@chatsystem/client 1.1.24 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
|
33
33
|
Try polyfilling it using "@formatjs/intl-relativetimeformat"
|
|
34
34
|
`,dt.MISSING_INTL_API));try{return Bc(e,t,a).format(n,r)}catch(u){e.onError(new nt("Error formatting relative time.",e.locale,u))}return String(n)}var Hc=["style","currency","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay","numberingSystem","trailingZeroDisplay","roundingPriority","roundingIncrement","roundingMode"];function Ss(e,t,n){var r=e.locale,a=e.formats,i=e.onError;n===void 0&&(n={});var u=n.format,o=u&&Ua(a,"number",u,i)||{},l=Bt(n,Hc,o);return t(r,l)}function Uc(e,t,n,r){r===void 0&&(r={});try{return Ss(e,t,r).format(n)}catch(a){e.onError(new nt("Error formatting number.",e.locale,a))}return String(n)}function jc(e,t,n,r){r===void 0&&(r={});try{return Ss(e,t,r).formatToParts(n)}catch(a){e.onError(new nt("Error formatting number.",e.locale,a))}return[]}function $c(e){var t=e?e[Object.keys(e)[0]]:void 0;return typeof t=="string"}function Yc(e){e.onWarn&&e.defaultRichTextElements&&$c(e.messages||{})&&e.onWarn(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled.
|
|
35
35
|
Please consider using "@formatjs/cli" to pre-compile your messages for performance.
|
|
36
|
-
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function Gc(e,t){var n=Sc(t),r=V(V({},gs),e),a=r.locale,i=r.defaultLocale,u=r.onError;return a?!Intl.NumberFormat.supportedLocalesOf(a).length&&u?u(new xi('Missing locale data for locale: "'.concat(a,'" in Intl.NumberFormat. Using default locale: "').concat(i,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(a).length&&u&&u(new xi('Missing locale data for locale: "'.concat(a,'" in Intl.DateTimeFormat. Using default locale: "').concat(i,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(u&&u(new gc('"locale" was not configured, using "'.concat(i,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),r.locale=r.defaultLocale||"en"),Yc(r),V(V({},r),{formatters:n,formatNumber:Uc.bind(null,r,n.getNumberFormat),formatNumberToParts:jc.bind(null,r,n.getNumberFormat),formatRelativeTime:Fc.bind(null,r,n.getRelativeTimeFormat),formatDate:xc.bind(null,r,n.getDateTimeFormat),formatDateToParts:Nc.bind(null,r,n.getDateTimeFormat),formatTime:Cc.bind(null,r,n.getDateTimeFormat),formatDateTimeRange:Ic.bind(null,r,n.getDateTimeFormat),formatTimeToParts:Oc.bind(null,r,n.getDateTimeFormat),formatPlural:wc.bind(null,r,n.getPluralRules),formatMessage:ma.bind(null,r,n),$t:ma.bind(null,r,n),formatList:Dc.bind(null,r,n.getListFormat),formatListToParts:ys.bind(null,r,n.getListFormat),formatDisplayName:Rc.bind(null,r,n.getDisplayNames)})}function xs(e){es(e,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}var Cs=V(V({},gs),{textComponent:Ve.Fragment});function zc(e){return function(t){return e(Ve.Children.toArray(t))}}function Vc(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=Object.keys(e),r=Object.keys(t),a=n.length;if(r.length!==a)return!1;for(var i=0;i<a;i++){var u=n[i];if(e[u]!==t[u]||!Object.prototype.hasOwnProperty.call(t,u))return!1}return!0}var ja=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=Ve.createContext(null)):Ve.createContext(null);ja.Consumer;var qc=ja.Provider,Wc=qc,Xc=ja;function hr(){var e=Ve.useContext(Xc);return xs(e),e}var pa;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(pa||(pa={}));var Ea;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(Ea||(Ea={}));function Is(e){var t=function(n){var r=hr(),a=n.value,i=n.children,u=fr(n,["value","children"]),o=typeof a=="string"?new Date(a||0):a,l=e==="formatDate"?r.formatDateToParts(o,u):r.formatTimeToParts(o,u);return i(l)};return t.displayName=Ea[e],t}function Rn(e){var t=function(n){var r=hr(),a=n.value,i=n.children,u=fr(n,["value","children"]),o=r[e](a,u);if(typeof i=="function")return i(o);var l=r.textComponent||Ve.Fragment;return Ve.createElement(l,null,o)};return t.displayName=pa[e],t}function Ns(e){return e&&Object.keys(e).reduce(function(t,n){var r=e[n];return t[n]=bs(r)?zc(r):r,t},{})}var Oi=function(e,t,n,r){for(var a=[],i=4;i<arguments.length;i++)a[i-4]=arguments[i];var u=Ns(r),o=ma.apply(void 0,lt([e,t,n,u],a,!1));return Array.isArray(o)?Ve.Children.toArray(o):o},Li=function(e,t){var n=e.defaultRichTextElements,r=fr(e,["defaultRichTextElements"]),a=Ns(n),i=Gc(V(V(V({},Cs),r),{defaultRichTextElements:a}),t),u={locale:i.locale,timeZone:i.timeZone,fallbackOnEmptyString:i.fallbackOnEmptyString,formats:i.formats,defaultLocale:i.defaultLocale,defaultFormats:i.defaultFormats,messages:i.messages,onError:i.onError,defaultRichTextElements:a};return V(V({},i),{formatMessage:Oi.bind(null,u,i.formatters),$t:Oi.bind(null,u,i.formatters)})};function Pr(e){return{locale:e.locale,timeZone:e.timeZone,fallbackOnEmptyString:e.fallbackOnEmptyString,formats:e.formats,textComponent:e.textComponent,messages:e.messages,defaultLocale:e.defaultLocale,defaultFormats:e.defaultFormats,onError:e.onError,onWarn:e.onWarn,wrapRichTextChunksInFragment:e.wrapRichTextChunksInFragment,defaultRichTextElements:e.defaultRichTextElements}}var Qc=(function(e){tt(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.cache=As(),n.state={cache:n.cache,intl:Li(Pr(n.props),n.cache),prevConfig:Pr(n.props)},n}return t.getDerivedStateFromProps=function(n,r){var a=r.prevConfig,i=r.cache,u=Pr(n);return Vc(a,u)?null:{intl:Li(u,i),prevConfig:u}},t.prototype.render=function(){return xs(this.state.intl),Ve.createElement(Wc,{value:this.state.intl},this.props.children)},t.displayName="IntlProvider",t.defaultProps=Cs,t})(Ve.PureComponent);Rn("formatDate");Rn("formatTime");Rn("formatNumber");Rn("formatList");Rn("formatDisplayName");Is("formatDate");Is("formatTime");const Kc={"generic.language.english":"English","generic.language.french":"French","generic.connect.google":"Connect with Google","generic.button.title.save":"Save","page.login.button.login":"Login / Register","page.login.google.login":"Continue with Google","navbar.button.home":"Home","navbar.button.pricing":"Pricing","navbar.button.login":"Login","navbar.button.demo":"Demo","navbar.userMenu.logout":"Log out","navbar.userMenu.profile":"Profile","navbar.userMenu.backOffice":"Back-office","home.header.catchphase":"The catchphrase you wanted","home.header.subcatchphase":"Discover the new software that will change it all","home.header.CTA":"See more","home.section.bulletsPointParagraphe1.title":"Management","home.section.bulletsPointParagraphe1.text":"Take advantage of a complete solution to have a direct point of view on all of your units.","home.section.bulletsPointParagraphe2.title":"Automation","home.section.bulletsPointParagraphe2.text":"In just a few clicks, manage your entire fleet. Implement macros and synergies on your systems.","home.section.bulletsPointParagraphe3.title":"Reporting","home.section.bulletsPointParagraphe3.text":"With its BI module, our software allows you to monitor performance and optimize your costs.","home.realm.title":"See the root of your business in a few clicks","home.realm.text":"The security of your data is at the heart of our concerns. Our software was created in France, we are ISO 27001 certified and all our servers are located in Europe.","home.realm.cta":"Discover our solution","home.testimonials.title":"What our customers say","home.testimonials.1.text":"Since using the software, we have better control of the flow of goods and relevant performance monitoring.","home.testimonials.1.job":"Developer @Wordpress","home.testimonials.1.name":"Loic Martins","home.testimonials.2.text":"Putting the software solution into production allowed us to completely reorganize the teams.","home.testimonials.2.job":"Community Manager @Comet","home.testimonials.2.name":"Anna Wang","home.testimonials.3.text":"Mastery of the logistics subject is obvious with the software solution.","home.testimonials.3.job":"Product Owner @April","home.testimonials.3.name":"Louis Bachant","home.test.section.title":"Try it out now","home.test.section.CTA":"See our solution","pricing.CTA.pleaseLogin":"Login to buy","pricing.page.title":"Choose your plan","pricing.page.subtitle":"No obligation: cancel at any time with one click.","subscribe.paymentRecap.title":"Payment Summary","subscribe.paymentRecap.customerName":"Name","subscribe.paymentRecap.customerMail":"Email","subscribe.paymentRecap.additionnalMention":"Mention to add","subscribe.paymentRecap.totalAmount":"Total Amount","subscribe.paymentForm.title":"Bank card","subscribe.paymentForm.cardNumber":"Card number","subscribe.paymentForm.expiresAt":"Expires at","subscribe.paymentForm.CVCNumber":"CVC number","subscribe.paymentForm.CTA.loading":"Loading ...","subscribe.paymentForm.CTA.pay":"Pay now","subscribe.success.title":"Payment successful","subscribe.success.paragraph1":"Your payment has been processed successfully. You are now suscribed !","subscribe.success.paragraph2":"Your new options are now available.","myAccount.page.leftMenu.general":"General","myAccount.page.leftMenu.profile":"Profile","chatbot.placeholder.content":"Message the assistant...","chatbot.chatline.label.user":"You","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.genericSearchMessage":"I'm looking for products","chatbot.chatline.loading.function.search":"Search","chatbot.chatline.loading.function.extractProductName":"Looking into the cavern","chatbot.chatline.loading.function.suggestProductName":"Consulting the shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Looking for ziboublis","chatbot.chatline.loading.function.searchStock":"Searching Stock","chatbot.chatline.loading.function.step":"Step","chatbot.chatline.loading.cancel":"Cancel","footer.tab.title.general":"General","footer.tab.title.about":"About","footer.tab.title.resources":"Resources","footer.tab.title.legal":"Legal","footer.tab.title.social":"Social","footer.tab.search":"Search","footer.tab.pricing":"Pricing","footer.tab.termsAndConditions":"Terms and conditions","footer.tab.finalCopyright":"Copyright © 2023 Logiciel, Inc. All rights reserved."},Zc={"generic.language.english":"Anglais","generic.language.french":"Français","generic.connect.google":"Se connecter avec Google","generic.button.title.save":"Sauvegarder","page.login.button.login":"Se connecter / S'inscrire","page.login.google.login":"Continuer avec Google","navbar.button.home":"Accueil","navbar.button.pricing":"Tarifs","navbar.button.login":"Se Connecter","navbar.button.demo":"Demo","navbar.userMenu.logout":"Déconnection","navbar.userMenu.profile":"Profil","navbar.userMenu.backOffice":"Back-office","home.header.catchphase":"Catchphrase de l'espace","home.header.subcatchphase":"Découvrez le logiciel qui met fin à vos problèmes","home.header.CTA":"Voir notre solution","home.section.bulletsPointParagraphe1.title":"Management","home.section.bulletsPointParagraphe1.text":"Profitez d'une solution complète pour avoir un point de vue direct sur l'ensemble de vos unités.","home.section.bulletsPointParagraphe2.title":"Automatisation","home.section.bulletsPointParagraphe2.text":"En quelques clicks, gérez l'ensemble de votre flotte. Mettez en place des macros et des synergies sur vos systèmes.","home.section.bulletsPointParagraphe3.title":"Reporting","home.section.bulletsPointParagraphe3.text":"Avec son module BI, notre logiciel vous permet de monitorer la performance et d'optimiser vos coûts. A l'euro prêt","home.realm.title":"Le coeur du métier en quelques clics","home.realm.text":"La sécurité de vos données est au cœur de nos préoccupations. Notre logiciel a été créé en France, nous sommes certifiés ISO 27001 et tous nos serveurs sont situés en Europe.","home.realm.cta":"Voir notre solution","home.testimonials.title":"Nos clients parlent de nous","home.testimonials.1.text":"Depuis notre utilisation du logiciel, nous avons un meilleur contrôle du flux de marchandises et un suivi de performance pertinent.","home.testimonials.1.job":"Developpeur @Wordpress","home.testimonials.1.name":"Loic Martins","home.testimonials.2.text":"La mise en production de la solution logicielle nous a permis de réorganiser complètement les équipes.","home.testimonials.2.job":"Community Manager @Comet","home.testimonials.2.name":"Anna Wang","home.testimonials.3.text":"La maitrise du sujet logistique est une évidence avec la solution logicielle.","home.testimonials.3.job":"Product Owner @April","home.testimonials.3.name":"Louis Bachant","home.test.section.title":"Testez dès maintenant","home.test.section.CTA":"Voir notre solution","pricing.CTA.pleaseLogin":"Connectez-vous","pricing.page.title":"Choisissez votre plan","pricing.page.subtitle":"Sans engagement : annulez à tout moment en un clic.","subscribe.paymentRecap.title":"Récapitulatif de paiement","subscribe.paymentRecap.customerName":"Nom","subscribe.paymentRecap.customerMail":"Email","subscribe.paymentRecap.additionnalMention":"Mention à ajouter","subscribe.paymentRecap.totalAmount":"Total","subscribe.paymentForm.title":"Carte bancaire","subscribe.paymentForm.cardNumber":"Numéro de carte","subscribe.paymentForm.expiresAt":"Expire le","subscribe.paymentForm.CVCNumber":"Numéro CVV","subscribe.paymentForm.CTA.loading":"Chargement ...","subscribe.paymentForm.CTA.pay":"S'abonner","subscribe.success.title":"Paiement effectué avec succès","subscribe.success.paragraph1":"Votre paiement a bien été accepté. Vous êtes désormais abonné !","subscribe.success.paragraph2":"Toutes vos options sont maintenant disponibles.","myAccount.page.leftMenu.general":"Général","myAccount.page.leftMenu.profile":"Profil","chatbot.placeholder.content":"Envoyez un message à l'assistant ...","chatbot.chatline.label.user":"Vous","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.search":"Recherche","chatbot.chatline.loading.function.genericSearchMessage":"Je cherche des produits","chatbot.chatline.loading.function.extractProductName":"Recherche dans la caverne","chatbot.chatline.loading.function.suggestProductName":"Consultation des shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Recherche des ziboublis","chatbot.chatline.loading.function.searchStock":"Recherche en stock","chatbot.chatline.loading.function.step":"Etape","chatbot.chatline.loading.cancel":"Annuler","footer.tab.title.general":"Général","footer.tab.title.about":"A propos","footer.tab.title.resources":"Ressources","footer.tab.title.legal":"Mentions Légales","footer.tab.title.social":"Social","footer.tab.search":"Rechercher","footer.tab.pricing":"Tarifs","footer.tab.termsAndConditions":"Termes et conditions","footer.tab.finalCopyright":"Copyright © 2023 Logiciel, Inc. Tous droits réservés."};var Ke=(e=>(e.FRENCH="fr-FR",e.ENGLISH="en-US",e))(Ke||{});const mr={[Ke.ENGLISH]:{translatedText:Kc,pictureName:Ke.ENGLISH,langID:0,locale:Ke.ENGLISH},[Ke.FRENCH]:{translatedText:Zc,pictureName:Ke.FRENCH,langID:1,locale:Ke.FRENCH}},Jc=Object.keys(mr);Jc.reduce((e,t)=>{const n=mr[t];return[...e,n]},[]);const ef="languageSettings",tf=(e,t)=>{let n,r;return typeof window<"u"&&(r=window.localStorage.getItem(ef)),r&&e?.[r]!==void 0?n=e[r]:(n=e[t],n.isDefault=!0),n},nf=(e,t)=>{const[n,r]=N.useState(e[t]),a=i=>{Object.keys(e).includes(i?.locale)?r(i):r(e[Ke.ENGLISH])};return N.useEffect(()=>{let i=tf(e,t);i.locale!==t&&r(e[i.locale])},[]),{appCurrentLang:n,handleSetContextCurrentLang:a}},Os=N.createContext({appCurrentLang:mr[Ke.ENGLISH],setAppCurrentLang:()=>{}}),Ls=N.createContext({conversation:[],setConversation:()=>{}});var Lt={},Ri;function rf(){if(Ri)return Lt;Ri=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.AgentDisplayFacetRoleType=Lt.AgentDisplayFacetModeType=void 0;var e;(function(n){n.SPRITESHEET="spritesheet",n.LOTTIE="lottie",n.IMAGE="image",n.SVG="svg",n.VIDEO="video"})(e||(Lt.AgentDisplayFacetModeType=e={}));var t;return(function(n){n.LAUNCHER="launcher",n.ASSISTANT="assistant",n.SEARCH="search"})(t||(Lt.AgentDisplayFacetRoleType=t={})),Lt}var Ge=rf();const Dr=e=>({mode:Ge.AgentDisplayFacetModeType.SVG,role:e}),af=()=>({agent:{display:{name:"",CSSRules:"",[Ge.AgentDisplayFacetRoleType.LAUNCHER]:Dr(Ge.AgentDisplayFacetRoleType.LAUNCHER),[Ge.AgentDisplayFacetRoleType.ASSISTANT]:Dr(Ge.AgentDisplayFacetRoleType.ASSISTANT),[Ge.AgentDisplayFacetRoleType.SEARCH]:Dr(Ge.AgentDisplayFacetRoleType.SEARCH)},text:{initialText:""}}}),pr=N.createContext({companySettings:af(),setCompanySettings:()=>{}}),Rs=()=>({hasFetchedSettings:!1,hasDisplayedCSS:!1}),uf=()=>{const[e,t]=N.useState(Rs());return{appInternalContext:e,setAppInternalContext:t,setHasFetchedSettings:()=>{t(a=>({...a,hasFetchedSettings:!0}))},setHasDisplayedCss:()=>{t(a=>({...a,hasDisplayedCSS:!0}))}}},vs=N.createContext({appInternalContext:Rs(),setAppInternalContext:()=>{},setHasFetchedSettings:()=>{}}),sf=e=>Object.values(Ke).includes(e),of=e=>sf(e)?e:(console.log(`Language ${e} not handled for now. Using ${Ke.ENGLISH}.`),Ke.ENGLISH);class Zn{constructor(){}static getApiUrl=()=>process.env.NODE_ENV==="development"?"http://localhost:3001":"https://www.api.chatsystem.ai";static getHeaders=({contentType:t="text/plain"})=>({"Content-Type":t});static getFetchConfig=({contentType:t="text/plain",httpVerb:n="GET",body:r,options:a={}})=>{const i={method:n,headers:this.getHeaders({contentType:t}),...a};return r&&(i.body=JSON.stringify(r)),i}}const lf=({agentId:e,appToken:t,onFetched:n})=>{const[r,a]=N.useState({}),i={companySettings:r,setCompanySettings:a},[u,o]=N.useState([]),l={conversation:u,setConversation:o};return N.useEffect(()=>{const c=Zn.getApiUrl(),f=Zn.getFetchConfig({httpVerb:"GET",contentType:"application/json"});fetch(`${c}/company/settings/${t}/${e}`,f).then(async d=>{const m=await d.json();a(m),o([{userType:"assistant",content:m.agent.text.initialText}]),n?.()}).catch(d=>console.log("error in fetch",d))},[t,e]),{contextCompanySettings:i,contextInitialChatbotStartingText:l}};function cf(e,t={},n){const{id:r,nonce:a,target:i,disableConstructable:u}=t,o=i??document.head,l=N.useRef(null),c=N.useRef(null);N.useEffect(()=>{if(!e)return;if(!u&&"adoptedStyleSheets"in o&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype)return l.current||(l.current=new CSSStyleSheet,o.adoptedStyleSheets=[...o.adoptedStyleSheets,l.current]),l.current.replaceSync(e),n?.(),()=>{const d=o.adoptedStyleSheets||[],m=d.indexOf(l.current);if(m>=0){const h=d.slice();h.splice(m,1),o.adoptedStyleSheets=h}l.current=null};if(!c.current){const d=document.createElement("style");d.type="text/css",r&&(d.id=r),a&&(d.nonce=a),(o instanceof Document&&o.head||o).appendChild(d),c.current=d}return c.current.textContent=e,n?.(),()=>{c.current?.parentNode?.removeChild(c.current),c.current=null}},[e,r,a,i,u])}const Zt=globalThis;Zt.__WIDGET_ASSET_CACHE__||(Zt.__WIDGET_ASSET_CACHE__={svg:new Map,img:new Map,lot:new Map,spr:new Map});Zt.__WIDGET_PRELOAD_KEYS__||(Zt.__WIDGET_PRELOAD_KEYS__=new Set);const kr=Zt.__WIDGET_PRELOAD_KEYS__,St=Zt.__WIDGET_ASSET_CACHE__,ff="widget-assets-v1";async function Er(e,t){const n=await caches.open(ff),r=await n.match(e,{ignoreSearch:!1});if(r)return r.clone();const a=await fetch(e,{cache:"force-cache",mode:"cors",keepalive:!0,...t});if(!a.ok)throw new Error(`HTTP ${a.status} for ${e}`);return n.put(e,a.clone()),a}async function Ps(e){const t=St.svg.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).text();if(typeof globalThis.DOMPurify<"u"&&typeof globalThis.DOMPurify.sanitize=="function")try{const u=new DOMParser().parseFromString(a,"image/svg+xml"),o=new XMLSerializer().serializeToString(u.documentElement);return{sanitized:globalThis.DOMPurify.sanitize(o,{USE_PROFILES:{svg:!0,svgFilters:!0}})}}catch{return{sanitized:globalThis.DOMPurify.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0}})}}else return{sanitized:a}})();return St.svg.set(e,{promise:n,ts:Date.now()}),n}function Ds(e){const t=St.img.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).blob();return{blobUrl:URL.createObjectURL(a)}})();return St.img.set(e,{promise:n,ts:Date.now()}),n}function ks(e){const t=St.lot.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).arrayBuffer(),i=new Uint8Array(a);if(i.length>=4&&i[0]===80&&i[1]===75&&i[2]===3&&i[3]===4||e.endsWith(".lottie"))return{kind:"zip",blobUrl:URL.createObjectURL(new Blob([a],{type:"application/zip"}))};const o=new TextDecoder().decode(i);return{kind:"json",data:JSON.parse(o)}})();return St.lot.set(e,{promise:n,ts:Date.now()}),n}function ws(e){const t=St.spr.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).blob();let i=null;try{i=await createImageBitmap(a)}catch{i=null}const{imgEl:u,width:o,height:l}=await new Promise((c,f)=>{const d=URL.createObjectURL(a),m=new Image;m.crossOrigin="anonymous",m.onload=()=>{const h=m.naturalWidth,y=m.naturalHeight;c({imgEl:m,width:h,height:y})},m.onerror=()=>{URL.revokeObjectURL(d),f(new Error("Spritesheet image decode failed"))},m.src=d,m.decode?.().catch(()=>{})});return{imgEl:u,bitmap:i,width:o,height:l}})();return St.spr.set(e,{promise:n,ts:Date.now()}),n}function df(e){e.images?.forEach(t=>void Ds(t)),e.svgs?.forEach(t=>void Ps(t)),e.lotties?.forEach(t=>void ks(t)),e.sprites?.forEach(t=>void ws(t))}function hf(e){try{const t=document.createElement("link");t.rel="preconnect",t.href=e,t.crossOrigin="anonymous",document.head.appendChild(t);const n=document.createElement("link");n.rel="dns-prefetch",n.href=e,document.head.appendChild(n)}catch(t){console.log("error in injectPreconnect",t)}}function Ms(e){return new URL(e,document.baseURI).toString()}function mf(e,t){const n=document.head.querySelectorAll('link[rel="preload"]');for(const r of n)if((e?r.as===e||r.getAttribute("as")===e:!0)&&r.href===t)return!0;return!1}function jn(e,t,n,r){const a=Ms(n),i=`${e}|${t??""}|${a}`;if(kr.has(i))return;if(mf(t,a)){kr.add(i);return}const u=document.createElement("link");u.rel=e,t&&(u.as=t),u.href=a,u.crossOrigin="anonymous",r&&(u.type=r),u.setAttribute("data-chatsystem-preload","1"),document.head.appendChild(u),kr.add(i)}function pf(e){const t=u=>Array.from(new Set((u??[]).map(Ms))),n=t(e.images),r=t(e.svgs),a=t(e.lotties),i=t(e.sprites);n.forEach(u=>jn("preload","image",u)),r.forEach(u=>jn("preload","fetch",u,"image/svg+xml")),a.forEach(u=>jn("preload","fetch",u,"application/zip")),i.forEach(u=>jn("preload","fetch",u))}function Ef(e){const{manifest:t,origins:n}=bf(e);n.forEach(hf),pf(t),df(t)}function bf(e){const t=Tf(e),n=new Set,r=new Set,a=new Set,i=new Set;for(const{url:l,mode:c}of t)switch(gf(c,l)){case"svg":r.add(l);break;case"lottie":a.add(l);break;case"spritesheet":i.add(l);break;case"image":n.add(l);break}const u={images:Array.from(n),svgs:Array.from(r),lotties:Array.from(a),sprites:Array.from(i)},o=Af(u);return{manifest:u,origins:o}}function Tf(e){if(!e?.agent?.display)return[];const t=e.agent.display,n=[t.launcher,t.assistant,t.search].filter(Boolean),r=[];for(const a of n)a?.assetUrl&&r.push({url:a.assetUrl,mode:a.mode});return r}function gf(e,t){if(e)switch(e){case"svg":return"svg";case"lottie":return"lottie";case"spritesheet":return"spritesheet";case"image":return"image";case"video":return"video"}try{const r=new URL(t,document.baseURI).pathname.toLowerCase();if(r.endsWith(".svg"))return"svg";if(r.endsWith(".lottie")||r.endsWith(".zip")||r.endsWith(".json"))return r.endsWith(".json"),"lottie";if(/\.(png|webp|jpg|jpeg|gif|avi,ef)$/.test(r))return"image";if(/\.(mp4|webm|mov|m4v|ogg)$/.test(r))return"video"}catch(n){console.log("error in normalizeKind:",n)}return"unknown"}function Af(e){const t=new Set,n=r=>{if(r)try{const a=new URL(r,document.baseURI);t.add(`${a.protocol}//${a.host}`)}catch(a){console.log("error in uniqueOriginsFromManifest",a)}};return(e.images??[]).forEach(n),(e.svgs??[]).forEach(n),(e.lotties??[]).forEach(n),(e.sprites??[]).forEach(n),Array.from(t)}const _f=({children:e,appToken:t,agentId:n})=>{var r=navigator.language;console.log("App boot"),console.log("Brower language",r);const a=of(r),{appCurrentLang:i,handleSetContextCurrentLang:u}=nf(mr,a),o={appCurrentLang:i,setAppCurrentLang:u},l=uf(),{contextCompanySettings:c,contextInitialChatbotStartingText:f}=lf({agentId:n,appToken:t,onFetched:l.setHasFetchedSettings});return Ef(c.companySettings),cf(c.companySettings?.agent?.display?.CSSRules,{id:`${n}`},l.setHasDisplayedCss),P.jsx(P.Fragment,{children:P.jsx(Qc,{locale:i?.locale,messages:i?.translatedText,children:P.jsx(Os.Provider,{value:o,children:P.jsx(vs.Provider,{value:l,children:P.jsx(pr.Provider,{value:c,children:P.jsx(Ls.Provider,{value:f,children:l.appInternalContext.hasDisplayedCSS&&e})})})})})})},yf=e=>Object.values(tn).includes(e),Sf=e=>yf(e)?e:(console.warn(`Display mode not valid. Using ${tn.LAUNCHER} as default.`),tn.LAUNCHER),xf=e=>Ve.createElement("svg",{fill:"#000000",height:"800px",width:"800px",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 330 330",xmlSpace:"preserve",...e},Ve.createElement("path",{id:"XMLID_102_",d:"M325.607,79.393c-5.857-5.857-15.355-5.858-21.213,0.001l-139.39,139.393L25.607,79.393 c-5.857-5.857-15.355-5.858-21.213,0.001c-5.858,5.858-5.858,15.355,0,21.213l150.004,150c2.813,2.813,6.628,4.393,10.606,4.393 s7.794-1.581,10.606-4.394l149.996-150C331.465,94.749,331.465,85.251,325.607,79.393z"})),Cf=({src:e})=>{const[t,n]=N.useState(null);return N.useEffect(()=>{let r=!1;return Ds(e).then(({blobUrl:a})=>{n(a)}).catch(()=>n(null)),()=>{t&&!r&&(URL.revokeObjectURL(t),r=!0)}},[e]),P.jsx("img",{src:t??e,decoding:"async",loading:"eager"})};function If(e){return!!e&&typeof e=="object"&&"blob"in e&&e.blob instanceof Blob}function Nf({src:e,autoplay:t=!0,loop:n=!0,className:r,style:a,placeholder:i,fallback:u,onLoaded:o,onError:l}){const[c,f]=N.useState({kind:"loading"});return N.useEffect(()=>{let d=null,m=!1;return f({kind:"loading"}),ks(e).then(async h=>{if(!m)if(h.kind==="zip"){const y=If(h)?h.blob:await(await fetch(h.blobUrl)).blob();d=URL.createObjectURL(y),f({kind:"lottieZip",blobUrl:d}),o?.(d)}else f({kind:"json",data:h.data}),o?.(h.data)}).catch(h=>!m&&(f({kind:"error",err:h}),l?.(h))),()=>{m=!0,d&&URL.revokeObjectURL(d)}},[e]),c.kind==="loading"?P.jsx("div",{className:"flex items-center justify-center rounded-xl border border-dashed p-6 text-sm opacity-70 "+(r??""),style:{minHeight:96,...a},children:i??"Loading animation…"}):c.kind==="error"?P.jsx("div",{className:"flex items-center justify-center rounded-xl border p-6 text-sm text-red-600 "+(r??""),style:{minHeight:96,...a},children:u??"Failed to load animation"}):c.kind==="json"?P.jsx(xl,{animationData:c.data,loop:n,autoplay:t,className:r,style:a,rendererSettings:{preserveAspectRatio:"xMidYMid meet"}}):P.jsx(Cl.DotLottieReact,{src:c.blobUrl,loop:n,autoplay:t,className:r,style:a})}async function Of(e,t={}){const{minPeriod:n=8,maxPeriod:r=Math.floor(Math.min(e.width,e.height)/2),gutterSearchRadius:a=3,debug:i=!1}=t;if(e.width<n*2||e.height<n*2)return i&&console.warn("detectGrid: image too small"),null;const u=document.createElement("canvas");u.width=e.naturalWidth,u.height=e.naturalHeight;const o=u.getContext("2d");if(!o)return null;o.drawImage(e,0,0);const{data:l}=o.getImageData(0,0,u.width,u.height),c=u.width,f=u.height,d=new Uint8ClampedArray(c*f);for(let Y=0;Y<f;Y++){let F=Y*c;for(let B=0;B<c;B++){const G=(F+B)*4;d[F+B]=.299*l[G]+.587*l[G+1]+.114*l[G+2]|0}}const m=new Float32Array(c),h=new Float32Array(f);for(let Y=1;Y<c-1;Y++){let F=0;for(let B=0;B<f;B++){const G=B*c+Y,$=d[G+1]-d[G-1];F+=Math.abs($)}m[Y]=F}for(let Y=1;Y<f-1;Y++){let F=0;for(let B=0;B<c;B++){const G=Y*c+B,$=d[G+c]-d[G-c];F+=Math.abs($)}h[Y]=F}const y=vi(m,n,Math.min(r,c/2)),A=vi(h,n,Math.min(r,f/2));if(!y||!A)return i&&console.warn("detectGrid: could not find periods"),null;const R=Math.max(1,Math.round(c/y)),S=Math.max(1,Math.round(f/A)),v=Pi(m,y,R,a),O=Pi(h,A,S,a),w=Math.max(1,y-v),C=Math.max(1,A-O);if(w*R>c+2||C*S>f+2)return i&&console.warn("detectGrid: sanity check failed"),null;const I=ba(m,60),W=ba(h,60),se=Math.max(0,Di(m,I)),ne=Math.max(0,Di(h,W));return i&&console.log({periodX:y,periodY:A,columns:R,rows:S,gutterX:v,gutterY:O,frameWidth:w,frameHeight:C,originX:se,originY:ne}),{columns:R,rows:S,frameWidth:w,frameHeight:C,gutterX:v,gutterY:O,originX:se,originY:ne}}function vi(e,t,n){const r=Bs(e);let a=0;for(let h=0;h<e.length;h++){const y=e[h]-r;a+=y*y}if(a===0)return null;const i=new Float32Array(n+1);let u=0,o=-1/0;for(let h=t;h<=n;h++){let y=0;for(let R=0;R+h<e.length;R++)y+=(e[R]-r)*(e[R+h]-r);const A=y/a;i[h]=A,A>o&&(o=A,u=h)}if(u<=t||u>=n)return u||null;const l=i[u-1],c=i[u],f=i[u+1],d=l-2*c+f,m=d===0?0:.5*(l-f)/d;return u+m}function Pi(e,t,n,r){const a=[];for(let o=1;o<n;o++){const l=o*t;let c=1/0,f=l;for(let d=-r;d<=r;d++){const m=l+d;if(m<=0||m>=e.length)continue;const h=e[m];h<c&&(c=h,f=m)}a.push(f)}if(a.length<1)return 0;let i=[];for(const o of a){const l=e[o]*1.5+ba(e,10)*.5;let c=o,f=o;for(;c>1&&e[c-1]<=l;)c--;for(;f<e.length-2&&e[f+1]<=l;)f++;i.push(Math.max(0,f-c+1))}const u=Math.round(Bs(i));return Math.max(0,Math.min(u,Math.floor(t/4)))}function Bs(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}function ba(e,t){const n=Array.from(e);n.sort((a,i)=>a-i);const r=Math.max(0,Math.min(n.length-1,Math.floor(t/100*n.length)));return n[r]}function Di(e,t){for(let n=0;n<e.length;n++)if(e[n]>t)return n;return 0}function Lf(e,t,n,r,a){const{data:i}=e.getImageData(t,n,r,a);let u=0;for(let o=3;o<i.length;o+=4)u+=i[o];return u/(255*(i.length/4))<.03}const Rf=N.forwardRef(function({src:t,frameWidth:n,frameHeight:r,columns:a,rows:i,gutterX:u=0,gutterY:o=0,frameCount:l,atlasFrames:c,fps:f=12,autoplay:d=!0,loop:m=!0,startFrame:h=0,direction:y="forward",scale:A=1,backgroundColor:R,className:S,style:v,pauseWhenHidden:O=!1,onLoad:w,onEnd:C,onFrame:I},W){const se=N.useRef(null),ne=N.useRef(null),[Y,F]=N.useState(null),[B,G]=N.useState(null),[$,X]=N.useState(null),[oe,pe]=N.useState(!1),[ve,Le]=N.useState(!!d),[p,H]=N.useState(h),Q=N.useRef(1),[T,q]=N.useState(null),Z=Math.max(1,Math.floor(typeof window<"u"&&window.devicePixelRatio||1));N.useEffect(()=>{let ce=!1;return pe(!1),ws(t).then(({imgEl:Ie,bitmap:Ee})=>{ce||(F(Ie),G(Ee),X({w:Ie.naturalWidth,h:Ie.naturalHeight}),pe(!0),w?.())}).catch(()=>{}),()=>{ce=!0}},[t,w]),N.useEffect(()=>{let ce=!1;return(async()=>{if(!Y)return;if(c&&c.length){q(null);return}if(!(!n||!r||!a||!i)){q(null);return}const Ee=await Of(Y,{debug:!0});ce||(Ee?q({frameWidth:Ee.frameWidth,frameHeight:Ee.frameHeight,columns:Ee.columns,rows:Ee.rows,gutterX:Ee.gutterX,gutterY:Ee.gutterY}):(q(null),console.warn("RemoteSpritesheet: auto-detect failed; please provide grid props.")))})(),()=>{ce=!0}},[Y,c,n,r,a,i]);const z=T?.frameWidth??n,K=T?.frameHeight??r,te=T?.columns??a,ie=T?.rows??i,J=T?.gutterX??u,_e=T?.gutterY??o,j=N.useMemo(()=>{if(c&&c.length>0)return{cols:0,rows:0};if(!$||!z||!K)return{cols:0,rows:0};const ce=te??Math.floor(($.w+J)/(z+J)),Ie=ie??Math.floor(($.h+_e)/(K+_e));return{cols:Math.max(0,ce),rows:Math.max(0,Ie)}},[c,$,z,K,te,ie,J,_e]),xe=N.useMemo(()=>{if(c?.length)return c;if(!z||!K)return[];const{cols:ce,rows:Ie}=j;if(!ce||!Ie)return[];const Ee=Math.min(l??ce*Ie,ce*Ie),be=[];for(let Ne=0;Ne<Ee;Ne++){const Fe=Ne%ce,we=Math.floor(Ne/ce),qe=T?.originX??0,Nr=T?.originY??0,L=qe+Fe*(z+J),U=Nr+we*(K+_e);be.push({x:L,y:U,w:z,h:K})}if(Y&&be.length){const Ne=document.createElement("canvas");Ne.width=Y.naturalWidth,Ne.height=Y.naturalHeight;const Fe=Ne.getContext("2d");if(Fe){Fe.drawImage(Y,0,0);let we=be.length;for(;we>0&&Lf(Fe,be[we-1].x,be[we-1].y,be[we-1].w,be[we-1].h);)we--;return be.slice(0,we)}}return be},[c,j,l,z,K,J,_e,Y,T?.originX,T?.originY]),ke=()=>{const ce=se.current;if(!ce||xe.length===0)return;const Ie=xe[Math.max(0,Math.min(p,xe.length-1))],Ee=Math.max(1,Math.round(Ie.w*A)),be=Math.max(1,Math.round(Ie.h*A));ce.style.width=Ee+"px",ce.style.height=be+"px",ce.width=Ee*Z,ce.height=be*Z};N.useEffect(()=>{ke()},[oe,A,xe.length,Z,p]);const Ce=ce=>{const Ie=B??Y??null,Ee=se.current;if(!Ee||!Ie||xe.length===0)return;const be=Ee.getContext("2d");if(!be)return;be.save(),be.setTransform(1,0,0,1,0,0),be.clearRect(0,0,Ee.width,Ee.height),R&&(be.fillStyle=R,be.fillRect(0,0,Ee.width,Ee.height));const Ne=xe[ce];be.scale(Z,Z),be.drawImage(Ie,Ne.x,Ne.y,Ne.w,Ne.h,0,0,Math.round(Ne.w*A),Math.round(Ne.h*A)),be.restore()};return N.useEffect(()=>{if(!oe||xe.length===0)return;let ce=performance.now();const Ie=1e3/Math.max(1,Math.min(120,f)),Ee=be=>{if(ne.current=requestAnimationFrame(Ee),!ve){Ce(p);return}const Ne=be-ce;if(Ne<Ie){Ce(p);return}ce=be-Ne%Ie,H(Fe=>{const we=xe.length-1;let qe=Fe;return y==="forward"?qe=Fe+1:y==="backward"?qe=Fe-1:((Fe>=we&&Q.current===1||Fe<=0&&Q.current===-1)&&(Q.current*=-1),qe=Fe+Q.current),(qe>we||qe<0)&&(m?qe=y==="backward"?we:0:(qe=Math.max(0,Math.min(qe,we)),Le(!1),C?.())),qe})};return ne.current=requestAnimationFrame(Ee),()=>{ne.current&&cancelAnimationFrame(ne.current)}},[oe,f,ve,m,y,xe.length,p]),N.useEffect(()=>{Ce(p),I?.(p)},[p,oe,A,Z]),N.useEffect(()=>{if(!O)return;const ce=()=>{document.hidden&&Le(!1)};return document.addEventListener("visibilitychange",ce),()=>document.removeEventListener("visibilitychange",ce)},[O]),N.useImperativeHandle(W,()=>({play:()=>Le(!0),pause:()=>Le(!1),toggle:()=>Le(ce=>!ce),gotoFrame:ce=>H(()=>Math.max(0,Math.min(ce,Math.max(0,xe.length-1)))),isPlaying:()=>ve,currentFrame:()=>p}),[ve,p,xe.length]),P.jsx("div",{className:S,style:v,children:P.jsx("canvas",{ref:se,"aria-label":"spritesheet animation"})})});function vf({url:e,className:t}){const[n,r]=N.useState(""),[a,i]=N.useState(null);return N.useEffect(()=>{let u=!1;return Ps(e).then(({sanitized:o})=>{u||(r(o),i(null))}).catch(o=>!u&&i(o.message??"Failed to load")),()=>{u=!0}},[e]),a?P.jsxs("div",{className:t,role:"alert",children:["Couldn’t load SVG: ",a]}):n?P.jsx("div",{className:t,dangerouslySetInnerHTML:{__html:n}}):P.jsx("div",{className:t})}const $a=({facet:e})=>{const{mode:t,assetUrl:n}=e;return P.jsxs("div",{className:"assetContainer",children:[t===Ge.AgentDisplayFacetModeType.LOTTIE&&P.jsx(Nf,{src:n,autoplay:!0,onError:r=>console.error(r)}),t===Ge.AgentDisplayFacetModeType.SVG&&P.jsx("div",{children:P.jsx(vf,{url:n})}),t===Ge.AgentDisplayFacetModeType.IMAGE&&P.jsx(Cf,{src:n}),t===Ge.AgentDisplayFacetModeType.SPRITESHEET&&P.jsx(Rf,{src:n})]})},Pf=({isWidgetOpen:e,setIsWidgetOpen:t})=>{const{companySettings:n}=N.useContext(pr);return P.jsxs("div",{className:`launcher
|
|
36
|
+
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function Gc(e,t){var n=Sc(t),r=V(V({},gs),e),a=r.locale,i=r.defaultLocale,u=r.onError;return a?!Intl.NumberFormat.supportedLocalesOf(a).length&&u?u(new xi('Missing locale data for locale: "'.concat(a,'" in Intl.NumberFormat. Using default locale: "').concat(i,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(a).length&&u&&u(new xi('Missing locale data for locale: "'.concat(a,'" in Intl.DateTimeFormat. Using default locale: "').concat(i,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(u&&u(new gc('"locale" was not configured, using "'.concat(i,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),r.locale=r.defaultLocale||"en"),Yc(r),V(V({},r),{formatters:n,formatNumber:Uc.bind(null,r,n.getNumberFormat),formatNumberToParts:jc.bind(null,r,n.getNumberFormat),formatRelativeTime:Fc.bind(null,r,n.getRelativeTimeFormat),formatDate:xc.bind(null,r,n.getDateTimeFormat),formatDateToParts:Nc.bind(null,r,n.getDateTimeFormat),formatTime:Cc.bind(null,r,n.getDateTimeFormat),formatDateTimeRange:Ic.bind(null,r,n.getDateTimeFormat),formatTimeToParts:Oc.bind(null,r,n.getDateTimeFormat),formatPlural:wc.bind(null,r,n.getPluralRules),formatMessage:ma.bind(null,r,n),$t:ma.bind(null,r,n),formatList:Dc.bind(null,r,n.getListFormat),formatListToParts:ys.bind(null,r,n.getListFormat),formatDisplayName:Rc.bind(null,r,n.getDisplayNames)})}function xs(e){es(e,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}var Cs=V(V({},gs),{textComponent:Ve.Fragment});function zc(e){return function(t){return e(Ve.Children.toArray(t))}}function Vc(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=Object.keys(e),r=Object.keys(t),a=n.length;if(r.length!==a)return!1;for(var i=0;i<a;i++){var u=n[i];if(e[u]!==t[u]||!Object.prototype.hasOwnProperty.call(t,u))return!1}return!0}var ja=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=Ve.createContext(null)):Ve.createContext(null);ja.Consumer;var qc=ja.Provider,Wc=qc,Xc=ja;function hr(){var e=Ve.useContext(Xc);return xs(e),e}var pa;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(pa||(pa={}));var Ea;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(Ea||(Ea={}));function Is(e){var t=function(n){var r=hr(),a=n.value,i=n.children,u=fr(n,["value","children"]),o=typeof a=="string"?new Date(a||0):a,l=e==="formatDate"?r.formatDateToParts(o,u):r.formatTimeToParts(o,u);return i(l)};return t.displayName=Ea[e],t}function Rn(e){var t=function(n){var r=hr(),a=n.value,i=n.children,u=fr(n,["value","children"]),o=r[e](a,u);if(typeof i=="function")return i(o);var l=r.textComponent||Ve.Fragment;return Ve.createElement(l,null,o)};return t.displayName=pa[e],t}function Ns(e){return e&&Object.keys(e).reduce(function(t,n){var r=e[n];return t[n]=bs(r)?zc(r):r,t},{})}var Oi=function(e,t,n,r){for(var a=[],i=4;i<arguments.length;i++)a[i-4]=arguments[i];var u=Ns(r),o=ma.apply(void 0,lt([e,t,n,u],a,!1));return Array.isArray(o)?Ve.Children.toArray(o):o},Li=function(e,t){var n=e.defaultRichTextElements,r=fr(e,["defaultRichTextElements"]),a=Ns(n),i=Gc(V(V(V({},Cs),r),{defaultRichTextElements:a}),t),u={locale:i.locale,timeZone:i.timeZone,fallbackOnEmptyString:i.fallbackOnEmptyString,formats:i.formats,defaultLocale:i.defaultLocale,defaultFormats:i.defaultFormats,messages:i.messages,onError:i.onError,defaultRichTextElements:a};return V(V({},i),{formatMessage:Oi.bind(null,u,i.formatters),$t:Oi.bind(null,u,i.formatters)})};function Pr(e){return{locale:e.locale,timeZone:e.timeZone,fallbackOnEmptyString:e.fallbackOnEmptyString,formats:e.formats,textComponent:e.textComponent,messages:e.messages,defaultLocale:e.defaultLocale,defaultFormats:e.defaultFormats,onError:e.onError,onWarn:e.onWarn,wrapRichTextChunksInFragment:e.wrapRichTextChunksInFragment,defaultRichTextElements:e.defaultRichTextElements}}var Qc=(function(e){tt(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.cache=As(),n.state={cache:n.cache,intl:Li(Pr(n.props),n.cache),prevConfig:Pr(n.props)},n}return t.getDerivedStateFromProps=function(n,r){var a=r.prevConfig,i=r.cache,u=Pr(n);return Vc(a,u)?null:{intl:Li(u,i),prevConfig:u}},t.prototype.render=function(){return xs(this.state.intl),Ve.createElement(Wc,{value:this.state.intl},this.props.children)},t.displayName="IntlProvider",t.defaultProps=Cs,t})(Ve.PureComponent);Rn("formatDate");Rn("formatTime");Rn("formatNumber");Rn("formatList");Rn("formatDisplayName");Is("formatDate");Is("formatTime");const Kc={"generic.language.english":"English","generic.language.french":"French","generic.connect.google":"Connect with Google","generic.button.title.save":"Save","page.login.button.login":"Login / Register","page.login.google.login":"Continue with Google","navbar.button.home":"Home","navbar.button.pricing":"Pricing","navbar.button.login":"Login","navbar.button.demo":"Demo","navbar.userMenu.logout":"Log out","navbar.userMenu.profile":"Profile","navbar.userMenu.backOffice":"Back-office","home.header.catchphase":"The catchphrase you wanted","home.header.subcatchphase":"Discover the new software that will change it all","home.header.CTA":"See more","home.section.bulletsPointParagraphe1.title":"Management","home.section.bulletsPointParagraphe1.text":"Take advantage of a complete solution to have a direct point of view on all of your units.","home.section.bulletsPointParagraphe2.title":"Automation","home.section.bulletsPointParagraphe2.text":"In just a few clicks, manage your entire fleet. Implement macros and synergies on your systems.","home.section.bulletsPointParagraphe3.title":"Reporting","home.section.bulletsPointParagraphe3.text":"With its BI module, our software allows you to monitor performance and optimize your costs.","home.realm.title":"See the root of your business in a few clicks","home.realm.text":"The security of your data is at the heart of our concerns. Our software was created in France, we are ISO 27001 certified and all our servers are located in Europe.","home.realm.cta":"Discover our solution","home.testimonials.title":"What our customers say","home.testimonials.1.text":"Since using the software, we have better control of the flow of goods and relevant performance monitoring.","home.testimonials.1.job":"Developer @Wordpress","home.testimonials.1.name":"Loic Martins","home.testimonials.2.text":"Putting the software solution into production allowed us to completely reorganize the teams.","home.testimonials.2.job":"Community Manager @Comet","home.testimonials.2.name":"Anna Wang","home.testimonials.3.text":"Mastery of the logistics subject is obvious with the software solution.","home.testimonials.3.job":"Product Owner @April","home.testimonials.3.name":"Louis Bachant","home.test.section.title":"Try it out now","home.test.section.CTA":"See our solution","pricing.CTA.pleaseLogin":"Login to buy","pricing.page.title":"Choose your plan","pricing.page.subtitle":"No obligation: cancel at any time with one click.","subscribe.paymentRecap.title":"Payment Summary","subscribe.paymentRecap.customerName":"Name","subscribe.paymentRecap.customerMail":"Email","subscribe.paymentRecap.additionnalMention":"Mention to add","subscribe.paymentRecap.totalAmount":"Total Amount","subscribe.paymentForm.title":"Bank card","subscribe.paymentForm.cardNumber":"Card number","subscribe.paymentForm.expiresAt":"Expires at","subscribe.paymentForm.CVCNumber":"CVC number","subscribe.paymentForm.CTA.loading":"Loading ...","subscribe.paymentForm.CTA.pay":"Pay now","subscribe.success.title":"Payment successful","subscribe.success.paragraph1":"Your payment has been processed successfully. You are now suscribed !","subscribe.success.paragraph2":"Your new options are now available.","myAccount.page.leftMenu.general":"General","myAccount.page.leftMenu.profile":"Profile","chatbot.placeholder.content":"Message the assistant...","chatbot.chatline.label.user":"You","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.genericSearchMessage":"I'm looking for products","chatbot.chatline.loading.function.search":"Search","chatbot.chatline.loading.function.extractProductName":"Looking into the cavern","chatbot.chatline.loading.function.suggestProductName":"Consulting the shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Looking for ziboublis","chatbot.chatline.loading.function.searchStock":"Searching Stock","chatbot.chatline.loading.function.step":"Step","chatbot.chatline.loading.cancel":"Cancel","footer.tab.title.general":"General","footer.tab.title.about":"About","footer.tab.title.resources":"Resources","footer.tab.title.legal":"Legal","footer.tab.title.social":"Social","footer.tab.search":"Search","footer.tab.pricing":"Pricing","footer.tab.termsAndConditions":"Terms and conditions","footer.tab.finalCopyright":"Copyright © 2023 Logiciel, Inc. All rights reserved."},Zc={"generic.language.english":"Anglais","generic.language.french":"Français","generic.connect.google":"Se connecter avec Google","generic.button.title.save":"Sauvegarder","page.login.button.login":"Se connecter / S'inscrire","page.login.google.login":"Continuer avec Google","navbar.button.home":"Accueil","navbar.button.pricing":"Tarifs","navbar.button.login":"Se Connecter","navbar.button.demo":"Demo","navbar.userMenu.logout":"Déconnection","navbar.userMenu.profile":"Profil","navbar.userMenu.backOffice":"Back-office","home.header.catchphase":"Catchphrase de l'espace","home.header.subcatchphase":"Découvrez le logiciel qui met fin à vos problèmes","home.header.CTA":"Voir notre solution","home.section.bulletsPointParagraphe1.title":"Management","home.section.bulletsPointParagraphe1.text":"Profitez d'une solution complète pour avoir un point de vue direct sur l'ensemble de vos unités.","home.section.bulletsPointParagraphe2.title":"Automatisation","home.section.bulletsPointParagraphe2.text":"En quelques clicks, gérez l'ensemble de votre flotte. Mettez en place des macros et des synergies sur vos systèmes.","home.section.bulletsPointParagraphe3.title":"Reporting","home.section.bulletsPointParagraphe3.text":"Avec son module BI, notre logiciel vous permet de monitorer la performance et d'optimiser vos coûts. A l'euro prêt","home.realm.title":"Le coeur du métier en quelques clics","home.realm.text":"La sécurité de vos données est au cœur de nos préoccupations. Notre logiciel a été créé en France, nous sommes certifiés ISO 27001 et tous nos serveurs sont situés en Europe.","home.realm.cta":"Voir notre solution","home.testimonials.title":"Nos clients parlent de nous","home.testimonials.1.text":"Depuis notre utilisation du logiciel, nous avons un meilleur contrôle du flux de marchandises et un suivi de performance pertinent.","home.testimonials.1.job":"Developpeur @Wordpress","home.testimonials.1.name":"Loic Martins","home.testimonials.2.text":"La mise en production de la solution logicielle nous a permis de réorganiser complètement les équipes.","home.testimonials.2.job":"Community Manager @Comet","home.testimonials.2.name":"Anna Wang","home.testimonials.3.text":"La maitrise du sujet logistique est une évidence avec la solution logicielle.","home.testimonials.3.job":"Product Owner @April","home.testimonials.3.name":"Louis Bachant","home.test.section.title":"Testez dès maintenant","home.test.section.CTA":"Voir notre solution","pricing.CTA.pleaseLogin":"Connectez-vous","pricing.page.title":"Choisissez votre plan","pricing.page.subtitle":"Sans engagement : annulez à tout moment en un clic.","subscribe.paymentRecap.title":"Récapitulatif de paiement","subscribe.paymentRecap.customerName":"Nom","subscribe.paymentRecap.customerMail":"Email","subscribe.paymentRecap.additionnalMention":"Mention à ajouter","subscribe.paymentRecap.totalAmount":"Total","subscribe.paymentForm.title":"Carte bancaire","subscribe.paymentForm.cardNumber":"Numéro de carte","subscribe.paymentForm.expiresAt":"Expire le","subscribe.paymentForm.CVCNumber":"Numéro CVV","subscribe.paymentForm.CTA.loading":"Chargement ...","subscribe.paymentForm.CTA.pay":"S'abonner","subscribe.success.title":"Paiement effectué avec succès","subscribe.success.paragraph1":"Votre paiement a bien été accepté. Vous êtes désormais abonné !","subscribe.success.paragraph2":"Toutes vos options sont maintenant disponibles.","myAccount.page.leftMenu.general":"Général","myAccount.page.leftMenu.profile":"Profil","chatbot.placeholder.content":"Envoyez un message à l'assistant ...","chatbot.chatline.label.user":"Vous","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.search":"Recherche","chatbot.chatline.loading.function.genericSearchMessage":"Je cherche des produits","chatbot.chatline.loading.function.extractProductName":"Recherche dans la caverne","chatbot.chatline.loading.function.suggestProductName":"Consultation des shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Recherche des ziboublis","chatbot.chatline.loading.function.searchStock":"Recherche en stock","chatbot.chatline.loading.function.step":"Etape","chatbot.chatline.loading.cancel":"Annuler","footer.tab.title.general":"Général","footer.tab.title.about":"A propos","footer.tab.title.resources":"Ressources","footer.tab.title.legal":"Mentions Légales","footer.tab.title.social":"Social","footer.tab.search":"Rechercher","footer.tab.pricing":"Tarifs","footer.tab.termsAndConditions":"Termes et conditions","footer.tab.finalCopyright":"Copyright © 2023 Logiciel, Inc. Tous droits réservés."};var Ke=(e=>(e.FRENCH="fr-FR",e.ENGLISH="en-US",e))(Ke||{});const mr={[Ke.ENGLISH]:{translatedText:Kc,pictureName:Ke.ENGLISH,langID:0,locale:Ke.ENGLISH},[Ke.FRENCH]:{translatedText:Zc,pictureName:Ke.FRENCH,langID:1,locale:Ke.FRENCH}},Jc=Object.keys(mr);Jc.reduce((e,t)=>{const n=mr[t];return[...e,n]},[]);const ef="languageSettings",tf=(e,t)=>{let n,r;return typeof window<"u"&&(r=window.localStorage.getItem(ef)),r&&e?.[r]!==void 0?n=e[r]:(n=e[t],n.isDefault=!0),n},nf=(e,t)=>{const[n,r]=N.useState(e[t]),a=i=>{Object.keys(e).includes(i?.locale)?r(i):r(e[Ke.ENGLISH])};return N.useEffect(()=>{let i=tf(e,t);i.locale!==t&&r(e[i.locale])},[]),{appCurrentLang:n,handleSetContextCurrentLang:a}},Os=N.createContext({appCurrentLang:mr[Ke.ENGLISH],setAppCurrentLang:()=>{}}),Ls=N.createContext({conversation:[],setConversation:()=>{}});var Lt={},Ri;function rf(){if(Ri)return Lt;Ri=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.AgentDisplayFacetRoleType=Lt.AgentDisplayFacetModeType=void 0;var e;(function(n){n.SPRITESHEET="spritesheet",n.LOTTIE="lottie",n.IMAGE="image",n.SVG="svg",n.VIDEO="video"})(e||(Lt.AgentDisplayFacetModeType=e={}));var t;return(function(n){n.LAUNCHER="launcher",n.ASSISTANT="assistant",n.SEARCH="search"})(t||(Lt.AgentDisplayFacetRoleType=t={})),Lt}var Ge=rf();const Dr=e=>({mode:Ge.AgentDisplayFacetModeType.SVG,role:e}),af=()=>({agent:{display:{name:"",CSSRules:"",[Ge.AgentDisplayFacetRoleType.LAUNCHER]:Dr(Ge.AgentDisplayFacetRoleType.LAUNCHER),[Ge.AgentDisplayFacetRoleType.ASSISTANT]:Dr(Ge.AgentDisplayFacetRoleType.ASSISTANT),[Ge.AgentDisplayFacetRoleType.SEARCH]:Dr(Ge.AgentDisplayFacetRoleType.SEARCH)},text:{initialText:""}}}),pr=N.createContext({companySettings:af(),setCompanySettings:()=>{}}),Rs=()=>({hasFetchedSettings:!1,hasDisplayedCSS:!1}),uf=()=>{const[e,t]=N.useState(Rs());return{appInternalContext:e,setAppInternalContext:t,setHasFetchedSettings:()=>{t(a=>({...a,hasFetchedSettings:!0}))},setHasDisplayedCss:()=>{t(a=>({...a,hasDisplayedCSS:!0}))}}},vs=N.createContext({appInternalContext:Rs(),setAppInternalContext:()=>{},setHasFetchedSettings:()=>{}}),sf=e=>Object.values(Ke).includes(e),of=e=>sf(e)?e:(console.log(`Language ${e} not handled for now. Using ${Ke.ENGLISH}.`),Ke.ENGLISH);class Zn{constructor(){}static getApiUrl=()=>process.env.NODE_ENV==="development"?"http://localhost:3001":"https://www.api.chatsystem.ai";static getHeaders=({contentType:t="text/plain"})=>({"Content-Type":t});static getFetchConfig=({contentType:t="text/plain",httpVerb:n="GET",body:r,options:a={}})=>{const i={method:n,headers:this.getHeaders({contentType:t}),...a};return r&&(i.body=JSON.stringify(r)),i}}const lf=({agentId:e,appToken:t,onFetched:n})=>{const[r,a]=N.useState({}),i={companySettings:r,setCompanySettings:a},[u,o]=N.useState([]),l={conversation:u,setConversation:o};return N.useEffect(()=>{const c=Zn.getApiUrl(),f=Zn.getFetchConfig({httpVerb:"GET",contentType:"application/json"});fetch(`${c}/company/settings/${t}/${e}`,f).then(async d=>{const m=await d.json();a(m),o([{userType:"assistant",content:m.agent.text.initialText}]),n?.()}).catch(d=>console.log("error in fetch",d))},[t,e]),{contextCompanySettings:i,contextInitialChatbotStartingText:l}};function cf(e,t={},n){const{id:r,nonce:a,target:i,disableConstructable:u}=t,o=i??document.head,l=N.useRef(null),c=N.useRef(null);N.useEffect(()=>{if(!e)return;if(!u&&"adoptedStyleSheets"in o&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype)return l.current||(l.current=new CSSStyleSheet,o.adoptedStyleSheets=[...o.adoptedStyleSheets,l.current]),l.current.replaceSync(e),n?.(),()=>{const d=o.adoptedStyleSheets||[],m=d.indexOf(l.current);if(m>=0){const h=d.slice();h.splice(m,1),o.adoptedStyleSheets=h}l.current=null};if(!c.current){const d=document.createElement("style");d.type="text/css",r&&(d.id=r),a&&(d.nonce=a),(o instanceof Document&&o.head||o).appendChild(d),c.current=d}return c.current.textContent=e,n?.(),()=>{c.current?.parentNode?.removeChild(c.current),c.current=null}},[e,r,a,i,u])}const Zt=globalThis;Zt.__WIDGET_ASSET_CACHE__||(Zt.__WIDGET_ASSET_CACHE__={svg:new Map,img:new Map,lot:new Map,spr:new Map});Zt.__WIDGET_PRELOAD_KEYS__||(Zt.__WIDGET_PRELOAD_KEYS__=new Set);const kr=Zt.__WIDGET_PRELOAD_KEYS__,St=Zt.__WIDGET_ASSET_CACHE__,ff="widget-assets-v1";async function Er(e,t){const n=await caches.open(ff),r=await n.match(e,{ignoreSearch:!1});if(r)return r.clone();const a=await fetch(e,{cache:"force-cache",mode:"cors",keepalive:!0,...t});if(!a.ok)throw new Error(`HTTP ${a.status} for ${e}`);return n.put(e,a.clone()),a}async function Ps(e){const t=St.svg.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).text();if(typeof globalThis.DOMPurify<"u"&&typeof globalThis.DOMPurify.sanitize=="function")try{const u=new DOMParser().parseFromString(a,"image/svg+xml"),o=new XMLSerializer().serializeToString(u.documentElement);return{sanitized:globalThis.DOMPurify.sanitize(o,{USE_PROFILES:{svg:!0,svgFilters:!0}})}}catch{return{sanitized:globalThis.DOMPurify.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0}})}}else return{sanitized:a}})();return St.svg.set(e,{promise:n,ts:Date.now()}),n}function Ds(e){const t=St.img.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).blob();return{blobUrl:URL.createObjectURL(a)}})();return St.img.set(e,{promise:n,ts:Date.now()}),n}function ks(e){const t=St.lot.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).arrayBuffer(),i=new Uint8Array(a);if(i.length>=4&&i[0]===80&&i[1]===75&&i[2]===3&&i[3]===4||e.endsWith(".lottie"))return{kind:"zip",blobUrl:URL.createObjectURL(new Blob([a],{type:"application/zip"}))};const o=new TextDecoder().decode(i);return{kind:"json",data:JSON.parse(o)}})();return St.lot.set(e,{promise:n,ts:Date.now()}),n}function ws(e){const t=St.spr.get(e);if(t)return t.promise;const n=(async()=>{const a=await(await Er(e)).blob();let i=null;try{i=await createImageBitmap(a)}catch{i=null}const{imgEl:u,width:o,height:l}=await new Promise((c,f)=>{const d=URL.createObjectURL(a),m=new Image;m.crossOrigin="anonymous",m.onload=()=>{const h=m.naturalWidth,y=m.naturalHeight;c({imgEl:m,width:h,height:y})},m.onerror=()=>{URL.revokeObjectURL(d),f(new Error("Spritesheet image decode failed"))},m.src=d,m.decode?.().catch(()=>{})});return{imgEl:u,bitmap:i,width:o,height:l}})();return St.spr.set(e,{promise:n,ts:Date.now()}),n}function df(e){e.images?.forEach(t=>void Ds(t)),e.svgs?.forEach(t=>void Ps(t)),e.lotties?.forEach(t=>void ks(t)),e.sprites?.forEach(t=>void ws(t))}function hf(e){try{const t=document.createElement("link");t.rel="preconnect",t.href=e,t.crossOrigin="anonymous",document.head.appendChild(t);const n=document.createElement("link");n.rel="dns-prefetch",n.href=e,document.head.appendChild(n)}catch(t){console.log("error in injectPreconnect",t)}}function Ms(e){return new URL(e,document.baseURI).toString()}function mf(e,t){const n=document.head.querySelectorAll('link[rel="preload"]');for(const r of n)if((e?r.as===e||r.getAttribute("as")===e:!0)&&r.href===t)return!0;return!1}function jn(e,t,n,r){const a=Ms(n),i=`${e}|${t??""}|${a}`;if(kr.has(i))return;if(mf(t,a)){kr.add(i);return}const u=document.createElement("link");u.rel=e,t&&(u.as=t),u.href=a,u.crossOrigin="anonymous",r&&(u.type=r),u.setAttribute("data-chatsystem-preload","1"),document.head.appendChild(u),kr.add(i)}function pf(e){const t=u=>Array.from(new Set((u??[]).map(Ms))),n=t(e.images),r=t(e.svgs),a=t(e.lotties),i=t(e.sprites);n.forEach(u=>jn("preload","image",u)),r.forEach(u=>jn("preload","fetch",u,"image/svg+xml")),a.forEach(u=>jn("preload","fetch",u,"application/zip")),i.forEach(u=>jn("preload","fetch",u))}function Ef(e){const{manifest:t,origins:n}=bf(e);n.forEach(hf),pf(t),df(t)}function bf(e){const t=Tf(e),n=new Set,r=new Set,a=new Set,i=new Set;for(const{url:l,mode:c}of t)switch(gf(c,l)){case"svg":r.add(l);break;case"lottie":a.add(l);break;case"spritesheet":i.add(l);break;case"image":n.add(l);break}const u={images:Array.from(n),svgs:Array.from(r),lotties:Array.from(a),sprites:Array.from(i)},o=Af(u);return{manifest:u,origins:o}}function Tf(e){if(!e?.agent?.display)return[];const t=e.agent.display,n=[t.launcher,t.assistant,t.search].filter(Boolean),r=[];for(const a of n)a?.assetUrl&&r.push({url:a.assetUrl,mode:a.mode});return r}function gf(e,t){if(e)switch(e){case"svg":return"svg";case"lottie":return"lottie";case"spritesheet":return"spritesheet";case"image":return"image";case"video":return"video"}try{const r=new URL(t,document.baseURI).pathname.toLowerCase();if(r.endsWith(".svg"))return"svg";if(r.endsWith(".lottie")||r.endsWith(".zip")||r.endsWith(".json"))return r.endsWith(".json"),"lottie";if(/\.(png|webp|jpg|jpeg|gif|avi,ef)$/.test(r))return"image";if(/\.(mp4|webm|mov|m4v|ogg)$/.test(r))return"video"}catch(n){console.log("error in normalizeKind:",n)}return"unknown"}function Af(e){const t=new Set,n=r=>{if(r)try{const a=new URL(r,document.baseURI);t.add(`${a.protocol}//${a.host}`)}catch(a){console.log("error in uniqueOriginsFromManifest",a)}};return(e.images??[]).forEach(n),(e.svgs??[]).forEach(n),(e.lotties??[]).forEach(n),(e.sprites??[]).forEach(n),Array.from(t)}const _f=({children:e,appToken:t,agentId:n})=>{var r=navigator.language;console.log("App boot"),console.log("Brower language",r);const a=of(r),{appCurrentLang:i,handleSetContextCurrentLang:u}=nf(mr,a),o={appCurrentLang:i,setAppCurrentLang:u},l=uf(),{contextCompanySettings:c,contextInitialChatbotStartingText:f}=lf({agentId:n,appToken:t,onFetched:l.setHasFetchedSettings});return Ef(c.companySettings),cf(c.companySettings?.agent?.display?.CSSRules,{id:`${n}`},l.setHasDisplayedCss),console.log("hasDIsplayedCss",l.appInternalContext.hasDisplayedCSS),P.jsx(P.Fragment,{children:P.jsx(Qc,{locale:i?.locale,messages:i?.translatedText,children:P.jsx(Os.Provider,{value:o,children:P.jsx(vs.Provider,{value:l,children:P.jsx(pr.Provider,{value:c,children:P.jsx(Ls.Provider,{value:f,children:l.appInternalContext.hasDisplayedCSS&&e})})})})})})},yf=e=>Object.values(tn).includes(e),Sf=e=>yf(e)?e:(console.warn(`Display mode not valid. Using ${tn.LAUNCHER} as default.`),tn.LAUNCHER),xf=e=>Ve.createElement("svg",{fill:"#000000",height:"800px",width:"800px",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 330 330",xmlSpace:"preserve",...e},Ve.createElement("path",{id:"XMLID_102_",d:"M325.607,79.393c-5.857-5.857-15.355-5.858-21.213,0.001l-139.39,139.393L25.607,79.393 c-5.857-5.857-15.355-5.858-21.213,0.001c-5.858,5.858-5.858,15.355,0,21.213l150.004,150c2.813,2.813,6.628,4.393,10.606,4.393 s7.794-1.581,10.606-4.394l149.996-150C331.465,94.749,331.465,85.251,325.607,79.393z"})),Cf=({src:e})=>{const[t,n]=N.useState(null);return N.useEffect(()=>{let r=!1;return Ds(e).then(({blobUrl:a})=>{n(a)}).catch(()=>n(null)),()=>{t&&!r&&(URL.revokeObjectURL(t),r=!0)}},[e]),P.jsx("img",{src:t??e,decoding:"async",loading:"eager"})};function If(e){return!!e&&typeof e=="object"&&"blob"in e&&e.blob instanceof Blob}function Nf({src:e,autoplay:t=!0,loop:n=!0,className:r,style:a,placeholder:i,fallback:u,onLoaded:o,onError:l}){const[c,f]=N.useState({kind:"loading"});return N.useEffect(()=>{let d=null,m=!1;return f({kind:"loading"}),ks(e).then(async h=>{if(!m)if(h.kind==="zip"){const y=If(h)?h.blob:await(await fetch(h.blobUrl)).blob();d=URL.createObjectURL(y),f({kind:"lottieZip",blobUrl:d}),o?.(d)}else f({kind:"json",data:h.data}),o?.(h.data)}).catch(h=>!m&&(f({kind:"error",err:h}),l?.(h))),()=>{m=!0,d&&URL.revokeObjectURL(d)}},[e]),c.kind==="loading"?P.jsx("div",{className:"flex items-center justify-center rounded-xl border border-dashed p-6 text-sm opacity-70 "+(r??""),style:{minHeight:96,...a},children:i??"Loading animation…"}):c.kind==="error"?P.jsx("div",{className:"flex items-center justify-center rounded-xl border p-6 text-sm text-red-600 "+(r??""),style:{minHeight:96,...a},children:u??"Failed to load animation"}):c.kind==="json"?P.jsx(xl,{animationData:c.data,loop:n,autoplay:t,className:r,style:a,rendererSettings:{preserveAspectRatio:"xMidYMid meet"}}):P.jsx(Cl.DotLottieReact,{src:c.blobUrl,loop:n,autoplay:t,className:r,style:a})}async function Of(e,t={}){const{minPeriod:n=8,maxPeriod:r=Math.floor(Math.min(e.width,e.height)/2),gutterSearchRadius:a=3,debug:i=!1}=t;if(e.width<n*2||e.height<n*2)return i&&console.warn("detectGrid: image too small"),null;const u=document.createElement("canvas");u.width=e.naturalWidth,u.height=e.naturalHeight;const o=u.getContext("2d");if(!o)return null;o.drawImage(e,0,0);const{data:l}=o.getImageData(0,0,u.width,u.height),c=u.width,f=u.height,d=new Uint8ClampedArray(c*f);for(let Y=0;Y<f;Y++){let F=Y*c;for(let B=0;B<c;B++){const G=(F+B)*4;d[F+B]=.299*l[G]+.587*l[G+1]+.114*l[G+2]|0}}const m=new Float32Array(c),h=new Float32Array(f);for(let Y=1;Y<c-1;Y++){let F=0;for(let B=0;B<f;B++){const G=B*c+Y,$=d[G+1]-d[G-1];F+=Math.abs($)}m[Y]=F}for(let Y=1;Y<f-1;Y++){let F=0;for(let B=0;B<c;B++){const G=Y*c+B,$=d[G+c]-d[G-c];F+=Math.abs($)}h[Y]=F}const y=vi(m,n,Math.min(r,c/2)),A=vi(h,n,Math.min(r,f/2));if(!y||!A)return i&&console.warn("detectGrid: could not find periods"),null;const R=Math.max(1,Math.round(c/y)),S=Math.max(1,Math.round(f/A)),v=Pi(m,y,R,a),O=Pi(h,A,S,a),w=Math.max(1,y-v),C=Math.max(1,A-O);if(w*R>c+2||C*S>f+2)return i&&console.warn("detectGrid: sanity check failed"),null;const I=ba(m,60),W=ba(h,60),se=Math.max(0,Di(m,I)),ne=Math.max(0,Di(h,W));return i&&console.log({periodX:y,periodY:A,columns:R,rows:S,gutterX:v,gutterY:O,frameWidth:w,frameHeight:C,originX:se,originY:ne}),{columns:R,rows:S,frameWidth:w,frameHeight:C,gutterX:v,gutterY:O,originX:se,originY:ne}}function vi(e,t,n){const r=Bs(e);let a=0;for(let h=0;h<e.length;h++){const y=e[h]-r;a+=y*y}if(a===0)return null;const i=new Float32Array(n+1);let u=0,o=-1/0;for(let h=t;h<=n;h++){let y=0;for(let R=0;R+h<e.length;R++)y+=(e[R]-r)*(e[R+h]-r);const A=y/a;i[h]=A,A>o&&(o=A,u=h)}if(u<=t||u>=n)return u||null;const l=i[u-1],c=i[u],f=i[u+1],d=l-2*c+f,m=d===0?0:.5*(l-f)/d;return u+m}function Pi(e,t,n,r){const a=[];for(let o=1;o<n;o++){const l=o*t;let c=1/0,f=l;for(let d=-r;d<=r;d++){const m=l+d;if(m<=0||m>=e.length)continue;const h=e[m];h<c&&(c=h,f=m)}a.push(f)}if(a.length<1)return 0;let i=[];for(const o of a){const l=e[o]*1.5+ba(e,10)*.5;let c=o,f=o;for(;c>1&&e[c-1]<=l;)c--;for(;f<e.length-2&&e[f+1]<=l;)f++;i.push(Math.max(0,f-c+1))}const u=Math.round(Bs(i));return Math.max(0,Math.min(u,Math.floor(t/4)))}function Bs(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}function ba(e,t){const n=Array.from(e);n.sort((a,i)=>a-i);const r=Math.max(0,Math.min(n.length-1,Math.floor(t/100*n.length)));return n[r]}function Di(e,t){for(let n=0;n<e.length;n++)if(e[n]>t)return n;return 0}function Lf(e,t,n,r,a){const{data:i}=e.getImageData(t,n,r,a);let u=0;for(let o=3;o<i.length;o+=4)u+=i[o];return u/(255*(i.length/4))<.03}const Rf=N.forwardRef(function({src:t,frameWidth:n,frameHeight:r,columns:a,rows:i,gutterX:u=0,gutterY:o=0,frameCount:l,atlasFrames:c,fps:f=12,autoplay:d=!0,loop:m=!0,startFrame:h=0,direction:y="forward",scale:A=1,backgroundColor:R,className:S,style:v,pauseWhenHidden:O=!1,onLoad:w,onEnd:C,onFrame:I},W){const se=N.useRef(null),ne=N.useRef(null),[Y,F]=N.useState(null),[B,G]=N.useState(null),[$,X]=N.useState(null),[oe,pe]=N.useState(!1),[ve,Le]=N.useState(!!d),[p,H]=N.useState(h),Q=N.useRef(1),[T,q]=N.useState(null),Z=Math.max(1,Math.floor(typeof window<"u"&&window.devicePixelRatio||1));N.useEffect(()=>{let ce=!1;return pe(!1),ws(t).then(({imgEl:Ie,bitmap:Ee})=>{ce||(F(Ie),G(Ee),X({w:Ie.naturalWidth,h:Ie.naturalHeight}),pe(!0),w?.())}).catch(()=>{}),()=>{ce=!0}},[t,w]),N.useEffect(()=>{let ce=!1;return(async()=>{if(!Y)return;if(c&&c.length){q(null);return}if(!(!n||!r||!a||!i)){q(null);return}const Ee=await Of(Y,{debug:!0});ce||(Ee?q({frameWidth:Ee.frameWidth,frameHeight:Ee.frameHeight,columns:Ee.columns,rows:Ee.rows,gutterX:Ee.gutterX,gutterY:Ee.gutterY}):(q(null),console.warn("RemoteSpritesheet: auto-detect failed; please provide grid props.")))})(),()=>{ce=!0}},[Y,c,n,r,a,i]);const z=T?.frameWidth??n,K=T?.frameHeight??r,te=T?.columns??a,ie=T?.rows??i,J=T?.gutterX??u,_e=T?.gutterY??o,j=N.useMemo(()=>{if(c&&c.length>0)return{cols:0,rows:0};if(!$||!z||!K)return{cols:0,rows:0};const ce=te??Math.floor(($.w+J)/(z+J)),Ie=ie??Math.floor(($.h+_e)/(K+_e));return{cols:Math.max(0,ce),rows:Math.max(0,Ie)}},[c,$,z,K,te,ie,J,_e]),xe=N.useMemo(()=>{if(c?.length)return c;if(!z||!K)return[];const{cols:ce,rows:Ie}=j;if(!ce||!Ie)return[];const Ee=Math.min(l??ce*Ie,ce*Ie),be=[];for(let Ne=0;Ne<Ee;Ne++){const Fe=Ne%ce,we=Math.floor(Ne/ce),qe=T?.originX??0,Nr=T?.originY??0,L=qe+Fe*(z+J),U=Nr+we*(K+_e);be.push({x:L,y:U,w:z,h:K})}if(Y&&be.length){const Ne=document.createElement("canvas");Ne.width=Y.naturalWidth,Ne.height=Y.naturalHeight;const Fe=Ne.getContext("2d");if(Fe){Fe.drawImage(Y,0,0);let we=be.length;for(;we>0&&Lf(Fe,be[we-1].x,be[we-1].y,be[we-1].w,be[we-1].h);)we--;return be.slice(0,we)}}return be},[c,j,l,z,K,J,_e,Y,T?.originX,T?.originY]),ke=()=>{const ce=se.current;if(!ce||xe.length===0)return;const Ie=xe[Math.max(0,Math.min(p,xe.length-1))],Ee=Math.max(1,Math.round(Ie.w*A)),be=Math.max(1,Math.round(Ie.h*A));ce.style.width=Ee+"px",ce.style.height=be+"px",ce.width=Ee*Z,ce.height=be*Z};N.useEffect(()=>{ke()},[oe,A,xe.length,Z,p]);const Ce=ce=>{const Ie=B??Y??null,Ee=se.current;if(!Ee||!Ie||xe.length===0)return;const be=Ee.getContext("2d");if(!be)return;be.save(),be.setTransform(1,0,0,1,0,0),be.clearRect(0,0,Ee.width,Ee.height),R&&(be.fillStyle=R,be.fillRect(0,0,Ee.width,Ee.height));const Ne=xe[ce];be.scale(Z,Z),be.drawImage(Ie,Ne.x,Ne.y,Ne.w,Ne.h,0,0,Math.round(Ne.w*A),Math.round(Ne.h*A)),be.restore()};return N.useEffect(()=>{if(!oe||xe.length===0)return;let ce=performance.now();const Ie=1e3/Math.max(1,Math.min(120,f)),Ee=be=>{if(ne.current=requestAnimationFrame(Ee),!ve){Ce(p);return}const Ne=be-ce;if(Ne<Ie){Ce(p);return}ce=be-Ne%Ie,H(Fe=>{const we=xe.length-1;let qe=Fe;return y==="forward"?qe=Fe+1:y==="backward"?qe=Fe-1:((Fe>=we&&Q.current===1||Fe<=0&&Q.current===-1)&&(Q.current*=-1),qe=Fe+Q.current),(qe>we||qe<0)&&(m?qe=y==="backward"?we:0:(qe=Math.max(0,Math.min(qe,we)),Le(!1),C?.())),qe})};return ne.current=requestAnimationFrame(Ee),()=>{ne.current&&cancelAnimationFrame(ne.current)}},[oe,f,ve,m,y,xe.length,p]),N.useEffect(()=>{Ce(p),I?.(p)},[p,oe,A,Z]),N.useEffect(()=>{if(!O)return;const ce=()=>{document.hidden&&Le(!1)};return document.addEventListener("visibilitychange",ce),()=>document.removeEventListener("visibilitychange",ce)},[O]),N.useImperativeHandle(W,()=>({play:()=>Le(!0),pause:()=>Le(!1),toggle:()=>Le(ce=>!ce),gotoFrame:ce=>H(()=>Math.max(0,Math.min(ce,Math.max(0,xe.length-1)))),isPlaying:()=>ve,currentFrame:()=>p}),[ve,p,xe.length]),P.jsx("div",{className:S,style:v,children:P.jsx("canvas",{ref:se,"aria-label":"spritesheet animation"})})});function vf({url:e,className:t}){const[n,r]=N.useState(""),[a,i]=N.useState(null);return N.useEffect(()=>{let u=!1;return Ps(e).then(({sanitized:o})=>{u||(r(o),i(null))}).catch(o=>!u&&i(o.message??"Failed to load")),()=>{u=!0}},[e]),a?P.jsxs("div",{className:t,role:"alert",children:["Couldn’t load SVG: ",a]}):n?P.jsx("div",{className:t,dangerouslySetInnerHTML:{__html:n}}):P.jsx("div",{className:t})}const $a=({facet:e})=>{const{mode:t,assetUrl:n}=e;return P.jsxs("div",{className:"assetContainer",children:[t===Ge.AgentDisplayFacetModeType.LOTTIE&&P.jsx(Nf,{src:n,autoplay:!0,onError:r=>console.error(r)}),t===Ge.AgentDisplayFacetModeType.SVG&&P.jsx("div",{children:P.jsx(vf,{url:n})}),t===Ge.AgentDisplayFacetModeType.IMAGE&&P.jsx(Cf,{src:n}),t===Ge.AgentDisplayFacetModeType.SPRITESHEET&&P.jsx(Rf,{src:n})]})},Pf=({isWidgetOpen:e,setIsWidgetOpen:t})=>{const{companySettings:n}=N.useContext(pr);return P.jsxs("div",{className:`launcher
|
|
37
37
|
fixed
|
|
38
38
|
z-[999999999]
|
|
39
39
|
transition
|