@choosemycompany/lib 0.10.0 → 1.0.0
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/README.md +2 -3
- package/dist/http/types.d.ts +5 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +650 -301
- package/dist/store/MissingItemIdError.d.ts +20 -0
- package/dist/store/StoreResetError.d.ts +18 -0
- package/dist/store/types.d.ts +239 -14
- package/dist/store/useStore.d.ts +88 -32
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,303 +1,651 @@
|
|
|
1
|
-
import { mande as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { defineStore as
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import { createError as
|
|
6
|
-
import { showError as
|
|
7
|
-
let
|
|
8
|
-
function
|
|
1
|
+
import { mande as De } from "mande";
|
|
2
|
+
import { ref as L, computed as ie, reactive as Ke, shallowRef as Ne, onMounted as fe, onBeforeUnmount as He, onUnmounted as Oe } from "vue";
|
|
3
|
+
import { defineStore as _e } from "pinia";
|
|
4
|
+
import { useI18n as V } from "vue-i18n";
|
|
5
|
+
import { createError as Fe } from "h3";
|
|
6
|
+
import { showError as qe, useRuntimeConfig as xe, useState as je } from "nuxt/app";
|
|
7
|
+
let x;
|
|
8
|
+
function ha(e) {
|
|
9
9
|
if (!e.baseUrl)
|
|
10
10
|
throw new Error("@choosemycompany/lib: configureHttp() needs a non-empty baseUrl");
|
|
11
|
-
|
|
11
|
+
x = e;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
13
|
+
function pe(e) {
|
|
14
|
+
if (!x)
|
|
15
15
|
throw new Error(
|
|
16
16
|
"@choosemycompany/lib: useHttp() was called before configureHttp(). Declare the base URLs from an app plugin."
|
|
17
17
|
);
|
|
18
|
-
if (e === void 0) return
|
|
19
|
-
const
|
|
18
|
+
if (e === void 0) return x.baseUrl;
|
|
19
|
+
const n = x.targets ?? {}, i = Object.hasOwn(n, e) ? n[e] : void 0;
|
|
20
20
|
if (typeof i != "string" || !i) {
|
|
21
|
-
const
|
|
21
|
+
const s = Object.keys(n), o = s.length > 0 ? s.join(", ") : "none";
|
|
22
22
|
throw new Error(
|
|
23
|
-
`@choosemycompany/lib: no HTTP target named "${e}". Declared targets: ${
|
|
23
|
+
`@choosemycompany/lib: no HTTP target named "${e}". Declared targets: ${o}.`
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
return i;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
const e =
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
function
|
|
33
|
-
e.value = !0,
|
|
28
|
+
const Ve = "/auth/api/v2/session/tokens", Ze = "/auth/api/v2/", $e = "cmc-auth-session-refresh", Je = _e("cmc-auth-session", () => {
|
|
29
|
+
const e = L(!1), n = L(!1), i = L(void 0);
|
|
30
|
+
let s, o = 0;
|
|
31
|
+
const u = ie(() => e.value && !n.value);
|
|
32
|
+
function l() {
|
|
33
|
+
e.value = !0, n.value = !1, i.value = void 0;
|
|
34
34
|
}
|
|
35
35
|
function f() {
|
|
36
|
-
|
|
36
|
+
o += 1, e.value = !1, n.value = !1, i.value = void 0;
|
|
37
37
|
}
|
|
38
38
|
function g() {
|
|
39
|
-
|
|
39
|
+
o += 1, e.value = !1, n.value = !0, i.value = "logout";
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
41
|
+
function h(S) {
|
|
42
|
+
o += 1, e.value = !1, n.value = !0, i.value = S;
|
|
43
43
|
}
|
|
44
|
-
async function
|
|
45
|
-
if (
|
|
44
|
+
async function A() {
|
|
45
|
+
if (n.value)
|
|
46
46
|
throw new Error("Session is expired: no refresh will be attempted");
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
}
|
|
51
|
-
async function
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
await
|
|
55
|
-
}
|
|
56
|
-
async function
|
|
57
|
-
const
|
|
58
|
-
let
|
|
47
|
+
return s ??= y(k).finally(() => {
|
|
48
|
+
s = void 0;
|
|
49
|
+
}), s;
|
|
50
|
+
}
|
|
51
|
+
async function y(S) {
|
|
52
|
+
const v = globalThis.navigator?.locks;
|
|
53
|
+
if (!v) return S();
|
|
54
|
+
await v.request($e, S);
|
|
55
|
+
}
|
|
56
|
+
async function k() {
|
|
57
|
+
const S = o, v = () => S !== o, Z = new URL(Ve, pe()).href;
|
|
58
|
+
let U;
|
|
59
59
|
try {
|
|
60
|
-
|
|
60
|
+
U = await fetch(Z, {
|
|
61
61
|
method: "POST",
|
|
62
62
|
credentials: "include"
|
|
63
63
|
});
|
|
64
|
-
} catch (
|
|
65
|
-
throw
|
|
64
|
+
} catch ($) {
|
|
65
|
+
throw v() || R(), $;
|
|
66
66
|
}
|
|
67
|
-
if (!
|
|
68
|
-
throw
|
|
69
|
-
if (
|
|
67
|
+
if (!U.ok)
|
|
68
|
+
throw v() || (U.status === 401 ? h(e.value ? "refresh-rejected" : "no-session") : R()), new Error(`Token refresh failed with status ${U.status}`);
|
|
69
|
+
if (v())
|
|
70
70
|
throw new Error("Session was dropped while the refresh was in flight");
|
|
71
|
-
|
|
71
|
+
l();
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function R() {
|
|
74
74
|
i.value = "refresh-unreachable";
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
77
77
|
isOpen: e,
|
|
78
|
-
isExpired:
|
|
78
|
+
isExpired: n,
|
|
79
79
|
expiryReason: i,
|
|
80
|
-
isAuthenticated:
|
|
81
|
-
open:
|
|
82
|
-
expire:
|
|
80
|
+
isAuthenticated: u,
|
|
81
|
+
open: l,
|
|
82
|
+
expire: h,
|
|
83
83
|
clear: f,
|
|
84
84
|
logout: g,
|
|
85
|
-
refresh:
|
|
85
|
+
refresh: A
|
|
86
86
|
};
|
|
87
87
|
});
|
|
88
|
-
function
|
|
88
|
+
function We() {
|
|
89
89
|
return import.meta.server || typeof document > "u";
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return (typeof e == "string" ? e : e instanceof URL ? e.href : e.url).includes(
|
|
91
|
+
function Qe(e) {
|
|
92
|
+
return (typeof e == "string" ? e : e instanceof URL ? e.href : e.url).includes(Ze);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return async (e,
|
|
96
|
-
if (
|
|
97
|
-
const i = await fetch(e,
|
|
98
|
-
if (i.status !== 401 ||
|
|
99
|
-
let
|
|
94
|
+
function Ye() {
|
|
95
|
+
return async (e, n) => {
|
|
96
|
+
if (We()) return fetch(e, n);
|
|
97
|
+
const i = await fetch(e, n);
|
|
98
|
+
if (i.status !== 401 || Qe(e) || new Headers(n?.headers).has("Authorization")) return i;
|
|
99
|
+
let s;
|
|
100
100
|
try {
|
|
101
|
-
|
|
101
|
+
s = Je();
|
|
102
102
|
} catch {
|
|
103
103
|
return i;
|
|
104
104
|
}
|
|
105
|
-
if (
|
|
105
|
+
if (s.isExpired) return i;
|
|
106
106
|
try {
|
|
107
|
-
await
|
|
108
|
-
} catch (
|
|
109
|
-
return
|
|
107
|
+
await s.refresh();
|
|
108
|
+
} catch (o) {
|
|
109
|
+
return s.isExpired || console.warn("[cmc-lib] token refresh failed, returning the original 401", o), i;
|
|
110
110
|
}
|
|
111
|
-
return fetch(e,
|
|
111
|
+
return fetch(e, n);
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
114
|
+
function ba(e) {
|
|
115
|
+
const n = De(pe(e), {
|
|
116
116
|
headers: {}
|
|
117
|
-
},
|
|
118
|
-
function i(
|
|
119
|
-
|
|
120
|
-
...
|
|
121
|
-
Authorization: `Bearer ${
|
|
117
|
+
}, Ye());
|
|
118
|
+
function i(o) {
|
|
119
|
+
n.options.headers = {
|
|
120
|
+
...n.options.headers ?? {},
|
|
121
|
+
Authorization: `Bearer ${o}`
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function s() {
|
|
125
|
+
n.options.headers && delete n.options.headers.Authorization;
|
|
126
126
|
}
|
|
127
|
-
return { http:
|
|
127
|
+
return { http: n, setToken: i, clearToken: s };
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return e.replace(
|
|
131
|
-
const
|
|
132
|
-
if (typeof
|
|
133
|
-
throw new Error(`Missing URL parameter "${
|
|
134
|
-
return encodeURIComponent(String(
|
|
129
|
+
function va(e, n) {
|
|
130
|
+
return e.replace(Xe, (i, s) => {
|
|
131
|
+
const o = Object.hasOwn(n, s) ? n[s] : void 0;
|
|
132
|
+
if (typeof o != "string" && typeof o != "number")
|
|
133
|
+
throw new Error(`Missing URL parameter "${s}" for template "${e}"`);
|
|
134
|
+
return encodeURIComponent(String(o));
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const te = "create";
|
|
142
|
-
function Be(e) {
|
|
143
|
-
const a = A({}), i = A({}), t = A({}), n = A({}), o = A(0);
|
|
144
|
-
let u = 0;
|
|
145
|
-
const f = e.getItemId ?? ((r) => {
|
|
146
|
-
const d = r.id;
|
|
147
|
-
if (d === void 0)
|
|
148
|
-
throw new Error(
|
|
149
|
-
"useStore: no `getItemId` option provided and item has no `id` property. Either pass `getItemId` in the store options, or expose an `id` field on your items."
|
|
150
|
-
);
|
|
151
|
-
return d;
|
|
152
|
-
});
|
|
153
|
-
function g(r) {
|
|
154
|
-
return !!n.value[r];
|
|
137
|
+
const Xe = /\{(\w+)\}/g;
|
|
138
|
+
class ea extends Error {
|
|
139
|
+
constructor(n) {
|
|
140
|
+
super(n ? "useStore: getItemId found no id in the received item." : "useStore: getItemId found no id in the received item. Pass `getItemId` in the store options, or give your items an `id` field."), this.name = "MissingItemIdError";
|
|
155
141
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
142
|
+
}
|
|
143
|
+
class aa extends Error {
|
|
144
|
+
constructor() {
|
|
145
|
+
super("useStore: the store was reset before this queued work started"), this.name = "StoreResetError";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function j(e) {
|
|
149
|
+
return re(e).join("|");
|
|
150
|
+
}
|
|
151
|
+
function Ba(e) {
|
|
152
|
+
const n = L({}), i = L({}), s = Ke({ items: n, views: i }), o = /* @__PURE__ */ new Map(), u = Ne(0);
|
|
153
|
+
let l = 0, f = 0;
|
|
154
|
+
const g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set();
|
|
155
|
+
function S(a, t, r = {}) {
|
|
156
|
+
return Q(a, t, r);
|
|
157
|
+
}
|
|
158
|
+
function v(a) {
|
|
159
|
+
_();
|
|
160
|
+
for (const t of o.values())
|
|
161
|
+
if (t.status === "pending" && D(t, a))
|
|
162
|
+
return !0;
|
|
163
|
+
return !1;
|
|
166
164
|
}
|
|
167
|
-
|
|
165
|
+
function Z(a) {
|
|
166
|
+
_();
|
|
167
|
+
let t = 0;
|
|
168
|
+
for (const r of o.values())
|
|
169
|
+
r.status === "pending" && D(r, a) && (t += 1);
|
|
170
|
+
return t;
|
|
171
|
+
}
|
|
172
|
+
function U(a) {
|
|
173
|
+
return v({ kind: "item", id: a });
|
|
174
|
+
}
|
|
175
|
+
function $(a, t = {}) {
|
|
176
|
+
return v(a ? { kind: "view", params: a, exact: t.exact } : { kind: "view" });
|
|
177
|
+
}
|
|
178
|
+
function he(a = {}) {
|
|
179
|
+
return v({ ...a, kind: "mutation" });
|
|
180
|
+
}
|
|
181
|
+
function be(a = {}) {
|
|
182
|
+
return v({ ...a, kind: "query" });
|
|
183
|
+
}
|
|
184
|
+
function ve(a) {
|
|
185
|
+
_();
|
|
186
|
+
const t = [];
|
|
187
|
+
for (const r of o.values())
|
|
188
|
+
r.status === "error" && D(r, a) && t.push({ scope: r.scope, error: r.error });
|
|
189
|
+
return t;
|
|
190
|
+
}
|
|
191
|
+
function Be(a) {
|
|
192
|
+
_();
|
|
193
|
+
for (const t of o.values())
|
|
194
|
+
if (t.status === "error" && D(t, a))
|
|
195
|
+
return t.error;
|
|
196
|
+
}
|
|
197
|
+
function K(a) {
|
|
198
|
+
for (const t of [...o.values()])
|
|
199
|
+
t.status === "error" && D(t, a) && o.delete(t.token);
|
|
200
|
+
P();
|
|
201
|
+
}
|
|
202
|
+
async function we(a, t = {}) {
|
|
168
203
|
if (!e.fetchOne)
|
|
169
204
|
throw new Error("useStore.retrieve called but fetchOne is not defined in store options");
|
|
170
|
-
const { force:
|
|
171
|
-
if (
|
|
172
|
-
return
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
return
|
|
176
|
-
const B = e.fetchOne,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
205
|
+
const { force: r = !1 } = t, d = n.value[a];
|
|
206
|
+
if (d !== void 0 && !r && (!e.isComplete || e.isComplete(d)))
|
|
207
|
+
return d;
|
|
208
|
+
const p = h.get(E(a));
|
|
209
|
+
if (p && !r)
|
|
210
|
+
return G(p);
|
|
211
|
+
const B = e.fetchOne, I = e.isGone ?? ia, M = f, b = l, C = oe(h, E(a), (c) => Q(
|
|
212
|
+
{ kind: "item", id: a },
|
|
213
|
+
async () => {
|
|
214
|
+
let w;
|
|
215
|
+
try {
|
|
216
|
+
w = await B(a);
|
|
217
|
+
} catch (m) {
|
|
218
|
+
if (c.supersededBy)
|
|
219
|
+
return;
|
|
220
|
+
throw M === f && !q(m) && I(m) && H(a), m;
|
|
221
|
+
}
|
|
222
|
+
if (!(M !== f || c.supersededBy)) {
|
|
223
|
+
if (Y(a, b)) {
|
|
224
|
+
const m = n.value[a];
|
|
225
|
+
if (m === void 0 || X(a) !== void 0)
|
|
226
|
+
return m;
|
|
227
|
+
const F = l;
|
|
228
|
+
let T;
|
|
229
|
+
try {
|
|
230
|
+
T = await B(a);
|
|
231
|
+
} catch (ae) {
|
|
232
|
+
if (c.supersededBy)
|
|
233
|
+
return;
|
|
234
|
+
throw M === f && !q(ae) && I(ae) && H(a), ae;
|
|
235
|
+
}
|
|
236
|
+
return M !== f || c.supersededBy || Y(a, F) ? X(a) : z(a, e.enrichItem ? e.enrichItem(T) : T);
|
|
237
|
+
}
|
|
238
|
+
return z(a, e.enrichItem ? e.enrichItem(w) : w);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{},
|
|
242
|
+
(w) => {
|
|
243
|
+
c.entryToken = w.token;
|
|
189
244
|
}
|
|
190
|
-
|
|
191
|
-
return
|
|
245
|
+
).catch((w) => q(w) ? X(a) : void 0));
|
|
246
|
+
return G(C);
|
|
192
247
|
}
|
|
193
|
-
function
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
248
|
+
function N(a) {
|
|
249
|
+
const t = j(a), r = i.value[t];
|
|
250
|
+
if (r)
|
|
196
251
|
return {
|
|
197
|
-
items:
|
|
198
|
-
total:
|
|
199
|
-
hasMore:
|
|
200
|
-
page:
|
|
201
|
-
limit:
|
|
252
|
+
items: r.itemIds.map((d) => n.value[d]).filter((d) => d !== void 0),
|
|
253
|
+
total: r.total,
|
|
254
|
+
hasMore: r.hasMore,
|
|
255
|
+
page: r.page,
|
|
256
|
+
limit: r.limit
|
|
202
257
|
};
|
|
203
258
|
}
|
|
204
|
-
|
|
259
|
+
function Ae(a) {
|
|
260
|
+
return n.value[a];
|
|
261
|
+
}
|
|
262
|
+
function ke() {
|
|
263
|
+
return Object.values(n.value);
|
|
264
|
+
}
|
|
265
|
+
function Ce(a) {
|
|
266
|
+
const t = e.enrichItem ? e.enrichItem(a) : a;
|
|
267
|
+
z(W(t), t);
|
|
268
|
+
}
|
|
269
|
+
function H(a, t = {}) {
|
|
270
|
+
const { clearError: r = !0 } = t;
|
|
271
|
+
delete n.value[a];
|
|
272
|
+
for (const d of Object.values(i.value)) {
|
|
273
|
+
const p = d.itemIds.findIndex((B) => E(B) === E(a));
|
|
274
|
+
p !== -1 && (d.itemIds.splice(p, 1), d.total = Math.max(0, d.total - 1));
|
|
275
|
+
}
|
|
276
|
+
r && (K({ kind: "item", id: a }), K({ kind: "mutation", name: "update", id: a }), K({ kind: "mutation", name: "remove", id: a }));
|
|
277
|
+
}
|
|
278
|
+
function O(a) {
|
|
279
|
+
for (const t of Object.keys(i.value))
|
|
280
|
+
ne(t, a) && g.add(t);
|
|
281
|
+
for (const [t, r] of A)
|
|
282
|
+
ne(t, a) && (r.stale = !0);
|
|
283
|
+
}
|
|
284
|
+
function Se(a) {
|
|
285
|
+
return a.kind === "item" ? n.value[a.id] !== void 0 : i.value[j(a.params)] !== void 0;
|
|
286
|
+
}
|
|
287
|
+
async function ye(a, t = {}) {
|
|
205
288
|
if (!e.fetchPage)
|
|
206
289
|
throw new Error("useStore.list called but fetchPage is not defined in store options");
|
|
207
|
-
const
|
|
208
|
-
if (i.value[
|
|
209
|
-
return
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
return await
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
290
|
+
const r = j(a), { force: d = !1 } = t;
|
|
291
|
+
if (i.value[r] !== void 0 && !g.has(r) && !d)
|
|
292
|
+
return N(a);
|
|
293
|
+
const p = A.get(r);
|
|
294
|
+
if (p && !d)
|
|
295
|
+
return await G(p), N(a);
|
|
296
|
+
const B = e.fetchPage, I = f, M = l, b = oe(A, r, (C) => Q(
|
|
297
|
+
{ kind: "view", params: a },
|
|
298
|
+
async () => {
|
|
299
|
+
let c;
|
|
300
|
+
try {
|
|
301
|
+
c = await B(a);
|
|
302
|
+
} catch (m) {
|
|
303
|
+
if (C.supersededBy)
|
|
304
|
+
return;
|
|
305
|
+
throw m;
|
|
306
|
+
}
|
|
307
|
+
if (I !== f || C.supersededBy)
|
|
218
308
|
return;
|
|
219
|
-
const
|
|
220
|
-
for (const
|
|
221
|
-
const
|
|
222
|
-
|
|
309
|
+
const w = [];
|
|
310
|
+
for (const m of c.items) {
|
|
311
|
+
const F = e.enrichItem ? e.enrichItem(m) : m, T = W(F);
|
|
312
|
+
Y(T, M) || z(T, F), w.push(T);
|
|
223
313
|
}
|
|
224
|
-
i.value[
|
|
225
|
-
itemIds:
|
|
226
|
-
total:
|
|
227
|
-
hasMore:
|
|
228
|
-
page:
|
|
229
|
-
limit:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
R === u && delete n.value[s];
|
|
314
|
+
i.value[r] = {
|
|
315
|
+
itemIds: w,
|
|
316
|
+
total: c.total,
|
|
317
|
+
hasMore: c.hasMore,
|
|
318
|
+
page: c.page,
|
|
319
|
+
limit: c.limit
|
|
320
|
+
}, C.stale ? g.add(r) : g.delete(r);
|
|
321
|
+
},
|
|
322
|
+
{},
|
|
323
|
+
(c) => {
|
|
324
|
+
C.entryToken = c.token;
|
|
236
325
|
}
|
|
237
|
-
|
|
238
|
-
|
|
326
|
+
).catch(() => {
|
|
327
|
+
}));
|
|
328
|
+
return await G(b), N(a);
|
|
239
329
|
}
|
|
240
|
-
async function
|
|
330
|
+
async function Ie(a, t = {}) {
|
|
241
331
|
if (!e.createMutation)
|
|
242
332
|
throw new Error("useStore.create called but createMutation is not defined in store options");
|
|
243
|
-
const
|
|
244
|
-
return
|
|
333
|
+
const r = e.createMutation;
|
|
334
|
+
return J({ name: "create", ...t }, () => r(a), {}, void 0, !0);
|
|
245
335
|
}
|
|
246
|
-
async function
|
|
336
|
+
async function Me(a, t) {
|
|
247
337
|
if (!e.updateMutation)
|
|
248
338
|
throw new Error("useStore.update called but updateMutation is not defined in store options");
|
|
249
|
-
const
|
|
250
|
-
return
|
|
339
|
+
const r = e.updateMutation;
|
|
340
|
+
return J({ name: "update", id: a }, () => r(a, t), {}, a, !1);
|
|
251
341
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
342
|
+
function Re(a, t, r = {}) {
|
|
343
|
+
return J(a, t, r, a.id, !1);
|
|
254
344
|
}
|
|
255
|
-
async function
|
|
345
|
+
async function Ee(a) {
|
|
256
346
|
if (!e.removeMutation)
|
|
257
347
|
throw new Error("useStore.remove called but removeMutation is not defined in store options");
|
|
258
|
-
const
|
|
259
|
-
await
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
348
|
+
const t = e.removeMutation, r = f;
|
|
349
|
+
if (await S({ kind: "mutation", name: "remove", id: a }, () => t(a)), r === f) {
|
|
350
|
+
H(a);
|
|
351
|
+
const d = l++;
|
|
352
|
+
y.set(E(a), d), k.set(E(a), d), O();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function Pe() {
|
|
356
|
+
f++, n.value = {}, i.value = {}, o.clear(), h.clear(), A.clear(), y.clear(), k.clear(), g.clear();
|
|
357
|
+
for (const a of R)
|
|
358
|
+
a(new aa());
|
|
359
|
+
R.clear(), P();
|
|
360
|
+
}
|
|
361
|
+
async function J(a, t, r, d, p) {
|
|
362
|
+
const B = f, I = l;
|
|
363
|
+
return S({ kind: "mutation", ...a }, async () => {
|
|
364
|
+
const M = await t(), b = e.enrichItem ? e.enrichItem(M) : M;
|
|
365
|
+
if (B !== f)
|
|
366
|
+
return b;
|
|
367
|
+
let C;
|
|
368
|
+
try {
|
|
369
|
+
C = W(b, d);
|
|
370
|
+
} catch (w) {
|
|
371
|
+
throw O(), w;
|
|
372
|
+
}
|
|
373
|
+
if (!p && Te(C, I))
|
|
374
|
+
return b;
|
|
375
|
+
const c = z(C, b);
|
|
376
|
+
return y.set(E(C), l++), O(), c;
|
|
377
|
+
}, r);
|
|
378
|
+
}
|
|
379
|
+
function W(a, t) {
|
|
380
|
+
const r = e.getItemId ? e.getItemId(a) : a.id;
|
|
381
|
+
if (r != null)
|
|
382
|
+
return r;
|
|
383
|
+
if (t !== void 0)
|
|
384
|
+
return t;
|
|
385
|
+
throw new ea(e.getItemId !== void 0);
|
|
386
|
+
}
|
|
387
|
+
async function Q(a, t, r, d) {
|
|
388
|
+
const { mode: p = "parallel", channel: B } = r, I = B ?? de(a);
|
|
389
|
+
if (p !== "parallel" && typeof t != "function")
|
|
390
|
+
throw new Error(
|
|
391
|
+
`useStore.withPending: mode '${p}' requires a thunk, not an already-started promise. Pass \`() => doWork()\` instead of \`doWork()\`.`
|
|
392
|
+
);
|
|
393
|
+
if (p === "dedupe") {
|
|
394
|
+
const c = ze(I);
|
|
395
|
+
if (c)
|
|
396
|
+
return c.promise;
|
|
263
397
|
}
|
|
398
|
+
const M = p === "queue" ? Ge(I) : [], b = Le(a, I);
|
|
399
|
+
if (d?.(b), p === "queue") {
|
|
400
|
+
const c = t, w = M.length > 0 ? Ue(Promise.all(M.map((m) => m.then(() => {
|
|
401
|
+
}, () => {
|
|
402
|
+
}))).then(() => {
|
|
403
|
+
})).then(c) : (async () => c())();
|
|
404
|
+
b.promise = w, P();
|
|
405
|
+
try {
|
|
406
|
+
const m = await w;
|
|
407
|
+
return se(b), m;
|
|
408
|
+
} catch (m) {
|
|
409
|
+
throw ue(b, m), m;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const C = typeof t == "function" ? (async () => t())() : t;
|
|
413
|
+
b.promise = C, P();
|
|
414
|
+
try {
|
|
415
|
+
const c = await C;
|
|
416
|
+
return se(b), c;
|
|
417
|
+
} catch (c) {
|
|
418
|
+
throw ue(b, c), c;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function oe(a, t, r) {
|
|
422
|
+
let d;
|
|
423
|
+
const p = {
|
|
424
|
+
supersededBy: null,
|
|
425
|
+
stale: !1,
|
|
426
|
+
entryToken: null,
|
|
427
|
+
result: new Promise((I) => {
|
|
428
|
+
d = I;
|
|
429
|
+
})
|
|
430
|
+
}, B = a.get(t);
|
|
431
|
+
return B && (B.supersededBy = p, B.entryToken !== null && (o.delete(B.entryToken), P())), a.set(t, p), d(r(p).finally(() => {
|
|
432
|
+
a.get(t) === p && a.delete(t);
|
|
433
|
+
})), p;
|
|
434
|
+
}
|
|
435
|
+
async function G(a) {
|
|
436
|
+
const t = await a.result;
|
|
437
|
+
return a.supersededBy ? G(a.supersededBy) : t;
|
|
438
|
+
}
|
|
439
|
+
function Te(a, t) {
|
|
440
|
+
const r = k.get(E(a));
|
|
441
|
+
return r !== void 0 && r >= t;
|
|
442
|
+
}
|
|
443
|
+
function Y(a, t) {
|
|
444
|
+
const r = y.get(E(a));
|
|
445
|
+
return r !== void 0 && r >= t;
|
|
446
|
+
}
|
|
447
|
+
function Ue(a) {
|
|
448
|
+
return new Promise((t, r) => {
|
|
449
|
+
R.add(r), a.then(() => {
|
|
450
|
+
R.delete(r), t();
|
|
451
|
+
});
|
|
452
|
+
});
|
|
264
453
|
}
|
|
265
|
-
function
|
|
266
|
-
t
|
|
454
|
+
function X(a) {
|
|
455
|
+
const t = n.value[a];
|
|
456
|
+
if (!(t === void 0 || e.isComplete && !e.isComplete(t)))
|
|
457
|
+
return t;
|
|
267
458
|
}
|
|
268
|
-
function
|
|
269
|
-
|
|
459
|
+
function z(a, t) {
|
|
460
|
+
const r = e.mergeItem ? e.mergeItem(n.value[a], t) : t;
|
|
461
|
+
return n.value[a] = r, r;
|
|
462
|
+
}
|
|
463
|
+
function P() {
|
|
464
|
+
u.value++;
|
|
465
|
+
}
|
|
466
|
+
function _() {
|
|
467
|
+
u.value;
|
|
468
|
+
}
|
|
469
|
+
function Le(a, t) {
|
|
470
|
+
const r = a.kind === "view" ? { ...a, params: { ...a.params } } : a, d = de(r);
|
|
471
|
+
r.kind === "mutation" && ee(d, l);
|
|
472
|
+
const p = {
|
|
473
|
+
token: l++,
|
|
474
|
+
key: t,
|
|
475
|
+
address: d,
|
|
476
|
+
scope: r,
|
|
477
|
+
status: "pending",
|
|
478
|
+
promise: null,
|
|
479
|
+
error: null,
|
|
480
|
+
failedAt: null
|
|
481
|
+
};
|
|
482
|
+
return o.set(p.token, p), P(), p;
|
|
483
|
+
}
|
|
484
|
+
function ee(a, t) {
|
|
485
|
+
for (const r of [...o.values()])
|
|
486
|
+
r.status === "error" && r.address === a && r.failedAt !== null && r.failedAt < t && o.delete(r.token);
|
|
487
|
+
}
|
|
488
|
+
function se(a) {
|
|
489
|
+
o.has(a.token) && (o.delete(a.token), ee(a.address, a.token), P());
|
|
490
|
+
}
|
|
491
|
+
function ue(a, t) {
|
|
492
|
+
if (o.has(a.token)) {
|
|
493
|
+
if (a.scope.kind !== "mutation") {
|
|
494
|
+
if (q(t)) {
|
|
495
|
+
o.delete(a.token), P();
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
ee(a.address, l);
|
|
499
|
+
}
|
|
500
|
+
a.status = "error", a.error = t, a.promise = null, a.failedAt = l++, P();
|
|
501
|
+
}
|
|
270
502
|
}
|
|
271
|
-
|
|
503
|
+
function Ge(a) {
|
|
504
|
+
const t = [];
|
|
505
|
+
for (const r of o.values())
|
|
506
|
+
r.status === "pending" && r.key === a && r.promise && t.push(r.promise);
|
|
507
|
+
return t;
|
|
508
|
+
}
|
|
509
|
+
function ze(a) {
|
|
510
|
+
for (const t of o.values())
|
|
511
|
+
if (t.status === "pending" && t.key === a && t.promise)
|
|
512
|
+
return t;
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
state: s,
|
|
516
|
+
getItem: Ae,
|
|
517
|
+
getItems: ke,
|
|
518
|
+
setItem: Ce,
|
|
519
|
+
removeItem: H,
|
|
520
|
+
markViewsStale: O,
|
|
521
|
+
hasData: Se,
|
|
522
|
+
getErrors: ve,
|
|
523
|
+
getError: Be,
|
|
524
|
+
clearErrors: K,
|
|
525
|
+
isPending: v,
|
|
526
|
+
pendingCount: Z,
|
|
527
|
+
isRetrieving: U,
|
|
528
|
+
isListing: $,
|
|
529
|
+
isMutating: he,
|
|
530
|
+
isQuerying: be,
|
|
531
|
+
withPending: S,
|
|
532
|
+
retrieve: we,
|
|
533
|
+
list: ye,
|
|
534
|
+
getView: N,
|
|
535
|
+
create: Ie,
|
|
536
|
+
update: Me,
|
|
537
|
+
mutate: Re,
|
|
538
|
+
remove: Ee,
|
|
539
|
+
reset: Pe
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function E(e) {
|
|
543
|
+
return String(e);
|
|
544
|
+
}
|
|
545
|
+
function de(e) {
|
|
546
|
+
switch (e.kind) {
|
|
547
|
+
case "item":
|
|
548
|
+
return `item:${String(e.id)}`;
|
|
549
|
+
case "view":
|
|
550
|
+
return `view:${j(e.params)}`;
|
|
551
|
+
case "query":
|
|
552
|
+
return `query:${e.name}:${e.id === void 0 ? "*" : String(e.id)}`;
|
|
553
|
+
case "mutation":
|
|
554
|
+
return `mutation:${e.name}:${e.id === void 0 ? "*" : String(e.id)}:${e.lid ?? "*"}`;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
function D(e, n) {
|
|
558
|
+
if (!n)
|
|
559
|
+
return !0;
|
|
560
|
+
const i = e.scope;
|
|
561
|
+
if (n.kind !== void 0 && n.kind !== i.kind)
|
|
562
|
+
return !1;
|
|
563
|
+
if (n.id !== void 0) {
|
|
564
|
+
const s = i.kind === "view" ? void 0 : i.id;
|
|
565
|
+
if (s === void 0 || E(s) !== E(n.id))
|
|
566
|
+
return !1;
|
|
567
|
+
}
|
|
568
|
+
if (n.params !== void 0) {
|
|
569
|
+
if (i.kind !== "view")
|
|
570
|
+
return !1;
|
|
571
|
+
const s = e.address.slice(5);
|
|
572
|
+
if (n.exact ? s !== re(n.params).join("|") : !ne(s, n.params))
|
|
573
|
+
return !1;
|
|
574
|
+
}
|
|
575
|
+
return n.name !== void 0 && (i.kind !== "mutation" && i.kind !== "query" || i.name !== n.name) || n.lid !== void 0 && (i.kind !== "mutation" || i.lid !== n.lid) ? !1 : n.predicate ? n.predicate(i) : !0;
|
|
272
576
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
577
|
+
function ne(e, n) {
|
|
578
|
+
if (!n)
|
|
579
|
+
return !0;
|
|
580
|
+
const i = new Set(na(e));
|
|
581
|
+
return re(n).every((s) => i.has(s));
|
|
582
|
+
}
|
|
583
|
+
function na(e) {
|
|
584
|
+
const n = [];
|
|
585
|
+
let i = 0, s = !1;
|
|
586
|
+
for (let o = 0; o < e.length; o++) {
|
|
587
|
+
const u = e[o];
|
|
588
|
+
s && u === "\\" ? o++ : u === '"' ? s = !s : u === "|" && !s && (n.push(e.slice(i, o)), i = o + 1);
|
|
589
|
+
}
|
|
590
|
+
return n.push(e.slice(i)), n;
|
|
591
|
+
}
|
|
592
|
+
function re(e) {
|
|
593
|
+
return Object.entries(e).filter(([, n]) => n !== void 0).sort(([n], [i]) => me(n, i)).map(([n, i]) => `${n}=${ta(i)}`);
|
|
594
|
+
}
|
|
595
|
+
function ta(e) {
|
|
596
|
+
return e instanceof Date ? ge(e) : typeof e == "string" || typeof e == "object" && e !== null ? JSON.stringify(te(e)) : String(e);
|
|
597
|
+
}
|
|
598
|
+
function te(e) {
|
|
599
|
+
return e instanceof Date ? ge(e) : Array.isArray(e) ? e.map(te) : typeof e == "object" && e !== null ? Object.fromEntries(
|
|
600
|
+
Object.entries(e).sort(([n], [i]) => me(n, i)).map(([n, i]) => [n, te(i)])
|
|
601
|
+
) : e;
|
|
602
|
+
}
|
|
603
|
+
function me(e, n) {
|
|
604
|
+
return e < n ? -1 : e > n ? 1 : 0;
|
|
605
|
+
}
|
|
606
|
+
function ge(e) {
|
|
607
|
+
return Number.isNaN(e.getTime()) ? String(e) : e.toISOString();
|
|
608
|
+
}
|
|
609
|
+
function ia(e) {
|
|
610
|
+
if (typeof e != "object" || e === null)
|
|
611
|
+
return !1;
|
|
612
|
+
const n = e.response;
|
|
613
|
+
if (typeof n != "object" || n === null)
|
|
614
|
+
return !1;
|
|
615
|
+
const i = n.status;
|
|
616
|
+
return i === 404 || i === 410 || i === 403;
|
|
617
|
+
}
|
|
618
|
+
function q(e) {
|
|
619
|
+
return typeof e == "object" && e !== null && e.name === "AbortError";
|
|
620
|
+
}
|
|
621
|
+
function wa(e, n) {
|
|
622
|
+
const i = (s) => {
|
|
623
|
+
const o = e.value, u = s.target;
|
|
624
|
+
!o || !u || o.contains(u) || n();
|
|
277
625
|
};
|
|
278
|
-
|
|
626
|
+
fe(() => {
|
|
279
627
|
document.addEventListener("click", i);
|
|
280
|
-
}),
|
|
628
|
+
}), He(() => {
|
|
281
629
|
document.removeEventListener("click", i);
|
|
282
630
|
});
|
|
283
631
|
}
|
|
284
|
-
function
|
|
285
|
-
const { locale: e } =
|
|
286
|
-
function
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
632
|
+
function Aa() {
|
|
633
|
+
const { locale: e } = V();
|
|
634
|
+
function n(i, s = null) {
|
|
635
|
+
const o = ra[i.trim().toUpperCase()];
|
|
636
|
+
if (!o)
|
|
289
637
|
throw new Error(`Unknown country code: ${i}`);
|
|
290
|
-
if (
|
|
291
|
-
return
|
|
292
|
-
if (
|
|
293
|
-
return
|
|
294
|
-
if (e.value !== "en" &&
|
|
295
|
-
return
|
|
638
|
+
if (s && o[s])
|
|
639
|
+
return o[s];
|
|
640
|
+
if (o[e.value])
|
|
641
|
+
return o[e.value];
|
|
642
|
+
if (e.value !== "en" && o.en)
|
|
643
|
+
return o.en;
|
|
296
644
|
throw new Error(`Unknown country code: ${i}`);
|
|
297
645
|
}
|
|
298
|
-
return
|
|
646
|
+
return n;
|
|
299
647
|
}
|
|
300
|
-
const
|
|
648
|
+
const ra = {
|
|
301
649
|
AD: { en: "Andorra", fr: "Andorre", es: "Andorra", de: "Andorra", it: "Andorra", pt: "Andorra", da: "Andorra" },
|
|
302
650
|
AE: { en: "United Arab Emirates", fr: "Émirats arabes unis", es: "Emiratos Árabes Unidos", de: "Vereinigte Arabische Emirate", it: "Emirati Arabi Uniti", pt: "Emirados Árabes Unidos", da: "De Forenede Arabiske Emirater" },
|
|
303
651
|
AF: { en: "Afghanistan", fr: "Afghanistan", es: "Afganistán", de: "Afghanistan", it: "Afghanistan", pt: "Afeganistão", da: "Afghanistan" },
|
|
@@ -435,153 +783,154 @@ const re = {
|
|
|
435
783
|
ZA: { en: "South Africa", fr: "Afrique Du Sud", es: "Sudáfrica", de: "Südafrika", it: "Sudafrica", pt: "África Do Sul", da: "Sydafrika" },
|
|
436
784
|
ZM: { en: "Zambia", fr: "Zambie", es: "Zambia", de: "Sambia", it: "Zambia", pt: "Zâmbia", da: "Zambia" },
|
|
437
785
|
ZW: { en: "Zimbabwe", fr: "Zimbabwe", es: "Zimbabue", de: "Simbabwe", it: "Zimbabwe", pt: "Zimbábue", da: "Zimbabwe" }
|
|
438
|
-
},
|
|
439
|
-
const
|
|
786
|
+
}, ka = ({ code: e, message: n, data: i }) => {
|
|
787
|
+
const s = n || "An unexpected error occurred", o = Fe({
|
|
440
788
|
statusCode: e,
|
|
441
|
-
statusMessage:
|
|
442
|
-
message:
|
|
789
|
+
statusMessage: s,
|
|
790
|
+
message: s,
|
|
443
791
|
data: i
|
|
444
792
|
});
|
|
445
|
-
throw
|
|
446
|
-
},
|
|
447
|
-
function
|
|
448
|
-
const { gtagId: e } =
|
|
793
|
+
throw qe(o), o;
|
|
794
|
+
}, oa = "ilcJCL_lmpwcEJfSkKND";
|
|
795
|
+
function Ca() {
|
|
796
|
+
const { gtagId: e } = xe().public;
|
|
449
797
|
return { reportConversion: () => {
|
|
450
798
|
if (typeof window > "u" || typeof window.gtag > "u" || !e)
|
|
451
799
|
return;
|
|
452
|
-
const i = `${e}/${
|
|
800
|
+
const i = `${e}/${oa}`;
|
|
453
801
|
window.gtag("event", "conversion", {
|
|
454
802
|
send_to: i
|
|
455
803
|
});
|
|
456
804
|
} };
|
|
457
805
|
}
|
|
458
|
-
const
|
|
459
|
-
function
|
|
460
|
-
const { locale: e } =
|
|
461
|
-
return { contactUrl:
|
|
806
|
+
const le = "https://5509641.hs-sites-eu1.com";
|
|
807
|
+
function Sa() {
|
|
808
|
+
const { locale: e } = V();
|
|
809
|
+
return { contactUrl: ie(() => e.value === "fr" ? `${le}/contact` : `${le}/${e.value}/contact`) };
|
|
462
810
|
}
|
|
463
|
-
function
|
|
464
|
-
async function e(
|
|
811
|
+
function ya() {
|
|
812
|
+
async function e(s) {
|
|
465
813
|
await Promise.all(
|
|
466
|
-
|
|
467
|
-
(
|
|
468
|
-
if (!
|
|
469
|
-
const
|
|
470
|
-
|
|
814
|
+
s.map(
|
|
815
|
+
(o) => new Promise((u) => {
|
|
816
|
+
if (!o) return u(null);
|
|
817
|
+
const l = new Image();
|
|
818
|
+
l.onload = () => u(null), l.onerror = () => u(null), l.src = o;
|
|
471
819
|
})
|
|
472
820
|
)
|
|
473
821
|
);
|
|
474
822
|
}
|
|
475
|
-
function
|
|
476
|
-
return
|
|
823
|
+
function n(s, o) {
|
|
824
|
+
return o.split(".").reduce((u, l) => u && typeof u == "object" && l in u ? u[l] : "", s) ?? "";
|
|
477
825
|
}
|
|
478
|
-
function i(
|
|
826
|
+
function i(s, o, u) {
|
|
479
827
|
if (import.meta.server)
|
|
480
828
|
return async (f) => {
|
|
481
|
-
|
|
829
|
+
s.value = !0;
|
|
482
830
|
};
|
|
483
|
-
const
|
|
484
|
-
`${
|
|
831
|
+
const l = je(
|
|
832
|
+
`${o}LoadedImageCache`,
|
|
485
833
|
() => ({})
|
|
486
834
|
);
|
|
487
835
|
return async (f) => {
|
|
488
836
|
if (!f) {
|
|
489
|
-
|
|
837
|
+
s.value = !1;
|
|
490
838
|
return;
|
|
491
839
|
}
|
|
492
|
-
const g =
|
|
493
|
-
if (
|
|
494
|
-
|
|
840
|
+
const g = u.map((y) => n(f, y)), h = `${o}|${g.join("|")}`;
|
|
841
|
+
if (l.value[h]) {
|
|
842
|
+
s.value = !0;
|
|
495
843
|
return;
|
|
496
844
|
}
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
await e(
|
|
845
|
+
s.value = !1;
|
|
846
|
+
const A = g.filter(Boolean).map(String);
|
|
847
|
+
await e(A), l.value[h] = !0, s.value = !0;
|
|
500
848
|
};
|
|
501
849
|
}
|
|
502
850
|
return i;
|
|
503
851
|
}
|
|
504
|
-
const
|
|
852
|
+
const sa = {
|
|
505
853
|
en: ["US", "UK"]
|
|
506
|
-
},
|
|
507
|
-
function
|
|
508
|
-
const
|
|
854
|
+
}, ua = "FR";
|
|
855
|
+
function da(e) {
|
|
856
|
+
const n = e.trim().replace("_", "-"), [i, s] = n.split("-");
|
|
509
857
|
return {
|
|
510
858
|
language: i?.toLowerCase() ?? "",
|
|
511
|
-
region:
|
|
859
|
+
region: s?.toUpperCase() ?? ""
|
|
512
860
|
};
|
|
513
861
|
}
|
|
514
|
-
function
|
|
862
|
+
function ce(e) {
|
|
515
863
|
return e.toString().trim().toUpperCase();
|
|
516
864
|
}
|
|
517
|
-
function
|
|
518
|
-
function e(
|
|
865
|
+
function Ia() {
|
|
866
|
+
function e(n, i) {
|
|
519
867
|
if (!i.length) return;
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
const g =
|
|
523
|
-
g?.length && f.push(...g.map(
|
|
524
|
-
for (const
|
|
525
|
-
if (
|
|
526
|
-
return
|
|
527
|
-
return
|
|
868
|
+
const s = i.map(ce), o = new Set(s), { language: u, region: l } = da(n), f = [];
|
|
869
|
+
l && f.push(l);
|
|
870
|
+
const g = sa[u];
|
|
871
|
+
g?.length && f.push(...g.map(ce)), u && f.push(u.toUpperCase()), f.push(ua);
|
|
872
|
+
for (const h of f)
|
|
873
|
+
if (o.has(h))
|
|
874
|
+
return h;
|
|
875
|
+
return s[0];
|
|
528
876
|
}
|
|
529
877
|
return { getRegionFromLocale: e };
|
|
530
878
|
}
|
|
531
|
-
function
|
|
532
|
-
const { t: e } =
|
|
533
|
-
function
|
|
534
|
-
const
|
|
535
|
-
let
|
|
536
|
-
for (;
|
|
537
|
-
const { index:
|
|
538
|
-
|
|
879
|
+
function Ma() {
|
|
880
|
+
const { t: e } = V();
|
|
881
|
+
function n(i, s) {
|
|
882
|
+
const o = e(i), u = [], f = s.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), g = new RegExp(`\\[(${f})\\]([\\s\\S]*?)\\[\\/\\1\\]`, "g"), h = s.reduce((k, R) => (k[R] = !1, k), {});
|
|
883
|
+
let A = 0, y = g.exec(o);
|
|
884
|
+
for (; y; ) {
|
|
885
|
+
const { index: k, 0: R, 1: S, 2: v } = y;
|
|
886
|
+
k > A && u.push({ text: o.slice(A, k), ...h }), v && S && u.push({ text: v, ...h, [S]: !0 }), A = k + R.length, y = g.exec(o);
|
|
539
887
|
}
|
|
540
|
-
return
|
|
888
|
+
return A < o.length && u.push({ text: o.slice(A), ...h }), u;
|
|
541
889
|
}
|
|
542
|
-
return { parse:
|
|
890
|
+
return { parse: n };
|
|
543
891
|
}
|
|
544
|
-
function
|
|
545
|
-
const
|
|
546
|
-
() =>
|
|
892
|
+
function Ra(e, n, i = 768) {
|
|
893
|
+
const s = L(i - 1), o = ie(
|
|
894
|
+
() => s.value >= i ? n : e
|
|
547
895
|
);
|
|
548
896
|
if (import.meta.client) {
|
|
549
|
-
const
|
|
550
|
-
|
|
897
|
+
const u = () => {
|
|
898
|
+
s.value = window.innerWidth;
|
|
551
899
|
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}),
|
|
555
|
-
window.removeEventListener("resize",
|
|
900
|
+
fe(() => {
|
|
901
|
+
u(), window.addEventListener("resize", u);
|
|
902
|
+
}), Oe(() => {
|
|
903
|
+
window.removeEventListener("resize", u);
|
|
556
904
|
});
|
|
557
905
|
}
|
|
558
|
-
return { size:
|
|
906
|
+
return { size: o, windowWidth: s };
|
|
559
907
|
}
|
|
560
|
-
function
|
|
561
|
-
const { locale: e } =
|
|
562
|
-
function
|
|
908
|
+
function Ea() {
|
|
909
|
+
const { locale: e } = V();
|
|
910
|
+
function n(i, s = "fr") {
|
|
563
911
|
if (!i) return "";
|
|
564
|
-
const
|
|
565
|
-
return i[
|
|
912
|
+
const o = e.value;
|
|
913
|
+
return i[o] ?? i[s] ?? "";
|
|
566
914
|
}
|
|
567
|
-
return
|
|
915
|
+
return n;
|
|
568
916
|
}
|
|
569
917
|
export {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
918
|
+
ea as MissingItemIdError,
|
|
919
|
+
aa as StoreResetError,
|
|
920
|
+
va as buildUrl,
|
|
921
|
+
ha as configureHttp,
|
|
922
|
+
j as getViewKey,
|
|
923
|
+
ka as showAndThrowError,
|
|
924
|
+
Je as useAuthSession,
|
|
925
|
+
wa as useClickOutside,
|
|
926
|
+
Aa as useCountriesTranslation,
|
|
927
|
+
Ca as useGtagConversion,
|
|
928
|
+
ba as useHttp,
|
|
929
|
+
Sa as useHubspotContactUrl,
|
|
930
|
+
ya as useImageCacheWatcherCallback,
|
|
931
|
+
Ia as useLocaleHelpers,
|
|
932
|
+
Ma as useParseTranslation,
|
|
933
|
+
Ra as useResponsiveSize,
|
|
934
|
+
Ba as useStore,
|
|
935
|
+
Ea as useTranslate
|
|
587
936
|
};
|