arcy.js 0.0.2 → 0.1.0

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.
Files changed (47) hide show
  1. package/README.md +94 -3
  2. package/dist/arcy.chat.ab181cf5a84b.js +1258 -0
  3. package/dist/arcy.flow.fef131718e42.js +3 -0
  4. package/dist/arcy.legacy.ab4e9266b657.js +567 -0
  5. package/dist/arcy.loader.js +2 -0
  6. package/dist/arcy.modern.60faeffc62a2.js +567 -0
  7. package/dist/arcy.picker.c598a581d964.js +59 -0
  8. package/dist/design-mode.cjs +135 -0
  9. package/dist/design-mode.d.cts +197 -0
  10. package/dist/design-mode.d.ts +197 -0
  11. package/dist/design-mode.js +127 -0
  12. package/dist/fonts/dm-sans-latin-ext.woff2 +0 -0
  13. package/dist/fonts/dm-sans-latin.woff2 +0 -0
  14. package/dist/fonts/ibm-plex-sans-latin-ext.woff2 +0 -0
  15. package/dist/fonts/ibm-plex-sans-latin.woff2 +0 -0
  16. package/dist/fonts/inter-latin-ext.woff2 +0 -0
  17. package/dist/fonts/inter-latin.woff2 +0 -0
  18. package/dist/fonts/lato-latin-ext.woff2 +0 -0
  19. package/dist/fonts/lato-latin.woff2 +0 -0
  20. package/dist/fonts/manrope-latin-ext.woff2 +0 -0
  21. package/dist/fonts/manrope-latin.woff2 +0 -0
  22. package/dist/fonts/montserrat-latin-ext.woff2 +0 -0
  23. package/dist/fonts/montserrat-latin.woff2 +0 -0
  24. package/dist/fonts/nunito-latin-ext.woff2 +0 -0
  25. package/dist/fonts/nunito-latin.woff2 +0 -0
  26. package/dist/fonts/open-sans-latin-ext.woff2 +0 -0
  27. package/dist/fonts/open-sans-latin.woff2 +0 -0
  28. package/dist/fonts/playfair-display-latin-ext.woff2 +0 -0
  29. package/dist/fonts/playfair-display-latin.woff2 +0 -0
  30. package/dist/fonts/poppins-latin-ext.woff2 +0 -0
  31. package/dist/fonts/poppins-latin.woff2 +0 -0
  32. package/dist/fonts/roboto-latin-ext.woff2 +0 -0
  33. package/dist/fonts/roboto-latin.woff2 +0 -0
  34. package/dist/fonts/source-sans-3-latin-ext.woff2 +0 -0
  35. package/dist/fonts/source-sans-3-latin.woff2 +0 -0
  36. package/dist/fonts/work-sans-latin-ext.woff2 +0 -0
  37. package/dist/fonts/work-sans-latin.woff2 +0 -0
  38. package/dist/index.cjs +5114 -0
  39. package/dist/index.d.cts +133 -0
  40. package/dist/index.d.ts +133 -0
  41. package/dist/index.js +5109 -0
  42. package/dist/snippet.cjs +46 -0
  43. package/dist/snippet.d.cts +39 -0
  44. package/dist/snippet.d.ts +39 -0
  45. package/dist/snippet.js +43 -0
  46. package/package.json +69 -5
  47. package/index.js +0 -5
@@ -0,0 +1,1258 @@
1
+ (function(exports){'use strict';/* arcy.js — https://arcyai.com */
2
+ var kt="__arcyChat";var At=["image/png","image/jpeg","image/webp"],Tt="--_arcy-font-key",Et="arcy-chat-policy",_t={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 Ve(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 St(e){let t=e.dataTransfer;return Array.from(t?.files??[])}var It=`
3
+ [data-tip] {
4
+ position: relative;
5
+ }
6
+
7
+ [data-tip]::after {
8
+ content: attr(data-tip);
9
+ position: absolute;
10
+ left: 50%;
11
+ bottom: calc(100% + 6px);
12
+ transform: translateX(-50%);
13
+ z-index: 2;
14
+ padding: 4px 8px;
15
+ border-radius: 6px;
16
+ background: var(--_arcy-main-text, #101828);
17
+ color: var(--_arcy-main-bg, #ffffff);
18
+ font-size: 11px;
19
+ line-height: 1.3;
20
+ white-space: nowrap;
21
+ pointer-events: none;
22
+ opacity: 0;
23
+ visibility: hidden;
24
+ transition: opacity 120ms ease;
25
+ }
26
+
27
+ [data-tip][data-tip-placement="below"]::after {
28
+ bottom: auto;
29
+ top: calc(100% + 6px);
30
+ }
31
+
32
+ /* Alignment, for a control near an edge the panel clips (D895). Centring a
33
+ bubble on the leftmost header icon puts half of it outside the panel, and
34
+ the panel clips its overflow, so the half outside is simply gone. No
35
+ z-index can fix that: the bubble is not behind anything, it is cut off.
36
+ These pin the bubble to the control's own edge instead. */
37
+ [data-tip][data-tip-align="start"]::after {
38
+ left: 0;
39
+ transform: none;
40
+ }
41
+
42
+ [data-tip][data-tip-align="end"]::after {
43
+ left: auto;
44
+ right: 0;
45
+ transform: none;
46
+ }
47
+
48
+ [data-tip]:hover::after,
49
+ [data-tip]:focus-visible::after {
50
+ opacity: 1;
51
+ visibility: visible;
52
+ }
53
+
54
+ /* A coarse pointer has no hover: the tooltip would latch open on tap and
55
+ sit over the thing the visitor just pressed. */
56
+ @media (hover: none) {
57
+ [data-tip]::after {
58
+ display: none;
59
+ }
60
+ }
61
+
62
+ @media (prefers-reduced-motion: reduce) {
63
+ [data-tip]::after {
64
+ transition: none;
65
+ }
66
+ }
67
+ `;function Lt(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}var Rt="data-arcy-style";function Ke(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${Rt}]`);if(n)return n.textContent=`${n.textContent??""}
68
+ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return r.setAttribute(Rt,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return Lt(`The widget could not apply its styles. ${String(n)}`),false}}var jn=/^(#{1,3})\s+(.*)$/,Wn=/^[-*]\s+(.*)$/,Gn=/^\d+\.\s+(.*)$/;var Ft=/`([^`]+)`|\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)]+)\)/g;function Vn(e){return /^https?:\/\//i.test(e)}function Ie(e,t,n){let r=0;Ft.lastIndex=0;let o;for(;o=Ft.exec(n);){o.index>r&&t.appendChild(e.createTextNode(n.slice(r,o.index)));let[a,s,h,k,m,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(k!==void 0){let l=e.createElement("em");l.textContent=k,t.appendChild(l);}else if(m!==void 0&&c!==void 0)if(Vn(c)){let l=e.createElement("a");l.setAttribute("href",c),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"),l.textContent=m,t.appendChild(l);}else t.appendChild(e.createTextNode(m));r=o.index+a.length;}r<n.length&&t.appendChild(e.createTextNode(n.slice(r)));}function Kn(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 Mt(e,t,n){try{for(;t.firstChild;)t.removeChild(t.firstChild);let r=Kn(n.split(`
69
+ `)),o=[],a=null,s=null,h=()=>{if(o.length===0)return;let c=e.createElement("p");Ie(e,c,o.join(" ")),t.appendChild(c),o=[];},k=()=>{a=null;},m=()=>{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(),k(),s=[]):m();continue}if(s!==null){s.push(c);continue}let l=c.trim();if(l===""){h(),k();continue}let v=jn.exec(l);if(v){h(),k();let x=Math.max(2,v[1].length),g=e.createElement(`h${x}`);Ie(e,g,v[2]),t.appendChild(g);continue}let p=Wn.exec(l);if(p){h(),(!a||a.kind!=="ul")&&(a={kind:"ul",el:e.createElement("ul")},t.appendChild(a.el));let x=e.createElement("li");Ie(e,x,p[1]),a.el.appendChild(x);continue}let u=Gn.exec(l);if(u){h(),(!a||a.kind!=="ol")&&(a={kind:"ol",el:e.createElement("ol")},t.appendChild(a.el));let x=e.createElement("li");Ie(e,x,u[1]),a.el.appendChild(x);continue}k(),o.push(l);}m(),h();}catch{}}var $t="arcy-flow-offer",Nt="arcy-flow-offer-hint",ae="arcy-flow-offer-button",Ot="arcy-flow-offer-icon",Pt="http://www.w3.org/2000/svg",Yn="M13 3L5 14h6l-1 7 8-11h-6l1-7z";function qn(e){let t=e.createElementNS(Pt,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("width","15"),t.setAttribute("height","15"),t.setAttribute("class",Ot);let n=e.createElementNS(Pt,"path");return n.setAttribute("d",Yn),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 Dt=`
71
+ .${$t} {
72
+ display: flex;
73
+ flex-direction: column;
74
+ align-items: flex-start;
75
+ gap: 8px;
76
+ margin-top: 10px;
77
+ }
78
+
79
+ .${Nt} {
80
+ font-size: 13px;
81
+ line-height: 1.4;
82
+ }
83
+
84
+ /* Filled in the operator's brand, not outlined: this is the one control in
85
+ the answer, and an outlined chip beside a filled user bubble reads as
86
+ secondary to the very thing it is offering to do. */
87
+ .${ae} {
88
+ appearance: none;
89
+ display: inline-flex;
90
+ align-items: center;
91
+ gap: 7px;
92
+ border: 0;
93
+ border-radius: 999px;
94
+ padding: 8px 14px;
95
+ background: var(--_arcy-brand-bg, #101828);
96
+ color: var(--_arcy-brand-text, #ffffff);
97
+ font: inherit;
98
+ font-size: 13px;
99
+ font-weight: 600;
100
+ line-height: 1.2;
101
+ text-align: left;
102
+ cursor: pointer;
103
+ -webkit-tap-highlight-color: transparent;
104
+ transition: background 120ms ease;
105
+ }
106
+
107
+ .${Ot} {
108
+ flex-shrink: 0;
109
+ }
110
+
111
+ .${ae}:hover {
112
+ background: var(--_arcy-brand-bg-hover, var(--_arcy-brand-bg, #101828));
113
+ }
114
+
115
+ .${ae}:active {
116
+ background: var(--_arcy-brand-bg-active, var(--_arcy-brand-bg, #101828));
117
+ }
118
+
119
+ .${ae}:focus-visible {
120
+ outline: 2px solid var(--_arcy-brand-bg, #101828);
121
+ outline-offset: 2px;
122
+ }
123
+
124
+ @media (prefers-reduced-motion: reduce) {
125
+ .${ae} {
126
+ transition: none;
127
+ }
128
+ }
129
+ `;function Bt(e,t,n,r){if(t.length===0)return null;let o=e.createElement("div");if(o.className=$t,n){let a=e.createElement("div");a.className=Nt,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(qn(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 Ut="arcy-chat-list",R="arcy-chat-msg",zt="arcy-chat-msg-images",Ye="arcy-chat-msg-thumbs",jt="arcy-chat-msg-meta",Wt="arcy-chat-msg-time",se="arcy-chat-rate",le="arcy-chat-msg-group",Gt="arcy-chat-citations",me="arcy-chat-citation-link",Vt="arcy-chat-citation-label",ce="arcy-chat-pending",Xn="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",Qn="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",Ht="http://www.w3.org/2000/svg";function Jn(e,t){let n=e.createElementNS(Ht,"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(Ht,"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 Zn(e){try{return e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return ""}}var Kt=`
130
+ .${Ut} {
131
+ display: flex;
132
+ flex-direction: column;
133
+ gap: 8px;
134
+ padding: 12px;
135
+ }
136
+
137
+ .${R} {
138
+ max-width: 85%;
139
+ padding: 8px 12px;
140
+ border-radius: 12px;
141
+ font-size: 13px;
142
+ line-height: 1.4;
143
+ white-space: pre-wrap;
144
+ overflow-wrap: break-word;
145
+ }
146
+
147
+ .${R}[data-role="assistant"],
148
+ .${R}[data-role="system"] {
149
+ align-self: flex-start;
150
+ background: var(--_arcy-assistant-bg, #f2f4f7);
151
+ color: var(--_arcy-main-text, #101828);
152
+ }
153
+
154
+ /* \u2500\u2500 Rendered markdown inside an answer (D1023, ADR 0129; D1034) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
155
+
156
+ /* The bubble is a chat message, not a document. Browser defaults give an h2
157
+ a 1.5em face and a full blank line above and below it, which turns a
158
+ three-step answer into something that reads like a landing page. These
159
+ rules keep every block on the bubble's own scale. */
160
+ .${R} > :first-child {
161
+ margin-top: 0;
162
+ }
163
+
164
+ .${R} > :last-child {
165
+ margin-bottom: 0;
166
+ }
167
+
168
+ .${R} p {
169
+ margin: 0 0 8px;
170
+ }
171
+
172
+ .${R} h2,
173
+ .${R} h3 {
174
+ margin: 12px 0 6px;
175
+ line-height: 1.3;
176
+ font-weight: 600;
177
+ }
178
+
179
+ .${R} h2 {
180
+ font-size: 15px;
181
+ }
182
+
183
+ .${R} h3 {
184
+ font-size: 13px;
185
+ }
186
+
187
+ .${R} ul,
188
+ .${R} ol {
189
+ margin: 0 0 8px;
190
+ padding-left: 20px;
191
+ }
192
+
193
+ .${R} li {
194
+ margin: 2px 0;
195
+ }
196
+
197
+ /* D1034: code. The agent answers install questions with real snippets, so
198
+ these have to read as code rather than as a sentence with backticks in
199
+ it. The block scrolls on its own rather than widening the bubble, since a
200
+ long line would otherwise push the panel sideways. */
201
+ .${R} code {
202
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
203
+ font-size: 0.9em;
204
+ padding: 1px 4px;
205
+ border-radius: 4px;
206
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
207
+ white-space: pre-wrap;
208
+ overflow-wrap: break-word;
209
+ }
210
+
211
+ .${R} pre {
212
+ margin: 0 0 8px;
213
+ padding: 10px 12px;
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);
217
+ overflow-x: auto;
218
+ white-space: pre;
219
+ }
220
+
221
+ .${R} pre code {
222
+ padding: 0;
223
+ background: none;
224
+ white-space: pre;
225
+ overflow-wrap: normal;
226
+ }
227
+
228
+ .${zt} {
229
+ display: block;
230
+ margin-top: 4px;
231
+ font-size: 11px;
232
+ opacity: 0.75;
233
+ }
234
+
235
+ .${Ye} {
236
+ display: flex;
237
+ flex-wrap: wrap;
238
+ gap: 4px;
239
+ margin-top: 6px;
240
+ }
241
+
242
+ .${Ye} img {
243
+ display: block;
244
+ width: 64px;
245
+ height: 64px;
246
+ object-fit: cover;
247
+ border-radius: 8px;
248
+ }
249
+
250
+ .${R}[data-role="user"] {
251
+ align-self: flex-end;
252
+ background: var(--_arcy-brand-bg, #101828);
253
+ color: var(--_arcy-brand-text, #ffffff);
254
+ }
255
+
256
+ /* One turn: the bubble, then its meta row. The group carries the alignment
257
+ so the row sits under the bubble's own edge rather than the panel's. */
258
+ .${le} {
259
+ display: flex;
260
+ flex-direction: column;
261
+ gap: 4px;
262
+ max-width: 85%;
263
+ }
264
+
265
+ .${le}[data-role="user"] {
266
+ align-self: flex-end;
267
+ align-items: flex-end;
268
+ }
269
+
270
+ .${le}[data-role="assistant"],
271
+ .${le}[data-role="system"] {
272
+ align-self: flex-start;
273
+ align-items: flex-start;
274
+ }
275
+
276
+ /* The bubble is the whole width of its group now, so its own alignment
277
+ would fight the group's. */
278
+ .${le} .${R} {
279
+ max-width: 100%;
280
+ align-self: auto;
281
+ }
282
+
283
+ .${jt} {
284
+ display: flex;
285
+ align-items: center;
286
+ gap: 2px;
287
+ padding: 0 4px;
288
+ min-height: 20px;
289
+ }
290
+
291
+ .${Wt} {
292
+ font-size: 11px;
293
+ line-height: 1;
294
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 45%, transparent);
295
+ font-variant-numeric: tabular-nums;
296
+ margin-right: 4px;
297
+ }
298
+
299
+ /* No background at rest, one on hover. The rating controls sit under every
300
+ answer, and two filled chips per turn would read as buttons the visitor
301
+ is expected to press. */
302
+ .${se} {
303
+ appearance: none;
304
+ border: 0;
305
+ cursor: pointer;
306
+ font: inherit;
307
+ display: flex;
308
+ align-items: center;
309
+ justify-content: center;
310
+ padding: 4px;
311
+ border-radius: 6px;
312
+ background: transparent;
313
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 45%, transparent);
314
+ -webkit-tap-highlight-color: transparent;
315
+ transition: background 120ms ease, color 120ms ease;
316
+ }
317
+
318
+ .${se}:hover {
319
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
320
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 80%, transparent);
321
+ }
322
+
323
+ .${se}[aria-pressed="true"] {
324
+ color: var(--_arcy-brand-bg, #101828);
325
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 12%, transparent);
326
+ }
327
+
328
+ .${se}:focus-visible {
329
+ outline: 2px solid currentColor;
330
+ outline-offset: 1px;
331
+ }
332
+
333
+ @media (prefers-reduced-motion: reduce) {
334
+ .${se} {
335
+ transition: none;
336
+ }
337
+ }
338
+
339
+ /* \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 */
340
+
341
+ .${Gt} {
342
+ display: flex;
343
+ flex-wrap: wrap;
344
+ gap: 6px;
345
+ padding: 0 4px;
346
+ font-size: 11px;
347
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
348
+ }
349
+
350
+ .${Vt} {
351
+ font-weight: 600;
352
+ }
353
+
354
+ /* D1034: a citation is a link, so it has to answer the pointer like one.
355
+ At rest it stays quiet enough not to compete with the answer above it. */
356
+ .${me} {
357
+ color: inherit;
358
+ text-decoration: underline;
359
+ text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
360
+ text-underline-offset: 2px;
361
+ border-radius: 3px;
362
+ transition: color 120ms ease, text-decoration-color 120ms ease;
363
+ }
364
+
365
+ .${me}:hover {
366
+ color: var(--_arcy-main-text, #101828);
367
+ text-decoration-color: currentColor;
368
+ }
369
+
370
+ .${me}:focus-visible {
371
+ outline: 2px solid currentColor;
372
+ outline-offset: 2px;
373
+ }
374
+
375
+ @media (prefers-reduced-motion: reduce) {
376
+ .${me} {
377
+ transition: none;
378
+ }
379
+ }
380
+
381
+ /* \u2500\u2500 "The agent is answering" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
382
+
383
+ /* Deliberately the assistant bubble's own background and corner, at the
384
+ assistant's own alignment: the answer replaces this in place, so the
385
+ surface should not move when it lands. */
386
+ .${ce} {
387
+ align-self: flex-start;
388
+ display: flex;
389
+ align-items: center;
390
+ gap: 4px;
391
+ padding: 12px;
392
+ border-radius: 12px;
393
+ background: var(--_arcy-assistant-bg, #f2f4f7);
394
+ }
395
+
396
+ .${ce} span {
397
+ width: 6px;
398
+ height: 6px;
399
+ border-radius: 999px;
400
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 45%, transparent);
401
+ animation: arcy-chat-typing 1.2s ease-in-out infinite;
402
+ }
403
+
404
+ .${ce} span:nth-child(2) {
405
+ animation-delay: 0.15s;
406
+ }
407
+
408
+ .${ce} span:nth-child(3) {
409
+ animation-delay: 0.3s;
410
+ }
411
+
412
+ @keyframes arcy-chat-typing {
413
+ 0%, 60%, 100% {
414
+ opacity: 0.35;
415
+ transform: translateY(0);
416
+ }
417
+ 30% {
418
+ opacity: 1;
419
+ transform: translateY(-3px);
420
+ }
421
+ }
422
+
423
+ /* Reduced motion keeps the bubble, and with it the answer to "is anything
424
+ happening", and drops only the movement. */
425
+ @media (prefers-reduced-motion: reduce) {
426
+ .${ce} span {
427
+ animation: none;
428
+ opacity: 0.55;
429
+ }
430
+ }
431
+ `;function Yt(e,t,n={}){let r=t.createElement("div");r.className=Ut,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 k=0,m=null;function c(u){if(!o)try{if(!u){m?.remove(),m=null;return}if(m)return;let x=t.createElement("div");x.className=ce,x.setAttribute("role","status"),x.setAttribute("aria-live","polite"),x.setAttribute("aria-label",n.answeringLabel?.()??"Answering");for(let g=0;g<3;g+=1)x.appendChild(t.createElement("span"));r.appendChild(x),m=x,h();}catch{}}function l(u,x,g){let C=n.labels;if(!C)return;let A=g,T=(P,U,O)=>{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",g===P?"true":"false"),y.appendChild(Jn(t,O)),y.addEventListener("click",()=>{try{A=A===P?null:P,I.setAttribute("aria-pressed",A==="up"?"true":"false"),H.setAttribute("aria-pressed",A==="down"?"true":"false"),n.onFeedback?.(A,x);}catch{}}),y},I=T("up",C.likeAnswer,Xn),H=T("down",C.dislikeAnswer,Qn);u.appendChild(I),u.appendChild(H);}function v(u,x){let g=n.searchedSourcesLabel;if(!g||x.length===0)return;let C=t.createElement("div");if(C.className=Gt,n.sourcesLabel){let T=t.createElement("span");T.className=Vt,T.textContent=n.sourcesLabel,C.appendChild(T);}let A=0;for(let T of x)if(T.sourceUrl){let I=t.createElement("a");I.className=me,I.setAttribute("href",T.sourceUrl),I.setAttribute("target","_blank"),I.setAttribute("rel","noopener noreferrer"),I.textContent=T.title,C.appendChild(I);}else A+=1;if(A>0){let T=t.createElement("span");T.textContent=g.replace("{count}",String(A)),C.appendChild(T);}u.appendChild(C);}function p(u,x,g={}){if(!o)try{let{images:C=0,imageUrls:A=[],at:T,messageId:I=null,feedback:H=null,citedSources:P=[],flowOffers:U=[]}=g,O=t.createElement("div");O.className=le,O.setAttribute("data-role",u);let y=t.createElement("div");if(y.className=R,y.setAttribute("data-role",u),u==="assistant"?Mt(t,y,x):y.textContent=x,A.length>0){let w=t.createElement("div");w.className=Ye;for(let E of A){let $=t.createElement("img");$.src=E,$.alt="",w.appendChild($),a.push(E);}y.appendChild(w);}else if(C>0){let w=t.createElement("span");w.className=zt,w.textContent=C===1?"1 image":`${C} images`,y.appendChild(w);}if(u==="assistant"&&U.length>0&&n.onStartFlow){let w=n.onStartFlow.bind(n),E=Bt(t,U,n.flowOfferHint?.(),w);E&&y.appendChild(E);}if(O.appendChild(y),u==="assistant"&&P.length>0&&v(O,P),u!=="system"){let w=t.createElement("div");w.className=jt;let E=t.createElement("span");E.className=Wt,E.textContent=Zn(T??n.now?.()??new Date),w.appendChild(E),u==="assistant"&&l(w,I,H),O.appendChild(w);}r.insertBefore(O,m),k+=1,h();}catch{}}return {addMessage:p,setPending:c,isEmpty:()=>k===0,scrollToEnd:h,clear(){if(!o)try{for(;r.firstChild;)r.removeChild(r.firstChild);s(),k=0,m=null;}catch{}},destroy(){if(!o){o=true;try{s(),r.remove();}catch{}}}}}var be="arcy-drawer",Le="arcy-drawer-scrim",Xt="arcy-drawer-header",qe="arcy-drawer-back",Xe="arcy-drawer-close",Qt="arcy-drawer-title",Jt="arcy-drawer-list",Re="arcy-drawer-item",Zt="arcy-drawer-item-title",en="arcy-drawer-item-sub",ye="arcy-drawer-item-tip",tn="arcy-drawer-item-icon",nn="arcy-drawer-item-text",rn="arcy-drawer-empty",Qe="arcy-drawer-action",Je="arcy-drawer-footer",on=`
432
+ /* A sheet over PART of the panel, sliding in from the left (D899). It used
433
+ to be inset:0 and appear instantly, so opening Recent chats replaced the
434
+ whole surface with no sense of where the conversation went or how to get
435
+ back. Covering part of the panel keeps the conversation visible behind it,
436
+ which is what makes the back gesture obvious. */
437
+ .${be} {
438
+ position: absolute;
439
+ top: 0;
440
+ bottom: 0;
441
+ left: 0;
442
+ width: min(78%, 320px);
443
+ display: flex;
444
+ flex-direction: column;
445
+ background: var(--_arcy-main-bg, #ffffff);
446
+ color: var(--_arcy-main-text, #101828);
447
+ border-right: 1px solid
448
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 10%, transparent);
449
+ z-index: 2;
450
+ transform: translateX(-101%);
451
+ visibility: hidden;
452
+ transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1),
453
+ visibility 0s linear 220ms;
454
+ }
455
+
456
+ /* The same sheet, hinged on the other edge. Only the three properties that
457
+ name a side change: everything about how it looks and animates is shared,
458
+ so the two can never drift. */
459
+ .${be}[data-side="right"] {
460
+ left: auto;
461
+ right: 0;
462
+ border-right: 0;
463
+ border-left: 1px solid
464
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 10%, transparent);
465
+ transform: translateX(101%);
466
+ }
467
+
468
+ .${be}[data-open] {
469
+ transform: translateX(0);
470
+ visibility: visible;
471
+ transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1),
472
+ visibility 0s;
473
+ }
474
+
475
+ /* The rest of the panel, dimmed while the sheet is over it. Tapping it is
476
+ the same as pressing back, which is what every sheet on a phone does. */
477
+ .${Le} {
478
+ position: absolute;
479
+ inset: 0;
480
+ z-index: 1;
481
+ appearance: none;
482
+ border: 0;
483
+ padding: 0;
484
+ cursor: pointer;
485
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 22%, transparent);
486
+ opacity: 0;
487
+ visibility: hidden;
488
+ transition: opacity 220ms ease, visibility 0s linear 220ms;
489
+ }
490
+
491
+ .${Le}[data-open] {
492
+ opacity: 1;
493
+ visibility: visible;
494
+ transition: opacity 220ms ease, visibility 0s;
495
+ }
496
+
497
+ @media (prefers-reduced-motion: reduce) {
498
+ .${be},
499
+ .${Le} {
500
+ transition: none;
501
+ }
502
+ }
503
+
504
+ .${Xt} {
505
+ display: flex;
506
+ align-items: center;
507
+ gap: 8px;
508
+ padding: 10px 10px 10px 12px;
509
+ flex: 0 0 auto;
510
+ }
511
+
512
+ .${qe},
513
+ .${Xe} {
514
+ appearance: none;
515
+ border: 0;
516
+ background: transparent;
517
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 70%, transparent);
518
+ cursor: pointer;
519
+ padding: 5px;
520
+ border-radius: 999px;
521
+ display: flex;
522
+ align-items: center;
523
+ flex: 0 0 auto;
524
+ -webkit-tap-highlight-color: transparent;
525
+ }
526
+
527
+ .${qe}:hover,
528
+ .${Xe}:hover {
529
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
530
+ }
531
+
532
+ .${Qt} {
533
+ font-weight: 600;
534
+ font-size: 14px;
535
+ min-width: 0;
536
+ flex: 1 1 auto;
537
+ overflow: hidden;
538
+ text-overflow: ellipsis;
539
+ white-space: nowrap;
540
+ }
541
+
542
+ .${Jt} {
543
+ flex: 1 1 auto;
544
+ min-height: 0;
545
+ overflow: auto;
546
+ display: flex;
547
+ flex-direction: column;
548
+ gap: 4px;
549
+ padding: 0 8px 8px;
550
+ }
551
+
552
+ /* A row, laid out left to right: the optional mark, then the text column.
553
+ A drawer with no mark renders one child and reads exactly as it did when
554
+ the row was the text column itself. */
555
+ .${Re} {
556
+ appearance: none;
557
+ border: 0;
558
+ cursor: pointer;
559
+ text-align: left;
560
+ font: inherit;
561
+ display: flex;
562
+ flex-direction: row;
563
+ align-items: center;
564
+ gap: 10px;
565
+ padding: 9px 10px;
566
+ border-radius: 10px;
567
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 4%, transparent);
568
+ color: inherit;
569
+ -webkit-tap-highlight-color: transparent;
570
+ }
571
+
572
+ .${Re}:hover {
573
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
574
+ }
575
+
576
+ /* The conversation the visitor is reading. Darker than hover so it still
577
+ reads as selected while the pointer is over another row, and carrying an
578
+ inset marker so the state is not colour alone. */
579
+ .${Re}[data-active] {
580
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 12%, transparent);
581
+ box-shadow: inset 2px 0 0 var(--_arcy-brand-bg, #101828);
582
+ font-weight: 600;
583
+ }
584
+
585
+ /* Dimmer than the title it sits beside: it labels the kind of row, and a
586
+ mark at full strength competes with the name a visitor is reading. */
587
+ .${tn} {
588
+ flex: 0 0 auto;
589
+ display: flex;
590
+ align-items: center;
591
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 60%, transparent);
592
+ }
593
+
594
+ /* The min-width: 0 is what keeps the ellipsis working: without it a flex
595
+ item refuses to shrink below its content, and a long flow name pushes the
596
+ row wider than the sheet instead of truncating. */
597
+ .${nn} {
598
+ display: flex;
599
+ flex-direction: column;
600
+ gap: 2px;
601
+ min-width: 0;
602
+ flex: 1 1 auto;
603
+ }
604
+
605
+ .${Zt} {
606
+ font-size: 13px;
607
+ overflow: hidden;
608
+ text-overflow: ellipsis;
609
+ white-space: nowrap;
610
+ }
611
+
612
+ .${en} {
613
+ font-size: 11.5px;
614
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
615
+ overflow: hidden;
616
+ text-overflow: ellipsis;
617
+ white-space: nowrap;
618
+ }
619
+
620
+ /* The whole subtitle, for a row whose subtitle is a flow's summary and does
621
+ not fit on one line (D1265). A single bubble reused by every row, and a
622
+ child of the SHEET rather than of the row it describes: the list scrolls
623
+ (overflow: auto above), and a bubble painted from inside a scrolling box
624
+ is cut off at that box's edge instead of hanging past it.
625
+
626
+ Position is set in script, because it is the one thing CSS cannot do from
627
+ here: the bubble sits beside the sheet, so it has to know how tall the row
628
+ is and how much room the panel has left. Everything else is here. */
629
+ .${ye} {
630
+ position: absolute;
631
+ z-index: 3;
632
+ /* Sized from its own text, not from the room left inside the sheet. The
633
+ bubble is placed BESIDE the sheet, but the sheet is what it is
634
+ positioned against, so the space between its left edge and the sheet's
635
+ right edge is zero. Left to shrink to fit, the box takes that zero as
636
+ its available width and falls back to the narrowest it can legally be,
637
+ which with the overflow-wrap: anywhere below is one character: the
638
+ summary comes out as a column of single letters. max-content sizes it
639
+ to the sentence instead, and the max-width under it does the wrapping. */
640
+ width: max-content;
641
+ box-sizing: border-box;
642
+ padding: 6px 9px;
643
+ border-radius: 6px;
644
+ background: var(--_arcy-main-text, #101828);
645
+ color: var(--_arcy-main-bg, #ffffff);
646
+ font-size: 11px;
647
+ line-height: 1.35;
648
+ /* Wraps, unlike the header tooltips: a summary is a sentence, and a
649
+ sentence on one line is the truncation this bubble exists to undo. */
650
+ white-space: normal;
651
+ overflow-wrap: anywhere;
652
+ pointer-events: none;
653
+ opacity: 0;
654
+ visibility: hidden;
655
+ transition: opacity 120ms ease;
656
+ }
657
+
658
+ .${ye}[data-open] {
659
+ opacity: 1;
660
+ visibility: visible;
661
+ }
662
+
663
+ /* Same reason as the header tooltips: a coarse pointer has no hover, so the
664
+ bubble would latch open over the row the visitor just pressed. */
665
+ @media (hover: none) {
666
+ .${ye} {
667
+ display: none;
668
+ }
669
+ }
670
+
671
+ @media (prefers-reduced-motion: reduce) {
672
+ .${ye} {
673
+ transition: none;
674
+ }
675
+ }
676
+
677
+ .${rn} {
678
+ flex: 1 1 auto;
679
+ display: flex;
680
+ flex-direction: column;
681
+ align-items: center;
682
+ justify-content: center;
683
+ gap: 10px;
684
+ padding: 16px;
685
+ text-align: center;
686
+ font-size: 13px;
687
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 60%, transparent);
688
+ }
689
+
690
+ .${Qe} {
691
+ appearance: none;
692
+ border: 0;
693
+ cursor: pointer;
694
+ font: inherit;
695
+ font-size: 13px;
696
+ display: flex;
697
+ align-items: center;
698
+ justify-content: center;
699
+ gap: 6px;
700
+ padding: 9px 14px;
701
+ border-radius: 999px;
702
+ background: var(--_arcy-brand-bg, #101828);
703
+ color: var(--_arcy-brand-text, #ffffff);
704
+ -webkit-tap-highlight-color: transparent;
705
+ }
706
+
707
+ /* The pinned "New chat" action, once the list is populated (D979): appended
708
+ as a footer sibling of the scrollable list rather than its last row, so it
709
+ never scrolls out of reach on a drawer with many conversations. */
710
+ .${Je} {
711
+ flex: 0 0 auto;
712
+ padding: 10px;
713
+ }
714
+
715
+ .${Je} .${Qe} {
716
+ width: 100%;
717
+ }
718
+ `,qt="http://www.w3.org/2000/svg",ge=8,er=240,tr=120;function Ze(e,t,n,r=2){let o=e.createElementNS(qt,"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(qt,"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 nr(e,t){return Ze(e,[t==="right"?"M9 5l7 7-7 7":"M15 5l-7 7 7 7"],16)}function rr(e){return Ze(e,["M18 6L6 18","M6 6l12 12"],16)}function or(e){return Ze(e,["M12 5v14M5 12h14"],14,2.5)}function Fe(e,t,n){let r=n.emptyText??"",o=n.actionLabel??null,a=[],s=false,h=n.side??"left",k=n.subtitleTips!==false,m=t.createElement("div");m.className=be,m.setAttribute("role","group"),m.setAttribute("data-side",h);let c=t.createElement("div");c.className=Xt;let l=t.createElement("button");l.type="button",l.className=qe,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(nr(t,h));let v=t.createElement("span");v.className=Qt,v.textContent=n.title;let p=t.createElement("button");p.type="button",p.className=Xe,p.setAttribute("aria-label",n.closeLabel),p.setAttribute("data-tip",n.closeLabel),p.setAttribute("data-tip-placement","below"),p.setAttribute("data-tip-align","end"),p.appendChild(rr(t)),c.appendChild(l),c.appendChild(v),c.appendChild(p);let u=t.createElement("div");u.className=Jt,m.appendChild(c),m.appendChild(u);let x=t.createElement("button");x.type="button",x.className=Le,x.setAttribute("aria-hidden","true"),x.tabIndex=-1,e.appendChild(x),e.appendChild(m);let g=t.createElement("div");g.className=ye,g.setAttribute("aria-hidden","true"),m.appendChild(g);function C(){g.removeAttribute("data-open");}function A(y,w){try{let E=m.getBoundingClientRect(),$=e.getBoundingClientRect(),D=y.getBoundingClientRect();if(E.width===0||$.width===0)return;let G=(h==="right"?E.left-$.left:$.right-E.right)-ge*2;if(G<tr){C();return}g.textContent=w,g.style.maxWidth=`${Math.min(er,G)}px`;let V=`${E.width+ge}px`;g.style.left=h==="right"?"auto":V,g.style.right=h==="right"?V:"auto",g.style.top="0px";let pe=g.offsetHeight,M=D.top-E.top,z=Math.max(ge,E.height-pe-ge);g.style.top=`${Math.min(Math.max(M,ge),z)}px`,g.setAttribute("data-open","");}catch{C();}}u.addEventListener("scroll",C);let T=()=>{try{n.onBack();}catch{}};l.addEventListener("click",T),p.addEventListener("click",T),x.addEventListener("click",T);let I=null;function H(){I?.remove(),I=null;}function P(){if(!s){for(C();u.firstChild;)u.removeChild(u.firstChild);if(H(),a.length===0){let y=t.createElement("div");y.className=rn;let w=t.createElement("span");w.textContent=r,y.appendChild(w),o&&y.appendChild(U(false)),u.appendChild(y);return}for(let y of a){let w=t.createElement("button");w.type="button",w.className=Re,y.active&&(w.setAttribute("data-active",""),w.setAttribute("aria-current","true"));let E=y.icon??n.itemIcon;if(E)try{let G=E(t);if(G){let V=t.createElement("span");V.className=tn,V.appendChild(G),w.appendChild(V);}}catch{}let $=t.createElement("span");$.className=nn;let D=t.createElement("span");if(D.className=Zt,D.textContent=y.title,$.appendChild(D),y.subtitle){let G=t.createElement("span");G.className=en,G.textContent=y.subtitle,$.appendChild(G);let V=y.subtitle;k&&(w.addEventListener("mouseenter",()=>A(w,V)),w.addEventListener("focus",()=>A(w,V)),w.addEventListener("mouseleave",C),w.addEventListener("blur",C));}w.appendChild($),w.addEventListener("click",()=>{try{n.onSelect(y.id);}catch{}}),u.appendChild(w);}o&&(I=t.createElement("div"),I.className=Je,I.appendChild(U(true)),m.appendChild(I));}}function U(y){let w=t.createElement("button");return w.type="button",w.className=Qe,y&&w.appendChild(or(t)),w.appendChild(t.createTextNode(o??"")),w.addEventListener("click",()=>{try{n.onAction?.();}catch{}}),w}P();function O(y){try{for(let w of Array.from(e.children))w===m||w===x||(y?w.setAttribute("inert",""):w.removeAttribute("inert"));}catch{}}return {open(){if(!s){m.setAttribute("data-open",""),x.setAttribute("data-open",""),O(true);try{l.focus();}catch{}}},close(){s||(C(),m.removeAttribute("data-open"),x.removeAttribute("data-open"),O(false));},isOpen:()=>m.hasAttribute("data-open"),setItems(y){a=y,P();},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&&(p.setAttribute("aria-label",y.closeLabel),p.setAttribute("data-tip",y.closeLabel)),P();},destroy(){if(!s){s=true;try{O(!1),u.removeEventListener("scroll",C),l.removeEventListener("click",T),p.removeEventListener("click",T),x.removeEventListener("click",T),g.remove(),m.remove(),x.remove();}catch{}}}}}var Me=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;var ir=560,ar=640;function Pe(e,t){let n=Me(t.width);if(!n)return ir;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function an(e,t,n){let r=Me(t);if(!r)return ar;let o=Math.round(e/100*r),a=r-n-16;return Math.max(0,Math.min(o,a))}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=Me(n);if(!r)return e;let o=Math.max(0,(r-Me(t))/2);return Math.min(o,Math.max(-o,e))}var S="arcy-fill-card",sn=`
719
+ .${S} {
720
+ position: absolute;
721
+ display: flex;
722
+ flex-direction: column;
723
+ gap: 10px;
724
+ box-sizing: border-box;
725
+ padding: 14px 16px;
726
+ border-radius: var(--arcy-chat-radius, 16px);
727
+ background: var(--_arcy-main-bg, #ffffff);
728
+ color: var(--_arcy-main-text, #101828);
729
+ border: var(--_arcy-border-width, 0px) solid
730
+ var(--_arcy-border-color, color-mix(in srgb, var(--_arcy-main-text, #101828) 15%, transparent));
731
+ box-shadow: var(--arcy-chat-shadow, 0 12px 32px rgba(16, 24, 40, 0.24));
732
+ font-family: inherit;
733
+ visibility: hidden;
734
+ opacity: 0;
735
+ transform-origin: bottom center;
736
+ transition: opacity 200ms ease, visibility 200ms ease;
737
+ }
738
+
739
+ .${S}[data-open] {
740
+ visibility: visible;
741
+ opacity: 1;
742
+ }
743
+
744
+ .${S}-question {
745
+ font-size: 14px;
746
+ line-height: 1.45;
747
+ overflow-wrap: anywhere;
748
+ }
749
+
750
+ .${S}-error {
751
+ font-size: 12.5px;
752
+ line-height: 1.4;
753
+ color: var(--_arcy-error-text, #b42318);
754
+ }
755
+
756
+ .${S}-controls {
757
+ display: flex;
758
+ flex-wrap: wrap;
759
+ align-items: center;
760
+ gap: 8px;
761
+ }
762
+
763
+ .${S}-controls:empty {
764
+ display: none;
765
+ }
766
+
767
+ .${S}-pill {
768
+ appearance: none;
769
+ border: 1px solid
770
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 18%, transparent);
771
+ background: transparent;
772
+ color: inherit;
773
+ font: inherit;
774
+ font-size: 13px;
775
+ padding: 7px 14px;
776
+ border-radius: 999px;
777
+ cursor: pointer;
778
+ }
779
+
780
+ .${S}-pill:hover {
781
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
782
+ }
783
+
784
+ .${S}-input {
785
+ flex: 1 1 auto;
786
+ min-width: 0;
787
+ box-sizing: border-box;
788
+ border: 1px solid
789
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 18%, transparent);
790
+ border-radius: 10px;
791
+ background: transparent;
792
+ color: inherit;
793
+ font: inherit;
794
+ font-size: 13px;
795
+ padding: 8px 10px;
796
+ outline: none;
797
+ }
798
+
799
+ .${S}-input:focus-visible {
800
+ border-color: var(--_arcy-brand-bg, #101828);
801
+ }
802
+
803
+ .${S}-range {
804
+ flex: 1 1 auto;
805
+ min-width: 0;
806
+ accent-color: var(--_arcy-brand-bg, #101828);
807
+ }
808
+
809
+ .${S}-range-value {
810
+ flex: 0 0 auto;
811
+ font-size: 13px;
812
+ font-variant-numeric: tabular-nums;
813
+ min-width: 2.5em;
814
+ text-align: right;
815
+ }
816
+
817
+ .${S}-confirm {
818
+ flex: 0 0 auto;
819
+ appearance: none;
820
+ border: 0;
821
+ border-radius: 999px;
822
+ background: var(--_arcy-brand-bg, #101828);
823
+ color: var(--_arcy-brand-text, #ffffff);
824
+ font: inherit;
825
+ font-size: 13px;
826
+ padding: 8px 16px;
827
+ cursor: pointer;
828
+ }
829
+
830
+ @media (prefers-reduced-motion: reduce) {
831
+ .${S} {
832
+ transition: none;
833
+ }
834
+ }
835
+ `,sr={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"},lr={date:"date",time:"time",datetime:"datetime-local",month:"month",week:"week"};function ln(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 k(l){let p=t()[sr[l]];return (typeof p=="string"?p:"").replace("{min}",h?.min??"").replace("{max}",h?.max??String(h?.maxLength??""))}function m(){let l;try{l=e.bar.getMetrics();}catch{return}let v=l.bottomOffset+l.keyboardOffset+l.height+8,p=r.style;if(p.setProperty("bottom",`${v}px`),p.setProperty("left","50%"),p.setProperty("translate","-50%"),l.isMobile){p.setProperty("width",`calc(100% - ${24}px)`),p.setProperty("max-width","none"),p.setProperty("transform","none");return}let u=Pe(l.widthPercent,{width:l.viewportWidth,height:l.viewportHeight});p.setProperty("width",`${u}px`),p.setProperty("max-width",`calc(100vw - ${32}px)`),p.setProperty("transform",we({x:$e(l.offset.x,u,l.viewportWidth),y:l.offset.y}));}function c(l,v){s.textContent="";let p=t(),u=(g,C)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-pill`,A.textContent=g,A.addEventListener("click",()=>v.onAnswer(C)),s.appendChild(A);},x=(g,C)=>{let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=p.fillConfirm,A.addEventListener("click",()=>v.onAnswer(C())),g.addEventListener("keydown",T=>{T.key==="Enter"&&(T.preventDefault(),v.onAnswer(C()));}),s.appendChild(g),s.appendChild(A);};switch(l.kind){case "select":case "radio":{for(let g of l.options??[])u(g.label,g.value);return}case "checkbox":{u(p.fillYes,"true"),u(p.fillNo,"false");return}case "range":{let g=n.createElement("input");g.type="range",g.className=`${S}-range`,l.min!==null&&(g.min=l.min),l.max!==null&&(g.max=l.max),l.step!==null&&(g.step=l.step);let C=n.createElement("span");C.className=`${S}-range-value`,C.textContent=g.value,g.addEventListener("input",()=>{C.textContent=g.value;});let A=n.createElement("button");A.type="button",A.className=`${S}-confirm`,A.textContent=p.fillConfirm,A.addEventListener("click",()=>v.onAnswer(g.value)),s.appendChild(g),s.appendChild(C),s.appendChild(A);return}case "password":{let g=n.createElement("input");g.type="password",g.className=`${S}-input`,g.autocomplete="off",x(g,()=>g.value);try{g.focus();}catch{}return}default:{let g=lr[l.kind];if(!g)return;let C=n.createElement("input");C.type=g,C.className=`${S}-input`,l.min!==null&&(C.min=l.min),l.max!==null&&(C.max=l.max),l.step!==null&&(C.step=l.step),x(C,()=>C.value);}}}return {show(l,v){h=l,o.textContent=l.question,c(l,v),this.setError(l.errorCode),m(),r.setAttribute("data-open","");},setError(l){l===null?(a.textContent="",a.style.setProperty("display","none")):(a.textContent=k(l),a.style.setProperty("display","block")),r.hasAttribute("data-open")&&m();},hide(){h=null,r.removeAttribute("data-open"),s.textContent="",a.textContent="",a.style.setProperty("display","none");},reposition(){r.hasAttribute("data-open")&&m();},isVisible:()=>r.hasAttribute("data-open"),destroy(){try{r.remove();}catch{}}}}var cr=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,dr=/^\d{4}-\d{2}-\d{2}$/,pr=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,ur=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,fr=/^\d{4}-\d{2}$/,hr=/^\d{4}-W\d{2}$/,mr=/^\+?[\d\s().-]{3,}$/;function gr(e){let t=Date.parse(e);return Number.isFinite(t)}function br(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 nt(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 cn(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)?br(r,t):"invalid_number"}case "email":return cr.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 mr.test(n)?null:"invalid";case "date":return !dr.test(n)||!gr(n)?"invalid_date":ve(n,t);case "datetime":return ur.test(n)?ve(n,t):"invalid_date";case "month":return fr.test(n)?ve(n,t):"invalid_date";case "week":return hr.test(n)?ve(n,t):"invalid_date";case "time":return pr.test(n)?ve(nt(n),{...t,min:t.min!==null?nt(t.min):null,max:t.max!==null?nt(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 dn(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 yr="https://api.arcyai.com",wr="/api/v1/sdk/flows/catalog";function vr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function xr(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 Cr(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 kr(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 Ar(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)Cr(a)&&n.push({...a,firstStepRoute:a.firstStepRoute??null});let r=e.starterFlows,o=Array.isArray(r)?r.filter(kr).map(a=>({cvid:a.cvid,publicName:a.publicName,summary:a.summary??null})):[];return {flows:n,starterFlows:o}}function Tr(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function pn(e){let{apiBase:t=yr,sessionToken:n,sessionId:r,setTimeoutImpl:o=(k,m)=>setTimeout(k,m),timeoutMs:a=8e3}=e,s=vr(e.fetchImpl);if(!s)return {ok:false,reason:"unusable"};let h=(async()=>{let k;try{k=await s(`${t}${wr}`,{method:"POST",headers:Tr(n),body:JSON.stringify(r?{sessionId:r}:{}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(!k.ok)return {ok:false,reason:"rejected"};let m;try{m=await k.json();}catch{return {ok:false,reason:"unusable"}}let c=Ar(m);return c?{ok:true,...c}:{ok:false,reason:"unusable"}})();return xr(h,a,o,{ok:false,reason:"network"})}function un(e){let t=[];for(let n of e){let r=n.publicName?.trim()??"";r&&t.push({...n,publicName:r});}return t}var W="https://api.arcyai.com",Er="/api/v1/sdk/agent/query";function _r(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Sr(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 Ir=new Set(["credits_exhausted","lapsed","org_cap_exceeded","user_cap_exceeded","anon_org_cap_exceeded","anon_user_cap_exceeded"]);function Lr(e){return typeof e=="string"&&Ir.has(e)}function Rr(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 Fr(e){return {"Content-Type":"application/json",Authorization:`Bearer ${e}`}}async function fn(e){let{apiBase:t=W,publicKey:n,sessionId:r,sessionToken:o,query:a,route:s,conversationId:h,attachments:k=[],setTimeoutImpl:m=(p,u)=>setTimeout(p,u),timeoutMs:c=2e4}=e,l=_r(e.fetchImpl);if(!l)return {ok:false,reason:"unusable"};let v=(async()=>{let p;try{p=await l(`${t}${Er}`,{method:"POST",headers:Fr(o),body:JSON.stringify({publicKey:n,sessionId:r,query:a,route:s,conversationId:h,...k.length>0?{attachments:k}:{}}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(p.status===402){let g;try{g=await p.json();}catch{return {ok:false,reason:"unusable"}}let C=g&&typeof g=="object"&&!Array.isArray(g)?g.reason:void 0;return Lr(C)?{ok:false,reason:"cap_denied",capReason:C}:{ok:false,reason:"unusable"}}if(!p.ok)return {ok:false,reason:"rejected"};let u;try{u=await p.json();}catch{return {ok:false,reason:"unusable"}}return Rr(u)??{ok:false,reason:"unusable"}})();return Sr(v,c,m,{ok:false,reason:"network"})}var hn="https://cdn.arcyai.com";var gn='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';function j(e,t=gn){return {family:e,fallback:t,stack:`"${e}", ${t}`}}var bn={system:{stack:gn},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:j("Inter"),roboto:j("Roboto"),"open-sans":j("Open Sans"),lato:j("Lato"),poppins:j("Poppins"),montserrat:j("Montserrat"),nunito:j("Nunito"),"source-sans-3":j("Source Sans 3"),"work-sans":j("Work Sans"),"dm-sans":j("DM Sans"),manrope:j("Manrope"),"playfair-display":j("Playfair Display","Georgia, serif"),"ibm-plex-sans":j("IBM Plex Sans")},Mr=[["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 Oe="--_arcy-font",mn="data-arcy-font";function Pr(e,t=hn){let n=bn[e];return n?.family?Mr.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(`
836
+ `):""}function rt(e,t){try{let n=e.style.getPropertyValue(Tt).trim(),r=n?bn[n]:void 0;if(!r){e.style.removeProperty(Oe);return}if(e.style.setProperty(Oe,r.stack),!r.family)return;let o=t.head||t.documentElement;if(!o||o.querySelector(`style[${mn}="${n}"]`))return;let a=t.createElement("style");a.setAttribute(mn,n),a.textContent=Pr(n),o.appendChild(a);}catch{}}var $r="/api/v1/sdk/conversations",Nr=15e3,Or=20,yn=60;function Dr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Br(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>=Or)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 wn(e){if(!e)return "";try{return new Date(e).toLocaleDateString()}catch{return ""}}function Hr(e,t){let n=e.firstMessage?.trim()??"";if(n.length>0)return n.length>yn?`${n.slice(0,yn-1).trimEnd()}\u2026`:n;let r=wn(e.lastMessageAt);return e.hasImage?r?`${t} ${r}`:t:r||t}function ot(e,t,n){return e.map(r=>({id:r.id,title:Hr(r,t),subtitle:wn(r.lastMessageAt),active:!!(n&&r.id===n)}))}async function vn(e){let{apiBase:t=W,sessionToken:n,visitorId:r,setTimeoutImpl:o=(k,m)=>setTimeout(k,m),timeoutMs:a=Nr}=e,s=Dr(e.fetchImpl);if(!s||!n||!r)return {ok:false};let h=(async()=>{let k;try{k=await s(`${t}${$r}?visitorId=${encodeURIComponent(r)}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!k.ok)return {ok:false};let m;try{m=await k.json();}catch{return {ok:false}}let c=Br(m);return c?{ok:true,conversations:c}:{ok:false}})();return new Promise(k=>{let m=false,c=l=>{m||(m=true,k(l));};h.then(c,()=>c({ok:false}));try{o(()=>c({ok:!1}),a);}catch{}})}var Ur="/api/v1/sdk/conversations/{conversationId}/messages",zr=15e3,jr=200;function Wr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Gr(e){return Ur.replace("{conversationId}",encodeURIComponent(e))}function xn(e){return e==="agent"?"assistant":"user"}function Vr(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>=jr)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 Cn(e){let{apiBase:t=W,sessionToken:n,conversationId:r,visitorId:o,setTimeoutImpl:a=(m,c)=>setTimeout(m,c),timeoutMs:s=zr}=e,h=Wr(e.fetchImpl);if(!h||!n||!r)return {ok:false};let k=(async()=>{let m;try{let v=o?`?visitorId=${encodeURIComponent(o)}`:"";m=await h(`${t}${Gr(r)}${v}`,{method:"GET",headers:{Authorization:`Bearer ${n}`},credentials:"omit"});}catch{return {ok:false}}if(!m.ok)return {ok:false};let c;try{c=await m.json();}catch{return {ok:false}}let l=Vr(c);return l?{ok:true,messages:l}:{ok:false}})();return new Promise(m=>{let c=false,l=v=>{c||(c=true,m(v));};k.then(l,()=>l({ok:false}));try{a(()=>l({ok:!1}),s);}catch{}})}var Kr="/api/v1/sdk/conversations/{conversationId}/messages/{messageId}/feedback",Yr=1e4;function qr(e){return e!==void 0?e:typeof fetch<"u"?fetch.bind(globalThis):null}function Xr(e,t){return Kr.replace("{conversationId}",encodeURIComponent(e)).replace("{messageId}",encodeURIComponent(t))}async function kn(e){let{apiBase:t=W,sessionToken:n,conversationId:r,messageId:o,value:a,visitorId:s,setTimeoutImpl:h=(l,v)=>setTimeout(l,v),timeoutMs:k=Yr}=e,m=qr(e.fetchImpl);if(!m||!n||!r||!o)return {ok:false};let c=(async()=>{try{let l=s?`?visitorId=${encodeURIComponent(s)}`:"";return {ok:(await m(`${t}${Xr(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 v=false,p=u=>{v||(v=true,l(u));};c.then(p,()=>p({ok:false}));try{h(()=>p({ok:!1}),k);}catch{}})}var Qr="/api/v1/sdk/uploads/presign",Jr="/api/v1/sdk/uploads/discard",Zr=3,eo=5*1024*1024,to=1568,no=At,ro=3e4;function it(e,t){return no.includes(e.type)?e.size>eo?{ok:false,reason:"size"}:t>=Zr?{ok:false,reason:"count"}:{ok:true}:{ok:false,reason:"type"}}function oo(e,t,n=to){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 An(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,k){a?.drawImage(s,0,0,h,k);},toBlob(s,h){return new Promise(k=>{try{o.toBlob(m=>k(m),s,h);}catch{k(null);}})}}},fetchImpl:t}}async function io(e,t){let n={blob:e,contentType:e.type,width:0,height:0};try{let r=await t.createImageBitmap(e),o=oo(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 ao(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;return typeof t.uploadUrl!="string"||typeof t.objectKey!="string"||!/^https:\/\//i.test(t.uploadUrl)?null:{uploadUrl:t.uploadUrl,objectKey:t.objectKey}}function so(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 Tn(e,t,n){let r=it(e,t);if(!r.ok)return {ok:false,reason:r.reason};let{apiBase:o=W,sessionToken:a,env:s,timeoutMs:h=ro}=n,k=s.setTimeoutImpl??((l,v)=>setTimeout(l,v)),m=s.fetchImpl;if(!m||!a)return {ok:false,reason:"failed"};let c=(async()=>{let l=await io(e,s),v;try{v=await m(`${o}${Qr}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({contentType:l.contentType,byteSize:l.blob.size}),credentials:"omit"});}catch{return {ok:false,reason:"failed"}}if(!v.ok)return {ok:false,reason:"failed"};let p;try{p=await v.json();}catch{return {ok:false,reason:"failed"}}let u=ao(p);if(!u)return {ok:false,reason:"failed"};try{if(!(await m(u.uploadUrl,{method:"PUT",headers:{"Content-Type":l.contentType},body:l.blob,credentials:"omit"})).ok)return {ok:!1,reason:"failed"}}catch{return {ok:false,reason:"failed"}}return {ok:true,attachment:{objectKey:u.objectKey,contentType:l.contentType,width:l.width,height:l.height}}})();return so(c,h,k,{ok:false,reason:"failed"})}async function En(e,t){let{apiBase:n=W,sessionToken:r,fetchImpl:o}=t;if(!o||!r||!e)return false;try{return (await o(`${n}${Jr}`,{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",at="arcy-chat-header",Ln="arcy-chat-icon",Rn="arcy-chat-name",Be="arcy-chat-hbtn",ne="arcy-chat-body",Fn="arcy-chat-strip",Mn="arcy-chat-main",xe="arcy-chat-mark",Ce="arcy-chat-mark-link",vi=Et,co="https://arcy-s3-bucket.s3.eu-north-1.amazonaws.com/arcy-logo-text-only.svg",po="https://arcyai.com",re="arcy-chat-welcome",He="arcy-chat-starter",st="arcy-chat-starters",Pn="arcy-chat-chips",Q="arcy-chat-chip",uo=new Set(["org_cap_exceeded","anon_org_cap_exceeded","credits_exhausted","lapsed"]),fo=60,ho=2500,mo=It+`
837
+ /* Stays mounted and animates open/shut in place (D929/D979) rather than
838
+ toggling "display": the bar glides the panel the last few pixels rather
839
+ than having it appear or vanish. "visibility" (not "pointer-events",
840
+ which the panel forces "auto !important" inline to survive a hostile
841
+ host page's own CSS) is what actually blocks interaction while closed: a
842
+ "visibility: hidden" element is never hit-tested regardless of its
843
+ "pointer-events" value. */
844
+ .${de} {
845
+ display: flex;
846
+ flex-direction: column;
847
+ overflow: hidden;
848
+ visibility: hidden;
849
+ opacity: 0;
850
+ /* Always under the bar (.arcy-bar-wrap's own z-index in styles.ts): the
851
+ panel mounts lazily, after the bar, and DOM order alone used to make it
852
+ the one painted on top whenever the two overlapped. */
853
+ z-index: 1;
854
+ transform: translateY(8px) scale(0.98);
855
+ transition: opacity 260ms cubic-bezier(0.32, 0.72, 0, 1),
856
+ transform 260ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 260ms;
857
+ font: 14px/1.4 var(${Oe}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
858
+ background: var(--_arcy-main-bg, #ffffff);
859
+ color: var(--_arcy-main-text, #101828);
860
+ /* The shared base.border (D832): one value, the bar's edge and this one. */
861
+ border: var(--_arcy-border-width, 0px) solid
862
+ var(--_arcy-border-color, color-mix(in srgb, var(--_arcy-main-text, #101828) 15%, transparent));
863
+ border-radius: var(--_arcy-chat-radius, 16px);
864
+ /* Offset 0 (was 8px down): the panel sits only PANEL_GAP (8px) above the
865
+ bar, and a downward-pushed shadow painted across it. Centering the blur
866
+ keeps the same softness without smearing onto the surface below. */
867
+ box-shadow: var(--_arcy-chat-shadow, 0 0 24px rgba(16, 24, 40, 0.28));
868
+ }
869
+
870
+ /* Glassiness (\xA75.4): a blur behind the panel plus an alpha on
871
+ main.background. Only where the browser can blur; elsewhere the panel
872
+ stays opaque, never transparent. */
873
+ @supports (backdrop-filter: blur(1px)) {
874
+ .${de} {
875
+ background: color-mix(in srgb, var(--_arcy-main-bg, #ffffff) calc(100% - var(--_arcy-glass-alpha, 0%)), transparent);
876
+ backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
877
+ -webkit-backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
878
+ }
879
+ }
880
+
881
+ .${de}[data-open] {
882
+ visibility: visible;
883
+ opacity: 1;
884
+ transform: translateY(0) scale(1);
885
+ transition: opacity 260ms cubic-bezier(0.32, 0.72, 0, 1),
886
+ transform 260ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s;
887
+ }
888
+
889
+ /* Under the breakpoint the panel is a sheet: full width, rounded at the top
890
+ only, so it reads as the screen rather than as a card floating on it.
891
+ Set from JS as an attribute rather than a media query, because the
892
+ breakpoint is one number and viewport.ts owns it (D865). */
893
+ .${de}[data-sheet] {
894
+ border-radius: var(--_arcy-chat-radius, 16px) var(--_arcy-chat-radius, 16px) 0 0;
895
+ border-bottom: 0;
896
+ }
897
+
898
+ .${at} {
899
+ display: flex;
900
+ align-items: center;
901
+ gap: 4px;
902
+ padding: 8px 10px;
903
+ flex: 0 0 auto;
904
+ }
905
+
906
+ .${Be} {
907
+ appearance: none;
908
+ border: 0;
909
+ background: transparent;
910
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 70%, transparent);
911
+ cursor: pointer;
912
+ padding: 6px;
913
+ border-radius: 999px;
914
+ display: flex;
915
+ align-items: center;
916
+ flex: 0 0 auto;
917
+ -webkit-tap-highlight-color: transparent;
918
+ }
919
+
920
+ .${Be}:hover {
921
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
922
+ }
923
+
924
+ .${Be}:focus-visible {
925
+ outline: 2px solid currentColor;
926
+ outline-offset: 2px;
927
+ }
928
+
929
+ /* The identity sits in the middle, between the two controls on the left and
930
+ the one on the right, so the panel reads as the operator's rather than as
931
+ a third party's. */
932
+ .${at} .arcy-chat-identity {
933
+ flex: 1 1 auto;
934
+ display: flex;
935
+ align-items: center;
936
+ justify-content: center;
937
+ gap: 6px;
938
+ min-width: 0;
939
+ }
940
+
941
+ /* Sized by its HEIGHT and keeps its own aspect ratio (D925/D930): it used to
942
+ be a square box with "object-fit: cover", right for an app icon and wrong
943
+ for everything else, since a wordmark got cropped to its middle letters.
944
+ "chat.logoSize" means height here and the width follows. */
945
+ .${Ln} {
946
+ display: block;
947
+ height: var(--_arcy-chat-logo-size, 24px);
948
+ width: auto;
949
+ max-width: 100%;
950
+ border-radius: 4px;
951
+ object-fit: contain;
952
+ flex: 0 0 auto;
953
+ }
954
+
955
+ .${Rn} {
956
+ font-weight: 600;
957
+ white-space: nowrap;
958
+ overflow: hidden;
959
+ text-overflow: ellipsis;
960
+ min-width: 0;
961
+ }
962
+
963
+ .${Mn} {
964
+ position: relative;
965
+ display: flex;
966
+ flex: 1 1 auto;
967
+ min-height: 0;
968
+ overflow: hidden;
969
+ }
970
+
971
+ .${ne} {
972
+ position: relative;
973
+ flex: 1 1 auto;
974
+ overflow: auto;
975
+ min-height: 0;
976
+ scrollbar-width: thin;
977
+ scrollbar-color: var(--_arcy-scroll-thumb, color-mix(in srgb, var(--_arcy-main-text, #101828) 25%, transparent))
978
+ var(--_arcy-scroll-track, transparent);
979
+ }
980
+
981
+ /* D896: a set scrollbar-color makes Chrome ignore every ::-webkit-scrollbar
982
+ rule, which silently killed the width, track and hover tokens. */
983
+ @supports selector(::-webkit-scrollbar) {
984
+ .${ne} {
985
+ scrollbar-width: auto;
986
+ scrollbar-color: auto;
987
+ }
988
+ }
989
+
990
+ .${ne}::-webkit-scrollbar {
991
+ width: var(--_arcy-scroll-width, 6px);
992
+ }
993
+
994
+ .${ne}::-webkit-scrollbar-track {
995
+ background: var(--_arcy-scroll-track, transparent);
996
+ }
997
+
998
+ .${ne}::-webkit-scrollbar-thumb {
999
+ background: var(--_arcy-scroll-thumb, color-mix(in srgb, var(--_arcy-main-text, #101828) 25%, transparent));
1000
+ border-radius: 999px;
1001
+ }
1002
+
1003
+ .${ne}::-webkit-scrollbar-thumb:hover {
1004
+ background: var(--_arcy-scroll-thumb-hover, color-mix(in srgb, var(--_arcy-main-text, #101828) 40%, transparent));
1005
+ }
1006
+
1007
+ /* \u2500\u2500 The welcome screen \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1008
+
1009
+ .${re} {
1010
+ display: flex;
1011
+ flex-direction: column;
1012
+ align-items: center;
1013
+ text-align: center;
1014
+ gap: 10px;
1015
+ /* Room under the starter pills, so they do not sit on the bottom strip
1016
+ now that the panel takes its full height (D897), and room ABOVE the
1017
+ mark, which otherwise sits against the header's bottom edge and reads
1018
+ as part of the chrome rather than the start of the content. */
1019
+ padding: 26px 14px 20px;
1020
+ }
1021
+
1022
+ .${re} .arcy-chat-welcome-icon {
1023
+ display: flex;
1024
+ align-items: center;
1025
+ justify-content: center;
1026
+ width: var(--_arcy-chat-welcome-icon-size, 34px);
1027
+ height: var(--_arcy-chat-welcome-icon-size, 34px);
1028
+ border-radius: 999px;
1029
+ background: var(--_arcy-brand-bg, #101828);
1030
+ color: var(--_arcy-brand-text, #ffffff);
1031
+ overflow: hidden;
1032
+ flex-shrink: 0;
1033
+ /* The uploaded mark is drawn full-bleed against a round clip: without an
1034
+ inset, any mark that is not a perfect circle (most logos aren't) reads
1035
+ as cropped at top/bottom the moment it stops being square.
1036
+ calc() against the size token itself, NOT a percentage: a percentage
1037
+ padding resolves against the *containing block's* width (the chat
1038
+ panel), not this element's own, so it would inflate a 34px badge to
1039
+ match the panel's width instead of insetting it. */
1040
+ box-sizing: border-box;
1041
+ padding: calc(var(--_arcy-chat-welcome-icon-size, 34px) * 0.15);
1042
+ }
1043
+
1044
+ .${re} .arcy-chat-welcome-icon img {
1045
+ width: 100%;
1046
+ height: 100%;
1047
+ object-fit: contain;
1048
+ display: block;
1049
+ }
1050
+
1051
+ /* The default mark is drawn at a fixed 18px by icon(), so it would stay 18px
1052
+ inside a badge the operator resized. A share of the badge instead, which is
1053
+ what the 18-in-34 it shipped with already was. */
1054
+ .${re} .arcy-chat-welcome-icon svg {
1055
+ width: 53%;
1056
+ height: 53%;
1057
+ }
1058
+
1059
+ .${re} .arcy-chat-headline {
1060
+ font-size: 19px;
1061
+ font-weight: 600;
1062
+ }
1063
+
1064
+ .${re} .arcy-chat-greeting {
1065
+ font-size: 13.5px;
1066
+ white-space: pre-wrap;
1067
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 70%, transparent);
1068
+ }
1069
+
1070
+ .${st} {
1071
+ display: flex;
1072
+ flex-wrap: wrap;
1073
+ justify-content: center;
1074
+ gap: 6px;
1075
+ }
1076
+
1077
+ /* The pills arrive a beat after the welcome screen paints, because they come
1078
+ from the flow catalog fetch rather than the bootstrap (D959). Holding one
1079
+ row of height until that answers is what stops the greeting sliding up the
1080
+ panel while somebody is reading it. Released either way: an operator who
1081
+ has featured nothing must not be left with a permanent gap. */
1082
+ .${st}[data-pending] {
1083
+ min-height: 34px;
1084
+ }
1085
+
1086
+ .${He} {
1087
+ appearance: none;
1088
+ text-align: left;
1089
+ font: inherit;
1090
+ font-size: 12.5px;
1091
+ cursor: pointer;
1092
+ padding: 7px 13px;
1093
+ border-radius: 999px;
1094
+ border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
1095
+ background: transparent;
1096
+ color: inherit;
1097
+ max-width: 100%;
1098
+ transition: background 120ms ease, border-color 120ms ease;
1099
+ -webkit-tap-highlight-color: transparent;
1100
+ }
1101
+
1102
+ .${He}:hover {
1103
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
1104
+ border-color: color-mix(in srgb, var(--_arcy-main-text, #101828) 30%, transparent);
1105
+ }
1106
+
1107
+ @media (prefers-reduced-motion: reduce) {
1108
+ .${He} {
1109
+ transition: none;
1110
+ }
1111
+ }
1112
+
1113
+ /* \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 */
1114
+
1115
+ .${Pn} {
1116
+ display: flex;
1117
+ flex-wrap: wrap;
1118
+ gap: 6px;
1119
+ padding: 8px 12px 0;
1120
+ }
1121
+
1122
+ .${Q} {
1123
+ position: relative;
1124
+ width: 56px;
1125
+ height: 56px;
1126
+ border-radius: 10px;
1127
+ overflow: hidden;
1128
+ border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 16%, transparent);
1129
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 6%, transparent);
1130
+ }
1131
+
1132
+ .${Q} img {
1133
+ display: block;
1134
+ width: 100%;
1135
+ height: 100%;
1136
+ object-fit: cover;
1137
+ }
1138
+
1139
+ /* While the bytes are still going up. The picture is already on screen, so
1140
+ the wait is a dimming rather than a placeholder that swaps for the real
1141
+ thing and moves the row. */
1142
+ .${Q}[data-state="uploading"] img {
1143
+ opacity: 0.45;
1144
+ }
1145
+
1146
+ .${Q}[data-state="uploading"]::after {
1147
+ content: "";
1148
+ position: absolute;
1149
+ inset: 50% auto auto 50%;
1150
+ width: 16px;
1151
+ height: 16px;
1152
+ margin: -8px 0 0 -8px;
1153
+ border-radius: 50%;
1154
+ border: 2px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 25%, transparent);
1155
+ border-top-color: var(--_arcy-main-text, #101828);
1156
+ animation: arcy-chip-spin 700ms linear infinite;
1157
+ }
1158
+
1159
+ @keyframes arcy-chip-spin {
1160
+ to { transform: rotate(360deg); }
1161
+ }
1162
+
1163
+ @media (prefers-reduced-motion: reduce) {
1164
+ .${Q}[data-state="uploading"]::after {
1165
+ animation: none;
1166
+ }
1167
+ }
1168
+
1169
+ /* The remove control. Over the picture rather than beside it, so three
1170
+ tiles still fit a phone screen, and 20px with a dark disc behind it so it
1171
+ is legible over a photograph of anything. */
1172
+ .${Q} button {
1173
+ position: absolute;
1174
+ top: 3px;
1175
+ right: 3px;
1176
+ display: flex;
1177
+ align-items: center;
1178
+ justify-content: center;
1179
+ width: 18px;
1180
+ height: 18px;
1181
+ padding: 0;
1182
+ appearance: none;
1183
+ border: none;
1184
+ border-radius: 50%;
1185
+ background: rgba(16, 24, 40, 0.72);
1186
+ color: #ffffff;
1187
+ cursor: pointer;
1188
+ -webkit-tap-highlight-color: transparent;
1189
+ }
1190
+
1191
+ .${Q} button:hover {
1192
+ background: rgba(16, 24, 40, 0.9);
1193
+ }
1194
+
1195
+ .${Q} button svg {
1196
+ display: block;
1197
+ }
1198
+
1199
+ /* \u2500\u2500 The bottom strip \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1200
+
1201
+ /* "Powered by ARCY" only, centred (D979): it is the widget's one free
1202
+ distribution channel, always rendered in beta (D839) and never a theme
1203
+ field. The AI disclosure and the consent sentence used to share this row
1204
+ and now sit under the bar instead, so the watermark is centred rather
1205
+ than pinned to a corner by a neighbour. */
1206
+ .${Fn} {
1207
+ flex: 0 0 auto;
1208
+ display: flex;
1209
+ align-items: center;
1210
+ justify-content: center;
1211
+ padding: 6px 14px 10px;
1212
+ font-size: 10.5px;
1213
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
1214
+ }
1215
+
1216
+ .${Ce} {
1217
+ display: inline-flex;
1218
+ align-items: center;
1219
+ gap: 4px;
1220
+ max-width: 100%;
1221
+ color: inherit;
1222
+ text-decoration: none;
1223
+ }
1224
+
1225
+ .${Ce} span {
1226
+ overflow: hidden;
1227
+ text-overflow: ellipsis;
1228
+ white-space: nowrap;
1229
+ }
1230
+
1231
+ .${xe} {
1232
+ height: 12px;
1233
+ width: auto;
1234
+ display: block;
1235
+ /* Dimmed to sit with the strip's own text, and lifted to full strength on
1236
+ hover so the link answers the pointer (D907). */
1237
+ opacity: 0.75;
1238
+ transition: opacity 120ms ease;
1239
+ }
1240
+
1241
+ .${Ce}:hover .${xe},
1242
+ .${Ce}:focus-visible .${xe} {
1243
+ opacity: 1;
1244
+ }
1245
+
1246
+ @media (prefers-reduced-motion: reduce) {
1247
+ .${xe} {
1248
+ transition: none;
1249
+ }
1250
+ }
1251
+
1252
+ @media (prefers-reduced-motion: reduce) {
1253
+ .${de} {
1254
+ transition: none;
1255
+ }
1256
+ }
1257
+ `+Kt+Dt+on,_n="http://www.w3.org/2000/svg";function te(e,t,n=17){let r=e.createElementNS(_n,"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(_n,"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 go="M12 21a9 9 0 100-18 9 9 0 000 18zM12 7v5l3 2",Sn="M13 3L5 14h6l-1 7 8-11h-6l1-7z",bo="M6 9l6 6 6-6",yo="M18 6L6 18M6 6l12 12",wo=["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"],vo=["M19 13V19H13","M5 5L19 19"],In=["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"],xo="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 De(e,t){let n=e.style,r=t.bar.getMetrics(),o=t.getMaxHeightPercent?.()??fo,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",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% - ${a+12}px)`),n.setProperty("max-height","none");return}e.removeAttribute("data-sheet");let s=Pe(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=a-r.offset.y,k=an(o,r.viewportHeight,h);n.setProperty("height",`${k}px`),n.setProperty("max-height",`${k}px`);}function Co(e){try{let ee=function(){try{for(;J.firstChild;)J.removeChild(J.firstChild);J.style.setProperty("display",F.length>0?"flex":"none");let i=p().removeImage;for(let d of F){let f=c.createElement("div");if(f.className=Q,f.setAttribute("data-state",d.attachment?"ready":"uploading"),d.previewUrl){let _=c.createElement("img");_.src=d.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,yo,12)),b.addEventListener("click",()=>{F=F.filter(_=>_!==d),pt(d),ee();}),f.appendChild(b),J.appendChild(f);}e.bar.setAttachmentCount(F.length);}catch{}},ht=function(){e.setConversationId?.(null),M.clear(),ut(),X();},ue=function(i){let d=ie;d&&(ie=null,oe.hide(),e.bar.setAwaitingInput?.(!1),e.bar.setDisabled(Ee),e.bar.setPlaceholder(v()?.inputPlaceholder??null),d.resolve(i));},je=function(i){let d=ie;if(!d)return;let f=d.request,b=f.kind==="select"||f.kind==="radio"?dn(i,f.options):f.kind==="password"?i:i.trim(),_=cn(b,f);if(_!==null){oe.setError(_);return}ue(b);},yt=function(i){if(Ee)return;let d=F.filter(f=>f.attachment!==null);F=F.filter(f=>f.attachment===null),ee(),M.addMessage("user",i,{images:d.length,imageUrls:d.map(f=>f.previewUrl).filter(f=>f!==null)}),X(),Ee=!0,e.bar.setDisabled(!0),M.setPending(!0),fn({apiBase:e.apiBase??W,publicKey:e.publicKey??"",sessionId:e.getSessionId?.()??"",sessionToken:e.getSessionToken?.()??"",query:i,route:e.getRoute?.()??l?.location?.pathname??"",conversationId:e.getConversationId?.()??"",attachments:d.map(f=>({objectKey:f.attachment.objectKey}))}).then(f=>{let b=p();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"){uo.has(f.capReason)?e.onOrgCapExceeded?.():M.addMessage("system",b.userCapReached);return}M.addMessage("system",b.genericError);}).finally(()=>{Ee=!1,M.setPending(!1),e.bar.setDisabled(!1);});},he=function(){if(!u.hasAttribute("data-open")){Ge(),rt(e.host,c),e.bar.setMode("open"),De(u,e),u.setAttribute("data-open","");try{let i=e.isolated?e.root:c,d=e.isolated?i.activeElement:c.activeElement;_e=(e.isolated?d!==null:!!(d&&e.host.contains(d)))?null:c.activeElement,e.bar.focusInput();}catch{}}},Ge=function(){let i=v(),d=p();O(),G(),ie||e.bar.setPlaceholder(i?.inputPlaceholder??null),e.bar.setAttachEnabled(i?.allowImageUpload===!0),e.bar.setDisclaimer(V());for(let[f,b]of [[C,d.historyTitle],[A,d.flowsTitle],[P,d.settingsTitle],[U,d.collapse]])f.setAttribute("aria-label",b),f.setAttribute("data-tip",b);for(let f of [N,K,B])f.setTexts({backLabel:d.back,closeLabel:d.closeSheet});X();},Ct=function(){if(u.hasAttribute("data-open")){u.removeAttribute("data-open"),N.close(),K.close(),B.close(),Z="root",e.bar.setMode("idle"),e.bar.setDisclaimer(null);try{let i=_e;_e=null;let d=u.getRootNode();(d instanceof ShadowRoot?d.activeElement:document.activeElement!==null&&document.activeElement!==document.body)&&i&&i.isConnected&&typeof i.focus=="function"&&i.focus();}catch{}}};var t=ee,n=ht,r=ue,o=je,a=yt,s=he,h=Ge,k=Ct;let m={host:e.host,root:e.root,isolated:e.isolated,destroy(){}};Ke(m,mo),Ke(m,sn);let c=e.host.ownerDocument,l=c.defaultView,v=()=>{try{return e.getWidget?.()??null}catch{return null}},p=()=>v()?.chrome??_t,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 x=c.createElement("div");x.className=at;let g=(i,d,f)=>{let b=c.createElement("button");return b.type="button",b.className=Be,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,d)),b},C=g(p().historyTitle,go,"start"),A=g(p().flowsTitle,Sn,"start");A.style.setProperty("display","none");let T=c.createElement("div");T.className="arcy-chat-identity";let I=c.createElement("span"),H=c.createElement("span");H.className=Rn,T.appendChild(I),T.appendChild(H);let P=g(p().settingsTitle,wo,"end");e.bar.dock||P.style.setProperty("display","none");let U=g(p().collapse,bo,"end");x.appendChild(C),x.appendChild(A),x.appendChild(T),x.appendChild(P),x.appendChild(U);let O=()=>{let i=v(),d=typeof i?.logoUrl=="string"&&/^https:\/\//i.test(i.logoUrl)?i.logoUrl:null;if(H.textContent=d?"":i?.name??"",H.style.setProperty("display",d?"none":"block"),d&&I.getAttribute("data-src")===d)return;let f=d?c.createElement("img"):c.createElement("span");if(f.className=d?Ln:"",d){let b=f;b.alt=i?.name??"",b.decoding="async",b.onerror=()=>{try{let _=c.createElement("span");b.replaceWith(_),I=_,H.textContent=i?.name??"",H.style.setProperty("display","block");}catch{}},b.setAttribute("data-src",d),b.src=d;}I.replaceWith(f),I=f;},y=c.createElement("div");y.className=ne;let w=c.createElement("div");w.className=Fn;let E=c.createElement("a");E.className=Ce,E.href=po,E.target="_blank",E.rel="noopener noreferrer";let $=c.createElement("span"),D=c.createElement("img");D.className=xe,D.src=co,D.alt="ARCY",D.decoding="async",D.loading="lazy",D.onerror=()=>{try{D.remove();}catch{}},E.appendChild($),E.appendChild(D),w.appendChild(E);let G=()=>{let i=p();$.textContent=i.poweredBy.replace(/\s*ARCY\s*$/i,""),E.setAttribute("aria-label",i.poweredBy);},V=()=>{let i=v(),d=p(),f=i?.privacyPolicyUrl,b=i?.name?d.aiDisclaimer.replace("{app}",i.name):d.aiDisclaimer;if(typeof f=="string"&&/^https:\/\//i.test(f)){let _=d.consentWithPolicy.indexOf("{policy}"),Y=_>=0?d.consentWithPolicy.slice(0,_):`${d.consentWithPolicy} `,L=_>=0?d.consentWithPolicy.slice(_+8):"";return {before:`${b}${d.disclaimerJoin}${Y}`,linkLabel:d.privacyPolicy,linkHref:f,after:L}}return b},pe=c.createElement("div");pe.className=Mn,pe.appendChild(y),u.appendChild(x),u.appendChild(pe),u.appendChild(w),e.root.appendChild(u),rt(e.host,c),De(u,e);let M=Yt(y,c,{labels:{likeAnswer:p().likeAnswer,dislikeAnswer:p().dislikeAnswer},answeringLabel:()=>p().answering,searchedSourcesLabel:p().searchedSourcesLabel,sourcesLabel:p().sourcesLabel,flowOfferHint:()=>p().flowOfferHint,onStartFlow:i=>{e.track?.("flow_pill_clicked",{},{flowCvid:i}),e.onStartFlow?.(i);},onFeedback:(i,d)=>{e.track?.("answer_feedback",{},{value:i});let f=e.getSessionToken?.()??"",b=e.getConversationId?.()??"";!d||!f||!b||kn({apiBase:e.apiBase,sessionToken:f,conversationId:b,messageId:d,value:i,visitorId:e.getVisitorId?.()??void 0});}}),z=c.createElement("div");z.className=re,y.insertBefore(z,y.firstChild);let lt=[],ke=!0,ct=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=v(),d=c.createElement("div");d.className="arcy-chat-welcome-icon";let f=i?.welcomeIconUrl??null;if(f&&f!==ct){let L=c.createElement("img");L.src=f,L.alt="",L.addEventListener("error",()=>{ct=f,X();},{once:!0}),d.appendChild(L);}else d.appendChild(te(c,xo,18));z.appendChild(d);let b=i?.welcomeHeadline?.trim()??"",_=i?.welcomeMessage?.trim()??"";if(b){let L=c.createElement("div");L.className="arcy-chat-headline",L.textContent=b,z.appendChild(L);}if(_){let L=c.createElement("div");L.className="arcy-chat-greeting",L.textContent=_,z.appendChild(L);}let Y=c.createElement("div");Y.className=st,ke&&Y.setAttribute("data-pending","");for(let L of lt){let q=c.createElement("button");q.type="button",q.className=He,q.textContent=L.publicName,q.addEventListener("click",()=>{e.track?.("starter_flow_clicked",{},{flowCvid:L.cvid}),e.onStartFlow?.(L.cvid);}),Y.appendChild(q);}z.appendChild(Y);}catch{}},J=c.createElement("div");J.className=Pn,J.style.setProperty("display","none"),y.insertBefore(J,y.firstChild);let F=[],dt=An(c),$n=dt.fetchImpl??(typeof fetch<"u"?fetch.bind(globalThis):null),Nn=i=>{try{return l?.URL?.createObjectURL?.(i)??URL.createObjectURL(i)}catch{return null}},Ue=i=>{if(i.previewUrl){try{(l?.URL??URL).revokeObjectURL(i.previewUrl);}catch{}i.previewUrl=null;}},pt=i=>{Ue(i);let d=i.attachment?.objectKey;d&&En(d,{apiBase:e.apiBase,sessionToken:e.getSessionToken?.()??"",fetchImpl:$n});},ut=()=>{let i=F;F=[];for(let d of i)pt(d);ee();},Ae=Promise.resolve(),ft=i=>{Ae=Ae.then(async()=>{for(let d of i){let f=e.getSessionToken?.()??"",b=q=>{let Se=p();M.addMessage("system",q==="type"?Se.imageWrongType:q==="size"?Se.imageTooLarge:q==="count"?Se.imageTooMany:Se.imageFailed);},_=it(d,F.length);if(!_.ok){b(_.reason),X();continue}let Y={previewUrl:Nn(d),attachment:null};F=[...F,Y],ee();let L=await Tn(d,F.length-1,{apiBase:e.apiBase,sessionToken:f,env:dt});if(L.ok){Y.attachment=L.attachment,ee();continue}F=F.filter(q=>q!==Y),Ue(Y),ee(),b(L.reason),X();}}),Ae=Ae.catch(()=>{});},ze=[],N=Fe(u,c,{title:p().historyTitle,emptyText:p().historyEmpty,actionLabel:p().newChat,subtitleTips:!1,backLabel:p().back,closeLabel:p().closeSheet,onBack:()=>N.close(),onAction:()=>{ht(),N.close();},onSelect:i=>{if((e.getConversationId?.()??"")===i){N.close();return}e.setConversationId?.(i),M.clear(),ut(),X(),N.close(),On(i);}});async function On(i){let d=e.getSessionToken?.()??"";if(!d)return;let f=await Cn({apiBase:e.apiBase,sessionToken:d,conversationId:i,visitorId:e.getVisitorId?.()??void 0});if(f.ok&&(e.getConversationId?.()??"")===i){M.clear();for(let b of f.messages)M.addMessage(xn(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 K=Fe(u,c,{title:p().flowsTitle,emptyText:p().flowsEmpty,actionLabel:null,backLabel:p().back,closeLabel:p().closeSheet,itemIcon:i=>te(i,Sn,16),onBack:()=>K.close(),onSelect:i=>{K.close(),e.onStartFlow?.(i);}}),Z="root",B=Fe(u,c,{title:p().settingsTitle,side:"right",actionLabel:null,backLabel:p().back,closeLabel:p().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?.());}}),Dn=()=>{if(!e.onSelectLocale)return [];let i=v()?.locales??[];return i.length>=2?i:[]},Te=()=>{let i=p(),d=Dn();if(Z==="language"){B.setTitle(i.language),B.setItems(d.map(b=>({id:b.code,title:b.label,active:b.code===v()?.activeLocale,icon:_=>te(_,In,16)})));return}B.setTitle(i.settingsTitle);let f=d.find(b=>b.code===v()?.activeLocale);B.setItems([...d.length?[{id:"language",title:i.language,subtitle:f?.label??null,icon:b=>te(b,In,16)}]:[],{id:"dock",title:i.dockChat,subtitle:i.dockChatHint,icon:b=>te(b,vo,16)}]);},mt=()=>{let i=p();N.setTitle(i.historyTitle),N.setTexts({emptyText:i.historyEmpty,actionLabel:i.newChat}),N.setItems(ot(ze,i.imageConversation,e.getConversationId?.())),N.open(),Bn();};async function Bn(){let i=e.getSessionToken?.()??"",d=e.getVisitorId?.()??"";if(!i||!d)return;let f=await vn({apiBase:e.apiBase,sessionToken:i,visitorId:d});f.ok&&(ze=f.conversations,N.isOpen()&&N.setItems(ot(ze,p().imageConversation,e.getConversationId?.())));}C.addEventListener("click",mt),A.addEventListener("click",()=>{let i=p();K.setTitle(i.flowsTitle),K.setTexts({emptyText:i.flowsEmpty}),K.open();});let gt=()=>{Z="root",Te(),B.open();};P.addEventListener("click",gt);let bt=()=>e.onRequestClose();U.addEventListener("click",bt);let oe=ln(e,()=>p()),ie=null,Ee=!1;e.bar.onSubmit(i=>{if(ie){je(i);return}he(),yt(i);}),e.bar.onFiles?.(i=>{he(),ft(i);});let Hn=()=>v()?.allowImageUpload===!0,Un=i=>{Ve(i)&&i.preventDefault();},zn=i=>{if(!Ve(i)||(i.preventDefault(),!Hn()))return;let d=St(i);d.length>0&&ft(d);};u.addEventListener("dragover",Un),u.addEventListener("drop",zn);let fe=i=>{lt=i,ke=!1,X();},wt=!1,We=()=>{if(wt)return !0;let i=e.getSessionToken?.();return i?(wt=!0,pn({apiBase:e.apiBase,sessionToken:i,sessionId:e.getSessionId?.()}).then(d=>{if(!d.ok){fe([]);return}let f=un(d.flows);fe(d.starterFlows),f.length!==0&&(A.style.setProperty("display","flex"),K.setItems(f.map(b=>({id:b.cvid,title:b.publicName,subtitle:b.summary}))));}).catch(()=>{fe([]);}),!0):!1};if(!We())try{l?.setTimeout(()=>{!We()&&ke&&fe([]);},ho);}catch{}let vt=i=>{if(i.key==="Escape"){if(i.stopPropagation(),N.isOpen()){N.close();return}if(K.isOpen()){K.close();return}if(B.isOpen()){B.close();return}e.onRequestClose();}};u.addEventListener("keydown",vt);let xt=()=>{u.hasAttribute("data-open")&&De(u,e),oe.reposition();};l?.addEventListener("resize",xt);let _e=null;return {open:he,close:Ct,reposition(){u.hasAttribute("data-open")&&De(u,e),oe.reposition();},refreshChrome(){!We()&&ke&&fe([]),u.hasAttribute("data-open")&&(Ge(),B.isOpen()&&Te());},destroy(){C.removeEventListener("click",mt),P.removeEventListener("click",gt),U.removeEventListener("click",bt),u.removeEventListener("keydown",vt),l?.removeEventListener("resize",xt),_e=null,ue(null),oe.destroy(),N.destroy(),K.destroy(),B.destroy(),M.destroy();for(let i of F)Ue(i);F=[],u.remove();},promptFill(i){return new Promise(d=>{ue(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:d,request:i};})},cancelFill(){ue(null);},showFlowFailure(){he(),M.addMessage("assistant",p().flowFailed),X();}}}catch{return null}}var ko={contract:4,mount:Co};if(typeof window<"u")try{window[kt]=ko;}catch{}
1258
+ exports.ARCY_HOME_URL=po;exports.ARCY_WORDMARK_URL=co;exports.BODY_CLASS=ne;exports.CATALOG_RETRY_MS=ho;exports.CHAT_CSS=mo;exports.CHIPS_CLASS=Pn;exports.CHIP_CLASS=Q;exports.HEADER_BUTTON_CLASS=Be;exports.HEADER_CLASS=at;exports.HEADER_ICON_CLASS=Ln;exports.HEADER_NAME_CLASS=Rn;exports.MAIN_CLASS=Mn;exports.MARK_CLASS=xe;exports.MARK_LINK_CLASS=Ce;exports.PANEL_CLASS=de;exports.POLICY_CLASS=vi;exports.STARTER_CLASS=He;exports.STARTER_ROW_CLASS=st;exports.STRIP_CLASS=Fn;exports.WELCOME_CLASS=re;exports.mount=Co;return exports;})({});