@divkitframework/divkit
Version:
DivKit for the web
1,296 lines • 377 kB
JavaScript
var pl = Object.defineProperty;
var _l = (r, t, e) => t in r ? pl(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
var Er = (r, t, e) => _l(r, typeof t != "symbol" ? t + "" : t, e);
/*!
DivKit v32.6.0
https://github.com/divkit/divkit
@licence Apache-2.0
*/
function j() {
}
const ml = (r) => r;
function bl(r) {
return r();
}
function yl() {
return /* @__PURE__ */ Object.create(null);
}
function rs(r) {
r.forEach(bl);
}
function wl(r) {
return typeof r == "function";
}
function $l(r, t) {
return r != r ? t == t : r !== t || r && typeof r == "object" || typeof r == "function";
}
function b(r, ...t) {
if (r == null) {
for (const i of t)
i(void 0);
return j;
}
const e = r.subscribe(...t);
return e.unsubscribe ? () => e.unsubscribe() : e;
}
function jl(r) {
let t;
return b(r, (e) => t = e)(), t;
}
function Al(r, t, { bubbles: e = !1, cancelable: i = !1 } = {}) {
return new CustomEvent(r, { detail: t, bubbles: e, cancelable: i });
}
let xn;
function kn(r) {
xn = r;
}
function _o() {
if (!xn) throw new Error("Function called outside component initialization");
return xn;
}
function Wr(r) {
_o().$$.on_destroy.push(r);
}
function kl() {
const r = _o();
return (t, e, { cancelable: i = !1 } = {}) => {
const n = r.$$.callbacks[t];
if (n) {
const o = Al(
/** @type {string} */
t,
e,
{ cancelable: i }
);
return n.slice().forEach((l) => {
l.call(r, o);
}), !o.defaultPrevented;
}
return !0;
};
}
function Ui(r, t) {
return _o().$$.context.set(r, t), t;
}
function pr(r) {
return _o().$$.context.get(r);
}
const bn = [], ks = [];
let Gn = [];
const xs = [], Va = /* @__PURE__ */ Promise.resolve();
let Oo = !1;
function xl() {
Oo || (Oo = !0, Va.then(Cl));
}
function Ai() {
return xl(), Va;
}
function El(r) {
Gn.push(r);
}
const ko = /* @__PURE__ */ new Set();
let Zi = 0;
function Cl() {
if (Zi !== 0)
return;
const r = xn;
do {
try {
for (; Zi < bn.length; ) {
const t = bn[Zi];
Zi++, kn(t), Sl(t.$$);
}
} catch (t) {
throw bn.length = 0, Zi = 0, t;
}
for (kn(null), bn.length = 0, Zi = 0; ks.length; ) ks.pop()();
for (let t = 0; t < Gn.length; t += 1) {
const e = Gn[t];
ko.has(e) || (ko.add(e), e());
}
Gn.length = 0;
} while (bn.length);
for (; xs.length; )
xs.pop()();
Oo = !1, ko.clear(), kn(r);
}
function Sl(r) {
if (r.fragment !== null) {
r.update(), rs(r.before_update);
const t = r.dirty;
r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, t), r.after_update.forEach(El);
}
}
function Fl(r) {
return (r == null ? void 0 : r.length) !== void 0 ? r : Array.from(r);
}
const Vl = (
/** @type {const} */
[
"allowfullscreen",
"allowpaymentrequest",
"async",
"autofocus",
"autoplay",
"checked",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"inert",
"ismap",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected"
]
), Il = /* @__PURE__ */ new Set([...Vl]), Dl = /[&"<]/g, Tl = /[&<]/g;
function ot(r, t = !1) {
const e = String(r), i = t ? Dl : Tl;
i.lastIndex = 0;
let n = "", o = 0;
for (; i.test(e); ) {
const l = i.lastIndex - 1, c = e[l];
n += e.substring(o, l) + (c === "&" ? "&" : c === '"' ? """ : "<"), o = l + 1;
}
return n + e.substring(o);
}
const Ml = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
function Es(r) {
return Ml.test(r) || r.toLowerCase() === "!doctype";
}
const Pl = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
function an(r, t) {
const e = Object.assign({}, ...r);
if (t) {
const n = t.classes, o = t.styles;
n && (e.class == null ? e.class = n : e.class += " " + n), o && (e.style == null ? e.style = zo(o) : e.style = zo(
Ol(e.style, o)
));
}
let i = "";
return Object.keys(e).forEach((n) => {
if (Pl.test(n)) return;
const o = e[n];
o === !0 ? i += " " + n : Il.has(n.toLowerCase()) ? o && (i += " " + n) : o != null && (i += ` ${n}="${o}"`);
}), i;
}
function Ol(r, t) {
const e = {};
for (const i of r.split(";")) {
const n = i.indexOf(":"), o = i.slice(0, n).trim(), l = i.slice(n + 1).trim();
o && (e[o] = l);
}
for (const i in t) {
const n = t[i];
n ? e[i] = n : delete e[i];
}
return e;
}
function Lr(r) {
return typeof r == "string" || r && typeof r == "object" ? ot(r, !0) : r;
}
function ln(r) {
const t = {};
for (const e in r)
t[e] = Lr(r[e]);
return t;
}
function Ir(r, t) {
r = Fl(r);
let e = "";
for (let i = 0; i < r.length; i += 1)
e += t(r[i], i);
return e;
}
const zl = {
$$render: () => ""
};
function Jt(r, t) {
if (!r || !r.$$render)
throw t === "svelte:component" && (t += " this={...}"), new Error(
`<${t}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${t}>.`
);
return r;
}
let xo;
function yr(r) {
function t(e, i, n, o, l) {
const c = xn, h = {
on_destroy: xo,
context: new Map(l || (c ? c.$$.context : [])),
// these will be immediately discarded
on_mount: [],
before_update: [],
after_update: [],
callbacks: yl()
};
kn({ $$: h });
const d = r(e, i, n, o);
return kn(c), d;
}
return {
render: (e = {}, { $$slots: i = {}, context: n = /* @__PURE__ */ new Map() } = {}) => {
xo = [];
const o = { title: "", head: "", css: /* @__PURE__ */ new Set() }, l = t(o, e, {}, i, n);
return rs(xo), {
html: l,
css: {
code: Array.from(o.css).map((c) => c.code).join(`
`),
map: null
// TODO
},
head: o.title + o.head
};
},
$$render: t
};
}
function $(r, t, e) {
if (t == null || e) return "";
const i = `="${ot(t, !0)}"`;
return ` ${r}${i}`;
}
function zo(r) {
return Object.keys(r).filter((t) => r[t] != null && r[t] !== "").map((t) => `${t}: ${Lr(r[t])};`).join(" ");
}
function Or(r) {
const t = zo(r);
return t ? ` style="${t}"` : "";
}
const Qi = [];
function Nl(r, t) {
return {
subscribe: ji(r, t).subscribe
};
}
function ji(r, t = j) {
let e;
const i = /* @__PURE__ */ new Set();
function n(c) {
if ($l(r, c) && (r = c, e)) {
const h = !Qi.length;
for (const d of i)
d[1](), Qi.push(d, r);
if (h) {
for (let d = 0; d < Qi.length; d += 2)
Qi[d][0](Qi[d + 1]);
Qi.length = 0;
}
}
}
function o(c) {
n(c(r));
}
function l(c, h = j) {
const d = [c, h];
return i.add(d), i.size === 1 && (e = t(n, o) || j), c(r), () => {
i.delete(d), i.size === 0 && e && (e(), e = null);
};
}
return { set: n, update: o, subscribe: l };
}
function gn(r, t, e) {
const i = !Array.isArray(r), n = i ? [r] : r;
if (!n.every(Boolean))
throw new Error("derived() expects stores as input, got a falsy value");
const o = t.length < 2;
return Nl(e, (l, c) => {
let h = !1;
const d = [];
let p = 0, S = j;
const D = () => {
if (p)
return;
S();
const R = t(i ? d[0] : d, l, c);
o ? l(R) : S = wl(R) ? R : j;
}, N = n.map(
(R, K) => b(
R,
(F) => {
d[K] = F, p &= ~(1 << K), h && D();
},
() => {
p |= 1 << K;
}
)
);
return h = !0, D(), function() {
rs(N), S(), h = !1;
};
});
}
const Rl = "divkit-6d515", Bl = "divkit-27458", Ll = "divkit-82db1", Hl = "divkit-be734", Wl = "divkit-9a652", Pr = {
root_platform_desktop: Rl,
root__clickable: Bl,
"root__clickable-no-transition": "divkit-3bb57",
"root__any-actions": "divkit-ba614",
root: Ll,
root__selectable: Hl,
root__unselectable: Wl,
"root__only-desktop": "divkit-316e7",
"root_restrict-scroll": "divkit-0a135",
"root_disabled-context-menu": "divkit-f5cb3"
}, Nr = Symbol("root");
function V(r, t = {}) {
const e = r;
return e.level = t.level || "error", t.additional && (e.additional = t.additional), e;
}
const Ul = "divkit-bf0ea", Gl = "divkit-27458", ql = "divkit-05991", Jl = "divkit-80cac", Yl = "divkit-90c49", Kl = "divkit-b33bc", Xl = "divkit-f6ff9", No = {
outer: Ul,
root__clickable: Gl,
"root__clickable-no-transition": "divkit-3bb57",
"outer_hide-on-transition-in": "divkit-c5f24",
"outer_halign-self_start": "divkit-002ec",
"outer_halign-self_center": "divkit-204f8",
"outer_halign-self_end": "divkit-bd7ba",
"outer_halign-self_stretch": "divkit-02d12",
"outer_valign-self_start": "divkit-fd8aa",
"outer_valign-self_center": "divkit-62df2",
"outer_valign-self_end": "divkit-819a0",
"outer_valign-self_stretch": "divkit-8a331",
"outer_parent-flex_vertical": "divkit-46b27",
"outer_parent-flex_horizontal": "divkit-be075",
"outer_valign-self_baseline": "divkit-2b876",
outer_width_content: ql,
outer_height_content: Jl,
"outer_width-constrained": "divkit-5bdb7",
"outer_parent-grid": "divkit-47ef2",
"outer_height-constrained": "divkit-351c8",
"outer_parent-overlap": "divkit-747b0",
"outer_scroll-snap_start": "divkit-91fd4",
"outer_scroll-snap_center": "divkit-c525d",
"outer_scroll-snap_end": "divkit-67470",
outer__border: Yl,
outer_visibility_invisible: Kl,
outer_visibility_gone: Xl,
"outer_has-action-animation": "divkit-4d4f3",
"outer_has-custom-focus": "divkit-b630e"
};
function ur(r) {
if (!r)
return;
let t = "";
for (const e in r)
if (r.hasOwnProperty(e)) {
if (!r[e] && r[e] !== 0)
continue;
t && (t += ";"), t += e + ":" + String(r[e]);
}
return t || void 0;
}
function Ve(r) {
if (typeof r != "number" && typeof r != "string" || !r)
return "0";
const t = Number(r);
return Number.isNaN(t) ? "0" : Math.ceil(t * 1e3) / 1e4 + "em";
}
function Hr(r) {
let t = Ve(r);
return t === "0" && (t += "em"), t;
}
function Ia(r, t) {
for (; r.length < t; )
r = "0" + r;
return r;
}
function or(r, t = 1, e = "transparent") {
if (r = (typeof r == "string" && r || "").toLowerCase(), r.charAt(0) !== "#")
return e;
const i = ki(r);
return i ? (i.a *= t, is(i)) : e;
}
function Zl(r, t, e = "transparent") {
if (r = (typeof r == "string" && r || "").toLowerCase(), r.charAt(0) !== "#")
return e;
const i = ki(r);
return i ? (i.a = t, is(i)) : e;
}
function is(r) {
return r.a === 255 ? `#${[r.r, r.g, r.b].map((t) => Ia(Math.round(t).toString(16), 2)).join("")}` : `rgba(${r.r},${r.g},${r.b},${(r.a / 255).toFixed(2)})`;
}
function ki(r) {
const t = (
// #AARRGGBB
r.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i) || // #ARGB
r.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])$/i) || // #RRGGBB
r.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i) || // #RGB
r.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i)
);
if (t) {
if (t.length === 5) {
const [d, p, S, D, N] = t, R = S.length === 2 ? S : S + S, K = D.length === 2 ? D : D + D, F = N.length === 2 ? N : N + N, k = p.length === 2 ? p : p + p;
return {
a: parseInt(k, 16),
r: parseInt(R, 16),
g: parseInt(K, 16),
b: parseInt(F, 16)
};
}
const [e, i, n, o] = t, l = i.length === 2 ? i : i + i, c = n.length === 2 ? n : n + n, h = o.length === 2 ? o : o + o;
return {
a: 255,
r: parseInt(l, 16),
g: parseInt(c, 16),
b: parseInt(h, 16)
};
}
return null;
}
function Ro(r) {
let t = String(r);
return t.indexOf("&") > -1 && (t = t.replace(/&/g, "&")), t.indexOf("<") > -1 && (t = t.replace(/</g, "<")), t.indexOf(">") > -1 && (t = t.replace(/>/g, ">")), t.indexOf('"') > -1 && (t = t.replace(/"/g, """)), t;
}
const Ci = Boolean;
function mo(r, t) {
if (r.length === 1 && r[0].type === "solid")
return ec({
bg: r[0]
});
const e = r.map((i) => {
if (i.type === "solid")
return Ql({
bg: i
});
if (i.type === "gradient")
return tc({
bg: i
});
if (i.type === "image")
return nc({
bg: i,
direction: t
});
if (i.type === "radial_gradient")
return ic({
bg: i
});
}).filter(Ci).reverse().reduce(function(i, n) {
return i.image.push(n.image), i.size.push(n.size || "auto"), i.position.push(n.pos || "50% 50%"), i;
}, {
image: [],
size: [],
position: []
});
return {
image: e.image.join(","),
size: e.size.join(","),
position: e.position.join(",")
};
}
function Ql(r) {
const t = or(r.bg.color || "transparent");
return {
size: void 0,
pos: void 0,
image: `linear-gradient(to bottom,${t},${t})`
};
}
function ec(r) {
return {
color: or(r.bg.color || "transparent"),
size: "auto",
position: "50% 50%"
};
}
function Da(r) {
return r.every((i) => i.color && typeof i.position == "number" && i.position >= 0 && i.position <= 1) ? r.sort((i, n) => Math.abs(i.position - n.position) < 1e-6 ? 0 : i.position - n.position).map((i) => `${or(i.color)} ${(i.position * 100).toFixed(2)}%`).join(",") : void 0;
}
function tc(r) {
var i, n, o, l;
if (!Array.isArray((i = r.bg) == null ? void 0 : i.colors) && !Array.isArray((n = r.bg) == null ? void 0 : n.color_map))
return;
const t = (o = r.bg.colors) == null ? void 0 : o.filter(Ci);
if (!(t != null && t.length) && !((l = r.bg) != null && l.color_map))
return;
let e;
if (r.bg.color_map) {
const c = Da(r.bg.color_map);
if (!c)
return;
e = "linear-gradient(" + (90 - Number(r.bg.angle || 0) + "deg") + "," + c + ")";
} else {
if (!t)
return;
e = "linear-gradient(" + (90 - Number(r.bg.angle || 0) + "deg") + "," + t.map((c) => or(c)).join(",") + ")";
}
return {
size: void 0,
pos: void 0,
image: e
};
}
const rc = {
nearest_corner: "closest-corner",
farthest_corner: "farthest-corner",
nearest_side: "closest-side",
farthest_side: "farthest-side"
};
function Cs(r) {
if (r && typeof r == "object" && "type" in r && r.value !== void 0) {
if (r.type === "fixed")
return Hr(r.value);
if (r.type === "relative")
return `${Number(r.value) * 100}%`;
}
return "50%";
}
function ic(r) {
var c, h, d, p;
if (!Array.isArray((c = r.bg) == null ? void 0 : c.colors) && !Array.isArray((h = r.bg) == null ? void 0 : h.color_map))
return;
const t = (d = r.bg.colors) == null ? void 0 : d.filter(Ci);
if (!(t != null && t.length) && !((p = r.bg) != null && p.color_map))
return;
let e;
if (r.bg.color_map ? e = Da(r.bg.color_map) : t && (e = t.map((S) => or(S)).join(",")), !e)
return;
const i = r.bg.radius;
let n;
i && typeof i == "object" && "type" in i && i.value !== void 0 && (i.type === "fixed" ? n = Hr(i.value) : i.type === "relative" && (n = rc[i.value]));
const o = Cs(r.bg.center_x), l = Cs(r.bg.center_y);
return {
size: void 0,
pos: void 0,
image: `radial-gradient(circle ${n || "farthest-corner"} at ${o} ${l},` + e + ")"
};
}
function nc(r) {
var e;
const t = (e = r.bg) == null ? void 0 : e.image_url;
if (t)
return {
size: Ta(r.bg.scale),
pos: Ma(r.bg, r.direction),
image: 'url("' + Ro(t) + '")'
};
}
function Ta(r) {
return r === "fit" ? "contain" : r === "stretch" ? "fill" : r === "no_scale" ? "none" : "cover";
}
function Ma(r, t) {
let e, i;
return r.content_alignment_horizontal === "left" || t === "ltr" && r.content_alignment_horizontal === "start" || t === "rtl" && r.content_alignment_horizontal === "end" ? e = "0%" : r.content_alignment_horizontal === "right" || t === "ltr" && r.content_alignment_horizontal === "end" || t === "rtl" && r.content_alignment_horizontal === "start" ? e = "100%" : e = "50%", r.content_alignment_vertical === "top" ? i = "0%" : r.content_alignment_vertical === "bottom" ? i = "100%" : i = "50%", e + " " + i;
}
function Vr(r, t) {
const e = Number(r);
return Number.isNaN(e) || e < 0 ? t : e;
}
function Ss(r, t, e) {
return typeof t == "number" && (r && t > 0 && t <= 100 || !r && t >= 0 && t < 100) ? t : e;
}
function oc(r) {
return r.is_enabled !== 0 && r.is_enabled !== !1 && r.index !== void 0;
}
function sc(r, {
visibilityActions: t,
disappearActions: e,
rootCtx: i,
componentContext: n
}) {
const o = [];
t && t.forEach((N) => {
o.push({
type: "visibility",
index: o.length,
action: N,
visible: !1,
count: 0,
finished: !1
});
}), e && e.forEach((N) => {
o.push({
type: "disappear",
index: o.length,
action: N,
// false, so disappear only works after the element becomes visible
visible: !1,
count: 0,
finished: !1
});
});
const l = o.map((N, R) => {
const K = N.type === "visibility";
return n.getDerivedFromVars({
index: R,
visibility_percentage: N.action.visibility_percentage,
visibility_duration: K ? N.action.visibility_duration : N.action.disappear_duration,
log_limit: N.action.log_limit,
is_enabled: N.action.is_enabled
}, void 0, !0);
});
let c;
const h = () => {
c && c.disconnect(), o.forEach((N) => {
N.timer && clearTimeout(N.timer);
});
}, d = gn(l, (N) => N);
let p;
const S = (N) => {
const R = N.type === "visibility";
n.execAnyActions([N.action], {
logType: R ? "visible" : "disappear",
node: r,
processUrls: !1
});
}, D = d.subscribe((N) => {
p = N.filter(oc);
const R = {};
p.forEach((k) => {
R[k.index] = k;
}), h();
const K = [...new Set(p.map((k) => {
const Ee = o[k.index].type === "visibility";
return Ss(
Ee,
k.visibility_percentage,
Ee ? 50 : 0
) / 100;
}))];
if (!K.length)
return;
const F = (k) => {
k.forEach((Ee) => {
p.forEach((X) => {
const he = o[X.index], ae = he.type === "visibility", ve = Ss(
ae,
X.visibility_percentage,
ae ? 50 : 0
);
let ce;
ve === 0 ? ce = Ee.intersectionRatio >= 1e-12 : ce = Ee.intersectionRatio >= ve / 100, (ae ? !he.visible && ce : he.visible && !ce) ? he.finished || (he.timer = setTimeout(() => {
++he.count;
const fe = X.log_limit === 0 ? 1 / 0 : X.log_limit || 1;
he.count >= fe && (he.finished = !0), S(he);
}, Vr(X.visibility_duration, 800))) : (ae ? !ce : ce) && he.timer && clearTimeout(he.timer), he.visible = ce;
});
});
};
c = new IntersectionObserver(F, {
threshold: K
}), c.observe(r);
});
return {
destroy() {
p == null || p.forEach((N) => {
const R = o[N.index];
!R || R.type !== "disappear" || !R.visible || R.finished || i.registerTimeout(window.setTimeout(() => {
S(R);
}, N.visibility_duration));
}), h(), D();
}
};
}
function Fs(r, t) {
t && r.push(t);
}
function er(r, t, e) {
const i = [];
Fs(i, t[r]);
for (const n in e)
if (e.hasOwnProperty(n)) {
const o = e[n];
if (o) {
const l = `${r}_${n}` + (typeof o == "string" ? `_${o}` : "");
Fs(i, t[l]);
}
}
return i.join(" ");
}
const ns = Symbol("state");
function xi(r, t) {
var l, c;
const e = r.top || 0, i = ((l = t === "ltr" ? r.end : r.start) != null ? l : r.right) || 0, n = r.bottom || 0, o = ((c = t === "ltr" ? r.start : r.end) != null ? c : r.left) || 0;
return e === 0 && i === 0 && n === 0 && o === 0 ? "" : Ve(e) + " " + Ve(i) + " " + Ve(n) + " " + Ve(o);
}
function bo(r) {
if (typeof r != "number" && typeof r != "string")
return !1;
const t = Number(r);
return !Number.isNaN(t);
}
function ni(r) {
return bo(r) && r >= 0;
}
function fo(r, t, e) {
var n, o;
if (!r)
return e;
const i = [
r.top,
(n = t === "ltr" ? r.end : r.start) != null ? n : r.right,
r.bottom,
(o = t === "ltr" ? r.start : r.end) != null ? o : r.left
];
for (let l = 0; l < i.length; ++l)
if (i[l] && !ni(i[l]))
return e;
return xi(r, t);
}
function ac(r, t) {
return !ni(r) || r === void 0 || r > 1 ? t : Number(r);
}
const lc = Object.prototype.hasOwnProperty;
function os(r, t) {
if (Object.is(r, t))
return !0;
if (typeof r != "object" || r === null || typeof t != "object" || t === null)
return Object.is(r, t);
const e = Object.keys(r), i = Object.keys(t);
if (e.length !== i.length)
return !1;
for (let n = 0; n < e.length; n++) {
const o = e[n];
if (!lc.call(t, o) || !os(r[o], t[o]))
return !1;
}
return !0;
}
function Mi(r, t) {
return os(r, t) ? t : r;
}
function cc(r, t) {
return r === "visible" || r === "invisible" || r === "gone" ? r : t;
}
function Pa(r, t) {
return r === "linear" || r === "ease" || r === "ease_in_out" || r === "ease_in" || r === "ease_out" ? r : t;
}
function sn(r, t) {
const e = Number(r);
return Number.isNaN(e) ? t : e;
}
function Oa(r) {
const t = [];
return r.name === "set" ? (r.items || []).forEach((e) => {
t.push(...Oa(e));
}) : t.push(r), t;
}
function hn(r, t) {
if (!r || typeof r != "object")
return t;
const e = [
"top",
"right",
"bottom",
"left"
];
for (let i = 0; i < e.length; ++i)
if (r[e[i]] && !ni(r[e[i]]))
return t;
return r;
}
function uc(r, t) {
if (!r && !t)
return {};
if (!t)
return r;
if (!r)
return t;
const e = {};
return [
"top",
"right",
"bottom",
"left",
"start",
"end"
].forEach((i) => {
const n = r[i];
n && (e[i] = n);
const o = t[i];
o && (e[i] = (e[i] || 0) + o);
}), e;
}
function dc(r, t) {
const e = [
r["top-left"],
r["top-right"],
r["bottom-right"],
r["bottom-left"]
];
for (let i = 0; i < e.length; ++i)
if (e[i] && !ni(e[i]))
return t;
return r;
}
function qn(r, t = 0, e = 10) {
return [
r["top-left"],
r["top-right"],
r["bottom-right"],
r["bottom-left"]
].map((i) => Ve((i || t) / e * 10)).join(" ");
}
function fc(r) {
var t, e, i, n, o, l;
return Ve(((e = (t = r.offset) == null ? void 0 : t.x) == null ? void 0 : e.value) || 0) + " " + Ve(((n = (i = r.offset) == null ? void 0 : i.y) == null ? void 0 : n.value) || 0) + " " + Ve((o = r.blur) != null ? o : 2) + " " + or(r.color || "#000000", (l = r.alpha) != null ? l : 0.19);
}
function gc(r, t) {
var e, i, n, o, l, c;
return "drop-shadow(" + or(r.color || "#000000", (e = r.alpha) != null ? e : 0.19) + " " + Ve((((n = (i = r.offset) == null ? void 0 : i.x) == null ? void 0 : n.value) || 0) * 10 / t) + " " + Ve((((l = (o = r.offset) == null ? void 0 : o.y) == null ? void 0 : l.value) || 0) * 10 / t) + " " + Ve(((c = r.blur) != null ? c : 2) * 10 / t) + ")";
}
function ss(r) {
return r.is_enabled !== 0 && r.is_enabled !== !1;
}
let Eo;
function hc() {
return typeof matchMedia > "u" ? !1 : (Eo || (Eo = window.matchMedia("(prefers-reduced-motion)")), Eo.matches);
}
const vc = 8, pc = (r, t, e, i) => {
let n;
return (e || i) && typeof ResizeObserver < "u" && (n = new ResizeObserver(async () => {
let o = 0;
const l = {}, c = (d, p) => {
if (d) {
const S = t.getVariable(d, "integer");
if (S) {
if (p = Math.round(p), l[d] || (l[d] = /* @__PURE__ */ new Set()), !l[d].has(p))
return S.setValue(p), l[d].add(p), !0;
} else {
const D = new Error("Missing variable");
D.level = "error", D.additional = {
variableName: d
}, t.logError(D);
}
}
return !1;
}, h = () => {
if (!r)
return !1;
const d = r.getBoundingClientRect(), p = c(e, d.width), S = c(i, d.height);
return p || S;
};
for (; h(); ) {
if (++o > vc) {
const d = new Error("Recursive layout in size_provider");
d.level = "warn", d.additional = {
widthVariableName: e,
heightVariableName: i
}, t.logError(d);
break;
}
await Ai();
}
}), n.observe(r)), n;
}, as = Symbol("enabled");
function Zr(r, t) {
return r === 1 || r === 0 || r === !1 || r === !0 ? !!r : t;
}
function cn(r) {
return [
r.state_description,
r.description,
r.hint
].filter(Boolean).join(", ");
}
const un = 2, _c = "divkit-ee5cc", mc = {
actionable__button: _c
};
function bc() {
}
const qi = Symbol("action");
function za(r) {
if (r.startsWith("tel:"))
return "tel";
const t = /^([^/]+):\/\//.exec(r);
return t && t[1] || "";
}
function Na(r, t) {
return t.has(r);
}
const yc = /* @__PURE__ */ new Set(["button", "image", "checkbox", "radio", "header"]), yo = yr((r, t, e, i) => {
let n, o, l = j, c = () => (l(), l = b(n, (ne) => o = ne), n), { componentContext: h } = t, { id: d = "" } = t, { actions: p = void 0 } = t, { doubleTapActions: S = void 0 } = t, { longTapActions: D = void 0 } = t, { pressStartActions: N = void 0 } = t, { pressEndActions: R = void 0 } = t, { hoverStartActions: K = void 0 } = t, { hoverEndActions: F = void 0 } = t, { cls: k = "" } = t, { style: Ee = null } = t, { attrs: X = void 0 } = t, { use: he = bc } = t, { customAction: ae = null } = t, { isNativeActionAnimation: ve = !0 } = t, { hasInnerFocusable: ce = !1 } = t, { customAccessibility: xe = void 0 } = t, { captureFocusOnAction: Y = !0 } = t;
const fe = pr(Nr), Ae = pr(qi);
Ui(qi, {
hasAction() {
return !!(Ae.hasAction() || p != null && p.length || (xe == null ? void 0 : xe.mode) === "exclude");
}
});
let ie, Se = "", Je, Re = null, De = !1, Ye, Ie, Ge = !1;
function T(ne) {
}
function ue(ne) {
Ae.hasAction();
}
Wr(() => {
typeof window < "u" && (window.removeEventListener("pointermove", T), window.removeEventListener("pointerup", ue), window.removeEventListener("pointercancel", ue)), d && !ce && fe.unregisterFocusable(d);
}), t.componentContext === void 0 && e.componentContext && h !== void 0 && e.componentContext(h), t.id === void 0 && e.id && d !== void 0 && e.id(d), t.actions === void 0 && e.actions && p !== void 0 && e.actions(p), t.doubleTapActions === void 0 && e.doubleTapActions && S !== void 0 && e.doubleTapActions(S), t.longTapActions === void 0 && e.longTapActions && D !== void 0 && e.longTapActions(D), t.pressStartActions === void 0 && e.pressStartActions && N !== void 0 && e.pressStartActions(N), t.pressEndActions === void 0 && e.pressEndActions && R !== void 0 && e.pressEndActions(R), t.hoverStartActions === void 0 && e.hoverStartActions && K !== void 0 && e.hoverStartActions(K), t.hoverEndActions === void 0 && e.hoverEndActions && F !== void 0 && e.hoverEndActions(F), t.cls === void 0 && e.cls && k !== void 0 && e.cls(k), t.style === void 0 && e.style && Ee !== void 0 && e.style(Ee), t.attrs === void 0 && e.attrs && X !== void 0 && e.attrs(X), t.use === void 0 && e.use && he !== void 0 && e.use(he), t.customAction === void 0 && e.customAction && ae !== void 0 && e.customAction(ae), t.isNativeActionAnimation === void 0 && e.isNativeActionAnimation && ve !== void 0 && e.isNativeActionAnimation(ve), t.hasInnerFocusable === void 0 && e.hasInnerFocusable && ce !== void 0 && e.hasInnerFocusable(ce), t.customAccessibility === void 0 && e.customAccessibility && xe !== void 0 && e.customAccessibility(xe), t.captureFocusOnAction === void 0 && e.captureFocusOnAction && Y !== void 0 && e.captureFocusOnAction(Y), Ge = (xe == null ? void 0 : xe.mode) === "exclude", c(n = h.getDerivedFromVars(p, void 0, !0));
{
if (Array.isArray(o) && (o != null && o.length))
for (let ne = 0; ne < o.length; ++ne) {
const Fe = o[ne].url;
if (Fe) {
Se = Fe, Je = o[ne].target || void 0;
break;
}
}
De = !!ae, (Se || Array.isArray(o) && (o != null && o.length)) && (Ae.hasAction() || Ge) ? (Se = "", h.logError(V(new Error("Actionable element is forbidden inside other actionable element or inside accessibility mode=exlucde"), {
level: "warn",
additional: { actions: o }
}))) : Se && !Na(za(Se), fe.getBuiltinProtocols()) ? (Se = "", De = !0) : !Se && Array.isArray(o) && (o != null && o.length) && (De = !0, o.some((ne) => ne.url || ne.typed || ne.menu_items) || h.logError(V(new Error("The component has a list of actions, but does not have a real action"), {
level: "warn",
additional: { actions: o }
})));
}
return xe != null && xe.type && yc.has(xe.type) ? xe.type === "header" ? Ye = "heading" : Ye = xe.type : Se ? Ye = void 0 : De && (Ye = "button"), (Ye === "checkbox" || Ye === "radio") && typeof (xe == null ? void 0 : xe.is_checked) == "boolean" ? Ie = xe.is_checked : Ie = void 0, l(), `${Se ? `<a${an(
[
{ href: Lr(Se) },
{ target: Lr(Je) },
{ style: Lr(Ee) },
{ role: Lr(Ye) },
{
"aria-checked": Lr(Ie)
},
{
class: ot(k, !0) + " " + ot(Pr["root__any-actions"], !0) + " " + ot(
ve ? Pr.root__clickable : Pr["root__clickable-no-transition"],
!0
) + " " + ot(
D != null && D.length ? Pr["root_disabled-context-menu"] : "",
!0
)
},
{
tabindex: Lr(h.fakeElement === un ? -1 : null)
},
ln(X)
],
{}
)}${$("this", ie, 0)}>${i.default ? i.default({}) : ""}</a>` : `${De ? `<button${an(
[
{
class: ot(k, !0) + " " + ot(mc.actionable__button, !0) + " " + ot(Pr["root__any-actions"], !0) + ot(
` ${ve ? Pr.root__clickable : Pr["root__clickable-no-transition"]} ${Pr.root__unselectable}`,
!0
) + " " + ot(
D != null && D.length ? Pr["root_disabled-context-menu"] : "",
!0
)
},
{ style: Lr(Ee) },
{ role: Lr(Ye) },
{
"aria-checked": Lr(Ie)
},
{ type: "button" },
{
tabindex: Lr(h.fakeElement === un ? -1 : null)
},
ln(X)
],
{}
)}${$("this", ie, 0)}>${i.default ? i.default({}) : ""}</button>` : `<span${an(
[
{
class: ot(k, !0) + " " + ot(
D != null && D.length ? Pr["root_disabled-context-menu"] : "",
!0
) + " " + ot("", !0)
},
{ style: Lr(Ee) },
{ role: Lr(Ye) },
{
"aria-checked": Lr(Ie)
},
{
"aria-hidden": Lr(Ge || void 0)
},
ln(X)
],
{}
)}${$("this", ie, 0)}>${i.default ? i.default({}) : ""}</span>`}`}`;
}), Fn = {
"outer-background": "divkit-7b038",
"outer-background_clip": "divkit-8fdbd",
"outer-background__item": "divkit-f9881",
"outer-background__item_hidden": "divkit-ea047"
};
function ai(r) {
return bo(r) && r > 0;
}
function Ra(r, t) {
return r.map((e) => {
if (!e) {
t(V(new Error("Incorrect filter"), {
level: "warn"
}));
return;
}
if (e.type === "blur") {
if (ai(e.radius))
return `blur(${Hr(e.radius / 2)})`;
} else {
if (e.type === "rtl_mirror")
return;
t(V(new Error("Unknown filter"), {
level: "warn",
additional: {
filter: e.type
}
}));
}
}).filter(Boolean).join(" ");
}
const wc = yr((r, t, e, i) => {
let n, { direction: o } = t, { componentContext: l } = t, { background: c = [] } = t, { radius: h = "" } = t;
return t.direction === void 0 && e.direction && o !== void 0 && e.direction(o), t.componentContext === void 0 && e.componentContext && l !== void 0 && e.componentContext(l), t.background === void 0 && e.background && c !== void 0 && e.background(c), t.radius === void 0 && e.radius && h !== void 0 && e.radius(h), n = c.map((d) => {
const p = {}, S = { style: p };
if (d.type === "nine_patch_image" && d.insets)
p["border-image"] = `url("${d.image_url}") ${d.insets.top || 0} ${d.insets.right || 0} ${d.insets.bottom || 0} ${d.insets.left || 0} fill`, p["border-image-width"] = "auto";
else {
const D = mo([d], o);
d.type === "solid" && (p["background-color"] = D.color), d.type === "gradient" && (p["background-image"] = D.image), d.type === "image" && (p.opacity = Number(d.alpha), S.image_url = d.image_url, p["object-fit"] = D.size, p["object-position"] = D.position, Array.isArray(d.filters) && d.filters.length && (p.filter = Ra(d.filters, l.logError), o === "rtl" && d.filters.some((N) => N.type === "rtl_mirror") && (p.transform = "scale(-1,1)")));
}
return S;
}), `<span${$("class", Fn["outer-background"] + (h ? " " + Fn["outer-background_clip"] : ""), 0)}${Or({ "border-radius": h })}>${Ir(n, (d) => `${d.image_url ? `<img${$("src", d.image_url, 0)} alt="" aria-hidden="true" loading="lazy" decoding="async"${$("class", Fn["outer-background__item"], 0)}${$("style", ur(d.style), 0)}>` : `<span${$("class", Fn["outer-background__item"], 0)}${$("style", ur(d.style), 0)}></span>`}`)}</span>`;
}), $c = {
left: "start",
center: "center",
right: "end",
start: "start",
end: "end"
}, jc = {
left: "end",
center: "center",
right: "start",
start: "start",
end: "end"
}, Ac = {
top: "start",
center: "center",
bottom: "end",
baseline: "baseline"
}, Co = (r) => `The component id with the "${r}" property for state change is missing. Either specify the id, or specify the "transition_trigger" property without "state_change" value.`;
function kc(r) {
return r.some((t) => t.name === "native");
}
const oi = yr((r, t, e, i) => {
var vr, Bi, Si, Li, bi, bs, ys, ws, $s, js, As;
let n, o, l, c, h, d, p, S, D, N, R, K, F, k, Ee, X, he, ae, ve, ce, xe, Y, fe, Ae = j, ie = () => (Ae(), Ae = b(Ee, (q) => fe = q), Ee), Se, Je = j, Re = () => (Je(), Je = b(k, (q) => Se = q), k), De, Ye = j, Ie = () => (Ye(), Ye = b(X, (q) => De = q), X), Ge, T = j, ue = () => (T(), T = b(F, (q) => Ge = q), F), ne, Fe, ee, at = j, _t = () => (at(), at = b(K, (q) => ee = q), K), et, Oe = j, He = () => (Oe(), Oe = b(o, (q) => et = q), o), W, wt = j, Ce = () => (wt(), wt = b(R, (q) => W = q), R), Te, gt = j, ht = () => (gt(), gt = b(N, (q) => Te = q), N), Qe, Be = j, At = () => (Be(), Be = b(D, (q) => Qe = q), D), le, ft = j, mt = () => (ft(), ft = b(S, (q) => le = q), S), ge, vt = j, Le = () => (vt(), vt = b(h, (q) => ge = q), h), ut, B = j, _e = () => (B(), B = b(p, (q) => ut = q), p), We, Lt = j, ke = () => (Lt(), Lt = b(d, (q) => We = q), d), $t, st = j, Ht = () => (st(), st = b(c, (q) => $t = q), c), pt, Xe = j, Ne = () => (Xe(), Xe = b(l, (q) => pt = q), l), U, it, { componentContext: I } = t, { cls: be = "" } = t, { style: Tt = void 0 } = t, { layoutParams: O = {} } = t, { customDescription: Et = !1 } = t, { customPaddings: lt = !1 } = t, { customActions: we = "" } = t, { additionalPaddings: de = null } = t, { heightByAspect: St = !1 } = t, { parentOf: Ct = void 0 } = t, { parentOfSimpleMode: Ft = void 0 } = t, { replaceItems: Ut = void 0 } = t, { hasInnerFocusable: dr = !1 } = t, { alwaysCustomFocus: oe = !1 } = t;
const qe = pr(Nr), dt = pr(ns), { isEnabled: Vt } = pr(as);
it = b(Vt, (q) => U = q);
const Qt = qe.direction;
Fe = b(Qt, (q) => ne = q);
let It, zt, kt = null, Nt = [], Gt = {}, Mt = {}, Rt = !1, lr = 1, sr = "transparent", te = 0, Bt = {
"top-left": 0,
"top-right": 0,
"bottom-right": 0,
"bottom-left": 0
}, qt = "", G = null, x = "", L = {}, Ue, Z, C, pe = 0, ct = 0, Q = 0, xt = !1, $e = !1, Yt = {}, Me, Ur, Kr, s = 0, yt = 0, $r = 0, tr = !1, Wt = !1, E = 1, fr, ar, nt, _r, Tr = [], jr = !1, Ar = !1, Mr, Rr, P, ei = [], Jr = [], u = [], f = [], v = [], A = [], w = [], ye = [], H = [], Ke = [], Ze = "", re, bt, Pe, Xt, kr = !1, xr = "visible", gr = 0, Gr = 0, Dr, ti, me, Xr = !1, hi = !0, qr, ze, a, g;
function y() {
G = null, x = "", E = 1, kr = !1, xr = "visible", gr = 0, Gr = 0, Dr = void 0, ti = void 0, hi = !0, Tr = I.fakeElement ? [] : I.json.transition_triggers || ["state_change", "visibility_change"], jr = Tr.indexOf("state_change") !== -1, Ar = Tr.indexOf("visibility_change") !== -1, It && rt(It), ze == null || ze(), U && (ze = qe.processVariableTriggers(I, I.json.variable_triggers));
}
function _(q, jt) {
if (!Array.isArray(Ct) || !Ut || Ft && (Array.isArray(jt) ? jt.length : 0) !== 1)
return;
const Kt = Ct.findIndex((Dt) => (Dt == null ? void 0 : Dt.id) === q), rr = Ct.slice();
rr.splice(Kt, 1, ...(jt || []).map((Dt) => ({ json: Dt, id: Dt == null ? void 0 : Dt.id }))), Ct = rr, Ut(rr.map((Dt) => Dt == null ? void 0 : Dt.json));
}
function z(q) {
const jt = sn(q.start_value, 1), Kt = sn(q.end_value, 1), rr = Vr(q.start_delay, 0), Dt = hc() ? 0 : Vr(q.duration, 300), ir = Pa(q.interpolator, "ease_in_out").replace(/_/g, "-");
switch (q.name) {
case "fade":
return re = jt, bt = Kt, `opacity ${Dt}ms ${ir} ${rr}ms`;
case "scale":
return Pe = jt, Xt = Kt, `transform ${Dt}ms ${ir} ${rr}ms`;
case "native":
case "no_animation":
return "";
default:
return I.logError(V(new Error("Unknown action_animation name"), {
additional: { animation: q.name }
})), "";
}
}
async function M(q) {
xr = q;
const jt = q === "visible" ? "in" : "out", Kt = jt === "in" ? I.json.transition_in : I.json.transition_out;
if (Ar && Kt) {
let rr;
q === "gone" && (rr = It.getBoundingClientRect()), await Ai(), jt === "in" && (Rr = !0), dt.runVisibilityTransition(
{
...I.json,
visibility: "visible"
},
I,
Kt,
It,
jt,
rr
).then(() => {
jt === "in" && (Rr = !1);
}).catch((Dt) => {
throw jt === "in" && (Rr = !1), Dt;
});
}
}
function tt() {
if (kt && It) {
const q = qe.getExtensionContext(I);
kt.forEach((jt) => {
var Kt;
(Kt = jt.unmountView) == null || Kt.call(jt, It, q);
}), kt = null;
}
}
function rt(q) {
var Yr, vi, pi;
a == null || a.destroy(), It = q, jr && I.json.transition_in && (I.id ? dt.registerChildWithTransitionIn(I.json, I, I.json.transition_in, q).then(() => {
Mr = !1;
}).catch((mr) => {
throw Mr = !1, mr;
}) : I.logError(V(new Error(Co("transition_in")), { level: "warn" }))), jr && I.json.transition_out && (I.id ? dt.registerChildWithTransitionOut(I.json, I, I.json.transition_out, q) : I.logError(V(new Error(Co("transition_out")), { level: "warn" }))), I.fakeElement || (I.json.transition_change && !I.id && I.logError(V(new Error(Co("transition_change")), { level: "warn" })), dt.registerChildWithTransitionChange(I.json, I, I.json.transition_change, q).then(() => {
P = !1;
}).catch((mr) => {
throw P = !1, mr;
}));
const jt = !I.fakeElement || I.fakeElement === un, Kt = jt ? I.json.visibility_actions || I.json.visibility_action && [I.json.visibility_action] : [], rr = jt ? I.json.disappear_actions : [];
let Dt;
(Array.isArray(Kt) && Kt.length || Array.isArray(rr) && rr.length) && (Dt = sc(q, {
visibilityActions: Kt,
disappearActions: rr,
rootCtx: qe,
componentContext: I
}));
const ir = I.id;
return ir && (g == null || g(), g = qe.registerId(ir, {
context: () => I,
node: () => It
}), dt.registerChild(ir)), (Yr = I.json.tooltips) == null || Yr.forEach((mr) => {
qe.registerTooltip(q, mr);
}), me && (me.disconnect(), me = void 0), me = pc(It, I, (vi = I.json.layout_provider) == null ? void 0 : vi.width_variable_name, (pi = I.json.layout_provider) == null ? void 0 : pi.height_variable_name), a = {
destroy() {
g && (g(), g = void 0), ir && dt.unregisterChild(ir), Dt && Dt.destroy();
}
}, a;
}
function wr() {
I.json.focus && ((oe || !jl(qe.isPointerFocus)) && (Xr = !0), I.execAnyActions(f));
}
function cr() {
I.json.focus && (Xr = !1, I.execAnyActions(v));
}
Wr(() => {
var q;
Nt.forEach((jt) => {
qe.unregisterParentOf(jt);
}), Nt = [], me && (me.disconnect(), me = void 0), (q = I.json.tooltips) == null || q.forEach((jt) => {
qe.unregisterTooltip(jt);
}), ze == null || ze(), tt();
}), t.componentContext === void 0 && e.componentContext && I !== void 0 && e.componentContext(I), t.cls === void 0 && e.cls && be !== void 0 && e.cls(be), t.style === void 0 && e.style && Tt !== void 0 && e.style(Tt), t.layoutParams === void 0 && e.layoutParams && O !== void 0 && e.layoutParams(O), t.customDescription === void 0 && e.customDescription && Et !== void 0 && e.customDescription(Et), t.customPaddings === void 0 && e.customPaddings && lt !== void 0 && e.customPaddings(lt), t.customActions === void 0 && e.customActions && we !== void 0 && e.customActions(we), t.additionalPaddings === void 0 && e.additionalPaddings && de !== void 0 && e.additionalPaddings(de), t.heightByAspect === void 0 && e.heightByAspect && St !== void 0 && e.heightByAspect(St), t.parentOf === void 0 && e.parentOf && Ct !== void 0 && e.parentOf(Ct), t.parentOfSimpleMode === void 0 && e.parentOfSimpleMode && Ft !== void 0 && e.parentOfSimpleMode(Ft), t.replaceItems === void 0 && e.replaceItems && Ut !== void 0 && e.replaceItems(Ut), t.hasInnerFocusable === void 0 && e.hasInnerFocusable && dr !== void 0 && e.hasInnerFocusable(dr), t.alwaysCustomFocus === void 0 && e.alwaysCustomFocus && oe !== void 0 && e.alwaysCustomFocus(oe), n = I.origJson, n && y(), U ? (ze == null || ze(), ze = qe.processVariableTriggers(I, I.json.variable_triggers)) : ze == null || ze(), He(o = I.getDerivedFromVars(I.json.focus)), Ne(l = I.getDerivedFromVars(I.json.border)), Ht(c = I.getDerivedFromVars(I.json.paddings)), Le(h = I.getDerivedFromVars(I.json.margins)), ke(d = I.getDerivedFromVars(I.json.width)), _e(p = I.getDerivedFromVars(I.json.alignment_horizontal)), mt(S = I.getDerivedFromVars(I.json.height)), At(D = I.getDerivedFromVars(I.json.alignment_vertical)), ht(N = I.getDerivedFromVars(I.json.alpha)), Ce(R = I.getDerivedFromVars(I.json.accessibility)), _t(K = I.getDerivedFromVars(I.json.background)), ue(F = I.getDerivedFromVars(I.json.action_animation)), Re(k = I.getDerivedFromVars(I.json.visibility)), ie(Ee = I.getDerivedFromVars(I.json.transform)), Ie(X = I.getDerivedFromVars(I.json.capture_focus_on_action)), Nt.forEach((q) => {
qe.unregisterParentOf(q);
}), Nt = [], Ct && Ct.forEach((q) => {
q != null && q.id && (Nt.push(q.id), qe.registerParentOf(q.id, {
replaceWith: _,
isSingleMode: !!Ft
}));
});
{
const q = Xr && (et != null && et.border) ? et.border : pt;
let jt = {}, Kt = {}, rr = !1, Dt = "";
if (q) {
if (Zr(q.has_shadow, !1)) {
const ir = q.shadow;
ir ? jt["box-shadow"] = fc(ir) : jt["box-shadow"] = "0 1px 2px 0 rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.07)";
}
if (q.stroke) {
rr = !0, lr = Vr(q.stroke.width, lr), sr = or(q.stroke.color, 1, sr);
const ir = ((vr = q.stroke.style) == null ? void 0 : vr.type) === "dashed" ? "dashed" : "solid";
Kt["--divkit-border"] = `${Ve(lr + 1)} ${ir} ${sr}`;
}
if (q.corners_radius && typeof q.corners_radius == "object") {
Bt = dc(q.corners_radius, Bt), jt["border-radius"] = qn(Bt);
const ir = {};
["top-left", "top-right", "bottom-right", "bottom-left"].forEach((Yr) => {
ir[Yr] = (Bt[Yr] || 0) + 1;
}), Kt["--divkit-border-radius"] = qn(ir);
} else q.corner_radius && (te = Vr(q.corner_radius, te), Bt = {
"top-left": te,
"top-right": te,
"bottom-right": te,
"bottom-left": te
}, jt["border-radius"] = Ve(te), Kt["--divkit-border-radius"] = Ve(te + 1));
if (rr && lr && (q.corners_radius || q.corner_radius)) {
let ir = { ...Bt };
["top-left", "top-right", "bottom-right", "bottom-left"].forEach((Yr) => {
ir[Yr] = (ir[Yr] || 0) + lr / 2;
}), Dt = qn(ir);
}
}
Gt = Mi(jt, Gt), Mt = Mi(Kt, Mt), Rt = rr, qt = Dt;
}
G = hn(
$t && !lt ? $t : void 0,
G
), he = xi(uc(G, de), ne), x = fo(ge, ne, x);
{
let q, jt, Kt, rr, Dt = {}, ir = 0, Yr = 0, vi = !1, pi = !1;
const mr = (Bi = I.json.width) == null ? void 0 : Bi.type;
if (mr === "fixed")
pe = Vr(We == null ? void 0 : We.value, pe), jt = Ve(pe);
else if (mr === "wrap_content" || (mr === "match_parent" || !mr) && O.parentHorizontalWrapContent) {
if (q = "content", (mr === "wrap_content" && (We != null && We.constrained) || (mr === "match_parent" || !mr) && O.parentHorizontalWrapContent) && (Dt["width-constrained"] = !0, O.parentContainerOrientation === "horizontal" && (Yr = 1)), mr === "wrap_content") {
const nr = We;
nr.min_size && ni(nr.min_size.value) && (Kt = Ve(nr.min_size.value)), nr.max_size && ni(nr.max_size.value) && (rr = Ve(nr.max_size.value));
}
(mr === "match_parent" || !mr) && I.logError(V(new Error("Incorrect child size. Container with wrap_content size contains child with match_parent size along the main axis"), { level: "warn" }));
} else if (q = "parent", O.parentContainerOrientation === "vertical" && O.parentContainerWrap && (pi = !0, I.logError(V(new Error("Cannot place a match_parent items on the cross-axis of wrap"), { level: "error" }))), O.parentLayoutOrientation === "vertical" || O.stretchWidth) {
const nr = (Li = (Si = ne === "ltr" ? ge == null ? void 0 : ge.start : ge == null ? void 0 : ge.end) != null ? Si : ge == null ? void 0 : ge.left) != null ? Li : 0, Ao = (bs = (bi = ne === "ltr" ? ge == null ? void 0 : ge.end : ge == null ? void 0 : ge.start) != null ? bi : ge == null ? void 0 : ge.right) != null ? bs : 0, mn = `calc(100% - ${Hr(nr + Ao)})`;
O.stretchWidth ? (jt = "0", Kt = mn) : jt = mn;
} else O.parentContainerOrientation === "horizontal" && (ir = We && "weight" in We && We.weight || 1, O.parentContainerWrap && (vi = !0));
if (q === "parent")
Dt["halign-self"] = "stretch";
else {
const nr = ut;
nr === "left" || nr === "center" || nr === "right" || nr === "start" || nr === "end" ? Dt["halign-self"] = (ne === "ltr" ? $c : jc)[nr] : Dt["halign-self"] = O.parentHAlign || "start";
}
q && (Dt.width = q), Ue = jt, Z = Kt, C = rr, ct = ir, Q = Yr, L = Mi(Dt, L), xt = vi, $e = pi;
}
{
let q, jt, Kt, rr, Dt = {}, ir = 0, Yr = 0, vi = !1, pi = !1;
const mr = (ys = I.json.height) == null ? void 0 : ys.type;
if (!St) if (mr === "fixed")
s = Vr(le == null ? void 0 : le.value, s), jt = Ve(s);
else if (mr === "match_parent" && !O.parentVerticalWrapContent)
if (q = "parent", O.parentContainerOrientation === "horizontal" && O.parentContainerWrap && (pi = !0, I.logError(V(new Error("Cannot place a match_parent items on the cross-axis of wrap"), { level: "error" }))), O.parentLayoutOrientation === "horizontal" || O.stretchHeight) {
const nr = (ws = ge == null ? void 0 : ge.top) != null ? ws : 0, Ao = ($s = ge == null ? void 0 : ge.bottom) != null ? $s : 0, mn = `calc(100% - ${Hr(nr + Ao)})`;
O.stretchHeight ? (jt = "0", Kt = mn) : jt = mn;
} else O.parentContainerOrientation === "vertical" && (ir = (le == null ? void 0 : le.weight) || 1, O.parentContainerWrap && (vi = !0));
else {
if (q = "content", (mr === "wrap_content" && (le != null && le.constrained) || mr === "match_parent" && O.parentVerticalWrapContent) && (Dt["height-constrained"] = !0, O.parentContainerOrientation === "vertical" && (Yr = 1)), mr === "wrap_content") {
const nr = le;
nr != null && nr.min_size && ni(nr.min_size.value) && (Kt = Ve(nr.min_size.value)), nr != null && nr.max_size && ni(nr.max_size.value) && (rr = Ve(nr.max_size.value));
}
mr === "match_parent" && I.logError(V(new Error("Incorrect child size. Container with wrap_content size contains child with match_parent size along the main axis"), { level: "warn" }));
}
if (q === "parent")
Dt["valign-self"] = "stretch";
else {
const nr = Qe;
nr === "top" || nr === "center" || nr === "bottom" || nr === "baseline" && O.parentContainerOrientation === "horizontal" ? Dt["valign-self"] = Ac[nr] : Dt["valign-self"] = O.parentVAlign || "start";
}
q && (Dt.height = q), Me = jt, Ur = Kt, Kr = rr, yt = ir, $r = Yr, Yt = Mi(Dt, Yt), tr = vi, Wt = pi;
}
if (ae = O.overlapParent ? !0 : void 0, ve = O.gridArea ? `${O.gridArea.y + 1}/${O.gridArea.x + 1}/span ${O.gridArea.rowSpan}/span ${O.gridArea.colSpan}` : void 0, E = ac(Te, E), fr = E === 1 ? void 0 : E, zt = void 0, W && !Et) {
const q = cn(W);
q && (zt = {}, zt["aria-label"] = q);
}
if (ar = Xr && (et != null && et.background) ? et.background : ee, nt = {}, _r = !1, Array.isArray(ar) && (_r = ar.some((q) => q.type === "image" || q.type === "nine_patch_image") || !!qt, !_r)) {
const q = mo(ar, ne);
nt["background-color"] = q.color, nt["background-image"] = q.image, nt["background-size"] = q.size, nt["background-position"] = q.position, nt["background-repeat"] = "no-repeat";
}
Mr = void 0, jr && I.id && I.json.transition_in && qe.isRunning("stateChange") && (Mr = !0), P = void 0, jr && I.id && qe.isRunning("stateChange") && dt.hasTransitionChange(I.id) && (P = !0);
{
const q = I.json;
let jt = q.actions || q.action && [q.action] || [], Kt = q.doubletap_actions || [], rr = q.longtap_actions || [], Dt = ((js = q.focus) == null ? void 0 : js.on_focus) ||