@abyss-project/commons-front-core 18.0.0 → 18.1.1

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.
@@ -0,0 +1,687 @@
1
+ import { jsxs as h, Fragment as J, jsx as d } from "react/jsx-runtime";
2
+ import { useState as v, useCallback as b, useEffect as T, useLayoutEffect as ie, useId as S, useRef as se, createContext as re, useContext as Q, useMemo as H } from "react";
3
+ import R from "@mui/material/Button";
4
+ import X from "@mui/material/Switch";
5
+ import { styled as g } from "@mui/material/styles";
6
+ import { t as x, w as E, p as f, d as D, D as N, S as O, a as V, u as w, b as Z, h as ae, M as ce, c as le } from "./Surface-dziv23sf.js";
7
+ import { useQuery as de, useMutation as ue } from "@tanstack/react-query";
8
+ import { AbyssCore as j } from "@abyss-project/main";
9
+ import { createPortal as fe } from "react-dom";
10
+ import pe from "@mui/material/GlobalStyles";
11
+ import ye from "@mui/material/Link";
12
+ const pt = "2026-11-03", M = "abyssCookieConsent", ee = 183, ge = ee * 24 * 60 * 60 * 1e3, me = ee * 24 * 60 * 60, he = "/", ke = "Lax", ve = (e) => btoa(JSON.stringify(e)), be = (e) => {
13
+ try {
14
+ const t = JSON.parse(atob(decodeURIComponent(e)));
15
+ return typeof t.a != "boolean" || typeof t.m != "boolean" || typeof t.d != "string" || typeof t.v != "string" ? null : t;
16
+ } catch {
17
+ return null;
18
+ }
19
+ }, te = (e, t, o = Date.now()) => {
20
+ if (e.v !== t)
21
+ return !1;
22
+ const n = new Date(e.d).getTime();
23
+ return Number.isNaN(n) ? !1 : o - n < ge;
24
+ }, Ae = () => typeof window > "u" ? !1 : window.location.protocol === "https:", ne = (e, t) => {
25
+ const o = [
26
+ `Path=${he}`,
27
+ `Max-Age=${t}`,
28
+ `SameSite=${ke}`
29
+ ];
30
+ return e.domain && o.push(`Domain=${e.domain}`), Ae() && o.push("Secure"), o.join("; ");
31
+ }, Ce = () => {
32
+ if (typeof document > "u")
33
+ return null;
34
+ const e = document.cookie.split(";").map((t) => t.trim()).find((t) => t.startsWith(`${M}=`));
35
+ return e ? be(e.slice(M.length + 1)) : null;
36
+ }, K = (e, t = {}) => {
37
+ typeof document > "u" || (document.cookie = `${M}=${ve(
38
+ e
39
+ )}; ${ne(t, me)}`);
40
+ }, Se = (e = {}) => {
41
+ typeof document > "u" || (document.cookie = `${M}=; ${ne(e, 0)}`);
42
+ };
43
+ var $ = /* @__PURE__ */ ((e) => (e.NOOP = "noop", e.ADOPT_DB = "adopt-db", e.PUSH_COOKIE = "push-cookie", e))($ || {});
44
+ const F = (e) => ({
45
+ essentials: !0,
46
+ analytics: e.analytics,
47
+ marketing: e.marketing,
48
+ decidedAt: typeof e.decidedAt == "string" ? e.decidedAt : new Date(e.decidedAt).toISOString(),
49
+ consentVersion: e.consentVersion
50
+ }), we = (e, t) => {
51
+ if (!e && !t)
52
+ return { action: "noop", value: null };
53
+ if (!e && t)
54
+ return { action: "adopt-db", value: F(t) };
55
+ if (e && !t)
56
+ return { action: "push-cookie", value: e };
57
+ const o = new Date(e.decidedAt).getTime(), n = new Date(
58
+ typeof t.decidedAt == "string" ? t.decidedAt : t.decidedAt.toISOString()
59
+ ).getTime();
60
+ return n > o ? { action: "adopt-db", value: F(t) } : o > n ? { action: "push-cookie", value: e } : { action: "noop", value: e };
61
+ }, Ee = (e) => ({
62
+ essentials: !0,
63
+ analytics: e.a,
64
+ marketing: e.m,
65
+ decidedAt: e.d,
66
+ consentVersion: e.v
67
+ }), G = (e) => ({
68
+ a: e.analytics,
69
+ m: e.marketing,
70
+ d: e.decidedAt,
71
+ v: e.consentVersion
72
+ }), Oe = (e) => {
73
+ const t = Ce();
74
+ return !t || !te(t, e) ? null : Ee(t);
75
+ }, Me = (e) => {
76
+ const [t, o] = v(
77
+ () => Oe(e.consentVersion)
78
+ ), n = de({
79
+ queryKey: ["cookie-consent", "me"],
80
+ queryFn: async () => (await j.sdk.user.cookieConsent.get()).data.consent,
81
+ enabled: e.isAuthenticated,
82
+ retry: !1,
83
+ refetchOnWindowFocus: !1
84
+ }), s = ue({
85
+ mutationFn: async (i) => (await j.sdk.user.cookieConsent.upsert({
86
+ analytics: i.analytics,
87
+ marketing: i.marketing,
88
+ decidedAt: i.decidedAt,
89
+ consentVersion: i.consentVersion
90
+ })).data.consent
91
+ }), a = b(
92
+ (i) => {
93
+ K(G(i), { domain: e.domain }), o(i), e.isAuthenticated && s.mutate(i);
94
+ },
95
+ [e.domain, e.isAuthenticated, s]
96
+ );
97
+ T(() => {
98
+ if (!e.isAuthenticated || n.isLoading || n.isError)
99
+ return;
100
+ const i = n.data ?? null, p = i !== null && te(
101
+ {
102
+ a: i.analytics,
103
+ m: i.marketing,
104
+ // `String`, never `toISOString()`: an unreadable date must read as no choice, not throw.
105
+ d: String(i.decidedAt),
106
+ v: i.consentVersion
107
+ },
108
+ e.consentVersion
109
+ ), y = we(t, p ? i : null);
110
+ y.action === $.ADOPT_DB && y.value ? (K(G(y.value), { domain: e.domain }), o(y.value)) : y.action === $.PUSH_COOKIE && y.value && s.mutate(y.value);
111
+ }, [e.isAuthenticated, n.isLoading, n.isError, n.data]);
112
+ const l = b(() => {
113
+ a({
114
+ essentials: !0,
115
+ analytics: !0,
116
+ marketing: !0,
117
+ decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
118
+ consentVersion: e.consentVersion
119
+ });
120
+ }, [e.consentVersion, a]), c = b(() => {
121
+ a({
122
+ essentials: !0,
123
+ analytics: !1,
124
+ marketing: !1,
125
+ decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
126
+ consentVersion: e.consentVersion
127
+ });
128
+ }, [e.consentVersion, a]), r = b(
129
+ (i) => {
130
+ a({
131
+ essentials: !0,
132
+ analytics: i.analytics,
133
+ marketing: i.marketing,
134
+ decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
135
+ consentVersion: e.consentVersion
136
+ });
137
+ },
138
+ [e.consentVersion, a]
139
+ ), u = b(() => {
140
+ Se({ domain: e.domain }), o(null);
141
+ }, [e.domain]);
142
+ return {
143
+ consent: t,
144
+ isResolved: t !== null,
145
+ acceptAll: l,
146
+ rejectAll: c,
147
+ save: r,
148
+ reset: u
149
+ };
150
+ }, Te = "https://abyss-project.fr/cgu", Y = "--abyss-toast-clearance", A = "--abyss-cookie-banner-modal-clearance", Re = /* @__PURE__ */ new Set([
151
+ "transform",
152
+ "translate",
153
+ "rotate",
154
+ "scale",
155
+ "filter",
156
+ "backdrop-filter",
157
+ "perspective",
158
+ "contain",
159
+ "transform-style",
160
+ "offset-path",
161
+ "content-visibility"
162
+ ]), xe = /* @__PURE__ */ new Set([
163
+ "paint",
164
+ "layout",
165
+ "strict",
166
+ "content"
167
+ ]), Ie = /* @__PURE__ */ new Set(["size", "inline-size"]), k = (e) => e !== "" && e !== "none", I = (e, t) => e.split(/[\s,]+/).some((o) => t.has(o)), L = [
168
+ { property: "transform", neutral: "none", creates: k },
169
+ { property: "translate", neutral: "none", creates: k },
170
+ { property: "rotate", neutral: "none", creates: k },
171
+ { property: "scale", neutral: "none", creates: k },
172
+ { property: "filter", neutral: "none", creates: k },
173
+ { property: "backdrop-filter", neutral: "none", creates: k },
174
+ { property: "perspective", neutral: "none", creates: k },
175
+ { property: "offset-path", neutral: "none", creates: k },
176
+ {
177
+ property: "transform-style",
178
+ neutral: "flat",
179
+ creates: (e) => e === "preserve-3d"
180
+ },
181
+ {
182
+ property: "content-visibility",
183
+ neutral: "visible",
184
+ creates: (e) => e === "auto" || e === "hidden"
185
+ },
186
+ {
187
+ property: "contain",
188
+ neutral: "none",
189
+ creates: (e) => I(e, xe)
190
+ },
191
+ {
192
+ property: "will-change",
193
+ neutral: "auto",
194
+ creates: (e) => I(e, Re)
195
+ },
196
+ {
197
+ // `scroll-state` alone makes no containing block: only the size containers do.
198
+ property: "container-type",
199
+ neutral: "normal",
200
+ creates: (e) => I(e, Ie)
201
+ }
202
+ ], Le = (e, t) => {
203
+ const o = [];
204
+ let n = e;
205
+ for (; n !== null && (o.push(n), n !== t); )
206
+ n = n.parentElement;
207
+ return o;
208
+ }, _e = (e) => typeof e.getAnimations == "function" && e.getAnimations().length > 0, Pe = (e, t) => {
209
+ const o = Le(e, t), n = /* @__PURE__ */ new Map();
210
+ let s = null;
211
+ const a = (c, r) => c.style.getPropertyValue(r.property) === r.neutral && c.style.getPropertyPriority(r.property) === "important", l = () => {
212
+ s == null || s.disconnect(), o.forEach((c) => {
213
+ let r = n.get(c);
214
+ if (L.filter(
215
+ (i) => (r == null ? void 0 : r.owned.has(i.property)) === !0 && !a(c, i)
216
+ ).forEach((i) => r == null ? void 0 : r.owned.delete(i.property)), _e(c))
217
+ return;
218
+ const u = getComputedStyle(c);
219
+ L.forEach((i) => {
220
+ const { property: p, neutral: y } = i;
221
+ (r == null ? void 0 : r.owned.has(p)) === !0 || c.style.getPropertyValue(p) !== "" || !i.creates(u.getPropertyValue(p).trim()) || (r === void 0 && (r = {
222
+ hadStyleAttribute: c.hasAttribute("style"),
223
+ owned: /* @__PURE__ */ new Set()
224
+ }, n.set(c, r)), r.owned.add(p), c.style.setProperty(p, y, "important"));
225
+ });
226
+ }), o.forEach(
227
+ (c) => s == null ? void 0 : s.observe(c, {
228
+ attributes: !0,
229
+ attributeFilter: ["style", "class"]
230
+ })
231
+ );
232
+ };
233
+ return s = new MutationObserver(l), t.addEventListener("transitionend", l), t.addEventListener("transitioncancel", l), t.addEventListener("animationend", l), l(), () => {
234
+ s == null || s.disconnect(), s = null, t.removeEventListener("transitionend", l), t.removeEventListener("transitioncancel", l), t.removeEventListener("animationend", l), n.forEach((c, r) => {
235
+ L.forEach((u) => {
236
+ c.owned.has(u.property) && a(r, u) && r.style.removeProperty(u.property);
237
+ }), !c.hadStyleAttribute && r.getAttribute("style") === "" && r.removeAttribute("style");
238
+ }), n.clear();
239
+ };
240
+ }, C = "data-abyss-cookie-banner-host", $e = () => {
241
+ const e = Array.from(document.body.children).filter(
242
+ (t) => t instanceof HTMLElement && t.classList.contains("MuiModal-root") && !t.classList.contains("MuiModal-hidden") && !t.classList.contains("MuiPopover-root")
243
+ );
244
+ for (let t = e.length - 1; t >= 0; t -= 1) {
245
+ const o = e[t], n = o.querySelector('[aria-modal="true"]');
246
+ if (n !== null)
247
+ return { host: o, surface: n };
248
+ }
249
+ return null;
250
+ }, De = () => {
251
+ const [e] = v(
252
+ () => typeof document > "u" ? null : document.createElement("div")
253
+ ), [t, o] = v(null);
254
+ return ie(() => {
255
+ if (e === null)
256
+ return;
257
+ let n = null, s = null, a = null;
258
+ const l = /* @__PURE__ */ new WeakSet(), c = () => {
259
+ Array.from(document.body.children).forEach((m) => {
260
+ m.classList.contains("MuiModal-root") && !l.has(m) && (l.add(m), r.observe(m, {
261
+ attributes: !0,
262
+ attributeFilter: ["class"]
263
+ }));
264
+ });
265
+ const u = $e(), i = (u == null ? void 0 : u.host) ?? null, p = (u == null ? void 0 : u.surface) ?? document.body;
266
+ e.parentNode !== p && p.appendChild(e);
267
+ const y = (u == null ? void 0 : u.surface) ?? null;
268
+ y !== s && (a == null || a(), a = null, s = y, u !== null && (a = Pe(u.surface, u.host))), e.removeAttribute("aria-hidden"), i !== n && (n == null || n.removeAttribute(C), i == null || i.setAttribute(C, ""), n = i, o(i));
269
+ }, r = new MutationObserver(c);
270
+ return r.observe(document.body, { childList: !0 }), c(), () => {
271
+ r.disconnect(), a == null || a(), n == null || n.removeAttribute(C), e.remove();
272
+ };
273
+ }, [e]), { container: e, modalHost: t };
274
+ }, U = g(R)(({ theme: e }) => x(e)), Ne = g("div")(({ theme: e }) => {
275
+ const { space: t, elevations: o, durations: n, easings: s } = e.design;
276
+ return {
277
+ position: "fixed",
278
+ zIndex: e.zIndex.snackbar,
279
+ // Clear of the home indicator or gesture bar of a native webview (0 elsewhere).
280
+ bottom: E(O.Bottom, t[6]),
281
+ right: f(t[6]),
282
+ width: 420,
283
+ maxWidth: `calc(100vw - ${f(2 * t[6])})`,
284
+ "& > *": {
285
+ boxShadow: o.overlay,
286
+ animation: `cookie-consent-in ${n.slow}ms ${s.sheet}`
287
+ },
288
+ "@keyframes cookie-consent-in": {
289
+ from: { opacity: 0, transform: `translateY(${f(t[3])})` },
290
+ to: { opacity: 1, transform: "translateY(0)" }
291
+ },
292
+ "@media (prefers-reduced-motion: reduce)": {
293
+ "& > *": { animation: "none" }
294
+ },
295
+ [D.down(N.Tablet)]: {
296
+ bottom: E(O.Bottom, t[3]),
297
+ right: E(O.Right, t[3]),
298
+ left: E(O.Left, t[3]),
299
+ width: "auto",
300
+ maxWidth: "none"
301
+ }
302
+ };
303
+ }), Ve = g("h2")(({ theme: e }) => ({
304
+ margin: 0,
305
+ fontSize: f(e.design.typeScale.sectionTitle),
306
+ fontWeight: V.semibold,
307
+ color: e.design.tokens["text.primary"]
308
+ })), ze = g("p")(({ theme: e }) => ({
309
+ margin: `${f(e.design.space[2])} 0 0`,
310
+ fontSize: f(e.design.typeScale.body),
311
+ color: e.design.tokens["text.secondary"]
312
+ })), Be = g(ye)(({ theme: e }) => ({
313
+ alignSelf: "flex-start",
314
+ marginTop: f(e.design.space[3]),
315
+ fontSize: f(e.design.typeScale.body),
316
+ color: e.design.tokens["accent.text"]
317
+ })), We = g("div")(({ theme: e }) => ({
318
+ display: "flex",
319
+ gap: f(e.design.space[2]),
320
+ marginTop: f(e.design.space[4]),
321
+ "& > *": { flex: 1 }
322
+ })), He = g(R)(({ theme: e }) => ({
323
+ ...x(e),
324
+ marginTop: f(e.design.space[2]),
325
+ color: e.design.tokens["text.secondary"]
326
+ }));
327
+ function je({ api: e }) {
328
+ const t = w(), { acceptAll: o, rejectAll: n, openPreferences: s } = e, a = S(), l = S(), c = se(null), { container: r, modalHost: u } = De();
329
+ return T(() => {
330
+ const i = c.current;
331
+ if (i === null)
332
+ return;
333
+ const p = document.documentElement, y = () => {
334
+ const B = Number.parseFloat(getComputedStyle(i).bottom), W = f(
335
+ i.getBoundingClientRect().height + (Number.isNaN(B) ? 0 : B)
336
+ );
337
+ p.style.setProperty(Y, W), u === null ? p.style.removeProperty(A) : p.style.setProperty(A, W);
338
+ };
339
+ y();
340
+ const m = typeof ResizeObserver > "u" ? null : new ResizeObserver(y);
341
+ return m == null || m.observe(i), window.addEventListener("resize", y), () => {
342
+ m == null || m.disconnect(), window.removeEventListener("resize", y), p.style.removeProperty(Y), p.style.removeProperty(A);
343
+ };
344
+ }, [u]), r === null ? null : fe(
345
+ /* @__PURE__ */ h(J, { children: [
346
+ /* @__PURE__ */ d(
347
+ pe,
348
+ {
349
+ styles: {
350
+ // A dialog or a sheet: the root of the modal is the box they are laid out in.
351
+ [`body > [${C}]`]: {
352
+ bottom: `var(${A}, 0px)`
353
+ },
354
+ // A drawer's paper is fixed to the viewport, not laid out in the root: shorten it too.
355
+ [`body > [${C}] > .MuiDrawer-paper`]: {
356
+ maxHeight: `calc(100% - var(${A}, 0px))`
357
+ },
358
+ [`body > [${C}] > .MuiDrawer-paperAnchorBottom`]: {
359
+ bottom: `var(${A}, 0px)`
360
+ }
361
+ }
362
+ }
363
+ ),
364
+ /* @__PURE__ */ d(Ne, { ref: c, children: /* @__PURE__ */ h(
365
+ Z,
366
+ {
367
+ padding: 4,
368
+ role: "dialog",
369
+ "aria-modal": !1,
370
+ "aria-labelledby": a,
371
+ "aria-describedby": l,
372
+ children: [
373
+ /* @__PURE__ */ d(Ve, { id: a, children: t.formatRichMessage({ id: "cookies.banner.title" }) }),
374
+ /* @__PURE__ */ d(ze, { id: l, children: t.formatRichMessage({ id: "cookies.banner.description" }) }),
375
+ /* @__PURE__ */ d(
376
+ Be,
377
+ {
378
+ href: Te,
379
+ rel: "noreferrer",
380
+ underline: "hover",
381
+ children: t.formatRichMessage({ id: "cookies.banner.privacy-link" })
382
+ }
383
+ ),
384
+ /* @__PURE__ */ h(We, { children: [
385
+ /* @__PURE__ */ d(U, { variant: "contained", onClick: o, children: t.formatRichMessage({ id: "cookies.action.accept-all" }) }),
386
+ /* @__PURE__ */ d(U, { variant: "outlined", onClick: n, children: t.formatRichMessage({ id: "cookies.action.reject-all" }) })
387
+ ] }),
388
+ /* @__PURE__ */ d(
389
+ He,
390
+ {
391
+ variant: "text",
392
+ size: "small",
393
+ fullWidth: !0,
394
+ onClick: s,
395
+ children: t.formatRichMessage({ id: "cookies.action.configure" })
396
+ }
397
+ )
398
+ ]
399
+ }
400
+ ) })
401
+ ] }),
402
+ r
403
+ );
404
+ }
405
+ const Ke = g("div")(({ theme: e }) => {
406
+ const { tokens: t, space: o } = e.design;
407
+ return {
408
+ display: "flex",
409
+ alignItems: "center",
410
+ justifyContent: "space-between",
411
+ gap: f(o[6]),
412
+ minWidth: 0,
413
+ paddingTop: f(o[3]),
414
+ paddingBottom: f(o[3]),
415
+ "& + &": { borderTop: ae(t["border.subtle"]) },
416
+ [D.down(N.Tablet)]: {
417
+ flexDirection: "column",
418
+ alignItems: "stretch",
419
+ gap: f(o[3])
420
+ }
421
+ };
422
+ }), Fe = g("div")(({ theme: e }) => ({
423
+ display: "flex",
424
+ flexDirection: "column",
425
+ gap: f(e.design.space[1]),
426
+ flex: "1 1 auto",
427
+ minWidth: 0,
428
+ overflowWrap: "anywhere"
429
+ })), Ge = g("label")(({ theme: e }) => ({
430
+ fontSize: f(e.design.typeScale.body),
431
+ fontWeight: V.medium,
432
+ color: e.design.tokens["text.primary"]
433
+ })), Ye = g("div")(({ theme: e }) => ({
434
+ fontSize: f(e.design.typeScale.small),
435
+ lineHeight: e.typography.body2.lineHeight,
436
+ color: e.design.tokens["text.secondary"]
437
+ })), Ue = g("div")({
438
+ display: "flex",
439
+ flex: "none",
440
+ alignItems: "center",
441
+ justifyContent: "flex-end",
442
+ maxWidth: "100%",
443
+ [D.down(N.Tablet)]: {
444
+ justifyContent: "flex-start"
445
+ }
446
+ });
447
+ function oe({
448
+ label: e,
449
+ description: t,
450
+ control: o,
451
+ htmlFor: n
452
+ }) {
453
+ const s = S(), a = `${s}-label`, l = t !== void 0 ? `${s}-description` : void 0;
454
+ return /* @__PURE__ */ h(
455
+ Ke,
456
+ {
457
+ role: "group",
458
+ "aria-labelledby": a,
459
+ "aria-describedby": l,
460
+ children: [
461
+ /* @__PURE__ */ h(Fe, { children: [
462
+ /* @__PURE__ */ d(
463
+ Ge,
464
+ {
465
+ id: a,
466
+ htmlFor: n,
467
+ as: n === void 0 ? "span" : "label",
468
+ children: e
469
+ }
470
+ ),
471
+ t !== void 0 && /* @__PURE__ */ d(Ye, { id: l, children: t })
472
+ ] }),
473
+ /* @__PURE__ */ d(Ue, { children: o })
474
+ ]
475
+ }
476
+ );
477
+ }
478
+ const q = g(R)(({ theme: e }) => x(e)), qe = g("span")(({ theme: e }) => ({
479
+ fontSize: f(e.design.typeScale.small),
480
+ color: e.design.tokens["text.secondary"],
481
+ whiteSpace: "nowrap"
482
+ })), Je = g("div")(({ theme: e }) => ({
483
+ display: "flex",
484
+ alignItems: "center",
485
+ gap: f(e.design.space[2])
486
+ }));
487
+ function _({
488
+ category: e,
489
+ checked: t,
490
+ locked: o = !1,
491
+ onChange: n
492
+ }) {
493
+ const s = w(), a = S();
494
+ return /* @__PURE__ */ d(
495
+ oe,
496
+ {
497
+ label: s.formatRichMessage({
498
+ id: `cookies.category.${e}.title`
499
+ }),
500
+ description: s.formatRichMessage({
501
+ id: `cookies.category.${e}.description`
502
+ }),
503
+ htmlFor: a,
504
+ control: /* @__PURE__ */ h(Je, { children: [
505
+ o && /* @__PURE__ */ d(qe, { children: s.formatRichMessage({
506
+ id: "cookies.category.essentials.always-on"
507
+ }) }),
508
+ /* @__PURE__ */ d(
509
+ X,
510
+ {
511
+ id: a,
512
+ checked: t,
513
+ disabled: o,
514
+ onChange: (l, c) => n == null ? void 0 : n(c)
515
+ }
516
+ )
517
+ ] })
518
+ }
519
+ );
520
+ }
521
+ function Qe({
522
+ api: e,
523
+ open: t,
524
+ onClose: o
525
+ }) {
526
+ const n = w(), { consent: s, save: a } = e, [l, c] = v(!1), [r, u] = v(!1), i = (s == null ? void 0 : s.analytics) ?? !1, p = (s == null ? void 0 : s.marketing) ?? !1;
527
+ T(() => {
528
+ t && (c(i), u(p));
529
+ }, [t, i, p]);
530
+ const y = () => {
531
+ a({ analytics: l, marketing: r }), o();
532
+ };
533
+ return /* @__PURE__ */ h(
534
+ ce,
535
+ {
536
+ open: t,
537
+ onClose: o,
538
+ size: le.Small,
539
+ title: n.formatRichMessage({ id: "cookies.configure.title" }),
540
+ actions: /* @__PURE__ */ h(J, { children: [
541
+ /* @__PURE__ */ d(q, { variant: "text", onClick: o, children: n.formatRichMessage({ id: "cookies.action.cancel" }) }),
542
+ /* @__PURE__ */ d(q, { variant: "contained", onClick: y, children: n.formatRichMessage({ id: "cookies.action.save" }) })
543
+ ] }),
544
+ children: [
545
+ /* @__PURE__ */ d(_, { category: "essentials", checked: !0, locked: !0 }),
546
+ /* @__PURE__ */ d(
547
+ _,
548
+ {
549
+ category: "analytics",
550
+ checked: l,
551
+ onChange: c
552
+ }
553
+ ),
554
+ /* @__PURE__ */ d(
555
+ _,
556
+ {
557
+ category: "marketing",
558
+ checked: r,
559
+ onChange: u
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ );
565
+ }
566
+ const z = re(null), Xe = () => {
567
+ const e = Q(z);
568
+ if (!e)
569
+ throw new Error(
570
+ "useAbyssCookieConsent must be used inside <AbyssCookieConsentProvider>"
571
+ );
572
+ return e;
573
+ }, yt = () => Q(z), gt = ({ children: e, consentVersion: t, isAuthenticated: o, domain: n, renderBanner: s }) => {
574
+ const a = Me({ isAuthenticated: o, consentVersion: t, domain: n }), [l, c] = v(!1), r = b(() => c(!0), []), u = b(() => c(!1), []), i = H(
575
+ () => ({ ...a, openPreferences: r }),
576
+ [a, r]
577
+ ), p = H(() => i.isResolved || l ? null : s ? s(i) : /* @__PURE__ */ d(je, { api: i }), [i, l, s]);
578
+ return /* @__PURE__ */ h(z.Provider, { value: i, children: [
579
+ e,
580
+ p,
581
+ /* @__PURE__ */ d(
582
+ Qe,
583
+ {
584
+ api: i,
585
+ open: l,
586
+ onClose: u
587
+ }
588
+ )
589
+ ] });
590
+ }, Ze = g(R)(({ theme: e }) => x(e)), et = g("h2")(({ theme: e }) => ({
591
+ margin: `0 0 ${f(e.design.space[2])}`,
592
+ fontSize: f(e.design.typeScale.sectionTitle),
593
+ fontWeight: V.semibold,
594
+ color: e.design.tokens["text.primary"]
595
+ })), tt = g("div")(({ theme: e }) => ({
596
+ display: "flex",
597
+ marginTop: f(e.design.space[3])
598
+ }));
599
+ function P({
600
+ category: e,
601
+ checked: t,
602
+ locked: o = !1,
603
+ onChange: n
604
+ }) {
605
+ const s = w(), a = S();
606
+ return /* @__PURE__ */ d(
607
+ oe,
608
+ {
609
+ label: s.formatRichMessage({
610
+ id: `cookies.category.${e}.title`
611
+ }),
612
+ description: s.formatRichMessage({
613
+ id: `cookies.category.${e}.description`
614
+ }),
615
+ htmlFor: a,
616
+ control: /* @__PURE__ */ d(
617
+ X,
618
+ {
619
+ id: a,
620
+ checked: t,
621
+ disabled: o,
622
+ onChange: (l, c) => n == null ? void 0 : n(c)
623
+ }
624
+ )
625
+ }
626
+ );
627
+ }
628
+ function mt() {
629
+ const e = w(), { consent: t, save: o } = Xe(), [n, s] = v((t == null ? void 0 : t.analytics) ?? !1), [a, l] = v((t == null ? void 0 : t.marketing) ?? !1), c = t == null ? void 0 : t.analytics, r = t == null ? void 0 : t.marketing;
630
+ return T(() => {
631
+ c !== void 0 && s(c), r !== void 0 && l(r);
632
+ }, [c, r]), /* @__PURE__ */ h(Z, { padding: 4, children: [
633
+ /* @__PURE__ */ d(et, { children: e.formatRichMessage({ id: "cookies.configure.title" }) }),
634
+ /* @__PURE__ */ d(P, { category: "essentials", checked: !0, locked: !0 }),
635
+ /* @__PURE__ */ d(
636
+ P,
637
+ {
638
+ category: "analytics",
639
+ checked: n,
640
+ onChange: s
641
+ }
642
+ ),
643
+ /* @__PURE__ */ d(
644
+ P,
645
+ {
646
+ category: "marketing",
647
+ checked: a,
648
+ onChange: l
649
+ }
650
+ ),
651
+ /* @__PURE__ */ d(tt, { children: /* @__PURE__ */ d(
652
+ Ze,
653
+ {
654
+ variant: "contained",
655
+ onClick: () => o({ analytics: n, marketing: a }),
656
+ children: e.formatRichMessage({ id: "cookies.action.save" })
657
+ }
658
+ ) })
659
+ ] });
660
+ }
661
+ export {
662
+ gt as A,
663
+ je as C,
664
+ Te as D,
665
+ $ as R,
666
+ oe as S,
667
+ Y as T,
668
+ yt as a,
669
+ Qe as b,
670
+ mt as c,
671
+ Me as d,
672
+ pt as e,
673
+ M as f,
674
+ ee as g,
675
+ ge as h,
676
+ me as i,
677
+ he as j,
678
+ ke as k,
679
+ ve as l,
680
+ be as m,
681
+ te as n,
682
+ Se as o,
683
+ we as p,
684
+ Ce as r,
685
+ Xe as u,
686
+ K as w
687
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The banner is `position: fixed`, so that it sticks to the window. A surface of a modal whose style
3
+ * creates a containing block (the `backdrop-filter` of the legacy theme's dialog paper, a
4
+ * `transform`, a `filter`, `contain: paint`, `will-change: transform`, `container-type`...) becomes
5
+ * the box the banner is laid out in instead: it sticks to the bottom of the surface and covers the
6
+ * modal's main action (#747). No stylesheet can tell this in advance, a theme may add any of them.
7
+ *
8
+ * So, while the banner is hosted in `surface`, each property above that really creates a block, read
9
+ * from `getComputedStyle` on the surface and on every ancestor up to `boundary` (the modal root), is
10
+ * switched off by an inline `!important` style. Only what comes from a stylesheet is touched: a
11
+ * property an element carries inline is driven by code (a sheet following the finger writes a
12
+ * `translateY` on every frame, a drawer leaving writes its exit transform), and is never written
13
+ * over, whatever its value; the banner then follows that element for as long as it is moved. Since
14
+ * only a property with no inline value is ever written, giving it back is removing ours (the `style`
15
+ * attribute goes too if it was not there). A style or class change of a chain element, or the end of a
16
+ * transition, is read again; a value someone writes over ours is theirs, and is left alone on release.
17
+ * The list is the common case: what other properties could ever create a block is not exhaustive.
18
+ */
19
+ export declare const neutralizeContainingBlocks: (surface: HTMLElement, boundary: HTMLElement) => (() => void);