@feedmepos/mf-miniprogram-v2 0.2.2-dev.8 → 0.2.2-dev.9
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-BtDqnBq4.js +193 -0
- package/dist/AppTemplatePicker-eKlQ0c54.js +184 -0
- package/dist/BrandFontPicker-CyLbp5nr.js +240 -0
- package/dist/BrandKitView-CaxS1T-W.js +217 -0
- package/dist/{ControlPlaneView-BYxujllj.js → ControlPlaneView-DGDA8EFh.js} +7328 -7367
- package/dist/{EcosystemView-B6asKyTg.js → EcosystemView-Cx-3k7lB.js} +116 -138
- package/dist/{LegacyWorkspaceEntry-7DvIosoj.js → LegacyWorkspaceEntry-opz_kWz9.js} +1 -1
- package/dist/MobileProjectsView-DEQ6q6Si.js +279 -0
- package/dist/{ModuleCenterView-Dqp-2hbL.js → ModuleCenterView-DEShxy_e.js} +1 -1
- package/dist/{ModuleDetailView-cpQ_UfS9.js → ModuleDetailView-BSndm4ov.js} +1 -1
- package/dist/{PagesView-CYc8LFYz.js → PagesView-CegMd6GC.js} +1 -1
- package/dist/{PortalSettingsView-CTy8c39M.js → PortalSettingsView-DFz6FUd9.js} +3 -3
- package/dist/{WorkspaceEntryView-aQfuZAPL.js → WorkspaceEntryView-e2EUnq9A.js} +1 -1
- package/dist/app.js +16 -10
- package/dist/{controlPlane-wUT1G_Gr.js → controlPlane-CoEgf9BA.js} +9 -9
- package/dist/{index-BDHUHtRw.js → index-D5qXvcfE.js} +24 -15
- package/dist/package.json +1 -1
- package/dist/{portalContext-CTVzkJV7.js → portalContext-C4HL_0kl.js} +2 -2
- package/dist/{routes-L0ady_Wy.js → routes-Boz_WlNM.js} +1 -0
- package/dist/style.css +1 -1
- package/dist/useBrandKit-BlKlqpo2.js +1020 -0
- package/dist/{useModuleCatalog-CD5N246F.js → useModuleCatalog-CkNuZzNM.js} +2 -2
- package/package.json +1 -1
- package/dist/App-KR6Q0u_b.js +0 -213
- package/dist/BrandKitView-B8t8RkHr.js +0 -221
- package/dist/useBrandKit-CpyR2j6m.js +0 -924
|
@@ -1,924 +0,0 @@
|
|
|
1
|
-
import { computed as tt, reactive as St } from "vue";
|
|
2
|
-
import { a as Rt, e as jt } from "./index-BDHUHtRw.js";
|
|
3
|
-
import { g as E, e as et } from "./controlPlane-wUT1G_Gr.js";
|
|
4
|
-
import { useCoreStore as xt } from "@feedmepos/mf-common";
|
|
5
|
-
var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
6
|
-
function Ft(n) {
|
|
7
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
8
|
-
}
|
|
9
|
-
var ht = { exports: {} };
|
|
10
|
-
(function(n, a) {
|
|
11
|
-
(function(u, e) {
|
|
12
|
-
n.exports = e();
|
|
13
|
-
})(Et, function() {
|
|
14
|
-
return function(u) {
|
|
15
|
-
var e = {};
|
|
16
|
-
function r(i) {
|
|
17
|
-
if (e[i]) return e[i].exports;
|
|
18
|
-
var l = e[i] = { i, l: !1, exports: {} };
|
|
19
|
-
return u[i].call(l.exports, l, l.exports, r), l.l = !0, l.exports;
|
|
20
|
-
}
|
|
21
|
-
return r.m = u, r.c = e, r.d = function(i, l, d) {
|
|
22
|
-
r.o(i, l) || Object.defineProperty(i, l, { enumerable: !0, get: d });
|
|
23
|
-
}, r.r = function(i) {
|
|
24
|
-
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
|
|
25
|
-
}, r.t = function(i, l) {
|
|
26
|
-
if (1 & l && (i = r(i)), 8 & l || 4 & l && typeof i == "object" && i && i.__esModule) return i;
|
|
27
|
-
var d = /* @__PURE__ */ Object.create(null);
|
|
28
|
-
if (r.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: i }), 2 & l && typeof i != "string")
|
|
29
|
-
for (var y in i)
|
|
30
|
-
r.d(
|
|
31
|
-
d,
|
|
32
|
-
y,
|
|
33
|
-
(function(b) {
|
|
34
|
-
return i[b];
|
|
35
|
-
}).bind(null, y)
|
|
36
|
-
);
|
|
37
|
-
return d;
|
|
38
|
-
}, r.n = function(i) {
|
|
39
|
-
var l = i && i.__esModule ? function() {
|
|
40
|
-
return i.default;
|
|
41
|
-
} : function() {
|
|
42
|
-
return i;
|
|
43
|
-
};
|
|
44
|
-
return r.d(l, "a", l), l;
|
|
45
|
-
}, r.o = function(i, l) {
|
|
46
|
-
return Object.prototype.hasOwnProperty.call(i, l);
|
|
47
|
-
}, r.p = "", r(r.s = 0);
|
|
48
|
-
}([
|
|
49
|
-
function(u, e, r) {
|
|
50
|
-
u.exports = r(1);
|
|
51
|
-
},
|
|
52
|
-
function(u, e, r) {
|
|
53
|
-
function i(t) {
|
|
54
|
-
return (i = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
55
|
-
return typeof o;
|
|
56
|
-
} : function(o) {
|
|
57
|
-
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
58
|
-
})(t);
|
|
59
|
-
}
|
|
60
|
-
function l(t) {
|
|
61
|
-
var o = "[object " + t + "]";
|
|
62
|
-
return function(s) {
|
|
63
|
-
return Object.prototype.toString.call(s) === o;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
r.r(e), r.d(e, "default", function() {
|
|
67
|
-
return Ot;
|
|
68
|
-
}), r.d(e, "compare", function() {
|
|
69
|
-
return ut;
|
|
70
|
-
}), r.d(e, "comparable", function() {
|
|
71
|
-
return G;
|
|
72
|
-
});
|
|
73
|
-
var d = l("Array"), y = l("Object"), b = l("Function");
|
|
74
|
-
function m(t, o) {
|
|
75
|
-
return b(t.get) ? t.get(o) : t[o];
|
|
76
|
-
}
|
|
77
|
-
function w(t) {
|
|
78
|
-
return function(o, s) {
|
|
79
|
-
if (!d(s) || !s.length) return t(o, s);
|
|
80
|
-
for (var f = 0, p = s.length; f < p; f++)
|
|
81
|
-
if (t(o, m(s, f))) return !0;
|
|
82
|
-
return !1;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function T(t) {
|
|
86
|
-
return function(o, s) {
|
|
87
|
-
if (!d(s) || !s.length) return t(o, s);
|
|
88
|
-
for (var f = 0, p = s.length; f < p; f++)
|
|
89
|
-
if (!t(o, m(s, f))) return !1;
|
|
90
|
-
return !0;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function P(t, o, s, f) {
|
|
94
|
-
return t.validate(t.options, o, s, f);
|
|
95
|
-
}
|
|
96
|
-
var R = {
|
|
97
|
-
$eq: w(function(t, o) {
|
|
98
|
-
return t(o);
|
|
99
|
-
}),
|
|
100
|
-
$ne: T(function(t, o) {
|
|
101
|
-
return t(o);
|
|
102
|
-
}),
|
|
103
|
-
$gt: w(function(t, o) {
|
|
104
|
-
return t(o);
|
|
105
|
-
}),
|
|
106
|
-
$gte: w(function(t, o) {
|
|
107
|
-
return t(o);
|
|
108
|
-
}),
|
|
109
|
-
$lt: w(function(t, o) {
|
|
110
|
-
return t(o);
|
|
111
|
-
}),
|
|
112
|
-
$lte: w(function(t, o) {
|
|
113
|
-
return t(o);
|
|
114
|
-
}),
|
|
115
|
-
$mod: w(function(t, o) {
|
|
116
|
-
return t(o);
|
|
117
|
-
}),
|
|
118
|
-
$in: function(t, o) {
|
|
119
|
-
return t(o);
|
|
120
|
-
},
|
|
121
|
-
$nin: function(t, o) {
|
|
122
|
-
return t(o);
|
|
123
|
-
},
|
|
124
|
-
$not: function(t, o, s, f) {
|
|
125
|
-
return t(o, s, f);
|
|
126
|
-
},
|
|
127
|
-
$type: function(t, o) {
|
|
128
|
-
return t(o);
|
|
129
|
-
},
|
|
130
|
-
$all: function(t, o, s, f) {
|
|
131
|
-
return R.$and(t, o, s, f);
|
|
132
|
-
},
|
|
133
|
-
$size: function(t, o) {
|
|
134
|
-
return !!o && t === o.length;
|
|
135
|
-
},
|
|
136
|
-
$or: function(t, o, s, f) {
|
|
137
|
-
for (var p = 0, h = t.length; p < h; p++)
|
|
138
|
-
if (P(m(t, p), o, s, f)) return !0;
|
|
139
|
-
return !1;
|
|
140
|
-
},
|
|
141
|
-
$nor: function(t, o, s, f) {
|
|
142
|
-
return !R.$or(t, o, s, f);
|
|
143
|
-
},
|
|
144
|
-
$and: function(t, o, s, f) {
|
|
145
|
-
for (var p = 0, h = t.length; p < h; p++)
|
|
146
|
-
if (!P(m(t, p), o, s, f)) return !1;
|
|
147
|
-
return !0;
|
|
148
|
-
},
|
|
149
|
-
$regex: w(function(t, o) {
|
|
150
|
-
return typeof o == "string" && t.test(o);
|
|
151
|
-
}),
|
|
152
|
-
$where: function(t, o, s, f) {
|
|
153
|
-
return t.call(o, o, s, f);
|
|
154
|
-
},
|
|
155
|
-
$elemMatch: function(t, o, s, f) {
|
|
156
|
-
return d(o) ? !!~function(p, h) {
|
|
157
|
-
for (var v = 0; v < p.length; v++)
|
|
158
|
-
if (m(p, v), P(h, m(p, v))) return v;
|
|
159
|
-
return -1;
|
|
160
|
-
}(o, t) : P(t, o, s, f);
|
|
161
|
-
},
|
|
162
|
-
$exists: function(t, o, s, f) {
|
|
163
|
-
return f.hasOwnProperty(s) === t;
|
|
164
|
-
}
|
|
165
|
-
}, j = {
|
|
166
|
-
$eq: function(t, o, s) {
|
|
167
|
-
var f = s.comparable, p = s.compare;
|
|
168
|
-
return t instanceof RegExp ? w(function(h) {
|
|
169
|
-
return typeof h == "string" && t.test(h);
|
|
170
|
-
}) : t instanceof Function ? w(t) : d(t) && !t.length ? w(function(h) {
|
|
171
|
-
return d(h) && !h.length;
|
|
172
|
-
}) : w(
|
|
173
|
-
t === null ? function(h) {
|
|
174
|
-
return h == null;
|
|
175
|
-
} : function(h) {
|
|
176
|
-
return p(f(h), f(t)) === 0;
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
},
|
|
180
|
-
$gt: function(t, o, s) {
|
|
181
|
-
var f = s.comparable, p = s.compare;
|
|
182
|
-
return function(h) {
|
|
183
|
-
return p(f(h), f(t)) > 0;
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
$gte: function(t, o, s) {
|
|
187
|
-
var f = s.comparable, p = s.compare;
|
|
188
|
-
return function(h) {
|
|
189
|
-
return p(f(h), f(t)) >= 0;
|
|
190
|
-
};
|
|
191
|
-
},
|
|
192
|
-
$lt: function(t, o, s) {
|
|
193
|
-
var f = s.comparable, p = s.compare;
|
|
194
|
-
return function(h) {
|
|
195
|
-
return p(f(h), f(t)) < 0;
|
|
196
|
-
};
|
|
197
|
-
},
|
|
198
|
-
$lte: function(t, o, s) {
|
|
199
|
-
var f = s.comparable, p = s.compare;
|
|
200
|
-
return function(h) {
|
|
201
|
-
return p(f(h), f(t)) <= 0;
|
|
202
|
-
};
|
|
203
|
-
},
|
|
204
|
-
$in: function(t, o, s) {
|
|
205
|
-
var f = s.comparable;
|
|
206
|
-
return function(p) {
|
|
207
|
-
if (!(p instanceof Array)) {
|
|
208
|
-
var h = f(p);
|
|
209
|
-
if (h === p && i(p) === "object") {
|
|
210
|
-
for (g = t.length; g--; )
|
|
211
|
-
if (String(t[g]) === String(p) && String(p) !== "[object Object]")
|
|
212
|
-
return !0;
|
|
213
|
-
}
|
|
214
|
-
if (h === void 0) {
|
|
215
|
-
for (g = t.length; g--; ) if (t[g] == null) return !0;
|
|
216
|
-
}
|
|
217
|
-
for (g = t.length; g--; ) {
|
|
218
|
-
var v = P(at(m(t, g), s), h, g, t);
|
|
219
|
-
if (v && String(v) !== "[object Object]" && String(h) !== "[object Object]")
|
|
220
|
-
return !0;
|
|
221
|
-
}
|
|
222
|
-
return !!~t.indexOf(h);
|
|
223
|
-
}
|
|
224
|
-
for (var g = p.length; g--; )
|
|
225
|
-
if (~t.indexOf(f(m(p, g)))) return !0;
|
|
226
|
-
return !1;
|
|
227
|
-
};
|
|
228
|
-
},
|
|
229
|
-
$nin: function(t, o, s) {
|
|
230
|
-
var f = j.$in(t, o, s);
|
|
231
|
-
return function(p, h, v, g) {
|
|
232
|
-
return !f(p, h, v, g);
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
$mod: function(t) {
|
|
236
|
-
return function(o) {
|
|
237
|
-
return o % t[0] == t[1];
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
$ne: function(t, o, s) {
|
|
241
|
-
var f = j.$eq(t, o, s);
|
|
242
|
-
return T(function(p, h, v, g) {
|
|
243
|
-
return !f(p, h, v, g);
|
|
244
|
-
});
|
|
245
|
-
},
|
|
246
|
-
$and: function(t, o, s) {
|
|
247
|
-
return t.map(N(s));
|
|
248
|
-
},
|
|
249
|
-
$all: function(t, o, s) {
|
|
250
|
-
return j.$and(t, o, s);
|
|
251
|
-
},
|
|
252
|
-
$or: function(t, o, s) {
|
|
253
|
-
return t.map(N(s));
|
|
254
|
-
},
|
|
255
|
-
$nor: function(t, o, s) {
|
|
256
|
-
return t.map(N(s));
|
|
257
|
-
},
|
|
258
|
-
$not: function(t, o, s) {
|
|
259
|
-
var f = N(s)(t);
|
|
260
|
-
return function(p, h, v) {
|
|
261
|
-
return !P(f, p, h, v);
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
$type: function(t) {
|
|
265
|
-
return function(o, s, f) {
|
|
266
|
-
return o != null && (o instanceof t || o.constructor == t);
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
$regex: function(t, o) {
|
|
270
|
-
return new RegExp(t, o.$options);
|
|
271
|
-
},
|
|
272
|
-
$where: function(t) {
|
|
273
|
-
if (typeof t == "function") return t;
|
|
274
|
-
throw new Error(
|
|
275
|
-
'In CSP mode, sift does not support strings in "$where" condition'
|
|
276
|
-
);
|
|
277
|
-
},
|
|
278
|
-
$elemMatch: function(t, o, s) {
|
|
279
|
-
return N(s)(t);
|
|
280
|
-
},
|
|
281
|
-
$exists: function(t) {
|
|
282
|
-
return !!t;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
function F(t, o) {
|
|
286
|
-
return { options: t, validate: o };
|
|
287
|
-
}
|
|
288
|
-
function wt(t, o) {
|
|
289
|
-
var s = t.keyPath, f = t.child, p = t.query, h = [];
|
|
290
|
-
if (function st(A, I, M, _t, X) {
|
|
291
|
-
if (M === I.length || A == null)
|
|
292
|
-
return void X.push([A, I[M - 1], _t]);
|
|
293
|
-
var lt = m(I, M);
|
|
294
|
-
if (d(A) && isNaN(Number(lt)))
|
|
295
|
-
for (var W = 0, $t = A.length; W < $t; W++) st(m(A, W), I, M, A, X);
|
|
296
|
-
else st(m(A, lt), I, M + 1, A, X);
|
|
297
|
-
}(o, s, 0, o, h), h.length === 1) {
|
|
298
|
-
var v = h[0];
|
|
299
|
-
return P(f, v[0], v[1], v[2]);
|
|
300
|
-
}
|
|
301
|
-
for (var g = p && p.$ne !== void 0, O = g, _ = 0; _ < h.length; _++) {
|
|
302
|
-
var x = h[_], K = P(f, x[0], x[1], x[2]);
|
|
303
|
-
g ? O &= K : O |= K;
|
|
304
|
-
}
|
|
305
|
-
return O;
|
|
306
|
-
}
|
|
307
|
-
function Pt(t, o, s) {
|
|
308
|
-
return F({ keyPath: t, child: o, query: s }, wt);
|
|
309
|
-
}
|
|
310
|
-
function N(t) {
|
|
311
|
-
var o = t.comparable, s = t.expressions, f = function(v) {
|
|
312
|
-
var g;
|
|
313
|
-
return (!v || !(g = v) || g.constructor !== Object && g.constructor !== Array && g.constructor.toString() !== "function Object() { [native code] }" && g.constructor.toString() !== "function Array() { [native code] }" || g.toJSON) && (v = { $eq: v }), v;
|
|
314
|
-
}, p = function(v) {
|
|
315
|
-
v = o(v);
|
|
316
|
-
var g = [];
|
|
317
|
-
for (var O in v) {
|
|
318
|
-
var _ = v[O];
|
|
319
|
-
if (O !== "$options") {
|
|
320
|
-
var x = R[O] || t && s && s[O];
|
|
321
|
-
if (x) j[O] && (_ = j[O](_, v, t)), g.push(F(o(_), x));
|
|
322
|
-
else {
|
|
323
|
-
if (O.charCodeAt(0) === 36)
|
|
324
|
-
throw new Error("Unknown operation " + O);
|
|
325
|
-
var K = O.split(".");
|
|
326
|
-
g.push(Pt(K, h(_), _));
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
return g.length === 1 ? g[0] : F(g, R.$and);
|
|
331
|
-
}, h = function(v) {
|
|
332
|
-
return v = f(v), function g(O, _) {
|
|
333
|
-
if (!y(O)) return _;
|
|
334
|
-
for (var x in O) _.push(x), g(O[x], _);
|
|
335
|
-
return _;
|
|
336
|
-
}(v, []).join(",").search(/[$.]/) === -1 ? F(v, C) : p(v);
|
|
337
|
-
};
|
|
338
|
-
return function(v) {
|
|
339
|
-
return p(f(v));
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
function C(t, o) {
|
|
343
|
-
if (Object.prototype.toString.call(t) !== Object.prototype.toString.call(o))
|
|
344
|
-
return !1;
|
|
345
|
-
if (y(t)) {
|
|
346
|
-
if (Object.keys(t).length !== Object.keys(o).length) return !1;
|
|
347
|
-
for (var s in t) if (!C(t[s], o[s])) return !1;
|
|
348
|
-
return !0;
|
|
349
|
-
}
|
|
350
|
-
if (d(t)) {
|
|
351
|
-
if (t.length !== o.length) return !1;
|
|
352
|
-
for (var f = 0, p = t.length; f < p; f++)
|
|
353
|
-
if (!C(t[f], o[f])) return !1;
|
|
354
|
-
return !0;
|
|
355
|
-
}
|
|
356
|
-
return t === o;
|
|
357
|
-
}
|
|
358
|
-
function at(t, o) {
|
|
359
|
-
var s = N(o)(t);
|
|
360
|
-
return o && o.select && (s = {
|
|
361
|
-
options: s,
|
|
362
|
-
validate: function(f, p, h, v) {
|
|
363
|
-
return P(f, p && o.select(p), h, v);
|
|
364
|
-
}
|
|
365
|
-
}), s;
|
|
366
|
-
}
|
|
367
|
-
function Ot(t, o) {
|
|
368
|
-
var s = at(t, o = Object.assign({ compare: ut, comparable: G }, o));
|
|
369
|
-
return function(f, p, h) {
|
|
370
|
-
return P(s, f, p, h);
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
function ut(t, o) {
|
|
374
|
-
if (C(t, o)) return 0;
|
|
375
|
-
if (i(t) === i(o)) {
|
|
376
|
-
if (t > o) return 1;
|
|
377
|
-
if (t < o) return -1;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
function G(t) {
|
|
381
|
-
return t instanceof Date ? t.getTime() : d(t) ? t.map(G) : t && typeof t.toJSON == "function" ? t.toJSON() : t;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
]);
|
|
385
|
-
});
|
|
386
|
-
})(ht);
|
|
387
|
-
var At = ht.exports;
|
|
388
|
-
const Tt = /* @__PURE__ */ Ft(At);
|
|
389
|
-
function Nt(n, a) {
|
|
390
|
-
for (var u = 0; u < a.length; u++) {
|
|
391
|
-
var e = a[u];
|
|
392
|
-
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(n, e.key, e);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
function kt(n, a, u) {
|
|
396
|
-
return a && Nt(n.prototype, a), n;
|
|
397
|
-
}
|
|
398
|
-
function It(n, a) {
|
|
399
|
-
n.prototype = Object.create(a.prototype), n.prototype.constructor = n, n.__proto__ = a;
|
|
400
|
-
}
|
|
401
|
-
function Y(n) {
|
|
402
|
-
return Y = Object.setPrototypeOf ? Object.getPrototypeOf : function(u) {
|
|
403
|
-
return u.__proto__ || Object.getPrototypeOf(u);
|
|
404
|
-
}, Y(n);
|
|
405
|
-
}
|
|
406
|
-
function H(n, a) {
|
|
407
|
-
return H = Object.setPrototypeOf || function(e, r) {
|
|
408
|
-
return e.__proto__ = r, e;
|
|
409
|
-
}, H(n, a);
|
|
410
|
-
}
|
|
411
|
-
function Mt() {
|
|
412
|
-
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
413
|
-
if (typeof Proxy == "function") return !0;
|
|
414
|
-
try {
|
|
415
|
-
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
416
|
-
})), !0;
|
|
417
|
-
} catch {
|
|
418
|
-
return !1;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function L(n, a, u) {
|
|
422
|
-
return Mt() ? L = Reflect.construct : L = function(r, i, l) {
|
|
423
|
-
var d = [null];
|
|
424
|
-
d.push.apply(d, i);
|
|
425
|
-
var y = Function.bind.apply(r, d), b = new y();
|
|
426
|
-
return l && H(b, l.prototype), b;
|
|
427
|
-
}, L.apply(null, arguments);
|
|
428
|
-
}
|
|
429
|
-
function Bt(n) {
|
|
430
|
-
return Function.toString.call(n).indexOf("[native code]") !== -1;
|
|
431
|
-
}
|
|
432
|
-
function z(n) {
|
|
433
|
-
var a = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
434
|
-
return z = function(e) {
|
|
435
|
-
if (e === null || !Bt(e)) return e;
|
|
436
|
-
if (typeof e != "function")
|
|
437
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
438
|
-
if (typeof a < "u") {
|
|
439
|
-
if (a.has(e)) return a.get(e);
|
|
440
|
-
a.set(e, r);
|
|
441
|
-
}
|
|
442
|
-
function r() {
|
|
443
|
-
return L(e, arguments, Y(this).constructor);
|
|
444
|
-
}
|
|
445
|
-
return r.prototype = Object.create(e.prototype, {
|
|
446
|
-
constructor: {
|
|
447
|
-
value: r,
|
|
448
|
-
enumerable: !1,
|
|
449
|
-
writable: !0,
|
|
450
|
-
configurable: !0
|
|
451
|
-
}
|
|
452
|
-
}), H(r, e);
|
|
453
|
-
}, z(n);
|
|
454
|
-
}
|
|
455
|
-
function ct(n) {
|
|
456
|
-
if (n === void 0)
|
|
457
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
458
|
-
return n;
|
|
459
|
-
}
|
|
460
|
-
var vt = function(a) {
|
|
461
|
-
return 'Cannot execute "' + a.action + '" on "' + a.subjectName + '"';
|
|
462
|
-
}, D = vt, Ct = /* @__PURE__ */ function(n) {
|
|
463
|
-
It(a, n), a.setDefaultMessage = function(r) {
|
|
464
|
-
r === null ? D = vt : D = typeof r == "string" ? function() {
|
|
465
|
-
return r;
|
|
466
|
-
} : r;
|
|
467
|
-
}, a.from = function(r) {
|
|
468
|
-
var i = new this("");
|
|
469
|
-
return Object.defineProperty(i, "ability", {
|
|
470
|
-
value: r
|
|
471
|
-
}), i;
|
|
472
|
-
};
|
|
473
|
-
function a(e, r) {
|
|
474
|
-
var i;
|
|
475
|
-
return r === void 0 && (r = {}), i = n.call(this, e) || this, i._setMetadata(r), i.message = e || D(ct(i)), i._customMessage = null, typeof Error.captureStackTrace == "function" && (i.name = i.constructor.name, Error.captureStackTrace(ct(i), i.constructor)), i;
|
|
476
|
-
}
|
|
477
|
-
var u = a.prototype;
|
|
478
|
-
return u.setMessage = function(r) {
|
|
479
|
-
return this._customMessage = r, this;
|
|
480
|
-
}, u.throwUnlessCan = function(r, i, l) {
|
|
481
|
-
if (!this.ability)
|
|
482
|
-
throw new ReferenceError("Cannot throw FordiddenError without respective ability instance");
|
|
483
|
-
var d = this.ability.relevantRuleFor(r, i, l);
|
|
484
|
-
if (!(d && !d.inverted)) {
|
|
485
|
-
this._setMetadata({
|
|
486
|
-
action: r,
|
|
487
|
-
subject: i,
|
|
488
|
-
field: l,
|
|
489
|
-
subjectName: this.ability.subjectName(i)
|
|
490
|
-
});
|
|
491
|
-
var y = d ? d.reason : "";
|
|
492
|
-
throw this.message = this._customMessage || y || D(this), this;
|
|
493
|
-
}
|
|
494
|
-
}, u._setMetadata = function(r) {
|
|
495
|
-
this.subject = r.subject, this.subjectName = r.subjectName, this.action = r.action, this.field = r.field;
|
|
496
|
-
}, a;
|
|
497
|
-
}(z(Error));
|
|
498
|
-
function V(n) {
|
|
499
|
-
return Array.isArray(n) ? n : [n];
|
|
500
|
-
}
|
|
501
|
-
function Kt(n) {
|
|
502
|
-
if (!n || typeof n == "string")
|
|
503
|
-
return n;
|
|
504
|
-
var a = typeof n == "object" ? n.constructor : n;
|
|
505
|
-
return a.modelName || a.name;
|
|
506
|
-
}
|
|
507
|
-
function Dt(n) {
|
|
508
|
-
return JSON.parse(JSON.stringify(n));
|
|
509
|
-
}
|
|
510
|
-
var Lt = /[-/\\^$+?.()|[\]{}]/g, Ut = /\.?\*+\.?/g, Ht = /\*+/, Jt = /\./g;
|
|
511
|
-
function qt(n, a, u) {
|
|
512
|
-
var e = u[0] === "*" || n[0] === "." && n[n.length - 1] === "." ? "+" : "*", r = n.indexOf("**") === -1 ? "[^.]" : ".", i = n.replace(Jt, "\\$&").replace(Ht, r + e);
|
|
513
|
-
return a + n.length === u.length ? "(?:" + i + ")?" : i;
|
|
514
|
-
}
|
|
515
|
-
function Gt(n, a, u) {
|
|
516
|
-
return n === "." && (u[a - 1] === "*" || u[a + 1] === "*") ? n : "\\" + n;
|
|
517
|
-
}
|
|
518
|
-
function Xt(n) {
|
|
519
|
-
var a = n.map(function(e) {
|
|
520
|
-
return e.replace(Lt, Gt).replace(Ut, qt);
|
|
521
|
-
}), u = a.length > 1 ? "(?:" + a.join("|") + ")" : a[0];
|
|
522
|
-
return new RegExp("^" + u + "$");
|
|
523
|
-
}
|
|
524
|
-
var Wt = /* @__PURE__ */ function() {
|
|
525
|
-
function n(u) {
|
|
526
|
-
this.actions = u.actions || u.action, this.subject = u.subject, this.fields = !u.fields || u.fields.length === 0 ? void 0 : V(u.fields), Object.defineProperty(this, "_fieldsPattern", {
|
|
527
|
-
writable: !0
|
|
528
|
-
}), this.inverted = !!u.inverted, this.conditions = u.conditions, Object.defineProperty(this, "_matches", {
|
|
529
|
-
writable: !0,
|
|
530
|
-
value: this.conditions ? Tt(this.conditions) : void 0
|
|
531
|
-
}), this.reason = u.reason;
|
|
532
|
-
}
|
|
533
|
-
var a = n.prototype;
|
|
534
|
-
return a.matches = function(e) {
|
|
535
|
-
return this._matches ? typeof e == "string" ? !this.inverted : this._matches(e) : !0;
|
|
536
|
-
}, a.isRelevantFor = function(e, r) {
|
|
537
|
-
return this.fields ? r ? this.matchesField(r) : !this.inverted : !0;
|
|
538
|
-
}, a.matchesField = function(e) {
|
|
539
|
-
return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null : Xt(this.fields)), this._fieldsPattern === null || e.indexOf("*") !== -1 ? this.fields.indexOf(e) !== -1 : this._fieldsPattern.test(e);
|
|
540
|
-
}, n;
|
|
541
|
-
}(), $ = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), ft = {
|
|
542
|
-
crud: ["create", "read", "update", "delete"]
|
|
543
|
-
};
|
|
544
|
-
function dt(n, a) {
|
|
545
|
-
return n === a || Array.isArray(a) && a.indexOf(n) !== -1;
|
|
546
|
-
}
|
|
547
|
-
var Yt = /* @__PURE__ */ function() {
|
|
548
|
-
n.addAlias = function(e, r) {
|
|
549
|
-
if (e === "manage" || dt("manage", r))
|
|
550
|
-
throw new Error('Cannot add alias for "manage" action because it represents any action');
|
|
551
|
-
if (dt(e, r))
|
|
552
|
-
throw new Error("Attempt to alias action to itself: " + e + " -> " + r.toString());
|
|
553
|
-
return ft[e] = r, this;
|
|
554
|
-
};
|
|
555
|
-
function n(u, e) {
|
|
556
|
-
e === void 0 && (e = {}), Object.defineProperty(this, "subjectName", {
|
|
557
|
-
value: e.subjectName || Kt
|
|
558
|
-
}), this[$] = {
|
|
559
|
-
RuleType: e.RuleType || Wt,
|
|
560
|
-
originalRules: u || [],
|
|
561
|
-
hasPerFieldRules: !1,
|
|
562
|
-
indexedRules: /* @__PURE__ */ Object.create(null),
|
|
563
|
-
mergedRules: /* @__PURE__ */ Object.create(null),
|
|
564
|
-
events: {},
|
|
565
|
-
aliases: Dt(ft)
|
|
566
|
-
}, this.update(u);
|
|
567
|
-
}
|
|
568
|
-
var a = n.prototype;
|
|
569
|
-
return a.update = function(e) {
|
|
570
|
-
if (!Array.isArray(e))
|
|
571
|
-
return this;
|
|
572
|
-
var r = {
|
|
573
|
-
rules: e,
|
|
574
|
-
ability: this
|
|
575
|
-
};
|
|
576
|
-
this.emit("update", r), this[$].originalRules = e.slice(0), this[$].mergedRules = /* @__PURE__ */ Object.create(null);
|
|
577
|
-
var i = this.buildIndexFor(e);
|
|
578
|
-
return this[$].indexedRules = i.rules, this[$].hasPerFieldRules = i.hasPerFieldRules, this.emit("updated", r), this;
|
|
579
|
-
}, a.buildIndexFor = function(e) {
|
|
580
|
-
for (var r = /* @__PURE__ */ Object.create(null), i = this[$].RuleType, l = !0, d = !1, y = 0; y < e.length; y++) {
|
|
581
|
-
var b = new i(e[y]), m = this.expandActions(b.actions), w = V(b.subject), T = e.length - y - 1;
|
|
582
|
-
l = !!(l && b.inverted), !d && b.fields && (d = !0);
|
|
583
|
-
for (var P = 0; P < w.length; P++) {
|
|
584
|
-
var R = w[P];
|
|
585
|
-
r[R] = r[R] || /* @__PURE__ */ Object.create(null);
|
|
586
|
-
for (var j = 0; j < m.length; j++) {
|
|
587
|
-
var F = m[j];
|
|
588
|
-
r[R][F] = r[R][F] || /* @__PURE__ */ Object.create(null), r[R][F][T] = b;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return {
|
|
593
|
-
isAllInverted: l,
|
|
594
|
-
hasPerFieldRules: d,
|
|
595
|
-
rules: r
|
|
596
|
-
};
|
|
597
|
-
}, a.expandActions = function(e) {
|
|
598
|
-
for (var r = this[$].aliases, i = V(e), l = 0; l < i.length; ) {
|
|
599
|
-
var d = i[l++];
|
|
600
|
-
r.hasOwnProperty(d) && (i = i.concat(r[d]));
|
|
601
|
-
}
|
|
602
|
-
return i;
|
|
603
|
-
}, a.can = function(e, r, i) {
|
|
604
|
-
if (i && typeof i != "string")
|
|
605
|
-
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");
|
|
606
|
-
var l = this.relevantRuleFor(e, r, i);
|
|
607
|
-
return !!l && !l.inverted;
|
|
608
|
-
}, a.relevantRuleFor = function(e, r, i) {
|
|
609
|
-
for (var l = this.rulesFor(e, r, i), d = 0; d < l.length; d++)
|
|
610
|
-
if (l[d].matches(r))
|
|
611
|
-
return l[d];
|
|
612
|
-
return null;
|
|
613
|
-
}, a.possibleRulesFor = function(e, r) {
|
|
614
|
-
var i = this.subjectName(r), l = this[$].mergedRules, d = i + "_" + e;
|
|
615
|
-
return l[d] || (l[d] = this.mergeRulesFor(e, i)), l[d];
|
|
616
|
-
}, a.mergeRulesFor = function(e, r) {
|
|
617
|
-
var i = this[$].indexedRules, l = [r, "all"].reduce(function(d, y) {
|
|
618
|
-
var b = i[y];
|
|
619
|
-
return b ? Object.assign(d, b[e], b.manage) : d;
|
|
620
|
-
}, []);
|
|
621
|
-
return l.filter(Boolean);
|
|
622
|
-
}, a.rulesFor = function(e, r, i) {
|
|
623
|
-
var l = this.possibleRulesFor(e, r);
|
|
624
|
-
return this[$].hasPerFieldRules ? l.filter(function(d) {
|
|
625
|
-
return d.isRelevantFor(r, i);
|
|
626
|
-
}) : l;
|
|
627
|
-
}, a.cannot = function() {
|
|
628
|
-
return !this.can.apply(this, arguments);
|
|
629
|
-
}, a.throwUnlessCan = function() {
|
|
630
|
-
var e;
|
|
631
|
-
console.warn(`
|
|
632
|
-
Ability.throwUnlessCan is deprecated and will be removed in 4.x version.
|
|
633
|
-
Please use "ForbiddenError.from(ability).throwUnlessCan(...)" instead.
|
|
634
|
-
`.trim()), (e = Ct.from(this)).throwUnlessCan.apply(e, arguments);
|
|
635
|
-
}, a.on = function(e, r) {
|
|
636
|
-
var i = this[$].events, l = !0;
|
|
637
|
-
return i[e] || (i[e] = []), i[e].push(r), function() {
|
|
638
|
-
if (l) {
|
|
639
|
-
var d = i[e].indexOf(r);
|
|
640
|
-
i[e].splice(d, 1), l = !1;
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
}, a.emit = function(e, r) {
|
|
644
|
-
var i = this[$].events[e];
|
|
645
|
-
i && i.slice(0).forEach(function(l) {
|
|
646
|
-
return l(r);
|
|
647
|
-
});
|
|
648
|
-
}, kt(n, [{
|
|
649
|
-
key: "rules",
|
|
650
|
-
get: function() {
|
|
651
|
-
return this[$].originalRules;
|
|
652
|
-
}
|
|
653
|
-
}]), n;
|
|
654
|
-
}();
|
|
655
|
-
function zt(n) {
|
|
656
|
-
return new Yt(n).can("manage", "business::miniProgram::brandkit");
|
|
657
|
-
}
|
|
658
|
-
function rt() {
|
|
659
|
-
var a;
|
|
660
|
-
const n = ((a = xt().sessionUser.value) == null ? void 0 : a.permissions) ?? [];
|
|
661
|
-
return zt(
|
|
662
|
-
n.map(({ fields: u, inverted: e, reason: r, ...i }) => ({
|
|
663
|
-
...i,
|
|
664
|
-
fields: u ?? void 0,
|
|
665
|
-
inverted: e ?? void 0,
|
|
666
|
-
reason: r ?? void 0
|
|
667
|
-
}))
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
function se() {
|
|
671
|
-
return tt(rt);
|
|
672
|
-
}
|
|
673
|
-
const q = [
|
|
674
|
-
{ path: "primary", label: "Primary", group: "Brand", hint: "Dominant brand color" },
|
|
675
|
-
{
|
|
676
|
-
path: "secondary",
|
|
677
|
-
label: "Secondary",
|
|
678
|
-
group: "Brand",
|
|
679
|
-
hint: "Light supporting fill — primary-colored text renders on top, keep it a light tint"
|
|
680
|
-
},
|
|
681
|
-
{ path: "accent", label: "Accent", group: "Brand", hint: "Highlight / CTA pop" },
|
|
682
|
-
{ path: "background.base", label: "Base", group: "Background", hint: "Page background" },
|
|
683
|
-
{ path: "background.elevated", label: "Elevated", group: "Background", hint: "Cards / sheets" },
|
|
684
|
-
{ path: "neutral.light", label: "Light", group: "Neutral", hint: "Borders / dividers" },
|
|
685
|
-
{ path: "neutral.mid", label: "Mid", group: "Neutral" },
|
|
686
|
-
{
|
|
687
|
-
path: "neutral.dark",
|
|
688
|
-
label: "Dark",
|
|
689
|
-
group: "Neutral",
|
|
690
|
-
hint: "Doubles as the modal scrim — keep near-black"
|
|
691
|
-
},
|
|
692
|
-
{ path: "text.onPrimary", label: "On primary", group: "Text", hint: "Text on a brand fill" },
|
|
693
|
-
{ path: "text.primary", label: "Primary", group: "Text" },
|
|
694
|
-
{ path: "text.secondary", label: "Secondary", group: "Text" },
|
|
695
|
-
{ path: "text.tertiary", label: "Tertiary", group: "Text" },
|
|
696
|
-
{ path: "status.success", label: "Success", group: "Status" },
|
|
697
|
-
{ path: "status.warning", label: "Warning", group: "Status" },
|
|
698
|
-
{ path: "status.error", label: "Error", group: "Status" },
|
|
699
|
-
{ path: "status.info", label: "Info", group: "Status" }
|
|
700
|
-
], nt = [
|
|
701
|
-
{ path: "brand", label: "Brand", group: "Fonts", hint: "Logo / wordmark contexts" },
|
|
702
|
-
{ path: "heading", label: "Heading", group: "Fonts" },
|
|
703
|
-
{ path: "body", label: "Body", group: "Fonts" }
|
|
704
|
-
], gt = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
705
|
-
function Vt(n) {
|
|
706
|
-
return gt.test(n.trim());
|
|
707
|
-
}
|
|
708
|
-
function le(n) {
|
|
709
|
-
const a = n.trim().toLowerCase();
|
|
710
|
-
if (!gt.test(a)) return "#000000";
|
|
711
|
-
if (a.length === 7) return a;
|
|
712
|
-
const [u, e, r] = a.slice(1);
|
|
713
|
-
return `#${u}${u}${e}${e}${r}${r}`;
|
|
714
|
-
}
|
|
715
|
-
function Qt() {
|
|
716
|
-
return Rt(jt("fmmf:dev")).apiOrigin;
|
|
717
|
-
}
|
|
718
|
-
function ot(n) {
|
|
719
|
-
return `${Qt()}/metadata/${n}/brandkit`;
|
|
720
|
-
}
|
|
721
|
-
function U(n, a) {
|
|
722
|
-
let u = n;
|
|
723
|
-
for (const e of a.split(".")) {
|
|
724
|
-
if (!u || typeof u != "object") return;
|
|
725
|
-
u = u[e];
|
|
726
|
-
}
|
|
727
|
-
return u;
|
|
728
|
-
}
|
|
729
|
-
function Q(n, a, u) {
|
|
730
|
-
const e = a.split("."), r = e.pop();
|
|
731
|
-
if (!r) return;
|
|
732
|
-
let i = n;
|
|
733
|
-
for (const l of e) {
|
|
734
|
-
const d = i[l];
|
|
735
|
-
(!d || typeof d != "object") && (i[l] = {}), i = i[l];
|
|
736
|
-
}
|
|
737
|
-
i[r] = u;
|
|
738
|
-
}
|
|
739
|
-
function pt(n, a, u) {
|
|
740
|
-
const e = {};
|
|
741
|
-
for (const r of u) {
|
|
742
|
-
const i = U(n == null ? void 0 : n[a], r.path);
|
|
743
|
-
e[r.path] = typeof i == "string" ? i : "";
|
|
744
|
-
}
|
|
745
|
-
return e;
|
|
746
|
-
}
|
|
747
|
-
function Z(n) {
|
|
748
|
-
return JSON.parse(JSON.stringify(n));
|
|
749
|
-
}
|
|
750
|
-
const c = St({
|
|
751
|
-
panelOpen: !1,
|
|
752
|
-
loading: !1,
|
|
753
|
-
saving: !1,
|
|
754
|
-
loaded: !1,
|
|
755
|
-
error: null,
|
|
756
|
-
businessId: null,
|
|
757
|
-
colors: {},
|
|
758
|
-
fonts: {},
|
|
759
|
-
savedColors: {},
|
|
760
|
-
savedFonts: {},
|
|
761
|
-
// Full kit as it was before our last save — the only undo colors get.
|
|
762
|
-
revertKit: null,
|
|
763
|
-
appliedProposal: null
|
|
764
|
-
});
|
|
765
|
-
async function it(n) {
|
|
766
|
-
const a = await fetch(ot(n), { signal: AbortSignal.timeout(15e3) });
|
|
767
|
-
if (a.status === 404) return null;
|
|
768
|
-
if (!a.ok) throw new Error(`GET brandkit failed: HTTP ${a.status}`);
|
|
769
|
-
return await a.json();
|
|
770
|
-
}
|
|
771
|
-
function J(n) {
|
|
772
|
-
c.colors = pt(n, "colors", q), c.fonts = pt(n, "fonts", nt), c.savedColors = { ...c.colors }, c.savedFonts = { ...c.fonts }, c.loaded = !0;
|
|
773
|
-
}
|
|
774
|
-
let k = null, S = 0, B = null;
|
|
775
|
-
function yt(n = !1) {
|
|
776
|
-
const a = E();
|
|
777
|
-
if (c.loaded && !n && c.businessId === a) return Promise.resolve();
|
|
778
|
-
if ((k == null ? void 0 : k.businessId) === a) return k.promise;
|
|
779
|
-
const u = ++S;
|
|
780
|
-
c.businessId !== a && (c.businessId = a, c.loaded = !1, c.revertKit = null, B = null, c.appliedProposal = null, J(null), c.loaded = !1);
|
|
781
|
-
const e = (async () => {
|
|
782
|
-
c.loading = !0, c.error = null;
|
|
783
|
-
try {
|
|
784
|
-
const r = await it(a);
|
|
785
|
-
u === S && J(r);
|
|
786
|
-
} catch (r) {
|
|
787
|
-
u === S && (c.error = et(r));
|
|
788
|
-
} finally {
|
|
789
|
-
u === S && (c.loading = !1, k = null);
|
|
790
|
-
}
|
|
791
|
-
})();
|
|
792
|
-
return k = { businessId: a, promise: e }, e;
|
|
793
|
-
}
|
|
794
|
-
function bt() {
|
|
795
|
-
const n = q.filter((u) => c.colors[u.path] !== c.savedColors[u.path]).map(
|
|
796
|
-
(u) => u.path
|
|
797
|
-
), a = nt.filter((u) => c.fonts[u.path] !== c.savedFonts[u.path]).map(
|
|
798
|
-
(u) => u.path
|
|
799
|
-
);
|
|
800
|
-
return { colorPaths: n, fontPaths: a };
|
|
801
|
-
}
|
|
802
|
-
const Zt = tt(() => {
|
|
803
|
-
const { colorPaths: n, fontPaths: a } = bt();
|
|
804
|
-
return n.length + a.length;
|
|
805
|
-
}), mt = tt(
|
|
806
|
-
() => q.some((n) => {
|
|
807
|
-
const a = c.colors[n.path] ?? "";
|
|
808
|
-
return a !== "" && !Vt(a);
|
|
809
|
-
})
|
|
810
|
-
);
|
|
811
|
-
async function te() {
|
|
812
|
-
const n = E();
|
|
813
|
-
if (!rt())
|
|
814
|
-
throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
|
|
815
|
-
if (c.saving || c.loading || !c.loaded || c.businessId !== n)
|
|
816
|
-
throw new Error("Wait for the current Brand Kit to finish loading or saving.");
|
|
817
|
-
if (mt.value) throw new Error("Enter valid hex colors before saving.");
|
|
818
|
-
const { colorPaths: a, fontPaths: u } = bt();
|
|
819
|
-
if (!a.length && !u.length) return;
|
|
820
|
-
const e = { ...c.colors }, r = { ...c.fonts }, i = S;
|
|
821
|
-
c.saving = !0, c.error = null;
|
|
822
|
-
try {
|
|
823
|
-
const l = await it(n) ?? {}, d = Z(l), y = Z(l);
|
|
824
|
-
(!y.colors || typeof y.colors != "object") && (y.colors = {}), (!y.fonts || typeof y.fonts != "object") && (y.fonts = {});
|
|
825
|
-
for (const m of a) Q(y.colors, m, (e[m] ?? "").trim());
|
|
826
|
-
for (const m of u) Q(y.fonts, m, (r[m] ?? "").trim());
|
|
827
|
-
if (i !== S || n !== E())
|
|
828
|
-
throw new Error("Business changed. No Brand Kit was saved.");
|
|
829
|
-
const b = await fetch(ot(n), {
|
|
830
|
-
method: "POST",
|
|
831
|
-
headers: { "Content-Type": "application/json" },
|
|
832
|
-
body: JSON.stringify(y),
|
|
833
|
-
signal: AbortSignal.timeout(2e4)
|
|
834
|
-
});
|
|
835
|
-
if (!b.ok) throw new Error(`Save failed: HTTP ${b.status}`);
|
|
836
|
-
i === S && n === E() && (c.revertKit = d, B = { colorPaths: a, fontPaths: u }, c.appliedProposal = null, J(y));
|
|
837
|
-
} catch (l) {
|
|
838
|
-
throw i === S && (c.error = et(l)), l;
|
|
839
|
-
} finally {
|
|
840
|
-
c.saving = !1;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
async function ee() {
|
|
844
|
-
if (!c.revertKit || !B || c.saving || c.loading) return;
|
|
845
|
-
const n = E();
|
|
846
|
-
if (!rt())
|
|
847
|
-
throw c.error = "You do not have permission to manage this Brand Kit. Contact an administrator.", new Error(c.error);
|
|
848
|
-
if (c.businessId !== n) throw new Error("Load the current business before reverting.");
|
|
849
|
-
const a = S, u = Z(c.revertKit), e = B;
|
|
850
|
-
c.saving = !0, c.error = null;
|
|
851
|
-
try {
|
|
852
|
-
const r = await it(n) ?? {};
|
|
853
|
-
for (const [l, d] of [
|
|
854
|
-
["colors", e.colorPaths],
|
|
855
|
-
["fonts", e.fontPaths]
|
|
856
|
-
]) {
|
|
857
|
-
const y = l === "colors" ? c.savedColors : c.savedFonts;
|
|
858
|
-
for (const b of d) {
|
|
859
|
-
if ((U(r[l], b) ?? "") !== y[b])
|
|
860
|
-
throw new Error("Brand Kit changed since your save. Reload it before editing again.");
|
|
861
|
-
(!r[l] || typeof r[l] != "object") && (r[l] = {});
|
|
862
|
-
const m = U(u[l], b);
|
|
863
|
-
if (typeof m == "string") Q(r[l], b, m);
|
|
864
|
-
else {
|
|
865
|
-
const w = b.split("."), T = w.pop(), P = w.length ? U(r[l], w.join(".")) : r[l];
|
|
866
|
-
P && typeof P == "object" && delete P[T];
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (a !== S || n !== E())
|
|
871
|
-
throw new Error("Business changed. No Brand Kit was reverted.");
|
|
872
|
-
const i = await fetch(ot(n), {
|
|
873
|
-
method: "POST",
|
|
874
|
-
headers: { "Content-Type": "application/json" },
|
|
875
|
-
body: JSON.stringify(r),
|
|
876
|
-
signal: AbortSignal.timeout(2e4)
|
|
877
|
-
});
|
|
878
|
-
if (!i.ok) throw new Error(`Revert failed: HTTP ${i.status}`);
|
|
879
|
-
a === S && n === E() && (c.revertKit = null, B = null, J(r));
|
|
880
|
-
} catch (r) {
|
|
881
|
-
throw a === S && (c.error = et(r)), r;
|
|
882
|
-
} finally {
|
|
883
|
-
c.saving = !1;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
async function re(n) {
|
|
887
|
-
c.panelOpen = !0;
|
|
888
|
-
const a = E();
|
|
889
|
-
if (await yt(), !(!c.loaded || c.loading || c.saving || c.businessId !== a || E() !== a)) {
|
|
890
|
-
for (const u of q) {
|
|
891
|
-
const e = n.colors[u.path];
|
|
892
|
-
e && (c.colors[u.path] = e);
|
|
893
|
-
}
|
|
894
|
-
for (const u of nt) {
|
|
895
|
-
const e = n.fonts[u.path];
|
|
896
|
-
e && (c.fonts[u.path] = e);
|
|
897
|
-
}
|
|
898
|
-
c.appliedProposal = n.name ?? "Untitled proposal";
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
function ne() {
|
|
902
|
-
c.colors = { ...c.savedColors }, c.fonts = { ...c.savedFonts }, c.appliedProposal = null;
|
|
903
|
-
}
|
|
904
|
-
function ce() {
|
|
905
|
-
return {
|
|
906
|
-
state: c,
|
|
907
|
-
dirtyCount: Zt,
|
|
908
|
-
hasInvalidColor: mt,
|
|
909
|
-
load: yt,
|
|
910
|
-
save: te,
|
|
911
|
-
revertLastSave: ee,
|
|
912
|
-
applyProposal: re,
|
|
913
|
-
discardEdits: ne
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
export {
|
|
917
|
-
q as C,
|
|
918
|
-
nt as F,
|
|
919
|
-
se as a,
|
|
920
|
-
Ft as g,
|
|
921
|
-
Vt as i,
|
|
922
|
-
le as t,
|
|
923
|
-
ce as u
|
|
924
|
-
};
|