(e=>{let t=document.body.style.overflow,s=e.vercelDomainForImageProxy,o=e,r=o.profileImageUrl,i=o.replicaUuid,n=o.replicaSlug,a=`${o.iframeBaseUrl}/${o.replicaUuid}${o.isPreview?"?isPreview=true":""}`,d="var(--sensay-widget-primary-color)",l="var(--sensay-widget-foreground-color)",u="var(--sensay-widget-background-color)";function c(){var e;let s=o.widgetPosition,n=o.suggestedQuestions;if(!i)return null;let c=document.createElement("div");c.id="sensay-widget-container";let p=c.attachShadow({mode:"open"}),y=function(e){let t=document.createElement("div");return t.id="sensay-widget",t.dataset.position=e,t}(s);p.appendChild(y),function(e,t={primaryColor:"#000000",foregroundColor:"#000000",backgroundColor:"#FFFFFF"}){let s={width:82,height:82},r=document.createElement("style");r.textContent=` :host { --sensay-widget-primary-color: ${t.primaryColor}; --sensay-widget-foreground-color: ${t.foregroundColor}; --sensay-widget-background-color: ${t.backgroundColor}; } :host #sensay-widget { ${o.isPreview?"position: absolute;":"position: fixed;"} display: flex; flex-direction: column; gap: 0px; max-width: 100%; max-height: 100vh; z-index: 9999; pointer-events: none; padding: 8px; } :host #sensay-widget[data-position='BOTTOM_LEFT'], :host #sensay-widget[data-position='CENTER_LEFT'], :host #sensay-widget[data-position='TOP_LEFT'] { align-items: flex-start; } :host #sensay-widget[data-position='BOTTOM_RIGHT'], :host #sensay-widget[data-position='CENTER_RIGHT'], :host #sensay-widget[data-position='TOP_RIGHT'] { align-items: flex-end; } :host #sensay-widget[data-position='BOTTOM_RIGHT'] { bottom: 0; right: 0; } :host #sensay-widget[data-position='BOTTOM_LEFT'] { bottom: 0; left: 0; } :host #sensay-widget[data-position='TOP_RIGHT'] { top: 0; right: 0; } :host #sensay-widget[data-position='TOP_LEFT'] { top: 0; left: 0; } :host #sensay-widget[data-position='CENTER_RIGHT'] { right: 0; top: 50%; transform: translateY(-50%); } :host #sensay-widget[data-position='CENTER_LEFT'] { left: 0; top: 50%; transform: translateY(-50%); } @media (min-width: 640px) { :host #sensay-widget { padding: 32px; } :host #sensay-iframe-container.visible { z-index: 1000; } } :host #sensay-chat-button { padding: 0; background-color: ${d}; color: ${u}; border: 2px solid color-mix(in srgb, ${u} 10%, ${d}); border-radius: 50%; width: ${s.width}px; height: ${s.height}px; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease-out; cursor: pointer; -webkit-tap-highlight-color: transparent; backface-visibility: hidden; will-change: transform; overflow: hidden; flex-shrink: 0; animation: sensay-widget_buttonFadeIn 0.15s ease-out forwards; box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.30); pointer-events: auto; order: 3; } @keyframes sensay-widget_buttonFadeIn { from { opacity: 0; } to { opacity: 1; } } :host #sensay-chat-button svg { transition: all 0.15s ease-out; } :host #sensay-chat-button:hover { background-color: color-mix(in srgb, ${d} 80%, white); border: 2px solid color-mix(in srgb, ${u} 20%, ${d}); } :host #sensay-chat-button:active { border: 2px solid color-mix(in srgb, ${u} 50%, ${d}); } :host #sensay-chat-button.open { transform: scale(${52/s.width}); background-color: ${u}; color: ${l}; border: 2px solid color-mix(in srgb, ${l} 10%, transparent); } @media (max-width: 640px) { :host #sensay-chat-button.open { display: none; } } :host #sensay-chat-button.open:hover { background-color: color-mix(in srgb, ${u} 80%, white); } :host #sensay-chat-button .chat-icon { display: block; } :host #sensay-chat-button .close-icon { display: none; } :host #sensay-chat-button.open .chat-icon { display: none; } :host #sensay-chat-button.open .close-icon { display: block; } :host #sensay-iframe-container { max-width: 100%; width: 372px; height: 500px; border-radius: 8px; display: flex; flex-direction: column; transition: opacity 0.15s ease-out; opacity: 0; box-shadow: 0px 2px 22px 0px rgba(0, 0, 0, 0.25); border: 1px solid color-mix(in srgb, ${l} 15%, transparent); order: 1; } :host #sensay-iframe-container.hidden { visibility: hidden; pointer-events: none; } :host #sensay-iframe-container.visible { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); } @media (max-width: 640px) { :host #sensay-iframe-container { position: fixed; top: 0; bottom: 0; right: 0; left: 0; width: 100%; height: 100dvh; border-radius: 0; border: none; z-index: 10000; } :host #sensay-iframe-container .sensay-iframe-container-inner { border-radius: 0; } } @media (min-width: 640px) { :host #sensay-iframe-container { height: 550px; width: 372px; } } :host .sensay-iframe-container-inner { border-radius: 8px; overflow: hidden; height: 100%; } :host #sensay-iframe { width: 100%; height: 100%; border: none; pointer-events: auto; } :host #sensay-chat-button .avatar-container { width: 100%; height: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none; } :host #sensay-chat-button:has(.avatar-container) { background-color: ${u}; border: 2px solid ${u}; } :host #sensay-suggested-questions-layout { display: flex; flex-direction: column; gap: 10px; order: 2; padding-bottom: 10px; } :host #sensay-suggested-questions-layout[data-show="false"] { display: none; } :host #sensay-suggested-questions-layout > button { pointer-events: auto; border-radius: 8px; box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.1); padding: 8px; cursor: pointer; width: fit-content; border: 1px solid color-mix(in srgb, ${d} 15%, transparent); background-color: color-mix(in srgb, ${u} 80%, transparent); color: color-mix(in srgb, ${l} 70%, transparent); font-size: 14px; gap: 8px; opacity: 0; display: flex; align-items: start; transform: translateY(20px); animation: sensay-widget_fadeInUp 0.15s ease-out forwards; max-width: 300px; min-width: 100px; backdrop-filter: blur(8px); transition: all 0.15s ease-in-out; user-select: none; text-align: left; } :host #sensay-suggested-questions-layout > button > span { text-align: left; overflow-wrap: break-word; word-break: normal; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; display: block; } :host #sensay-suggested-questions-layout > button:hover { border: 1px solid color-mix(in srgb, ${d} 30%, transparent); background-color: ${u}; color: ${l}; } :host #sensay-suggested-questions-layout svg { flex-shrink: 0; color: color-mix(in srgb, ${l} 40%, transparent); transition: all 0.15s ease-in-out; margin-top: 5px; } :host #sensay-suggested-questions-layout > button:hover svg { color: color-mix(in srgb, ${l} 70%, transparent); } @keyframes sensay-widget_fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } :host #sensay-widget[data-position='BOTTOM_RIGHT'] #sensay-suggested-questions-layout { align-items: flex-end; } `,e.appendChild(r)}(p,o);let{iframeContainer:f,iframe:b}=function(){let e=document.createElement("div");e.id="sensay-iframe-container";let t=document.createElement("div");t.className="sensay-iframe-container-inner";let s=document.createElement("iframe");return s.src=a,s.id="sensay-iframe",s.allow="clipboard-read; clipboard-write",t.appendChild(s),e.appendChild(t),{iframeContainer:e,iframe:s}}();f.classList.add("hidden"),this.messageManager=new w(b);let{chatButton:x}=function(e){let t=document.createElement("button");return t.id="sensay-chat-button",t.type="button",t.setAttribute("aria-label","Open chat"),m(t,o.showAvatarInLauncher,e),{chatButton:t}}(o.showAvatarInLauncher?o.profileImageUrl:void 0),v=function({chatButton:e,iframeContainer:s,shadow:i,messageManager:n}){let a=!1,d=!1;function l(){return window.innerWidth<640}return function(){if(a=!a,e.classList.toggle("open"),h(e,i,a,o.showAvatarInLauncher&&r),a&&!d&&(d=!0),a){l()&&(t=document.body.style.overflow,document.body.style.overflow="hidden"),s.classList.remove("hidden"),s.offsetHeight,s.classList.add("visible");let e=i.getElementById("sensay-suggested-questions-layout");e&&(e.dataset.show="false"),setTimeout(()=>{o.isPreview||n.sendMessageToIframe({messageType:"focus_input"})},150)}else{s.classList.remove("visible"),s.classList.add("hidden"),l()&&(document.body.style.overflow=t);let e=i.getElementById("sensay-suggested-questions-layout");e&&(!d||o.isPreview)&&!1!==o.showFloatingQuestions&&setTimeout(()=>{a||(e.dataset.show="true",e.style.pointerEvents="auto")},150)}}}({chatButton:x,iframeContainer:f,shadow:p,messageManager:this.messageManager}),C=function({suggestedQuestions:e,toggleChat:t}){let s=document.createElement("div");if(s.id="sensay-suggested-questions-layout",s.dataset.show="true",s.ariaLabel="Suggested Questions",!e||0===e.length)return s;for(let o=0;o{s.style.pointerEvents="none",t(),this.messageManager.sendMessageToIframe({messageType:"suggestedQuestion",data:r})}),s.appendChild(i)}return s}({suggestedQuestions:n,toggleChat:v});x.addEventListener("click",v),e=v,window.addEventListener("message",t=>{t.data&&"close_widget"===t.data.messageType&&e()},!1),y.appendChild(f),y.appendChild(x),o.showFloatingQuestions&&g(!0,y,C);let _=document.getElementById("sensay-widget-target");_?_.appendChild(c):document.body.appendChild(c),window.configSensayWidget=e=>{if((o={...o,...e}).primaryColor&&p.host.style.setProperty("--sensay-widget-primary-color",o.primaryColor),o.backgroundColor&&p.host.style.setProperty("--sensay-widget-background-color",o.backgroundColor),o.textColor&&p.host.style.setProperty("--sensay-widget-foreground-color",o.textColor),o.position&&(y.dataset.position=o.position),void 0!==o.showAvatarInLauncher||r){let e=p.getElementById("sensay-chat-button");if(e){m(e,o.showAvatarInLauncher,r);let t=e.classList.contains("open");h(e,p,t,o.showAvatarInLauncher&&r)}}void 0!==o.showFloatingQuestions&&g(o.showFloatingQuestions,y,C),this.messageManager.sendMessageToIframe({messageType:"config",data:o})};let k=window.innerWidth;!o.isPreview||k<640||f.classList.contains("visible")||v()}function p(){let e=document.getElementById("sensay-widget-container");return e?.parentNode&&e.parentNode.removeChild(e),document.body.style.overflow=t,function(){let e=`/${n}/embed-script.js`;for(let t of[`link[rel="preload"][href*="${e}"]`,`link[rel="preload"][href*="${i}"]`])for(let e of document.querySelectorAll(t))e.parentNode&&e.parentNode.removeChild(e);for(let t of[`script[src*="${e}"]`,`script[src*="${i}"]`])for(let e of document.querySelectorAll(t))e.parentNode&&e.parentNode.removeChild(e);window.initSensayWidget&&(window.initSensayWidget=void 0),window.unmountSensayWidget&&(window.unmountSensayWidget=void 0),window.initSensayWidgetPreview&&(window.initSensayWidgetPreview=void 0),window.unmountSensayWidgetPreview&&(window.unmountSensayWidgetPreview=void 0)}(),!0}function g(e,t,s){e?s.parentNode||t.appendChild(s):s.parentNode&&s.parentNode.removeChild(s)}function h(e,t,s,o){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(s?(e.style.backgroundColor=getComputedStyle(t.host).getPropertyValue("--sensay-widget-background-color"),e.style.color=getComputedStyle(t.host).getPropertyValue("--sensay-widget-foreground-color"),e.style.border=`2px solid color-mix(in srgb, ${getComputedStyle(t.host).getPropertyValue("--sensay-widget-foreground-color")} 10%, transparent)`):o?(e.style.backgroundColor=getComputedStyle(t.host).getPropertyValue("--sensay-widget-background-color"),e.style.border=`2px solid ${getComputedStyle(t.host).getPropertyValue("--sensay-widget-background-color")}`):(e.style.backgroundColor=getComputedStyle(t.host).getPropertyValue("--sensay-widget-primary-color"),e.style.color=getComputedStyle(t.host).getPropertyValue("--sensay-widget-background-color"),e.style.border=`2px solid color-mix(in srgb, ${getComputedStyle(t.host).getPropertyValue("--sensay-widget-background-color")} 10%, ${getComputedStyle(t.host).getPropertyValue("--sensay-widget-primary-color")})`))}function y(e,{viewBox:t,width:s,height:o}){let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("width",s),r.setAttribute("height",o),r.setAttribute("viewBox",t),r.style.fill="currentColor";let i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),r.appendChild(i),r}function m(e,t,o){for(;e.firstChild;)e.removeChild(e.firstChild);let r=y("M25 0.5H3.00002C2.33698 0.5 1.7011 0.763392 1.23225 1.23223C0.763414 1.70107 0.500022 2.33696 0.500022 3V23C0.498025 23.4761 0.63325 23.9427 0.889516 24.3439C1.14578 24.7452 1.51223 25.0641 1.94502 25.2625C2.27724 25.418 2.63944 25.4991 3.00627 25.5C3.5933 25.4985 4.16091 25.2895 4.60877 24.91L4.62377 24.8962L8.55877 21.5H25C25.6631 21.5 26.2989 21.2366 26.7678 20.7678C27.2366 20.2989 27.5 19.663 27.5 19V3C27.5 2.33696 27.2366 1.70107 26.7678 1.23223C26.2989 0.763392 25.6631 0.5 25 0.5ZM24.5 18.5H8.00002C7.64001 18.4994 7.29192 18.629 7.02002 18.865L3.50002 21.9037V3.5H24.5V18.5Z",{viewBox:"0 0 28 26",width:"28",height:"26"});r.classList.add("chat-icon"),r.style.fill="currentColor";let i=y("M27.0612 13.0612L17.0612 23.0612C16.9218 23.2011 16.7563 23.312 16.5739 23.3877C16.3916 23.4634 16.1961 23.5024 15.9987 23.5024C15.8013 23.5024 15.6058 23.4634 15.4235 23.3877C15.2411 23.312 15.0756 23.2011 14.9362 23.0612L4.9362 13.0612C4.6544 12.7794 4.49609 12.3972 4.49609 11.9987C4.49609 11.6002 4.6544 11.218 4.9362 10.9362C5.21799 10.6544 5.60018 10.4961 5.9987 10.4961C6.39721 10.4961 6.7794 10.6544 7.0612 10.9362L15.9999 19.875L24.9387 10.935C25.2205 10.6532 25.6027 10.4949 26.0012 10.4949C26.3997 10.4949 26.7819 10.6532 27.0637 10.935C27.3455 11.2168 27.5038 11.599 27.5038 11.9975C27.5038 12.396 27.3455 12.7782 27.0637 13.06L27.0612 13.0612Z",{viewBox:"0 0 32 32",width:"32",height:"32"});if(i.classList.add("close-icon"),i.style.fill="currentColor",t&&o){let t=document.createElement("div");t.classList.add("chat-icon","avatar-container"),t.style.backgroundImage=`url(${s}/_next/image?url=${o}&w=256&q=75)`,e.appendChild(t),e.appendChild(i)}else e.appendChild(r),e.appendChild(i)}o.isPreview?(window.initSensayWidgetPreview=c.bind(window),window.unmountSensayWidgetPreview=p.bind(window)):(window.initSensayWidget=c.bind(window),window.unmountSensayWidget=p.bind(window));class w{constructor(e,t="*"){this.iframe=e,this.isReady=!1,this.messageQueue=[],this.targetOrigin=t,this.setupMessageListener()}setupMessageListener(){window.addEventListener("message",e=>{e.data?.messageType==="iframe_ready"&&this.handleIframeReady()})}handleIframeReady(){this.isReady=!0,this.processQueue()}processQueue(){for(;this.messageQueue.length>0;){let e=this.messageQueue.shift();e&&this.sendMessageToIframe(e)}}sendMessageToIframe(e){if(!this.isReady){this.messageQueue.push(e);return}this.iframe.contentWindow?.postMessage(e,this.targetOrigin)}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c();let f=document.createElement("link");f.rel="preload",f.href=a,f.as="document",f.crossOrigin="anonymous",document.head.appendChild(f)})({ replicaUuid: '34110564-c55e-418d-b159-c93a56014b52', replicaSlug: 'image-pro', widgetPosition: 'BOTTOM_RIGHT', iframeBaseUrl: 'https://chat-widget.sensay.io', primaryColor: '#000000', foregroundColor: '#000000', backgroundColor: '#FFFFFF', profileImageUrl: 'https://xotqxvmmnunwfsaemqfy.supabase.co/storage/v1/object/public/persona_images/34110564-c55e-418d-b159-c93a56014b52/profile-2025-02-14T19:39:08.896Z.jpeg', hideBranding: false, showAvatarInLauncher: false, suggestedQuestions: [], showFloatingQuestions: true, isPreview: false, vercelDomainForImageProxy: 'https://chat-widget.sensay.io' })