1import{Q as te,N as se,au as j,av as ne,aw as re,D as ae,r as v,ax as g,j as e,ay as ie,w as S,S as le,az as E,aA as oe,aB as ce,aC as de,G as $,H as me}from"./index-DAzmh9nZ.js";import{a as ue,b as xe,T as pe,C as he,u as fe,E as be}from"./CoordonneesFields-BzKBBdAa.js";import{m as ge}from"./paiementEnCours-DK5dIu0X.js";function je(){return{data:te("frais_paiement")??null}}const O={oneshot:"Dons ponctuels",subscription:"Abonnements mensuels",installments:"Paiement en 4 fois"},k=t=>de({amount:t,currency:"EUR"});function Q({value:t,onMinus:i,onPlus:s}){return e.jsxs("div",{className:"flex shrink-0 items-center rounded-full border border-primary/10 bg-white p-1 shadow-[0_8px_20px_rgba(0,0,0,0.06)]",children:[e.jsx("button",{type:"button",onClick:i,"aria-label":"Diminuer",className:"flex h-8 w-8 items-center justify-center rounded-full text-lg font-bold text-primary",children:"â"}),e.jsx("span",{className:"w-8 text-center text-base font-black text-primary",children:t}),e.jsx("button",{type:"button",onClick:s,"aria-label":"Augmenter",className:"flex h-8 w-8 items-center justify-center rounded-full border-2 border-accent-purple text-lg font-bold text-accent-purple",children:"+"})]})}function ye(t){var s,o,r,l;return(((s=t.meta)==null?void 0:s.destinataires)??((o=t.meta)==null?void 0:o.destinataire)??((r=t.meta)==null?void 0:r.procuration)??((l=t.meta)==null?void 0:l.beneficiaire)??"").split("|").map(d=>d.trim()).filter(Boolean)}function H({item:t,modifiable:i=!0}){var y;const s=j(x=>x.setQuantity),o=j(x=>x.remove),r=ye(t),l=(y=t.meta)==null?void 0:y.arbres,d=r.length>0,u=r.length>1?l?`${l} arbres · un nom chacun`:`${r.length} noms`:l?`${l} arbres · un seul nom`:"Dédié à ",p=r.some(x=>x!=="Anonyme"),m=i&&!ce(g(t))&&!p,c=e.jsxs("button",{type:"button",onClick:()=>o(t.id),className:"inline-flex min-h-[44px] items-center gap-1.5 rounded-md text-sm font-semibold text-danger hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-purple",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Retirer"]}),a=t.emoji??"ð³",b=(a.match(new RegExp("\\p{Extended_Pictographic}","gu"))??[]).length>1;return e.jsxs("div",{className:"mb-4 grid grid-cols-[60px_minmax(0,1fr)_auto] gap-x-4 gap-y-2 rounded-xl border border-line-soft bg-white p-4 shadow-[0_6px_18px_rgba(var(--kc-rgb-primary),0.05)]",children:[e.jsx("div",{className:"flex h-[60px] w-[60px] items-center justify-center overflow-hidden rounded-xl bg-surface-purple-50 sm:row-span-2",children:t.image?e.jsx("img",{src:t.image,alt:"",className:"h-full w-full rounded-xl object-cover"}):e.jsx("span",{"aria-hidden":"true",className:S("whitespace-nowrap leading-none",b?"text-xl":"text-3xl"),children:a})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-bold leading-tight text-primary",children:t.name}),d&&e.jsx("p",{className:"mt-1 text-xs font-medium text-ink-muted-purple",children:u}),(()=>{var h;const x=((h=t.meta)==null?void 0:h.paiement)??(g(t)==="subscription"?"Abonnement mensuel":g(t)==="installments"?"Paiement en 4 fois":null);return x?e.jsxs("span",{className:"mt-1.5 inline-flex items-center gap-1 rounded-md bg-surface-purple-50 px-2 py-0.5 text-xs font-bold text-accent-purple",children:["ð³ ",x]}):null})()]}),e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"text-right font-brand text-lg font-bold leading-tight text-primary",children:k(t.unitPrice.amount*t.quantity)}),i&&!m&&!d&&c]}),d&&e.jsxs("div",{className:"col-span-3 flex items-start gap-3 sm:col-span-2 sm:col-start-2",children:[e.jsx("ul",{"aria-label":"Noms",className:"flex min-w-0 flex-1 flex-wrap content-start gap-1.5",children:r.map((x,h)=>e.jsx("li",{className:S("max-w-full break-words rounded-full border px-3 py-1 text-sm font-semibold leading-5",x==="Anonyme"?"border-dashed border-ink-dim bg-white text-ink-muted-purple":"border-purple-200 bg-gradient-to-b from-white to-surface-purple-50 text-accent-purple shadow-[0_1px_2px_rgba(var(--kc-rgb-primary),0.06)]"),children:x},`${x}-${h}`))}),i&&!m&&e.jsx("div",{className:"-my-[7px] shrink-0",children:c})]}),m&&e.jsxs("div",{className:"col-span-3 flex items-center justify-between gap-3 sm:col-span-2 sm:col-start-2",children:[e.jsx(Q,{value:t.quantity,onMinus:()=>s(t.id,t.quantity-1),onPlus:()=>s(t.id,t.quantity+1)}),c]})]})}function ve(){return e.jsxs("div",{className:"flex flex-col gap-4 roun
1ded-xl border border-dashed border-line-form bg-white p-6 shadow-[0_6px_18px_rgba(var(--kc-rgb-primary),0.05)] sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-surface-purple-50 text-2xl","aria-hidden":"true",children:"ð"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-primary",children:"Votre panier est vide"}),e.jsx("p",{className:"mt-1 text-sm text-ink-muted-purple",children:"Ajoutez un projet ou une cause pour commencer votre don."})]})]}),e.jsx(E,{to:"/",className:"w-full whitespace-nowrap rounded-[10px] bg-primary px-3.5 py-2.5 text-center text-sm font-bold text-white no-underline sm:ml-auto sm:w-auto",children:"Découvrir nos actions"})]})}function Ne(){var c;const t=j(a=>a.add),i=j(a=>a.remove),s=j(a=>a.items.find(b=>b.id==="upsell-passion")),o=!!s,r=(s==null?void 0:s.quantity)??1,l=(c=s==null?void 0:s.meta)==null?void 0:c.destinataires,[d,u]=v.useState(()=>l&&l!=="Anonyme"?l:""),p=1600,m=(a,b,y)=>{i("upsell-passion"),a&&t({id:"upsell-passion",slug:"arbre-fruitier",name:"Fruit de la Passion",unitPrice:{amount:p,currency:"EUR"},emoji:"ð",meta:{destinataires:y.trim().slice(0,$.name)||"Anonyme"}},b)};return e.jsxs("div",{className:"relative my-4 overflow-hidden rounded-3xl border-2 border-orange-400 bg-[#fff7ed] p-5 shadow-[0_0_30px_rgba(251,146,60,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute -right-12 -top-12 h-28 w-28 rounded-full bg-orange-500/10 blur-2xl"}),e.jsxs("div",{className:"relative z-10 mb-3.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white text-lg shadow-sm",children:"ð³"}),e.jsx("span",{className:"text-sm font-black leading-tight text-primary-light",children:"Plantez un Fruit de la passion en sadaqa jariyah ð"})]}),e.jsxs("label",{className:"relative inline-block h-[18px] w-[34px] shrink-0",children:[e.jsx("input",{type:"checkbox",checked:o,"aria-label":"Ajouter un arbre fruitier en sadaqa jariyah",onChange:a=>m(a.target.checked,1,d),className:"peer sr-only"}),e.jsx("span",{className:"absolute inset-0 cursor-pointer rounded-full bg-toggle-off transition peer-checked:bg-primary"}),e.jsx("span",{className:"absolute bottom-0.5 left-0.5 h-3.5 w-3.5 rounded-full bg-white transition peer-checked:translate-x-4"})]})]}),e.jsxs("p",{className:"relative z-10 mb-2.5 text-xs font-bold leading-snug text-primary-light/55",children:["Plantez un arbre fruitier en Sadaqah Jariyah pour développer une économie locale."," ",e.jsx("u",{className:"font-black text-primary-light/70",children:"Dédiez cet arbre au nom de :"})]}),e.jsx("input",{type:"text",value:d,maxLength:$.name,autoComplete:"off","aria-label":"Dédier cet arbre au nom de",onChange:a=>{const b=me(a.target.value);u(b),o&&m(!0,r,b)},placeholder:"Leila RAHMANI, Ismael FOFANA...",className:"w-full rounded-xl border border-primary-light/10 bg-white/50 px-3.5 py-2 text-sm font-bold text-primary-light outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10"}),e.jsx("div",{className:"my-2.5 flex flex-wrap justify-center gap-1.5",children:["ð¥ Vidéo personnalisée","ð Coordonnées GPS","ð Certificat à offrir"].map(a=>e.jsx("span",{className:"inline-flex items-center gap-1 rounded-lg border border-primary-light/5 bg-white/60 px-2 py-1 text-xs font-black uppercase tracking-wide text-primary-light shadow-sm",children:a},a))}),o&&e.jsxs("div",{className:"relative z-10 flex items-center justify-between gap-2",children:[e.jsx(Q,{value:r,onMinus:()=>m(!0,Math.max(1,r-1),d),onPlus:()=>m(!0,Math.min(20,r+1),d)}),e.jsxs("span",{className:"whitespace-nowrap text-xl font-black text-primary-light",children:["+ ",k(r*p)]})]})]})}function we({onSubmit:t,register:i,control:s,errors:o}){return e.jsxs("form",{id:"donForm",onSubmit:t,noValidate:!0,className:"mt-8",children:[e.jsx("h2",{className:"mb-4 text-xl font-extrabold text-primary",children:"Vos coordonnées"}),e.jsx("div",{className:"rounded-xl border border-line-soft bg-white p-6 shadow-[0_4px_10px_rgba(0,0,0,0.03)]",children:e.jsx(he,{register:i,control:s,errors:o})})]})}function G(t,i,s,o,r,l){const d=i.reduce((c,a)=>c+a.unitPrice.amount*a.quantity,0),u=o&&t==="oneshot"?r:0,p=d+u,m=i.map(c=>({id:c.id,slug:c.slug,name:c.name,unitPrice:c.unitPrice,quantity:c.quantity,meta:c.meta}));return u>0&&m.push({id:"frais-paiement",slug:"frais",name:"Frais de paiement",unitPrice:{amount:u,currency:"EUR"},quantity:1}),{mode:t,label:O[t],amount:p,payload:{mode:t,lines:m,customer:s,amount:{amount:p,currency:"EUR"},feesIncluded:o,turnstileToken:l??void 0}}}function ke(t,i,s,o,r){const l=[],d=t.filter(u=>g(u)==="oneshot");d.length&&l.push(G("oneshot",d,i,s,o,r));for(const u of t.filter(p=>g(p)!=="oneshot")){const p=Math.max(1,u.quantity),m={...u,quantity:1};for(let c=0;c<p;
1c++)l.push(G(g(u),[m],i,s,o,r))}return l}function Ce({segment:t,index:i,total:s,onSuccess:o,onCancel:r,retour:l}){const d=fe(i,{onMount:!0});return e.jsxs("div",{ref:d,className:"rounded-xl border border-line-soft bg-white p-5 shadow-[0_8px_20px_rgba(var(--kc-rgb-primary),0.06)]",children:[s>1&&e.jsxs("p",{className:"mb-1 text-xs font-bold uppercase tracking-wide text-ink-muted-purple",children:["Paiement ",i+1,"/",s]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"font-bold text-primary",children:t.label}),e.jsx("span",{className:"font-brand text-lg font-black text-primary",children:k(t.amount)})]}),e.jsx(be,{payload:t.payload,onSuccess:o},i),e.jsxs("button",{type:"button",onClick:r,className:"mt-3 w-full text-center text-sm font-semibold text-ink-muted-purple transition hover:text-primary",children:["â ",l]})]})}function Me({engagement:t}={}){se(t?"Mon engagement":"Faire un don");const i=j(n=>n.items),s=t?[t]:i,o=j(n=>n.clearModes),r=j(n=>n.remove),l=ne(),d=re(),u=t?t.unitPrice.amount*t.quantity:d,p=ae(),[m,c]=v.useState(!1),[a,b]=v.useState(null),[y,x]=v.useState(null),[h,C]=v.useState(null),[N,q]=v.useState(0),[A,W]=v.useState(null),{register:D,control:J,handleSubmit:K,formState:{errors:w}}=ue({resolver:xe(oe),mode:"onBlur",shouldFocusError:!1}),{data:X}=je(),_=X??0,P=Array.from(new Set(s.map(g))),I=s.length>0&&P.every(n=>n==="oneshot")&&_>0,V=u+(m&&I?_:0),Y=n=>{var T,L;if(s.length===0){x("Votre panier est vide â ajoutez un don avant de valider.");return}x(null);const f={prenom:n.prenom,nom:n.nom,email:n.email,tel:n.tel,adresse:n.adresse,ville:n.ville,cp:n.cp},z=s.filter(F=>g(F)==="installments"),R=z.reduce((F,U)=>F+U.unitPrice.amount*U.quantity,0),M=Number((L=(T=z[0])==null?void 0:T.meta)==null?void 0:L.installments),ee=Number.isFinite(M)&&M>0?M:4,B={prenom:n.prenom,nom:n.nom,email:n.email,tel:n.tel,amount:V,...R>0?{installmentsAmount:R,installmentsCount:ee}:{}};W(B),ge(B),q(0),C(ke(s,f,m,_,a))},Z=n=>{if(h){if(t){p("/don/merci",{state:{...A,orderCode:n}}),C(null);return}for(const f of h[N].payload.lines)f.id&&f.id!=="frais-paiement"&&r(f.id);N+1<h.length?q(N+1):(o(h.map(f=>f.mode)),p("/don/merci",{state:{...A,orderCode:n}}),C(null))}};return e.jsxs("div",{className:"bg-surface-page-2 px-[5%] py-5 min-[900px]:px-[10%] min-[900px]:py-10",children:[e.jsxs("div",{className:"mb-5 flex flex-col items-start gap-2 sm:flex-row sm:items-center sm:justify-between",children:[t?e.jsx("h1",{className:"text-2xl font-extrabold text-primary",children:"Mon engagement"}):e.jsxs("h1",{className:"text-2xl font-extrabold text-primary",children:["Mon Panier"," ",e.jsxs("span",{className:"text-xl font-normal text-ink-muted-purple",children:["(",l," article",l>1?"s":"",")"]})]}),!t&&s.length>0&&e.jsxs("button",{type:"button",onClick:()=>o(["oneshot","subscription","installments"]),className:"inline-flex items-center gap-1.5 text-sm font-semibold text-danger",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Tout supprimer"]})]}),e.jsxs("div",{className:S("flex flex-col gap-[30px]",h?"mx-auto max-w-[520px]":"min-[900px]:grid min-[900px]:grid-cols-[1fr_360px] min-[900px]:items-start min-[900px]:gap-10"),children:[e.jsxs("div",{className:h?"hidden":void 0,children:[s.length===0?e.jsx(ve,{}):P.length===1?s.map(n=>e.jsx(H,{item:n,modifiable:!t},n.id)):P.map(n=>e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-3 text-sm font-extrabold uppercase tracking-wide text-ink-muted-purple",children:O[n]}),s.filter(f=>g(f)===n).map(f=>e.jsx(H,{item:f},f.id))]},n)),e.jsx(we,{onSubmit:K(Y,n=>ie(document.getElementById("donForm"),Object.keys(n))),register:D,control:J,errors:w})]}),e.jsx("div",{className:"min-[900px]:sticky min-[900px]:top-28",children:h?e.jsx(Ce,{segment:h[N],index:N,total:h.length,onSuccess:Z,onCancel:()=>C(null),retour:t?"Revenir à mon engagement":"Modifier mon panier"}):e.jsxs("div",{className:"rounded-xl border border-line-soft bg-white p-5 shadow-[0_8px_20px_rgba(var(--kc-rgb-primary),0.06)]",children:[I&&e.jsxs("div",{className:"rounded-[10px] border border-primary/8 bg-[#e0f2f1] p-3.5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2 font-bold text-primary",children:"ð¶ Participez aux frais"}),e.jsxs("label",{className:"relative inline-block h-[18px] w-[34px] shrink-0",children:[e.jsx("input",{type:"checkbox",checked:m,"aria-label":"Participer aux frais de paiement",onChange:n=>c(n.target.checked),className:"peer sr-only"}),e.jsx("span",{className:"absolute inset-0 cursor-pointer rounded-full bg-toggle-off transition peer-checked:bg-primary"}),e.jsx("span",{className:"absolute bottom-0.5 left-0.5 h-3.5 w-3.5 rounded-full bg-white transition peer-checked:translate-x-4"})]})]}),e.jsx("p",{className:"text-[0.85rem] leading-relaxed text-primary/95",children:"Merci de prendre en compte les frais de paiement pour soutenir notre action."}),e.jsxs("div",{className:"mt-1 text-right text-[1.05rem] font-extrabold text-primary",children:["+ ",k(_)]})]}),!P.some(n=>n==="subscription"||n==="installments")&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{}),e.jsx("div",{className:"my-4 h-px bg-[#eee]"})]}),e.jsxs("div",{className:"mb-5 flex items-center justify-between text-[1.05rem] font-bold text-primary",children:[e.jsx("span",{children:"Montant total :"}),e.jsx("span",{className:"font-brand",children:k(V)})]}),e.jsx("div",{className:"mb-4 flex justify-center",children:e.jsx(pe,{onVerify:b})}),y&&e.jsx("div",{role:"alert",className:"mb-3 rounded-lg border border-danger/30 bg-danger/5 px-3 py-2.5 text-sm font-semibold text-danger",children:y}),e.jsxs("button",{type:"submit",form:"donForm",disabled:!a||s.length===0,className:S(le({variant:"primary",size:"lg"}),"w-full py-3.5 shadow-[0_4px_12px_rgba(var(--kc-rgb-primary),0.2)] disabled:opacity-70"),children:["Faites votre don",e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e.jsx("polyline",{points:"12 5 19 12 12 19"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-col items-center text-center",children:[e.jsxs("label",{className:"flex max-w-[420px] cursor-pointer items-start justify-center gap-2.5 text-[0.8rem] leading-snug text-ink-muted-purple",children:[e.jsx("input",{type:"checkbox",form:"donForm",className:"mt-0.5","aria-invalid":w.terms?!0:void 0,"aria-describedby":w.terms?"donForm-terms-error":void 0,...D("terms")}),e.jsxs("span",{children:["Je confirme avoir lu et accepté la"," ",e.jsxs(E,{to:"/confidentialite",target:"_blank",rel:"noopener noreferrer",className:"font-bold text-primary underline",children:["Politique de Confidentialité",e.jsx("span",{className:"sr-only",children:" (nouvel onglet)"})]})," ","et les"," ",e.jsxs(E,{to:"/cgv",target:"_blank",rel:"noopener noreferrer",className:"font-bold text-primary underline",children:["Conditions Générales de Participation",e.jsx("span",{className:"sr-only",children:" (nouvel onglet)"})]}),", et accepte l'exécution immédiate de ma participation."]})]}),w.terms&&e.jsx("div",{id:"donForm-terms-error",role:"alert",className:"mt-2 max-w-[420px] text-[0.85rem] text-danger",children:w.terms.message})]}),e.jsx("h3",{className:"mb-2 mt-5 text-center text-base font-bold text-primary",children:"Moyens de paiement acceptés"}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:e.jsx("img",{src:"https://cdn.kebchi.fr/site_kebchi/panier/payments.webp",alt:"Moyens de paiement acceptés",className:"h-auto w-full max-w-[360px] opacity-90",loading:"lazy"})}),e.jsx("div",{className:"mt-2.5 text-center text-[0.8rem] text-ink-muted-purple",children:"Paiement 100% Sécurisé"})]})})]})]})}export{Me as CartPage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.