tybotflow-widget 0.8.5 → 0.8.6
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 +2 -2
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -59692,7 +59692,7 @@ function Jz({ onValidate: g, agentChatResponseColor: A, agentChatResponseBgColor
|
|
|
59692
59692
|
return /* @__PURE__ */ S.jsxs("div", { className: "w-full mx-auto", style: { color: A }, children: [
|
|
59693
59693
|
/* @__PURE__ */ S.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
59694
59694
|
/* @__PURE__ */ S.jsx(gM, { className: "w-5 h-5", style: { color: B } }),
|
|
59695
|
-
/* @__PURE__ */ S.jsx("h2", { className: "text-lg font-semibold mt-1", children: "
|
|
59695
|
+
/* @__PURE__ */ S.jsx("h2", { className: "text-lg font-semibold mt-1", children: "Demande de devis" })
|
|
59696
59696
|
] }),
|
|
59697
59697
|
/* @__PURE__ */ S.jsxs(
|
|
59698
59698
|
"div",
|
|
@@ -59746,7 +59746,7 @@ function Jz({ onValidate: g, agentChatResponseColor: A, agentChatResponseBgColor
|
|
|
59746
59746
|
/* @__PURE__ */ S.jsxs("div", { className: "space-y-2", children: [
|
|
59747
59747
|
/* @__PURE__ */ S.jsxs("label", { className: "text-sm font-medium flex items-center gap-2", children: [
|
|
59748
59748
|
/* @__PURE__ */ S.jsx(M3, { className: "w-4 h-4" }),
|
|
59749
|
-
"
|
|
59749
|
+
"Société / Email *"
|
|
59750
59750
|
] }),
|
|
59751
59751
|
/* @__PURE__ */ S.jsx(
|
|
59752
59752
|
"input",
|
package/dist/index.umd.js
CHANGED
|
@@ -547,7 +547,7 @@ end`};A.events.push(["putFont",function(C){(function(Q){var o=Q.font,w=Q.out,M=Q
|
|
|
547
547
|
input::placeholder {
|
|
548
548
|
color: ${A+"80"};
|
|
549
549
|
}
|
|
550
|
-
`}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2 pb-2 border-b",style:{borderColor:B+"40"},children:[S.jsx(Uo,{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:M.nom,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.entreprise,onChange:r=>s("entreprise",r.target.value),placeholder:"Ex. : ACME SARL",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":B}})]}),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:M.email,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.phone,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.poste,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]})]}),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 ${t?"grid-cols-1":"grid-cols-2"} gap-2`,children:U.map(r=>S.jsx("button",{onClick:()=>s("secteur",r),className:"px-3 py-2 text-sm rounded-lg transition-colors text-left",style:{backgroundColor:M.secteur===r?w:o||I+"60",color:M.secteur===r?E:A,borderRadius:"10px",border:`1px solid ${B}`},children:r},r))})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Valider ma candidature"]})]})}function OW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState({fullName:"",phone:"",email:"",ville:""}),D=(G,R)=>{M(U=>({...U,[G]:R}))},t=()=>{g(w)},s=()=>w.fullName.trim()!==""&&w.phone.trim()!==""&&w.email.trim()!==""&&w.ville.trim()!=="",a={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`};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(Uo,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:w.fullName,onChange:G=>D("fullName",G.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:w.phone,onChange:G=>D("phone",G.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:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Gj,{className:"w-4 h-4"}),"Email *"]}),S.jsx("input",{type:"email",value:w.email,onChange:G=>D("email",G.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:w.ville,onChange:G=>D("ville",G.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:t,disabled:!s(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}function JW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState({fullName:"",phone:"",email:"",ville:""}),D=(G,R)=>{M(U=>({...U,[G]:R}))},t=()=>{g(w)},s=()=>w.fullName.trim()!==""&&w.phone.trim()!==""&&w.email.trim()!==""&&w.ville.trim()!=="",a={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`,direction:"rtl",textAlign:"right"};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},dir:"rtl",children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(Uo,{className:"w-5 h-5",style:{color:B}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"نموذج التواصل"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"الاسم الكامل *"]}),S.jsx("input",{type:"text",value:w.fullName,onChange:G=>D("fullName",G.target.value),placeholder:"أدخل اسمك الكامل...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"رقم الهاتف *"]}),S.jsx("input",{type:"tel",value:w.phone,onChange:G=>D("phone",G.target.value),placeholder:"أدخل رقم هاتفك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Gj,{className:"w-4 h-4"}),"البريد الإلكتروني *"]}),S.jsx("input",{type:"email",value:w.email,onChange:G=>D("email",G.target.value),placeholder:"أدخل بريدك الإلكتروني...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"المدينة *"]}),S.jsx("input",{type:"text",value:w.ville,onChange:G=>D("ville",G.target.value),placeholder:"أدخل مدينتك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:t,disabled:!s(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"إرسال"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* الحقول الإلزامية"})]})}function HW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o,formVars:w}){const[M,D]=fA.useState({nomComplet:"",numero:"",nomMachine:w?.Nom_machine||"",nomSociete:"",ville:"",typeDeProjet:""}),t=(R,U)=>{D(r=>({...r,[R]:U}))},s=()=>{g(M)},a=()=>M.nomComplet.trim()!==""&&M.numero.trim()!==""&&M.nomMachine.trim()!==""&&M.nomSociete.trim()!=="",G={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`};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(oe,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:M.nomComplet,onChange:R=>t("nomComplet",R.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:M.numero,onChange:R=>t("numero",R.target.value),placeholder:"Entrez votre numéro...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(tj,{className:"w-4 h-4"}),"Nom de société *"]}),S.jsx("input",{type:"text",value:M.nomSociete,onChange:R=>t("nomSociete",R.target.value),placeholder:"Entrez le nom de votre société...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(oe,{className:"w-4 h-4"}),"Nom machine *"]}),S.jsx("input",{type:"text",value:M.nomMachine,onChange:R=>t("nomMachine",R.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:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(oe,{className:"w-4 h-4"}),"Type de projet"]}),S.jsx("textarea",{value:M.typeDeProjet,onChange:R=>t("typeDeProjet",R.target.value),placeholder:"Besoin",rows:3,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2 resize-none",style:{...G,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:s,disabled:!a(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const esA=["É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 xW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),[D,t]=fA.useState(""),s={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`},a=()=>{g({situation:w,ville:D})},G=()=>w.trim()!==""&&D.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(Uo,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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:esA.map(R=>S.jsxs("button",{type:"button",onClick:()=>M(R),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===R?B:_E(I,50),color:w===R?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===R?S.jsx(Yj,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:R})]},R))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:D,onChange:R=>t(R.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...s,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const MsA=["طالب(ة) يستعد/تستعد للباكالوريا","حاصل(ة) على الباكالوريا (منذ أقل من 3 سنوات)","طالب(ة) في التعليم العالي","خريج(ة) بدون عمل"];function NW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),[D,t]=fA.useState(""),s={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`,direction:"rtl",textAlign:"right"},a=()=>{g({situation:w,ville:D})},G=()=>w.trim()!==""&&D.trim()!=="";return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},dir:"rtl",children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(Uo,{className:"w-5 h-5",style:{color:B}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"نموذج جدارة"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:I,borderRadius:`${C}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"اختر وضعك الحالي *"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:MsA.map(R=>S.jsxs("button",{type:"button",onClick:()=>M(R),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===R?B:_E(I,50),color:w===R?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"right",direction:"rtl"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===R?S.jsx(Yj,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:R})]},R))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"المدينة *"]}),S.jsx("input",{type:"text",value:D,onChange:R=>t(R.target.value),placeholder:"أدخل مدينتك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...s,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"إرسال"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* الحقول الإلزامية"})]})}const DsA=["Marketing digital","Développement web","Création de contenu"];function dW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),D=t=>{M(t),g({Domaines_qui_vous_interessent:t})};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(HIA,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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:DsA.map(t=>S.jsxs("button",{type:"button",onClick:()=>D(t),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===t?B:_E(I,50),color:w===t?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===t?S.jsx(YQ,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:t})]},t))})]})})]})}const R4=(g,A)=>{if(!g.showWhen)return!0;const I=A[g.showWhen.field];return!(g.showWhen.equals!==void 0&&I!==g.showWhen.equals||g.showWhen.notEquals!==void 0&&I===g.showWhen.notEquals||g.showWhen.in&&!g.showWhen.in.includes(I)||g.showWhen.notIn&&g.showWhen.notIn.includes(I))},hsA=g=>{if(g===0)return"0 Bytes";const A=1024,I=["Bytes","KB","MB","GB"],B=Math.floor(Math.log(g)/Math.log(A));return Number.parseFloat((g/Math.pow(A,B)).toFixed(2))+" "+I[B]};function tsA({definition:g,onValidate:A,agentChatResponseColor:I,agentChatResponseBgColor:B,buttonsBgColor:E,buttonColor:C,chatRoundness:Q,panelWidth:o,inputBackgroundColor:w}){const M=fA.useMemo(()=>{const O={};return g.defaults&&Object.entries(g.defaults).forEach(([m,y])=>{O[m]=y}),g.fields.forEach(m=>{if(m.defaultValue!==void 0){O[m.key]=m.defaultValue;return}if(O[m.key]===void 0)switch(m.type){case"number":case"counter":O[m.key]=m.min??0;break;case"hidden":O[m.key]="";break;default:O[m.key]="";break}}),O},[g.defaults,g.fields]),[D,t]=fA.useState(M),[s,a]=fA.useState({}),G=o<700,R={backgroundColor:w||_E(B,50),color:I,borderRadius:`${Q}px`,border:`1px solid ${E}`,direction:g.dir==="rtl"?"rtl":"ltr",textAlign:g.dir==="rtl"?"right":"left"},U=(O,m)=>{t(y=>({...y,[O]:m}))},r=(O,m)=>{const y=m.target.files?.[0]||null;if(!y){a(L=>({...L,[O.key]:null}));return}if(O.maxSizeMb&&y.size>O.maxSizeMb*1024*1024){alert(`La taille maximale autorisee est ${O.maxSizeMb}MB.`),m.target.value="";return}a(L=>({...L,[O.key]:y}))},l=()=>g.fields.every(O=>{if(!O.required||!R4(O,D))return!0;if(O.type==="file")return!!s[O.key];const m=D[O.key];return m==null?!1:typeof m=="number"?!Number.isNaN(m):String(m).trim()!==""}),K=(O,m)=>{const y={};return g.fields.forEach(L=>{if(R4(L,O)&&L.type!=="section"){if(L.type==="file"){const j=m[L.key];j&&(y[L.key]={name:j.name,size:j.size,mimeType:j.type},y.attachment={type:L.attachmentType||"document",file:j});return}y[L.key]=O[L.key]}}),y},k=()=>{const O=K(D,s);A(O)};return S.jsxs("div",{className:"w-full mx-auto",style:{color:I},dir:g.dir||"ltr",children:[g.title&&S.jsxs("div",{className:"mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold mt-1",children:g.title}),g.subtitle&&S.jsx("p",{className:"text-xs opacity-80 mt-1",children:g.subtitle})]}),S.jsx("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:B,borderRadius:`${Q}px`},children:g.fields.map(O=>{if(!R4(O,D)||O.type==="hidden")return null;if(O.type==="section")return S.jsxs("div",{className:"pt-1",children:[S.jsx("h3",{className:"text-sm font-semibold",children:O.label}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70 mt-1",children:O.helperText})]},O.key);if(O.type==="button-group"){const m=O.mobileColumns||1,y=O.desktopColumns||2,L=G?m:y,j=D[O.key];return S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${L}, minmax(0, 1fr))`},children:(O.options||[]).map(Z=>{const d=j===Z.value;return S.jsx("button",{type:"button",onClick:()=>{const z={...D,[O.key]:Z.value};t(z),(O.submitOnChange||g.submitOnChange)&&A(K(z,s))},className:"px-3 py-2 text-sm rounded-lg transition-colors",style:{backgroundColor:d?E:w||_E(B,50),color:d?C:I,borderRadius:`${Q}px`,border:`1px solid ${E}`,textAlign:g.dir==="rtl"?"right":"left"},children:Z.label},String(Z.value))})}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key)}if(O.type==="counter"){const m=D[O.key],y=typeof m=="number"?m:Number(m||0),L=O.min??0,j=O.max??99,Z=O.step??1;return S.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[S.jsx("p",{className:"block text-sm font-medium h-min my-auto",children:O.label}),S.jsxs("div",{className:"flex items-center gap-2 place-self-end",children:[S.jsx("button",{type:"button",onClick:()=>U(O.key,Math.max(y-Z,L)),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:C},children:S.jsx(Xs,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[60px] text-center text-lg font-semibold px-4 py-2 rounded-lg",style:{backgroundColor:w||B+"60",borderRadius:`${Q}px`},children:y}),S.jsx("button",{type:"button",onClick:()=>U(O.key,Math.min(y+Z,j)),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E,color:C},children:S.jsx(Rt,{className:"w-4 h-4"})})]})]},O.key)}if(O.type==="file"){const m=s[O.key];return S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText}),S.jsx("input",{type:"file",accept:O.accept,onChange:y=>r(O,y),className:"w-full px-3 py-2 text-sm",style:R}),m&&S.jsxs("div",{className:"w-full px-3 py-2 text-sm rounded-lg flex items-center justify-between gap-2",style:{backgroundColor:w||B+"60",borderRadius:`${Q}px`,border:`1px solid ${E}`,color:I},children:[S.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[S.jsx(vs,{className:"w-4 h-4 flex-shrink-0"}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm truncate",children:m.name}),S.jsx("p",{className:"text-xs opacity-70",children:hsA(m.size)})]})]}),S.jsx("button",{type:"button",onClick:()=>a(y=>({...y,[O.key]:null})),className:"p-1 rounded-full hover:opacity-80 flex-shrink-0",style:{backgroundColor:E+"20",color:I},children:S.jsx(tw,{className:"w-4 h-4"})})]})]},O.key)}return O.type==="textarea"?S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("textarea",{value:String(D[O.key]||""),onChange:m=>U(O.key,m.target.value),placeholder:O.placeholder,rows:O.rows||3,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2 resize-none",style:{...R,"--tw-ring-color":E}}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key):O.type==="select"?S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsxs("select",{value:String(D[O.key]||""),onChange:m=>U(O.key,m.target.value),className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":E},children:[S.jsx("option",{value:"",children:O.placeholder||"Select an option"}),(O.options||[]).map(m=>S.jsx("option",{value:String(m.value),children:m.label},String(m.value)))]}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key):S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("input",{type:O.type,value:String(D[O.key]||""),onChange:m=>{if(O.type==="number"){U(O.key,Number(m.target.value));return}U(O.key,m.target.value)},placeholder:O.placeholder,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":E},min:O.min,max:O.max,step:O.step}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key)})}),S.jsxs("button",{onClick:k,disabled:!l(),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:C,borderRadius:`${Q}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),g.submitLabel||"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:g.requiredHint||"* Champs obligatoires"})]})}function CG({products:g,onValidate:A,agentChatResponseColor:I,agentChatResponseBgColor:B,buttonsBgColor:E,buttonColor:C,chatRoundness:Q,panelWidth:o,inputBackgroundColor:w}){const[M,D]=fA.useState({}),[t,s]=fA.useState(!1),[a,G]=fA.useState(0),R=o<700,U=o>=1300,r=Math.ceil((g?.length||0)/(R?1:U?3:2)),l=()=>{G(W=>(W+1)%r)},K=()=>{G(W=>(W-1+r)%r)},k=W=>{G(W)},O=W=>{D(T=>({...T,[W]:(T[W]||0)+1}))},m=W=>{D(T=>{const X={...T};return X[W]>1?X[W]-=1:delete X[W],X})},y=()=>Object.entries(M).map(([W,T])=>({id_produit:W,quantite:T})),L=()=>Object.values(M).reduce((W,T)=>W+T,0),j=()=>{const T={products:y()};A(T)},Z=()=>Object.entries(M).map(([W,T])=>({product:g.find(P=>P.id===W),quantity:T})).filter(W=>W.product),d=()=>Z().reduce((W,{product:T,quantity:X})=>W+T.price*X,0),z=()=>{const W=[];for(let T=0;T<g.length;T+=R?1:U?3:2)W.push(g.slice(T,T+(R?1:U?3:2)));return W};return S.jsxs("div",{className:"w-full mx-auto",style:{color:I},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Produits Disponibles"}),L()>0&&S.jsxs("button",{onClick:()=>s(!t),className:"flex items-center gap-2 px-3 py-2 rounded-lg transition-colors",style:{backgroundColor:E+"20",color:C,borderRadius:`${Q}px`},children:[S.jsx(qIA,{className:"w-4 h-4"}),S.jsxs("div",{className:"flex flex-col items-end text-xs",children:[S.jsxs("span",{children:[L()," articles"]}),S.jsx("span",{children:d()>0?`${d().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(-${a*100}%)`},children:z().map((W,T)=>S.jsx("div",{className:`w-full flex-shrink-0 grid ${R?"grid-cols-1":U&&g.length>=3?"grid-cols-3":"grid-cols-2"} gap-4 p-2`,children:W.map(X=>S.jsxs("div",{className:"p-4 rounded-lg border border-opacity-20",style:{backgroundColor:B+"40",borderColor:I,borderRadius:`${Q}px`},children:[S.jsx("div",{className:"relative w-full h-40 mb-3 rounded-md overflow-hidden",children:S.jsx("img",{src:X?.image??"",alt:X.nomProduit,className:"w-full h-full object-contain bg-gray-100"})}),S.jsx("h3",{className:"font-semibold text-sm mb-2",style:{color:I},children:X.nomProduit}),S.jsx("p",{className:"text-xs text-opacity-70 mb-2 line-clamp-2",style:{color:I},title:X.description,children:X.description}),S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsxs("div",{className:"text-xs",style:{color:I},children:[X.stock>0?"In Stock":"Out of stock",S.jsx("br",{}),"Prix: ",X.price!=0?`${X.price} DH`:"-"]}),S.jsx("div",{className:"flex items-center gap-2",children:M[X.id]?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>m(X.id),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:C},children:S.jsx(Xs,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[20px] text-center text-sm font-semibold",children:M[X.id]}),S.jsx("button",{onClick:()=>O(X.id),disabled:M[X.id]>=X.stock,className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors disabled:opacity-50",style:{backgroundColor:E,color:C},children:S.jsx(Rt,{className:"w-4 h-4"})})]}):S.jsx("button",{onClick:()=>O(X.id),disabled:X.stock===0,className:"px-3 py-1 text-xs rounded-lg transition-colors disabled:opacity-50",style:{backgroundColor:E,color:C,borderRadius:`${Q}px`},children:X.price===0?"Ajouter au devis":"Ajouter au panier"})})]})]},X.id))},T))}),r>1&&S.jsxs(S.Fragment,{children:[a>0&&S.jsx("button",{onClick:K,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:C},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<r-1&&S.jsx("button",{onClick:l,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:C},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===a?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},T))})]}),t&&L()>0&&S.jsxs("div",{className:"mt-3 p-4 rounded-lg border border-opacity-20 mb-4",style:{backgroundColor:B+"60",borderColor:I,borderRadius:`${Q}px`},children:[S.jsxs("h3",{className:"font-semibold mb-3",children:["Produits sélectionnés: (",L()," 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))}),d()>0&&S.jsx("div",{className:"border-t border-opacity-30 mt-3 pt-3",style:{borderColor:I},children:S.jsxs("div",{className:"flex justify-between items-center font-semibold",children:[S.jsx("span",{children:"Total:"}),S.jsxs("span",{children:[d().toFixed(2)," DH"]})]})})]}),L()>0&&S.jsxs("button",{onClick:j,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:C,borderRadius:`${Q}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Valider la sélection (",L()," articles) ",d()!==0?`- ${d().toFixed(2)} DH`:""]})]})}const asA=({options:g,message:A,allowMultiple:I,chatRoundness:B,buttonsBgColor:E,buttonColor:C,agentChatResponseColor:Q,agentChatResponseBgColor:o,isRtl:w,onSend:M,onScroll:D})=>{const[t,s]=fA.useState([]),a=o?_E(o,10):E,G=U=>{I?s(r=>r.includes(U)?r.filter(K=>K!==U):[...r,U]):M(U)},R=()=>{t.length>0&&(M(t.join(",")),s([]))};return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"mt-2 flex flex-col",dir:w?"rtl":"ltr",children:g?.map((U,r)=>{const l=I&&t.includes(U.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",dir:Yw(U.label)?"rtl":"ltr",onClick:()=>G(U.value),onMouseEnter:K=>{K.currentTarget.style.borderColor=`${E}`},onMouseLeave:K=>{const k=l?E:_E(a,20);K.currentTarget.style.border=`2px solid ${k}`},style:{background:l?`linear-gradient(135deg, ${E}, ${E}DD)`:a,borderRadius:"18px",color:Q,border:`2px solid ${_E(a,20)}`,opacity:l?.95:1,transform:l?"scale(0.99)":"scale(1)"},children:[S.jsxs("div",{className:"flex items-center gap-2 w-full",children:[I&&l&&S.jsx(YQ,{className:"w-4 h-4 flex-shrink-0"}),S.jsx(YE,{sequence:[U.label,0,D],cursor:!1,speed:90})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Yw(U.label)?S.jsx(aj,{className:"w-4 h-4"}):S.jsx(sj,{className:"w-4 h-4"})})]},r)})}),I&&t.length>0&&S.jsx("div",{className:"mt-3 flex justify-end",dir:w?"rtl":"ltr",children:S.jsxs("button",{onClick:R,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:`${B}px`,color:C},children:[S.jsx(Rj,{className:"w-4 h-4"}),S.jsxs("span",{children:["Send (",t.length,")"]})]})})]})},r4=({items:g,chatRoundness:A,agentChatResponseBgColor:I,agentChatResponseColor:B,buttonsBgColor:E,buttonColor:C,inputBackgroundColor:Q,onButtonClick:o,setMessages:w})=>{const[M,D]=fA.useState(0),t=g?.length||0,s=()=>{D(R=>(R+1)%t)},a=()=>{D(R=>(R-1+t)%t)},G=R=>{D(R)};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(-${M*100}%)`},children:g?.map((R,U)=>S.jsxs("div",{className:"w-full flex-shrink-0 px-2",style:{background:I},children:[S.jsxs("div",{className:"relative h-40 w-full mb-3 ",children:[S.jsx("img",{src:R.image,alt:R.title,className:"size-full object-cover rounded-lg"}),t>1&&S.jsxs(S.Fragment,{children:[M>0&&S.jsx("button",{onClick:a,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:C},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<t-1&&S.jsx("button",{onClick:s,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:C},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:B},children:R.title}),S.jsx("p",{className:"text-xs mb-3 leading-relaxed",style:{color:B},children:R.subtitle}),S.jsx("div",{className:"space-y-2",children:R.actions?.map((r,l)=>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"?o(r.title,r.payload):r.action==="say-something"&&typeof r.action=="string"&&w(K=>[...K,{sender:"agent",content:r.payload,id:`msg-${Date.now()}`,timestamp:new Date,seen:!0}])},style:{background:E,borderRadius:`${A}px`,color:C},children:r.title},l))})]},U))})}),t>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:`${Q}CC`,color:B},children:[M+1," / ",t]}),t>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:g?.map((R,U)=>S.jsx("button",{onClick:()=>G(U),className:`w-2 h-2 rounded-full transition-all duration-200 ${U===M?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},U))})]})})};function DC(g,A,I,B){return new(I||(I=Promise))(function(E,C){function Q(M){try{w(B.next(M))}catch(D){C(D)}}function o(M){try{w(B.throw(M))}catch(D){C(D)}}function w(M){var D;M.done?E(M.value):(D=M.value,D instanceof I?D:new I(function(t){t(D)})).then(Q,o)}w((B=B.apply(g,A||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let vt=class{constructor(){this.listeners={}}on(A,I,B){if(this.listeners[A]||(this.listeners[A]=new Set),this.listeners[A].add(I),B?.once){const E=()=>{this.un(A,E),this.un(A,I)};return this.on(A,E),E}return()=>this.un(A,I)}un(A,I){var B;(B=this.listeners[A])===null||B===void 0||B.delete(I)}once(A,I){return this.on(A,I,{once:!0})}unAll(){this.listeners={}}emit(A,...I){this.listeners[A]&&this.listeners[A].forEach(B=>B(...I))}};const QG={decode:function(g,A){return DC(this,void 0,void 0,function*(){const I=new AudioContext({sampleRate:A});return I.decodeAudioData(g).finally(()=>I.close())})},createBuffer:function(g,A){return typeof g[0]=="number"&&(g=[g]),function(I){const B=I[0];if(B.some(E=>E>1||E<-1)){const E=B.length;let C=0;for(let Q=0;Q<E;Q++){const o=Math.abs(B[Q]);o>C&&(C=o)}for(const Q of I)for(let o=0;o<E;o++)Q[o]/=C}}(g),{duration:A,length:g[0].length,sampleRate:g[0].length/A,numberOfChannels:g.length,getChannelData:I=>g?.[I],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jW(g,A){const I=A.xmlns?document.createElementNS(A.xmlns,g):document.createElement(g);for(const[B,E]of Object.entries(A))if(B==="children"&&E)for(const[C,Q]of Object.entries(E))Q instanceof Node?I.appendChild(Q):typeof Q=="string"?I.appendChild(document.createTextNode(Q)):I.appendChild(jW(C,Q));else B==="style"?Object.assign(I.style,E):B==="textContent"?I.textContent=E:I.setAttribute(B,E.toString());return I}function pW(g,A,I){const B=jW(g,A||{});return I?.appendChild(B),B}var ssA=Object.freeze({__proto__:null,createElement:pW,default:pW});const csA={fetchBlob:function(g,A,I){return DC(this,void 0,void 0,function*(){const B=yield fetch(g,I);if(B.status>=400)throw new Error(`Failed to fetch ${g}: ${B.status} (${B.statusText})`);return function(E,C){DC(this,void 0,void 0,function*(){if(!E.body||!E.headers)return;const Q=E.body.getReader(),o=Number(E.headers.get("Content-Length"))||0;let w=0;const M=t=>DC(this,void 0,void 0,function*(){w+=t?.length||0;const s=Math.round(w/o*100);C(s)}),D=()=>DC(this,void 0,void 0,function*(){let t;try{t=yield Q.read()}catch{return}t.done||(M(t.value),yield D())});D()})}(B.clone(),A),B.blob()})}};let GsA=class extends vt{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,I,B){return this.media.addEventListener(A,I,B),()=>this.media.removeEventListener(A,I,B)}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,I){const B=this.getSrc();if(A&&B===A)return;this.revokeSrc();const E=I instanceof Blob&&(this.canPlayType(I.type)||!A)?URL.createObjectURL(I):A;if(B&&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 DC(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,I){I!=null&&(this.media.preservesPitch=I),this.media.playbackRate=A}getMediaElement(){return this.media}setSinkId(A){return this.media.setSinkId(A)}},n4=class rx extends vt{constructor(A,I){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 B=this.parentFromOptionsContainer(A.container);this.parent=B;const[E,C]=this.initHtml();B.appendChild(E),this.container=E,this.scrollContainer=C.querySelector(".scroll"),this.wrapper=C.querySelector(".wrapper"),this.canvasWrapper=C.querySelector(".canvases"),this.progressWrapper=C.querySelector(".progress"),this.cursor=C.querySelector(".cursor"),I&&C.appendChild(I),this.initEvents()}parentFromOptionsContainer(A){let I;if(typeof A=="string"?I=document.querySelector(A):A instanceof HTMLElement&&(I=A),!I)throw new Error("Container not found");return I}initEvents(){const A=I=>{const B=this.wrapper.getBoundingClientRect(),E=I.clientX-B.left,C=I.clientY-B.top;return[E/B.width,C/B.height]};if(this.wrapper.addEventListener("click",I=>{const[B,E]=A(I);this.emit("click",B,E)}),this.wrapper.addEventListener("dblclick",I=>{const[B,E]=A(I);this.emit("dblclick",B,E)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:I,scrollWidth:B,clientWidth:E}=this.scrollContainer,C=I/B,Q=(I+E)/B;this.emit("scroll",C,Q,I,I+E)}),typeof ResizeObserver=="function"){const I=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{I().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,I,B,E,C=3,Q=0,o=100){if(!A)return()=>{};const w=matchMedia("(pointer: coarse)").matches;let M=()=>{};const D=t=>{if(t.button!==Q)return;t.preventDefault(),t.stopPropagation();let s=t.clientX,a=t.clientY,G=!1;const R=Date.now(),U=O=>{if(O.preventDefault(),O.stopPropagation(),w&&Date.now()-R<o)return;const m=O.clientX,y=O.clientY,L=m-s,j=y-a;if(G||Math.abs(L)>C||Math.abs(j)>C){const Z=A.getBoundingClientRect(),{left:d,top:z}=Z;G||(B?.(s-d,a-z),G=!0),I(L,j,m-d,y-z),s=m,a=y}},r=O=>{if(G){const m=O.clientX,y=O.clientY,L=A.getBoundingClientRect(),{left:j,top:Z}=L;E?.(m-j,y-Z)}M()},l=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||r(O)},K=O=>{G&&(O.stopPropagation(),O.preventDefault())},k=O=>{G&&O.preventDefault()};document.addEventListener("pointermove",U),document.addEventListener("pointerup",r),document.addEventListener("pointerout",l),document.addEventListener("pointercancel",l),document.addEventListener("touchmove",k,{passive:!1}),document.addEventListener("click",K,{capture:!0}),M=()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",r),document.removeEventListener("pointerout",l),document.removeEventListener("pointercancel",l),document.removeEventListener("touchmove",k),setTimeout(()=>{document.removeEventListener("click",K,{capture:!0})},10)}};return A.addEventListener("pointerdown",D),()=>{M(),A.removeEventListener("pointerdown",D)}}(this.wrapper,(A,I,B)=>{this.emit("drag",Math.max(0,Math.min(1,B/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,I){var B;const E=((B=this.audioData)===null||B===void 0?void 0:B.numberOfChannels)||1;if(A==null)return 128;if(!isNaN(Number(A)))return Number(A);if(A==="auto"){const C=this.parent.clientHeight||128;return I?.every(Q=>!Q.overlay)?C/E:C}return 128}initHtml(){const A=document.createElement("div"),I=A.attachShadow({mode:"open"}),B=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return I.innerHTML=`
|
|
550
|
+
`}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center gap-2 pb-2 border-b",style:{borderColor:B+"40"},children:[S.jsx(Uo,{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:M.nom,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.entreprise,onChange:r=>s("entreprise",r.target.value),placeholder:"Ex. : ACME SARL",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":B}})]}),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:M.email,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.phone,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]}),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:M.poste,onChange:r=>s("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:{...R,"--tw-ring-color":B}})]})]}),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 ${t?"grid-cols-1":"grid-cols-2"} gap-2`,children:U.map(r=>S.jsx("button",{onClick:()=>s("secteur",r),className:"px-3 py-2 text-sm rounded-lg transition-colors text-left",style:{backgroundColor:M.secteur===r?w:o||I+"60",color:M.secteur===r?E:A,borderRadius:"10px",border:`1px solid ${B}`},children:r},r))})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Valider ma candidature"]})]})}function OW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState({fullName:"",phone:"",email:"",ville:""}),D=(G,R)=>{M(U=>({...U,[G]:R}))},t=()=>{g(w)},s=()=>w.fullName.trim()!==""&&w.phone.trim()!==""&&w.email.trim()!==""&&w.ville.trim()!=="",a={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`};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(Uo,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:w.fullName,onChange:G=>D("fullName",G.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:w.phone,onChange:G=>D("phone",G.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:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Gj,{className:"w-4 h-4"}),"Email *"]}),S.jsx("input",{type:"email",value:w.email,onChange:G=>D("email",G.target.value),placeholder:"Entrez votre adresse email...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:w.ville,onChange:G=>D("ville",G.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:t,disabled:!s(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}function JW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState({fullName:"",phone:"",email:"",ville:""}),D=(G,R)=>{M(U=>({...U,[G]:R}))},t=()=>{g(w)},s=()=>w.fullName.trim()!==""&&w.phone.trim()!==""&&w.email.trim()!==""&&w.ville.trim()!=="",a={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`,direction:"rtl",textAlign:"right"};return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},dir:"rtl",children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(Uo,{className:"w-5 h-5",style:{color:B}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"نموذج التواصل"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"الاسم الكامل *"]}),S.jsx("input",{type:"text",value:w.fullName,onChange:G=>D("fullName",G.target.value),placeholder:"أدخل اسمك الكامل...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"رقم الهاتف *"]}),S.jsx("input",{type:"tel",value:w.phone,onChange:G=>D("phone",G.target.value),placeholder:"أدخل رقم هاتفك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Gj,{className:"w-4 h-4"}),"البريد الإلكتروني *"]}),S.jsx("input",{type:"email",value:w.email,onChange:G=>D("email",G.target.value),placeholder:"أدخل بريدك الإلكتروني...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"المدينة *"]}),S.jsx("input",{type:"text",value:w.ville,onChange:G=>D("ville",G.target.value),placeholder:"أدخل مدينتك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...a,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:t,disabled:!s(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"إرسال"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* الحقول الإلزامية"})]})}function HW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o,formVars:w}){const[M,D]=fA.useState({nomComplet:"",numero:"",nomMachine:w?.Nom_machine||"",nomSociete:"",ville:"",typeDeProjet:""}),t=(R,U)=>{D(r=>({...r,[R]:U}))},s=()=>{g(M)},a=()=>M.nomComplet.trim()!==""&&M.numero.trim()!==""&&M.nomMachine.trim()!==""&&M.nomSociete.trim()!=="",G={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`};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(oe,{className:"w-5 h-5",style:{color:B}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"Demande de devis"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:I,borderRadius:`${C}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(Uo,{className:"w-4 h-4"}),"Nom complet *"]}),S.jsx("input",{type:"text",value:M.nomComplet,onChange:R=>t("nomComplet",R.target.value),placeholder:"Entrez votre nom complet...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Tr,{className:"w-4 h-4"}),"Numéro de téléphone *"]}),S.jsx("input",{type:"tel",value:M.numero,onChange:R=>t("numero",R.target.value),placeholder:"Entrez votre numéro...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(tj,{className:"w-4 h-4"}),"Société / Email *"]}),S.jsx("input",{type:"text",value:M.nomSociete,onChange:R=>t("nomSociete",R.target.value),placeholder:"Entrez le nom de votre société...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(oe,{className:"w-4 h-4"}),"Nom machine *"]}),S.jsx("input",{type:"text",value:M.nomMachine,onChange:R=>t("nomMachine",R.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:{...G,"--tw-ring-color":B}})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(oe,{className:"w-4 h-4"}),"Type de projet"]}),S.jsx("textarea",{value:M.typeDeProjet,onChange:R=>t("typeDeProjet",R.target.value),placeholder:"Besoin",rows:3,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2 resize-none",style:{...G,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:s,disabled:!a(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const esA=["É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 xW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),[D,t]=fA.useState(""),s={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`},a=()=>{g({situation:w,ville:D})},G=()=>w.trim()!==""&&D.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(Uo,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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:esA.map(R=>S.jsxs("button",{type:"button",onClick:()=>M(R),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===R?B:_E(I,50),color:w===R?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===R?S.jsx(Yj,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:R})]},R))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"Ville *"]}),S.jsx("input",{type:"text",value:D,onChange:R=>t(R.target.value),placeholder:"Entrez votre ville...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...s,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* Champs obligatoires"})]})}const MsA=["طالب(ة) يستعد/تستعد للباكالوريا","حاصل(ة) على الباكالوريا (منذ أقل من 3 سنوات)","طالب(ة) في التعليم العالي","خريج(ة) بدون عمل"];function NW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),[D,t]=fA.useState(""),s={backgroundColor:_E(I,50),color:A,borderRadius:`${C}px`,border:`1px solid ${B}`,direction:"rtl",textAlign:"right"},a=()=>{g({situation:w,ville:D})},G=()=>w.trim()!==""&&D.trim()!=="";return S.jsxs("div",{className:"w-full mx-auto",style:{color:A},dir:"rtl",children:[S.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[S.jsx(Uo,{className:"w-5 h-5",style:{color:B}}),S.jsx("h2",{className:"text-lg font-semibold mt-1",children:"نموذج جدارة"})]}),S.jsxs("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:I,borderRadius:`${C}px`},children:[S.jsxs("div",{className:"space-y-2",children:[S.jsx("label",{className:"block text-sm font-medium",children:"اختر وضعك الحالي *"}),S.jsx("div",{className:"grid grid-cols-1 gap-2",children:MsA.map(R=>S.jsxs("button",{type:"button",onClick:()=>M(R),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===R?B:_E(I,50),color:w===R?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"right",direction:"rtl"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===R?S.jsx(Yj,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:R})]},R))})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[S.jsx(Yt,{className:"w-4 h-4"}),"المدينة *"]}),S.jsx("input",{type:"text",value:D,onChange:R=>t(R.target.value),placeholder:"أدخل مدينتك...",className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...s,"--tw-ring-color":B}})]})]}),S.jsxs("button",{onClick:a,disabled:!G(),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:B,color:E,borderRadius:`${C}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"إرسال"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:"* الحقول الإلزامية"})]})}const DsA=["Marketing digital","Développement web","Création de contenu"];function dW({onValidate:g,agentChatResponseColor:A,agentChatResponseBgColor:I,buttonsBgColor:B,buttonColor:E,chatRoundness:C,panelWidth:Q,inputBackgroundColor:o}){const[w,M]=fA.useState(""),D=t=>{M(t),g({Domaines_qui_vous_interessent:t})};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(HIA,{className:"w-5 h-5",style:{color:B}}),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:I,borderRadius:`${C}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:DsA.map(t=>S.jsxs("button",{type:"button",onClick:()=>D(t),className:"w-full flex items-center gap-3 px-3 py-2 text-sm",style:{background:w===t?B:_E(I,50),color:w===t?E:A,borderRadius:`${C}px`,border:`1px solid ${B}`,textAlign:"left"},children:[S.jsx("div",{style:{width:18,display:"flex",alignItems:"center",justifyContent:"center"},children:w===t?S.jsx(YQ,{className:"w-4 h-4"}):S.jsx("div",{style:{width:14}})}),S.jsx("span",{className:"text-sm",children:t})]},t))})]})})]})}const R4=(g,A)=>{if(!g.showWhen)return!0;const I=A[g.showWhen.field];return!(g.showWhen.equals!==void 0&&I!==g.showWhen.equals||g.showWhen.notEquals!==void 0&&I===g.showWhen.notEquals||g.showWhen.in&&!g.showWhen.in.includes(I)||g.showWhen.notIn&&g.showWhen.notIn.includes(I))},hsA=g=>{if(g===0)return"0 Bytes";const A=1024,I=["Bytes","KB","MB","GB"],B=Math.floor(Math.log(g)/Math.log(A));return Number.parseFloat((g/Math.pow(A,B)).toFixed(2))+" "+I[B]};function tsA({definition:g,onValidate:A,agentChatResponseColor:I,agentChatResponseBgColor:B,buttonsBgColor:E,buttonColor:C,chatRoundness:Q,panelWidth:o,inputBackgroundColor:w}){const M=fA.useMemo(()=>{const O={};return g.defaults&&Object.entries(g.defaults).forEach(([m,y])=>{O[m]=y}),g.fields.forEach(m=>{if(m.defaultValue!==void 0){O[m.key]=m.defaultValue;return}if(O[m.key]===void 0)switch(m.type){case"number":case"counter":O[m.key]=m.min??0;break;case"hidden":O[m.key]="";break;default:O[m.key]="";break}}),O},[g.defaults,g.fields]),[D,t]=fA.useState(M),[s,a]=fA.useState({}),G=o<700,R={backgroundColor:w||_E(B,50),color:I,borderRadius:`${Q}px`,border:`1px solid ${E}`,direction:g.dir==="rtl"?"rtl":"ltr",textAlign:g.dir==="rtl"?"right":"left"},U=(O,m)=>{t(y=>({...y,[O]:m}))},r=(O,m)=>{const y=m.target.files?.[0]||null;if(!y){a(L=>({...L,[O.key]:null}));return}if(O.maxSizeMb&&y.size>O.maxSizeMb*1024*1024){alert(`La taille maximale autorisee est ${O.maxSizeMb}MB.`),m.target.value="";return}a(L=>({...L,[O.key]:y}))},l=()=>g.fields.every(O=>{if(!O.required||!R4(O,D))return!0;if(O.type==="file")return!!s[O.key];const m=D[O.key];return m==null?!1:typeof m=="number"?!Number.isNaN(m):String(m).trim()!==""}),K=(O,m)=>{const y={};return g.fields.forEach(L=>{if(R4(L,O)&&L.type!=="section"){if(L.type==="file"){const j=m[L.key];j&&(y[L.key]={name:j.name,size:j.size,mimeType:j.type},y.attachment={type:L.attachmentType||"document",file:j});return}y[L.key]=O[L.key]}}),y},k=()=>{const O=K(D,s);A(O)};return S.jsxs("div",{className:"w-full mx-auto",style:{color:I},dir:g.dir||"ltr",children:[g.title&&S.jsxs("div",{className:"mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold mt-1",children:g.title}),g.subtitle&&S.jsx("p",{className:"text-xs opacity-80 mt-1",children:g.subtitle})]}),S.jsx("div",{className:"p-4 rounded-lg space-y-4",style:{backgroundColor:B,borderRadius:`${Q}px`},children:g.fields.map(O=>{if(!R4(O,D)||O.type==="hidden")return null;if(O.type==="section")return S.jsxs("div",{className:"pt-1",children:[S.jsx("h3",{className:"text-sm font-semibold",children:O.label}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70 mt-1",children:O.helperText})]},O.key);if(O.type==="button-group"){const m=O.mobileColumns||1,y=O.desktopColumns||2,L=G?m:y,j=D[O.key];return S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${L}, minmax(0, 1fr))`},children:(O.options||[]).map(Z=>{const d=j===Z.value;return S.jsx("button",{type:"button",onClick:()=>{const z={...D,[O.key]:Z.value};t(z),(O.submitOnChange||g.submitOnChange)&&A(K(z,s))},className:"px-3 py-2 text-sm rounded-lg transition-colors",style:{backgroundColor:d?E:w||_E(B,50),color:d?C:I,borderRadius:`${Q}px`,border:`1px solid ${E}`,textAlign:g.dir==="rtl"?"right":"left"},children:Z.label},String(Z.value))})}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key)}if(O.type==="counter"){const m=D[O.key],y=typeof m=="number"?m:Number(m||0),L=O.min??0,j=O.max??99,Z=O.step??1;return S.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[S.jsx("p",{className:"block text-sm font-medium h-min my-auto",children:O.label}),S.jsxs("div",{className:"flex items-center gap-2 place-self-end",children:[S.jsx("button",{type:"button",onClick:()=>U(O.key,Math.max(y-Z,L)),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:C},children:S.jsx(Xs,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[60px] text-center text-lg font-semibold px-4 py-2 rounded-lg",style:{backgroundColor:w||B+"60",borderRadius:`${Q}px`},children:y}),S.jsx("button",{type:"button",onClick:()=>U(O.key,Math.min(y+Z,j)),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E,color:C},children:S.jsx(Rt,{className:"w-4 h-4"})})]})]},O.key)}if(O.type==="file"){const m=s[O.key];return S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText}),S.jsx("input",{type:"file",accept:O.accept,onChange:y=>r(O,y),className:"w-full px-3 py-2 text-sm",style:R}),m&&S.jsxs("div",{className:"w-full px-3 py-2 text-sm rounded-lg flex items-center justify-between gap-2",style:{backgroundColor:w||B+"60",borderRadius:`${Q}px`,border:`1px solid ${E}`,color:I},children:[S.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[S.jsx(vs,{className:"w-4 h-4 flex-shrink-0"}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm truncate",children:m.name}),S.jsx("p",{className:"text-xs opacity-70",children:hsA(m.size)})]})]}),S.jsx("button",{type:"button",onClick:()=>a(y=>({...y,[O.key]:null})),className:"p-1 rounded-full hover:opacity-80 flex-shrink-0",style:{backgroundColor:E+"20",color:I},children:S.jsx(tw,{className:"w-4 h-4"})})]})]},O.key)}return O.type==="textarea"?S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("textarea",{value:String(D[O.key]||""),onChange:m=>U(O.key,m.target.value),placeholder:O.placeholder,rows:O.rows||3,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2 resize-none",style:{...R,"--tw-ring-color":E}}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key):O.type==="select"?S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsxs("select",{value:String(D[O.key]||""),onChange:m=>U(O.key,m.target.value),className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":E},children:[S.jsx("option",{value:"",children:O.placeholder||"Select an option"}),(O.options||[]).map(m=>S.jsx("option",{value:String(m.value),children:m.label},String(m.value)))]}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key):S.jsxs("div",{className:"space-y-2",children:[O.label&&S.jsx("label",{className:"block text-sm font-medium",children:O.label}),S.jsx("input",{type:O.type,value:String(D[O.key]||""),onChange:m=>{if(O.type==="number"){U(O.key,Number(m.target.value));return}U(O.key,m.target.value)},placeholder:O.placeholder,className:"w-full px-3 py-2 text-sm focus:outline-none focus:ring-2",style:{...R,"--tw-ring-color":E},min:O.min,max:O.max,step:O.step}),O.helperText&&S.jsx("p",{className:"text-xs opacity-70",children:O.helperText})]},O.key)})}),S.jsxs("button",{onClick:k,disabled:!l(),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:C,borderRadius:`${Q}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),g.submitLabel||"Envoyer"]}),S.jsx("div",{className:"mt-2 text-xs opacity-70 text-center",children:g.requiredHint||"* Champs obligatoires"})]})}function CG({products:g,onValidate:A,agentChatResponseColor:I,agentChatResponseBgColor:B,buttonsBgColor:E,buttonColor:C,chatRoundness:Q,panelWidth:o,inputBackgroundColor:w}){const[M,D]=fA.useState({}),[t,s]=fA.useState(!1),[a,G]=fA.useState(0),R=o<700,U=o>=1300,r=Math.ceil((g?.length||0)/(R?1:U?3:2)),l=()=>{G(W=>(W+1)%r)},K=()=>{G(W=>(W-1+r)%r)},k=W=>{G(W)},O=W=>{D(T=>({...T,[W]:(T[W]||0)+1}))},m=W=>{D(T=>{const X={...T};return X[W]>1?X[W]-=1:delete X[W],X})},y=()=>Object.entries(M).map(([W,T])=>({id_produit:W,quantite:T})),L=()=>Object.values(M).reduce((W,T)=>W+T,0),j=()=>{const T={products:y()};A(T)},Z=()=>Object.entries(M).map(([W,T])=>({product:g.find(P=>P.id===W),quantity:T})).filter(W=>W.product),d=()=>Z().reduce((W,{product:T,quantity:X})=>W+T.price*X,0),z=()=>{const W=[];for(let T=0;T<g.length;T+=R?1:U?3:2)W.push(g.slice(T,T+(R?1:U?3:2)));return W};return S.jsxs("div",{className:"w-full mx-auto",style:{color:I},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Produits Disponibles"}),L()>0&&S.jsxs("button",{onClick:()=>s(!t),className:"flex items-center gap-2 px-3 py-2 rounded-lg transition-colors",style:{backgroundColor:E+"20",color:C,borderRadius:`${Q}px`},children:[S.jsx(qIA,{className:"w-4 h-4"}),S.jsxs("div",{className:"flex flex-col items-end text-xs",children:[S.jsxs("span",{children:[L()," articles"]}),S.jsx("span",{children:d()>0?`${d().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(-${a*100}%)`},children:z().map((W,T)=>S.jsx("div",{className:`w-full flex-shrink-0 grid ${R?"grid-cols-1":U&&g.length>=3?"grid-cols-3":"grid-cols-2"} gap-4 p-2`,children:W.map(X=>S.jsxs("div",{className:"p-4 rounded-lg border border-opacity-20",style:{backgroundColor:B+"40",borderColor:I,borderRadius:`${Q}px`},children:[S.jsx("div",{className:"relative w-full h-40 mb-3 rounded-md overflow-hidden",children:S.jsx("img",{src:X?.image??"",alt:X.nomProduit,className:"w-full h-full object-contain bg-gray-100"})}),S.jsx("h3",{className:"font-semibold text-sm mb-2",style:{color:I},children:X.nomProduit}),S.jsx("p",{className:"text-xs text-opacity-70 mb-2 line-clamp-2",style:{color:I},title:X.description,children:X.description}),S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsxs("div",{className:"text-xs",style:{color:I},children:[X.stock>0?"In Stock":"Out of stock",S.jsx("br",{}),"Prix: ",X.price!=0?`${X.price} DH`:"-"]}),S.jsx("div",{className:"flex items-center gap-2",children:M[X.id]?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>m(X.id),className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors",style:{backgroundColor:E+"80",color:C},children:S.jsx(Xs,{className:"w-4 h-4"})}),S.jsx("span",{className:"min-w-[20px] text-center text-sm font-semibold",children:M[X.id]}),S.jsx("button",{onClick:()=>O(X.id),disabled:M[X.id]>=X.stock,className:"w-8 h-8 rounded-full flex items-center justify-center transition-colors disabled:opacity-50",style:{backgroundColor:E,color:C},children:S.jsx(Rt,{className:"w-4 h-4"})})]}):S.jsx("button",{onClick:()=>O(X.id),disabled:X.stock===0,className:"px-3 py-1 text-xs rounded-lg transition-colors disabled:opacity-50",style:{backgroundColor:E,color:C,borderRadius:`${Q}px`},children:X.price===0?"Ajouter au devis":"Ajouter au panier"})})]})]},X.id))},T))}),r>1&&S.jsxs(S.Fragment,{children:[a>0&&S.jsx("button",{onClick:K,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:C},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<r-1&&S.jsx("button",{onClick:l,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:C},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===a?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},T))})]}),t&&L()>0&&S.jsxs("div",{className:"mt-3 p-4 rounded-lg border border-opacity-20 mb-4",style:{backgroundColor:B+"60",borderColor:I,borderRadius:`${Q}px`},children:[S.jsxs("h3",{className:"font-semibold mb-3",children:["Produits sélectionnés: (",L()," 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))}),d()>0&&S.jsx("div",{className:"border-t border-opacity-30 mt-3 pt-3",style:{borderColor:I},children:S.jsxs("div",{className:"flex justify-between items-center font-semibold",children:[S.jsx("span",{children:"Total:"}),S.jsxs("span",{children:[d().toFixed(2)," DH"]})]})})]}),L()>0&&S.jsxs("button",{onClick:j,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:C,borderRadius:`${Q}px`},children:[S.jsx(YQ,{className:"w-4 h-4"}),"Valider la sélection (",L()," articles) ",d()!==0?`- ${d().toFixed(2)} DH`:""]})]})}const asA=({options:g,message:A,allowMultiple:I,chatRoundness:B,buttonsBgColor:E,buttonColor:C,agentChatResponseColor:Q,agentChatResponseBgColor:o,isRtl:w,onSend:M,onScroll:D})=>{const[t,s]=fA.useState([]),a=o?_E(o,10):E,G=U=>{I?s(r=>r.includes(U)?r.filter(K=>K!==U):[...r,U]):M(U)},R=()=>{t.length>0&&(M(t.join(",")),s([]))};return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"mt-2 flex flex-col",dir:w?"rtl":"ltr",children:g?.map((U,r)=>{const l=I&&t.includes(U.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",dir:Yw(U.label)?"rtl":"ltr",onClick:()=>G(U.value),onMouseEnter:K=>{K.currentTarget.style.borderColor=`${E}`},onMouseLeave:K=>{const k=l?E:_E(a,20);K.currentTarget.style.border=`2px solid ${k}`},style:{background:l?`linear-gradient(135deg, ${E}, ${E}DD)`:a,borderRadius:"18px",color:Q,border:`2px solid ${_E(a,20)}`,opacity:l?.95:1,transform:l?"scale(0.99)":"scale(1)"},children:[S.jsxs("div",{className:"flex items-center gap-2 w-full",children:[I&&l&&S.jsx(YQ,{className:"w-4 h-4 flex-shrink-0"}),S.jsx(YE,{sequence:[U.label,0,D],cursor:!1,speed:90})]}),S.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Yw(U.label)?S.jsx(aj,{className:"w-4 h-4"}):S.jsx(sj,{className:"w-4 h-4"})})]},r)})}),I&&t.length>0&&S.jsx("div",{className:"mt-3 flex justify-end",dir:w?"rtl":"ltr",children:S.jsxs("button",{onClick:R,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:`${B}px`,color:C},children:[S.jsx(Rj,{className:"w-4 h-4"}),S.jsxs("span",{children:["Send (",t.length,")"]})]})})]})},r4=({items:g,chatRoundness:A,agentChatResponseBgColor:I,agentChatResponseColor:B,buttonsBgColor:E,buttonColor:C,inputBackgroundColor:Q,onButtonClick:o,setMessages:w})=>{const[M,D]=fA.useState(0),t=g?.length||0,s=()=>{D(R=>(R+1)%t)},a=()=>{D(R=>(R-1+t)%t)},G=R=>{D(R)};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(-${M*100}%)`},children:g?.map((R,U)=>S.jsxs("div",{className:"w-full flex-shrink-0 px-2",style:{background:I},children:[S.jsxs("div",{className:"relative h-40 w-full mb-3 ",children:[S.jsx("img",{src:R.image,alt:R.title,className:"size-full object-cover rounded-lg"}),t>1&&S.jsxs(S.Fragment,{children:[M>0&&S.jsx("button",{onClick:a,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:C},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<t-1&&S.jsx("button",{onClick:s,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:C},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:B},children:R.title}),S.jsx("p",{className:"text-xs mb-3 leading-relaxed",style:{color:B},children:R.subtitle}),S.jsx("div",{className:"space-y-2",children:R.actions?.map((r,l)=>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"?o(r.title,r.payload):r.action==="say-something"&&typeof r.action=="string"&&w(K=>[...K,{sender:"agent",content:r.payload,id:`msg-${Date.now()}`,timestamp:new Date,seen:!0}])},style:{background:E,borderRadius:`${A}px`,color:C},children:r.title},l))})]},U))})}),t>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:`${Q}CC`,color:B},children:[M+1," / ",t]}),t>1&&S.jsx("div",{className:"flex justify-center space-x-2 mt-3",children:g?.map((R,U)=>S.jsx("button",{onClick:()=>G(U),className:`w-2 h-2 rounded-full transition-all duration-200 ${U===M?"scale-125 opacity-100":"opacity-40 hover:opacity-70"}`,style:{backgroundColor:E}},U))})]})})};function DC(g,A,I,B){return new(I||(I=Promise))(function(E,C){function Q(M){try{w(B.next(M))}catch(D){C(D)}}function o(M){try{w(B.throw(M))}catch(D){C(D)}}function w(M){var D;M.done?E(M.value):(D=M.value,D instanceof I?D:new I(function(t){t(D)})).then(Q,o)}w((B=B.apply(g,A||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let vt=class{constructor(){this.listeners={}}on(A,I,B){if(this.listeners[A]||(this.listeners[A]=new Set),this.listeners[A].add(I),B?.once){const E=()=>{this.un(A,E),this.un(A,I)};return this.on(A,E),E}return()=>this.un(A,I)}un(A,I){var B;(B=this.listeners[A])===null||B===void 0||B.delete(I)}once(A,I){return this.on(A,I,{once:!0})}unAll(){this.listeners={}}emit(A,...I){this.listeners[A]&&this.listeners[A].forEach(B=>B(...I))}};const QG={decode:function(g,A){return DC(this,void 0,void 0,function*(){const I=new AudioContext({sampleRate:A});return I.decodeAudioData(g).finally(()=>I.close())})},createBuffer:function(g,A){return typeof g[0]=="number"&&(g=[g]),function(I){const B=I[0];if(B.some(E=>E>1||E<-1)){const E=B.length;let C=0;for(let Q=0;Q<E;Q++){const o=Math.abs(B[Q]);o>C&&(C=o)}for(const Q of I)for(let o=0;o<E;o++)Q[o]/=C}}(g),{duration:A,length:g[0].length,sampleRate:g[0].length/A,numberOfChannels:g.length,getChannelData:I=>g?.[I],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jW(g,A){const I=A.xmlns?document.createElementNS(A.xmlns,g):document.createElement(g);for(const[B,E]of Object.entries(A))if(B==="children"&&E)for(const[C,Q]of Object.entries(E))Q instanceof Node?I.appendChild(Q):typeof Q=="string"?I.appendChild(document.createTextNode(Q)):I.appendChild(jW(C,Q));else B==="style"?Object.assign(I.style,E):B==="textContent"?I.textContent=E:I.setAttribute(B,E.toString());return I}function pW(g,A,I){const B=jW(g,A||{});return I?.appendChild(B),B}var ssA=Object.freeze({__proto__:null,createElement:pW,default:pW});const csA={fetchBlob:function(g,A,I){return DC(this,void 0,void 0,function*(){const B=yield fetch(g,I);if(B.status>=400)throw new Error(`Failed to fetch ${g}: ${B.status} (${B.statusText})`);return function(E,C){DC(this,void 0,void 0,function*(){if(!E.body||!E.headers)return;const Q=E.body.getReader(),o=Number(E.headers.get("Content-Length"))||0;let w=0;const M=t=>DC(this,void 0,void 0,function*(){w+=t?.length||0;const s=Math.round(w/o*100);C(s)}),D=()=>DC(this,void 0,void 0,function*(){let t;try{t=yield Q.read()}catch{return}t.done||(M(t.value),yield D())});D()})}(B.clone(),A),B.blob()})}};let GsA=class extends vt{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,I,B){return this.media.addEventListener(A,I,B),()=>this.media.removeEventListener(A,I,B)}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,I){const B=this.getSrc();if(A&&B===A)return;this.revokeSrc();const E=I instanceof Blob&&(this.canPlayType(I.type)||!A)?URL.createObjectURL(I):A;if(B&&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 DC(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,I){I!=null&&(this.media.preservesPitch=I),this.media.playbackRate=A}getMediaElement(){return this.media}setSinkId(A){return this.media.setSinkId(A)}},n4=class rx extends vt{constructor(A,I){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 B=this.parentFromOptionsContainer(A.container);this.parent=B;const[E,C]=this.initHtml();B.appendChild(E),this.container=E,this.scrollContainer=C.querySelector(".scroll"),this.wrapper=C.querySelector(".wrapper"),this.canvasWrapper=C.querySelector(".canvases"),this.progressWrapper=C.querySelector(".progress"),this.cursor=C.querySelector(".cursor"),I&&C.appendChild(I),this.initEvents()}parentFromOptionsContainer(A){let I;if(typeof A=="string"?I=document.querySelector(A):A instanceof HTMLElement&&(I=A),!I)throw new Error("Container not found");return I}initEvents(){const A=I=>{const B=this.wrapper.getBoundingClientRect(),E=I.clientX-B.left,C=I.clientY-B.top;return[E/B.width,C/B.height]};if(this.wrapper.addEventListener("click",I=>{const[B,E]=A(I);this.emit("click",B,E)}),this.wrapper.addEventListener("dblclick",I=>{const[B,E]=A(I);this.emit("dblclick",B,E)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:I,scrollWidth:B,clientWidth:E}=this.scrollContainer,C=I/B,Q=(I+E)/B;this.emit("scroll",C,Q,I,I+E)}),typeof ResizeObserver=="function"){const I=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{I().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,I,B,E,C=3,Q=0,o=100){if(!A)return()=>{};const w=matchMedia("(pointer: coarse)").matches;let M=()=>{};const D=t=>{if(t.button!==Q)return;t.preventDefault(),t.stopPropagation();let s=t.clientX,a=t.clientY,G=!1;const R=Date.now(),U=O=>{if(O.preventDefault(),O.stopPropagation(),w&&Date.now()-R<o)return;const m=O.clientX,y=O.clientY,L=m-s,j=y-a;if(G||Math.abs(L)>C||Math.abs(j)>C){const Z=A.getBoundingClientRect(),{left:d,top:z}=Z;G||(B?.(s-d,a-z),G=!0),I(L,j,m-d,y-z),s=m,a=y}},r=O=>{if(G){const m=O.clientX,y=O.clientY,L=A.getBoundingClientRect(),{left:j,top:Z}=L;E?.(m-j,y-Z)}M()},l=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||r(O)},K=O=>{G&&(O.stopPropagation(),O.preventDefault())},k=O=>{G&&O.preventDefault()};document.addEventListener("pointermove",U),document.addEventListener("pointerup",r),document.addEventListener("pointerout",l),document.addEventListener("pointercancel",l),document.addEventListener("touchmove",k,{passive:!1}),document.addEventListener("click",K,{capture:!0}),M=()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",r),document.removeEventListener("pointerout",l),document.removeEventListener("pointercancel",l),document.removeEventListener("touchmove",k),setTimeout(()=>{document.removeEventListener("click",K,{capture:!0})},10)}};return A.addEventListener("pointerdown",D),()=>{M(),A.removeEventListener("pointerdown",D)}}(this.wrapper,(A,I,B)=>{this.emit("drag",Math.max(0,Math.min(1,B/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,I){var B;const E=((B=this.audioData)===null||B===void 0?void 0:B.numberOfChannels)||1;if(A==null)return 128;if(!isNaN(Number(A)))return Number(A);if(A==="auto"){const C=this.parent.clientHeight||128;return I?.every(Q=>!Q.overlay)?C/E:C}return 128}initHtml(){const A=document.createElement("div"),I=A.attachShadow({mode:"open"}),B=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return I.innerHTML=`
|
|
551
551
|
<style${B?` nonce="${B}"`:""}>
|
|
552
552
|
:host {
|
|
553
553
|
user-select: none;
|