arcy.js 0.1.2 → 0.1.4

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.
@@ -1,5 +1,5 @@
1
1
  (function(exports){'use strict';/* arcy.js — https://arcyai.com */
2
- var _t="__arcyChat";var St=["image/png","image/jpeg","image/webp"],Lt="--_arcy-font-key",It="arcy-chat-policy",Rt="arcy-bar-tray",Mt={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."};function Ye(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 Ft(e){let t=e.dataTransfer;return Array.from(t?.files??[])}var Pt=`
2
+ var St="__arcyChat";var Lt=["image/png","image/jpeg","image/webp"],It="--_arcy-font-key",Rt="arcy-chat-policy",Mt="arcy-bar-tray",Ft={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."};function qe(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 Pt(e){let t=e.dataTransfer;return Array.from(t?.files??[])}var $t=`
3
3
  [data-tip] {
4
4
  position: relative;
5
5
  }
@@ -64,11 +64,11 @@ var _t="__arcyChat";var St=["image/png","image/jpeg","image/webp"],Lt="--_arcy-f
64
64
  transition: none;
65
65
  }
66
66
  }
67
- `;function Nt(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function Yn(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 Kn=typeof document<"u"?Yn(document):null;function Xn(){return Kn}function Le(e){let t=Xn();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var $t="data-arcy-style";function Ke(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${$t}]`);if(n)return n.textContent=`${n.textContent??""}
68
- ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAttribute($t,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return Nt(`The widget could not apply its styles. ${String(n)}`),false}}var Qn=/^(#{1,3})\s+(.*)$/,Jn=/^[-*]\s+(.*)$/,Zn=/^\d+\.\s+(.*)$/;var Ot=/`([^`]+)`|\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)]+)\)/g;function er(e){return /^https?:\/\//i.test(e)}function Ie(e,t,n){let r=0;Ot.lastIndex=0;let o;for(;o=Ot.exec(n);){o.index>r&&t.appendChild(e.createTextNode(n.slice(r,o.index)));let[i,s,h,C,g,c]=o;if(s!==void 0){let l=e.createElement("code");l.textContent=s,t.appendChild(l);}else if(h!==void 0){let l=e.createElement("strong");l.textContent=h,t.appendChild(l);}else if(C!==void 0){let l=e.createElement("em");l.textContent=C,t.appendChild(l);}else if(g!==void 0&&c!==void 0)if(er(c)){let l=e.createElement("a");l.setAttribute("href",c),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"),l.textContent=g,t.appendChild(l);}else t.appendChild(e.createTextNode(g));r=o.index+i.length;}r<n.length&&t.appendChild(e.createTextNode(n.slice(r)));}function tr(e){let t=[],n=false;for(let r of e){if(!r.includes("```")){t.push(r);continue}r.split("```").forEach((i,s)=>{s>0&&(t.push("```"),n=!n),!(n&&s>0&&/^\s*[A-Za-z0-9+#-]*\s*$/.test(i))&&i!==""&&t.push(i);});}return t}function Dt(e,t,n){try{for(;t.firstChild;)t.removeChild(t.firstChild);let r=tr(n.split(`
69
- `)),o=[],i=null,s=null,h=()=>{if(o.length===0)return;let c=e.createElement("p");Ie(e,c,o.join(" ")),t.appendChild(c),o=[];},C=()=>{i=null;},g=()=>{if(s===null)return;let c=e.createElement("pre"),l=e.createElement("code");for(;s.length>0&&s[0].trim()==="";)s.shift();for(;s.length>0&&s[s.length-1].trim()==="";)s.pop();l.textContent=s.join(`
70
- `),c.appendChild(l),t.appendChild(c),s=null;};for(let c of r){if(c.trim()==="```"){s===null?(h(),C(),s=[]):g();continue}if(s!==null){s.push(c);continue}let l=c.trim();if(l===""){h(),C();continue}let v=Qn.exec(l);if(v){h(),C();let w=Math.max(2,v[1].length),m=e.createElement(`h${w}`);Ie(e,m,v[2]),t.appendChild(m);continue}let d=Jn.exec(l);if(d){h(),(!i||i.kind!=="ul")&&(i={kind:"ul",el:e.createElement("ul")},t.appendChild(i.el));let w=e.createElement("li");Ie(e,w,d[1]),i.el.appendChild(w);continue}let u=Zn.exec(l);if(u){h(),(!i||i.kind!=="ol")&&(i={kind:"ol",el:e.createElement("ol")},t.appendChild(i.el));let w=e.createElement("li");Ie(e,w,u[1]),i.el.appendChild(w);continue}C(),o.push(l);}g(),h();}catch{}}var Ht="arcy-flow-offer",Ut="arcy-flow-offer-hint",ae="arcy-flow-offer-button",zt="arcy-flow-offer-icon",Bt="http://www.w3.org/2000/svg",nr="M13 3L5 14h6l-1 7 8-11h-6l1-7z";function rr(e){let t=e.createElementNS(Bt,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("width","15"),t.setAttribute("height","15"),t.setAttribute("class",zt);let n=e.createElementNS(Bt,"path");return n.setAttribute("d",nr),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),t.appendChild(n),t}var Vt=`
71
- .${Ht} {
67
+ `;function Nt(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function Kn(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 a=r[o].nonce;if(typeof a=="string"&&a.length>0)return a}return null}catch{return null}}var qn=typeof document<"u"?Kn(document):null;function Qn(){return qn}function Re(e){let t=Qn();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var Ot="data-arcy-style";function Xe(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${Ot}]`);if(n)return n.textContent=`${n.textContent??""}
68
+ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Re(r),r.setAttribute(Ot,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return Nt(`The widget could not apply its styles. ${String(n)}`),false}}var Jn=/^(#{1,3})\s+(.*)$/,Zn=/^[-*]\s+(.*)$/,er=/^\d+\.\s+(.*)$/;var Dt=/`([^`]+)`|\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)]+)\)/g;function tr(e){return /^https?:\/\//i.test(e)}function Me(e,t,n){let r=0;Dt.lastIndex=0;let o;for(;o=Dt.exec(n);){o.index>r&&t.appendChild(e.createTextNode(n.slice(r,o.index)));let[a,s,h,C,g,c]=o;if(s!==void 0){let l=e.createElement("code");l.textContent=s,t.appendChild(l);}else if(h!==void 0){let l=e.createElement("strong");l.textContent=h,t.appendChild(l);}else if(C!==void 0){let l=e.createElement("em");l.textContent=C,t.appendChild(l);}else if(g!==void 0&&c!==void 0)if(tr(c)){let l=e.createElement("a");l.setAttribute("href",c),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"),l.textContent=g,t.appendChild(l);}else t.appendChild(e.createTextNode(g));r=o.index+a.length;}r<n.length&&t.appendChild(e.createTextNode(n.slice(r)));}function nr(e){let t=[],n=false;for(let r of e){if(!r.includes("```")){t.push(r);continue}r.split("```").forEach((a,s)=>{s>0&&(t.push("```"),n=!n),!(n&&s>0&&/^\s*[A-Za-z0-9+#-]*\s*$/.test(a))&&a!==""&&t.push(a);});}return t}function Bt(e,t,n){try{for(;t.firstChild;)t.removeChild(t.firstChild);let r=nr(n.split(`
69
+ `)),o=[],a=null,s=null,h=()=>{if(o.length===0)return;let c=e.createElement("p");Me(e,c,o.join(" ")),t.appendChild(c),o=[];},C=()=>{a=null;},g=()=>{if(s===null)return;let c=e.createElement("pre"),l=e.createElement("code");for(;s.length>0&&s[0].trim()==="";)s.shift();for(;s.length>0&&s[s.length-1].trim()==="";)s.pop();l.textContent=s.join(`
70
+ `),c.appendChild(l),t.appendChild(c),s=null;};for(let c of r){if(c.trim()==="```"){s===null?(h(),C(),s=[]):g();continue}if(s!==null){s.push(c);continue}let l=c.trim();if(l===""){h(),C();continue}let w=Jn.exec(l);if(w){h(),C();let v=Math.max(2,w[1].length),m=e.createElement(`h${v}`);Me(e,m,w[2]),t.appendChild(m);continue}let d=Zn.exec(l);if(d){h(),(!a||a.kind!=="ul")&&(a={kind:"ul",el:e.createElement("ul")},t.appendChild(a.el));let v=e.createElement("li");Me(e,v,d[1]),a.el.appendChild(v);continue}let u=er.exec(l);if(u){h(),(!a||a.kind!=="ol")&&(a={kind:"ol",el:e.createElement("ol")},t.appendChild(a.el));let v=e.createElement("li");Me(e,v,u[1]),a.el.appendChild(v);continue}C(),o.push(l);}g(),h();}catch{}}var Ut="arcy-flow-offer",zt="arcy-flow-offer-hint",ae="arcy-flow-offer-button",Vt="arcy-flow-offer-icon",Ht="http://www.w3.org/2000/svg",rr="M13 3L5 14h6l-1 7 8-11h-6l1-7z";function or(e){let t=e.createElementNS(Ht,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("width","15"),t.setAttribute("height","15"),t.setAttribute("class",Vt);let n=e.createElementNS(Ht,"path");return n.setAttribute("d",rr),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),t.appendChild(n),t}var Wt=`
71
+ .${Ut} {
72
72
  display: flex;
73
73
  flex-direction: column;
74
74
  align-items: flex-start;
@@ -76,7 +76,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
76
76
  margin-top: 10px;
77
77
  }
78
78
 
79
- .${Ut} {
79
+ .${zt} {
80
80
  font-size: 13px;
81
81
  line-height: 1.4;
82
82
  }
@@ -104,7 +104,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
104
104
  transition: background 120ms ease;
105
105
  }
106
106
 
107
- .${zt} {
107
+ .${Vt} {
108
108
  flex-shrink: 0;
109
109
  }
110
110
 
@@ -126,15 +126,15 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
126
126
  transition: none;
127
127
  }
128
128
  }
129
- `;function Wt(e,t,n,r){if(t.length===0)return null;let o=e.createElement("div");if(o.className=Ht,n){let i=e.createElement("div");i.className=Ut,i.textContent=n,o.appendChild(i);}for(let i of t.slice(0,1)){let s=e.createElement("button");s.type="button",s.className=ae,s.appendChild(rr(e));let h=e.createElement("span");h.textContent=i.publicName??"Start",s.appendChild(h),s.addEventListener("click",()=>{s.disabled=true;try{r(i.flowCvid);}catch{}}),o.appendChild(s);}return o}var Gt="arcy-chat-list",M="arcy-chat-msg",Yt="arcy-chat-msg-images",qe="arcy-chat-msg-thumbs",Kt="arcy-chat-msg-meta",qt="arcy-chat-msg-time",se="arcy-chat-rate",le="arcy-chat-msg-group",Xt="arcy-chat-citations",me="arcy-chat-citation-link",Qt="arcy-chat-citation-label",ce="arcy-chat-pending",or="M7 10v10H4V10zM7 10l4.5-7a2 2 0 0 1 3.4 2L13.5 9H19a2 2 0 0 1 2 2.3l-1 6A2 2 0 0 1 18 19H7",ir="M7 14V4H4v10zM7 14l4.5 7a2 2 0 0 0 3.4-2L13.5 15H19a2 2 0 0 0 2-2.3l-1-6A2 2 0 0 0 18 5H7",jt="http://www.w3.org/2000/svg";function ar(e,t){let n=e.createElementNS(jt,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("aria-hidden","true"),n.setAttribute("width","14"),n.setAttribute("height","14");let r=e.createElementNS(jt,"path");return r.setAttribute("d",t),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),n.appendChild(r),n}function sr(e){try{return e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return ""}}var Jt=`
130
- .${Gt} {
129
+ `;function jt(e,t,n,r){if(t.length===0)return null;let o=e.createElement("div");if(o.className=Ut,n){let a=e.createElement("div");a.className=zt,a.textContent=n,o.appendChild(a);}for(let a of t.slice(0,1)){let s=e.createElement("button");s.type="button",s.className=ae,s.appendChild(or(e));let h=e.createElement("span");h.textContent=a.publicName??"Start",s.appendChild(h),s.addEventListener("click",()=>{s.disabled=true;try{r(a.flowCvid);}catch{}}),o.appendChild(s);}return o}var Yt="arcy-chat-list",F="arcy-chat-msg",Kt="arcy-chat-msg-images",Qe="arcy-chat-msg-thumbs",qt="arcy-chat-msg-meta",Xt="arcy-chat-msg-time",se="arcy-chat-rate",le="arcy-chat-msg-group",Qt="arcy-chat-citations",be="arcy-chat-citation-link",Jt="arcy-chat-citation-label",ce="arcy-chat-pending",ir="M7 10v10H4V10zM7 10l4.5-7a2 2 0 0 1 3.4 2L13.5 9H19a2 2 0 0 1 2 2.3l-1 6A2 2 0 0 1 18 19H7",ar="M7 14V4H4v10zM7 14l4.5 7a2 2 0 0 0 3.4-2L13.5 15H19a2 2 0 0 0 2-2.3l-1-6A2 2 0 0 0 18 5H7",Gt="http://www.w3.org/2000/svg";function sr(e,t){let n=e.createElementNS(Gt,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("aria-hidden","true"),n.setAttribute("width","14"),n.setAttribute("height","14");let r=e.createElementNS(Gt,"path");return r.setAttribute("d",t),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),n.appendChild(r),n}function lr(e){try{return e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return ""}}var Zt=`
130
+ .${Yt} {
131
131
  display: flex;
132
132
  flex-direction: column;
133
133
  gap: 8px;
134
134
  padding: 12px;
135
135
  }
136
136
 
137
- .${M} {
137
+ .${F} {
138
138
  max-width: 85%;
139
139
  padding: 8px 12px;
140
140
  border-radius: 12px;
@@ -144,11 +144,11 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
144
144
  overflow-wrap: break-word;
145
145
  }
146
146
 
147
- .${M}[data-role="assistant"],
148
- .${M}[data-role="system"] {
147
+ .${F}[data-role="assistant"],
148
+ .${F}[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 */
@@ -157,40 +157,40 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
157
157
  a 1.5em face and a full blank line above and below it, which turns a
158
158
  three-step answer into something that reads like a landing page. These
159
159
  rules keep every block on the bubble's own scale. */
160
- .${M} > :first-child {
160
+ .${F} > :first-child {
161
161
  margin-top: 0;
162
162
  }
163
163
 
164
- .${M} > :last-child {
164
+ .${F} > :last-child {
165
165
  margin-bottom: 0;
166
166
  }
167
167
 
168
- .${M} p {
168
+ .${F} p {
169
169
  margin: 0 0 8px;
170
170
  }
171
171
 
172
- .${M} h2,
173
- .${M} h3 {
172
+ .${F} h2,
173
+ .${F} h3 {
174
174
  margin: 12px 0 6px;
175
175
  line-height: 1.3;
176
176
  font-weight: 600;
177
177
  }
178
178
 
179
- .${M} h2 {
179
+ .${F} h2 {
180
180
  font-size: 15px;
181
181
  }
182
182
 
183
- .${M} h3 {
183
+ .${F} h3 {
184
184
  font-size: 13px;
185
185
  }
186
186
 
187
- .${M} ul,
188
- .${M} ol {
187
+ .${F} ul,
188
+ .${F} ol {
189
189
  margin: 0 0 8px;
190
190
  padding-left: 20px;
191
191
  }
192
192
 
193
- .${M} li {
193
+ .${F} li {
194
194
  margin: 2px 0;
195
195
  }
196
196
 
@@ -198,27 +198,27 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
198
198
  these have to read as code rather than as a sentence with backticks in
199
199
  it. The block scrolls on its own rather than widening the bubble, since a
200
200
  long line would otherwise push the panel sideways. */
201
- .${M} code {
201
+ .${F} code {
202
202
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
203
203
  font-size: 0.9em;
204
204
  padding: 1px 4px;
205
205
  border-radius: 4px;
206
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
206
+ background: color-mix(in srgb, currentColor 12%, transparent);
207
207
  white-space: pre-wrap;
208
208
  overflow-wrap: break-word;
209
209
  }
210
210
 
211
- .${M} pre {
211
+ .${F} pre {
212
212
  margin: 0 0 8px;
213
213
  padding: 10px 12px;
214
214
  border-radius: 8px;
215
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 6%, transparent);
216
- border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 10%, transparent);
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
  }
220
220
 
221
- .${M} pre code {
221
+ .${F} pre code {
222
222
  padding: 0;
223
223
  background: none;
224
224
  white-space: pre;
@@ -226,13 +226,13 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
226
226
  }
227
227
 
228
228
  /* Above the bubble, as a sibling of it: see addMessage(). */
229
- .${Yt} {
229
+ .${Kt} {
230
230
  display: block;
231
231
  font-size: 11px;
232
232
  opacity: 0.75;
233
233
  }
234
234
 
235
- .${qe} {
235
+ .${Qe} {
236
236
  display: flex;
237
237
  flex-wrap: wrap;
238
238
  gap: 4px;
@@ -241,7 +241,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
241
241
 
242
242
  /* Sized by height, the width left to the picture: a fixed square cropped
243
243
  every screenshot to its middle. */
244
- .${qe} img {
244
+ .${Qe} img {
245
245
  display: block;
246
246
  width: auto;
247
247
  height: 120px;
@@ -252,7 +252,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
252
252
  color-mix(in srgb, var(--_arcy-main-text, #101828) 12%, transparent);
253
253
  }
254
254
 
255
- .${M}[data-role="user"] {
255
+ .${F}[data-role="user"] {
256
256
  align-self: flex-end;
257
257
  background: var(--_arcy-brand-bg, #101828);
258
258
  color: var(--_arcy-brand-text, #ffffff);
@@ -280,12 +280,12 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
280
280
 
281
281
  /* The bubble is the whole width of its group now, so its own alignment
282
282
  would fight the group's. */
283
- .${le} .${M} {
283
+ .${le} .${F} {
284
284
  max-width: 100%;
285
285
  align-self: auto;
286
286
  }
287
287
 
288
- .${Kt} {
288
+ .${qt} {
289
289
  display: flex;
290
290
  align-items: center;
291
291
  gap: 2px;
@@ -293,7 +293,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
293
293
  min-height: 20px;
294
294
  }
295
295
 
296
- .${qt} {
296
+ .${Xt} {
297
297
  font-size: 11px;
298
298
  line-height: 1;
299
299
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 45%, transparent);
@@ -343,7 +343,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
343
343
 
344
344
  /* \u2500\u2500 Citations (D1023, ADR 0129) \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 */
345
345
 
346
- .${Xt} {
346
+ .${Qt} {
347
347
  display: flex;
348
348
  flex-wrap: wrap;
349
349
  gap: 6px;
@@ -352,13 +352,13 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
352
352
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
353
353
  }
354
354
 
355
- .${Qt} {
355
+ .${Jt} {
356
356
  font-weight: 600;
357
357
  }
358
358
 
359
359
  /* D1034: a citation is a link, so it has to answer the pointer like one.
360
360
  At rest it stays quiet enough not to compete with the answer above it. */
361
- .${me} {
361
+ .${be} {
362
362
  color: inherit;
363
363
  text-decoration: underline;
364
364
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
@@ -367,18 +367,18 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
367
367
  transition: color 120ms ease, text-decoration-color 120ms ease;
368
368
  }
369
369
 
370
- .${me}:hover {
370
+ .${be}:hover {
371
371
  color: var(--_arcy-main-text, #101828);
372
372
  text-decoration-color: currentColor;
373
373
  }
374
374
 
375
- .${me}:focus-visible {
375
+ .${be}:focus-visible {
376
376
  outline: 2px solid currentColor;
377
377
  outline-offset: 2px;
378
378
  }
379
379
 
380
380
  @media (prefers-reduced-motion: reduce) {
381
- .${me} {
381
+ .${be} {
382
382
  transition: none;
383
383
  }
384
384
  }
@@ -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, var(--_arcy-main-text, #101828) 45%, transparent);
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
 
@@ -433,13 +434,13 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
433
434
  opacity: 0.55;
434
435
  }
435
436
  }
436
- `;function Zt(e,t,n={}){let r=t.createElement("div");r.className=Gt,e.appendChild(r);let o=false,i=[];function s(){for(;i.length>0;){let u=i.pop();if(u)try{URL.revokeObjectURL(u);}catch{}}}function h(){try{e.scrollTop=e.scrollHeight;}catch{}}let C=0,g=null;function c(u){if(!o)try{if(!u){g?.remove(),g=null;return}if(g)return;let w=t.createElement("div");w.className=ce,w.setAttribute("role","status"),w.setAttribute("aria-live","polite"),w.setAttribute("aria-label",n.answeringLabel?.()??"Answering");for(let m=0;m<3;m+=1)w.appendChild(t.createElement("span"));r.appendChild(w),g=w,h();}catch{}}function l(u,w,m){let x=n.labels;if(!x)return;let A=m,E=(N,U,$)=>{let y=t.createElement("button");return y.type="button",y.className=se,y.setAttribute("aria-label",U),y.setAttribute("data-tip",U),y.setAttribute("aria-pressed",m===N?"true":"false"),y.appendChild(ar(t,$)),y.addEventListener("click",()=>{try{A=A===N?null:N,L.setAttribute("aria-pressed",A==="up"?"true":"false"),H.setAttribute("aria-pressed",A==="down"?"true":"false"),n.onFeedback?.(A,w);}catch{}}),y},L=E("up",x.likeAnswer,or),H=E("down",x.dislikeAnswer,ir);u.appendChild(L),u.appendChild(H);}function v(u,w){let m=n.searchedSourcesLabel;if(!m||w.length===0)return;let x=t.createElement("div");if(x.className=Xt,n.sourcesLabel){let E=t.createElement("span");E.className=Qt,E.textContent=n.sourcesLabel,x.appendChild(E);}let A=0;for(let E of w)if(E.sourceUrl){let L=t.createElement("a");L.className=me,L.setAttribute("href",E.sourceUrl),L.setAttribute("target","_blank"),L.setAttribute("rel","noopener noreferrer"),L.textContent=E.title,x.appendChild(L);}else A+=1;if(A>0){let E=t.createElement("span");E.textContent=m.replace("{count}",String(A)),x.appendChild(E);}u.appendChild(x);}function d(u,w,m={}){if(!o)try{let{images:x=0,imageUrls:A=[],at:E,messageId:L=null,feedback:H=null,citedSources:N=[],flowOffers:U=[]}=m,$=t.createElement("div");$.className=le,$.setAttribute("data-role",u);let y=t.createElement("div");y.className=M,y.setAttribute("data-role",u),u==="assistant"?Dt(t,y,w):y.textContent=w;let k=null;if(A.length>0){k=t.createElement("div"),k.className=qe;for(let T of A){let I=t.createElement("img");I.src=T,I.alt="",k.appendChild(I),i.push(T);}}else x>0&&(k=t.createElement("div"),k.className=Yt,k.textContent=x===1?"1 image":`${x} images`);if(k&&$.appendChild(k),u==="assistant"&&U.length>0&&n.onStartFlow){let T=n.onStartFlow.bind(n),I=Wt(t,U,n.flowOfferHint?.(),T);I&&y.appendChild(I);}if((w!==""||!k)&&$.appendChild(y),u==="assistant"&&N.length>0&&v($,N),u!=="system"){let T=t.createElement("div");T.className=Kt;let I=t.createElement("span");I.className=qt,I.textContent=sr(E??n.now?.()??new Date),T.appendChild(I),u==="assistant"&&l(T,L,H),$.appendChild(T);}r.insertBefore($,g),C+=1,h();}catch{}}return {addMessage:d,setPending:c,isEmpty:()=>C===0,scrollToEnd:h,clear(){if(!o)try{for(;r.firstChild;)r.removeChild(r.firstChild);s(),C=0,g=null;}catch{}},destroy(){if(!o){o=true;try{s(),r.remove();}catch{}}}}}var be="arcy-drawer",Re="arcy-drawer-scrim",tn="arcy-drawer-header",Xe="arcy-drawer-back",Qe="arcy-drawer-close",nn="arcy-drawer-title",rn="arcy-drawer-list",Me="arcy-drawer-item",on="arcy-drawer-item-title",an="arcy-drawer-item-sub",ye="arcy-drawer-item-tip",sn="arcy-drawer-item-icon",ln="arcy-drawer-item-text",cn="arcy-drawer-empty",Je="arcy-drawer-action",Ze="arcy-drawer-footer",dn=`
437
+ `;function en(e,t,n={}){let r=t.createElement("div");r.className=Yt,e.appendChild(r);let o=false,a=[];function s(){for(;a.length>0;){let u=a.pop();if(u)try{URL.revokeObjectURL(u);}catch{}}}function h(){try{e.scrollTop=e.scrollHeight;}catch{}}let C=0,g=null;function c(u){if(!o)try{if(!u){g?.remove(),g=null;return}if(g)return;let v=t.createElement("div");v.className=ce,v.setAttribute("role","status"),v.setAttribute("aria-live","polite"),v.setAttribute("aria-label",n.answeringLabel?.()??"Answering");for(let m=0;m<3;m+=1)v.appendChild(t.createElement("span"));r.appendChild(v),g=v,h();}catch{}}function l(u,v,m){let x=n.labels;if(!x)return;let A=m,E=($,U,N)=>{let y=t.createElement("button");return y.type="button",y.className=se,y.setAttribute("aria-label",U),y.setAttribute("data-tip",U),y.setAttribute("aria-pressed",m===$?"true":"false"),y.appendChild(sr(t,N)),y.addEventListener("click",()=>{try{A=A===$?null:$,L.setAttribute("aria-pressed",A==="up"?"true":"false"),H.setAttribute("aria-pressed",A==="down"?"true":"false"),n.onFeedback?.(A,v);}catch{}}),y},L=E("up",x.likeAnswer,ir),H=E("down",x.dislikeAnswer,ar);u.appendChild(L),u.appendChild(H);}function w(u,v){let m=n.searchedSourcesLabel;if(!m||v.length===0)return;let x=t.createElement("div");if(x.className=Qt,n.sourcesLabel){let E=t.createElement("span");E.className=Jt,E.textContent=n.sourcesLabel,x.appendChild(E);}let A=0;for(let E of v)if(E.sourceUrl){let L=t.createElement("a");L.className=be,L.setAttribute("href",E.sourceUrl),L.setAttribute("target","_blank"),L.setAttribute("rel","noopener noreferrer"),L.textContent=E.title,x.appendChild(L);}else A+=1;if(A>0){let E=t.createElement("span");E.textContent=m.replace("{count}",String(A)),x.appendChild(E);}u.appendChild(x);}function d(u,v,m={}){if(!o)try{let{images:x=0,imageUrls:A=[],at:E,messageId:L=null,feedback:H=null,citedSources:$=[],flowOffers:U=[]}=m,N=t.createElement("div");N.className=le,N.setAttribute("data-role",u);let y=t.createElement("div");y.className=F,y.setAttribute("data-role",u),u==="assistant"?Bt(t,y,v):y.textContent=v;let k=null;if(A.length>0){k=t.createElement("div"),k.className=Qe;for(let T of A){let I=t.createElement("img");I.src=T,I.alt="",k.appendChild(I),a.push(T);}}else x>0&&(k=t.createElement("div"),k.className=Kt,k.textContent=x===1?"1 image":`${x} images`);if(k&&N.appendChild(k),u==="assistant"&&U.length>0&&n.onStartFlow){let T=n.onStartFlow.bind(n),I=jt(t,U,n.flowOfferHint?.(),T);I&&y.appendChild(I);}if((v!==""||!k)&&N.appendChild(y),u==="assistant"&&$.length>0&&w(N,$),u!=="system"){let T=t.createElement("div");T.className=qt;let I=t.createElement("span");I.className=Xt,I.textContent=lr(E??n.now?.()??new Date),T.appendChild(I),u==="assistant"&&l(T,L,H),N.appendChild(T);}r.insertBefore(N,g),C+=1,h();}catch{}}return {addMessage:d,setPending:c,isEmpty:()=>C===0,scrollToEnd:h,clear(){if(!o)try{for(;r.firstChild;)r.removeChild(r.firstChild);s(),C=0,g=null;}catch{}},destroy(){if(!o){o=true;try{s(),r.remove();}catch{}}}}}var we="arcy-drawer",Fe="arcy-drawer-scrim",nn="arcy-drawer-header",Je="arcy-drawer-back",Ze="arcy-drawer-close",rn="arcy-drawer-title",on="arcy-drawer-list",Pe="arcy-drawer-item",an="arcy-drawer-item-title",sn="arcy-drawer-item-sub",ve="arcy-drawer-item-tip",ln="arcy-drawer-item-icon",cn="arcy-drawer-item-text",dn="arcy-drawer-empty",et="arcy-drawer-action",tt="arcy-drawer-footer",pn=`
437
438
  /* A sheet over PART of the panel, sliding in from the left (D899). It used
438
439
  to be inset:0 and appear instantly, so opening Recent chats replaced the
439
440
  whole surface with no sense of where the conversation went or how to get
440
441
  back. Covering part of the panel keeps the conversation visible behind it,
441
442
  which is what makes the back gesture obvious. */
442
- .${be} {
443
+ .${we} {
443
444
  position: absolute;
444
445
  top: 0;
445
446
  bottom: 0;
@@ -461,7 +462,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
461
462
  /* The same sheet, hinged on the other edge. Only the three properties that
462
463
  name a side change: everything about how it looks and animates is shared,
463
464
  so the two can never drift. */
464
- .${be}[data-side="right"] {
465
+ .${we}[data-side="right"] {
465
466
  left: auto;
466
467
  right: 0;
467
468
  border-right: 0;
@@ -470,7 +471,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
470
471
  transform: translateX(101%);
471
472
  }
472
473
 
473
- .${be}[data-open] {
474
+ .${we}[data-open] {
474
475
  transform: translateX(0);
475
476
  visibility: visible;
476
477
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1),
@@ -479,7 +480,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
479
480
 
480
481
  /* The rest of the panel, dimmed while the sheet is over it. Tapping it is
481
482
  the same as pressing back, which is what every sheet on a phone does. */
482
- .${Re} {
483
+ .${Fe} {
483
484
  position: absolute;
484
485
  inset: 0;
485
486
  z-index: 1;
@@ -493,20 +494,20 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
493
494
  transition: opacity 220ms ease, visibility 0s linear 220ms;
494
495
  }
495
496
 
496
- .${Re}[data-open] {
497
+ .${Fe}[data-open] {
497
498
  opacity: 1;
498
499
  visibility: visible;
499
500
  transition: opacity 220ms ease, visibility 0s;
500
501
  }
501
502
 
502
503
  @media (prefers-reduced-motion: reduce) {
503
- .${be},
504
- .${Re} {
504
+ .${we},
505
+ .${Fe} {
505
506
  transition: none;
506
507
  }
507
508
  }
508
509
 
509
- .${tn} {
510
+ .${nn} {
510
511
  display: flex;
511
512
  align-items: center;
512
513
  gap: 8px;
@@ -514,8 +515,8 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
514
515
  flex: 0 0 auto;
515
516
  }
516
517
 
517
- .${Xe},
518
- .${Qe} {
518
+ .${Je},
519
+ .${Ze} {
519
520
  appearance: none;
520
521
  border: 0;
521
522
  background: transparent;
@@ -529,12 +530,12 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
529
530
  -webkit-tap-highlight-color: transparent;
530
531
  }
531
532
 
532
- .${Xe}:hover,
533
- .${Qe}:hover {
533
+ .${Je}:hover,
534
+ .${Ze}:hover {
534
535
  background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
535
536
  }
536
537
 
537
- .${nn} {
538
+ .${rn} {
538
539
  font-weight: 600;
539
540
  font-size: 14px;
540
541
  min-width: 0;
@@ -544,7 +545,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
544
545
  white-space: nowrap;
545
546
  }
546
547
 
547
- .${rn} {
548
+ .${on} {
548
549
  flex: 1 1 auto;
549
550
  min-height: 0;
550
551
  overflow: auto;
@@ -557,7 +558,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
557
558
  /* A row, laid out left to right: the optional mark, then the text column.
558
559
  A drawer with no mark renders one child and reads exactly as it did when
559
560
  the row was the text column itself. */
560
- .${Me} {
561
+ .${Pe} {
561
562
  appearance: none;
562
563
  border: 0;
563
564
  cursor: pointer;
@@ -574,14 +575,14 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
574
575
  -webkit-tap-highlight-color: transparent;
575
576
  }
576
577
 
577
- .${Me}:hover {
578
+ .${Pe}:hover {
578
579
  background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
579
580
  }
580
581
 
581
582
  /* The conversation the visitor is reading. Darker than hover so it still
582
583
  reads as selected while the pointer is over another row, and carrying an
583
584
  inset marker so the state is not colour alone. */
584
- .${Me}[data-active] {
585
+ .${Pe}[data-active] {
585
586
  background: color-mix(in srgb, var(--_arcy-main-text, #101828) 12%, transparent);
586
587
  box-shadow: inset 2px 0 0 var(--_arcy-brand-bg, #101828);
587
588
  font-weight: 600;
@@ -589,7 +590,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
589
590
 
590
591
  /* Dimmer than the title it sits beside: it labels the kind of row, and a
591
592
  mark at full strength competes with the name a visitor is reading. */
592
- .${sn} {
593
+ .${ln} {
593
594
  flex: 0 0 auto;
594
595
  display: flex;
595
596
  align-items: center;
@@ -599,7 +600,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
599
600
  /* The min-width: 0 is what keeps the ellipsis working: without it a flex
600
601
  item refuses to shrink below its content, and a long flow name pushes the
601
602
  row wider than the sheet instead of truncating. */
602
- .${ln} {
603
+ .${cn} {
603
604
  display: flex;
604
605
  flex-direction: column;
605
606
  gap: 2px;
@@ -607,14 +608,14 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
607
608
  flex: 1 1 auto;
608
609
  }
609
610
 
610
- .${on} {
611
+ .${an} {
611
612
  font-size: 13px;
612
613
  overflow: hidden;
613
614
  text-overflow: ellipsis;
614
615
  white-space: nowrap;
615
616
  }
616
617
 
617
- .${an} {
618
+ .${sn} {
618
619
  font-size: 11.5px;
619
620
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
620
621
  overflow: hidden;
@@ -631,7 +632,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
631
632
  Position is set in script, because it is the one thing CSS cannot do from
632
633
  here: the bubble sits beside the sheet, so it has to know how tall the row
633
634
  is and how much room the panel has left. Everything else is here. */
634
- .${ye} {
635
+ .${ve} {
635
636
  position: absolute;
636
637
  z-index: 3;
637
638
  /* Sized from its own text, not from the room left inside the sheet. The
@@ -660,7 +661,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
660
661
  transition: opacity 120ms ease;
661
662
  }
662
663
 
663
- .${ye}[data-open] {
664
+ .${ve}[data-open] {
664
665
  opacity: 1;
665
666
  visibility: visible;
666
667
  }
@@ -668,18 +669,18 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
668
669
  /* Same reason as the header tooltips: a coarse pointer has no hover, so the
669
670
  bubble would latch open over the row the visitor just pressed. */
670
671
  @media (hover: none) {
671
- .${ye} {
672
+ .${ve} {
672
673
  display: none;
673
674
  }
674
675
  }
675
676
 
676
677
  @media (prefers-reduced-motion: reduce) {
677
- .${ye} {
678
+ .${ve} {
678
679
  transition: none;
679
680
  }
680
681
  }
681
682
 
682
- .${cn} {
683
+ .${dn} {
683
684
  flex: 1 1 auto;
684
685
  display: flex;
685
686
  flex-direction: column;
@@ -692,7 +693,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
692
693
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 60%, transparent);
693
694
  }
694
695
 
695
- .${Je} {
696
+ .${et} {
696
697
  appearance: none;
697
698
  border: 0;
698
699
  cursor: pointer;
@@ -712,15 +713,15 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
712
713
  /* The pinned "New chat" action, once the list is populated (D979): appended
713
714
  as a footer sibling of the scrollable list rather than its last row, so it
714
715
  never scrolls out of reach on a drawer with many conversations. */
715
- .${Ze} {
716
+ .${tt} {
716
717
  flex: 0 0 auto;
717
718
  padding: 10px;
718
719
  }
719
720
 
720
- .${Ze} .${Je} {
721
+ .${tt} .${et} {
721
722
  width: 100%;
722
723
  }
723
- `,en="http://www.w3.org/2000/svg",ge=8,lr=240,cr=120;function et(e,t,n,r=2){let o=e.createElementNS(en,"svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.setAttribute("aria-hidden","true");for(let i of t){let s=e.createElementNS(en,"path");s.setAttribute("d",i),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width",String(r)),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),o.appendChild(s);}return o}function dr(e,t){return et(e,[t==="right"?"M9 5l7 7-7 7":"M15 5l-7 7 7 7"],16)}function pr(e){return et(e,["M18 6L6 18","M6 6l12 12"],16)}function ur(e){return et(e,["M12 5v14M5 12h14"],14,2.5)}function Fe(e,t,n){let r=n.emptyText??"",o=n.actionLabel??null,i=[],s=false,h=n.side??"left",C=n.subtitleTips!==false,g=t.createElement("div");g.className=be,g.setAttribute("role","group"),g.setAttribute("data-side",h);let c=t.createElement("div");c.className=tn;let l=t.createElement("button");l.type="button",l.className=Xe,l.setAttribute("aria-label",n.backLabel),l.setAttribute("data-tip",n.backLabel),l.setAttribute("data-tip-placement","below"),l.setAttribute("data-tip-align","start"),l.appendChild(dr(t,h));let v=t.createElement("span");v.className=nn,v.textContent=n.title;let d=t.createElement("button");d.type="button",d.className=Qe,d.setAttribute("aria-label",n.closeLabel),d.setAttribute("data-tip",n.closeLabel),d.setAttribute("data-tip-placement","below"),d.setAttribute("data-tip-align","end"),d.appendChild(pr(t)),c.appendChild(l),c.appendChild(v),c.appendChild(d);let u=t.createElement("div");u.className=rn,g.appendChild(c),g.appendChild(u);let w=t.createElement("button");w.type="button",w.className=Re,w.setAttribute("aria-hidden","true"),w.tabIndex=-1,e.appendChild(w),e.appendChild(g);let m=t.createElement("div");m.className=ye,m.setAttribute("aria-hidden","true"),g.appendChild(m);function x(){m.removeAttribute("data-open");}function A(y,k){try{let T=g.getBoundingClientRect(),I=e.getBoundingClientRect(),q=y.getBoundingClientRect();if(T.width===0||I.width===0)return;let W=(h==="right"?T.left-I.left:I.right-T.right)-ge*2;if(W<cr){x();return}m.textContent=k,m.style.maxWidth=`${Math.min(lr,W)}px`;let j=`${T.width+ge}px`;m.style.left=h==="right"?"auto":j,m.style.right=h==="right"?j:"auto",m.style.top="0px";let pe=m.offsetHeight,P=q.top-T.top,z=Math.max(ge,T.height-pe-ge);m.style.top=`${Math.min(Math.max(P,ge),z)}px`,m.setAttribute("data-open","");}catch{x();}}u.addEventListener("scroll",x);let E=()=>{try{n.onBack();}catch{}};l.addEventListener("click",E),d.addEventListener("click",E),w.addEventListener("click",E);let L=null;function H(){L?.remove(),L=null;}function N(){if(!s){for(x();u.firstChild;)u.removeChild(u.firstChild);if(H(),i.length===0){let y=t.createElement("div");y.className=cn;let k=t.createElement("span");k.textContent=r,y.appendChild(k),o&&y.appendChild(U(false)),u.appendChild(y);return}for(let y of i){let k=t.createElement("button");k.type="button",k.className=Me,y.active&&(k.setAttribute("data-active",""),k.setAttribute("aria-current","true"));let T=y.icon??n.itemIcon;if(T)try{let W=T(t);if(W){let j=t.createElement("span");j.className=sn,j.appendChild(W),k.appendChild(j);}}catch{}let I=t.createElement("span");I.className=ln;let q=t.createElement("span");if(q.className=on,q.textContent=y.title,I.appendChild(q),y.subtitle){let W=t.createElement("span");W.className=an,W.textContent=y.subtitle,I.appendChild(W);let j=y.subtitle;C&&(k.addEventListener("mouseenter",()=>A(k,j)),k.addEventListener("focus",()=>A(k,j)),k.addEventListener("mouseleave",x),k.addEventListener("blur",x));}k.appendChild(I),k.addEventListener("click",()=>{try{n.onSelect(y.id);}catch{}}),u.appendChild(k);}o&&(L=t.createElement("div"),L.className=Ze,L.appendChild(U(true)),g.appendChild(L));}}function U(y){let k=t.createElement("button");return k.type="button",k.className=Je,y&&k.appendChild(ur(t)),k.appendChild(t.createTextNode(o??"")),k.addEventListener("click",()=>{try{n.onAction?.();}catch{}}),k}N();function $(y){try{for(let k of Array.from(e.children))k===g||k===w||(y?k.setAttribute("inert",""):k.removeAttribute("inert"));}catch{}}return {open(){if(!s){g.setAttribute("data-open",""),w.setAttribute("data-open",""),$(true);try{l.focus();}catch{}}},close(){s||(x(),g.removeAttribute("data-open"),w.removeAttribute("data-open"),$(false));},isOpen:()=>g.hasAttribute("data-open"),setItems(y){i=y,N();},setTitle(y){v.textContent=y;},setTexts(y){y.emptyText!==void 0&&(r=y.emptyText),y.actionLabel!==void 0&&(o=y.actionLabel),y.backLabel!==void 0&&(l.setAttribute("aria-label",y.backLabel),l.setAttribute("data-tip",y.backLabel)),y.closeLabel!==void 0&&(d.setAttribute("aria-label",y.closeLabel),d.setAttribute("data-tip",y.closeLabel)),N();},destroy(){if(!s){s=true;try{$(!1),u.removeEventListener("scroll",x),l.removeEventListener("click",E),d.removeEventListener("click",E),w.removeEventListener("click",E),m.remove(),g.remove(),w.remove();}catch{}}}}}var Pe=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;var fr=560,hr=640;function Ne(e,t){let n=Pe(t.width);if(!n)return fr;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function pn(e,t,n){let r=Pe(t);if(!r)return hr;let o=Math.round(e/100*r),i=r-n-16;return Math.max(0,Math.min(o,i))}function we(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function $e(e,t,n){let r=Pe(n);if(!r)return e;let o=Math.max(0,(r-Pe(t))/2);return Math.min(o,Math.max(-o,e))}var S="arcy-fill-card",un=`
724
+ `,tn="http://www.w3.org/2000/svg",ye=8,cr=240,dr=120;function nt(e,t,n,r=2){let o=e.createElementNS(tn,"svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.setAttribute("aria-hidden","true");for(let a of t){let s=e.createElementNS(tn,"path");s.setAttribute("d",a),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width",String(r)),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),o.appendChild(s);}return o}function pr(e,t){return nt(e,[t==="right"?"M9 5l7 7-7 7":"M15 5l-7 7 7 7"],16)}function ur(e){return nt(e,["M18 6L6 18","M6 6l12 12"],16)}function fr(e){return nt(e,["M12 5v14M5 12h14"],14,2.5)}function $e(e,t,n){let r=n.emptyText??"",o=n.actionLabel??null,a=[],s=false,h=n.side??"left",C=n.subtitleTips!==false,g=t.createElement("div");g.className=we,g.setAttribute("role","group"),g.setAttribute("data-side",h);let c=t.createElement("div");c.className=nn;let l=t.createElement("button");l.type="button",l.className=Je,l.setAttribute("aria-label",n.backLabel),l.setAttribute("data-tip",n.backLabel),l.setAttribute("data-tip-placement","below"),l.setAttribute("data-tip-align","start"),l.appendChild(pr(t,h));let w=t.createElement("span");w.className=rn,w.textContent=n.title;let d=t.createElement("button");d.type="button",d.className=Ze,d.setAttribute("aria-label",n.closeLabel),d.setAttribute("data-tip",n.closeLabel),d.setAttribute("data-tip-placement","below"),d.setAttribute("data-tip-align","end"),d.appendChild(ur(t)),c.appendChild(l),c.appendChild(w),c.appendChild(d);let u=t.createElement("div");u.className=on,g.appendChild(c),g.appendChild(u);let v=t.createElement("button");v.type="button",v.className=Fe,v.setAttribute("aria-hidden","true"),v.tabIndex=-1,e.appendChild(v),e.appendChild(g);let m=t.createElement("div");m.className=ve,m.setAttribute("aria-hidden","true"),g.appendChild(m);function x(){m.removeAttribute("data-open");}function A(y,k){try{let T=g.getBoundingClientRect(),I=e.getBoundingClientRect(),q=y.getBoundingClientRect();if(T.width===0||I.width===0)return;let W=(h==="right"?T.left-I.left:I.right-T.right)-ye*2;if(W<dr){x();return}m.textContent=k,m.style.maxWidth=`${Math.min(cr,W)}px`;let j=`${T.width+ye}px`;m.style.left=h==="right"?"auto":j,m.style.right=h==="right"?j:"auto",m.style.top="0px";let ue=m.offsetHeight,M=q.top-T.top,z=Math.max(ye,T.height-ue-ye);m.style.top=`${Math.min(Math.max(M,ye),z)}px`,m.setAttribute("data-open","");}catch{x();}}u.addEventListener("scroll",x);let E=()=>{try{n.onBack();}catch{}};l.addEventListener("click",E),d.addEventListener("click",E),v.addEventListener("click",E);let L=null;function H(){L?.remove(),L=null;}function $(){if(!s){for(x();u.firstChild;)u.removeChild(u.firstChild);if(H(),a.length===0){let y=t.createElement("div");y.className=dn;let k=t.createElement("span");k.textContent=r,y.appendChild(k),o&&y.appendChild(U(false)),u.appendChild(y);return}for(let y of a){let k=t.createElement("button");k.type="button",k.className=Pe,y.active&&(k.setAttribute("data-active",""),k.setAttribute("aria-current","true"));let T=y.icon??n.itemIcon;if(T)try{let W=T(t);if(W){let j=t.createElement("span");j.className=ln,j.appendChild(W),k.appendChild(j);}}catch{}let I=t.createElement("span");I.className=cn;let q=t.createElement("span");if(q.className=an,q.textContent=y.title,I.appendChild(q),y.subtitle){let W=t.createElement("span");W.className=sn,W.textContent=y.subtitle,I.appendChild(W);let j=y.subtitle;C&&(k.addEventListener("mouseenter",()=>A(k,j)),k.addEventListener("focus",()=>A(k,j)),k.addEventListener("mouseleave",x),k.addEventListener("blur",x));}k.appendChild(I),k.addEventListener("click",()=>{try{n.onSelect(y.id);}catch{}}),u.appendChild(k);}o&&(L=t.createElement("div"),L.className=tt,L.appendChild(U(true)),g.appendChild(L));}}function U(y){let k=t.createElement("button");return k.type="button",k.className=et,y&&k.appendChild(fr(t)),k.appendChild(t.createTextNode(o??"")),k.addEventListener("click",()=>{try{n.onAction?.();}catch{}}),k}$();function N(y){try{for(let k of Array.from(e.children))k===g||k===v||(y?k.setAttribute("inert",""):k.removeAttribute("inert"));}catch{}}return {open(){if(!s){g.setAttribute("data-open",""),v.setAttribute("data-open",""),N(true);try{l.focus();}catch{}}},close(){s||(x(),g.removeAttribute("data-open"),v.removeAttribute("data-open"),N(false));},isOpen:()=>g.hasAttribute("data-open"),setItems(y){a=y,$();},setTitle(y){w.textContent=y;},setTexts(y){y.emptyText!==void 0&&(r=y.emptyText),y.actionLabel!==void 0&&(o=y.actionLabel),y.backLabel!==void 0&&(l.setAttribute("aria-label",y.backLabel),l.setAttribute("data-tip",y.backLabel)),y.closeLabel!==void 0&&(d.setAttribute("aria-label",y.closeLabel),d.setAttribute("data-tip",y.closeLabel)),$();},destroy(){if(!s){s=true;try{N(!1),u.removeEventListener("scroll",x),l.removeEventListener("click",E),d.removeEventListener("click",E),v.removeEventListener("click",E),m.remove(),g.remove(),v.remove();}catch{}}}}}var Ne=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;var hr=560,mr=640;function Oe(e,t){let n=Ne(t.width);if(!n)return hr;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function un(e,t,n){let r=Ne(t);if(!r)return mr;let o=Math.round(e/100*r),a=r-n-16;return Math.max(0,Math.min(o,a))}function xe(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function De(e,t,n){let r=Ne(n);if(!r)return e;let o=Math.max(0,(r-Ne(t))/2);return Math.min(o,Math.max(-o,e))}var S="arcy-fill-card",fn=`
724
725
  .${S} {
725
726
  position: absolute;
726
727
  display: flex;
@@ -837,8 +838,8 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
837
838
  transition: none;
838
839
  }
839
840
  }
840
- `,mr={required:"fillRequired",invalid_number:"fillInvalidNumber",number_too_small:"fillNumberTooSmall",number_too_large:"fillNumberTooLarge",invalid_email:"fillInvalidEmail",invalid_url:"fillInvalidUrl",invalid_date:"fillInvalidDate",invalid_time:"fillInvalidTime",date_too_early:"fillDateTooEarly",date_too_late:"fillDateTooLate",too_long:"fillTooLong",invalid_option:"fillInvalidOption",invalid:"fillInvalid"},gr={date:"date",time:"time",datetime:"datetime-local",month:"month",week:"week"};function fn(e,t){let n=e.host.ownerDocument,r=n.createElement("div");r.className=S,r.setAttribute("role","dialog");let o=n.createElement("div");o.className=`${S}-question`;let i=n.createElement("div");i.className=`${S}-error`,i.setAttribute("role","alert"),i.style.setProperty("display","none");let s=n.createElement("div");s.className=`${S}-controls`,r.appendChild(o),r.appendChild(i),r.appendChild(s),e.root.appendChild(r);let h=null;function C(l){let d=t()[mr[l]];return (typeof d=="string"?d:"").replace("{min}",h?.min??"").replace("{max}",h?.max??String(h?.maxLength??""))}function g(){let l;try{l=e.bar.getMetrics();}catch{return}let v=l.bottomOffset+l.keyboardOffset+l.height+8,d=r.style;if(d.setProperty("bottom",`${v}px`),d.setProperty("left","50%"),d.setProperty("translate","-50%"),l.isMobile){d.setProperty("width",`calc(100% - ${24}px)`),d.setProperty("max-width","none"),d.setProperty("transform","none");return}let u=Ne(l.widthPercent,{width:l.viewportWidth,height:l.viewportHeight});d.setProperty("width",`${u}px`),d.setProperty("max-width",`calc(100vw - ${32}px)`),d.setProperty("transform",we({x:$e(l.offset.x,u,l.viewportWidth),y:l.offset.y}));}function c(l,v){s.textContent="";let d=t(),u=(m,x)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-pill`,A.textContent=m,A.addEventListener("click",()=>v.onAnswer(x)),s.appendChild(A);},w=(m,x)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=d.fillConfirm,A.addEventListener("click",()=>v.onAnswer(x())),m.addEventListener("keydown",E=>{E.key==="Enter"&&(E.preventDefault(),v.onAnswer(x()));}),s.appendChild(m),s.appendChild(A);};switch(l.kind){case "select":case "radio":{for(let m of l.options??[])u(m.label,m.value);return}case "checkbox":{u(d.fillYes,"true"),u(d.fillNo,"false");return}case "range":{let m=n.createElement("input");m.type="range",m.className=`${S}-range`,l.min!==null&&(m.min=l.min),l.max!==null&&(m.max=l.max),l.step!==null&&(m.step=l.step);let x=n.createElement("span");x.className=`${S}-range-value`,x.textContent=m.value,m.addEventListener("input",()=>{x.textContent=m.value;});let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=d.fillConfirm,A.addEventListener("click",()=>v.onAnswer(m.value)),s.appendChild(m),s.appendChild(x),s.appendChild(A);return}case "password":{let m=n.createElement("input");m.type="password",m.className=`${S}-input`,m.autocomplete="off",w(m,()=>m.value);try{m.focus();}catch{}return}default:{let m=gr[l.kind];if(!m)return;let x=n.createElement("input");x.type=m,x.className=`${S}-input`,l.min!==null&&(x.min=l.min),l.max!==null&&(x.max=l.max),l.step!==null&&(x.step=l.step),w(x,()=>x.value);}}}return {show(l,v){h=l,o.textContent=l.question,c(l,v),this.setError(l.errorCode),g(),r.setAttribute("data-open","");},setError(l){l===null?(i.textContent="",i.style.setProperty("display","none")):(i.textContent=C(l),i.style.setProperty("display","block")),r.hasAttribute("data-open")&&g();},hide(){h=null,r.removeAttribute("data-open"),s.textContent="",i.textContent="",i.style.setProperty("display","none");},reposition(){r.hasAttribute("data-open")&&g();},isVisible:()=>r.hasAttribute("data-open"),destroy(){try{r.remove();}catch{}}}}var br=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,yr=/^\d{4}-\d{2}-\d{2}$/,wr=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,vr=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,xr=/^\d{4}-\d{2}$/,Cr=/^\d{4}-W\d{2}$/,kr=/^\+?[\d\s().-]{3,}$/;function Ar(e){let t=Date.parse(e);return Number.isFinite(t)}function Er(e,t){if(t.min!==null){let n=Number(t.min);if(Number.isFinite(n)&&e<n)return "number_too_small"}if(t.max!==null){let n=Number(t.max);if(Number.isFinite(n)&&e>n)return "number_too_large"}return null}function rt(e){return /^\d:/.test(e)?`0${e}`:e}function ve(e,t){return t.min!==null&&t.min.length>0&&e<t.min?"date_too_early":t.max!==null&&t.max.length>0&&e>t.max?"date_too_late":null}function hn(e,t){let n=t.kind==="password"?e:e.trim();if(n.length===0)return t.required?"required":null;if(t.maxLength!==null&&n.length>t.maxLength)return "too_long";switch(t.kind){case "number":case "range":{let r=Number(n);return Number.isFinite(r)?Er(r,t):"invalid_number"}case "email":return br.test(n)?null:"invalid_email";case "url":try{let r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?null:"invalid_url"}catch{return "invalid_url"}case "tel":return kr.test(n)?null:"invalid";case "date":return !yr.test(n)||!Ar(n)?"invalid_date":ve(n,t);case "datetime":return vr.test(n)?ve(n,t):"invalid_date";case "month":return xr.test(n)?ve(n,t):"invalid_date";case "week":return Cr.test(n)?ve(n,t):"invalid_date";case "time":return wr.test(n)?ve(rt(n),{...t,min:t.min!==null?rt(t.min):null,max:t.max!==null?rt(t.max):null}):"invalid_time";case "select":case "radio":return (t.options??[]).some(o=>o.value===n)?null:"invalid_option";case "checkbox":return n==="true"||n==="false"?null:"invalid_option";default:{if(t.pattern)try{if(!new RegExp(`^(?:${t.pattern})$`).test(n))return "invalid"}catch{}return null}}}function mn(e,t){if(!t||t.length===0)return e;let n=e.trim();if(t.some(i=>i.value===n))return n;let r=n.toLowerCase(),o=t.find(i=>i.label.trim().toLowerCase()===r);return o?o.value:e}var Tr="https://api.arcyai.com",_r="/api/v1/sdk/flows/catalog";function Sr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Lr(e,t,n,r){return new Promise(o=>{let i=false,s=h=>{i||(i=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}function Ir(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.cvid=="string"&&(t.publicName===null||typeof t.publicName=="string")&&(t.summary===null||typeof t.summary=="string")&&(t.firstStepRoute===void 0||t.firstStepRoute===null||typeof t.firstStepRoute=="string")}function Rr(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.cvid=="string"&&typeof t.publicName=="string"&&t.publicName.trim().length>0&&(t.summary===null||t.summary===void 0||typeof t.summary=="string")}function Mr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.flows;if(!Array.isArray(t))return null;let n=[];for(let i of t)Ir(i)&&n.push({...i,firstStepRoute:i.firstStepRoute??null});let r=e.starterFlows,o=Array.isArray(r)?r.filter(Rr).map(i=>({cvid:i.cvid,publicName:i.publicName,summary:i.summary??null})):[];return {flows:n,starterFlows:o}}function Fr(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function gn(e){let{apiBase:t=Tr,sessionToken:n,sessionId:r,setTimeoutImpl:o=(C,g)=>setTimeout(C,g),timeoutMs:i=8e3}=e,s=Sr(e.fetchImpl);if(!s)return {ok:false,reason:"unusable"};let h=(async()=>{let C;try{C=await s(`${t}${_r}`,{method:"POST",headers:Fr(n),body:JSON.stringify(r?{sessionId:r}:{}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(!C.ok)return {ok:false,reason:"rejected"};let g;try{g=await C.json();}catch{return {ok:false,reason:"unusable"}}let c=Mr(g);return c?{ok:true,...c}:{ok:false,reason:"unusable"}})();return Lr(h,i,o,{ok:false,reason:"network"})}function bn(e){let t=[];for(let n of e){let r=n.publicName?.trim()??"";r&&t.push({...n,publicName:r});}return t}var D="https://api.arcyai.com",Pr="/api/v1/sdk/agent/query";function Nr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function $r(e,t,n,r){return new Promise(o=>{let i=false,s=h=>{i||(i=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}var Or=new Set(["credits_exhausted","lapsed","org_cap_exceeded","user_cap_exceeded","anon_org_cap_exceeded","anon_user_cap_exceeded"]);function Dr(e){return typeof e=="string"&&Or.has(e)}function Br(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.responseType!=="chat")return null;let n=t.chatResponse;if(!n||typeof n!="object"||Array.isArray(n))return null;let r=n;if(typeof r.message!="string")return null;let o=[];if(Array.isArray(r.flowsOffered))for(let s of r.flowsOffered){if(!s||typeof s!="object"||Array.isArray(s))continue;let h=s;typeof h.flowCvid=="string"&&(h.publicName!==null&&typeof h.publicName!="string"||o.push({flowCvid:h.flowCvid,publicName:h.publicName??null}));}let i=[];if(Array.isArray(r.citedSources))for(let s of r.citedSources){if(!s||typeof s!="object"||Array.isArray(s))continue;let h=s;typeof h.documentId!="string"||typeof h.title!="string"||h.sourceUrl!==null&&typeof h.sourceUrl!="string"||i.push({documentId:h.documentId,title:h.title,sourceUrl:h.sourceUrl??null});}return {ok:true,message:r.message,messageId:typeof r.messageId=="string"&&r.messageId.length>0?r.messageId:null,isFallback:r.isFallback===true,flowsOffered:o,citedSources:i}}function Hr(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function yn(e){let{apiBase:t=D,publicKey:n,sessionId:r,sessionToken:o,query:i,route:s,conversationId:h,attachments:C=[],setTimeoutImpl:g=(d,u)=>setTimeout(d,u),timeoutMs:c=2e4}=e,l=Nr(e.fetchImpl);if(!l)return {ok:false,reason:"unusable"};let v=(async()=>{let d;try{d=await l(`${t}${Pr}`,{method:"POST",headers:Hr(o),body:JSON.stringify({publicKey:n,sessionId:r,query:i,route:s,conversationId:h,...C.length>0?{attachments:C}:{}}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(d.status===402){let m;try{m=await d.json();}catch{return {ok:false,reason:"unusable"}}let x=m&&typeof m=="object"&&!Array.isArray(m)?m.reason:void 0;return Dr(x)?{ok:false,reason:"cap_denied",capReason:x}:{ok:false,reason:"unusable"}}if(!d.ok)return {ok:false,reason:"rejected"};let u;try{u=await d.json();}catch{return {ok:false,reason:"unusable"}}return Br(u)??{ok:false,reason:"unusable"}})();return $r(v,c,g,{ok:false,reason:"network"})}var Ur="https://api.arcyai.com";function zr(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function ot(e,t){return zr(e)?/^https:\/\//i.test(e)?e:`${(t??Ur).replace(/\/+$/,"")}${e}`:null}var vn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';function V(e,t=vn){return {family:e,fallback:t,stack:`"${e}", ${t}`}}var xn={system:{stack:vn},serif:{stack:'Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif'},mono:{stack:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace'},humanist:{stack:'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", sans-serif'},rounded:{stack:'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, "Arial Rounded MT Bold", Calibri, sans-serif'},inter:V("Inter"),roboto:V("Roboto"),"open-sans":V("Open Sans"),lato:V("Lato"),poppins:V("Poppins"),montserrat:V("Montserrat"),nunito:V("Nunito"),"source-sans-3":V("Source Sans 3"),"work-sans":V("Work Sans"),"dm-sans":V("DM Sans"),manrope:V("Manrope"),"playfair-display":V("Playfair Display","Georgia, serif"),"ibm-plex-sans":V("IBM Plex Sans")},Vr=[["latin","U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"],["latin-ext","U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF"]];var De="--_arcy-font",wn="data-arcy-font";function Wr(e,t=D){let n=xn[e];return n?.family?Vr.map(([r,o])=>`@font-face{font-family:"${n.family}";font-style:normal;font-weight:400;font-display:swap;src:url("${t}/fonts/${e}-${r}.woff2") format("woff2");unicode-range:${o};}`).join(`
841
- `):""}function it(e,t,n=D){try{let r=e.style.getPropertyValue(Lt).trim(),o=r?xn[r]:void 0;if(!o){e.style.removeProperty(De);return}if(e.style.setProperty(De,o.stack),!o.family)return;let i=t.head||t.documentElement;if(!i||i.querySelector(`style[${wn}="${r}"]`))return;let s=t.createElement("style");Le(s),s.setAttribute(wn,r),s.textContent=Wr(r,n),i.appendChild(s);}catch{}}var jr="/api/v1/sdk/conversations",Gr=15e3,Yr=20,Cn=60;function Kr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function qr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.conversations;if(!Array.isArray(t))return null;let n=[];for(let r of t){if(n.length>=Yr)break;if(!r||typeof r!="object"||Array.isArray(r))continue;let o=r;if(typeof o.id!="string"||o.id.length===0)continue;let i=o.lastMessageAt,s=typeof i=="number"&&Number.isFinite(i)?i:typeof i=="string"?Date.parse(i):NaN;n.push({id:o.id,firstMessage:typeof o.firstMessage=="string"&&o.firstMessage.length>0?o.firstMessage:null,hasImage:o.hasImage===true,lastMessageAt:Number.isFinite(s)?s:0});}return n}function kn(e){if(!e)return "";try{return new Date(e).toLocaleDateString()}catch{return ""}}function Xr(e,t){let n=e.firstMessage?.trim()??"";if(n.length>0)return n.length>Cn?`${n.slice(0,Cn-1).trimEnd()}\u2026`:n;let r=kn(e.lastMessageAt);return e.hasImage?r?`${t} ${r}`:t:r||t}function at(e,t,n){return e.map(r=>({id:r.id,title:Xr(r,t),subtitle:kn(r.lastMessageAt),active:!!(n&&r.id===n)}))}async function An(e){let{apiBase:t=D,sessionToken:n,visitorId:r,setTimeoutImpl:o=(C,g)=>setTimeout(C,g),timeoutMs:i=Gr}=e,s=Kr(e.fetchImpl);if(!s||!n||!r)return {ok:false};let h=(async()=>{let C;try{C=await s(`${t}${jr}?visitorId=${encodeURIComponent(r)}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!C.ok)return {ok:false};let g;try{g=await C.json();}catch{return {ok:false}}let c=qr(g);return c?{ok:true,conversations:c}:{ok:false}})();return new Promise(C=>{let g=false,c=l=>{g||(g=true,C(l));};h.then(c,()=>c({ok:false}));try{o(()=>c({ok:!1}),i);}catch{}})}var Qr="/api/v1/sdk/conversations/{conversationId}/messages",Jr=15e3,Zr=200;function eo(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function to(e){return Qr.replace("{conversationId}",encodeURIComponent(e))}function En(e){return e==="agent"?"assistant":"user"}function no(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.messages;if(!Array.isArray(t))return null;let n=[];for(let r of t){if(n.length>=Zr)break;if(!r||typeof r!="object"||Array.isArray(r))continue;let o=r;if(typeof o.id!="string"||o.id.length===0||o.role!=="user"&&o.role!=="agent"||typeof o.text!="string")continue;let i=o.occurredAt,s=typeof i=="number"&&Number.isFinite(i)?i:typeof i=="string"?Date.parse(i):NaN,h=typeof o.images=="number"&&Number.isFinite(o.images)?Math.max(0,Math.floor(o.images)):0;n.push({id:o.id,role:o.role,text:o.text,occurredAt:Number.isFinite(s)?s:0,images:h,feedback:o.feedback==="up"||o.feedback==="down"?o.feedback:null});}return n}async function Tn(e){let{apiBase:t=D,sessionToken:n,conversationId:r,visitorId:o,setTimeoutImpl:i=(g,c)=>setTimeout(g,c),timeoutMs:s=Jr}=e,h=eo(e.fetchImpl);if(!h||!n||!r)return {ok:false};let C=(async()=>{let g;try{let v=o?`?visitorId=${encodeURIComponent(o)}`:"";g=await h(`${t}${to(r)}${v}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!g.ok)return {ok:false};let c;try{c=await g.json();}catch{return {ok:false}}let l=no(c);return l?{ok:true,messages:l}:{ok:false}})();return new Promise(g=>{let c=false,l=v=>{c||(c=true,g(v));};C.then(l,()=>l({ok:false}));try{i(()=>l({ok:!1}),s);}catch{}})}var ro="/api/v1/sdk/conversations/{conversationId}/messages/{messageId}/feedback",oo=1e4;function io(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function ao(e,t){return ro.replace("{conversationId}",encodeURIComponent(e)).replace("{messageId}",encodeURIComponent(t))}async function _n(e){let{apiBase:t=D,sessionToken:n,conversationId:r,messageId:o,value:i,visitorId:s,setTimeoutImpl:h=(l,v)=>setTimeout(l,v),timeoutMs:C=oo}=e,g=io(e.fetchImpl);if(!g||!n||!r||!o)return {ok:false};let c=(async()=>{try{let l=s?`?visitorId=${encodeURIComponent(s)}`:"";return {ok:(await g(`${t}${ao(r,o)}${l}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({value:i}),credentials:"omit"})).ok}}catch{return {ok:false}}})();return new Promise(l=>{let v=false,d=u=>{v||(v=true,l(u));};c.then(d,()=>d({ok:false}));try{h(()=>d({ok:!1}),C);}catch{}})}var so="<svg width='476' height='139' viewBox='0 0 476 139' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M0 24.69C0 11.0541 11.0541 0 24.69 0H451.311C464.946 0 476 11.0537 476 24.6892V114.311C476 127.946 464.946 139 451.311 139H24.69C11.0541 139 0 127.946 0 114.31V24.69Z' fill='#12161A'/><path d='M132.047 84.6159L108.384 42.3014C101.224 29.4986 82.7988 29.502 75.6456 42.3116L52.0065 84.6362C43.8531 99.2299 63.7247 113.114 74.6251 100.436C83.7854 89.7891 100.271 89.7857 109.435 100.429C120.342 113.1 140.207 99.2096 132.047 84.6159Z' stroke='white' stroke-width='9.11833'/><path d='M232.67 100H221.885V85.398H183.969V100H173.183V70.2567C173.183 65.9148 173.93 61.9186 175.424 58.2681C176.917 54.6176 178.991 51.4787 181.646 48.8514C184.301 46.2242 187.44 44.1777 191.063 42.7119C194.685 41.2462 198.64 40.5133 202.927 40.5133H227.236C227.983 40.5133 228.688 40.6516 229.351 40.9282C230.015 41.2047 230.596 41.5919 231.094 42.0897C231.592 42.5875 231.979 43.1682 232.255 43.832C232.532 44.4957 232.67 45.2009 232.67 45.9476V100ZM183.969 74.6124H221.885V51.2989H202.927C202.595 51.2989 201.89 51.3542 200.811 51.4649C199.76 51.5478 198.53 51.7829 197.119 52.1701C195.736 52.5572 194.271 53.1518 192.722 53.9538C191.173 54.7558 189.749 55.8621 188.449 57.2725C187.149 58.6829 186.071 60.4528 185.214 62.5823C184.384 64.6841 183.969 67.2422 183.969 70.2567V74.6124ZM304.685 60.5082C304.685 62.9695 304.38 65.1681 303.772 67.104C303.164 69.0398 302.334 70.7545 301.283 72.2479C300.26 73.7136 299.071 74.9719 297.716 76.0228C296.36 77.0737 294.936 77.9449 293.443 78.6362C291.977 79.3 290.484 79.7839 288.963 80.0881C287.469 80.3924 286.059 80.5445 284.731 80.5445L307.257 100H290.58L268.097 80.5445H260.339V69.7589H284.731C286.086 69.6482 287.317 69.3717 288.423 68.9292C289.557 68.4591 290.525 67.8368 291.327 67.0625C292.157 66.2881 292.793 65.3617 293.235 64.2831C293.678 63.1769 293.899 61.9186 293.899 60.5082V53.7049C293.899 53.0965 293.816 52.6402 293.65 52.336C293.512 52.0041 293.318 51.7691 293.069 51.6308C292.848 51.4649 292.599 51.3681 292.323 51.3404C292.074 51.3128 291.839 51.2989 291.617 51.2989H256.025V100H245.239V45.9476C245.239 45.2009 245.378 44.4957 245.654 43.832C245.931 43.1682 246.304 42.5875 246.774 42.0897C247.272 41.5919 247.853 41.2047 248.517 40.9282C249.18 40.6516 249.899 40.5133 250.674 40.5133H291.617C294.024 40.5133 296.056 40.9558 297.716 41.8408C299.375 42.6981 300.716 43.7905 301.739 45.118C302.79 46.4178 303.537 47.8282 303.979 49.3492C304.45 50.8703 304.685 52.2945 304.685 53.622V60.5082ZM368.776 100H329.865C328.869 100 327.791 99.8894 326.629 99.6681C325.495 99.4192 324.361 99.0459 323.228 98.5481C322.121 98.0503 321.057 97.4142 320.033 96.6399C319.01 95.8379 318.098 94.8838 317.295 93.7775C316.521 92.6437 315.899 91.3439 315.429 89.8781C314.959 88.3848 314.724 86.7116 314.724 84.8587V55.6546C314.724 54.659 314.834 53.5943 315.055 52.4604C315.304 51.2989 315.678 50.1651 316.175 49.0588C316.673 47.925 317.323 46.8464 318.125 45.8232C318.927 44.7999 319.881 43.9011 320.987 43.1268C322.121 42.3248 323.421 41.6887 324.887 41.2185C326.353 40.7484 328.012 40.5133 329.865 40.5133H368.776V51.2989H329.865C328.454 51.2989 327.376 51.6723 326.629 52.419C325.882 53.1657 325.509 54.2719 325.509 55.7376V84.8587C325.509 86.2415 325.882 87.32 326.629 88.0944C327.404 88.8411 328.482 89.2144 329.865 89.2144H368.776V100ZM435.647 60.4252C435.647 62.8865 435.329 65.0851 434.692 67.021C434.084 68.9569 433.268 70.6715 432.245 72.1649C431.222 73.6306 430.019 74.8889 428.636 75.9398C427.281 76.9907 425.87 77.8619 424.405 78.5533C422.939 79.217 421.446 79.701 419.925 80.0052C418.431 80.3094 417.021 80.4615 415.693 80.4615H411.338V100H400.469V80.4615H396.155C394.827 80.4615 393.403 80.3094 391.882 80.0052C390.389 79.701 388.895 79.217 387.402 78.5533C385.936 77.8619 384.526 76.9907 383.171 75.9398C381.815 74.8889 380.612 73.6306 379.562 72.1649C378.538 70.6715 377.709 68.9569 377.073 67.021C376.464 65.0575 376.16 62.8589 376.16 60.4252V40.5133H386.946V60.4252C386.946 61.8356 387.167 63.1078 387.609 64.2416C388.052 65.3478 388.674 66.302 389.476 67.104C390.278 67.906 391.246 68.5282 392.38 68.9707C393.541 69.3855 394.827 69.5929 396.238 69.5929H415.693C416.716 69.427 417.767 69.2196 418.846 68.9707C419.925 68.6941 420.906 68.2378 421.791 67.6018C422.676 66.9657 423.409 66.0807 423.99 64.9468C424.571 63.813 424.861 62.3058 424.861 60.4252V40.5133H435.647V60.4252Z' fill='white'/></svg>";function Sn(e){try{let n=new DOMParser().parseFromString(so,"image/svg+xml").documentElement;if(!n||n.nodeName==="parsererror")return null;let r=e.importNode(n,!0);return r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),r}catch{return null}}var lo="/api/v1/sdk/uploads",co="/api/v1/sdk/uploads/discard",po=3,uo=5*1024*1024,fo=1568,ho=St,mo=3e4;function st(e,t){return ho.includes(e.type)?e.size>uo?{ok:false,reason:"size"}:t>=po?{ok:false,reason:"count"}:{ok:true}:{ok:false,reason:"type"}}function go(e,t,n=fo){let r=Math.max(e,t);if(!(r>n)||!(r>0))return {width:Math.round(e),height:Math.round(t)};let o=n/r;return {width:Math.max(1,Math.round(e*o)),height:Math.max(1,Math.round(t*o))}}function Ln(e,t=typeof fetch<"u"?fetch.bind(globalThis):null){return {createImageBitmap:n=>createImageBitmap(n),createCanvas(n,r){let o=e.createElement("canvas");o.width=n,o.height=r;let i=o.getContext("2d");return {drawImage(s,h,C){i?.drawImage(s,0,0,h,C);},toBlob(s,h){return new Promise(C=>{try{o.toBlob(g=>C(g),s,h);}catch{C(null);}})}}},fetchImpl:t}}async function bo(e,t){let n={blob:e,contentType:e.type,width:0,height:0};try{let r=await t.createImageBitmap(e),o=go(r.width,r.height);if(o.width===r.width&&o.height===r.height)return r.close?.(),{...n,width:r.width,height:r.height};let i=t.createCanvas(o.width,o.height);i.drawImage(r,o.width,o.height);let s=await i.toBlob("image/jpeg",.85);return r.close?.(),s?{blob:s,contentType:"image/jpeg",width:o.width,height:o.height}:n}catch{return n}}function yo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.objectKey;return typeof t=="string"&&t.length>0?t:null}function wo(e,t,n,r){return new Promise(o=>{let i=false,s=h=>{i||(i=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}async function In(e,t,n){let r=st(e,t);if(!r.ok)return {ok:false,reason:r.reason};let{apiBase:o=D,sessionToken:i,env:s,timeoutMs:h=mo}=n,C=s.setTimeoutImpl??((l,v)=>setTimeout(l,v)),g=s.fetchImpl;if(!g||!i)return {ok:false,reason:"failed"};let c=(async()=>{let l=await bo(e,s),v;try{v=new FormData,v.append("file",l.blob,"image");}catch{return {ok:false,reason:"failed"}}let d;try{d=await g(`${o}${lo}`,{method:"POST",headers:{Authorization:`Bearer ${i}`},body:v,credentials:"omit"});}catch{return {ok:false,reason:"failed"}}if(!d.ok)return {ok:false,reason:"failed"};let u;try{u=await d.json();}catch{return {ok:false,reason:"failed"}}let w=yo(u);return w?{ok:true,attachment:{objectKey:w,contentType:l.contentType,width:l.width,height:l.height}}:{ok:false,reason:"failed"}})();return wo(c,h,C,{ok:false,reason:"failed"})}async function Rn(e,t){let{apiBase:n=D,sessionToken:r,fetchImpl:o}=t;if(!o||!r||!e)return false;try{return (await o(`${n}${co}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({objectKey:e}),credentials:"omit"})).ok}catch{return false}}var de="arcy-chat-panel",lt="arcy-chat-header",Nn="arcy-chat-icon",$n="arcy-chat-name",He="arcy-chat-hbtn",ne="arcy-chat-body",On="arcy-chat-strip",Dn="arcy-chat-main",xe="arcy-chat-mark",Ce="arcy-chat-mark-link",$i=It;var xo="https://arcyai.com",re="arcy-chat-welcome",Ue="arcy-chat-starter",ct="arcy-chat-starters",dt="arcy-chat-chips",J="arcy-chat-chip",Co=new Set(["org_cap_exceeded","anon_org_cap_exceeded","credits_exhausted","lapsed"]),ko=60,Ao=2500,Eo=Pt+`
841
+ `,gr={required:"fillRequired",invalid_number:"fillInvalidNumber",number_too_small:"fillNumberTooSmall",number_too_large:"fillNumberTooLarge",invalid_email:"fillInvalidEmail",invalid_url:"fillInvalidUrl",invalid_date:"fillInvalidDate",invalid_time:"fillInvalidTime",date_too_early:"fillDateTooEarly",date_too_late:"fillDateTooLate",too_long:"fillTooLong",invalid_option:"fillInvalidOption",invalid:"fillInvalid"},br={date:"date",time:"time",datetime:"datetime-local",month:"month",week:"week"};function hn(e,t){let n=e.host.ownerDocument,r=n.createElement("div");r.className=S,r.setAttribute("role","dialog");let o=n.createElement("div");o.className=`${S}-question`;let a=n.createElement("div");a.className=`${S}-error`,a.setAttribute("role","alert"),a.style.setProperty("display","none");let s=n.createElement("div");s.className=`${S}-controls`,r.appendChild(o),r.appendChild(a),r.appendChild(s),e.root.appendChild(r);let h=null;function C(l){let d=t()[gr[l]];return (typeof d=="string"?d:"").replace("{min}",h?.min??"").replace("{max}",h?.max??String(h?.maxLength??""))}function g(){let l;try{l=e.bar.getMetrics();}catch{return}let w=l.bottomOffset+l.keyboardOffset+l.height+8,d=r.style;if(d.setProperty("bottom",`${w}px`),d.setProperty("left","50%"),d.setProperty("translate","-50%"),l.isMobile){d.setProperty("width",`calc(100% - ${24}px)`),d.setProperty("max-width","none"),d.setProperty("transform","none");return}let u=Oe(l.widthPercent,{width:l.viewportWidth,height:l.viewportHeight});d.setProperty("width",`${u}px`),d.setProperty("max-width",`calc(100vw - ${32}px)`),d.setProperty("transform",xe({x:De(l.offset.x,u,l.viewportWidth),y:l.offset.y}));}function c(l,w){s.textContent="";let d=t(),u=(m,x)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-pill`,A.textContent=m,A.addEventListener("click",()=>w.onAnswer(x)),s.appendChild(A);},v=(m,x)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=d.fillConfirm,A.addEventListener("click",()=>w.onAnswer(x())),m.addEventListener("keydown",E=>{E.key==="Enter"&&(E.preventDefault(),w.onAnswer(x()));}),s.appendChild(m),s.appendChild(A);};switch(l.kind){case "select":case "radio":{for(let m of l.options??[])u(m.label,m.value);return}case "checkbox":{u(d.fillYes,"true"),u(d.fillNo,"false");return}case "range":{let m=n.createElement("input");m.type="range",m.className=`${S}-range`,l.min!==null&&(m.min=l.min),l.max!==null&&(m.max=l.max),l.step!==null&&(m.step=l.step);let x=n.createElement("span");x.className=`${S}-range-value`,x.textContent=m.value,m.addEventListener("input",()=>{x.textContent=m.value;});let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=d.fillConfirm,A.addEventListener("click",()=>w.onAnswer(m.value)),s.appendChild(m),s.appendChild(x),s.appendChild(A);return}case "password":{let m=n.createElement("input");m.type="password",m.className=`${S}-input`,m.autocomplete="off",v(m,()=>m.value);try{m.focus();}catch{}return}default:{let m=br[l.kind];if(!m)return;let x=n.createElement("input");x.type=m,x.className=`${S}-input`,l.min!==null&&(x.min=l.min),l.max!==null&&(x.max=l.max),l.step!==null&&(x.step=l.step),v(x,()=>x.value);}}}return {show(l,w){h=l,o.textContent=l.question,c(l,w),this.setError(l.errorCode),g(),r.setAttribute("data-open","");},setError(l){l===null?(a.textContent="",a.style.setProperty("display","none")):(a.textContent=C(l),a.style.setProperty("display","block")),r.hasAttribute("data-open")&&g();},hide(){h=null,r.removeAttribute("data-open"),s.textContent="",a.textContent="",a.style.setProperty("display","none");},reposition(){r.hasAttribute("data-open")&&g();},isVisible:()=>r.hasAttribute("data-open"),destroy(){try{r.remove();}catch{}}}}var yr=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,wr=/^\d{4}-\d{2}-\d{2}$/,vr=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,xr=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,Cr=/^\d{4}-\d{2}$/,kr=/^\d{4}-W\d{2}$/,Ar=/^\+?[\d\s().-]{3,}$/;function Er(e){let t=Date.parse(e);return Number.isFinite(t)}function Tr(e,t){if(t.min!==null){let n=Number(t.min);if(Number.isFinite(n)&&e<n)return "number_too_small"}if(t.max!==null){let n=Number(t.max);if(Number.isFinite(n)&&e>n)return "number_too_large"}return null}function it(e){return /^\d:/.test(e)?`0${e}`:e}function Ce(e,t){return t.min!==null&&t.min.length>0&&e<t.min?"date_too_early":t.max!==null&&t.max.length>0&&e>t.max?"date_too_late":null}function mn(e,t){let n=t.kind==="password"?e:e.trim();if(n.length===0)return t.required?"required":null;if(t.maxLength!==null&&n.length>t.maxLength)return "too_long";switch(t.kind){case "number":case "range":{let r=Number(n);return Number.isFinite(r)?Tr(r,t):"invalid_number"}case "email":return yr.test(n)?null:"invalid_email";case "url":try{let r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?null:"invalid_url"}catch{return "invalid_url"}case "tel":return Ar.test(n)?null:"invalid";case "date":return !wr.test(n)||!Er(n)?"invalid_date":Ce(n,t);case "datetime":return xr.test(n)?Ce(n,t):"invalid_date";case "month":return Cr.test(n)?Ce(n,t):"invalid_date";case "week":return kr.test(n)?Ce(n,t):"invalid_date";case "time":return vr.test(n)?Ce(it(n),{...t,min:t.min!==null?it(t.min):null,max:t.max!==null?it(t.max):null}):"invalid_time";case "select":case "radio":return (t.options??[]).some(o=>o.value===n)?null:"invalid_option";case "checkbox":return n==="true"||n==="false"?null:"invalid_option";default:{if(t.pattern)try{if(!new RegExp(`^(?:${t.pattern})$`).test(n))return "invalid"}catch{}return null}}}function gn(e,t){if(!t||t.length===0)return e;let n=e.trim();if(t.some(a=>a.value===n))return n;let r=n.toLowerCase(),o=t.find(a=>a.label.trim().toLowerCase()===r);return o?o.value:e}var _r="https://api.arcyai.com",Sr="/api/v1/sdk/flows/catalog";function Lr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Ir(e,t,n,r){return new Promise(o=>{let a=false,s=h=>{a||(a=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}function Rr(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.cvid=="string"&&(t.publicName===null||typeof t.publicName=="string")&&(t.summary===null||typeof t.summary=="string")&&(t.firstStepRoute===void 0||t.firstStepRoute===null||typeof t.firstStepRoute=="string")}function Mr(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.cvid=="string"&&typeof t.publicName=="string"&&t.publicName.trim().length>0&&(t.summary===null||t.summary===void 0||typeof t.summary=="string")}function Fr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.flows;if(!Array.isArray(t))return null;let n=[];for(let a of t)Rr(a)&&n.push({...a,firstStepRoute:a.firstStepRoute??null});let r=e.starterFlows,o=Array.isArray(r)?r.filter(Mr).map(a=>({cvid:a.cvid,publicName:a.publicName,summary:a.summary??null})):[];return {flows:n,starterFlows:o}}function Pr(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function bn(e){let{apiBase:t=_r,sessionToken:n,sessionId:r,setTimeoutImpl:o=(C,g)=>setTimeout(C,g),timeoutMs:a=8e3}=e,s=Lr(e.fetchImpl);if(!s)return {ok:false,reason:"unusable"};let h=(async()=>{let C;try{C=await s(`${t}${Sr}`,{method:"POST",headers:Pr(n),body:JSON.stringify(r?{sessionId:r}:{}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(!C.ok)return {ok:false,reason:"rejected"};let g;try{g=await C.json();}catch{return {ok:false,reason:"unusable"}}let c=Fr(g);return c?{ok:true,...c}:{ok:false,reason:"unusable"}})();return Ir(h,a,o,{ok:false,reason:"network"})}function yn(e){let t=[];for(let n of e){let r=n.publicName?.trim()??"";r&&t.push({...n,publicName:r});}return t}var D="https://api.arcyai.com",$r="/api/v1/sdk/agent/query";function Nr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Or(e,t,n,r){return new Promise(o=>{let a=false,s=h=>{a||(a=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}var Dr=new Set(["credits_exhausted","lapsed","org_cap_exceeded","user_cap_exceeded","anon_org_cap_exceeded","anon_user_cap_exceeded"]);function Br(e){return typeof e=="string"&&Dr.has(e)}function Hr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.responseType!=="chat")return null;let n=t.chatResponse;if(!n||typeof n!="object"||Array.isArray(n))return null;let r=n;if(typeof r.message!="string")return null;let o=[];if(Array.isArray(r.flowsOffered))for(let s of r.flowsOffered){if(!s||typeof s!="object"||Array.isArray(s))continue;let h=s;typeof h.flowCvid=="string"&&(h.publicName!==null&&typeof h.publicName!="string"||o.push({flowCvid:h.flowCvid,publicName:h.publicName??null}));}let a=[];if(Array.isArray(r.citedSources))for(let s of r.citedSources){if(!s||typeof s!="object"||Array.isArray(s))continue;let h=s;typeof h.documentId!="string"||typeof h.title!="string"||h.sourceUrl!==null&&typeof h.sourceUrl!="string"||a.push({documentId:h.documentId,title:h.title,sourceUrl:h.sourceUrl??null});}return {ok:true,message:r.message,messageId:typeof r.messageId=="string"&&r.messageId.length>0?r.messageId:null,isFallback:r.isFallback===true,flowsOffered:o,citedSources:a}}function Ur(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function wn(e){let{apiBase:t=D,publicKey:n,sessionId:r,sessionToken:o,query:a,route:s,conversationId:h,attachments:C=[],setTimeoutImpl:g=(d,u)=>setTimeout(d,u),timeoutMs:c=2e4}=e,l=Nr(e.fetchImpl);if(!l)return {ok:false,reason:"unusable"};let w=(async()=>{let d;try{d=await l(`${t}${$r}`,{method:"POST",headers:Ur(o),body:JSON.stringify({publicKey:n,sessionId:r,query:a,route:s,conversationId:h,...C.length>0?{attachments:C}:{}}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(d.status===402){let m;try{m=await d.json();}catch{return {ok:false,reason:"unusable"}}let x=m&&typeof m=="object"&&!Array.isArray(m)?m.reason:void 0;return Br(x)?{ok:false,reason:"cap_denied",capReason:x}:{ok:false,reason:"unusable"}}if(!d.ok)return {ok:false,reason:"rejected"};let u;try{u=await d.json();}catch{return {ok:false,reason:"unusable"}}return Hr(u)??{ok:false,reason:"unusable"}})();return Or(w,c,g,{ok:false,reason:"network"})}var zr="https://api.arcyai.com";function Vr(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function at(e,t){return Vr(e)?/^https:\/\//i.test(e)?e:`${(t??zr).replace(/\/+$/,"")}${e}`:null}var xn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';function V(e,t=xn){return {family:e,fallback:t,stack:`"${e}", ${t}`}}var Cn={system:{stack:xn},serif:{stack:'Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif'},mono:{stack:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace'},humanist:{stack:'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", sans-serif'},rounded:{stack:'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, "Arial Rounded MT Bold", Calibri, sans-serif'},inter:V("Inter"),roboto:V("Roboto"),"open-sans":V("Open Sans"),lato:V("Lato"),poppins:V("Poppins"),montserrat:V("Montserrat"),nunito:V("Nunito"),"source-sans-3":V("Source Sans 3"),"work-sans":V("Work Sans"),"dm-sans":V("DM Sans"),manrope:V("Manrope"),"playfair-display":V("Playfair Display","Georgia, serif"),"ibm-plex-sans":V("IBM Plex Sans")},Wr=[["latin","U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"],["latin-ext","U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF"]];var He="--_arcy-font",vn="data-arcy-font";function jr(e,t=D){let n=Cn[e];return n?.family?Wr.map(([r,o])=>`@font-face{font-family:"${n.family}";font-style:normal;font-weight:400;font-display:swap;src:url("${t}/fonts/${e}-${r}.woff2") format("woff2");unicode-range:${o};}`).join(`
842
+ `):""}function st(e,t,n=D){try{let r=e.style.getPropertyValue(It).trim(),o=r?Cn[r]:void 0;if(!o){e.style.removeProperty(He);return}if(e.style.setProperty(He,o.stack),!o.family)return;let a=t.head||t.documentElement;if(!a||a.querySelector(`style[${vn}="${r}"]`))return;let s=t.createElement("style");Re(s),s.setAttribute(vn,r),s.textContent=jr(r,n),a.appendChild(s);}catch{}}var Gr="/api/v1/sdk/conversations",Yr=15e3,Kr=20,kn=60;function qr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Xr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.conversations;if(!Array.isArray(t))return null;let n=[];for(let r of t){if(n.length>=Kr)break;if(!r||typeof r!="object"||Array.isArray(r))continue;let o=r;if(typeof o.id!="string"||o.id.length===0)continue;let a=o.lastMessageAt,s=typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?Date.parse(a):NaN;n.push({id:o.id,firstMessage:typeof o.firstMessage=="string"&&o.firstMessage.length>0?o.firstMessage:null,hasImage:o.hasImage===true,lastMessageAt:Number.isFinite(s)?s:0});}return n}function An(e){if(!e)return "";try{return new Date(e).toLocaleDateString()}catch{return ""}}function Qr(e,t){let n=e.firstMessage?.trim()??"";if(n.length>0)return n.length>kn?`${n.slice(0,kn-1).trimEnd()}\u2026`:n;let r=An(e.lastMessageAt);return e.hasImage?r?`${t} ${r}`:t:r||t}function lt(e,t,n){return e.map(r=>({id:r.id,title:Qr(r,t),subtitle:An(r.lastMessageAt),active:!!(n&&r.id===n)}))}async function En(e){let{apiBase:t=D,sessionToken:n,visitorId:r,setTimeoutImpl:o=(C,g)=>setTimeout(C,g),timeoutMs:a=Yr}=e,s=qr(e.fetchImpl);if(!s||!n||!r)return {ok:false};let h=(async()=>{let C;try{C=await s(`${t}${Gr}?visitorId=${encodeURIComponent(r)}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!C.ok)return {ok:false};let g;try{g=await C.json();}catch{return {ok:false}}let c=Xr(g);return c?{ok:true,conversations:c}:{ok:false}})();return new Promise(C=>{let g=false,c=l=>{g||(g=true,C(l));};h.then(c,()=>c({ok:false}));try{o(()=>c({ok:!1}),a);}catch{}})}var Jr="/api/v1/sdk/conversations/{conversationId}/messages",Zr=15e3,eo=200;function to(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function no(e){return Jr.replace("{conversationId}",encodeURIComponent(e))}function Tn(e){return e==="agent"?"assistant":"user"}function ro(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.messages;if(!Array.isArray(t))return null;let n=[];for(let r of t){if(n.length>=eo)break;if(!r||typeof r!="object"||Array.isArray(r))continue;let o=r;if(typeof o.id!="string"||o.id.length===0||o.role!=="user"&&o.role!=="agent"||typeof o.text!="string")continue;let a=o.occurredAt,s=typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?Date.parse(a):NaN,h=typeof o.images=="number"&&Number.isFinite(o.images)?Math.max(0,Math.floor(o.images)):0;n.push({id:o.id,role:o.role,text:o.text,occurredAt:Number.isFinite(s)?s:0,images:h,feedback:o.feedback==="up"||o.feedback==="down"?o.feedback:null});}return n}async function _n(e){let{apiBase:t=D,sessionToken:n,conversationId:r,visitorId:o,setTimeoutImpl:a=(g,c)=>setTimeout(g,c),timeoutMs:s=Zr}=e,h=to(e.fetchImpl);if(!h||!n||!r)return {ok:false};let C=(async()=>{let g;try{let w=o?`?visitorId=${encodeURIComponent(o)}`:"";g=await h(`${t}${no(r)}${w}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!g.ok)return {ok:false};let c;try{c=await g.json();}catch{return {ok:false}}let l=ro(c);return l?{ok:true,messages:l}:{ok:false}})();return new Promise(g=>{let c=false,l=w=>{c||(c=true,g(w));};C.then(l,()=>l({ok:false}));try{a(()=>l({ok:!1}),s);}catch{}})}var oo="/api/v1/sdk/conversations/{conversationId}/messages/{messageId}/feedback",io=1e4;function ao(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function so(e,t){return oo.replace("{conversationId}",encodeURIComponent(e)).replace("{messageId}",encodeURIComponent(t))}async function Sn(e){let{apiBase:t=D,sessionToken:n,conversationId:r,messageId:o,value:a,visitorId:s,setTimeoutImpl:h=(l,w)=>setTimeout(l,w),timeoutMs:C=io}=e,g=ao(e.fetchImpl);if(!g||!n||!r||!o)return {ok:false};let c=(async()=>{try{let l=s?`?visitorId=${encodeURIComponent(s)}`:"";return {ok:(await g(`${t}${so(r,o)}${l}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({value:a}),credentials:"omit"})).ok}}catch{return {ok:false}}})();return new Promise(l=>{let w=false,d=u=>{w||(w=true,l(u));};c.then(d,()=>d({ok:false}));try{h(()=>d({ok:!1}),C);}catch{}})}var lo="<svg width='476' height='139' viewBox='0 0 476 139' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M0 24.69C0 11.0541 11.0541 0 24.69 0H451.311C464.946 0 476 11.0537 476 24.6892V114.311C476 127.946 464.946 139 451.311 139H24.69C11.0541 139 0 127.946 0 114.31V24.69Z' fill='#12161A'/><path d='M132.047 84.6159L108.384 42.3014C101.224 29.4986 82.7988 29.502 75.6456 42.3116L52.0065 84.6362C43.8531 99.2299 63.7247 113.114 74.6251 100.436C83.7854 89.7891 100.271 89.7857 109.435 100.429C120.342 113.1 140.207 99.2096 132.047 84.6159Z' stroke='white' stroke-width='9.11833'/><path d='M232.67 100H221.885V85.398H183.969V100H173.183V70.2567C173.183 65.9148 173.93 61.9186 175.424 58.2681C176.917 54.6176 178.991 51.4787 181.646 48.8514C184.301 46.2242 187.44 44.1777 191.063 42.7119C194.685 41.2462 198.64 40.5133 202.927 40.5133H227.236C227.983 40.5133 228.688 40.6516 229.351 40.9282C230.015 41.2047 230.596 41.5919 231.094 42.0897C231.592 42.5875 231.979 43.1682 232.255 43.832C232.532 44.4957 232.67 45.2009 232.67 45.9476V100ZM183.969 74.6124H221.885V51.2989H202.927C202.595 51.2989 201.89 51.3542 200.811 51.4649C199.76 51.5478 198.53 51.7829 197.119 52.1701C195.736 52.5572 194.271 53.1518 192.722 53.9538C191.173 54.7558 189.749 55.8621 188.449 57.2725C187.149 58.6829 186.071 60.4528 185.214 62.5823C184.384 64.6841 183.969 67.2422 183.969 70.2567V74.6124ZM304.685 60.5082C304.685 62.9695 304.38 65.1681 303.772 67.104C303.164 69.0398 302.334 70.7545 301.283 72.2479C300.26 73.7136 299.071 74.9719 297.716 76.0228C296.36 77.0737 294.936 77.9449 293.443 78.6362C291.977 79.3 290.484 79.7839 288.963 80.0881C287.469 80.3924 286.059 80.5445 284.731 80.5445L307.257 100H290.58L268.097 80.5445H260.339V69.7589H284.731C286.086 69.6482 287.317 69.3717 288.423 68.9292C289.557 68.4591 290.525 67.8368 291.327 67.0625C292.157 66.2881 292.793 65.3617 293.235 64.2831C293.678 63.1769 293.899 61.9186 293.899 60.5082V53.7049C293.899 53.0965 293.816 52.6402 293.65 52.336C293.512 52.0041 293.318 51.7691 293.069 51.6308C292.848 51.4649 292.599 51.3681 292.323 51.3404C292.074 51.3128 291.839 51.2989 291.617 51.2989H256.025V100H245.239V45.9476C245.239 45.2009 245.378 44.4957 245.654 43.832C245.931 43.1682 246.304 42.5875 246.774 42.0897C247.272 41.5919 247.853 41.2047 248.517 40.9282C249.18 40.6516 249.899 40.5133 250.674 40.5133H291.617C294.024 40.5133 296.056 40.9558 297.716 41.8408C299.375 42.6981 300.716 43.7905 301.739 45.118C302.79 46.4178 303.537 47.8282 303.979 49.3492C304.45 50.8703 304.685 52.2945 304.685 53.622V60.5082ZM368.776 100H329.865C328.869 100 327.791 99.8894 326.629 99.6681C325.495 99.4192 324.361 99.0459 323.228 98.5481C322.121 98.0503 321.057 97.4142 320.033 96.6399C319.01 95.8379 318.098 94.8838 317.295 93.7775C316.521 92.6437 315.899 91.3439 315.429 89.8781C314.959 88.3848 314.724 86.7116 314.724 84.8587V55.6546C314.724 54.659 314.834 53.5943 315.055 52.4604C315.304 51.2989 315.678 50.1651 316.175 49.0588C316.673 47.925 317.323 46.8464 318.125 45.8232C318.927 44.7999 319.881 43.9011 320.987 43.1268C322.121 42.3248 323.421 41.6887 324.887 41.2185C326.353 40.7484 328.012 40.5133 329.865 40.5133H368.776V51.2989H329.865C328.454 51.2989 327.376 51.6723 326.629 52.419C325.882 53.1657 325.509 54.2719 325.509 55.7376V84.8587C325.509 86.2415 325.882 87.32 326.629 88.0944C327.404 88.8411 328.482 89.2144 329.865 89.2144H368.776V100ZM435.647 60.4252C435.647 62.8865 435.329 65.0851 434.692 67.021C434.084 68.9569 433.268 70.6715 432.245 72.1649C431.222 73.6306 430.019 74.8889 428.636 75.9398C427.281 76.9907 425.87 77.8619 424.405 78.5533C422.939 79.217 421.446 79.701 419.925 80.0052C418.431 80.3094 417.021 80.4615 415.693 80.4615H411.338V100H400.469V80.4615H396.155C394.827 80.4615 393.403 80.3094 391.882 80.0052C390.389 79.701 388.895 79.217 387.402 78.5533C385.936 77.8619 384.526 76.9907 383.171 75.9398C381.815 74.8889 380.612 73.6306 379.562 72.1649C378.538 70.6715 377.709 68.9569 377.073 67.021C376.464 65.0575 376.16 62.8589 376.16 60.4252V40.5133H386.946V60.4252C386.946 61.8356 387.167 63.1078 387.609 64.2416C388.052 65.3478 388.674 66.302 389.476 67.104C390.278 67.906 391.246 68.5282 392.38 68.9707C393.541 69.3855 394.827 69.5929 396.238 69.5929H415.693C416.716 69.427 417.767 69.2196 418.846 68.9707C419.925 68.6941 420.906 68.2378 421.791 67.6018C422.676 66.9657 423.409 66.0807 423.99 64.9468C424.571 63.813 424.861 62.3058 424.861 60.4252V40.5133H435.647V60.4252Z' fill='white'/></svg>";function Ln(e){try{let n=new DOMParser().parseFromString(lo,"image/svg+xml").documentElement;if(!n||n.nodeName==="parsererror")return null;let r=e.importNode(n,!0);return r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),r}catch{return null}}var co="/api/v1/sdk/uploads",po="/api/v1/sdk/uploads/discard",uo=3,fo=5*1024*1024,ho=1568,mo=Lt,go=3e4;function ct(e,t){return mo.includes(e.type)?e.size>fo?{ok:false,reason:"size"}:t>=uo?{ok:false,reason:"count"}:{ok:true}:{ok:false,reason:"type"}}function bo(e,t,n=ho){let r=Math.max(e,t);if(!(r>n)||!(r>0))return {width:Math.round(e),height:Math.round(t)};let o=n/r;return {width:Math.max(1,Math.round(e*o)),height:Math.max(1,Math.round(t*o))}}function In(e,t=typeof fetch<"u"?fetch.bind(globalThis):null){return {createImageBitmap:n=>createImageBitmap(n),createCanvas(n,r){let o=e.createElement("canvas");o.width=n,o.height=r;let a=o.getContext("2d");return {drawImage(s,h,C){a?.drawImage(s,0,0,h,C);},toBlob(s,h){return new Promise(C=>{try{o.toBlob(g=>C(g),s,h);}catch{C(null);}})}}},fetchImpl:t}}async function yo(e,t){let n={blob:e,contentType:e.type,width:0,height:0};try{let r=await t.createImageBitmap(e),o=bo(r.width,r.height);if(o.width===r.width&&o.height===r.height)return r.close?.(),{...n,width:r.width,height:r.height};let a=t.createCanvas(o.width,o.height);a.drawImage(r,o.width,o.height);let s=await a.toBlob("image/jpeg",.85);return r.close?.(),s?{blob:s,contentType:"image/jpeg",width:o.width,height:o.height}:n}catch{return n}}function wo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.objectKey;return typeof t=="string"&&t.length>0?t:null}function vo(e,t,n,r){return new Promise(o=>{let a=false,s=h=>{a||(a=true,o(h));};e.then(s,()=>s(r));try{n(()=>s(r),t);}catch{}})}async function Rn(e,t,n){let r=ct(e,t);if(!r.ok)return {ok:false,reason:r.reason};let{apiBase:o=D,sessionToken:a,env:s,timeoutMs:h=go}=n,C=s.setTimeoutImpl??((l,w)=>setTimeout(l,w)),g=s.fetchImpl;if(!g||!a)return {ok:false,reason:"failed"};let c=(async()=>{let l=await yo(e,s),w;try{w=new FormData,w.append("file",l.blob,"image");}catch{return {ok:false,reason:"failed"}}let d;try{d=await g(`${o}${co}`,{method:"POST",headers:{Authorization:`Bearer ${a}`},body:w,credentials:"omit"});}catch{return {ok:false,reason:"failed"}}if(!d.ok)return {ok:false,reason:"failed"};let u;try{u=await d.json();}catch{return {ok:false,reason:"failed"}}let v=wo(u);return v?{ok:true,attachment:{objectKey:v,contentType:l.contentType,width:l.width,height:l.height}}:{ok:false,reason:"failed"}})();return vo(c,h,C,{ok:false,reason:"failed"})}async function Mn(e,t){let{apiBase:n=D,sessionToken:r,fetchImpl:o}=t;if(!o||!r||!e)return false;try{return (await o(`${n}${po}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({objectKey:e}),credentials:"omit"})).ok}catch{return false}}var de="arcy-chat-panel",dt="arcy-chat-header",Nn="arcy-chat-icon",On="arcy-chat-name",ze="arcy-chat-hbtn",ne="arcy-chat-body",Dn="arcy-chat-strip",Bn="arcy-chat-main",ke="arcy-chat-mark",Ae="arcy-chat-mark-link",Oi=Rt;var Co="https://arcyai.com",re="arcy-chat-welcome",pe="arcy-chat-starter",pt="arcy-chat-starters",ut="arcy-chat-chips",J="arcy-chat-chip",ko=new Set(["org_cap_exceeded","anon_org_cap_exceeded","credits_exhausted","lapsed"]),Ao=60,Eo=2500,To=$t+`
842
843
  /* Stays mounted and animates open/shut in place (D929/D979) rather than
843
844
  toggling "display": the bar glides the panel the last few pixels rather
844
845
  than having it appear or vanish. "visibility" (not "pointer-events",
@@ -859,7 +860,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
859
860
  transform: translateY(8px) scale(0.98);
860
861
  transition: opacity 260ms cubic-bezier(0.32, 0.72, 0, 1),
861
862
  transform 260ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 260ms;
862
- font: 14px/1.4 var(${De}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
863
+ font: 14px/1.4 var(${He}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
863
864
  background: var(--_arcy-main-bg, #ffffff);
864
865
  color: var(--_arcy-main-text, #101828);
865
866
  /* The shared base.border (D832): one value, the bar's edge and this one. */
@@ -900,7 +901,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
900
901
  border-bottom: 0;
901
902
  }
902
903
 
903
- .${lt} {
904
+ .${dt} {
904
905
  display: flex;
905
906
  align-items: center;
906
907
  gap: 4px;
@@ -908,7 +909,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
908
909
  flex: 0 0 auto;
909
910
  }
910
911
 
911
- .${He} {
912
+ .${ze} {
912
913
  appearance: none;
913
914
  border: 0;
914
915
  background: transparent;
@@ -922,11 +923,11 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
922
923
  -webkit-tap-highlight-color: transparent;
923
924
  }
924
925
 
925
- .${He}:hover {
926
+ .${ze}:hover {
926
927
  background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
927
928
  }
928
929
 
929
- .${He}:focus-visible {
930
+ .${ze}:focus-visible {
930
931
  outline: 2px solid currentColor;
931
932
  outline-offset: 2px;
932
933
  }
@@ -934,7 +935,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
934
935
  /* The identity sits in the middle, between the two controls on the left and
935
936
  the one on the right, so the panel reads as the operator's rather than as
936
937
  a third party's. */
937
- .${lt} .arcy-chat-identity {
938
+ .${dt} .arcy-chat-identity {
938
939
  flex: 1 1 auto;
939
940
  display: flex;
940
941
  align-items: center;
@@ -957,7 +958,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
957
958
  flex: 0 0 auto;
958
959
  }
959
960
 
960
- .${$n} {
961
+ .${On} {
961
962
  font-weight: 600;
962
963
  white-space: nowrap;
963
964
  overflow: hidden;
@@ -965,7 +966,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
965
966
  min-width: 0;
966
967
  }
967
968
 
968
- .${Dn} {
969
+ .${Bn} {
969
970
  position: relative;
970
971
  display: flex;
971
972
  flex: 1 1 auto;
@@ -1072,7 +1073,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1072
1073
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 70%, transparent);
1073
1074
  }
1074
1075
 
1075
- .${ct} {
1076
+ .${pt} {
1076
1077
  display: flex;
1077
1078
  flex-wrap: wrap;
1078
1079
  justify-content: center;
@@ -1084,40 +1085,60 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1084
1085
  row of height until that answers is what stops the greeting sliding up the
1085
1086
  panel while somebody is reading it. Released either way: an operator who
1086
1087
  has featured nothing must not be left with a permanent gap. */
1087
- .${ct}[data-pending] {
1088
+ .${pt}[data-pending] {
1088
1089
  min-height: 34px;
1089
1090
  }
1090
1091
 
1091
- .${Ue} {
1092
+ /* Painted in the operator's brand, not in neutral grey (D1478). These pills
1093
+ are the first thing a visitor is invited to touch, and a grey outline on a
1094
+ welcome screen reads as chrome rather than as an offer. Tinted rather than
1095
+ filled, the same brand-on-brand-wash pair the transcript already uses for a
1096
+ pressed rating: up to five of these sit in one row, and five solid brand
1097
+ buttons would fight both each other and the send button below them. The
1098
+ brand colour therefore lands on the border, on the wash behind the label,
1099
+ and on the label itself, all derived from the one token the operator set. */
1100
+ .${pe} {
1092
1101
  appearance: none;
1093
1102
  text-align: left;
1094
1103
  font: inherit;
1095
1104
  font-size: 12.5px;
1105
+ font-weight: 500;
1096
1106
  cursor: pointer;
1097
1107
  padding: 7px 13px;
1098
1108
  border-radius: 999px;
1099
- border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
1100
- background: transparent;
1101
- color: inherit;
1109
+ border: 1px solid color-mix(in srgb, var(--_arcy-brand-bg, #101828) 28%, transparent);
1110
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 8%, transparent);
1111
+ color: var(--_arcy-brand-bg, #101828);
1102
1112
  max-width: 100%;
1103
1113
  transition: background 120ms ease, border-color 120ms ease;
1104
1114
  -webkit-tap-highlight-color: transparent;
1105
1115
  }
1106
1116
 
1107
- .${Ue}:hover {
1108
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
1109
- border-color: color-mix(in srgb, var(--_arcy-main-text, #101828) 30%, transparent);
1117
+ .${pe}:hover {
1118
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 16%, transparent);
1119
+ border-color: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 48%, transparent);
1120
+ }
1121
+
1122
+ .${pe}:active {
1123
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 24%, transparent);
1124
+ }
1125
+
1126
+ /* Brand rather than "currentColor", so the ring stays the same colour on a
1127
+ pill whose label the host page has managed to restyle. */
1128
+ .${pe}:focus-visible {
1129
+ outline: 2px solid var(--_arcy-brand-bg, #101828);
1130
+ outline-offset: 2px;
1110
1131
  }
1111
1132
 
1112
1133
  @media (prefers-reduced-motion: reduce) {
1113
- .${Ue} {
1134
+ .${pe} {
1114
1135
  transition: none;
1115
1136
  }
1116
1137
  }
1117
1138
 
1118
1139
  /* \u2500\u2500 Attachments waiting to be sent \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 */
1119
1140
 
1120
- .${dt} {
1141
+ .${ut} {
1121
1142
  display: flex;
1122
1143
  flex-wrap: wrap;
1123
1144
  gap: 6px;
@@ -1126,7 +1147,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1126
1147
 
1127
1148
  /* In the tray the bar owns the insets; the rule above is the D845 fallback
1128
1149
  for a core with no tray. */
1129
- .${Rt} .${dt} {
1150
+ .${Mt} .${ut} {
1130
1151
  flex: 1 1 auto;
1131
1152
  min-width: 0;
1132
1153
  padding: 0;
@@ -1216,7 +1237,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1216
1237
  field. The AI disclosure and the consent sentence used to share this row
1217
1238
  and now sit under the bar instead, so the watermark is centred rather
1218
1239
  than pinned to a corner by a neighbour. */
1219
- .${On} {
1240
+ .${Dn} {
1220
1241
  flex: 0 0 auto;
1221
1242
  display: flex;
1222
1243
  align-items: center;
@@ -1226,7 +1247,7 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1226
1247
  color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
1227
1248
  }
1228
1249
 
1229
- .${Ce} {
1250
+ .${Ae} {
1230
1251
  display: inline-flex;
1231
1252
  align-items: center;
1232
1253
  gap: 4px;
@@ -1235,13 +1256,13 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1235
1256
  text-decoration: none;
1236
1257
  }
1237
1258
 
1238
- .${Ce} span {
1259
+ .${Ae} span {
1239
1260
  overflow: hidden;
1240
1261
  text-overflow: ellipsis;
1241
1262
  white-space: nowrap;
1242
1263
  }
1243
1264
 
1244
- .${xe} {
1265
+ .${ke} {
1245
1266
  height: 12px;
1246
1267
  width: auto;
1247
1268
  display: block;
@@ -1251,13 +1272,13 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1251
1272
  transition: opacity 120ms ease;
1252
1273
  }
1253
1274
 
1254
- .${Ce}:hover .${xe},
1255
- .${Ce}:focus-visible .${xe} {
1275
+ .${Ae}:hover .${ke},
1276
+ .${Ae}:focus-visible .${ke} {
1256
1277
  opacity: 1;
1257
1278
  }
1258
1279
 
1259
1280
  @media (prefers-reduced-motion: reduce) {
1260
- .${xe} {
1281
+ .${ke} {
1261
1282
  transition: none;
1262
1283
  }
1263
1284
  }
@@ -1267,5 +1288,5 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Le(r),r.setAtt
1267
1288
  transition: none;
1268
1289
  }
1269
1290
  }
1270
- `+Jt+Vt+dn,Mn="http://www.w3.org/2000/svg";function te(e,t,n=17){let r=e.createElementNS(Mn,"svg");r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("aria-hidden","true"),r.setAttribute("width",String(n)),r.setAttribute("height",String(n));for(let o of typeof t=="string"?[t]:t){let i=e.createElementNS(Mn,"path");i.setAttribute("d",o),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),r.appendChild(i);}return r}var To="M12 21a9 9 0 100-18 9 9 0 000 18zM12 7v5l3 2",Fn="M13 3L5 14h6l-1 7 8-11h-6l1-7z",_o="M6 9l6 6 6-6",So="M18 6L6 18M6 6l12 12",Lo=["M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z","M9 12a3 3 0 1 0 6 0 3 3 0 1 0-6 0"],Io=["M19 13V19H13","M5 5L19 19"],Pn=["M5 8h10","M9 4v4","M12 20l4-9 4 9","M13.5 17h5","M13 8a10 10 0 0 1-8 8","M8 11a10 10 0 0 0 5 5"],Ro="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";function Be(e,t){let n=e.style,r=t.bar.getMetrics(),o=t.getMaxHeightPercent?.()??ko,i=r.bottomOffset+r.keyboardOffset+r.height+8;if(n.setProperty("bottom",`${i}px`),n.setProperty("left","50%"),n.setProperty("translate","-50%"),n.setProperty("transform",we(r.offset)),r.isMobile){e.setAttribute("data-sheet",""),n.setProperty("width",`calc(100% - ${24}px)`),n.setProperty("max-width","none"),n.setProperty("height",`calc(100% - ${i+12}px)`),n.setProperty("max-height","none");return}e.removeAttribute("data-sheet");let s=Ne(r.widthPercent,{width:r.viewportWidth,height:r.viewportHeight});n.setProperty("width",`${s}px`),n.setProperty("max-width",`calc(100vw - ${32}px)`),n.setProperty("transform",we({x:$e(r.offset.x,s,r.viewportWidth),y:r.offset.y}));let h=i-r.offset.y,C=pn(o,r.viewportHeight,h);n.setProperty("height",`${C}px`),n.setProperty("max-height",`${C}px`);}function Mo(e){try{let ee=function(){try{for(;Q.firstChild;)Q.removeChild(Q.firstChild);Q.style.setProperty("display",F.length>0?"flex":"none");let a=d().removeImage;for(let p of F){let f=c.createElement("div");if(f.className=J,f.setAttribute("data-state",p.attachment?"ready":"uploading"),p.previewUrl){let _=c.createElement("img");_.src=p.previewUrl,_.alt="",f.appendChild(_);}let b=c.createElement("button");b.type="button",b.setAttribute("aria-label",a),b.setAttribute("data-tip",a),b.appendChild(te(c,So,12)),b.addEventListener("click",()=>{F=F.filter(_=>_!==p),mt(p),ee();}),f.appendChild(b),Q.appendChild(f);}e.bar.setAttachmentCount(F.length);}catch{}},yt=function(){e.setConversationId?.(null),P.clear(),gt(),X();},ue=function(a){let p=ie;p&&(ie=null,oe.hide(),e.bar.setAwaitingInput?.(!1),e.bar.setDisabled(Te),e.bar.setPlaceholder(v()?.inputPlaceholder??null),p.resolve(a));},We=function(a){let p=ie;if(!p)return;let f=p.request,b=f.kind==="select"||f.kind==="radio"?mn(a,f.options):f.kind==="password"?a:a.trim(),_=hn(b,f);if(_!==null){oe.setError(_);return}ue(b);},Ct=function(a){if(Te)return;let p=F.filter(f=>f.attachment!==null);F=F.filter(f=>f.attachment===null),ee(),P.addMessage("user",a,{images:p.length,imageUrls:p.map(f=>f.previewUrl).filter(f=>f!==null)}),X(),Te=!0,e.bar.setDisabled(!0),P.setPending(!0),yn({apiBase:e.apiBase??D,publicKey:e.publicKey??"",sessionId:e.getSessionId?.()??"",sessionToken:e.getSessionToken?.()??"",query:a,route:e.getRoute?.()??l?.location?.pathname??"",conversationId:e.getConversationId?.()??"",attachments:p.map(f=>({objectKey:f.attachment.objectKey}))}).then(f=>{let b=d();if(f.ok){P.addMessage("assistant",f.message,{messageId:f.messageId,citedSources:f.citedSources,flowOffers:f.flowsOffered}),e.touchConversation?.(),f.isFallback&&e.track?.("fallback_triggered",{},{question:a});for(let _ of f.flowsOffered)e.track?.("flow_suggested",{},{flowCvid:_.flowCvid});return}if(f.reason==="cap_denied"){Co.has(f.capReason)?e.onOrgCapExceeded?.():P.addMessage("system",b.userCapReached);return}P.addMessage("system",b.genericError);}).finally(()=>{Te=!1,P.setPending(!1),e.bar.setDisabled(!1);});},he=function(){if(!u.hasAttribute("data-open")){Ge(),it(e.host,c,e.apiBase),e.bar.setMode("open"),Be(u,e),u.setAttribute("data-open","");try{let a=e.isolated?e.root:c,p=e.isolated?a.activeElement:c.activeElement;_e=(e.isolated?p!==null:!!(p&&e.host.contains(p)))?null:c.activeElement,e.bar.focusInput();}catch{}}},Ge=function(){let a=v(),p=d();$(),W(),ie||e.bar.setPlaceholder(a?.inputPlaceholder??null),e.bar.setAttachEnabled(a?.allowImageUpload===!0),e.bar.setDisclaimer(j());for(let[f,b]of [[x,p.historyTitle],[A,p.flowsTitle],[N,p.settingsTitle],[U,p.collapse]])f.setAttribute("aria-label",b),f.setAttribute("data-tip",b);for(let f of [O,G,B])f.setTexts({backLabel:p.back,closeLabel:p.closeSheet});X();},Tt=function(){if(u.hasAttribute("data-open")){u.removeAttribute("data-open"),O.close(),G.close(),B.close(),Z="root",e.bar.setMode("idle"),e.bar.setDisclaimer(null);try{let a=_e;_e=null;let p=u.getRootNode();(p instanceof ShadowRoot?p.activeElement:document.activeElement!==null&&document.activeElement!==document.body)&&a&&a.isConnected&&typeof a.focus=="function"&&a.focus();}catch{}}};var t=ee,n=yt,r=ue,o=We,i=Ct,s=he,h=Ge,C=Tt;let g={host:e.host,root:e.root,isolated:e.isolated,destroy(){}};Ke(g,Eo),Ke(g,un);let c=e.host.ownerDocument,l=c.defaultView,v=()=>{try{return e.getWidget?.()??null}catch{return null}},d=()=>v()?.chrome??Mt,u=c.createElement("div");u.className=de,u.setAttribute("role","dialog"),u.setAttribute("aria-label","ARCY chat"),u.tabIndex=-1,u.style.setProperty("position","absolute","important"),u.style.setProperty("pointer-events","auto","important"),u.style.setProperty("box-sizing","border-box");let w=c.createElement("div");w.className=lt;let m=(a,p,f)=>{let b=c.createElement("button");return b.type="button",b.className=He,b.setAttribute("aria-label",a),b.setAttribute("data-tip",a),b.setAttribute("data-tip-placement","below"),b.setAttribute("data-tip-align",f),b.appendChild(te(c,p)),b},x=m(d().historyTitle,To,"start"),A=m(d().flowsTitle,Fn,"start");A.style.setProperty("display","none");let E=c.createElement("div");E.className="arcy-chat-identity";let L=c.createElement("span"),H=c.createElement("span");H.className=$n,E.appendChild(L),E.appendChild(H);let N=m(d().settingsTitle,Lo,"end");e.bar.dock||N.style.setProperty("display","none");let U=m(d().collapse,_o,"end");w.appendChild(x),w.appendChild(A),w.appendChild(E),w.appendChild(N),w.appendChild(U);let $=()=>{let a=v(),p=ot(a?.logoUrl,e.apiBase);if(H.textContent=p?"":a?.name??"",H.style.setProperty("display",p?"none":"block"),p&&L.getAttribute("data-src")===p)return;let f=p?c.createElement("img"):c.createElement("span");if(f.className=p?Nn:"",p){let b=f;b.alt=a?.name??"",b.decoding="async",b.onerror=()=>{try{let _=c.createElement("span");b.replaceWith(_),L=_,H.textContent=a?.name??"",H.style.setProperty("display","block");}catch{}},b.setAttribute("data-src",p),b.src=p;}L.replaceWith(f),L=f;},y=c.createElement("div");y.className=ne;let k=c.createElement("div");k.className=On;let T=c.createElement("a");T.className=Ce,T.href=xo,T.target="_blank",T.rel="noopener noreferrer";let I=c.createElement("span"),q=Sn(c);q&&q.setAttribute("class",xe),T.appendChild(I),q&&T.appendChild(q),k.appendChild(T);let W=()=>{let a=d();I.textContent=a.poweredBy.replace(/\s*ARCY\s*$/i,""),T.setAttribute("aria-label",a.poweredBy);},j=()=>{let a=v(),p=d(),f=a?.privacyPolicyUrl,b=a?.name?p.aiDisclaimer.replace("{app}",a.name):p.aiDisclaimer;if(typeof f=="string"&&/^https:\/\//i.test(f)){let _=p.consentWithPolicy.indexOf("{policy}"),Y=_>=0?p.consentWithPolicy.slice(0,_):`${p.consentWithPolicy} `,R=_>=0?p.consentWithPolicy.slice(_+8):"";return {before:`${b}${p.disclaimerJoin}${Y}`,linkLabel:p.privacyPolicy,linkHref:f,after:R}}return b},pe=c.createElement("div");pe.className=Dn,pe.appendChild(y),u.appendChild(w),u.appendChild(pe),u.appendChild(k),e.root.appendChild(u),it(e.host,c,e.apiBase),Be(u,e);let P=Zt(y,c,{labels:{likeAnswer:d().likeAnswer,dislikeAnswer:d().dislikeAnswer},answeringLabel:()=>d().answering,searchedSourcesLabel:d().searchedSourcesLabel,sourcesLabel:d().sourcesLabel,flowOfferHint:()=>d().flowOfferHint,onStartFlow:a=>{e.track?.("flow_pill_clicked",{},{flowCvid:a}),e.onStartFlow?.(a);},onFeedback:(a,p)=>{e.track?.("answer_feedback",{},{value:a});let f=e.getSessionToken?.()??"",b=e.getConversationId?.()??"";!p||!f||!b||_n({apiBase:e.apiBase,sessionToken:f,conversationId:b,messageId:p,value:a,visitorId:e.getVisitorId?.()??void 0});}}),z=c.createElement("div");z.className=re,y.insertBefore(z,y.firstChild);let pt=[],ke=!0,ut=null,X=()=>{try{for(;z.firstChild;)z.removeChild(z.firstChild);if(!P.isEmpty()){z.style.setProperty("display","none");return}z.style.setProperty("display","flex");let a=v(),p=c.createElement("div");p.className="arcy-chat-welcome-icon";let f=ot(a?.welcomeIconUrl,e.apiBase);if(f&&f!==ut){let R=c.createElement("img");R.src=f,R.alt="",R.addEventListener("error",()=>{ut=f,X();},{once:!0}),p.appendChild(R);}else p.appendChild(te(c,Ro,18));z.appendChild(p);let b=a?.welcomeHeadline?.trim()??"",_=a?.welcomeMessage?.trim()??"";if(b){let R=c.createElement("div");R.className="arcy-chat-headline",R.textContent=b,z.appendChild(R);}if(_){let R=c.createElement("div");R.className="arcy-chat-greeting",R.textContent=_,z.appendChild(R);}let Y=c.createElement("div");Y.className=ct,ke&&Y.setAttribute("data-pending","");for(let R of pt){let K=c.createElement("button");K.type="button",K.className=Ue,K.textContent=R.publicName,K.addEventListener("click",()=>{e.track?.("starter_flow_clicked",{},{flowCvid:R.cvid}),e.onStartFlow?.(R.cvid);}),Y.appendChild(K);}z.appendChild(Y);}catch{}},Q=c.createElement("div");Q.className=dt,Q.style.setProperty("display","none");let ft=e.bar.attachmentSlot?.()??null;ft?ft.appendChild(Q):y.insertBefore(Q,y.firstChild);let F=[],ht=Ln(c),Bn=ht.fetchImpl??(typeof fetch<"u"?fetch.bind(globalThis):null),Hn=a=>{try{return l?.URL?.createObjectURL?.(a)??URL.createObjectURL(a)}catch{return null}},ze=a=>{if(a.previewUrl){try{(l?.URL??URL).revokeObjectURL(a.previewUrl);}catch{}a.previewUrl=null;}},mt=a=>{ze(a);let p=a.attachment?.objectKey;p&&Rn(p,{apiBase:e.apiBase,sessionToken:e.getSessionToken?.()??"",fetchImpl:Bn});},gt=()=>{let a=F;F=[];for(let p of a)mt(p);ee();},Ae=Promise.resolve(),bt=a=>{Ae=Ae.then(async()=>{for(let p of a){let f=e.getSessionToken?.()??"",b=K=>{let Se=d();P.addMessage("system",K==="type"?Se.imageWrongType:K==="size"?Se.imageTooLarge:K==="count"?Se.imageTooMany:Se.imageFailed);},_=st(p,F.length);if(!_.ok){b(_.reason),X();continue}let Y={previewUrl:Hn(p),attachment:null};F=[...F,Y],ee();let R=await In(p,F.length-1,{apiBase:e.apiBase,sessionToken:f,env:ht});if(R.ok){Y.attachment=R.attachment,ee();continue}F=F.filter(K=>K!==Y),ze(Y),ee(),b(R.reason),X();}}),Ae=Ae.catch(()=>{});},Ve=[],O=Fe(u,c,{title:d().historyTitle,emptyText:d().historyEmpty,actionLabel:d().newChat,subtitleTips:!1,backLabel:d().back,closeLabel:d().closeSheet,onBack:()=>O.close(),onAction:()=>{yt(),O.close();},onSelect:a=>{if((e.getConversationId?.()??"")===a){O.close();return}e.setConversationId?.(a),P.clear(),gt(),X(),O.close(),Un(a);}});async function Un(a){let p=e.getSessionToken?.()??"";if(!p)return;let f=await Tn({apiBase:e.apiBase,sessionToken:p,conversationId:a,visitorId:e.getVisitorId?.()??void 0});if(f.ok&&(e.getConversationId?.()??"")===a){P.clear();for(let b of f.messages)P.addMessage(En(b.role),b.text,{images:b.images,at:b.occurredAt?new Date(b.occurredAt):void 0,messageId:b.id,feedback:b.feedback});X(),P.scrollToEnd();}}let G=Fe(u,c,{title:d().flowsTitle,emptyText:d().flowsEmpty,actionLabel:null,backLabel:d().back,closeLabel:d().closeSheet,itemIcon:a=>te(a,Fn,16),onBack:()=>G.close(),onSelect:a=>{G.close(),e.onStartFlow?.(a);}}),Z="root",B=Fe(u,c,{title:d().settingsTitle,side:"right",actionLabel:null,backLabel:d().back,closeLabel:d().closeSheet,onBack:()=>{if(Z==="language"){Z="root",Ee();return}B.close();},onSelect:a=>{if(Z==="language"){B.close(),Z="root",e.onSelectLocale?.(a);return}if(a==="language"){Z="language",Ee();return}a==="dock"&&(B.close(),e.onRequestClose(),e.bar.dock?.());}}),zn=()=>{if(!e.onSelectLocale)return [];let a=v()?.locales??[];return a.length>=2?a:[]},Ee=()=>{let a=d(),p=zn();if(Z==="language"){B.setTitle(a.language),B.setItems(p.map(b=>({id:b.code,title:b.label,active:b.code===v()?.activeLocale,icon:_=>te(_,Pn,16)})));return}B.setTitle(a.settingsTitle);let f=p.find(b=>b.code===v()?.activeLocale);B.setItems([...p.length?[{id:"language",title:a.language,subtitle:f?.label??null,icon:b=>te(b,Pn,16)}]:[],{id:"dock",title:a.dockChat,subtitle:a.dockChatHint,icon:b=>te(b,Io,16)}]);},wt=()=>{let a=d();O.setTitle(a.historyTitle),O.setTexts({emptyText:a.historyEmpty,actionLabel:a.newChat}),O.setItems(at(Ve,a.imageConversation,e.getConversationId?.())),O.open(),Vn();};async function Vn(){let a=e.getSessionToken?.()??"",p=e.getVisitorId?.()??"";if(!a||!p)return;let f=await An({apiBase:e.apiBase,sessionToken:a,visitorId:p});f.ok&&(Ve=f.conversations,O.isOpen()&&O.setItems(at(Ve,d().imageConversation,e.getConversationId?.())));}x.addEventListener("click",wt),A.addEventListener("click",()=>{let a=d();G.setTitle(a.flowsTitle),G.setTexts({emptyText:a.flowsEmpty}),G.open();});let vt=()=>{Z="root",Ee(),B.open();};N.addEventListener("click",vt);let xt=()=>e.onRequestClose();U.addEventListener("click",xt);let oe=fn(e,()=>d()),ie=null,Te=!1;e.bar.onSubmit(a=>{if(ie){We(a);return}he(),Ct(a);}),e.bar.onFiles?.(a=>{he(),bt(a);});let Wn=()=>v()?.allowImageUpload===!0,jn=a=>{Ye(a)&&a.preventDefault();},Gn=a=>{if(!Ye(a)||(a.preventDefault(),!Wn()))return;let p=Ft(a);p.length>0&&bt(p);};u.addEventListener("dragover",jn),u.addEventListener("drop",Gn);let fe=a=>{pt=a,ke=!1,X();},kt=!1,je=()=>{if(kt)return !0;let a=e.getSessionToken?.();return a?(kt=!0,gn({apiBase:e.apiBase,sessionToken:a,sessionId:e.getSessionId?.()}).then(p=>{if(!p.ok){fe([]);return}let f=bn(p.flows);fe(p.starterFlows),f.length!==0&&(A.style.setProperty("display","flex"),G.setItems(f.map(b=>({id:b.cvid,title:b.publicName,subtitle:b.summary}))));}).catch(()=>{fe([]);}),!0):!1};if(!je())try{l?.setTimeout(()=>{!je()&&ke&&fe([]);},Ao);}catch{}let At=a=>{if(a.key==="Escape"){if(a.stopPropagation(),O.isOpen()){O.close();return}if(G.isOpen()){G.close();return}if(B.isOpen()){B.close();return}e.onRequestClose();}};u.addEventListener("keydown",At);let Et=()=>{u.hasAttribute("data-open")&&Be(u,e),oe.reposition();};l?.addEventListener("resize",Et);let _e=null;return {open:he,close:Tt,reposition(){u.hasAttribute("data-open")&&Be(u,e),oe.reposition();},refreshChrome(){!je()&&ke&&fe([]),u.hasAttribute("data-open")&&(Ge(),B.isOpen()&&Ee());},destroy(){x.removeEventListener("click",wt),N.removeEventListener("click",vt),U.removeEventListener("click",xt),u.removeEventListener("keydown",At),l?.removeEventListener("resize",Et),_e=null,ue(null),oe.destroy(),O.destroy(),G.destroy(),B.destroy(),P.destroy();for(let a of F)ze(a);F=[],Q.remove(),e.bar.setAttachmentCount(0),u.remove();},promptFill(a){return new Promise(p=>{ue(null),e.onRequestClose(),oe.show(a,{onAnswer:f=>We(f)}),e.bar.setAwaitingInput?.(!0),a.kind==="password"?e.bar.setDisabled(!0):(e.bar.setPlaceholder(a.question),e.bar.focusInput()),ie={resolve:p,request:a};})},cancelFill(){ue(null);},showFlowFailure(){he(),P.addMessage("assistant",d().flowFailed),X();}}}catch{return null}}var Fo={contract:4,mount:Mo};if(typeof window<"u")try{window[_t]=Fo;}catch{}
1271
- exports.ARCY_HOME_URL=xo;exports.BODY_CLASS=ne;exports.CATALOG_RETRY_MS=Ao;exports.CHAT_CSS=Eo;exports.CHIPS_CLASS=dt;exports.CHIP_CLASS=J;exports.HEADER_BUTTON_CLASS=He;exports.HEADER_CLASS=lt;exports.HEADER_ICON_CLASS=Nn;exports.HEADER_NAME_CLASS=$n;exports.MAIN_CLASS=Dn;exports.MARK_CLASS=xe;exports.MARK_LINK_CLASS=Ce;exports.PANEL_CLASS=de;exports.POLICY_CLASS=$i;exports.STARTER_CLASS=Ue;exports.STARTER_ROW_CLASS=ct;exports.STRIP_CLASS=On;exports.WELCOME_CLASS=re;exports.mount=Mo;exports.resolveImageUrl=ot;return exports;})({});
1291
+ `+Zt+Wt+pn,Fn="http://www.w3.org/2000/svg";function te(e,t,n=17){let r=e.createElementNS(Fn,"svg");r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("aria-hidden","true"),r.setAttribute("width",String(n)),r.setAttribute("height",String(n));for(let o of typeof t=="string"?[t]:t){let a=e.createElementNS(Fn,"path");a.setAttribute("d",o),a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","2"),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),r.appendChild(a);}return r}var _o="M12 21a9 9 0 100-18 9 9 0 000 18zM12 7v5l3 2",Pn="M13 3L5 14h6l-1 7 8-11h-6l1-7z",So="M6 9l6 6 6-6",Lo="M18 6L6 18M6 6l12 12",Io=["M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z","M9 12a3 3 0 1 0 6 0 3 3 0 1 0-6 0"],Ro=["M19 13V19H13","M5 5L19 19"],$n=["M5 8h10","M9 4v4","M12 20l4-9 4 9","M13.5 17h5","M13 8a10 10 0 0 1-8 8","M8 11a10 10 0 0 0 5 5"],Mo="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";function Ue(e,t){let n=e.style,r=t.bar.getMetrics(),o=t.getMaxHeightPercent?.()??Ao,a=r.bottomOffset+r.keyboardOffset+r.height+8;if(n.setProperty("bottom",`${a}px`),n.setProperty("left","50%"),n.setProperty("translate","-50%"),n.setProperty("transform",xe(r.offset)),r.isMobile){e.setAttribute("data-sheet",""),n.setProperty("width",`calc(100% - ${24}px)`),n.setProperty("max-width","none"),n.setProperty("height",`calc(100% - ${a+12}px)`),n.setProperty("max-height","none");return}e.removeAttribute("data-sheet");let s=Oe(r.widthPercent,{width:r.viewportWidth,height:r.viewportHeight});n.setProperty("width",`${s}px`),n.setProperty("max-width",`calc(100vw - ${32}px)`),n.setProperty("transform",xe({x:De(r.offset.x,s,r.viewportWidth),y:r.offset.y}));let h=a-r.offset.y,C=un(o,r.viewportHeight,h);n.setProperty("height",`${C}px`),n.setProperty("max-height",`${C}px`);}function Fo(e){try{let ee=function(){try{for(;Q.firstChild;)Q.removeChild(Q.firstChild);Q.style.setProperty("display",P.length>0?"flex":"none");let i=d().removeImage;for(let p of P){let f=c.createElement("div");if(f.className=J,f.setAttribute("data-state",p.attachment?"ready":"uploading"),p.previewUrl){let _=c.createElement("img");_.src=p.previewUrl,_.alt="",f.appendChild(_);}let b=c.createElement("button");b.type="button",b.setAttribute("aria-label",i),b.setAttribute("data-tip",i),b.appendChild(te(c,Lo,12)),b.addEventListener("click",()=>{P=P.filter(_=>_!==p),bt(p),ee();}),f.appendChild(b),Q.appendChild(f);}e.bar.setAttachmentCount(P.length);}catch{}},vt=function(){e.setConversationId?.(null),M.clear(),yt(),X();},he=function(i){let p=ie;p&&(ie=null,oe.hide(),e.bar.setAwaitingInput?.(!1),e.bar.setDisabled(_e),e.bar.setPlaceholder(w()?.inputPlaceholder??null),p.resolve(i));},je=function(i){let p=ie;if(!p)return;let f=p.request,b=f.kind==="select"||f.kind==="radio"?gn(i,f.options):f.kind==="password"?i:i.trim(),_=mn(b,f);if(_!==null){oe.setError(_);return}he(b);},At=function(i){if(_e)return;let p=P.filter(f=>f.attachment!==null);P=P.filter(f=>f.attachment===null),ee(),M.addMessage("user",i,{images:p.length,imageUrls:p.map(f=>f.previewUrl).filter(f=>f!==null)}),X(),_e=!0,e.bar.setDisabled(!0),M.setPending(!0),wn({apiBase:e.apiBase??D,publicKey:e.publicKey??"",sessionId:e.getSessionId?.()??"",sessionToken:e.getSessionToken?.()??"",query:i,route:e.getRoute?.()??l?.location?.pathname??"",conversationId:e.getConversationId?.()??"",attachments:p.map(f=>({objectKey:f.attachment.objectKey}))}).then(f=>{let b=d();if(f.ok){M.addMessage("assistant",f.message,{messageId:f.messageId,citedSources:f.citedSources,flowOffers:f.flowsOffered}),e.touchConversation?.(),f.isFallback&&e.track?.("fallback_triggered",{},{question:i});for(let _ of f.flowsOffered)e.track?.("flow_suggested",{},{flowCvid:_.flowCvid});return}if(f.reason==="cap_denied"){ko.has(f.capReason)?e.onOrgCapExceeded?.():M.addMessage("system",b.userCapReached);return}M.addMessage("system",b.genericError);}).finally(()=>{_e=!1,M.setPending(!1),e.bar.setDisabled(!1);});},ge=function(){if(!u.hasAttribute("data-open")){Ke(),st(e.host,c,e.apiBase),e.bar.setMode("open"),Ue(u,e),u.setAttribute("data-open","");try{let i=e.isolated?e.root:c,p=e.isolated?i.activeElement:c.activeElement;Le=(e.isolated?p!==null:!!(p&&e.host.contains(p)))?null:c.activeElement,e.bar.focusInput();}catch{}}},Ke=function(){let i=w(),p=d();N(),W(),ie||e.bar.setPlaceholder(i?.inputPlaceholder??null),e.bar.setAttachEnabled(i?.allowImageUpload===!0),e.bar.setDisclaimer(j());for(let[f,b]of [[x,p.historyTitle],[A,p.flowsTitle],[$,p.settingsTitle],[U,p.collapse]])f.setAttribute("aria-label",b),f.setAttribute("data-tip",b);for(let f of [O,G,B])f.setTexts({backLabel:p.back,closeLabel:p.closeSheet});X();},_t=function(){if(u.hasAttribute("data-open")){u.removeAttribute("data-open"),O.close(),G.close(),B.close(),Z="root",e.bar.setMode("idle"),e.bar.setDisclaimer(null);try{let i=Le;Le=null;let p=u.getRootNode();(p instanceof ShadowRoot?p.activeElement:document.activeElement!==null&&document.activeElement!==document.body)&&i&&i.isConnected&&typeof i.focus=="function"&&i.focus();}catch{}}};var t=ee,n=vt,r=he,o=je,a=At,s=ge,h=Ke,C=_t;let g={host:e.host,root:e.root,isolated:e.isolated,destroy(){}};Xe(g,To),Xe(g,fn);let c=e.host.ownerDocument,l=c.defaultView,w=()=>{try{return e.getWidget?.()??null}catch{return null}},d=()=>w()?.chrome??Ft,u=c.createElement("div");u.className=de,u.setAttribute("role","dialog"),u.setAttribute("aria-label","ARCY chat"),u.tabIndex=-1,u.style.setProperty("position","absolute","important"),u.style.setProperty("pointer-events","auto","important"),u.style.setProperty("box-sizing","border-box");let v=c.createElement("div");v.className=dt;let m=(i,p,f)=>{let b=c.createElement("button");return b.type="button",b.className=ze,b.setAttribute("aria-label",i),b.setAttribute("data-tip",i),b.setAttribute("data-tip-placement","below"),b.setAttribute("data-tip-align",f),b.appendChild(te(c,p)),b},x=m(d().historyTitle,_o,"start"),A=m(d().flowsTitle,Pn,"start");A.style.setProperty("display","none");let E=c.createElement("div");E.className="arcy-chat-identity";let L=c.createElement("span"),H=c.createElement("span");H.className=On,E.appendChild(L),E.appendChild(H);let $=m(d().settingsTitle,Io,"end");e.bar.dock||$.style.setProperty("display","none");let U=m(d().collapse,So,"end");v.appendChild(x),v.appendChild(A),v.appendChild(E),v.appendChild($),v.appendChild(U);let N=()=>{let i=w(),p=at(i?.logoUrl,e.apiBase);if(H.textContent=p?"":i?.name??"",H.style.setProperty("display",p?"none":"block"),p&&L.getAttribute("data-src")===p)return;let f=p?c.createElement("img"):c.createElement("span");if(f.className=p?Nn:"",p){let b=f;b.alt=i?.name??"",b.decoding="async",b.onerror=()=>{try{let _=c.createElement("span");b.replaceWith(_),L=_,H.textContent=i?.name??"",H.style.setProperty("display","block");}catch{}},b.setAttribute("data-src",p),b.src=p;}L.replaceWith(f),L=f;},y=c.createElement("div");y.className=ne;let k=c.createElement("div");k.className=Dn;let T=c.createElement("a");T.className=Ae,T.href=Co,T.target="_blank",T.rel="noopener noreferrer";let I=c.createElement("span"),q=Ln(c);q&&q.setAttribute("class",ke),T.appendChild(I),q&&T.appendChild(q),k.appendChild(T);let W=()=>{let i=d();I.textContent=i.poweredBy.replace(/\s*ARCY\s*$/i,""),T.setAttribute("aria-label",i.poweredBy);},j=()=>{let i=w(),p=d(),f=i?.privacyPolicyUrl,b=i?.name?p.aiDisclaimer.replace("{app}",i.name):p.aiDisclaimer;if(typeof f=="string"&&/^https:\/\//i.test(f)){let _=p.consentWithPolicy.indexOf("{policy}"),Y=_>=0?p.consentWithPolicy.slice(0,_):`${p.consentWithPolicy} `,R=_>=0?p.consentWithPolicy.slice(_+8):"";return {before:`${b}${p.disclaimerJoin}${Y}`,linkLabel:p.privacyPolicy,linkHref:f,after:R}}return b},ue=c.createElement("div");ue.className=Bn,ue.appendChild(y),u.appendChild(v),u.appendChild(ue),u.appendChild(k),e.root.appendChild(u),st(e.host,c,e.apiBase),Ue(u,e);let M=en(y,c,{labels:{likeAnswer:d().likeAnswer,dislikeAnswer:d().dislikeAnswer},answeringLabel:()=>d().answering,searchedSourcesLabel:d().searchedSourcesLabel,sourcesLabel:d().sourcesLabel,flowOfferHint:()=>d().flowOfferHint,onStartFlow:i=>{e.track?.("flow_pill_clicked",{},{flowCvid:i}),e.onStartFlow?.(i);},onFeedback:(i,p)=>{e.track?.("answer_feedback",{},{value:i});let f=e.getSessionToken?.()??"",b=e.getConversationId?.()??"";!p||!f||!b||Sn({apiBase:e.apiBase,sessionToken:f,conversationId:b,messageId:p,value:i,visitorId:e.getVisitorId?.()??void 0});}}),z=c.createElement("div");z.className=re,y.insertBefore(z,y.firstChild);let ft=[],fe=!0,ht=null,X=()=>{try{for(;z.firstChild;)z.removeChild(z.firstChild);if(!M.isEmpty()){z.style.setProperty("display","none");return}z.style.setProperty("display","flex");let i=w(),p=c.createElement("div");p.className="arcy-chat-welcome-icon";let f=at(i?.welcomeIconUrl,e.apiBase);if(f&&f!==ht){let R=c.createElement("img");R.src=f,R.alt="",R.addEventListener("error",()=>{ht=f,X();},{once:!0}),p.appendChild(R);}else p.appendChild(te(c,Mo,18));z.appendChild(p);let b=i?.welcomeHeadline?.trim()??"",_=i?.welcomeMessage?.trim()??"";if(b){let R=c.createElement("div");R.className="arcy-chat-headline",R.textContent=b,z.appendChild(R);}if(_){let R=c.createElement("div");R.className="arcy-chat-greeting",R.textContent=_,z.appendChild(R);}let Y=c.createElement("div");Y.className=pt,fe&&Y.setAttribute("data-pending","");for(let R of ft){let K=c.createElement("button");K.type="button",K.className=pe,K.textContent=R.publicName,K.addEventListener("click",()=>{e.track?.("starter_flow_clicked",{},{flowCvid:R.cvid}),e.onStartFlow?.(R.cvid);}),Y.appendChild(K);}z.appendChild(Y);}catch{}},Q=c.createElement("div");Q.className=ut,Q.style.setProperty("display","none");let mt=e.bar.attachmentSlot?.()??null;mt?mt.appendChild(Q):y.insertBefore(Q,y.firstChild);let P=[],gt=In(c),Hn=gt.fetchImpl??(typeof fetch<"u"?fetch.bind(globalThis):null),Un=i=>{try{return l?.URL?.createObjectURL?.(i)??URL.createObjectURL(i)}catch{return null}},Ve=i=>{if(i.previewUrl){try{(l?.URL??URL).revokeObjectURL(i.previewUrl);}catch{}i.previewUrl=null;}},bt=i=>{Ve(i);let p=i.attachment?.objectKey;p&&Mn(p,{apiBase:e.apiBase,sessionToken:e.getSessionToken?.()??"",fetchImpl:Hn});},yt=()=>{let i=P;P=[];for(let p of i)bt(p);ee();},Ee=Promise.resolve(),wt=i=>{Ee=Ee.then(async()=>{for(let p of i){let f=e.getSessionToken?.()??"",b=K=>{let Ie=d();M.addMessage("system",K==="type"?Ie.imageWrongType:K==="size"?Ie.imageTooLarge:K==="count"?Ie.imageTooMany:Ie.imageFailed);},_=ct(p,P.length);if(!_.ok){b(_.reason),X();continue}let Y={previewUrl:Un(p),attachment:null};P=[...P,Y],ee();let R=await Rn(p,P.length-1,{apiBase:e.apiBase,sessionToken:f,env:gt});if(R.ok){Y.attachment=R.attachment,ee();continue}P=P.filter(K=>K!==Y),Ve(Y),ee(),b(R.reason),X();}}),Ee=Ee.catch(()=>{});},We=[],O=$e(u,c,{title:d().historyTitle,emptyText:d().historyEmpty,actionLabel:d().newChat,subtitleTips:!1,backLabel:d().back,closeLabel:d().closeSheet,onBack:()=>O.close(),onAction:()=>{vt(),O.close();},onSelect:i=>{if((e.getConversationId?.()??"")===i&&!M.isEmpty()){O.close();return}e.setConversationId?.(i),M.clear(),yt(),X(),O.close(),zn(i);}});async function zn(i){let p=e.getSessionToken?.()??"";if(!p)return;let f=await _n({apiBase:e.apiBase,sessionToken:p,conversationId:i,visitorId:e.getVisitorId?.()??void 0});if(f.ok&&(e.getConversationId?.()??"")===i){M.clear();for(let b of f.messages)M.addMessage(Tn(b.role),b.text,{images:b.images,at:b.occurredAt?new Date(b.occurredAt):void 0,messageId:b.id,feedback:b.feedback});X(),M.scrollToEnd();}}let G=$e(u,c,{title:d().flowsTitle,emptyText:d().flowsEmpty,actionLabel:null,backLabel:d().back,closeLabel:d().closeSheet,itemIcon:i=>te(i,Pn,16),onBack:()=>G.close(),onSelect:i=>{G.close(),e.onStartFlow?.(i);}}),Z="root",B=$e(u,c,{title:d().settingsTitle,side:"right",actionLabel:null,backLabel:d().back,closeLabel:d().closeSheet,onBack:()=>{if(Z==="language"){Z="root",Te();return}B.close();},onSelect:i=>{if(Z==="language"){B.close(),Z="root",e.onSelectLocale?.(i);return}if(i==="language"){Z="language",Te();return}i==="dock"&&(B.close(),e.onRequestClose(),e.bar.dock?.());}}),Vn=()=>{if(!e.onSelectLocale)return [];let i=w()?.locales??[];return i.length>=2?i:[]},Te=()=>{let i=d(),p=Vn();if(Z==="language"){B.setTitle(i.language),B.setItems(p.map(b=>({id:b.code,title:b.label,active:b.code===w()?.activeLocale,icon:_=>te(_,$n,16)})));return}B.setTitle(i.settingsTitle);let f=p.find(b=>b.code===w()?.activeLocale);B.setItems([...p.length?[{id:"language",title:i.language,subtitle:f?.label??null,icon:b=>te(b,$n,16)}]:[],{id:"dock",title:i.dockChat,subtitle:i.dockChatHint,icon:b=>te(b,Ro,16)}]);},xt=()=>{let i=d();O.setTitle(i.historyTitle),O.setTexts({emptyText:i.historyEmpty,actionLabel:i.newChat}),O.setItems(lt(We,i.imageConversation,e.getConversationId?.())),O.open(),Wn();};async function Wn(){let i=e.getSessionToken?.()??"",p=e.getVisitorId?.()??"";if(!i||!p)return;let f=await En({apiBase:e.apiBase,sessionToken:i,visitorId:p});f.ok&&(We=f.conversations,O.isOpen()&&O.setItems(lt(We,d().imageConversation,e.getConversationId?.())));}x.addEventListener("click",xt),A.addEventListener("click",()=>{let i=d();G.setTitle(i.flowsTitle),G.setTexts({emptyText:i.flowsEmpty}),G.open();});let Ct=()=>{Z="root",Te(),B.open();};$.addEventListener("click",Ct);let kt=()=>e.onRequestClose();U.addEventListener("click",kt);let oe=hn(e,()=>d()),ie=null,_e=!1;e.bar.onSubmit(i=>{if(ie){je(i);return}ge(),At(i);}),e.bar.onFiles?.(i=>{ge(),wt(i);});let jn=()=>w()?.allowImageUpload===!0,Gn=i=>{qe(i)&&i.preventDefault();},Yn=i=>{if(!qe(i)||(i.preventDefault(),!jn()))return;let p=Pt(i);p.length>0&&wt(p);};u.addEventListener("dragover",Gn),u.addEventListener("drop",Yn);let me=i=>{ft=i,fe=!1,X();},Se=!1,Ge=null,Ye=()=>{if(Se)return !0;let i=e.getSessionToken?.();return i?(Se=!0,Ge=w()?.audience||null,bn({apiBase:e.apiBase,sessionToken:i,sessionId:e.getSessionId?.()}).then(p=>{if(!p.ok){me([]);return}let f=yn(p.flows);me(p.starterFlows),f.length!==0&&(A.style.setProperty("display","flex"),G.setItems(f.map(b=>({id:b.cvid,title:b.publicName,subtitle:b.summary}))));}).catch(()=>{me([]);}),!0):!1};if(!Ye())try{l?.setTimeout(()=>{!Ye()&&fe&&me([]);},Eo);}catch{}let Et=i=>{if(i.key==="Escape"){if(i.stopPropagation(),O.isOpen()){O.close();return}if(G.isOpen()){G.close();return}if(B.isOpen()){B.close();return}e.onRequestClose();}};u.addEventListener("keydown",Et);let Tt=()=>{u.hasAttribute("data-open")&&Ue(u,e),oe.reposition();};l?.addEventListener("resize",Tt);let Le=null;return {open:ge,close:_t,reposition(){u.hasAttribute("data-open")&&Ue(u,e),oe.reposition();},refreshChrome(){let i=w()?.audience||null;Se&&i!==null&&Ge!==null&&i!==Ge&&M.isEmpty()&&(Se=!1,fe=!0),!Ye()&&fe&&me([]),u.hasAttribute("data-open")&&(Ke(),B.isOpen()&&Te());},destroy(){x.removeEventListener("click",xt),$.removeEventListener("click",Ct),U.removeEventListener("click",kt),u.removeEventListener("keydown",Et),l?.removeEventListener("resize",Tt),Le=null,he(null),oe.destroy(),O.destroy(),G.destroy(),B.destroy(),M.destroy();for(let i of P)Ve(i);P=[],Q.remove(),e.bar.setAttachmentCount(0),u.remove();},promptFill(i){return new Promise(p=>{he(null),e.onRequestClose(),oe.show(i,{onAnswer:f=>je(f)}),e.bar.setAwaitingInput?.(!0),i.kind==="password"?e.bar.setDisabled(!0):(e.bar.setPlaceholder(i.question),e.bar.focusInput()),ie={resolve:p,request:i};})},cancelFill(){he(null);},showFlowFailure(){ge(),M.addMessage("assistant",d().flowFailed),X();}}}catch{return null}}var Po={contract:4,mount:Fo};if(typeof window<"u")try{window[St]=Po;}catch{}
1292
+ exports.ARCY_HOME_URL=Co;exports.BODY_CLASS=ne;exports.CATALOG_RETRY_MS=Eo;exports.CHAT_CSS=To;exports.CHIPS_CLASS=ut;exports.CHIP_CLASS=J;exports.HEADER_BUTTON_CLASS=ze;exports.HEADER_CLASS=dt;exports.HEADER_ICON_CLASS=Nn;exports.HEADER_NAME_CLASS=On;exports.MAIN_CLASS=Bn;exports.MARK_CLASS=ke;exports.MARK_LINK_CLASS=Ae;exports.PANEL_CLASS=de;exports.POLICY_CLASS=Oi;exports.STARTER_CLASS=pe;exports.STARTER_ROW_CLASS=pt;exports.STRIP_CLASS=Dn;exports.WELCOME_CLASS=re;exports.mount=Fo;exports.resolveImageUrl=at;return exports;})({});