luzia-widget 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/links.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,gEAAgE,CAAC;AACjG,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA,qCAAqC,CAAC;AACpE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAA,yCAAyC,CAAC;AAClE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,aAAa,KAAK,WAAW,MAAM,KAAK,GAAG,EAAE,IAAI,CAAC,CAAC;AAE/E,uFAAuF;AACvF,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,kGAAkG;AAClG,SAAS,WAAW,CAAC,OAAe;IAClC,IAAI,OAAO,GAAG,OAAO,CAAC;IACtB,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,OAAO,CAAC;QACvB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAU,EAAE,CAAC;YAC9D,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;gBAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9G,CAAC;QACD,IAAI,OAAO,KAAK,MAAM;YAAE,OAAO,OAAO,CAAC;IACzC,CAAC;AACH,CAAC;AAED,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AAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,CAAC;AACnC,CAAC"}
@@ -1,4 +1,4 @@
1
- var N="conversation_limit_reached",$="message_too_long";function E(r){return r.code===N?"limit":r.code===$?"too-long":"unavailable"}var P={limit:"You've reached the message limit for this conversation.","too-long":"That message is too long. Please shorten it and try again.",unavailable:"luzIA is unavailable right now. Please try again later."};function S(r,e,t){if(r.hidden=e===null,r.replaceChildren(),e===null)return;r.append(P[e]);let i=t.trim();e==="too-long"||!i||r.append(" You can get in touch directly: ",V(i),".")}function V(r){let e=/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(r)?`mailto:${r}`:/^https?:\/\/\S+$/i.test(r)?r:null;if(!e)return document.createTextNode(r);let t=document.createElement("a");return t.href=e,t.textContent=r,e.startsWith("mailto:")||(t.target="_blank",t.rel="noopener noreferrer"),t}var u=class extends Error{code;status;constructor(e,t,i){super(t),this.name="LuziaRequestError",this.code=e,this.status=i}};async function*T(r,e,t){let i;try{i=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({messages:e}),signal:t})}catch(s){if(t?.aborted)return;throw new u("network_error",A(s))}if(!i.ok)throw await B(i);if(!i.body)throw new u("network_error","The reply had no body.",i.status);let n=i.body.pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:s,value:o}=await n.read();if(s)return;o&&(yield o)}}catch(s){if(t?.aborted)return;throw new u("network_error",A(s),i.status)}finally{n.releaseLock()}}async function B(r){let t=(await r.json().catch(()=>{}))?.error;return new u(typeof t?.code=="string"?t.code:"http_error",typeof t?.message=="string"?t.message:`The server answered ${r.status}.`,r.status)}function A(r){return r instanceof Error?r.message:String(r)}var h=class{#e;#n=new Set;#g;#t=null;constructor(e){this.#g=e,this.#e={messages:e.messages??[],status:"idle",error:null,unsent:null}}get state(){return this.#e}subscribe(e){return this.#n.add(e),()=>this.#n.delete(e)}send(e){let t=e.trim();return!t||this.#e.status==="streaming"?!1:(this.#m([...this.#e.messages,{role:"user",content:t}]),!0)}abort(){this.#t?.abort()}reset(e=[]){let t=this.#t;this.#t=null,t?.abort(),this.#r({messages:e,status:"idle",error:null,unsent:null})}async#m(e){let t=new AbortController;this.#t=t;let i="";this.#r({messages:[...e,{role:"assistant",content:i}],status:"streaming",error:null,unsent:null});try{for await(let n of T(this.#g.endpoint(),e,t.signal)){if(this.#t!==t)return;i+=n,this.#r({...this.#e,messages:[...e,{role:"assistant",content:i}]})}if(this.#t!==t)return;this.#r({messages:C(e,i),status:"idle",error:null,unsent:null})}catch(n){if(this.#t!==t)return;let s=n instanceof u?n:new u("network_error",String(n));i?this.#r({messages:C(e,i),status:"error",error:s,unsent:null}):this.#r({messages:e.slice(0,-1),status:"error",error:s,unsent:e.at(-1)?.content??null})}finally{this.#t===t&&(this.#t=null)}}#r(e){this.#e=e;for(let t of this.#n)t(e)}};function C(r,e){return e?[...r,{role:"assistant",content:e}]:r}var j=String.raw`\[([^\]\n]+)\]\(\s*((?:https?:\/\/|mailto:|www\.)[^\s)]+)\s*\)`,F=String.raw`(?:https?:\/\/|www\.)[^\s<>"'\x60]+`,D=String.raw`[\w.+-]+@[\w-]+(?:\.[\w-]+)*\.[a-z]{2,}`,K=new RegExp(`${j}|(${F})|(${D})`,"gi"),G=/[.,;:!?'"»”’]+$/;function U(r){let e=r;for(;;){let t=e;e=e.replace(G,"");for(let[i,n]of[["(",")"],["[","]"]])e.endsWith(n)&&M(e,n)>M(e,i)&&(e=e.slice(0,-1));if(e===t)return e}}function M(r,e){return r.split(e).length-1}function I(r){let e=/^www\./i.test(r)?`https://${r}`:r;try{let t=new URL(e);return["http:","https:","mailto:"].includes(t.protocol)?t.href:null}catch{return null}}function f(r,e,t){let i=document.createElement("a");return i.href=e,i.textContent=r,e.startsWith("mailto:")||(i.target="_blank",i.rel="noopener noreferrer"),t||(i.tabIndex=-1),i}function v(r,e,{focusable:t=!0}={}){let i=[],n=0;for(let s of e.matchAll(K)){let[o,l,a,L,p]=s,b=s.index,g=o,d=null;if(l!==void 0&&a!==void 0){let c=I(a);c&&(d=f(l,c,t))}else if(L!==void 0){g=U(L);let c=I(g);c&&(d=f(g,c,t))}else p!==void 0&&(d=f(p,`mailto:${p}`,t));d&&(b>n&&i.push(document.createTextNode(e.slice(n,b))),i.push(d),n=b+g.length)}n<e.length&&i.push(document.createTextNode(e.slice(n))),r.replaceChildren(...i)}function W(r){let e=r;try{e=new URL(r,document.baseURI).href}catch{}return`luzia:conversation:${e}`}function O(r,e){let t=Z();if(!t)return()=>{};let i=Q(t,e);i&&r.state.messages.length===0&&r.reset(i);let n=H(R(r.state));return r.subscribe(s=>{let o=R(s),l=H(o);if(l!==n){n=l;try{o.length===0?t.removeItem(e):t.setItem(e,l)}catch{}}})}function R(r){return r.status==="streaming"?r.messages.slice(0,-1):r.messages}function H(r){let e={v:1,messages:[...r]};return JSON.stringify(e)}function Q(r,e){try{let t=r.getItem(e);if(t===null)return null;let i=JSON.parse(t);return Y(i)?i.messages.map(({role:n,content:s})=>({role:n,content:s})):null}catch{return null}}function Y(r){if(typeof r!="object"||r===null)return!1;let{v:e,messages:t}=r;return e===1&&Array.isArray(t)&&t.every(J)}function J(r){if(typeof r!="object"||r===null)return!1;let{role:e,content:t}=r;return(e==="user"||e==="assistant")&&typeof t=="string"}function Z(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}var _=`
1
+ var q="conversation_limit_reached",N="message_too_long";function z(n){return n.code===q?"limit":n.code===N?"too-long":"unavailable"}var $={limit:"You've reached the message limit for this conversation.","too-long":"That message is too long. Please shorten it and try again.",unavailable:"luzIA is unavailable right now. Please try again later."};function L(n,e,t){if(n.hidden=e===null,n.replaceChildren(),e===null)return;n.append($[e]);let i=t.trim();e==="too-long"||!i||n.append(" You can get in touch directly: ",P(i),".")}function P(n){let e=/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(n)?`mailto:${n}`:/^https?:\/\/\S+$/i.test(n)?n:null;if(!e)return document.createTextNode(n);let t=document.createElement("a");return t.href=e,t.textContent=n,e.startsWith("mailto:")||(t.target="_blank",t.rel="noopener noreferrer"),t}var d=class extends Error{code;status;constructor(e,t,i){super(t),this.name="LuziaRequestError",this.code=e,this.status=i}};async function*E(n,e,t){let i;try{i=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({messages:e}),signal:t})}catch(r){if(t?.aborted)return;throw new d("network_error",A(r))}if(!i.ok)throw await V(i);if(!i.body)throw new d("network_error","The reply had no body.",i.status);let a=i.body.pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:r,value:s}=await a.read();if(r)return;s&&(yield s)}}catch(r){if(t?.aborted)return;throw new d("network_error",A(r),i.status)}finally{a.releaseLock()}}async function V(n){let t=(await n.json().catch(()=>{}))?.error;return new d(typeof t?.code=="string"?t.code:"http_error",typeof t?.message=="string"?t.message:`The server answered ${n.status}.`,n.status)}function A(n){return n instanceof Error?n.message:String(n)}var h=class{#e;#a=new Set;#l;#n=null;constructor(e){this.#l=e,this.#e={messages:e.messages??[],status:"idle",error:null,unsent:null}}get state(){return this.#e}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}send(e){let t=e.trim();return!t||this.#e.status==="streaming"?!1:(this.#d([...this.#e.messages,{role:"user",content:t}]),!0)}abort(){this.#n?.abort()}reset(e=[]){let t=this.#n;this.#n=null,t?.abort(),this.#i({messages:e,status:"idle",error:null,unsent:null})}async#d(e){let t=new AbortController;this.#n=t;let i="";this.#i({messages:[...e,{role:"assistant",content:i}],status:"streaming",error:null,unsent:null});try{for await(let a of E(this.#l.endpoint(),e,t.signal)){if(this.#n!==t)return;i+=a,this.#i({...this.#e,messages:[...e,{role:"assistant",content:i}]})}if(this.#n!==t)return;this.#i({messages:T(e,i),status:"idle",error:null,unsent:null})}catch(a){if(this.#n!==t)return;let r=a instanceof d?a:new d("network_error",String(a));i?this.#i({messages:T(e,i),status:"error",error:r,unsent:null}):this.#i({messages:e.slice(0,-1),status:"error",error:r,unsent:e.at(-1)?.content??null})}finally{this.#n===t&&(this.#n=null)}}#i(e){this.#e=e;for(let t of this.#a)t(e)}};function T(n,e){return e?[...n,{role:"assistant",content:e}]:n}var B=String.raw`\[([^\]\n]+)\]\(\s*((?:https?:\/\/|mailto:|www\.)[^\s)]+)\s*\)`,G=String.raw`(?:https?:\/\/|www\.)[^\s<>"'\x60]+`,j=String.raw`[\w.+-]+@[\w-]+(?:\.[\w-]+)*\.[a-z]{2,}`,K=new RegExp(`${B}|(${G})|(${j})`,"gi"),D=/[.,;:!?'"»”’]+$/;function F(n){let e=n;for(;;){let t=e;e=e.replace(D,"");for(let[i,a]of[["(",")"],["[","]"]])e.endsWith(a)&&S(e,a)>S(e,i)&&(e=e.slice(0,-1));if(e===t)return e}}function S(n,e){return n.split(e).length-1}function C(n){let e=/^www\./i.test(n)?`https://${n}`:n;try{let t=new URL(e);return["http:","https:","mailto:"].includes(t.protocol)?t.href:null}catch{return null}}function f(n,e){let t=document.createElement("a");return t.href=e,t.textContent=n,e.startsWith("mailto:")||(t.target="_blank",t.rel="noopener noreferrer"),t}function M(n,e){let t=[],i=0;for(let a of e.matchAll(K)){let[r,s,l,o,p]=a,b=a.index,g=r,u=null;if(s!==void 0&&l!==void 0){let c=C(l);c&&(u=f(s,c))}else if(o!==void 0){g=F(o);let c=C(g);c&&(u=f(g,c))}else p!==void 0&&(u=f(p,`mailto:${p}`));u&&(b>i&&t.push(document.createTextNode(e.slice(i,b))),t.push(u),i=b+g.length)}i<e.length&&t.push(document.createTextNode(e.slice(i))),n.replaceChildren(...t)}function R(n){let e=n;try{e=new URL(n,document.baseURI).href}catch{}return`luzia:conversation:${e}`}function O(n,e){let t=J();if(!t)return()=>{};let i=Y(t,e);i&&n.state.messages.length===0&&n.reset(i);let a=W(I(n.state));return n.subscribe(r=>{let s=I(r),l=W(s);if(l!==a){a=l;try{s.length===0?t.removeItem(e):t.setItem(e,l)}catch{}}})}function I(n){return n.status==="streaming"?n.messages.slice(0,-1):n.messages}function W(n){let e={v:1,messages:[...n]};return JSON.stringify(e)}function Y(n,e){try{let t=n.getItem(e);if(t===null)return null;let i=JSON.parse(t);return U(i)?i.messages.map(({role:a,content:r})=>({role:a,content:r})):null}catch{return null}}function U(n){if(typeof n!="object"||n===null)return!1;let{v:e,messages:t}=n;return e===1&&Array.isArray(t)&&t.every(Q)}function Q(n){if(typeof n!="object"||n===null)return!1;let{role:e,content:t}=n;return(e==="user"||e==="assistant")&&typeof t=="string"}function J(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}var _=`
2
2
  :host {
3
3
  --luzia-accent: #4f46e5;
4
4
  --luzia-accent-contrast: #ffffff;
@@ -76,6 +76,40 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
76
76
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
77
77
  cursor: pointer;
78
78
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
79
+ position: relative;
80
+ }
81
+ /*
82
+ * With the Owner's hello animation, luzIA peeks out of the closed launcher
83
+ * now and then, above its text: she rises from its top edge (clipped there,
84
+ * as if from behind it), says hello, and ducks back down.
85
+ */
86
+ .peek {
87
+ position: absolute;
88
+ left: calc(50% + 1.15rem);
89
+ bottom: calc(100% - 1px);
90
+ width: 10.5rem;
91
+ height: var(--luzia-peek-size, 8.5rem);
92
+ transform: translateX(-50%);
93
+ clip-path: inset(-3rem -3rem 0 -3rem);
94
+ pointer-events: none;
95
+ }
96
+ .peek-image {
97
+ display: block;
98
+ height: 100%;
99
+ width: 100%;
100
+ object-fit: contain;
101
+ object-position: 50% 100%;
102
+ transform: translateY(105%);
103
+ transform-origin: 50% 100%;
104
+ filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.18));
105
+ }
106
+ /* The animation says hello; she only rises and ducks: half a second up, gently settling;
107
+ half a second down, easing in and out (no sudden drop). */
108
+ .bubble[data-peeking] .peek-image { animation: luzia-peek-rise 4s both; }
109
+ @keyframes luzia-peek-rise {
110
+ 0% { transform: translateY(105%); animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1); }
111
+ 12.5%, 87.5% { transform: translateY(0); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
112
+ 100% { transform: translateY(105%); }
79
113
  }
80
114
  @media (hover: hover) and (pointer: fine) {
81
115
  .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
@@ -113,8 +147,9 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
113
147
  transition-duration: 140ms;
114
148
  transition-delay: 0ms;
115
149
  }
116
- /* Less motion: the text still fades, but nothing moves or turns. */
150
+ /* Less motion: the text still fades, but nothing moves or turns (and luzIA doesn't peek). */
117
151
  @media (prefers-reduced-motion: reduce) {
152
+ .peek { display: none; }
118
153
  .bubble, .bubble-label, .bubble-icon path { transition: none; }
119
154
  .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }
120
155
  .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }
@@ -125,10 +160,9 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
125
160
  width: min(24rem, calc(100vw - 2.5rem));
126
161
  height: min(40rem, calc(100vh - 7rem));
127
162
  margin-bottom: 0.75rem;
128
- /* luzIA stands in a soft light of the accent colour; it fades out before the conversation. */
129
- background-color: var(--luzia-surface);
130
- background-image: radial-gradient(19rem 12rem at 6.5rem 8rem, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent 70%);
131
- background-repeat: no-repeat;
163
+ background: var(--luzia-surface);
164
+ /* luzIA's light (.stage::before) sits behind the header and stage, above this background. */
165
+ isolation: isolate;
132
166
  border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);
133
167
  border-radius: 1.25rem;
134
168
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);
@@ -173,20 +207,42 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
173
207
  .header-icon svg { display: block; }
174
208
  .header-icon circle { fill: var(--luzia-accent); }
175
209
  .header-icon path { fill: var(--luzia-accent-contrast); }
176
- /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */
210
+ /* Like a video call: luzIA's whole picture at the top, her state beside it like a name tag. */
177
211
  .stage {
212
+ --luzia-avatar-height: var(--luzia-avatar-size, clamp(6rem, 26vh, 11rem));
213
+ position: relative;
178
214
  flex: none;
179
215
  display: flex;
180
- justify-content: flex-start;
181
- gap: 0.75rem;
216
+ justify-content: center;
217
+ align-items: flex-end;
182
218
  padding: 0.25rem 1rem 0;
183
219
  border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);
184
220
  }
221
+ /* She stands in a soft light of the accent colour. */
222
+ .stage::before {
223
+ content: '';
224
+ position: absolute;
225
+ z-index: -1;
226
+ left: 50%;
227
+ bottom: -3rem;
228
+ width: 22rem;
229
+ height: 15rem;
230
+ transform: translateX(-50%);
231
+ background: radial-gradient(closest-side, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent);
232
+ pointer-events: none;
233
+ }
185
234
  /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */
186
235
  .avatar {
187
- display: block;
188
- height: var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem));
236
+ display: grid;
237
+ grid-template-rows: 100%;
238
+ flex: none;
239
+ height: var(--luzia-avatar-height);
189
240
  }
241
+ /* The still picture and its talking version share one place; only one shows at a time. */
242
+ .avatar > * { grid-area: 1 / 1; }
243
+ .avatar .speaking { opacity: 0; }
244
+ .stage[data-talking] .avatar .speaking { opacity: 1; }
245
+ .stage[data-talking] .avatar:has(.speaking) .still { opacity: 0; }
190
246
  .avatar img,
191
247
  .avatar svg {
192
248
  display: block;
@@ -194,78 +250,76 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
194
250
  width: auto;
195
251
  max-width: 100%;
196
252
  object-fit: contain;
197
- transition: filter 0.2s ease;
253
+ transform-origin: 50% 100%;
254
+ transition: filter 0.2s ease, transform 360ms cubic-bezier(0.23, 1, 0.32, 1);
198
255
  }
199
- .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }
256
+ .avatar svg { aspect-ratio: 1; margin-bottom: 0.5rem; height: calc(100% - 0.5rem); }
200
257
  /* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */
201
258
  .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }
202
- /* luzIA stays on the left; her speech bubble appears on the right without moving her. */
203
- .speech {
204
- position: relative;
205
- flex: 1;
206
- align-self: flex-start;
207
- min-width: 0;
208
- margin: 0.75rem 0 0;
209
- padding: 0.6rem 0.8rem;
210
- border: 1px solid var(--luzia-border);
211
- border-radius: 1rem;
212
- background: var(--luzia-surface);
213
- color: var(--luzia-text);
214
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 24px -10px rgb(0 0 0 / 0.25);
215
- font-size: 0.875rem;
216
- line-height: 1.45;
217
- opacity: 1;
218
- transition: opacity 0.4s ease;
219
- }
220
- .speech-text {
221
- display: block;
222
- max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);
223
- /* Long replies scroll inside the bubble, so their beginning can be read. */
224
- overflow-y: auto;
225
- overscroll-behavior: contain;
226
- padding-inline-end: 0.25rem;
227
- white-space: pre-wrap;
228
- overflow-wrap: anywhere;
229
- }
230
- /* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */
231
- .speech::before,
232
- .speech::after {
233
- content: '';
234
- position: absolute;
235
- border-block-style: solid;
236
- border-block-color: transparent;
237
- border-inline-end-style: solid;
238
- }
239
- .speech::before {
240
- top: var(--luzia-speech-tail-top, 1.6rem);
241
- left: -0.6rem;
242
- border-block-width: 0.45rem;
243
- border-inline-end-width: 0.6rem;
244
- border-inline-end-color: var(--luzia-border);
245
- }
246
- .speech::after {
247
- top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);
248
- left: calc(-0.6rem + 1.5px);
249
- border-block-width: calc(0.45rem - 1px);
250
- border-inline-end-width: 0.6rem;
251
- border-inline-end-color: var(--luzia-surface);
252
- }
253
- .speech.leaving { opacity: 0; }
254
- @media (prefers-reduced-motion: reduce) {
255
- .speech { transition: none; }
256
- }
257
- /* While a reply streams in, a soft glow follows the picture's outline. */
259
+ /* While the Visitor types, she leans in a little, as someone listening does. */
260
+ .stage[data-presence='listening'] .avatar img,
261
+ .stage[data-presence='listening'] .avatar svg { transform: scale(1.025) rotate(-1deg); }
262
+ /* Speaking (the greeting, or a reply as it streams in): a soft glow breathes along her outline. */
258
263
  .stage[data-speaking] .avatar img,
259
- .stage[data-speaking] .avatar svg {
264
+ .stage[data-speaking] .avatar svg,
265
+ .stage[data-greeting] .avatar img,
266
+ .stage[data-greeting] .avatar svg {
260
267
  filter: drop-shadow(0 0 6px var(--luzia-accent));
261
268
  animation: luzia-speaking 1.4s ease-in-out infinite;
262
269
  }
263
270
  @keyframes luzia-speaking {
264
271
  50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }
265
272
  }
273
+ /* Her state, like the name tag in a video call: a dot that is lit while she is busy. */
274
+ /* Centred under her, on the divider line, like the name tag in a video call. */
275
+ .presence {
276
+ position: absolute;
277
+ z-index: 1;
278
+ left: 50%;
279
+ bottom: 0;
280
+ transform: translate(-50%, 50%);
281
+ display: flex;
282
+ align-items: center;
283
+ gap: 0.45rem;
284
+ max-width: calc(100% - 2rem);
285
+ padding: 0.3rem 0.7rem 0.3rem 0.55rem;
286
+ border-radius: 999px;
287
+ background: var(--luzia-surface);
288
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 0 0 1px color-mix(in srgb, var(--luzia-border) 60%, transparent);
289
+ color: color-mix(in srgb, var(--luzia-text) 72%, transparent);
290
+ font-size: 0.8125rem;
291
+ font-weight: 500;
292
+ line-height: 1.2;
293
+ white-space: nowrap;
294
+ }
295
+ .presence-dot {
296
+ flex: none;
297
+ width: 0.5rem;
298
+ height: 0.5rem;
299
+ border-radius: 50%;
300
+ background: #16a34a;
301
+ box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 18%, transparent);
302
+ transition: background-color 200ms ease, box-shadow 200ms ease;
303
+ }
304
+ .stage:not([data-presence='idle']) .presence-dot {
305
+ background: var(--luzia-accent);
306
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--luzia-accent) 22%, transparent);
307
+ animation: luzia-pulse 1.2s ease-in-out infinite;
308
+ }
309
+ .stage:not([data-presence='idle']) .presence-text { color: var(--luzia-text); }
310
+ @keyframes luzia-pulse {
311
+ 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--luzia-accent) 8%, transparent); }
312
+ }
266
313
  @media (prefers-reduced-motion: reduce) {
314
+ .avatar img, .avatar svg { transition: filter 0.2s ease; transform: none !important; }
267
315
  .stage[data-speaking] .avatar img,
268
- .stage[data-speaking] .avatar svg { animation: none; }
316
+ .stage[data-speaking] .avatar svg,
317
+ .stage[data-greeting] .avatar img,
318
+ .stage[data-greeting] .avatar svg,
319
+ .stage:not([data-presence='idle']) .presence-dot { animation: none; }
320
+ /* A moving mouth is motion too: the still picture stays. */
321
+ .stage[data-talking] .avatar .speaking { opacity: 0; }
322
+ .stage[data-talking] .avatar:has(.speaking) .still { opacity: 1; }
269
323
  }
270
324
  .title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
271
325
  .new-conversation,
@@ -346,11 +400,11 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
346
400
  display: flex;
347
401
  flex-direction: column;
348
402
  gap: 0.375rem;
349
- padding: 1rem 1rem 0.75rem;
403
+ /* Room at the top for luzIA's name tag, which sits on the divider line. */
404
+ padding: 1.5rem 1rem 0.75rem;
350
405
  overflow-y: auto;
351
406
  }
352
- .body,
353
- .speech-text {
407
+ .body {
354
408
  scrollbar-width: thin;
355
409
  scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;
356
410
  }
@@ -373,17 +427,37 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
373
427
  background: var(--luzia-muted);
374
428
  transform-origin: bottom left;
375
429
  }
430
+ /* Before her reply starts, luzIA thinks in her own message: three dots that rise in turn. */
431
+ .message[data-thinking] {
432
+ display: flex;
433
+ gap: 0.3rem;
434
+ padding-block: 0.85rem;
435
+ }
436
+ .message[data-thinking] .dot {
437
+ width: 0.4rem;
438
+ height: 0.4rem;
439
+ border-radius: 50%;
440
+ background: color-mix(in srgb, var(--luzia-text) 45%, transparent);
441
+ animation: luzia-think 1.1s ease-in-out infinite;
442
+ }
443
+ .message[data-thinking] .dot:nth-child(2) { animation-delay: 160ms; }
444
+ .message[data-thinking] .dot:nth-child(3) { animation-delay: 320ms; }
445
+ @keyframes luzia-think {
446
+ 0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
447
+ 30% { transform: translateY(-3px); opacity: 1; }
448
+ }
449
+ @media (prefers-reduced-motion: reduce) {
450
+ .message[data-thinking] .dot { animation: luzia-fade 1.1s ease-in-out infinite alternate; }
451
+ }
376
452
  /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */
377
- .message a,
378
- .speech-text a {
453
+ .message a {
379
454
  color: inherit;
380
455
  text-decoration: underline;
381
456
  text-decoration-thickness: 1px;
382
457
  text-underline-offset: 0.15em;
383
458
  border-radius: 0.125rem;
384
459
  }
385
- .message a:hover,
386
- .speech-text a:hover { text-decoration-thickness: 2px; }
460
+ .message a:hover { text-decoration-thickness: 2px; }
387
461
  .message a:focus-visible {
388
462
  outline: 2px solid var(--luzia-accent);
389
463
  outline-offset: 1px;
@@ -409,7 +483,7 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
409
483
  .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }
410
484
  .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }
411
485
  /* Each new message rises into place once. */
412
- .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
486
+ .greeting, .message { animation: luzia-rise 260ms var(--luzia-ease-out); }
413
487
  @keyframes luzia-rise {
414
488
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
415
489
  }
@@ -449,7 +523,7 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
449
523
  }
450
524
  .suggestion:active { transform: scale(0.97); }
451
525
  @media (prefers-reduced-motion: reduce) {
452
- .message, .suggestions li { animation-name: luzia-fade; }
526
+ .greeting, .message, .suggestions li { animation-name: luzia-fade; }
453
527
  .suggestion:active { transform: none; }
454
528
  }
455
529
  .alert {
@@ -534,9 +608,8 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
534
608
  @supports (height: 100dvh) {
535
609
  .panel { height: var(--luzia-viewport-height, 100dvh); }
536
610
  }
537
- /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */
538
- :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }
539
- :host([data-keyboard]) .speech-text { max-height: 4.5rem; }
611
+ /* With the keyboard open there is little room: a smaller picture keeps the last messages in view. */
612
+ :host([data-keyboard]) .stage { --luzia-avatar-height: 4.5rem; }
540
613
  /* Inline, the chat stays in the page but never taller than the screen. */
541
614
  :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }
542
615
  .composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
@@ -544,13 +617,13 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
544
617
  /* Below 16px, mobile browsers zoom the page when the text box gets focus. */
545
618
  .composer textarea { font-size: 16px; }
546
619
  }
547
- `;var k="luzia-widget",X=typeof HTMLElement>"u"?class{}:HTMLElement;function y(r=null){return(document.documentElement.lang||navigator.language||"en").toLowerCase().startsWith("es")?`\xA1Hola! Soy luzIA, una IA que responde preguntas sobre ${r??"la persona de este portfolio"}: su experiencia, sus proyectos y lo que busca. \xBFQu\xE9 te gustar\xEDa saber?`:`Hi! I\u2019m luzIA, an AI agent that answers questions about ${r??"the person behind this portfolio"}: their experience, their projects and what they\u2019re looking for. What would you like to know?`}var ee=1500;function te(r){return fetch(r,{headers:{accept:"application/json"}}).then(async e=>{if(!e.ok)return null;let t=await e.json();return typeof t.owner?.name=="string"&&t.owner.name.trim()?t.owner.name.trim():null}).catch(()=>null)}var re=500,w="Ask luzIA about me",x=`<svg viewBox="0 0 32 32" width="100%" height="100%" focusable="false">
620
+ `;var k="luzia-widget",X=typeof HTMLElement>"u"?class{}:HTMLElement;function v(n=null){return(document.documentElement.lang||navigator.language||"en").toLowerCase().startsWith("es")?`\xA1Hola! Soy luzIA, una IA que responde preguntas sobre ${n??"la persona de este portfolio"}: su experiencia, sus proyectos y lo que busca. \xBFQu\xE9 te gustar\xEDa saber?`:`Hi! I\u2019m luzIA, an AI agent that answers questions about ${n??"the person behind this portfolio"}: their experience, their projects and what they\u2019re looking for. What would you like to know?`}var Z=1500;function ee(n){return fetch(n,{headers:{accept:"application/json"}}).then(async e=>{if(!e.ok)return null;let t=await e.json();return typeof t.owner?.name=="string"&&t.owner.name.trim()?t.owner.name.trim():null}).catch(()=>null)}var te=4e3,ne=25e3,ie='<span class="dot" aria-hidden="true"></span>'.repeat(3),ae=1400;function re(n){let e=(document.documentElement.lang||navigator.language||"en").toLowerCase().startsWith("es");return{idle:["En l\xEDnea","Online"],listening:["Escuchando\u2026","Listening\u2026"],thinking:["Pensando\u2026","Thinking\u2026"],replying:["Respondiendo\u2026","Replying\u2026"]}[n][e?0:1]}var w="Ask luzIA about me",y=`<svg viewBox="0 0 32 32" width="100%" height="100%" focusable="false">
548
621
  <circle cx="16" cy="16" r="16" fill="var(--luzia-accent-contrast)" />
549
622
  <path d="M16 6l2.6 6.4L25 15l-6.4 2.6L16 24l-2.6-6.4L7 15l6.4-2.6z" fill="var(--luzia-accent)" />
550
- </svg>`,ie=`
623
+ </svg>`,se=`
551
624
  <section class="panel" role="dialog" aria-label="luzIA" hidden>
552
625
  <header class="header">
553
- <span class="header-icon" aria-hidden="true">${x}</span>
626
+ <span class="header-icon" aria-hidden="true">${y}</span>
554
627
  <h2 class="title">luzIA</h2>
555
628
  <button type="button" class="new-conversation" aria-label="Restart conversation">
556
629
  <svg viewBox="0 0 24 24" width="20" height="20" focusable="false" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -565,9 +638,9 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
565
638
  </svg>
566
639
  </button>
567
640
  </header>
568
- <div class="stage">
569
- <span class="avatar" aria-hidden="true"></span>
570
- <p class="speech" aria-hidden="true" hidden><span class="speech-text"></span></p>
641
+ <div class="stage" aria-hidden="true">
642
+ <span class="avatar"></span>
643
+ <span class="presence"><span class="presence-dot"></span><span class="presence-text"></span></span>
571
644
  </div>
572
645
  <div class="body">
573
646
  <p class="greeting" hidden></p>
@@ -586,7 +659,9 @@ var N="conversation_limit_reached",$="message_too_long";function E(r){return r.c
586
659
  </form>
587
660
  </section>
588
661
  <button type="button" class="bubble" aria-label="${w}" aria-expanded="false">
589
- <span class="bubble-icon" aria-hidden="true">${x}</span>
662
+ <span class="peek" aria-hidden="true"></span>
663
+ <span class="bubble-icon" aria-hidden="true">${y}</span>
590
664
  <span class="bubble-label" aria-hidden="true"><span class="bubble-text">${w}</span></span>
591
665
  </button>
592
- `,m=class extends X{conversation=new h({endpoint:()=>this.endpoint});#e=null;get endpoint(){return this.getAttribute("endpoint")??""}set endpoint(e){this.setAttribute("endpoint",e)}get contact(){return this.getAttribute("contact")??""}set contact(e){this.setAttribute("contact",e)}get greeting(){return this.getAttribute("greeting")??y()}set greeting(e){this.setAttribute("greeting",e)}get suggestedQuestions(){return ne(this.getAttribute("suggested-questions"))}set suggestedQuestions(e){this.setAttribute("suggested-questions",JSON.stringify(e))}get mode(){return this.getAttribute("mode")==="inline"?"inline":"bubble"}set mode(e){this.setAttribute("mode",e)}get theme(){let e=this.getAttribute("theme");return e==="dark"||e==="auto"?e:"light"}set theme(e){this.setAttribute("theme",e)}get avatar(){return this.getAttribute("avatar")??""}set avatar(e){this.setAttribute("avatar",e)}get bubbleLabel(){return this.getAttribute("bubble-label")?.trim()||w}set bubbleLabel(e){this.setAttribute("bubble-label",e)}static get observedAttributes(){return["greeting","suggested-questions","mode","avatar","bubble-label"]}connectedCallback(){if(this.#e)return;let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>${_}</style>${ie}`,O(this.conversation,W(this.endpoint));let t=null,i=()=>this.hasAttribute("greeting")||!this.endpoint?null:(t??=te(this.endpoint),t);this.#e=new z(e,this.conversation,()=>this.contact,i),this.#e.configure(this),i()}attributeChangedCallback(){this.#e?.configure(this)}};function ne(r){if(!r)return[];let e;try{e=JSON.parse(r)}catch{return[]}return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):[]}var z=class{#e;#n;#g;#t;#m;#r;#f;#s;#d;#a=null;#o="";#c;#C=null;#k=!1;#l;#v=!1;#L=!1;#h;#E;#y;#M;#w;#i;#I;#u;#R;#x="bubble";#b=new WeakMap;#H=!1;#S;#A=null;constructor(e,t,i,n=()=>null){this.#S=n,this.#u=t,this.#c=e.host,this.#R=i,this.#e=e.querySelector(".bubble"),this.#n=e.querySelector(".panel"),this.#g=e.querySelector(".close"),this.#t=e.querySelector(".body"),this.#m=e.querySelector(".greeting"),this.#r=e.querySelector(".avatar"),this.#f=e.querySelector(".stage"),this.#s=e.querySelector(".speech"),this.#d=e.querySelector(".speech-text"),this.#s.addEventListener("mouseenter",()=>{this.#v=!0,this.#L=!0,clearTimeout(this.#l),this.#l=void 0,this.#s.classList.remove("leaving")}),this.#s.addEventListener("mouseleave",()=>{this.#v=!1,this.#p(this.#u.state)}),this.#h=e.querySelector(".messages"),this.#E=e.querySelector(".announcer"),this.#y=e.querySelector(".suggestions"),this.#M=e.querySelector(".alert"),this.#w=e.querySelector(".composer"),this.#i=this.#w.querySelector("textarea"),this.#I=this.#w.querySelector("button"),this.#e.addEventListener("click",()=>this.#T(this.#e.getAttribute("aria-expanded")!=="true")),this.#g.addEventListener("click",()=>this.#T(!1)),this.#n.addEventListener("keydown",s=>{s.key==="Escape"&&this.#x==="bubble"&&!s.isComposing&&(s.preventDefault(),this.#T(!1))}),e.querySelector(".new-conversation").addEventListener("click",()=>{t.reset(),this.#k=!1,this.#_(),this.#i.focus()}),this.#w.addEventListener("submit",s=>{s.preventDefault(),this.#q()}),this.#i.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&!s.isComposing&&(s.preventDefault(),this.#q())}),t.subscribe(s=>this.#p(s)),this.#p(t.state)}configure(e){this.#V(e.avatar.trim()),this.#e.setAttribute("aria-label",e.bubbleLabel),this.#e.querySelector(".bubble-text").textContent=e.bubbleLabel,this.#o=this.#A&&this.#S()?y(this.#A):e.greeting.trim(),this.#m.textContent=this.#o,this.#y.replaceChildren(...e.suggestedQuestions.map(t=>{let i=document.createElement("button");i.type="button",i.className="suggestion",i.textContent=t,i.addEventListener("click",()=>{this.#u.send(t)&&this.#i.focus()});let n=document.createElement("li");return n.append(i),n})),this.#p(this.#u.state),e.mode!==this.#x&&this.#$(e.mode)}#$(e){this.#x=e;let t=e==="inline";this.#n.setAttribute("role",t?"region":"dialog"),this.#e.hidden=t,this.#g.hidden=t,this.#W(t)}#T(e){this.#W(e),(e?this.#i:this.#e).focus()}#W(e){this.#n.hidden=!e,this.#e.setAttribute("aria-expanded",String(e)),e&&this.#_(),this.#C?.(),this.#C=e?this.#P():null}#P(){let e=window.visualViewport;if(!e)return null;let t=()=>{if(!(this.#x==="bubble"&&window.matchMedia("(max-width: 480px)").matches))return this.#O();this.#c.style.setProperty("--luzia-viewport-height",`${e.height}px`),this.#c.style.setProperty("--luzia-viewport-top",`${e.offsetTop}px`),this.#c.toggleAttribute("data-keyboard",e.height<window.innerHeight*.75)};return t(),e.addEventListener("resize",t),e.addEventListener("scroll",t),()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t),this.#O()}}#O(){this.#c.style.removeProperty("--luzia-viewport-height"),this.#c.style.removeProperty("--luzia-viewport-top"),this.#c.removeAttribute("data-keyboard")}#_(){if(this.#k||this.#n.hidden)return;this.#k=!0;let e=()=>{!this.#o||this.#n.hidden||this.#u.state.messages.length>0||(this.#z(),this.#a="greeting",this.#N(this.#o),this.#p(this.#u.state))},t=this.#S();if(!t)return e();let i=new Promise(n=>setTimeout(()=>n(null),ee));Promise.race([t,i]).then(n=>{n&&(this.#A=n,this.#o=y(n),this.#m.textContent=this.#o),e()})}#V(e){let t=this.#r.querySelector("img")?.getAttribute("src")??null;if(!(e&&t===e)&&!(!e&&t===null&&this.#r.firstChild))if(e){let i=document.createElement("img");i.src=e,i.alt="",this.#r.replaceChildren(i)}else this.#r.innerHTML=x}#q(){let e=this.#i.value;this.#u.send(e)&&(this.#i.value="",this.#i.focus())}#B(e,t){let i=this.#H&&!t;if(this.#H=t,(t||e.messages.length===0)&&(this.#E.textContent=""),!i)return;let n=e.messages.at(-1);this.#E.textContent=e.status==="idle"&&n?.role==="assistant"?n.content:""}#j(e,t){let i=e.messages.length-1,n=e.messages[i]?.role==="assistant";if(t&&n)this.#a!==i&&this.#z(),this.#a=i,clearTimeout(this.#l),this.#N(e.messages[i].content);else if(this.#a!==null){let s=this.#a==="greeting";if(!(s?e.messages.length===0:this.#a===i&&e.status==="idle"))this.#z();else if(this.#l===void 0&&!this.#v){let l=s?this.#o:e.messages[i].content,a=this.#L?re:Math.min(1e4,4e3+l.length*40);this.#l=setTimeout(()=>this.#F(),a)}}[...this.#h.children].forEach((s,o)=>{s.hidden=o===this.#a}),this.#m.hidden=!this.#o||this.#a==="greeting"}#N(e){this.#s.classList.remove("leaving"),this.#s.hidden=e==="",this.#f.toggleAttribute("data-saying",!this.#s.hidden),this.#b.get(this.#d)!==e&&(this.#b.set(this.#d,e),v(this.#d,e,{focusable:!1}))}#F(){this.#s.classList.add("leaving"),this.#l=setTimeout(()=>{this.#z(),this.#p(this.#u.state)},400)}#z(){clearTimeout(this.#l),this.#l=void 0,this.#a=null,this.#s.hidden=!0,this.#v=!1,this.#L=!1,this.#f.removeAttribute("data-saying"),this.#d.scrollTop=0,this.#s.classList.remove("leaving"),this.#d.textContent="",this.#b.delete(this.#d)}#p(e){for(e.messages.forEach((s,o)=>{let l=this.#h.children[o],a=l;(!a||a.dataset.role!==s.role)&&(a=document.createElement("li"),a.className="message",a.dataset.role=s.role,l?l.replaceWith(a):this.#h.append(a)),this.#b.get(a)!==s.content&&(this.#b.set(a,s.content),s.role==="assistant"?v(a,s.content):a.textContent=s.content)});this.#h.children.length>e.messages.length;)this.#h.lastElementChild?.remove();this.#y.hidden=e.messages.length>0||this.#y.children.length===0;let t=e.status==="streaming";this.#j(e,t),this.#t.scrollTop=this.#t.scrollHeight,this.#f.toggleAttribute("data-speaking",t),this.#h.setAttribute("aria-busy",String(t)),this.#B(e,t);let i=e.status==="error"&&e.error?E(e.error):null;S(this.#M,i,this.#R());let n=i==="limit";this.#i.disabled=n,this.#I.disabled=t||n,e.unsent!==null&&!n&&!this.#i.value&&(this.#i.value=e.unsent)}};function q(){customElements.get(k)||customElements.define(k,m)}q();export{h as Conversation,k as LUZIA_WIDGET_TAG,u as LuziaRequestError,m as LuziaWidgetElement,q as defineLuziaWidget};
666
+ `,m=class extends X{conversation=new h({endpoint:()=>this.endpoint});#e=null;get endpoint(){return this.getAttribute("endpoint")??""}set endpoint(e){this.setAttribute("endpoint",e)}get contact(){return this.getAttribute("contact")??""}set contact(e){this.setAttribute("contact",e)}get greeting(){return this.getAttribute("greeting")??v()}set greeting(e){this.setAttribute("greeting",e)}get suggestedQuestions(){return oe(this.getAttribute("suggested-questions"))}set suggestedQuestions(e){this.setAttribute("suggested-questions",JSON.stringify(e))}get mode(){return this.getAttribute("mode")==="inline"?"inline":"bubble"}set mode(e){this.setAttribute("mode",e)}get theme(){let e=this.getAttribute("theme");return e==="dark"||e==="auto"?e:"light"}set theme(e){this.setAttribute("theme",e)}get avatar(){return this.getAttribute("avatar")??""}set avatar(e){this.setAttribute("avatar",e)}get avatarSpeaking(){return this.getAttribute("avatar-speaking")??""}set avatarSpeaking(e){this.setAttribute("avatar-speaking",e)}get avatarWaving(){return this.getAttribute("avatar-waving")??""}set avatarWaving(e){this.setAttribute("avatar-waving",e)}get bubbleLabel(){return this.getAttribute("bubble-label")?.trim()||w}set bubbleLabel(e){this.setAttribute("bubble-label",e)}static get observedAttributes(){return["greeting","suggested-questions","mode","avatar","avatar-speaking","avatar-waving","bubble-label"]}connectedCallback(){if(this.#e)return;let e=this.attachShadow({mode:"open"});e.innerHTML=`<style>${_}</style>${se}`,O(this.conversation,R(this.endpoint));let t=null,i=()=>this.hasAttribute("greeting")||!this.endpoint?null:(t??=ee(this.endpoint),t);this.#e=new x(e,this.conversation,()=>this.contact,i),this.#e.configure(this),i()}attributeChangedCallback(){this.#e?.configure(this)}};function oe(n){if(!n)return[];let e;try{e=JSON.parse(n)}catch{return[]}return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(Boolean):[]}var x=class{#e;#a;#l;#n;#d;#i;#r;#v;#h;#m;#q=0;#u="";#w=!1;#y;#s;#T=null;#x=!1;#c;#k;#p;#S;#b;#t;#C;#o;#M;#g="bubble";#I=new WeakMap;#W=!1;#z;#L=null;constructor(e,t,i,a=()=>null){this.#z=a,this.#o=t,this.#s=e.host,this.#M=i,this.#e=e.querySelector(".bubble"),this.#a=e.querySelector(".panel"),this.#l=e.querySelector(".close"),this.#n=e.querySelector(".body"),this.#d=e.querySelector(".greeting"),this.#i=e.querySelector(".avatar"),this.#r=e.querySelector(".stage"),this.#v=e.querySelector(".presence-text"),this.#h=e.querySelector(".peek"),this.#c=e.querySelector(".messages"),this.#k=e.querySelector(".announcer"),this.#p=e.querySelector(".suggestions"),this.#S=e.querySelector(".alert"),this.#b=e.querySelector(".composer"),this.#t=this.#b.querySelector("textarea"),this.#C=this.#b.querySelector("button"),this.#e.addEventListener("click",()=>this.#A(this.#e.getAttribute("aria-expanded")!=="true")),this.#l.addEventListener("click",()=>this.#A(!1)),this.#a.addEventListener("keydown",s=>{s.key==="Escape"&&this.#g==="bubble"&&!s.isComposing&&(s.preventDefault(),this.#A(!1))}),e.querySelector(".new-conversation").addEventListener("click",()=>{t.reset(),this.#x=!1,this.#w=!1,this.#_(),this.#t.focus()}),this.#b.addEventListener("submit",s=>{s.preventDefault(),this.#H()}),this.#t.addEventListener("input",()=>this.#E(this.#o.state)),this.#t.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&!s.isComposing&&(s.preventDefault(),this.#H())});let r=setInterval(()=>{this.#s.isConnected?this.#$():clearInterval(r)},ne);t.subscribe(s=>this.#f(s)),this.#f(t.state)}configure(e){this.#V(e.avatar.trim(),e.avatarSpeaking.trim()),this.#B(e.avatarWaving.trim()),this.#e.setAttribute("aria-label",e.bubbleLabel),this.#e.querySelector(".bubble-text").textContent=e.bubbleLabel,this.#u=this.#L&&this.#z()?v(this.#L):e.greeting.trim(),this.#d.textContent=this.#u,this.#p.replaceChildren(...e.suggestedQuestions.map(t=>{let i=document.createElement("button");i.type="button",i.className="suggestion",i.textContent=t,i.addEventListener("click",()=>{this.#o.send(t)&&this.#t.focus()});let a=document.createElement("li");return a.append(i),a})),this.#f(this.#o.state),e.mode!==this.#g&&this.#N(e.mode)}#N(e){this.#g=e;let t=e==="inline";this.#a.setAttribute("role",t?"region":"dialog"),this.#e.hidden=t,this.#l.hidden=t,this.#R(t)}#A(e){this.#R(e),(e?this.#t:this.#e).focus()}#$(){let e=!this.#a.hidden,t=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,i=this.#h.firstElementChild,a=i?.dataset.waves;this.#g!=="bubble"||e||document.hidden||t||!i||!a||i.hasAttribute("data-broken")||(i.src=`${a.split("#")[0]}#peek-${++this.#q}`,this.#e.toggleAttribute("data-peeking",!0),clearTimeout(this.#m),this.#m=setTimeout(()=>this.#e.removeAttribute("data-peeking"),te))}#R(e){e&&(clearTimeout(this.#m),this.#e.removeAttribute("data-peeking")),this.#a.hidden=!e,this.#e.setAttribute("aria-expanded",String(e)),e&&this.#_(),this.#T?.(),this.#T=e?this.#P():null}#P(){let e=window.visualViewport;if(!e)return null;let t=()=>{if(!(this.#g==="bubble"&&window.matchMedia("(max-width: 480px)").matches))return this.#O();this.#s.style.setProperty("--luzia-viewport-height",`${e.height}px`),this.#s.style.setProperty("--luzia-viewport-top",`${e.offsetTop}px`),this.#s.toggleAttribute("data-keyboard",e.height<window.innerHeight*.75)};return t(),e.addEventListener("resize",t),e.addEventListener("scroll",t),()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t),this.#O()}}#O(){this.#s.style.removeProperty("--luzia-viewport-height"),this.#s.style.removeProperty("--luzia-viewport-top"),this.#s.removeAttribute("data-keyboard")}#_(){if(this.#x||this.#a.hidden)return;this.#x=!0;let e=()=>{!this.#u||this.#a.hidden||this.#o.state.messages.length>0||(this.#w=!0,clearTimeout(this.#y),this.#r.toggleAttribute("data-greeting",!0),this.#y=setTimeout(()=>{this.#r.removeAttribute("data-greeting"),this.#E(this.#o.state)},ae),this.#f(this.#o.state))},t=this.#z();if(!t)return e();let i=new Promise(a=>setTimeout(()=>a(null),Z));Promise.race([t,i]).then(a=>{a&&(this.#L=a,this.#u=v(a),this.#d.textContent=this.#u),e()})}#V(e,t){let i=`${e}
667
+ ${e?t:""}`;if(this.#i.dataset.shown===i)return;if(this.#i.dataset.shown=i,!e){this.#i.innerHTML=y;return}let a=(r,s)=>{let l=document.createElement("img");return l.src=r,l.alt="",l.className=s,l};this.#i.replaceChildren(a(e,"still"),...t?[a(t,"speaking")]:[])}#B(e){if((this.#h.firstElementChild?.dataset.waves??"")===e)return;if(clearTimeout(this.#m),this.#e.removeAttribute("data-peeking"),!e){this.#h.replaceChildren();return}let i=document.createElement("img");i.alt="",i.className="peek-image",i.dataset.waves=e,i.addEventListener("error",()=>{i.dataset.broken="",this.#e.removeAttribute("data-peeking")}),i.src=e,this.#h.replaceChildren(i)}#H(){let e=this.#t.value;this.#o.send(e)&&(this.#t.value="",this.#t.focus())}#G(e,t){let i=this.#W&&!t;if(this.#W=t,(t||e.messages.length===0)&&(this.#k.textContent=""),!i)return;let a=e.messages.at(-1);this.#k.textContent=e.status==="idle"&&a?.role==="assistant"?a.content:""}#E(e){let t=e.messages.at(-1),i="idle";e.status==="streaming"?i=t?.role==="assistant"&&t.content?"replying":"thinking":this.#t.value.trim()&&!this.#t.disabled&&(i="listening"),this.#r.dataset.presence=i,this.#r.toggleAttribute("data-talking",i==="replying"||this.#r.hasAttribute("data-greeting"));let a=re(i);this.#v.textContent!==a&&(this.#v.textContent=a)}#f(e){for(e.messages.forEach((r,s)=>{let l=this.#c.children[s],o=l;(!o||o.dataset.role!==r.role)&&(o=document.createElement("li"),o.className="message",o.dataset.role=r.role,l?l.replaceWith(o):this.#c.append(o)),o.toggleAttribute("data-thinking",r.role==="assistant"&&r.content===""),this.#I.get(o)!==r.content&&(this.#I.set(o,r.content),r.role==="assistant"&&r.content===""?o.innerHTML=ie:r.role==="assistant"?M(o,r.content):o.textContent=r.content)});this.#c.children.length>e.messages.length;)this.#c.lastElementChild?.remove();this.#p.hidden=e.messages.length>0||this.#p.children.length===0;let t=e.status==="streaming";this.#d.hidden=!this.#u||e.messages.length===0&&!this.#w,e.messages.length>0&&this.#r.hasAttribute("data-greeting")&&(clearTimeout(this.#y),this.#r.removeAttribute("data-greeting")),this.#n.scrollTop=this.#n.scrollHeight,this.#r.toggleAttribute("data-speaking",t),this.#c.setAttribute("aria-busy",String(t)),this.#G(e,t);let i=e.status==="error"&&e.error?z(e.error):null;L(this.#S,i,this.#M());let a=i==="limit";this.#t.disabled=a,this.#C.disabled=t||a,e.unsent!==null&&!a&&!this.#t.value&&(this.#t.value=e.unsent),this.#E(e)}};function H(){customElements.get(k)||customElements.define(k,m)}H();export{h as Conversation,k as LUZIA_WIDGET_TAG,d as LuziaRequestError,m as LuziaWidgetElement,H as defineLuziaWidget};
package/dist/styles.d.ts CHANGED
@@ -9,11 +9,11 @@
9
9
  * - `--luzia-border`: input and inline-panel borders
10
10
  * - `--luzia-font`: font family
11
11
  * - `--luzia-inline-height`: height of the chat in inline mode
12
- * - `--luzia-speech-tail-top`: how far down the speech bubble's tail points (towards luzIA's mouth)
13
- * - `--luzia-avatar-size`: height of luzIA's picture at the top of the chat (default: 7rem to 13rem, by screen height)
12
+ * - `--luzia-avatar-size`: height of luzIA's picture at the top of the chat (default: 6rem to 11rem, by screen height)
13
+ * - `--luzia-peek-size`: height of the hello animation when luzIA peeks out of the closed launcher (default: 8.5rem)
14
14
  *
15
15
  * Every control is at least 44px square (a comfortable tap target) and shows
16
16
  * a focus ring for keyboard users. Below 480px wide the bubble's chat fills
17
17
  * the screen; the inline chat stays in the page at full width.
18
18
  */
19
- export declare const styles = "\n :host {\n --luzia-accent: #4f46e5;\n --luzia-accent-contrast: #ffffff;\n --luzia-surface: #ffffff;\n --luzia-text: #18181b;\n --luzia-muted: #f4f4f5;\n --luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --luzia-border: #d4d4d8;\n --luzia-inline-height: 38rem;\n --luzia-ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n /* How strongly the accent lights the top of the chat, behind luzIA. */\n --luzia-glow-strength: 22%;\n position: fixed;\n right: 1.25rem;\n bottom: 1.25rem;\n z-index: 2147483000;\n font-family: var(--luzia-font);\n color: var(--luzia-text);\n }\n :host([theme='dark']) {\n --luzia-glow-strength: 30%;\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n @media (prefers-color-scheme: dark) {\n :host([theme='auto']) {\n --luzia-glow-strength: 30%;\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n }\n [hidden] { display: none !important; }\n button { min-width: 44px; min-height: 44px; }\n button:focus-visible,\n textarea:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 2px;\n }\n /* The message box shows focus on its whole field (see .composer:focus-within). */\n .composer textarea:focus-visible { outline: none; }\n ::selection { background: color-mix(in srgb, var(--luzia-accent) 28%, transparent); }\n .message[data-role='user']::selection { background: color-mix(in srgb, var(--luzia-accent-contrast) 35%, transparent); }\n /* Read by screen readers only: each finished reply (see the element's View). */\n .announcer {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n }\n /*\n * The launcher: a pill with luzIA's icon and an invitation to ask. With the\n * chat open it folds into just the icon: the text fades and blurs out first,\n * then the pill narrows (unfolding, the pill widens first, then the text comes in).\n */\n .bubble {\n display: flex;\n align-items: center;\n height: 3.25rem;\n margin-left: auto;\n padding: 0 0.45rem;\n border: none;\n border-radius: 999px;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.95rem var(--luzia-font);\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);\n cursor: pointer;\n transition: transform 160ms ease-out, box-shadow 160ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }\n }\n .bubble:active { transform: scale(0.97); }\n .bubble-icon { display: block; width: 2.35rem; height: 2.35rem; flex: none; }\n .bubble-icon svg { display: block; }\n /* The star turns a little as the pill folds and unfolds. */\n .bubble-icon path {\n transform-box: fill-box;\n transform-origin: center;\n transition: transform 400ms var(--luzia-ease-out);\n }\n .bubble[aria-expanded='true'] .bubble-icon path { transform: rotate(90deg); }\n .bubble-label {\n display: block;\n overflow: hidden;\n max-width: 14rem;\n transition: max-width 320ms var(--luzia-ease-out);\n }\n .bubble-text {\n display: block;\n padding: 0 0.95rem 0 0.6rem;\n white-space: nowrap;\n transition: opacity 200ms ease 90ms, filter 200ms ease 90ms, transform 200ms ease-out 90ms;\n }\n .bubble[aria-expanded='true'] .bubble-label {\n max-width: 0;\n transition-delay: 60ms;\n }\n .bubble[aria-expanded='true'] .bubble-text {\n opacity: 0;\n filter: blur(3px);\n transform: translateX(-0.4rem);\n transition-duration: 140ms;\n transition-delay: 0ms;\n }\n /* Less motion: the text still fades, but nothing moves or turns. */\n @media (prefers-reduced-motion: reduce) {\n .bubble, .bubble-label, .bubble-icon path { transition: none; }\n .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }\n .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }\n }\n .panel {\n display: flex;\n flex-direction: column;\n width: min(24rem, calc(100vw - 2.5rem));\n height: min(40rem, calc(100vh - 7rem));\n margin-bottom: 0.75rem;\n /* luzIA stands in a soft light of the accent colour; it fades out before the conversation. */\n background-color: var(--luzia-surface);\n background-image: radial-gradient(19rem 12rem at 6.5rem 8rem, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent 70%);\n background-repeat: no-repeat;\n border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);\n border-radius: 1.25rem;\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);\n overflow: hidden;\n }\n /* Opening grows the chat out of the launcher below it; closing is instant. */\n :host(:not([mode='inline'])) .panel {\n transform-origin: bottom right;\n transition: opacity 200ms ease-out, transform 240ms var(--luzia-ease-out);\n @starting-style {\n opacity: 0;\n transform: translateY(8px) scale(0.97);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n :host(:not([mode='inline'])) .panel {\n transition: opacity 150ms ease;\n @starting-style { transform: none; }\n }\n }\n :host([mode='inline']) {\n position: static;\n display: block;\n z-index: auto;\n }\n :host([mode='inline']) .panel {\n position: static;\n width: 100%;\n height: var(--luzia-inline-height);\n margin: 0;\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);\n }\n /* Quiet: luzIA's mark and name, then two icon buttons. The light below carries the colour. */\n .header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.375rem 0.375rem 0 0.875rem;\n color: var(--luzia-text);\n }\n .header-icon { display: block; width: 1.5rem; height: 1.5rem; flex: none; }\n .header-icon svg { display: block; }\n .header-icon circle { fill: var(--luzia-accent); }\n .header-icon path { fill: var(--luzia-accent-contrast); }\n /* Like a video call: luzIA's whole picture large and centred at the top, the conversation below it. */\n .stage {\n flex: none;\n display: flex;\n justify-content: flex-start;\n gap: 0.75rem;\n padding: 0.25rem 1rem 0;\n border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);\n }\n /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */\n .avatar {\n display: block;\n height: var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem));\n }\n .avatar img,\n .avatar svg {\n display: block;\n height: 100%;\n width: auto;\n max-width: 100%;\n object-fit: contain;\n transition: filter 0.2s ease;\n }\n .avatar svg { aspect-ratio: 1; margin-bottom: 0.75rem; height: calc(100% - 0.75rem); }\n /* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */\n .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }\n /* luzIA stays on the left; her speech bubble appears on the right without moving her. */\n .speech {\n position: relative;\n flex: 1;\n align-self: flex-start;\n min-width: 0;\n margin: 0.75rem 0 0;\n padding: 0.6rem 0.8rem;\n border: 1px solid var(--luzia-border);\n border-radius: 1rem;\n background: var(--luzia-surface);\n color: var(--luzia-text);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 24px -10px rgb(0 0 0 / 0.25);\n font-size: 0.875rem;\n line-height: 1.45;\n opacity: 1;\n transition: opacity 0.4s ease;\n }\n .speech-text {\n display: block;\n max-height: calc(var(--luzia-avatar-size, clamp(7rem, 30vh, 13rem)) - 2.75rem);\n /* Long replies scroll inside the bubble, so their beginning can be read. */\n overflow-y: auto;\n overscroll-behavior: contain;\n padding-inline-end: 0.25rem;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n /* The tail points back at luzIA's mouth (tune its height with --luzia-speech-tail-top). */\n .speech::before,\n .speech::after {\n content: '';\n position: absolute;\n border-block-style: solid;\n border-block-color: transparent;\n border-inline-end-style: solid;\n }\n .speech::before {\n top: var(--luzia-speech-tail-top, 1.6rem);\n left: -0.6rem;\n border-block-width: 0.45rem;\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-border);\n }\n .speech::after {\n top: calc(var(--luzia-speech-tail-top, 1.6rem) + 1px);\n left: calc(-0.6rem + 1.5px);\n border-block-width: calc(0.45rem - 1px);\n border-inline-end-width: 0.6rem;\n border-inline-end-color: var(--luzia-surface);\n }\n .speech.leaving { opacity: 0; }\n @media (prefers-reduced-motion: reduce) {\n .speech { transition: none; }\n }\n /* While a reply streams in, a soft glow follows the picture's outline. */\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg {\n filter: drop-shadow(0 0 6px var(--luzia-accent));\n animation: luzia-speaking 1.4s ease-in-out infinite;\n }\n @keyframes luzia-speaking {\n 50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }\n }\n @media (prefers-reduced-motion: reduce) {\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg { animation: none; }\n }\n .title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }\n .new-conversation,\n .close {\n color: color-mix(in srgb, var(--luzia-text) 65%, transparent);\n }\n /* Restart: a circular arrow, named by a tooltip on hover or keyboard focus. */\n .new-conversation {\n position: relative;\n display: grid;\n place-items: center;\n margin-inline: auto 0.25rem;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .new-conversation svg { display: block; transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1); }\n .new-conversation:active { transform: scale(0.94); }\n .tooltip {\n position: absolute;\n top: calc(100% + 0.4rem);\n right: 0;\n z-index: 1;\n padding: 0.35rem 0.6rem;\n border-radius: 0.375rem;\n background: var(--luzia-text);\n color: var(--luzia-surface);\n font: 500 0.75rem var(--luzia-font);\n white-space: nowrap;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);\n pointer-events: none;\n opacity: 0;\n transform: translateY(-2px) scale(0.97);\n transform-origin: top right;\n /* Leaving: quick, with no wait. */\n transition: opacity 100ms ease-out, transform 100ms ease-out;\n }\n /* Appearing: after a short pause, so passing over the button does not flash it. */\n .new-conversation:focus-visible .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out, transform 125ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .new-conversation:hover,\n .close:hover { background-color: color-mix(in srgb, var(--luzia-text) 8%, transparent); color: var(--luzia-text); }\n /* The arrow winds back a little, hinting at what it does. */\n .new-conversation:hover svg { transform: rotate(-45deg); }\n .new-conversation:hover .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out 350ms, transform 125ms ease-out 350ms;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .tooltip, .new-conversation:active, .new-conversation svg { transform: none !important; }\n }\n .close {\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .close svg { display: block; }\n .close:active { transform: scale(0.94); }\n @media (prefers-reduced-motion: reduce) {\n .close:active { transform: none; }\n }\n .body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n padding: 1rem 1rem 0.75rem;\n overflow-y: auto;\n }\n .body,\n .speech-text {\n scrollbar-width: thin;\n scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;\n }\n /* Messages: soft, with the corner nearest the speaker drawn in, like a tail. */\n .greeting,\n .message {\n max-width: 85%;\n margin: 0;\n padding: 0.55rem 0.875rem;\n border-radius: 1.125rem;\n font-size: 0.9375rem;\n line-height: 1.45;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n .greeting,\n .message[data-role='assistant'] {\n align-self: flex-start;\n border-bottom-left-radius: 0.375rem;\n background: var(--luzia-muted);\n transform-origin: bottom left;\n }\n /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */\n .message a,\n .speech-text a {\n color: inherit;\n text-decoration: underline;\n text-decoration-thickness: 1px;\n text-underline-offset: 0.15em;\n border-radius: 0.125rem;\n }\n .message a:hover,\n .speech-text a:hover { text-decoration-thickness: 2px; }\n .message a:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 1px;\n }\n .messages {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n }\n .message[data-role='user'] {\n align-self: flex-end;\n border-bottom-right-radius: 0.375rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--luzia-accent) 80%, transparent);\n transform-origin: bottom right;\n }\n /* A little more room where the speaker changes. */\n .message[data-role='assistant'] + .message[data-role='user'],\n .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }\n .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }\n /* Each new message rises into place once. */\n .message { animation: luzia-rise 260ms var(--luzia-ease-out); }\n @keyframes luzia-rise {\n from { opacity: 0; transform: translateY(6px) scale(0.98); }\n }\n @keyframes luzia-fade {\n from { opacity: 0; }\n }\n .suggestions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n margin: auto 0 0;\n padding: 0;\n list-style: none;\n }\n /* Questions the Visitor could ask, tinted with the accent; they arrive one after another. */\n .suggestions li { animation: luzia-rise 320ms var(--luzia-ease-out) both; transform-origin: bottom right; }\n .suggestions li:nth-child(2) { animation-delay: 50ms; }\n .suggestions li:nth-child(3) { animation-delay: 100ms; }\n .suggestions li:nth-child(n + 4) { animation-delay: 150ms; }\n .suggestion {\n padding: 0.5rem 0.9rem;\n border: 1px solid color-mix(in srgb, var(--luzia-accent) 24%, transparent);\n border-radius: 999px;\n background: color-mix(in srgb, var(--luzia-accent) 7%, var(--luzia-surface));\n color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-text));\n font: 500 0.875rem/1.3 var(--luzia-font);\n text-align: left;\n cursor: pointer;\n transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .suggestion:hover {\n border-color: color-mix(in srgb, var(--luzia-accent) 45%, transparent);\n background: color-mix(in srgb, var(--luzia-accent) 13%, var(--luzia-surface));\n }\n }\n .suggestion:active { transform: scale(0.97); }\n @media (prefers-reduced-motion: reduce) {\n .message, .suggestions li { animation-name: luzia-fade; }\n .suggestion:active { transform: none; }\n }\n .alert {\n margin: 0 1rem 0.5rem;\n font-size: 0.875rem;\n color: #b91c1c;\n }\n .alert a {\n color: inherit;\n }\n /* One rounded field: the message box with a round Send button inside it. */\n .composer {\n display: flex;\n align-items: flex-end;\n gap: 0.375rem;\n margin: 0 0.75rem 0.75rem;\n padding: 0.25rem 0.25rem 0.25rem 1rem;\n border: 1px solid var(--luzia-border);\n border-radius: 1.5rem;\n background: var(--luzia-surface);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);\n transition: border-color 150ms ease, box-shadow 150ms ease;\n }\n .composer:focus-within {\n border-color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-border));\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--luzia-accent) 16%, transparent);\n }\n .composer textarea {\n flex: 1;\n box-sizing: border-box;\n min-height: 2.75rem;\n max-height: 8rem;\n resize: none;\n padding: 0.7rem 0;\n border: none;\n background: transparent;\n color: var(--luzia-text);\n caret-color: var(--luzia-accent);\n font: inherit;\n font-size: 0.9375rem;\n line-height: 1.4;\n /* Grows with what is typed, where supported. */\n field-sizing: content;\n }\n .composer textarea::placeholder { color: color-mix(in srgb, var(--luzia-text) 55%, transparent); }\n .composer textarea:disabled { cursor: not-allowed; }\n .send {\n display: grid;\n place-items: center;\n flex: none;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n cursor: pointer;\n transition: background-color 150ms ease, opacity 150ms ease, transform 160ms ease-out;\n }\n .send svg { display: block; }\n @media (hover: hover) and (pointer: fine) {\n .send:not(:disabled):hover { background: color-mix(in srgb, var(--luzia-accent) 86%, #000); }\n }\n .send:not(:disabled):active { transform: scale(0.94); }\n .send:disabled { opacity: 0.35; cursor: default; }\n @media (prefers-reduced-motion: reduce) {\n .send:not(:disabled):active { transform: none; }\n }\n @media (max-width: 480px) {\n /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */\n .panel {\n position: fixed;\n top: var(--luzia-viewport-top, 0px);\n left: 0;\n width: 100vw;\n height: var(--luzia-viewport-height, 100vh);\n margin: 0;\n border: none;\n border-radius: 0;\n }\n @supports (height: 100dvh) {\n .panel { height: var(--luzia-viewport-height, 100dvh); }\n }\n /* With the keyboard open there is little room: a smaller picture keeps the speech bubble and the last messages in view. */\n :host([data-keyboard]) .avatar { height: min(var(--luzia-avatar-size, 6rem), 6rem); }\n :host([data-keyboard]) .speech-text { max-height: 4.5rem; }\n /* Inline, the chat stays in the page but never taller than the screen. */\n :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }\n .composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }\n :host(:not([mode='inline'])) .panel { transform-origin: bottom center; }\n /* Below 16px, mobile browsers zoom the page when the text box gets focus. */\n .composer textarea { font-size: 16px; }\n }\n";
19
+ export declare const styles = "\n :host {\n --luzia-accent: #4f46e5;\n --luzia-accent-contrast: #ffffff;\n --luzia-surface: #ffffff;\n --luzia-text: #18181b;\n --luzia-muted: #f4f4f5;\n --luzia-font: system-ui, -apple-system, 'Segoe UI', sans-serif;\n --luzia-border: #d4d4d8;\n --luzia-inline-height: 38rem;\n --luzia-ease-out: cubic-bezier(0.23, 1, 0.32, 1);\n /* How strongly the accent lights the top of the chat, behind luzIA. */\n --luzia-glow-strength: 22%;\n position: fixed;\n right: 1.25rem;\n bottom: 1.25rem;\n z-index: 2147483000;\n font-family: var(--luzia-font);\n color: var(--luzia-text);\n }\n :host([theme='dark']) {\n --luzia-glow-strength: 30%;\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n @media (prefers-color-scheme: dark) {\n :host([theme='auto']) {\n --luzia-glow-strength: 30%;\n --luzia-surface: #18181b;\n --luzia-text: #f4f4f5;\n --luzia-muted: #27272a;\n --luzia-border: #3f3f46;\n }\n }\n [hidden] { display: none !important; }\n button { min-width: 44px; min-height: 44px; }\n button:focus-visible,\n textarea:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 2px;\n }\n /* The message box shows focus on its whole field (see .composer:focus-within). */\n .composer textarea:focus-visible { outline: none; }\n ::selection { background: color-mix(in srgb, var(--luzia-accent) 28%, transparent); }\n .message[data-role='user']::selection { background: color-mix(in srgb, var(--luzia-accent-contrast) 35%, transparent); }\n /* Read by screen readers only: each finished reply (see the element's View). */\n .announcer {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n }\n /*\n * The launcher: a pill with luzIA's icon and an invitation to ask. With the\n * chat open it folds into just the icon: the text fades and blurs out first,\n * then the pill narrows (unfolding, the pill widens first, then the text comes in).\n */\n .bubble {\n display: flex;\n align-items: center;\n height: 3.25rem;\n margin-left: auto;\n padding: 0 0.45rem;\n border: none;\n border-radius: 999px;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n font: 600 0.95rem var(--luzia-font);\n box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);\n cursor: pointer;\n transition: transform 160ms ease-out, box-shadow 160ms ease-out;\n position: relative;\n }\n /*\n * With the Owner's hello animation, luzIA peeks out of the closed launcher\n * now and then, above its text: she rises from its top edge (clipped there,\n * as if from behind it), says hello, and ducks back down.\n */\n .peek {\n position: absolute;\n left: calc(50% + 1.15rem);\n bottom: calc(100% - 1px);\n width: 10.5rem;\n height: var(--luzia-peek-size, 8.5rem);\n transform: translateX(-50%);\n clip-path: inset(-3rem -3rem 0 -3rem);\n pointer-events: none;\n }\n .peek-image {\n display: block;\n height: 100%;\n width: 100%;\n object-fit: contain;\n object-position: 50% 100%;\n transform: translateY(105%);\n transform-origin: 50% 100%;\n filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.18));\n }\n /* The animation says hello; she only rises and ducks: half a second up, gently settling;\n half a second down, easing in and out (no sudden drop). */\n .bubble[data-peeking] .peek-image { animation: luzia-peek-rise 4s both; }\n @keyframes luzia-peek-rise {\n 0% { transform: translateY(105%); animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1); }\n 12.5%, 87.5% { transform: translateY(0); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }\n 100% { transform: translateY(105%); }\n }\n @media (hover: hover) and (pointer: fine) {\n .bubble:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }\n }\n .bubble:active { transform: scale(0.97); }\n .bubble-icon { display: block; width: 2.35rem; height: 2.35rem; flex: none; }\n .bubble-icon svg { display: block; }\n /* The star turns a little as the pill folds and unfolds. */\n .bubble-icon path {\n transform-box: fill-box;\n transform-origin: center;\n transition: transform 400ms var(--luzia-ease-out);\n }\n .bubble[aria-expanded='true'] .bubble-icon path { transform: rotate(90deg); }\n .bubble-label {\n display: block;\n overflow: hidden;\n max-width: 14rem;\n transition: max-width 320ms var(--luzia-ease-out);\n }\n .bubble-text {\n display: block;\n padding: 0 0.95rem 0 0.6rem;\n white-space: nowrap;\n transition: opacity 200ms ease 90ms, filter 200ms ease 90ms, transform 200ms ease-out 90ms;\n }\n .bubble[aria-expanded='true'] .bubble-label {\n max-width: 0;\n transition-delay: 60ms;\n }\n .bubble[aria-expanded='true'] .bubble-text {\n opacity: 0;\n filter: blur(3px);\n transform: translateX(-0.4rem);\n transition-duration: 140ms;\n transition-delay: 0ms;\n }\n /* Less motion: the text still fades, but nothing moves or turns (and luzIA doesn't peek). */\n @media (prefers-reduced-motion: reduce) {\n .peek { display: none; }\n .bubble, .bubble-label, .bubble-icon path { transition: none; }\n .bubble:hover, .bubble:active, .bubble-text, .bubble[aria-expanded='true'] .bubble-text { transform: none; }\n .bubble-text, .bubble[aria-expanded='true'] .bubble-text { filter: none; transition: opacity 150ms ease; }\n }\n .panel {\n display: flex;\n flex-direction: column;\n width: min(24rem, calc(100vw - 2.5rem));\n height: min(40rem, calc(100vh - 7rem));\n margin-bottom: 0.75rem;\n background: var(--luzia-surface);\n /* luzIA's light (.stage::before) sits behind the header and stage, above this background. */\n isolation: isolate;\n border: 1px solid color-mix(in srgb, var(--luzia-border) 70%, transparent);\n border-radius: 1.25rem;\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 24px 48px -12px rgb(0 0 0 / 0.3);\n overflow: hidden;\n }\n /* Opening grows the chat out of the launcher below it; closing is instant. */\n :host(:not([mode='inline'])) .panel {\n transform-origin: bottom right;\n transition: opacity 200ms ease-out, transform 240ms var(--luzia-ease-out);\n @starting-style {\n opacity: 0;\n transform: translateY(8px) scale(0.97);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n :host(:not([mode='inline'])) .panel {\n transition: opacity 150ms ease;\n @starting-style { transform: none; }\n }\n }\n :host([mode='inline']) {\n position: static;\n display: block;\n z-index: auto;\n }\n :host([mode='inline']) .panel {\n position: static;\n width: 100%;\n height: var(--luzia-inline-height);\n margin: 0;\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);\n }\n /* Quiet: luzIA's mark and name, then two icon buttons. The light below carries the colour. */\n .header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.375rem 0.375rem 0 0.875rem;\n color: var(--luzia-text);\n }\n .header-icon { display: block; width: 1.5rem; height: 1.5rem; flex: none; }\n .header-icon svg { display: block; }\n .header-icon circle { fill: var(--luzia-accent); }\n .header-icon path { fill: var(--luzia-accent-contrast); }\n /* Like a video call: luzIA's whole picture at the top, her state beside it like a name tag. */\n .stage {\n --luzia-avatar-height: var(--luzia-avatar-size, clamp(6rem, 26vh, 11rem));\n position: relative;\n flex: none;\n display: flex;\n justify-content: center;\n align-items: flex-end;\n padding: 0.25rem 1rem 0;\n border-bottom: 1px solid color-mix(in srgb, var(--luzia-border) 75%, transparent);\n }\n /* She stands in a soft light of the accent colour. */\n .stage::before {\n content: '';\n position: absolute;\n z-index: -1;\n left: 50%;\n bottom: -3rem;\n width: 22rem;\n height: 15rem;\n transform: translateX(-50%);\n background: radial-gradient(closest-side, color-mix(in srgb, var(--luzia-accent) var(--luzia-glow-strength), transparent), transparent);\n pointer-events: none;\n }\n /* The picture is shown whole, in its own shape (a cut-out stands on the divider line). */\n .avatar {\n display: grid;\n grid-template-rows: 100%;\n flex: none;\n height: var(--luzia-avatar-height);\n }\n /* The still picture and its talking version share one place; only one shows at a time. */\n .avatar > * { grid-area: 1 / 1; }\n .avatar .speaking { opacity: 0; }\n .stage[data-talking] .avatar .speaking { opacity: 1; }\n .stage[data-talking] .avatar:has(.speaking) .still { opacity: 0; }\n .avatar img,\n .avatar svg {\n display: block;\n height: 100%;\n width: auto;\n max-width: 100%;\n object-fit: contain;\n transform-origin: 50% 100%;\n transition: filter 0.2s ease, transform 360ms cubic-bezier(0.23, 1, 0.32, 1);\n }\n .avatar svg { aspect-ratio: 1; margin-bottom: 0.5rem; height: calc(100% - 0.5rem); }\n /* luzIA's own icon: the star on a disc lit by the accent, not a flat white circle. */\n .avatar svg circle { fill: color-mix(in srgb, var(--luzia-accent) 12%, var(--luzia-surface)); }\n /* While the Visitor types, she leans in a little, as someone listening does. */\n .stage[data-presence='listening'] .avatar img,\n .stage[data-presence='listening'] .avatar svg { transform: scale(1.025) rotate(-1deg); }\n /* Speaking (the greeting, or a reply as it streams in): a soft glow breathes along her outline. */\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg,\n .stage[data-greeting] .avatar img,\n .stage[data-greeting] .avatar svg {\n filter: drop-shadow(0 0 6px var(--luzia-accent));\n animation: luzia-speaking 1.4s ease-in-out infinite;\n }\n @keyframes luzia-speaking {\n 50% { filter: drop-shadow(0 0 14px var(--luzia-accent)); }\n }\n /* Her state, like the name tag in a video call: a dot that is lit while she is busy. */\n /* Centred under her, on the divider line, like the name tag in a video call. */\n .presence {\n position: absolute;\n z-index: 1;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n display: flex;\n align-items: center;\n gap: 0.45rem;\n max-width: calc(100% - 2rem);\n padding: 0.3rem 0.7rem 0.3rem 0.55rem;\n border-radius: 999px;\n background: var(--luzia-surface);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 0 0 1px color-mix(in srgb, var(--luzia-border) 60%, transparent);\n color: color-mix(in srgb, var(--luzia-text) 72%, transparent);\n font-size: 0.8125rem;\n font-weight: 500;\n line-height: 1.2;\n white-space: nowrap;\n }\n .presence-dot {\n flex: none;\n width: 0.5rem;\n height: 0.5rem;\n border-radius: 50%;\n background: #16a34a;\n box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 18%, transparent);\n transition: background-color 200ms ease, box-shadow 200ms ease;\n }\n .stage:not([data-presence='idle']) .presence-dot {\n background: var(--luzia-accent);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--luzia-accent) 22%, transparent);\n animation: luzia-pulse 1.2s ease-in-out infinite;\n }\n .stage:not([data-presence='idle']) .presence-text { color: var(--luzia-text); }\n @keyframes luzia-pulse {\n 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--luzia-accent) 8%, transparent); }\n }\n @media (prefers-reduced-motion: reduce) {\n .avatar img, .avatar svg { transition: filter 0.2s ease; transform: none !important; }\n .stage[data-speaking] .avatar img,\n .stage[data-speaking] .avatar svg,\n .stage[data-greeting] .avatar img,\n .stage[data-greeting] .avatar svg,\n .stage:not([data-presence='idle']) .presence-dot { animation: none; }\n /* A moving mouth is motion too: the still picture stays. */\n .stage[data-talking] .avatar .speaking { opacity: 0; }\n .stage[data-talking] .avatar:has(.speaking) .still { opacity: 1; }\n }\n .title { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }\n .new-conversation,\n .close {\n color: color-mix(in srgb, var(--luzia-text) 65%, transparent);\n }\n /* Restart: a circular arrow, named by a tooltip on hover or keyboard focus. */\n .new-conversation {\n position: relative;\n display: grid;\n place-items: center;\n margin-inline: auto 0.25rem;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .new-conversation svg { display: block; transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1); }\n .new-conversation:active { transform: scale(0.94); }\n .tooltip {\n position: absolute;\n top: calc(100% + 0.4rem);\n right: 0;\n z-index: 1;\n padding: 0.35rem 0.6rem;\n border-radius: 0.375rem;\n background: var(--luzia-text);\n color: var(--luzia-surface);\n font: 500 0.75rem var(--luzia-font);\n white-space: nowrap;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);\n pointer-events: none;\n opacity: 0;\n transform: translateY(-2px) scale(0.97);\n transform-origin: top right;\n /* Leaving: quick, with no wait. */\n transition: opacity 100ms ease-out, transform 100ms ease-out;\n }\n /* Appearing: after a short pause, so passing over the button does not flash it. */\n .new-conversation:focus-visible .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out, transform 125ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .new-conversation:hover,\n .close:hover { background-color: color-mix(in srgb, var(--luzia-text) 8%, transparent); color: var(--luzia-text); }\n /* The arrow winds back a little, hinting at what it does. */\n .new-conversation:hover svg { transform: rotate(-45deg); }\n .new-conversation:hover .tooltip {\n opacity: 1;\n transform: none;\n transition: opacity 125ms ease-out 350ms, transform 125ms ease-out 350ms;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .tooltip, .new-conversation:active, .new-conversation svg { transform: none !important; }\n }\n .close {\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n border-radius: 0.75rem;\n background: transparent;\n cursor: pointer;\n transition: background-color 150ms ease, color 150ms ease, transform 160ms ease-out;\n }\n .close svg { display: block; }\n .close:active { transform: scale(0.94); }\n @media (prefers-reduced-motion: reduce) {\n .close:active { transform: none; }\n }\n .body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n /* Room at the top for luzIA's name tag, which sits on the divider line. */\n padding: 1.5rem 1rem 0.75rem;\n overflow-y: auto;\n }\n .body {\n scrollbar-width: thin;\n scrollbar-color: color-mix(in srgb, var(--luzia-text) 22%, transparent) transparent;\n }\n /* Messages: soft, with the corner nearest the speaker drawn in, like a tail. */\n .greeting,\n .message {\n max-width: 85%;\n margin: 0;\n padding: 0.55rem 0.875rem;\n border-radius: 1.125rem;\n font-size: 0.9375rem;\n line-height: 1.45;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n .greeting,\n .message[data-role='assistant'] {\n align-self: flex-start;\n border-bottom-left-radius: 0.375rem;\n background: var(--luzia-muted);\n transform-origin: bottom left;\n }\n /* Before her reply starts, luzIA thinks in her own message: three dots that rise in turn. */\n .message[data-thinking] {\n display: flex;\n gap: 0.3rem;\n padding-block: 0.85rem;\n }\n .message[data-thinking] .dot {\n width: 0.4rem;\n height: 0.4rem;\n border-radius: 50%;\n background: color-mix(in srgb, var(--luzia-text) 45%, transparent);\n animation: luzia-think 1.1s ease-in-out infinite;\n }\n .message[data-thinking] .dot:nth-child(2) { animation-delay: 160ms; }\n .message[data-thinking] .dot:nth-child(3) { animation-delay: 320ms; }\n @keyframes luzia-think {\n 0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }\n 30% { transform: translateY(-3px); opacity: 1; }\n }\n @media (prefers-reduced-motion: reduce) {\n .message[data-thinking] .dot { animation: luzia-fade 1.1s ease-in-out infinite alternate; }\n }\n /* Links in luzIA's replies: underlined in the text's own colour, so they read as links on any theme. */\n .message a {\n color: inherit;\n text-decoration: underline;\n text-decoration-thickness: 1px;\n text-underline-offset: 0.15em;\n border-radius: 0.125rem;\n }\n .message a:hover { text-decoration-thickness: 2px; }\n .message a:focus-visible {\n outline: 2px solid var(--luzia-accent);\n outline-offset: 1px;\n }\n .messages {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n }\n .message[data-role='user'] {\n align-self: flex-end;\n border-bottom-right-radius: 0.375rem;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--luzia-accent) 80%, transparent);\n transform-origin: bottom right;\n }\n /* A little more room where the speaker changes. */\n .message[data-role='assistant'] + .message[data-role='user'],\n .message[data-role='user'] + .message[data-role='assistant'] { margin-top: 0.375rem; }\n .greeting:not([hidden]) + .messages:not(:empty) { margin-top: 0.375rem; }\n /* Each new message rises into place once. */\n .greeting, .message { animation: luzia-rise 260ms var(--luzia-ease-out); }\n @keyframes luzia-rise {\n from { opacity: 0; transform: translateY(6px) scale(0.98); }\n }\n @keyframes luzia-fade {\n from { opacity: 0; }\n }\n .suggestions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: 0.5rem;\n margin: auto 0 0;\n padding: 0;\n list-style: none;\n }\n /* Questions the Visitor could ask, tinted with the accent; they arrive one after another. */\n .suggestions li { animation: luzia-rise 320ms var(--luzia-ease-out) both; transform-origin: bottom right; }\n .suggestions li:nth-child(2) { animation-delay: 50ms; }\n .suggestions li:nth-child(3) { animation-delay: 100ms; }\n .suggestions li:nth-child(n + 4) { animation-delay: 150ms; }\n .suggestion {\n padding: 0.5rem 0.9rem;\n border: 1px solid color-mix(in srgb, var(--luzia-accent) 24%, transparent);\n border-radius: 999px;\n background: color-mix(in srgb, var(--luzia-accent) 7%, var(--luzia-surface));\n color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-text));\n font: 500 0.875rem/1.3 var(--luzia-font);\n text-align: left;\n cursor: pointer;\n transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;\n }\n @media (hover: hover) and (pointer: fine) {\n .suggestion:hover {\n border-color: color-mix(in srgb, var(--luzia-accent) 45%, transparent);\n background: color-mix(in srgb, var(--luzia-accent) 13%, var(--luzia-surface));\n }\n }\n .suggestion:active { transform: scale(0.97); }\n @media (prefers-reduced-motion: reduce) {\n .greeting, .message, .suggestions li { animation-name: luzia-fade; }\n .suggestion:active { transform: none; }\n }\n .alert {\n margin: 0 1rem 0.5rem;\n font-size: 0.875rem;\n color: #b91c1c;\n }\n .alert a {\n color: inherit;\n }\n /* One rounded field: the message box with a round Send button inside it. */\n .composer {\n display: flex;\n align-items: flex-end;\n gap: 0.375rem;\n margin: 0 0.75rem 0.75rem;\n padding: 0.25rem 0.25rem 0.25rem 1rem;\n border: 1px solid var(--luzia-border);\n border-radius: 1.5rem;\n background: var(--luzia-surface);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);\n transition: border-color 150ms ease, box-shadow 150ms ease;\n }\n .composer:focus-within {\n border-color: color-mix(in srgb, var(--luzia-accent) 60%, var(--luzia-border));\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--luzia-accent) 16%, transparent);\n }\n .composer textarea {\n flex: 1;\n box-sizing: border-box;\n min-height: 2.75rem;\n max-height: 8rem;\n resize: none;\n padding: 0.7rem 0;\n border: none;\n background: transparent;\n color: var(--luzia-text);\n caret-color: var(--luzia-accent);\n font: inherit;\n font-size: 0.9375rem;\n line-height: 1.4;\n /* Grows with what is typed, where supported. */\n field-sizing: content;\n }\n .composer textarea::placeholder { color: color-mix(in srgb, var(--luzia-text) 55%, transparent); }\n .composer textarea:disabled { cursor: not-allowed; }\n .send {\n display: grid;\n place-items: center;\n flex: none;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: var(--luzia-accent);\n color: var(--luzia-accent-contrast);\n cursor: pointer;\n transition: background-color 150ms ease, opacity 150ms ease, transform 160ms ease-out;\n }\n .send svg { display: block; }\n @media (hover: hover) and (pointer: fine) {\n .send:not(:disabled):hover { background: color-mix(in srgb, var(--luzia-accent) 86%, #000); }\n }\n .send:not(:disabled):active { transform: scale(0.94); }\n .send:disabled { opacity: 0.35; cursor: default; }\n @media (prefers-reduced-motion: reduce) {\n .send:not(:disabled):active { transform: none; }\n }\n @media (max-width: 480px) {\n /* The whole visible screen: above the on-screen keyboard when it is open (set by the element from visualViewport). */\n .panel {\n position: fixed;\n top: var(--luzia-viewport-top, 0px);\n left: 0;\n width: 100vw;\n height: var(--luzia-viewport-height, 100vh);\n margin: 0;\n border: none;\n border-radius: 0;\n }\n @supports (height: 100dvh) {\n .panel { height: var(--luzia-viewport-height, 100dvh); }\n }\n /* With the keyboard open there is little room: a smaller picture keeps the last messages in view. */\n :host([data-keyboard]) .stage { --luzia-avatar-height: 4.5rem; }\n /* Inline, the chat stays in the page but never taller than the screen. */\n :host([mode='inline']) .panel { height: min(var(--luzia-inline-height), 85vh); }\n .composer { margin-bottom: max(0.75rem, env(safe-area-inset-bottom)); }\n :host(:not([mode='inline'])) .panel { transform-origin: bottom center; }\n /* Below 16px, mobile browsers zoom the page when the text box gets focus. */\n .composer textarea { font-size: 16px; }\n }\n";