@lystech/core 3.0.81 → 3.0.82

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.
@@ -43021,7 +43021,7 @@ const Zf = {
43021
43021
  padding: 2,
43022
43022
  lineHeight: 0,
43023
43023
  flexShrink: 0
43024
- }, fW = "@lystech/core", hW = "lystechcorenpmpackage:last-version", mW = "3.0.81";
43024
+ }, fW = "@lystech/core", hW = "lystechcorenpmpackage:last-version", mW = "3.0.82";
43025
43025
  function vW(e = {}) {
43026
43026
  const {
43027
43027
  packageName: t = fW,
@@ -1715,7 +1715,7 @@ html body {
1715
1715
  .lystech-support-close:hover {
1716
1716
  background-color: #f3f4f6 !important;
1717
1717
  color: #374151 !important;
1718
- }`;function tW(){O.useEffect(()=>{if(typeof document>"u"||document.getElementById(qx))return;const e=document.createElement("style");e.id=qx,e.appendChild(document.createTextNode(eW)),document.head.appendChild(e)},[])}const ig=5,nW=6*1024*1024;function rW(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=String(r.result||""),o=a.indexOf(",");t(o>=0?a.slice(o+1):a)},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function Jx(){const{organizationDetails:e}=Wr(),{isLoggedIn:t,currentUser:n}=mr();tW();const r=!!(t&&(n!=null&&n.email)),a=(n==null?void 0:n.email)??"",o=`${(n==null?void 0:n.firstName)??""} ${(n==null?void 0:n.lastName)??""}`.trim()||a,[i,s]=O.useState(!1),[c,u]=O.useState(""),[d,f]=O.useState(""),[h,v]=O.useState(""),[g,p]=O.useState(""),[m,b]=O.useState("idle"),[C,S]=O.useState(""),[E,A]=O.useState([]),w=O.useRef(null),x=O.useRef(null),P=O.useRef(null);O.useEffect(()=>{if(!i)return;const T=D=>{D.key==="Escape"&&s(!1)};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[i]),O.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);function M(){u(""),f(""),v(""),p(""),b("idle"),S(""),A([])}function N(T){const D=Array.from(T.target.files||[]),z=D.filter(F=>(F.type==="application/pdf"||F.type.startsWith("image/"))&&F.size<=nW);z.length<D.length&&S("PDF et images seulement (max ~6 Mo par fichier)."),A(F=>[...F,...z].slice(0,ig)),T.target.value=""}function I(){s(!1),P.current&&(clearTimeout(P.current),P.current=null),setTimeout(M,250)}function L(){i?I():(M(),s(!0))}async function j(T){var D;if(T.preventDefault(),m!=="sending"){b("sending"),S("");try{const z=await Promise.all(E.map(async F=>({filename:F.name,contentType:F.type||"application/octet-stream",dataBase64:await rW(F)})));await kt.post("/support/submit",{name:r?o:c,email:r?a:d,message:h,website:g,attachments:z.length>0?z:void 0}),b("success"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{I()},2500)}catch(z){const F=(D=z==null?void 0:z.response)==null?void 0:D.status;F===429?(b("error"),S("Trop de messages, réessaie plus tard.")):F===409?I():(b("error"),S("Échec de l'envoi, réessaie."))}}}if(!(e!=null&&e.supportEnabled))return null;const R=m==="sending";return y.jsxs("div",{style:{position:"fixed",bottom:20,right:20,zIndex:_Y,pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"},children:[i&&y.jsxs("div",{ref:w,role:"dialog","aria-label":"Formulaire de contact du support",style:{pointerEvents:"auto",width:"min(360px, calc(100vw - 32px))",maxHeight:"calc(100vh - 110px)",overflowY:"auto",backgroundColor:"#ffffff",color:"#1f2937",borderRadius:18,border:"1px solid rgba(15, 118, 110, 0.08)",boxShadow:"0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08)",padding:22,boxSizing:"border-box",animation:"lystech-support-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1)"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:18},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11},children:[y.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:11,backgroundColor:"rgba(15, 118, 110, 0.1)",color:Nl,flexShrink:0},children:y.jsx(eg,{size:22,weight:"fill"})}),y.jsxs("div",{children:[y.jsx("strong",{style:{display:"block",fontSize:16,lineHeight:1.25,color:"#111827"},children:"Contacter le support"}),y.jsx("span",{style:{display:"block",fontSize:12.5,lineHeight:1.4,color:"#6b7280",marginTop:2},children:"On te répond rapidement."})]})]}),y.jsx("button",{type:"button",onClick:I,"aria-label":"Fermer",className:"lystech-support-close",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"inline-flex",color:"#9ca3af",borderRadius:8,lineHeight:0,flexShrink:0,transition:"background-color 0.15s ease, color 0.15s ease"},children:y.jsx(Pl,{size:20})})]}),m==="success"?y.jsx("div",{style:{padding:"24px 8px",textAlign:"center",fontSize:15,color:"#047857",fontWeight:600},children:"✓ Message envoyé, merci !"}):y.jsxs("form",{onSubmit:j,noValidate:!0,children:[y.jsx("input",{type:"text",name:"website",value:g,onChange:T=>p(T.target.value),tabIndex:-1,"aria-hidden":"true",autoComplete:"off",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0}}),r?y.jsxs("div",{style:{fontSize:12.5,color:"#6b7280",marginBottom:14,lineHeight:1.4},children:["Connecté·e en tant que"," ",y.jsx("span",{style:{color:"#374151",fontWeight:600},children:a})]}):y.jsxs(y.Fragment,{children:[y.jsxs("label",{style:sg,children:["Nom",y.jsx("input",{type:"text",value:c,onChange:T=>u(T.target.value),required:!0,disabled:R,placeholder:"Ton nom",className:"lystech-support-field",style:lg})]}),y.jsxs("label",{style:sg,children:["Courriel",y.jsx("input",{type:"email",value:d,onChange:T=>f(T.target.value),required:!0,disabled:R,placeholder:"toi@exemple.com",className:"lystech-support-field",style:lg})]})]}),y.jsxs("label",{style:sg,children:["Message",y.jsx("textarea",{value:h,onChange:T=>v(T.target.value),required:!0,disabled:R,rows:4,placeholder:"Comment peut-on t'aider ?",className:"lystech-support-field",style:{...lg,resize:"vertical",minHeight:96}})]}),y.jsxs("div",{style:{marginBottom:14},children:[y.jsx("input",{ref:x,type:"file",multiple:!0,accept:".pdf,image/*",onChange:N,style:{display:"none"}}),y.jsx("button",{type:"button",onClick:()=>{var T;return(T=x.current)==null?void 0:T.click()},disabled:R||E.length>=ig,style:{...aW,opacity:R||E.length>=ig?.6:1},children:"📎 Joindre un fichier (PDF / image)"}),E.length>0&&y.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:6},children:E.map((T,D)=>y.jsxs("div",{style:oW,children:[y.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:T.name}),y.jsx("button",{type:"button",onClick:()=>A(z=>z.filter((F,V)=>V!==D)),"aria-label":"Retirer le fichier",style:iW,children:y.jsx(Pl,{size:14})})]},D))})]}),m==="error"&&C&&y.jsx("div",{role:"alert",style:{color:"#b91c1c",fontSize:13,marginBottom:12},children:C}),y.jsx("button",{type:"submit",disabled:R,className:"lystech-support-send-btn",style:{width:"100%",padding:"12px 16px",marginTop:2,backgroundColor:Nl,color:"#ffffff",border:"none",borderRadius:11,fontSize:15,fontWeight:600,letterSpacing:.2,cursor:R?"default":"pointer",opacity:R?.7:1,boxShadow:"0 4px 12px rgba(15, 118, 110, 0.24)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},children:R?"Envoi…":"Envoyer"})]})]}),y.jsx("button",{type:"button",onClick:L,"aria-label":"Contacter le support","aria-expanded":i,className:"lystech-support-fab",style:{pointerEvents:"auto",width:Qx,height:Qx,borderRadius:"50%",backgroundColor:Nl,color:"#ffffff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 16px rgba(0, 0, 0, 0.24)",transition:"background-color 0.15s ease, transform 0.15s ease"},children:y.jsx(eg,{size:28,weight:"fill"})})]})}const sg={display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:14},lg={display:"block",width:"100%",marginTop:6,padding:"11px 13px",fontSize:14,color:"#1f2937",backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:10,boxSizing:"border-box",fontFamily:"inherit"},aW={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",fontSize:13,fontWeight:600,color:Nl,backgroundColor:"rgba(15, 118, 110, 0.08)",border:"1px dashed rgba(15, 118, 110, 0.4)",borderRadius:10,cursor:"pointer",fontFamily:"inherit"},oW={display:"flex",alignItems:"center",gap:8,padding:"6px 10px",fontSize:12.5,color:"#374151",backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8},iW={display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer",padding:2,lineHeight:0,flexShrink:0},sW="@lystech/core",lW="lystechcorenpmpackage:last-version",_x="3.0.81";function $x(e={}){const{packageName:t=sW,storageKey:n=lW,triggerOnFirstInstall:r=!1,onPackageUpdated:a}=e,[o,i]=O.useState(null),[s]=O.useState(_x),[c,u]=O.useState(!1),[d,f]=O.useState(!1),h=O.useCallback(()=>{if(typeof window>"u")return;const v=localStorage.getItem(n),g=!v,p=!!v&&v!==s;if(i(v),u(g),f(p),g||p){const m={packageName:t,previousVersion:v,currentVersion:s,isFirstInstall:g,hasUpdated:p};(p||g&&r)&&(a==null||a(m)),window.dispatchEvent(new CustomEvent("lystechcorenpmpackage:update",{detail:m}))}localStorage.setItem(n,s)},[n,s,t,r,a]);return O.useEffect(()=>{h()},[h]),O.useMemo(()=>({packageName:t,previousVersion:o,currentVersion:s,isFirstInstall:c,hasUpdated:d,checkForUpdate:h}),[t,o,s,c,d,h])}const cW=new L3({defaultOptions:{queries:{staleTime:1e3*60*5,retry:3,refetchOnWindowFocus:!1}}}),eA=O.createContext({}),qo=()=>O.useContext(eA);function uW({children:e,organization:t,shouldRedirectAfterLogin:n,loginRedirectRoute:r,queryClient:a,usePushNotifications:o,useProgressiveWebAppFeatures:i,useThemeProvider:s,quickGoogleLoginButtonStyle:c,enableGoogleQuickLoginButton:u,showGoogleQuickLoginButton:d,useGoogleAutoSelect:f,debugMode:h,showAskPermissionsButtons:v,hideSupportButton:g,onPackageUpdated:p,triggerOnFirstInstallPackageCallback:m,packageVersionStorageKey:b}){const C=a||cW;$x({onPackageUpdated:p,triggerOnFirstInstall:!!m,storageKey:b});const S=y.jsxs(eA.Provider,{value:{debugMode:h,usePushNotifications:o,useProgressiveWebAppFeatures:i},children:[h&&y.jsxs("div",{className:"p-10",children:[y.jsx("h2",{children:"DEBUG MODE"}),y.jsxs("p",{children:["Organization: ",t]})]}),y.jsx(bY,{children:y.jsx(fY,{children:y.jsx(W3,{client:C,children:y.jsx(pY,{usePushNotifications:o,children:y.jsx(mY,{children:y.jsx(dW,{organization:t,children:y.jsx(gW,{shouldRedirectAfterLogin:n,loginRedirectRoute:r,quickGoogleLoginButtonStyle:c,enableGoogleQuickLoginButton:u,showGoogleQuickLoginButton:d,useGoogleAutoSelect:f,children:y.jsxs(bx,{children:[e,v&&y.jsx(Zx,{enableInstallAppButton:v==null?void 0:v.installApp,enablePushNotificationButton:v==null?void 0:v.pushNotifications}),!g&&y.jsx(Jx,{})]})})})})})})})})]});return s?y.jsx(CY,{children:S}):S}const tA=O.createContext({});function Wr(){return O.useContext(tA)}function dW({children:e,organization:t}){const n=Gf(),{debugMode:r}=qo(),[a,o]=O.useState(t||"");O.useEffect(()=>{if(t){r&&console.log("OrganizationProvider: organization prop utilisée",t),o(t);return}const E=new URLSearchParams(n.search),A=E.get("org");if(A){r&&console.log("OrganizationProvider: paramètre ?org= trouvé dans l'URL",A),E.delete("org");const w=`${n.pathname}${E.toString()?"?"+E.toString():""}`;window.history.replaceState({},"",w),o(A)}else{const w=localStorage.getItem("Organization");w?(r&&console.log("OrganizationProvider: organisation trouvée dans le localStorage",w),o(w)):r&&console.log("OrganizationProvider: aucune organisation trouvée")}},[t,n.search,n.pathname,r]);function i(E){r&&console.log("User logged in:",E),!a&&!t&&E!=null&&E.defaultOrganization&&o(E.defaultOrganization)}const{data:s,isLoading:c,refetch:u}=F1(a),d=kf();function f(){u(),d.invalidateQueries()}O.useEffect(()=>{f()},[a]),O.useEffect(()=>{localStorage.removeItem("invalid-organizations")},[]);const[h,v]=O.useState(""),[g,p]=O.useState({clientId:"",appSecret:"",clientIdSandbox:"",appSecretSandbox:"",enabled:!1});O.useEffect(()=>{localStorage.setItem("Organization",a),r&&(a?console.log("OrganizationProvider: organisation mise à jour dans le localStorage",a):console.warn("OrganizationProvider: organisationState est vide, pas de mise à jour dans le localStorage"))},[a]),O.useEffect(()=>{v((s==null?void 0:s.image)??""),s&&p({clientId:(s==null?void 0:s.paypalClientId)??"",appSecret:(s==null?void 0:s.paypalAppSecret)??"",clientIdSandbox:(s==null?void 0:s.paypalClientIdSandbox)??"",appSecretSandbox:(s==null?void 0:s.paypalAppSecretSandbox)??"",enabled:!!s.paypalEnabled||!1})},[s]);async function m(E){const A=await p3(E);return A!=null&&A.success&&u(),A==null?void 0:A.success}async function b(E){const A=await b3(E);return A!=null&&A.success&&(u(),p(w=>({...w,enabled:E}))),A==null?void 0:A.success}async function C(){await C3(),u()}async function S(E,A,w){const x=await y3(E,A,w);return f(),x}return y.jsx(tA.Provider,{value:{organization:a,organizationImage:h,organizationDetails:s??void 0,areOrganizationDetailsLoading:c,paypalInfo:g,onLoggedIn:i,updateOrganizationDetails:m,updatePaypalConfiguration:S,toggleOrganizationMode:C,updateOrganizationPaypalEnabled:b,refetchOrganizationDetails:f},children:e})}async function fW(){return await kt.get("/users/roles")}const nA=(e,t)=>Er(["user-role-details",e,t],fW,{enabled:!!e,select:n=>n==null?void 0:n.data,onError:n=>{console.error("Error fetching user role details:",n)}}),hW={apiKey:"AIzaSyCpAeHlt1wZvM5KtYg7X7MDVnWVJT86gvc",authDomain:"lystech.firebaseapp.com",databaseURL:"https://lystech.firebaseio.com",projectId:"lystech",storageBucket:"lystech.appspot.com",messagingSenderId:"237347321732",appId:"1:237347321732:web:7f9586d48e488d73ddcfd1"};async function rA(e){const t=new FormData;t.append("image",e);const n=await kt.put("users/image",t,{headers:{"Content-Type":"multipart/form-data"},data:t});return n==null?void 0:n.data}async function aA(e,t){const n=await kt.put("users/image/url",{authKey:e,imageUrl:t});return n==null?void 0:n.data}async function mW(e){const t=await kt.post("auth/request-reset-password",{email:e});return t==null?void 0:t.data}async function vW(e){const t=await kt.post(`auth/activate/${e}`);return t==null?void 0:t.data}async function oA(e){return await kt.post("auth/register",{...e})}const iA=O.createContext({});function mr(){return O.useContext(iA)}function gW({children:e,shouldRedirectAfterLogin:t,loginRedirectRoute:n,quickGoogleLoginButtonStyle:r,enableGoogleQuickLoginButton:a,showGoogleQuickLoginButton:o,useGoogleAutoSelect:i=!0}){var X,ae,ie,ee,ce,le,Se;const[s,c]=O.useState(n||null),{debugMode:u}=qo();A0(hW);const{organization:d,onLoggedIn:f}=Wr(),h=O.useCallback(()=>{const ue=sessionStorage.getItem("username");if(ue)return{id:parseInt(sessionStorage.getItem("id")||"-1"),displayName:ue,firstName:sessionStorage.getItem("firstName")||"",lastName:sessionStorage.getItem("lastName")||"",birthday:sessionStorage.getItem("birthday")?new Date(sessionStorage.getItem("birthday")):null,email:sessionStorage.getItem("email")||"",UID:sessionStorage.getItem("authKey")||"",profileImage:sessionStorage.getItem("profileImage")||"",notifyCoffee:sessionStorage.getItem("notifyCoffee")?parseInt(sessionStorage.getItem("notifyCoffee")):0,defaultOrganization:sessionStorage.getItem("defaultOrganization")||"",thirdPartyAuthUID:sessionStorage.getItem("thirdPartyAuthUID")||"",roleDetails:{role:"",isOwner:!1,isSuperAdmin:!1,isAdmin:!1,isUser:!1,isSuperAdminOrMore:!1,isAdminOrMore:!1,isUserOrMore:!1,isAdminInAnyOrganization:!1},type:"emailPassword",activatedOn:"",approvedBy:""}},[]),v=O.useCallback(()=>{const te=h();return te||{}},[h]);function g(te){p&&(p.notifyCoffee=te,m({...p}),sessionStorage.setItem("notifyCoffee",te.toString()))}const[p,m]=O.useState(v()),b=O.useCallback(async te=>{const{success:ue,url:ve}=await rA(te);return ue&&(p.photoURL=ve,p.profileImage=ve,m({...p}),sessionStorage.setItem("profileImage",ve||"")),ue},[p,m]),C=O.useCallback(async te=>{const{success:ue,url:ve}=await aA(p==null?void 0:p.UID,te);return ue&&(p.photoURL=ve,p.profileImage=ve,m({...p}),sessionStorage.setItem("profileImage",ve||"")),ue},[p,m]),S=O.useCallback(te=>{p.firstName=te,m({...p}),sessionStorage.setItem("firstName",te)},[p,m]),E=O.useCallback(te=>{p.lastName=te,m({...p}),sessionStorage.setItem("lastName",te)},[p,m]),A=X1(),w=LM(),x=O.useMemo(()=>{if(p&&p.id!==-1&&p!=null&&p.UID)return{id:p.id,UID:p.UID,thirdPartyAuthUID:p.thirdPartyAuthUID,displayName:p.displayName,firstName:p.firstName,lastName:p.lastName,birthday:p.birthday,profileImage:p.profileImage,defaultOrganization:p.defaultOrganization,email:p.email,roleDetails:p.roleDetails,type:"emailPassword",activatedOn:p.activatedOn,notifyCoffee:p.notifyCoffee,approvedBy:p.approvedBy}},[p]),{data:P,isLoading:M}=nA((x==null?void 0:x.UID)??"",d),N=O.useMemo(()=>({...x,roleDetails:P}),[x,P]),I=O.useMemo(()=>!!(x!=null&&x.UID)&&(x==null?void 0:x.id)!==-1,[x]);O.useEffect(()=>{localStorage.setItem("authKey",(x==null?void 0:x.UID)??"")},[x]);const[L,j]=O.useState(!0),R=O.useRef(!1);O.useEffect(()=>{R.current||(R.current=!0,z().finally(()=>j(!1)))},[]);const T=O.useRef(!1),D=O.useRef(()=>{});O.useEffect(()=>{const te=kt.interceptors.response.use(ue=>ue,ue=>{var ve;return((ve=ue==null?void 0:ue.response)==null?void 0:ve.status)===401&&T.current&&(console.warn("[Auth] 401 reçu alors que connecté — session invalide, déconnexion locale."),D.current()),Promise.reject(ue)});return()=>{kt.interceptors.response.eject(te)}},[]),O.useEffect(()=>{T.current=I},[I]),O.useEffect(()=>{D.current=()=>ne(null)});async function z(){try{const te=await kt.get("/auth/me");return console.log("Validate Me Response",te),te.data&&ne(te==null?void 0:te.data),te==null?void 0:te.data}catch(te){return console.log("Validate Me Error",te),null}finally{j(!1)}}O.useEffect(()=>{P&&localStorage.setItem("userRoleDetails",JSON.stringify(P))},[P]);const F=O.useMemo(()=>{if(!I)return"/login";let te="";return P&&(te="/past-orders"),te===""&&(te="/"),("/"+te+"/").replace(/\/+/g,"/")},[P,I]);async function V(te,ue,ve,de=()=>{},Ae=()=>{},we=0){try{const be={email:te,password:ue},xe=await kt.get("/auth/login",{headers:be}),Re=!!xe.data;ve({result:Re,data:xe==null?void 0:xe.data}),we>0?setTimeout(()=>{ne(xe==null?void 0:xe.data),t&&s&&A(s),f&&f(xe==null?void 0:xe.data)},we):(ne(xe==null?void 0:xe.data),f&&f(xe==null?void 0:xe.data),t&&s&&A(s))}catch(be){console.log("Login Error",be),(be==null?void 0:be.status)===403?de(be):Ae(be)}}async function W(te,ue,ve){const de=await kt.post("/auth/login/third-party",{providerData:te,token:ue,tokenType:ve}),Ae=de==null?void 0:de.data;if(!Ae){console.error("No user data returned from third-party login");return}return ne(Ae),f&&f(Ae),de}async function k(){var te,ue,ve,de;try{const Ae=new Ia;Ae.setCustomParameters({prompt:"select_account"});const we=await Cp(w,Ae);if(((ue=(te=we==null?void 0:we.user)==null?void 0:te.providerData)==null?void 0:ue.length)===0||!((ve=we==null?void 0:we.user)!=null&&ve.providerData))return;const be=(de=we==null?void 0:we.user)==null?void 0:de.providerData[0],xe=await we.user.getIdToken();return await W(be,xe,"firebase")}catch(Ae){console.error("Google login failed",Ae)}}async function H(){var te;try{const ue=new Na,ve=await Cp(w,ue),de=(te=ve==null?void 0:ve.user)==null?void 0:te.providerData[0],Ae=await ve.user.getIdToken();return await W(de,Ae,"firebase")}catch(ue){console.error("Facebook login failed",ue)}}async function B(){try{await kt.post("/auth/logout")}catch(te){console.warn("Déconnexion serveur échouée",te)}sessionStorage.clear(),localStorage.clear(),ne(null),x6(w),A("/")}async function U(te){const ue=KM(te.credential);if(ue!=null&&ue.email){let ve="unknown.com";ue!=null&&ue.iss.includes("google")?ve="google.com":ue!=null&&ue.iss.includes("facebook")&&(ve="facebook.com");const de={displayName:ue==null?void 0:ue.given_name,email:ue==null?void 0:ue.email,phoneNumber:null,photoURL:ue==null?void 0:ue.picture,providerId:ve,uid:ue==null?void 0:ue.sub};return await W(de,te.credential,"google")}}const Y=()=>{console.error("Google login failed")};function _(te){t&&s&&A(s)}function $(te){var ue;if(!te){sessionStorage.clear();return}sessionStorage.setItem("username",te.displayName),sessionStorage.setItem("email",te.email),sessionStorage.setItem("firstName",te.firstName??""),sessionStorage.setItem("lastName",te.lastName??""),sessionStorage.setItem("birthday",((ue=te.birthday)==null?void 0:ue.toString())??""),sessionStorage.setItem("defaultOrganization",te.defaultOrganization),sessionStorage.setItem("id",te.id.toString()),sessionStorage.setItem("authKey",te.UID),sessionStorage.setItem("thirdPartyAuthUID",te.thirdPartyAuthUID),sessionStorage.setItem("profileImage",te.profileImage),sessionStorage.setItem("notifyCoffee",te.notifyCoffee.toString())}function ne(te){m(te),$(te),(te==null?void 0:te.id)==-1&&(te==null?void 0:te.id)!=-1&&_()}const oe=O.useMemo(()=>{var te,ue,ve;return I?!1:a!==void 0?a:!((te=window==null?void 0:window.location)!=null&&te.pathname.includes("/activate"))&&!((ue=window==null?void 0:window.location)!=null&&ue.pathname.includes("/account/reset-password"))&&!((ve=window==null?void 0:window.location)!=null&&ve.pathname.includes("/account/activation"))},[I,a,(X=window==null?void 0:window.location)==null?void 0:X.pathname]),se=O.useMemo(()=>{var te;return o!==void 0?o:oe&&!((te=window==null?void 0:window.location)!=null&&te.pathname.includes("/login"))},[oe,o,(ae=window==null?void 0:window.location)==null?void 0:ae.pathname]);return O.useEffect(()=>{u&&(console.log("AuthProvider - user.UID:",x==null?void 0:x.UID),console.log("AuthProvider - isLoggedIn:",I))},[x==null?void 0:x.UID,I]),y.jsx(HM,{clientId:"237347321732-65nra8lcs59qn6dms77ruad01vjdr7ph.apps.googleusercontent.com",children:y.jsxs(iA.Provider,{value:{user:x?{...x,roleDetails:P||{role:"",isOwner:!1,isSuperAdmin:!1,isAdmin:!1,isUser:!1,isSuperAdminOrMore:!1,isAdminOrMore:!1,isUserOrMore:!1,isAdminInAnyOrganization:!1}}:void 0,currentUser:N,auth:w,isLoggedIn:I,isCheckingSession:L,isSuperAdmin:!!((ie=N==null?void 0:N.roleDetails)!=null&&ie.isSuperAdminOrMore),isAdmin:!!((ee=N==null?void 0:N.roleDetails)!=null&&ee.isAdminOrMore),isUser:!!((ce=N==null?void 0:N.roleDetails)!=null&&ce.isUserOrMore),isSuperAdminInAnyOrganization:!!((le=N==null?void 0:N.roleDetails)!=null&&le.isSuperAdminOrMore),isAdminInAnyOrganization:!!((Se=N==null?void 0:N.roleDetails)!=null&&Se.isAdminInAnyOrganization),areRoleDetailsLoading:M,homeRoute:F,setLoginRedirectRouteState:c,registerNewUser:oA,signInWithEmailAndPassword:V,signInWithGoogle:k,signInWithFacebook:H,logout:B,requestResetPassword:mW,activateUser:vW,updateUserImage:b,updateUserImageUrl:C,updateUserFirstName:S,updateUserLastName:E,updateNotificationState:g},children:[u&&y.jsx("div",{className:"p-10",children:y.jsxs("p",{children:["Login Redirect Route State: ",y.jsx("b",{children:s||"null"})]})}),e,oe&&y.jsx("div",{className:`fixed top-10 right-10 ${se?"":"hidden"}`,style:r,children:y.jsx(WM,{onSuccess:U,onError:Y,auto_select:i,useOneTap:!0,type:"icon"})})]})})}async function pW(){return(await kt.get("/politique-and-conditions/9716a5de-02be-4fb2-b9b5-85ad82bfae4f")).data}async function bW(){return(await kt.get("/politique-and-conditions")).data}const sA=()=>Er({queryKey:["lystech-politique-and-conditions"],queryFn:pW}),lA=e=>Er({queryKey:["politique-and-conditions",e],queryFn:bW,enabled:!!e});async function yW(){const e=await kt.get("collections/invitation");return(e==null?void 0:e.data)||[]}const fd=(e,t)=>Er(["invitedToOrders",e,t],yW,{staleTime:1e3*60*2,select:n=>t?n.filter(r=>r.organization.subdomain===t):n,enabled:!!e});async function CW(e,t){const n={code:e,products:t},r=await kt.post("promo-codes/validate",n);return r==null?void 0:r.data}async function cA(){const e=await kt.get("promo-codes/user");return e==null?void 0:e.data}const SW=e=>Er(["personal-promo-codes",e],cA,{enabled:!!e,refetchInterval:45*1e3,refetchOnWindowFocus:!0});async function uA(){const e=await kt.get("images/featured");return e==null?void 0:e.data}const wW=()=>Er(["featured-images"],uA,{onError:e=>{console.error("Error fetching featured images:",e)}});async function dA(e){const t=await kt.get(`/posts/slug/${e}`);if(t.status!==200)throw new Error(`Error fetching post with ID ${e}: ${t.statusText}`);return t.data}const EW=(e,t)=>Er(["single-post",e,t],()=>dA(e));async function xW(e){const t=await kt.get(`/shop/collection/${e}`);return t==null?void 0:t.data}async function AW(e,t){const n=await kt.post("/shop/breakdown",{products:e,promoCodes:t});return n==null?void 0:n.data}async function OW(e){const t=await kt.post("/shop/save",e);return t==null?void 0:t.data}const fA=(e,t,n)=>Er(["order-details-breakdown",e,t.map(r=>r.UID),t.map(r=>r.quantity),n.map(r=>r.toLowerCase())],async()=>await AW(t,n),{enabled:!!e&&t.length>0}),MW=()=>kf();async function PW(){try{const e=await kt.get("/shop/collections");return localStorage.setItem("collections",JSON.stringify(e==null?void 0:e.data)),(e==null?void 0:e.data)||[]}catch(e){return console.log(e),[]}}async function hA(e){var n;const t=await kt.post("stripe/checkout",e);if(t.status===200&&((n=t.data)!=null&&n.url))return t.data;throw new Error("Failed to create Stripe checkout session")}const mA=({onSuccess:e,onAccountNotActivated:t,onAccountNotFound:n,onError:r,className:a="",showTitle:o=!0,title:i="Se connecter",loginButtonText:s="Se connecter",pendingConnexionButtonText:c="Connexion...",passwordFieldLabel:u="Mot de passe",emailFieldLabel:d="Email",emailFieldPlaceholder:f="Votre email",passwordFieldPlaceholder:h="••••••••••••",loginSuccessMessage:v="Connexion réussie",unknownErrorMessage:g="Une erreur inconnue est survenue.",showForgotPassword:p=!1,forgotPasswordText:m="Mot de passe oublié ?",onForgotPassword:b})=>{const C=mr(),S=na(),[E,A]=O.useState({email:"",password:""}),[w,x]=O.useState(!1),[P,M]=O.useState(!1),N=(L,j)=>{A(R=>({...R,[L]:j}))},I=async L=>{var j,R,T;L.preventDefault(),x(!0);try{await C.signInWithEmailAndPassword(E.email,E.password,D=>{e?e(D):S.showMessage({type:"success",message:v})},D=>{t?t(D):S.showMessage({type:"warning",message:D==null?void 0:D.message})},D=>{n?n(D):S.showMessage({type:"error",message:D==null?void 0:D.message})})}catch(D){const z=D instanceof Error?D:new Error("Erreur inconnue");if(r)r(z);else{const F=(T=(R=(j=D.error)==null?void 0:j.response)==null?void 0:R.data)==null?void 0:T.message;S.showMessage({type:"error",message:F||g})}}finally{x(!1)}};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`auth-form ${a}`,children:[o&&y.jsx("h2",{children:i}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:d}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:E.email,onChange:L=>N("email",L.target.value),required:!0,placeholder:f})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"password",children:u}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:P?"text":"password",id:"password",value:E.password,onChange:L=>N("password",L.target.value),required:!0,placeholder:h}),y.jsx("button",{type:"button",className:"auth-field__icon auth-field__eye",onClick:()=>M(L=>!L),"aria-label":P?"Masquer le mot de passe":"Afficher le mot de passe",children:P?y.jsx(Dx,{size:18}):y.jsx(Rx,{size:18})})]})]})}),p&&b&&y.jsx("div",{className:"auth-form__forgot",children:y.jsx("button",{type:"button",className:"link-button",onClick:b,children:m})}),y.jsx("button",{type:"button",disabled:w||!E.email.trim()||!E.password.trim(),className:"btn btn-primary",onClick:I,children:w?c:s})]}),y.jsx("div",{className:"auth-divider",children:"ou continuer avec"}),y.jsxs("div",{className:"third-party-row",children:[y.jsxs("button",{type:"button",className:"third-party-login-button login-with-google",onClick:()=>C.signInWithGoogle(),children:[y.jsx(Lx,{size:20,weight:"bold"})," Google"]}),y.jsxs("button",{type:"button",className:"third-party-login-button login-with-facebook",onClick:()=>C.signInWithFacebook(),children:[y.jsx(Tx,{size:20,weight:"fill"})," Facebook"]})]})]})},vA=({onSuccess:e,onEmailAlreadyExists:t,onError:n,className:r="",showTitle:a=!0,title:o="Créer un compte",showBirthdayField:i=!0,firstNameFieldLabel:s="Prénom",firstNameFieldPlaceholder:c="Votre prénom",lastNameFieldLabel:u="Nom",lastNameFieldPlaceholder:d="Votre nom",emailFieldLabel:f="Email",emailFieldPlaceholder:h="Votre email",birthdayFieldLabel:v="Date de naissance",birthdayFieldPlaceholder:g="Votre date de naissance",passwordFieldLabel:p="Mot de passe",passwordFieldPlaceholder:m="••••••••••••",confirmPasswordFieldLabel:b="Confirmation du mot de passe",confirmPasswordFieldPlaceholder:C="••••••••••••",createAccountButtonText:S="Créer le compte",creatingAccountButtonText:E="Création en cours...",accountCreatedMessage:A="Compte créé avec succès !",accountAlreadyExistsMessage:w="Un compte avec cet email existe déjà.",errorMessage:x="Une erreur est survenue lors de la création du compte.",passwordNotMatchMessage:P="Les mots de passe ne correspondent pas.",politiqueAndConditionsConsentTexte:M="En créant un compte, j'accepte les termes et conditions.",seePolitiqueAndConditions:N="Voir les termes et conditions",politiqueAndConditionsRoute:I="/conditions"})=>{const L=mr(),j=na(),[R,T]=O.useState({firstName:"",lastName:"",email:"",birthday:"",password:"",confirmPassword:""}),[D,z]=O.useState(!1),F=(W,k)=>{T(H=>({...H,[W]:k}))},V=async W=>{var k,H,B;if(W.preventDefault(),z(!0),R.password!==R.confirmPassword){j.showMessage({type:"error",message:P}),z(!1);return}try{L.registerNewUser?(await L.registerNewUser({username:R.email,email:R.email,password:R.password,firstName:R.firstName,lastName:R.lastName,birthday:R.birthday||void 0}),e?e():j.showMessage({type:"success",message:A})):j.showMessage({type:"error",message:"La méthode d'enregistrement n'est pas disponible."})}catch(U){const Y=U instanceof Error?U:new Error("Erreur inconnue");if(n)console.log("Error in AuthRegisterForm:",Y),n(Y);else{const _=(B=(H=(k=U.error)==null?void 0:k.response)==null?void 0:H.data)==null?void 0:B.message;j.showMessage({type:"error",message:_})}}finally{z(!1)}};return y.jsxs("form",{onSubmit:V,className:`auth-form ${r}`,children:[a&&y.jsx("h2",{children:o}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"firstName",children:s}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ag,{size:18})}),y.jsx("input",{type:"text",id:"firstName",value:R.firstName,onChange:W=>F("firstName",W.target.value),placeholder:c,required:!0})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"lastName",children:u}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ag,{size:18})}),y.jsx("input",{type:"text",id:"lastName",value:R.lastName,onChange:W=>F("lastName",W.target.value),required:!0,placeholder:d})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:f}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:R.email,onChange:W=>F("email",W.target.value),required:!0,placeholder:h})]})]})}),i&&y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"birthday",children:v}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(Ax,{size:18})}),y.jsx("input",{type:"date",id:"birthday",value:R.birthday,onChange:W=>F("birthday",W.target.value)})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"password",children:p}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:"password",id:"password",value:R.password,onChange:W=>F("password",W.target.value),required:!0,placeholder:m})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"confirmPassword",children:b}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:"password",id:"confirmPassword",value:R.confirmPassword,onChange:W=>F("confirmPassword",W.target.value),required:!0,placeholder:C})]})]})}),y.jsx("div",{className:"form-row",children:y.jsx("div",{className:"form-group",style:{fontSize:"0.95em",color:"#555"},children:y.jsxs("span",{children:[M," ",y.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--auth-accent)",textDecoration:"underline"},children:N})]})})}),y.jsx("button",{type:"submit",disabled:D,className:"btn btn-primary",children:D?E:S})]})},gA=({onSuccess:e,onError:t,className:n="",showTitle:r=!0,title:a="Réinitialiser le mot de passe",showDescription:o=!0,description:i="Entrez votre email pour recevoir un lien de réinitialisation.",emailFieldLabel:s="Email",confirmButtonText:c="Envoyer le lien",confirmingButtonText:u="Envoi en cours...",emailFieldPlaceholder:d="votre@email.com",activationMailSentMessage:f="Un email de réinitialisation a été envoyé à votre adresse.",errorMessage:h="Impossible d'envoyer l'email de réinitialisation."})=>{const v=mr(),g=na(),[p,m]=O.useState(""),[b,C]=O.useState(""),[S,E]=O.useState(!1),A=async x=>{x.preventDefault(),E(!0);try{const P=await v.requestResetPassword(p);C(p),e?e(p):g.showMessage({type:"success",message:f})}catch(P){const M=P instanceof Error?P:new Error("Erreur inconnue");t?t(M):g.showMessage({type:"error",message:`${h}`})}finally{E(!1)}},w=S||p===b||!p.trim();return y.jsxs("form",{onSubmit:A,className:`auth-form ${n}`,children:[r&&y.jsx("h2",{children:a}),o&&y.jsx("p",{className:"form-description",children:i}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:s}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:p,onChange:x=>m(x.target.value),required:!0,placeholder:d})]})]})}),y.jsx("button",{type:"submit",disabled:w,className:"btn btn-primary",children:S?u:c})]})},pA=({onLogout:e,onClose:t,className:n="",showTitle:r=!0,title:a="Profil utilisateur",showCloseButton:o=!1,closeButtonText:i="Fermer",logoutSuccessMessage:s="Déconnexion réussie",logoutErrorMessage:c="Erreur lors de la déconnexion",disconnectedLabel:u="Non connecté",mustBeLoggedInMessage:d="Vous devez être connecté pour voir votre profil.",logoutButtonText:f="Se déconnecter",emailLabel:h="Email",nameLabel:v="Nom",idLabel:g="ID"})=>{var C,S,E;const p=mr(),m=na(),b=async()=>{try{await p.logout(),e?e():m.showMessage({type:"success",message:s})}catch(A){console.error("Erreur lors de la déconnexion:",A),m.showMessage({type:"error",message:c})}};return p.isLoggedIn?y.jsxs("div",{className:`user-profile ${n}`,children:[y.jsx("div",{className:"profile-icon",children:"👤"}),r&&y.jsx("h2",{children:a}),y.jsxs("div",{className:"user-info",children:[y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[h,":"]}),y.jsx("span",{className:"value",children:((C=p.currentUser)==null?void 0:C.email)||"N/A"})]}),y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[v,":"]}),y.jsx("span",{className:"value",children:((S=p.currentUser)==null?void 0:S.displayName)||"N/A"})]}),y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[g,":"]}),y.jsx("span",{className:"value",children:((E=p.currentUser)==null?void 0:E.id)||"N/A"})]})]}),y.jsxs("div",{className:"profile-actions",children:[y.jsx("button",{onClick:b,className:"btn btn-logout",children:f}),o&&t&&y.jsx("button",{onClick:t,className:"btn btn-secondary",children:i})]})]}):y.jsxs("div",{className:`user-profile ${n}`,children:[y.jsx("div",{className:"profile-icon",children:"🔒"}),y.jsx("h2",{children:u}),y.jsx("p",{children:d})]})};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function bA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function NW(e){if(Array.isArray(e))return e}function IW(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,i,s=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}function RW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1718
+ }`;function tW(){O.useEffect(()=>{if(typeof document>"u"||document.getElementById(qx))return;const e=document.createElement("style");e.id=qx,e.appendChild(document.createTextNode(eW)),document.head.appendChild(e)},[])}const ig=5,nW=6*1024*1024;function rW(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=String(r.result||""),o=a.indexOf(",");t(o>=0?a.slice(o+1):a)},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function Jx(){const{organizationDetails:e}=Wr(),{isLoggedIn:t,currentUser:n}=mr();tW();const r=!!(t&&(n!=null&&n.email)),a=(n==null?void 0:n.email)??"",o=`${(n==null?void 0:n.firstName)??""} ${(n==null?void 0:n.lastName)??""}`.trim()||a,[i,s]=O.useState(!1),[c,u]=O.useState(""),[d,f]=O.useState(""),[h,v]=O.useState(""),[g,p]=O.useState(""),[m,b]=O.useState("idle"),[C,S]=O.useState(""),[E,A]=O.useState([]),w=O.useRef(null),x=O.useRef(null),P=O.useRef(null);O.useEffect(()=>{if(!i)return;const T=D=>{D.key==="Escape"&&s(!1)};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[i]),O.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);function M(){u(""),f(""),v(""),p(""),b("idle"),S(""),A([])}function N(T){const D=Array.from(T.target.files||[]),z=D.filter(F=>(F.type==="application/pdf"||F.type.startsWith("image/"))&&F.size<=nW);z.length<D.length&&S("PDF et images seulement (max ~6 Mo par fichier)."),A(F=>[...F,...z].slice(0,ig)),T.target.value=""}function I(){s(!1),P.current&&(clearTimeout(P.current),P.current=null),setTimeout(M,250)}function L(){i?I():(M(),s(!0))}async function j(T){var D;if(T.preventDefault(),m!=="sending"){b("sending"),S("");try{const z=await Promise.all(E.map(async F=>({filename:F.name,contentType:F.type||"application/octet-stream",dataBase64:await rW(F)})));await kt.post("/support/submit",{name:r?o:c,email:r?a:d,message:h,website:g,attachments:z.length>0?z:void 0}),b("success"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{I()},2500)}catch(z){const F=(D=z==null?void 0:z.response)==null?void 0:D.status;F===429?(b("error"),S("Trop de messages, réessaie plus tard.")):F===409?I():(b("error"),S("Échec de l'envoi, réessaie."))}}}if(!(e!=null&&e.supportEnabled))return null;const R=m==="sending";return y.jsxs("div",{style:{position:"fixed",bottom:20,right:20,zIndex:_Y,pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"},children:[i&&y.jsxs("div",{ref:w,role:"dialog","aria-label":"Formulaire de contact du support",style:{pointerEvents:"auto",width:"min(360px, calc(100vw - 32px))",maxHeight:"calc(100vh - 110px)",overflowY:"auto",backgroundColor:"#ffffff",color:"#1f2937",borderRadius:18,border:"1px solid rgba(15, 118, 110, 0.08)",boxShadow:"0 20px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08)",padding:22,boxSizing:"border-box",animation:"lystech-support-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1)"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:18},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11},children:[y.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:11,backgroundColor:"rgba(15, 118, 110, 0.1)",color:Nl,flexShrink:0},children:y.jsx(eg,{size:22,weight:"fill"})}),y.jsxs("div",{children:[y.jsx("strong",{style:{display:"block",fontSize:16,lineHeight:1.25,color:"#111827"},children:"Contacter le support"}),y.jsx("span",{style:{display:"block",fontSize:12.5,lineHeight:1.4,color:"#6b7280",marginTop:2},children:"On te répond rapidement."})]})]}),y.jsx("button",{type:"button",onClick:I,"aria-label":"Fermer",className:"lystech-support-close",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"inline-flex",color:"#9ca3af",borderRadius:8,lineHeight:0,flexShrink:0,transition:"background-color 0.15s ease, color 0.15s ease"},children:y.jsx(Pl,{size:20})})]}),m==="success"?y.jsx("div",{style:{padding:"24px 8px",textAlign:"center",fontSize:15,color:"#047857",fontWeight:600},children:"✓ Message envoyé, merci !"}):y.jsxs("form",{onSubmit:j,noValidate:!0,children:[y.jsx("input",{type:"text",name:"website",value:g,onChange:T=>p(T.target.value),tabIndex:-1,"aria-hidden":"true",autoComplete:"off",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0}}),r?y.jsxs("div",{style:{fontSize:12.5,color:"#6b7280",marginBottom:14,lineHeight:1.4},children:["Connecté·e en tant que"," ",y.jsx("span",{style:{color:"#374151",fontWeight:600},children:a})]}):y.jsxs(y.Fragment,{children:[y.jsxs("label",{style:sg,children:["Nom",y.jsx("input",{type:"text",value:c,onChange:T=>u(T.target.value),required:!0,disabled:R,placeholder:"Ton nom",className:"lystech-support-field",style:lg})]}),y.jsxs("label",{style:sg,children:["Courriel",y.jsx("input",{type:"email",value:d,onChange:T=>f(T.target.value),required:!0,disabled:R,placeholder:"toi@exemple.com",className:"lystech-support-field",style:lg})]})]}),y.jsxs("label",{style:sg,children:["Message",y.jsx("textarea",{value:h,onChange:T=>v(T.target.value),required:!0,disabled:R,rows:4,placeholder:"Comment peut-on t'aider ?",className:"lystech-support-field",style:{...lg,resize:"vertical",minHeight:96}})]}),y.jsxs("div",{style:{marginBottom:14},children:[y.jsx("input",{ref:x,type:"file",multiple:!0,accept:".pdf,image/*",onChange:N,style:{display:"none"}}),y.jsx("button",{type:"button",onClick:()=>{var T;return(T=x.current)==null?void 0:T.click()},disabled:R||E.length>=ig,style:{...aW,opacity:R||E.length>=ig?.6:1},children:"📎 Joindre un fichier (PDF / image)"}),E.length>0&&y.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:6},children:E.map((T,D)=>y.jsxs("div",{style:oW,children:[y.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:T.name}),y.jsx("button",{type:"button",onClick:()=>A(z=>z.filter((F,V)=>V!==D)),"aria-label":"Retirer le fichier",style:iW,children:y.jsx(Pl,{size:14})})]},D))})]}),m==="error"&&C&&y.jsx("div",{role:"alert",style:{color:"#b91c1c",fontSize:13,marginBottom:12},children:C}),y.jsx("button",{type:"submit",disabled:R,className:"lystech-support-send-btn",style:{width:"100%",padding:"12px 16px",marginTop:2,backgroundColor:Nl,color:"#ffffff",border:"none",borderRadius:11,fontSize:15,fontWeight:600,letterSpacing:.2,cursor:R?"default":"pointer",opacity:R?.7:1,boxShadow:"0 4px 12px rgba(15, 118, 110, 0.24)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},children:R?"Envoi…":"Envoyer"})]})]}),y.jsx("button",{type:"button",onClick:L,"aria-label":"Contacter le support","aria-expanded":i,className:"lystech-support-fab",style:{pointerEvents:"auto",width:Qx,height:Qx,borderRadius:"50%",backgroundColor:Nl,color:"#ffffff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 16px rgba(0, 0, 0, 0.24)",transition:"background-color 0.15s ease, transform 0.15s ease"},children:y.jsx(eg,{size:28,weight:"fill"})})]})}const sg={display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:14},lg={display:"block",width:"100%",marginTop:6,padding:"11px 13px",fontSize:14,color:"#1f2937",backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:10,boxSizing:"border-box",fontFamily:"inherit"},aW={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",fontSize:13,fontWeight:600,color:Nl,backgroundColor:"rgba(15, 118, 110, 0.08)",border:"1px dashed rgba(15, 118, 110, 0.4)",borderRadius:10,cursor:"pointer",fontFamily:"inherit"},oW={display:"flex",alignItems:"center",gap:8,padding:"6px 10px",fontSize:12.5,color:"#374151",backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8},iW={display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer",padding:2,lineHeight:0,flexShrink:0},sW="@lystech/core",lW="lystechcorenpmpackage:last-version",_x="3.0.82";function $x(e={}){const{packageName:t=sW,storageKey:n=lW,triggerOnFirstInstall:r=!1,onPackageUpdated:a}=e,[o,i]=O.useState(null),[s]=O.useState(_x),[c,u]=O.useState(!1),[d,f]=O.useState(!1),h=O.useCallback(()=>{if(typeof window>"u")return;const v=localStorage.getItem(n),g=!v,p=!!v&&v!==s;if(i(v),u(g),f(p),g||p){const m={packageName:t,previousVersion:v,currentVersion:s,isFirstInstall:g,hasUpdated:p};(p||g&&r)&&(a==null||a(m)),window.dispatchEvent(new CustomEvent("lystechcorenpmpackage:update",{detail:m}))}localStorage.setItem(n,s)},[n,s,t,r,a]);return O.useEffect(()=>{h()},[h]),O.useMemo(()=>({packageName:t,previousVersion:o,currentVersion:s,isFirstInstall:c,hasUpdated:d,checkForUpdate:h}),[t,o,s,c,d,h])}const cW=new L3({defaultOptions:{queries:{staleTime:1e3*60*5,retry:3,refetchOnWindowFocus:!1}}}),eA=O.createContext({}),qo=()=>O.useContext(eA);function uW({children:e,organization:t,shouldRedirectAfterLogin:n,loginRedirectRoute:r,queryClient:a,usePushNotifications:o,useProgressiveWebAppFeatures:i,useThemeProvider:s,quickGoogleLoginButtonStyle:c,enableGoogleQuickLoginButton:u,showGoogleQuickLoginButton:d,useGoogleAutoSelect:f,debugMode:h,showAskPermissionsButtons:v,hideSupportButton:g,onPackageUpdated:p,triggerOnFirstInstallPackageCallback:m,packageVersionStorageKey:b}){const C=a||cW;$x({onPackageUpdated:p,triggerOnFirstInstall:!!m,storageKey:b});const S=y.jsxs(eA.Provider,{value:{debugMode:h,usePushNotifications:o,useProgressiveWebAppFeatures:i},children:[h&&y.jsxs("div",{className:"p-10",children:[y.jsx("h2",{children:"DEBUG MODE"}),y.jsxs("p",{children:["Organization: ",t]})]}),y.jsx(bY,{children:y.jsx(fY,{children:y.jsx(W3,{client:C,children:y.jsx(pY,{usePushNotifications:o,children:y.jsx(mY,{children:y.jsx(dW,{organization:t,children:y.jsx(gW,{shouldRedirectAfterLogin:n,loginRedirectRoute:r,quickGoogleLoginButtonStyle:c,enableGoogleQuickLoginButton:u,showGoogleQuickLoginButton:d,useGoogleAutoSelect:f,children:y.jsxs(bx,{children:[e,v&&y.jsx(Zx,{enableInstallAppButton:v==null?void 0:v.installApp,enablePushNotificationButton:v==null?void 0:v.pushNotifications}),!g&&y.jsx(Jx,{})]})})})})})})})})]});return s?y.jsx(CY,{children:S}):S}const tA=O.createContext({});function Wr(){return O.useContext(tA)}function dW({children:e,organization:t}){const n=Gf(),{debugMode:r}=qo(),[a,o]=O.useState(t||"");O.useEffect(()=>{if(t){r&&console.log("OrganizationProvider: organization prop utilisée",t),o(t);return}const E=new URLSearchParams(n.search),A=E.get("org");if(A){r&&console.log("OrganizationProvider: paramètre ?org= trouvé dans l'URL",A),E.delete("org");const w=`${n.pathname}${E.toString()?"?"+E.toString():""}`;window.history.replaceState({},"",w),o(A)}else{const w=localStorage.getItem("Organization");w?(r&&console.log("OrganizationProvider: organisation trouvée dans le localStorage",w),o(w)):r&&console.log("OrganizationProvider: aucune organisation trouvée")}},[t,n.search,n.pathname,r]);function i(E){r&&console.log("User logged in:",E),!a&&!t&&E!=null&&E.defaultOrganization&&o(E.defaultOrganization)}const{data:s,isLoading:c,refetch:u}=F1(a),d=kf();function f(){u(),d.invalidateQueries()}O.useEffect(()=>{f()},[a]),O.useEffect(()=>{localStorage.removeItem("invalid-organizations")},[]);const[h,v]=O.useState(""),[g,p]=O.useState({clientId:"",appSecret:"",clientIdSandbox:"",appSecretSandbox:"",enabled:!1});O.useEffect(()=>{localStorage.setItem("Organization",a),r&&(a?console.log("OrganizationProvider: organisation mise à jour dans le localStorage",a):console.warn("OrganizationProvider: organisationState est vide, pas de mise à jour dans le localStorage"))},[a]),O.useEffect(()=>{v((s==null?void 0:s.image)??""),s&&p({clientId:(s==null?void 0:s.paypalClientId)??"",appSecret:(s==null?void 0:s.paypalAppSecret)??"",clientIdSandbox:(s==null?void 0:s.paypalClientIdSandbox)??"",appSecretSandbox:(s==null?void 0:s.paypalAppSecretSandbox)??"",enabled:!!s.paypalEnabled||!1})},[s]);async function m(E){const A=await p3(E);return A!=null&&A.success&&u(),A==null?void 0:A.success}async function b(E){const A=await b3(E);return A!=null&&A.success&&(u(),p(w=>({...w,enabled:E}))),A==null?void 0:A.success}async function C(){await C3(),u()}async function S(E,A,w){const x=await y3(E,A,w);return f(),x}return y.jsx(tA.Provider,{value:{organization:a,organizationImage:h,organizationDetails:s??void 0,areOrganizationDetailsLoading:c,paypalInfo:g,onLoggedIn:i,updateOrganizationDetails:m,updatePaypalConfiguration:S,toggleOrganizationMode:C,updateOrganizationPaypalEnabled:b,refetchOrganizationDetails:f},children:e})}async function fW(){return await kt.get("/users/roles")}const nA=(e,t)=>Er(["user-role-details",e,t],fW,{enabled:!!e,select:n=>n==null?void 0:n.data,onError:n=>{console.error("Error fetching user role details:",n)}}),hW={apiKey:"AIzaSyCpAeHlt1wZvM5KtYg7X7MDVnWVJT86gvc",authDomain:"lystech.firebaseapp.com",databaseURL:"https://lystech.firebaseio.com",projectId:"lystech",storageBucket:"lystech.appspot.com",messagingSenderId:"237347321732",appId:"1:237347321732:web:7f9586d48e488d73ddcfd1"};async function rA(e){const t=new FormData;t.append("image",e);const n=await kt.put("users/image",t,{headers:{"Content-Type":"multipart/form-data"},data:t});return n==null?void 0:n.data}async function aA(e,t){const n=await kt.put("users/image/url",{authKey:e,imageUrl:t});return n==null?void 0:n.data}async function mW(e){const t=await kt.post("auth/request-reset-password",{email:e});return t==null?void 0:t.data}async function vW(e){const t=await kt.post(`auth/activate/${e}`);return t==null?void 0:t.data}async function oA(e){return await kt.post("auth/register",{...e})}const iA=O.createContext({});function mr(){return O.useContext(iA)}function gW({children:e,shouldRedirectAfterLogin:t,loginRedirectRoute:n,quickGoogleLoginButtonStyle:r,enableGoogleQuickLoginButton:a,showGoogleQuickLoginButton:o,useGoogleAutoSelect:i=!0}){var X,ae,ie,ee,ce,le,Se;const[s,c]=O.useState(n||null),{debugMode:u}=qo();A0(hW);const{organization:d,onLoggedIn:f}=Wr(),h=O.useCallback(()=>{const ue=sessionStorage.getItem("username");if(ue)return{id:parseInt(sessionStorage.getItem("id")||"-1"),displayName:ue,firstName:sessionStorage.getItem("firstName")||"",lastName:sessionStorage.getItem("lastName")||"",birthday:sessionStorage.getItem("birthday")?new Date(sessionStorage.getItem("birthday")):null,email:sessionStorage.getItem("email")||"",UID:sessionStorage.getItem("authKey")||"",profileImage:sessionStorage.getItem("profileImage")||"",notifyCoffee:sessionStorage.getItem("notifyCoffee")?parseInt(sessionStorage.getItem("notifyCoffee")):0,defaultOrganization:sessionStorage.getItem("defaultOrganization")||"",thirdPartyAuthUID:sessionStorage.getItem("thirdPartyAuthUID")||"",roleDetails:{role:"",isOwner:!1,isSuperAdmin:!1,isAdmin:!1,isUser:!1,isSuperAdminOrMore:!1,isAdminOrMore:!1,isUserOrMore:!1,isAdminInAnyOrganization:!1},type:"emailPassword",activatedOn:"",approvedBy:""}},[]),v=O.useCallback(()=>{const te=h();return te||{}},[h]);function g(te){p&&(p.notifyCoffee=te,m({...p}),sessionStorage.setItem("notifyCoffee",te.toString()))}const[p,m]=O.useState(v()),b=O.useCallback(async te=>{const{success:ue,url:ve}=await rA(te);return ue&&(p.photoURL=ve,p.profileImage=ve,m({...p}),sessionStorage.setItem("profileImage",ve||"")),ue},[p,m]),C=O.useCallback(async te=>{const{success:ue,url:ve}=await aA(p==null?void 0:p.UID,te);return ue&&(p.photoURL=ve,p.profileImage=ve,m({...p}),sessionStorage.setItem("profileImage",ve||"")),ue},[p,m]),S=O.useCallback(te=>{p.firstName=te,m({...p}),sessionStorage.setItem("firstName",te)},[p,m]),E=O.useCallback(te=>{p.lastName=te,m({...p}),sessionStorage.setItem("lastName",te)},[p,m]),A=X1(),w=LM(),x=O.useMemo(()=>{if(p&&p.id!==-1&&p!=null&&p.UID)return{id:p.id,UID:p.UID,thirdPartyAuthUID:p.thirdPartyAuthUID,displayName:p.displayName,firstName:p.firstName,lastName:p.lastName,birthday:p.birthday,profileImage:p.profileImage,defaultOrganization:p.defaultOrganization,email:p.email,roleDetails:p.roleDetails,type:"emailPassword",activatedOn:p.activatedOn,notifyCoffee:p.notifyCoffee,approvedBy:p.approvedBy}},[p]),{data:P,isLoading:M}=nA((x==null?void 0:x.UID)??"",d),N=O.useMemo(()=>({...x,roleDetails:P}),[x,P]),I=O.useMemo(()=>!!(x!=null&&x.UID)&&(x==null?void 0:x.id)!==-1,[x]);O.useEffect(()=>{localStorage.setItem("authKey",(x==null?void 0:x.UID)??"")},[x]);const[L,j]=O.useState(!0),R=O.useRef(!1);O.useEffect(()=>{R.current||(R.current=!0,z().finally(()=>j(!1)))},[]);const T=O.useRef(!1),D=O.useRef(()=>{});O.useEffect(()=>{const te=kt.interceptors.response.use(ue=>ue,ue=>{var ve;return((ve=ue==null?void 0:ue.response)==null?void 0:ve.status)===401&&T.current&&(console.warn("[Auth] 401 reçu alors que connecté — session invalide, déconnexion locale."),D.current()),Promise.reject(ue)});return()=>{kt.interceptors.response.eject(te)}},[]),O.useEffect(()=>{T.current=I},[I]),O.useEffect(()=>{D.current=()=>ne(null)});async function z(){try{const te=await kt.get("/auth/me");return console.log("Validate Me Response",te),te.data&&ne(te==null?void 0:te.data),te==null?void 0:te.data}catch(te){return console.log("Validate Me Error",te),null}finally{j(!1)}}O.useEffect(()=>{P&&localStorage.setItem("userRoleDetails",JSON.stringify(P))},[P]);const F=O.useMemo(()=>{if(!I)return"/login";let te="";return P&&(te="/past-orders"),te===""&&(te="/"),("/"+te+"/").replace(/\/+/g,"/")},[P,I]);async function V(te,ue,ve,de=()=>{},Ae=()=>{},we=0){try{const be={email:te,password:ue},xe=await kt.get("/auth/login",{headers:be}),Re=!!xe.data;ve({result:Re,data:xe==null?void 0:xe.data}),we>0?setTimeout(()=>{ne(xe==null?void 0:xe.data),t&&s&&A(s),f&&f(xe==null?void 0:xe.data)},we):(ne(xe==null?void 0:xe.data),f&&f(xe==null?void 0:xe.data),t&&s&&A(s))}catch(be){console.log("Login Error",be),(be==null?void 0:be.status)===403?de(be):Ae(be)}}async function W(te,ue,ve){const de=await kt.post("/auth/login/third-party",{providerData:te,token:ue,tokenType:ve}),Ae=de==null?void 0:de.data;if(!Ae){console.error("No user data returned from third-party login");return}return ne(Ae),f&&f(Ae),de}async function k(){var te,ue,ve,de;try{const Ae=new Ia;Ae.setCustomParameters({prompt:"select_account"});const we=await Cp(w,Ae);if(((ue=(te=we==null?void 0:we.user)==null?void 0:te.providerData)==null?void 0:ue.length)===0||!((ve=we==null?void 0:we.user)!=null&&ve.providerData))return;const be=(de=we==null?void 0:we.user)==null?void 0:de.providerData[0],xe=await we.user.getIdToken();return await W(be,xe,"firebase")}catch(Ae){console.error("Google login failed",Ae)}}async function H(){var te;try{const ue=new Na,ve=await Cp(w,ue),de=(te=ve==null?void 0:ve.user)==null?void 0:te.providerData[0],Ae=await ve.user.getIdToken();return await W(de,Ae,"firebase")}catch(ue){console.error("Facebook login failed",ue)}}async function B(){try{await kt.post("/auth/logout")}catch(te){console.warn("Déconnexion serveur échouée",te)}sessionStorage.clear(),localStorage.clear(),ne(null),x6(w),A("/")}async function U(te){const ue=KM(te.credential);if(ue!=null&&ue.email){let ve="unknown.com";ue!=null&&ue.iss.includes("google")?ve="google.com":ue!=null&&ue.iss.includes("facebook")&&(ve="facebook.com");const de={displayName:ue==null?void 0:ue.given_name,email:ue==null?void 0:ue.email,phoneNumber:null,photoURL:ue==null?void 0:ue.picture,providerId:ve,uid:ue==null?void 0:ue.sub};return await W(de,te.credential,"google")}}const Y=()=>{console.error("Google login failed")};function _(te){t&&s&&A(s)}function $(te){var ue;if(!te){sessionStorage.clear();return}sessionStorage.setItem("username",te.displayName),sessionStorage.setItem("email",te.email),sessionStorage.setItem("firstName",te.firstName??""),sessionStorage.setItem("lastName",te.lastName??""),sessionStorage.setItem("birthday",((ue=te.birthday)==null?void 0:ue.toString())??""),sessionStorage.setItem("defaultOrganization",te.defaultOrganization),sessionStorage.setItem("id",te.id.toString()),sessionStorage.setItem("authKey",te.UID),sessionStorage.setItem("thirdPartyAuthUID",te.thirdPartyAuthUID),sessionStorage.setItem("profileImage",te.profileImage),sessionStorage.setItem("notifyCoffee",te.notifyCoffee.toString())}function ne(te){m(te),$(te),(te==null?void 0:te.id)==-1&&(te==null?void 0:te.id)!=-1&&_()}const oe=O.useMemo(()=>{var te,ue,ve;return I?!1:a!==void 0?a:!((te=window==null?void 0:window.location)!=null&&te.pathname.includes("/activate"))&&!((ue=window==null?void 0:window.location)!=null&&ue.pathname.includes("/account/reset-password"))&&!((ve=window==null?void 0:window.location)!=null&&ve.pathname.includes("/account/activation"))},[I,a,(X=window==null?void 0:window.location)==null?void 0:X.pathname]),se=O.useMemo(()=>{var te;return o!==void 0?o:oe&&!((te=window==null?void 0:window.location)!=null&&te.pathname.includes("/login"))},[oe,o,(ae=window==null?void 0:window.location)==null?void 0:ae.pathname]);return O.useEffect(()=>{u&&(console.log("AuthProvider - user.UID:",x==null?void 0:x.UID),console.log("AuthProvider - isLoggedIn:",I))},[x==null?void 0:x.UID,I]),y.jsx(HM,{clientId:"237347321732-65nra8lcs59qn6dms77ruad01vjdr7ph.apps.googleusercontent.com",children:y.jsxs(iA.Provider,{value:{user:x?{...x,roleDetails:P||{role:"",isOwner:!1,isSuperAdmin:!1,isAdmin:!1,isUser:!1,isSuperAdminOrMore:!1,isAdminOrMore:!1,isUserOrMore:!1,isAdminInAnyOrganization:!1}}:void 0,currentUser:N,auth:w,isLoggedIn:I,isCheckingSession:L,isSuperAdmin:!!((ie=N==null?void 0:N.roleDetails)!=null&&ie.isSuperAdminOrMore),isAdmin:!!((ee=N==null?void 0:N.roleDetails)!=null&&ee.isAdminOrMore),isUser:!!((ce=N==null?void 0:N.roleDetails)!=null&&ce.isUserOrMore),isSuperAdminInAnyOrganization:!!((le=N==null?void 0:N.roleDetails)!=null&&le.isSuperAdminOrMore),isAdminInAnyOrganization:!!((Se=N==null?void 0:N.roleDetails)!=null&&Se.isAdminInAnyOrganization),areRoleDetailsLoading:M,homeRoute:F,setLoginRedirectRouteState:c,registerNewUser:oA,signInWithEmailAndPassword:V,signInWithGoogle:k,signInWithFacebook:H,logout:B,requestResetPassword:mW,activateUser:vW,updateUserImage:b,updateUserImageUrl:C,updateUserFirstName:S,updateUserLastName:E,updateNotificationState:g},children:[u&&y.jsx("div",{className:"p-10",children:y.jsxs("p",{children:["Login Redirect Route State: ",y.jsx("b",{children:s||"null"})]})}),e,oe&&y.jsx("div",{className:`fixed top-10 right-10 ${se?"":"hidden"}`,style:r,children:y.jsx(WM,{onSuccess:U,onError:Y,auto_select:i,useOneTap:!0,type:"icon"})})]})})}async function pW(){return(await kt.get("/politique-and-conditions/9716a5de-02be-4fb2-b9b5-85ad82bfae4f")).data}async function bW(){return(await kt.get("/politique-and-conditions")).data}const sA=()=>Er({queryKey:["lystech-politique-and-conditions"],queryFn:pW}),lA=e=>Er({queryKey:["politique-and-conditions",e],queryFn:bW,enabled:!!e});async function yW(){const e=await kt.get("collections/invitation");return(e==null?void 0:e.data)||[]}const fd=(e,t)=>Er(["invitedToOrders",e,t],yW,{staleTime:1e3*60*2,select:n=>t?n.filter(r=>r.organization.subdomain===t):n,enabled:!!e});async function CW(e,t){const n={code:e,products:t},r=await kt.post("promo-codes/validate",n);return r==null?void 0:r.data}async function cA(){const e=await kt.get("promo-codes/user");return e==null?void 0:e.data}const SW=e=>Er(["personal-promo-codes",e],cA,{enabled:!!e,refetchInterval:45*1e3,refetchOnWindowFocus:!0});async function uA(){const e=await kt.get("images/featured");return e==null?void 0:e.data}const wW=()=>Er(["featured-images"],uA,{onError:e=>{console.error("Error fetching featured images:",e)}});async function dA(e){const t=await kt.get(`/posts/slug/${e}`);if(t.status!==200)throw new Error(`Error fetching post with ID ${e}: ${t.statusText}`);return t.data}const EW=(e,t)=>Er(["single-post",e,t],()=>dA(e));async function xW(e){const t=await kt.get(`/shop/collection/${e}`);return t==null?void 0:t.data}async function AW(e,t){const n=await kt.post("/shop/breakdown",{products:e,promoCodes:t});return n==null?void 0:n.data}async function OW(e){const t=await kt.post("/shop/save",e);return t==null?void 0:t.data}const fA=(e,t,n)=>Er(["order-details-breakdown",e,t.map(r=>r.UID),t.map(r=>r.quantity),n.map(r=>r.toLowerCase())],async()=>await AW(t,n),{enabled:!!e&&t.length>0}),MW=()=>kf();async function PW(){try{const e=await kt.get("/shop/collections");return localStorage.setItem("collections",JSON.stringify(e==null?void 0:e.data)),(e==null?void 0:e.data)||[]}catch(e){return console.log(e),[]}}async function hA(e){var n;const t=await kt.post("stripe/checkout",e);if(t.status===200&&((n=t.data)!=null&&n.url))return t.data;throw new Error("Failed to create Stripe checkout session")}const mA=({onSuccess:e,onAccountNotActivated:t,onAccountNotFound:n,onError:r,className:a="",showTitle:o=!0,title:i="Se connecter",loginButtonText:s="Se connecter",pendingConnexionButtonText:c="Connexion...",passwordFieldLabel:u="Mot de passe",emailFieldLabel:d="Email",emailFieldPlaceholder:f="Votre email",passwordFieldPlaceholder:h="••••••••••••",loginSuccessMessage:v="Connexion réussie",unknownErrorMessage:g="Une erreur inconnue est survenue.",showForgotPassword:p=!1,forgotPasswordText:m="Mot de passe oublié ?",onForgotPassword:b})=>{const C=mr(),S=na(),[E,A]=O.useState({email:"",password:""}),[w,x]=O.useState(!1),[P,M]=O.useState(!1),N=(L,j)=>{A(R=>({...R,[L]:j}))},I=async L=>{var j,R,T;L.preventDefault(),x(!0);try{await C.signInWithEmailAndPassword(E.email,E.password,D=>{e?e(D):S.showMessage({type:"success",message:v})},D=>{t?t(D):S.showMessage({type:"warning",message:D==null?void 0:D.message})},D=>{n?n(D):S.showMessage({type:"error",message:D==null?void 0:D.message})})}catch(D){const z=D instanceof Error?D:new Error("Erreur inconnue");if(r)r(z);else{const F=(T=(R=(j=D.error)==null?void 0:j.response)==null?void 0:R.data)==null?void 0:T.message;S.showMessage({type:"error",message:F||g})}}finally{x(!1)}};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`auth-form ${a}`,children:[o&&y.jsx("h2",{children:i}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:d}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:E.email,onChange:L=>N("email",L.target.value),required:!0,placeholder:f})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"password",children:u}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:P?"text":"password",id:"password",value:E.password,onChange:L=>N("password",L.target.value),required:!0,placeholder:h}),y.jsx("button",{type:"button",className:"auth-field__icon auth-field__eye",onClick:()=>M(L=>!L),"aria-label":P?"Masquer le mot de passe":"Afficher le mot de passe",children:P?y.jsx(Dx,{size:18}):y.jsx(Rx,{size:18})})]})]})}),p&&b&&y.jsx("div",{className:"auth-form__forgot",children:y.jsx("button",{type:"button",className:"link-button",onClick:b,children:m})}),y.jsx("button",{type:"button",disabled:w||!E.email.trim()||!E.password.trim(),className:"btn btn-primary",onClick:I,children:w?c:s})]}),y.jsx("div",{className:"auth-divider",children:"ou continuer avec"}),y.jsxs("div",{className:"third-party-row",children:[y.jsxs("button",{type:"button",className:"third-party-login-button login-with-google",onClick:()=>C.signInWithGoogle(),children:[y.jsx(Lx,{size:20,weight:"bold"})," Google"]}),y.jsxs("button",{type:"button",className:"third-party-login-button login-with-facebook",onClick:()=>C.signInWithFacebook(),children:[y.jsx(Tx,{size:20,weight:"fill"})," Facebook"]})]})]})},vA=({onSuccess:e,onEmailAlreadyExists:t,onError:n,className:r="",showTitle:a=!0,title:o="Créer un compte",showBirthdayField:i=!0,firstNameFieldLabel:s="Prénom",firstNameFieldPlaceholder:c="Votre prénom",lastNameFieldLabel:u="Nom",lastNameFieldPlaceholder:d="Votre nom",emailFieldLabel:f="Email",emailFieldPlaceholder:h="Votre email",birthdayFieldLabel:v="Date de naissance",birthdayFieldPlaceholder:g="Votre date de naissance",passwordFieldLabel:p="Mot de passe",passwordFieldPlaceholder:m="••••••••••••",confirmPasswordFieldLabel:b="Confirmation du mot de passe",confirmPasswordFieldPlaceholder:C="••••••••••••",createAccountButtonText:S="Créer le compte",creatingAccountButtonText:E="Création en cours...",accountCreatedMessage:A="Compte créé avec succès !",accountAlreadyExistsMessage:w="Un compte avec cet email existe déjà.",errorMessage:x="Une erreur est survenue lors de la création du compte.",passwordNotMatchMessage:P="Les mots de passe ne correspondent pas.",politiqueAndConditionsConsentTexte:M="En créant un compte, j'accepte les termes et conditions.",seePolitiqueAndConditions:N="Voir les termes et conditions",politiqueAndConditionsRoute:I="/conditions"})=>{const L=mr(),j=na(),[R,T]=O.useState({firstName:"",lastName:"",email:"",birthday:"",password:"",confirmPassword:""}),[D,z]=O.useState(!1),F=(W,k)=>{T(H=>({...H,[W]:k}))},V=async W=>{var k,H,B;if(W.preventDefault(),z(!0),R.password!==R.confirmPassword){j.showMessage({type:"error",message:P}),z(!1);return}try{L.registerNewUser?(await L.registerNewUser({username:R.email,email:R.email,password:R.password,firstName:R.firstName,lastName:R.lastName,birthday:R.birthday||void 0}),e?e():j.showMessage({type:"success",message:A})):j.showMessage({type:"error",message:"La méthode d'enregistrement n'est pas disponible."})}catch(U){const Y=U instanceof Error?U:new Error("Erreur inconnue");if(n)console.log("Error in AuthRegisterForm:",Y),n(Y);else{const _=(B=(H=(k=U.error)==null?void 0:k.response)==null?void 0:H.data)==null?void 0:B.message;j.showMessage({type:"error",message:_})}}finally{z(!1)}};return y.jsxs("form",{onSubmit:V,className:`auth-form ${r}`,children:[a&&y.jsx("h2",{children:o}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"firstName",children:s}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ag,{size:18})}),y.jsx("input",{type:"text",id:"firstName",value:R.firstName,onChange:W=>F("firstName",W.target.value),placeholder:c,required:!0})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"lastName",children:u}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ag,{size:18})}),y.jsx("input",{type:"text",id:"lastName",value:R.lastName,onChange:W=>F("lastName",W.target.value),required:!0,placeholder:d})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:f}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:R.email,onChange:W=>F("email",W.target.value),required:!0,placeholder:h})]})]})}),i&&y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"birthday",children:v}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(Ax,{size:18})}),y.jsx("input",{type:"date",id:"birthday",value:R.birthday,onChange:W=>F("birthday",W.target.value)})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"password",children:p}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:"password",id:"password",value:R.password,onChange:W=>F("password",W.target.value),required:!0,placeholder:m})]})]})}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"confirmPassword",children:b}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(ud,{size:18})}),y.jsx("input",{type:"password",id:"confirmPassword",value:R.confirmPassword,onChange:W=>F("confirmPassword",W.target.value),required:!0,placeholder:C})]})]})}),y.jsx("div",{className:"form-row",children:y.jsx("div",{className:"form-group",style:{fontSize:"0.95em",color:"#555"},children:y.jsxs("span",{children:[M," ",y.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--auth-accent)",textDecoration:"underline"},children:N})]})})}),y.jsx("button",{type:"submit",disabled:D,className:"btn btn-primary",children:D?E:S})]})},gA=({onSuccess:e,onError:t,className:n="",showTitle:r=!0,title:a="Réinitialiser le mot de passe",showDescription:o=!0,description:i="Entrez votre email pour recevoir un lien de réinitialisation.",emailFieldLabel:s="Email",confirmButtonText:c="Envoyer le lien",confirmingButtonText:u="Envoi en cours...",emailFieldPlaceholder:d="votre@email.com",activationMailSentMessage:f="Un email de réinitialisation a été envoyé à votre adresse.",errorMessage:h="Impossible d'envoyer l'email de réinitialisation."})=>{const v=mr(),g=na(),[p,m]=O.useState(""),[b,C]=O.useState(""),[S,E]=O.useState(!1),A=async x=>{x.preventDefault(),E(!0);try{const P=await v.requestResetPassword(p);C(p),e?e(p):g.showMessage({type:"success",message:f})}catch(P){const M=P instanceof Error?P:new Error("Erreur inconnue");t?t(M):g.showMessage({type:"error",message:`${h}`})}finally{E(!1)}},w=S||p===b||!p.trim();return y.jsxs("form",{onSubmit:A,className:`auth-form ${n}`,children:[r&&y.jsx("h2",{children:a}),o&&y.jsx("p",{className:"form-description",children:i}),y.jsx("div",{className:"form-row",children:y.jsxs("div",{className:"form-group",children:[y.jsx("label",{htmlFor:"email",children:s}),y.jsxs("div",{className:"auth-field",children:[y.jsx("span",{className:"auth-field__icon",children:y.jsx(cd,{size:18})}),y.jsx("input",{type:"email",id:"email",value:p,onChange:x=>m(x.target.value),required:!0,placeholder:d})]})]})}),y.jsx("button",{type:"submit",disabled:w,className:"btn btn-primary",children:S?u:c})]})},pA=({onLogout:e,onClose:t,className:n="",showTitle:r=!0,title:a="Profil utilisateur",showCloseButton:o=!1,closeButtonText:i="Fermer",logoutSuccessMessage:s="Déconnexion réussie",logoutErrorMessage:c="Erreur lors de la déconnexion",disconnectedLabel:u="Non connecté",mustBeLoggedInMessage:d="Vous devez être connecté pour voir votre profil.",logoutButtonText:f="Se déconnecter",emailLabel:h="Email",nameLabel:v="Nom",idLabel:g="ID"})=>{var C,S,E;const p=mr(),m=na(),b=async()=>{try{await p.logout(),e?e():m.showMessage({type:"success",message:s})}catch(A){console.error("Erreur lors de la déconnexion:",A),m.showMessage({type:"error",message:c})}};return p.isLoggedIn?y.jsxs("div",{className:`user-profile ${n}`,children:[y.jsx("div",{className:"profile-icon",children:"👤"}),r&&y.jsx("h2",{children:a}),y.jsxs("div",{className:"user-info",children:[y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[h,":"]}),y.jsx("span",{className:"value",children:((C=p.currentUser)==null?void 0:C.email)||"N/A"})]}),y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[v,":"]}),y.jsx("span",{className:"value",children:((S=p.currentUser)==null?void 0:S.displayName)||"N/A"})]}),y.jsxs("div",{className:"info-item",children:[y.jsxs("span",{className:"label",children:[g,":"]}),y.jsx("span",{className:"value",children:((E=p.currentUser)==null?void 0:E.id)||"N/A"})]})]}),y.jsxs("div",{className:"profile-actions",children:[y.jsx("button",{onClick:b,className:"btn btn-logout",children:f}),o&&t&&y.jsx("button",{onClick:t,className:"btn btn-secondary",children:i})]})]}):y.jsxs("div",{className:`user-profile ${n}`,children:[y.jsx("div",{className:"profile-icon",children:"🔒"}),y.jsx("h2",{children:u}),y.jsx("p",{children:d})]})};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function bA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function NW(e){if(Array.isArray(e))return e}function IW(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,i,s=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}function RW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1719
1719
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DW(e,t){return NW(e)||IW(e,t)||TW(e,t)||RW()}function TW(e,t){if(e){if(typeof e=="string")return bA(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bA(e,t):void 0}}const yA=Object.entries,CA=Object.setPrototypeOf,jW=Object.isFrozen,LW=Object.getPrototypeOf,FW=Object.getOwnPropertyDescriptor;let er=Object.freeze,tr=Object.seal,Ji=Object.create,SA=typeof Reflect<"u"&&Reflect,cg=SA.apply,ug=SA.construct;er||(er=function(t){return t}),tr||(tr=function(t){return t}),cg||(cg=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];return t.apply(n,a)}),ug||(ug=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Il=Yn(Array.prototype.forEach),zW=Yn(Array.prototype.lastIndexOf),wA=Yn(Array.prototype.pop),_i=Yn(Array.prototype.push),kW=Yn(Array.prototype.splice),vo=Array.isArray,Rl=Yn(String.prototype.toLowerCase),dg=Yn(String.prototype.toString),EA=Yn(String.prototype.match),Dl=Yn(String.prototype.replace),xA=Yn(String.prototype.indexOf),HW=Yn(String.prototype.trim),BW=Yn(Number.prototype.toString),VW=Yn(Boolean.prototype.toString),AA=typeof BigInt>"u"?null:Yn(BigInt.prototype.toString),OA=typeof Symbol>"u"?null:Yn(Symbol.prototype.toString),qn=Yn(Object.prototype.hasOwnProperty),Tl=Yn(Object.prototype.toString),nr=Yn(RegExp.prototype.test),Jo=YW(TypeError);function Yn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return cg(e,t,r)}}function YW(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ug(e,n)}}function tn(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rl;if(CA&&CA(e,null),!vo(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const o=n(a);o!==a&&(jW(t)||(t[r]=o),a=o)}e[a]=!0}return e}function WW(e){for(let t=0;t<e.length;t++)qn(e,t)||(e[t]=null);return e}function vr(e){const t=Ji(null);for(const r of yA(e)){var n=DW(r,2);const a=n[0],o=n[1];qn(e,a)&&(vo(o)?t[a]=WW(o):o&&typeof o=="object"&&o.constructor===Object?t[a]=vr(o):t[a]=o)}return t}function UW(e){switch(typeof e){case"string":return e;case"number":return BW(e);case"boolean":return VW(e);case"bigint":return AA?AA(e):"0";case"symbol":return OA?OA(e):"Symbol()";case"undefined":return Tl(e);case"function":case"object":{if(e===null)return Tl(e);const t=e,n=ya(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Tl(r)}return Tl(e)}default:return Tl(e)}}function ya(e,t){for(;e!==null;){const r=FW(e,t);if(r){if(r.get)return Yn(r.get);if(typeof r.value=="function")return Yn(r.value)}e=LW(e)}function n(){return null}return n}function GW(e){try{return nr(e,""),!0}catch{return!1}}const MA=er(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),fg=er(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hg=er(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),KW=er(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mg=er(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ZW=er(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),PA=er(["#text"]),NA=er(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),vg=er(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),IA=er(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hd=er(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),QW=tr(/{{[\w\W]*|^[\w\W]*}}/g),XW=tr(/<%[\w\W]*|^[\w\W]*%>/g),qW=tr(/\${[\w\W]*/g),JW=tr(/^data-[\-\w.\u00B7-\uFFFF]+$/),_W=tr(/^aria-[\-\w]+$/),RA=tr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$W=tr(/^(?:\w+script|data):/i),eU=tr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tU=tr(/^html$/i),nU=tr(/^[a-z][.\w]*(-[.\w]+)+$/i),DA=tr(/<[/\w!]/g),rU=tr(/<[/\w]/g),aU=tr(/<\/no(script|embed|frames)/i),oU=tr(/\/>/i),Ca={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},iU=function(){return typeof window>"u"?null:window},sU=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},TA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},go=function(t,n,r,a){return qn(t,n)&&vo(t[n])?tn(a.base?vr(a.base):{},t[n],a.transform):r};function jA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iU();const t=ke=>jA(ke);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==Ca.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,i=e.Node,s=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,f=e.trustedTypes,h=s.prototype,v=ya(h,"cloneNode"),g=ya(h,"remove"),p=ya(h,"nextSibling"),m=ya(h,"childNodes"),b=ya(h,"parentNode"),C=ya(h,"shadowRoot"),S=ya(h,"attributes"),E=i&&i.prototype?ya(i.prototype,"nodeType"):null,A=i&&i.prototype?ya(i.prototype,"nodeName"):null;if(typeof o=="function"){const ke=n.createElement("template");ke.content&&ke.content.ownerDocument&&(n=ke.content.ownerDocument)}let w,x="",P,M=!1,N=0;const I=function(){if(N>0)throw Jo('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},L=function(Q){I(),N++;try{return w.createHTML(Q)}finally{N--}},j=function(Q){I(),N++;try{return w.createScriptURL(Q)}finally{N--}},R=function(){return M||(P=sU(f,a),M=!0),P},T=n,D=T.implementation,z=T.createNodeIterator,F=T.createDocumentFragment,V=T.getElementsByTagName,W=r.importNode;let k=TA();t.isSupported=typeof yA=="function"&&typeof b=="function"&&D&&D.createHTMLDocument!==void 0;const H=QW,B=XW,U=qW,Y=JW,_=_W,$=$W,ne=eU,oe=nU;let se=RA,X=null;const ae=tn({},[...MA,...fg,...hg,...mg,...PA]);let ie=null;const ee=tn({},[...NA,...vg,...IA,...hd]);let ce=Object.seal(Ji(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,Se=null;const te=Object.seal(Ji(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,ve=!0,de=!1,Ae=!0,we=!1,be=!0,xe=!1,Re=!1,$e=null,Be=null,Fe=!1,et=!1,J=!1,re=!1,he=!0,me=!1;const ge="user-content-";let Pe=!0,Ee=!1,Me={},at=null;const mt=tn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let St=null;const Vt=tn({},["audio","video","img","source","image","track"]);let Tt=null;const jt=tn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),bt="http://www.w3.org/1998/Math/MathML",ut="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let pe=Ke,Oe=!1,De=null;const We=tn({},[bt,ut,Ke],dg),He=er(["mi","mo","mn","ms","mtext"]);let ze=tn({},He);const nt=er(["annotation-xml"]);let Xe=tn({},nt);const ot=tn({},["title","style","font","a","script"]);let Z=null;const Ie=["application/xhtml+xml","text/html"],Le="text/html";let Ve=null,it=null;const vt=n.createElement("form"),ht=function(Q){return Q instanceof RegExp||Q instanceof Function},dt=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(it&&it===Q)return;(!Q||typeof Q!="object")&&(Q={}),Q=vr(Q),Z=Ie.indexOf(Q.PARSER_MEDIA_TYPE)===-1?Le:Q.PARSER_MEDIA_TYPE,Ve=Z==="application/xhtml+xml"?dg:Rl,X=go(Q,"ALLOWED_TAGS",ae,{transform:Ve}),ie=go(Q,"ALLOWED_ATTR",ee,{transform:Ve}),De=go(Q,"ALLOWED_NAMESPACES",We,{transform:dg}),Tt=go(Q,"ADD_URI_SAFE_ATTR",jt,{transform:Ve,base:jt}),St=go(Q,"ADD_DATA_URI_TAGS",Vt,{transform:Ve,base:Vt}),at=go(Q,"FORBID_CONTENTS",mt,{transform:Ve}),le=go(Q,"FORBID_TAGS",vr({}),{transform:Ve}),Se=go(Q,"FORBID_ATTR",vr({}),{transform:Ve}),Me=qn(Q,"USE_PROFILES")?Q.USE_PROFILES&&typeof Q.USE_PROFILES=="object"?vr(Q.USE_PROFILES):Q.USE_PROFILES:!1,ue=Q.ALLOW_ARIA_ATTR!==!1,ve=Q.ALLOW_DATA_ATTR!==!1,de=Q.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=Q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=Q.SAFE_FOR_TEMPLATES||!1,be=Q.SAFE_FOR_XML!==!1,xe=Q.WHOLE_DOCUMENT||!1,et=Q.RETURN_DOM||!1,J=Q.RETURN_DOM_FRAGMENT||!1,re=Q.RETURN_TRUSTED_TYPE||!1,Fe=Q.FORCE_BODY||!1,he=Q.SANITIZE_DOM!==!1,me=Q.SANITIZE_NAMED_PROPS||!1,Pe=Q.KEEP_CONTENT!==!1,Ee=Q.IN_PLACE||!1,se=GW(Q.ALLOWED_URI_REGEXP)?Q.ALLOWED_URI_REGEXP:RA,pe=typeof Q.NAMESPACE=="string"?Q.NAMESPACE:Ke,ze=qn(Q,"MATHML_TEXT_INTEGRATION_POINTS")&&Q.MATHML_TEXT_INTEGRATION_POINTS&&typeof Q.MATHML_TEXT_INTEGRATION_POINTS=="object"?vr(Q.MATHML_TEXT_INTEGRATION_POINTS):tn({},He),Xe=qn(Q,"HTML_INTEGRATION_POINTS")&&Q.HTML_INTEGRATION_POINTS&&typeof Q.HTML_INTEGRATION_POINTS=="object"?vr(Q.HTML_INTEGRATION_POINTS):tn({},nt);const Ce=qn(Q,"CUSTOM_ELEMENT_HANDLING")&&Q.CUSTOM_ELEMENT_HANDLING&&typeof Q.CUSTOM_ELEMENT_HANDLING=="object"?vr(Q.CUSTOM_ELEMENT_HANDLING):Ji(null);if(ce=Ji(null),qn(Ce,"tagNameCheck")&&ht(Ce.tagNameCheck)&&(ce.tagNameCheck=Ce.tagNameCheck),qn(Ce,"attributeNameCheck")&&ht(Ce.attributeNameCheck)&&(ce.attributeNameCheck=Ce.attributeNameCheck),qn(Ce,"allowCustomizedBuiltInElements")&&typeof Ce.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=Ce.allowCustomizedBuiltInElements),tr(ce),we&&(ve=!1),J&&(et=!0),Me&&(X=tn({},PA),ie=Ji(null),Me.html===!0&&(tn(X,MA),tn(ie,NA)),Me.svg===!0&&(tn(X,fg),tn(ie,vg),tn(ie,hd)),Me.svgFilters===!0&&(tn(X,hg),tn(ie,vg),tn(ie,hd)),Me.mathMl===!0&&(tn(X,mg),tn(ie,IA),tn(ie,hd))),te.tagCheck=null,te.attributeCheck=null,qn(Q,"ADD_TAGS")&&(typeof Q.ADD_TAGS=="function"?te.tagCheck=Q.ADD_TAGS:vo(Q.ADD_TAGS)&&(X===ae&&(X=vr(X)),tn(X,Q.ADD_TAGS,Ve))),qn(Q,"ADD_ATTR")&&(typeof Q.ADD_ATTR=="function"?te.attributeCheck=Q.ADD_ATTR:vo(Q.ADD_ATTR)&&(ie===ee&&(ie=vr(ie)),tn(ie,Q.ADD_ATTR,Ve))),qn(Q,"ADD_URI_SAFE_ATTR")&&vo(Q.ADD_URI_SAFE_ATTR)&&tn(Tt,Q.ADD_URI_SAFE_ATTR,Ve),qn(Q,"FORBID_CONTENTS")&&vo(Q.FORBID_CONTENTS)&&(at===mt&&(at=vr(at)),tn(at,Q.FORBID_CONTENTS,Ve)),qn(Q,"ADD_FORBID_CONTENTS")&&vo(Q.ADD_FORBID_CONTENTS)&&(at===mt&&(at=vr(at)),tn(at,Q.ADD_FORBID_CONTENTS,Ve)),Pe&&(X["#text"]=!0),xe&&tn(X,["html","head","body"]),X.table&&(tn(X,["tbody"]),delete le.tbody),Q.TRUSTED_TYPES_POLICY){if(typeof Q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Jo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Jo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ge=w;w=Q.TRUSTED_TYPES_POLICY;try{x=L("")}catch(lt){throw w=Ge,lt}}else Q.TRUSTED_TYPES_POLICY===null?(w=void 0,x=""):(w===void 0&&(w=R()),w&&typeof x=="string"&&(x=L("")));er&&er(Q),it=Q},Ht=tn({},[...fg,...hg,...KW]),xt=tn({},[...mg,...ZW]),At=function(Q,Ce,Ge){return Ce.namespaceURI===Ke?Q==="svg":Ce.namespaceURI===bt?Q==="svg"&&(Ge==="annotation-xml"||ze[Ge]):!!Ht[Q]},Ue=function(Q,Ce,Ge){return Ce.namespaceURI===Ke?Q==="math":Ce.namespaceURI===ut?Q==="math"&&Xe[Ge]:!!xt[Q]},tt=function(Q,Ce,Ge){return Ce.namespaceURI===ut&&!Xe[Ge]||Ce.namespaceURI===bt&&!ze[Ge]?!1:!xt[Q]&&(ot[Q]||!Ht[Q])},qe=function(Q){let Ce=b(Q);(!Ce||!Ce.tagName)&&(Ce={namespaceURI:pe,tagName:"template"});const Ge=Rl(Q.tagName),lt=Rl(Ce.tagName);return De[Q.namespaceURI]?Q.namespaceURI===ut?At(Ge,Ce,lt):Q.namespaceURI===bt?Ue(Ge,Ce,lt):Q.namespaceURI===Ke?tt(Ge,Ce,lt):!!(Z==="application/xhtml+xml"&&De[Q.namespaceURI]):!1},je=function(Q){_i(t.removed,{element:Q});try{b(Q).removeChild(Q)}catch{if(g(Q),!b(Q))throw Jo("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},gt=function(Q){const Ce=m(Q);if(Ce){const lt=[];Il(Ce,Mt=>{_i(lt,Mt)}),Il(lt,Mt=>{try{g(Mt)}catch{}})}const Ge=S(Q);if(Ge)for(let lt=Ge.length-1;lt>=0;--lt){const Mt=Ge[lt],Qe=Mt&&Mt.name;if(typeof Qe=="string")try{Q.removeAttribute(Qe)}catch{}}},It=function(Q,Ce){try{_i(t.removed,{attribute:Ce.getAttributeNode(Q),from:Ce})}catch{_i(t.removed,{attribute:null,from:Ce})}if(Ce.removeAttribute(Q),Q==="is")if(et||J)try{je(Ce)}catch{}else try{Ce.setAttribute(Q,"")}catch{}},Kt=function(Q){const Ce=S(Q);if(Ce)for(let Ge=Ce.length-1;Ge>=0;--Ge){const lt=Ce[Ge],Mt=lt&&lt.name;if(!(typeof Mt!="string"||ie[Ve(Mt)]))try{Q.removeAttribute(Mt)}catch{}}},rn=function(Q){const Ce=[Q];for(;Ce.length>0;){const Ge=Ce.pop();(E?E(Ge):Ge.nodeType)===Ca.element&&Kt(Ge);const Mt=m(Ge);if(Mt)for(let Qe=Mt.length-1;Qe>=0;--Qe)Ce.push(Mt[Qe])}},Mn=function(Q){let Ce=null,Ge=null;if(Fe)Q="<remove></remove>"+Q;else{const Qe=EA(Q,/^[\r\n\t ]+/);Ge=Qe&&Qe[0]}Z==="application/xhtml+xml"&&pe===Ke&&(Q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Q+"</body></html>");const lt=w?L(Q):Q;if(pe===Ke)try{Ce=new d().parseFromString(lt,Z)}catch{}if(!Ce||!Ce.documentElement){Ce=D.createDocument(pe,"template",null);try{Ce.documentElement.innerHTML=Oe?x:lt}catch{}}const Mt=Ce.body||Ce.documentElement;return Q&&Ge&&Mt.insertBefore(n.createTextNode(Ge),Mt.childNodes[0]||null),pe===Ke?V.call(Ce,xe?"html":"body")[0]:xe?Ce.documentElement:Mt},qt=function(Q){return z.call(Q.ownerDocument||Q,Q,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},pn=function(Q){return Q=Dl(Q,H," "),Q=Dl(Q,B," "),Q=Dl(Q,U," "),Q},Cn=function(Q){var Ce;Q.normalize();const Ge=z.call(Q.ownerDocument||Q,Q,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let lt=Ge.nextNode();for(;lt;)lt.data=pn(lt.data),lt=Ge.nextNode();const Mt=(Ce=Q.querySelectorAll)===null||Ce===void 0?void 0:Ce.call(Q,"template");Mt&&Il(Mt,Qe=>{Dn(Qe.content)&&Cn(Qe.content)})},Sn=function(Q){const Ce=A?A(Q):null;return typeof Ce!="string"||Ve(Ce)!=="form"?!1:typeof Q.nodeName!="string"||typeof Q.textContent!="string"||typeof Q.removeChild!="function"||Q.attributes!==S(Q)||typeof Q.removeAttribute!="function"||typeof Q.setAttribute!="function"||typeof Q.namespaceURI!="string"||typeof Q.insertBefore!="function"||typeof Q.hasChildNodes!="function"||Q.nodeType!==E(Q)||Q.childNodes!==m(Q)},Dn=function(Q){if(!E||typeof Q!="object"||Q===null)return!1;try{return E(Q)===Ca.documentFragment}catch{return!1}},Nn=function(Q){if(!E||typeof Q!="object"||Q===null)return!1;try{return typeof E(Q)=="number"}catch{return!1}};function un(ke,Q,Ce){ke.length!==0&&Il(ke,Ge=>{Ge.call(t,Q,Ce,it)})}const Zn=function(Q,Ce){return!!(be&&Q.hasChildNodes()&&!Nn(Q.firstElementChild)&&nr(DA,Q.textContent)&&nr(DA,Q.innerHTML)||be&&Q.namespaceURI===Ke&&Ce==="style"&&Nn(Q.firstElementChild)||Q.nodeType===Ca.processingInstruction||be&&Q.nodeType===Ca.comment&&nr(rU,Q.data))},_n=function(Q,Ce){if(!le[Ce]&&Ft(Ce)&&(ce.tagNameCheck instanceof RegExp&&nr(ce.tagNameCheck,Ce)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(Ce)))return!1;if(Pe&&!at[Ce]){const Ge=b(Q),lt=m(Q);if(lt&&Ge){const Mt=lt.length;for(let Qe=Mt-1;Qe>=0;--Qe){const st=Ee?lt[Qe]:v(lt[Qe],!0);Ge.insertBefore(st,p(Q))}}}return je(Q),!0},Qn=function(Q){if(un(k.beforeSanitizeElements,Q,null),Sn(Q))return je(Q),!0;const Ce=Ve(A?A(Q):Q.nodeName);if(un(k.uponSanitizeElement,Q,{tagName:Ce,allowedTags:X}),Zn(Q,Ce))return je(Q),!0;if(le[Ce]||!(te.tagCheck instanceof Function&&te.tagCheck(Ce))&&!X[Ce])return _n(Q,Ce);if((E?E(Q):Q.nodeType)===Ca.element&&!qe(Q)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&nr(aU,Q.innerHTML))return je(Q),!0;if(we&&Q.nodeType===Ca.text){const lt=pn(Q.textContent);Q.textContent!==lt&&(_i(t.removed,{element:Q.cloneNode()}),Q.textContent=lt)}return un(k.afterSanitizeElements,Q,null),!1},rr=function(Q,Ce,Ge){if(Se[Ce]||he&&(Ce==="id"||Ce==="name")&&(Ge in n||Ge in vt))return!1;const lt=ie[Ce]||te.attributeCheck instanceof Function&&te.attributeCheck(Ce,Q);if(!(ve&&nr(Y,Ce))){if(!(ue&&nr(_,Ce))){if(lt){if(!Tt[Ce]){if(!nr(se,Dl(Ge,ne,""))){if(!((Ce==="src"||Ce==="xlink:href"||Ce==="href")&&Q!=="script"&&xA(Ge,"data:")===0&&St[Q])){if(!(de&&!nr($,Dl(Ge,ne,"")))){if(Ge)return!1}}}}}else if(!(Ft(Q)&&(ce.tagNameCheck instanceof RegExp&&nr(ce.tagNameCheck,Q)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(Q))&&(ce.attributeNameCheck instanceof RegExp&&nr(ce.attributeNameCheck,Ce)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(Ce,Q))||Ce==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&nr(ce.tagNameCheck,Ge)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(Ge))))return!1}}return!0},gr=tn({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ft=function(Q){return!gr[Rl(Q)]&&nr(oe,Q)},ft=function(Q,Ce,Ge,lt){if(w&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ge)switch(f.getAttributeType(Q,Ce)){case"TrustedHTML":return L(lt);case"TrustedScriptURL":return j(lt)}return lt},Rt=function(Q,Ce,Ge,lt){try{Ge?Q.setAttributeNS(Ge,Ce,lt):Q.setAttribute(Ce,lt),Sn(Q)?je(Q):wA(t.removed)}catch{It(Ce,Q)}},_e=function(Q){un(k.beforeSanitizeAttributes,Q,null);const Ce=Q.attributes;if(!Ce||Sn(Q))return;const Ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let lt=Ce.length;const Mt=Ve(Q.nodeName);for(;lt--;){const Qe=Ce[lt],st=Qe.name,Et=Qe.namespaceURI,Lt=Qe.value,$t=Ve(st),la=Lt;let xn=st==="value"?la:HW(la);if(Ge.attrName=$t,Ge.attrValue=xn,Ge.keepAttr=!0,Ge.forceKeepAttr=void 0,un(k.uponSanitizeAttribute,Q,Ge),xn=Ge.attrValue,me&&($t==="id"||$t==="name")&&xA(xn,ge)!==0&&(It(st,Q),xn=ge+xn),be&&nr(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,xn)){It(st,Q);continue}if($t==="attributename"&&EA(xn,"href")){It(st,Q);continue}if(!Ge.forceKeepAttr){if(!Ge.keepAttr){It(st,Q);continue}if(!Ae&&nr(oU,xn)){It(st,Q);continue}if(we&&(xn=pn(xn)),!rr(Mt,$t,xn)){It(st,Q);continue}xn=ft(Mt,$t,Et,xn),xn!==la&&Rt(Q,st,Et,xn)}}un(k.afterSanitizeAttributes,Q,null)},Je=function(Q){let Ce=null;const Ge=qt(Q);for(un(k.beforeSanitizeShadowDOM,Q,null);Ce=Ge.nextNode();)if(un(k.uponSanitizeShadowNode,Ce,null),Qn(Ce),_e(Ce),Dn(Ce.content)&&Je(Ce.content),(E?E(Ce):Ce.nodeType)===Ca.element){const Mt=C(Ce);Dn(Mt)&&(Dt(Mt),Je(Mt))}un(k.afterSanitizeShadowDOM,Q,null)},Dt=function(Q){const Ce=[{node:Q,shadow:null}];for(;Ce.length>0;){const Ge=Ce.pop();if(Ge.shadow){Je(Ge.shadow);continue}const lt=Ge.node,Qe=(E?E(lt):lt.nodeType)===Ca.element,st=m(lt);if(st)for(let Et=st.length-1;Et>=0;--Et)Ce.push({node:st[Et],shadow:null});if(Qe){const Et=A?A(lt):null;if(typeof Et=="string"&&Ve(Et)==="template"){const Lt=lt.content;Dn(Lt)&&Ce.push({node:Lt,shadow:null})}}if(Qe){const Et=C(lt);Dn(Et)&&Ce.push({node:null,shadow:Et},{node:Et,shadow:null})}}};return t.sanitize=function(ke){let Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ce=null,Ge=null,lt=null,Mt=null;if(Oe=!ke,Oe&&(ke="<!-->"),typeof ke!="string"&&!Nn(ke)&&(ke=UW(ke),typeof ke!="string"))throw Jo("dirty is not a string, aborting");if(!t.isSupported)return ke;Re?(X=$e,ie=Be):dt(Q),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(X=vr(X)),k.uponSanitizeAttribute.length>0&&(ie=vr(ie)),t.removed=[];const Qe=Ee&&typeof ke!="string"&&Nn(ke);if(Qe){const Lt=A?A(ke):ke.nodeName;if(typeof Lt=="string"){const $t=Ve(Lt);if(!X[$t]||le[$t])throw Jo("root node is forbidden and cannot be sanitized in-place")}if(Sn(ke))throw Jo("root node is clobbered and cannot be sanitized in-place");try{Dt(ke)}catch($t){throw gt(ke),$t}}else if(Nn(ke))Ce=Mn("<!---->"),Ge=Ce.ownerDocument.importNode(ke,!0),Ge.nodeType===Ca.element&&Ge.nodeName==="BODY"||Ge.nodeName==="HTML"?Ce=Ge:Ce.appendChild(Ge),Dt(Ge);else{if(!et&&!we&&!xe&&ke.indexOf("<")===-1)return w&&re?L(ke):ke;if(Ce=Mn(ke),!Ce)return et?null:re?x:""}Ce&&Fe&&je(Ce.firstChild);const st=qt(Qe?ke:Ce);try{for(;lt=st.nextNode();)Qn(lt),_e(lt),Dn(lt.content)&&Je(lt.content)}catch(Lt){throw Qe&&gt(ke),Lt}if(Qe)return Il(t.removed,Lt=>{Lt.element&&rn(Lt.element)}),we&&Cn(ke),ke;if(et){if(we&&Cn(Ce),J)for(Mt=F.call(Ce.ownerDocument);Ce.firstChild;)Mt.appendChild(Ce.firstChild);else Mt=Ce;return(ie.shadowroot||ie.shadowrootmode)&&(Mt=W.call(r,Mt,!0)),Mt}let Et=xe?Ce.outerHTML:Ce.innerHTML;return xe&&X["!doctype"]&&Ce.ownerDocument&&Ce.ownerDocument.doctype&&Ce.ownerDocument.doctype.name&&nr(tU,Ce.ownerDocument.doctype.name)&&(Et="<!DOCTYPE "+Ce.ownerDocument.doctype.name+`>
1720
1720
  `+Et),we&&(Et=pn(Et)),w&&re?L(Et):Et},t.setConfig=function(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dt(ke),Re=!0,$e=X,Be=ie},t.clearConfig=function(){it=null,Re=!1,$e=null,Be=null,w=P,x=""},t.isValidAttribute=function(ke,Q,Ce){it||dt({});const Ge=Ve(ke),lt=Ve(Q);return rr(Ge,lt,Ce)},t.addHook=function(ke,Q){typeof Q=="function"&&qn(k,ke)&&_i(k[ke],Q)},t.removeHook=function(ke,Q){if(qn(k,ke)){if(Q!==void 0){const Ce=zW(k[ke],Q);return Ce===-1?void 0:kW(k[ke],Ce,1)[0]}return wA(k[ke])}},t.removeHooks=function(ke){qn(k,ke)&&(k[ke]=[])},t.removeAllHooks=function(){k=TA()},t}var lU=jA();function cU(e){return e?lU.sanitize(e,{ADD_ATTR:["target","rel"]}):""}function LA(){const{organization:e}=Wr(),{data:t,isLoading:n}=sA(),{data:r,isLoading:a}=lA(e),o=O.useMemo(()=>n||a?[]:e!=="lystech"?[...r||[],...t||[]]:r||[],[t,r,n,a,e]);return y.jsx("div",{className:"flex col gap-10",style:{padding:"20px",textAlign:"left"},children:o&&o.map(i=>y.jsxs("div",{className:"p-4 border rounded bg-white",children:[y.jsx("div",{dangerouslySetInnerHTML:{__html:cU(i.content)}}),y.jsx("div",{className:"text-xs text-gray-500 mt-2",children:i.updatedOn?`Updated: ${new Date(i.updatedOn).toLocaleString()}`:""})]},i.id))})}function uU(){const{showMessage:e}=na(),{activateUser:t}=mr(),{token:n}=pN(),[r,a]=O.useState(!1),[o,i]=O.useState(!1),s=O.useRef(!1),[c,u]=O.useState(null);async function d(f){if(!s.current){s.current=!0,u({type:"info",content:"Activation en cours..."}),a(!0);try{const h=await t(f);return h!=null&&h.success?(e({message:"Votre compte a été activé avec succès.",type:"success",duration:1e4}),i(!0),u({type:"success",content:"Votre compte a été activé avec succès. Redirection..."}),setTimeout(()=>{if(h!=null&&h.redirectionUrl){window.location.href=h.redirectionUrl;return}else window.location.href="/login"},3e3)):(e({message:"L'activation de votre compte a échoué ou ce lien est expiré.",type:"error",duration:1e4}),u({type:"error",content:"L'activation de votre compte a échoué ou ce lien est expiré."})),h}catch{return e({message:"Une erreur s'est produite lors de l'activation de votre compte.",type:"error",duration:1e4}),u({type:"error",content:"Une erreur s'est produite lors de l'activation de votre compte."}),null}finally{a(!1)}}}return O.useEffect(()=>{n&&!o&&!r&&!s.current&&d(n)},[n,o,r]),y.jsx("div",{className:"account-activation auth-theme-container",children:y.jsx("div",{className:"auth-theme-content",children:y.jsx("div",{className:`auth-message ${(c==null?void 0:c.type)||""}`.trim(),children:c==null?void 0:c.content})})})}const dU=({onSuccess:e,onCancel:t,style:n,className:r="",centered:a=!1,showLogo:o=!0,logoSrc:i,appName:s="",defaultMode:c="login",cancelButtonText:u="Annuler",returnToLoginButtonText:d="Retour à la connexion",showTitle:f=!0,title:h="",showLoginForm:v=!0,showRegisterForm:g=!0,showForgotPasswordForm:p=!0,loginButtonText:m="Se connecter",registerButtonText:b="S'inscrire",forgotPasswordButtonText:C="Réinitialiser le mot de passe",loginFormProps:S={},registerFormProps:E={},forgotPasswordFormProps:A={},politiqueAndConditionsConsentTexte:w="En créant un compte, j'ai lu, compris et j'accepte les règles d'utilisation.",seePolitiqueAndConditions:x="Voir les termes et conditions",politiqueAndConditionsRoute:P="/conditions"})=>{const M=mr(),N=Gf(),[I,L]=O.useState(c),j=!!P&&(N==null?void 0:N.pathname)===P,R=()=>{e==null||e()},T=()=>{L("login")},D=()=>{L("login")},z=()=>{};return j?y.jsx(LA,{}):M.isLoggedIn?y.jsx("div",{className:`auth-template connected ${r}`,style:{...n,...a?{maxWidth:"400px",margin:"0 auto",padding:"20px"}:{}},children:y.jsxs("div",{className:"auth-container",children:[o&&y.jsxs("div",{className:"auth-header",children:[i&&y.jsx("img",{src:i,alt:s,className:"auth-logo"}),y.jsx("h1",{children:s})]}),y.jsx(pA,{onLogout:z,onClose:t,showCloseButton:!!t})]})}):y.jsx("div",{className:`auth-template ${r}`,style:{...n,...a?{maxWidth:"400px",margin:"0 auto",padding:"20px"}:{}},children:y.jsxs("div",{className:"auth-container",children:[o&&y.jsxs("div",{className:"auth-header",children:[i&&y.jsx("img",{src:i,alt:s,className:"auth-logo"}),y.jsx("h1",{children:s})]}),f&&y.jsx("div",{className:"auth-title",children:y.jsx("h2",{children:h})}),y.jsxs("div",{className:"auth-tabs",children:[v&&y.jsx("button",{className:`tab ${I==="login"?"active":""}`,onClick:()=>L("login"),children:m}),g&&y.jsx("button",{className:`tab ${I==="register"?"active":""}`,onClick:()=>L("register"),children:b})]}),y.jsxs("div",{className:"auth-content",children:[I==="login"&&v&&y.jsx("div",{children:y.jsx(mA,{onSuccess:R,loginButtonText:"Se connecter",className:"auth-login-form",showTitle:!1,showForgotPassword:p,forgotPasswordText:C,onForgotPassword:()=>L("forgot-password"),...S})}),I==="register"&&g&&y.jsx(vA,{onSuccess:T,politiqueAndConditionsConsentTexte:w,seePolitiqueAndConditions:x,politiqueAndConditionsRoute:P,...E}),I==="forgot-password"&&p&&y.jsxs("div",{children:[y.jsx(gA,{onSuccess:D,...A}),y.jsx("div",{className:"auth-links",children:y.jsxs("button",{type:"button",onClick:()=>L("login"),className:"link-button",children:["← ",d]})})]}),I==="activation"&&y.jsx(uU,{})]}),t&&y.jsx("div",{className:"auth-footer",children:y.jsx("button",{onClick:t,className:"btn btn-secondary",children:u})})]})})};function md(){const{organizationDetails:e}=Wr();return y.jsxs("div",{style:{width:"100%",minHeight:"400px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:18,color:"#888"},children:[y.jsx("div",{className:"loading-spinner",style:{width:48,height:48,border:"6px solid #eee",borderTop:`6px solid ${(e==null?void 0:e.primaryColor)||"#1677ff"}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),y.jsx("style",{children:`
1721
1721
  @keyframes spin {