tybotflow-widget 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -59730,7 +59730,7 @@ function mZ({ onValidate: i, agentChatResponseColor: A, agentChatResponseBgColor
|
|
|
59730
59730
|
},
|
|
59731
59731
|
children: [
|
|
59732
59732
|
/* @__PURE__ */ S.jsxs("div", { className: "space-y-2", children: [
|
|
59733
|
-
/* @__PURE__ */ S.jsx("label", { className: "block text-sm font-medium", children: "
|
|
59733
|
+
/* @__PURE__ */ S.jsx("label", { className: "block text-sm font-medium", children: "Choisissez votre situation actuelle *" }),
|
|
59734
59734
|
/* @__PURE__ */ S.jsx("div", { className: "grid grid-cols-1 gap-2", children: slA.map((l) => /* @__PURE__ */ S.jsxs(
|
|
59735
59735
|
"button",
|
|
59736
59736
|
{
|
package/dist/index.umd.js
CHANGED
|
@@ -537,7 +537,7 @@ end`};A.events.push(["putFont",function(I){(function(B){var t=B.font,o=B.out,a=B
|
|
|
537
537
|
input::placeholder {
|
|
538
538
|
color: ${A+"80"};
|
|
539
539
|
}
|
|
540
|
-
`}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2 pb-2 border-b",style:{borderColor:e+"40"},children:[S.jsx(ca,{className:"w-4 h-4",style:{color:A}}),S.jsx("h3",{className:"text-sm font-semibold",children:"Informations personnelles"})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Nom complet *"}),S.jsx("input",{type:"text",value:a.nom,onChange:R=>w("nom",R.target.value),placeholder:"Votre nom et prénom",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Nom de l'entreprise *"}),S.jsx("input",{type:"text",value:a.entreprise,onChange:R=>w("entreprise",R.target.value),placeholder:"Ex. : ACME SARL",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Email professionnel *"}),S.jsx("input",{type:"email",value:a.email,onChange:R=>w("email",R.target.value),placeholder:"ex. nom@startup.com",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Numéro de téléphone *"}),S.jsx("input",{type:"tel",value:a.phone,onChange:R=>w("phone",R.target.value),placeholder:"Inclure l'indicatif international (ex. +212...)",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Poste *"}),S.jsx("input",{type:"text",value:a.poste,onChange:R=>w("poste",R.target.value),placeholder:"Ex. : CEO, Ingénieur, Étudient ...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Secteur d'activité *"}),S.jsx("div",{className:`grid ${s?"grid-cols-1":"grid-cols-2"} gap-2`,children:Y.map(R=>S.jsx("button",{onClick:()=>w("secteur",R),className:"px-3 py-2 text-sm rounded-lg transition-colors text-left",style:{backgroundColor:a.secteur===R?o:t||g+"60",color:a.secteur===R?E:A,borderRadius:"10px",border:`1px solid ${e}`},children:R},R))})]})]}),S.jsxs("button",{onClick:M,disabled:!c(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Valider ma candidature"]})]})}function YW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState({fullName:"",phone:"",email:"",ville:""}),r=(c,l)=>{a(Y=>({...Y,[c]:l}))},s=()=>{i(o)},w=()=>o.fullName.trim()!==""&&o.phone.trim()!==""&&o.email.trim()!==""&&o.ville.trim()!=="",M={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(ca,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire de contact"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ca,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:o.fullName,onChange:c=>r("fullName",c.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ay,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:o.phone,onChange:c=>r("phone",c.target.value),placeholder:"Entrez votre numéro de téléphone...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Qy,{className:"w-4 h-4"}),"Email *"]}),S.jsx("input",{type:"email",value:o.email,onChange:c=>r("email",c.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:o.ville,onChange:c=>r("ville",c.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]})]}),S.jsxs("button",{onClick:s,disabled:!w(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}function GW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState({nomComplet:"",numero:"",nomMachine:"",email:"",ville:"",typeDeProjet:""}),r=(c,l)=>{a(Y=>({...Y,[c]:l}))},s=()=>{i(o)},w=()=>o.nomComplet.trim()!==""&&o.numero.trim()!==""&&o.nomMachine.trim()!==""&&o.ville.trim()!=="",M={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(iQ,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire XCMG"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ca,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:o.nomComplet,onChange:c=>r("nomComplet",c.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ay,{className:"w-4 h-4"}),"Numéro *"]}),S.jsx("input",{type:"tel",value:o.numero,onChange:c=>r("numero",c.target.value),placeholder:"Entrez votre numéro...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Qy,{className:"w-4 h-4"}),"Email"]}),S.jsx("input",{type:"email",value:o.email,onChange:c=>r("email",c.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:o.ville,onChange:c=>r("ville",c.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(iQ,{className:"w-4 h-4"}),"Nom machine *"]}),S.jsx("input",{type:"text",value:o.nomMachine,onChange:c=>r("nomMachine",c.target.value),placeholder:"Entrez le nom de la machine...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(iQ,{className:"w-4 h-4"}),"Type de projet"]}),S.jsxs("select",{value:o.typeDeProjet,onChange:c=>r("typeDeProjet",c.target.value),className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e},children:[S.jsx("option",{value:"",children:"Sélectionnez le type de projet"}),S.jsx("option",{value:"BTP",children:"BTP"}),S.jsx("option",{value:"infrastructure",children:"infrastructure"}),S.jsx("option",{value:"PME",children:"PME"}),S.jsx("option",{value:"Autre",children:"Autre"})]})]})]}),S.jsxs("button",{onClick:s,disabled:!w(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const XMA=["Étudiant(e) en préparation du Bac","Titulaire du Bac (moins de 3 ans)","Étudiant(e) en études supérieures","Diplômé(e) sans emploi"];function FW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState(""),[r,s]=_A.useState(""),w={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`},M=()=>{i({situation:o,ville:r})},c=()=>o.trim()!==""&&r.trim()!=="";return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(ca,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire Jadara"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Situation actuelle *"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:XMA.map(l=>S.jsxs("button",{type:"button",onClick:()=>a(l),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:o===l?e:t||g+"60",color:o===l?E:A,borderRadius:`${I}px`,border:`1px solid ${e}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:o===l?S.jsx(kgA,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:l})]},l))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:r,onChange:l=>s(l.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...w,"--tw-ring-color":e}})]})]}),S.jsxs("button",{onClick:M,disabled:!c(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const _MA=["Marketing digital","Développement web","Création de contenu"];function mW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState(""),r=s=>{a(s),i({Domaines_qui_vous_interessent:s})};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[S.jsx(GgA,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Domaines d'intérêt"})]}),S.jsx("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:g,borderRadius:`${I}px`},children:S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Domaines qui vous intéressent"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:_MA.map(s=>S.jsxs("button",{type:"button",onClick:()=>r(s),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:o===s?e:t||g+"60",color:o===s?E:A,borderRadius:`${I}px`,border:`1px solid ${e}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:o===s?S.jsx(KC,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:s})]},s))})]})})]})}function Ac({products:i,onValidate:A,agentChatResponseColor:g,agentChatResponseBgColor:e,buttonsBgColor:E,buttonColor:I,chatRoundness:B,panelWidth:t,inputBackgroundColor:o}){const[a,r]=_A.useState({}),[s,w]=_A.useState(!1),[M,c]=_A.useState(0),l=t<700,Y=t>=1300,R=Math.ceil((i?.length||0)/(l?1:Y?3:2)),F=()=>{c(W=>(W+1)%R)},m=()=>{c(W=>(W-1+R)%R)},K=W=>{c(W)},O=W=>{r(T=>({...T,[W]:(T[W]||0)+1}))},p=W=>{r(T=>{const AA={...T};return AA[W]>1?AA[W]-=1:delete AA[W],AA})},q=()=>Object.entries(a).map(([W,T])=>({id_produit:W,quantite:T})),H=()=>Object.values(a).reduce((W,T)=>W+T,0),x=()=>{const T={products:q()};A(T)},Z=()=>Object.entries(a).map(([W,T])=>({product:i.find(P=>P.id===W),quantity:T})).filter(W=>W.product),y=()=>Z().reduce((W,{product:T,quantity:AA})=>W+T.price*AA,0),z=()=>{const W=[];for(let T=0;T<i.length;T+=l?1:Y?3:2)W.push(i.slice(T,T+(l?1:Y?3:2)));return W};return S.jsxs("div",{className:"w-full mx-auto",style:{color:g},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Produits Disponibles"}),H()>0&&S.jsxs("button",{onClick:()=>w(!s),className:"flex items-center gap-2 px-3 py-2 rounded-lg transition-colors",style:{backgroundColor:E+"20",color:I,borderRadius:`${B}px`},children:[S.jsx(NgA,{className:"w-4 h-4"}),S.jsxs("div",{className:"flex flex-col items-end text-xs",children:[S.jsxs("span",{children:[H()," articles"]}),S.jsx("span",{children:y()>0?`${y().toFixed(2)} DH`:""})]})]})]}),S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"relative overflow-hidden mb-6",children:[S.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${M*100}%)`},children:z().map((W,T)=>S.jsx("div",{className:`w-full flex-shrink-0 grid ${l?"grid-cols-1":Y&&i.length>=3?"grid-cols-3":"grid-cols-2"} gap-4 p-2`,children:W.map(AA=>S.jsxs("div",{className:"p-4 rounded-lg border border-opacity-20",style:{backgroundColor:e+"40",borderColor:g,borderRadius:`${B}px`},children:[S.jsx("div",{className:"relative w-full h-40 mb-3 rounded-md overflow-hidden",children:S.jsx("img",{src:AA?.image??"",alt:AA.nomProduit,className:"w-full h-full object-contain bg-gray-100"})}),S.jsx("h3",{className:"font-semibold text-sm mb-2",style:{color:g},children:AA.nomProduit}),S.jsx("p",{className:"text-xs text-opacity-70 mb-2 line-clamp-2",style:{color:g},title:AA.description,children:AA.description}),S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsxs("div",{className:"text-xs",style:{color:g},children:[AA.stock>0?"In Stock":"Out of stock",S.jsx("br",{}),"Prix: ",AA.price!=0?`${AA.price} DH`:"-"]}),S.jsx("div",{className:"flex items-center gap-2",children:a[AA.id]?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>p(AA.id),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:I},children:S.jsx(qu,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[20px] text-center text-sm font-semibold",children:a[AA.id]}),S.jsx("button",{onClick:()=>O(AA.id),disabled:a[AA.id]>=AA.stock,className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors disabled:opacity-50",style:{backgroundColor:E,color:I},children:S.jsx(Wh,{className:"w-4 h-4"})})]}):S.jsx("button",{onClick:()=>O(AA.id),disabled:AA.stock===0,className:"px-3 py-1 text-xs rounded-lg transition-colors disabled:opacity-50",style:{backgroundColor:E,color:I,borderRadius:`${B}px`},children:AA.price===0?"Ajouter au devis":"Ajouter au panier"})})]})]},AA.id))},T))}),R>1&&S.jsxs(S.Fragment,{children:[M>0&&S.jsx("button",{onClick:m,className:"absolute left-0 top-24 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),M<R-1&&S.jsx("button",{onClick:F,className:"absolute right-0 top-24 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),R>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:Array.from({length:R}).map((W,T)=>S.jsx("button",{onClick:()=>K(T),className:`w-2 h-2 rounded-full transition-all duration-200 ${T===M?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},T))})]}),s&&H()>0&&S.jsxs("div",{className:"mt-3 p-4 rounded-lg border border-opacity-20 mb-4",style:{backgroundColor:e+"60",borderColor:g,borderRadius:`${B}px`},children:[S.jsxs("h3",{className:"font-semibold mb-3",children:["Produits sélectionnés: (",H()," articles)"]}),S.jsx("div",{className:"space-y-2",children:Z().map(({product:W,quantity:T})=>S.jsxs("div",{className:"flex justify-between items-center text-sm",children:[S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{children:W.nomProduit}),S.jsx("div",{className:"text-xs opacity-70",children:W.price>0?`${W.price.toFixed(2)} DH × ${T}`:`× ${T}`})]}),S.jsx("span",{className:"ml-2 font-medium",children:W.price*T>0?`${(W.price*T).toFixed(2)} DH`:""})]},W.id))}),y()>0&&S.jsx("div",{className:"border-t border-opacity-30 mt-3 pt-3",style:{borderColor:g},children:S.jsxs("div",{className:"flex justify-between items-center font-semibold",children:[S.jsx("span",{children:"Total:"}),S.jsxs("span",{children:[y().toFixed(2)," DH"]})]})})]}),H()>0&&S.jsxs("button",{onClick:x,className:"w-full px-6 py-3 mt-3 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2",style:{backgroundColor:E,color:I,borderRadius:`${B}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Valider la sélection (",H()," articles) ",y()!==0?`- ${y().toFixed(2)} DH`:""]})]})}const $MA=({options:i,message:A,allowMultiple:g,chatRoundness:e,buttonsBgColor:E,buttonColor:I,agentChatResponseColor:B,agentChatResponseBgColor:t,isRtl:o,onSend:a,onScroll:r})=>{const[s,w]=_A.useState([]),M=(R,F)=>{try{let m=R.replace("#","");m.length===3&&(m=m.split("").map(H=>H+H).join(""));const K=parseInt(m,16);let O=(K>>16)+F,p=(K>>8&255)+F,q=(K&255)+F;return O=Math.max(0,Math.min(255,O)),p=Math.max(0,Math.min(255,p)),q=Math.max(0,Math.min(255,q)),"#"+(O<<16|p<<8|q).toString(16).padStart(6,"0")}catch{return R}},c=t?M(t,10):E,l=R=>{g?w(F=>F.includes(R)?F.filter(K=>K!==R):[...F,R]):a(R)},Y=()=>{s.length>0&&(a(s.join(",")),w([]))};return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"mt-2 flex flex-col",dir:o?"rtl":"ltr",children:i?.map((R,F)=>{const m=g&&s.includes(R.value);return S.jsxs("button",{className:"w-full mb-1 flex items-center justify-between px-4 py-2.5 hover:opacity-95 transition-all duration-100",onClick:()=>l(R.value),onMouseEnter:K=>{K.currentTarget.style.borderColor=`${E}`},onMouseLeave:K=>{const O=m?E:M(c,20);K.currentTarget.style.border=`2px solid ${O}`},style:{background:m?`linear-gradient(135deg, ${E}, ${E}DD)`:c,borderRadius:"18px",color:B,border:`2px solid ${M(c,20)}`,opacity:m?.95:1,transform:m?"scale(0.99)":"scale(1)"},children:[S.jsxs("div",{className:"flex items-center gap-2 w-full",children:[g&&m&&S.jsx(KC,{className:"w-4 h-4"}),S.jsx(xE,{sequence:[R.label,0,r],wrapper:"span",cursor:!1,speed:90})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:S.jsx(ty,{className:"w-5 h-5",style:{color:m?M(c,20):I}})})]},F)})}),g&&s.length>0&&S.jsx("div",{className:"mt-3 flex justify-end",dir:o?"rtl":"ltr",children:S.jsxs("button",{onClick:Y,className:"px-6 py-2 font-semibold hover:scale-105 transition-all duration-200 flex items-center gap-2",style:{background:`linear-gradient(135deg, ${E}, ${E}AA)`,borderRadius:`${e}px`,color:I},children:[S.jsx(ry,{className:"w-4 h-4"}),S.jsxs("span",{children:["Send (",s.length,")"]})]})})]})},MS=({items:i,chatRoundness:A,agentChatResponseBgColor:g,agentChatResponseColor:e,buttonsBgColor:E,buttonColor:I,inputBackgroundColor:B,onButtonClick:t,setMessages:o})=>{const[a,r]=_A.useState(0),s=i?.length||0,w=()=>{r(l=>(l+1)%s)},M=()=>{r(l=>(l-1+s)%s)},c=l=>{r(l)};return S.jsx("div",{className:"mt-2 w-full",children:S.jsxs("div",{className:"relative max-w-md mx-auto",children:[S.jsx("div",{className:"overflow-hidden rounded-lg",style:{borderRadius:`${A}px`},children:S.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:i?.map((l,Y)=>S.jsxs("div",{className:"w-full flex-shrink-0 px-2",style:{background:g},children:[S.jsxs("div",{className:"relative h-40 w-full mb-3 ",children:[S.jsx("img",{src:l.image,alt:l.title,className:"size-full object-cover rounded-lg"}),s>1&&S.jsxs(S.Fragment,{children:[a>0&&S.jsx("button",{onClick:M,className:"absolute -left-2 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),a<s-1&&S.jsx("button",{onClick:w,className:"absolute -right-2 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),S.jsx("h3",{className:"text-sm font-bold mb-2",style:{color:e},children:l.title}),S.jsx("p",{className:"text-xs mb-3 leading-relaxed",style:{color:e},children:l.subtitle}),S.jsx("div",{className:"space-y-2",children:l.actions?.map((R,F)=>S.jsx("button",{className:"w-full px-4 py-2 text-sm font-medium hover:scale-[0.98] transition-all duration-200",onClick:()=>{R.action==="link"||R.action==="Open URL"?window.open(R.url,"_blank"):R.action==="postback"||R.action==="Postback"?t(R.title,R.payload):R.action==="say-something"&&typeof R.action=="string"&&o(m=>[...m,{sender:"agent",content:R.payload,id:`msg-${Date.now()}`,timestamp:new Date,seen:!0}])},style:{background:E,borderRadius:`${A}px`,color:I},children:R.title},F))})]},Y))})}),s>1&&S.jsxs("div",{className:"absolute top-2 right-2 px-2 py-1 text-xs font-medium rounded-full backdrop-blur-sm",style:{backgroundColor:`${B}CC`,color:e},children:[a+1," / ",s]}),s>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:i?.map((l,Y)=>S.jsx("button",{onClick:()=>c(Y),className:`w-2 h-2 rounded-full transition-all duration-200 ${Y===a?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},Y))})]})})};function MI(i,A,g,e){return new(g||(g=Promise))(function(E,I){function B(a){try{o(e.next(a))}catch(r){I(r)}}function t(a){try{o(e.throw(a))}catch(r){I(r)}}function o(a){var r;a.done?E(a.value):(r=a.value,r instanceof g?r:new g(function(s){s(r)})).then(B,t)}o((e=e.apply(i,A||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let Ts=class{constructor(){this.listeners={}}on(A,g,e){if(this.listeners[A]||(this.listeners[A]=new Set),this.listeners[A].add(g),e?.once){const E=()=>{this.un(A,E),this.un(A,g)};return this.on(A,E),E}return()=>this.un(A,g)}un(A,g){var e;(e=this.listeners[A])===null||e===void 0||e.delete(g)}once(A,g){return this.on(A,g,{once:!0})}unAll(){this.listeners={}}emit(A,...g){this.listeners[A]&&this.listeners[A].forEach(e=>e(...g))}};const ic={decode:function(i,A){return MI(this,void 0,void 0,function*(){const g=new AudioContext({sampleRate:A});return g.decodeAudioData(i).finally(()=>g.close())})},createBuffer:function(i,A){return typeof i[0]=="number"&&(i=[i]),function(g){const e=g[0];if(e.some(E=>E>1||E<-1)){const E=e.length;let I=0;for(let B=0;B<E;B++){const t=Math.abs(e[B]);t>I&&(I=t)}for(const B of g)for(let t=0;t<E;t++)B[t]/=I}}(i),{duration:A,length:i[0].length,sampleRate:i[0].length/A,numberOfChannels:i.length,getChannelData:g=>i?.[g],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function UW(i,A){const g=A.xmlns?document.createElementNS(A.xmlns,i):document.createElement(i);for(const[e,E]of Object.entries(A))if(e==="children"&&E)for(const[I,B]of Object.entries(E))B instanceof Node?g.appendChild(B):typeof B=="string"?g.appendChild(document.createTextNode(B)):g.appendChild(UW(I,B));else e==="style"?Object.assign(g.style,E):e==="textContent"?g.textContent=E:g.setAttribute(e,E.toString());return g}function dW(i,A,g){const e=UW(i,A||{});return g?.appendChild(e),e}var AhA=Object.freeze({__proto__:null,createElement:dW,default:dW});const ihA={fetchBlob:function(i,A,g){return MI(this,void 0,void 0,function*(){const e=yield fetch(i,g);if(e.status>=400)throw new Error(`Failed to fetch ${i}: ${e.status} (${e.statusText})`);return function(E,I){MI(this,void 0,void 0,function*(){if(!E.body||!E.headers)return;const B=E.body.getReader(),t=Number(E.headers.get("Content-Length"))||0;let o=0;const a=s=>MI(this,void 0,void 0,function*(){o+=s?.length||0;const w=Math.round(o/t*100);I(w)}),r=()=>MI(this,void 0,void 0,function*(){let s;try{s=yield B.read()}catch{return}s.done||(a(s.value),yield r())});r()})}(e.clone(),A),e.blob()})}};let ghA=class extends Ts{constructor(A){super(),this.isExternalMedia=!1,A.media?(this.media=A.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),A.mediaControls&&(this.media.controls=!0),A.autoplay&&(this.media.autoplay=!0),A.playbackRate!=null&&this.onMediaEvent("canplay",()=>{A.playbackRate!=null&&(this.media.playbackRate=A.playbackRate)},{once:!0})}onMediaEvent(A,g,e){return this.media.addEventListener(A,g,e),()=>this.media.removeEventListener(A,g,e)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const A=this.getSrc();A.startsWith("blob:")&&URL.revokeObjectURL(A)}canPlayType(A){return this.media.canPlayType(A)!==""}setSrc(A,g){const e=this.getSrc();if(A&&e===A)return;this.revokeSrc();const E=g instanceof Blob&&(this.canPlayType(g.type)||!A)?URL.createObjectURL(g):A;if(e&&this.media.removeAttribute("src"),E||A)try{this.media.src=E}catch{this.media.src=A}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(A){this.media=A}play(){return MI(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;throw A}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(A){this.media.currentTime=Math.max(0,Math.min(A,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(A){this.media.volume=A}getMuted(){return this.media.muted}setMuted(A){this.media.muted=A}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(A,g){g!=null&&(this.media.preservesPitch=g),this.media.playbackRate=A}getMediaElement(){return this.media}setSinkId(A){return this.media.setSinkId(A)}},hS=class MO extends Ts{constructor(A,g){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=A;const e=this.parentFromOptionsContainer(A.container);this.parent=e;const[E,I]=this.initHtml();e.appendChild(E),this.container=E,this.scrollContainer=I.querySelector(".scroll"),this.wrapper=I.querySelector(".wrapper"),this.canvasWrapper=I.querySelector(".canvases"),this.progressWrapper=I.querySelector(".progress"),this.cursor=I.querySelector(".cursor"),g&&I.appendChild(g),this.initEvents()}parentFromOptionsContainer(A){let g;if(typeof A=="string"?g=document.querySelector(A):A instanceof HTMLElement&&(g=A),!g)throw new Error("Container not found");return g}initEvents(){const A=g=>{const e=this.wrapper.getBoundingClientRect(),E=g.clientX-e.left,I=g.clientY-e.top;return[E/e.width,I/e.height]};if(this.wrapper.addEventListener("click",g=>{const[e,E]=A(g);this.emit("click",e,E)}),this.wrapper.addEventListener("dblclick",g=>{const[e,E]=A(g);this.emit("dblclick",e,E)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:g,scrollWidth:e,clientWidth:E}=this.scrollContainer,I=g/e,B=(g+E)/e;this.emit("scroll",I,B,g,g+E)}),typeof ResizeObserver=="function"){const g=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{g().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const A=this.parent.clientWidth;A===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=A,this.reRender())}initDrag(){this.subscriptions.push(function(A,g,e,E,I=3,B=0,t=100){if(!A)return()=>{};const o=matchMedia("(pointer: coarse)").matches;let a=()=>{};const r=s=>{if(s.button!==B)return;s.preventDefault(),s.stopPropagation();let w=s.clientX,M=s.clientY,c=!1;const l=Date.now(),Y=O=>{if(O.preventDefault(),O.stopPropagation(),o&&Date.now()-l<t)return;const p=O.clientX,q=O.clientY,H=p-w,x=q-M;if(c||Math.abs(H)>I||Math.abs(x)>I){const Z=A.getBoundingClientRect(),{left:y,top:z}=Z;c||(e?.(w-y,M-z),c=!0),g(H,x,p-y,q-z),w=p,M=q}},R=O=>{if(c){const p=O.clientX,q=O.clientY,H=A.getBoundingClientRect(),{left:x,top:Z}=H;E?.(p-x,q-Z)}a()},F=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||R(O)},m=O=>{c&&(O.stopPropagation(),O.preventDefault())},K=O=>{c&&O.preventDefault()};document.addEventListener("pointermove",Y),document.addEventListener("pointerup",R),document.addEventListener("pointerout",F),document.addEventListener("pointercancel",F),document.addEventListener("touchmove",K,{passive:!1}),document.addEventListener("click",m,{capture:!0}),a=()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",R),document.removeEventListener("pointerout",F),document.removeEventListener("pointercancel",F),document.removeEventListener("touchmove",K),setTimeout(()=>{document.removeEventListener("click",m,{capture:!0})},10)}};return A.addEventListener("pointerdown",r),()=>{a(),A.removeEventListener("pointerdown",r)}}(this.wrapper,(A,g,e)=>{this.emit("drag",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))},A=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,A/this.wrapper.getBoundingClientRect().width)))},A=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,A/this.wrapper.getBoundingClientRect().width)))}))}getHeight(A,g){var e;const E=((e=this.audioData)===null||e===void 0?void 0:e.numberOfChannels)||1;if(A==null)return 128;if(!isNaN(Number(A)))return Number(A);if(A==="auto"){const I=this.parent.clientHeight||128;return g?.every(B=>!B.overlay)?I/E:I}return 128}initHtml(){const A=document.createElement("div"),g=A.attachShadow({mode:"open"}),e=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return g.innerHTML=`
|
|
540
|
+
`}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2 pb-2 border-b",style:{borderColor:e+"40"},children:[S.jsx(ca,{className:"w-4 h-4",style:{color:A}}),S.jsx("h3",{className:"text-sm font-semibold",children:"Informations personnelles"})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Nom complet *"}),S.jsx("input",{type:"text",value:a.nom,onChange:R=>w("nom",R.target.value),placeholder:"Votre nom et prénom",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Nom de l'entreprise *"}),S.jsx("input",{type:"text",value:a.entreprise,onChange:R=>w("entreprise",R.target.value),placeholder:"Ex. : ACME SARL",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Email professionnel *"}),S.jsx("input",{type:"email",value:a.email,onChange:R=>w("email",R.target.value),placeholder:"ex. nom@startup.com",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Numéro de téléphone *"}),S.jsx("input",{type:"tel",value:a.phone,onChange:R=>w("phone",R.target.value),placeholder:"Inclure l'indicatif international (ex. +212...)",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Poste *"}),S.jsx("input",{type:"text",value:a.poste,onChange:R=>w("poste",R.target.value),placeholder:"Ex. : CEO, Ingénieur, Étudient ...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...l,"--tw-ring-color":e}})]})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Secteur d'activité *"}),S.jsx("div",{className:`grid ${s?"grid-cols-1":"grid-cols-2"} gap-2`,children:Y.map(R=>S.jsx("button",{onClick:()=>w("secteur",R),className:"px-3 py-2 text-sm rounded-lg transition-colors text-left",style:{backgroundColor:a.secteur===R?o:t||g+"60",color:a.secteur===R?E:A,borderRadius:"10px",border:`1px solid ${e}`},children:R},R))})]})]}),S.jsxs("button",{onClick:M,disabled:!c(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Valider ma candidature"]})]})}function YW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState({fullName:"",phone:"",email:"",ville:""}),r=(c,l)=>{a(Y=>({...Y,[c]:l}))},s=()=>{i(o)},w=()=>o.fullName.trim()!==""&&o.phone.trim()!==""&&o.email.trim()!==""&&o.ville.trim()!=="",M={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(ca,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire de contact"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ca,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:o.fullName,onChange:c=>r("fullName",c.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ay,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:o.phone,onChange:c=>r("phone",c.target.value),placeholder:"Entrez votre numéro de téléphone...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Qy,{className:"w-4 h-4"}),"Email *"]}),S.jsx("input",{type:"email",value:o.email,onChange:c=>r("email",c.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:o.ville,onChange:c=>r("ville",c.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]})]}),S.jsxs("button",{onClick:s,disabled:!w(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}function GW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState({nomComplet:"",numero:"",nomMachine:"",email:"",ville:"",typeDeProjet:""}),r=(c,l)=>{a(Y=>({...Y,[c]:l}))},s=()=>{i(o)},w=()=>o.nomComplet.trim()!==""&&o.numero.trim()!==""&&o.nomMachine.trim()!==""&&o.ville.trim()!=="",M={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(iQ,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire XCMG"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ca,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:o.nomComplet,onChange:c=>r("nomComplet",c.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(ay,{className:"w-4 h-4"}),"Numéro *"]}),S.jsx("input",{type:"tel",value:o.numero,onChange:c=>r("numero",c.target.value),placeholder:"Entrez votre numéro...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Qy,{className:"w-4 h-4"}),"Email"]}),S.jsx("input",{type:"email",value:o.email,onChange:c=>r("email",c.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:o.ville,onChange:c=>r("ville",c.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(iQ,{className:"w-4 h-4"}),"Nom machine *"]}),S.jsx("input",{type:"text",value:o.nomMachine,onChange:c=>r("nomMachine",c.target.value),placeholder:"Entrez le nom de la machine...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(iQ,{className:"w-4 h-4"}),"Type de projet"]}),S.jsxs("select",{value:o.typeDeProjet,onChange:c=>r("typeDeProjet",c.target.value),className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...M,"--tw-ring-color":e},children:[S.jsx("option",{value:"",children:"Sélectionnez le type de projet"}),S.jsx("option",{value:"BTP",children:"BTP"}),S.jsx("option",{value:"infrastructure",children:"infrastructure"}),S.jsx("option",{value:"PME",children:"PME"}),S.jsx("option",{value:"Autre",children:"Autre"})]})]})]}),S.jsxs("button",{onClick:s,disabled:!w(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const XMA=["Étudiant(e) en préparation du Bac","Titulaire du Bac (moins de 3 ans)","Étudiant(e) en études supérieures","Diplômé(e) sans emploi"];function FW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState(""),[r,s]=_A.useState(""),w={backgroundColor:t||g+"60",color:A,borderRadius:`${I}px`,border:`1px solid ${e}`},M=()=>{i({situation:o,ville:r})},c=()=>o.trim()!==""&&r.trim()!=="";return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(ca,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Formulaire Jadara"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:g,borderRadius:`${I}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Choisissez votre situation actuelle *"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:XMA.map(l=>S.jsxs("button",{type:"button",onClick:()=>a(l),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:o===l?e:t||g+"60",color:o===l?E:A,borderRadius:`${I}px`,border:`1px solid ${e}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:o===l?S.jsx(kgA,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:l})]},l))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Th,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:r,onChange:l=>s(l.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...w,"--tw-ring-color":e}})]})]}),S.jsxs("button",{onClick:M,disabled:!c(),className:"w-full px-6 py-3 mt-4 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:e,color:E,borderRadius:`${I}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const _MA=["Marketing digital","Développement web","Création de contenu"];function mW({onValidate:i,agentChatResponseColor:A,agentChatResponseBgColor:g,buttonsBgColor:e,buttonColor:E,chatRoundness:I,panelWidth:B,inputBackgroundColor:t}){const[o,a]=_A.useState(""),r=s=>{a(s),i({Domaines_qui_vous_interessent:s})};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[S.jsx(GgA,{className:"w-5 h-5",style:{color:e}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Domaines d'intérêt"})]}),S.jsx("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:g,borderRadius:`${I}px`},children:S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"Domaines qui vous intéressent"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:_MA.map(s=>S.jsxs("button",{type:"button",onClick:()=>r(s),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:o===s?e:t||g+"60",color:o===s?E:A,borderRadius:`${I}px`,border:`1px solid ${e}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:o===s?S.jsx(KC,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:s})]},s))})]})})]})}function Ac({products:i,onValidate:A,agentChatResponseColor:g,agentChatResponseBgColor:e,buttonsBgColor:E,buttonColor:I,chatRoundness:B,panelWidth:t,inputBackgroundColor:o}){const[a,r]=_A.useState({}),[s,w]=_A.useState(!1),[M,c]=_A.useState(0),l=t<700,Y=t>=1300,R=Math.ceil((i?.length||0)/(l?1:Y?3:2)),F=()=>{c(W=>(W+1)%R)},m=()=>{c(W=>(W-1+R)%R)},K=W=>{c(W)},O=W=>{r(T=>({...T,[W]:(T[W]||0)+1}))},p=W=>{r(T=>{const AA={...T};return AA[W]>1?AA[W]-=1:delete AA[W],AA})},q=()=>Object.entries(a).map(([W,T])=>({id_produit:W,quantite:T})),H=()=>Object.values(a).reduce((W,T)=>W+T,0),x=()=>{const T={products:q()};A(T)},Z=()=>Object.entries(a).map(([W,T])=>({product:i.find(P=>P.id===W),quantity:T})).filter(W=>W.product),y=()=>Z().reduce((W,{product:T,quantity:AA})=>W+T.price*AA,0),z=()=>{const W=[];for(let T=0;T<i.length;T+=l?1:Y?3:2)W.push(i.slice(T,T+(l?1:Y?3:2)));return W};return S.jsxs("div",{className:"w-full mx-auto",style:{color:g},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Produits Disponibles"}),H()>0&&S.jsxs("button",{onClick:()=>w(!s),className:"flex items-center gap-2 px-3 py-2 rounded-lg transition-colors",style:{backgroundColor:E+"20",color:I,borderRadius:`${B}px`},children:[S.jsx(NgA,{className:"w-4 h-4"}),S.jsxs("div",{className:"flex flex-col items-end text-xs",children:[S.jsxs("span",{children:[H()," articles"]}),S.jsx("span",{children:y()>0?`${y().toFixed(2)} DH`:""})]})]})]}),S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"relative overflow-hidden mb-6",children:[S.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${M*100}%)`},children:z().map((W,T)=>S.jsx("div",{className:`w-full flex-shrink-0 grid ${l?"grid-cols-1":Y&&i.length>=3?"grid-cols-3":"grid-cols-2"} gap-4 p-2`,children:W.map(AA=>S.jsxs("div",{className:"p-4 rounded-lg border border-opacity-20",style:{backgroundColor:e+"40",borderColor:g,borderRadius:`${B}px`},children:[S.jsx("div",{className:"relative w-full h-40 mb-3 rounded-md overflow-hidden",children:S.jsx("img",{src:AA?.image??"",alt:AA.nomProduit,className:"w-full h-full object-contain bg-gray-100"})}),S.jsx("h3",{className:"font-semibold text-sm mb-2",style:{color:g},children:AA.nomProduit}),S.jsx("p",{className:"text-xs text-opacity-70 mb-2 line-clamp-2",style:{color:g},title:AA.description,children:AA.description}),S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsxs("div",{className:"text-xs",style:{color:g},children:[AA.stock>0?"In Stock":"Out of stock",S.jsx("br",{}),"Prix: ",AA.price!=0?`${AA.price} DH`:"-"]}),S.jsx("div",{className:"flex items-center gap-2",children:a[AA.id]?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>p(AA.id),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:I},children:S.jsx(qu,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[20px] text-center text-sm font-semibold",children:a[AA.id]}),S.jsx("button",{onClick:()=>O(AA.id),disabled:a[AA.id]>=AA.stock,className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors disabled:opacity-50",style:{backgroundColor:E,color:I},children:S.jsx(Wh,{className:"w-4 h-4"})})]}):S.jsx("button",{onClick:()=>O(AA.id),disabled:AA.stock===0,className:"px-3 py-1 text-xs rounded-lg transition-colors disabled:opacity-50",style:{backgroundColor:E,color:I,borderRadius:`${B}px`},children:AA.price===0?"Ajouter au devis":"Ajouter au panier"})})]})]},AA.id))},T))}),R>1&&S.jsxs(S.Fragment,{children:[M>0&&S.jsx("button",{onClick:m,className:"absolute left-0 top-24 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),M<R-1&&S.jsx("button",{onClick:F,className:"absolute right-0 top-24 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),R>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:Array.from({length:R}).map((W,T)=>S.jsx("button",{onClick:()=>K(T),className:`w-2 h-2 rounded-full transition-all duration-200 ${T===M?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},T))})]}),s&&H()>0&&S.jsxs("div",{className:"mt-3 p-4 rounded-lg border border-opacity-20 mb-4",style:{backgroundColor:e+"60",borderColor:g,borderRadius:`${B}px`},children:[S.jsxs("h3",{className:"font-semibold mb-3",children:["Produits sélectionnés: (",H()," articles)"]}),S.jsx("div",{className:"space-y-2",children:Z().map(({product:W,quantity:T})=>S.jsxs("div",{className:"flex justify-between items-center text-sm",children:[S.jsxs("div",{className:"flex-1",children:[S.jsx("div",{children:W.nomProduit}),S.jsx("div",{className:"text-xs opacity-70",children:W.price>0?`${W.price.toFixed(2)} DH × ${T}`:`× ${T}`})]}),S.jsx("span",{className:"ml-2 font-medium",children:W.price*T>0?`${(W.price*T).toFixed(2)} DH`:""})]},W.id))}),y()>0&&S.jsx("div",{className:"border-t border-opacity-30 mt-3 pt-3",style:{borderColor:g},children:S.jsxs("div",{className:"flex justify-between items-center font-semibold",children:[S.jsx("span",{children:"Total:"}),S.jsxs("span",{children:[y().toFixed(2)," DH"]})]})})]}),H()>0&&S.jsxs("button",{onClick:x,className:"w-full px-6 py-3 mt-3 text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-2",style:{backgroundColor:E,color:I,borderRadius:`${B}px`},children:[S.jsx(KC,{className:"w-4 h-4"}),"Valider la sélection (",H()," articles) ",y()!==0?`- ${y().toFixed(2)} DH`:""]})]})}const $MA=({options:i,message:A,allowMultiple:g,chatRoundness:e,buttonsBgColor:E,buttonColor:I,agentChatResponseColor:B,agentChatResponseBgColor:t,isRtl:o,onSend:a,onScroll:r})=>{const[s,w]=_A.useState([]),M=(R,F)=>{try{let m=R.replace("#","");m.length===3&&(m=m.split("").map(H=>H+H).join(""));const K=parseInt(m,16);let O=(K>>16)+F,p=(K>>8&255)+F,q=(K&255)+F;return O=Math.max(0,Math.min(255,O)),p=Math.max(0,Math.min(255,p)),q=Math.max(0,Math.min(255,q)),"#"+(O<<16|p<<8|q).toString(16).padStart(6,"0")}catch{return R}},c=t?M(t,10):E,l=R=>{g?w(F=>F.includes(R)?F.filter(K=>K!==R):[...F,R]):a(R)},Y=()=>{s.length>0&&(a(s.join(",")),w([]))};return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"mt-2 flex flex-col",dir:o?"rtl":"ltr",children:i?.map((R,F)=>{const m=g&&s.includes(R.value);return S.jsxs("button",{className:"w-full mb-1 flex items-center justify-between px-4 py-2.5 hover:opacity-95 transition-all duration-100",onClick:()=>l(R.value),onMouseEnter:K=>{K.currentTarget.style.borderColor=`${E}`},onMouseLeave:K=>{const O=m?E:M(c,20);K.currentTarget.style.border=`2px solid ${O}`},style:{background:m?`linear-gradient(135deg, ${E}, ${E}DD)`:c,borderRadius:"18px",color:B,border:`2px solid ${M(c,20)}`,opacity:m?.95:1,transform:m?"scale(0.99)":"scale(1)"},children:[S.jsxs("div",{className:"flex items-center gap-2 w-full",children:[g&&m&&S.jsx(KC,{className:"w-4 h-4"}),S.jsx(xE,{sequence:[R.label,0,r],wrapper:"span",cursor:!1,speed:90})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:S.jsx(ty,{className:"w-5 h-5",style:{color:m?M(c,20):I}})})]},F)})}),g&&s.length>0&&S.jsx("div",{className:"mt-3 flex justify-end",dir:o?"rtl":"ltr",children:S.jsxs("button",{onClick:Y,className:"px-6 py-2 font-semibold hover:scale-105 transition-all duration-200 flex items-center gap-2",style:{background:`linear-gradient(135deg, ${E}, ${E}AA)`,borderRadius:`${e}px`,color:I},children:[S.jsx(ry,{className:"w-4 h-4"}),S.jsxs("span",{children:["Send (",s.length,")"]})]})})]})},MS=({items:i,chatRoundness:A,agentChatResponseBgColor:g,agentChatResponseColor:e,buttonsBgColor:E,buttonColor:I,inputBackgroundColor:B,onButtonClick:t,setMessages:o})=>{const[a,r]=_A.useState(0),s=i?.length||0,w=()=>{r(l=>(l+1)%s)},M=()=>{r(l=>(l-1+s)%s)},c=l=>{r(l)};return S.jsx("div",{className:"mt-2 w-full",children:S.jsxs("div",{className:"relative max-w-md mx-auto",children:[S.jsx("div",{className:"overflow-hidden rounded-lg",style:{borderRadius:`${A}px`},children:S.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:i?.map((l,Y)=>S.jsxs("div",{className:"w-full flex-shrink-0 px-2",style:{background:g},children:[S.jsxs("div",{className:"relative h-40 w-full mb-3 ",children:[S.jsx("img",{src:l.image,alt:l.title,className:"size-full object-cover rounded-lg"}),s>1&&S.jsxs(S.Fragment,{children:[a>0&&S.jsx("button",{onClick:M,className:"absolute -left-2 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),a<s-1&&S.jsx("button",{onClick:w,className:"absolute -right-2 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full flex items-center justify-center transition-all duration-200 hover:scale-110 shadow-lg backdrop-blur-sm",style:{backgroundColor:`${E}CC`,color:I},children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),S.jsx("h3",{className:"text-sm font-bold mb-2",style:{color:e},children:l.title}),S.jsx("p",{className:"text-xs mb-3 leading-relaxed",style:{color:e},children:l.subtitle}),S.jsx("div",{className:"space-y-2",children:l.actions?.map((R,F)=>S.jsx("button",{className:"w-full px-4 py-2 text-sm font-medium hover:scale-[0.98] transition-all duration-200",onClick:()=>{R.action==="link"||R.action==="Open URL"?window.open(R.url,"_blank"):R.action==="postback"||R.action==="Postback"?t(R.title,R.payload):R.action==="say-something"&&typeof R.action=="string"&&o(m=>[...m,{sender:"agent",content:R.payload,id:`msg-${Date.now()}`,timestamp:new Date,seen:!0}])},style:{background:E,borderRadius:`${A}px`,color:I},children:R.title},F))})]},Y))})}),s>1&&S.jsxs("div",{className:"absolute top-2 right-2 px-2 py-1 text-xs font-medium rounded-full backdrop-blur-sm",style:{backgroundColor:`${B}CC`,color:e},children:[a+1," / ",s]}),s>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:i?.map((l,Y)=>S.jsx("button",{onClick:()=>c(Y),className:`w-2 h-2 rounded-full transition-all duration-200 ${Y===a?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},Y))})]})})};function MI(i,A,g,e){return new(g||(g=Promise))(function(E,I){function B(a){try{o(e.next(a))}catch(r){I(r)}}function t(a){try{o(e.throw(a))}catch(r){I(r)}}function o(a){var r;a.done?E(a.value):(r=a.value,r instanceof g?r:new g(function(s){s(r)})).then(B,t)}o((e=e.apply(i,A||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let Ts=class{constructor(){this.listeners={}}on(A,g,e){if(this.listeners[A]||(this.listeners[A]=new Set),this.listeners[A].add(g),e?.once){const E=()=>{this.un(A,E),this.un(A,g)};return this.on(A,E),E}return()=>this.un(A,g)}un(A,g){var e;(e=this.listeners[A])===null||e===void 0||e.delete(g)}once(A,g){return this.on(A,g,{once:!0})}unAll(){this.listeners={}}emit(A,...g){this.listeners[A]&&this.listeners[A].forEach(e=>e(...g))}};const ic={decode:function(i,A){return MI(this,void 0,void 0,function*(){const g=new AudioContext({sampleRate:A});return g.decodeAudioData(i).finally(()=>g.close())})},createBuffer:function(i,A){return typeof i[0]=="number"&&(i=[i]),function(g){const e=g[0];if(e.some(E=>E>1||E<-1)){const E=e.length;let I=0;for(let B=0;B<E;B++){const t=Math.abs(e[B]);t>I&&(I=t)}for(const B of g)for(let t=0;t<E;t++)B[t]/=I}}(i),{duration:A,length:i[0].length,sampleRate:i[0].length/A,numberOfChannels:i.length,getChannelData:g=>i?.[g],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function UW(i,A){const g=A.xmlns?document.createElementNS(A.xmlns,i):document.createElement(i);for(const[e,E]of Object.entries(A))if(e==="children"&&E)for(const[I,B]of Object.entries(E))B instanceof Node?g.appendChild(B):typeof B=="string"?g.appendChild(document.createTextNode(B)):g.appendChild(UW(I,B));else e==="style"?Object.assign(g.style,E):e==="textContent"?g.textContent=E:g.setAttribute(e,E.toString());return g}function dW(i,A,g){const e=UW(i,A||{});return g?.appendChild(e),e}var AhA=Object.freeze({__proto__:null,createElement:dW,default:dW});const ihA={fetchBlob:function(i,A,g){return MI(this,void 0,void 0,function*(){const e=yield fetch(i,g);if(e.status>=400)throw new Error(`Failed to fetch ${i}: ${e.status} (${e.statusText})`);return function(E,I){MI(this,void 0,void 0,function*(){if(!E.body||!E.headers)return;const B=E.body.getReader(),t=Number(E.headers.get("Content-Length"))||0;let o=0;const a=s=>MI(this,void 0,void 0,function*(){o+=s?.length||0;const w=Math.round(o/t*100);I(w)}),r=()=>MI(this,void 0,void 0,function*(){let s;try{s=yield B.read()}catch{return}s.done||(a(s.value),yield r())});r()})}(e.clone(),A),e.blob()})}};let ghA=class extends Ts{constructor(A){super(),this.isExternalMedia=!1,A.media?(this.media=A.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),A.mediaControls&&(this.media.controls=!0),A.autoplay&&(this.media.autoplay=!0),A.playbackRate!=null&&this.onMediaEvent("canplay",()=>{A.playbackRate!=null&&(this.media.playbackRate=A.playbackRate)},{once:!0})}onMediaEvent(A,g,e){return this.media.addEventListener(A,g,e),()=>this.media.removeEventListener(A,g,e)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const A=this.getSrc();A.startsWith("blob:")&&URL.revokeObjectURL(A)}canPlayType(A){return this.media.canPlayType(A)!==""}setSrc(A,g){const e=this.getSrc();if(A&&e===A)return;this.revokeSrc();const E=g instanceof Blob&&(this.canPlayType(g.type)||!A)?URL.createObjectURL(g):A;if(e&&this.media.removeAttribute("src"),E||A)try{this.media.src=E}catch{this.media.src=A}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(A){this.media=A}play(){return MI(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;throw A}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(A){this.media.currentTime=Math.max(0,Math.min(A,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(A){this.media.volume=A}getMuted(){return this.media.muted}setMuted(A){this.media.muted=A}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(A,g){g!=null&&(this.media.preservesPitch=g),this.media.playbackRate=A}getMediaElement(){return this.media}setSinkId(A){return this.media.setSinkId(A)}},hS=class MO extends Ts{constructor(A,g){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=A;const e=this.parentFromOptionsContainer(A.container);this.parent=e;const[E,I]=this.initHtml();e.appendChild(E),this.container=E,this.scrollContainer=I.querySelector(".scroll"),this.wrapper=I.querySelector(".wrapper"),this.canvasWrapper=I.querySelector(".canvases"),this.progressWrapper=I.querySelector(".progress"),this.cursor=I.querySelector(".cursor"),g&&I.appendChild(g),this.initEvents()}parentFromOptionsContainer(A){let g;if(typeof A=="string"?g=document.querySelector(A):A instanceof HTMLElement&&(g=A),!g)throw new Error("Container not found");return g}initEvents(){const A=g=>{const e=this.wrapper.getBoundingClientRect(),E=g.clientX-e.left,I=g.clientY-e.top;return[E/e.width,I/e.height]};if(this.wrapper.addEventListener("click",g=>{const[e,E]=A(g);this.emit("click",e,E)}),this.wrapper.addEventListener("dblclick",g=>{const[e,E]=A(g);this.emit("dblclick",e,E)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:g,scrollWidth:e,clientWidth:E}=this.scrollContainer,I=g/e,B=(g+E)/e;this.emit("scroll",I,B,g,g+E)}),typeof ResizeObserver=="function"){const g=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{g().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const A=this.parent.clientWidth;A===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=A,this.reRender())}initDrag(){this.subscriptions.push(function(A,g,e,E,I=3,B=0,t=100){if(!A)return()=>{};const o=matchMedia("(pointer: coarse)").matches;let a=()=>{};const r=s=>{if(s.button!==B)return;s.preventDefault(),s.stopPropagation();let w=s.clientX,M=s.clientY,c=!1;const l=Date.now(),Y=O=>{if(O.preventDefault(),O.stopPropagation(),o&&Date.now()-l<t)return;const p=O.clientX,q=O.clientY,H=p-w,x=q-M;if(c||Math.abs(H)>I||Math.abs(x)>I){const Z=A.getBoundingClientRect(),{left:y,top:z}=Z;c||(e?.(w-y,M-z),c=!0),g(H,x,p-y,q-z),w=p,M=q}},R=O=>{if(c){const p=O.clientX,q=O.clientY,H=A.getBoundingClientRect(),{left:x,top:Z}=H;E?.(p-x,q-Z)}a()},F=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||R(O)},m=O=>{c&&(O.stopPropagation(),O.preventDefault())},K=O=>{c&&O.preventDefault()};document.addEventListener("pointermove",Y),document.addEventListener("pointerup",R),document.addEventListener("pointerout",F),document.addEventListener("pointercancel",F),document.addEventListener("touchmove",K,{passive:!1}),document.addEventListener("click",m,{capture:!0}),a=()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",R),document.removeEventListener("pointerout",F),document.removeEventListener("pointercancel",F),document.removeEventListener("touchmove",K),setTimeout(()=>{document.removeEventListener("click",m,{capture:!0})},10)}};return A.addEventListener("pointerdown",r),()=>{a(),A.removeEventListener("pointerdown",r)}}(this.wrapper,(A,g,e)=>{this.emit("drag",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))},A=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,A/this.wrapper.getBoundingClientRect().width)))},A=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,A/this.wrapper.getBoundingClientRect().width)))}))}getHeight(A,g){var e;const E=((e=this.audioData)===null||e===void 0?void 0:e.numberOfChannels)||1;if(A==null)return 128;if(!isNaN(Number(A)))return Number(A);if(A==="auto"){const I=this.parent.clientHeight||128;return g?.every(B=>!B.overlay)?I/E:I}return 128}initHtml(){const A=document.createElement("div"),g=A.attachShadow({mode:"open"}),e=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return g.innerHTML=`
|
|
541
541
|
<style${e?` nonce="${e}"`:""}>
|
|
542
542
|
:host {
|
|
543
543
|
user-select: none;
|