@feedmepos/mf-miniprogram-v2 0.2.9-dev.14 → 0.2.9-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-CHLsLhLM.js → App-D-AO7es-.js} +2 -2
- package/dist/{BrandFontPicker-Bl9B7aqX.js → BrandFontPicker-DrmNZyiU.js} +1 -1
- package/dist/BrandKitView-mCBJh18l.js +329 -0
- package/dist/{ControlPlaneView-DVaCCYGV.js → ControlPlaneView-nXBl0P82.js} +7961 -7858
- package/dist/{EcosystemView-BfhoNYCr.js → EcosystemView-DTO_VDuQ.js} +3 -3
- package/dist/{MobileProjectDialog-CDpnfKte.js → MobileProjectDialog-BJT7F1aq.js} +1 -1
- package/dist/{MobileProjectsView-Z8g67Azi.js → MobileProjectsView-mI7VrPLi.js} +3 -3
- package/dist/{ModuleCenterView-BXP3OGtz.js → ModuleCenterView-CPvh_2yV.js} +1 -1
- package/dist/{ModuleDetailView-EC1i1tq7.js → ModuleDetailView-Cyt3Owxj.js} +1 -1
- package/dist/{PagesView-Ddk9vYh8.js → PagesView-DWKG50PT.js} +1 -1
- package/dist/{PortalSettingsView-1As-b0iB.js → PortalSettingsView-DWBFuVgS.js} +1 -1
- package/dist/{TemplateCenterView-Bs-n3C7-.js → TemplateCenterView-CF3ga3su.js} +1 -1
- package/dist/{WorkspaceEntryView-bz7fAxJT.js → WorkspaceEntryView-CPFFi_dV.js} +1 -1
- package/dist/app.js +11 -11
- package/dist/{localPreference-BF2Eojpr.js → localPreference-DGZbSJ6w.js} +1 -1
- package/dist/package.json +1 -1
- package/dist/{portalContext-BmCv8WeN.js → portalContext-BKzVf74q.js} +1 -1
- package/dist/{routes-B8zrcTY4.js → routes-W8KfuhWL.js} +7 -3
- package/dist/style.css +1 -1
- package/dist/useBrandKit-BS3CrkJC.js +1092 -0
- package/dist/{useModuleCatalog-4BywsFM5.js → useModuleCatalog-Bg_Np4Ry.js} +1 -1
- package/package.json +1 -1
- package/dist/BrandKitView-3A6cj34f.js +0 -276
- package/dist/useBrandKit-CgRcfGqk.js +0 -1048
|
@@ -0,0 +1,1092 @@
|
|
|
1
|
+
import { f as Lt, e as Ct } from "./index-BnE-gQP_.js";
|
|
2
|
+
import { computed as B, reactive as Nt } from "vue";
|
|
3
|
+
import { k as _, e as st } from "./controlPlane-BolHy5EI.js";
|
|
4
|
+
import { useCoreStore as Mt } from "@feedmepos/mf-common";
|
|
5
|
+
import { g as kt, c as Dt } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
6
|
+
const ut = [
|
|
7
|
+
"Inter",
|
|
8
|
+
"Roboto",
|
|
9
|
+
"Open Sans",
|
|
10
|
+
"Lato",
|
|
11
|
+
"Montserrat",
|
|
12
|
+
"Noto Sans",
|
|
13
|
+
"Nunito",
|
|
14
|
+
"Nunito Sans",
|
|
15
|
+
"Poppins",
|
|
16
|
+
"Raleway",
|
|
17
|
+
"Source Sans 3",
|
|
18
|
+
"Ubuntu",
|
|
19
|
+
"DM Sans",
|
|
20
|
+
"Manrope",
|
|
21
|
+
"Work Sans",
|
|
22
|
+
"Oswald",
|
|
23
|
+
"Playfair Display",
|
|
24
|
+
"Merriweather",
|
|
25
|
+
"Lora",
|
|
26
|
+
"Noto Sans SC",
|
|
27
|
+
"Noto Sans TC"
|
|
28
|
+
];
|
|
29
|
+
function Bt(e) {
|
|
30
|
+
var o;
|
|
31
|
+
return ((o = e.split(",")[0]) == null ? void 0 : o.trim().replace(/^(['"])(.*)\1$/, "$2")) || "App default";
|
|
32
|
+
}
|
|
33
|
+
function _e(e) {
|
|
34
|
+
const o = ["Playfair Display", "Merriweather", "Lora"].includes(e) ? "serif" : "sans-serif";
|
|
35
|
+
return `'${e}', ${o === "serif" ? "" : "system-ui, "}${o}`;
|
|
36
|
+
}
|
|
37
|
+
function bt(e) {
|
|
38
|
+
return `https://fonts.googleapis.com/css2?${[...new Set(e)].sort().map((s) => `family=${encodeURIComponent(s)}:wght@400;500;600;700`).join("&")}&display=swap`;
|
|
39
|
+
}
|
|
40
|
+
function Ut(e) {
|
|
41
|
+
if (!e || typeof e != "object" || !("stylesheet" in e) || typeof e.stylesheet != "string")
|
|
42
|
+
return !1;
|
|
43
|
+
try {
|
|
44
|
+
const o = new URL(e.stylesheet);
|
|
45
|
+
if (o.hostname !== "fonts.googleapis.com" || !["/css", "/css2"].includes(o.pathname)) return !1;
|
|
46
|
+
const s = o.searchParams.getAll("family").flatMap((t) => t.split("|"));
|
|
47
|
+
return s.length > 0 && s.every(
|
|
48
|
+
(t) => ut.some((n) => {
|
|
49
|
+
var i;
|
|
50
|
+
return n.toLowerCase() === ((i = t.split(":")[0]) == null ? void 0 : i.trim().toLowerCase());
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
} catch {
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function Kt(e, o) {
|
|
58
|
+
const s = ["brand", "heading", "body"].flatMap(
|
|
59
|
+
(n) => (o[n] || "").split(",").flatMap((i) => {
|
|
60
|
+
const l = ut.find((f) => f.toLowerCase() === Bt(i).toLowerCase());
|
|
61
|
+
return l ? [l] : [];
|
|
62
|
+
})
|
|
63
|
+
), t = Array.isArray(e) ? e.filter((n) => !Ut(n)) : [];
|
|
64
|
+
return s.length ? [...t, { stylesheet: bt(s) }] : t;
|
|
65
|
+
}
|
|
66
|
+
const z = /* @__PURE__ */ new Map();
|
|
67
|
+
function xe(e) {
|
|
68
|
+
if (!ut.some((t) => t === e)) return Promise.resolve();
|
|
69
|
+
const o = z.get(e);
|
|
70
|
+
if (o) return o;
|
|
71
|
+
const s = new Promise((t, n) => {
|
|
72
|
+
const i = document.createElement("link");
|
|
73
|
+
i.rel = "stylesheet", i.href = bt([e]);
|
|
74
|
+
let l = !1;
|
|
75
|
+
const f = window.setTimeout(() => y(), 15e3), y = () => {
|
|
76
|
+
l || (l = !0, window.clearTimeout(f), i.remove(), z.delete(e), n(new Error(`Could not load ${e}`)));
|
|
77
|
+
};
|
|
78
|
+
i.onerror = y, i.onload = () => {
|
|
79
|
+
document.fonts.load(`400 16px "${e}"`).then((w) => {
|
|
80
|
+
if (!l) {
|
|
81
|
+
if (!w.length) return y();
|
|
82
|
+
l = !0, window.clearTimeout(f), t();
|
|
83
|
+
}
|
|
84
|
+
}, y);
|
|
85
|
+
}, document.head.append(i);
|
|
86
|
+
});
|
|
87
|
+
return z.set(e, s), s;
|
|
88
|
+
}
|
|
89
|
+
var wt = { exports: {} };
|
|
90
|
+
(function(e, o) {
|
|
91
|
+
(function(s, t) {
|
|
92
|
+
e.exports = t();
|
|
93
|
+
})(Dt, function() {
|
|
94
|
+
return function(s) {
|
|
95
|
+
var t = {};
|
|
96
|
+
function n(i) {
|
|
97
|
+
if (t[i]) return t[i].exports;
|
|
98
|
+
var l = t[i] = { i, l: !1, exports: {} };
|
|
99
|
+
return s[i].call(l.exports, l, l.exports, n), l.l = !0, l.exports;
|
|
100
|
+
}
|
|
101
|
+
return n.m = s, n.c = t, n.d = function(i, l, f) {
|
|
102
|
+
n.o(i, l) || Object.defineProperty(i, l, { enumerable: !0, get: f });
|
|
103
|
+
}, n.r = function(i) {
|
|
104
|
+
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
|
|
105
|
+
}, n.t = function(i, l) {
|
|
106
|
+
if (1 & l && (i = n(i)), 8 & l || 4 & l && typeof i == "object" && i && i.__esModule) return i;
|
|
107
|
+
var f = /* @__PURE__ */ Object.create(null);
|
|
108
|
+
if (n.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: i }), 2 & l && typeof i != "string")
|
|
109
|
+
for (var y in i)
|
|
110
|
+
n.d(
|
|
111
|
+
f,
|
|
112
|
+
y,
|
|
113
|
+
(function(w) {
|
|
114
|
+
return i[w];
|
|
115
|
+
}).bind(null, y)
|
|
116
|
+
);
|
|
117
|
+
return f;
|
|
118
|
+
}, n.n = function(i) {
|
|
119
|
+
var l = i && i.__esModule ? function() {
|
|
120
|
+
return i.default;
|
|
121
|
+
} : function() {
|
|
122
|
+
return i;
|
|
123
|
+
};
|
|
124
|
+
return n.d(l, "a", l), l;
|
|
125
|
+
}, n.o = function(i, l) {
|
|
126
|
+
return Object.prototype.hasOwnProperty.call(i, l);
|
|
127
|
+
}, n.p = "", n(n.s = 0);
|
|
128
|
+
}([
|
|
129
|
+
function(s, t, n) {
|
|
130
|
+
s.exports = n(1);
|
|
131
|
+
},
|
|
132
|
+
function(s, t, n) {
|
|
133
|
+
function i(r) {
|
|
134
|
+
return (i = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) {
|
|
135
|
+
return typeof a;
|
|
136
|
+
} : function(a) {
|
|
137
|
+
return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
|
|
138
|
+
})(r);
|
|
139
|
+
}
|
|
140
|
+
function l(r) {
|
|
141
|
+
var a = "[object " + r + "]";
|
|
142
|
+
return function(c) {
|
|
143
|
+
return Object.prototype.toString.call(c) === a;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
n.r(t), n.d(t, "default", function() {
|
|
147
|
+
return At;
|
|
148
|
+
}), n.d(t, "compare", function() {
|
|
149
|
+
return dt;
|
|
150
|
+
}), n.d(t, "comparable", function() {
|
|
151
|
+
return X;
|
|
152
|
+
});
|
|
153
|
+
var f = l("Array"), y = l("Object"), w = l("Function");
|
|
154
|
+
function m(r, a) {
|
|
155
|
+
return w(r.get) ? r.get(a) : r[a];
|
|
156
|
+
}
|
|
157
|
+
function F(r) {
|
|
158
|
+
return function(a, c) {
|
|
159
|
+
if (!f(c) || !c.length) return r(a, c);
|
|
160
|
+
for (var d = 0, p = c.length; d < p; d++)
|
|
161
|
+
if (r(a, m(c, d))) return !0;
|
|
162
|
+
return !1;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function x(r) {
|
|
166
|
+
return function(a, c) {
|
|
167
|
+
if (!f(c) || !c.length) return r(a, c);
|
|
168
|
+
for (var d = 0, p = c.length; d < p; d++)
|
|
169
|
+
if (!r(a, m(c, d))) return !1;
|
|
170
|
+
return !0;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function b(r, a, c, d) {
|
|
174
|
+
return r.validate(r.options, a, c, d);
|
|
175
|
+
}
|
|
176
|
+
var E = {
|
|
177
|
+
$eq: F(function(r, a) {
|
|
178
|
+
return r(a);
|
|
179
|
+
}),
|
|
180
|
+
$ne: x(function(r, a) {
|
|
181
|
+
return r(a);
|
|
182
|
+
}),
|
|
183
|
+
$gt: F(function(r, a) {
|
|
184
|
+
return r(a);
|
|
185
|
+
}),
|
|
186
|
+
$gte: F(function(r, a) {
|
|
187
|
+
return r(a);
|
|
188
|
+
}),
|
|
189
|
+
$lt: F(function(r, a) {
|
|
190
|
+
return r(a);
|
|
191
|
+
}),
|
|
192
|
+
$lte: F(function(r, a) {
|
|
193
|
+
return r(a);
|
|
194
|
+
}),
|
|
195
|
+
$mod: F(function(r, a) {
|
|
196
|
+
return r(a);
|
|
197
|
+
}),
|
|
198
|
+
$in: function(r, a) {
|
|
199
|
+
return r(a);
|
|
200
|
+
},
|
|
201
|
+
$nin: function(r, a) {
|
|
202
|
+
return r(a);
|
|
203
|
+
},
|
|
204
|
+
$not: function(r, a, c, d) {
|
|
205
|
+
return r(a, c, d);
|
|
206
|
+
},
|
|
207
|
+
$type: function(r, a) {
|
|
208
|
+
return r(a);
|
|
209
|
+
},
|
|
210
|
+
$all: function(r, a, c, d) {
|
|
211
|
+
return E.$and(r, a, c, d);
|
|
212
|
+
},
|
|
213
|
+
$size: function(r, a) {
|
|
214
|
+
return !!a && r === a.length;
|
|
215
|
+
},
|
|
216
|
+
$or: function(r, a, c, d) {
|
|
217
|
+
for (var p = 0, h = r.length; p < h; p++)
|
|
218
|
+
if (b(m(r, p), a, c, d)) return !0;
|
|
219
|
+
return !1;
|
|
220
|
+
},
|
|
221
|
+
$nor: function(r, a, c, d) {
|
|
222
|
+
return !E.$or(r, a, c, d);
|
|
223
|
+
},
|
|
224
|
+
$and: function(r, a, c, d) {
|
|
225
|
+
for (var p = 0, h = r.length; p < h; p++)
|
|
226
|
+
if (!b(m(r, p), a, c, d)) return !1;
|
|
227
|
+
return !0;
|
|
228
|
+
},
|
|
229
|
+
$regex: F(function(r, a) {
|
|
230
|
+
return typeof a == "string" && r.test(a);
|
|
231
|
+
}),
|
|
232
|
+
$where: function(r, a, c, d) {
|
|
233
|
+
return r.call(a, a, c, d);
|
|
234
|
+
},
|
|
235
|
+
$elemMatch: function(r, a, c, d) {
|
|
236
|
+
return f(a) ? !!~function(p, h) {
|
|
237
|
+
for (var g = 0; g < p.length; g++)
|
|
238
|
+
if (m(p, g), b(h, m(p, g))) return g;
|
|
239
|
+
return -1;
|
|
240
|
+
}(a, r) : b(r, a, c, d);
|
|
241
|
+
},
|
|
242
|
+
$exists: function(r, a, c, d) {
|
|
243
|
+
return d.hasOwnProperty(c) === r;
|
|
244
|
+
}
|
|
245
|
+
}, j = {
|
|
246
|
+
$eq: function(r, a, c) {
|
|
247
|
+
var d = c.comparable, p = c.compare;
|
|
248
|
+
return r instanceof RegExp ? F(function(h) {
|
|
249
|
+
return typeof h == "string" && r.test(h);
|
|
250
|
+
}) : r instanceof Function ? F(r) : f(r) && !r.length ? F(function(h) {
|
|
251
|
+
return f(h) && !h.length;
|
|
252
|
+
}) : F(
|
|
253
|
+
r === null ? function(h) {
|
|
254
|
+
return h == null;
|
|
255
|
+
} : function(h) {
|
|
256
|
+
return p(d(h), d(r)) === 0;
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
$gt: function(r, a, c) {
|
|
261
|
+
var d = c.comparable, p = c.compare;
|
|
262
|
+
return function(h) {
|
|
263
|
+
return p(d(h), d(r)) > 0;
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
$gte: function(r, a, c) {
|
|
267
|
+
var d = c.comparable, p = c.compare;
|
|
268
|
+
return function(h) {
|
|
269
|
+
return p(d(h), d(r)) >= 0;
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
$lt: function(r, a, c) {
|
|
273
|
+
var d = c.comparable, p = c.compare;
|
|
274
|
+
return function(h) {
|
|
275
|
+
return p(d(h), d(r)) < 0;
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
$lte: function(r, a, c) {
|
|
279
|
+
var d = c.comparable, p = c.compare;
|
|
280
|
+
return function(h) {
|
|
281
|
+
return p(d(h), d(r)) <= 0;
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
$in: function(r, a, c) {
|
|
285
|
+
var d = c.comparable;
|
|
286
|
+
return function(p) {
|
|
287
|
+
if (!(p instanceof Array)) {
|
|
288
|
+
var h = d(p);
|
|
289
|
+
if (h === p && i(p) === "object") {
|
|
290
|
+
for (v = r.length; v--; )
|
|
291
|
+
if (String(r[v]) === String(p) && String(p) !== "[object Object]")
|
|
292
|
+
return !0;
|
|
293
|
+
}
|
|
294
|
+
if (h === void 0) {
|
|
295
|
+
for (v = r.length; v--; ) if (r[v] == null) return !0;
|
|
296
|
+
}
|
|
297
|
+
for (v = r.length; v--; ) {
|
|
298
|
+
var g = b(ft(m(r, v), c), h, v, r);
|
|
299
|
+
if (g && String(g) !== "[object Object]" && String(h) !== "[object Object]")
|
|
300
|
+
return !0;
|
|
301
|
+
}
|
|
302
|
+
return !!~r.indexOf(h);
|
|
303
|
+
}
|
|
304
|
+
for (var v = p.length; v--; )
|
|
305
|
+
if (~r.indexOf(d(m(p, v)))) return !0;
|
|
306
|
+
return !1;
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
$nin: function(r, a, c) {
|
|
310
|
+
var d = j.$in(r, a, c);
|
|
311
|
+
return function(p, h, g, v) {
|
|
312
|
+
return !d(p, h, g, v);
|
|
313
|
+
};
|
|
314
|
+
},
|
|
315
|
+
$mod: function(r) {
|
|
316
|
+
return function(a) {
|
|
317
|
+
return a % r[0] == r[1];
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
$ne: function(r, a, c) {
|
|
321
|
+
var d = j.$eq(r, a, c);
|
|
322
|
+
return x(function(p, h, g, v) {
|
|
323
|
+
return !d(p, h, g, v);
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
$and: function(r, a, c) {
|
|
327
|
+
return r.map(L(c));
|
|
328
|
+
},
|
|
329
|
+
$all: function(r, a, c) {
|
|
330
|
+
return j.$and(r, a, c);
|
|
331
|
+
},
|
|
332
|
+
$or: function(r, a, c) {
|
|
333
|
+
return r.map(L(c));
|
|
334
|
+
},
|
|
335
|
+
$nor: function(r, a, c) {
|
|
336
|
+
return r.map(L(c));
|
|
337
|
+
},
|
|
338
|
+
$not: function(r, a, c) {
|
|
339
|
+
var d = L(c)(r);
|
|
340
|
+
return function(p, h, g) {
|
|
341
|
+
return !b(d, p, h, g);
|
|
342
|
+
};
|
|
343
|
+
},
|
|
344
|
+
$type: function(r) {
|
|
345
|
+
return function(a, c, d) {
|
|
346
|
+
return a != null && (a instanceof r || a.constructor == r);
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
$regex: function(r, a) {
|
|
350
|
+
return new RegExp(r, a.$options);
|
|
351
|
+
},
|
|
352
|
+
$where: function(r) {
|
|
353
|
+
if (typeof r == "function") return r;
|
|
354
|
+
throw new Error(
|
|
355
|
+
'In CSP mode, sift does not support strings in "$where" condition'
|
|
356
|
+
);
|
|
357
|
+
},
|
|
358
|
+
$elemMatch: function(r, a, c) {
|
|
359
|
+
return L(c)(r);
|
|
360
|
+
},
|
|
361
|
+
$exists: function(r) {
|
|
362
|
+
return !!r;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
function I(r, a) {
|
|
366
|
+
return { options: r, validate: a };
|
|
367
|
+
}
|
|
368
|
+
function xt(r, a) {
|
|
369
|
+
var c = r.keyPath, d = r.child, p = r.query, h = [];
|
|
370
|
+
if (function pt(T, M, k, It, W) {
|
|
371
|
+
if (k === M.length || T == null)
|
|
372
|
+
return void W.push([T, M[k - 1], It]);
|
|
373
|
+
var ht = m(M, k);
|
|
374
|
+
if (f(T) && isNaN(Number(ht)))
|
|
375
|
+
for (var Z = 0, Tt = T.length; Z < Tt; Z++) pt(m(T, Z), M, k, T, W);
|
|
376
|
+
else pt(m(T, ht), M, k + 1, T, W);
|
|
377
|
+
}(a, c, 0, a, h), h.length === 1) {
|
|
378
|
+
var g = h[0];
|
|
379
|
+
return b(d, g[0], g[1], g[2]);
|
|
380
|
+
}
|
|
381
|
+
for (var v = p && p.$ne !== void 0, O = v, S = 0; S < h.length; S++) {
|
|
382
|
+
var A = h[S], G = b(d, A[0], A[1], A[2]);
|
|
383
|
+
v ? O &= G : O |= G;
|
|
384
|
+
}
|
|
385
|
+
return O;
|
|
386
|
+
}
|
|
387
|
+
function jt(r, a, c) {
|
|
388
|
+
return I({ keyPath: r, child: a, query: c }, xt);
|
|
389
|
+
}
|
|
390
|
+
function L(r) {
|
|
391
|
+
var a = r.comparable, c = r.expressions, d = function(g) {
|
|
392
|
+
var v;
|
|
393
|
+
return (!g || !(v = g) || v.constructor !== Object && v.constructor !== Array && v.constructor.toString() !== "function Object() { [native code] }" && v.constructor.toString() !== "function Array() { [native code] }" || v.toJSON) && (g = { $eq: g }), g;
|
|
394
|
+
}, p = function(g) {
|
|
395
|
+
g = a(g);
|
|
396
|
+
var v = [];
|
|
397
|
+
for (var O in g) {
|
|
398
|
+
var S = g[O];
|
|
399
|
+
if (O !== "$options") {
|
|
400
|
+
var A = E[O] || r && c && c[O];
|
|
401
|
+
if (A) j[O] && (S = j[O](S, g, r)), v.push(I(a(S), A));
|
|
402
|
+
else {
|
|
403
|
+
if (O.charCodeAt(0) === 36)
|
|
404
|
+
throw new Error("Unknown operation " + O);
|
|
405
|
+
var G = O.split(".");
|
|
406
|
+
v.push(jt(G, h(S), S));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return v.length === 1 ? v[0] : I(v, E.$and);
|
|
411
|
+
}, h = function(g) {
|
|
412
|
+
return g = d(g), function v(O, S) {
|
|
413
|
+
if (!y(O)) return S;
|
|
414
|
+
for (var A in O) S.push(A), v(O[A], S);
|
|
415
|
+
return S;
|
|
416
|
+
}(g, []).join(",").search(/[$.]/) === -1 ? I(g, K) : p(g);
|
|
417
|
+
};
|
|
418
|
+
return function(g) {
|
|
419
|
+
return p(d(g));
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function K(r, a) {
|
|
423
|
+
if (Object.prototype.toString.call(r) !== Object.prototype.toString.call(a))
|
|
424
|
+
return !1;
|
|
425
|
+
if (y(r)) {
|
|
426
|
+
if (Object.keys(r).length !== Object.keys(a).length) return !1;
|
|
427
|
+
for (var c in r) if (!K(r[c], a[c])) return !1;
|
|
428
|
+
return !0;
|
|
429
|
+
}
|
|
430
|
+
if (f(r)) {
|
|
431
|
+
if (r.length !== a.length) return !1;
|
|
432
|
+
for (var d = 0, p = r.length; d < p; d++)
|
|
433
|
+
if (!K(r[d], a[d])) return !1;
|
|
434
|
+
return !0;
|
|
435
|
+
}
|
|
436
|
+
return r === a;
|
|
437
|
+
}
|
|
438
|
+
function ft(r, a) {
|
|
439
|
+
var c = L(a)(r);
|
|
440
|
+
return a && a.select && (c = {
|
|
441
|
+
options: c,
|
|
442
|
+
validate: function(d, p, h, g) {
|
|
443
|
+
return b(d, p && a.select(p), h, g);
|
|
444
|
+
}
|
|
445
|
+
}), c;
|
|
446
|
+
}
|
|
447
|
+
function At(r, a) {
|
|
448
|
+
var c = ft(r, a = Object.assign({ compare: dt, comparable: X }, a));
|
|
449
|
+
return function(d, p, h) {
|
|
450
|
+
return b(c, d, p, h);
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function dt(r, a) {
|
|
454
|
+
if (K(r, a)) return 0;
|
|
455
|
+
if (i(r) === i(a)) {
|
|
456
|
+
if (r > a) return 1;
|
|
457
|
+
if (r < a) return -1;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function X(r) {
|
|
461
|
+
return r instanceof Date ? r.getTime() : f(r) ? r.map(X) : r && typeof r.toJSON == "function" ? r.toJSON() : r;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
]);
|
|
465
|
+
});
|
|
466
|
+
})(wt);
|
|
467
|
+
var Gt = wt.exports;
|
|
468
|
+
const Ht = /* @__PURE__ */ kt(Gt);
|
|
469
|
+
function Jt(e, o) {
|
|
470
|
+
for (var s = 0; s < o.length; s++) {
|
|
471
|
+
var t = o[s];
|
|
472
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(e, t.key, t);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function qt(e, o, s) {
|
|
476
|
+
return o && Jt(e.prototype, o), e;
|
|
477
|
+
}
|
|
478
|
+
function Yt(e, o) {
|
|
479
|
+
e.prototype = Object.create(o.prototype), e.prototype.constructor = e, e.__proto__ = o;
|
|
480
|
+
}
|
|
481
|
+
function Q(e) {
|
|
482
|
+
return Q = Object.setPrototypeOf ? Object.getPrototypeOf : function(s) {
|
|
483
|
+
return s.__proto__ || Object.getPrototypeOf(s);
|
|
484
|
+
}, Q(e);
|
|
485
|
+
}
|
|
486
|
+
function q(e, o) {
|
|
487
|
+
return q = Object.setPrototypeOf || function(t, n) {
|
|
488
|
+
return t.__proto__ = n, t;
|
|
489
|
+
}, q(e, o);
|
|
490
|
+
}
|
|
491
|
+
function Vt() {
|
|
492
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
493
|
+
if (typeof Proxy == "function") return !0;
|
|
494
|
+
try {
|
|
495
|
+
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
496
|
+
})), !0;
|
|
497
|
+
} catch {
|
|
498
|
+
return !1;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function J(e, o, s) {
|
|
502
|
+
return Vt() ? J = Reflect.construct : J = function(n, i, l) {
|
|
503
|
+
var f = [null];
|
|
504
|
+
f.push.apply(f, i);
|
|
505
|
+
var y = Function.bind.apply(n, f), w = new y();
|
|
506
|
+
return l && q(w, l.prototype), w;
|
|
507
|
+
}, J.apply(null, arguments);
|
|
508
|
+
}
|
|
509
|
+
function Xt(e) {
|
|
510
|
+
return Function.toString.call(e).indexOf("[native code]") !== -1;
|
|
511
|
+
}
|
|
512
|
+
function tt(e) {
|
|
513
|
+
var o = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
514
|
+
return tt = function(t) {
|
|
515
|
+
if (t === null || !Xt(t)) return t;
|
|
516
|
+
if (typeof t != "function")
|
|
517
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
518
|
+
if (typeof o < "u") {
|
|
519
|
+
if (o.has(t)) return o.get(t);
|
|
520
|
+
o.set(t, n);
|
|
521
|
+
}
|
|
522
|
+
function n() {
|
|
523
|
+
return J(t, arguments, Q(this).constructor);
|
|
524
|
+
}
|
|
525
|
+
return n.prototype = Object.create(t.prototype, {
|
|
526
|
+
constructor: {
|
|
527
|
+
value: n,
|
|
528
|
+
enumerable: !1,
|
|
529
|
+
writable: !0,
|
|
530
|
+
configurable: !0
|
|
531
|
+
}
|
|
532
|
+
}), q(n, t);
|
|
533
|
+
}, tt(e);
|
|
534
|
+
}
|
|
535
|
+
function gt(e) {
|
|
536
|
+
if (e === void 0)
|
|
537
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
538
|
+
return e;
|
|
539
|
+
}
|
|
540
|
+
var Ft = function(o) {
|
|
541
|
+
return 'Cannot execute "' + o.action + '" on "' + o.subjectName + '"';
|
|
542
|
+
}, H = Ft, Wt = /* @__PURE__ */ function(e) {
|
|
543
|
+
Yt(o, e), o.setDefaultMessage = function(n) {
|
|
544
|
+
n === null ? H = Ft : H = typeof n == "string" ? function() {
|
|
545
|
+
return n;
|
|
546
|
+
} : n;
|
|
547
|
+
}, o.from = function(n) {
|
|
548
|
+
var i = new this("");
|
|
549
|
+
return Object.defineProperty(i, "ability", {
|
|
550
|
+
value: n
|
|
551
|
+
}), i;
|
|
552
|
+
};
|
|
553
|
+
function o(t, n) {
|
|
554
|
+
var i;
|
|
555
|
+
return n === void 0 && (n = {}), i = e.call(this, t) || this, i._setMetadata(n), i.message = t || H(gt(i)), i._customMessage = null, typeof Error.captureStackTrace == "function" && (i.name = i.constructor.name, Error.captureStackTrace(gt(i), i.constructor)), i;
|
|
556
|
+
}
|
|
557
|
+
var s = o.prototype;
|
|
558
|
+
return s.setMessage = function(n) {
|
|
559
|
+
return this._customMessage = n, this;
|
|
560
|
+
}, s.throwUnlessCan = function(n, i, l) {
|
|
561
|
+
if (!this.ability)
|
|
562
|
+
throw new ReferenceError("Cannot throw FordiddenError without respective ability instance");
|
|
563
|
+
var f = this.ability.relevantRuleFor(n, i, l);
|
|
564
|
+
if (!(f && !f.inverted)) {
|
|
565
|
+
this._setMetadata({
|
|
566
|
+
action: n,
|
|
567
|
+
subject: i,
|
|
568
|
+
field: l,
|
|
569
|
+
subjectName: this.ability.subjectName(i)
|
|
570
|
+
});
|
|
571
|
+
var y = f ? f.reason : "";
|
|
572
|
+
throw this.message = this._customMessage || y || H(this), this;
|
|
573
|
+
}
|
|
574
|
+
}, s._setMetadata = function(n) {
|
|
575
|
+
this.subject = n.subject, this.subjectName = n.subjectName, this.action = n.action, this.field = n.field;
|
|
576
|
+
}, o;
|
|
577
|
+
}(tt(Error));
|
|
578
|
+
function et(e) {
|
|
579
|
+
return Array.isArray(e) ? e : [e];
|
|
580
|
+
}
|
|
581
|
+
function Zt(e) {
|
|
582
|
+
if (!e || typeof e == "string")
|
|
583
|
+
return e;
|
|
584
|
+
var o = typeof e == "object" ? e.constructor : e;
|
|
585
|
+
return o.modelName || o.name;
|
|
586
|
+
}
|
|
587
|
+
function zt(e) {
|
|
588
|
+
return JSON.parse(JSON.stringify(e));
|
|
589
|
+
}
|
|
590
|
+
var Qt = /[-/\\^$+?.()|[\]{}]/g, te = /\.?\*+\.?/g, ee = /\*+/, re = /\./g;
|
|
591
|
+
function ne(e, o, s) {
|
|
592
|
+
var t = s[0] === "*" || e[0] === "." && e[e.length - 1] === "." ? "+" : "*", n = e.indexOf("**") === -1 ? "[^.]" : ".", i = e.replace(re, "\\$&").replace(ee, n + t);
|
|
593
|
+
return o + e.length === s.length ? "(?:" + i + ")?" : i;
|
|
594
|
+
}
|
|
595
|
+
function oe(e, o, s) {
|
|
596
|
+
return e === "." && (s[o - 1] === "*" || s[o + 1] === "*") ? e : "\\" + e;
|
|
597
|
+
}
|
|
598
|
+
function ie(e) {
|
|
599
|
+
var o = e.map(function(t) {
|
|
600
|
+
return t.replace(Qt, oe).replace(te, ne);
|
|
601
|
+
}), s = o.length > 1 ? "(?:" + o.join("|") + ")" : o[0];
|
|
602
|
+
return new RegExp("^" + s + "$");
|
|
603
|
+
}
|
|
604
|
+
var ae = /* @__PURE__ */ function() {
|
|
605
|
+
function e(s) {
|
|
606
|
+
this.actions = s.actions || s.action, this.subject = s.subject, this.fields = !s.fields || s.fields.length === 0 ? void 0 : et(s.fields), Object.defineProperty(this, "_fieldsPattern", {
|
|
607
|
+
writable: !0
|
|
608
|
+
}), this.inverted = !!s.inverted, this.conditions = s.conditions, Object.defineProperty(this, "_matches", {
|
|
609
|
+
writable: !0,
|
|
610
|
+
value: this.conditions ? Ht(this.conditions) : void 0
|
|
611
|
+
}), this.reason = s.reason;
|
|
612
|
+
}
|
|
613
|
+
var o = e.prototype;
|
|
614
|
+
return o.matches = function(t) {
|
|
615
|
+
return this._matches ? typeof t == "string" ? !this.inverted : this._matches(t) : !0;
|
|
616
|
+
}, o.isRelevantFor = function(t, n) {
|
|
617
|
+
return this.fields ? n ? this.matchesField(n) : !this.inverted : !0;
|
|
618
|
+
}, o.matchesField = function(t) {
|
|
619
|
+
return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null : ie(this.fields)), this._fieldsPattern === null || t.indexOf("*") !== -1 ? this.fields.indexOf(t) !== -1 : this._fieldsPattern.test(t);
|
|
620
|
+
}, e;
|
|
621
|
+
}(), P = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), yt = {
|
|
622
|
+
crud: ["create", "read", "update", "delete"]
|
|
623
|
+
};
|
|
624
|
+
function vt(e, o) {
|
|
625
|
+
return e === o || Array.isArray(o) && o.indexOf(e) !== -1;
|
|
626
|
+
}
|
|
627
|
+
var se = /* @__PURE__ */ function() {
|
|
628
|
+
e.addAlias = function(t, n) {
|
|
629
|
+
if (t === "manage" || vt("manage", n))
|
|
630
|
+
throw new Error('Cannot add alias for "manage" action because it represents any action');
|
|
631
|
+
if (vt(t, n))
|
|
632
|
+
throw new Error("Attempt to alias action to itself: " + t + " -> " + n.toString());
|
|
633
|
+
return yt[t] = n, this;
|
|
634
|
+
};
|
|
635
|
+
function e(s, t) {
|
|
636
|
+
t === void 0 && (t = {}), Object.defineProperty(this, "subjectName", {
|
|
637
|
+
value: t.subjectName || Zt
|
|
638
|
+
}), this[P] = {
|
|
639
|
+
RuleType: t.RuleType || ae,
|
|
640
|
+
originalRules: s || [],
|
|
641
|
+
hasPerFieldRules: !1,
|
|
642
|
+
indexedRules: /* @__PURE__ */ Object.create(null),
|
|
643
|
+
mergedRules: /* @__PURE__ */ Object.create(null),
|
|
644
|
+
events: {},
|
|
645
|
+
aliases: zt(yt)
|
|
646
|
+
}, this.update(s);
|
|
647
|
+
}
|
|
648
|
+
var o = e.prototype;
|
|
649
|
+
return o.update = function(t) {
|
|
650
|
+
if (!Array.isArray(t))
|
|
651
|
+
return this;
|
|
652
|
+
var n = {
|
|
653
|
+
rules: t,
|
|
654
|
+
ability: this
|
|
655
|
+
};
|
|
656
|
+
this.emit("update", n), this[P].originalRules = t.slice(0), this[P].mergedRules = /* @__PURE__ */ Object.create(null);
|
|
657
|
+
var i = this.buildIndexFor(t);
|
|
658
|
+
return this[P].indexedRules = i.rules, this[P].hasPerFieldRules = i.hasPerFieldRules, this.emit("updated", n), this;
|
|
659
|
+
}, o.buildIndexFor = function(t) {
|
|
660
|
+
for (var n = /* @__PURE__ */ Object.create(null), i = this[P].RuleType, l = !0, f = !1, y = 0; y < t.length; y++) {
|
|
661
|
+
var w = new i(t[y]), m = this.expandActions(w.actions), F = et(w.subject), x = t.length - y - 1;
|
|
662
|
+
l = !!(l && w.inverted), !f && w.fields && (f = !0);
|
|
663
|
+
for (var b = 0; b < F.length; b++) {
|
|
664
|
+
var E = F[b];
|
|
665
|
+
n[E] = n[E] || /* @__PURE__ */ Object.create(null);
|
|
666
|
+
for (var j = 0; j < m.length; j++) {
|
|
667
|
+
var I = m[j];
|
|
668
|
+
n[E][I] = n[E][I] || /* @__PURE__ */ Object.create(null), n[E][I][x] = w;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return {
|
|
673
|
+
isAllInverted: l,
|
|
674
|
+
hasPerFieldRules: f,
|
|
675
|
+
rules: n
|
|
676
|
+
};
|
|
677
|
+
}, o.expandActions = function(t) {
|
|
678
|
+
for (var n = this[P].aliases, i = et(t), l = 0; l < i.length; ) {
|
|
679
|
+
var f = i[l++];
|
|
680
|
+
n.hasOwnProperty(f) && (i = i.concat(n[f]));
|
|
681
|
+
}
|
|
682
|
+
return i;
|
|
683
|
+
}, o.can = function(t, n, i) {
|
|
684
|
+
if (i && typeof i != "string")
|
|
685
|
+
throw new Error("Ability.can expects 3rd parameter to be a string. See https://stalniy.github.io/casl/abilities/2017/07/21/check-abilities.html#checking-fields for details");
|
|
686
|
+
var l = this.relevantRuleFor(t, n, i);
|
|
687
|
+
return !!l && !l.inverted;
|
|
688
|
+
}, o.relevantRuleFor = function(t, n, i) {
|
|
689
|
+
for (var l = this.rulesFor(t, n, i), f = 0; f < l.length; f++)
|
|
690
|
+
if (l[f].matches(n))
|
|
691
|
+
return l[f];
|
|
692
|
+
return null;
|
|
693
|
+
}, o.possibleRulesFor = function(t, n) {
|
|
694
|
+
var i = this.subjectName(n), l = this[P].mergedRules, f = i + "_" + t;
|
|
695
|
+
return l[f] || (l[f] = this.mergeRulesFor(t, i)), l[f];
|
|
696
|
+
}, o.mergeRulesFor = function(t, n) {
|
|
697
|
+
var i = this[P].indexedRules, l = [n, "all"].reduce(function(f, y) {
|
|
698
|
+
var w = i[y];
|
|
699
|
+
return w ? Object.assign(f, w[t], w.manage) : f;
|
|
700
|
+
}, []);
|
|
701
|
+
return l.filter(Boolean);
|
|
702
|
+
}, o.rulesFor = function(t, n, i) {
|
|
703
|
+
var l = this.possibleRulesFor(t, n);
|
|
704
|
+
return this[P].hasPerFieldRules ? l.filter(function(f) {
|
|
705
|
+
return f.isRelevantFor(n, i);
|
|
706
|
+
}) : l;
|
|
707
|
+
}, o.cannot = function() {
|
|
708
|
+
return !this.can.apply(this, arguments);
|
|
709
|
+
}, o.throwUnlessCan = function() {
|
|
710
|
+
var t;
|
|
711
|
+
console.warn(`
|
|
712
|
+
Ability.throwUnlessCan is deprecated and will be removed in 4.x version.
|
|
713
|
+
Please use "ForbiddenError.from(ability).throwUnlessCan(...)" instead.
|
|
714
|
+
`.trim()), (t = Wt.from(this)).throwUnlessCan.apply(t, arguments);
|
|
715
|
+
}, o.on = function(t, n) {
|
|
716
|
+
var i = this[P].events, l = !0;
|
|
717
|
+
return i[t] || (i[t] = []), i[t].push(n), function() {
|
|
718
|
+
if (l) {
|
|
719
|
+
var f = i[t].indexOf(n);
|
|
720
|
+
i[t].splice(f, 1), l = !1;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}, o.emit = function(t, n) {
|
|
724
|
+
var i = this[P].events[t];
|
|
725
|
+
i && i.slice(0).forEach(function(l) {
|
|
726
|
+
return l(n);
|
|
727
|
+
});
|
|
728
|
+
}, qt(e, [{
|
|
729
|
+
key: "rules",
|
|
730
|
+
get: function() {
|
|
731
|
+
return this[P].originalRules;
|
|
732
|
+
}
|
|
733
|
+
}]), e;
|
|
734
|
+
}();
|
|
735
|
+
function ue(e) {
|
|
736
|
+
return new se(e).can("manage", "business::miniProgram::brandkit");
|
|
737
|
+
}
|
|
738
|
+
function V() {
|
|
739
|
+
var o;
|
|
740
|
+
const e = ((o = Mt().sessionUser.value) == null ? void 0 : o.permissions) ?? [];
|
|
741
|
+
return ue(
|
|
742
|
+
e.map(({ fields: s, inverted: t, reason: n, ...i }) => ({
|
|
743
|
+
...i,
|
|
744
|
+
fields: s ?? void 0,
|
|
745
|
+
inverted: t ?? void 0,
|
|
746
|
+
reason: n ?? void 0
|
|
747
|
+
}))
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
function je() {
|
|
751
|
+
return B(V);
|
|
752
|
+
}
|
|
753
|
+
const U = [
|
|
754
|
+
{ path: "primary", label: "Primary", group: "Brand", hint: "Dominant brand color" },
|
|
755
|
+
{
|
|
756
|
+
path: "secondary",
|
|
757
|
+
label: "Secondary",
|
|
758
|
+
group: "Brand",
|
|
759
|
+
hint: "Light supporting fill — primary-colored text renders on top, keep it a light tint"
|
|
760
|
+
},
|
|
761
|
+
{ path: "accent", label: "Accent", group: "Brand", hint: "Highlight / CTA pop" },
|
|
762
|
+
{ path: "background.base", label: "Base", group: "Background", hint: "Page background" },
|
|
763
|
+
{ path: "background.elevated", label: "Elevated", group: "Background", hint: "Cards / sheets" },
|
|
764
|
+
{ path: "neutral.light", label: "Light", group: "Neutral", hint: "Borders / dividers" },
|
|
765
|
+
{ path: "neutral.mid", label: "Mid", group: "Neutral" },
|
|
766
|
+
{
|
|
767
|
+
path: "neutral.dark",
|
|
768
|
+
label: "Dark",
|
|
769
|
+
group: "Neutral",
|
|
770
|
+
hint: "Doubles as the modal scrim — keep near-black"
|
|
771
|
+
},
|
|
772
|
+
{ path: "text.onPrimary", label: "On primary", group: "Text", hint: "Text on a brand fill" },
|
|
773
|
+
{ path: "text.primary", label: "Primary", group: "Text" },
|
|
774
|
+
{ path: "text.secondary", label: "Secondary", group: "Text" },
|
|
775
|
+
{ path: "text.tertiary", label: "Tertiary", group: "Text" },
|
|
776
|
+
{ path: "status.success", label: "Success", group: "Status" },
|
|
777
|
+
{ path: "status.warning", label: "Warning", group: "Status" },
|
|
778
|
+
{ path: "status.error", label: "Error", group: "Status" },
|
|
779
|
+
{ path: "status.info", label: "Info", group: "Status" }
|
|
780
|
+
], N = [
|
|
781
|
+
{ path: "brand", label: "Brand", group: "Fonts", hint: "Logo / wordmark contexts" },
|
|
782
|
+
{ path: "heading", label: "Heading", group: "Fonts" },
|
|
783
|
+
{ path: "body", label: "Body", group: "Fonts" }
|
|
784
|
+
], rt = "HORIZONTAL", nt = "LIST", Ot = {
|
|
785
|
+
category: ["HORIZONTAL", "VERTICAL"],
|
|
786
|
+
items: ["LIST", "GRID"]
|
|
787
|
+
}, le = { category: "VERTICAL", singleCategory: !1 };
|
|
788
|
+
function ce(e) {
|
|
789
|
+
const o = $(e, "ordering.app.category");
|
|
790
|
+
return o === "VERTICAL" || o === "HORIZONTAL" ? o : rt;
|
|
791
|
+
}
|
|
792
|
+
function fe(e) {
|
|
793
|
+
return $(e, "ordering.app.items") === "GRID" ? "GRID" : nt;
|
|
794
|
+
}
|
|
795
|
+
function de(e, o, s) {
|
|
796
|
+
(!e.ordering || typeof e.ordering != "object") && (e.ordering = { kiosk: { ...le } });
|
|
797
|
+
const t = e.ordering;
|
|
798
|
+
(!t.app || typeof t.app != "object") && (t.app = { singleCategory: !1 });
|
|
799
|
+
const n = t.app;
|
|
800
|
+
for (const i of ["category", "items"])
|
|
801
|
+
(s.includes(i) || !Ot[i].includes(n[i])) && (n[i] = o[i]);
|
|
802
|
+
}
|
|
803
|
+
const St = {
|
|
804
|
+
primary: "#ff7823",
|
|
805
|
+
secondary: "#fff3e6",
|
|
806
|
+
accent: "#B25300",
|
|
807
|
+
"background.base": "#F8F8F8",
|
|
808
|
+
"background.elevated": "#FFFFFF",
|
|
809
|
+
"neutral.light": "#DADADA",
|
|
810
|
+
"neutral.mid": "#B2B3B6",
|
|
811
|
+
"neutral.dark": "#1C1C1E",
|
|
812
|
+
"text.onPrimary": "#FFFFFF",
|
|
813
|
+
"text.primary": "#1C1C1E",
|
|
814
|
+
"text.secondary": "#555555",
|
|
815
|
+
"text.tertiary": "#A2A09E",
|
|
816
|
+
"status.success": "#10B981",
|
|
817
|
+
"status.warning": "#F59E0B",
|
|
818
|
+
"status.error": "#EF4444",
|
|
819
|
+
"status.info": "#3B82F6"
|
|
820
|
+
}, Pt = {
|
|
821
|
+
brand: "'Inter', sans-serif",
|
|
822
|
+
heading: "'Inter', sans-serif",
|
|
823
|
+
body: "'Roboto', sans-serif"
|
|
824
|
+
}, Rt = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
825
|
+
function pe(e) {
|
|
826
|
+
return Rt.test(e.trim());
|
|
827
|
+
}
|
|
828
|
+
function mt(e) {
|
|
829
|
+
const o = e.trim().toLowerCase();
|
|
830
|
+
if (!Rt.test(o)) return "#000000";
|
|
831
|
+
if (o.length === 7) return o;
|
|
832
|
+
const [s, t, n] = o.slice(1);
|
|
833
|
+
return `#${s}${s}${t}${t}${n}${n}`;
|
|
834
|
+
}
|
|
835
|
+
function he() {
|
|
836
|
+
return Lt(Ct("fmmf:dev")).apiOrigin;
|
|
837
|
+
}
|
|
838
|
+
function lt(e) {
|
|
839
|
+
return `${he()}/metadata/${e}/brandkit`;
|
|
840
|
+
}
|
|
841
|
+
function $(e, o) {
|
|
842
|
+
let s = e;
|
|
843
|
+
for (const t of o.split(".")) {
|
|
844
|
+
if (!s || typeof s != "object") return;
|
|
845
|
+
s = s[t];
|
|
846
|
+
}
|
|
847
|
+
return s;
|
|
848
|
+
}
|
|
849
|
+
function ot(e, o, s) {
|
|
850
|
+
const t = o.split("."), n = t.pop();
|
|
851
|
+
if (!n) return;
|
|
852
|
+
let i = e;
|
|
853
|
+
for (const l of t) {
|
|
854
|
+
const f = i[l];
|
|
855
|
+
(!f || typeof f != "object") && (i[l] = {}), i = i[l];
|
|
856
|
+
}
|
|
857
|
+
i[n] = s;
|
|
858
|
+
}
|
|
859
|
+
function it(e, o, s) {
|
|
860
|
+
const t = {};
|
|
861
|
+
for (const n of s) {
|
|
862
|
+
const i = $(e == null ? void 0 : e[o], n.path);
|
|
863
|
+
t[n.path] = typeof i == "string" ? i : "";
|
|
864
|
+
}
|
|
865
|
+
return t;
|
|
866
|
+
}
|
|
867
|
+
function at(e) {
|
|
868
|
+
return JSON.parse(JSON.stringify(e));
|
|
869
|
+
}
|
|
870
|
+
const u = Nt({
|
|
871
|
+
panelOpen: !1,
|
|
872
|
+
loading: !1,
|
|
873
|
+
saving: !1,
|
|
874
|
+
loaded: !1,
|
|
875
|
+
error: null,
|
|
876
|
+
businessId: null,
|
|
877
|
+
colors: {},
|
|
878
|
+
fonts: {},
|
|
879
|
+
savedColors: {},
|
|
880
|
+
savedFonts: {},
|
|
881
|
+
categoryLayout: rt,
|
|
882
|
+
savedCategoryLayout: rt,
|
|
883
|
+
menuItems: nt,
|
|
884
|
+
savedMenuItems: nt,
|
|
885
|
+
// Full kit as it was before our last save — the only undo colors get.
|
|
886
|
+
revertKit: null,
|
|
887
|
+
appliedProposal: null
|
|
888
|
+
});
|
|
889
|
+
async function ct(e) {
|
|
890
|
+
const o = await fetch(lt(e), { signal: AbortSignal.timeout(15e3) });
|
|
891
|
+
if (o.status === 404) return null;
|
|
892
|
+
if (!o.ok) throw new Error(`GET brandkit failed: HTTP ${o.status}`);
|
|
893
|
+
return await o.json();
|
|
894
|
+
}
|
|
895
|
+
function Y(e) {
|
|
896
|
+
u.colors = it(e, "colors", U), u.fonts = it(e, "fonts", N), u.savedColors = { ...u.colors }, u.savedFonts = { ...u.fonts }, u.categoryLayout = ce(e), u.savedCategoryLayout = u.categoryLayout, u.menuItems = fe(e), u.savedMenuItems = u.menuItems, u.loaded = !0;
|
|
897
|
+
}
|
|
898
|
+
let C = null, R = 0, D = null;
|
|
899
|
+
function $t(e = !1) {
|
|
900
|
+
const o = _();
|
|
901
|
+
if (u.loaded && !e && u.businessId === o) return Promise.resolve();
|
|
902
|
+
if ((C == null ? void 0 : C.businessId) === o) return C.promise;
|
|
903
|
+
const s = ++R;
|
|
904
|
+
u.businessId !== o && (u.businessId = o, u.loaded = !1, u.revertKit = null, D = null, u.appliedProposal = null, Y(null), u.loaded = !1);
|
|
905
|
+
const t = (async () => {
|
|
906
|
+
u.loading = !0, u.error = null;
|
|
907
|
+
try {
|
|
908
|
+
const n = await ct(o);
|
|
909
|
+
s === R && Y(n);
|
|
910
|
+
} catch (n) {
|
|
911
|
+
s === R && (u.error = st(n));
|
|
912
|
+
} finally {
|
|
913
|
+
s === R && (u.loading = !1, C = null);
|
|
914
|
+
}
|
|
915
|
+
})();
|
|
916
|
+
return C = { businessId: o, promise: t }, t;
|
|
917
|
+
}
|
|
918
|
+
function Et() {
|
|
919
|
+
const e = U.filter((t) => u.colors[t.path] !== u.savedColors[t.path]).map(
|
|
920
|
+
(t) => t.path
|
|
921
|
+
), o = N.filter((t) => u.fonts[t.path] !== u.savedFonts[t.path]).map(
|
|
922
|
+
(t) => t.path
|
|
923
|
+
), s = [];
|
|
924
|
+
return u.categoryLayout !== u.savedCategoryLayout && s.push("category"), u.menuItems !== u.savedMenuItems && s.push("items"), { colorPaths: e, fontPaths: o, layoutFields: s };
|
|
925
|
+
}
|
|
926
|
+
const ge = B(() => {
|
|
927
|
+
const { colorPaths: e, fontPaths: o, layoutFields: s } = Et();
|
|
928
|
+
return e.length + o.length + s.length;
|
|
929
|
+
}), _t = B(
|
|
930
|
+
() => U.some((e) => {
|
|
931
|
+
const o = u.colors[e.path] ?? "";
|
|
932
|
+
return o !== "" && !pe(o);
|
|
933
|
+
})
|
|
934
|
+
);
|
|
935
|
+
async function ye() {
|
|
936
|
+
const e = _();
|
|
937
|
+
if (!V())
|
|
938
|
+
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
939
|
+
if (u.saving || u.loading || !u.loaded || u.businessId !== e)
|
|
940
|
+
throw new Error("Wait for the current Brand Kit to finish loading or saving.");
|
|
941
|
+
if (_t.value) throw new Error("Enter valid hex colors before saving.");
|
|
942
|
+
const { colorPaths: o, fontPaths: s, layoutFields: t } = Et();
|
|
943
|
+
if (!o.length && !s.length && !t.length) return;
|
|
944
|
+
const n = { ...u.colors }, i = { ...u.fonts }, l = { category: u.categoryLayout, items: u.menuItems }, f = R;
|
|
945
|
+
u.saving = !0, u.error = null;
|
|
946
|
+
try {
|
|
947
|
+
const y = await ct(e) ?? {}, w = at(y), m = at(y);
|
|
948
|
+
o.length && (!m.colors || typeof m.colors != "object") && (m.colors = {}), s.length && (!m.fonts || typeof m.fonts != "object") && (m.fonts = {});
|
|
949
|
+
for (const b of o) ot(m.colors, b, (n[b] ?? "").trim());
|
|
950
|
+
for (const b of s) ot(m.fonts, b, (i[b] ?? "").trim());
|
|
951
|
+
s.length && (m.fontFamilies = Kt(y.fontFamilies, it(m, "fonts", N)));
|
|
952
|
+
const F = t.length ? ["category", "items"].filter(
|
|
953
|
+
(b) => t.includes(b) || !Ot[b].includes($(y, `ordering.app.${b}`))
|
|
954
|
+
) : [];
|
|
955
|
+
if (t.length && de(m, l, t), f !== R || e !== _())
|
|
956
|
+
throw new Error("Business changed. No Brand Kit was saved.");
|
|
957
|
+
const x = await fetch(lt(e), {
|
|
958
|
+
method: "POST",
|
|
959
|
+
headers: { "Content-Type": "application/json" },
|
|
960
|
+
body: JSON.stringify(m),
|
|
961
|
+
signal: AbortSignal.timeout(2e4)
|
|
962
|
+
});
|
|
963
|
+
if (!x.ok) throw new Error(`Save failed: HTTP ${x.status}`);
|
|
964
|
+
f === R && e === _() && (u.revertKit = w, D = {
|
|
965
|
+
colorPaths: o,
|
|
966
|
+
fontPaths: s,
|
|
967
|
+
savedFontFamilies: s.length ? JSON.stringify(m.fontFamilies) : void 0,
|
|
968
|
+
...F.length ? {
|
|
969
|
+
menuLayout: {
|
|
970
|
+
fields: F,
|
|
971
|
+
previous: Object.fromEntries(F.map((b) => [b, $(y, `ordering.app.${b}`)]))
|
|
972
|
+
}
|
|
973
|
+
} : {}
|
|
974
|
+
}, u.appliedProposal = null, Y(m));
|
|
975
|
+
} catch (y) {
|
|
976
|
+
throw f === R && (u.error = st(y)), y;
|
|
977
|
+
} finally {
|
|
978
|
+
u.saving = !1;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
async function ve() {
|
|
982
|
+
if (!u.revertKit || !D || u.saving || u.loading) return;
|
|
983
|
+
const e = _();
|
|
984
|
+
if (!V())
|
|
985
|
+
throw u.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(u.error);
|
|
986
|
+
if (u.businessId !== e) throw new Error("Load the current business before reverting.");
|
|
987
|
+
const o = R, s = at(u.revertKit), t = D;
|
|
988
|
+
u.saving = !0, u.error = null;
|
|
989
|
+
try {
|
|
990
|
+
const n = await ct(e) ?? {};
|
|
991
|
+
if (t.fontPaths.length) {
|
|
992
|
+
if (N.some((l) => ($(n.fonts, l.path) ?? "") !== u.savedFonts[l.path]) || JSON.stringify(n.fontFamilies) !== t.savedFontFamilies)
|
|
993
|
+
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
994
|
+
Object.hasOwn(s, "fontFamilies") ? n.fontFamilies = s.fontFamilies : delete n.fontFamilies;
|
|
995
|
+
}
|
|
996
|
+
for (const [l, f] of [
|
|
997
|
+
["colors", t.colorPaths],
|
|
998
|
+
["fonts", t.fontPaths]
|
|
999
|
+
]) {
|
|
1000
|
+
const y = l === "colors" ? u.savedColors : u.savedFonts;
|
|
1001
|
+
for (const w of f) {
|
|
1002
|
+
if (($(n[l], w) ?? "") !== y[w])
|
|
1003
|
+
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1004
|
+
(!n[l] || typeof n[l] != "object") && (n[l] = {});
|
|
1005
|
+
const m = $(s[l], w);
|
|
1006
|
+
if (typeof m == "string") ot(n[l], w, m);
|
|
1007
|
+
else {
|
|
1008
|
+
const F = w.split("."), x = F.pop(), b = F.length ? $(n[l], F.join(".")) : n[l];
|
|
1009
|
+
b && typeof b == "object" && delete b[x];
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
if (t.menuLayout) {
|
|
1014
|
+
const l = { category: u.savedCategoryLayout, items: u.savedMenuItems };
|
|
1015
|
+
if (t.menuLayout.fields.some((y) => $(n, `ordering.app.${y}`) !== l[y]))
|
|
1016
|
+
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
1017
|
+
const f = $(n, "ordering.app");
|
|
1018
|
+
for (const y of t.menuLayout.fields) {
|
|
1019
|
+
if (!f || typeof f != "object") break;
|
|
1020
|
+
const w = t.menuLayout.previous[y];
|
|
1021
|
+
w === void 0 ? delete f[y] : f[y] = w;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
if (o !== R || e !== _())
|
|
1025
|
+
throw new Error("Business changed. No Brand Kit was reverted.");
|
|
1026
|
+
const i = await fetch(lt(e), {
|
|
1027
|
+
method: "POST",
|
|
1028
|
+
headers: { "Content-Type": "application/json" },
|
|
1029
|
+
body: JSON.stringify(n),
|
|
1030
|
+
signal: AbortSignal.timeout(2e4)
|
|
1031
|
+
});
|
|
1032
|
+
if (!i.ok) throw new Error(`Revert failed: HTTP ${i.status}`);
|
|
1033
|
+
o === R && e === _() && (u.revertKit = null, D = null, Y(n));
|
|
1034
|
+
} catch (n) {
|
|
1035
|
+
throw o === R && (u.error = st(n)), n;
|
|
1036
|
+
} finally {
|
|
1037
|
+
u.saving = !1;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
async function me(e) {
|
|
1041
|
+
u.panelOpen = !0;
|
|
1042
|
+
const o = _();
|
|
1043
|
+
if (await $t(), !(!u.loaded || u.loading || u.saving || u.businessId !== o || _() !== o)) {
|
|
1044
|
+
for (const s of U) {
|
|
1045
|
+
const t = e.colors[s.path];
|
|
1046
|
+
t && (u.colors[s.path] = t);
|
|
1047
|
+
}
|
|
1048
|
+
for (const s of N) {
|
|
1049
|
+
const t = e.fonts[s.path];
|
|
1050
|
+
t && (u.fonts[s.path] = t);
|
|
1051
|
+
}
|
|
1052
|
+
u.appliedProposal = e.name ?? "Untitled proposal";
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
function be() {
|
|
1056
|
+
u.colors = { ...u.savedColors }, u.fonts = { ...u.savedFonts }, u.categoryLayout = u.savedCategoryLayout, u.menuItems = u.savedMenuItems, u.appliedProposal = null;
|
|
1057
|
+
}
|
|
1058
|
+
const we = B(
|
|
1059
|
+
() => U.every((e) => mt(u.colors[e.path] ?? "") === mt(St[e.path]))
|
|
1060
|
+
), Fe = B(
|
|
1061
|
+
() => N.every((e) => u.fonts[e.path] === Pt[e.path])
|
|
1062
|
+
);
|
|
1063
|
+
function Oe(e) {
|
|
1064
|
+
!V() || !u.loaded || u.loading || u.saving || u.businessId !== _() || (e === "colors" ? u.colors = { ...St } : u.fonts = { ...Pt }, u.appliedProposal = null);
|
|
1065
|
+
}
|
|
1066
|
+
function Ae() {
|
|
1067
|
+
return {
|
|
1068
|
+
state: u,
|
|
1069
|
+
dirtyCount: ge,
|
|
1070
|
+
hasInvalidColor: _t,
|
|
1071
|
+
colorsAreDefault: we,
|
|
1072
|
+
fontsAreDefault: Fe,
|
|
1073
|
+
load: $t,
|
|
1074
|
+
save: ye,
|
|
1075
|
+
revertLastSave: ve,
|
|
1076
|
+
applyProposal: me,
|
|
1077
|
+
resetToDefault: Oe,
|
|
1078
|
+
discardEdits: be
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
export {
|
|
1082
|
+
U as C,
|
|
1083
|
+
N as F,
|
|
1084
|
+
ut as G,
|
|
1085
|
+
je as a,
|
|
1086
|
+
Bt as b,
|
|
1087
|
+
_e as f,
|
|
1088
|
+
pe as i,
|
|
1089
|
+
xe as l,
|
|
1090
|
+
mt as t,
|
|
1091
|
+
Ae as u
|
|
1092
|
+
};
|