diff --git a/admin/src/api.ts b/admin/src/api.ts index a6e63ed..800f815 100644 --- a/admin/src/api.ts +++ b/admin/src/api.ts @@ -187,6 +187,8 @@ export interface StoreListItem extends Store { } export interface StoreDetail extends Store { + /** Carte de fidélité conçue. */ + hasCard: boolean; counts: { cards: number; staff: number; transactions: number }; subscription: { status: SubscriptionStatus; plan: Plan; stripeSubscriptionId: string | null } | null; /** Lien encodé dans le QR d'inscription. */ diff --git a/admin/src/pages/StorePage.tsx b/admin/src/pages/StorePage.tsx index 1c85dda..22c87f2 100644 --- a/admin/src/pages/StorePage.tsx +++ b/admin/src/pages/StorePage.tsx @@ -44,11 +44,13 @@ export function StorePage() { return ( <> -
-
- ← Magasins + ← Magasins +
+
+ +
-

{store.name}

+

{store.name}

{store.subscription?.stripeSubscriptionId && store.subscription.status !== 'CANCELED' && ( @@ -57,8 +59,15 @@ export function StorePage() { )}

- {store.city} · {store.counts.cards} clients · {store.counts.staff} employés + {store.city} · {store.counts.cards} clients · {store.counts.staff} employés · {store.contactName}

+ {/* Étapes d'ouverture : le magasin s'ouvre seul quand les deux premières sont faites */} +
    +
  • {store.subscription?.status === 'ACTIVE' ? '✓' : '○'} Abonnement payé
  • +
  • {store.hasCard ? '✓' : '○'} Carte conçue
  • +
  • {store.status === 'ACTIVE' ? '✓' : '○'} Programme ouvert
  • +
+
{(store.status === 'DRAFT' || store.status === 'CLOSED') && ( @@ -76,7 +85,12 @@ export function StorePage() { )}
-
+
+ Lien d’inscription : + {store.enrollUrl} + +
+ {store.status === 'SUSPENDED' && (
diff --git a/admin/src/pages/StoresPage.tsx b/admin/src/pages/StoresPage.tsx index 204ece6..2d92c3e 100644 --- a/admin/src/pages/StoresPage.tsx +++ b/admin/src/pages/StoresPage.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; +import { Link, useNavigate } from 'react-router-dom'; import { api, PLAN_LABEL, StoreListItem, StoreStatus } from '../api'; import { STATUS_LABEL, StatusBadge } from '../components/Layout'; @@ -23,6 +23,7 @@ function subscriptionLabel(s: StoreListItem['subscriptionStatus']) { } export function StoresPage() { + const navigate = useNavigate(); const [q, setQ] = useState(''); const [status, setStatus] = useState('ALL'); const [data, setData] = useState<{ items: StoreListItem[]; counts: Partial> } | null>(null); @@ -44,19 +45,27 @@ export function StoresPage() { const total = data ? Object.values(data.counts).reduce((a, b) => a + (b ?? 0), 0) : 0; const unpaid = data?.items.filter((s) => s.subscriptionStatus === 'PAST_DUE').length ?? 0; + const customers = data?.items.reduce((n, s) => n + s.customers, 0) ?? 0; + const pending = data?.counts.DRAFT ?? 0; return ( <>

Magasins

-

- {total} magasins inscrits · {unpaid} abonnements impayés -

+

{total} magasins inscrits

+ Nouveau magasin
+ {/* Chiffres clés (liste affichée) */} +
+
{data?.counts.ACTIVE ?? '—'}magasins ouverts
+
{data ? pending : '—'}en cours d’ouverture
+
{data ? unpaid : '—'}abonnements impayés
+
{data ? customers.toLocaleString('fr-FR') : '—'}cartes clients
+
+
@@ -89,7 +98,7 @@ export function StoresPage() { {data?.items.map((s) => ( - + navigate(`/magasins/${s.id}`)}> diff --git a/admin/src/styles.css b/admin/src/styles.css index 6c43dce..6779908 100644 --- a/admin/src/styles.css +++ b/admin/src/styles.css @@ -233,3 +233,22 @@ dialog::backdrop { background: rgb(0 0 0 / 0.45); } .s-side { position: static; } } @media (max-width: 520px) { .s-two { grid-template-columns: 1fr; } } + +/* ── Back-office : chiffres clés, lignes cliquables, en-tête de fiche ── */ +.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; } +.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; } +.kpi b { font-size: 28px; font-weight: 800; line-height: 1.2; } +.kpi span { font-size: 14px; color: var(--text-3); } +.kpi.ok b { color: var(--ok); } +.kpi.warn b { color: var(--warn); } +.kpi.err b { color: var(--err); } +tr.clickable { cursor: pointer; } +tr.clickable:hover td { background: var(--primary-soft); } +.store-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; } +.store-id { display: flex; gap: 16px; align-items: center; } +.store-avatar { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 22px; display: grid; place-items: center; flex: none; } +.open-steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; } +.open-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: 14px; font-weight: 600; } +.open-steps li.done { background: var(--ok-bg); color: var(--ok); } +.copy-line { display: flex; gap: 8px; align-items: center; font-size: 14px; } +.copy-line code { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; word-break: break-all; } diff --git a/backend/src/stores/stores.service.ts b/backend/src/stores/stores.service.ts index 626ecb4..31ffbd6 100644 --- a/backend/src/stores/stores.service.ts +++ b/backend/src/stores/stores.service.ts @@ -49,13 +49,15 @@ export class StoresService { where: { id }, include: { subscription: true, + cardDesign: { select: { id: true } }, _count: { select: { cards: true, staff: true, transactions: true } }, }, }); if (!store) throw new NotFoundException('Magasin introuvable'); - const { _count, subscription, ...s } = store; + const { _count, subscription, cardDesign, ...s } = store; return { ...this.present(s), + hasCard: !!cardDesign, counts: _count, subscription, enrollUrl: `${this.config.get('webUrl')}/c/${s.slug}`, diff --git a/site/assets/espace/index-BTYDwwaq.css b/site/assets/espace/index-Bj5p9Bgz.css similarity index 89% rename from site/assets/espace/index-BTYDwwaq.css rename to site/assets/espace/index-Bj5p9Bgz.css index 87db0f8..7300309 100644 --- a/site/assets/espace/index-BTYDwwaq.css +++ b/site/assets/espace/index-Bj5p9Bgz.css @@ -1 +1 @@ -:root{--primary: #0e7a66;--primary-hover: #0b6253;--primary-soft: #eaf6f2;--accent: #f2b544;--bg: #f6f6f3;--surface: #ffffff;--surface-2: #eeede8;--border: #dedcd6;--border-strong: #8a897f;--text: #1c1c19;--text-2: #45443e;--text-3: #5f5e56;--ok-bg: #e5f3e9;--ok: #1e7a3c;--warn-bg: #fcefd6;--warn: #8f5300;--err-bg: #fbe7e5;--err: #b8322a;--radius: 10px;color-scheme:light}@media (prefers-color-scheme: dark){:root{--primary: #3cb59c;--primary-hover: #5cc7b0;--primary-soft: #143a33;--bg: #141412;--surface: #1d1d1a;--surface-2: #272723;--border: #34342f;--border-strong: #6d6c63;--text: #f2f1ec;--text-2: #cfcec6;--text-3: #a5a49b;--ok-bg: #173523;--ok: #6fcf8f;--warn-bg: #3a2b10;--warn: #f2b544;--err-bg: #3d1a17;--err: #f08a80;color-scheme:dark}}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:400 16px/1.5 Figtree,system-ui,sans-serif}a{color:var(--primary)}a:hover{color:var(--primary-hover)}h1{margin:0;font-size:32px;line-height:40px;font-weight:700;letter-spacing:-.01em}h2{margin:0;font-size:20px;font-weight:700}.muted{color:var(--text-3)}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.shell{min-height:100vh;display:flex;flex-wrap:wrap}.sidebar{flex:1 1 240px;max-width:280px;background:var(--surface);border-right:1px solid var(--border);padding:24px 16px;display:flex;flex-direction:column;gap:28px}.sidebar nav{display:flex;flex-direction:column;gap:4px}.sidebar nav a{display:flex;align-items:center;gap:12px;height:44px;padding:0 12px;border-radius:var(--radius);color:var(--text-2);font-weight:500;text-decoration:none}.sidebar nav a.active{background:var(--primary-soft);color:var(--primary);font-weight:600}.sidebar .bottom{margin-top:auto;border-top:1px solid var(--surface-2);padding:16px 8px 0}.main{flex:999 1 560px;min-width:0;padding:32px 40px 48px}.container{max-width:1200px;margin:0 auto;display:flex;flex-direction:column;gap:24px}.row{display:flex;flex-wrap:wrap;gap:16px;align-items:center}.between{justify-content:space-between}@media (max-width: 720px){.sidebar{max-width:none;border-right:0;border-bottom:1px solid var(--border)}.main{padding:24px 16px}}.brand{display:flex;align-items:center;gap:10px;padding:0 8px}.brand{--brand-arch: #0e7a66}@media (prefers-color-scheme: dark){.brand{--brand-arch: #3dc3a2}}.brand-name{font-size:19px;font-weight:700;letter-spacing:-.03em}.brand-name b{font-weight:700;color:var(--brand-arch)}.card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:24px}.btn{height:48px;padding:0 20px;border-radius:var(--radius);border:1px solid transparent;cursor:pointer;font:600 16px Figtree,sans-serif;display:inline-flex;align-items:center;justify-content:center;gap:10px;text-decoration:none;background:var(--primary);color:#fff}.btn:hover:not(:disabled){background:var(--primary-hover);color:#fff}.btn:disabled{opacity:.55;cursor:not-allowed}.btn.secondary{background:var(--surface);color:var(--text);border-color:var(--border-strong)}.btn.secondary:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.btn.danger{background:var(--err)}.btn.small{height:36px;padding:0 14px;font-size:14px}.field{display:flex;flex-direction:column;gap:6px}.field label{font-size:15px;font-weight:600}.field .hint{font-size:14px;color:var(--text-3)}.field .error{font-size:14px;color:var(--err)}.input,select.input{height:48px;padding:0 14px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);color:var(--text);font:400 16px Figtree,sans-serif;width:100%}.input:focus{outline:2px solid var(--primary);outline-offset:1px}.grid-2{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px}.badge{display:inline-flex;align-items:center;gap:8px;height:28px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:600}.badge:before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}.badge.DRAFT{background:var(--surface-2);color:var(--text-2)}.badge.DRAFT:before{background:transparent;border:2px solid currentColor}.badge.ACTIVE{background:var(--ok-bg);color:var(--ok)}.badge.SUSPENDED{background:var(--warn-bg);color:var(--warn)}.badge.CLOSED{background:var(--err-bg);color:var(--err)}.chip{height:40px;padding:0 14px;border-radius:999px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);font:600 15px Figtree,sans-serif;cursor:pointer;display:inline-flex;align-items:center;gap:8px}.chip[aria-pressed=true]{background:var(--primary);border-color:var(--primary);color:#fff}.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:16px;overflow:hidden}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:15px}th{background:var(--surface-2);text-align:left;color:var(--text-2);font-size:13px;font-weight:600;padding:12px 16px}td{border-top:1px solid var(--surface-2);padding:12px 16px;height:64px}td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}.alert{padding:14px 18px;border-radius:12px;font-weight:500}.alert.error{background:var(--err-bg);color:var(--err)}.alert.warn{background:var(--warn-bg);color:var(--warn)}.alert.ok{background:var(--ok-bg);color:var(--ok)}.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);overflow-x:auto}.tabs a{padding:12px 16px;text-decoration:none;color:var(--text-2);font-weight:600;border-bottom:3px solid transparent;white-space:nowrap}.tabs a.active{color:var(--primary);border-bottom-color:var(--primary)}dialog{border:0;border-radius:16px;padding:0;max-width:520px;width:calc(100% - 32px);background:var(--surface);color:var(--text)}dialog::backdrop{background:#00000073}.dialog-body{padding:24px;display:flex;flex-direction:column;gap:20px}.password-box{font:600 22px ui-monospace,monospace;letter-spacing:.06em;background:var(--surface-2);border-radius:var(--radius);padding:14px;text-align:center;-webkit-user-select:all;user-select:all}.wizard{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:32px;align-items:start}@media (max-width: 1000px){.wizard{grid-template-columns:1fr}}.steps{display:flex;gap:8px;flex-wrap:wrap;list-style:none;margin:0;padding:0}.steps button{height:40px;padding:0 14px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);font:600 14px Figtree,sans-serif;cursor:pointer}.steps button[aria-current=step]{background:var(--primary);border-color:var(--primary);color:#fff}.preview-col{position:sticky;top:24px;display:flex;flex-direction:column;gap:16px;align-items:center}.color-row{display:flex;align-items:center;gap:12px}.color-row input[type=color]{width:48px;height:48px;border:1px solid var(--border-strong);border-radius:var(--radius);padding:2px;background:var(--surface)}.mode-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px}.mode-card{border:2px solid var(--border);border-radius:14px;padding:18px;cursor:pointer;display:flex;gap:12px}.mode-card:has(input:checked){border-color:var(--primary);background:var(--primary-soft)}.upload-drop{border:2px dashed var(--border-strong);border-radius:14px;padding:20px;display:flex;align-items:center;gap:16px}.upload-drop img{max-height:72px;max-width:200px;border-radius:6px}.link{background:none;border:0;padding:0;color:var(--primary);font:inherit;text-decoration:underline;cursor:pointer}.m-top{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:16px;padding:14px 24px;background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-bottom:1px solid var(--border)}.m-top .grow{flex:1}.m-avatar{width:38px;height:38px;border-radius:50%;background:var(--primary-soft);color:var(--primary);font-weight:800;display:grid;place-items:center}.m-hero{border-radius:24px;padding:28px;background:var(--primary);color:#fff;display:flex;flex-wrap:wrap;gap:20px;align-items:center;justify-content:space-between}.m-hero h1{color:#fff}.m-hero p{margin:4px 0 0;opacity:.85}.m-hero .btn{background:#fff;color:var(--primary);border-color:#fff}.m-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;list-style:none;margin:0;padding:0}.m-step{display:flex;gap:12px;align-items:flex-start;padding:16px;border-radius:16px;background:var(--surface);border:1px solid var(--border)}.m-step .dot{flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-weight:800;font-size:14px;background:var(--surface-2);color:var(--text-3)}.m-step.done .dot{background:var(--ok);color:#fff}.m-step.current{border:2px solid var(--primary)}.m-step.current .dot{background:var(--primary);color:#fff}.m-step strong{display:block}.m-step span{font-size:14px;color:var(--text-3)}.m-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}.m-tile{display:flex;flex-direction:column;gap:8px}.m-tile .ico{width:44px;height:44px;border-radius:12px;background:var(--primary-soft);display:grid;place-items:center;font-size:22px}.m-copy{display:flex;gap:8px;align-items:center;background:var(--surface-2);border-radius:10px;padding:8px 10px;font-size:14px;word-break:break-all}.m-copy code{flex:1;font:inherit}@media (max-width: 600px){.m-top{padding:12px 16px}.m-hero{padding:22px}}.s-page{min-height:100vh;padding:0 16px 48px}.s-head{max-width:1080px;margin:0 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;padding:18px 0}.s-layout{max-width:1080px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:24px;align-items:start}.s-main{display:flex;flex-direction:column;gap:20px}.s-section{display:flex;flex-direction:column;gap:16px}.s-title{display:flex;align-items:center;gap:12px}.s-num{width:30px;height:30px;border-radius:50%;background:var(--primary);color:#fff;font-weight:800;display:grid;place-items:center;font-size:15px}.s-seg{display:inline-flex;flex-wrap:wrap;max-width:100%;align-self:flex-start;padding:4px;border-radius:12px;background:var(--surface-2);gap:4px}.s-seg button{border:0;background:transparent;font:inherit;font-weight:700;font-size:15px;padding:8px 14px;border-radius:9px;color:var(--text-3);cursor:pointer}.s-seg button[aria-pressed=true]{background:var(--surface);color:var(--text);box-shadow:0 1px 3px #0000001a}.s-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}.s-plan{position:relative;display:flex;flex-direction:column;gap:4px;padding:18px 16px 16px;border:2px solid var(--border);border-radius:16px;cursor:pointer;background:var(--surface);transition:border-color .15s,background .15s}.s-plan:hover{border-color:var(--border-strong)}.s-plan.on{border-color:var(--primary);background:var(--primary-soft)}.s-plan:has(input:focus-visible){outline:3px solid var(--primary);outline-offset:2px}.s-plan strong{font-size:18px}.s-price{font-size:26px;font-weight:800}.s-price small{font-size:14px;font-weight:500;color:var(--text-3)}.s-tag{position:absolute;top:-11px;left:14px;background:var(--primary);color:#fff;font-size:12px;font-weight:700;padding:2px 10px;border-radius:999px}.s-two{display:grid;grid-template-columns:1fr 1fr;gap:16px}.s-side{position:sticky;top:24px}.s-summary{display:flex;flex-direction:column;gap:16px}.s-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:6px;font-size:14px}.s-list li:before{content:"✓";color:var(--primary);font-weight:800;margin-right:8px}.s-trust{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-3)}@media (max-width: 860px){.s-layout{grid-template-columns:minmax(0,1fr)}.s-side{position:static}}@media (max-width: 520px){.s-two{grid-template-columns:1fr}} +:root{--primary: #0e7a66;--primary-hover: #0b6253;--primary-soft: #eaf6f2;--accent: #f2b544;--bg: #f6f6f3;--surface: #ffffff;--surface-2: #eeede8;--border: #dedcd6;--border-strong: #8a897f;--text: #1c1c19;--text-2: #45443e;--text-3: #5f5e56;--ok-bg: #e5f3e9;--ok: #1e7a3c;--warn-bg: #fcefd6;--warn: #8f5300;--err-bg: #fbe7e5;--err: #b8322a;--radius: 10px;color-scheme:light}@media (prefers-color-scheme: dark){:root{--primary: #3cb59c;--primary-hover: #5cc7b0;--primary-soft: #143a33;--bg: #141412;--surface: #1d1d1a;--surface-2: #272723;--border: #34342f;--border-strong: #6d6c63;--text: #f2f1ec;--text-2: #cfcec6;--text-3: #a5a49b;--ok-bg: #173523;--ok: #6fcf8f;--warn-bg: #3a2b10;--warn: #f2b544;--err-bg: #3d1a17;--err: #f08a80;color-scheme:dark}}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:400 16px/1.5 Figtree,system-ui,sans-serif}a{color:var(--primary)}a:hover{color:var(--primary-hover)}h1{margin:0;font-size:32px;line-height:40px;font-weight:700;letter-spacing:-.01em}h2{margin:0;font-size:20px;font-weight:700}.muted{color:var(--text-3)}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.shell{min-height:100vh;display:flex;flex-wrap:wrap}.sidebar{flex:1 1 240px;max-width:280px;background:var(--surface);border-right:1px solid var(--border);padding:24px 16px;display:flex;flex-direction:column;gap:28px}.sidebar nav{display:flex;flex-direction:column;gap:4px}.sidebar nav a{display:flex;align-items:center;gap:12px;height:44px;padding:0 12px;border-radius:var(--radius);color:var(--text-2);font-weight:500;text-decoration:none}.sidebar nav a.active{background:var(--primary-soft);color:var(--primary);font-weight:600}.sidebar .bottom{margin-top:auto;border-top:1px solid var(--surface-2);padding:16px 8px 0}.main{flex:999 1 560px;min-width:0;padding:32px 40px 48px}.container{max-width:1200px;margin:0 auto;display:flex;flex-direction:column;gap:24px}.row{display:flex;flex-wrap:wrap;gap:16px;align-items:center}.between{justify-content:space-between}@media (max-width: 720px){.sidebar{max-width:none;border-right:0;border-bottom:1px solid var(--border)}.main{padding:24px 16px}}.brand{display:flex;align-items:center;gap:10px;padding:0 8px}.brand{--brand-arch: #0e7a66}@media (prefers-color-scheme: dark){.brand{--brand-arch: #3dc3a2}}.brand-name{font-size:19px;font-weight:700;letter-spacing:-.03em}.brand-name b{font-weight:700;color:var(--brand-arch)}.card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:24px}.btn{height:48px;padding:0 20px;border-radius:var(--radius);border:1px solid transparent;cursor:pointer;font:600 16px Figtree,sans-serif;display:inline-flex;align-items:center;justify-content:center;gap:10px;text-decoration:none;background:var(--primary);color:#fff}.btn:hover:not(:disabled){background:var(--primary-hover);color:#fff}.btn:disabled{opacity:.55;cursor:not-allowed}.btn.secondary{background:var(--surface);color:var(--text);border-color:var(--border-strong)}.btn.secondary:hover:not(:disabled){background:var(--surface-2);color:var(--text)}.btn.danger{background:var(--err)}.btn.small{height:36px;padding:0 14px;font-size:14px}.field{display:flex;flex-direction:column;gap:6px}.field label{font-size:15px;font-weight:600}.field .hint{font-size:14px;color:var(--text-3)}.field .error{font-size:14px;color:var(--err)}.input,select.input{height:48px;padding:0 14px;border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);color:var(--text);font:400 16px Figtree,sans-serif;width:100%}.input:focus{outline:2px solid var(--primary);outline-offset:1px}.grid-2{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px}.badge{display:inline-flex;align-items:center;gap:8px;height:28px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:600}.badge:before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}.badge.DRAFT{background:var(--surface-2);color:var(--text-2)}.badge.DRAFT:before{background:transparent;border:2px solid currentColor}.badge.ACTIVE{background:var(--ok-bg);color:var(--ok)}.badge.SUSPENDED{background:var(--warn-bg);color:var(--warn)}.badge.CLOSED{background:var(--err-bg);color:var(--err)}.chip{height:40px;padding:0 14px;border-radius:999px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);font:600 15px Figtree,sans-serif;cursor:pointer;display:inline-flex;align-items:center;gap:8px}.chip[aria-pressed=true]{background:var(--primary);border-color:var(--primary);color:#fff}.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:16px;overflow:hidden}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:15px}th{background:var(--surface-2);text-align:left;color:var(--text-2);font-size:13px;font-weight:600;padding:12px 16px}td{border-top:1px solid var(--surface-2);padding:12px 16px;height:64px}td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}.alert{padding:14px 18px;border-radius:12px;font-weight:500}.alert.error{background:var(--err-bg);color:var(--err)}.alert.warn{background:var(--warn-bg);color:var(--warn)}.alert.ok{background:var(--ok-bg);color:var(--ok)}.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);overflow-x:auto}.tabs a{padding:12px 16px;text-decoration:none;color:var(--text-2);font-weight:600;border-bottom:3px solid transparent;white-space:nowrap}.tabs a.active{color:var(--primary);border-bottom-color:var(--primary)}dialog{border:0;border-radius:16px;padding:0;max-width:520px;width:calc(100% - 32px);background:var(--surface);color:var(--text)}dialog::backdrop{background:#00000073}.dialog-body{padding:24px;display:flex;flex-direction:column;gap:20px}.password-box{font:600 22px ui-monospace,monospace;letter-spacing:.06em;background:var(--surface-2);border-radius:var(--radius);padding:14px;text-align:center;-webkit-user-select:all;user-select:all}.wizard{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:32px;align-items:start}@media (max-width: 1000px){.wizard{grid-template-columns:1fr}}.steps{display:flex;gap:8px;flex-wrap:wrap;list-style:none;margin:0;padding:0}.steps button{height:40px;padding:0 14px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);font:600 14px Figtree,sans-serif;cursor:pointer}.steps button[aria-current=step]{background:var(--primary);border-color:var(--primary);color:#fff}.preview-col{position:sticky;top:24px;display:flex;flex-direction:column;gap:16px;align-items:center}.color-row{display:flex;align-items:center;gap:12px}.color-row input[type=color]{width:48px;height:48px;border:1px solid var(--border-strong);border-radius:var(--radius);padding:2px;background:var(--surface)}.mode-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px}.mode-card{border:2px solid var(--border);border-radius:14px;padding:18px;cursor:pointer;display:flex;gap:12px}.mode-card:has(input:checked){border-color:var(--primary);background:var(--primary-soft)}.upload-drop{border:2px dashed var(--border-strong);border-radius:14px;padding:20px;display:flex;align-items:center;gap:16px}.upload-drop img{max-height:72px;max-width:200px;border-radius:6px}.link{background:none;border:0;padding:0;color:var(--primary);font:inherit;text-decoration:underline;cursor:pointer}.m-top{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:16px;padding:14px 24px;background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-bottom:1px solid var(--border)}.m-top .grow{flex:1}.m-avatar{width:38px;height:38px;border-radius:50%;background:var(--primary-soft);color:var(--primary);font-weight:800;display:grid;place-items:center}.m-hero{border-radius:24px;padding:28px;background:var(--primary);color:#fff;display:flex;flex-wrap:wrap;gap:20px;align-items:center;justify-content:space-between}.m-hero h1{color:#fff}.m-hero p{margin:4px 0 0;opacity:.85}.m-hero .btn{background:#fff;color:var(--primary);border-color:#fff}.m-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;list-style:none;margin:0;padding:0}.m-step{display:flex;gap:12px;align-items:flex-start;padding:16px;border-radius:16px;background:var(--surface);border:1px solid var(--border)}.m-step .dot{flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-weight:800;font-size:14px;background:var(--surface-2);color:var(--text-3)}.m-step.done .dot{background:var(--ok);color:#fff}.m-step.current{border:2px solid var(--primary)}.m-step.current .dot{background:var(--primary);color:#fff}.m-step strong{display:block}.m-step span{font-size:14px;color:var(--text-3)}.m-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}.m-tile{display:flex;flex-direction:column;gap:8px}.m-tile .ico{width:44px;height:44px;border-radius:12px;background:var(--primary-soft);display:grid;place-items:center;font-size:22px}.m-copy{display:flex;gap:8px;align-items:center;background:var(--surface-2);border-radius:10px;padding:8px 10px;font-size:14px;word-break:break-all}.m-copy code{flex:1;font:inherit}@media (max-width: 600px){.m-top{padding:12px 16px}.m-hero{padding:22px}}.s-page{min-height:100vh;padding:0 16px 48px}.s-head{max-width:1080px;margin:0 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;padding:18px 0}.s-layout{max-width:1080px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:24px;align-items:start}.s-main{display:flex;flex-direction:column;gap:20px}.s-section{display:flex;flex-direction:column;gap:16px}.s-title{display:flex;align-items:center;gap:12px}.s-num{width:30px;height:30px;border-radius:50%;background:var(--primary);color:#fff;font-weight:800;display:grid;place-items:center;font-size:15px}.s-seg{display:inline-flex;flex-wrap:wrap;max-width:100%;align-self:flex-start;padding:4px;border-radius:12px;background:var(--surface-2);gap:4px}.s-seg button{border:0;background:transparent;font:inherit;font-weight:700;font-size:15px;padding:8px 14px;border-radius:9px;color:var(--text-3);cursor:pointer}.s-seg button[aria-pressed=true]{background:var(--surface);color:var(--text);box-shadow:0 1px 3px #0000001a}.s-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}.s-plan{position:relative;display:flex;flex-direction:column;gap:4px;padding:18px 16px 16px;border:2px solid var(--border);border-radius:16px;cursor:pointer;background:var(--surface);transition:border-color .15s,background .15s}.s-plan:hover{border-color:var(--border-strong)}.s-plan.on{border-color:var(--primary);background:var(--primary-soft)}.s-plan:has(input:focus-visible){outline:3px solid var(--primary);outline-offset:2px}.s-plan strong{font-size:18px}.s-price{font-size:26px;font-weight:800}.s-price small{font-size:14px;font-weight:500;color:var(--text-3)}.s-tag{position:absolute;top:-11px;left:14px;background:var(--primary);color:#fff;font-size:12px;font-weight:700;padding:2px 10px;border-radius:999px}.s-two{display:grid;grid-template-columns:1fr 1fr;gap:16px}.s-side{position:sticky;top:24px}.s-summary{display:flex;flex-direction:column;gap:16px}.s-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:6px;font-size:14px}.s-list li:before{content:"✓";color:var(--primary);font-weight:800;margin-right:8px}.s-trust{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-3)}@media (max-width: 860px){.s-layout{grid-template-columns:minmax(0,1fr)}.s-side{position:static}}@media (max-width: 520px){.s-two{grid-template-columns:1fr}}.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.kpi{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:16px 18px;display:flex;flex-direction:column;gap:2px}.kpi b{font-size:28px;font-weight:800;line-height:1.2}.kpi span{font-size:14px;color:var(--text-3)}.kpi.ok b{color:var(--ok)}.kpi.warn b{color:var(--warn)}.kpi.err b{color:var(--err)}tr.clickable{cursor:pointer}tr.clickable:hover td{background:var(--primary-soft)}.store-head{display:flex;flex-wrap:wrap;gap:20px;align-items:center;justify-content:space-between}.store-id{display:flex;gap:16px;align-items:center}.store-avatar{width:56px;height:56px;border-radius:16px;background:var(--primary-soft);color:var(--primary);font-weight:800;font-size:22px;display:grid;place-items:center;flex:none}.open-steps{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0}.open-steps li{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;background:var(--surface-2);color:var(--text-3);font-size:14px;font-weight:600}.open-steps li.done{background:var(--ok-bg);color:var(--ok)}.copy-line{display:flex;gap:8px;align-items:center;font-size:14px}.copy-line code{background:var(--surface-2);border-radius:8px;padding:6px 10px;word-break:break-all} diff --git a/site/assets/espace/index-fxzUSxGt.js b/site/assets/espace/index-DOsOn4Cf.js similarity index 62% rename from site/assets/espace/index-fxzUSxGt.js rename to site/assets/espace/index-DOsOn4Cf.js index b5f531b..e7cd59a 100644 --- a/site/assets/espace/index-fxzUSxGt.js +++ b/site/assets/espace/index-DOsOn4Cf.js @@ -6,7 +6,7 @@ function Bf(e,t){for(var n=0;n>>1,X=R[W];if(0>>1;Wl(ws,A))Otl(Or,ws)?(R[W]=Or,R[Ot]=A,W=Ot):(R[W]=ws,R[Ut]=A,W=Ut);else if(Otl(Or,A))R[W]=Or,R[Ot]=A,W=Ot;else break e}}return M}function l(R,M){var A=R.sortIndex-M.sortIndex;return A!==0?A:R.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var u=[],c=[],d=1,h=null,g=3,x=!1,v=!1,j=!1,C=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(R){for(var M=n(c);M!==null;){if(M.callback===null)r(c);else if(M.startTime<=R)r(c),M.sortIndex=M.expirationTime,t(u,M);else break;M=n(c)}}function y(R){if(j=!1,m(R),!v)if(n(u)!==null)v=!0,Ve(N);else{var M=n(c);M!==null&&Xe(y,M.startTime-R)}}function N(R,M){v=!1,j&&(j=!1,p(P),P=-1),x=!0;var A=g;try{for(m(M),h=n(u);h!==null&&(!(h.expirationTime>M)||R&&!Y());){var W=h.callback;if(typeof W=="function"){h.callback=null,g=h.priorityLevel;var X=W(h.expirationTime<=M);M=e.unstable_now(),typeof X=="function"?h.callback=X:h===n(u)&&r(u),m(M)}else r(u);h=n(u)}if(h!==null)var nn=!0;else{var Ut=n(c);Ut!==null&&Xe(y,Ut.startTime-M),nn=!1}return nn}finally{h=null,g=A,x=!1}}var S=!1,E=null,P=-1,z=5,_=-1;function Y(){return!(e.unstable_now()-_R||125W?(R.sortIndex=A,t(c,R),n(u)===null&&R===n(c)&&(j?(p(P),P=-1):j=!0,Xe(y,A-W))):(R.sortIndex=X,t(u,R),v||x||(v=!0,Ve(N))),R},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(R){var M=g;return function(){var A=g;g=M;try{return R.apply(this,arguments)}finally{g=A}}}})(Zu);Xu.exports=Zu;var dp=Xu.exports;/** + */(function(e){function t(T,_){var M=T.length;T.push(_);e:for(;0>>1,X=T[V];if(0>>1;Vl(ws,M))Btl(Or,ws)?(T[V]=Or,T[Bt]=M,V=Bt):(T[V]=ws,T[Ot]=M,V=Ot);else if(Btl(Or,M))T[V]=Or,T[Bt]=M,V=Bt;else break e}}return _}function l(T,_){var M=T.sortIndex-_.sortIndex;return M!==0?M:T.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var u=[],c=[],p=1,h=null,m=3,y=!1,v=!1,j=!1,C=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(T){for(var _=n(c);_!==null;){if(_.callback===null)r(c);else if(_.startTime<=T)r(c),_.sortIndex=_.expirationTime,t(u,_);else break;_=n(c)}}function x(T){if(j=!1,g(T),!v)if(n(u)!==null)v=!0,We(N);else{var _=n(c);_!==null&&Xe(x,_.startTime-T)}}function N(T,_){v=!1,j&&(j=!1,f(P),P=-1),y=!0;var M=m;try{for(g(_),h=n(u);h!==null&&(!(h.expirationTime>_)||T&&!Y());){var V=h.callback;if(typeof V=="function"){h.callback=null,m=h.priorityLevel;var X=V(h.expirationTime<=_);_=e.unstable_now(),typeof X=="function"?h.callback=X:h===n(u)&&r(u),g(_)}else r(u);h=n(u)}if(h!==null)var nn=!0;else{var Ot=n(c);Ot!==null&&Xe(x,Ot.startTime-_),nn=!1}return nn}finally{h=null,m=M,y=!1}}var S=!1,E=null,P=-1,z=5,A=-1;function Y(){return!(e.unstable_now()-AT||125V?(T.sortIndex=M,t(c,T),n(u)===null&&T===n(c)&&(j?(f(P),P=-1):j=!0,Xe(x,M-V))):(T.sortIndex=X,t(u,T),v||y||(v=!0,We(N))),T},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(T){var _=m;return function(){var M=m;m=_;try{return T.apply(this,arguments)}finally{m=M}}}})(Zu);Xu.exports=Zu;var dp=Xu.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ function Bf(e,t){for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ni=Object.prototype.hasOwnProperty,pp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ma={},ga={};function hp(e){return ni.call(ga,e)?!0:ni.call(ma,e)?!1:pp.test(e)?ga[e]=!0:(ma[e]=!0,!1)}function mp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gp(e,t,n,r){if(t===null||typeof t>"u"||mp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function me(e,t,n,r,l,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oe[e]=new me(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oe[t]=new me(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){oe[e]=new me(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oe[e]=new me(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oe[e]=new me(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){oe[e]=new me(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){oe[e]=new me(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){oe[e]=new me(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){oe[e]=new me(e,5,!1,e.toLowerCase(),null,!1,!1)});var co=/[\-:]([a-z])/g;function fo(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){oe[e]=new me(e,1,!1,e.toLowerCase(),null,!1,!1)});oe.xlinkHref=new me("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){oe[e]=new me(e,1,!1,e.toLowerCase(),null,!0,!0)});function po(e,t,n,r){var l=oe.hasOwnProperty(t)?oe[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ni=Object.prototype.hasOwnProperty,pp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ma={},ga={};function hp(e){return ni.call(ga,e)?!0:ni.call(ma,e)?!1:pp.test(e)?ga[e]=!0:(ma[e]=!0,!1)}function mp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gp(e,t,n,r){if(t===null||typeof t>"u"||mp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function me(e,t,n,r,l,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oe[e]=new me(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oe[t]=new me(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){oe[e]=new me(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oe[e]=new me(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oe[e]=new me(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){oe[e]=new me(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){oe[e]=new me(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){oe[e]=new me(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){oe[e]=new me(e,5,!1,e.toLowerCase(),null,!1,!1)});var co=/[\-:]([a-z])/g;function fo(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(co,fo);oe[t]=new me(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){oe[e]=new me(e,1,!1,e.toLowerCase(),null,!1,!1)});oe.xlinkHref=new me("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){oe[e]=new me(e,1,!1,e.toLowerCase(),null,!0,!0)});function po(e,t,n,r){var l=oe.hasOwnProperty(t)?oe[t]:null;(l!==null?l.type!==0:r||!(2a||l[o]!==s[a]){var u=` -`+l[o].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{Ns=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qn(e):""}function vp(e){switch(e.tag){case 5:return qn(e.type);case 16:return qn("Lazy");case 13:return qn("Suspense");case 19:return qn("SuspenseList");case 0:case 2:case 15:return e=Cs(e.type,!1),e;case 11:return e=Cs(e.type.render,!1),e;case 1:return e=Cs(e.type,!0),e;default:return""}}function ii(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case on:return"Fragment";case sn:return"Portal";case ri:return"Profiler";case ho:return"StrictMode";case li:return"Suspense";case si:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case nc:return(e.displayName||"Context")+".Consumer";case tc:return(e._context.displayName||"Context")+".Provider";case mo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case go:return t=e.displayName||null,t!==null?t:ii(e.type)||"Memo";case ft:t=e._payload,e=e._init;try{return ii(e(t))}catch{}}return null}function yp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ii(t);case 8:return t===ho?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Lt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xp(e){var t=lc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function br(e){e._valueTracker||(e._valueTracker=xp(e))}function sc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=lc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function oi(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ya(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Lt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ic(e,t){t=t.checked,t!=null&&po(e,"checked",t,!1)}function ai(e,t){ic(e,t);var n=Lt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&ui(e,t.type,Lt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xa(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ui(e,t,n){(t!=="number"||xl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jn=Array.isArray;function yn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function dr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var er={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wp=["Webkit","ms","Moz","O"];Object.keys(er).forEach(function(e){wp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),er[t]=er[e]})});function cc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||er.hasOwnProperty(e)&&er[e]?(""+t).trim():t+"px"}function dc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=cc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var jp=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fi(e,t){if(t){if(jp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function pi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hi=null;function vo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mi=null,xn=null,wn=null;function Sa(e){if(e=zr(e)){if(typeof mi!="function")throw Error(k(280));var t=e.stateNode;t&&(t=es(t),mi(e.stateNode,e.type,t))}}function fc(e){xn?wn?wn.push(e):wn=[e]:xn=e}function pc(){if(xn){var e=xn,t=wn;if(wn=xn=null,Sa(e),t)for(e=0;e>>=0,e===0?32:31-(Mp(e)/Ap|0)|0}var Vr=64,Hr=4194304;function Xn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=Xn(a):(s&=o,s!==0&&(r=Xn(s)))}else o=n&~l,o!==0?r=Xn(o):s!==0&&(r=Xn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Mr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$e(t),e[t]=n}function Dp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=nr),_a=" ",Ma=!1;function Ac(e,t){switch(e){case"keyup":return dh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var an=!1;function ph(e,t){switch(e){case"compositionend":return zc(t);case"keypress":return t.which!==32?null:(Ma=!0,_a);case"textInput":return e=t.data,e===_a&&Ma?null:e;default:return null}}function hh(e,t){if(an)return e==="compositionend"||!Eo&&Ac(e,t)?(e=_c(),al=So=gt=null,an=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fa(n)}}function Uc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oc(){for(var e=window,t=xl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xl(e.document)}return t}function ko(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Nh(e){var t=Oc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Uc(n.ownerDocument.documentElement,n)){if(r!==null&&ko(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Da(n,s);var o=Da(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,un=null,ji=null,lr=null,Si=!1;function Ua(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Si||un==null||un!==xl(r)||(r=un,"selectionStart"in r&&ko(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),lr&&vr(lr,r)||(lr=r,r=kl(ji,"onSelect"),0fn||(e.current=Ri[fn],Ri[fn]=null,fn--)}function U(e,t){fn++,Ri[fn]=e.current,e.current=t}var _t={},de=zt(_t),ye=zt(!1),Yt=_t;function En(e,t){var n=e.type.contextTypes;if(!n)return _t;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function Rl(){B(ye),B(de)}function Ha(e,t,n){if(de.current!==_t)throw Error(k(168));U(de,t),U(ye,n)}function Yc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,yp(e)||"Unknown",l));return K({},n,r)}function Tl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,Yt=de.current,U(de,e),U(ye,ye.current),!0}function Qa(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=Yc(e,t,Yt),r.__reactInternalMemoizedMergedChildContext=e,B(ye),B(de),U(de,e)):B(ye),U(ye,n)}var et=null,ts=!1,Us=!1;function Gc(e){et===null?et=[e]:et.push(e)}function Ih(e){ts=!0,Gc(e)}function It(){if(!Us&&et!==null){Us=!0;var e=0,t=D;try{var n=et;for(D=1;e>=o,l-=o,tt=1<<32-$e(t)+l|n<P?(z=E,E=null):z=E.sibling;var _=g(p,E,m[P],y);if(_===null){E===null&&(E=z);break}e&&E&&_.alternate===null&&t(p,E),f=s(_,f,P),S===null?N=_:S.sibling=_,S=_,E=z}if(P===m.length)return n(p,E),b&&$t(p,P),N;if(E===null){for(;PP?(z=E,E=null):z=E.sibling;var Y=g(p,E,_.value,y);if(Y===null){E===null&&(E=z);break}e&&E&&Y.alternate===null&&t(p,E),f=s(Y,f,P),S===null?N=Y:S.sibling=Y,S=Y,E=z}if(_.done)return n(p,E),b&&$t(p,P),N;if(E===null){for(;!_.done;P++,_=m.next())_=h(p,_.value,y),_!==null&&(f=s(_,f,P),S===null?N=_:S.sibling=_,S=_);return b&&$t(p,P),N}for(E=r(p,E);!_.done;P++,_=m.next())_=x(E,p,P,_.value,y),_!==null&&(e&&_.alternate!==null&&E.delete(_.key===null?P:_.key),f=s(_,f,P),S===null?N=_:S.sibling=_,S=_);return e&&E.forEach(function(Te){return t(p,Te)}),b&&$t(p,P),N}function C(p,f,m,y){if(typeof m=="object"&&m!==null&&m.type===on&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case $r:e:{for(var N=m.key,S=f;S!==null;){if(S.key===N){if(N=m.type,N===on){if(S.tag===7){n(p,S.sibling),f=l(S,m.props.children),f.return=p,p=f;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ft&&Ga(N)===S.type){n(p,S.sibling),f=l(S,m.props),f.ref=Qn(p,S,m),f.return=p,p=f;break e}n(p,S);break}else t(p,S);S=S.sibling}m.type===on?(f=Kt(m.props.children,p.mode,y,m.key),f.return=p,p=f):(y=gl(m.type,m.key,m.props,null,p.mode,y),y.ref=Qn(p,f,m),y.return=p,p=y)}return o(p);case sn:e:{for(S=m.key;f!==null;){if(f.key===S)if(f.tag===4&&f.stateNode.containerInfo===m.containerInfo&&f.stateNode.implementation===m.implementation){n(p,f.sibling),f=l(f,m.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=Qs(m,p.mode,y),f.return=p,p=f}return o(p);case ft:return S=m._init,C(p,f,S(m._payload),y)}if(Jn(m))return v(p,f,m,y);if($n(m))return j(p,f,m,y);Xr(p,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,f!==null&&f.tag===6?(n(p,f.sibling),f=l(f,m),f.return=p,p=f):(n(p,f),f=Hs(m,p.mode,y),f.return=p,p=f),o(p)):n(p,f)}return C}var Pn=Zc(!0),ed=Zc(!1),Ml=zt(null),Al=null,mn=null,Lo=null;function _o(){Lo=mn=Al=null}function Mo(e){var t=Ml.current;B(Ml),e._currentValue=t}function _i(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sn(e,t){Al=e,Lo=mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ve=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(Lo!==e)if(e={context:e,memoizedValue:t,next:null},mn===null){if(Al===null)throw Error(k(308));mn=e,Al.dependencies={lanes:0,firstContext:e}}else mn=mn.next=e;return t}var Vt=null;function Ao(e){Vt===null?Vt=[e]:Vt.push(e)}function td(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ao(t)):(n.next=l.next,l.next=n),t.interleaved=n,ot(e,r)}function ot(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var pt=!1;function zo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ct(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ot(e,n)}return l=r.interleaved,l===null?(t.next=t,Ao(r)):(t.next=l.next,l.next=t),r.interleaved=t,ot(e,n)}function cl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xo(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function zl(e,t,n,r){var l=e.updateQueue;pt=!1;var s=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=u))}if(s!==null){var h=l.baseState;o=0,d=c=u=null,a=s;do{var g=a.lane,x=a.eventTime;if((r&g)===g){d!==null&&(d=d.next={eventTime:x,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,j=a;switch(g=t,x=n,j.tag){case 1:if(v=j.payload,typeof v=="function"){h=v.call(x,h,g);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=j.payload,g=typeof v=="function"?v.call(x,h,g):v,g==null)break e;h=K({},h,g);break e;case 2:pt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,g=l.effects,g===null?l.effects=[a]:g.push(a))}else x={eventTime:x,lane:g,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=x,u=h):d=d.next=x,o|=g;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;g=a,a=g.next,g.next=null,l.lastBaseUpdate=g,l.shared.pending=null}}while(!0);if(d===null&&(u=h),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=d,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Jt|=o,e.lanes=o,e.memoizedState=h}}function Ja(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Bs.transition;Bs.transition={};try{e(!1),t()}finally{D=n,Bs.transition=r}}function xd(){return Ie().memoizedState}function Oh(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wd(e))jd(t,n);else if(n=td(e,t,n,r),n!==null){var l=pe();be(n,e,r,l),Sd(n,t,r)}}function Bh(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wd(e))jd(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(l.hasEagerState=!0,l.eagerState=a,We(a,o)){var u=t.interleaved;u===null?(l.next=l,Ao(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=td(e,t,l,r),n!==null&&(l=pe(),be(n,e,r,l),Sd(n,t,r))}}function wd(e){var t=e.alternate;return e===H||t!==null&&t===H}function jd(e,t){sr=Fl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xo(e,n)}}var Dl={readContext:ze,useCallback:ae,useContext:ae,useEffect:ae,useImperativeHandle:ae,useInsertionEffect:ae,useLayoutEffect:ae,useMemo:ae,useReducer:ae,useRef:ae,useState:ae,useDebugValue:ae,useDeferredValue:ae,useTransition:ae,useMutableSource:ae,useSyncExternalStore:ae,useId:ae,unstable_isNewReconciler:!1},$h={readContext:ze,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Za,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,fl(4194308,4,hd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fl(4194308,4,e,t)},useInsertionEffect:function(e,t){return fl(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Oh.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Xa,useDebugValue:bo,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Xa(!1),t=e[0];return e=Uh.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(b){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),le===null)throw Error(k(349));qt&30||id(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Za(ad.bind(null,r,s,e),[e]),r.flags|=2048,Er(9,od.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Qe(),t=le.identifierPrefix;if(b){var n=nt,r=tt;n=(r&~(1<<32-$e(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Nr++,0")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{Ns=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qn(e):""}function vp(e){switch(e.tag){case 5:return qn(e.type);case 16:return qn("Lazy");case 13:return qn("Suspense");case 19:return qn("SuspenseList");case 0:case 2:case 15:return e=Cs(e.type,!1),e;case 11:return e=Cs(e.type.render,!1),e;case 1:return e=Cs(e.type,!0),e;default:return""}}function ii(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case on:return"Fragment";case sn:return"Portal";case ri:return"Profiler";case ho:return"StrictMode";case li:return"Suspense";case si:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case nc:return(e.displayName||"Context")+".Consumer";case tc:return(e._context.displayName||"Context")+".Provider";case mo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case go:return t=e.displayName||null,t!==null?t:ii(e.type)||"Memo";case ft:t=e._payload,e=e._init;try{return ii(e(t))}catch{}}return null}function yp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ii(t);case 8:return t===ho?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Lt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xp(e){var t=lc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function br(e){e._valueTracker||(e._valueTracker=xp(e))}function sc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=lc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function oi(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ya(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Lt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ic(e,t){t=t.checked,t!=null&&po(e,"checked",t,!1)}function ai(e,t){ic(e,t);var n=Lt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&ui(e,t.type,Lt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xa(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ui(e,t,n){(t!=="number"||xl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jn=Array.isArray;function yn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Vr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function dr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var er={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wp=["Webkit","ms","Moz","O"];Object.keys(er).forEach(function(e){wp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),er[t]=er[e]})});function cc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||er.hasOwnProperty(e)&&er[e]?(""+t).trim():t+"px"}function dc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=cc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var jp=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fi(e,t){if(t){if(jp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function pi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hi=null;function vo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mi=null,xn=null,wn=null;function Sa(e){if(e=zr(e)){if(typeof mi!="function")throw Error(k(280));var t=e.stateNode;t&&(t=es(t),mi(e.stateNode,e.type,t))}}function fc(e){xn?wn?wn.push(e):wn=[e]:xn=e}function pc(){if(xn){var e=xn,t=wn;if(wn=xn=null,Sa(e),t)for(e=0;e>>=0,e===0?32:31-(_p(e)/Mp|0)|0}var Wr=64,Hr=4194304;function Xn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=Xn(a):(s&=o,s!==0&&(r=Xn(s)))}else o=n&~l,o!==0?r=Xn(o):s!==0&&(r=Xn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function _r(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$e(t),e[t]=n}function Dp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=nr),Aa=" ",_a=!1;function Mc(e,t){switch(e){case"keyup":return dh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var an=!1;function ph(e,t){switch(e){case"compositionend":return zc(t);case"keypress":return t.which!==32?null:(_a=!0,Aa);case"textInput":return e=t.data,e===Aa&&_a?null:e;default:return null}}function hh(e,t){if(an)return e==="compositionend"||!Eo&&Mc(e,t)?(e=Ac(),al=So=gt=null,an=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fa(n)}}function Uc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oc(){for(var e=window,t=xl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xl(e.document)}return t}function ko(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Nh(e){var t=Oc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Uc(n.ownerDocument.documentElement,n)){if(r!==null&&ko(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Da(n,s);var o=Da(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,un=null,ji=null,lr=null,Si=!1;function Ua(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Si||un==null||un!==xl(r)||(r=un,"selectionStart"in r&&ko(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),lr&&vr(lr,r)||(lr=r,r=kl(ji,"onSelect"),0fn||(e.current=Ti[fn],Ti[fn]=null,fn--)}function U(e,t){fn++,Ti[fn]=e.current,e.current=t}var At={},de=zt(At),ye=zt(!1),Gt=At;function En(e,t){var n=e.type.contextTypes;if(!n)return At;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function Tl(){B(ye),B(de)}function Ha(e,t,n){if(de.current!==At)throw Error(k(168));U(de,t),U(ye,n)}function Yc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,yp(e)||"Unknown",l));return K({},n,r)}function Rl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||At,Gt=de.current,U(de,e),U(ye,ye.current),!0}function Qa(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=Yc(e,t,Gt),r.__reactInternalMemoizedMergedChildContext=e,B(ye),B(de),U(de,e)):B(ye),U(ye,n)}var et=null,ts=!1,Us=!1;function Gc(e){et===null?et=[e]:et.push(e)}function Ih(e){ts=!0,Gc(e)}function It(){if(!Us&&et!==null){Us=!0;var e=0,t=D;try{var n=et;for(D=1;e>=o,l-=o,tt=1<<32-$e(t)+l|n<P?(z=E,E=null):z=E.sibling;var A=m(f,E,g[P],x);if(A===null){E===null&&(E=z);break}e&&E&&A.alternate===null&&t(f,E),d=s(A,d,P),S===null?N=A:S.sibling=A,S=A,E=z}if(P===g.length)return n(f,E),b&&bt(f,P),N;if(E===null){for(;PP?(z=E,E=null):z=E.sibling;var Y=m(f,E,A.value,x);if(Y===null){E===null&&(E=z);break}e&&E&&Y.alternate===null&&t(f,E),d=s(Y,d,P),S===null?N=Y:S.sibling=Y,S=Y,E=z}if(A.done)return n(f,E),b&&bt(f,P),N;if(E===null){for(;!A.done;P++,A=g.next())A=h(f,A.value,x),A!==null&&(d=s(A,d,P),S===null?N=A:S.sibling=A,S=A);return b&&bt(f,P),N}for(E=r(f,E);!A.done;P++,A=g.next())A=y(E,f,P,A.value,x),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?P:A.key),d=s(A,d,P),S===null?N=A:S.sibling=A,S=A);return e&&E.forEach(function(Re){return t(f,Re)}),b&&bt(f,P),N}function C(f,d,g,x){if(typeof g=="object"&&g!==null&&g.type===on&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case $r:e:{for(var N=g.key,S=d;S!==null;){if(S.key===N){if(N=g.type,N===on){if(S.tag===7){n(f,S.sibling),d=l(S,g.props.children),d.return=f,f=d;break e}}else if(S.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ft&&Ga(N)===S.type){n(f,S.sibling),d=l(S,g.props),d.ref=Qn(f,S,g),d.return=f,f=d;break e}n(f,S);break}else t(f,S);S=S.sibling}g.type===on?(d=Yt(g.props.children,f.mode,x,g.key),d.return=f,f=d):(x=gl(g.type,g.key,g.props,null,f.mode,x),x.ref=Qn(f,d,g),x.return=f,f=x)}return o(f);case sn:e:{for(S=g.key;d!==null;){if(d.key===S)if(d.tag===4&&d.stateNode.containerInfo===g.containerInfo&&d.stateNode.implementation===g.implementation){n(f,d.sibling),d=l(d,g.children||[]),d.return=f,f=d;break e}else{n(f,d);break}else t(f,d);d=d.sibling}d=Qs(g,f.mode,x),d.return=f,f=d}return o(f);case ft:return S=g._init,C(f,d,S(g._payload),x)}if(Jn(g))return v(f,d,g,x);if($n(g))return j(f,d,g,x);Xr(f,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,d!==null&&d.tag===6?(n(f,d.sibling),d=l(d,g),d.return=f,f=d):(n(f,d),d=Hs(g,f.mode,x),d.return=f,f=d),o(f)):n(f,d)}return C}var Pn=Zc(!0),ed=Zc(!1),_l=zt(null),Ml=null,mn=null,Lo=null;function Ao(){Lo=mn=Ml=null}function _o(e){var t=_l.current;B(_l),e._currentValue=t}function Ai(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sn(e,t){Ml=e,Lo=mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ve=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(Lo!==e)if(e={context:e,memoizedValue:t,next:null},mn===null){if(Ml===null)throw Error(k(308));mn=e,Ml.dependencies={lanes:0,firstContext:e}}else mn=mn.next=e;return t}var Ht=null;function Mo(e){Ht===null?Ht=[e]:Ht.push(e)}function td(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Mo(t)):(n.next=l.next,l.next=n),t.interleaved=n,ot(e,r)}function ot(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var pt=!1;function zo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ct(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ot(e,n)}return l=r.interleaved,l===null?(t.next=t,Mo(r)):(t.next=l.next,l.next=t),r.interleaved=t,ot(e,n)}function cl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xo(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function zl(e,t,n,r){var l=e.updateQueue;pt=!1;var s=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==o&&(a===null?p.firstBaseUpdate=c:a.next=c,p.lastBaseUpdate=u))}if(s!==null){var h=l.baseState;o=0,p=c=u=null,a=s;do{var m=a.lane,y=a.eventTime;if((r&m)===m){p!==null&&(p=p.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,j=a;switch(m=t,y=n,j.tag){case 1:if(v=j.payload,typeof v=="function"){h=v.call(y,h,m);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=j.payload,m=typeof v=="function"?v.call(y,h,m):v,m==null)break e;h=K({},h,m);break e;case 2:pt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[a]:m.push(a))}else y={eventTime:y,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(c=p=y,u=h):p=p.next=y,o|=m;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;m=a,a=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(p===null&&(u=h),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Xt|=o,e.lanes=o,e.memoizedState=h}}function Ja(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Bs.transition;Bs.transition={};try{e(!1),t()}finally{D=n,Bs.transition=r}}function xd(){return Ie().memoizedState}function Oh(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wd(e))jd(t,n);else if(n=td(e,t,n,r),n!==null){var l=pe();be(n,e,r,l),Sd(n,t,r)}}function Bh(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wd(e))jd(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(l.hasEagerState=!0,l.eagerState=a,Ve(a,o)){var u=t.interleaved;u===null?(l.next=l,Mo(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=td(e,t,l,r),n!==null&&(l=pe(),be(n,e,r,l),Sd(n,t,r))}}function wd(e){var t=e.alternate;return e===H||t!==null&&t===H}function jd(e,t){sr=Fl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xo(e,n)}}var Dl={readContext:ze,useCallback:ae,useContext:ae,useEffect:ae,useImperativeHandle:ae,useInsertionEffect:ae,useLayoutEffect:ae,useMemo:ae,useReducer:ae,useRef:ae,useState:ae,useDebugValue:ae,useDeferredValue:ae,useTransition:ae,useMutableSource:ae,useSyncExternalStore:ae,useId:ae,unstable_isNewReconciler:!1},$h={readContext:ze,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Za,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,fl(4194308,4,hd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fl(4194308,4,e,t)},useInsertionEffect:function(e,t){return fl(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Oh.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Xa,useDebugValue:bo,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Xa(!1),t=e[0];return e=Uh.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(b){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),le===null)throw Error(k(349));Jt&30||id(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Za(ad.bind(null,r,s,e),[e]),r.flags|=2048,Er(9,od.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Qe(),t=le.identifierPrefix;if(b){var n=nt,r=tt;n=(r&~(1<<32-$e(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Nr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ke]=t,e[wr]=r,Md(e,t,!1,!1),t.stateNode=e;e:{switch(o=pi(n,r),n){case"dialog":O("cancel",e),O("close",e),l=r;break;case"iframe":case"object":case"embed":O("load",e),l=r;break;case"video":case"audio":for(l=0;lLn&&(t.flags|=128,r=!0,Kn(s,!1),t.lanes=4194304)}else{if(!r)if(e=Il(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Kn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!b)return ue(t),null}else 2*J()-s.renderingStartTime>Ln&&n!==1073741824&&(t.flags|=128,r=!0,Kn(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=J(),t.sibling=null,n=V.current,U(V,r?n&1|2:n&1),t):(ue(t),null);case 22:case 23:return Yo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Se&1073741824&&(ue(t),t.subtreeFlags&6&&(t.flags|=8192)):ue(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function Gh(e,t){switch(Ro(t),t.tag){case 1:return xe(t.type)&&Rl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Rn(),B(ye),B(de),Do(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fo(t),null;case 13:if(B(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(V),null;case 4:return Rn(),null;case 10:return Mo(t.type._context),null;case 22:case 23:return Yo(),null;case 24:return null;default:return null}}var el=!1,ce=!1,qh=typeof WeakSet=="function"?WeakSet:Set,T=null;function gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){q(e,t,r)}else n.current=null}function Bi(e,t,n){try{n()}catch(r){q(e,t,r)}}var cu=!1;function Jh(e,t){if(Ni=Cl,e=Oc(),ko(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,d=0,h=e,g=null;t:for(;;){for(var x;h!==n||l!==0&&h.nodeType!==3||(a=o+l),h!==s||r!==0&&h.nodeType!==3||(u=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(x=h.firstChild)!==null;)g=h,h=x;for(;;){if(h===e)break t;if(g===n&&++c===l&&(a=o),g===s&&++d===r&&(u=o),(x=h.nextSibling)!==null)break;h=g,g=h.parentNode}h=x}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ci={focusedElem:e,selectionRange:n},Cl=!1,T=t;T!==null;)if(t=T,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,T=e;else for(;T!==null;){t=T;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var j=v.memoizedProps,C=v.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?j:Ue(t.type,j),C);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(y){q(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,T=e;break}T=t.return}return v=cu,cu=!1,v}function ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&Bi(t,n,s)}l=l.next}while(l!==r)}}function ls(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $i(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Id(e){var t=e.alternate;t!==null&&(e.alternate=null,Id(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[wr],delete t[Pi],delete t[Ah],delete t[zh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fd(e){return e.tag===5||e.tag===3||e.tag===4}function du(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Pl));else if(r!==4&&(e=e.child,e!==null))for(bi(e,t,n),e=e.sibling;e!==null;)bi(e,t,n),e=e.sibling}function Wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Wi(e,t,n),e=e.sibling;e!==null;)Wi(e,t,n),e=e.sibling}var se=null,Oe=!1;function dt(e,t,n){for(n=n.child;n!==null;)Dd(e,t,n),n=n.sibling}function Dd(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(ql,n)}catch{}switch(n.tag){case 5:ce||gn(n,t);case 6:var r=se,l=Oe;se=null,dt(e,t,n),se=r,Oe=l,se!==null&&(Oe?(e=se,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):se.removeChild(n.stateNode));break;case 18:se!==null&&(Oe?(e=se,n=n.stateNode,e.nodeType===8?Ds(e.parentNode,n):e.nodeType===1&&Ds(e,n),mr(e)):Ds(se,n.stateNode));break;case 4:r=se,l=Oe,se=n.stateNode.containerInfo,Oe=!0,dt(e,t,n),se=r,Oe=l;break;case 0:case 11:case 14:case 15:if(!ce&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Bi(n,t,o),l=l.next}while(l!==r)}dt(e,t,n);break;case 1:if(!ce&&(gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){q(n,t,a)}dt(e,t,n);break;case 21:dt(e,t,n);break;case 22:n.mode&1?(ce=(r=ce)||n.memoizedState!==null,dt(e,t,n),ce=r):dt(e,t,n);break;default:dt(e,t,n)}}function fu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qh),t.forEach(function(r){var l=im.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function De(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~s}if(r=l,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Zh(r/1960))-r,10e?16:e,vt===null)var r=!1;else{if(e=vt,vt=null,Bl=0,F&6)throw Error(k(331));var l=F;for(F|=4,T=e.current;T!==null;){var s=T,o=s.child;if(T.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uJ()-Qo?Qt(e,0):Ho|=n),we(e,t)}function Hd(e,t){t===0&&(e.mode&1?(t=Hr,Hr<<=1,!(Hr&130023424)&&(Hr=4194304)):t=1);var n=pe();e=ot(e,t),e!==null&&(Mr(e,t,n),we(e,n))}function sm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hd(e,n)}function im(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),Hd(e,n)}var Qd;Qd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ve=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ve=!1,Kh(e,t,n);ve=!!(e.flags&131072)}else ve=!1,b&&t.flags&1048576&&qc(t,_l,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;pl(e,t),e=t.pendingProps;var l=En(t,de.current);Sn(t,n),l=Oo(null,t,r,e,l,n);var s=Bo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(s=!0,Tl(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,zo(t),l.updater=rs,t.stateNode=l,l._reactInternals=t,Ai(t,r,e,n),t=Fi(null,t,r,!0,s,n)):(t.tag=0,b&&s&&Po(t),fe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(pl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=am(r),e=Ue(r,e),l){case 0:t=Ii(null,t,r,e,n);break e;case 1:t=ou(null,t,r,e,n);break e;case 11:t=su(null,t,r,e,n);break e;case 14:t=iu(null,t,r,Ue(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),ou(e,t,r,l,n);case 3:e:{if(Td(t),e===null)throw Error(k(387));r=t.pendingProps,s=t.memoizedState,l=s.element,nd(e,t),zl(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=Tn(Error(k(423)),t),t=au(e,t,r,n,l);break e}else if(r!==l){l=Tn(Error(k(424)),t),t=au(e,t,r,n,l);break e}else for(Ne=Nt(t.stateNode.containerInfo.firstChild),Ce=t,b=!0,Be=null,n=ed(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kn(),r===l){t=at(e,t,n);break e}fe(e,t,r,n)}t=t.child}return t;case 5:return rd(t),e===null&&Li(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,o=l.children,Ei(r,l)?o=null:s!==null&&Ei(r,s)&&(t.flags|=32),Rd(e,t),fe(e,t,o,n),t.child;case 6:return e===null&&Li(t),null;case 13:return Ld(e,t,n);case 4:return Io(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pn(t,null,r,n):fe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),su(e,t,r,l,n);case 7:return fe(e,t,t.pendingProps,n),t.child;case 8:return fe(e,t,t.pendingProps.children,n),t.child;case 12:return fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,o=l.value,U(Ml,r._currentValue),r._currentValue=o,s!==null)if(We(s.value,o)){if(s.children===l.children&&!ye.current){t=at(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=lt(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?u.next=u:(u.next=d.next,d.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),_i(s.return,n,t),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(k(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),_i(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}fe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Sn(t,n),l=ze(l),r=r(l),t.flags|=1,fe(e,t,r,n),t.child;case 14:return r=t.type,l=Ue(r,t.pendingProps),l=Ue(r.type,l),iu(e,t,r,l,n);case 15:return kd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),pl(e,t),t.tag=1,xe(r)?(e=!0,Tl(t)):e=!1,Sn(t,n),Nd(t,r,l),Ai(t,r,l,n),Fi(null,t,r,!0,e,n);case 19:return _d(e,t,n);case 22:return Pd(e,t,n)}throw Error(k(156,t.tag))};function Kd(e,t){return wc(e,t)}function om(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Me(e,t,n,r){return new om(e,t,n,r)}function qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function am(e){if(typeof e=="function")return qo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mo)return 11;if(e===go)return 14}return 2}function Pt(e,t){var n=e.alternate;return n===null?(n=Me(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function gl(e,t,n,r,l,s){var o=2;if(r=e,typeof e=="function")qo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case on:return Kt(n.children,l,s,t);case ho:o=8,l|=8;break;case ri:return e=Me(12,n,t,l|2),e.elementType=ri,e.lanes=s,e;case li:return e=Me(13,n,t,l),e.elementType=li,e.lanes=s,e;case si:return e=Me(19,n,t,l),e.elementType=si,e.lanes=s,e;case rc:return is(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case tc:o=10;break e;case nc:o=9;break e;case mo:o=11;break e;case go:o=14;break e;case ft:o=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=Me(o,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Kt(e,t,n,r){return e=Me(7,e,r,t),e.lanes=n,e}function is(e,t,n,r){return e=Me(22,e,r,t),e.elementType=rc,e.lanes=n,e.stateNode={isHidden:!1},e}function Hs(e,t,n){return e=Me(6,e,null,t),e.lanes=n,e}function Qs(e,t,n){return t=Me(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function um(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ks(0),this.expirationTimes=ks(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ks(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Jo(e,t,n,r,l,s,o,a,u){return e=new um(e,t,n,a,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Me(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zo(s),e}function cm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Jd)}catch(e){console.error(e)}}Jd(),Ju.exports=ke;var mm=Ju.exports,Xd,wu=mm;Xd=wu.createRoot,wu.hydrateRoot;/** +`+s.stack}return{value:e,source:t,stack:l,digest:null}}function Vs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function zi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Wh=typeof WeakMap=="function"?WeakMap:Map;function Cd(e,t,n){n=lt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ol||(Ol=!0,Wi=r),zi(e,t)},n}function Ed(e,t,n){n=lt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){zi(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){zi(e,t),typeof r!="function"&&(Et===null?Et=new Set([this]):Et.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function nu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Wh;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=lm.bind(null,e,t,n),t.then(e,e))}function ru(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function lu(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lt(-1,1),t.tag=2,Ct(n,t,1))),n.lanes|=1),e)}var Hh=ut.ReactCurrentOwner,ve=!1;function fe(e,t,n,r){t.child=e===null?ed(t,null,n,r):Pn(t,e.child,n,r)}function su(e,t,n,r,l){n=n.render;var s=t.ref;return Sn(t,l),r=Oo(e,t,n,r,s,l),n=Bo(),e!==null&&!ve?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,at(e,t,l)):(b&&n&&Po(t),t.flags|=1,fe(e,t,r,l),t.child)}function iu(e,t,n,r,l){if(e===null){var s=n.type;return typeof s=="function"&&!qo(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,kd(e,t,s,r,l)):(e=gl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&l)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:vr,n(o,r)&&e.ref===t.ref)return at(e,t,l)}return t.flags|=1,e=Pt(s,r),e.ref=t.ref,e.return=t,t.child=e}function kd(e,t,n,r,l){if(e!==null){var s=e.memoizedProps;if(vr(s,r)&&e.ref===t.ref)if(ve=!1,t.pendingProps=r=s,(e.lanes&l)!==0)e.flags&131072&&(ve=!0);else return t.lanes=e.lanes,at(e,t,l)}return Ii(e,t,n,r,l)}function Pd(e,t,n){var r=t.pendingProps,l=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},U(vn,Se),Se|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,U(vn,Se),Se|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,U(vn,Se),Se|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,U(vn,Se),Se|=r;return fe(e,t,l,n),t.child}function Td(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ii(e,t,n,r,l){var s=xe(n)?Gt:de.current;return s=En(t,s),Sn(t,l),n=Oo(e,t,n,r,s,l),r=Bo(),e!==null&&!ve?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,at(e,t,l)):(b&&r&&Po(t),t.flags|=1,fe(e,t,n,l),t.child)}function ou(e,t,n,r,l){if(xe(n)){var s=!0;Rl(t)}else s=!1;if(Sn(t,l),t.stateNode===null)pl(e,t),Nd(t,n,r),Mi(t,n,r,l),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var u=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=ze(c):(c=xe(n)?Gt:de.current,c=En(t,c));var p=n.getDerivedStateFromProps,h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||u!==c)&&tu(t,o,r,c),pt=!1;var m=t.memoizedState;o.state=m,zl(t,r,o,l),u=t.memoizedState,a!==r||m!==u||ye.current||pt?(typeof p=="function"&&(_i(t,n,p,r),u=t.memoizedState),(a=pt||eu(t,n,a,r,m,u,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,nd(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Ue(t.type,a),o.props=c,h=t.pendingProps,m=o.context,u=n.contextType,typeof u=="object"&&u!==null?u=ze(u):(u=xe(n)?Gt:de.current,u=En(t,u));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||m!==u)&&tu(t,o,r,u),pt=!1,m=t.memoizedState,o.state=m,zl(t,r,o,l);var v=t.memoizedState;a!==h||m!==v||ye.current||pt?(typeof y=="function"&&(_i(t,n,y,r),v=t.memoizedState),(c=pt||eu(t,n,c,r,m,v,u)||!1)?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,v,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,v,u)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),o.props=r,o.state=v,o.context=u,r=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Fi(e,t,n,r,s,l)}function Fi(e,t,n,r,l,s){Td(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return l&&Qa(t,n,!1),at(e,t,s);r=t.stateNode,Hh.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Pn(t,e.child,null,s),t.child=Pn(t,null,a,s)):fe(e,t,a,s),t.memoizedState=r.state,l&&Qa(t,n,!0),t.child}function Rd(e){var t=e.stateNode;t.pendingContext?Ha(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ha(e,t.context,!1),Io(e,t.containerInfo)}function au(e,t,n,r,l){return kn(),Ro(l),t.flags|=256,fe(e,t,n,r),t.child}var Di={dehydrated:null,treeContext:null,retryLane:0};function Ui(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ld(e,t,n){var r=t.pendingProps,l=W.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(l&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),U(W,l&1),e===null)return Li(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=is(o,r,0,null),e=Yt(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Ui(n),t.memoizedState=Di,e):Vo(t,o));if(l=e.memoizedState,l!==null&&(a=l.dehydrated,a!==null))return Qh(e,t,o,r,a,l,n);if(s){s=r.fallback,o=t.mode,l=e.child,a=l.sibling;var u={mode:"hidden",children:r.children};return!(o&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Pt(l,u),r.subtreeFlags=l.subtreeFlags&14680064),a!==null?s=Pt(a,s):(s=Yt(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Ui(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Di,r}return s=e.child,e=s.sibling,r=Pt(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Vo(e,t){return t=is({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Zr(e,t,n,r){return r!==null&&Ro(r),Pn(t,e.child,null,n),e=Vo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qh(e,t,n,r,l,s,o){if(n)return t.flags&256?(t.flags&=-257,r=Vs(Error(k(422))),Zr(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,l=t.mode,r=is({mode:"visible",children:r.children},l,0,null),s=Yt(s,l,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Pn(t,e.child,null,o),t.child.memoizedState=Ui(o),t.memoizedState=Di,s);if(!(t.mode&1))return Zr(e,t,o,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(k(419)),r=Vs(s,r,void 0),Zr(e,t,o,r)}if(a=(o&e.childLanes)!==0,ve||a){if(r=le,r!==null){switch(o&-o){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|o)?0:l,l!==0&&l!==s.retryLane&&(s.retryLane=l,ot(e,l),be(r,e,l,-1))}return Go(),r=Vs(Error(k(421))),Zr(e,t,o,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=sm.bind(null,e),l._reactRetry=t,null):(e=s.treeContext,Ne=Nt(l.nextSibling),Ce=t,b=!0,Be=null,e!==null&&(Le[Ae++]=tt,Le[Ae++]=nt,Le[Ae++]=qt,tt=e.id,nt=e.overflow,qt=t),t=Vo(t,r.children),t.flags|=4096,t)}function uu(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ai(e.return,t,n)}function Ws(e,t,n,r,l){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=l)}function Ad(e,t,n){var r=t.pendingProps,l=r.revealOrder,s=r.tail;if(fe(e,t,r.children,n),r=W.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&uu(e,n,t);else if(e.tag===19)uu(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(U(W,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Il(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Ws(t,!1,l,n,s);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Il(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Ws(t,!0,n,null,s);break;case"together":Ws(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function pl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function at(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xt|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(k(153));if(t.child!==null){for(e=t.child,n=Pt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Kh(e,t,n){switch(t.tag){case 3:Rd(t),kn();break;case 5:rd(t);break;case 1:xe(t.type)&&Rl(t);break;case 4:Io(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;U(_l,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(U(W,W.current&1),t.flags|=128,null):n&t.child.childLanes?Ld(e,t,n):(U(W,W.current&1),e=at(e,t,n),e!==null?e.sibling:null);U(W,W.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ad(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),U(W,W.current),r)break;return null;case 22:case 23:return t.lanes=0,Pd(e,t,n)}return at(e,t,n)}var _d,Oi,Md,zd;_d=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Oi=function(){};Md=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Qt(Ge.current);var s=null;switch(n){case"input":l=oi(e,l),r=oi(e,r),s=[];break;case"select":l=K({},l,{value:void 0}),r=K({},r,{value:void 0}),s=[];break;case"textarea":l=ci(e,l),r=ci(e,r),s=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Pl)}fi(n,r);var o;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var a=l[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(cr.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var u=r[c];if(a=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&u!==a&&(u!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&a[o]!==u[o]&&(n||(n={}),n[o]=u[o])}else n||(s||(s=[]),s.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(s=s||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(cr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&O("scroll",e),s||a===u||(s=[])):(s=s||[]).push(c,u))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};zd=function(e,t,n,r){n!==r&&(t.flags|=4)};function Kn(e,t){if(!b)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ue(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Yh(e,t,n){var r=t.pendingProps;switch(To(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ue(t),null;case 1:return xe(t.type)&&Tl(),ue(t),null;case 3:return r=t.stateNode,Tn(),B(ye),B(de),Do(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Jr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Be!==null&&(Ki(Be),Be=null))),Oi(e,t),ue(t),null;case 5:Fo(t);var l=Qt(Sr.current);if(n=t.type,e!==null&&t.stateNode!=null)Md(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(k(166));return ue(t),null}if(e=Qt(Ge.current),Jr(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Ke]=t,r[wr]=s,e=(t.mode&1)!==0,n){case"dialog":O("cancel",r),O("close",r);break;case"iframe":case"object":case"embed":O("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ke]=t,e[wr]=r,_d(e,t,!1,!1),t.stateNode=e;e:{switch(o=pi(n,r),n){case"dialog":O("cancel",e),O("close",e),l=r;break;case"iframe":case"object":case"embed":O("load",e),l=r;break;case"video":case"audio":for(l=0;lLn&&(t.flags|=128,r=!0,Kn(s,!1),t.lanes=4194304)}else{if(!r)if(e=Il(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Kn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!b)return ue(t),null}else 2*J()-s.renderingStartTime>Ln&&n!==1073741824&&(t.flags|=128,r=!0,Kn(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=J(),t.sibling=null,n=W.current,U(W,r?n&1|2:n&1),t):(ue(t),null);case 22:case 23:return Yo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Se&1073741824&&(ue(t),t.subtreeFlags&6&&(t.flags|=8192)):ue(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function Gh(e,t){switch(To(t),t.tag){case 1:return xe(t.type)&&Tl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Tn(),B(ye),B(de),Do(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fo(t),null;case 13:if(B(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(W),null;case 4:return Tn(),null;case 10:return _o(t.type._context),null;case 22:case 23:return Yo(),null;case 24:return null;default:return null}}var el=!1,ce=!1,qh=typeof WeakSet=="function"?WeakSet:Set,R=null;function gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){q(e,t,r)}else n.current=null}function Bi(e,t,n){try{n()}catch(r){q(e,t,r)}}var cu=!1;function Jh(e,t){if(Ni=Cl,e=Oc(),ko(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,p=0,h=e,m=null;t:for(;;){for(var y;h!==n||l!==0&&h.nodeType!==3||(a=o+l),h!==s||r!==0&&h.nodeType!==3||(u=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(y=h.firstChild)!==null;)m=h,h=y;for(;;){if(h===e)break t;if(m===n&&++c===l&&(a=o),m===s&&++p===r&&(u=o),(y=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=y}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ci={focusedElem:e,selectionRange:n},Cl=!1,R=t;R!==null;)if(t=R,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,R=e;else for(;R!==null;){t=R;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var j=v.memoizedProps,C=v.memoizedState,f=t.stateNode,d=f.getSnapshotBeforeUpdate(t.elementType===t.type?j:Ue(t.type,j),C);f.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(x){q(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,R=e;break}R=t.return}return v=cu,cu=!1,v}function ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&Bi(t,n,s)}l=l.next}while(l!==r)}}function ls(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $i(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Id(e){var t=e.alternate;t!==null&&(e.alternate=null,Id(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[wr],delete t[Pi],delete t[Mh],delete t[zh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fd(e){return e.tag===5||e.tag===3||e.tag===4}function du(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Pl));else if(r!==4&&(e=e.child,e!==null))for(bi(e,t,n),e=e.sibling;e!==null;)bi(e,t,n),e=e.sibling}function Vi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}var se=null,Oe=!1;function dt(e,t,n){for(n=n.child;n!==null;)Dd(e,t,n),n=n.sibling}function Dd(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(ql,n)}catch{}switch(n.tag){case 5:ce||gn(n,t);case 6:var r=se,l=Oe;se=null,dt(e,t,n),se=r,Oe=l,se!==null&&(Oe?(e=se,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):se.removeChild(n.stateNode));break;case 18:se!==null&&(Oe?(e=se,n=n.stateNode,e.nodeType===8?Ds(e.parentNode,n):e.nodeType===1&&Ds(e,n),mr(e)):Ds(se,n.stateNode));break;case 4:r=se,l=Oe,se=n.stateNode.containerInfo,Oe=!0,dt(e,t,n),se=r,Oe=l;break;case 0:case 11:case 14:case 15:if(!ce&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Bi(n,t,o),l=l.next}while(l!==r)}dt(e,t,n);break;case 1:if(!ce&&(gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){q(n,t,a)}dt(e,t,n);break;case 21:dt(e,t,n);break;case 22:n.mode&1?(ce=(r=ce)||n.memoizedState!==null,dt(e,t,n),ce=r):dt(e,t,n);break;default:dt(e,t,n)}}function fu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qh),t.forEach(function(r){var l=im.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function De(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~s}if(r=l,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Zh(r/1960))-r,10e?16:e,vt===null)var r=!1;else{if(e=vt,vt=null,Bl=0,F&6)throw Error(k(331));var l=F;for(F|=4,R=e.current;R!==null;){var s=R,o=s.child;if(R.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uJ()-Qo?Kt(e,0):Ho|=n),we(e,t)}function Hd(e,t){t===0&&(e.mode&1?(t=Hr,Hr<<=1,!(Hr&130023424)&&(Hr=4194304)):t=1);var n=pe();e=ot(e,t),e!==null&&(_r(e,t,n),we(e,n))}function sm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hd(e,n)}function im(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),Hd(e,n)}var Qd;Qd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ve=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ve=!1,Kh(e,t,n);ve=!!(e.flags&131072)}else ve=!1,b&&t.flags&1048576&&qc(t,Al,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;pl(e,t),e=t.pendingProps;var l=En(t,de.current);Sn(t,n),l=Oo(null,t,r,e,l,n);var s=Bo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(s=!0,Rl(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,zo(t),l.updater=rs,t.stateNode=l,l._reactInternals=t,Mi(t,r,e,n),t=Fi(null,t,r,!0,s,n)):(t.tag=0,b&&s&&Po(t),fe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(pl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=am(r),e=Ue(r,e),l){case 0:t=Ii(null,t,r,e,n);break e;case 1:t=ou(null,t,r,e,n);break e;case 11:t=su(null,t,r,e,n);break e;case 14:t=iu(null,t,r,Ue(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),ou(e,t,r,l,n);case 3:e:{if(Rd(t),e===null)throw Error(k(387));r=t.pendingProps,s=t.memoizedState,l=s.element,nd(e,t),zl(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=Rn(Error(k(423)),t),t=au(e,t,r,n,l);break e}else if(r!==l){l=Rn(Error(k(424)),t),t=au(e,t,r,n,l);break e}else for(Ne=Nt(t.stateNode.containerInfo.firstChild),Ce=t,b=!0,Be=null,n=ed(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kn(),r===l){t=at(e,t,n);break e}fe(e,t,r,n)}t=t.child}return t;case 5:return rd(t),e===null&&Li(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,o=l.children,Ei(r,l)?o=null:s!==null&&Ei(r,s)&&(t.flags|=32),Td(e,t),fe(e,t,o,n),t.child;case 6:return e===null&&Li(t),null;case 13:return Ld(e,t,n);case 4:return Io(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pn(t,null,r,n):fe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),su(e,t,r,l,n);case 7:return fe(e,t,t.pendingProps,n),t.child;case 8:return fe(e,t,t.pendingProps.children,n),t.child;case 12:return fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,o=l.value,U(_l,r._currentValue),r._currentValue=o,s!==null)if(Ve(s.value,o)){if(s.children===l.children&&!ye.current){t=at(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=lt(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ai(s.return,n,t),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(k(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ai(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}fe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Sn(t,n),l=ze(l),r=r(l),t.flags|=1,fe(e,t,r,n),t.child;case 14:return r=t.type,l=Ue(r,t.pendingProps),l=Ue(r.type,l),iu(e,t,r,l,n);case 15:return kd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ue(r,l),pl(e,t),t.tag=1,xe(r)?(e=!0,Rl(t)):e=!1,Sn(t,n),Nd(t,r,l),Mi(t,r,l,n),Fi(null,t,r,!0,e,n);case 19:return Ad(e,t,n);case 22:return Pd(e,t,n)}throw Error(k(156,t.tag))};function Kd(e,t){return wc(e,t)}function om(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _e(e,t,n,r){return new om(e,t,n,r)}function qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function am(e){if(typeof e=="function")return qo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mo)return 11;if(e===go)return 14}return 2}function Pt(e,t){var n=e.alternate;return n===null?(n=_e(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function gl(e,t,n,r,l,s){var o=2;if(r=e,typeof e=="function")qo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case on:return Yt(n.children,l,s,t);case ho:o=8,l|=8;break;case ri:return e=_e(12,n,t,l|2),e.elementType=ri,e.lanes=s,e;case li:return e=_e(13,n,t,l),e.elementType=li,e.lanes=s,e;case si:return e=_e(19,n,t,l),e.elementType=si,e.lanes=s,e;case rc:return is(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case tc:o=10;break e;case nc:o=9;break e;case mo:o=11;break e;case go:o=14;break e;case ft:o=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=_e(o,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Yt(e,t,n,r){return e=_e(7,e,r,t),e.lanes=n,e}function is(e,t,n,r){return e=_e(22,e,r,t),e.elementType=rc,e.lanes=n,e.stateNode={isHidden:!1},e}function Hs(e,t,n){return e=_e(6,e,null,t),e.lanes=n,e}function Qs(e,t,n){return t=_e(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function um(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ks(0),this.expirationTimes=ks(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ks(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Jo(e,t,n,r,l,s,o,a,u){return e=new um(e,t,n,a,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=_e(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zo(s),e}function cm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Jd)}catch(e){console.error(e)}}Jd(),Ju.exports=ke;var mm=Ju.exports,Xd,wu=mm;Xd=wu.createRoot,wu.hydrateRoot;/** * @remix-run/router v1.23.4 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Zd(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vm(){return Math.random().toString(36).substr(2,8)}function Su(e,t){return{usr:e.state,key:e.key,idx:t}}function Yi(e,t,n,r){return n===void 0&&(n=null),Pr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?On(t):t,{state:n,key:t&&t.key||r||vm()})}function Wl(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function On(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ym(e,t,n,r){r===void 0&&(r={});let{window:l=document.defaultView,v5Compat:s=!1}=r,o=l.history,a=yt.Pop,u=null,c=d();c==null&&(c=0,o.replaceState(Pr({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function h(){a=yt.Pop;let C=d(),p=C==null?null:C-c;c=C,u&&u({action:a,location:j.location,delta:p})}function g(C,p){a=yt.Push;let f=Yi(j.location,C,p);c=d()+1;let m=Su(f,c),y=j.createHref(f);try{o.pushState(m,"",y)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;l.location.assign(y)}s&&u&&u({action:a,location:j.location,delta:1})}function x(C,p){a=yt.Replace;let f=Yi(j.location,C,p);c=d();let m=Su(f,c),y=j.createHref(f);o.replaceState(m,"",y),s&&u&&u({action:a,location:j.location,delta:0})}function v(C){let p=l.location.origin!=="null"?l.location.origin:l.location.href,f=typeof C=="string"?C:Wl(C);return f=f.replace(/ $/,"%20"),Q(p,"No window.location.(origin|href) available to create URL for href: "+f),new URL(f,p)}let j={get action(){return a},get location(){return e(l,o)},listen(C){if(u)throw new Error("A history only accepts one active listener");return l.addEventListener(ju,h),u=C,()=>{l.removeEventListener(ju,h),u=null}},createHref(C){return t(l,C)},createURL:v,encodeLocation(C){let p=v(C);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:g,replace:x,go(C){return o.go(C)}};return j}var Nu;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Nu||(Nu={}));function xm(e,t,n){return n===void 0&&(n="/"),wm(e,t,n)}function wm(e,t,n,r){let l=typeof t=="string"?On(t):t,s=_n(l.pathname||"/",n);if(s==null)return null;let o=ef(e);jm(o);let a=null,u=Mm(s);for(let c=0;a==null&&c{let u={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};u.relativePath.startsWith("/")&&(Q(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let c=Rt([r,u.relativePath]),d=n.concat(u);s.children&&s.children.length>0&&(Q(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),ef(s.children,t,d,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:Rm(c,s.index),routesMeta:d})};return e.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))l(s,o);else for(let u of tf(s.path))l(s,o,u)}),t}function tf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return l?[s,""]:[s];let o=tf(r.join("/")),a=[];return a.push(...o.map(u=>u===""?s:[s,u].join("/"))),l&&a.push(...o),a.map(u=>e.startsWith("/")&&u===""?"/":u)}function jm(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Tm(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Sm=/^:[\w-]+$/,Nm=3,Cm=2,Em=1,km=10,Pm=-2,Cu=e=>e==="*";function Rm(e,t){let n=e.split("/"),r=n.length;return n.some(Cu)&&(r+=Pm),t&&(r+=Cm),n.filter(l=>!Cu(l)).reduce((l,s)=>l+(Sm.test(s)?Nm:s===""?Em:km),r)}function Tm(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function Lm(e,t,n){let{routesMeta:r}=e,l={},s="/",o=[];for(let a=0;a{let{paramName:g,isOptional:x}=d;if(g==="*"){let j=a[h]||"";o=s.slice(0,s.length-j.length).replace(/(.)\/+$/,"$1")}const v=a[h];return x&&!v?c[g]=void 0:c[g]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function _m(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Zd(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,u)=>(r.push({paramName:a,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Mm(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zd(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function _n(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Am(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?On(e):e,s;return n?(n=nf(n),n.startsWith("/")?s=Eu(n.substring(1),"/"):s=Eu(n,t)):s=t,{pathname:s,search:Fm(r),hash:Dm(l)}}function Eu(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Ks(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function zm(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ta(e,t){let n=zm(e);return t?n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function na(e,t,n,r){r===void 0&&(r=!1);let l;typeof e=="string"?l=On(e):(l=Pr({},e),Q(!l.pathname||!l.pathname.includes("?"),Ks("?","pathname","search",l)),Q(!l.pathname||!l.pathname.includes("#"),Ks("#","pathname","hash",l)),Q(!l.search||!l.search.includes("#"),Ks("#","search","hash",l)));let s=e===""||l.pathname==="",o=s?"/":l.pathname,a;if(o==null)a=n;else{let h=t.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),h-=1;l.pathname=g.join("/")}a=h>=0?t[h]:"/"}let u=Am(l,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||d)&&(u.pathname+="/"),u}const nf=e=>e.replace(/\/\/+/g,"/"),Rt=e=>nf(e.join("/")),Im=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Fm=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Dm=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Um(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const rf=["post","put","patch","delete"];new Set(rf);const Om=["get",...rf];new Set(Om);/** + */function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Zd(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vm(){return Math.random().toString(36).substr(2,8)}function Su(e,t){return{usr:e.state,key:e.key,idx:t}}function Yi(e,t,n,r){return n===void 0&&(n=null),Pr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?On(t):t,{state:n,key:t&&t.key||r||vm()})}function Vl(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function On(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ym(e,t,n,r){r===void 0&&(r={});let{window:l=document.defaultView,v5Compat:s=!1}=r,o=l.history,a=yt.Pop,u=null,c=p();c==null&&(c=0,o.replaceState(Pr({},o.state,{idx:c}),""));function p(){return(o.state||{idx:null}).idx}function h(){a=yt.Pop;let C=p(),f=C==null?null:C-c;c=C,u&&u({action:a,location:j.location,delta:f})}function m(C,f){a=yt.Push;let d=Yi(j.location,C,f);c=p()+1;let g=Su(d,c),x=j.createHref(d);try{o.pushState(g,"",x)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;l.location.assign(x)}s&&u&&u({action:a,location:j.location,delta:1})}function y(C,f){a=yt.Replace;let d=Yi(j.location,C,f);c=p();let g=Su(d,c),x=j.createHref(d);o.replaceState(g,"",x),s&&u&&u({action:a,location:j.location,delta:0})}function v(C){let f=l.location.origin!=="null"?l.location.origin:l.location.href,d=typeof C=="string"?C:Vl(C);return d=d.replace(/ $/,"%20"),Q(f,"No window.location.(origin|href) available to create URL for href: "+d),new URL(d,f)}let j={get action(){return a},get location(){return e(l,o)},listen(C){if(u)throw new Error("A history only accepts one active listener");return l.addEventListener(ju,h),u=C,()=>{l.removeEventListener(ju,h),u=null}},createHref(C){return t(l,C)},createURL:v,encodeLocation(C){let f=v(C);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:m,replace:y,go(C){return o.go(C)}};return j}var Nu;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Nu||(Nu={}));function xm(e,t,n){return n===void 0&&(n="/"),wm(e,t,n)}function wm(e,t,n,r){let l=typeof t=="string"?On(t):t,s=An(l.pathname||"/",n);if(s==null)return null;let o=ef(e);jm(o);let a=null,u=_m(s);for(let c=0;a==null&&c{let u={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};u.relativePath.startsWith("/")&&(Q(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let c=Tt([r,u.relativePath]),p=n.concat(u);s.children&&s.children.length>0&&(Q(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),ef(s.children,t,p,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:Tm(c,s.index),routesMeta:p})};return e.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))l(s,o);else for(let u of tf(s.path))l(s,o,u)}),t}function tf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return l?[s,""]:[s];let o=tf(r.join("/")),a=[];return a.push(...o.map(u=>u===""?s:[s,u].join("/"))),l&&a.push(...o),a.map(u=>e.startsWith("/")&&u===""?"/":u)}function jm(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Rm(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Sm=/^:[\w-]+$/,Nm=3,Cm=2,Em=1,km=10,Pm=-2,Cu=e=>e==="*";function Tm(e,t){let n=e.split("/"),r=n.length;return n.some(Cu)&&(r+=Pm),t&&(r+=Cm),n.filter(l=>!Cu(l)).reduce((l,s)=>l+(Sm.test(s)?Nm:s===""?Em:km),r)}function Rm(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function Lm(e,t,n){let{routesMeta:r}=e,l={},s="/",o=[];for(let a=0;a{let{paramName:m,isOptional:y}=p;if(m==="*"){let j=a[h]||"";o=s.slice(0,s.length-j.length).replace(/(.)\/+$/,"$1")}const v=a[h];return y&&!v?c[m]=void 0:c[m]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function Am(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Zd(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,u)=>(r.push({paramName:a,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function _m(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zd(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function An(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Mm(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?On(e):e,s;return n?(n=nf(n),n.startsWith("/")?s=Eu(n.substring(1),"/"):s=Eu(n,t)):s=t,{pathname:s,search:Fm(r),hash:Dm(l)}}function Eu(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Ks(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function zm(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ta(e,t){let n=zm(e);return t?n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function na(e,t,n,r){r===void 0&&(r=!1);let l;typeof e=="string"?l=On(e):(l=Pr({},e),Q(!l.pathname||!l.pathname.includes("?"),Ks("?","pathname","search",l)),Q(!l.pathname||!l.pathname.includes("#"),Ks("#","pathname","hash",l)),Q(!l.search||!l.search.includes("#"),Ks("#","search","hash",l)));let s=e===""||l.pathname==="",o=s?"/":l.pathname,a;if(o==null)a=n;else{let h=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;l.pathname=m.join("/")}a=h>=0?t[h]:"/"}let u=Mm(l,a),c=o&&o!=="/"&&o.endsWith("/"),p=(s||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||p)&&(u.pathname+="/"),u}const nf=e=>e.replace(/\/\/+/g,"/"),Tt=e=>nf(e.join("/")),Im=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Fm=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Dm=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Um(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const rf=["post","put","patch","delete"];new Set(rf);const Om=["get",...rf];new Set(Om);/** * React Router v6.30.6 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Rr(){return Rr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),w.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let h=na(c,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Rt([t,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[t,r,o,s,e])}const bm=w.createContext(null);function Wm(e){let t=w.useContext(qe).outlet;return t&&w.createElement(bm.Provider,{value:e},t)}function af(){let{matches:e}=w.useContext(qe),t=e[e.length-1];return t?t.params:{}}function ps(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=w.useContext(ct),{matches:l}=w.useContext(qe),{pathname:s}=Ft(),o=JSON.stringify(ta(l,r.v7_relativeSplatPath));return w.useMemo(()=>na(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function Vm(e,t){return Hm(e,t)}function Hm(e,t,n,r){Bn()||Q(!1);let{navigator:l}=w.useContext(ct),{matches:s}=w.useContext(qe),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let c=Ft(),d;if(t){var h;let C=typeof t=="string"?On(t):t;u==="/"||(h=C.pathname)!=null&&h.startsWith(u)||Q(!1),d=C}else d=c;let g=d.pathname||"/",x=g;if(u!=="/"){let C=u.replace(/^\//,"").split("/");x="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let v=xm(e,{pathname:x}),j=qm(v&&v.map(C=>Object.assign({},C,{params:Object.assign({},a,C.params),pathname:Rt([u,l.encodeLocation?l.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?u:Rt([u,l.encodeLocation?l.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),s,n,r);return t&&j?w.createElement(fs.Provider,{value:{location:Rr({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:yt.Pop}},j):j}function Qm(){let e=eg(),t=Um(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:l},n):null,null)}const Km=w.createElement(Qm,null);class Ym extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?w.createElement(qe.Provider,{value:this.props.routeContext},w.createElement(sf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gm(e){let{routeContext:t,match:n,children:r}=e,l=w.useContext(ds);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(qe.Provider,{value:t},r)}function qm(e,t,n,r){var l;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(l=n)==null?void 0:l.errors;if(a!=null){let d=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||Q(!1),o=o.slice(0,Math.min(o.length,d+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,h,g)=>{let x,v=!1,j=null,C=null;n&&(x=a&&h.route.id?a[h.route.id]:void 0,j=h.route.errorElement||Km,u&&(c<0&&g===0?(ng("route-fallback"),v=!0,C=null):c===g&&(v=!0,C=h.route.hydrateFallbackElement||null)));let p=t.concat(o.slice(0,g+1)),f=()=>{let m;return x?m=j:v?m=C:h.route.Component?m=w.createElement(h.route.Component,null):h.route.element?m=h.route.element:m=d,w.createElement(Gm,{match:h,routeContext:{outlet:d,matches:p,isDataRoute:n!=null},children:m})};return n&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?w.createElement(Ym,{location:n.location,revalidation:n.revalidation,component:j,error:x,children:f(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):f()},null)}var uf=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(uf||{}),cf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(cf||{});function Jm(e){let t=w.useContext(ds);return t||Q(!1),t}function Xm(e){let t=w.useContext(lf);return t||Q(!1),t}function Zm(e){let t=w.useContext(qe);return t||Q(!1),t}function df(e){let t=Zm(),n=t.matches[t.matches.length-1];return n.route.id||Q(!1),n.route.id}function eg(){var e;let t=w.useContext(sf),n=Xm(),r=df();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function tg(){let{router:e}=Jm(uf.UseNavigateStable),t=df(cf.UseNavigateStable),n=w.useRef(!1);return of(()=>{n.current=!0}),w.useCallback(function(l,s){s===void 0&&(s={}),n.current&&(typeof l=="number"?e.navigate(l):e.navigate(l,Rr({fromRouteId:t},s)))},[e,t])}const ku={};function ng(e,t,n){ku[e]||(ku[e]=!0)}function rg(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function vl(e){let{to:t,replace:n,state:r,relative:l}=e;Bn()||Q(!1);let{future:s,static:o}=w.useContext(ct),{matches:a}=w.useContext(qe),{pathname:u}=Ft(),c=tn(),d=na(t,ta(a,s.v7_relativeSplatPath),u,l==="path"),h=JSON.stringify(d);return w.useEffect(()=>c(JSON.parse(h),{replace:n,state:r,relative:l}),[c,h,l,n,r]),null}function lg(e){return Wm(e.context)}function G(e){Q(!1)}function sg(e){let{basename:t="/",children:n=null,location:r,navigationType:l=yt.Pop,navigator:s,static:o=!1,future:a}=e;Bn()&&Q(!1);let u=t.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:u,navigator:s,static:o,future:Rr({v7_relativeSplatPath:!1},a)}),[u,a,s,o]);typeof r=="string"&&(r=On(r));let{pathname:d="/",search:h="",hash:g="",state:x=null,key:v="default"}=r,j=w.useMemo(()=>{let C=_n(d,u);return C==null?null:{location:{pathname:C,search:h,hash:g,state:x,key:v},navigationType:l}},[u,d,h,g,x,v,l]);return j==null?null:w.createElement(ct.Provider,{value:c},w.createElement(fs.Provider,{children:n,value:j}))}function qi(e){let{children:t,location:n}=e;return Vm(Ji(t),n)}new Promise(()=>{});function Ji(e,t){t===void 0&&(t=[]);let n=[];return w.Children.forEach(e,(r,l)=>{if(!w.isValidElement(r))return;let s=[...t,l];if(r.type===w.Fragment){n.push.apply(n,Ji(r.props.children,s));return}r.type!==G&&Q(!1),!r.props.index||!r.props.children||Q(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ji(r.props.children,s)),n.push(o)}),n}/** + */function Tr(){return Tr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),w.useCallback(function(c,p){if(p===void 0&&(p={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let h=na(c,JSON.parse(o),s,p.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Tt([t,h.pathname])),(p.replace?r.replace:r.push)(h,p.state,p)},[t,r,o,s,e])}const bm=w.createContext(null);function Vm(e){let t=w.useContext(qe).outlet;return t&&w.createElement(bm.Provider,{value:e},t)}function af(){let{matches:e}=w.useContext(qe),t=e[e.length-1];return t?t.params:{}}function ps(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=w.useContext(ct),{matches:l}=w.useContext(qe),{pathname:s}=Ft(),o=JSON.stringify(ta(l,r.v7_relativeSplatPath));return w.useMemo(()=>na(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function Wm(e,t){return Hm(e,t)}function Hm(e,t,n,r){Bn()||Q(!1);let{navigator:l}=w.useContext(ct),{matches:s}=w.useContext(qe),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let c=Ft(),p;if(t){var h;let C=typeof t=="string"?On(t):t;u==="/"||(h=C.pathname)!=null&&h.startsWith(u)||Q(!1),p=C}else p=c;let m=p.pathname||"/",y=m;if(u!=="/"){let C=u.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(C.length).join("/")}let v=xm(e,{pathname:y}),j=qm(v&&v.map(C=>Object.assign({},C,{params:Object.assign({},a,C.params),pathname:Tt([u,l.encodeLocation?l.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?u:Tt([u,l.encodeLocation?l.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),s,n,r);return t&&j?w.createElement(fs.Provider,{value:{location:Tr({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:yt.Pop}},j):j}function Qm(){let e=eg(),t=Um(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:l},n):null,null)}const Km=w.createElement(Qm,null);class Ym extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?w.createElement(qe.Provider,{value:this.props.routeContext},w.createElement(sf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gm(e){let{routeContext:t,match:n,children:r}=e,l=w.useContext(ds);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(qe.Provider,{value:t},r)}function qm(e,t,n,r){var l;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(l=n)==null?void 0:l.errors;if(a!=null){let p=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);p>=0||Q(!1),o=o.slice(0,Math.min(o.length,p+1))}let u=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let p=0;p=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((p,h,m)=>{let y,v=!1,j=null,C=null;n&&(y=a&&h.route.id?a[h.route.id]:void 0,j=h.route.errorElement||Km,u&&(c<0&&m===0?(ng("route-fallback"),v=!0,C=null):c===m&&(v=!0,C=h.route.hydrateFallbackElement||null)));let f=t.concat(o.slice(0,m+1)),d=()=>{let g;return y?g=j:v?g=C:h.route.Component?g=w.createElement(h.route.Component,null):h.route.element?g=h.route.element:g=p,w.createElement(Gm,{match:h,routeContext:{outlet:p,matches:f,isDataRoute:n!=null},children:g})};return n&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?w.createElement(Ym,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:d(),routeContext:{outlet:null,matches:f,isDataRoute:!0}}):d()},null)}var uf=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(uf||{}),cf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(cf||{});function Jm(e){let t=w.useContext(ds);return t||Q(!1),t}function Xm(e){let t=w.useContext(lf);return t||Q(!1),t}function Zm(e){let t=w.useContext(qe);return t||Q(!1),t}function df(e){let t=Zm(),n=t.matches[t.matches.length-1];return n.route.id||Q(!1),n.route.id}function eg(){var e;let t=w.useContext(sf),n=Xm(),r=df();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function tg(){let{router:e}=Jm(uf.UseNavigateStable),t=df(cf.UseNavigateStable),n=w.useRef(!1);return of(()=>{n.current=!0}),w.useCallback(function(l,s){s===void 0&&(s={}),n.current&&(typeof l=="number"?e.navigate(l):e.navigate(l,Tr({fromRouteId:t},s)))},[e,t])}const ku={};function ng(e,t,n){ku[e]||(ku[e]=!0)}function rg(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function vl(e){let{to:t,replace:n,state:r,relative:l}=e;Bn()||Q(!1);let{future:s,static:o}=w.useContext(ct),{matches:a}=w.useContext(qe),{pathname:u}=Ft(),c=Dt(),p=na(t,ta(a,s.v7_relativeSplatPath),u,l==="path"),h=JSON.stringify(p);return w.useEffect(()=>c(JSON.parse(h),{replace:n,state:r,relative:l}),[c,h,l,n,r]),null}function lg(e){return Vm(e.context)}function G(e){Q(!1)}function sg(e){let{basename:t="/",children:n=null,location:r,navigationType:l=yt.Pop,navigator:s,static:o=!1,future:a}=e;Bn()&&Q(!1);let u=t.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:u,navigator:s,static:o,future:Tr({v7_relativeSplatPath:!1},a)}),[u,a,s,o]);typeof r=="string"&&(r=On(r));let{pathname:p="/",search:h="",hash:m="",state:y=null,key:v="default"}=r,j=w.useMemo(()=>{let C=An(p,u);return C==null?null:{location:{pathname:C,search:h,hash:m,state:y,key:v},navigationType:l}},[u,p,h,m,y,v,l]);return j==null?null:w.createElement(ct.Provider,{value:c},w.createElement(fs.Provider,{children:n,value:j}))}function qi(e){let{children:t,location:n}=e;return Wm(Ji(t),n)}new Promise(()=>{});function Ji(e,t){t===void 0&&(t=[]);let n=[];return w.Children.forEach(e,(r,l)=>{if(!w.isValidElement(r))return;let s=[...t,l];if(r.type===w.Fragment){n.push.apply(n,Ji(r.props.children,s));return}r.type!==G&&Q(!1),!r.props.index||!r.props.children||Q(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ji(r.props.children,s)),n.push(o)}),n}/** * React Router DOM v6.30.6 * * Copyright (c) Remix Software Inc. @@ -64,13 +64,13 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Vl(){return Vl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=e[n];return t.concat(Array.isArray(r)?r.map(l=>[n,l]):[[n,r]])},[]))}function ag(e,t){let n=Xi(e);return t&&t.forEach((r,l)=>{n.has(l)||t.getAll(l).forEach(s=>{n.append(l,s)})}),n}const ug=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],cg=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],dg="6";try{window.__reactRouterVersion=dg}catch{}const fg=w.createContext({isTransitioning:!1}),pg="startTransition",Pu=lp[pg];function hg(e){let{basename:t,children:n,future:r,window:l}=e,s=w.useRef();s.current==null&&(s.current=gm({window:l,v5Compat:!0}));let o=s.current,[a,u]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},d=w.useCallback(h=>{c&&Pu?Pu(()=>u(h)):u(h)},[u,c]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>rg(r),[r]),w.createElement(sg,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const mg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fe=w.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:s,replace:o,state:a,target:u,to:c,preventScrollReset:d,viewTransition:h}=t,g=ff(t,ug),{basename:x}=w.useContext(ct),v,j=!1;if(typeof c=="string"&&gg.test(c)&&(v=c,mg))try{let m=new URL(window.location.href),y=c.startsWith("//")?new URL(m.protocol+c):new URL(c),N=_n(y.pathname,x);y.origin===m.origin&&N!=null?c=N+y.search+y.hash:j=!0}catch{}let C=Bm(c,{relative:l}),p=yg(c,{replace:o,state:a,target:u,preventScrollReset:d,relative:l,viewTransition:h});function f(m){r&&r(m),m.defaultPrevented||p(m)}return w.createElement("a",Vl({},g,{href:v||C,onClick:j||s?r:f,ref:n,target:u}))}),yl=w.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:s="",end:o=!1,style:a,to:u,viewTransition:c,children:d}=t,h=ff(t,cg),g=ps(u,{relative:h.relative}),x=Ft(),v=w.useContext(lf),{navigator:j,basename:C}=w.useContext(ct),p=v!=null&&xg(g)&&c===!0,f=j.encodeLocation?j.encodeLocation(g).pathname:g.pathname,m=x.pathname,y=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;l||(m=m.toLowerCase(),y=y?y.toLowerCase():null,f=f.toLowerCase()),y&&C&&(y=_n(y,C)||y);const N=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let S=m===f||!o&&m.startsWith(f)&&m.charAt(N)==="/",E=y!=null&&(y===f||!o&&y.startsWith(f)&&y.charAt(f.length)==="/"),P={isActive:S,isPending:E,isTransitioning:p},z=S?r:void 0,_;typeof s=="function"?_=s(P):_=[s,S?"active":null,E?"pending":null,p?"transitioning":null].filter(Boolean).join(" ");let Y=typeof a=="function"?a(P):a;return w.createElement(Fe,Vl({},h,{"aria-current":z,className:_,ref:n,style:Y,to:u,viewTransition:c}),typeof d=="function"?d(P):d)});var Zi;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Zi||(Zi={}));var Ru;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ru||(Ru={}));function vg(e){let t=w.useContext(ds);return t||Q(!1),t}function yg(e,t){let{target:n,replace:r,state:l,preventScrollReset:s,relative:o,viewTransition:a}=t===void 0?{}:t,u=tn(),c=Ft(),d=ps(e,{relative:o});return w.useCallback(h=>{if(og(h,n)){h.preventDefault();let g=r!==void 0?r:Wl(c)===Wl(d);u(e,{replace:g,state:l,preventScrollReset:s,relative:o,viewTransition:a})}},[c,u,d,r,l,n,e,s,o,a])}function ra(e){let t=w.useRef(Xi(e)),n=w.useRef(!1),r=Ft(),l=w.useMemo(()=>ag(r.search,n.current?null:t.current),[r.search]),s=tn(),o=w.useCallback((a,u)=>{const c=Xi(typeof a=="function"?a(l):a);n.current=!0,s("?"+c,u)},[s,l]);return[l,o]}function xg(e,t){t===void 0&&(t={});let n=w.useContext(fg);n==null&&Q(!1);let{basename:r}=vg(Zi.useViewTransitionState),l=ps(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=_n(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=_n(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Gi(l.pathname,o)!=null||Gi(l.pathname,s)!=null}const Tr="https://api.monespacepro.eu",hs="mep.admin.refresh",la="mep.admin.kind";let Tt=null,pf=()=>{};class ms extends Error{constructor(t,n){super(n),this.status=t}}function eo(e){return e?`${Tr}${e}`:null}function wg(e){pf=e}function jg(){try{return localStorage.getItem(hs)?localStorage.getItem(la)==="staff"?"staff":"admin":null}catch{return null}}function sa(e,t){Tt=e.accessToken;try{localStorage.setItem(hs,e.refreshToken),t&&localStorage.setItem(la,t)}catch{}}function ia(){Tt=null;try{localStorage.removeItem(hs),localStorage.removeItem(la)}catch{}pf()}async function Sg(e,t){const n=await rt("POST","/api/auth/admin/login",{email:e,password:t},!1);sa(n,"admin")}async function Ng(e,t){const n=await rt("POST","/api/auth/staff/login",{email:e,password:t},!1);sa(n,"staff")}const Tu={get:e=>rt("GET",e,void 0,!1),post:(e,t)=>rt("POST",e,t,!1)};let Ys=null;async function Hl(){let e=null;try{e=localStorage.getItem(hs)}catch{}return e?(Ys??(Ys=fetch(`${Tr}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})}).then(async t=>t.ok?(sa(await t.json()),!0):!1).catch(()=>!1).finally(()=>{Ys=null})),Ys):!1}async function rt(e,t,n,r=!0,l=!0){r&&!Tt&&await Hl();const s=n instanceof FormData,o=await fetch(`${Tr}${t}`,{method:e,headers:{...n!==void 0&&!s&&{"Content-Type":"application/json"},...r&&Tt&&{Authorization:`Bearer ${Tt}`}},body:n===void 0?void 0:s?n:JSON.stringify(n)});if(o.status===401&&r){if(l&&await Hl())return rt(e,t,n,r,!1);ia()}if(!o.ok){const u=await o.json().catch(()=>({})),c=Array.isArray(u.message)?u.message.join(" · "):u.message;throw new ms(o.status,c||"Une erreur est survenue")}const a=await o.text();return a?JSON.parse(a):null}async function to(e,t){Tt||await Hl();let n=await fetch(`${Tr}${e}`,{headers:{Authorization:`Bearer ${Tt}`}});if(n.status===401&&await Hl()&&(n=await fetch(`${Tr}${e}`,{headers:{Authorization:`Bearer ${Tt}`}})),!n.ok)throw new ms(n.status,"Téléchargement impossible");const r=URL.createObjectURL(await n.blob());Object.assign(document.createElement("a"),{href:r,download:t}).click(),setTimeout(()=>URL.revokeObjectURL(r),1e4)}const $={get:e=>rt("GET",e),post:(e,t)=>rt("POST",e,t??{}),put:(e,t)=>rt("PUT",e,t),patch:(e,t)=>rt("PATCH",e,t)},Mt={ESSENTIEL:"Essentiel",PRO:"Pro",RESEAU:"Réseau"};function Cg({size:e=32}){return i.jsxs("svg",{width:e,height:e,viewBox:"0.5 -2 64 64","aria-hidden":"true",children:[i.jsx("path",{d:"M12 54V32a9 9 0 0 1 18 0v22M30 32a9 9 0 0 1 18 0v22",fill:"none",stroke:"var(--brand-arch)",strokeWidth:"8"}),i.jsx("circle",{cx:"51",cy:"12",r:"6",fill:"#F2B544"})]})}function Fr({admin:e=!0}){return i.jsxs("div",{className:"brand",children:[i.jsx(Cg,{}),i.jsxs("span",{className:"brand-name",children:["MonEspace",i.jsx("b",{children:"Pro"})]}),e&&i.jsx("span",{className:"badge DRAFT",style:{marginLeft:"auto",height:22},children:"Admin"})]})}function Eg(){return i.jsxs("div",{className:"shell",children:[i.jsxs("aside",{className:"sidebar",children:[i.jsx(Fr,{}),i.jsx("nav",{"aria-label":"Navigation principale",children:i.jsx(yl,{to:"/magasins",children:"Magasins"})}),i.jsx("div",{className:"bottom",children:i.jsx("button",{type:"button",className:"btn secondary small",onClick:ia,children:"Se déconnecter"})})]}),i.jsx("main",{className:"main",children:i.jsx("div",{className:"container",children:i.jsx(lg,{})})})]})}const hf={DRAFT:"Brouillon",ACTIVE:"Actif",SUSPENDED:"Suspendu",CLOSED:"Fermé"};function mf({status:e}){return i.jsx("span",{className:`badge ${e}`,children:hf[e]})}function kg({onLogin:e}){const t=tn(),[n,r]=w.useState(""),[l,s]=w.useState(""),[o,a]=w.useState(null),[u,c]=w.useState(!1);async function d(h){h.preventDefault(),c(!0),a(null);try{await Sg(n,l),e(),t("/magasins")}catch(g){a(g.message)}finally{c(!1)}}return i.jsx("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:16},children:i.jsxs("form",{className:"card",onSubmit:d,style:{width:"100%",maxWidth:420,display:"flex",flexDirection:"column",gap:20},children:[i.jsx(Fr,{}),i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:26},children:"Connexion"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Espace d'administration MonEspacePro"})]}),o&&i.jsx("div",{className:"alert error",role:"alert",children:o}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"email",children:"E-mail"}),i.jsx("input",{id:"email",className:"input",type:"email",autoComplete:"username",required:!0,value:n,onChange:h=>r(h.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"password",children:"Mot de passe"}),i.jsx("input",{id:"password",className:"input",type:"password",autoComplete:"current-password",required:!0,minLength:8,value:l,onChange:h=>s(h.target.value)})]}),i.jsx("button",{className:"btn",disabled:u,children:u?"Connexion…":"Se connecter"})]})})}const Pg=["ALL","DRAFT","ACTIVE","SUSPENDED","CLOSED"];function Rg(e){return e.split(" ").filter(t=>t.length>2).slice(-2).map(t=>t[0]).join("").toUpperCase()}function Tg(e){return e==="ACTIVE"?i.jsx("span",{style:{color:"var(--ok)",fontWeight:600},children:"Actif"}):e==="PAST_DUE"?i.jsx("span",{style:{color:"var(--err)",fontWeight:600},children:"Impayé"}):e==="INCOMPLETE"?i.jsx("span",{className:"muted",children:"En attente"}):i.jsx("span",{className:"muted",children:"—"})}function Lg(){const[e,t]=w.useState(""),[n,r]=w.useState("ALL"),[l,s]=w.useState(null),[o,a]=w.useState(null);w.useEffect(()=>{const d=setTimeout(()=>{const h=new URLSearchParams;e.trim()&&h.set("q",e.trim()),n!=="ALL"&&h.set("status",n),$.get(`/api/admin/stores?${h}`).then(s).catch(g=>a(g.message))},250);return()=>clearTimeout(d)},[e,n]);const u=l?Object.values(l.counts).reduce((d,h)=>d+(h??0),0):0,c=(l==null?void 0:l.items.filter(d=>d.subscriptionStatus==="PAST_DUE").length)??0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",style:{alignItems:"flex-end"},children:[i.jsxs("div",{children:[i.jsx("h1",{children:"Magasins"}),i.jsxs("p",{className:"muted",style:{margin:0},children:[u," magasins inscrits · ",c," abonnements impayés"]})]}),i.jsx(Fe,{to:"/magasins/nouveau",className:"btn",children:"+ Nouveau magasin"})]}),i.jsxs("div",{className:"row",children:[i.jsxs("div",{style:{flex:"1 1 320px",maxWidth:420},children:[i.jsx("label",{htmlFor:"search",className:"sr-only",children:"Rechercher un magasin"}),i.jsx("input",{id:"search",type:"search",className:"input",placeholder:"Rechercher par nom ou ville",value:e,onChange:d=>t(d.target.value)})]}),i.jsx("div",{role:"group","aria-label":"Filtrer par statut",className:"row",style:{gap:8},children:Pg.map(d=>i.jsxs("button",{type:"button",className:"chip","aria-pressed":n===d,onClick:()=>r(d),children:[d==="ALL"?"Tous":hf[d],i.jsx("span",{style:{opacity:.8,fontWeight:500},children:d==="ALL"?u:(l==null?void 0:l.counts[d])??0})]},d))})]}),o&&i.jsx("div",{className:"alert error",children:o}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:860},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Magasin"}),i.jsx("th",{scope:"col",children:"Ville"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",className:"num",children:"Clients"}),i.jsx("th",{scope:"col",children:"Abonnement"}),i.jsx("th",{scope:"col",children:"Créé le"})]})}),i.jsx("tbody",{children:l==null?void 0:l.items.map(d=>i.jsxs("tr",{children:[i.jsx("td",{style:{paddingLeft:24},children:i.jsxs(Fe,{to:`/magasins/${d.id}`,style:{display:"inline-flex",alignItems:"center",gap:12,color:"var(--text)",fontWeight:600,textDecoration:"none"},children:[i.jsx("span",{style:{width:36,height:36,borderRadius:10,background:"var(--primary-soft)",color:"var(--primary)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:800},children:Rg(d.name)}),d.name]})}),i.jsx("td",{children:d.city}),i.jsx("td",{children:i.jsx(mf,{status:d.status})}),i.jsx("td",{className:"num",children:d.customers}),i.jsxs("td",{children:[Tg(d.subscriptionStatus),d.plan&&i.jsxs("span",{className:"muted",style:{fontSize:14},children:[" · ",Mt[d.plan]]})]}),i.jsx("td",{className:"muted",children:new Date(d.createdAt).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})})]},d.id))})]})}),l&&l.items.length===0&&i.jsxs("div",{style:{padding:"48px 24px",textAlign:"center"},children:[i.jsx("strong",{children:"Aucun magasin trouvé"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Essayez un autre nom, une autre ville ou retirez le filtre de statut."})]})]})]})}const _g={name:"",siret:"",addressLine:"",postalCode:"",city:"",contactName:"",contactEmail:"",contactPhone:"",maxAmountEuros:500,minScanIntervalMin:5};function gf({initial:e,submitLabel:t,onSubmit:n}){const[r,l]=w.useState(e),[s,o]=w.useState(null),[a,u]=w.useState(!1),c=g=>x=>l(v=>({...v,[g]:typeof v[g]=="number"?Number(x.target.value):x.target.value}));async function d(g){g.preventDefault(),u(!0),o(null);try{await n(r)}catch(x){o(x.message)}finally{u(!1)}}const h=(g,x,v={})=>i.jsxs("div",{className:"field",children:[i.jsxs("label",{htmlFor:g,children:[x," *"]}),i.jsx("input",{id:g,className:"input",required:!0,value:r[g],onChange:c(g),...v})]});return i.jsxs("form",{onSubmit:d,style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsx("p",{className:"muted",style:{margin:0},children:"Les champs marqués d'un astérisque (*) sont obligatoires."}),s&&i.jsx("div",{className:"alert error",role:"alert",children:s}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsx("h2",{children:"Commerce"}),i.jsxs("div",{className:"grid-2",children:[h("name","Nom du magasin"),h("siret","SIRET",{placeholder:"14 chiffres",inputMode:"numeric",pattern:"[0-9 ]{14,17}"})]}),h("addressLine","Adresse",{placeholder:"Numéro et nom de rue"}),i.jsxs("div",{className:"grid-2",children:[h("postalCode","Code postal",{placeholder:"5 chiffres",inputMode:"numeric",pattern:"[0-9]{5}"}),h("city","Ville")]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsx("h2",{children:"Contact"}),h("contactName","Nom du contact",{placeholder:"Prénom Nom"}),i.jsxs("div",{className:"grid-2",children:[h("contactEmail","E-mail",{type:"email",placeholder:"contact@exemple.fr"}),h("contactPhone","Téléphone",{type:"tel",placeholder:"06 12 34 56 78"})]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Anti-triche"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Limitent les crédits abusifs. Une opération hors limites est refusée et apparaît dans l'onglet Opérations."})]}),i.jsxs("div",{className:"grid-2",children:[i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"maxAmountEuros",children:"Plafond par opération (€) *"}),i.jsx("input",{id:"maxAmountEuros",className:"input",type:"number",min:1,max:1e4,required:!0,value:r.maxAmountEuros,onChange:c("maxAmountEuros")})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"minScanIntervalMin",children:"Délai minimum entre deux crédits (min) *"}),i.jsx("input",{id:"minScanIntervalMin",className:"input",type:"number",min:0,max:1440,required:!0,value:r.minScanIntervalMin,onChange:c("minScanIntervalMin")})]})]})]}),i.jsx("div",{children:i.jsx("button",{className:"btn",disabled:a,children:a?"Enregistrement…":t})})]})}function Mg(){const e=tn(),[t,n]=w.useState("PRO"),[r,l]=w.useState("MONTH"),[s,o]=w.useState(null);return s?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsxs("h1",{children:[s.name," est créé"]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:12},children:[s.link.emailedTo?i.jsxs("div",{className:"alert ok",children:["Lien de paiement (formule ",Mt[t],", ",r==="YEAR"?"annuelle":"mensuelle",") envoyé à ",i.jsx("strong",{children:s.link.emailedTo}),s.manager&&", avec ses identifiants Dirigeant",". Le magasin s'ouvrira automatiquement dès le paiement validé et la carte conçue."]}):i.jsxs("div",{className:"alert warn",children:["Le lien de paiement n'a pas pu être envoyé : ",s.link.error,". Renvoyez-le depuis l'onglet Facturation."]}),s.manager?i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{margin:0},children:["Compte Dirigeant : ",i.jsx("strong",{children:s.manager.email}),", mot de passe provisoire :"]}),i.jsx("div",{className:"password-box",children:s.manager.provisionalPassword})]}):i.jsx("div",{className:"alert warn",children:"Un compte existe déjà avec l'e-mail du contact : créez le Dirigeant à la main dans l'onglet Employés."}),i.jsx("div",{className:"row",style:{justifyContent:"flex-end"},children:i.jsx("button",{className:"btn",onClick:()=>e(`/magasins/${s.id}/carte`),children:"Concevoir la carte"})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsx("h1",{children:"Nouveau magasin"}),i.jsx("p",{className:"muted",style:{margin:0},children:"À la création, le contact reçoit automatiquement par e-mail le lien de paiement de la formule choisie et ses identifiants Dirigeant."})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsx("h2",{children:"Formule *"}),i.jsx("div",{role:"radiogroup","aria-label":"Formule",className:"row",style:{gap:8},children:["ESSENTIEL","PRO","RESEAU"].map(a=>i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":t===a,"aria-pressed":t===a,onClick:()=>n(a),children:Mt[a]},a))}),i.jsxs("div",{role:"radiogroup","aria-label":"Périodicité",className:"row",style:{gap:8},children:[i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":r==="MONTH","aria-pressed":r==="MONTH",onClick:()=>l("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":r==="YEAR","aria-pressed":r==="YEAR",onClick:()=>l("YEAR"),children:"Annuel — 2 mois offerts"})]})]}),i.jsx(gf,{initial:_g,submitLabel:"Créer le magasin",onSubmit:async a=>{o(await $.post("/api/admin/stores",{...a,plan:t,interval:r}))}})]})}function vf({size:e}){const n=e/21,r=(s,o)=>i.jsxs("g",{children:[i.jsx("rect",{x:s*n,y:o*n,width:7*n,height:7*n,fill:"#000"}),i.jsx("rect",{x:(s+1)*n,y:(o+1)*n,width:5*n,height:5*n,fill:"#fff"}),i.jsx("rect",{x:(s+2)*n,y:(o+2)*n,width:3*n,height:3*n,fill:"#000"})]},`${s}-${o}`),l=[];for(let s=0;s<21;s++)for(let o=0;o<21;o++)!(o<8&&s<8||o>12&&s<8||o<8&&s>12)&&(o*7+s*13+o*s)%3===0&&l.push(i.jsx("rect",{x:o*n,y:s*n,width:n,height:n,fill:"#000"},`${o}.${s}`));return i.jsxs("svg",{width:e,height:e,"aria-hidden":"true",children:[i.jsx("rect",{width:e,height:e,fill:"#fff"}),r(0,0),r(14,0),r(0,14),l]})}function yf(e){return e.pointsMode==="STAMP"?{label:"TAMPONS",value:"7"}:{label:"POINTS",value:"120"}}function Ql(e){const t=e.pointsMode==="STAMP"?7:120,n=(e.rewards??[]).filter(s=>s.active!==!1&&s.label.trim()).sort((s,o)=>s.cost-o.cost);if(!n.length)return null;const r=n.filter(s=>s.cost<=t);if(r.length)return`${r[r.length-1].label} : disponible !`;const l=n[0].cost-t;return`${n[0].label} : encore ${l} ${e.pointsMode==="STAMP"?"tampon":"point"}${l>1?"s":""}`}function Ag({d:e}){const t=yf(e);return i.jsxs("div",{style:{width:320,borderRadius:14,overflow:"hidden",background:e.backgroundColor,color:e.foregroundColor,boxShadow:"0 12px 32px rgb(0 0 0 / 0.25)",fontFamily:"-apple-system, system-ui, sans-serif"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 14px",height:50},children:[e.logoUrl?i.jsx("img",{src:e.logoUrl,alt:"",style:{maxHeight:34,maxWidth:140,objectFit:"contain"}}):i.jsx("span",{style:{fontWeight:700},children:e.storeName}),i.jsxs("div",{style:{textAlign:"right"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:t.label}),i.jsx("div",{style:{fontSize:18},children:t.value})]})]}),i.jsx("div",{style:{position:"relative",height:123,background:e.stripUrl?`center/cover url(${e.stripUrl})`:"rgb(255 255 255 / 0.08)"},children:i.jsxs("div",{style:{position:"absolute",left:14,bottom:10},children:[i.jsx("div",{style:{fontSize:11,fontWeight:600,color:e.labelColor,textShadow:e.stripUrl?"0 1px 2px rgb(0 0 0 / 0.5)":void 0},children:"SOLDE"}),i.jsx("div",{style:{fontSize:36,lineHeight:1,textShadow:e.stripUrl?"0 1px 3px rgb(0 0 0 / 0.5)":void 0},children:t.value})]})}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"10px 14px"},children:[i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"PROGRAMME"}),i.jsx("div",{style:{fontSize:14},children:e.programName||"—"})]}),i.jsxs("div",{style:{textAlign:"right"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"MEMBRE"}),i.jsx("div",{style:{fontSize:14},children:"Camille"})]})]}),Ql(e)&&i.jsxs("div",{style:{padding:"0 14px 6px"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"PROCHAINE RÉCOMPENSE"}),i.jsx("div",{style:{fontSize:14},children:Ql(e)})]}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"14px 0 20px"},children:i.jsx("div",{style:{background:"#fff",padding:8,borderRadius:6},children:i.jsx(vf,{size:120})})})]})}function zg({d:e}){const t=yf(e);return i.jsxs("div",{style:{width:320,borderRadius:20,overflow:"hidden",background:e.backgroundColor,color:e.foregroundColor,boxShadow:"0 12px 32px rgb(0 0 0 / 0.25)",fontFamily:"Roboto, system-ui, sans-serif"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px"},children:[i.jsx("span",{style:{width:32,height:32,borderRadius:"50%",background:"#fff",overflow:"hidden",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.logoUrl&&i.jsx("img",{src:e.logoUrl,alt:"",style:{width:"100%",height:"100%",objectFit:"contain"}})}),i.jsx("span",{style:{fontSize:14},children:e.storeName})]}),i.jsx("div",{style:{padding:"0 16px 12px",fontSize:22},children:e.programName||"—"}),i.jsxs("div",{style:{display:"flex",gap:32,padding:"0 16px 16px"},children:[i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:t.label==="POINTS"?"Points":"Tampons"}),i.jsx("div",{style:{fontSize:18},children:t.value})]}),i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:"Membre"}),i.jsx("div",{style:{fontSize:18},children:"Camille"})]})]}),Ql(e)&&i.jsxs("div",{style:{padding:"0 16px 12px"},children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:"Prochaine récompense"}),i.jsx("div",{style:{fontSize:15},children:Ql(e)})]}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0 16px"},children:i.jsx("div",{style:{background:"#fff",padding:10,borderRadius:12},children:i.jsx(vf,{size:120})})}),e.stripUrl&&i.jsx("img",{src:e.stripUrl,alt:"",style:{display:"block",width:"100%",aspectRatio:"1125 / 432",objectFit:"cover"}})]})}var Dr={},Ig=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},xf={},Re={};let oa;const Fg=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Re.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};Re.getSymbolTotalCodewords=function(t){return Fg[t]};Re.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};Re.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');oa=t};Re.isKanjiModeEnabled=function(){return typeof oa<"u"};Re.toSJIS=function(t){return oa(t)};var gs={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(gs);function wf(){this.buffer=[],this.length=0}wf.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Dg=wf;function Ur(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Ur.prototype.set=function(e,t,n,r){const l=e*this.size+t;this.data[l]=n,r&&(this.reservedBit[l]=!0)};Ur.prototype.get=function(e,t){return this.data[e*this.size+t]};Ur.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};Ur.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Ug=Ur,jf={};(function(e){const t=Re.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,s=t(r),o=s===145?26:Math.ceil((s-13)/(2*l-2))*2,a=[s-7];for(let u=1;u=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const s=l.size;let o=0,a=0,u=0,c=null,d=null;for(let h=0;h=5&&(o+=t.N1+(a-5)),c=x,a=1),x=l.get(g,h),x===d?u++:(u>=5&&(o+=t.N1+(u-5)),d=x,u=1)}a>=5&&(o+=t.N1+(a-5)),u>=5&&(o+=t.N1+(u-5))}return o},e.getPenaltyN2=function(l){const s=l.size;let o=0;for(let a=0;a=10&&(a===1488||a===93)&&o++,u=u<<1&2047|l.get(d,c),d>=10&&(u===1488||u===93)&&o++}return o*t.N3},e.getPenaltyN4=function(l){let s=0;const o=l.data.length;for(let u=0;u=0;){const o=s[0];for(let u=0;u0){const s=new Uint8Array(this.degree);return s.set(r,l),s}return r};var Bg=aa,kf={},Dt={},ua={};ua.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var Je={};const Pf="[0-9]+",$g="[A-Z $%*+\\-./:]+";let Lr="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Lr=Lr.replace(/u/g,"\\u");const bg="(?:(?![A-Z0-9 $%*+\\-./:]|"+Lr+`)(?:.|[\r -]))+`;Je.KANJI=new RegExp(Lr,"g");Je.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Je.BYTE=new RegExp(bg,"g");Je.NUMERIC=new RegExp(Pf,"g");Je.ALPHANUMERIC=new RegExp($g,"g");const Wg=new RegExp("^"+Lr+"$"),Vg=new RegExp("^"+Pf+"$"),Hg=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Je.testKanji=function(t){return Wg.test(t)};Je.testNumeric=function(t){return Vg.test(t)};Je.testAlphanumeric=function(t){return Hg.test(t)};(function(e){const t=ua,n=Je;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return n.testNumeric(s)?e.NUMERIC:n.testAlphanumeric(s)?e.ALPHANUMERIC:n.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(s,o){if(e.isValid(s))return s;try{return r(s)}catch{return o}}})(Dt);(function(e){const t=Re,n=vs,r=gs,l=Dt,s=ua,o=7973,a=t.getBCHDigit(o);function u(g,x,v){for(let j=1;j<=40;j++)if(x<=e.getCapacity(j,v,g))return j}function c(g,x){return l.getCharCountIndicator(g,x)+4}function d(g,x){let v=0;return g.forEach(function(j){const C=c(j.mode,x);v+=C+j.getBitsLength()}),v}function h(g,x){for(let v=1;v<=40;v++)if(d(g,v)<=e.getCapacity(v,x,l.MIXED))return v}e.from=function(x,v){return s.isValid(x)?parseInt(x,10):v},e.getCapacity=function(x,v,j){if(!s.isValid(x))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=l.BYTE);const C=t.getSymbolTotalCodewords(x),p=n.getTotalCodewordsCount(x,v),f=(C-p)*8;if(j===l.MIXED)return f;const m=f-c(j,x);switch(j){case l.NUMERIC:return Math.floor(m/10*3);case l.ALPHANUMERIC:return Math.floor(m/11*2);case l.KANJI:return Math.floor(m/13);case l.BYTE:default:return Math.floor(m/8)}},e.getBestVersionForData=function(x,v){let j;const C=r.from(v,r.M);if(Array.isArray(x)){if(x.length>1)return h(x,C);if(x.length===0)return 1;j=x[0]}else j=x;return u(j.mode,j.getLength(),C)},e.getEncodedBits=function(x){if(!s.isValid(x)||x<7)throw new Error("Invalid QR Code version");let v=x<<12;for(;t.getBCHDigit(v)-a>=0;)v^=o<=0;)l^=Tf<0&&(r=this.data.substr(n),l=parseInt(r,10),t.put(l,s*3+1))};var Yg=Mn;const Gg=Dt,Gs=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function An(e){this.mode=Gg.ALPHANUMERIC,this.data=e}An.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};An.prototype.getLength=function(){return this.data.length};An.prototype.getBitsLength=function(){return An.getBitsLength(this.data.length)};An.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let r=Gs.indexOf(this.data[n])*45;r+=Gs.indexOf(this.data[n+1]),t.put(r,11)}this.data.length%2&&t.put(Gs.indexOf(this.data[n]),6)};var qg=An;const Jg=Dt;function zn(e){this.mode=Jg.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}zn.getBitsLength=function(t){return t*8};zn.prototype.getLength=function(){return this.data.length};zn.prototype.getBitsLength=function(){return zn.getBitsLength(this.data.length)};zn.prototype.write=function(e){for(let t=0,n=this.data.length;t=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` -Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var tv=In,_f={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,r,l){var s={},o={};o[r]=0;var a=t.PriorityQueue.make();a.push(r,0);for(var u,c,d,h,g,x,v,j,C;!a.empty();){u=a.pop(),c=u.value,h=u.cost,g=n[c]||{};for(d in g)g.hasOwnProperty(d)&&(x=g[d],v=h+x,j=o[d],C=typeof o[d]>"u",(C||j>v)&&(o[d]=v,a.push(d,v),s[d]=c))}if(typeof l<"u"&&typeof o[l]>"u"){var p=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(p)}return s},extract_shortest_path_from_predecessor_list:function(n,r){for(var l=[],s=r;s;)l.push(s),n[s],s=n[s];return l.reverse(),l},find_path:function(n,r,l){var s=t.single_source_shortest_paths(n,r,l);return t.extract_shortest_path_from_predecessor_list(s,l)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,l={},s;n=n||{};for(s in r)r.hasOwnProperty(s)&&(l[s]=r[s]);return l.queue=[],l.sorter=n.sorter||r.default_sorter,l},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var l={value:n,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(_f);var nv=_f.exports;(function(e){const t=Dt,n=Yg,r=qg,l=Xg,s=tv,o=Je,a=Re,u=nv;function c(p){return unescape(encodeURIComponent(p)).length}function d(p,f,m){const y=[];let N;for(;(N=p.exec(m))!==null;)y.push({data:N[0],index:N.index,mode:f,length:N[0].length});return y}function h(p){const f=d(o.NUMERIC,t.NUMERIC,p),m=d(o.ALPHANUMERIC,t.ALPHANUMERIC,p);let y,N;return a.isKanjiModeEnabled()?(y=d(o.BYTE,t.BYTE,p),N=d(o.KANJI,t.KANJI,p)):(y=d(o.BYTE_KANJI,t.BYTE,p),N=[]),f.concat(m,y,N).sort(function(E,P){return E.index-P.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function g(p,f){switch(f){case t.NUMERIC:return n.getBitsLength(p);case t.ALPHANUMERIC:return r.getBitsLength(p);case t.KANJI:return s.getBitsLength(p);case t.BYTE:return l.getBitsLength(p)}}function x(p){return p.reduce(function(f,m){const y=f.length-1>=0?f[f.length-1]:null;return y&&y.mode===m.mode?(f[f.length-1].data+=m.data,f):(f.push(m),f)},[])}function v(p){const f=[];for(let m=0;m=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?e.set(s+a,o+u,!0,!0):e.set(s+a,o+u,!1,!0))}}function dv(e){const t=e.size;for(let n=8;n>a&1)===1,e.set(l,s,o,!0),e.set(s,l,o,!0)}function Xs(e,t,n){const r=e.size,l=av.getEncodedBits(t,n);let s,o;for(s=0;s<15;s++)o=(l>>s&1)===1,s<6?e.set(s,8,o,!0):s<8?e.set(s+1,8,o,!0):e.set(r-15+s,8,o,!0),s<8?e.set(8,r-s-1,o,!0):s<9?e.set(8,15-s-1+1,o,!0):e.set(8,15-s-1,o,!0);e.set(r-8,8,1,!0)}function hv(e,t){const n=e.size;let r=-1,l=n-1,s=7,o=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!e.isReserved(l,a-u)){let c=!1;o>>s&1)===1),e.set(l,a-u,c),s--,s===-1&&(o++,s=7)}if(l+=r,l<0||n<=l){l-=r,r=-r;break}}}function mv(e,t,n){const r=new rv;n.forEach(function(u){r.put(u.mode.bit,4),r.put(u.getLength(),uv.getCharCountIndicator(u.mode,e)),u.write(r)});const l=xs.getSymbolTotalCodewords(e),s=lo.getTotalCodewordsCount(e,t),o=(l-s)*8;for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(o-r.getLengthInBits())/8;for(let u=0;u{let r=e[n];return t.concat(Array.isArray(r)?r.map(l=>[n,l]):[[n,r]])},[]))}function ag(e,t){let n=Xi(e);return t&&t.forEach((r,l)=>{n.has(l)||t.getAll(l).forEach(s=>{n.append(l,s)})}),n}const ug=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],cg=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],dg="6";try{window.__reactRouterVersion=dg}catch{}const fg=w.createContext({isTransitioning:!1}),pg="startTransition",Pu=lp[pg];function hg(e){let{basename:t,children:n,future:r,window:l}=e,s=w.useRef();s.current==null&&(s.current=gm({window:l,v5Compat:!0}));let o=s.current,[a,u]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},p=w.useCallback(h=>{c&&Pu?Pu(()=>u(h)):u(h)},[u,c]);return w.useLayoutEffect(()=>o.listen(p),[o,p]),w.useEffect(()=>rg(r),[r]),w.createElement(sg,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const mg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fe=w.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:s,replace:o,state:a,target:u,to:c,preventScrollReset:p,viewTransition:h}=t,m=ff(t,ug),{basename:y}=w.useContext(ct),v,j=!1;if(typeof c=="string"&&gg.test(c)&&(v=c,mg))try{let g=new URL(window.location.href),x=c.startsWith("//")?new URL(g.protocol+c):new URL(c),N=An(x.pathname,y);x.origin===g.origin&&N!=null?c=N+x.search+x.hash:j=!0}catch{}let C=Bm(c,{relative:l}),f=yg(c,{replace:o,state:a,target:u,preventScrollReset:p,relative:l,viewTransition:h});function d(g){r&&r(g),g.defaultPrevented||f(g)}return w.createElement("a",Wl({},m,{href:v||C,onClick:j||s?r:d,ref:n,target:u}))}),yl=w.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:s="",end:o=!1,style:a,to:u,viewTransition:c,children:p}=t,h=ff(t,cg),m=ps(u,{relative:h.relative}),y=Ft(),v=w.useContext(lf),{navigator:j,basename:C}=w.useContext(ct),f=v!=null&&xg(m)&&c===!0,d=j.encodeLocation?j.encodeLocation(m).pathname:m.pathname,g=y.pathname,x=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;l||(g=g.toLowerCase(),x=x?x.toLowerCase():null,d=d.toLowerCase()),x&&C&&(x=An(x,C)||x);const N=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let S=g===d||!o&&g.startsWith(d)&&g.charAt(N)==="/",E=x!=null&&(x===d||!o&&x.startsWith(d)&&x.charAt(d.length)==="/"),P={isActive:S,isPending:E,isTransitioning:f},z=S?r:void 0,A;typeof s=="function"?A=s(P):A=[s,S?"active":null,E?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let Y=typeof a=="function"?a(P):a;return w.createElement(Fe,Wl({},h,{"aria-current":z,className:A,ref:n,style:Y,to:u,viewTransition:c}),typeof p=="function"?p(P):p)});var Zi;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Zi||(Zi={}));var Tu;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tu||(Tu={}));function vg(e){let t=w.useContext(ds);return t||Q(!1),t}function yg(e,t){let{target:n,replace:r,state:l,preventScrollReset:s,relative:o,viewTransition:a}=t===void 0?{}:t,u=Dt(),c=Ft(),p=ps(e,{relative:o});return w.useCallback(h=>{if(og(h,n)){h.preventDefault();let m=r!==void 0?r:Vl(c)===Vl(p);u(e,{replace:m,state:l,preventScrollReset:s,relative:o,viewTransition:a})}},[c,u,p,r,l,n,e,s,o,a])}function ra(e){let t=w.useRef(Xi(e)),n=w.useRef(!1),r=Ft(),l=w.useMemo(()=>ag(r.search,n.current?null:t.current),[r.search]),s=Dt(),o=w.useCallback((a,u)=>{const c=Xi(typeof a=="function"?a(l):a);n.current=!0,s("?"+c,u)},[s,l]);return[l,o]}function xg(e,t){t===void 0&&(t={});let n=w.useContext(fg);n==null&&Q(!1);let{basename:r}=vg(Zi.useViewTransitionState),l=ps(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=An(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=An(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Gi(l.pathname,o)!=null||Gi(l.pathname,s)!=null}const Rr="https://api.monespacepro.eu",hs="mep.admin.refresh",la="mep.admin.kind";let Rt=null,pf=()=>{};class ms extends Error{constructor(t,n){super(n),this.status=t}}function eo(e){return e?`${Rr}${e}`:null}function wg(e){pf=e}function jg(){try{return localStorage.getItem(hs)?localStorage.getItem(la)==="staff"?"staff":"admin":null}catch{return null}}function sa(e,t){Rt=e.accessToken;try{localStorage.setItem(hs,e.refreshToken),t&&localStorage.setItem(la,t)}catch{}}function ia(){Rt=null;try{localStorage.removeItem(hs),localStorage.removeItem(la)}catch{}pf()}async function Sg(e,t){const n=await rt("POST","/api/auth/admin/login",{email:e,password:t},!1);sa(n,"admin")}async function Ng(e,t){const n=await rt("POST","/api/auth/staff/login",{email:e,password:t},!1);sa(n,"staff")}const Ru={get:e=>rt("GET",e,void 0,!1),post:(e,t)=>rt("POST",e,t,!1)};let Ys=null;async function Hl(){let e=null;try{e=localStorage.getItem(hs)}catch{}return e?(Ys??(Ys=fetch(`${Rr}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})}).then(async t=>t.ok?(sa(await t.json()),!0):!1).catch(()=>!1).finally(()=>{Ys=null})),Ys):!1}async function rt(e,t,n,r=!0,l=!0){r&&!Rt&&await Hl();const s=n instanceof FormData,o=await fetch(`${Rr}${t}`,{method:e,headers:{...n!==void 0&&!s&&{"Content-Type":"application/json"},...r&&Rt&&{Authorization:`Bearer ${Rt}`}},body:n===void 0?void 0:s?n:JSON.stringify(n)});if(o.status===401&&r){if(l&&await Hl())return rt(e,t,n,r,!1);ia()}if(!o.ok){const u=await o.json().catch(()=>({})),c=Array.isArray(u.message)?u.message.join(" · "):u.message;throw new ms(o.status,c||"Une erreur est survenue")}const a=await o.text();return a?JSON.parse(a):null}async function to(e,t){Rt||await Hl();let n=await fetch(`${Rr}${e}`,{headers:{Authorization:`Bearer ${Rt}`}});if(n.status===401&&await Hl()&&(n=await fetch(`${Rr}${e}`,{headers:{Authorization:`Bearer ${Rt}`}})),!n.ok)throw new ms(n.status,"Téléchargement impossible");const r=URL.createObjectURL(await n.blob());Object.assign(document.createElement("a"),{href:r,download:t}).click(),setTimeout(()=>URL.revokeObjectURL(r),1e4)}const $={get:e=>rt("GET",e),post:(e,t)=>rt("POST",e,t??{}),put:(e,t)=>rt("PUT",e,t),patch:(e,t)=>rt("PATCH",e,t)},_t={ESSENTIEL:"Essentiel",PRO:"Pro",RESEAU:"Réseau"};function Cg({size:e=32}){return i.jsxs("svg",{width:e,height:e,viewBox:"0.5 -2 64 64","aria-hidden":"true",children:[i.jsx("path",{d:"M12 54V32a9 9 0 0 1 18 0v22M30 32a9 9 0 0 1 18 0v22",fill:"none",stroke:"var(--brand-arch)",strokeWidth:"8"}),i.jsx("circle",{cx:"51",cy:"12",r:"6",fill:"#F2B544"})]})}function Fr({admin:e=!0}){return i.jsxs("div",{className:"brand",children:[i.jsx(Cg,{}),i.jsxs("span",{className:"brand-name",children:["MonEspace",i.jsx("b",{children:"Pro"})]}),e&&i.jsx("span",{className:"badge DRAFT",style:{marginLeft:"auto",height:22},children:"Admin"})]})}function Eg(){return i.jsxs("div",{className:"shell",children:[i.jsxs("aside",{className:"sidebar",children:[i.jsx(Fr,{}),i.jsx("nav",{"aria-label":"Navigation principale",children:i.jsx(yl,{to:"/magasins",children:"Magasins"})}),i.jsx("div",{className:"bottom",children:i.jsx("button",{type:"button",className:"btn secondary small",onClick:ia,children:"Se déconnecter"})})]}),i.jsx("main",{className:"main",children:i.jsx("div",{className:"container",children:i.jsx(lg,{})})})]})}const hf={DRAFT:"Brouillon",ACTIVE:"Actif",SUSPENDED:"Suspendu",CLOSED:"Fermé"};function mf({status:e}){return i.jsx("span",{className:`badge ${e}`,children:hf[e]})}function kg({onLogin:e}){const t=Dt(),[n,r]=w.useState(""),[l,s]=w.useState(""),[o,a]=w.useState(null),[u,c]=w.useState(!1);async function p(h){h.preventDefault(),c(!0),a(null);try{await Sg(n,l),e(),t("/magasins")}catch(m){a(m.message)}finally{c(!1)}}return i.jsx("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:16},children:i.jsxs("form",{className:"card",onSubmit:p,style:{width:"100%",maxWidth:420,display:"flex",flexDirection:"column",gap:20},children:[i.jsx(Fr,{}),i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:26},children:"Connexion"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Espace d'administration MonEspacePro"})]}),o&&i.jsx("div",{className:"alert error",role:"alert",children:o}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"email",children:"E-mail"}),i.jsx("input",{id:"email",className:"input",type:"email",autoComplete:"username",required:!0,value:n,onChange:h=>r(h.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"password",children:"Mot de passe"}),i.jsx("input",{id:"password",className:"input",type:"password",autoComplete:"current-password",required:!0,minLength:8,value:l,onChange:h=>s(h.target.value)})]}),i.jsx("button",{className:"btn",disabled:u,children:u?"Connexion…":"Se connecter"})]})})}const Pg=["ALL","DRAFT","ACTIVE","SUSPENDED","CLOSED"];function Tg(e){return e.split(" ").filter(t=>t.length>2).slice(-2).map(t=>t[0]).join("").toUpperCase()}function Rg(e){return e==="ACTIVE"?i.jsx("span",{style:{color:"var(--ok)",fontWeight:600},children:"Actif"}):e==="PAST_DUE"?i.jsx("span",{style:{color:"var(--err)",fontWeight:600},children:"Impayé"}):e==="INCOMPLETE"?i.jsx("span",{className:"muted",children:"En attente"}):i.jsx("span",{className:"muted",children:"—"})}function Lg(){const e=Dt(),[t,n]=w.useState(""),[r,l]=w.useState("ALL"),[s,o]=w.useState(null),[a,u]=w.useState(null);w.useEffect(()=>{const y=setTimeout(()=>{const v=new URLSearchParams;t.trim()&&v.set("q",t.trim()),r!=="ALL"&&v.set("status",r),$.get(`/api/admin/stores?${v}`).then(o).catch(j=>u(j.message))},250);return()=>clearTimeout(y)},[t,r]);const c=s?Object.values(s.counts).reduce((y,v)=>y+(v??0),0):0,p=(s==null?void 0:s.items.filter(y=>y.subscriptionStatus==="PAST_DUE").length)??0,h=(s==null?void 0:s.items.reduce((y,v)=>y+v.customers,0))??0,m=(s==null?void 0:s.counts.DRAFT)??0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",style:{alignItems:"flex-end"},children:[i.jsxs("div",{children:[i.jsx("h1",{children:"Magasins"}),i.jsxs("p",{className:"muted",style:{margin:0},children:[c," magasins inscrits"]})]}),i.jsx(Fe,{to:"/magasins/nouveau",className:"btn",children:"+ Nouveau magasin"})]}),i.jsxs("div",{className:"kpis",children:[i.jsxs("div",{className:"kpi ok",children:[i.jsx("b",{children:(s==null?void 0:s.counts.ACTIVE)??"—"}),i.jsx("span",{children:"magasins ouverts"})]}),i.jsxs("div",{className:`kpi${m?" warn":""}`,children:[i.jsx("b",{children:s?m:"—"}),i.jsx("span",{children:"en cours d’ouverture"})]}),i.jsxs("div",{className:`kpi${p?" err":""}`,children:[i.jsx("b",{children:s?p:"—"}),i.jsx("span",{children:"abonnements impayés"})]}),i.jsxs("div",{className:"kpi",children:[i.jsx("b",{children:s?h.toLocaleString("fr-FR"):"—"}),i.jsx("span",{children:"cartes clients"})]})]}),i.jsxs("div",{className:"row",children:[i.jsxs("div",{style:{flex:"1 1 320px",maxWidth:420},children:[i.jsx("label",{htmlFor:"search",className:"sr-only",children:"Rechercher un magasin"}),i.jsx("input",{id:"search",type:"search",className:"input",placeholder:"Rechercher par nom ou ville",value:t,onChange:y=>n(y.target.value)})]}),i.jsx("div",{role:"group","aria-label":"Filtrer par statut",className:"row",style:{gap:8},children:Pg.map(y=>i.jsxs("button",{type:"button",className:"chip","aria-pressed":r===y,onClick:()=>l(y),children:[y==="ALL"?"Tous":hf[y],i.jsx("span",{style:{opacity:.8,fontWeight:500},children:y==="ALL"?c:(s==null?void 0:s.counts[y])??0})]},y))})]}),a&&i.jsx("div",{className:"alert error",children:a}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:860},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Magasin"}),i.jsx("th",{scope:"col",children:"Ville"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",className:"num",children:"Clients"}),i.jsx("th",{scope:"col",children:"Abonnement"}),i.jsx("th",{scope:"col",children:"Créé le"})]})}),i.jsx("tbody",{children:s==null?void 0:s.items.map(y=>i.jsxs("tr",{className:"clickable",onClick:()=>e(`/magasins/${y.id}`),children:[i.jsx("td",{style:{paddingLeft:24},children:i.jsxs(Fe,{to:`/magasins/${y.id}`,style:{display:"inline-flex",alignItems:"center",gap:12,color:"var(--text)",fontWeight:600,textDecoration:"none"},children:[i.jsx("span",{style:{width:36,height:36,borderRadius:10,background:"var(--primary-soft)",color:"var(--primary)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:800},children:Tg(y.name)}),y.name]})}),i.jsx("td",{children:y.city}),i.jsx("td",{children:i.jsx(mf,{status:y.status})}),i.jsx("td",{className:"num",children:y.customers}),i.jsxs("td",{children:[Rg(y.subscriptionStatus),y.plan&&i.jsxs("span",{className:"muted",style:{fontSize:14},children:[" · ",_t[y.plan]]})]}),i.jsx("td",{className:"muted",children:new Date(y.createdAt).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})})]},y.id))})]})}),s&&s.items.length===0&&i.jsxs("div",{style:{padding:"48px 24px",textAlign:"center"},children:[i.jsx("strong",{children:"Aucun magasin trouvé"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Essayez un autre nom, une autre ville ou retirez le filtre de statut."})]})]})]})}const Ag={name:"",siret:"",addressLine:"",postalCode:"",city:"",contactName:"",contactEmail:"",contactPhone:"",maxAmountEuros:500,minScanIntervalMin:5};function gf({initial:e,submitLabel:t,onSubmit:n}){const[r,l]=w.useState(e),[s,o]=w.useState(null),[a,u]=w.useState(!1),c=m=>y=>l(v=>({...v,[m]:typeof v[m]=="number"?Number(y.target.value):y.target.value}));async function p(m){m.preventDefault(),u(!0),o(null);try{await n(r)}catch(y){o(y.message)}finally{u(!1)}}const h=(m,y,v={})=>i.jsxs("div",{className:"field",children:[i.jsxs("label",{htmlFor:m,children:[y," *"]}),i.jsx("input",{id:m,className:"input",required:!0,value:r[m],onChange:c(m),...v})]});return i.jsxs("form",{onSubmit:p,style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsx("p",{className:"muted",style:{margin:0},children:"Les champs marqués d'un astérisque (*) sont obligatoires."}),s&&i.jsx("div",{className:"alert error",role:"alert",children:s}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsx("h2",{children:"Commerce"}),i.jsxs("div",{className:"grid-2",children:[h("name","Nom du magasin"),h("siret","SIRET",{placeholder:"14 chiffres",inputMode:"numeric",pattern:"[0-9 ]{14,17}"})]}),h("addressLine","Adresse",{placeholder:"Numéro et nom de rue"}),i.jsxs("div",{className:"grid-2",children:[h("postalCode","Code postal",{placeholder:"5 chiffres",inputMode:"numeric",pattern:"[0-9]{5}"}),h("city","Ville")]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsx("h2",{children:"Contact"}),h("contactName","Nom du contact",{placeholder:"Prénom Nom"}),i.jsxs("div",{className:"grid-2",children:[h("contactEmail","E-mail",{type:"email",placeholder:"contact@exemple.fr"}),h("contactPhone","Téléphone",{type:"tel",placeholder:"06 12 34 56 78"})]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Anti-triche"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Limitent les crédits abusifs. Une opération hors limites est refusée et apparaît dans l'onglet Opérations."})]}),i.jsxs("div",{className:"grid-2",children:[i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"maxAmountEuros",children:"Plafond par opération (€) *"}),i.jsx("input",{id:"maxAmountEuros",className:"input",type:"number",min:1,max:1e4,required:!0,value:r.maxAmountEuros,onChange:c("maxAmountEuros")})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"minScanIntervalMin",children:"Délai minimum entre deux crédits (min) *"}),i.jsx("input",{id:"minScanIntervalMin",className:"input",type:"number",min:0,max:1440,required:!0,value:r.minScanIntervalMin,onChange:c("minScanIntervalMin")})]})]})]}),i.jsx("div",{children:i.jsx("button",{className:"btn",disabled:a,children:a?"Enregistrement…":t})})]})}function _g(){const e=Dt(),[t,n]=w.useState("PRO"),[r,l]=w.useState("MONTH"),[s,o]=w.useState(null);return s?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsxs("h1",{children:[s.name," est créé"]})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:12},children:[s.link.emailedTo?i.jsxs("div",{className:"alert ok",children:["Lien de paiement (formule ",_t[t],", ",r==="YEAR"?"annuelle":"mensuelle",") envoyé à ",i.jsx("strong",{children:s.link.emailedTo}),s.manager&&", avec ses identifiants Dirigeant",". Le magasin s'ouvrira automatiquement dès le paiement validé et la carte conçue."]}):i.jsxs("div",{className:"alert warn",children:["Le lien de paiement n'a pas pu être envoyé : ",s.link.error,". Renvoyez-le depuis l'onglet Facturation."]}),s.manager?i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{margin:0},children:["Compte Dirigeant : ",i.jsx("strong",{children:s.manager.email}),", mot de passe provisoire :"]}),i.jsx("div",{className:"password-box",children:s.manager.provisionalPassword})]}):i.jsx("div",{className:"alert warn",children:"Un compte existe déjà avec l'e-mail du contact : créez le Dirigeant à la main dans l'onglet Employés."}),i.jsx("div",{className:"row",style:{justifyContent:"flex-end"},children:i.jsx("button",{className:"btn",onClick:()=>e(`/magasins/${s.id}/carte`),children:"Concevoir la carte"})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsx("h1",{children:"Nouveau magasin"}),i.jsx("p",{className:"muted",style:{margin:0},children:"À la création, le contact reçoit automatiquement par e-mail le lien de paiement de la formule choisie et ses identifiants Dirigeant."})]}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsx("h2",{children:"Formule *"}),i.jsx("div",{role:"radiogroup","aria-label":"Formule",className:"row",style:{gap:8},children:["ESSENTIEL","PRO","RESEAU"].map(a=>i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":t===a,"aria-pressed":t===a,onClick:()=>n(a),children:_t[a]},a))}),i.jsxs("div",{role:"radiogroup","aria-label":"Périodicité",className:"row",style:{gap:8},children:[i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":r==="MONTH","aria-pressed":r==="MONTH",onClick:()=>l("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button",className:"chip",role:"radio","aria-checked":r==="YEAR","aria-pressed":r==="YEAR",onClick:()=>l("YEAR"),children:"Annuel — 2 mois offerts"})]})]}),i.jsx(gf,{initial:Ag,submitLabel:"Créer le magasin",onSubmit:async a=>{o(await $.post("/api/admin/stores",{...a,plan:t,interval:r}))}})]})}function vf({size:e}){const n=e/21,r=(s,o)=>i.jsxs("g",{children:[i.jsx("rect",{x:s*n,y:o*n,width:7*n,height:7*n,fill:"#000"}),i.jsx("rect",{x:(s+1)*n,y:(o+1)*n,width:5*n,height:5*n,fill:"#fff"}),i.jsx("rect",{x:(s+2)*n,y:(o+2)*n,width:3*n,height:3*n,fill:"#000"})]},`${s}-${o}`),l=[];for(let s=0;s<21;s++)for(let o=0;o<21;o++)!(o<8&&s<8||o>12&&s<8||o<8&&s>12)&&(o*7+s*13+o*s)%3===0&&l.push(i.jsx("rect",{x:o*n,y:s*n,width:n,height:n,fill:"#000"},`${o}.${s}`));return i.jsxs("svg",{width:e,height:e,"aria-hidden":"true",children:[i.jsx("rect",{width:e,height:e,fill:"#fff"}),r(0,0),r(14,0),r(0,14),l]})}function yf(e){return e.pointsMode==="STAMP"?{label:"TAMPONS",value:"7"}:{label:"POINTS",value:"120"}}function Ql(e){const t=e.pointsMode==="STAMP"?7:120,n=(e.rewards??[]).filter(s=>s.active!==!1&&s.label.trim()).sort((s,o)=>s.cost-o.cost);if(!n.length)return null;const r=n.filter(s=>s.cost<=t);if(r.length)return`${r[r.length-1].label} : disponible !`;const l=n[0].cost-t;return`${n[0].label} : encore ${l} ${e.pointsMode==="STAMP"?"tampon":"point"}${l>1?"s":""}`}function Mg({d:e}){const t=yf(e);return i.jsxs("div",{style:{width:320,borderRadius:14,overflow:"hidden",background:e.backgroundColor,color:e.foregroundColor,boxShadow:"0 12px 32px rgb(0 0 0 / 0.25)",fontFamily:"-apple-system, system-ui, sans-serif"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 14px",height:50},children:[e.logoUrl?i.jsx("img",{src:e.logoUrl,alt:"",style:{maxHeight:34,maxWidth:140,objectFit:"contain"}}):i.jsx("span",{style:{fontWeight:700},children:e.storeName}),i.jsxs("div",{style:{textAlign:"right"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:t.label}),i.jsx("div",{style:{fontSize:18},children:t.value})]})]}),i.jsx("div",{style:{position:"relative",height:123,background:e.stripUrl?`center/cover url(${e.stripUrl})`:"rgb(255 255 255 / 0.08)"},children:i.jsxs("div",{style:{position:"absolute",left:14,bottom:10},children:[i.jsx("div",{style:{fontSize:11,fontWeight:600,color:e.labelColor,textShadow:e.stripUrl?"0 1px 2px rgb(0 0 0 / 0.5)":void 0},children:"SOLDE"}),i.jsx("div",{style:{fontSize:36,lineHeight:1,textShadow:e.stripUrl?"0 1px 3px rgb(0 0 0 / 0.5)":void 0},children:t.value})]})}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"10px 14px"},children:[i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"PROGRAMME"}),i.jsx("div",{style:{fontSize:14},children:e.programName||"—"})]}),i.jsxs("div",{style:{textAlign:"right"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"MEMBRE"}),i.jsx("div",{style:{fontSize:14},children:"Camille"})]})]}),Ql(e)&&i.jsxs("div",{style:{padding:"0 14px 6px"},children:[i.jsx("div",{style:{fontSize:10,fontWeight:600,color:e.labelColor},children:"PROCHAINE RÉCOMPENSE"}),i.jsx("div",{style:{fontSize:14},children:Ql(e)})]}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"14px 0 20px"},children:i.jsx("div",{style:{background:"#fff",padding:8,borderRadius:6},children:i.jsx(vf,{size:120})})})]})}function zg({d:e}){const t=yf(e);return i.jsxs("div",{style:{width:320,borderRadius:20,overflow:"hidden",background:e.backgroundColor,color:e.foregroundColor,boxShadow:"0 12px 32px rgb(0 0 0 / 0.25)",fontFamily:"Roboto, system-ui, sans-serif"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px"},children:[i.jsx("span",{style:{width:32,height:32,borderRadius:"50%",background:"#fff",overflow:"hidden",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.logoUrl&&i.jsx("img",{src:e.logoUrl,alt:"",style:{width:"100%",height:"100%",objectFit:"contain"}})}),i.jsx("span",{style:{fontSize:14},children:e.storeName})]}),i.jsx("div",{style:{padding:"0 16px 12px",fontSize:22},children:e.programName||"—"}),i.jsxs("div",{style:{display:"flex",gap:32,padding:"0 16px 16px"},children:[i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:t.label==="POINTS"?"Points":"Tampons"}),i.jsx("div",{style:{fontSize:18},children:t.value})]}),i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:"Membre"}),i.jsx("div",{style:{fontSize:18},children:"Camille"})]})]}),Ql(e)&&i.jsxs("div",{style:{padding:"0 16px 12px"},children:[i.jsx("div",{style:{fontSize:11,opacity:.8},children:"Prochaine récompense"}),i.jsx("div",{style:{fontSize:15},children:Ql(e)})]}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0 16px"},children:i.jsx("div",{style:{background:"#fff",padding:10,borderRadius:12},children:i.jsx(vf,{size:120})})}),e.stripUrl&&i.jsx("img",{src:e.stripUrl,alt:"",style:{display:"block",width:"100%",aspectRatio:"1125 / 432",objectFit:"cover"}})]})}var Dr={},Ig=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},xf={},Te={};let oa;const Fg=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Te.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};Te.getSymbolTotalCodewords=function(t){return Fg[t]};Te.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};Te.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');oa=t};Te.isKanjiModeEnabled=function(){return typeof oa<"u"};Te.toSJIS=function(t){return oa(t)};var gs={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,l){if(e.isValid(r))return r;try{return t(r)}catch{return l}}})(gs);function wf(){this.buffer=[],this.length=0}wf.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Dg=wf;function Ur(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Ur.prototype.set=function(e,t,n,r){const l=e*this.size+t;this.data[l]=n,r&&(this.reservedBit[l]=!0)};Ur.prototype.get=function(e,t){return this.data[e*this.size+t]};Ur.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};Ur.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Ug=Ur,jf={};(function(e){const t=Te.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const l=Math.floor(r/7)+2,s=t(r),o=s===145?26:Math.ceil((s-13)/(2*l-2))*2,a=[s-7];for(let u=1;u=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const s=l.size;let o=0,a=0,u=0,c=null,p=null;for(let h=0;h=5&&(o+=t.N1+(a-5)),c=y,a=1),y=l.get(m,h),y===p?u++:(u>=5&&(o+=t.N1+(u-5)),p=y,u=1)}a>=5&&(o+=t.N1+(a-5)),u>=5&&(o+=t.N1+(u-5))}return o},e.getPenaltyN2=function(l){const s=l.size;let o=0;for(let a=0;a=10&&(a===1488||a===93)&&o++,u=u<<1&2047|l.get(p,c),p>=10&&(u===1488||u===93)&&o++}return o*t.N3},e.getPenaltyN4=function(l){let s=0;const o=l.data.length;for(let u=0;u=0;){const o=s[0];for(let u=0;u0){const s=new Uint8Array(this.degree);return s.set(r,l),s}return r};var Bg=aa,kf={},Ut={},ua={};ua.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var Je={};const Pf="[0-9]+",$g="[A-Z $%*+\\-./:]+";let Lr="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Lr=Lr.replace(/u/g,"\\u");const bg="(?:(?![A-Z0-9 $%*+\\-./:]|"+Lr+`)(?:.|[\r +]))+`;Je.KANJI=new RegExp(Lr,"g");Je.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Je.BYTE=new RegExp(bg,"g");Je.NUMERIC=new RegExp(Pf,"g");Je.ALPHANUMERIC=new RegExp($g,"g");const Vg=new RegExp("^"+Lr+"$"),Wg=new RegExp("^"+Pf+"$"),Hg=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Je.testKanji=function(t){return Vg.test(t)};Je.testNumeric=function(t){return Wg.test(t)};Je.testAlphanumeric=function(t){return Hg.test(t)};(function(e){const t=ua,n=Je;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return n.testNumeric(s)?e.NUMERIC:n.testAlphanumeric(s)?e.ALPHANUMERIC:n.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.ccBits};function r(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(s,o){if(e.isValid(s))return s;try{return r(s)}catch{return o}}})(Ut);(function(e){const t=Te,n=vs,r=gs,l=Ut,s=ua,o=7973,a=t.getBCHDigit(o);function u(m,y,v){for(let j=1;j<=40;j++)if(y<=e.getCapacity(j,v,m))return j}function c(m,y){return l.getCharCountIndicator(m,y)+4}function p(m,y){let v=0;return m.forEach(function(j){const C=c(j.mode,y);v+=C+j.getBitsLength()}),v}function h(m,y){for(let v=1;v<=40;v++)if(p(m,v)<=e.getCapacity(v,y,l.MIXED))return v}e.from=function(y,v){return s.isValid(y)?parseInt(y,10):v},e.getCapacity=function(y,v,j){if(!s.isValid(y))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=l.BYTE);const C=t.getSymbolTotalCodewords(y),f=n.getTotalCodewordsCount(y,v),d=(C-f)*8;if(j===l.MIXED)return d;const g=d-c(j,y);switch(j){case l.NUMERIC:return Math.floor(g/10*3);case l.ALPHANUMERIC:return Math.floor(g/11*2);case l.KANJI:return Math.floor(g/13);case l.BYTE:default:return Math.floor(g/8)}},e.getBestVersionForData=function(y,v){let j;const C=r.from(v,r.M);if(Array.isArray(y)){if(y.length>1)return h(y,C);if(y.length===0)return 1;j=y[0]}else j=y;return u(j.mode,j.getLength(),C)},e.getEncodedBits=function(y){if(!s.isValid(y)||y<7)throw new Error("Invalid QR Code version");let v=y<<12;for(;t.getBCHDigit(v)-a>=0;)v^=o<=0;)l^=Rf<0&&(r=this.data.substr(n),l=parseInt(r,10),t.put(l,s*3+1))};var Yg=_n;const Gg=Ut,Gs=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Mn(e){this.mode=Gg.ALPHANUMERIC,this.data=e}Mn.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};Mn.prototype.getLength=function(){return this.data.length};Mn.prototype.getBitsLength=function(){return Mn.getBitsLength(this.data.length)};Mn.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let r=Gs.indexOf(this.data[n])*45;r+=Gs.indexOf(this.data[n+1]),t.put(r,11)}this.data.length%2&&t.put(Gs.indexOf(this.data[n]),6)};var qg=Mn;const Jg=Ut;function zn(e){this.mode=Jg.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}zn.getBitsLength=function(t){return t*8};zn.prototype.getLength=function(){return this.data.length};zn.prototype.getBitsLength=function(){return zn.getBitsLength(this.data.length)};zn.prototype.write=function(e){for(let t=0,n=this.data.length;t=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` +Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var tv=In,Af={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,r,l){var s={},o={};o[r]=0;var a=t.PriorityQueue.make();a.push(r,0);for(var u,c,p,h,m,y,v,j,C;!a.empty();){u=a.pop(),c=u.value,h=u.cost,m=n[c]||{};for(p in m)m.hasOwnProperty(p)&&(y=m[p],v=h+y,j=o[p],C=typeof o[p]>"u",(C||j>v)&&(o[p]=v,a.push(p,v),s[p]=c))}if(typeof l<"u"&&typeof o[l]>"u"){var f=["Could not find a path from ",r," to ",l,"."].join("");throw new Error(f)}return s},extract_shortest_path_from_predecessor_list:function(n,r){for(var l=[],s=r;s;)l.push(s),n[s],s=n[s];return l.reverse(),l},find_path:function(n,r,l){var s=t.single_source_shortest_paths(n,r,l);return t.extract_shortest_path_from_predecessor_list(s,l)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,l={},s;n=n||{};for(s in r)r.hasOwnProperty(s)&&(l[s]=r[s]);return l.queue=[],l.sorter=n.sorter||r.default_sorter,l},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var l={value:n,cost:r};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Af);var nv=Af.exports;(function(e){const t=Ut,n=Yg,r=qg,l=Xg,s=tv,o=Je,a=Te,u=nv;function c(f){return unescape(encodeURIComponent(f)).length}function p(f,d,g){const x=[];let N;for(;(N=f.exec(g))!==null;)x.push({data:N[0],index:N.index,mode:d,length:N[0].length});return x}function h(f){const d=p(o.NUMERIC,t.NUMERIC,f),g=p(o.ALPHANUMERIC,t.ALPHANUMERIC,f);let x,N;return a.isKanjiModeEnabled()?(x=p(o.BYTE,t.BYTE,f),N=p(o.KANJI,t.KANJI,f)):(x=p(o.BYTE_KANJI,t.BYTE,f),N=[]),d.concat(g,x,N).sort(function(E,P){return E.index-P.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function m(f,d){switch(d){case t.NUMERIC:return n.getBitsLength(f);case t.ALPHANUMERIC:return r.getBitsLength(f);case t.KANJI:return s.getBitsLength(f);case t.BYTE:return l.getBitsLength(f)}}function y(f){return f.reduce(function(d,g){const x=d.length-1>=0?d[d.length-1]:null;return x&&x.mode===g.mode?(d[d.length-1].data+=g.data,d):(d.push(g),d)},[])}function v(f){const d=[];for(let g=0;g=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?e.set(s+a,o+u,!0,!0):e.set(s+a,o+u,!1,!0))}}function dv(e){const t=e.size;for(let n=8;n>a&1)===1,e.set(l,s,o,!0),e.set(s,l,o,!0)}function Xs(e,t,n){const r=e.size,l=av.getEncodedBits(t,n);let s,o;for(s=0;s<15;s++)o=(l>>s&1)===1,s<6?e.set(s,8,o,!0):s<8?e.set(s+1,8,o,!0):e.set(r-15+s,8,o,!0),s<8?e.set(8,r-s-1,o,!0):s<9?e.set(8,15-s-1+1,o,!0):e.set(8,15-s-1,o,!0);e.set(r-8,8,1,!0)}function hv(e,t){const n=e.size;let r=-1,l=n-1,s=7,o=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!e.isReserved(l,a-u)){let c=!1;o>>s&1)===1),e.set(l,a-u,c),s--,s===-1&&(o++,s=7)}if(l+=r,l<0||n<=l){l-=r,r=-r;break}}}function mv(e,t,n){const r=new rv;n.forEach(function(u){r.put(u.mode.bit,4),r.put(u.getLength(),uv.getCharCountIndicator(u.mode,e)),u.write(r)});const l=xs.getSymbolTotalCodewords(e),s=lo.getTotalCodewordsCount(e,t),o=(l-s)*8;for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(o-r.getLengthInBits())/8;for(let u=0;u=7&&pv(u,t),hv(u,o),isNaN(r)&&(r=ro.getBestMask(u,Xs.bind(null,u,n))),ro.applyMask(r,u),Xs(u,n,r),{modules:u,version:t,errorCorrectionLevel:n,maskPattern:r,segments:l}}xf.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let r=qs.M,l,s;return typeof n<"u"&&(r=qs.from(n.errorCorrectionLevel,qs.M),l=Yl.from(n.version),s=ro.from(n.maskPattern),n.toSJISFunc&&xs.setToSJISFunction(n.toSJISFunc)),vv(t,l,r,s)};var Mf={},ca={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(s){return[s,s]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,s=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:s,scale:s?4:o,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const s=e.getScale(r,l);return Math.floor((r+l.margin*2)*s)},e.qrToImageData=function(r,l,s){const o=l.modules.size,a=l.modules.data,u=e.getScale(o,s),c=Math.floor((o+s.margin*2)*u),d=s.margin*u,h=[s.color.light,s.color.dark];for(let g=0;g=d&&x>=d&&g"u"&&(!o||!o.getContext)&&(u=o,o=void 0),o||(c=r()),u=t.getOptions(u);const d=t.getImageWidth(s.modules.size,u),h=c.getContext("2d"),g=h.createImageData(d,d);return t.qrToImageData(g.data,s,u),n(h,c,d),h.putImageData(g,0,0),c},e.renderToDataURL=function(s,o,a){let u=a;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),u||(u={});const c=e.render(s,o,u),d=u.type||"image/png",h=u.rendererOpts||{};return c.toDataURL(d,h.quality)}})(Mf);var Af={};const yv=ca;function Mu(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function Zs(e,t,n){let r=e+t;return typeof n<"u"&&(r+=" "+n),r}function xv(e,t,n){let r="",l=0,s=!1,o=0;for(let a=0;a0&&u>0&&e[a-1]||(r+=s?Zs("M",u+n,.5+c+n):Zs("m",l,0),l=0,s=!1),u+1':"",c="',d='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` -`;return typeof r=="function"&&r(null,g),g};const wv=Ig,so=xf,zf=Mf,jv=Af;function da(e,t,n,r,l){const s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!wv())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(l=n,n=t,t=r=void 0):o===3&&(t.getContext&&typeof l>"u"?(l=r,r=void 0):(l=r,r=n,n=t,t=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(n=t,t=r=void 0):o===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(u,c){try{const d=so.create(n,r);u(e(d,t,r))}catch(d){c(d)}})}try{const u=so.create(n,r);l(null,e(u,t,r))}catch(u){l(u)}}Dr.create=so.create;Dr.toCanvas=da.bind(null,zf.render);Dr.toDataURL=da.bind(null,zf.renderToDataURL);Dr.toString=da.bind(null,function(e,t,n){return jv.render(e,n)});const Sv={A5:{w:148,h:210,pad:12,logo:14,store:6,eyebrow:3.8,title:10,qr:66,qrWithRewards:50,body:4.5,small:4,maxRewards:4},A6:{w:105,h:148,pad:8,logo:10,store:4.5,eyebrow:3,title:7,qr:46,qrWithRewards:34,body:3.4,small:3.1,maxRewards:3}};function If(e){const t=Sv[e.format],n=(e.rewards??[]).filter(c=>c.active!==!1&&c.label.trim()).sort((c,d)=>c.cost-d.cost),r=n.slice(0,t.maxRewards),l=e.pointsMode==="STAMP"?"tampons":"points",s=r.length?t.qrWithRewards:t.qr,[o,a]=w.useState("");w.useEffect(()=>{Dr.toString(e.url,{type:"svg",errorCorrectionLevel:"Q",margin:0,color:{dark:"#111111",light:"#FFFFFF"}}).then(a)},[e.url]);const u=c=>`${c}mm`;return i.jsxs("div",{className:"poster",style:{width:u(t.w),height:u(t.h),padding:u(t.pad),boxSizing:"border-box",background:e.backgroundColor,color:e.foregroundColor,fontFamily:"'Figtree', system-ui, sans-serif",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between",textAlign:"center",overflow:"hidden",printColorAdjust:"exact",WebkitPrintColorAdjust:"exact"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u(3)},children:[e.logoUrl&&i.jsx("img",{src:e.logoUrl,alt:"",style:{width:u(t.logo),height:u(t.logo),objectFit:"contain",borderRadius:u(2.5),background:"#fff"}}),i.jsx("span",{style:{fontSize:u(t.store),fontWeight:700},children:e.storeName})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:u(2.5)},children:[i.jsx("span",{style:{fontSize:u(t.eyebrow),fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:e.labelColor},children:e.programName}),i.jsx("span",{style:{fontSize:u(t.title),lineHeight:1.12,fontWeight:800,letterSpacing:"-0.02em",maxWidth:"92%"},children:"Scannez pour obtenir votre carte de fidélité"})]}),i.jsx("div",{role:"img","aria-label":"QR code d'inscription",style:{background:"#fff",borderRadius:u(3.5),padding:u(4),width:u(s),height:u(s),boxSizing:"content-box"},dangerouslySetInnerHTML:{__html:o}}),r.length>0&&i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:u(1.6)},children:[i.jsx("span",{style:{fontSize:u(t.small),fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:e.labelColor},children:"Vos récompenses"}),i.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:u(1.2)},children:r.map(c=>i.jsxs("li",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:u(3),padding:`${u(1.4)} ${u(3)}`,borderRadius:u(2.5),background:"rgba(255,255,255,0.12)",fontSize:u(t.body),lineHeight:1.25},children:[i.jsx("span",{style:{fontWeight:700,textAlign:"left"},children:c.label}),i.jsxs("span",{style:{whiteSpace:"nowrap",color:e.labelColor,fontWeight:600},children:[c.cost," ",l]})]},`${c.label}-${c.cost}`))}),n.length>r.length&&i.jsxs("span",{style:{fontSize:u(t.small),color:e.labelColor},children:["et ",n.length-r.length," autre(s) à découvrir sur votre carte"]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:u(1.5)},children:[i.jsx("span",{style:{fontSize:u(t.body),lineHeight:1.4,fontWeight:600},children:"Ajoutez-la à Apple Wallet ou Google Wallet."}),i.jsx("span",{style:{fontSize:u(t.small),lineHeight:1.4,color:e.labelColor},children:"Gratuit, sans application à télécharger."})]})]})}function Ff(e){return new Promise((t,n)=>{const r=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(r),t(l)},l.onerror=()=>n(new Error("Image illisible")),l.src=r})}function Df(e){return new Promise((t,n)=>e.toBlob(r=>r?t(r):n(new Error("Conversion impossible")),"image/png"))}async function Nv(e){const t=await Ff(e),n=1125,r=432,l=Math.max(n/t.width,r/t.height),s=n/l,o=r/l,a=Object.assign(document.createElement("canvas"),{width:n,height:r});return a.getContext("2d").drawImage(t,(t.width-s)/2,(t.height-o)/2,s,o,0,0,n,r),Df(a)}async function Cv(e){const t=await Ff(e),n=Math.min(1,480/Math.max(t.width,t.height)),r=Object.assign(document.createElement("canvas"),{width:Math.round(t.width*n),height:Math.round(t.height*n)});return r.getContext("2d").drawImage(t,0,0,r.width,r.height),Df(r)}async function Ev(e){const t=new Image;t.crossOrigin="anonymous",t.src=e;try{await t.decode()}catch{return null}const r=Object.assign(document.createElement("canvas"),{width:48,height:48}).getContext("2d");r.drawImage(t,0,0,48,48);let l;try{l=r.getImageData(0,0,48,48).data}catch{return null}const s=new Map;for(let u=0;u235&&d>235&&h>235)continue;const x=`${c>>5}${d>>5}${h>>5}`,v=s.get(x)??{n:0,r:0,g:0,b:0};s.set(x,{n:v.n+1,r:v.r+c,g:v.g+d,b:v.b+h})}const o=[...s.values()].sort((u,c)=>c.n-u.n)[0];if(!o)return null;const a=u=>Math.round(u/o.n).toString(16).padStart(2,"0");return`#${a(o.r)}${a(o.g)}${a(o.b)}`.toUpperCase()}function Au(e,t){const n=s=>{const[o,a,u]=[1,3,5].map(c=>{const d=parseInt(s.slice(c,c+2),16)/255;return d<=.03928?d/12.92:((d+.055)/1.055)**2.4});return .2126*o+.7152*a+.0722*u},[r,l]=[n(e),n(t)].sort((s,o)=>o-s);return(r+.05)/(l+.05)}const ei=["Identité","Couleurs","Règle de points","Récompenses","Récapitulatif"];function kv(e){return{programName:`Fidélité ${e.name}`.slice(0,40),backgroundColor:"#1F2937",foregroundColor:"#FFFFFF",labelColor:"#D1D5DB",pointsMode:"AMOUNT",pointsPerEuro:1,rewards:[]}}function Uf({store:e,onSaved:t,base:n=`/api/admin/stores/${e.id}/card-design`,posterHref:r=`/magasins/${e.id}/affichette`,draftNote:l}){const[s,o]=w.useState(0),[a,u]=w.useState(null),[c,d]=w.useState({logoUrl:null,stripUrl:null}),[h,g]=w.useState(!1),[x,v]=w.useState("apple"),[j,C]=w.useState(null),[p,f]=w.useState(!1),[m,y]=w.useState(null);function N(L){const{logoUrl:ne,stripUrl:je,...Ve}=L;u(Ve),d({logoUrl:eo(ne),stripUrl:eo(je)}),g(!0)}if(w.useEffect(()=>{$.get(n).then(L=>L?N(L):u(kv(e))).catch(L=>C(L.message))},[n,e]),w.useEffect(()=>{c.logoUrl&&Ev(c.logoUrl).then(y)},[c.logoUrl]),!a)return j?i.jsx("div",{className:"alert error",children:j}):i.jsx("p",{className:"muted",children:"Chargement…"});const S=(L,ne)=>u({...a,[L]:ne});async function E(){C(null),f(!0);try{const{programName:L,backgroundColor:ne,foregroundColor:je,labelColor:Ve,pointsMode:Xe,pointsPerEuro:R}=a,M=a.rewards.map(({id:A,label:W,cost:X,active:nn})=>({id:A,label:W,cost:X,active:nn}));return N(await $.put(n,{programName:L,backgroundColor:ne,foregroundColor:je,labelColor:Ve,pointsMode:Xe,pointsPerEuro:R,rewards:M})),t(),!0}catch(L){return C(L.message),!1}finally{f(!1)}}async function P(){await E()&&o(L=>Math.min(L+1,ei.length-1))}async function z(L,ne){var Ve;const je=(Ve=ne.target.files)==null?void 0:Ve[0];if(ne.target.value="",!!je&&!(!h&&!await E())){f(!0),C(null);try{const Xe=L==="logo"?await Cv(je):await Nv(je),R=new FormData;R.append("file",Xe,`${L}.png`),N(await $.post(`${n}/images/${L}`,R))}catch(Xe){C(Xe.message)}finally{f(!1)}}}const _={...a,...c,storeName:e.name},Y=Au(a.backgroundColor,a.foregroundColor),Te=Au(a.backgroundColor,a.labelColor);return i.jsxs("div",{className:"wizard",children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsx("ol",{className:"steps","aria-label":"Étapes",children:ei.map((L,ne)=>i.jsx("li",{children:i.jsxs("button",{type:"button","aria-current":ne===s?"step":void 0,onClick:()=>o(ne),children:[ne+1," · ",L]})},L))}),j&&i.jsx("div",{className:"alert error",role:"alert",children:j}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[s===0&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Identité"}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"programName",children:"Nom du programme *"}),i.jsx("input",{id:"programName",className:"input",maxLength:40,value:a.programName,onChange:L=>S("programName",L.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("span",{style:{fontWeight:600},children:"Logo"}),i.jsxs("div",{className:"upload-drop",children:[c.logoUrl&&i.jsx("img",{src:c.logoUrl,alt:"Logo actuel"}),i.jsxs("label",{className:"btn secondary small",children:[c.logoUrl?"Remplacer":"Choisir un fichier",i.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:L=>z("logo",L),disabled:p})]}),i.jsx("span",{className:"hint",children:"PNG carré conseillé, fond transparent."})]})]}),i.jsxs("div",{className:"field",children:[i.jsx("span",{style:{fontWeight:600},children:"Bandeau"}),i.jsxs("div",{className:"upload-drop",children:[c.stripUrl&&i.jsx("img",{src:c.stripUrl,alt:"Bandeau actuel"}),i.jsxs("label",{className:"btn secondary small",children:[c.stripUrl?"Remplacer":"Choisir un fichier",i.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:L=>z("strip",L),disabled:p})]}),i.jsx("span",{className:"hint",children:"Recadré automatiquement au format Wallet (1125 × 432)."})]})]})]}),s===1&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Couleurs"}),m&&m!==a.backgroundColor&&i.jsxs("div",{className:"row",style:{gap:12},children:[i.jsx("span",{style:{width:28,height:28,borderRadius:8,background:m,border:"1px solid var(--border)"}}),i.jsxs("span",{children:["Couleur extraite du logo : ",m]}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:()=>S("backgroundColor",m),children:"Utiliser comme fond"})]}),[["backgroundColor","Fond"],["foregroundColor","Texte"],["labelColor","Libellés"]].map(([L,ne])=>i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:L,children:ne}),i.jsxs("div",{className:"color-row",children:[i.jsx("input",{type:"color","aria-label":`${ne} (sélecteur)`,value:a[L],onChange:je=>S(L,je.target.value.toUpperCase())}),i.jsx("input",{id:L,className:"input",style:{maxWidth:160},value:a[L],pattern:"#[0-9A-Fa-f]{6}",onChange:je=>S(L,je.target.value)})]})]},L)),Y<4.5&&i.jsxs("div",{className:"alert warn",children:["Contraste texte/fond insuffisant (",Y.toFixed(1),":1, minimum 4,5:1) : le solde sera difficile à lire."]}),Te<3&&i.jsxs("div",{className:"alert warn",children:["Contraste libellés/fond faible (",Te.toFixed(1),":1, minimum conseillé 3:1)."]})]}),s===2&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Règle de points"}),i.jsxs("div",{className:"mode-cards",role:"radiogroup",children:[i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"mode",checked:a.pointsMode==="AMOUNT",onChange:()=>S("pointsMode","AMOUNT")}),i.jsxs("span",{children:[i.jsx("strong",{children:"Points selon le montant"}),i.jsx("br",{}),i.jsx("span",{className:"muted",children:"X points par euro dépensé"})]})]}),i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"mode",checked:a.pointsMode==="STAMP",onChange:()=>S("pointsMode","STAMP")}),i.jsxs("span",{children:[i.jsx("strong",{children:"Tampons"}),i.jsx("br",{}),i.jsx("span",{className:"muted",children:"1 tampon par passage"})]})]})]}),a.pointsMode==="AMOUNT"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"ppe",children:"Points par euro *"}),i.jsx("input",{id:"ppe",className:"input",type:"number",step:"0.01",min:.01,max:100,style:{maxWidth:160},value:a.pointsPerEuro,onChange:L=>S("pointsPerEuro",Number(L.target.value))})]}),i.jsxs("p",{className:"muted",style:{margin:0},children:["Exemple : un panier de 23,50 € = ",i.jsxs("strong",{children:[Math.floor(23.5*a.pointsPerEuro)," points"]})," (arrondi à l'inférieur)."]})]}):i.jsx("p",{className:"muted",style:{margin:0},children:"Chaque passage validé par un employé ajoute un tampon, quel que soit le montant."})]}),s===3&&i.jsx(Pv,{rewards:a.rewards,unit:a.pointsMode==="STAMP"?"tampons":"points",onChange:L=>S("rewards",L)}),s===4&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Récapitulatif"}),i.jsxs("ul",{style:{margin:0,paddingLeft:20,lineHeight:1.8},children:[i.jsxs("li",{children:["Programme : ",i.jsx("strong",{children:a.programName})]}),i.jsxs("li",{children:["Règle : ",a.pointsMode==="STAMP"?"1 tampon par passage":`${a.pointsPerEuro} point(s) par euro`]}),i.jsxs("li",{children:["Récompenses : ",a.rewards.filter(L=>L.active!==!1).map(L=>`${L.label} (${L.cost})`).join(", ")||"aucune"]}),i.jsxs("li",{children:["Logo : ",c.logoUrl?"oui":i.jsx("span",{style:{color:"var(--warn)"},children:"manquant"})," · Bandeau : ",c.stripUrl?"oui":"non"]})]}),i.jsx("h3",{style:{margin:"8px 0 0"},children:"Affichette du comptoir"}),i.jsxs("div",{style:{display:"flex",gap:24,flexWrap:"wrap",alignItems:"flex-start"},children:[i.jsx("div",{style:{width:222,height:315,overflow:"hidden",borderRadius:8,boxShadow:"0 4px 16px rgb(0 0 0 / 0.15)"},children:i.jsx("div",{style:{transform:"scale(0.4)",transformOrigin:"top left"},children:i.jsx(If,{format:"A5",url:e.enrollUrl,storeName:e.name,programName:a.programName,logoUrl:c.logoUrl,backgroundColor:a.backgroundColor,foregroundColor:a.foregroundColor,labelColor:a.labelColor,rewards:a.rewards,pointsMode:a.pointsMode})})}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,flex:"1 1 220px"},children:[i.jsx("p",{style:{margin:0},children:"Le QR mène à la page d'inscription :"}),i.jsx("a",{href:e.enrollUrl,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:e.enrollUrl}),i.jsx(Fe,{to:r,className:"btn secondary",children:"Imprimer l'affichette (A5 / A6)"})]})]}),e.status==="DRAFT"&&(l??i.jsxs("p",{style:{margin:0},children:["Le programme s'ouvre automatiquement dès que l'abonnement est payé. Sinon, utilisez le bouton ",i.jsx("strong",{children:"Activer"})," en haut de la fiche."]}))]}),i.jsxs("div",{className:"row between",children:[i.jsx("button",{type:"button",className:"btn secondary",disabled:s===0,onClick:()=>o(s-1),children:"Précédent"}),sv("apple"),children:"Apple Wallet"}),i.jsx("button",{type:"button",className:"chip","aria-pressed":x==="google",onClick:()=>v("google"),children:"Google Wallet"})]}),x==="apple"?i.jsx(Ag,{d:_}):i.jsx(zg,{d:_}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Aperçu indicatif — QR et solde fictifs."})]})]})}function Pv({rewards:e,unit:t,onChange:n}){const r=(l,s)=>n(e.map((o,a)=>a===l?{...o,...s}:o));return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Récompenses"}),e.length===0&&i.jsxs("p",{className:"muted",style:{margin:0},children:["Aucune récompense. Exemple : « Café offert » pour 10 ",t,"."]}),e.map((l,s)=>i.jsxs("div",{className:"row",style:{alignItems:"flex-end",opacity:l.active===!1?.6:1},children:[i.jsxs("div",{className:"field",style:{flex:"1 1 240px"},children:[i.jsx("label",{htmlFor:`rw-label-${s}`,children:"Libellé"}),i.jsx("input",{id:`rw-label-${s}`,className:"input",maxLength:60,value:l.label,onChange:o=>r(s,{label:o.target.value})})]}),i.jsxs("div",{className:"field",style:{width:140},children:[i.jsxs("label",{htmlFor:`rw-cost-${s}`,children:["Coût (",t,")"]}),i.jsx("input",{id:`rw-cost-${s}`,className:"input",type:"number",min:1,value:l.cost,onChange:o=>r(s,{cost:Number(o.target.value)})})]}),l.active===!1?i.jsx("button",{type:"button",className:"btn secondary",onClick:()=>r(s,{active:!0}),children:"Réactiver"}):i.jsx("button",{type:"button",className:"btn secondary","aria-label":`Retirer ${l.label||"la récompense"}`,onClick:()=>n(e.filter((o,a)=>a!==s)),children:"Retirer"})]},l.id??`new-${s}`)),i.jsx("div",{children:i.jsx("button",{type:"button",className:"btn secondary",disabled:e.length>=20,onClick:()=>n([...e,{label:"",cost:10}]),children:"+ Ajouter une récompense"})})]})}const Of={MANAGER:"Dirigeant",EMPLOYEE:"Employé"};function Rv({storeId:e}){const t=`/api/admin/stores/${e}/staff`,[n,r]=w.useState([]),[l,s]=w.useState(null),[o,a]=w.useState(null),u=w.useRef(null),c=w.useRef(null),d=w.useCallback(()=>{$.get(t).then(r).catch(v=>s(v.message))},[t]);w.useEffect(d,[d]);function h(v){var j;a(v),(j=c.current)==null||j.showModal(),d()}async function g(v){try{await $.patch(`${t}/${v.id}`,{active:!v.active}),d()}catch(j){s(j.message)}}async function x(v){if(window.confirm(`Générer un nouveau mot de passe pour ${v.displayName} ? Ses sessions seront fermées.`))try{h(await $.post(`${t}/${v.id}/reset-password`))}catch(j){s(j.message)}}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",children:[i.jsx("h2",{children:"Employés"}),i.jsx("button",{className:"btn",onClick:()=>{var v;return(v=u.current)==null?void 0:v.showModal()},children:"+ Nouvel employé"})]}),l&&i.jsx("div",{className:"alert error",role:"alert",children:l}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:720},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Nom"}),i.jsx("th",{scope:"col",children:"E-mail"}),i.jsx("th",{scope:"col",children:"Rôle"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",children:i.jsx("span",{className:"sr-only",children:"Actions"})})]})}),i.jsx("tbody",{children:n.map(v=>i.jsxs("tr",{style:{opacity:v.active?1:.6},children:[i.jsx("td",{style:{paddingLeft:24,fontWeight:600},children:v.displayName}),i.jsx("td",{children:v.email}),i.jsx("td",{children:Of[v.role]}),i.jsx("td",{children:v.active?i.jsx("span",{className:"badge ACTIVE",children:"Actif"}):i.jsx("span",{className:"badge DRAFT",children:"Désactivé"})}),i.jsxs("td",{style:{textAlign:"right",whiteSpace:"nowrap"},children:[i.jsx("button",{className:"btn secondary small",onClick:()=>x(v),children:"Nouveau mot de passe"})," ",i.jsx("button",{className:"btn secondary small",onClick:()=>g(v),children:v.active?"Désactiver":"Réactiver"})]})]},v.id))})]})}),n.length===0&&i.jsx("p",{className:"muted",style:{padding:24,margin:0,textAlign:"center"},children:"Aucun employé. Créez au moins un dirigeant pour que le magasin puisse utiliser l'app Pro."})]}),i.jsx("dialog",{ref:u,"aria-labelledby":"new-staff-title",children:i.jsx(Tv,{base:t,onCancel:()=>{var v;return(v=u.current)==null?void 0:v.close()},onCreated:v=>{var j;(j=u.current)==null||j.close(),h(v)}})}),i.jsx("dialog",{ref:c,"aria-labelledby":"pwd-title",children:i.jsxs("div",{className:"dialog-body",children:[i.jsx("h2",{id:"pwd-title",children:"Mot de passe provisoire"}),i.jsxs("p",{style:{margin:0},children:["Communiquez-le à ",i.jsx("strong",{children:o==null?void 0:o.displayName})," (",o==null?void 0:o.email,"). Il ne sera plus affiché ensuite."]}),i.jsx("div",{className:"password-box",children:o==null?void 0:o.provisionalPassword}),i.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[i.jsx("button",{className:"btn secondary",onClick:()=>{var v;return(v=navigator.clipboard)==null?void 0:v.writeText((o==null?void 0:o.provisionalPassword)??"")},children:"Copier"}),i.jsx("button",{className:"btn",onClick:()=>{var v;return(v=c.current)==null?void 0:v.close()},children:"J'ai noté le mot de passe"})]})]})})]})}function Tv({base:e,onCancel:t,onCreated:n}){const[r,l]=w.useState(""),[s,o]=w.useState(""),[a,u]=w.useState("EMPLOYEE"),[c,d]=w.useState(null),[h,g]=w.useState(!1);async function x(v){v.preventDefault(),g(!0),d(null);try{n(await $.post(e,{displayName:r,email:s,role:a})),l(""),o(""),u("EMPLOYEE")}catch(j){d(j.message)}finally{g(!1)}}return i.jsxs("form",{className:"dialog-body",onSubmit:x,children:[i.jsx("h2",{id:"new-staff-title",children:"Nouvel employé"}),c&&i.jsx("div",{className:"alert error",role:"alert",children:c}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"staff-name",children:"Prénom et nom *"}),i.jsx("input",{id:"staff-name",className:"input",required:!0,placeholder:"Prénom Nom",value:r,onChange:v=>l(v.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"staff-email",children:"E-mail *"}),i.jsx("input",{id:"staff-email",className:"input",type:"email",required:!0,placeholder:"prenom@exemple.fr",value:s,onChange:v=>o(v.target.value)})]}),i.jsxs("fieldset",{style:{border:0,padding:0,margin:0},className:"field",children:[i.jsx("legend",{style:{fontWeight:600,marginBottom:6},children:"Rôle *"}),i.jsx("div",{className:"mode-cards",children:["EMPLOYEE","MANAGER"].map(v=>i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"role",checked:a===v,onChange:()=>u(v)}),i.jsxs("span",{children:[i.jsx("strong",{children:Of[v]}),i.jsx("br",{}),i.jsx("span",{className:"muted",style:{fontSize:14},children:v==="MANAGER"?"Toute la configuration : carte, modules, campagnes, employés, statistiques":"Scanne les cartes et crédite les points, voit ses opérations"})]})]},v))})]}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Un mot de passe provisoire sera généré à la création."}),i.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",className:"btn secondary",onClick:t,children:"Annuler"}),i.jsx("button",{className:"btn",disabled:h,children:"Créer le compte"})]})]})}const zu={ACTIVE:["Actif","ACTIVE"],INCOMPLETE:["En attente de paiement","DRAFT"],PAST_DUE:["Impayé","SUSPENDED"],CANCELED:["Résilié","CLOSED"]},Lv={multiStore:"Carte commune à plusieurs magasins"},Iu=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",minimumFractionDigits:e%100?2:0}),Gn=e=>new Date(e).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});function _v({storeId:e,contactEmail:t,onChange:n}){const[r,l]=w.useState(null),[s,o]=w.useState(null),[a,u]=w.useState(null),[c,d]=w.useState(!1),[h,g]=w.useState(null),[x,v]=w.useState(null),j=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/billing`).then(l).catch(S=>o(S.message))},[e]);w.useEffect(j,[j]);async function C(S,E,P){d(!0),o(null);try{const z=await $.post(E,P);u({...z,label:S}),j(),n()}catch(z){o(z.message)}finally{d(!1)}}if(!r)return s?i.jsx("div",{className:"alert error",children:s}):i.jsx("p",{className:"muted",children:"Chargement…"});const p=r.subscription,f=p&&p.status!=="CANCELED"&&p.hasSubscription?r.catalog.find(S=>S.plan===p.plan):null,m=!f,y=h??(p==null?void 0:p.plan)??"PRO",N=x??(p==null?void 0:p.interval)??"MONTH";return i.jsxs(i.Fragment,{children:[r.testMode&&i.jsx("div",{className:"alert warn",children:"Stripe est en mode test : aucun paiement réel n'est encaissé (carte de test 4242 4242 4242 4242)."}),s&&i.jsx("div",{className:"alert error",role:"alert",children:s}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{className:"row between",children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Abonnement"}),i.jsx("p",{className:"muted",style:{margin:0},children:f?`Formule ${f.name}${p.legacyPrice?" (tarif fondateur)":""} — ${p.interval==="YEAR"?"annuelle":"mensuelle"}`:"Aucune formule souscrite. Sans abonnement actif, le magasin a les droits de la formule Essentiel."})]}),i.jsx("span",{className:`badge ${p?zu[p.status][1]:"DRAFT"}`,children:p?zu[p.status][0]:"Aucun abonnement"})]}),(p==null?void 0:p.cancelAtPeriodEnd)&&p.currentPeriodEnd&&i.jsxs("div",{className:"alert warn",children:["Résiliation demandée : l'abonnement s'arrête le ",i.jsx("strong",{children:Gn(p.currentPeriodEnd)}),"."]}),(p==null?void 0:p.currentPeriodEnd)&&p.status==="ACTIVE"&&!p.cancelAtPeriodEnd&&i.jsxs("p",{style:{margin:0},children:["Prochain prélèvement le ",i.jsx("strong",{children:Gn(p.currentPeriodEnd)}),"."]}),r.billingSuspended&&i.jsx("div",{className:"alert warn",children:"Magasin suspendu automatiquement pour impayé. Il sera réactivé dès que le paiement passera."}),f&&i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsxs("button",{className:"btn",disabled:c,onClick:()=>C("Espace abonnement",`/api/admin/stores/${e}/billing/portal-link`,{sendEmail:!0}),children:["Envoyer l'espace abonnement à ",t]}),i.jsx("button",{className:"btn secondary",disabled:c,onClick:()=>C("Espace abonnement",`/api/admin/stores/${e}/billing/portal-link`,{sendEmail:!1}),children:"Ouvrir l'espace abonnement"}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Changer de formule, de moyen de paiement, résilier."})]})]}),m&&i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsxs("div",{className:"row between",children:[i.jsx("h2",{children:"Choisir une formule"}),i.jsxs("div",{role:"group","aria-label":"Périodicité",className:"row",style:{gap:8},children:[i.jsx("button",{type:"button",className:"chip","aria-pressed":N==="MONTH",onClick:()=>v("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button",className:"chip","aria-pressed":N==="YEAR",onClick:()=>v("YEAR"),children:"Annuel — 2 mois offerts"})]})]}),i.jsx("div",{className:"mode-cards",role:"radiogroup","aria-label":"Formule",children:r.catalog.map(S=>i.jsxs("label",{className:"mode-card",style:{flexDirection:"column",gap:8},children:[i.jsxs("span",{className:"row",style:{gap:10},children:[i.jsx("input",{type:"radio",name:"plan",checked:y===S.plan,onChange:()=>g(S.plan)}),i.jsx("strong",{style:{fontSize:18},children:S.name}),S.plan==="PRO"&&i.jsx("span",{className:"badge ACTIVE",style:{height:22},children:"Conseillée"})]}),i.jsxs("span",{style:{fontSize:24,fontWeight:800},children:[Iu(S.priceCents[N]),i.jsxs("span",{className:"muted",style:{fontSize:14,fontWeight:500},children:[" / ",N==="YEAR"?"an":"mois",S.plan==="RESEAU"?" / magasin":""]})]}),i.jsx("span",{className:"muted",style:{fontSize:14},children:S.tagline}),i.jsxs("ul",{style:{margin:0,paddingLeft:18,fontSize:14,lineHeight:1.6},children:[i.jsx("li",{children:S.limits.maxStaff?`${S.limits.maxStaff} employés`:"Employés illimités"}),i.jsx("li",{children:"Carte Wallet, points ou tampons, récompenses, mises à jour en direct"}),S.features.map(E=>i.jsx("li",{children:Lv[E]??E},E))]}),i.jsx("span",{style:{fontSize:14,fontWeight:700},children:S.modules.length?`Modules inclus (${S.modules.length})`:"Aucun module inclus"}),S.modules.length>0&&i.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:14,lineHeight:1.6},children:S.modules.map(E=>i.jsx("li",{title:E.tagline,children:E.name},E.id))})]},S.plan))}),i.jsxs("p",{className:"muted",style:{margin:0,fontSize:14},children:["Lien permanent (il ne périme pas) : ",i.jsx("a",{href:r.subscribeUrl,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:r.subscribeUrl}),". Le commerçant pourra saisir un code promo sur la page de paiement (codes à créer dans Stripe → Coupons)."]}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsxs("button",{className:"btn",disabled:c,onClick:()=>C("Lien d'abonnement",`/api/admin/stores/${e}/billing/checkout-link`,{plan:y,interval:N,sendEmail:!0}),children:["Envoyer le lien à ",t]}),i.jsx("button",{className:"btn secondary",disabled:c,onClick:()=>C("Lien d'abonnement",`/api/admin/stores/${e}/billing/checkout-link`,{plan:y,interval:N,sendEmail:!1}),children:"Enregistrer la formule sans envoyer"})]})]}),a&&i.jsxs("div",{className:"alert ok",children:[a.label," ",a.emailedTo?i.jsxs(i.Fragment,{children:["envoyé à ",i.jsx("strong",{children:a.emailedTo}),". "]}):"créé. ",i.jsx("a",{href:a.url,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:a.url})]}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:720},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Facture"}),i.jsx("th",{scope:"col",children:"Objet"}),i.jsx("th",{scope:"col",children:"Période"}),i.jsx("th",{scope:"col",className:"num",children:"Montant"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",children:i.jsx("span",{className:"sr-only",children:"PDF"})})]})}),i.jsx("tbody",{children:r.invoices.map(S=>i.jsxs("tr",{children:[i.jsx("td",{style:{paddingLeft:24,fontWeight:600},children:S.number}),i.jsx("td",{style:{fontSize:14},children:S.description.replace("Abonnement MonEspacePro — ","")}),i.jsxs("td",{children:[Gn(S.periodStart)," → ",Gn(S.periodEnd)]}),i.jsx("td",{className:"num",children:Iu(S.amountCents)}),i.jsx("td",{children:S.paidAt?i.jsxs("span",{className:"badge ACTIVE",children:["Payée le ",Gn(S.paidAt)]}):i.jsx("span",{className:"badge SUSPENDED",children:"Impayée"})}),i.jsx("td",{style:{textAlign:"right",paddingRight:24},children:i.jsx("button",{className:"btn secondary small",onClick:()=>to(`/api/admin/invoices/${S.id}/pdf`,`${S.number}.pdf`).catch(E=>o(E.message)),children:"PDF"})})]},S.id))})]})}),r.invoices.length===0&&i.jsx("p",{className:"muted",style:{padding:24,margin:0,textAlign:"center"},children:"Aucune facture pour l'instant. Elles sont créées automatiquement à chaque paiement."})]})]})}const Fu=e=>new Date(e).toLocaleString("fr-FR",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"});function Mv({storeId:e,storeName:t}){const[n,r]=w.useState(null),[l,s]=w.useState(""),[o,a]=w.useState(null),[u,c]=w.useState(null),[d,h]=w.useState(null),[g,x]=w.useState(!1),v=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/campaigns`).then(r).catch(f=>c(f.message))},[e]);if(w.useEffect(v,[v]),!n)return u?i.jsx("div",{className:"alert error",children:u}):i.jsx("p",{className:"muted",children:"Chargement…"});const j=l.trim(),C=!n.allowed||!!n.nextAllowedAt;async function p(){if(confirm(`Envoyer ce message aux ${n.audience.cards} cartes de ${t} ? +`);const o=mv(t,n,l),a=xs.getSymbolSize(t),u=new lv(a);return cv(u,t),dv(u),fv(u,t),Xs(u,n,0),t>=7&&pv(u,t),hv(u,o),isNaN(r)&&(r=ro.getBestMask(u,Xs.bind(null,u,n))),ro.applyMask(r,u),Xs(u,n,r),{modules:u,version:t,errorCorrectionLevel:n,maskPattern:r,segments:l}}xf.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let r=qs.M,l,s;return typeof n<"u"&&(r=qs.from(n.errorCorrectionLevel,qs.M),l=Yl.from(n.version),s=ro.from(n.maskPattern),n.toSJISFunc&&xs.setToSJISFunction(n.toSJISFunc)),vv(t,l,r,s)};var _f={},ca={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(s){return[s,s]}))),r.length===6&&r.push("F","F");const l=parseInt(r.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const l=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,s=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:s,scale:s?4:o,margin:l,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,l){return l.width&&l.width>=r+l.margin*2?l.width/(r+l.margin*2):l.scale},e.getImageWidth=function(r,l){const s=e.getScale(r,l);return Math.floor((r+l.margin*2)*s)},e.qrToImageData=function(r,l,s){const o=l.modules.size,a=l.modules.data,u=e.getScale(o,s),c=Math.floor((o+s.margin*2)*u),p=s.margin*u,h=[s.color.light,s.color.dark];for(let m=0;m=p&&y>=p&&m"u"&&(!o||!o.getContext)&&(u=o,o=void 0),o||(c=r()),u=t.getOptions(u);const p=t.getImageWidth(s.modules.size,u),h=c.getContext("2d"),m=h.createImageData(p,p);return t.qrToImageData(m.data,s,u),n(h,c,p),h.putImageData(m,0,0),c},e.renderToDataURL=function(s,o,a){let u=a;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),u||(u={});const c=e.render(s,o,u),p=u.type||"image/png",h=u.rendererOpts||{};return c.toDataURL(p,h.quality)}})(_f);var Mf={};const yv=ca;function _u(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function Zs(e,t,n){let r=e+t;return typeof n<"u"&&(r+=" "+n),r}function xv(e,t,n){let r="",l=0,s=!1,o=0;for(let a=0;a0&&u>0&&e[a-1]||(r+=s?Zs("M",u+n,.5+c+n):Zs("m",l,0),l=0,s=!1),u+1':"",c="',p='viewBox="0 0 '+a+" "+a+'"',m=''+u+c+` +`;return typeof r=="function"&&r(null,m),m};const wv=Ig,so=xf,zf=_f,jv=Mf;function da(e,t,n,r,l){const s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!wv())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(l=n,n=t,t=r=void 0):o===3&&(t.getContext&&typeof l>"u"?(l=r,r=void 0):(l=r,r=n,n=t,t=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(n=t,t=r=void 0):o===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(u,c){try{const p=so.create(n,r);u(e(p,t,r))}catch(p){c(p)}})}try{const u=so.create(n,r);l(null,e(u,t,r))}catch(u){l(u)}}Dr.create=so.create;Dr.toCanvas=da.bind(null,zf.render);Dr.toDataURL=da.bind(null,zf.renderToDataURL);Dr.toString=da.bind(null,function(e,t,n){return jv.render(e,n)});const Sv={A5:{w:148,h:210,pad:12,logo:14,store:6,eyebrow:3.8,title:10,qr:66,qrWithRewards:50,body:4.5,small:4,maxRewards:4},A6:{w:105,h:148,pad:8,logo:10,store:4.5,eyebrow:3,title:7,qr:46,qrWithRewards:34,body:3.4,small:3.1,maxRewards:3}};function If(e){const t=Sv[e.format],n=(e.rewards??[]).filter(c=>c.active!==!1&&c.label.trim()).sort((c,p)=>c.cost-p.cost),r=n.slice(0,t.maxRewards),l=e.pointsMode==="STAMP"?"tampons":"points",s=r.length?t.qrWithRewards:t.qr,[o,a]=w.useState("");w.useEffect(()=>{Dr.toString(e.url,{type:"svg",errorCorrectionLevel:"Q",margin:0,color:{dark:"#111111",light:"#FFFFFF"}}).then(a)},[e.url]);const u=c=>`${c}mm`;return i.jsxs("div",{className:"poster",style:{width:u(t.w),height:u(t.h),padding:u(t.pad),boxSizing:"border-box",background:e.backgroundColor,color:e.foregroundColor,fontFamily:"'Figtree', system-ui, sans-serif",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between",textAlign:"center",overflow:"hidden",printColorAdjust:"exact",WebkitPrintColorAdjust:"exact"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u(3)},children:[e.logoUrl&&i.jsx("img",{src:e.logoUrl,alt:"",style:{width:u(t.logo),height:u(t.logo),objectFit:"contain",borderRadius:u(2.5),background:"#fff"}}),i.jsx("span",{style:{fontSize:u(t.store),fontWeight:700},children:e.storeName})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:u(2.5)},children:[i.jsx("span",{style:{fontSize:u(t.eyebrow),fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:e.labelColor},children:e.programName}),i.jsx("span",{style:{fontSize:u(t.title),lineHeight:1.12,fontWeight:800,letterSpacing:"-0.02em",maxWidth:"92%"},children:"Scannez pour obtenir votre carte de fidélité"})]}),i.jsx("div",{role:"img","aria-label":"QR code d'inscription",style:{background:"#fff",borderRadius:u(3.5),padding:u(4),width:u(s),height:u(s),boxSizing:"content-box"},dangerouslySetInnerHTML:{__html:o}}),r.length>0&&i.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:u(1.6)},children:[i.jsx("span",{style:{fontSize:u(t.small),fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:e.labelColor},children:"Vos récompenses"}),i.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:u(1.2)},children:r.map(c=>i.jsxs("li",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:u(3),padding:`${u(1.4)} ${u(3)}`,borderRadius:u(2.5),background:"rgba(255,255,255,0.12)",fontSize:u(t.body),lineHeight:1.25},children:[i.jsx("span",{style:{fontWeight:700,textAlign:"left"},children:c.label}),i.jsxs("span",{style:{whiteSpace:"nowrap",color:e.labelColor,fontWeight:600},children:[c.cost," ",l]})]},`${c.label}-${c.cost}`))}),n.length>r.length&&i.jsxs("span",{style:{fontSize:u(t.small),color:e.labelColor},children:["et ",n.length-r.length," autre(s) à découvrir sur votre carte"]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:u(1.5)},children:[i.jsx("span",{style:{fontSize:u(t.body),lineHeight:1.4,fontWeight:600},children:"Ajoutez-la à Apple Wallet ou Google Wallet."}),i.jsx("span",{style:{fontSize:u(t.small),lineHeight:1.4,color:e.labelColor},children:"Gratuit, sans application à télécharger."})]})]})}function Ff(e){return new Promise((t,n)=>{const r=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(r),t(l)},l.onerror=()=>n(new Error("Image illisible")),l.src=r})}function Df(e){return new Promise((t,n)=>e.toBlob(r=>r?t(r):n(new Error("Conversion impossible")),"image/png"))}async function Nv(e){const t=await Ff(e),n=1125,r=432,l=Math.max(n/t.width,r/t.height),s=n/l,o=r/l,a=Object.assign(document.createElement("canvas"),{width:n,height:r});return a.getContext("2d").drawImage(t,(t.width-s)/2,(t.height-o)/2,s,o,0,0,n,r),Df(a)}async function Cv(e){const t=await Ff(e),n=Math.min(1,480/Math.max(t.width,t.height)),r=Object.assign(document.createElement("canvas"),{width:Math.round(t.width*n),height:Math.round(t.height*n)});return r.getContext("2d").drawImage(t,0,0,r.width,r.height),Df(r)}async function Ev(e){const t=new Image;t.crossOrigin="anonymous",t.src=e;try{await t.decode()}catch{return null}const r=Object.assign(document.createElement("canvas"),{width:48,height:48}).getContext("2d");r.drawImage(t,0,0,48,48);let l;try{l=r.getImageData(0,0,48,48).data}catch{return null}const s=new Map;for(let u=0;u235&&p>235&&h>235)continue;const y=`${c>>5}${p>>5}${h>>5}`,v=s.get(y)??{n:0,r:0,g:0,b:0};s.set(y,{n:v.n+1,r:v.r+c,g:v.g+p,b:v.b+h})}const o=[...s.values()].sort((u,c)=>c.n-u.n)[0];if(!o)return null;const a=u=>Math.round(u/o.n).toString(16).padStart(2,"0");return`#${a(o.r)}${a(o.g)}${a(o.b)}`.toUpperCase()}function Mu(e,t){const n=s=>{const[o,a,u]=[1,3,5].map(c=>{const p=parseInt(s.slice(c,c+2),16)/255;return p<=.03928?p/12.92:((p+.055)/1.055)**2.4});return .2126*o+.7152*a+.0722*u},[r,l]=[n(e),n(t)].sort((s,o)=>o-s);return(r+.05)/(l+.05)}const ei=["Identité","Couleurs","Règle de points","Récompenses","Récapitulatif"];function kv(e){return{programName:`Fidélité ${e.name}`.slice(0,40),backgroundColor:"#1F2937",foregroundColor:"#FFFFFF",labelColor:"#D1D5DB",pointsMode:"AMOUNT",pointsPerEuro:1,rewards:[]}}function Uf({store:e,onSaved:t,base:n=`/api/admin/stores/${e.id}/card-design`,posterHref:r=`/magasins/${e.id}/affichette`,draftNote:l}){const[s,o]=w.useState(0),[a,u]=w.useState(null),[c,p]=w.useState({logoUrl:null,stripUrl:null}),[h,m]=w.useState(!1),[y,v]=w.useState("apple"),[j,C]=w.useState(null),[f,d]=w.useState(!1),[g,x]=w.useState(null);function N(L){const{logoUrl:ne,stripUrl:je,...We}=L;u(We),p({logoUrl:eo(ne),stripUrl:eo(je)}),m(!0)}if(w.useEffect(()=>{$.get(n).then(L=>L?N(L):u(kv(e))).catch(L=>C(L.message))},[n,e]),w.useEffect(()=>{c.logoUrl&&Ev(c.logoUrl).then(x)},[c.logoUrl]),!a)return j?i.jsx("div",{className:"alert error",children:j}):i.jsx("p",{className:"muted",children:"Chargement…"});const S=(L,ne)=>u({...a,[L]:ne});async function E(){C(null),d(!0);try{const{programName:L,backgroundColor:ne,foregroundColor:je,labelColor:We,pointsMode:Xe,pointsPerEuro:T}=a,_=a.rewards.map(({id:M,label:V,cost:X,active:nn})=>({id:M,label:V,cost:X,active:nn}));return N(await $.put(n,{programName:L,backgroundColor:ne,foregroundColor:je,labelColor:We,pointsMode:Xe,pointsPerEuro:T,rewards:_})),t(),!0}catch(L){return C(L.message),!1}finally{d(!1)}}async function P(){await E()&&o(L=>Math.min(L+1,ei.length-1))}async function z(L,ne){var We;const je=(We=ne.target.files)==null?void 0:We[0];if(ne.target.value="",!!je&&!(!h&&!await E())){d(!0),C(null);try{const Xe=L==="logo"?await Cv(je):await Nv(je),T=new FormData;T.append("file",Xe,`${L}.png`),N(await $.post(`${n}/images/${L}`,T))}catch(Xe){C(Xe.message)}finally{d(!1)}}}const A={...a,...c,storeName:e.name},Y=Mu(a.backgroundColor,a.foregroundColor),Re=Mu(a.backgroundColor,a.labelColor);return i.jsxs("div",{className:"wizard",children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsx("ol",{className:"steps","aria-label":"Étapes",children:ei.map((L,ne)=>i.jsx("li",{children:i.jsxs("button",{type:"button","aria-current":ne===s?"step":void 0,onClick:()=>o(ne),children:[ne+1," · ",L]})},L))}),j&&i.jsx("div",{className:"alert error",role:"alert",children:j}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[s===0&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Identité"}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"programName",children:"Nom du programme *"}),i.jsx("input",{id:"programName",className:"input",maxLength:40,value:a.programName,onChange:L=>S("programName",L.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("span",{style:{fontWeight:600},children:"Logo"}),i.jsxs("div",{className:"upload-drop",children:[c.logoUrl&&i.jsx("img",{src:c.logoUrl,alt:"Logo actuel"}),i.jsxs("label",{className:"btn secondary small",children:[c.logoUrl?"Remplacer":"Choisir un fichier",i.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:L=>z("logo",L),disabled:f})]}),i.jsx("span",{className:"hint",children:"PNG carré conseillé, fond transparent."})]})]}),i.jsxs("div",{className:"field",children:[i.jsx("span",{style:{fontWeight:600},children:"Bandeau"}),i.jsxs("div",{className:"upload-drop",children:[c.stripUrl&&i.jsx("img",{src:c.stripUrl,alt:"Bandeau actuel"}),i.jsxs("label",{className:"btn secondary small",children:[c.stripUrl?"Remplacer":"Choisir un fichier",i.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",onChange:L=>z("strip",L),disabled:f})]}),i.jsx("span",{className:"hint",children:"Recadré automatiquement au format Wallet (1125 × 432)."})]})]})]}),s===1&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Couleurs"}),g&&g!==a.backgroundColor&&i.jsxs("div",{className:"row",style:{gap:12},children:[i.jsx("span",{style:{width:28,height:28,borderRadius:8,background:g,border:"1px solid var(--border)"}}),i.jsxs("span",{children:["Couleur extraite du logo : ",g]}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:()=>S("backgroundColor",g),children:"Utiliser comme fond"})]}),[["backgroundColor","Fond"],["foregroundColor","Texte"],["labelColor","Libellés"]].map(([L,ne])=>i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:L,children:ne}),i.jsxs("div",{className:"color-row",children:[i.jsx("input",{type:"color","aria-label":`${ne} (sélecteur)`,value:a[L],onChange:je=>S(L,je.target.value.toUpperCase())}),i.jsx("input",{id:L,className:"input",style:{maxWidth:160},value:a[L],pattern:"#[0-9A-Fa-f]{6}",onChange:je=>S(L,je.target.value)})]})]},L)),Y<4.5&&i.jsxs("div",{className:"alert warn",children:["Contraste texte/fond insuffisant (",Y.toFixed(1),":1, minimum 4,5:1) : le solde sera difficile à lire."]}),Re<3&&i.jsxs("div",{className:"alert warn",children:["Contraste libellés/fond faible (",Re.toFixed(1),":1, minimum conseillé 3:1)."]})]}),s===2&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Règle de points"}),i.jsxs("div",{className:"mode-cards",role:"radiogroup",children:[i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"mode",checked:a.pointsMode==="AMOUNT",onChange:()=>S("pointsMode","AMOUNT")}),i.jsxs("span",{children:[i.jsx("strong",{children:"Points selon le montant"}),i.jsx("br",{}),i.jsx("span",{className:"muted",children:"X points par euro dépensé"})]})]}),i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"mode",checked:a.pointsMode==="STAMP",onChange:()=>S("pointsMode","STAMP")}),i.jsxs("span",{children:[i.jsx("strong",{children:"Tampons"}),i.jsx("br",{}),i.jsx("span",{className:"muted",children:"1 tampon par passage"})]})]})]}),a.pointsMode==="AMOUNT"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"ppe",children:"Points par euro *"}),i.jsx("input",{id:"ppe",className:"input",type:"number",step:"0.01",min:.01,max:100,style:{maxWidth:160},value:a.pointsPerEuro,onChange:L=>S("pointsPerEuro",Number(L.target.value))})]}),i.jsxs("p",{className:"muted",style:{margin:0},children:["Exemple : un panier de 23,50 € = ",i.jsxs("strong",{children:[Math.floor(23.5*a.pointsPerEuro)," points"]})," (arrondi à l'inférieur)."]})]}):i.jsx("p",{className:"muted",style:{margin:0},children:"Chaque passage validé par un employé ajoute un tampon, quel que soit le montant."})]}),s===3&&i.jsx(Pv,{rewards:a.rewards,unit:a.pointsMode==="STAMP"?"tampons":"points",onChange:L=>S("rewards",L)}),s===4&&i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Récapitulatif"}),i.jsxs("ul",{style:{margin:0,paddingLeft:20,lineHeight:1.8},children:[i.jsxs("li",{children:["Programme : ",i.jsx("strong",{children:a.programName})]}),i.jsxs("li",{children:["Règle : ",a.pointsMode==="STAMP"?"1 tampon par passage":`${a.pointsPerEuro} point(s) par euro`]}),i.jsxs("li",{children:["Récompenses : ",a.rewards.filter(L=>L.active!==!1).map(L=>`${L.label} (${L.cost})`).join(", ")||"aucune"]}),i.jsxs("li",{children:["Logo : ",c.logoUrl?"oui":i.jsx("span",{style:{color:"var(--warn)"},children:"manquant"})," · Bandeau : ",c.stripUrl?"oui":"non"]})]}),i.jsx("h3",{style:{margin:"8px 0 0"},children:"Affichette du comptoir"}),i.jsxs("div",{style:{display:"flex",gap:24,flexWrap:"wrap",alignItems:"flex-start"},children:[i.jsx("div",{style:{width:222,height:315,overflow:"hidden",borderRadius:8,boxShadow:"0 4px 16px rgb(0 0 0 / 0.15)"},children:i.jsx("div",{style:{transform:"scale(0.4)",transformOrigin:"top left"},children:i.jsx(If,{format:"A5",url:e.enrollUrl,storeName:e.name,programName:a.programName,logoUrl:c.logoUrl,backgroundColor:a.backgroundColor,foregroundColor:a.foregroundColor,labelColor:a.labelColor,rewards:a.rewards,pointsMode:a.pointsMode})})}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,flex:"1 1 220px"},children:[i.jsx("p",{style:{margin:0},children:"Le QR mène à la page d'inscription :"}),i.jsx("a",{href:e.enrollUrl,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:e.enrollUrl}),i.jsx(Fe,{to:r,className:"btn secondary",children:"Imprimer l'affichette (A5 / A6)"})]})]}),e.status==="DRAFT"&&(l??i.jsxs("p",{style:{margin:0},children:["Le programme s'ouvre automatiquement dès que l'abonnement est payé. Sinon, utilisez le bouton ",i.jsx("strong",{children:"Activer"})," en haut de la fiche."]}))]}),i.jsxs("div",{className:"row between",children:[i.jsx("button",{type:"button",className:"btn secondary",disabled:s===0,onClick:()=>o(s-1),children:"Précédent"}),sv("apple"),children:"Apple Wallet"}),i.jsx("button",{type:"button",className:"chip","aria-pressed":y==="google",onClick:()=>v("google"),children:"Google Wallet"})]}),y==="apple"?i.jsx(Mg,{d:A}):i.jsx(zg,{d:A}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Aperçu indicatif — QR et solde fictifs."})]})]})}function Pv({rewards:e,unit:t,onChange:n}){const r=(l,s)=>n(e.map((o,a)=>a===l?{...o,...s}:o));return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Récompenses"}),e.length===0&&i.jsxs("p",{className:"muted",style:{margin:0},children:["Aucune récompense. Exemple : « Café offert » pour 10 ",t,"."]}),e.map((l,s)=>i.jsxs("div",{className:"row",style:{alignItems:"flex-end",opacity:l.active===!1?.6:1},children:[i.jsxs("div",{className:"field",style:{flex:"1 1 240px"},children:[i.jsx("label",{htmlFor:`rw-label-${s}`,children:"Libellé"}),i.jsx("input",{id:`rw-label-${s}`,className:"input",maxLength:60,value:l.label,onChange:o=>r(s,{label:o.target.value})})]}),i.jsxs("div",{className:"field",style:{width:140},children:[i.jsxs("label",{htmlFor:`rw-cost-${s}`,children:["Coût (",t,")"]}),i.jsx("input",{id:`rw-cost-${s}`,className:"input",type:"number",min:1,value:l.cost,onChange:o=>r(s,{cost:Number(o.target.value)})})]}),l.active===!1?i.jsx("button",{type:"button",className:"btn secondary",onClick:()=>r(s,{active:!0}),children:"Réactiver"}):i.jsx("button",{type:"button",className:"btn secondary","aria-label":`Retirer ${l.label||"la récompense"}`,onClick:()=>n(e.filter((o,a)=>a!==s)),children:"Retirer"})]},l.id??`new-${s}`)),i.jsx("div",{children:i.jsx("button",{type:"button",className:"btn secondary",disabled:e.length>=20,onClick:()=>n([...e,{label:"",cost:10}]),children:"+ Ajouter une récompense"})})]})}const Of={MANAGER:"Dirigeant",EMPLOYEE:"Employé"};function Tv({storeId:e}){const t=`/api/admin/stores/${e}/staff`,[n,r]=w.useState([]),[l,s]=w.useState(null),[o,a]=w.useState(null),u=w.useRef(null),c=w.useRef(null),p=w.useCallback(()=>{$.get(t).then(r).catch(v=>s(v.message))},[t]);w.useEffect(p,[p]);function h(v){var j;a(v),(j=c.current)==null||j.showModal(),p()}async function m(v){try{await $.patch(`${t}/${v.id}`,{active:!v.active}),p()}catch(j){s(j.message)}}async function y(v){if(window.confirm(`Générer un nouveau mot de passe pour ${v.displayName} ? Ses sessions seront fermées.`))try{h(await $.post(`${t}/${v.id}/reset-password`))}catch(j){s(j.message)}}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",children:[i.jsx("h2",{children:"Employés"}),i.jsx("button",{className:"btn",onClick:()=>{var v;return(v=u.current)==null?void 0:v.showModal()},children:"+ Nouvel employé"})]}),l&&i.jsx("div",{className:"alert error",role:"alert",children:l}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:720},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Nom"}),i.jsx("th",{scope:"col",children:"E-mail"}),i.jsx("th",{scope:"col",children:"Rôle"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",children:i.jsx("span",{className:"sr-only",children:"Actions"})})]})}),i.jsx("tbody",{children:n.map(v=>i.jsxs("tr",{style:{opacity:v.active?1:.6},children:[i.jsx("td",{style:{paddingLeft:24,fontWeight:600},children:v.displayName}),i.jsx("td",{children:v.email}),i.jsx("td",{children:Of[v.role]}),i.jsx("td",{children:v.active?i.jsx("span",{className:"badge ACTIVE",children:"Actif"}):i.jsx("span",{className:"badge DRAFT",children:"Désactivé"})}),i.jsxs("td",{style:{textAlign:"right",whiteSpace:"nowrap"},children:[i.jsx("button",{className:"btn secondary small",onClick:()=>y(v),children:"Nouveau mot de passe"})," ",i.jsx("button",{className:"btn secondary small",onClick:()=>m(v),children:v.active?"Désactiver":"Réactiver"})]})]},v.id))})]})}),n.length===0&&i.jsx("p",{className:"muted",style:{padding:24,margin:0,textAlign:"center"},children:"Aucun employé. Créez au moins un dirigeant pour que le magasin puisse utiliser l'app Pro."})]}),i.jsx("dialog",{ref:u,"aria-labelledby":"new-staff-title",children:i.jsx(Rv,{base:t,onCancel:()=>{var v;return(v=u.current)==null?void 0:v.close()},onCreated:v=>{var j;(j=u.current)==null||j.close(),h(v)}})}),i.jsx("dialog",{ref:c,"aria-labelledby":"pwd-title",children:i.jsxs("div",{className:"dialog-body",children:[i.jsx("h2",{id:"pwd-title",children:"Mot de passe provisoire"}),i.jsxs("p",{style:{margin:0},children:["Communiquez-le à ",i.jsx("strong",{children:o==null?void 0:o.displayName})," (",o==null?void 0:o.email,"). Il ne sera plus affiché ensuite."]}),i.jsx("div",{className:"password-box",children:o==null?void 0:o.provisionalPassword}),i.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[i.jsx("button",{className:"btn secondary",onClick:()=>{var v;return(v=navigator.clipboard)==null?void 0:v.writeText((o==null?void 0:o.provisionalPassword)??"")},children:"Copier"}),i.jsx("button",{className:"btn",onClick:()=>{var v;return(v=c.current)==null?void 0:v.close()},children:"J'ai noté le mot de passe"})]})]})})]})}function Rv({base:e,onCancel:t,onCreated:n}){const[r,l]=w.useState(""),[s,o]=w.useState(""),[a,u]=w.useState("EMPLOYEE"),[c,p]=w.useState(null),[h,m]=w.useState(!1);async function y(v){v.preventDefault(),m(!0),p(null);try{n(await $.post(e,{displayName:r,email:s,role:a})),l(""),o(""),u("EMPLOYEE")}catch(j){p(j.message)}finally{m(!1)}}return i.jsxs("form",{className:"dialog-body",onSubmit:y,children:[i.jsx("h2",{id:"new-staff-title",children:"Nouvel employé"}),c&&i.jsx("div",{className:"alert error",role:"alert",children:c}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"staff-name",children:"Prénom et nom *"}),i.jsx("input",{id:"staff-name",className:"input",required:!0,placeholder:"Prénom Nom",value:r,onChange:v=>l(v.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"staff-email",children:"E-mail *"}),i.jsx("input",{id:"staff-email",className:"input",type:"email",required:!0,placeholder:"prenom@exemple.fr",value:s,onChange:v=>o(v.target.value)})]}),i.jsxs("fieldset",{style:{border:0,padding:0,margin:0},className:"field",children:[i.jsx("legend",{style:{fontWeight:600,marginBottom:6},children:"Rôle *"}),i.jsx("div",{className:"mode-cards",children:["EMPLOYEE","MANAGER"].map(v=>i.jsxs("label",{className:"mode-card",children:[i.jsx("input",{type:"radio",name:"role",checked:a===v,onChange:()=>u(v)}),i.jsxs("span",{children:[i.jsx("strong",{children:Of[v]}),i.jsx("br",{}),i.jsx("span",{className:"muted",style:{fontSize:14},children:v==="MANAGER"?"Toute la configuration : carte, modules, campagnes, employés, statistiques":"Scanne les cartes et crédite les points, voit ses opérations"})]})]},v))})]}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Un mot de passe provisoire sera généré à la création."}),i.jsxs("div",{className:"row",style:{justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",className:"btn secondary",onClick:t,children:"Annuler"}),i.jsx("button",{className:"btn",disabled:h,children:"Créer le compte"})]})]})}const zu={ACTIVE:["Actif","ACTIVE"],INCOMPLETE:["En attente de paiement","DRAFT"],PAST_DUE:["Impayé","SUSPENDED"],CANCELED:["Résilié","CLOSED"]},Lv={multiStore:"Carte commune à plusieurs magasins"},Iu=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",minimumFractionDigits:e%100?2:0}),Gn=e=>new Date(e).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});function Av({storeId:e,contactEmail:t,onChange:n}){const[r,l]=w.useState(null),[s,o]=w.useState(null),[a,u]=w.useState(null),[c,p]=w.useState(!1),[h,m]=w.useState(null),[y,v]=w.useState(null),j=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/billing`).then(l).catch(S=>o(S.message))},[e]);w.useEffect(j,[j]);async function C(S,E,P){p(!0),o(null);try{const z=await $.post(E,P);u({...z,label:S}),j(),n()}catch(z){o(z.message)}finally{p(!1)}}if(!r)return s?i.jsx("div",{className:"alert error",children:s}):i.jsx("p",{className:"muted",children:"Chargement…"});const f=r.subscription,d=f&&f.status!=="CANCELED"&&f.hasSubscription?r.catalog.find(S=>S.plan===f.plan):null,g=!d,x=h??(f==null?void 0:f.plan)??"PRO",N=y??(f==null?void 0:f.interval)??"MONTH";return i.jsxs(i.Fragment,{children:[r.testMode&&i.jsx("div",{className:"alert warn",children:"Stripe est en mode test : aucun paiement réel n'est encaissé (carte de test 4242 4242 4242 4242)."}),s&&i.jsx("div",{className:"alert error",role:"alert",children:s}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{className:"row between",children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Abonnement"}),i.jsx("p",{className:"muted",style:{margin:0},children:d?`Formule ${d.name}${f.legacyPrice?" (tarif fondateur)":""} — ${f.interval==="YEAR"?"annuelle":"mensuelle"}`:"Aucune formule souscrite. Sans abonnement actif, le magasin a les droits de la formule Essentiel."})]}),i.jsx("span",{className:`badge ${f?zu[f.status][1]:"DRAFT"}`,children:f?zu[f.status][0]:"Aucun abonnement"})]}),(f==null?void 0:f.cancelAtPeriodEnd)&&f.currentPeriodEnd&&i.jsxs("div",{className:"alert warn",children:["Résiliation demandée : l'abonnement s'arrête le ",i.jsx("strong",{children:Gn(f.currentPeriodEnd)}),"."]}),(f==null?void 0:f.currentPeriodEnd)&&f.status==="ACTIVE"&&!f.cancelAtPeriodEnd&&i.jsxs("p",{style:{margin:0},children:["Prochain prélèvement le ",i.jsx("strong",{children:Gn(f.currentPeriodEnd)}),"."]}),r.billingSuspended&&i.jsx("div",{className:"alert warn",children:"Magasin suspendu automatiquement pour impayé. Il sera réactivé dès que le paiement passera."}),d&&i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsxs("button",{className:"btn",disabled:c,onClick:()=>C("Espace abonnement",`/api/admin/stores/${e}/billing/portal-link`,{sendEmail:!0}),children:["Envoyer l'espace abonnement à ",t]}),i.jsx("button",{className:"btn secondary",disabled:c,onClick:()=>C("Espace abonnement",`/api/admin/stores/${e}/billing/portal-link`,{sendEmail:!1}),children:"Ouvrir l'espace abonnement"}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Changer de formule, de moyen de paiement, résilier."})]})]}),g&&i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:20},children:[i.jsxs("div",{className:"row between",children:[i.jsx("h2",{children:"Choisir une formule"}),i.jsxs("div",{role:"group","aria-label":"Périodicité",className:"row",style:{gap:8},children:[i.jsx("button",{type:"button",className:"chip","aria-pressed":N==="MONTH",onClick:()=>v("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button",className:"chip","aria-pressed":N==="YEAR",onClick:()=>v("YEAR"),children:"Annuel — 2 mois offerts"})]})]}),i.jsx("div",{className:"mode-cards",role:"radiogroup","aria-label":"Formule",children:r.catalog.map(S=>i.jsxs("label",{className:"mode-card",style:{flexDirection:"column",gap:8},children:[i.jsxs("span",{className:"row",style:{gap:10},children:[i.jsx("input",{type:"radio",name:"plan",checked:x===S.plan,onChange:()=>m(S.plan)}),i.jsx("strong",{style:{fontSize:18},children:S.name}),S.plan==="PRO"&&i.jsx("span",{className:"badge ACTIVE",style:{height:22},children:"Conseillée"})]}),i.jsxs("span",{style:{fontSize:24,fontWeight:800},children:[Iu(S.priceCents[N]),i.jsxs("span",{className:"muted",style:{fontSize:14,fontWeight:500},children:[" / ",N==="YEAR"?"an":"mois",S.plan==="RESEAU"?" / magasin":""]})]}),i.jsx("span",{className:"muted",style:{fontSize:14},children:S.tagline}),i.jsxs("ul",{style:{margin:0,paddingLeft:18,fontSize:14,lineHeight:1.6},children:[i.jsx("li",{children:S.limits.maxStaff?`${S.limits.maxStaff} employés`:"Employés illimités"}),i.jsx("li",{children:"Carte Wallet, points ou tampons, récompenses, mises à jour en direct"}),S.features.map(E=>i.jsx("li",{children:Lv[E]??E},E))]}),i.jsx("span",{style:{fontSize:14,fontWeight:700},children:S.modules.length?`Modules inclus (${S.modules.length})`:"Aucun module inclus"}),S.modules.length>0&&i.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:14,lineHeight:1.6},children:S.modules.map(E=>i.jsx("li",{title:E.tagline,children:E.name},E.id))})]},S.plan))}),i.jsxs("p",{className:"muted",style:{margin:0,fontSize:14},children:["Lien permanent (il ne périme pas) : ",i.jsx("a",{href:r.subscribeUrl,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:r.subscribeUrl}),". Le commerçant pourra saisir un code promo sur la page de paiement (codes à créer dans Stripe → Coupons)."]}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsxs("button",{className:"btn",disabled:c,onClick:()=>C("Lien d'abonnement",`/api/admin/stores/${e}/billing/checkout-link`,{plan:x,interval:N,sendEmail:!0}),children:["Envoyer le lien à ",t]}),i.jsx("button",{className:"btn secondary",disabled:c,onClick:()=>C("Lien d'abonnement",`/api/admin/stores/${e}/billing/checkout-link`,{plan:x,interval:N,sendEmail:!1}),children:"Enregistrer la formule sans envoyer"})]})]}),a&&i.jsxs("div",{className:"alert ok",children:[a.label," ",a.emailedTo?i.jsxs(i.Fragment,{children:["envoyé à ",i.jsx("strong",{children:a.emailedTo}),". "]}):"créé. ",i.jsx("a",{href:a.url,target:"_blank",rel:"noreferrer",style:{wordBreak:"break-all"},children:a.url})]}),i.jsxs("div",{className:"table-wrap",children:[i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{minWidth:720},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",style:{paddingLeft:24},children:"Facture"}),i.jsx("th",{scope:"col",children:"Objet"}),i.jsx("th",{scope:"col",children:"Période"}),i.jsx("th",{scope:"col",className:"num",children:"Montant"}),i.jsx("th",{scope:"col",children:"Statut"}),i.jsx("th",{scope:"col",children:i.jsx("span",{className:"sr-only",children:"PDF"})})]})}),i.jsx("tbody",{children:r.invoices.map(S=>i.jsxs("tr",{children:[i.jsx("td",{style:{paddingLeft:24,fontWeight:600},children:S.number}),i.jsx("td",{style:{fontSize:14},children:S.description.replace("Abonnement MonEspacePro — ","")}),i.jsxs("td",{children:[Gn(S.periodStart)," → ",Gn(S.periodEnd)]}),i.jsx("td",{className:"num",children:Iu(S.amountCents)}),i.jsx("td",{children:S.paidAt?i.jsxs("span",{className:"badge ACTIVE",children:["Payée le ",Gn(S.paidAt)]}):i.jsx("span",{className:"badge SUSPENDED",children:"Impayée"})}),i.jsx("td",{style:{textAlign:"right",paddingRight:24},children:i.jsx("button",{className:"btn secondary small",onClick:()=>to(`/api/admin/invoices/${S.id}/pdf`,`${S.number}.pdf`).catch(E=>o(E.message)),children:"PDF"})})]},S.id))})]})}),r.invoices.length===0&&i.jsx("p",{className:"muted",style:{padding:24,margin:0,textAlign:"center"},children:"Aucune facture pour l'instant. Elles sont créées automatiquement à chaque paiement."})]})]})}const Fu=e=>new Date(e).toLocaleString("fr-FR",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"});function _v({storeId:e,storeName:t}){const[n,r]=w.useState(null),[l,s]=w.useState(""),[o,a]=w.useState(null),[u,c]=w.useState(null),[p,h]=w.useState(null),[m,y]=w.useState(!1),v=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/campaigns`).then(r).catch(d=>c(d.message))},[e]);if(w.useEffect(v,[v]),!n)return u?i.jsx("div",{className:"alert error",children:u}):i.jsx("p",{className:"muted",children:"Chargement…"});const j=l.trim(),C=!n.allowed||!!n.nextAllowedAt;async function f(){if(confirm(`Envoyer ce message aux ${n.audience.cards} cartes de ${t} ? -« ${j} »`)){x(!0),c(null);try{await $.post(`/api/admin/stores/${e}/campaigns`,{message:j,title:(o??n.defaultTitle).trim()}),s(""),h("Campagne envoyée. Les cartes se mettent à jour dans les minutes qui suivent."),v()}catch(f){c(f.message)}finally{x(!1)}}}return i.jsxs(i.Fragment,{children:[u&&i.jsx("div",{className:"alert error",role:"alert",children:u}),d&&i.jsx("div",{className:"alert ok",role:"status",children:d}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Nouvelle campagne"}),i.jsxs("p",{className:"muted",style:{margin:0},children:["Le message apparaît en notification sur le téléphone des clients et reste visible sur leur carte. Audience : ",i.jsx("strong",{children:n.audience.cards})," cartes, dont ",i.jsx("strong",{children:n.audience.appleDevices})," iPhone joignables (Google Wallet : tous les clients qui ont ajouté la carte)."]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"campaign-title",children:"Titre de la notification"}),i.jsx("input",{id:"campaign-title",className:"input",maxLength:40,value:o??n.defaultTitle,onChange:f=>a(f.target.value),disabled:C||g}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Affiché sur Google Wallet. Sur iPhone, le nom du magasin apparaît toujours en titre."})]}),i.jsx("label",{htmlFor:"campaign-msg",children:"Message"}),i.jsx("textarea",{id:"campaign-msg",className:"input",rows:3,maxLength:n.maxLength,placeholder:"Ex. : -20 % sur les viennoiseries ce samedi, sur présentation de votre carte !",value:l,onChange:f=>s(f.target.value),disabled:C||g}),i.jsxs("div",{className:"row between",children:[i.jsxs("span",{className:"muted",style:{fontSize:14},children:[j.length," / ",n.maxLength," caractères · 1 campagne toutes les ",n.minIntervalHours," h maximum"]}),i.jsx("button",{className:"btn",disabled:C||g||j.length<5,onClick:p,children:g?"Envoi…":"Envoyer la campagne"})]}),n.nextAllowedAt&&i.jsxs("div",{className:"alert warn",children:["Prochain envoi possible le ",Fu(n.nextAllowedAt),"."]})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Historique"}),n.items.length===0?i.jsx("p",{className:"muted",style:{margin:0},children:"Aucune campagne envoyée pour l'instant."}):i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"Date"}),i.jsx("th",{scope:"col",children:"Message"}),i.jsx("th",{scope:"col",children:"Envoyée par"}),i.jsx("th",{scope:"col",className:"num",children:"Cartes"})]})}),i.jsx("tbody",{children:n.items.map(f=>i.jsxs("tr",{children:[i.jsx("td",{className:"muted",style:{whiteSpace:"nowrap"},children:Fu(f.createdAt)}),i.jsxs("td",{children:[f.title&&i.jsxs("strong",{children:[f.title," · "]}),f.message]}),i.jsx("td",{children:f.sentByName}),i.jsx("td",{className:"num",children:f.cards})]},f.id))})]})})]})]})}function Av({m:e}){const[t,n]=e.override===!0?["Ajouté sur mesure","ACTIVE"]:e.override===!1?["Retiré","CLOSED"]:e.inPlan?["Inclus dans la formule","ACTIVE"]:["Non inclus","DRAFT"];return i.jsx("span",{className:`badge ${n}`,children:t})}function zv({f:e,value:t,onChange:n}){var a;const r=`f-${e.key}`,l=i.jsxs(i.Fragment,{children:[e.help&&i.jsxs("span",{className:"muted",style:{fontSize:14},children:[e.help," "]}),"variables"in e&&((a=e.variables)!=null&&a.length)?i.jsxs("span",{className:"muted",style:{fontSize:14},children:["Variables : ",e.variables.map(u=>i.jsx("code",{style:{marginRight:6},children:u},u))]}):null]});if(e.type==="boolean")return i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontWeight:600},children:[i.jsx("input",{type:"checkbox",checked:!!t,onChange:u=>n(u.target.checked)}),e.label,e.help&&i.jsxs("span",{className:"muted",style:{fontWeight:400,fontSize:14},children:["— ",e.help]})]});if(e.type==="int"||e.type==="hour")return i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,style:{fontWeight:600},children:e.label}),i.jsxs("div",{className:"row",style:{gap:8,alignItems:"center"},children:[i.jsx("input",{id:r,className:"input",type:"number",style:{width:120},min:e.min,max:e.max,value:Number(t),onChange:u=>n(Math.floor(Number(u.target.value)||0))}),i.jsx("span",{className:"muted",children:e.type==="hour"?"h":e.unit})]}),l]});const s=e,o=String(t??"");return i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,style:{fontWeight:600},children:e.label}),s.type==="textarea"?i.jsx("textarea",{id:r,className:"input",rows:2,maxLength:s.maxLength,value:o,onChange:u=>n(u.target.value)}):i.jsx("input",{id:r,className:"input",type:s.type==="url"?"url":"text",maxLength:s.maxLength,value:o,onChange:u=>n(u.target.value)}),i.jsxs("div",{className:"row between",style:{gap:8},children:[i.jsx("span",{children:l}),i.jsxs("span",{className:"muted",style:{fontSize:13},children:[o.length," / ",s.maxLength]})]}),s.type!=="url"&&o!==s.default&&i.jsx("button",{type:"button",className:"link",style:{fontSize:14},onClick:()=>n(s.default),children:"Remettre le texte par défaut"})]})}function Iv({storeId:e,storeName:t,initial:n,onChanged:r}){const[l,s]=w.useState(n),[o,a]=w.useState(n.config),[u,c]=w.useState(!1),[d,h]=w.useState(!1),[g,x]=w.useState(null),[v,j]=w.useState(null),C=`/api/admin/stores/${e}/modules/${l.id}`,p=y=>{s(y),a(y.config)};w.useEffect(()=>{u&&$.get(C).then(p).catch(y=>x(y.message))},[u,C]);async function f(y,N){h(!0),x(null),j(null);try{p(await y()),j(N),r()}catch(S){x(S.message)}finally{h(!1)}}const m=JSON.stringify(o)!==JSON.stringify(l.config);return i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:14},children:[i.jsxs("div",{className:"row between",style:{alignItems:"flex-start",gap:12},children:[i.jsxs("div",{style:{flex:"1 1 320px"},children:[i.jsxs("div",{className:"row",style:{gap:10,alignItems:"center"},children:[i.jsx("h2",{style:{margin:0},children:l.name}),i.jsx(Av,{m:l}),l.available&&i.jsx("span",{className:`badge ${l.config.enabled?"ACTIVE":"DRAFT"}`,children:l.config.enabled?"Activé":"Désactivé"})]}),i.jsx("p",{className:"muted",style:{margin:"6px 0 0"},children:l.description})]}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsx("label",{className:"sr-only",htmlFor:`ov-${l.id}`,children:"Disponibilité du module"}),i.jsxs("select",{id:`ov-${l.id}`,className:"input",style:{width:"auto"},disabled:d,value:l.override===null?"plan":l.override?"add":"remove",onChange:y=>{const N=y.target.value==="plan"?null:y.target.value==="add";f(()=>$.put(`${C}/override`,{value:N}),N===null?"Module remis selon la formule.":N?"Module ajouté sur mesure.":"Module retiré.")},children:[i.jsxs("option",{value:"plan",children:["Selon la formule",l.inPlan?" (inclus)":" (non inclus)"]}),i.jsx("option",{value:"add",children:"Ajouter sur mesure"}),i.jsx("option",{value:"remove",children:"Retirer"})]}),i.jsx("button",{type:"button",className:"btn secondary",onClick:()=>c(!u),"aria-expanded":u,children:u?"Fermer":"Personnaliser"})]})]}),g&&i.jsx("div",{className:"alert error",role:"alert",children:g}),v&&i.jsx("div",{className:"alert ok",role:"status",children:v}),u&&i.jsxs(i.Fragment,{children:[!l.available&&i.jsx("div",{className:"alert warn",children:"Module non disponible pour ce magasin : ajoutez-le sur mesure ou changez de formule pour l'activer. Vous pouvez déjà préparer ses réglages."}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontWeight:700},children:[i.jsx("input",{type:"checkbox",checked:!!o.enabled,onChange:y=>a({...o,enabled:y.target.checked})}),"Module activé"]}),l.fields.map(y=>i.jsx(zv,{f:y,value:o[y.key],onChange:N=>a({...o,[y.key]:N})},y.key)),l.stats&&i.jsx("div",{className:"row",style:{gap:24},children:Object.entries(l.stats).map(([y,N])=>i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:22,fontWeight:800},children:N??"—"}),i.jsx("div",{className:"muted",style:{fontSize:14},children:y})]},y))}),l.id==="stats"&&i.jsx(Fe,{to:"../statistiques",children:"Voir les statistiques du magasin →"}),i.jsxs("div",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[m&&i.jsx("button",{type:"button",className:"btn secondary",disabled:d,onClick:()=>a(l.config),children:"Annuler"}),i.jsx("button",{type:"button",className:"btn",disabled:d||!m,onClick:()=>f(()=>$.put(C,o),"Réglages enregistrés."),children:d?"Enregistrement…":"Enregistrer"})]}),l.id==="campaigns"&&l.available&&l.config.enabled&&i.jsx(Mv,{storeId:e,storeName:t})]})]})}function Fv({storeId:e,storeName:t}){const[n,r]=w.useState(null),[l,s]=w.useState(null),o=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/modules`).then(r).catch(u=>s(u.message))},[e]);if(w.useEffect(o,[o]),!n)return l?i.jsx("div",{className:"alert error",children:l}):i.jsx("p",{className:"muted",children:"Chargement…"});const a=n.filter(u=>u.available&&u.config.enabled).length;return i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"muted",style:{margin:0},children:[a," module(s) actif(s) sur ",n.length,". Chaque module est inclus ou non dans la formule ; vous pouvez l'ajouter ou le retirer sur mesure, et tous ses textes et réglages sont personnalisables. Le dirigeant peut aussi les régler depuis l'app Pro."]}),n.map(u=>i.jsx(Iv,{storeId:e,storeName:t,initial:u,onChanged:o},u.id))]})}const Dv=[[30,"30 jours"],[90,"3 mois"],[365,"12 mois"]],ti=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",maximumFractionDigits:e>=1e5?0:2}),ln=e=>e.toLocaleString("fr-FR");function Uv({value:e}){if(e===null)return null;const t=e>=0;return i.jsxs("span",{style:{fontSize:13,fontWeight:700,color:t?"var(--ok)":"var(--err)"},children:[t?"▲":"▼"," ",Math.abs(e).toLocaleString("fr-FR")," %"]})}function Bt({label:e,value:t,hint:n,change:r}){return i.jsxs("div",{className:"card",style:{padding:16,display:"flex",flexDirection:"column",gap:4},children:[i.jsx("span",{className:"muted",style:{fontSize:14},children:e}),i.jsx("span",{style:{fontSize:26,fontWeight:800},children:t}),i.jsxs("span",{style:{display:"flex",gap:8,alignItems:"baseline"},children:[r!==void 0&&i.jsx(Uv,{value:r}),n&&i.jsx("span",{className:"muted",style:{fontSize:13},children:n})]})]})}function Ov({series:e}){const t=Math.max(1,...e.map(l=>Math.max(l.visits,l.newCards))),n=100/e.length,r=Math.ceil(e.length/8);return i.jsxs("svg",{viewBox:"0 0 100 46",preserveAspectRatio:"none",style:{width:"100%",height:220},role:"img","aria-label":"Passages et nouvelles cartes sur la période",children:[e.map((l,s)=>i.jsxs("g",{children:[i.jsx("title",{children:`${l.label} : ${l.visits} passage(s), ${l.newCards} nouvelle(s) carte(s)`}),i.jsx("rect",{x:s*n+n*.1,y:40-l.visits/t*38,width:n*.45,height:l.visits/t*38,fill:"var(--primary)"}),i.jsx("rect",{x:s*n+n*.55,y:40-l.newCards/t*38,width:n*.35,height:l.newCards/t*38,fill:"var(--primary-soft)",stroke:"var(--primary)",strokeWidth:.1}),s%r===0&&i.jsx("text",{x:s*n+n/2,y:45,fontSize:2.2,textAnchor:"middle",fill:"currentColor",opacity:.6,children:l.label})]},s)),i.jsx("line",{x1:0,x2:100,y1:40,y2:40,stroke:"var(--border)",strokeWidth:.2})]})}function Bv({heat:e}){const t=Array.from({length:15},(r,l)=>l+7),n=Math.max(1,...e.values.flat());return i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{borderCollapse:"separate",borderSpacing:3,minWidth:560},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{}),t.map(r=>i.jsxs("th",{style:{fontSize:12,fontWeight:500,padding:0,textAlign:"center"},children:[r,"h"]},r))]})}),i.jsx("tbody",{children:e.weekdays.map((r,l)=>i.jsxs("tr",{children:[i.jsx("th",{scope:"row",style:{fontSize:13,fontWeight:600,padding:"0 8px 0 0"},children:r}),t.map(s=>{const o=e.values[l][s];return i.jsx("td",{title:`${r} ${s} h : ${o} passage(s)`,style:{padding:0,height:26,borderRadius:4,background:o?`color-mix(in srgb, var(--primary) ${Math.round(15+o/n*85)}%, transparent)`:"var(--surface-2)"}},s)})]},r))})]})})}function $v({storeId:e,storeSlug:t}){const[n,r]=w.useState(30),[l,s]=w.useState(null),[o,a]=w.useState(null),[u,c]=w.useState(null);w.useEffect(()=>{a(null),$.get(`/api/admin/stores/${e}/stats?days=${n}`).then(s).catch(x=>a(x.message))},[e,n]);async function d(x){c(x);try{const v=new Date().toISOString().slice(0,10);x==="customers"?await to(`/api/admin/stores/${e}/export/customers`,`clients-${t}-${v}.csv`):await to(`/api/admin/stores/${e}/export/transactions?days=${n}`,`operations-${t}-${n}j-${v}.csv`)}catch(v){a(v.message)}finally{c(null)}}const h=l==null?void 0:l.kpis,g=(l==null?void 0:l.pointsMode)==="STAMP"?"tampons":"points";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",style:{alignItems:"center"},children:[i.jsx("div",{role:"group","aria-label":"Période",className:"row",style:{gap:8},children:Dv.map(([x,v])=>i.jsx("button",{type:"button",className:"chip","aria-pressed":n===x,onClick:()=>r(x),children:v},x))}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsx("button",{className:"btn secondary",disabled:!!u,onClick:()=>d("customers"),children:u==="customers"?"Export…":"Exporter les clients (CSV)"}),i.jsx("button",{className:"btn secondary",disabled:!!u,onClick:()=>d("transactions"),children:u==="transactions"?"Export…":"Exporter les opérations (CSV)"})]})]}),o&&i.jsx("div",{className:"alert error",role:"alert",children:o}),l&&!l.allowed&&i.jsx("div",{className:"alert warn",children:"Ce magasin n'a pas la formule Pro : il ne voit pas ces statistiques dans son app (vous, si)."}),!l||!h?!o&&i.jsx("p",{className:"muted",children:"Chargement…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(190px, 1fr))",gap:12},children:[i.jsx(Bt,{label:"Passages",value:ln(h.visits),change:h.visitsChange,hint:"vs période précédente"}),i.jsx(Bt,{label:"Nouvelles cartes",value:ln(h.newCards),change:h.newCardsChange,hint:`${ln(h.cardsTotal)} au total`}),i.jsx(Bt,{label:"Clients actifs",value:ln(h.activeCustomers),hint:`${h.visitsPerCustomer.toLocaleString("fr-FR")} passage(s) par client`}),i.jsx(Bt,{label:"Clients fidèles",value:h.returningRate===null?"—":`${h.returningRate.toLocaleString("fr-FR")} %`,hint:"venus au moins 2 fois"}),l.pointsMode==="AMOUNT"&&i.jsx(Bt,{label:"Achats enregistrés",value:ti(h.revenueCents),hint:h.averageBasketCents===null?void 0:`panier moyen ${ti(h.averageBasketCents)}`}),i.jsx(Bt,{label:"Récompenses",value:ln(h.rewardsRedeemed),hint:`${ln(h.pointsGiven)} ${g} distribués`}),i.jsx(Bt,{label:"Cartes dans Apple Wallet",value:h.appleWalletRate===null?"—":`${h.appleWalletRate.toLocaleString("fr-FR")} %`,hint:"iPhone joignables"})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Fréquentation"}),i.jsxs("p",{className:"muted",style:{marginTop:0,fontSize:14},children:[i.jsx("span",{style:{display:"inline-block",width:10,height:10,background:"var(--primary)",borderRadius:2}})," Passages   ",i.jsx("span",{style:{display:"inline-block",width:10,height:10,background:"var(--primary-soft)",border:"1px solid var(--primary)",borderRadius:2}})," Nouvelles cartes"]}),i.jsx(Ov,{series:l.series})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Heures d'affluence"}),i.jsx("p",{className:"muted",style:{marginTop:0},children:l.busiest?`Créneau le plus fréquenté : ${l.busiest}.`:"Pas encore de passage sur la période."}),i.jsx(Bv,{heat:l.heatmap})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Meilleurs clients"}),l.top.length===0?i.jsx("p",{className:"muted",style:{margin:0},children:"Pas encore de passage sur la période."}):i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"Client"}),i.jsx("th",{scope:"col",className:"num",children:"Passages"}),l.pointsMode==="AMOUNT"&&i.jsx("th",{scope:"col",className:"num",children:"Achats"}),i.jsx("th",{scope:"col",className:"num",children:"Solde"})]})}),i.jsx("tbody",{children:l.top.map((x,v)=>i.jsxs("tr",{children:[i.jsx("td",{children:x.firstName}),i.jsx("td",{className:"num",children:x.visits}),l.pointsMode==="AMOUNT"&&i.jsx("td",{className:"num",children:ti(x.amountCents)}),i.jsx("td",{className:"num",children:x.balance})]},v))})]})})]})]})]})}const bv=[["infos","Infos"],["carte","Carte de fidélité"],["employes","Employés"],["modules","Modules"],["statistiques","Statistiques"],["facturation","Facturation"]];function Wv(){var c;const{id:e}=af(),[t,n]=w.useState(null),[r,l]=w.useState(null),[s,o]=w.useState(null),a=w.useCallback(()=>{$.get(`/api/admin/stores/${e}`).then(n).catch(d=>l(d.message))},[e]);w.useEffect(a,[a]);async function u(d,h){if(!(h&&!window.confirm(h))){l(null);try{await $.patch(`/api/admin/stores/${e}/status`,{status:d}),a()}catch(g){l(g.message)}}}return t?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",children:[i.jsxs("div",{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsxs("div",{className:"row",style:{gap:12},children:[i.jsx("h1",{children:t.name}),i.jsx(mf,{status:t.status}),((c=t.subscription)==null?void 0:c.stripeSubscriptionId)&&t.subscription.status!=="CANCELED"&&i.jsx(yl,{to:"facturation",className:"badge DRAFT",style:{textDecoration:"none"},title:"Formule d'abonnement",children:Mt[t.subscription.plan]})]}),i.jsxs("p",{className:"muted",style:{margin:0},children:[t.city," · ",t.counts.cards," clients · ",t.counts.staff," employés"]})]}),i.jsxs("div",{className:"row",style:{gap:8},children:[(t.status==="DRAFT"||t.status==="CLOSED")&&i.jsx("button",{className:"btn",onClick:()=>u("ACTIVE"),children:"Activer"}),t.status==="SUSPENDED"&&i.jsx("button",{className:"btn",onClick:()=>u("ACTIVE"),children:"Réactiver"}),t.status==="ACTIVE"&&i.jsx("button",{className:"btn secondary",onClick:()=>u("SUSPENDED","Suspendre ce magasin ? Les employés ne pourront plus scanner."),children:"Suspendre"}),t.status!=="CLOSED"&&i.jsx("button",{className:"btn secondary",onClick:()=>u("CLOSED","Fermer ce magasin ?"),children:"Fermer"})]})]}),t.status==="SUSPENDED"&&i.jsxs("div",{className:"alert warn",role:"status",children:["Magasin suspendu",t.billingSuspended?" pour impayé":""," : les scans et les nouvelles inscriptions sont refusés.",t.billingSuspended&&i.jsxs(i.Fragment,{children:[" Voir l'onglet ",i.jsx(yl,{to:"facturation",children:"Facturation"}),"."]})]}),r&&i.jsx("div",{className:"alert error",role:"alert",children:r}),s&&i.jsx("div",{className:"alert ok",role:"status",children:s}),i.jsx("nav",{className:"tabs","aria-label":"Sections du magasin",children:bv.map(([d,h])=>i.jsx(yl,{to:d,children:h},d))}),i.jsxs(qi,{children:[i.jsx(G,{index:!0,element:i.jsx(vl,{to:"infos",replace:!0})}),i.jsx(G,{path:"infos",element:i.jsx(gf,{initial:t,submitLabel:"Enregistrer",onSubmit:async d=>{const{name:h,siret:g,addressLine:x,postalCode:v,city:j,contactName:C,contactEmail:p,contactPhone:f,maxAmountEuros:m,minScanIntervalMin:y}=d;await $.patch(`/api/admin/stores/${e}`,{name:h,siret:g,addressLine:x,postalCode:v,city:j,contactName:C,contactEmail:p,contactPhone:f,maxAmountEuros:m,minScanIntervalMin:y}),o("Modifications enregistrées."),a()}},t.id)}),i.jsx(G,{path:"carte",element:i.jsx(Uf,{store:t,onSaved:a})}),i.jsx(G,{path:"employes",element:i.jsx(Rv,{storeId:t.id})}),i.jsx(G,{path:"modules",element:i.jsx(Fv,{storeId:t.id,storeName:t.name})}),i.jsx(G,{path:"statistiques",element:i.jsx($v,{storeId:t.id,storeSlug:t.slug})}),i.jsx(G,{path:"facturation",element:i.jsx(_v,{storeId:t.id,contactEmail:t.contactEmail,onChange:a})})]})]}):r?i.jsx("div",{className:"alert error",children:r}):i.jsx("p",{className:"muted",children:"Chargement…"})}function Du({merchant:e=!1}){const{id:t}=af(),n=e?"/api/staff/store":`/api/admin/stores/${t}`,r=e?"/api/staff/card-design":`/api/admin/stores/${t}/card-design`,[l,s]=ra(),o=l.get("format")==="A6"?"A6":"A5",[a,u]=w.useState(null),[c,d]=w.useState(null),[h,g]=w.useState(null);return w.useEffect(()=>{Promise.all([$.get(n),$.get(r)]).then(([x,v])=>{u(x),d(v)}).catch(x=>g(x.message))},[n,r]),h?i.jsx("div",{className:"alert error",style:{margin:24},children:h}):a?c?i.jsxs("div",{className:"poster-page",children:[i.jsx("style",{children:`@page{size:${o};margin:0}@media print{.no-print{display:none!important}body{background:#fff}.poster-page{padding:0!important}}`}),i.jsxs("div",{className:"no-print row between",style:{padding:16},children:[i.jsx(Fe,{to:e?"/espace":`/magasins/${t}/carte`,children:"← Retour à la carte"}),i.jsxs("div",{className:"row",style:{gap:8},children:[["A5","A6"].map(x=>i.jsx("button",{type:"button",className:"chip","aria-pressed":o===x,onClick:()=>s({format:x}),children:x},x)),i.jsx("button",{type:"button",className:"btn",onClick:()=>window.print(),children:"Imprimer"})]})]}),a.status!=="ACTIVE"&&i.jsx("div",{className:"alert warn no-print",style:{margin:"0 16px 16px"},children:"Le magasin n'est pas actif : le QR mène pour l'instant à une page « introuvable » ou « indisponible »."}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:16},className:"poster-page",children:i.jsx(If,{format:o,url:a.enrollUrl,storeName:a.name,programName:c.programName,logoUrl:eo(c.logoUrl),backgroundColor:c.backgroundColor,foregroundColor:c.foregroundColor,labelColor:c.labelColor,rewards:c.rewards,pointsMode:c.pointsMode})}),i.jsx("p",{className:"no-print muted",style:{textAlign:"center"},children:a.enrollUrl})]}):i.jsx("div",{className:"alert warn",style:{margin:24},children:"Concevez d'abord la carte de fidélité."}):i.jsx("p",{className:"muted",style:{margin:24},children:"Chargement…"})}const Uu=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",minimumFractionDigits:e%100?2:0}),Ou=["ESSENTIEL","PRO","RESEAU"],Vv=[["name","Nom du commerce",{autoComplete:"organization",placeholder:"Boulangerie Kerlann",maxLength:120}],["siret","SIRET",{inputMode:"numeric",placeholder:"123 456 789 00012"}],["addressLine","Adresse",{autoComplete:"street-address",maxLength:200}],["postalCode","Code postal",{autoComplete:"postal-code",inputMode:"numeric",maxLength:5}],["city","Ville",{autoComplete:"address-level2",maxLength:120}],["contactName","Prénom et nom",{autoComplete:"name",maxLength:120}],["contactPhone","Téléphone",{autoComplete:"tel",type:"tel"}],["contactEmail","E-mail (votre identifiant de connexion)",{autoComplete:"email",type:"email"}]];function Hv(){const[e]=ra(),t=(e.get("formule")??"").toUpperCase(),[n,r]=w.useState(Ou.includes(t)?t:"PRO"),[l,s]=w.useState(e.get("periode")==="annuel"?"YEAR":"MONTH"),[o,a]=w.useState([]),[u,c]=w.useState({name:"",siret:"",addressLine:"",postalCode:"",city:"",contactName:"",contactPhone:"",contactEmail:"",password:""}),[d,h]=w.useState(!1),[g,x]=w.useState(e.get("annule")?"Paiement annulé : rien n’a été prélevé. Vous pouvez reprendre quand vous voulez.":null),[v,j]=w.useState(!1);w.useEffect(()=>{const y=N=>N.persisted&&j(!1);return window.addEventListener("pageshow",y),()=>window.removeEventListener("pageshow",y)},[]),w.useEffect(()=>{Tu.get("/api/public/signup/plans").then(a).catch(()=>{})},[]);async function C(y){y.preventDefault(),j(!0),x(null);try{const{url:N}=await Tu.post("/api/public/signup",{...u,plan:n,interval:l,cgv:d});window.location.assign(N)}catch(N){x(N.message),j(!1),window.scrollTo({top:0,behavior:"smooth"})}}const p=o.find(y=>y.plan===n),f=o.length?o:Ou.map(y=>({plan:y,name:Mt[y],tagline:"",priceCents:{MONTH:0,YEAR:0},modules:[],limits:{maxStaff:null}})),m=y=>{const[,N,S]=Vv.find(([E])=>E===y);return i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:`s-${y}`,children:N}),i.jsx("input",{id:`s-${y}`,className:"input",required:!0,value:u[y],onChange:E=>c({...u,[y]:E.target.value}),...S})]},y)};return i.jsxs("main",{className:"s-page",children:[i.jsxs("header",{className:"s-head",children:[i.jsx("a",{href:"https://monespacepro.eu/",style:{textDecoration:"none",color:"inherit"},"aria-label":"MonEspacePro, accueil",children:i.jsx(Fr,{admin:!1})}),i.jsxs("span",{className:"muted",style:{fontSize:14},children:["Déjà inscrit ? ",i.jsx(Fe,{to:"/espace",children:"Se connecter"})]})]}),i.jsxs("form",{onSubmit:C,className:"s-layout",children:[i.jsxs("div",{className:"s-main",children:[i.jsxs("div",{children:[i.jsx("h1",{children:"Créer mon programme de fidélité"}),i.jsx("p",{className:"muted",style:{margin:"6px 0 0"},children:"Trois minutes, sans engagement. Votre espace est prêt dès le paiement validé."})]}),g&&i.jsx("div",{className:"alert error",role:"alert",children:g}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"1"}),i.jsx("h2",{children:"Votre formule"})]}),i.jsxs("div",{role:"group","aria-label":"Périodicité",className:"s-seg",children:[i.jsx("button",{type:"button","aria-pressed":l==="MONTH",onClick:()=>s("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button","aria-pressed":l==="YEAR",onClick:()=>s("YEAR"),children:"Annuel · 2 mois offerts"})]}),i.jsx("div",{className:"s-plans",role:"radiogroup","aria-label":"Formule",children:f.map(y=>i.jsxs("label",{className:`s-plan${n===y.plan?" on":""}`,children:[i.jsx("input",{type:"radio",name:"plan",className:"sr-only",checked:n===y.plan,onChange:()=>r(y.plan)}),y.plan==="PRO"&&i.jsx("span",{className:"s-tag",children:"Conseillée"}),i.jsx("strong",{children:y.name}),y.priceCents[l]>0&&i.jsxs("span",{className:"s-price",children:[Uu(y.priceCents[l]),i.jsxs("small",{children:[" / ",l==="YEAR"?"an":"mois"]})]}),i.jsx("span",{className:"muted",style:{fontSize:14},children:y.tagline})]},y.plan))})]}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"2"}),i.jsx("h2",{children:"Votre commerce"})]}),m("name"),m("siret"),m("addressLine"),i.jsxs("div",{className:"s-two",children:[m("postalCode"),m("city")]})]}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"3"}),i.jsx("h2",{children:"Vos identifiants"})]}),i.jsxs("div",{className:"s-two",children:[m("contactName"),m("contactPhone")]}),m("contactEmail"),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"s-password",children:"Mot de passe"}),i.jsx("input",{id:"s-password",className:"input",type:"password",required:!0,minLength:10,autoComplete:"new-password",value:u.password,onChange:y=>c({...u,password:y.target.value})}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"10 caractères minimum. Il ouvre votre espace web et l’app MonEspacePro."})]})]})]}),i.jsx("aside",{className:"s-side",children:i.jsxs("section",{className:"card s-summary",children:[i.jsx("span",{className:"muted",style:{fontSize:13,textTransform:"uppercase",letterSpacing:".05em"},children:"Récapitulatif"}),i.jsxs("div",{className:"row between",style:{alignItems:"baseline"},children:[i.jsxs("strong",{style:{fontSize:20},children:["Formule ",(p==null?void 0:p.name)??Mt[n]]}),p&&i.jsxs("span",{style:{fontSize:22,fontWeight:800},children:[Uu(p.priceCents[l]),i.jsxs("span",{className:"muted",style:{fontSize:14,fontWeight:500},children:[" / ",l==="YEAR"?"an":"mois"]})]})]}),p&&i.jsxs("ul",{className:"s-list",children:[i.jsx("li",{children:"Carte dans Apple Wallet et Google Wallet"}),i.jsx("li",{children:p.limits.maxStaff?`${p.limits.maxStaff} employés`:"Employés illimités"}),p.modules.map(y=>i.jsx("li",{children:y.name},y.id))]}),i.jsxs("label",{className:"row",style:{gap:10,alignItems:"flex-start",flexWrap:"nowrap",fontSize:14},children:[i.jsx("input",{type:"checkbox",required:!0,checked:d,onChange:y=>h(y.target.checked),style:{marginTop:3}}),i.jsxs("span",{children:["J’accepte les ",i.jsx("a",{href:"https://monespacepro.eu/cgv/",target:"_blank",rel:"noreferrer",children:"CGV"})," et la"," ",i.jsx("a",{href:"https://monespacepro.eu/confidentialite/",target:"_blank",rel:"noreferrer",children:"politique de confidentialité"}),"."]})]}),i.jsx("button",{className:"btn",disabled:v,style:{width:"100%"},children:v?"Redirection vers le paiement…":"Continuer vers le paiement"}),i.jsxs("ul",{className:"s-trust",children:[i.jsx("li",{children:"🔒 Paiement sécurisé par Stripe"}),i.jsx("li",{children:"💳 Carte bancaire ou prélèvement SEPA"}),i.jsx("li",{children:"↩︎ Sans engagement, résiliable à tout moment"})]})]})})]})]})}function Qv({onLogin:e}){const t=tn(),[n]=ra(),r=n.has("bienvenue"),[l,s]=w.useState(""),[o,a]=w.useState(""),[u,c]=w.useState(null),[d,h]=w.useState(!1);async function g(x){x.preventDefault(),h(!0),c(null);try{await Ng(l,o),e(),t("/espace",{replace:!0})}catch(v){c(r&&v instanceof ms&&v.status===401?"Votre espace est en cours de création. Réessayez dans quelques secondes.":v.message)}finally{h(!1)}}return i.jsx("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:16},children:i.jsxs("form",{className:"card",onSubmit:g,style:{width:"100%",maxWidth:420,display:"flex",flexDirection:"column",gap:20},children:[i.jsx(Fr,{admin:!1}),r&&i.jsx("div",{className:"alert ok",children:"Paiement reçu, merci ! Connectez-vous avec l’e-mail et le mot de passe choisis à l’inscription."}),i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:26},children:"Mon espace"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Mêmes identifiants que l’app MonEspacePro."})]}),u&&i.jsx("div",{className:"alert error",role:"alert",children:u}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"m-email",children:"E-mail"}),i.jsx("input",{id:"m-email",className:"input",type:"email",autoComplete:"username",required:!0,value:l,onChange:x=>s(x.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"m-password",children:"Mot de passe"}),i.jsx("input",{id:"m-password",className:"input",type:"password",autoComplete:"current-password",required:!0,value:o,onChange:x=>a(x.target.value)})]}),i.jsx("button",{className:"btn",disabled:d,children:d?"Connexion…":"Se connecter"}),i.jsxs("p",{className:"muted",style:{margin:0,fontSize:14,textAlign:"center"},children:["Pas encore client ? ",i.jsx(Fe,{to:"/inscription",children:"Créer mon programme"})]})]})})}function Kv(){const[e,t]=w.useState(null),[n,r]=w.useState(null),[l,s]=w.useState(!1),[o,a]=w.useState(null),u=w.useCallback(()=>{$.get("/api/staff/store").then(t).catch(v=>r(v instanceof ms&&v.status===403?"Cet espace est réservé au Dirigeant du magasin. Utilisez l’app MonEspacePro pour scanner les cartes.":v.message)),$.get("/api/staff/card-design").then(v=>a(!!v)).catch(()=>a(null))},[]);w.useEffect(u,[u]);function c(v){var j;(j=navigator.clipboard)==null||j.writeText(v).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}const d=!!e&&!e.subscribeUrl,h=(e==null?void 0:e.status)==="ACTIVE",g=[["Abonnement",d?`Formule ${e!=null&&e.subscription?Mt[e.subscription.plan]:""} active`:"En attente du paiement",d],["Carte de fidélité",o?"Conçue":"Logo, couleurs, récompenses",!!o],["Programme ouvert",h?"Vos clients peuvent s’inscrire":"S’ouvre automatiquement",h]],x=g.findIndex(([,,v])=>!v);return i.jsxs("div",{style:{minHeight:"100vh"},children:[i.jsxs("header",{className:"m-top",children:[i.jsx(Fr,{admin:!1}),i.jsx("span",{className:"grow"}),e&&i.jsx("span",{className:"muted",style:{fontSize:14},children:e.name}),e&&i.jsx("span",{className:"m-avatar","aria-hidden":"true",children:e.name.charAt(0).toUpperCase()}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:ia,children:"Se déconnecter"})]}),i.jsxs("main",{className:"container",style:{padding:24,display:"flex",flexDirection:"column",gap:24},children:[n&&i.jsx("div",{className:"alert error",role:"alert",children:n}),!e&&!n&&i.jsx("p",{className:"muted",children:"Chargement…"}),e&&i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"m-hero",children:[i.jsxs("div",{children:[i.jsx("h1",{children:e.name}),i.jsxs("p",{children:[e.subscription?`Formule ${Mt[e.subscription.plan]}`:"Aucune formule"," ·"," ",h?"programme ouvert à vos clients":e.status==="SUSPENDED"?"programme suspendu":"programme pas encore ouvert"]})]}),e.subscribeUrl&&i.jsx("a",{className:"btn",href:e.subscribeUrl,children:"Activer mon abonnement"})]}),e.status==="SUSPENDED"&&i.jsx("div",{className:"alert warn",children:"Programme suspendu. Il rouvre automatiquement dès le paiement de l’abonnement régularisé."}),i.jsx("ol",{className:"m-steps","aria-label":"Étapes d’ouverture",children:g.map(([v,j,C],p)=>i.jsxs("li",{className:`m-step${C?" done":""}${p===x?" current":""}`,"aria-current":p===x?"step":void 0,children:[i.jsx("span",{className:"dot",children:C?"✓":p+1}),i.jsxs("div",{children:[i.jsx("strong",{children:v}),i.jsx("span",{children:j})]})]},v))}),i.jsxs("div",{className:"m-grid",children:[i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"🔗"}),i.jsx("h2",{children:"Lien d’inscription"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Vos clients s’inscrivent ici (c’est le QR code de l’affichette)."}),i.jsxs("div",{className:"m-copy",children:[i.jsx("code",{children:e.enrollUrl}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:()=>c(e.enrollUrl),children:l?"Copié ✓":"Copier"})]})]}),i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"🖨️"}),i.jsx("h2",{children:"Affichette du comptoir"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"À imprimer en A5 ou A6 et à poser près de la caisse."}),i.jsx("div",{children:o?i.jsx(Fe,{className:"btn secondary",to:"/espace/affichette",children:"Imprimer l’affichette"}):i.jsx("span",{className:"muted",style:{fontSize:14},children:"Disponible une fois la carte conçue."})})]}),i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"📱"}),i.jsx("h2",{children:"App MonEspacePro"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Scan des cartes, employés, modules (campagnes, anniversaire, relances…) et statistiques : avec les mêmes identifiants."})]})]}),i.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.jsx("h2",{children:"Ma carte de fidélité"}),i.jsx(Uf,{store:e,onSaved:u,base:"/api/staff/card-design",posterHref:"/espace/affichette",draftNote:i.jsx("p",{style:{margin:0},children:e.subscribeUrl?"Votre programme s’ouvrira automatiquement dès votre abonnement activé.":"Enregistrez la carte : votre programme s’ouvre automatiquement à vos clients."})})]})]})]})]})}function Yv(){const e=tn(),t=Ft(),[n,r]=w.useState(jg()),l=t.pathname.startsWith("/espace");w.useEffect(()=>{wg(()=>{r(null),e(l?"/espace":"/connexion")})},[e,l]);const s=i.jsx(Qv,{onLogin:()=>r("staff")});return n!=="admin"||t.pathname==="/inscription"?i.jsxs(qi,{children:[i.jsx(G,{path:"/inscription",element:i.jsx(Hv,{})}),n==="staff"?i.jsxs(i.Fragment,{children:[i.jsx(G,{path:"/espace/affichette",element:i.jsx(Du,{merchant:!0})}),i.jsx(G,{path:"/espace",element:i.jsx(Kv,{})}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:"/espace",replace:!0})})]}):i.jsxs(i.Fragment,{children:[i.jsx(G,{path:"/espace",element:s}),i.jsx(G,{path:"/connexion",element:i.jsx(kg,{onLogin:()=>r("admin")})}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:l?"/espace":"/connexion",replace:!0})})]})]}):i.jsxs(qi,{children:[i.jsx(G,{path:"/espace",element:s}),i.jsx(G,{path:"/magasins/:id/affichette",element:i.jsx(Du,{})}),i.jsxs(G,{element:i.jsx(Eg,{}),children:[i.jsx(G,{path:"/magasins",element:i.jsx(Lg,{})}),i.jsx(G,{path:"/magasins/nouveau",element:i.jsx(Mg,{})}),i.jsx(G,{path:"/magasins/:id/*",element:i.jsx(Wv,{})})]}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:"/magasins",replace:!0})})]})}Xd(document.getElementById("root")).render(i.jsx(w.StrictMode,{children:i.jsx(hg,{future:{v7_startTransition:!0},children:i.jsx(Yv,{})})})); +« ${j} »`)){y(!0),c(null);try{await $.post(`/api/admin/stores/${e}/campaigns`,{message:j,title:(o??n.defaultTitle).trim()}),s(""),h("Campagne envoyée. Les cartes se mettent à jour dans les minutes qui suivent."),v()}catch(d){c(d.message)}finally{y(!1)}}}return i.jsxs(i.Fragment,{children:[u&&i.jsx("div",{className:"alert error",role:"alert",children:u}),p&&i.jsx("div",{className:"alert ok",role:"status",children:p}),i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Nouvelle campagne"}),i.jsxs("p",{className:"muted",style:{margin:0},children:["Le message apparaît en notification sur le téléphone des clients et reste visible sur leur carte. Audience : ",i.jsx("strong",{children:n.audience.cards})," cartes, dont ",i.jsx("strong",{children:n.audience.appleDevices})," iPhone joignables (Google Wallet : tous les clients qui ont ajouté la carte)."]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"campaign-title",children:"Titre de la notification"}),i.jsx("input",{id:"campaign-title",className:"input",maxLength:40,value:o??n.defaultTitle,onChange:d=>a(d.target.value),disabled:C||m}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"Affiché sur Google Wallet. Sur iPhone, le nom du magasin apparaît toujours en titre."})]}),i.jsx("label",{htmlFor:"campaign-msg",children:"Message"}),i.jsx("textarea",{id:"campaign-msg",className:"input",rows:3,maxLength:n.maxLength,placeholder:"Ex. : -20 % sur les viennoiseries ce samedi, sur présentation de votre carte !",value:l,onChange:d=>s(d.target.value),disabled:C||m}),i.jsxs("div",{className:"row between",children:[i.jsxs("span",{className:"muted",style:{fontSize:14},children:[j.length," / ",n.maxLength," caractères · 1 campagne toutes les ",n.minIntervalHours," h maximum"]}),i.jsx("button",{className:"btn",disabled:C||m||j.length<5,onClick:f,children:m?"Envoi…":"Envoyer la campagne"})]}),n.nextAllowedAt&&i.jsxs("div",{className:"alert warn",children:["Prochain envoi possible le ",Fu(n.nextAllowedAt),"."]})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Historique"}),n.items.length===0?i.jsx("p",{className:"muted",style:{margin:0},children:"Aucune campagne envoyée pour l'instant."}):i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"Date"}),i.jsx("th",{scope:"col",children:"Message"}),i.jsx("th",{scope:"col",children:"Envoyée par"}),i.jsx("th",{scope:"col",className:"num",children:"Cartes"})]})}),i.jsx("tbody",{children:n.items.map(d=>i.jsxs("tr",{children:[i.jsx("td",{className:"muted",style:{whiteSpace:"nowrap"},children:Fu(d.createdAt)}),i.jsxs("td",{children:[d.title&&i.jsxs("strong",{children:[d.title," · "]}),d.message]}),i.jsx("td",{children:d.sentByName}),i.jsx("td",{className:"num",children:d.cards})]},d.id))})]})})]})]})}function Mv({m:e}){const[t,n]=e.override===!0?["Ajouté sur mesure","ACTIVE"]:e.override===!1?["Retiré","CLOSED"]:e.inPlan?["Inclus dans la formule","ACTIVE"]:["Non inclus","DRAFT"];return i.jsx("span",{className:`badge ${n}`,children:t})}function zv({f:e,value:t,onChange:n}){var a;const r=`f-${e.key}`,l=i.jsxs(i.Fragment,{children:[e.help&&i.jsxs("span",{className:"muted",style:{fontSize:14},children:[e.help," "]}),"variables"in e&&((a=e.variables)!=null&&a.length)?i.jsxs("span",{className:"muted",style:{fontSize:14},children:["Variables : ",e.variables.map(u=>i.jsx("code",{style:{marginRight:6},children:u},u))]}):null]});if(e.type==="boolean")return i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontWeight:600},children:[i.jsx("input",{type:"checkbox",checked:!!t,onChange:u=>n(u.target.checked)}),e.label,e.help&&i.jsxs("span",{className:"muted",style:{fontWeight:400,fontSize:14},children:["— ",e.help]})]});if(e.type==="int"||e.type==="hour")return i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,style:{fontWeight:600},children:e.label}),i.jsxs("div",{className:"row",style:{gap:8,alignItems:"center"},children:[i.jsx("input",{id:r,className:"input",type:"number",style:{width:120},min:e.min,max:e.max,value:Number(t),onChange:u=>n(Math.floor(Number(u.target.value)||0))}),i.jsx("span",{className:"muted",children:e.type==="hour"?"h":e.unit})]}),l]});const s=e,o=String(t??"");return i.jsxs("div",{children:[i.jsx("label",{htmlFor:r,style:{fontWeight:600},children:e.label}),s.type==="textarea"?i.jsx("textarea",{id:r,className:"input",rows:2,maxLength:s.maxLength,value:o,onChange:u=>n(u.target.value)}):i.jsx("input",{id:r,className:"input",type:s.type==="url"?"url":"text",maxLength:s.maxLength,value:o,onChange:u=>n(u.target.value)}),i.jsxs("div",{className:"row between",style:{gap:8},children:[i.jsx("span",{children:l}),i.jsxs("span",{className:"muted",style:{fontSize:13},children:[o.length," / ",s.maxLength]})]}),s.type!=="url"&&o!==s.default&&i.jsx("button",{type:"button",className:"link",style:{fontSize:14},onClick:()=>n(s.default),children:"Remettre le texte par défaut"})]})}function Iv({storeId:e,storeName:t,initial:n,onChanged:r}){const[l,s]=w.useState(n),[o,a]=w.useState(n.config),[u,c]=w.useState(!1),[p,h]=w.useState(!1),[m,y]=w.useState(null),[v,j]=w.useState(null),C=`/api/admin/stores/${e}/modules/${l.id}`,f=x=>{s(x),a(x.config)};w.useEffect(()=>{u&&$.get(C).then(f).catch(x=>y(x.message))},[u,C]);async function d(x,N){h(!0),y(null),j(null);try{f(await x()),j(N),r()}catch(S){y(S.message)}finally{h(!1)}}const g=JSON.stringify(o)!==JSON.stringify(l.config);return i.jsxs("section",{className:"card",style:{display:"flex",flexDirection:"column",gap:14},children:[i.jsxs("div",{className:"row between",style:{alignItems:"flex-start",gap:12},children:[i.jsxs("div",{style:{flex:"1 1 320px"},children:[i.jsxs("div",{className:"row",style:{gap:10,alignItems:"center"},children:[i.jsx("h2",{style:{margin:0},children:l.name}),i.jsx(Mv,{m:l}),l.available&&i.jsx("span",{className:`badge ${l.config.enabled?"ACTIVE":"DRAFT"}`,children:l.config.enabled?"Activé":"Désactivé"})]}),i.jsx("p",{className:"muted",style:{margin:"6px 0 0"},children:l.description})]}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsx("label",{className:"sr-only",htmlFor:`ov-${l.id}`,children:"Disponibilité du module"}),i.jsxs("select",{id:`ov-${l.id}`,className:"input",style:{width:"auto"},disabled:p,value:l.override===null?"plan":l.override?"add":"remove",onChange:x=>{const N=x.target.value==="plan"?null:x.target.value==="add";d(()=>$.put(`${C}/override`,{value:N}),N===null?"Module remis selon la formule.":N?"Module ajouté sur mesure.":"Module retiré.")},children:[i.jsxs("option",{value:"plan",children:["Selon la formule",l.inPlan?" (inclus)":" (non inclus)"]}),i.jsx("option",{value:"add",children:"Ajouter sur mesure"}),i.jsx("option",{value:"remove",children:"Retirer"})]}),i.jsx("button",{type:"button",className:"btn secondary",onClick:()=>c(!u),"aria-expanded":u,children:u?"Fermer":"Personnaliser"})]})]}),m&&i.jsx("div",{className:"alert error",role:"alert",children:m}),v&&i.jsx("div",{className:"alert ok",role:"status",children:v}),u&&i.jsxs(i.Fragment,{children:[!l.available&&i.jsx("div",{className:"alert warn",children:"Module non disponible pour ce magasin : ajoutez-le sur mesure ou changez de formule pour l'activer. Vous pouvez déjà préparer ses réglages."}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontWeight:700},children:[i.jsx("input",{type:"checkbox",checked:!!o.enabled,onChange:x=>a({...o,enabled:x.target.checked})}),"Module activé"]}),l.fields.map(x=>i.jsx(zv,{f:x,value:o[x.key],onChange:N=>a({...o,[x.key]:N})},x.key)),l.stats&&i.jsx("div",{className:"row",style:{gap:24},children:Object.entries(l.stats).map(([x,N])=>i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:22,fontWeight:800},children:N??"—"}),i.jsx("div",{className:"muted",style:{fontSize:14},children:x})]},x))}),l.id==="stats"&&i.jsx(Fe,{to:"../statistiques",children:"Voir les statistiques du magasin →"}),i.jsxs("div",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[g&&i.jsx("button",{type:"button",className:"btn secondary",disabled:p,onClick:()=>a(l.config),children:"Annuler"}),i.jsx("button",{type:"button",className:"btn",disabled:p||!g,onClick:()=>d(()=>$.put(C,o),"Réglages enregistrés."),children:p?"Enregistrement…":"Enregistrer"})]}),l.id==="campaigns"&&l.available&&l.config.enabled&&i.jsx(_v,{storeId:e,storeName:t})]})]})}function Fv({storeId:e,storeName:t}){const[n,r]=w.useState(null),[l,s]=w.useState(null),o=w.useCallback(()=>{$.get(`/api/admin/stores/${e}/modules`).then(r).catch(u=>s(u.message))},[e]);if(w.useEffect(o,[o]),!n)return l?i.jsx("div",{className:"alert error",children:l}):i.jsx("p",{className:"muted",children:"Chargement…"});const a=n.filter(u=>u.available&&u.config.enabled).length;return i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"muted",style:{margin:0},children:[a," module(s) actif(s) sur ",n.length,". Chaque module est inclus ou non dans la formule ; vous pouvez l'ajouter ou le retirer sur mesure, et tous ses textes et réglages sont personnalisables. Le dirigeant peut aussi les régler depuis l'app Pro."]}),n.map(u=>i.jsx(Iv,{storeId:e,storeName:t,initial:u,onChanged:o},u.id))]})}const Dv=[[30,"30 jours"],[90,"3 mois"],[365,"12 mois"]],ti=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",maximumFractionDigits:e>=1e5?0:2}),ln=e=>e.toLocaleString("fr-FR");function Uv({value:e}){if(e===null)return null;const t=e>=0;return i.jsxs("span",{style:{fontSize:13,fontWeight:700,color:t?"var(--ok)":"var(--err)"},children:[t?"▲":"▼"," ",Math.abs(e).toLocaleString("fr-FR")," %"]})}function $t({label:e,value:t,hint:n,change:r}){return i.jsxs("div",{className:"card",style:{padding:16,display:"flex",flexDirection:"column",gap:4},children:[i.jsx("span",{className:"muted",style:{fontSize:14},children:e}),i.jsx("span",{style:{fontSize:26,fontWeight:800},children:t}),i.jsxs("span",{style:{display:"flex",gap:8,alignItems:"baseline"},children:[r!==void 0&&i.jsx(Uv,{value:r}),n&&i.jsx("span",{className:"muted",style:{fontSize:13},children:n})]})]})}function Ov({series:e}){const t=Math.max(1,...e.map(l=>Math.max(l.visits,l.newCards))),n=100/e.length,r=Math.ceil(e.length/8);return i.jsxs("svg",{viewBox:"0 0 100 46",preserveAspectRatio:"none",style:{width:"100%",height:220},role:"img","aria-label":"Passages et nouvelles cartes sur la période",children:[e.map((l,s)=>i.jsxs("g",{children:[i.jsx("title",{children:`${l.label} : ${l.visits} passage(s), ${l.newCards} nouvelle(s) carte(s)`}),i.jsx("rect",{x:s*n+n*.1,y:40-l.visits/t*38,width:n*.45,height:l.visits/t*38,fill:"var(--primary)"}),i.jsx("rect",{x:s*n+n*.55,y:40-l.newCards/t*38,width:n*.35,height:l.newCards/t*38,fill:"var(--primary-soft)",stroke:"var(--primary)",strokeWidth:.1}),s%r===0&&i.jsx("text",{x:s*n+n/2,y:45,fontSize:2.2,textAnchor:"middle",fill:"currentColor",opacity:.6,children:l.label})]},s)),i.jsx("line",{x1:0,x2:100,y1:40,y2:40,stroke:"var(--border)",strokeWidth:.2})]})}function Bv({heat:e}){const t=Array.from({length:15},(r,l)=>l+7),n=Math.max(1,...e.values.flat());return i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{style:{borderCollapse:"separate",borderSpacing:3,minWidth:560},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{}),t.map(r=>i.jsxs("th",{style:{fontSize:12,fontWeight:500,padding:0,textAlign:"center"},children:[r,"h"]},r))]})}),i.jsx("tbody",{children:e.weekdays.map((r,l)=>i.jsxs("tr",{children:[i.jsx("th",{scope:"row",style:{fontSize:13,fontWeight:600,padding:"0 8px 0 0"},children:r}),t.map(s=>{const o=e.values[l][s];return i.jsx("td",{title:`${r} ${s} h : ${o} passage(s)`,style:{padding:0,height:26,borderRadius:4,background:o?`color-mix(in srgb, var(--primary) ${Math.round(15+o/n*85)}%, transparent)`:"var(--surface-2)"}},s)})]},r))})]})})}function $v({storeId:e,storeSlug:t}){const[n,r]=w.useState(30),[l,s]=w.useState(null),[o,a]=w.useState(null),[u,c]=w.useState(null);w.useEffect(()=>{a(null),$.get(`/api/admin/stores/${e}/stats?days=${n}`).then(s).catch(y=>a(y.message))},[e,n]);async function p(y){c(y);try{const v=new Date().toISOString().slice(0,10);y==="customers"?await to(`/api/admin/stores/${e}/export/customers`,`clients-${t}-${v}.csv`):await to(`/api/admin/stores/${e}/export/transactions?days=${n}`,`operations-${t}-${n}j-${v}.csv`)}catch(v){a(v.message)}finally{c(null)}}const h=l==null?void 0:l.kpis,m=(l==null?void 0:l.pointsMode)==="STAMP"?"tampons":"points";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"row between",style:{alignItems:"center"},children:[i.jsx("div",{role:"group","aria-label":"Période",className:"row",style:{gap:8},children:Dv.map(([y,v])=>i.jsx("button",{type:"button",className:"chip","aria-pressed":n===y,onClick:()=>r(y),children:v},y))}),i.jsxs("div",{className:"row",style:{gap:8},children:[i.jsx("button",{className:"btn secondary",disabled:!!u,onClick:()=>p("customers"),children:u==="customers"?"Export…":"Exporter les clients (CSV)"}),i.jsx("button",{className:"btn secondary",disabled:!!u,onClick:()=>p("transactions"),children:u==="transactions"?"Export…":"Exporter les opérations (CSV)"})]})]}),o&&i.jsx("div",{className:"alert error",role:"alert",children:o}),l&&!l.allowed&&i.jsx("div",{className:"alert warn",children:"Ce magasin n'a pas la formule Pro : il ne voit pas ces statistiques dans son app (vous, si)."}),!l||!h?!o&&i.jsx("p",{className:"muted",children:"Chargement…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(190px, 1fr))",gap:12},children:[i.jsx($t,{label:"Passages",value:ln(h.visits),change:h.visitsChange,hint:"vs période précédente"}),i.jsx($t,{label:"Nouvelles cartes",value:ln(h.newCards),change:h.newCardsChange,hint:`${ln(h.cardsTotal)} au total`}),i.jsx($t,{label:"Clients actifs",value:ln(h.activeCustomers),hint:`${h.visitsPerCustomer.toLocaleString("fr-FR")} passage(s) par client`}),i.jsx($t,{label:"Clients fidèles",value:h.returningRate===null?"—":`${h.returningRate.toLocaleString("fr-FR")} %`,hint:"venus au moins 2 fois"}),l.pointsMode==="AMOUNT"&&i.jsx($t,{label:"Achats enregistrés",value:ti(h.revenueCents),hint:h.averageBasketCents===null?void 0:`panier moyen ${ti(h.averageBasketCents)}`}),i.jsx($t,{label:"Récompenses",value:ln(h.rewardsRedeemed),hint:`${ln(h.pointsGiven)} ${m} distribués`}),i.jsx($t,{label:"Cartes dans Apple Wallet",value:h.appleWalletRate===null?"—":`${h.appleWalletRate.toLocaleString("fr-FR")} %`,hint:"iPhone joignables"})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Fréquentation"}),i.jsxs("p",{className:"muted",style:{marginTop:0,fontSize:14},children:[i.jsx("span",{style:{display:"inline-block",width:10,height:10,background:"var(--primary)",borderRadius:2}})," Passages   ",i.jsx("span",{style:{display:"inline-block",width:10,height:10,background:"var(--primary-soft)",border:"1px solid var(--primary)",borderRadius:2}})," Nouvelles cartes"]}),i.jsx(Ov,{series:l.series})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Heures d'affluence"}),i.jsx("p",{className:"muted",style:{marginTop:0},children:l.busiest?`Créneau le plus fréquenté : ${l.busiest}.`:"Pas encore de passage sur la période."}),i.jsx(Bv,{heat:l.heatmap})]}),i.jsxs("section",{className:"card",children:[i.jsx("h2",{children:"Meilleurs clients"}),l.top.length===0?i.jsx("p",{className:"muted",style:{margin:0},children:"Pas encore de passage sur la période."}):i.jsx("div",{className:"table-scroll",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",children:"Client"}),i.jsx("th",{scope:"col",className:"num",children:"Passages"}),l.pointsMode==="AMOUNT"&&i.jsx("th",{scope:"col",className:"num",children:"Achats"}),i.jsx("th",{scope:"col",className:"num",children:"Solde"})]})}),i.jsx("tbody",{children:l.top.map((y,v)=>i.jsxs("tr",{children:[i.jsx("td",{children:y.firstName}),i.jsx("td",{className:"num",children:y.visits}),l.pointsMode==="AMOUNT"&&i.jsx("td",{className:"num",children:ti(y.amountCents)}),i.jsx("td",{className:"num",children:y.balance})]},v))})]})})]})]})]})}const bv=[["infos","Infos"],["carte","Carte de fidélité"],["employes","Employés"],["modules","Modules"],["statistiques","Statistiques"],["facturation","Facturation"]];function Vv(){var c,p,h;const{id:e}=af(),[t,n]=w.useState(null),[r,l]=w.useState(null),[s,o]=w.useState(null),a=w.useCallback(()=>{$.get(`/api/admin/stores/${e}`).then(n).catch(m=>l(m.message))},[e]);w.useEffect(a,[a]);async function u(m,y){if(!(y&&!window.confirm(y))){l(null);try{await $.patch(`/api/admin/stores/${e}/status`,{status:m}),a()}catch(v){l(v.message)}}}return t?i.jsxs(i.Fragment,{children:[i.jsx(Fe,{to:"/magasins",children:"← Magasins"}),i.jsxs("section",{className:"card store-head",children:[i.jsxs("div",{className:"store-id",children:[i.jsx("span",{className:"store-avatar","aria-hidden":"true",children:t.name.charAt(0).toUpperCase()}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsxs("div",{className:"row",style:{gap:12},children:[i.jsx("h1",{style:{fontSize:28,lineHeight:"34px"},children:t.name}),i.jsx(mf,{status:t.status}),((c=t.subscription)==null?void 0:c.stripeSubscriptionId)&&t.subscription.status!=="CANCELED"&&i.jsx(yl,{to:"facturation",className:"badge DRAFT",style:{textDecoration:"none"},title:"Formule d'abonnement",children:_t[t.subscription.plan]})]}),i.jsxs("p",{className:"muted",style:{margin:0},children:[t.city," · ",t.counts.cards," clients · ",t.counts.staff," employés · ",t.contactName]}),i.jsxs("ul",{className:"open-steps","aria-label":"Étapes d’ouverture",children:[i.jsxs("li",{className:((p=t.subscription)==null?void 0:p.status)==="ACTIVE"?"done":"",children:[((h=t.subscription)==null?void 0:h.status)==="ACTIVE"?"✓":"○"," Abonnement payé"]}),i.jsxs("li",{className:t.hasCard?"done":"",children:[t.hasCard?"✓":"○"," Carte conçue"]}),i.jsxs("li",{className:t.status==="ACTIVE"?"done":"",children:[t.status==="ACTIVE"?"✓":"○"," Programme ouvert"]})]})]})]}),i.jsxs("div",{className:"row",style:{gap:8},children:[(t.status==="DRAFT"||t.status==="CLOSED")&&i.jsx("button",{className:"btn",onClick:()=>u("ACTIVE"),children:"Activer"}),t.status==="SUSPENDED"&&i.jsx("button",{className:"btn",onClick:()=>u("ACTIVE"),children:"Réactiver"}),t.status==="ACTIVE"&&i.jsx("button",{className:"btn secondary",onClick:()=>u("SUSPENDED","Suspendre ce magasin ? Les employés ne pourront plus scanner."),children:"Suspendre"}),t.status!=="CLOSED"&&i.jsx("button",{className:"btn secondary",onClick:()=>u("CLOSED","Fermer ce magasin ?"),children:"Fermer"})]}),i.jsxs("div",{className:"copy-line",style:{flexBasis:"100%"},children:[i.jsx("span",{className:"muted",children:"Lien d’inscription :"}),i.jsx("code",{children:t.enrollUrl}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:()=>{var m;return(m=navigator.clipboard)==null?void 0:m.writeText(t.enrollUrl).then(()=>o("Lien copié."))},children:"Copier"})]})]}),t.status==="SUSPENDED"&&i.jsxs("div",{className:"alert warn",role:"status",children:["Magasin suspendu",t.billingSuspended?" pour impayé":""," : les scans et les nouvelles inscriptions sont refusés.",t.billingSuspended&&i.jsxs(i.Fragment,{children:[" Voir l'onglet ",i.jsx(yl,{to:"facturation",children:"Facturation"}),"."]})]}),r&&i.jsx("div",{className:"alert error",role:"alert",children:r}),s&&i.jsx("div",{className:"alert ok",role:"status",children:s}),i.jsx("nav",{className:"tabs","aria-label":"Sections du magasin",children:bv.map(([m,y])=>i.jsx(yl,{to:m,children:y},m))}),i.jsxs(qi,{children:[i.jsx(G,{index:!0,element:i.jsx(vl,{to:"infos",replace:!0})}),i.jsx(G,{path:"infos",element:i.jsx(gf,{initial:t,submitLabel:"Enregistrer",onSubmit:async m=>{const{name:y,siret:v,addressLine:j,postalCode:C,city:f,contactName:d,contactEmail:g,contactPhone:x,maxAmountEuros:N,minScanIntervalMin:S}=m;await $.patch(`/api/admin/stores/${e}`,{name:y,siret:v,addressLine:j,postalCode:C,city:f,contactName:d,contactEmail:g,contactPhone:x,maxAmountEuros:N,minScanIntervalMin:S}),o("Modifications enregistrées."),a()}},t.id)}),i.jsx(G,{path:"carte",element:i.jsx(Uf,{store:t,onSaved:a})}),i.jsx(G,{path:"employes",element:i.jsx(Tv,{storeId:t.id})}),i.jsx(G,{path:"modules",element:i.jsx(Fv,{storeId:t.id,storeName:t.name})}),i.jsx(G,{path:"statistiques",element:i.jsx($v,{storeId:t.id,storeSlug:t.slug})}),i.jsx(G,{path:"facturation",element:i.jsx(Av,{storeId:t.id,contactEmail:t.contactEmail,onChange:a})})]})]}):r?i.jsx("div",{className:"alert error",children:r}):i.jsx("p",{className:"muted",children:"Chargement…"})}function Du({merchant:e=!1}){const{id:t}=af(),n=e?"/api/staff/store":`/api/admin/stores/${t}`,r=e?"/api/staff/card-design":`/api/admin/stores/${t}/card-design`,[l,s]=ra(),o=l.get("format")==="A6"?"A6":"A5",[a,u]=w.useState(null),[c,p]=w.useState(null),[h,m]=w.useState(null);return w.useEffect(()=>{Promise.all([$.get(n),$.get(r)]).then(([y,v])=>{u(y),p(v)}).catch(y=>m(y.message))},[n,r]),h?i.jsx("div",{className:"alert error",style:{margin:24},children:h}):a?c?i.jsxs("div",{className:"poster-page",children:[i.jsx("style",{children:`@page{size:${o};margin:0}@media print{.no-print{display:none!important}body{background:#fff}.poster-page{padding:0!important}}`}),i.jsxs("div",{className:"no-print row between",style:{padding:16},children:[i.jsx(Fe,{to:e?"/espace":`/magasins/${t}/carte`,children:"← Retour à la carte"}),i.jsxs("div",{className:"row",style:{gap:8},children:[["A5","A6"].map(y=>i.jsx("button",{type:"button",className:"chip","aria-pressed":o===y,onClick:()=>s({format:y}),children:y},y)),i.jsx("button",{type:"button",className:"btn",onClick:()=>window.print(),children:"Imprimer"})]})]}),a.status!=="ACTIVE"&&i.jsx("div",{className:"alert warn no-print",style:{margin:"0 16px 16px"},children:"Le magasin n'est pas actif : le QR mène pour l'instant à une page « introuvable » ou « indisponible »."}),i.jsx("div",{style:{display:"flex",justifyContent:"center",padding:16},className:"poster-page",children:i.jsx(If,{format:o,url:a.enrollUrl,storeName:a.name,programName:c.programName,logoUrl:eo(c.logoUrl),backgroundColor:c.backgroundColor,foregroundColor:c.foregroundColor,labelColor:c.labelColor,rewards:c.rewards,pointsMode:c.pointsMode})}),i.jsx("p",{className:"no-print muted",style:{textAlign:"center"},children:a.enrollUrl})]}):i.jsx("div",{className:"alert warn",style:{margin:24},children:"Concevez d'abord la carte de fidélité."}):i.jsx("p",{className:"muted",style:{margin:24},children:"Chargement…"})}const Uu=e=>(e/100).toLocaleString("fr-FR",{style:"currency",currency:"EUR",minimumFractionDigits:e%100?2:0}),Ou=["ESSENTIEL","PRO","RESEAU"],Wv=[["name","Nom du commerce",{autoComplete:"organization",placeholder:"Boulangerie Kerlann",maxLength:120}],["siret","SIRET",{inputMode:"numeric",placeholder:"123 456 789 00012"}],["addressLine","Adresse",{autoComplete:"street-address",maxLength:200}],["postalCode","Code postal",{autoComplete:"postal-code",inputMode:"numeric",maxLength:5}],["city","Ville",{autoComplete:"address-level2",maxLength:120}],["contactName","Prénom et nom",{autoComplete:"name",maxLength:120}],["contactPhone","Téléphone",{autoComplete:"tel",type:"tel"}],["contactEmail","E-mail (votre identifiant de connexion)",{autoComplete:"email",type:"email"}]];function Hv(){const[e]=ra(),t=(e.get("formule")??"").toUpperCase(),[n,r]=w.useState(Ou.includes(t)?t:"PRO"),[l,s]=w.useState(e.get("periode")==="annuel"?"YEAR":"MONTH"),[o,a]=w.useState([]),[u,c]=w.useState({name:"",siret:"",addressLine:"",postalCode:"",city:"",contactName:"",contactPhone:"",contactEmail:"",password:""}),[p,h]=w.useState(!1),[m,y]=w.useState(e.get("annule")?"Paiement annulé : rien n’a été prélevé. Vous pouvez reprendre quand vous voulez.":null),[v,j]=w.useState(!1);w.useEffect(()=>{const x=N=>N.persisted&&j(!1);return window.addEventListener("pageshow",x),()=>window.removeEventListener("pageshow",x)},[]),w.useEffect(()=>{Ru.get("/api/public/signup/plans").then(a).catch(()=>{})},[]);async function C(x){x.preventDefault(),j(!0),y(null);try{const{url:N}=await Ru.post("/api/public/signup",{...u,plan:n,interval:l,cgv:p});window.location.assign(N)}catch(N){y(N.message),j(!1),window.scrollTo({top:0,behavior:"smooth"})}}const f=o.find(x=>x.plan===n),d=o.length?o:Ou.map(x=>({plan:x,name:_t[x],tagline:"",priceCents:{MONTH:0,YEAR:0},modules:[],limits:{maxStaff:null}})),g=x=>{const[,N,S]=Wv.find(([E])=>E===x);return i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:`s-${x}`,children:N}),i.jsx("input",{id:`s-${x}`,className:"input",required:!0,value:u[x],onChange:E=>c({...u,[x]:E.target.value}),...S})]},x)};return i.jsxs("main",{className:"s-page",children:[i.jsxs("header",{className:"s-head",children:[i.jsx("a",{href:"https://monespacepro.eu/",style:{textDecoration:"none",color:"inherit"},"aria-label":"MonEspacePro, accueil",children:i.jsx(Fr,{admin:!1})}),i.jsxs("span",{className:"muted",style:{fontSize:14},children:["Déjà inscrit ? ",i.jsx(Fe,{to:"/espace",children:"Se connecter"})]})]}),i.jsxs("form",{onSubmit:C,className:"s-layout",children:[i.jsxs("div",{className:"s-main",children:[i.jsxs("div",{children:[i.jsx("h1",{children:"Créer mon programme de fidélité"}),i.jsx("p",{className:"muted",style:{margin:"6px 0 0"},children:"Trois minutes, sans engagement. Votre espace est prêt dès le paiement validé."})]}),m&&i.jsx("div",{className:"alert error",role:"alert",children:m}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"1"}),i.jsx("h2",{children:"Votre formule"})]}),i.jsxs("div",{role:"group","aria-label":"Périodicité",className:"s-seg",children:[i.jsx("button",{type:"button","aria-pressed":l==="MONTH",onClick:()=>s("MONTH"),children:"Mensuel"}),i.jsx("button",{type:"button","aria-pressed":l==="YEAR",onClick:()=>s("YEAR"),children:"Annuel · 2 mois offerts"})]}),i.jsx("div",{className:"s-plans",role:"radiogroup","aria-label":"Formule",children:d.map(x=>i.jsxs("label",{className:`s-plan${n===x.plan?" on":""}`,children:[i.jsx("input",{type:"radio",name:"plan",className:"sr-only",checked:n===x.plan,onChange:()=>r(x.plan)}),x.plan==="PRO"&&i.jsx("span",{className:"s-tag",children:"Conseillée"}),i.jsx("strong",{children:x.name}),x.priceCents[l]>0&&i.jsxs("span",{className:"s-price",children:[Uu(x.priceCents[l]),i.jsxs("small",{children:[" / ",l==="YEAR"?"an":"mois"]})]}),i.jsx("span",{className:"muted",style:{fontSize:14},children:x.tagline})]},x.plan))})]}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"2"}),i.jsx("h2",{children:"Votre commerce"})]}),g("name"),g("siret"),g("addressLine"),i.jsxs("div",{className:"s-two",children:[g("postalCode"),g("city")]})]}),i.jsxs("section",{className:"card s-section",children:[i.jsxs("div",{className:"s-title",children:[i.jsx("span",{className:"s-num",children:"3"}),i.jsx("h2",{children:"Vos identifiants"})]}),i.jsxs("div",{className:"s-two",children:[g("contactName"),g("contactPhone")]}),g("contactEmail"),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"s-password",children:"Mot de passe"}),i.jsx("input",{id:"s-password",className:"input",type:"password",required:!0,minLength:10,autoComplete:"new-password",value:u.password,onChange:x=>c({...u,password:x.target.value})}),i.jsx("span",{className:"muted",style:{fontSize:14},children:"10 caractères minimum. Il ouvre votre espace web et l’app MonEspacePro."})]})]})]}),i.jsx("aside",{className:"s-side",children:i.jsxs("section",{className:"card s-summary",children:[i.jsx("span",{className:"muted",style:{fontSize:13,textTransform:"uppercase",letterSpacing:".05em"},children:"Récapitulatif"}),i.jsxs("div",{className:"row between",style:{alignItems:"baseline"},children:[i.jsxs("strong",{style:{fontSize:20},children:["Formule ",(f==null?void 0:f.name)??_t[n]]}),f&&i.jsxs("span",{style:{fontSize:22,fontWeight:800},children:[Uu(f.priceCents[l]),i.jsxs("span",{className:"muted",style:{fontSize:14,fontWeight:500},children:[" / ",l==="YEAR"?"an":"mois"]})]})]}),f&&i.jsxs("ul",{className:"s-list",children:[i.jsx("li",{children:"Carte dans Apple Wallet et Google Wallet"}),i.jsx("li",{children:f.limits.maxStaff?`${f.limits.maxStaff} employés`:"Employés illimités"}),f.modules.map(x=>i.jsx("li",{children:x.name},x.id))]}),i.jsxs("label",{className:"row",style:{gap:10,alignItems:"flex-start",flexWrap:"nowrap",fontSize:14},children:[i.jsx("input",{type:"checkbox",required:!0,checked:p,onChange:x=>h(x.target.checked),style:{marginTop:3}}),i.jsxs("span",{children:["J’accepte les ",i.jsx("a",{href:"https://monespacepro.eu/cgv/",target:"_blank",rel:"noreferrer",children:"CGV"})," et la"," ",i.jsx("a",{href:"https://monespacepro.eu/confidentialite/",target:"_blank",rel:"noreferrer",children:"politique de confidentialité"}),"."]})]}),i.jsx("button",{className:"btn",disabled:v,style:{width:"100%"},children:v?"Redirection vers le paiement…":"Continuer vers le paiement"}),i.jsxs("ul",{className:"s-trust",children:[i.jsx("li",{children:"🔒 Paiement sécurisé par Stripe"}),i.jsx("li",{children:"💳 Carte bancaire ou prélèvement SEPA"}),i.jsx("li",{children:"↩︎ Sans engagement, résiliable à tout moment"})]})]})})]})]})}function Qv({onLogin:e}){const t=Dt(),[n]=ra(),r=n.has("bienvenue"),[l,s]=w.useState(""),[o,a]=w.useState(""),[u,c]=w.useState(null),[p,h]=w.useState(!1);async function m(y){y.preventDefault(),h(!0),c(null);try{await Ng(l,o),e(),t("/espace",{replace:!0})}catch(v){c(r&&v instanceof ms&&v.status===401?"Votre espace est en cours de création. Réessayez dans quelques secondes.":v.message)}finally{h(!1)}}return i.jsx("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:16},children:i.jsxs("form",{className:"card",onSubmit:m,style:{width:"100%",maxWidth:420,display:"flex",flexDirection:"column",gap:20},children:[i.jsx(Fr,{admin:!1}),r&&i.jsx("div",{className:"alert ok",children:"Paiement reçu, merci ! Connectez-vous avec l’e-mail et le mot de passe choisis à l’inscription."}),i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:26},children:"Mon espace"}),i.jsx("p",{className:"muted",style:{margin:0},children:"Mêmes identifiants que l’app MonEspacePro."})]}),u&&i.jsx("div",{className:"alert error",role:"alert",children:u}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"m-email",children:"E-mail"}),i.jsx("input",{id:"m-email",className:"input",type:"email",autoComplete:"username",required:!0,value:l,onChange:y=>s(y.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"m-password",children:"Mot de passe"}),i.jsx("input",{id:"m-password",className:"input",type:"password",autoComplete:"current-password",required:!0,value:o,onChange:y=>a(y.target.value)})]}),i.jsx("button",{className:"btn",disabled:p,children:p?"Connexion…":"Se connecter"}),i.jsxs("p",{className:"muted",style:{margin:0,fontSize:14,textAlign:"center"},children:["Pas encore client ? ",i.jsx(Fe,{to:"/inscription",children:"Créer mon programme"})]})]})})}function Kv(){const[e,t]=w.useState(null),[n,r]=w.useState(null),[l,s]=w.useState(!1),[o,a]=w.useState(null),u=w.useCallback(()=>{$.get("/api/staff/store").then(t).catch(v=>r(v instanceof ms&&v.status===403?"Cet espace est réservé au Dirigeant du magasin. Utilisez l’app MonEspacePro pour scanner les cartes.":v.message)),$.get("/api/staff/card-design").then(v=>a(!!v)).catch(()=>a(null))},[]);w.useEffect(u,[u]);function c(v){var j;(j=navigator.clipboard)==null||j.writeText(v).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}const p=!!e&&!e.subscribeUrl,h=(e==null?void 0:e.status)==="ACTIVE",m=[["Abonnement",p?`Formule ${e!=null&&e.subscription?_t[e.subscription.plan]:""} active`:"En attente du paiement",p],["Carte de fidélité",o?"Conçue":"Logo, couleurs, récompenses",!!o],["Programme ouvert",h?"Vos clients peuvent s’inscrire":"S’ouvre automatiquement",h]],y=m.findIndex(([,,v])=>!v);return i.jsxs("div",{style:{minHeight:"100vh"},children:[i.jsxs("header",{className:"m-top",children:[i.jsx(Fr,{admin:!1}),i.jsx("span",{className:"grow"}),e&&i.jsx("span",{className:"muted",style:{fontSize:14},children:e.name}),e&&i.jsx("span",{className:"m-avatar","aria-hidden":"true",children:e.name.charAt(0).toUpperCase()}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:ia,children:"Se déconnecter"})]}),i.jsxs("main",{className:"container",style:{padding:24,display:"flex",flexDirection:"column",gap:24},children:[n&&i.jsx("div",{className:"alert error",role:"alert",children:n}),!e&&!n&&i.jsx("p",{className:"muted",children:"Chargement…"}),e&&i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"m-hero",children:[i.jsxs("div",{children:[i.jsx("h1",{children:e.name}),i.jsxs("p",{children:[e.subscription?`Formule ${_t[e.subscription.plan]}`:"Aucune formule"," ·"," ",h?"programme ouvert à vos clients":e.status==="SUSPENDED"?"programme suspendu":"programme pas encore ouvert"]})]}),e.subscribeUrl&&i.jsx("a",{className:"btn",href:e.subscribeUrl,children:"Activer mon abonnement"})]}),e.status==="SUSPENDED"&&i.jsx("div",{className:"alert warn",children:"Programme suspendu. Il rouvre automatiquement dès le paiement de l’abonnement régularisé."}),i.jsx("ol",{className:"m-steps","aria-label":"Étapes d’ouverture",children:m.map(([v,j,C],f)=>i.jsxs("li",{className:`m-step${C?" done":""}${f===y?" current":""}`,"aria-current":f===y?"step":void 0,children:[i.jsx("span",{className:"dot",children:C?"✓":f+1}),i.jsxs("div",{children:[i.jsx("strong",{children:v}),i.jsx("span",{children:j})]})]},v))}),i.jsxs("div",{className:"m-grid",children:[i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"🔗"}),i.jsx("h2",{children:"Lien d’inscription"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Vos clients s’inscrivent ici (c’est le QR code de l’affichette)."}),i.jsxs("div",{className:"m-copy",children:[i.jsx("code",{children:e.enrollUrl}),i.jsx("button",{type:"button",className:"btn secondary small",onClick:()=>c(e.enrollUrl),children:l?"Copié ✓":"Copier"})]})]}),i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"🖨️"}),i.jsx("h2",{children:"Affichette du comptoir"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"À imprimer en A5 ou A6 et à poser près de la caisse."}),i.jsx("div",{children:o?i.jsx(Fe,{className:"btn secondary",to:"/espace/affichette",children:"Imprimer l’affichette"}):i.jsx("span",{className:"muted",style:{fontSize:14},children:"Disponible une fois la carte conçue."})})]}),i.jsxs("section",{className:"card m-tile",children:[i.jsx("span",{className:"ico","aria-hidden":"true",children:"📱"}),i.jsx("h2",{children:"App MonEspacePro"}),i.jsx("p",{className:"muted",style:{margin:0,fontSize:14},children:"Scan des cartes, employés, modules (campagnes, anniversaire, relances…) et statistiques : avec les mêmes identifiants."})]})]}),i.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.jsx("h2",{children:"Ma carte de fidélité"}),i.jsx(Uf,{store:e,onSaved:u,base:"/api/staff/card-design",posterHref:"/espace/affichette",draftNote:i.jsx("p",{style:{margin:0},children:e.subscribeUrl?"Votre programme s’ouvrira automatiquement dès votre abonnement activé.":"Enregistrez la carte : votre programme s’ouvre automatiquement à vos clients."})})]})]})]})]})}function Yv(){const e=Dt(),t=Ft(),[n,r]=w.useState(jg()),l=t.pathname.startsWith("/espace");w.useEffect(()=>{wg(()=>{r(null),e(l?"/espace":"/connexion")})},[e,l]);const s=i.jsx(Qv,{onLogin:()=>r("staff")});return n!=="admin"||t.pathname==="/inscription"?i.jsxs(qi,{children:[i.jsx(G,{path:"/inscription",element:i.jsx(Hv,{})}),n==="staff"?i.jsxs(i.Fragment,{children:[i.jsx(G,{path:"/espace/affichette",element:i.jsx(Du,{merchant:!0})}),i.jsx(G,{path:"/espace",element:i.jsx(Kv,{})}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:"/espace",replace:!0})})]}):i.jsxs(i.Fragment,{children:[i.jsx(G,{path:"/espace",element:s}),i.jsx(G,{path:"/connexion",element:i.jsx(kg,{onLogin:()=>r("admin")})}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:l?"/espace":"/connexion",replace:!0})})]})]}):i.jsxs(qi,{children:[i.jsx(G,{path:"/espace",element:s}),i.jsx(G,{path:"/magasins/:id/affichette",element:i.jsx(Du,{})}),i.jsxs(G,{element:i.jsx(Eg,{}),children:[i.jsx(G,{path:"/magasins",element:i.jsx(Lg,{})}),i.jsx(G,{path:"/magasins/nouveau",element:i.jsx(_g,{})}),i.jsx(G,{path:"/magasins/:id/*",element:i.jsx(Vv,{})})]}),i.jsx(G,{path:"*",element:i.jsx(vl,{to:"/magasins",replace:!0})})]})}Xd(document.getElementById("root")).render(i.jsx(w.StrictMode,{children:i.jsx(hg,{future:{v7_startTransition:!0},children:i.jsx(Yv,{})})})); diff --git a/site/espace/affichette/index.html b/site/espace/affichette/index.html index cd283bc..44fac40 100644 --- a/site/espace/affichette/index.html +++ b/site/espace/affichette/index.html @@ -8,8 +8,8 @@ Affichette — MonEspacePro - - + +
diff --git a/site/espace/index.html b/site/espace/index.html index bd9bd2a..d77b8fb 100644 --- a/site/espace/index.html +++ b/site/espace/index.html @@ -8,8 +8,8 @@ Mon espace — MonEspacePro - - + +
diff --git a/site/inscription/index.html b/site/inscription/index.html index 507a708..74e5b5a 100644 --- a/site/inscription/index.html +++ b/site/inscription/index.html @@ -7,8 +7,8 @@ Créer mon programme de fidélité — MonEspacePro - - + +