arcy.js 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arcy.chat.39921845e233.js → arcy.chat.24c8e3d6804c.js} +6 -5
- package/dist/{arcy.legacy.7037dec7a67f.js → arcy.legacy.4e373458bb24.js} +1 -1
- package/dist/arcy.loader.js +1 -1
- package/dist/{arcy.modern.0ffea3108a8d.js → arcy.modern.336f518dd090.js} +1 -1
- package/dist/{chat-IU4IJMGO.js → chat-HNE6525R.js} +6 -5
- package/dist/index.cjs +6 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -148,7 +148,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
|
|
|
148
148
|
.${M}[data-role="system"] {
|
|
149
149
|
align-self: flex-start;
|
|
150
150
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
151
|
-
color: var(--_arcy-main-text, #101828);
|
|
151
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/* \u2500\u2500 Rendered markdown inside an answer (D1023, ADR 0129; D1034) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
@@ -203,7 +203,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
|
|
|
203
203
|
font-size: 0.9em;
|
|
204
204
|
padding: 1px 4px;
|
|
205
205
|
border-radius: 4px;
|
|
206
|
-
background: color-mix(in srgb,
|
|
206
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
207
207
|
white-space: pre-wrap;
|
|
208
208
|
overflow-wrap: break-word;
|
|
209
209
|
}
|
|
@@ -212,8 +212,8 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
|
|
|
212
212
|
margin: 0 0 8px;
|
|
213
213
|
padding: 10px 12px;
|
|
214
214
|
border-radius: 8px;
|
|
215
|
-
background: color-mix(in srgb,
|
|
216
|
-
border: 1px solid color-mix(in srgb,
|
|
215
|
+
background: color-mix(in srgb, currentColor 10%, transparent);
|
|
216
|
+
border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
|
|
217
217
|
overflow-x: auto;
|
|
218
218
|
white-space: pre;
|
|
219
219
|
}
|
|
@@ -396,13 +396,14 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
|
|
|
396
396
|
padding: 12px;
|
|
397
397
|
border-radius: 12px;
|
|
398
398
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
399
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
.${ce} span {
|
|
402
403
|
width: 6px;
|
|
403
404
|
height: 6px;
|
|
404
405
|
border-radius: 999px;
|
|
405
|
-
background: color-mix(in srgb,
|
|
406
|
+
background: color-mix(in srgb, currentColor 55%, transparent);
|
|
406
407
|
animation: arcy-chat-typing 1.2s ease-in-out infinite;
|
|
407
408
|
}
|
|
408
409
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
var qr=Object.defineProperty,Jr=Object.defineProperties;var Qr=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var Zr=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?qr(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Zr.call(t,n)&&fn(e,n,t[n]);if(dn)for(var n of dn(t))eo.call(t,n)&&fn(e,n,t[n]);return e},ae=(e,t)=>Jr(e,Qr(t));var H=(e,t,n)=>new Promise((r,s)=>{var l=o=>{try{f(n.next(o));}catch(i){s(i);}},a=o=>{try{f(n.throw(o));}catch(i){s(i);}},f=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,a);f((n=n.apply(e,t)).next());});function w(e){typeof console!="undefined"&&console.warn&&console.warn(`[arcy] ${e}`);}function pn(){let e=new Map;function t(r,s){if(typeof s!="function")return w(`on("${r}") needs a function. Ignoring.`),()=>{};let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{l.delete(s);}}function n(r){let s=e.get(r);if(s)for(let l of [...s])try{l();}catch(a){w(`A "${r}" handler threw. ${String(a)}`);}}return {on:t,emit:n}}function kt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var mn=[/[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],to="[masked]";function Xe(e){return mn.some(t=>(t.lastIndex=0,t.test(e)))}var At=4096,no=100,ro=64;function ot(e){if(!e)return;let t=e.slice(0,At);if(e.length>At){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,At-no):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of mn)n=n.replace(r,to);return n.slice(0,80)}}function gn(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 oo=["data-testid","data-test","data-cy","id","name","aria-label"],io=["data-testid","data-test","data-cy"],so=64;function ao(e){for(let t of io){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>so)&&!Xe(r))return r}}var lo=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function co(e){let t=kt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let s of oo){let l=t.getAttribute(s);if(l===null||s==="id"&&!gn(l))continue;let a=ot(l);if(a!==void 0)return {tag:n,attr:s,value:a}}let r=t.getAttribute("role");if(r!==null&&lo.has(r))return {tag:n,attr:"role",value:r};t=kt(t);}}function uo(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function hn(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:uo(e)},n=ot(e.textContent);n!==void 0&&(t.text=n);let r=ot(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let s=ot(e.getAttribute("placeholder"));s!==void 0&&(t.placeholder=s);let l=e.getAttribute("id");l!==null&&gn(l)&&!Xe(l)&&(t.id=l);let a=e.getAttribute("role");if(a!==null){let i=a.trim();i!==""&&i.length<=ro&&!Xe(i)&&(t.role=i);}let f=ao(e);f!==void 0&&(t.testId=f);let o=co(e);return o!==void 0&&(t.ancestorTag=o.tag,t.ancestorAttr=o.attr,t.ancestorValue=o.value),t}var yn="arcy.picker.73f47221b73c.js",bn="arcy.chat.
|
|
2
|
+
var qr=Object.defineProperty,Jr=Object.defineProperties;var Qr=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var Zr=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?qr(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Zr.call(t,n)&&fn(e,n,t[n]);if(dn)for(var n of dn(t))eo.call(t,n)&&fn(e,n,t[n]);return e},ae=(e,t)=>Jr(e,Qr(t));var H=(e,t,n)=>new Promise((r,s)=>{var l=o=>{try{f(n.next(o));}catch(i){s(i);}},a=o=>{try{f(n.throw(o));}catch(i){s(i);}},f=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,a);f((n=n.apply(e,t)).next());});function w(e){typeof console!="undefined"&&console.warn&&console.warn(`[arcy] ${e}`);}function pn(){let e=new Map;function t(r,s){if(typeof s!="function")return w(`on("${r}") needs a function. Ignoring.`),()=>{};let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{l.delete(s);}}function n(r){let s=e.get(r);if(s)for(let l of [...s])try{l();}catch(a){w(`A "${r}" handler threw. ${String(a)}`);}}return {on:t,emit:n}}function kt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var mn=[/[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],to="[masked]";function Xe(e){return mn.some(t=>(t.lastIndex=0,t.test(e)))}var At=4096,no=100,ro=64;function ot(e){if(!e)return;let t=e.slice(0,At);if(e.length>At){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,At-no):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of mn)n=n.replace(r,to);return n.slice(0,80)}}function gn(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 oo=["data-testid","data-test","data-cy","id","name","aria-label"],io=["data-testid","data-test","data-cy"],so=64;function ao(e){for(let t of io){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>so)&&!Xe(r))return r}}var lo=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function co(e){let t=kt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let s of oo){let l=t.getAttribute(s);if(l===null||s==="id"&&!gn(l))continue;let a=ot(l);if(a!==void 0)return {tag:n,attr:s,value:a}}let r=t.getAttribute("role");if(r!==null&&lo.has(r))return {tag:n,attr:"role",value:r};t=kt(t);}}function uo(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function hn(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:uo(e)},n=ot(e.textContent);n!==void 0&&(t.text=n);let r=ot(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let s=ot(e.getAttribute("placeholder"));s!==void 0&&(t.placeholder=s);let l=e.getAttribute("id");l!==null&&gn(l)&&!Xe(l)&&(t.id=l);let a=e.getAttribute("role");if(a!==null){let i=a.trim();i!==""&&i.length<=ro&&!Xe(i)&&(t.role=i);}let f=ao(e);f!==void 0&&(t.testId=f);let o=co(e);return o!==void 0&&(t.ancestorTag=o.tag,t.ancestorAttr=o.attr,t.ancestorValue=o.value),t}var yn="arcy.picker.73f47221b73c.js",bn="arcy.chat.24c8e3d6804c.js",wn="arcy.flow.fef131718e42.js";var fo=/^(?:\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,po=/^[^@\s/]+@[^@\s/]+\.[^@\s/]+$/;function mo(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(t){return e}}function vn(e){return e.length===0?false:fo.test(e)?true:po.test(mo(e))}function Be(e){let n=e.split("/").map(r=>vn(r)?":id":r).join("/");for(;n.length>1&&n.charAt(n.length-1)==="/";)n=n.slice(0,-1);return n.length===0?"/":n}function go(e){if(e.length===0)return "";let t=[];for(let n of e.split("&")){if(n.length===0)continue;let r=n.indexOf("="),s=r===-1?n:n.slice(0,r);if(s.length===0)continue;let l=vn(s)?":id":s;t.indexOf(l)===-1&&t.push(l);}return t.length===0?"":(t.sort(),`?${t.join("&")}`)}function ho(e,t){var n;try{let r=new URL(e,t!=null?t:void 0);return {path:r.pathname,query:r.search.slice(1)}}catch(r){let s=(n=e.split("#")[0])!=null?n:"";if(!s.startsWith("/"))return null;let l=s.indexOf("?");return l===-1?{path:s,query:""}:{path:s.slice(0,l),query:s.slice(l+1)}}}function je(e,t){if(typeof e!="string"||e.length===0)return null;let n=ho(e,t);if(n===null)return null;let r=Be(n.path);if(!r)return null;if(r.length>=2048)return r.slice(0,2048);let s=go(n.query);return s.length===0||r.length+s.length>2048?r:r+s}function yo(e){try{let t=e.currentScript,n=t==null?void 0:t.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let s=0;s<r.length;s++){let l=r[s].nonce;if(typeof l=="string"&&l.length>0)return l}return null}catch(t){return null}}var bo=typeof document!="undefined"?yo(document):null;function wo(){return bo}function Le(e){let t=wo();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch(n){}}var vo="https://docs.arcyai.com/troubleshooting#content-security-policy";function _t(e){try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function So(e){var s;let t=_t(e.apiBase),n=e.cdnBase?_t(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((s=e.docsUrl)!=null?s:vo),r.join(`
|
|
3
3
|
`)}function Sn(e,t){let n=[t.apiBase,t.cdnBase].filter(s=>typeof s=="string"&&s.length>0).map(_t).filter(s=>s!==null),r=()=>{};try{let s=l=>{let a=l.blockedURI;(a==="inline"||n.some(o=>a==null?void 0:a.startsWith(o)))&&(r(),w(So(t)));};e.document.addEventListener("securitypolicyviolation",s),r=()=>{try{e.document.removeEventListener("securitypolicyviolation",s);}catch(l){}};}catch(s){}return ()=>r()}var It="__arcyPicker";var qe=2,En="arcy:design-mode:ready",Tn="arcy:design-mode:pick",xn="arcy:design-mode:exit",kn="arcy:design-mode:screenshot";var _n="arcy-widget",An="data-arcy",Rt="2147483000",Eo=[["position","fixed"],["inset","0"],["z-index",Rt],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],To=[["margin","0"],["padding","0"]],Cn="data-arcy-style",Je=new Map;function xo(e=_n){let t=Je.get(e);return t!==void 0&&t.host.isConnected}function it(e={}){var s,l,a;if(typeof document=="undefined")return null;let t=(s=e.id)!=null?s:_n,n=e.container;if(xo(t))return w("This ARCY surface is already on this page. Ignoring the second mount."),null;Je.delete(t);let r=(l=n!=null?n:document.body)!=null?l:document.documentElement;if(!r)return w("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let f=document.querySelectorAll(`[${An}]`);for(let o=0;o<f.length;o+=1)if(((a=f[o])==null?void 0:a.id)===t)return w("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let f=document.createElement("div");f.id=t,f.setAttribute(An,"");for(let[h,v]of Eo)f.style.setProperty(h,v,"important");for(let[h,v]of To)f.style.setProperty(h,v);let o=f,i=!1;try{f.attachShadow&&(o=f.attachShadow({mode:"closed"}),i=!0);}catch(h){}r.appendChild(f),Ao(f);let u={host:f,root:o,isolated:i,destroy(){try{f.parentNode&&f.parentNode.removeChild(f);}catch(h){}Je.get(t)===u&&Je.delete(t);}};return Je.set(t,u),u}catch(f){return w(`The widget could not mount. ${String(f)}`),null}}var ko=["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 Ao(e){let t=n=>{try{n.stopPropagation();}catch(r){}};for(let n of ko)try{e.addEventListener(n,t);}catch(r){}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||Pt(e.ownerDocument,e);});}catch(n){}}function Pt(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(n){}}function In(e,t){var n;if(!e.isolated)return false;try{let r=e.root.querySelector(`[${Cn}]`);if(r)return r.textContent=`${(n=r.textContent)!=null?n:""}
|
|
4
4
|
${t}`,!0;let s=e.host.ownerDocument.createElement("style");return Le(s),s.setAttribute(Cn,""),s.textContent=t,e.root.appendChild(s),!0}catch(r){return w(`The widget could not apply its styles. ${String(r)}`),false}}var Co="arcy-picker-notice",_o=[["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)"]],Ro=[["font-weight","600"],["margin-bottom","4px"]],Po=[["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 st(e,t){for(let[n,r]of t)e.style.setProperty(n,r);}var Rn=false;function at(e){if(Rn)return;let t=null;try{if(t=it({id:Co}),!t)return;Rn=!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[o,i]of _o)r.style.setProperty(o,i,"important");st(r,Io);let s=n.createElement("div");st(s,Ro),s.textContent="ARCY element picker did not start";let l=n.createElement("div");st(l,Po),l.textContent=e;let a=n.createElement("button");a.type="button",st(a,Lo),a.textContent="Dismiss";let f=t;a.addEventListener("click",()=>{try{f.destroy();}catch(o){}}),r.append(s,l,a),t.root.appendChild(r);}catch(n){try{t==null||t.destroy();}catch(r){}}}function Se(e){w(e),at(e);}var Lt="arcy_picker",Oo="/api/v1/sdk/tagging/verify",Ln="https://cdn.arcyai.com";var Mo=15e3,Fo=1e4;function No(e,t){var n;return (n=Ot(e))!=null?n:Ot(t)}function Ot(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Lt);return t&&t.length>0?t:null}catch(t){return null}}function Do(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Lt),r=Ot(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Lt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Bo(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,fetchImpl:s,timeoutMs:l=Fo,setTimeoutImpl:a=(i,u)=>setTimeout(i,u)}=e;if(!s)return null;let f=()=>H(null,null,function*(){try{let i=yield s(`${t}${Oo}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r}),credentials:"omit"});if(!i.ok)return null;let u=yield i.json();if((u==null?void 0:u.ok)!==!0)return null;let h=Ho(u.returnOrigin);return h?{returnOrigin:h,screenshotsEnabled:u.elementScreenshotsEnabled!==!1}:(Se("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(i){return null}}),o=new Promise(i=>{try{a(()=>i(null),l);}catch(u){}});return Promise.race([f(),o])})}function Ho(e){if(typeof e!="string"||e.length===0)return null;try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function On(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,Se(p));},u=()=>{let p;try{p=e[It];}catch(k){return i("The element picker registration could not be read. Design mode is off."),null}if(!p)return null;if(typeof p.mount!="function")return i("The element picker registered something unusable. Design mode is off."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The element picker on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to use design mode.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[It]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${yn}`;let b=a.src;a.onload=()=>h(()=>Se("The element picker loaded but did not register. Design mode is off.")),a.onerror=()=>{try{Se(`Failed to load ${b}. Design mode is off. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){Se(`The element picker could not load. ${String(p)}`),f(null);return}try{r(()=>{l||Se("The element picker did not load in time. Design mode is off."),f(null);},n);}catch(p){}})}function Uo(e){try{let t=e.location.pathname;return typeof t!="string"||!t.startsWith("/")?"/":Be(t)}catch(t){return "/"}}function Vo(e){try{let t=e.opener;return !!t&&!t.closed}catch(t){return false}}function lt(e,t,n){try{let r=e.opener;if(!r||r.closed){w("The ARCY dashboard window is gone, so that pick could not be sent.");return}r.postMessage(n,t);}catch(r){w(`That pick could not be sent to the ARCY dashboard. ${String(r)}`);}}function Mn(e){return H(this,null,function*(){try{let{win:t,token:n,apiBase:r,fetchImpl:s,onVerified:l,loadChunk:a,loadTimeoutMs:f=Mo,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e,i=No(t.location.search,t.location.hash);if(!i)return "no_nonce";if(Do(t),!Vo(t))return Se("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 u=yield Bo({apiBase:r,token:n,nonce:i,fetchImpl:s,setTimeoutImpl:o});if(!u)return Se("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{l();}catch(k){}let h=yield a(t,f,o);if(!h)return "load_failed";let{returnOrigin:v,screenshotsEnabled:p}=u;return h.mount({screenshotsEnabled:p,onPick:(k,D)=>{lt(t,v,{type:Tn,protocol:qe,target:k,route:Uo(t),matchCount:D});},onScreenshot:k=>{lt(t,v,{type:kn,protocol:qe,screenshot:k});},onExit:()=>{lt(t,v,{type:xn,protocol:qe});}})?(lt(t,v,{type:En,protocol:qe}),"active"):(Se("The element picker could not start. Design mode is off."),"mount_failed")}catch(t){return Se(`Design mode could not start. ${String(t)}`),"load_failed"}})}var Mt={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function oe(e){return e?{getItem(t){try{return e.getItem(t)}catch(n){return null}},setItem(t,n){try{e.setItem(t,n);}catch(r){}},removeItem(t){try{e.removeItem(t);}catch(n){}}}:Mt}function Ee(){try{let e=globalThis.localStorage;return oe(e)}catch(e){return Mt}}function Ve(){try{let e=globalThis.sessionStorage;return oe(e)}catch(e){return Mt}}function ie(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(r){return null}}function ne(e,t,n){try{e.setItem(t,JSON.stringify(n));}catch(r){}}var Wo="arcy.preview.";function ct(e,t=Ve()){try{return oe(t).getItem(Wo+e)!==null}catch(n){return false}}var Ft="arcy_preview",$o=1,Ko="/api/v1/sdk/flows/preview/verify",Go=1e4;function Yo(e,t){var n;return (n=Nt(e))!=null?n:Nt(t)}function Nt(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Ft);return t&&t.length>0?t:null}catch(t){return null}}function zo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Ft),r=Nt(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Ft),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Fn(e,t){try{let n=Yo(e.location.search,e.location.hash);return n?(zo(e),{kind:"nonce",nonce:n}):ct(t)?{kind:"pending"}:null}catch(n){return null}}function Nn(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,sessionToken:s,userTraits:l,fetchImpl:a,timeoutMs:f=Go,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e;if(!a)return null;let i=k=>{w(k);try{at(k);}catch(D){}return null},u=()=>H(null,null,function*(){try{let k=yield a(`${t}${Ko}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify($($({token:r},s?{sessionToken:s}:{}),l&&Object.keys(l).length>0?{userTraits:l}:{})),credentials:"omit"});if(!k.ok)return i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again.");let D=yield k.json();return (D==null?void 0:D.ok)!==!0||D.flow===void 0||D.flow===null?i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again."):D.protocol!==$o?i("This page runs an older version of arcy.js than the dashboard expects. The preview cannot run until the script updates."):D.flow}catch(k){return i("ARCY could not reach its server to start this preview. Check the connection and press Preview again.")}}),h=false,v,p=new Promise(k=>{try{v=o(()=>{h||(h=!0,k(i("ARCY took too long to verify this preview link. Close this tab and press Preview in the dashboard again.")));},f);}catch(D){}}),b=yield Promise.race([u().then(k=>(h=true,k)),p]);try{v!==void 0&&clearTimeout(v);}catch(k){}return b})}var Dt="https://api.arcyai.com",Xo="/api/v1/sdk/session/init";var jo=["ON","REQUIRE_CONSENT","OFF"];function qo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,n=t.behavioralTelemetry,r=t.effectiveCustomization,s=t.widget,l=t.identity,a=l&&typeof l=="object"&&!Array.isArray(l)?l.accepted:void 0;return {sessionToken:typeof t.sessionToken=="string"?t.sessionToken:null,behavioralTelemetry:typeof n=="string"&&jo.indexOf(n)!==-1?n:null,customization:r&&typeof r=="object"&&!Array.isArray(r)?r:null,widget:s&&typeof s=="object"&&!Array.isArray(s)?s:null,identityAccepted:typeof a=="boolean"?a:null}}function Dn(e){let{token:t,apiBase:n=Dt,setTimeoutImpl:r=(S,E)=>setTimeout(S,E),now:s=()=>Date.now(),retryDelayMs:l=2e3,attemptTimeoutMs:a=5e3,failureCooldownMs:f=3e4}=e,o=e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,i=`${n}${Xo}`,u=null,h=null,v=null,p=null,b=0;function k(S){let E={publicKey:t,sessionId:S.sessionId};return S.visitorId!==void 0&&(E.visitorId=S.visitorId),S.userId!==void 0&&(E.userId=S.userId),S.userHash!==void 0&&(E.userHash=S.userHash),S.userTraits!==void 0&&(E.userTraits=S.userTraits),S.uiLanguage!==void 0&&(E.uiLanguage=S.uiLanguage),S.contentLocale!==void 0&&(E.contentLocale=S.contentLocale),S.viewerLocale!==void 0&&(E.viewerLocale=S.viewerLocale),S.route!==void 0&&(E.route=S.route),S.sessionContext!==void 0&&(E.sessionContext=S.sessionContext),JSON.stringify(E)}function D(S){return H(this,null,function*(){if(!o)return {ok:false,reason:"unusable"};let E;try{E=yield o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:S,credentials:"omit"});}catch(M){return null}if(E.status>=500)return null;if(!E.ok)return {ok:false,reason:"rejected"};let F;try{F=yield E.json();}catch(M){return {ok:false,reason:"unusable"}}let A=qo(F);return A?{ok:true,config:A}:{ok:false,reason:"unusable"}})}function I(S){return new Promise(E=>{try{r(()=>E(),S);}catch(F){E();}})}function V(S){return Promise.race([D(S),I(a).then(()=>null)])}function P(S){return H(this,null,function*(){let E=yield V(S);if(E)return E;yield I(l);let F=yield V(S);return F!=null?F:{ok:false,reason:"network"}})}return {sync(S){return H(this,null,function*(){let E=k(S);if(p&&E===h)return p;if(!p&&E===h&&u)return {ok:true,config:u};if(v&&v.json===E&&s()-v.at<f)return {ok:false,reason:"network"};h=E;let F=++b,A=P(E).then(M=>(F===b&&(M.ok?(u=M.config,v=null):(v={json:E,at:s()},h===E&&(h=null))),p===A&&(p=null),M));return p=A,A})},config:()=>u}}var Bt="__arcyChat";var Bn=["image/png","image/jpeg","image/webp"],Ht="--_arcy-font-key",Hn="arcy-chat-policy",Un="arcy-bar-tray",ut={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 Ut="https://cdn.arcyai.com";var Jo=15e3;function Wn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Bt];}catch(k){return i("The chat panel registration could not be read. The panel will not open."),null}if(!p)return null;if(typeof p.mount!="function")return i("The chat panel registered something unusable. The panel will not open."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==4?(i(`The chat panel on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${4}. Update arcy.js to open the chat panel.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Bt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${bn}`;let b=a.src;a.onload=()=>h(()=>w("The chat panel loaded but did not register. The panel will not open.")),a.onerror=()=>{try{w(`Failed to load ${b}. The chat panel will not open. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The chat panel could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The chat panel did not load in time."),f(null);},n);}catch(p){}})}function $n(e){let{root:t,host:n,win:r=typeof window!="undefined"?window:void 0,loadChunk:s,loadTimeoutMs:l=Jo,setTimeoutImpl:a=(L,j)=>setTimeout(L,j),onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A}=e,M=t!==n,C=null,G=null,U=false,K=false;function J(){return H(this,null,function*(){if(!(C||U))return G||(G=H(null,null,function*(){if(r)try{let L=yield s(r,l,a);if(!L||U)return;let j={root:t,host:n,isolated:M,onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A};C=L.mount(j),C||w("The chat panel could not start.");}catch(L){w(`The chat panel could not load. ${String(L)}`);}finally{G=null;}}),G)})}return {open(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U)))try{C==null||C.open();}catch(L){w(`The chat panel could not open. ${String(L)}`);}})},close(){K=false;try{C==null||C.close();}catch(L){w(`The chat panel could not close. ${String(L)}`);}},destroy(){U=true,K=false;let L=C;C=null;try{L==null||L.destroy();}catch(j){w(`The chat panel could not be removed. ${String(j)}`);}},reposition(){var L;try{(L=C==null?void 0:C.reposition)==null||L.call(C);}catch(j){w(`The chat panel could not move. ${String(j)}`);}},refreshChrome(){var L;try{(L=C==null?void 0:C.refreshChrome)==null||L.call(C);}catch(j){w(`The chat panel could not apply its texts. ${String(j)}`);}},promptFill(L){return H(this,null,function*(){if(U||(yield J(),U||!(C!=null&&C.promptFill)))return null;try{return yield C.promptFill(L)}catch(j){return w(`The flow's question could not be shown. ${String(j)}`),null}})},cancelFill(){var L;try{(L=C==null?void 0:C.cancelFill)==null||L.call(C);}catch(j){w(`The flow's question could not be withdrawn. ${String(j)}`);}},showFlowFailure(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U||!(C!=null&&C.showFlowFailure))))try{C.showFlowFailure();}catch(L){w(`The flow's failure notice could not be shown. ${String(L)}`);}})}}}var Vt="__arcyFlow";var Qo="arcy.flow.";function Zo(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=Ee()}={}){let n=oe(t),r=Qo+e;return {read(){let s=ie(n,r);return !s||!Zo(s)?null:{flowId:s.flowId,currentStepCvid:s.currentStepCvid,flowSessionId:s.flowSessionId,startedAt:s.startedAt}},save(s){ne(n,r,s);},clear(){n.removeItem(r);}}}var Yn="https://cdn.arcyai.com";var ei=15e3;function zn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Vt];}catch(k){return i("The flow engine registration could not be read. The flow will not start."),null}if(!p)return null;if(typeof p.mount!="function")return i("The flow engine registered something unusable. The flow will not start."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The flow engine on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to run flows.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Vt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${wn}`;let b=a.src;a.onload=()=>h(()=>w("The flow engine loaded but did not register. The flow will not start.")),a.onerror=()=>{try{w(`Failed to load ${b}. The flow will not start. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The flow engine could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The flow engine did not load in time."),f(null);},n);}catch(p){}})}function Xn(e){let{win:t=typeof window!="undefined"?window:void 0,loadChunk:n,loadTimeoutMs:r=ei,setTimeoutImpl:s=(h,v)=>setTimeout(h,v),context:l}=e,a=null,f=null,o=false;function i(){return H(this,null,function*(){if(!(a||o))return f||(f=H(null,null,function*(){if(t)try{let h=yield n(t,r,s);if(!h||o)return;a=h.mount(ae($({},l),{doc:t.document,win:t})),a||w("The flow engine could not start.");}catch(h){w(`The flow engine could not load. ${String(h)}`);}finally{f=null;}}),f)})}return {start(h){return H(this,null,function*(){if(!o&&(yield i(),!o))try{yield a==null?void 0:a.start(h);}catch(v){w(`The flow could not start. ${String(v)}`);}})},resume(){return H(this,null,function*(){if(o||!Kn(l.token).read()||(yield i(),o||!a))return false;try{return yield a.resume()}catch(v){return w(`The flow could not resume. ${String(v)}`),false}})},startPreview(h){return H(this,null,function*(){var v;if(!o&&(yield i(),!o))try{yield (v=a==null?void 0:a.startPreview)==null?void 0:v.call(a,h);}catch(p){w(`The preview could not start. ${String(p)}`);}})},resumePreview(){return H(this,null,function*(){if(o||!ct(l.token)||(yield i(),o||!(a!=null&&a.resumePreview)))return false;try{return yield a.resumePreview()}catch(h){return w(`The preview could not resume. ${String(h)}`),false}})},stop(){var h;if(!o)try{(h=a==null?void 0:a.stop)==null||h.call(a);}catch(v){w(`The flow could not be stopped. ${String(v)}`);}},destroy(){o=true;let h=a;a=null;try{h==null||h.destroy();}catch(v){w(`The flow engine could not be removed. ${String(v)}`);}}}}function Wt(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 jn(e){var n;let t=e.dataTransfer;return Array.from((n=t==null?void 0:t.files)!=null?n:[])}var qn=`
|
|
5
5
|
[data-tip] {
|
package/dist/arcy.loader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(exports){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
var c="arcy.modern.
|
|
2
|
+
var c="arcy.modern.336f518dd090.js",i="arcy.legacy.4e373458bb24.js";function a(){return typeof HTMLScriptElement!="undefined"&&"noModule"in HTMLScriptElement.prototype}function p(r){let e=r.currentScript;return !e||!e.src?"":e.src.replace(/\/[^/]*$/,"")}function l(r,e){var s;let u=p(e),d=a()?c:i,t=e.createElement("script"),o=(s=e.currentScript)==null?void 0:s.nonce;o&&(t.nonce=o,t.setAttribute("nonce",o)),t.async=true,t.src=`${u}/${d}`,t.onerror=()=>{typeof console!="undefined"&&console.warn&&console.warn(`[arcy] Failed to load ${t.src}. ARCY is disabled.`);};let n=e.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(t,n):(e.head||e.documentElement).appendChild(t);}typeof window!="undefined"&&typeof document!="undefined"&&l(window,document);exports.currentScriptBase=p;exports.loadCore=l;return exports;})({});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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.
|
|
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.24c8e3d6804c.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
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
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
5
|
[data-tip] {
|
|
@@ -345,7 +345,7 @@ var TRANSCRIPT_CSS = `
|
|
|
345
345
|
.${MSG_CLASS}[data-role="system"] {
|
|
346
346
|
align-self: flex-start;
|
|
347
347
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
348
|
-
color: var(--_arcy-main-text, #101828);
|
|
348
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/* \u2500\u2500 Rendered markdown inside an answer (D1023, ADR 0129; D1034) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
@@ -400,7 +400,7 @@ var TRANSCRIPT_CSS = `
|
|
|
400
400
|
font-size: 0.9em;
|
|
401
401
|
padding: 1px 4px;
|
|
402
402
|
border-radius: 4px;
|
|
403
|
-
background: color-mix(in srgb,
|
|
403
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
404
404
|
white-space: pre-wrap;
|
|
405
405
|
overflow-wrap: break-word;
|
|
406
406
|
}
|
|
@@ -409,8 +409,8 @@ var TRANSCRIPT_CSS = `
|
|
|
409
409
|
margin: 0 0 8px;
|
|
410
410
|
padding: 10px 12px;
|
|
411
411
|
border-radius: 8px;
|
|
412
|
-
background: color-mix(in srgb,
|
|
413
|
-
border: 1px solid color-mix(in srgb,
|
|
412
|
+
background: color-mix(in srgb, currentColor 10%, transparent);
|
|
413
|
+
border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
|
|
414
414
|
overflow-x: auto;
|
|
415
415
|
white-space: pre;
|
|
416
416
|
}
|
|
@@ -593,13 +593,14 @@ var TRANSCRIPT_CSS = `
|
|
|
593
593
|
padding: 12px;
|
|
594
594
|
border-radius: 12px;
|
|
595
595
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
596
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
596
597
|
}
|
|
597
598
|
|
|
598
599
|
.${PENDING_CLASS} span {
|
|
599
600
|
width: 6px;
|
|
600
601
|
height: 6px;
|
|
601
602
|
border-radius: 999px;
|
|
602
|
-
background: color-mix(in srgb,
|
|
603
|
+
background: color-mix(in srgb, currentColor 55%, transparent);
|
|
603
604
|
animation: arcy-chat-typing 1.2s ease-in-out infinite;
|
|
604
605
|
}
|
|
605
606
|
|
package/dist/index.cjs
CHANGED
|
@@ -1593,7 +1593,7 @@ var init_transcript = __esm({
|
|
|
1593
1593
|
.${MSG_CLASS}[data-role="system"] {
|
|
1594
1594
|
align-self: flex-start;
|
|
1595
1595
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
1596
|
-
color: var(--_arcy-main-text, #101828);
|
|
1596
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
1597
1597
|
}
|
|
1598
1598
|
|
|
1599
1599
|
/* \u2500\u2500 Rendered markdown inside an answer (D1023, ADR 0129; D1034) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
@@ -1648,7 +1648,7 @@ var init_transcript = __esm({
|
|
|
1648
1648
|
font-size: 0.9em;
|
|
1649
1649
|
padding: 1px 4px;
|
|
1650
1650
|
border-radius: 4px;
|
|
1651
|
-
background: color-mix(in srgb,
|
|
1651
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
1652
1652
|
white-space: pre-wrap;
|
|
1653
1653
|
overflow-wrap: break-word;
|
|
1654
1654
|
}
|
|
@@ -1657,8 +1657,8 @@ var init_transcript = __esm({
|
|
|
1657
1657
|
margin: 0 0 8px;
|
|
1658
1658
|
padding: 10px 12px;
|
|
1659
1659
|
border-radius: 8px;
|
|
1660
|
-
background: color-mix(in srgb,
|
|
1661
|
-
border: 1px solid color-mix(in srgb,
|
|
1660
|
+
background: color-mix(in srgb, currentColor 10%, transparent);
|
|
1661
|
+
border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
|
|
1662
1662
|
overflow-x: auto;
|
|
1663
1663
|
white-space: pre;
|
|
1664
1664
|
}
|
|
@@ -1841,13 +1841,14 @@ var init_transcript = __esm({
|
|
|
1841
1841
|
padding: 12px;
|
|
1842
1842
|
border-radius: 12px;
|
|
1843
1843
|
background: var(--_arcy-assistant-bg, #f2f4f7);
|
|
1844
|
+
color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
|
|
1844
1845
|
}
|
|
1845
1846
|
|
|
1846
1847
|
.${PENDING_CLASS} span {
|
|
1847
1848
|
width: 6px;
|
|
1848
1849
|
height: 6px;
|
|
1849
1850
|
border-radius: 999px;
|
|
1850
|
-
background: color-mix(in srgb,
|
|
1851
|
+
background: color-mix(in srgb, currentColor 55%, transparent);
|
|
1851
1852
|
animation: arcy-chat-typing 1.2s ease-in-out infinite;
|
|
1852
1853
|
}
|
|
1853
1854
|
|
package/dist/index.js
CHANGED
|
@@ -4717,7 +4717,7 @@ var bundledChunks = {
|
|
|
4717
4717
|
cdnBase: null,
|
|
4718
4718
|
loadChat: (win, timeoutMs, setTimeoutImpl) => importChunk(
|
|
4719
4719
|
win,
|
|
4720
|
-
() => import('./chat-
|
|
4720
|
+
() => import('./chat-HNE6525R.js'),
|
|
4721
4721
|
CHAT_GLOBAL,
|
|
4722
4722
|
CHAT_CONTRACT,
|
|
4723
4723
|
"chat panel",
|
package/package.json
CHANGED