arcy.js 0.1.1 → 0.1.2

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.
@@ -0,0 +1,568 @@
1
+ (function(){'use strict';/* arcy.js — https://arcyai.com */
2
+ function h(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function zt(){let e=new Map;function t(r,o){if(typeof o!="function")return h(`on("${r}") needs a function. Ignoring.`),()=>{};let i=e.get(r);return i||(i=new Set,e.set(r,i)),i.add(o),()=>{i.delete(o);}}function n(r){let o=e.get(r);if(o)for(let i of [...o])try{i();}catch(s){h(`A "${r}" handler threw. ${String(s)}`);}}return {on:t,emit:n}}function gt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var Xt=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],Pr="[masked]";function Me(e){return Xt.some(t=>(t.lastIndex=0,t.test(e)))}var yt=4096,Lr=100,Or=64;function ze(e){if(!e)return;let t=e.slice(0,yt);if(e.length>yt){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,yt-Lr):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of Xt)n=n.replace(r,Pr);return n.slice(0,80)}}function jt(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var Mr=["data-testid","data-test","data-cy","id","name","aria-label"],Fr=["data-testid","data-test","data-cy"],Nr=64;function Dr(e){for(let t of Fr){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Nr)&&!Me(r))return r}}var Br=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function Hr(e){let t=gt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let o of Mr){let i=t.getAttribute(o);if(i===null||o==="id"&&!jt(i))continue;let s=ze(i);if(s!==void 0)return {tag:n,attr:o,value:s}}let r=t.getAttribute("role");if(r!==null&&Br.has(r))return {tag:n,attr:"role",value:r};t=gt(t);}}function Ur(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function qt(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:Ur(e)},n=ze(e.textContent);n!==void 0&&(t.text=n);let r=ze(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let o=ze(e.getAttribute("placeholder"));o!==void 0&&(t.placeholder=o);let i=e.getAttribute("id");i!==null&&jt(i)&&!Me(i)&&(t.id=i);let s=e.getAttribute("role");if(s!==null){let l=s.trim();l!==""&&l.length<=Or&&!Me(l)&&(t.role=l);}let f=Dr(e);f!==void 0&&(t.testId=f);let a=Hr(e);return a!==void 0&&(t.ancestorTag=a.tag,t.ancestorAttr=a.attr,t.ancestorValue=a.value),t}var Jt="arcy.picker.73f47221b73c.js",Qt="arcy.chat.39921845e233.js",Zt="arcy.flow.fef131718e42.js";var Vr=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{12,})$/i,Wr=/^[^@\s/]+@[^@\s/]+\.[^@\s/]+$/;function $r(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function en(e){return e.length===0?false:Vr.test(e)?true:Wr.test($r(e))}function ke(e){let n=e.split("/").map(r=>en(r)?":id":r).join("/");for(;n.length>1&&n.charAt(n.length-1)==="/";)n=n.slice(0,-1);return n.length===0?"/":n}function Kr(e){if(e.length===0)return "";let t=[];for(let n of e.split("&")){if(n.length===0)continue;let r=n.indexOf("="),o=r===-1?n:n.slice(0,r);if(o.length===0)continue;let i=en(o)?":id":o;t.indexOf(i)===-1&&t.push(i);}return t.length===0?"":(t.sort(),`?${t.join("&")}`)}function Gr(e,t){try{let n=new URL(e,t??void 0);return {path:n.pathname,query:n.search.slice(1)}}catch{let n=e.split("#")[0]??"";if(!n.startsWith("/"))return null;let r=n.indexOf("?");return r===-1?{path:n,query:""}:{path:n.slice(0,r),query:n.slice(r+1)}}}function Fe(e,t){if(typeof e!="string"||e.length===0)return null;let n=Gr(e,t);if(n===null)return null;let r=ke(n.path);if(!r)return null;if(r.length>=2048)return r.slice(0,2048);let o=Kr(n.query);return o.length===0||r.length+o.length>2048?r:r+o}function Yr(e){try{let n=e.currentScript?.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let o=0;o<r.length;o++){let i=r[o].nonce;if(typeof i=="string"&&i.length>0)return i}return null}catch{return null}}var zr=typeof document<"u"?Yr(document):null;function jr(){return zr}function ve(e){let t=jr();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var qr="https://docs.arcyai.com/troubleshooting#content-security-policy";function bt(e){try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch{return null}}function Jr(e){let t=bt(e.apiBase),n=e.cdnBase?bt(e.cdnBase):null,r=["This page's Content-Security-Policy is blocking part of the ARCY widget.","Add these to the policy your app sends:",""];return n&&r.push(` script-src ${n}`),t&&(r.push(` connect-src ${t}`),r.push(` font-src ${t}`),r.push(` img-src ${t} blob:`)),r.push(" style-src 'unsafe-inline', or a nonce on the script that loads ARCY"),r.push(""),r.push("To allow none of them, proxy a path on your own domain to the API and pass it as arcy.init(token, { apiBase })."),r.push(e.docsUrl??qr),r.join(`
3
+ `)}function tn(e,t){let n=[t.apiBase,t.cdnBase].filter(o=>typeof o=="string"&&o.length>0).map(bt).filter(o=>o!==null),r=()=>{};try{let o=i=>{let s=i.blockedURI;(s==="inline"||n.some(a=>s?.startsWith(a)))&&(r(),h(Jr(t)));};e.document.addEventListener("securitypolicyviolation",o),r=()=>{try{e.document.removeEventListener("securitypolicyviolation",o);}catch{}};}catch{}return ()=>r()}var wt="__arcyPicker";var Ne=2,nn="arcy:design-mode:ready",rn="arcy:design-mode:pick",on="arcy:design-mode:exit",sn="arcy:design-mode:screenshot";var cn="arcy-widget",an="data-arcy",vt="2147483000",Qr=[["position","fixed"],["inset","0"],["z-index",vt],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],Zr=[["margin","0"],["padding","0"]],ln="data-arcy-style",De=new Map;function eo(e=cn){let t=De.get(e);return t!==void 0&&t.host.isConnected}function Xe(e={}){if(typeof document>"u")return null;let t=e.id??cn,n=e.container;if(eo(t))return h("This ARCY surface is already on this page. Ignoring the second mount."),null;De.delete(t);let r=n??document.body??document.documentElement;if(!r)return h("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let o=document.querySelectorAll(`[${an}]`);for(let i=0;i<o.length;i+=1)if(o[i]?.id===t)return h("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let o=document.createElement("div");o.id=t,o.setAttribute(an,"");for(let[a,l]of Qr)o.style.setProperty(a,l,"important");for(let[a,l]of Zr)o.style.setProperty(a,l);let i=o,s=!1;try{o.attachShadow&&(i=o.attachShadow({mode:"closed"}),s=!0);}catch{}r.appendChild(o),no(o);let f={host:o,root:i,isolated:s,destroy(){try{o.parentNode&&o.parentNode.removeChild(o);}catch{}De.get(t)===f&&De.delete(t);}};return De.set(t,f),f}catch(o){return h(`The widget could not mount. ${String(o)}`),null}}var to=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function no(e){let t=n=>{try{n.stopPropagation();}catch{}};for(let n of to)try{e.addEventListener(n,t);}catch{}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||St(e.ownerDocument,e);});}catch{}}function St(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch{}}function un(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${ln}]`);if(n)return n.textContent=`${n.textContent??""}
4
+ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return ve(r),r.setAttribute(ln,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return h(`The widget could not apply its styles. ${String(n)}`),false}}var ro="arcy-picker-notice",oo=[["left","50%"],["bottom","24px"]],io=[["transform","translateX(-50%)"],["box-sizing","border-box"],["max-width","min(520px, calc(100vw - 32px))"],["padding","14px 16px"],["border-radius","12px"],["background","#101828"],["color","#ffffff"],["font",'13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'],["box-shadow","0 8px 24px rgba(16, 24, 40, 0.28)"]],so=[["font-weight","600"],["margin-bottom","4px"]],ao=[["color","#d0d5dd"]],lo=[["appearance","none"],["margin-top","10px"],["border","1px solid rgba(255, 255, 255, 0.25)"],["border-radius","999px"],["background","transparent"],["color","#ffffff"],["font","inherit"],["padding","4px 12px"],["cursor","pointer"]];function je(e,t){for(let[n,r]of t)e.style.setProperty(n,r);}var dn=false;function qe(e){if(dn)return;let t=null;try{if(t=Xe({id:ro}),!t)return;dn=!0;let n=t.host.ownerDocument,r=n.createElement("div");r.style.setProperty("position","absolute","important"),r.style.setProperty("pointer-events","auto","important");for(let[a,l]of oo)r.style.setProperty(a,l,"important");je(r,io);let o=n.createElement("div");je(o,so),o.textContent="ARCY element picker did not start";let i=n.createElement("div");je(i,ao),i.textContent=e;let s=n.createElement("button");s.type="button",je(s,lo),s.textContent="Dismiss";let f=t;s.addEventListener("click",()=>{try{f.destroy();}catch{}}),r.append(o,i,s),t.root.appendChild(r);}catch{try{t?.destroy();}catch{}}}function ce(e){h(e),qe(e);}var Et="arcy_picker",co="/api/v1/sdk/tagging/verify",pn="https://cdn.arcyai.com";var uo=15e3,fo=1e4;function po(e,t){return Tt(e)??Tt(t)}function Tt(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Et);return t&&t.length>0?t:null}catch{return null}}function mo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Et),r=Tt(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Et),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch{}}async function ho(e){let{apiBase:t,token:n,nonce:r,fetchImpl:o,timeoutMs:i=fo,setTimeoutImpl:s=(l,d)=>setTimeout(l,d)}=e;if(!o)return null;let f=async()=>{try{let l=await o(`${t}${co}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r}),credentials:"omit"});if(!l.ok)return null;let d=await l.json();if(d?.ok!==!0)return null;let b=go(d.returnOrigin);return b?{returnOrigin:b,screenshotsEnabled:d.elementScreenshotsEnabled!==!1}:(ce("This ARCY server has not been told where its dashboard lives, so a pick would have nowhere to go. Set FRONTEND_DASHBOARD_URL and try again."),null)}catch{return null}},a=new Promise(l=>{try{s(()=>l(null),i);}catch{}});return Promise.race([f(),a])}function go(e){if(typeof e!="string"||e.length===0)return null;try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch{return null}}function mn(e,t,n,r){return new Promise(o=>{let i=false,s=null,f=p=>{i||(i=true,s&&(s.onload=null,s.onerror=null),o(p));},a=false,l=p=>{a||(a=true,ce(p));},d=()=>{let p;try{p=e[wt];}catch{return l("The element picker registration could not be read. Design mode is off."),null}if(!p)return null;if(typeof p.mount!="function")return l("The element picker registered something unusable. Design mode is off."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==2?(l(`The element picker on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to use design mode.`),null):p},b=p=>{try{let g=d();!g&&!a&&p(),f(g);}catch{f(null);}},v=false;try{v=e[wt]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;s=p.createElement("script"),ve(s),s.async=!0,s.src=`${t}/${Jt}`;let g=s.src;s.onload=()=>b(()=>ce("The element picker loaded but did not register. Design mode is off.")),s.onerror=()=>{try{ce(`Failed to load ${g}. Design mode is off. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}f(null);},(p.head||p.documentElement).appendChild(s);}catch(p){ce(`The element picker could not load. ${String(p)}`),f(null);return}try{r(()=>{i||ce("The element picker did not load in time. Design mode is off."),f(null);},n);}catch{}})}function yo(e){try{let t=e.location.pathname;return typeof t!="string"||!t.startsWith("/")?"/":ke(t)}catch{return "/"}}function bo(e){try{let t=e.opener;return !!t&&!t.closed}catch{return false}}function Je(e,t,n){try{let r=e.opener;if(!r||r.closed){h("The ARCY dashboard window is gone, so that pick could not be sent.");return}r.postMessage(n,t);}catch(r){h(`That pick could not be sent to the ARCY dashboard. ${String(r)}`);}}async function hn(e){try{let{win:t,token:n,apiBase:r,fetchImpl:o,onVerified:i,loadChunk:s,loadTimeoutMs:f=uo,setTimeoutImpl:a=(C,O)=>setTimeout(C,O)}=e,l=po(t.location.search,t.location.hash);if(!l)return "no_nonce";if(mo(t),!bo(t))return ce("This page was not opened by the ARCY dashboard, so a picked element would have nowhere to go. If you did start it from the flow builder, this site is severing the link back: a Cross-Origin-Opener-Policy header on this page (helmet sets one by default) does exactly that. Serve this page with Cross-Origin-Opener-Policy: unsafe-none while you author."),"no_opener";let d=await ho({apiBase:r,token:n,nonce:l,fetchImpl:o,setTimeoutImpl:a});if(!d)return ce("The design-mode link is invalid, expired, or could not be verified. It is single-use and short-lived, so a reload spends it. Check that this page carries the same environment Token as the flow you are editing, then open the picker again from the dashboard."),"rejected";try{i();}catch{}let b=await s(t,f,a);if(!b)return "load_failed";let{returnOrigin:v,screenshotsEnabled:p}=d;return b.mount({screenshotsEnabled:p,onPick:(C,O)=>{Je(t,v,{type:rn,protocol:Ne,target:C,route:yo(t),matchCount:O});},onScreenshot:C=>{Je(t,v,{type:sn,protocol:Ne,screenshot:C});},onExit:()=>{Je(t,v,{type:on,protocol:Ne});}})?(Je(t,v,{type:nn,protocol:Ne}),"active"):(ce("The element picker could not start. Design mode is off."),"mount_failed")}catch(t){return ce(`Design mode could not start. ${String(t)}`),"load_failed"}}var xt={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Q(e){return e?{getItem(t){try{return e.getItem(t)}catch{return null}},setItem(t,n){try{e.setItem(t,n);}catch{}},removeItem(t){try{e.removeItem(t);}catch{}}}:xt}function ue(){try{let e=globalThis.localStorage;return Q(e)}catch{return xt}}function _e(){try{let e=globalThis.sessionStorage;return Q(e)}catch{return xt}}function Z(e,t){let n=e.getItem(t);if(!n)return null;try{let r=JSON.parse(n);return !r||typeof r!="object"||Array.isArray(r)?null:r}catch{return null}}function J(e,t,n){try{e.setItem(t,JSON.stringify(n));}catch{}}var wo="arcy.preview.";function Qe(e,t=_e()){try{return Q(t).getItem(wo+e)!==null}catch{return false}}var kt="arcy_preview",vo=1,So="/api/v1/sdk/flows/preview/verify",Eo=1e4;function To(e,t){return Ct(e)??Ct(t)}function Ct(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(kt);return t&&t.length>0?t:null}catch{return null}}function xo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(kt),r=Ct(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(kt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch{}}function gn(e,t){try{let n=To(e.location.search,e.location.hash);return n?(xo(e),{kind:"nonce",nonce:n}):Qe(t)?{kind:"pending"}:null}catch{return null}}async function yn(e){let{apiBase:t,token:n,nonce:r,sessionToken:o,userTraits:i,fetchImpl:s,timeoutMs:f=Eo,setTimeoutImpl:a=(C,O)=>setTimeout(C,O)}=e;if(!s)return null;let l=C=>{h(C);try{qe(C);}catch{}return null},d=async()=>{try{let C=await s(`${t}${So}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r,...o?{sessionToken:o}:{},...i&&Object.keys(i).length>0?{userTraits:i}:{}}),credentials:"omit"});if(!C.ok)return l("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again.");let O=await C.json();return O?.ok!==!0||O.flow===void 0||O.flow===null?l("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again."):O.protocol!==vo?l("This page runs an older version of arcy.js than the dashboard expects. The preview cannot run until the script updates."):O.flow}catch{return l("ARCY could not reach its server to start this preview. Check the connection and press Preview again.")}},b=false,v,p=new Promise(C=>{try{v=a(()=>{b||(b=!0,C(l("ARCY took too long to verify this preview link. Close this tab and press Preview in the dashboard again.")));},f);}catch{}}),g=await Promise.race([d().then(C=>(b=true,C)),p]);try{v!==void 0&&clearTimeout(v);}catch{}return g}var At="https://api.arcyai.com",ko="/api/v1/sdk/session/init";var Co=["ON","REQUIRE_CONSENT","OFF"];function Ao(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,n=t.behavioralTelemetry,r=t.effectiveCustomization,o=t.widget,i=t.identity,s=i&&typeof i=="object"&&!Array.isArray(i)?i.accepted:void 0;return {sessionToken:typeof t.sessionToken=="string"?t.sessionToken:null,behavioralTelemetry:typeof n=="string"&&Co.indexOf(n)!==-1?n:null,customization:r&&typeof r=="object"&&!Array.isArray(r)?r:null,widget:o&&typeof o=="object"&&!Array.isArray(o)?o:null,identityAccepted:typeof s=="boolean"?s:null}}function bn(e){let{token:t,apiBase:n=At,setTimeoutImpl:r=(T,w)=>setTimeout(T,w),now:o=()=>Date.now(),retryDelayMs:i=2e3,attemptTimeoutMs:s=5e3,failureCooldownMs:f=3e4}=e,a=e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,l=`${n}${ko}`,d=null,b=null,v=null,p=null,g=0;function C(T){let w={publicKey:t,sessionId:T.sessionId};return T.visitorId!==void 0&&(w.visitorId=T.visitorId),T.userId!==void 0&&(w.userId=T.userId),T.userHash!==void 0&&(w.userHash=T.userHash),T.userTraits!==void 0&&(w.userTraits=T.userTraits),T.uiLanguage!==void 0&&(w.uiLanguage=T.uiLanguage),T.contentLocale!==void 0&&(w.contentLocale=T.contentLocale),T.viewerLocale!==void 0&&(w.viewerLocale=T.viewerLocale),T.route!==void 0&&(w.route=T.route),T.sessionContext!==void 0&&(w.sessionContext=T.sessionContext),JSON.stringify(w)}async function O(T){if(!a)return {ok:false,reason:"unusable"};let w;try{w=await a(l,{method:"POST",headers:{"Content-Type":"application/json"},body:T,credentials:"omit"});}catch{return null}if(w.status>=500)return null;if(!w.ok)return {ok:false,reason:"rejected"};let _;try{_=await w.json();}catch{return {ok:false,reason:"unusable"}}let M=Ao(_);return M?{ok:true,config:M}:{ok:false,reason:"unusable"}}function k(T){return new Promise(w=>{try{r(()=>w(),T);}catch{w();}})}function Y(T){return Promise.race([O(T),k(s).then(()=>null)])}async function N(T){let w=await Y(T);return w||(await k(i),await Y(T)??{ok:false,reason:"network"})}return {async sync(T){let w=C(T);if(p&&w===b)return p;if(!p&&w===b&&d)return {ok:true,config:d};if(v&&v.json===w&&o()-v.at<f)return {ok:false,reason:"network"};b=w;let _=++g,M=N(w).then(S=>(_===g&&(S.ok?(d=S.config,v=null):(v={json:w,at:o()},b===w&&(b=null))),p===M&&(p=null),S));return p=M,M},config:()=>d}}var _t="__arcyChat";var wn=["image/png","image/jpeg","image/webp"],It="--_arcy-font-key",vn="arcy-chat-policy",Sn="arcy-bar-tray",Ze={historyTitle:"Recent chats",historyEmpty:"No conversations yet.",newChat:"New chat",flowsTitle:"What I can do",flowsEmpty:"Nothing to run yet.",collapse:"Collapse",back:"Back",closeSheet:"Close",settingsTitle:"Settings",dockChat:"Dock to the corner",dockChatHint:"Shrink ARCY to a button in the bottom-right corner.",language:"Language",openChat:"Open chat",moveBar:"Move the chat bar",send:"Send",flowRunning:"Running",flowStep:"Step {step} of {total}",flowStop:"Stop",flowFailed:"Sorry, I could not finish that for you this time. You can ask me here and I will help you do it.",attachMenu:"Add",attachImage:"Attach an image",removeImage:"Remove image",imageTooLarge:"That image is too large. Each image must be under 5 MB.",imageWrongType:"That file type is not supported. Use PNG, JPEG or WEBP.",imageTooMany:"You can attach up to 3 images.",imageFailed:"That image could not be uploaded. Please try again.",likeAnswer:"Good answer",dislikeAnswer:"Bad answer",answering:"Answering",aiDisclaimer:"{app} is AI and can make mistakes",consentNotice:"Your messages are processed to answer your question.",consentWithPolicy:"{policy}",disclaimerJoin:" \xB7 ",privacyPolicy:"Privacy Policy",poweredBy:"Powered by ARCY",genericError:"Something went wrong. Please try again.",userCapReached:"You've reached today's limit for questions. Please try again tomorrow.",imageConversation:"Image",searchedSourcesLabel:"Searched {count} sources",sourcesLabel:"Sources:",flowOfferHint:"You can do this in one click with the Quick Flow below.",fillConfirm:"Confirm",fillYes:"Yes",fillNo:"No",fillRequired:"This field needs an answer.",fillInvalidNumber:"Please enter a number.",fillNumberTooSmall:"Please enter {min} or more.",fillNumberTooLarge:"Please enter {max} or less.",fillInvalidEmail:"Please enter a valid email address.",fillInvalidUrl:"Please enter a valid link.",fillInvalidDate:"Please enter a valid date.",fillInvalidTime:"Please enter a valid time.",fillDateTooEarly:"Please pick {min} or later.",fillDateTooLate:"Please pick {max} or earlier.",fillTooLong:"Please keep it under {max} characters.",fillInvalidOption:"Please pick one of the options.",fillInvalid:"That does not look right. Please try again."};var Rt="https://cdn.arcyai.com";var _o=15e3;function Tn(e,t,n,r){return new Promise(o=>{let i=false,s=null,f=p=>{i||(i=true,s&&(s.onload=null,s.onerror=null),o(p));},a=false,l=p=>{a||(a=true,h(p));},d=()=>{let p;try{p=e[_t];}catch{return l("The chat panel registration could not be read. The panel will not open."),null}if(!p)return null;if(typeof p.mount!="function")return l("The chat panel registered something unusable. The panel will not open."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==4?(l(`The chat panel on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${4}. Update arcy.js to open the chat panel.`),null):p},b=p=>{try{let g=d();!g&&!a&&p(),f(g);}catch{f(null);}},v=false;try{v=e[_t]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;s=p.createElement("script"),ve(s),s.async=!0,s.src=`${t}/${Qt}`;let g=s.src;s.onload=()=>b(()=>h("The chat panel loaded but did not register. The panel will not open.")),s.onerror=()=>{try{h(`Failed to load ${g}. The chat panel will not open. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}f(null);},(p.head||p.documentElement).appendChild(s);}catch(p){h(`The chat panel could not load. ${String(p)}`),f(null);return}try{r(()=>{i||h("The chat panel did not load in time."),f(null);},n);}catch{}})}function xn(e){let{root:t,host:n,win:r=typeof window<"u"?window:void 0,loadChunk:o,loadTimeoutMs:i=_o,setTimeoutImpl:s=(L,B)=>setTimeout(L,B),onRequestClose:f,bar:a,apiBase:l,getSessionToken:d,getSessionId:b,getRoute:v,getMaxHeightPercent:p,onStartFlow:g,publicKey:C,getConversationId:O,setConversationId:k,touchConversation:Y,getVisitorId:N,onOrgCapExceeded:T,onStopFlow:w,track:_,getWidget:M,onSelectLocale:S}=e,I=t!==n,P=null,V=null,D=false,U=false;async function K(){if(!(P||D))return V||(V=(async()=>{if(r)try{let L=await o(r,i,s);if(!L||D)return;let B={root:t,host:n,isolated:I,onRequestClose:f,bar:a,apiBase:l,getSessionToken:d,getSessionId:b,getRoute:v,getMaxHeightPercent:p,onStartFlow:g,publicKey:C,getConversationId:O,setConversationId:k,touchConversation:Y,getVisitorId:N,onOrgCapExceeded:T,onStopFlow:w,track:_,getWidget:M,onSelectLocale:S};P=L.mount(B),P||h("The chat panel could not start.");}catch(L){h(`The chat panel could not load. ${String(L)}`);}finally{V=null;}})(),V)}return {async open(){if(!D&&(U=true,await K(),!(!U||D)))try{P?.open();}catch(L){h(`The chat panel could not open. ${String(L)}`);}},close(){U=false;try{P?.close();}catch(L){h(`The chat panel could not close. ${String(L)}`);}},destroy(){D=true,U=false;let L=P;P=null;try{L?.destroy();}catch(B){h(`The chat panel could not be removed. ${String(B)}`);}},reposition(){try{P?.reposition?.();}catch(L){h(`The chat panel could not move. ${String(L)}`);}},refreshChrome(){try{P?.refreshChrome?.();}catch(L){h(`The chat panel could not apply its texts. ${String(L)}`);}},async promptFill(L){if(D||(await K(),D||!P?.promptFill))return null;try{return await P.promptFill(L)}catch(B){return h(`The flow's question could not be shown. ${String(B)}`),null}},cancelFill(){try{P?.cancelFill?.();}catch(L){h(`The flow's question could not be withdrawn. ${String(L)}`);}},async showFlowFailure(){if(!D&&(U=true,await K(),!(!U||D||!P?.showFlowFailure)))try{P.showFlowFailure();}catch(L){h(`The flow's failure notice could not be shown. ${String(L)}`);}}}}var Pt="__arcyFlow";var Io="arcy.flow.";function Ro(e){return typeof e.flowId=="string"&&e.flowId.length>0&&typeof e.currentStepCvid=="string"&&e.currentStepCvid.length>0&&typeof e.flowSessionId=="string"&&e.flowSessionId.length>0&&typeof e.startedAt=="number"}function kn(e,{store:t=ue()}={}){let n=Q(t),r=Io+e;return {read(){let o=Z(n,r);return !o||!Ro(o)?null:{flowId:o.flowId,currentStepCvid:o.currentStepCvid,flowSessionId:o.flowSessionId,startedAt:o.startedAt}},save(o){J(n,r,o);},clear(){n.removeItem(r);}}}var An="https://cdn.arcyai.com";var Po=15e3;function _n(e,t,n,r){return new Promise(o=>{let i=false,s=null,f=p=>{i||(i=true,s&&(s.onload=null,s.onerror=null),o(p));},a=false,l=p=>{a||(a=true,h(p));},d=()=>{let p;try{p=e[Pt];}catch{return l("The flow engine registration could not be read. The flow will not start."),null}if(!p)return null;if(typeof p.mount!="function")return l("The flow engine registered something unusable. The flow will not start."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==2?(l(`The flow engine on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to run flows.`),null):p},b=p=>{try{let g=d();!g&&!a&&p(),f(g);}catch{f(null);}},v=false;try{v=e[Pt]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;s=p.createElement("script"),ve(s),s.async=!0,s.src=`${t}/${Zt}`;let g=s.src;s.onload=()=>b(()=>h("The flow engine loaded but did not register. The flow will not start.")),s.onerror=()=>{try{h(`Failed to load ${g}. The flow will not start. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}f(null);},(p.head||p.documentElement).appendChild(s);}catch(p){h(`The flow engine could not load. ${String(p)}`),f(null);return}try{r(()=>{i||h("The flow engine did not load in time."),f(null);},n);}catch{}})}function In(e){let{win:t=typeof window<"u"?window:void 0,loadChunk:n,loadTimeoutMs:r=Po,setTimeoutImpl:o=(d,b)=>setTimeout(d,b),context:i}=e,s=null,f=null,a=false;async function l(){if(!(s||a))return f||(f=(async()=>{if(t)try{let d=await n(t,r,o);if(!d||a)return;s=d.mount({...i,doc:t.document,win:t}),s||h("The flow engine could not start.");}catch(d){h(`The flow engine could not load. ${String(d)}`);}finally{f=null;}})(),f)}return {async start(d){if(!a&&(await l(),!a))try{await s?.start(d);}catch(b){h(`The flow could not start. ${String(b)}`);}},async resume(){if(a||!kn(i.token).read()||(await l(),a||!s))return false;try{return await s.resume()}catch(b){return h(`The flow could not resume. ${String(b)}`),false}},async startPreview(d){if(!a&&(await l(),!a))try{await s?.startPreview?.(d);}catch(b){h(`The preview could not start. ${String(b)}`);}},async resumePreview(){if(a||!Qe(i.token)||(await l(),a||!s?.resumePreview))return false;try{return await s.resumePreview()}catch(d){return h(`The preview could not resume. ${String(d)}`),false}},stop(){if(!a)try{s?.stop?.();}catch(d){h(`The flow could not be stopped. ${String(d)}`);}},destroy(){a=true;let d=s;s=null;try{d?.destroy();}catch(b){h(`The flow engine could not be removed. ${String(b)}`);}}}}function Lt(e){let t=e.dataTransfer;if(!t)return false;let n=t.types;if(!n)return false;for(let r=0;r<n.length;r+=1)if(n[r]==="Files")return true;return false}function Rn(e){let t=e.dataTransfer;return Array.from(t?.files??[])}var Pn=`
5
+ [data-tip] {
6
+ position: relative;
7
+ }
8
+
9
+ [data-tip]::after {
10
+ content: attr(data-tip);
11
+ position: absolute;
12
+ left: 50%;
13
+ bottom: calc(100% + 6px);
14
+ transform: translateX(-50%);
15
+ z-index: 2;
16
+ padding: 4px 8px;
17
+ border-radius: 6px;
18
+ background: var(--_arcy-main-text, #101828);
19
+ color: var(--_arcy-main-bg, #ffffff);
20
+ font-size: 11px;
21
+ line-height: 1.3;
22
+ white-space: nowrap;
23
+ pointer-events: none;
24
+ opacity: 0;
25
+ visibility: hidden;
26
+ transition: opacity 120ms ease;
27
+ }
28
+
29
+ [data-tip][data-tip-placement="below"]::after {
30
+ bottom: auto;
31
+ top: calc(100% + 6px);
32
+ }
33
+
34
+ /* Alignment, for a control near an edge the panel clips (D895). Centring a
35
+ bubble on the leftmost header icon puts half of it outside the panel, and
36
+ the panel clips its overflow, so the half outside is simply gone. No
37
+ z-index can fix that: the bubble is not behind anything, it is cut off.
38
+ These pin the bubble to the control's own edge instead. */
39
+ [data-tip][data-tip-align="start"]::after {
40
+ left: 0;
41
+ transform: none;
42
+ }
43
+
44
+ [data-tip][data-tip-align="end"]::after {
45
+ left: auto;
46
+ right: 0;
47
+ transform: none;
48
+ }
49
+
50
+ [data-tip]:hover::after,
51
+ [data-tip]:focus-visible::after {
52
+ opacity: 1;
53
+ visibility: visible;
54
+ }
55
+
56
+ /* A coarse pointer has no hover: the tooltip would latch open on tap and
57
+ sit over the thing the visitor just pressed. */
58
+ @media (hover: none) {
59
+ [data-tip]::after {
60
+ display: none;
61
+ }
62
+ }
63
+
64
+ @media (prefers-reduced-motion: reduce) {
65
+ [data-tip]::after {
66
+ transition: none;
67
+ }
68
+ }
69
+ `;var Ln=Pn+`
70
+ .arcy-bar-wrap {
71
+ gap: 6px;
72
+ font: 14px/1.4 var(--_arcy-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
73
+ /* Only ever animates from a concrete pixel value: bar.ts's render()
74
+ freezes the wrap's current width before writing the target so this has
75
+ two real numbers to interpolate between, never the "max-content"
76
+ keyword most engines cannot transition. */
77
+ transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
78
+ /* Above the panel, always (.arcy-chat-panel's own z-index in chat.ts):
79
+ both are position: absolute siblings inside the same shared root with
80
+ nothing else to order them, so without this the panel simply painted
81
+ over the bar whenever they overlapped, because the panel is always the
82
+ later of the two to mount (it loads lazily, on first open()) and DOM
83
+ order was the only tiebreaker. This is its own stacking context, so the
84
+ bar's own menu and tooltips (z-index 2 inside it, tooltip.ts) stay
85
+ above the panel too, not just the bar's own box. */
86
+ z-index: 2;
87
+ }
88
+
89
+ /* The corner launcher the widget becomes when a visitor docks it from the
90
+ panel's Settings sheet. Its size and placement are written inline from
91
+ bar.ts, for the reason at the top of this file: docked, this button is the
92
+ only way back into the widget, so losing this sheet has to leave it plain
93
+ rather than unfindable.
94
+
95
+ It is the WELCOME MARK: same size token, same brand colours, same
96
+ overflow-hidden circle an upload is inset into. The welcome screen's own
97
+ rule, in chat.ts, is its twin, and the two are meant to be
98
+ indistinguishable, because docked this button is that mark. */
99
+ .arcy-bar-dock {
100
+ overflow: hidden;
101
+ appearance: none;
102
+ border: 0;
103
+ /* box-sizing: border-box comes from bar.ts's SURVIVAL_STYLE. calc() against
104
+ the size token itself, NOT a percentage: a percentage padding resolves
105
+ against the containing block's width, not this button's own, and would
106
+ inflate a 34px button to match the page instead of insetting the icon. */
107
+ padding: calc(var(--_arcy-chat-welcome-icon-size, 34px) * 0.15);
108
+ cursor: pointer;
109
+ border-radius: 999px;
110
+ background: var(--_arcy-brand-bg, #101828);
111
+ color: var(--_arcy-brand-text, #ffffff);
112
+ -webkit-tap-highlight-color: transparent;
113
+ /* Its own stacking context, above the panel, same as the bar's wrap. */
114
+ z-index: 2;
115
+ transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
116
+ }
117
+
118
+ .arcy-bar-dock:hover {
119
+ transform: scale(1.06);
120
+ }
121
+
122
+ .arcy-bar-dock:focus-visible {
123
+ outline: 2px solid currentColor;
124
+ outline-offset: 3px;
125
+ }
126
+
127
+ .arcy-bar {
128
+ position: relative;
129
+ display: flex;
130
+ align-items: center;
131
+ box-sizing: border-box;
132
+ width: 100%;
133
+ min-height: 52px;
134
+ padding: 0 8px 0 8px;
135
+ border-radius: var(--arcy-bar-radius, 16px);
136
+ background: var(--_arcy-main-bg, #ffffff);
137
+ color: var(--_arcy-main-text, #101828);
138
+ /* The shared base.border (D832): one value, this edge and the panel's. */
139
+ border: var(--_arcy-border-width, 0px) solid
140
+ var(--_arcy-border-color, color-mix(in srgb, var(--_arcy-main-text, #101828) 15%, transparent));
141
+ /* The focus ring rides in front of the operator's own shadow rather than
142
+ replacing it (D908), so a focused bar keeps whatever depth they chose. */
143
+ box-shadow: var(--_arcy-bar-focus-ring, 0 0 #0000),
144
+ var(--arcy-bar-shadow, 0 8px 24px rgba(16, 24, 40, 0.28));
145
+ transition: box-shadow 160ms ease, background 160ms ease,
146
+ border-color 160ms ease;
147
+ }
148
+
149
+ /* Flow mode's status surface reads left to right (dot, name, step, stop),
150
+ so the left edge sits closer to the composer's usual text inset while the
151
+ right stays flush with the stop control (D930/D979). */
152
+ .arcy-bar[data-mode="flow"] {
153
+ padding: 0 8px 0 16px;
154
+ }
155
+
156
+ /* Glassiness (\xA75.4): a blur behind the bar plus an alpha on
157
+ main.background. Only where the browser can blur; elsewhere the bar stays
158
+ opaque, never transparent. With no glass set the alpha is 0% and this is
159
+ a no-op. */
160
+ @supports (backdrop-filter: blur(1px)) {
161
+ .arcy-bar {
162
+ background: color-mix(in srgb, var(--_arcy-main-bg, #ffffff) calc(100% - var(--_arcy-glass-alpha, 0%)), transparent);
163
+ backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
164
+ -webkit-backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
165
+ }
166
+ }
167
+
168
+ .arcy-bar-form {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 6px;
172
+ flex: 1 1 auto;
173
+ min-width: 0;
174
+ margin: 0;
175
+ }
176
+
177
+ .arcy-bar-input {
178
+ flex: 1 1 auto;
179
+ min-width: 0;
180
+ appearance: none;
181
+ border: 0;
182
+ background: transparent;
183
+ color: inherit;
184
+ font: inherit;
185
+ padding: 12px 0;
186
+ outline: none;
187
+ }
188
+
189
+ /* Collapsed, the whole pill is the target (ADR 0103): the input inside it is
190
+ a few pixels wide, and a visitor aiming for it is a visitor who misses. */
191
+ .arcy-bar[data-collapsed="true"] {
192
+ cursor: pointer;
193
+ }
194
+
195
+ .arcy-bar[data-collapsed="true"] .arcy-bar-input {
196
+ /* No cursor override here, unlike the pill above: this is a real,
197
+ focusable input, not a decoration, and hovering directly over it
198
+ should give the same text-caret cue any input gives. The surrounding
199
+ pill's own pointer cursor still covers the rest of the target. */
200
+ /* Takes the row's spare width, exactly as it does open (ADR 0149): the
201
+ pill is bar.collapsedWidth wide now rather than as wide as its own
202
+ text, and an input that kept sizing itself to the placeholder would
203
+ leave the operator's extra pixels stranded behind the send control. */
204
+ padding-right: 8px;
205
+ }
206
+
207
+ /* The left slot. As a mark it is not a control, so it takes no hover, no
208
+ pointer and no tab stop; as the menu's plus it is an icon button. */
209
+ .arcy-bar-grip {
210
+ /* Outside the composer's own controls: what it moves is the whole bar, so
211
+ it takes neither the left slot's hover treatment nor its padding
212
+ (ADR 0111). Rendered on BOTH widths of the bar, resting and expanded,
213
+ and only when the operator has allowed it: the data-grip rule below is
214
+ driven by that setting alone. The handle used to vanish the moment the panel
215
+ opened even though dragging the open bar already worked underneath,
216
+ which is a control that is functional but invisible. */
217
+ display: none;
218
+ align-items: center;
219
+ justify-content: center;
220
+ flex: 0 0 auto;
221
+ padding: 0 2px 0 4px;
222
+ margin-right: -2px;
223
+ border: 0;
224
+ background: transparent;
225
+ /* Matches the leading icon's own resting contrast (see .arcy-bar-leading
226
+ below). The previous, much lower value read as barely-there against
227
+ either theme, which made the handle hard to spot rather than subtle. */
228
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
229
+ cursor: grab;
230
+ touch-action: none;
231
+ -webkit-tap-highlight-color: transparent;
232
+ }
233
+
234
+ .arcy-bar[data-grip="true"] .arcy-bar-grip {
235
+ display: flex;
236
+ }
237
+
238
+ .arcy-bar-grip:active {
239
+ cursor: grabbing;
240
+ }
241
+
242
+ .arcy-bar-grip:hover {
243
+ color: var(--_arcy-main-text, #101828);
244
+ }
245
+
246
+ .arcy-bar-leading {
247
+ appearance: none;
248
+ border: 0;
249
+ padding: 8px;
250
+ border-radius: 999px;
251
+ background: transparent;
252
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
253
+ font: inherit;
254
+ display: flex;
255
+ align-items: center;
256
+ justify-content: center;
257
+ flex: 0 0 auto;
258
+ -webkit-tap-highlight-color: transparent;
259
+ }
260
+
261
+ .arcy-bar-leading[data-role="menu"] {
262
+ cursor: pointer;
263
+ }
264
+
265
+ .arcy-bar-leading[data-role="menu"]:hover {
266
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
267
+ }
268
+
269
+ .arcy-bar-leading[data-role="mark"] {
270
+ cursor: inherit;
271
+ color: var(--_arcy-brand-bg, #101828);
272
+ opacity: 1;
273
+ }
274
+
275
+ .arcy-bar-menu {
276
+ position: absolute;
277
+ left: 0;
278
+ bottom: calc(100% + 8px);
279
+ z-index: 1;
280
+ display: flex;
281
+ flex-direction: column;
282
+ gap: 2px;
283
+ min-width: 200px;
284
+ padding: 6px;
285
+ border-radius: 12px;
286
+ background: var(--_arcy-main-bg, #ffffff);
287
+ color: var(--_arcy-main-text, #101828);
288
+ border: 1px solid
289
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 12%, transparent);
290
+ box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
291
+ }
292
+
293
+ /* The menu is a surface the visitor sees, so it wears base.glassiness like
294
+ the bar and the panel do (D832's one-value rule, one layer out). It gets
295
+ its own @supports block rather than joining the bar's above, because this
296
+ sheet declares the menu's opaque background AFTER that block: sharing it
297
+ would put the two rules at equal specificity with the opaque one last,
298
+ and the menu stayed white on a glassy bar.
299
+
300
+ Note this sheet is a template literal. No backticks in these comments. */
301
+ @supports (backdrop-filter: blur(1px)) {
302
+ .arcy-bar-menu {
303
+ background: color-mix(in srgb, var(--_arcy-main-bg, #ffffff) calc(100% - var(--_arcy-glass-alpha, 0%)), transparent);
304
+ backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
305
+ -webkit-backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
306
+ }
307
+ }
308
+
309
+ .arcy-bar-menu-item {
310
+ appearance: none;
311
+ border: 0;
312
+ cursor: pointer;
313
+ font: inherit;
314
+ text-align: left;
315
+ display: flex;
316
+ align-items: center;
317
+ gap: 10px;
318
+ padding: 8px 10px;
319
+ border-radius: 8px;
320
+ background: transparent;
321
+ color: inherit;
322
+ -webkit-tap-highlight-color: transparent;
323
+ }
324
+
325
+ .arcy-bar-menu-item:hover {
326
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
327
+ }
328
+
329
+ .arcy-bar-input::placeholder {
330
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
331
+ /* Opera and older Firefox dim placeholders by default, which on a light
332
+ bar reads as a disabled input. */
333
+ opacity: 1;
334
+ }
335
+
336
+ .arcy-bar-input:disabled {
337
+ opacity: 0.6;
338
+ }
339
+
340
+ .arcy-bar-icon,
341
+ .arcy-bar-send,
342
+ .arcy-bar-stop {
343
+ appearance: none;
344
+ border: 0;
345
+ cursor: pointer;
346
+ font: inherit;
347
+ -webkit-tap-highlight-color: transparent;
348
+ display: flex;
349
+ align-items: center;
350
+ justify-content: center;
351
+ flex: 0 0 auto;
352
+ }
353
+
354
+ .arcy-bar-icon {
355
+ padding: 8px;
356
+ border-radius: 999px;
357
+ background: transparent;
358
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
359
+ }
360
+
361
+ .arcy-bar-icon:hover {
362
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
363
+ }
364
+
365
+ .arcy-bar-send {
366
+ padding: 10px;
367
+ border-radius: 999px;
368
+ background: var(--_arcy-brand-bg, #101828);
369
+ color: var(--_arcy-brand-text, #ffffff);
370
+ }
371
+
372
+ /* The send control answers the pointer whatever colour the operator chose
373
+ (D888). The hover token defaults to the base colour, so a background swap
374
+ alone is invisible on every theme that did not set one; a lift and a
375
+ contact shadow read on any colour, including white on white. */
376
+ .arcy-bar-send {
377
+ transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
378
+ }
379
+
380
+ .arcy-bar-send:hover {
381
+ background: var(--_arcy-brand-bg-hover, var(--_arcy-brand-bg, #101828));
382
+ transform: translateY(-1px);
383
+ box-shadow: 0 2px 8px rgba(16, 24, 40, 0.18);
384
+ }
385
+
386
+ .arcy-bar-send:active {
387
+ background: var(--_arcy-brand-bg-active, var(--_arcy-brand-bg, #101828));
388
+ transform: translateY(0);
389
+ box-shadow: none;
390
+ }
391
+
392
+ @media (prefers-reduced-motion: reduce) {
393
+ .arcy-bar-send {
394
+ transition: background 120ms ease;
395
+ }
396
+ .arcy-bar-send:hover,
397
+ .arcy-bar-send:active {
398
+ transform: none;
399
+ }
400
+ }
401
+
402
+ .arcy-bar-send:disabled,
403
+ .arcy-bar-icon:disabled {
404
+ cursor: default;
405
+ opacity: 0.6;
406
+ }
407
+
408
+ /* The input takes NO ring of its own (D887). It fills a bar that already
409
+ looks like an input, so a rectangle drawn around the text reads as a
410
+ browser artefact rather than as focus, and it was the first thing a
411
+ visitor saw on clicking. The bar carries the state instead.
412
+
413
+ The border goes brand (D908). base.border.width defaults to 0, so a
414
+ colour change alone would be invisible on most themes; the 1px ring is
415
+ what actually paints the edge there, and on a theme that HAS a border the
416
+ two land on the same line. */
417
+ .arcy-bar:focus-within {
418
+ outline: none;
419
+ border-color: var(--_arcy-brand-bg, #101828);
420
+ --_arcy-bar-focus-ring: 0 0 0 1px var(--_arcy-brand-bg, #101828);
421
+ }
422
+
423
+ /* A control inside the bar still says which control it is: the bar's ring
424
+ says "the widget has focus", this one says "and it is this button". */
425
+ .arcy-bar-icon:focus-visible,
426
+ .arcy-bar-send:focus-visible,
427
+ .arcy-bar-stop:focus-visible,
428
+ .arcy-bar-leading:focus-visible,
429
+ .arcy-bar-menu-item:focus-visible {
430
+ outline: 2px solid var(--_arcy-main-text, #101828);
431
+ outline-offset: 1px;
432
+ }
433
+
434
+ /* The attachment tray. See bar.ts's renderTray(). */
435
+ .arcy-bar-tray {
436
+ display: none;
437
+ flex-wrap: wrap;
438
+ align-items: center;
439
+ gap: 6px;
440
+ padding: 10px 4px 2px 4px;
441
+ min-width: 0;
442
+ }
443
+
444
+ /* A composer holding pictures is two rows, not one. */
445
+ .arcy-bar[data-attachments="true"] {
446
+ flex-direction: column;
447
+ align-items: stretch;
448
+ }
449
+
450
+ /* \u2500\u2500 Flow-running mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
451
+
452
+ .arcy-bar-status {
453
+ display: flex;
454
+ align-items: center;
455
+ gap: 10px;
456
+ flex: 1 1 auto;
457
+ min-width: 0;
458
+ }
459
+
460
+ .arcy-bar-dot {
461
+ flex: 0 0 auto;
462
+ width: 8px;
463
+ height: 8px;
464
+ border-radius: 999px;
465
+ background: var(--_arcy-brand-bg, #101828);
466
+ animation: arcy-bar-pulse 1.4s ease-in-out infinite;
467
+ }
468
+
469
+ @keyframes arcy-bar-pulse {
470
+ 0%, 100% { opacity: 1; }
471
+ 50% { opacity: 0.35; }
472
+ }
473
+
474
+ .arcy-bar-flow-name {
475
+ flex: 1 1 auto;
476
+ min-width: 0;
477
+ overflow: hidden;
478
+ text-overflow: ellipsis;
479
+ white-space: nowrap;
480
+ font-size: 13px;
481
+ }
482
+
483
+ .arcy-bar-flow-step {
484
+ flex: 0 0 auto;
485
+ font-size: 12px;
486
+ font-variant-numeric: tabular-nums;
487
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 60%, transparent);
488
+ }
489
+
490
+ .arcy-bar-stop {
491
+ gap: 6px;
492
+ padding: 6px 12px;
493
+ border-radius: 999px;
494
+ font-size: 12px;
495
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
496
+ color: inherit;
497
+ }
498
+
499
+ .arcy-bar-stop:hover {
500
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
501
+ }
502
+
503
+ /* ADR 0169: the combined input rendering. The status row sits on a slim top
504
+ row and the composer stays live beneath it, so a fill question can be
505
+ answered without losing sight of the run. */
506
+ .arcy-bar[data-mode="input"] {
507
+ flex-direction: column;
508
+ align-items: stretch;
509
+ padding: 6px 8px 0 8px;
510
+ }
511
+
512
+ .arcy-bar[data-mode="input"] .arcy-bar-status {
513
+ flex: 0 0 auto;
514
+ padding: 2px 8px 4px 8px;
515
+ border-bottom: 1px solid
516
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
517
+ }
518
+
519
+ .arcy-bar[data-mode="input"] .arcy-bar-form {
520
+ padding-left: 8px;
521
+ }
522
+
523
+ /* D1296: the done state. The run is over, so the dot stops pulsing and the
524
+ check mark takes the counter's place. */
525
+ .arcy-bar[data-phase="done"] .arcy-bar-dot {
526
+ animation: none;
527
+ opacity: 1;
528
+ }
529
+
530
+ .arcy-bar[data-phase="done"] .arcy-bar-flow-step {
531
+ color: var(--_arcy-main-text, #101828);
532
+ font-size: 14px;
533
+ }
534
+
535
+ /* The AI disclosure. Under the bar, and only while the panel is open: a
536
+ quiet page stays quiet. */
537
+ .arcy-bar-disclaimer {
538
+ font-size: 10.5px;
539
+ text-align: center;
540
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
541
+ /* The wrap is centred on the bar, so this must not be able to widen it. */
542
+ max-width: 100%;
543
+ }
544
+
545
+ /* The privacy-policy link inline in the bar disclosure (D979/D981-followup).
546
+ Underlined so it reads as clickable against text that otherwise is not. */
547
+ .arcy-chat-policy {
548
+ color: inherit;
549
+ text-decoration: underline;
550
+ text-underline-offset: 2px;
551
+ cursor: pointer;
552
+ }
553
+
554
+ .arcy-chat-policy:hover {
555
+ color: var(--_arcy-main-text, #101828);
556
+ }
557
+
558
+ @media (prefers-reduced-motion: reduce) {
559
+ .arcy-bar,
560
+ .arcy-bar-wrap,
561
+ .arcy-bar-dock,
562
+ .arcy-bar-dot {
563
+ transition: none;
564
+ animation: none;
565
+ }
566
+ }
567
+ `;var Se=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;function On(e){let t=e?.document?.documentElement;return {width:Se(t?.clientWidth)||Se(e?.innerWidth),height:Se(t?.clientHeight)||Se(e?.innerHeight)}}function Lo(e){let t=e?.visualViewport;if(!t)return 0;let n=On(e).height,r=Se(t.height);if(!n||!r)return 0;let o=typeof t.offsetTop=="number"&&Number.isFinite(t.offsetTop)?t.offsetTop:0,i=n-(r+o);return !Number.isFinite(i)||i<24?0:Math.min(i,n)}function et(e){let t=On(e);return {...t,isMobile:t.width>0&&t.width<640,keyboardOffset:Lo(e)}}var Oo=560;function Mn(e,t){let n=Se(t.width);if(!n)return Oo;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function Fn(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function Ot(e,t,n){let r=Se(n);if(!r)return e;let o=Math.max(0,(r-Se(t))/2);return Math.min(o,Math.max(-o,e))}var Fo=1e4,Nn=52,tt=24,nt=18,rt=30,ot=280,Dn="var(--_arcy-chat-welcome-icon-size, 34px)",Bn="53%",No=24,Hn="http://www.w3.org/2000/svg",Un=[["box-sizing","border-box"],["margin","0"],["display","flex"]],Vn=[["position","absolute"],["pointer-events","auto"]],Do=260,Bo=300,Ho=150,Uo=3e3;function be(e,t,n,r=2){let o=e.createElementNS(Hn,"svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("aria-hidden","true"),o.setAttribute("width",String(n)),o.setAttribute("height",String(n));let i=e.createElementNS(Hn,"path");return i.setAttribute("d",t),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width",String(r)),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),o.appendChild(i),o}function Wn(e,t,n){let r=e.createElement("img");return r.src=t,r.alt="",r.setAttribute("aria-hidden","true"),r.width=n,r.height=n,r.style.setProperty("width",`${n}px`),r.style.setProperty("height",`${n}px`),r.style.setProperty("object-fit","contain"),r}var Vo="M5 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0-4 0M21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21",Be={x:0,y:0},Wo="M12 5v14M5 12h14",$o="M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",$n="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M4 20m-2 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0",Kn="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",Ko="M12 19V5M5 12l7-7 7 7",Go="M6 6h12v12H6z";function $(e,t){return (...n)=>{try{t(...n);}catch(r){h(`${e} failed. ${String(r)}`);}}}var Yo={send:"Send",attachMenu:"Add",attachImage:"Attach an image",flowStop:"Stop",openChat:"Open chat",moveBar:"Move the chat bar",flowStep:"Step {step} of {total}"};function Gn(e={}){let t={...Yo,...e.labels??{}},n={widthPercent:e.geometry?.widthPercent??rt,bottomOffset:e.geometry?.bottomOffset??tt,collapsedWidth:e.geometry?.collapsedWidth??ot},r=null,o=false,i=null,s=null,f=null,a=null,l=null,d=null,b=e.iconUrl??null,v=e.iconSize??nt,p=e.welcomeIconUrl??null,g=null,C=null,O=false,k=null,Y=null,N=false,T={x:0,y:0},w=null,_=null,M=null,S=null,I=null,P=null,V=null,D=null,U=null,K=null,L="idle",B=null,de=false,ee=false,we=0,te=false,fe=false,W={width:0,height:0,isMobile:false,keyboardOffset:0};function se(){return !B&&L!=="open"}function ae(u){let m=i?.offsetWidth??0,H=i?.offsetHeight??0;if(!W.width||!W.height)return u;let F=n.bottomOffset+W.keyboardOffset,j=Math.max(0,W.height-H-F);return {x:Ot(u.x,m,W.width),y:Math.min(F,Math.max(-j,u.y))}}function E(u){if(!O||W.isMobile)return;u.preventDefault(),u.stopPropagation();let m=u.clientX,H=u.clientY,F=T,j=C,q=C?.ownerDocument?.defaultView??(typeof window<"u"?window:null),Yt=Ae=>{Ae.pointerId===u.pointerId&&(T=ae({x:F.x+(Ae.clientX-m),y:F.y+(Ae.clientY-H)}),G(),e.onGeometryChange?.());},Ye=Ae=>{if(Ae.pointerId===u.pointerId){q?.removeEventListener("pointermove",Yt,true),q?.removeEventListener("pointerup",Ye,true),q?.removeEventListener("pointercancel",Ye,true);try{j?.releasePointerCapture(Ae.pointerId);}catch{}e.onPositionChange?.(T);}};try{j?.setPointerCapture(u.pointerId);}catch{}q?.addEventListener("pointermove",Yt,true),q?.addEventListener("pointerup",Ye,true),q?.addEventListener("pointercancel",Ye,true);}function R(){i?.style.setProperty("display",N?"none":"flex","important"),k&&(k.style.setProperty("display",N?"flex":"none","important"),N&&(k.style.setProperty("bottom",`${n.bottomOffset+W.keyboardOffset}px`,"important"),k.style.setProperty("right",`${No}px`,"important")));}function G(){if(R(),!i)return;let u=se(),m=Mn(n.widthPercent,W),H=n.bottomOffset+W.keyboardOffset;i.style.setProperty("bottom",`${H}px`,"important"),i.style.setProperty("left","50%","important"),i.style.setProperty("translate","-50%","important");let F=O&&!W.isMobile?ae(T):Be;T=F;let j=B?Be:{x:Ot(F.x,u?n.collapsedWidth:m,W.width),y:F.y};i.style.setProperty("transform",Fn(j)),s?.setAttribute("data-grip",O&&!W.isMobile&&!B?"true":"false"),i.style.setProperty("width",u?`${n.collapsedWidth}px`:`${m}px`);let q=`calc(100% - ${24}px)`;i.style.setProperty("max-width",W.isMobile?q:"none"),i.setAttribute("data-mobile",W.isMobile?"":"false");}function ne(){if(!l||!d)return;let u=l.ownerDocument,m=!se()&&ee,H=m?be(u,Wo,18):b?Wn(u,b,v):be(u,$n,v);l.replaceChild(H,d),d=H,l.setAttribute("aria-label",t.attachMenu),m?l.setAttribute("data-tip",t.attachMenu):l.removeAttribute("data-tip"),l.setAttribute("aria-haspopup",m?"menu":"false"),l.setAttribute("data-role",m?"menu":"mark"),l.disabled=!m,l.setAttribute("aria-hidden",m?"false":"true"),l.tabIndex=m?0:-1,m||he();}function pe(){if(!K||!s)return;let u=ee&&we>0&&!se(),m=s.getAttribute("data-attachments")==="true";K.style.setProperty("display",u?"flex":"none"),s.setAttribute("data-attachments",u?"true":"false"),m!==u&&$("onGeometryChange",()=>e.onGeometryChange?.())();}function me(u){te=u,w&&w.style.setProperty("display",u?"flex":"none"),l?.setAttribute("aria-expanded",u?"true":"false"),u&&_?.focus();}function he(){if(!te)return;let u=w?.getRootNode(),m=!!(u&&"activeElement"in u&&u.activeElement&&w?.contains(u.activeElement));me(false),m&&l?.focus();}function ie(){if(!k||!Y)return;let u=k.ownerDocument,m=p&&p!==g?p:null,H;if(m){let F=u.createElement("img");F.src=m,F.alt="",F.setAttribute("aria-hidden","true"),F.style.setProperty("width","100%"),F.style.setProperty("height","100%"),F.style.setProperty("object-fit","contain"),F.style.setProperty("display","block"),F.addEventListener("error",()=>{g=m,ie();},{once:true}),H=F;}else {let F=be(u,Kn,18);F.setAttribute("width",Bn),F.setAttribute("height",Bn),H=F;}k.replaceChild(H,Y),Y=H;}function z(){if(!s||!f||!I)return;let u=B?de?"input":"flow":L,m=B?.phase==="done";s.setAttribute("data-mode",u),s.setAttribute("data-phase",B?m?"done":"running":"none"),s.setAttribute("data-collapsed",se()?"true":"false"),ne(),pe(),G(),f.style.setProperty("display",u==="flow"?"none":"flex"),I.style.setProperty("display",u==="flow"||u==="input"?"flex":"none"),S?.style.setProperty("display","flex"),s.setAttribute("aria-expanded",u==="open"?"true":"false"),B&&P&&V&&(P.textContent=B.name,V.textContent=m?"\u2713":t.flowStep.replace("{step}",String(B.step)).replace("{total}",String(B.total)),D?.style.setProperty("display",m?"none":"flex")),U&&U.style.setProperty("display",u==="open"&&U.textContent?"block":"none");}function Ve(){W=et(typeof window<"u"?window:null),G(),$("onGeometryChange",()=>e.onGeometryChange?.())();}function We(u){u.preventDefault();let m=a?.value.trim()??"";if(!m&&we===0){Te();return}a&&(a.value=""),$("onSubmit",()=>e.onSubmit?.(m))();}function lt(){Te();}function Te(){B||L==="open"||fe||(fe=true,$("onActivate",()=>e.onActivate?.())());}function Pe(u){if(!(B||L==="open")&&!(w&&u.target instanceof Node&&w.contains(u.target))){Te();try{a?.focus();}catch{}}}function ct(){fe=false;}function $e(u){u.preventDefault(),u.stopPropagation(),!(se()||!ee)&&me(!te);}function ut(){try{M?.click();}catch{}}function Le(u){u.preventDefault(),u.stopPropagation(),he(),ut(),e.onAttach?.();}function xe(){let u=M?.files,m=u?Array.from(u):[];M&&(M.value=""),!(!ee||m.length===0)&&e.onFiles?.(m);}function dt(u){u.key==="Escape"&&te&&he();}function ft(u){if(!te)return;let m=u.target;m instanceof Node&&(l?.contains(m)===true||w?.contains(m)===true)||he();}function pt(u){let m=typeof u.composedPath=="function"?u.composedPath():[],H=u.target,F=r?.host,j=!!(F&&(m.some(q=>q===F)||m.length===0&&H instanceof Node&&F.contains(H)));te&&!j&&he(),!(B||L!=="open")&&(!F||j||$("onDismiss",()=>e.onDismiss?.())());}function mt(u){Lt(u)&&u.preventDefault();}function ht(u){if(!Lt(u)||(u.preventDefault(),!ee))return;let m=Rn(u);m.length!==0&&e.onFiles?.(m);}let le=$("resize",Ve),Ke=$("submit",We),re=$("focus",lt),ge=$("barClick",Pe),Ge=$("pointerdown",ct),c=$("attachMenu",$e),y=$("attach",Le),A=$("picked",xe),x=$("stop",()=>e.onStop?.()),X=$("menuKey",dt),ye=$("menuDismiss",pt),Ce=$("menuDismissInside",ft),Oe=$("dragover",mt),$t=$("drop",ht),Kt=$("undock",()=>e.onUndock?.());function Gt(u){if(!o){o=true;try{u.style.setProperty("opacity","1");}catch{}}}function _r(u,m){if(o)return;if(!m||typeof m.setTimeout!="function"){o=true;return}try{u.style.setProperty("opacity","0"),u.style.setProperty("transition",`opacity ${Do}ms ease`);}catch{o=true;return}let H=F=>{try{m.setTimeout(()=>Gt(u),F);}catch{Gt(u);}};if(u.ownerDocument.readyState==="complete"){H(Ho);return}try{m.addEventListener("load",()=>H(Bo),{once:!0});}catch{}H(Uo);}function Ir(){if(r?.host.isConnected){h("The chat bar is already mounted. Ignoring the second mount.");return}r=null;let u=Xe({container:e.container});if(!u)return;r=u,_r(u.host,u.host.ownerDocument.defaultView),un(r,Ln);let m=r.host.ownerDocument;i=m.createElement("div"),i.className="arcy-bar-wrap";for(let[j,q]of Un)i.style.setProperty(j,q);for(let[j,q]of Vn)i.style.setProperty(j,q,"important");i.style.setProperty("flex-direction","column"),i.style.setProperty("align-items","center"),s=m.createElement("div"),s.className="arcy-bar",s.setAttribute("role","group"),s.setAttribute("aria-label",t.openChat),f=m.createElement("form"),f.className="arcy-bar-form",a=m.createElement("input"),a.type="text",a.className="arcy-bar-input",a.maxLength=Fo,a.setAttribute("aria-label",t.openChat),a.autocomplete="off",K=m.createElement("div"),K.className=Sn,K.style.setProperty("display","none"),C=m.createElement("button"),C.type="button",C.className="arcy-bar-grip",C.setAttribute("aria-label",t.moveBar),C.setAttribute("data-tip",t.moveBar),C.appendChild(be(m,$o,16)),C.addEventListener("pointerdown",E),C.addEventListener("click",j=>j.stopPropagation()),l=m.createElement("button"),l.type="button",l.className="arcy-bar-leading",d=b?Wn(m,b,v):be(m,$n,v),l.appendChild(d),w=m.createElement("div"),w.className="arcy-bar-menu",w.setAttribute("role","menu"),w.style.setProperty("display","none"),_=m.createElement("button"),_.type="button",_.className="arcy-bar-menu-item",_.setAttribute("role","menuitem"),_.appendChild(be(m,Vo,16)),_.appendChild(m.createTextNode(t.attachImage)),w.appendChild(_),M=m.createElement("input"),M.type="file",M.accept=wn.join(","),M.multiple=true,M.tabIndex=-1,M.setAttribute("aria-hidden","true"),M.style.setProperty("display","none"),s.appendChild(M),S=m.createElement("button"),S.type="submit",S.className="arcy-bar-send",S.setAttribute("aria-label",t.send),S.appendChild(be(m,Ko,18)),f.appendChild(C),f.appendChild(l),f.appendChild(a),f.appendChild(S),I=m.createElement("div"),I.className="arcy-bar-status",I.style.setProperty("display","none");let H=m.createElement("span");H.className="arcy-bar-dot",H.setAttribute("aria-hidden","true"),P=m.createElement("span"),P.className="arcy-bar-flow-name",V=m.createElement("span"),V.className="arcy-bar-flow-step",D=m.createElement("button"),D.type="button",D.className="arcy-bar-stop",D.appendChild(be(m,Go,15,2)),D.appendChild(m.createTextNode(t.flowStop)),I.appendChild(H),I.appendChild(P),I.appendChild(V),I.appendChild(D),s.appendChild(K),s.appendChild(f),s.appendChild(I),s.appendChild(w),U=m.createElement("div"),U.className="arcy-bar-disclaimer",U.style.setProperty("display","none"),i.appendChild(s),i.appendChild(U),k=m.createElement("button"),k.type="button",k.className="arcy-bar-dock",k.setAttribute("aria-label",t.openChat),k.setAttribute("data-tip",t.openChat),k.setAttribute("data-tip-placement","above"),k.setAttribute("data-tip-align","end");for(let[j,q]of Un)k.style.setProperty(j,q);for(let[j,q]of Vn)k.style.setProperty(j,q,"important");k.style.setProperty("align-items","center"),k.style.setProperty("justify-content","center"),k.style.setProperty("width",Dn),k.style.setProperty("height",Dn),Y=be(m,Kn,18),k.appendChild(Y),ie(),k.addEventListener("click",Kt),f.addEventListener("submit",Ke),a.addEventListener("focus",re),s.addEventListener("click",ge),s.addEventListener("pointerdown",Ge,true),l.addEventListener("click",c),_.addEventListener("click",y),M.addEventListener("change",A),D.addEventListener("click",x),s.addEventListener("dragover",Oe),s.addEventListener("drop",$t),m.addEventListener("pointerdown",ye,true),r.root.addEventListener("pointerdown",Ce,true),m.addEventListener("keydown",X,true);let F=m.defaultView;F?.addEventListener("resize",le),F?.addEventListener("orientationchange",le),F?.visualViewport?.addEventListener("resize",le),F?.visualViewport?.addEventListener("scroll",le),r.root.appendChild(i),r.root.appendChild(k),W=et(F??null),N=e.readDocked?.()===true,G(),z();}function Rr(){if(!r)return;let u=r.host.ownerDocument.defaultView;u?.removeEventListener("resize",le),u?.removeEventListener("orientationchange",le),u?.visualViewport?.removeEventListener("resize",le),u?.visualViewport?.removeEventListener("scroll",le),f?.removeEventListener("submit",Ke),a?.removeEventListener("focus",re),s?.removeEventListener("click",ge),s?.removeEventListener("pointerdown",Ge,true),l?.removeEventListener("click",c),_?.removeEventListener("click",y),M?.removeEventListener("change",A),D?.removeEventListener("click",x),s?.removeEventListener("dragover",Oe),s?.removeEventListener("drop",$t),k?.removeEventListener("click",Kt);let m=r.host.ownerDocument;m.removeEventListener("pointerdown",ye,true),r.root.removeEventListener("pointerdown",Ce,true),m.removeEventListener("keydown",X,true),r.destroy(),r=null,i=s=f=I=P=V=U=null,a=null,_=S=D=null,M=null,l=null,d=null,k=null,Y=null,w=null,K=null,te=false,B=null,L="idle";}return {mount:Ir,unmount:Rr,isMounted:()=>r!==null&&r.host.isConnected,getElement:()=>s,getRoot:()=>r?.root??null,getHost:()=>r?.host??null,setMode(u){L!==u&&(L=u,fe=false,z());},getMode:()=>B?"flow":L,setGeometry(u){n={widthPercent:u.widthPercent??n.widthPercent,bottomOffset:u.bottomOffset??n.bottomOffset,collapsedWidth:u.collapsedWidth??n.collapsedWidth},G();},getMetrics:()=>({...n,offset:B||!O||W.isMobile?Be:T,height:i?.offsetHeight||s?.offsetHeight||Nn,keyboardOffset:W.keyboardOffset,isMobile:W.isMobile,viewportHeight:W.height,viewportWidth:W.width}),getHeight:()=>i?.offsetHeight||s?.offsetHeight||Nn,setLabels(u){t={...t,...u};try{if(S?.setAttribute("aria-label",t.send),_){let m=_.lastChild;m&&(m.textContent=t.attachImage);}if(s?.setAttribute("aria-label",t.openChat),a?.setAttribute("aria-label",t.openChat),k&&(k.setAttribute("aria-label",t.openChat),k.setAttribute("data-tip",t.openChat)),C&&(C.setAttribute("aria-label",t.moveBar),C.setAttribute("data-tip",t.moveBar)),D){let m=D.lastChild;m&&(m.textContent=t.flowStop);}}catch{}z();},setPlaceholder(u){try{a&&(a.placeholder=u??"");}catch{}},setDisabled(u){try{a&&(a.disabled=u),S&&(S.disabled=u),_&&(_.disabled=u),u&&he();}catch{}},setAttachEnabled(u){ee!==u&&(ee=u,z());},setDraggable(u){O!==u&&(O=u,T=u?e.readPosition?.()??Be:Be,G(),e.onGeometryChange?.());},setIcon(u){b!==u&&(b=u,ne());},setIconSize(u){v!==u&&(v=u,ne());},setWelcomeIcon(u){p!==u&&(p=u,g=null,ie());},setDocked(u){N!==u&&(N=u,$("onDockedChange",()=>e.onDockedChange?.(u))(),u&&he(),G(),$("onGeometryChange",()=>e.onGeometryChange?.())());},isDocked:()=>N,setFlow(u){B=u,u||(de=false),z();},setAwaitingInput(u){de!==u&&(de=u,z(),$("onGeometryChange",()=>e.onGeometryChange?.())());},setDisclaimer(u){try{if(U&&(U.textContent="",u!=null))if(typeof u=="string")U.textContent=u;else {let m=U.ownerDocument;U.appendChild(m.createTextNode(u.before));let H=m.createElement("a");H.className=vn,H.href=u.linkHref,H.target="_blank",H.rel="noopener noreferrer",H.textContent=u.linkLabel,U.appendChild(H),u.after&&U.appendChild(m.createTextNode(u.after));}}catch{}z();},setAttachmentCount(u){we=u;try{pe();}catch{}},attachmentSlot:()=>K,focusInput(){try{r&&St(r.host.ownerDocument,r.host),a?.focus();}catch{}},reposition:()=>{W=et(typeof window<"u"?window:null),G();},readValue:()=>a?.value??"",clearValue(){try{a&&(a.value="");}catch{}}}}var zo="https://api.arcyai.com";function Mt(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function it(e,t){return Mt(e)?/^https:\/\//i.test(e)?e:`${(t??zo).replace(/\/+$/,"")}${e}`:null}var Xo=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,jo=/^[a-z0-9-]{1,32}$/,Yn={none:"none",soft:"0 0 2px rgba(16, 24, 40, 0.04), 0 0 8px rgba(16, 24, 40, 0.06)",medium:"0 0 4px rgba(16, 24, 40, 0.05), 0 0 20px rgba(16, 24, 40, 0.10)",strong:"0 0 8px rgba(16, 24, 40, 0.07), 0 0 36px rgba(16, 24, 40, 0.16)",bold:"0 0 12px rgba(16, 24, 40, 0.10), 0 0 48px rgba(16, 24, 40, 0.22)"},qo=20,Jo=50,Qo=30,Zo=80,ei=0,ti=120,ni=14,ri=28,oi=180,ii=480,si=2147483647,st={vars:{},widthPercent:null,bottomOffset:null,collapsedWidth:null,barIconSize:null,maxHeightPercent:null,zIndex:null};function oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ee(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.min(n,Math.max(t,e))}function He(e,t,n){if(t)for(let[r,o]of n){let i=t[r];typeof i=="string"&&Xo.test(i)&&(e[o]=i);}}function Ie(e,t,n,r,o){let i=Ee(n,r,o);i!==null&&(e[t]=`${i}px`);}function zn(e,t,n){typeof n=="string"&&n in Yn&&(e[t]=Yn[n]);}function Ft(e){let t=oe(e);if(!t)return st;let n={},r=oe(t.base);He(n,oe(r?.brand),[["text","--_arcy-brand-text"],["background","--_arcy-brand-bg"],["hover","--_arcy-brand-bg-hover"],["active","--_arcy-brand-bg-active"]]),He(n,oe(r?.main),[["text","--_arcy-main-text"],["background","--_arcy-main-bg"]]);let o=oe(r?.border);Ie(n,"--_arcy-border-width",o?.width,0,8),He(n,o,[["color","--_arcy-border-color"]]);let i=Ee(r?.glassiness,0,100);i!==null&&i>0&&(n["--_arcy-glass-blur"]=`${Math.round(i/5)}px`,n["--_arcy-glass-alpha"]=`${Math.round(i/2)}%`);let s=r?.fontFamily;typeof s=="string"&&jo.test(s)&&s!=="system"&&(n[It]=s);let f=Ee(r?.zIndex,0,si);Ie(n,"--arcy-bar-radius",r?.borderRadius,0,32),Ie(n,"--_arcy-chat-radius",r?.borderRadius,0,32),zn(n,"--arcy-bar-shadow",r?.shadow),zn(n,"--_arcy-chat-shadow",r?.shadow);let a=oe(t.bar),l=oe(t.chat);Ie(n,"--_arcy-chat-logo-size",l?.logoSize,16,48),Ie(n,"--_arcy-chat-welcome-icon-size",l?.welcomeIconSize,16,72),He(n,oe(l?.assistantBubble),[["background","--_arcy-assistant-bg"],["text","--_arcy-assistant-text"]]);let d=oe(l?.scrollbar);return Ie(n,"--_arcy-scroll-width",d?.width,2,16),He(n,d,[["track","--_arcy-scroll-track"],["thumb","--_arcy-scroll-thumb"],["thumbHover","--_arcy-scroll-thumb-hover"]]),{vars:n,widthPercent:Ee(l?.width,qo,Jo),bottomOffset:Ee(a?.bottomOffset,ei,ti),collapsedWidth:Ee(a?.collapsedWidth,oi,ii),barIconSize:Ee(a?.iconSize,ni,ri),maxHeightPercent:Ee(l?.maxHeight,Qo,Zo),zIndex:f!==null?Math.round(f):null}}var ai=["--_arcy-brand-text","--_arcy-brand-bg","--_arcy-brand-bg-hover","--_arcy-brand-bg-active","--_arcy-main-text","--_arcy-main-bg","--_arcy-border-width","--_arcy-border-color","--_arcy-glass-blur","--_arcy-glass-alpha",It,"--arcy-bar-radius","--arcy-bar-shadow","--_arcy-chat-radius","--_arcy-chat-logo-size","--_arcy-chat-welcome-icon-size","--_arcy-chat-shadow","--_arcy-assistant-bg","--_arcy-assistant-text","--_arcy-scroll-width","--_arcy-scroll-track","--_arcy-scroll-thumb","--_arcy-scroll-thumb-hover"];function Xn(e,t){try{for(let n of ai){let r=t.vars[n];r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r);}e.style.setProperty("z-index",t.zIndex===null?vt:String(t.zIndex),"important");}catch(n){h(`The widget could not apply its theme. ${String(n)}`);}}var li="arcy.tokens.",ci=4096,ui=100;function Ue(e){let t=oe(e);if(!t)return null;let n=typeof t.name=="string"?t.name.slice(0,ui):"",r=t.logoUrl,o=Mt(r)?r:null;return {name:n,logoUrl:o}}function jn(e,t=ue()){let n=Q(t),r=li+e;return {read(){let o=oe(Z(n,r));return {tokens:Ft(o?.t),identity:Ue(o?.w)}},remember(o,i){let s=oe(o),f=Ue(i);if(!s&&!f){n.removeItem(r);return}try{let a={t:s??void 0,w:f??void 0};if(JSON.stringify(a).length>ci)return;J(n,r,a);}catch{}}}}var di="arcy.shell.",qn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,fi=/^[a-z]{2}-[A-Z]{2}$/;function pi(e){if(!e||typeof e!="object")return null;let{x:t,y:n}=e;return typeof t!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function mi(e){let t=typeof globalThis<"u"?globalThis.crypto:void 0;if(!e&&t&&typeof t.randomUUID=="function")try{let o=t.randomUUID();if(qn.test(o))return o}catch{}let n=new Uint8Array(16);if(e)e(n);else if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let o=0;o<n.length;o++)n[o]=Math.floor(Math.random()*256);n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let r="";for(let o=0;o<n.length;o++)r+=(n[o]??0).toString(16).padStart(2,"0");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Jn(e,{store:t=ue(),fill:n}={}){let r=Q(t),o=di+e;function i(){return Z(r,o)??{}}function s(a){J(r,o,{...i(),...a});}function f(){let a=i(),l=a.anonymousId;return {anonymousId:typeof l=="string"&&qn.test(l)?l:null,position:pi(a.position),docked:a.docked===true,locale:typeof a.locale=="string"&&fi.test(a.locale)?a.locale:null}}return {read:f,anonymousId(){let a=f().anonymousId;return a||(s({anonymousId:mi(n)}),f().anonymousId)},rememberPosition(a){s({position:a});},rememberDocked(a){s({docked:a});},rememberLocale(a){s({locale:a});},forgetAnonymousId(){let a=i();a.anonymousId!==void 0&&(delete a.anonymousId,Object.keys(a).length===0?r.removeItem(o):J(r,o,a));}}}var hi="arcy.visit.",Qn="first";function Zn(e,t=_e()){let n=Q(t),r=hi+e;return {markFirstVisit(){n.setItem(r,Qn);},isFirstVisit(){return n.getItem(r)===Qn}}}var er="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var Nt=e=>{let t=typeof globalThis<"u"?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){t.getRandomValues(e);return}for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);};function Re(e,t=Nt){let n="",r=Math.floor(e);for(let s=0;s<10;s++)n=(er[r%32]??"0")+n,r=Math.floor(r/32);let o=new Uint8Array(16);t(o);let i="";for(let s=0;s<16;s++)i+=er[(o[s]??0)%32];return n+i}var gi="arcy.chat.",yi=1440*60*1e3;function tr(e,{store:t=ue(),fill:n=Nt,now:r=Date.now}={}){let o=Q(t),i=gi+e;function s(){return Z(o,i)??{}}function f(){let a=Re(r(),n);return J(o,i,{id:a,lastActiveAt:r()}),a}return {id(){let a=s(),l=typeof a.id=="string"?a.id:null,d=typeof a.lastActiveAt=="number"?a.lastActiveAt:null;return l&&d!==null&&r()-d<yi?l:f()},touch(){let a=s();typeof a.id=="string"&&J(o,i,{...a,lastActiveAt:r()});},reset(){f();},adopt(a){return typeof a!="string"||a.length===0?this.id():(J(o,i,{id:a,lastActiveAt:r()}),a)},startNew(){return f()}}}var bi=[["utm_source","utmSource"],["utm_medium","utmMedium"],["utm_campaign","utmCampaign"],["utm_content","utmContent"],["utm_term","utmTerm"]],wi=255,vi=512,Si=/[\u0000-\u001f\u007f]/g;function nr(e,t){let n=e.replace(Si,"").trim();if(n.length!==0)return n.slice(0,t)}function Ei(e){if(!(typeof e!="string"||e.length===0))try{let t=new URL(e),n=t.host;if(!n)return;let r=ke(t.pathname);return nr(r==="/"?n:n+r,vi)}catch{return}}function Ti(e){let t={};if(typeof e!="string"||e.length===0)return t;let n=e.charAt(0)==="?"?e.slice(1):e;for(let r of n.split("&")){let o=r.indexOf("=");if(o<=0)continue;let i=r.slice(0,o).toLowerCase(),s=bi.find(l=>l[0]===i);if(!s)continue;let f=r.slice(o+1).replace(/\+/g," ");try{f=decodeURIComponent(f);}catch{}let a=nr(f,wi);a&&(t[s[1]]=a);}return t}function xi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/Edg[A-Z]?\//.test(t))return "Edge";if(/OPR\/|Opera/.test(t))return "Opera";if(/SamsungBrowser\//.test(t))return "Samsung Internet";if(/Firefox\/|FxiOS\//.test(t))return "Firefox";if(/Chrome\/|CriOS\//.test(t))return "Chrome";if(/Safari\//.test(t))return "Safari"}}function ki(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/iPhone|iPad|iPod/.test(t))return "iOS";if(/Android/.test(t))return "Android";if(/CrOS/.test(t))return "ChromeOS";if(/Windows/.test(t))return "Windows";if(/Mac OS X|Macintosh/.test(t))return "macOS";if(/Linux/.test(t))return "Linux"}}function Ci(e){if(!(typeof e!="number"||!(e>0)))return e<480?"xs":e<768?"sm":e<1024?"md":e<1280?"lg":"xl"}function rr(e){let t={...Ti(e.search)},n=Ei(e.referrer);n&&(t.referrer=n);let r=xi(e.userAgent);r&&(t.browser=r);let o=ki(e.userAgent);o&&(t.os=o);let i=Ci(e.viewportWidth);return i&&(t.viewport=i),Object.keys(t).length>0?t:void 0}var Ai=["ON","REQUIRE_CONSENT","OFF"];function or(e,t){function n(){let o=Z(e,t);if(!o)return {};let i=typeof o.state=="string"&&Ai.indexOf(o.state)!==-1?o.state:void 0,s=typeof o.consent=="boolean"?o.consent:void 0;return {state:i,consent:s}}function r(o){if(o.state===void 0&&o.consent===void 0){e.removeItem(t);return}J(e,t,o);}return {state:()=>n().state??null,consent:()=>n().consent??null,setState(o){r({...n(),state:o});},setConsent(o){let i=n();r({state:i.state,consent:o?true:void 0});},clearState(){r({state:void 0,consent:n().consent});},shouldCapture(){let{state:o,consent:i}=n();return o===void 0||o==="OFF"?false:o==="REQUIRE_CONSENT"?i===true:true}}}var _i=/iPhone|iPod|Android.*Mobile|Windows Phone|BlackBerry|Opera Mini|IEMobile/i,Ii=/iPad|Tablet|PlayBook|Silk|Kindle/i;function ir(e){let t=e?.userAgent??"";return Ii.test(t)||e?.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1?"tablet":_i.test(t)?"mobile":/Android/i.test(t)?"tablet":"desktop"}var ar=100,Ri=4096,Pi=["INPUT","TEXTAREA","SELECT"];function sr(e){if(e.length!==0&&!Me(e.slice(0,Ri)))return e.slice(0,ar)}function Dt(e,t){let n=(e.tagName??"").toUpperCase(),r={tag:n.toLowerCase()},o=e.getAttribute("role");o&&(r.role=o.slice(0,64));let i=e.getAttribute("type");if(i&&(r.type=i.slice(0,32)),Pi.indexOf(n)===-1){let s=(e.textContent??"").replace(/\s+/g," ").trim(),f=sr(s);f&&(r.text=f);}else {let s=e.getAttribute("aria-label")??e.getAttribute("name"),f=sr(s??"");f&&(r.label=f);}if(t){let s=t(e);s&&Object.keys(s).length>0&&(r.fingerprint=s);}return r}function lr(e,t){return Dt(e,t)}function cr(e,t){let n=Dt(e,t),r=e.validity?.valid;return typeof r=="boolean"&&(n.valid=r),n}function ur(e,t){let n=Dt(e,t),r=e.getAttribute("name")??e.getAttribute("id");r&&(n.form=r.slice(0,ar));let o=e.elements?.length;return typeof o=="number"&&(n.fieldCount=o),n}var Li=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Oi="OTHER",Mi=400,dr=200,Fi=/[\u0000-\u001f\u007f]+/g;function Ht(e){let t=null;if(typeof e=="string")t=e;else if(e&&typeof e=="object"){let r=e.message;typeof r=="string"&&(t=r);}if(t===null)return null;let n=t.replace(Fi," ").trim();return n.length===0?null:n.length>dr?n.slice(0,dr):n}function Bt(e){if(typeof e!="string")return "GET";let t=e.toUpperCase();return Li.indexOf(t)===-1?Oi:t}function Ni(e){return typeof e=="number"&&e>=Mi}function fr(e){let{target:t,report:n,ignore:r}=e,o=[];function i(a,l,d){try{if(!Ni(l)||d!==null&&r?.(d))return;n({method:a,status:l,url:d===null?null:Fe(d,t.location?.href)});}catch{}}function s(){let a=t.fetch;if(typeof a!="function")return;let l=function(...d){let b=a.apply(this,d);try{let v=b;if(typeof v?.then!="function")return b;v.then(p=>{let g=p?.status;i(Di(d),g,Bi(d));},()=>{});}catch{}return b};t.fetch=l,o.push(()=>{t.fetch===l&&(t.fetch=a);});}function f(){let a=t.XMLHttpRequest?.prototype,l=a?.open,d=a?.send;if(!a||typeof l!="function"||typeof d!="function"||typeof WeakMap!="function")return;let b=new WeakMap,v=function(...g){let C=l.apply(this,g);try{b.set(this,{method:Bt(g[0]),url:typeof g[1]=="string"?g[1]:null,listening:b.get(this)?.listening??!1});}catch{}return C},p=function(...g){try{let C=this,O=b.get(this);typeof C.addEventListener=="function"&&O?.listening!==!0&&(O&&(O.listening=!0),C.addEventListener("loadend",()=>{let k=b.get(this);i(k?.method??"GET",C.status,k?.url??null);}));}catch{}return d.apply(this,g)};a.open=v,o.push(()=>{a.open===v&&(a.open=l);}),a.send=p,o.push(()=>{a.send===p&&(a.send=d);});}try{s(),f();}catch{for(let a of o)try{a();}catch{}return null}return o.length===0?null:()=>{for(let a of o)try{a();}catch{}o.length=0;}}function Di(e){let t=e[1];if(t&&typeof t=="object"&&typeof t.method=="string")return Bt(t.method);let n=e[0];return n&&typeof n=="object"&&typeof n.method=="string"?Bt(n.method):"GET"}function Bi(e){let t=e[0];if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=t.url;if(typeof n=="string")return n;let r=t.href;return typeof r=="string"?r:null}function pr(e,t,n,r,o){let i={id:e,name:t,occurredAt:n,sessionId:r.sessionId};return r.userId&&(i.userId=r.userId),r.visitorId&&(i.visitorId=r.visitorId),r.route&&(i.route=r.route),r.localeCode&&(i.localeCode=r.localeCode),r.deviceClass&&(i.deviceClass=r.deviceClass),r.flowSessionId&&(i.flowSessionId=r.flowSessionId),o&&Object.keys(o).length>0&&(i.payload=o),i}var Hi=["button","submit","reset","image","hidden","checkbox","radio"],Ui=["INPUT","TEXTAREA","SELECT"];function Vi(e){if(!e||typeof e.getAttribute!="function")return false;let t=(e.tagName??"").toUpperCase();if(Ui.indexOf(t)===-1)return false;if(t!=="INPUT")return true;let n=(e.getAttribute("type")??"text").toLowerCase();return Hi.indexOf(n)===-1}function mr(e){let t=e.value;return typeof t=="string"?t.length===0:t==null}function hr(e){let t=null;return {focus(n){Vi(n)&&(t={element:n,empty:mr(n),filled:false,cleared:false},e.emit("field_focused",n));},change(n){if(!t||t.element!==n)return;let r=mr(n);if(r!==t.empty){if(t.empty=r,!r){if(t.filled)return;t.filled=true,e.emit("input_filled",n);return}t.cleared||(t.cleared=true,e.emit("input_cleared",n));}},blur(n){t&&t.element===n&&(t=null);}}}var Wi=["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","OPTION","LABEL"],$i=["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","textbox","searchbox","slider","spinbutton","treeitem"];function Ki(e,t){let n=(e.tagName??"").toUpperCase();if(Wi.indexOf(n)!==-1)return true;let r=e.getAttribute("role");if(r&&$i.indexOf(r.toLowerCase())!==-1||e.getAttribute("onclick")!==null)return true;let o=e.getAttribute("tabindex");return o!==null&&Number(o)>=0||e.getAttribute("contenteditable")==="true"?true:t?t(e)==="pointer":false}function gr(e,t){let n=e;for(let r=0;n&&r<6;r++){if(Ki(n,t))return n;n=n.parentElement;}return null}var Gi=[25,50,75,100],Yi=250,zi=100;function yr(e){let{readDepth:t,emit:n,setTimeoutImpl:r=(l,d)=>setTimeout(l,d),clearTimeoutImpl:o=l=>clearTimeout(l),throttleMs:i=Yi}=e,s=0,f=null;function a(){f=null;let l=null;try{l=t();}catch{return}if(l===null)return;let d=0;for(let b of Gi)l>=b&&(d=b);d<=s||(s=d,n(d));}return {scrolled(){if(f===null&&!(s>=zi))try{f=r(a,i);}catch{f=null;}},reset(){if(s=0,f!==null){try{o(f);}catch{}f=null;}},dispose(){if(f!==null){try{o(f);}catch{}f=null;}}}}function br(e){let t=e.innerHeight??0,n=e.documentHeight??0;if(!(n-t>0)||!(t>0))return null;let i=((e.scrollY??0)+t)/n*100;return i>0?i>100?100:i:0}var Xi=1800*1e3,ji=60*1e3;function wr({store:e,key:t,now:n,fill:r,windowMs:o=Xi}){function i(l){let d=Z(e,t);return d&&typeof d.id=="string"&&d.id.length>0&&typeof d.seen=="number"&&l-d.seen<o?d:null}function s(l){let d=Re(l,r);return J(e,t,{id:d,seen:l}),d}function f(){let l=n(),d=i(l);return d?(l-d.seen>=ji&&J(e,t,{id:d.id,seen:l}),d.id):s(l)}function a(){let l=n();return i(l)?.id??s(l)}return {touch:f,current:a,peek:()=>Z(e,t),clear(){e.removeItem(t);}}}var Ut="https://api.arcyai.com",qi="/api/v1/sdk/telemetry";function Ji(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3;}return t}function Qi(e){let t=[],n=[],r=13;for(let o of e){let i=Ji(JSON.stringify(o))+1;(n.length>=100||n.length>0&&r+i>65536)&&(t.push(n),n=[],r=13),n.push(o),r+=i;}return n.length>0&&t.push(n),t}function vr(e){let{token:t,apiBase:n=Ut,fetchImpl:r,sendBeacon:o,setTimeoutImpl:i=(S,I)=>setTimeout(S,I),clearTimeoutImpl:s=S=>clearTimeout(S),sessionStore:f,stopKey:a,onTelemetryOff:l}=e,d=`${n}${qi}`,b=[],v=null,p=C(),g=Promise.resolve();function C(){return !f||!a?null:f.getItem(a)==="tracked_events_cap"?"tracked_events_cap":null}function O(S){p=S,b=[],k(),S==="tracked_events_cap"?f&&a&&f.setItem(a,S):l&&l();}function k(){v!==null&&(s(v),v=null);}function Y(){v===null&&(v=i(()=>{v=null,M(false);},5e3));}function N(S){if(p===null){if(b.push(S),b.length>1e3&&b.splice(0,b.length-1e3),b.length>=20){M(false);return}Y();}}async function T(S){try{let I=await S.json();if(I&&typeof I=="object"){let P=I.code;if(typeof P=="string")return P}}catch{}return null}async function w(S){if(!r)return S;let I;try{I=await r(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({events:S}),credentials:"omit"});}catch{return S}return I.status===403?await T(I)==="telemetry_off"?(O("telemetry_off"),[]):[]:I.status===429?await T(I)==="tracked_events_cap"?(O("tracked_events_cap"),[]):S:I.status>=500?S:[]}function _(S){let I=JSON.stringify({events:S}),P=`${d}?token=${encodeURIComponent(t)}`;if(o&&typeof Blob<"u")try{if(o(P,new Blob([I],{type:"application/json"})))return !0}catch{}if(r)try{return r(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:I,keepalive:!0,credentials:"omit"}).catch(()=>{}),!0}catch{return false}return false}async function M(S=false){if(k(),p!==null||b.length===0){await g;return}let I=b;b=[];let P=Qi(I);if(S){for(let V of P)_(V);return}g=g.then(async()=>{let V=[];for(let D of P){if(p!==null)return;V.push(...await w(D));}V.length>0&&p===null&&(b=V.concat(b),b.length>1e3&&b.splice(0,b.length-1e3),Y());}),await g;}return {enqueue:N,flush:M,stopped:()=>p,discard(){b=[],k();},dispose(){k();}}}var Sr="arcy:routechange",Zi="arcy.session.",es="arcy.telemetry.",ts="arcy.telemetry.stop.";function at(e){return e.isTrusted===false}function Vt(e){let{token:t,apiBase:n,describeElement:r,getUserId:o,getVisitorId:i,getFlowSessionId:s,now:f=()=>Date.now(),fill:a}=e,l=e.win!==void 0?e.win:typeof window<"u"?window:null,d=e.doc!==void 0?e.doc:typeof document<"u"?document:null,b=e.localStore??ue(),v=or(b,es+t),p=wr({store:b,key:Zi+t,now:f,fill:a}),g=vr({token:t,apiBase:n,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,sendBeacon:l?.navigator?.sendBeacon&&typeof l.navigator.sendBeacon=="function"?l.navigator.sendBeacon.bind(l.navigator):null,setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl,sessionStore:e.sessionStore??_e(),stopKey:ts+t,onTelemetryOff:()=>v.clearState()}),C=ir(l?.navigator),O=l?.navigator?.language??void 0,k=false,Y=false,N=null,T=false;function w(){return Fe(l?.location?.href)??void 0}function _(E,R,G){if(Y||!v.shouldCapture()||g.stopped()!==null)return false;let ne=f(),pe=p.touch(),me=pr(Re(ne,a),E,ne,{sessionId:pe,userId:o?.()??void 0,visitorId:i?.()??void 0,route:w(),localeCode:O,deviceClass:C,flowSessionId:G?.flowSessionId??s?.()??void 0},R);return G?.flowId&&(me.flowId=G.flowId),G?.flowVersion&&(me.flowVersion=G.flowVersion),G?.stepCvid&&(me.stepCvid=G.stepCvid),g.enqueue(me),true}let M=E=>{try{let R=E;if(at(R))return;let G=l?.getComputedStyle?pe=>{try{return l.getComputedStyle(pe).cursor??null}catch{return null}}:void 0,ne=gr(R.target,G);if(!ne)return;_("interaction_click",lr(ne,r));}catch{}},S=E=>{try{let R=E;if(at(R)||!R.target||typeof R.target.getAttribute!="function")return;_("form_submit",ur(R.target,r));}catch{}},I=()=>{try{let E=w()??null;if(E===N)return;let R=N;N=E,V.reset(),_("navigation",R?{from:R}:void 0);}catch{}},P=hr({emit:(E,R)=>{_(E,cr(R,r));}}),V=yr({readDepth:()=>br({scrollY:l?.scrollY,innerHeight:l?.innerHeight,documentHeight:d?.documentElement?.scrollHeight}),emit:E=>{_("scroll_depth",{percent:E});},setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl}),D=false,U=E=>{try{let R=E;if(at(R)||!R.target)return;P.focus(R.target);}catch{}},K=E=>{try{let R=E;if(at(R)||!R.target)return;P.change(R.target);}catch{}},L=E=>{try{let R=E;if(!R.target)return;P.blur(R.target);}catch{}},B=()=>{try{V.scrolled();}catch{}},de=()=>{try{if(d?.visibilityState==="visible"){_("page_visible");return}_("page_hidden"),g.flush(!0);}catch{}},ee=()=>{try{D||(D=!0,_("session_end")),g.flush(!0);}catch{}},we=E=>{try{let R=E;fe({message:Ht(R.message)??"Uncaught error",kind:"error",source:W(R.filename)});}catch{}},te=E=>{try{fe({message:Ht(E.reason)??"Unhandled promise rejection",kind:"unhandledrejection"});}catch{}};function fe(E){let R={message:E.message,kind:E.kind};E.source&&(R.source=E.source),_("js_error",R);}function W(E){if(typeof E=="string")return Fe(E,l?.location?.href)??void 0}let se=(n??Ut).replace(/\/+$/,""),ae=null;return {start(){k||Y||(k=true,N=w()??null,d?.addEventListener("click",M,true),d?.addEventListener("submit",S,true),d?.addEventListener("focusin",U,true),d?.addEventListener("focusout",L,true),d?.addEventListener("input",K,true),d?.addEventListener("change",K,true),l?.addEventListener(Sr,I),l?.addEventListener("popstate",I),l?.addEventListener("scroll",B,{passive:true}),l?.addEventListener("pagehide",ee),d?.addEventListener("visibilitychange",de),l?.addEventListener("error",we),l?.addEventListener("unhandledrejection",te),l&&ae===null&&(ae=fr({target:l,report:E=>{let R={method:E.method,status:E.status};E.url&&(R.url=E.url),_("request_failed",R);},ignore:E=>E.indexOf(se)===0})),T=!_("navigation")&&v.state()===null);},stop(E){Y=true,k&&(k=false,d?.removeEventListener("click",M,true),d?.removeEventListener("submit",S,true),d?.removeEventListener("focusin",U,true),d?.removeEventListener("focusout",L,true),d?.removeEventListener("input",K,true),d?.removeEventListener("change",K,true),l?.removeEventListener(Sr,I),l?.removeEventListener("popstate",I),l?.removeEventListener("scroll",B),l?.removeEventListener("pagehide",ee),d?.removeEventListener("visibilitychange",de),l?.removeEventListener("error",we),l?.removeEventListener("unhandledrejection",te),ae&&(ae(),ae=null),V.dispose(),E?.discard?g.discard():g.flush(false),g.dispose());},setTelemetryState(E){v.setState(E),T&&(T=false,_("navigation"));},setTelemetryConsent(E){v.setConsent(E),E||g.discard();},track(E,R,G){_(E,R,G);},flush:()=>g.flush(false),sessionId:()=>p.current(),resetSession:()=>p.clear(),stopped:()=>g.stopped(),state:()=>v.state()}}var Er="0.1.1";var ns=["telemetry","locale","defaultOpen","contentLocale","apiBase"];function Tr(){return {userId:null,isAnonymous:false,attributes:{}}}function rs(e,t){return e==null?{ok:true,hash:void 0}:typeof e!="string"||e.length===0?(h(`${t}() was given a userHash that is not a string. Ignoring it.`),{ok:false}):{ok:true,hash:e}}function Wt(e,t){if(e===void 0)return {};if(typeof e!="object"||e===null||Array.isArray(e))return h(`${t}() attributes must be an object. Ignoring the call.`),null;let n={};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;if(o===null){n[r]=null;continue}let i=typeof o;if(i==="string"||i==="number"||i==="boolean"){n[r]=o;continue}if(Array.isArray(o)&&o.every(s=>typeof s=="string")){n[r]=o;continue}h(`${t}() dropped "${r}": an attribute must be a string, number, boolean, null, or an array of strings.`);}return n}var os={cdnBase:null,loadChat:()=>Promise.resolve(null),loadFlow:()=>Promise.resolve(null),loadPicker:()=>Promise.resolve(null)};function xr(e){return is({chunks:e}).api}function is(e={}){let t=e.chunks??os,n=zt();function r(){let c=i.apiBase;return typeof c=="string"&&c.length>0?c.replace(/\/+$/,""):e.apiBase??At}let o=null,i={},s=Tr(),f=false,a=null,l=null,d=null,b=false,v=null,p=null,g=null,C=0,O,k,Y=false,N=null,T=null,w=null,_=null,M=null,S=st,I=null,P=null,V=null,D=null,U=null,K=false,L=false;function B(c){return o===null?(h(`${c}() was called before init(). Ignoring.`),false):true}async function de(c,y){if(typeof c!="string"||c.length===0){h("init() needs an environment token. Ignoring the call.");return}if(o!==null){h("init() has already been called. Ignoring the second call.");return}if(o=c,i={},y!==void 0)if(typeof y!="object"||y===null)h("init() options must be an object. Continuing without them.");else for(let[A,x]of Object.entries(y)){if(!ns.includes(A)){h(`init() ignored unknown option "${A}". Only telemetry, locale, defaultOpen, contentLocale, and apiBase can be set in code; everything else is configured in the dashboard.`);continue}i[A]=x;}typeof window<"u"&&tn(window,{apiBase:r(),cdnBase:t.cdnBase}),ee(c),we(c),te(c),await xe(),n.emit("ready"),i.defaultOpen&&re();}function ee(c){try{N=Jn(c);let y=N.read().anonymousId!==null;_=N.anonymousId(),T=Zn(c),y||T.markFirstVisit();}catch(y){N=null,_=null,h(`The ARCY session could not be started. ${String(y)}`);}try{w=tr(c);}catch(y){w=null,h(`The ARCY session could not be started. ${String(y)}`);}try{M=jn(c);let y=M.read();S=y.tokens,I=y.identity;}catch(y){M=null,S=st,h(`The ARCY session could not be started. ${String(y)}`);}try{p=Vt({token:c,apiBase:r(),fetchImpl:e.fetchImpl,describeElement:y=>qt(y),getUserId:()=>s.isAnonymous?null:s.userId,getVisitorId:()=>_}),i.telemetry!==void 0&&p.setTelemetryConsent(i.telemetry===!0),p.start();}catch(y){h(`Telemetry could not start. ${String(y)}`);}try{g=bn({token:c,apiBase:r(),fetchImpl:e.fetchImpl,setTimeoutImpl:e.setTimeoutImpl});}catch(y){h(`The ARCY session could not be started. ${String(y)}`);}se();}function we(c){if(!(typeof window>"u"))try{hn({win:window,token:c,loadChunk:t.loadPicker,apiBase:r(),fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl,onVerified:()=>p?.stop({discard:!0})});}catch(y){h(`Design mode could not start. ${String(y)}`);}}function te(c){if(!(typeof window>"u"))try{let y=gn(window,c);if(!y)return;p?.stop({discard:!0}),b=!0,v=y;}catch(y){h(`The preview could not start. ${String(y)}`);}}function fe(c){return yn({apiBase:r(),token:o??"",nonce:c,sessionToken:g?.config()?.sessionToken??null,userTraits:s.attributes,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl})}function W(){L=false,a?.unmount(),a=null,l?.destroy(),l=null,d?.destroy(),d=null,P=null,V=null,D=null,ge();}function se(){try{a||G(),ae(),ne(),l?.refreshChrome(),L&&(L=!1,re());}catch(c){h(`The chat bar could not render. ${String(c)}`);}}function ae(){try{let c=a?.getHost();if(!a||!c)return;Xn(c,S),a.setGeometry({widthPercent:S.widthPercent??rt,bottomOffset:S.bottomOffset??tt,collapsedWidth:S.collapsedWidth??ot}),a.setIconSize(S.barIconSize??nt);}catch(c){h(`The widget could not apply its theme. ${String(c)}`);}}function E(){let c=g?.config()?.widget,y=Ue(c)??I;if(!y)return null;let A=Oe=>typeof Oe=="string"?Oe:"",x=c?.chrome&&typeof c.chrome=="object"&&!Array.isArray(c.chrome)?{...Ze,...c.chrome}:Ze,X=c?.welcomeIconUrl,ye=c?.chatBarIconUrl,Ce=r();return {name:y.name,logoUrl:it(y.logoUrl,Ce),welcomeIconUrl:it(X,Ce),chatBarIconUrl:it(ye,Ce),welcomeMessage:A(c?.welcomeMessage),inputPlaceholder:A(c?.inputPlaceholder),welcomeHeadline:A(c?.welcomeHeadline),allowImageUpload:c?.allowImageUpload===true,barDraggable:c?.barDraggable===true,privacyPolicyUrl:typeof c?.privacyPolicyUrl=="string"&&/^https:\/\//i.test(c.privacyPolicyUrl)?c.privacyPolicyUrl:null,chrome:x,locales:R(c?.locales),activeLocale:typeof c?.activeLocale=="string"?c.activeLocale:""}}function R(c){if(!Array.isArray(c))return [];let y=[];for(let A of c){if(!A||typeof A!="object")continue;let{code:x,label:X}=A;typeof x!="string"||x.length===0||typeof X!="string"||X.length===0||y.push({code:x,label:X});}return y}function G(){try{a=Gn({geometry:{widthPercent:S.widthPercent??rt,bottomOffset:S.bottomOffset??tt,collapsedWidth:S.collapsedWidth??ot},labels:pe(),iconUrl:E()?.chatBarIconUrl??null,welcomeIconUrl:E()?.welcomeIconUrl??null,iconSize:S.barIconSize??nt,onActivate:()=>re(),onSubmit:c=>{if(K||re(),P){P(c);return}U=c;},onAttach:()=>{re();},onFiles:c=>{if(re(),V){V(c);return}D=c;},onDismiss:()=>{ge();},onStop:()=>{d?.stop(),Te();},onGeometryChange:()=>l?.reposition(),readPosition:()=>N?.read().position??null,onPositionChange:c=>N?.rememberPosition(c),readDocked:()=>N?.read().docked===!0,onDockedChange:c=>N?.rememberDocked(c),onUndock:()=>re()}),a.mount(),ct();}catch(c){h(`The chat bar could not render. ${String(c)}`);}}function ne(){try{if(!a)return;let c=E();a.setLabels(pe()),a.getMode()!=="flow"&&a.setPlaceholder(c?.inputPlaceholder??null),a.setAttachEnabled(c?.allowImageUpload===!0),a.setDraggable(c?.barDraggable===!0),a.setIcon(c?.chatBarIconUrl??null),a.setWelcomeIcon(c?.welcomeIconUrl??null);}catch(c){h(`The widget could not apply its texts. ${String(c)}`);}}function pe(){let c=E()?.chrome??Ze;return {send:c.send,attachMenu:c.attachMenu,attachImage:c.attachImage,flowStop:c.flowStop,openChat:c.openChat,moveBar:c.moveBar,flowStep:c.flowStep}}let me=600,he=4e3,ie=null,z=[],Ve=null;function We(c){let y=c.phase==="done"?he:me;try{ie=setTimeout(()=>{for(ie=null;z.length>0;){let A=z.shift();if(Pe(A),A!==null){We(A);return}}},y);}catch{}}function lt(c){if(c===null){let y=Ve?.phase==="done"||z.some(A=>A?.phase==="done");if(ie!==null&&y){z[z.length-1]!==null&&z.push(null);return}Te();return}if(ie!==null){let y=z[z.length-1];if(c.phase!=="done"&&y!==void 0&&y!==null&&y.phase!=="done"){z[z.length-1]=c;return}z.push(c);return}Pe(c),We(c);}function Te(){if(ie!==null){try{clearTimeout(ie);}catch{}ie=null;}z=[],Pe(null);}function Pe(c){Ve=c;try{if(c&&a?.setDocked(!1),a?.setFlow(c),c){ge();return}a?.setPlaceholder(E()?.inputPlaceholder??null);}catch(y){h(`The flow status could not be shown. ${String(y)}`);}}function ct(){try{let c=a?.getRoot(),y=a?.getHost(),A=a;if(!c||!y||!A)return;l=xn({root:c,host:y,loadChunk:t.loadChat,onRequestClose:()=>ge(),bar:{onSubmit:x=>{if(P=x,U!==null){let X=U;U=null,x(X);}},onFiles:x=>{if(V=x,D!==null){let X=D;D=null,x(X);}},setPlaceholder:x=>A.setPlaceholder(x),setDisabled:x=>A.setDisabled(x),setMode:x=>A.setMode(x),setFlow:x=>A.setFlow(x),setAwaitingInput:x=>A.setAwaitingInput(x),setDisclaimer:x=>A.setDisclaimer(x),setAttachEnabled:x=>A.setAttachEnabled(x),setAttachmentCount:x=>A.setAttachmentCount(x),attachmentSlot:()=>A.attachmentSlot(),focusInput:()=>A.focusInput(),getMetrics:()=>A.getMetrics(),dock:()=>A.setDocked(!0)},apiBase:r(),getSessionToken:()=>g?.config()?.sessionToken??null,getSessionId:()=>p?.sessionId(),getRoute:()=>typeof window<"u"?window.location.pathname:"",getMaxHeightPercent:()=>S.maxHeightPercent??void 0,onStartFlow:x=>{Le(),d?.start(x);},onStopFlow:()=>{d?.stop(),Te();},publicKey:o??void 0,getConversationId:()=>w?.id()??null,setConversationId:x=>x===null?w?.startNew()??null:w?.adopt(x)??null,touchConversation:()=>w?.touch(),getVisitorId:()=>_,onOrgCapExceeded:()=>W(),track:(x,X,ye)=>{p?.track(x,ye,X);},getWidget:()=>E(),onSelectLocale:x=>{$e(x);}});}catch(c){h(`The chat panel could not be prepared. ${String(c)}`);}}async function $e(c){try{if(typeof c!="string"||c.length===0||N?.read().locale===c)return;N?.rememberLocale(c),await xe(),ne(),l?.refreshChrome();}catch(y){h(`The widget could not change its language. ${String(y)}`);}}function ut(){if(!o)return null;let c=g?.config()?.sessionToken;if(!c)return null;let y=T;return {apiBase:r(),token:o,sessionToken:c,sessionId:p?.sessionId(),getTrait:A=>{let x=s.attributes[A];if(!(x==null||Array.isArray(x)))return x},...y?{isFirstVisit:()=>y.isFirstVisit()}:{},promptFill:A=>(a?.setDocked(false),K=true,(l?.promptFill(A)??Promise.resolve(null)).finally(()=>{K=false;})),cancelFill:()=>{K=false,l?.cancelFill();},onFailure:()=>{f||re(),l?.showFlowFailure();},track:(A,x,X)=>{p?.track(A,X,x);},onStatus:A=>lt(A),getBottomOcclusion:()=>{let A=a?.getMetrics();return A?A.bottomOffset+A.keyboardOffset+A.height:0}}}function Le(){if(!d)try{let c=ut();if(!c)return;d=In({context:c,loadChunk:t.loadFlow});}catch(c){h(`The flow engine could not be prepared. ${String(c)}`);}}async function xe(){try{await pt();}catch(c){h(`The ARCY session could not be started. ${String(c)}`);}try{let c=g?.config();if(c){let y=(c.customization??{}).tokens;M?.remember(y,c.widget),S=Ft(y),I=Ue(c.widget)??I;}}catch(c){h(`The widget could not read its theme. ${String(c)}`);}if(b||(Le(),d&&(b=true,d.resume())),v){let c=v;v=null,(async()=>{if(Le(),!d)return;if(c.kind==="pending"){await d.resumePreview();return}let y=await fe(c.nonce);y&&await d.startPreview(y);})().catch(y=>h(`The preview could not run. ${String(y)}`));}se();}function dt(){if(O!==void 0)return O;try{let c=typeof window<"u"?window.location.pathname:null;return typeof c!="string"||!c.startsWith("/")?void 0:(O=ke(c),O)}catch{return}}function ft(){if(Y)return k;Y=true;try{return typeof window>"u"?void 0:(k=rr({referrer:typeof document<"u"?document.referrer:null,search:window.location?.search??null,userAgent:typeof navigator<"u"?navigator.userAgent:null,viewportWidth:window.innerWidth}),k)}catch{return}}async function pt(){if(!g||!p)return;let c=++C,y=await g.sync({sessionId:p.sessionId(),route:dt(),sessionContext:ft(),visitorId:_??void 0,userId:s.isAnonymous?void 0:s.userId??void 0,userHash:s.isAnonymous?void 0:s.userHash,userTraits:Object.keys(s.attributes).length?s.attributes:void 0,uiLanguage:i.locale==="en"||i.locale==="tr"?i.locale:void 0,contentLocale:typeof i.contentLocale=="string"?i.contentLocale:void 0,viewerLocale:N?.read().locale??void 0});if(!y.ok){h("The ARCY session could not be started. The widget will keep working, and telemetry stays off until configuration arrives.");return}c===C&&(y.config.identityAccepted===false&&h("This environment enforces identity verification and no valid userHash was supplied, so this user was not identified and none of their attributes were stored. Pass a signed userHash: arcy.identify(userId, attributes, { userHash }). See Settings > Identity verification in the ARCY dashboard."),y.config.behavioralTelemetry&&p.setTelemetryState(y.config.behavioralTelemetry));}async function mt(c,y,A){if(!B("identify"))return;if(typeof c!="string"||c.length===0){h("identify() needs a user id. Ignoring the call.");return}let x=Wt(y,"identify");if(x===null)return;let X=rs((A??{}).userHash,"identify");if(!X.ok)return;let ye=s.userId===c&&!s.isAnonymous;s={userId:c,isAnonymous:false,attributes:ye?{...s.attributes,...x}:x,userHash:ye?X.hash??s.userHash:X.hash},await xe();}async function ht(c){if(!B("identifyAnonymous"))return;let y=Wt(c,"identifyAnonymous");y!==null&&(s={userId:null,isAnonymous:true,attributes:y},await xe());}async function le(c){if(!B("updateUser"))return;if(!s.userId&&!s.isAnonymous){h("updateUser() was called before identify() or identifyAnonymous(). Ignoring the call.");return}let y=Wt(c,"updateUser");y!==null&&(s={...s,attributes:{...s.attributes,...y}},await xe());}function Ke(){s=Tr(),N?.forgetAnonymousId(),_=N?.anonymousId()??null,p?.resetSession(),w?.reset(),ge();}function re(){if(B("open")){if(!a){L=true;return}f||(a?.setDocked(false),f=true,a?.setMode("open"),l?.open(),n.emit("open"));}}function ge(){f&&(f=false,a?.setMode("idle"),l?.close(),n.emit("close"));}function Ge(c,y){return n.on(c,y)}return {api:{init:de,identify:mt,identifyAnonymous:ht,updateUser:le,reset:Ke,open:re,close:ge,on:Ge,VERSION:Er},getToken:()=>o,getOptions:()=>i,getIdentity:()=>s,isOpen:()=>f,getBar:()=>a,getChatController:()=>l,getFlowController:()=>d,getTelemetry:()=>p,getConfig:()=>g?.config()??null,selectLocale:$e,getShellState:()=>N,getTokens:()=>S,getWidgetChrome:()=>E()}}var kr={cdnBase:Rt,loadChat:(e,t,n)=>Tn(e,Rt,t,n),loadFlow:(e,t,n)=>_n(e,An,t,n),loadPicker:(e,t,n)=>mn(e,pn,t,n)};function Cr(e,t){let n=e.q;for(;n.length>0;){let r=n.shift();if(!r)break;let o=t[r.method];if(typeof o!="function"){r.resolve();continue}try{let i=o(...r.args);i&&typeof i.then=="function"?i.then(()=>r.resolve(),()=>r.resolve()):r.resolve();}catch{r.resolve();}}}var Ar=xr(kr);if(typeof window<"u"){let e=window.arcy;window.arcy=Ar,e&&Array.isArray(e.q)&&Cr(e,Ar);}
568
+ })();