var j = Object.defineProperty, G = Object.defineProperties; var J = Object.getOwnPropertyDescriptors; var b = Object.getOwnPropertySymbols; var K = Object.prototype.hasOwnProperty, Q = Object.prototype.propertyIsEnumerable; var S = (n, l, a) => l in n ? j(n, l, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[l] = a, u = (n, l) => { for (var a in l || (l = {})) K.call(l, a) && S(n, a, l[a]); if (b) for (var a of b(l)) Q.call(l, a) && S(n, a, l[a]); return n; }, C = (n, l) => G(n, J(l)); import { computed as B, ref as f, watch as W, resolveComponent as X, openBlock as d, createBlock as Y, withCtx as T, createElementVNode as t, toDisplayString as r, createElementBlock as v, Fragment as I, renderList as x, normalizeClass as Z, normalizeStyle as E, createCommentVNode as ee, createVNode as F, unref as te, createTextVNode as se } from "vue"; import { n as oe, dq as p, dr as k, I as le, ds as ae, B as ne, dt as ce, du as ue, dv as re, dw as ie } from "./index2.js"; const de = { class: "s-theme-config" }, ve = { class: "section" }, me = { class: "section-title" }, _e = { class: "preset-list" }, pe = ["title", "onClick"], he = { class: "name" }, ge = { class: "theme-container" }, Ce = { key: 0, class: "disabled-box" }, fe = { class: "section" }, ke = { class: "section-title" }, ye = { class: "color-row" }, $e = ["value"], we = { class: "tip" }, be = { class: "section" }, Se = { class: "section-title" }, Be = { class: "customer-grid" }, Te = { class: "cell-label" }, Ie = ["value", "onInput"], xe = { class: "cell-hex" }, Ee = { class: "tip" }, Fe = { class: "actions" }, He = { __name: "SThemeConfig", props: { /** * 是否显示,配合 v-model:value 使用 */ value: { type: Boolean, default: !1 } }, emits: ["update:value", "change"], setup(n, { emit: l }) { const a = n, h = l, m = B({ get: () => a.value, set: (e) => h("update:value", e) }), H = B(() => s.value.code !== "customer"), _ = f(p()), L = ae, s = f(u({}, window.$theme || {})), i = f(k()), y = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, N = (e) => y.test(String(e || "").trim()) ? String(e).trim() : "#000000"; W( () => a.value, (e) => { e && (_.value = p(), s.value = u({}, window.$theme || {}), i.value = k()); } ); const g = () => { const e = ie(s.value); s.value = u({}, e), h("change", u({}, e)); }, R = (e) => { s.value = u({}, e), g(); }, $ = (e) => { s.value = ce(e), g(); }, V = (e) => { const c = e.target.value; s.value = C(u({}, s.value), { color: c }); }, z = (e) => { const c = String(e.target.value || "").trim(); if (!y.test(c)) { s.value = C(u({}, s.value), { color: window.$theme && window.$theme.color || "" }); return; } $(c); }, D = (e, c) => { i.value = ue({ [e]: c }), s.value = u({}, i.value), _.value = p(), g(); }, O = () => { const e = re(); s.value = u({}, e), i.value = k(), _.value = p(), h("change", u({}, e)); }, A = () => { m.value = !1; }, M = () => { m.value = !1; }; return (e, c) => { const P = le, U = ne, q = X("s-modal"); return d(), Y(q, { value: m.value, "onUpdate:value": c[1] || (c[1] = (o) => m.value = o), title: e.$l("主题配置"), width: "620px", "save-btn-text": e.$l("完成"), onHandSave: A, onHandCancel: M }, { default: T(() => [ t("div", de, [ t("div", ve, [ t("div", me, r(e.$l("预设主题")), 1), t("div", _e, [ (d(!0), v(I, null, x(_.value, (o) => (d(), v("div", { key: o.name, class: Z(["preset-item", { active: s.value.name === o.name }]), title: o.color, onClick: (w) => R(o) }, [ t("span", { class: "dot", style: E({ backgroundColor: o.color }) }, null, 4), t("span", he, r(o.name), 1) ], 10, pe))), 128)) ]) ]), t("div", ge, [ H.value ? (d(), v("div", Ce)) : ee("", !0), t("div", fe, [ t("div", ke, r(e.$l("主题色")), 1), t("div", ye, [ t("input", { class: "color-picker", type: "color", value: s.value.color, onInput: c[0] || (c[0] = (o) => $(o.target.value)) }, null, 40, $e), F(P, { class: "hex-input", value: s.value.color, maxlength: 7, onChange: V, onBlur: z }, null, 8, ["value"]), t("span", we, r(e.$l("修改后立即生效")), 1) ]), t("div", { class: "theme-preview", style: E({ backgroundColor: s.value.color }) }, null, 4) ]), t("div", be, [ t("div", Se, r(e.$l("customer 颜色")), 1), t("div", Be, [ (d(!0), v(I, null, x(te(L), (o) => (d(), v("div", { key: o.key, class: "customer-cell" }, [ t("span", Te, r(e.$l(o.label)), 1), t("input", { class: "color-picker small", type: "color", value: N(i.value[o.key]), onInput: (w) => D(o.key, w.target.value) }, null, 40, Ie), t("span", xe, r(i.value[o.key]), 1) ]))), 128)) ]), t("div", Ee, r(e.$l("修改 customer 颜色会自动切换到 customer 主题")), 1) ]) ]), t("div", Fe, [ F(U, { size: "small", onClick: O }, { default: T(() => [ se(r(e.$l("恢复默认")), 1) ]), _: 1 }) ]) ]) ]), _: 1 }, 8, ["value", "title", "save-btn-text"]); }; } }, Ve = /* @__PURE__ */ oe(He, [["__scopeId", "data-v-9674b30a"]]); export { Ve as default };