ordify-chat-widget 1.1.3 → 1.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/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _n=Object.defineProperty;var Pn=(e,t,r)=>t in e?_n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var mt=(e,t,r)=>Pn(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react");function On(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const zt=On(x);var Br={exports:{}},tt={};/**
1
+ "use strict";var Pn=Object.defineProperty;var On=(e,t,r)=>t in e?Pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var gt=(e,t,r)=>On(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react");function Dn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Nt=Dn(x);var Lr={exports:{}},rt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,14 +6,14 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Dn=x,zn=Symbol.for("react.element"),Nn=Symbol.for("react.fragment"),Bn=Object.prototype.hasOwnProperty,Ln=Dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Fn={key:!0,ref:!0,__self:!0,__source:!0};function Lr(e,t,r){var n,o={},c=null,u=null;r!==void 0&&(c=""+r),t.key!==void 0&&(c=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)Bn.call(t,n)&&!Fn.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:zn,type:e,key:c,ref:u,props:o,_owner:Ln.current}}tt.Fragment=Nn;tt.jsx=Lr;tt.jsxs=Lr;Br.exports=tt;var l=Br.exports;function Pe(){return Math.random().toString(36).substr(2,9)}function Kn(e){return new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).format(e)}function Wn(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Un(e,t){let r;return(...n)=>{r||(e(...n),r=!0,setTimeout(()=>r=!1,t))}}function nr(e){let t=e.replace(/\r\n/g,`
9
+ */var zn=x,Nn=Symbol.for("react.element"),Bn=Symbol.for("react.fragment"),Ln=Object.prototype.hasOwnProperty,Fn=zn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Kn={key:!0,ref:!0,__self:!0,__source:!0};function Fr(e,t,r){var n,o={},c=null,u=null;r!==void 0&&(c=""+r),t.key!==void 0&&(c=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)Ln.call(t,n)&&!Kn.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:Nn,type:e,key:c,ref:u,props:o,_owner:Fn.current}}rt.Fragment=Bn;rt.jsx=Fr;rt.jsxs=Fr;Lr.exports=rt;var l=Lr.exports;function Pe(){return Math.random().toString(36).substr(2,9)}function Wn(e){return new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).format(e)}function Un(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Hn(e,t){let r;return(...n)=>{r||(e(...n),r=!0,setTimeout(()=>r=!1,t))}}function or(e){let t=e.replace(/\r\n/g,`
10
10
  `);return t=t.replace(/\n\nUsing [^\n]+\.{3}(?:\s*\n)+/g,`
11
11
 
12
12
  `),t=t.replace(/\n\nAction completed(?:\s*\n)+/g,`
13
13
 
14
14
  `),t=t.replace(/^Using [^\n]+\.{3}(?:\s*\n)+/m,""),t=t.replace(/^Action completed(?:\s*\n)+/m,""),t=t.replace(/\n{3,}/g,`
15
15
 
16
- `),t}function Hn(e){const t=e.type;return t==="adk_tool"||t==="ADK_TOOL"}function qn(e){return{id:e.id,name:e.name,url:e.url,content_type:e.content_type,type:e.type,size:e.size??null,preview:null,oauth_token:null}}class Fr{constructor(t){mt(this,"config");mt(this,"warnedLegacyApiKey",!1);if(this.config=t,!this.config.publishableKey&&!this.config.apiKey)throw new Error("Either publishableKey or apiKey is required.");this.config.publishableKey&&this.config.apiKey&&console.warn("[Ordify] Both publishableKey and apiKey provided. publishableKey will be used.")}usePublishableKey(){return!!this.config.publishableKey}maybeWarnLegacyApiKey(){this.usePublishableKey()||this.warnedLegacyApiKey||(this.warnedLegacyApiKey=!0,console.warn("[Ordify] Using legacy apiKey in browser. For production embeds, use publishableKey from user settings."))}getAuthHeaders(t=!1){return this.usePublishableKey()?{...t?{"Content-Type":"application/json"}:{},"x-ordify-publishable-key":this.config.publishableKey,accept:"application/json"}:(this.maybeWarnLegacyApiKey(),{...t?{"Content-Type":"application/json"}:{},"api-key":this.config.apiKey,accept:"application/json"})}getAuthHeadersForPdfExport(){return this.usePublishableKey()?{"Content-Type":"application/json","x-ordify-publishable-key":this.config.publishableKey,accept:"application/pdf"}:(this.maybeWarnLegacyApiKey(),{"Content-Type":"application/json","api-key":this.config.apiKey,accept:"application/pdf"})}async exportMessagePdf(t,r){const n=`${this.config.apiBaseUrl}/document-conversion/pdf`,o=await fetch(n,{method:"POST",headers:this.getAuthHeadersForPdfExport(),body:JSON.stringify({content:t,filename:r??void 0,format:"A4",margin_top:"1cm",margin_bottom:"1cm",margin_left:"1cm",margin_right:"1cm",print_background:!0,display_header_footer:!1})});if(!o.ok){let p=`HTTP ${o.status}`;try{const v=await o.json();p=typeof v.detail=="string"?v.detail:p}catch{try{const v=await o.text();v&&(p=v.slice(0,500))}catch{}}throw new Error(`PDF export failed: ${p}`)}const c=await o.blob(),u=o.headers.get("Content-Disposition");let d=r!=null&&r.endsWith(".pdf")?r:`${r??"document"}.pdf`;const h=/filename\*?=(?:UTF-8''|")?([^";\n]+)/i.exec(u??"");if(h!=null&&h[1])try{d=decodeURIComponent(h[1].replace(/^"|"$/g,"").trim())}catch{d=h[1].replace(/^"|"$/g,"").trim()}d.endsWith(".pdf")||(d+=".pdf");const b=URL.createObjectURL(c),g=document.createElement("a");g.href=b,g.download=d,g.rel="noopener noreferrer",document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(b)}async sendMessage(t,r,n,o){const c=this.usePublishableKey()?`/widget/chat/${this.config.agentId}`:`/chat/agents/${this.config.agentId}`,u=`${this.config.apiBaseUrl}${c}`,d=o!=null&&o.length?o.map(qn):void 0,h={message:t,sessionId:r,context:n,use_thinking:!!this.config.useThinking};this.usePublishableKey()&&(h.enable_image_generation=this.config.enableImageGeneration===!0),d!=null&&d.length&&(h.attachments=d,h.use_document_understanding=d.some(g=>g.type==="document"||!g.type&&!String(g.content_type||"").startsWith("image/")));const b=await fetch(u,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify(h)});if(!b.ok){const g=await b.json();throw new Error(`API Error: ${g.detail}`)}if(!b.body)throw new Error("No response body");return b.body}async uploadAttachment(t){if(!this.usePublishableKey())throw new Error("[Ordify] uploadAttachment requires publishableKey.");const r=`${this.config.apiBaseUrl}/widget/attachments`,n=new FormData;n.append("file",t);const o=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!1),body:n});if(!o.ok){let u=`HTTP ${o.status}`;try{u=(await o.json()).detail||u}catch{}throw new Error(`API Error: ${u}`)}const c=await o.json();if(!(c!=null&&c.url)||!(c!=null&&c.content_type)||!(c!=null&&c.name))throw new Error("Invalid attachment response from server");return{id:c.id,name:c.name,type:c.type==="image"?"image":"document",url:c.url,content_type:c.content_type,size:c.size,preview:c.preview}}async createSession(){const t=this.usePublishableKey()?"/widget/sessions":"/sessions",r=`${this.config.apiBaseUrl}${t}`,n=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify({name:"Chat Session",agentConfig:{type:"chat",settings:null}})});if(!n.ok){const o=await n.json();throw new Error(`API Error: ${o.detail}`)}return n.json()}async getSessionWithMessages(t){const r=this.usePublishableKey()?`/widget/sessions/${t}/with-messages`:`/sessions/${t}/with-messages`,n=`${this.config.apiBaseUrl}${r}`,o=await fetch(n,{method:"GET",headers:this.getAuthHeaders()});if(!o.ok){const c=await o.json();throw new Error(`API Error: ${c.detail}`)}return o.json()}async getAgents(){if(!this.config.apiKey)throw new Error("[Ordify] getAgents() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/chat/agents`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const o=await r.json();throw new Error(`API Error: ${o.detail}`)}return(await r.json()).agents||[]}async getSessions(){if(!this.config.apiKey)throw new Error("[Ordify] getSessions() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/sessions`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`API Error: ${n.detail}`)}return r.json()}}function Kr(e){try{if(e.startsWith("data: ")){const t=e.slice(6).trim();if(t==="[DONE]"||t==="")return{text:"",sessionId:"",type:"done"};const r=JSON.parse(t);if(r.done)return{text:"",sessionId:r.sessionId||"",type:"done"};if(r.type==="turn_complete")return null;if(r.type==="adk_tool"){const n=typeof r.content=="string"?r.content.trim():"";return n?{type:"stream",text:`
16
+ `),t}function qn(e){const t=e.type;return t==="adk_tool"||t==="ADK_TOOL"}function Gn(e){return{id:e.id,name:e.name,url:e.url,content_type:e.content_type,type:e.type,size:e.size??null,preview:null,oauth_token:null}}class Kr{constructor(t){gt(this,"config");gt(this,"warnedLegacyApiKey",!1);if(this.config=t,!this.config.publishableKey&&!this.config.apiKey)throw new Error("Either publishableKey or apiKey is required.");this.config.publishableKey&&this.config.apiKey&&console.warn("[Ordify] Both publishableKey and apiKey provided. publishableKey will be used.")}usePublishableKey(){return!!this.config.publishableKey}maybeWarnLegacyApiKey(){this.usePublishableKey()||this.warnedLegacyApiKey||(this.warnedLegacyApiKey=!0,console.warn("[Ordify] Using legacy apiKey in browser. For production embeds, use publishableKey from user settings."))}getAuthHeaders(t=!1){return this.usePublishableKey()?{...t?{"Content-Type":"application/json"}:{},"x-ordify-publishable-key":this.config.publishableKey,accept:"application/json"}:(this.maybeWarnLegacyApiKey(),{...t?{"Content-Type":"application/json"}:{},"api-key":this.config.apiKey,accept:"application/json"})}getAuthHeadersForPdfExport(){return this.usePublishableKey()?{"Content-Type":"application/json","x-ordify-publishable-key":this.config.publishableKey,accept:"application/pdf"}:(this.maybeWarnLegacyApiKey(),{"Content-Type":"application/json","api-key":this.config.apiKey,accept:"application/pdf"})}async exportMessagePdf(t,r){const n=`${this.config.apiBaseUrl}/document-conversion/pdf`,o=await fetch(n,{method:"POST",headers:this.getAuthHeadersForPdfExport(),body:JSON.stringify({content:t,filename:r??void 0,format:"A4",margin_top:"1cm",margin_bottom:"1cm",margin_left:"1cm",margin_right:"1cm",print_background:!0,display_header_footer:!1})});if(!o.ok){let p=`HTTP ${o.status}`;try{const v=await o.json();p=typeof v.detail=="string"?v.detail:p}catch{try{const v=await o.text();v&&(p=v.slice(0,500))}catch{}}throw new Error(`PDF export failed: ${p}`)}const c=await o.blob(),u=o.headers.get("Content-Disposition");let d=r!=null&&r.endsWith(".pdf")?r:`${r??"document"}.pdf`;const h=/filename\*?=(?:UTF-8''|")?([^";\n]+)/i.exec(u??"");if(h!=null&&h[1])try{d=decodeURIComponent(h[1].replace(/^"|"$/g,"").trim())}catch{d=h[1].replace(/^"|"$/g,"").trim()}d.endsWith(".pdf")||(d+=".pdf");const b=URL.createObjectURL(c),g=document.createElement("a");g.href=b,g.download=d,g.rel="noopener noreferrer",document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(b)}async sendMessage(t,r,n,o){const c=this.usePublishableKey()?`/widget/chat/${this.config.agentId}`:`/chat/agents/${this.config.agentId}`,u=`${this.config.apiBaseUrl}${c}`,d=o!=null&&o.length?o.map(Gn):void 0,h={message:t,sessionId:r,context:n,use_thinking:!!this.config.useThinking};this.usePublishableKey()&&(h.enable_image_generation=this.config.enableImageGeneration===!0),d!=null&&d.length&&(h.attachments=d,h.use_document_understanding=d.some(g=>g.type==="document"||!g.type&&!String(g.content_type||"").startsWith("image/")));const b=await fetch(u,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify(h)});if(!b.ok){const g=await b.json();throw new Error(`API Error: ${g.detail}`)}if(!b.body)throw new Error("No response body");return b.body}async uploadAttachment(t){if(!this.usePublishableKey())throw new Error("[Ordify] uploadAttachment requires publishableKey.");const r=`${this.config.apiBaseUrl}/widget/attachments`,n=new FormData;n.append("file",t);const o=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!1),body:n});if(!o.ok){let u=`HTTP ${o.status}`;try{u=(await o.json()).detail||u}catch{}throw new Error(`API Error: ${u}`)}const c=await o.json();if(!(c!=null&&c.url)||!(c!=null&&c.content_type)||!(c!=null&&c.name))throw new Error("Invalid attachment response from server");return{id:c.id,name:c.name,type:c.type==="image"?"image":"document",url:c.url,content_type:c.content_type,size:c.size,preview:c.preview}}async createSession(){const t=this.usePublishableKey()?"/widget/sessions":"/sessions",r=`${this.config.apiBaseUrl}${t}`,n=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify({name:"Chat Session",agentConfig:{type:"chat",settings:null}})});if(!n.ok){const o=await n.json();throw new Error(`API Error: ${o.detail}`)}return n.json()}async getSessionWithMessages(t){const r=this.usePublishableKey()?`/widget/sessions/${t}/with-messages`:`/sessions/${t}/with-messages`,n=`${this.config.apiBaseUrl}${r}`,o=await fetch(n,{method:"GET",headers:this.getAuthHeaders()});if(!o.ok){const c=await o.json();throw new Error(`API Error: ${c.detail}`)}return o.json()}async getAgents(){if(!this.config.apiKey)throw new Error("[Ordify] getAgents() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/chat/agents`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const o=await r.json();throw new Error(`API Error: ${o.detail}`)}return(await r.json()).agents||[]}async getSessions(){if(!this.config.apiKey)throw new Error("[Ordify] getSessions() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/sessions`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`API Error: ${n.detail}`)}return r.json()}}function Wr(e){try{if(e.startsWith("data: ")){const t=e.slice(6).trim();if(t==="[DONE]"||t==="")return{text:"",sessionId:"",type:"done"};const r=JSON.parse(t);if(r.done)return{text:"",sessionId:r.sessionId||"",type:"done"};if(r.type==="turn_complete")return null;if(r.type==="adk_tool"){const n=typeof r.content=="string"?r.content.trim():"";return n?{type:"stream",text:`
17
17
 
18
18
  ${n}
19
19
 
@@ -21,65 +21,65 @@ ${n}
21
21
 
22
22
  ![Generated image](${n})
23
23
 
24
- `,sessionId:r.sessionId||"",agentName:r.agentName}:null}return r}}catch(t){console.warn("Failed to parse streaming response:",t)}return null}function or(e){const t=(e.attachments||[]).map(r=>r.id).join("|");return`${e.role}:${e.content.trim()}:${t}`}function Gn(e){const t=e.attachments;if(!t||!Array.isArray(t)||t.length===0)return;const r=[];for(const n of t){const o=n.url||"";o&&r.push({id:n.id||Pe(),name:String(n.name||"attachment"),type:n.type==="image"?"image":"document",url:o,content_type:String(n.content_type||n.contentType||"application/octet-stream"),size:n.size,preview:n.preview})}return r.length?r:void 0}function Wr(e){const[t,r]=x.useState([]),[n,o]=x.useState(!1),[c,u]=x.useState(null),[d,h]=x.useState(e.sessionId||null),[b,g]=x.useState(!1),[p,v]=x.useState(!1),[w,C]=x.useState(!1),[I,$]=x.useState(!1),[a,i]=x.useState(!1),s=x.useRef(null),f=x.useRef(""),m=x.useRef(!1),k=x.useRef(!1),y=x.useRef(!1),A=`${e.publishableKey??""}|${e.apiKey??""}|${e.apiBaseUrl??""}|${e.agentId}|${e.useThinking===!0?"1":"0"}|img:${e.enableImageGeneration===!0?"1":e.enableImageGeneration===!1?"0":""}`;f.current!==A&&(s.current=null,f.current=A),s.current||(s.current=new Fr({publishableKey:e.publishableKey,apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl||"https://api.ordify.ai",agentId:e.agentId,useThinking:e.useThinking===!0,enableImageGeneration:e.enableImageGeneration}));const M=x.useRef(null),z=x.useRef(new Set);x.useEffect(()=>{if(e.sessionId&&e.sessionId!==d){const T=z.current.has(e.sessionId);h(e.sessionId),k.current=!1,M.current=null,C(!1),T||r([])}},[e.sessionId]),x.useEffect(()=>{(async()=>{const D=d||e.sessionId;if(y.current||n)return;if(!D){k.current=!0,M.current=null,C(!1);return}if(M.current===D)return;if(z.current.has(D)&&t.length>0&&!k.current){k.current=!0,M.current=D,$(!1);return}M.current=D,$(!0);try{const S=await s.current.getSessionWithMessages(D);if(S.messages&&S.messages.length>0){const O=S.messages.filter(N=>!Hn(N)).map(N=>{const F=N.role==="assistant"?"assistant":"user",_=String(N.content||"");return{id:N.id||Pe(),content:F==="assistant"?nr(_):_,role:F,timestamp:N.timestamp?new Date(N.timestamp):new Date,sessionId:D,attachments:Gn(N)}});r(N=>{if(N.length>0){const F=new Map,_=new Map;return N.forEach(B=>{F.set(B.id,B);const q=or(B);_.has(q)||_.set(q,B)}),O.forEach(B=>{const q=or(B);!F.has(B.id)&&!_.has(q)?(F.set(B.id,B),_.set(q,B)):F.has(B.id)&&F.set(B.id,B)}),Array.from(F.values()).sort((B,q)=>B.timestamp.getTime()-q.timestamp.getTime())}return O}),C(!0),i(!0)}else C(!1)}catch(S){console.warn("Failed to load session history:",S),C(!1),S instanceof Error&&S.message.includes("404")&&(h(null),M.current=null)}finally{$(!1),k.current=!0}})()},[d,e.sessionId]);const P=x.useCallback(()=>{u(null)},[]),K=x.useCallback(async T=>{if(!s.current)throw new Error("API client not initialized");return s.current.uploadAttachment(T)},[]),j=x.useCallback(async(T,D)=>{if(!s.current)throw new Error("API client not initialized");await s.current.exportMessagePdf(T,D)},[]),W=x.useCallback(async(T,D,H)=>{const S=T.trim(),O=!!(H&&H.length>0);if(!(!S&&!O||n)){o(!0),u(null);try{const N=H!=null&&H.length?H.map(Z=>({...Z})):void 0,F={id:Pe(),content:S,role:"user",timestamp:new Date,sessionId:d||void 0,attachments:N};r(Z=>[...Z,F]),i(!0);let _=d||e.sessionId||null;_?_!==d&&h(_):(_=(await s.current.createSession()).id,z.current.add(_),e.onSessionCreated&&e.onSessionCreated(_)),y.current=!0;const B=(await s.current.sendMessage(S||"(see attachments)",_,D,N)).getReader(),q=new TextDecoder;let V={id:Pe(),content:"",role:"assistant",timestamp:new Date,sessionId:_};for(r(Z=>[...Z,V]);;){const{done:Z,value:se}=await B.read();if(Z)break;const Ee=q.decode(se,{stream:!0}).split(`
25
- `);for(const pe of Ee){if(!pe.trim())continue;const J=Kr(pe);if(J){if(J.type==="stream"&&J.text)V.content=nr(V.content+J.text),r(ht=>ht.find(Me=>Me.id===V.id)?ht.map(Me=>Me.id===V.id?{...Me,content:V.content}:Me):[...ht,{...V,content:V.content}]);else if(J.type==="done")break}}}_&&_!==d&&h(_),e.onMessage&&e.onMessage(V)}catch(N){const F=N instanceof Error?N.message:"Failed to send message";u(F),e.onError&&e.onError(N instanceof Error?N:new Error(F))}finally{y.current=!1,o(!1)}}},[e.onSessionCreated,e.onMessage,e.onError,e.sessionId,e.useThinking,n,d]);return x.useEffect(()=>{const D=!(d||e.sessionId)||!w,H=e.quickQuestions&&e.quickQuestions.length>0;if((e.initialMessage||e.initialContext)&&D&&!p&&!n&&!I&&!m.current&&k.current&&!H){v(!0),m.current=!0;let S,O;if(e.initialMessage&&e.initialContext)S=e.initialMessage,O=e.initialContext;else if(e.initialMessage)S=e.initialMessage,O=void 0;else if(e.initialContext)S="Hi",O=e.initialContext;else return;setTimeout(()=>{W(S,O)},0)}},[e.initialMessage,e.initialContext,p,n,I,w,d,e.sessionId,W]),{messages:t,sendMessage:W,uploadAttachment:K,exportMessagePdf:j,isLoading:n,error:c,clearError:P,sessionId:d,isOpen:b,setIsOpen:g,hasSessionStarted:a}}function Be(e){if(typeof process>"u"||!process.env)return;const t=process.env[e];return typeof t=="string"&&t.length>0?t:void 0}function Ur(e){return x.useMemo(()=>{const t=e.agentId||Be("ORDIFY_AGENT_ID"),r=e.publishableKey||Be("ORDIFY_PUBLISHABLE_KEY"),n=e.apiKey||Be("ORDIFY_API_KEY"),o=e.apiBaseUrl||Be("ORDIFY_API_BASE_URL")||"https://r.ordify.ai";if(!t)throw new Error("Ordify agent ID is required. Provide agentId prop or set ORDIFY_AGENT_ID environment variable.");if(!r&&!n)throw new Error("Ordify credentials are required. Provide publishableKey (recommended) or apiKey.");return{agentId:t,publishableKey:r,apiKey:n,apiBaseUrl:o,mode:e.mode||"floating",position:e.position||"bottom-right",theme:e.theme||"auto",placeholder:e.placeholder||"Type a message...",height:e.height||"500px",backgroundColor:e.backgroundColor,textColor:e.textColor,borderRadius:e.borderRadius,className:e.className||"",buttonStyle:e.buttonStyle||{},chatWindowStyle:e.chatWindowStyle||{},showHeader:e.showHeader!==!1,buttonText:e.buttonText,chatName:e.chatName,primaryColor:e.primaryColor,agentImage:e.agentImage,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,onSessionCreated:e.onSessionCreated,initialMessage:e.initialMessage,initialContext:e.initialContext,sessionId:e.sessionId,quickQuestions:e.quickQuestions,welcomeMessage:e.welcomeMessage,welcomeImage:e.welcomeImage,enableAttachments:e.enableAttachments,maxAttachmentSizeMB:e.maxAttachmentSizeMB,maxAttachments:e.maxAttachments,allowedAttachmentTypes:e.allowedAttachmentTypes,useThinking:e.useThinking===!0,enableImageGeneration:e.enableImageGeneration}},[e])}async function Qn(e){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}/**
24
+ `,sessionId:r.sessionId||"",agentName:r.agentName}:null}return r}}catch(t){console.warn("Failed to parse streaming response:",t)}return null}function ar(e){const t=(e.attachments||[]).map(r=>r.id).join("|");return`${e.role}:${e.content.trim()}:${t}`}function Qn(e){const t=e.attachments;if(!t||!Array.isArray(t)||t.length===0)return;const r=[];for(const n of t){const o=n.url||"";o&&r.push({id:n.id||Pe(),name:String(n.name||"attachment"),type:n.type==="image"?"image":"document",url:o,content_type:String(n.content_type||n.contentType||"application/octet-stream"),size:n.size,preview:n.preview})}return r.length?r:void 0}function Ur(e){const[t,r]=x.useState([]),[n,o]=x.useState(!1),[c,u]=x.useState(null),[d,h]=x.useState(e.sessionId||null),[b,g]=x.useState(!1),[p,v]=x.useState(!1),[w,C]=x.useState(!1),[I,$]=x.useState(!1),[a,i]=x.useState(!1),s=x.useRef(null),f=x.useRef(""),m=x.useRef(!1),k=x.useRef(!1),y=x.useRef(!1),A=`${e.publishableKey??""}|${e.apiKey??""}|${e.apiBaseUrl??""}|${e.agentId}|${e.useThinking===!0?"1":"0"}|img:${e.enableImageGeneration===!0?"1":e.enableImageGeneration===!1?"0":""}`;f.current!==A&&(s.current=null,f.current=A),s.current||(s.current=new Kr({publishableKey:e.publishableKey,apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl||"https://api.ordify.ai",agentId:e.agentId,useThinking:e.useThinking===!0,enableImageGeneration:e.enableImageGeneration}));const R=x.useRef(null),z=x.useRef(new Set);x.useEffect(()=>{if(e.sessionId&&e.sessionId!==d){const T=z.current.has(e.sessionId);h(e.sessionId),k.current=!1,R.current=null,C(!1),T||r([])}},[e.sessionId]),x.useEffect(()=>{(async()=>{const D=d||e.sessionId;if(y.current||n)return;if(!D){k.current=!0,R.current=null,C(!1);return}if(R.current===D)return;if(z.current.has(D)&&t.length>0&&!k.current){k.current=!0,R.current=D,$(!1);return}R.current=D,$(!0);try{const S=await s.current.getSessionWithMessages(D);if(S.messages&&S.messages.length>0){const O=S.messages.filter(N=>!qn(N)).map(N=>{const F=N.role==="assistant"?"assistant":"user",_=String(N.content||"");return{id:N.id||Pe(),content:F==="assistant"?or(_):_,role:F,timestamp:N.timestamp?new Date(N.timestamp):new Date,sessionId:D,attachments:Qn(N)}});r(N=>{if(N.length>0){const F=new Map,_=new Map;return N.forEach(B=>{F.set(B.id,B);const q=ar(B);_.has(q)||_.set(q,B)}),O.forEach(B=>{const q=ar(B);!F.has(B.id)&&!_.has(q)?(F.set(B.id,B),_.set(q,B)):F.has(B.id)&&F.set(B.id,B)}),Array.from(F.values()).sort((B,q)=>B.timestamp.getTime()-q.timestamp.getTime())}return O}),C(!0),i(!0)}else C(!1)}catch(S){console.warn("Failed to load session history:",S),C(!1),S instanceof Error&&S.message.includes("404")&&(h(null),R.current=null)}finally{$(!1),k.current=!0}})()},[d,e.sessionId]);const P=x.useCallback(()=>{u(null)},[]),K=x.useCallback(async T=>{if(!s.current)throw new Error("API client not initialized");return s.current.uploadAttachment(T)},[]),j=x.useCallback(async(T,D)=>{if(!s.current)throw new Error("API client not initialized");await s.current.exportMessagePdf(T,D)},[]),W=x.useCallback(async(T,D,H)=>{const S=T.trim(),O=!!(H&&H.length>0);if(!(!S&&!O||n)){o(!0),u(null);try{const N=H!=null&&H.length?H.map(Z=>({...Z})):void 0,F={id:Pe(),content:S,role:"user",timestamp:new Date,sessionId:d||void 0,attachments:N};r(Z=>[...Z,F]),i(!0);let _=d||e.sessionId||null;_?_!==d&&h(_):(_=(await s.current.createSession()).id,z.current.add(_),e.onSessionCreated&&e.onSessionCreated(_)),y.current=!0;const B=(await s.current.sendMessage(S||"(see attachments)",_,D,N)).getReader(),q=new TextDecoder;let V={id:Pe(),content:"",role:"assistant",timestamp:new Date,sessionId:_};for(r(Z=>[...Z,V]);;){const{done:Z,value:se}=await B.read();if(Z)break;const Ee=q.decode(se,{stream:!0}).split(`
25
+ `);for(const pe of Ee){if(!pe.trim())continue;const J=Wr(pe);if(J){if(J.type==="stream"&&J.text)V.content=or(V.content+J.text),r(mt=>mt.find(Re=>Re.id===V.id)?mt.map(Re=>Re.id===V.id?{...Re,content:V.content}:Re):[...mt,{...V,content:V.content}]);else if(J.type==="done")break}}}_&&_!==d&&h(_),e.onMessage&&e.onMessage(V)}catch(N){const F=N instanceof Error?N.message:"Failed to send message";u(F),e.onError&&e.onError(N instanceof Error?N:new Error(F))}finally{y.current=!1,o(!1)}}},[e.onSessionCreated,e.onMessage,e.onError,e.sessionId,e.useThinking,n,d]);return x.useEffect(()=>{const D=!(d||e.sessionId)||!w,H=e.quickQuestions&&e.quickQuestions.length>0;if((e.initialMessage||e.initialContext)&&D&&!p&&!n&&!I&&!m.current&&k.current&&!H){v(!0),m.current=!0;let S,O;if(e.initialMessage&&e.initialContext)S=e.initialMessage,O=e.initialContext;else if(e.initialMessage)S=e.initialMessage,O=void 0;else if(e.initialContext)S="Hi",O=e.initialContext;else return;setTimeout(()=>{W(S,O)},0)}},[e.initialMessage,e.initialContext,p,n,I,w,d,e.sessionId,W]),{messages:t,sendMessage:W,uploadAttachment:K,exportMessagePdf:j,isLoading:n,error:c,clearError:P,sessionId:d,isOpen:b,setIsOpen:g,hasSessionStarted:a}}function Le(e){if(typeof process>"u"||!process.env)return;const t=process.env[e];return typeof t=="string"&&t.length>0?t:void 0}function Hr(e){return x.useMemo(()=>{const t=e.agentId||Le("ORDIFY_AGENT_ID"),r=e.publishableKey||Le("ORDIFY_PUBLISHABLE_KEY"),n=e.apiKey||Le("ORDIFY_API_KEY"),o=e.apiBaseUrl||Le("ORDIFY_API_BASE_URL")||"https://r.ordify.ai";if(!t)throw new Error("Ordify agent ID is required. Provide agentId prop or set ORDIFY_AGENT_ID environment variable.");if(!r&&!n)throw new Error("Ordify credentials are required. Provide publishableKey (recommended) or apiKey.");return{agentId:t,publishableKey:r,apiKey:n,apiBaseUrl:o,mode:e.mode||"floating",position:e.position||"bottom-right",theme:e.theme||"auto",placeholder:e.placeholder||"Type a message...",height:e.height||"500px",backgroundColor:e.backgroundColor,textColor:e.textColor,borderRadius:e.borderRadius,className:e.className||"",buttonStyle:e.buttonStyle||{},chatWindowStyle:e.chatWindowStyle||{},showHeader:e.showHeader!==!1,buttonText:e.buttonText,chatName:e.chatName,primaryColor:e.primaryColor,agentImage:e.agentImage,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,onSessionCreated:e.onSessionCreated,initialMessage:e.initialMessage,initialContext:e.initialContext,sessionId:e.sessionId,quickQuestions:e.quickQuestions,welcomeMessage:e.welcomeMessage,welcomeImage:e.welcomeImage,enableAttachments:e.enableAttachments,maxAttachmentSizeMB:e.maxAttachmentSizeMB,maxAttachments:e.maxAttachments,allowedAttachmentTypes:e.allowedAttachmentTypes,useThinking:e.useThinking===!0,enableImageGeneration:e.enableImageGeneration}},[e])}async function Yn(e){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}/**
26
26
  * @license lucide-react v0.544.0 - ISC
27
27
  *
28
28
  * This source code is licensed under the ISC license.
29
29
  * See the LICENSE file in the root directory of this source tree.
30
- */const Yn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),ar=e=>{const t=Vn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hr=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Zn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
30
+ */const Vn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Zn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),sr=e=>{const t=Zn(e);return t.charAt(0).toUpperCase()+t.slice(1)},qr=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Jn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
31
31
  * @license lucide-react v0.544.0 - ISC
32
32
  *
33
33
  * This source code is licensed under the ISC license.
34
34
  * See the LICENSE file in the root directory of this source tree.
35
- */var Jn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
35
+ */var Xn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
36
36
  * @license lucide-react v0.544.0 - ISC
37
37
  *
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
- */const Xn=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:c,iconNode:u,...d},h)=>x.createElement("svg",{ref:h,...Jn,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Hr("lucide",o),...!c&&!Zn(d)&&{"aria-hidden":"true"},...d},[...u.map(([b,g])=>x.createElement(b,g)),...Array.isArray(c)?c:[c]]));/**
40
+ */const eo=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:c,iconNode:u,...d},h)=>x.createElement("svg",{ref:h,...Xn,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:qr("lucide",o),...!c&&!Jn(d)&&{"aria-hidden":"true"},...d},[...u.map(([b,g])=>x.createElement(b,g)),...Array.isArray(c)?c:[c]]));/**
41
41
  * @license lucide-react v0.544.0 - ISC
42
42
  *
43
43
  * This source code is licensed under the ISC license.
44
44
  * See the LICENSE file in the root directory of this source tree.
45
- */const Te=(e,t)=>{const r=x.forwardRef(({className:n,...o},c)=>x.createElement(Xn,{ref:c,iconNode:t,className:Hr(`lucide-${Yn(ar(e))}`,`lucide-${e}`,n),...o}));return r.displayName=ar(e),r};/**
45
+ */const Te=(e,t)=>{const r=x.forwardRef(({className:n,...o},c)=>x.createElement(eo,{ref:c,iconNode:t,className:qr(`lucide-${Vn(sr(e))}`,`lucide-${e}`,n),...o}));return r.displayName=sr(e),r};/**
46
46
  * @license lucide-react v0.544.0 - ISC
47
47
  *
48
48
  * This source code is licensed under the ISC license.
49
49
  * See the LICENSE file in the root directory of this source tree.
50
- */const eo=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],to=Te("copy",eo);/**
50
+ */const to=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ro=Te("copy",to);/**
51
51
  * @license lucide-react v0.544.0 - ISC
52
52
  *
53
53
  * This source code is licensed under the ISC license.
54
54
  * See the LICENSE file in the root directory of this source tree.
55
- */const ro=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],no=Te("file-down",ro);/**
55
+ */const no=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],oo=Te("file-down",no);/**
56
56
  * @license lucide-react v0.544.0 - ISC
57
57
  *
58
58
  * This source code is licensed under the ISC license.
59
59
  * See the LICENSE file in the root directory of this source tree.
60
- */const oo=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ao=Te("file-text",oo);/**
60
+ */const ao=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],so=Te("file-text",ao);/**
61
61
  * @license lucide-react v0.544.0 - ISC
62
62
  *
63
63
  * This source code is licensed under the ISC license.
64
64
  * See the LICENSE file in the root directory of this source tree.
65
- */const so=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],io=Te("image",so);/**
65
+ */const io=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],co=Te("image",io);/**
66
66
  * @license lucide-react v0.544.0 - ISC
67
67
  *
68
68
  * This source code is licensed under the ISC license.
69
69
  * See the LICENSE file in the root directory of this source tree.
70
- */const co=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lo=Te("paperclip",co);/**
70
+ */const lo=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],uo=Te("paperclip",lo);/**
71
71
  * @license lucide-react v0.544.0 - ISC
72
72
  *
73
73
  * This source code is licensed under the ISC license.
74
74
  * See the LICENSE file in the root directory of this source tree.
75
- */const uo=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],po=Te("x",uo);var X=function(){return X=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},X.apply(this,arguments)};function Ve(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,c;n<o;n++)(c||!(n in t))&&(c||(c=Array.prototype.slice.call(t,0,n)),c[n]=t[n]);return e.concat(c||Array.prototype.slice.call(t))}var U="-ms-",Oe="-moz-",L="-webkit-",qr="comm",rt="rule",Nt="decl",fo="@import",Gr="@keyframes",ho="@layer",Qr=Math.abs,Bt=String.fromCharCode,At=Object.assign;function mo(e,t){return Q(e,0)^45?(((t<<2^Q(e,0))<<2^Q(e,1))<<2^Q(e,2))<<2^Q(e,3):0}function Yr(e){return e.trim()}function ae(e,t){return(e=t.exec(e))?e[0]:e}function R(e,t,r){return e.replace(t,r)}function We(e,t,r){return e.indexOf(t,r)}function Q(e,t){return e.charCodeAt(t)|0}function ve(e,t,r){return e.slice(t,r)}function ne(e){return e.length}function Vr(e){return e.length}function _e(e,t){return t.push(e),e}function go(e,t){return e.map(t).join("")}function sr(e,t){return e.filter(function(r){return!ae(r,t)})}var nt=1,$e=1,Zr=0,ee=0,G=0,Ae="";function ot(e,t,r,n,o,c,u,d){return{value:e,root:t,parent:r,type:n,props:o,children:c,line:nt,column:$e,length:u,return:"",siblings:d}}function de(e,t){return At(ot("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function xe(e){for(;e.root;)e=de(e.root,{children:[e]});_e(e,e.siblings)}function bo(){return G}function yo(){return G=ee>0?Q(Ae,--ee):0,$e--,G===10&&($e=1,nt--),G}function te(){return G=ee<Zr?Q(Ae,ee++):0,$e++,G===10&&($e=1,nt++),G}function me(){return Q(Ae,ee)}function Ue(){return ee}function at(e,t){return ve(Ae,e,t)}function Et(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function xo(e){return nt=$e=1,Zr=ne(Ae=e),ee=0,[]}function ko(e){return Ae="",e}function gt(e){return Yr(at(ee-1,Mt(e===91?e+2:e===40?e+1:e)))}function wo(e){for(;(G=me())&&G<33;)te();return Et(e)>2||Et(G)>3?"":" "}function vo(e,t){for(;--t&&te()&&!(G<48||G>102||G>57&&G<65||G>70&&G<97););return at(e,Ue()+(t<6&&me()==32&&te()==32))}function Mt(e){for(;te();)switch(G){case e:return ee;case 34:case 39:e!==34&&e!==39&&Mt(G);break;case 40:e===41&&Mt(e);break;case 92:te();break}return ee}function $o(e,t){for(;te()&&e+G!==57;)if(e+G===84&&me()===47)break;return"/*"+at(t,ee-1)+"*"+Bt(e===47?e:te())}function So(e){for(;!Et(me());)te();return at(e,ee)}function Co(e){return ko(He("",null,null,null,[""],e=xo(e),0,[0],e))}function He(e,t,r,n,o,c,u,d,h){for(var b=0,g=0,p=u,v=0,w=0,C=0,I=1,$=1,a=1,i=0,s="",f=o,m=c,k=n,y=s;$;)switch(C=i,i=te()){case 40:if(C!=108&&Q(y,p-1)==58){We(y+=R(gt(i),"&","&\f"),"&\f",Qr(b?d[b-1]:0))!=-1&&(a=-1);break}case 34:case 39:case 91:y+=gt(i);break;case 9:case 10:case 13:case 32:y+=wo(C);break;case 92:y+=vo(Ue()-1,7);continue;case 47:switch(me()){case 42:case 47:_e(jo($o(te(),Ue()),t,r,h),h);break;default:y+="/"}break;case 123*I:d[b++]=ne(y)*a;case 125*I:case 59:case 0:switch(i){case 0:case 125:$=0;case 59+g:a==-1&&(y=R(y,/\f/g,"")),w>0&&ne(y)-p&&_e(w>32?cr(y+";",n,r,p-1,h):cr(R(y," ","")+";",n,r,p-2,h),h);break;case 59:y+=";";default:if(_e(k=ir(y,t,r,b,g,o,d,s,f=[],m=[],p,c),c),i===123)if(g===0)He(y,t,k,k,f,c,p,d,m);else switch(v===99&&Q(y,3)===110?100:v){case 100:case 108:case 109:case 115:He(e,k,k,n&&_e(ir(e,k,k,0,0,o,d,s,o,f=[],p,m),m),o,m,p,d,n?f:m);break;default:He(y,k,k,k,[""],m,0,d,m)}}b=g=w=0,I=a=1,s=y="",p=u;break;case 58:p=1+ne(y),w=C;default:if(I<1){if(i==123)--I;else if(i==125&&I++==0&&yo()==125)continue}switch(y+=Bt(i),i*I){case 38:a=g>0?1:(y+="\f",-1);break;case 44:d[b++]=(ne(y)-1)*a,a=1;break;case 64:me()===45&&(y+=gt(te())),v=me(),g=p=ne(s=y+=So(Ue())),i++;break;case 45:C===45&&ne(y)==2&&(I=0)}}return c}function ir(e,t,r,n,o,c,u,d,h,b,g,p){for(var v=o-1,w=o===0?c:[""],C=Vr(w),I=0,$=0,a=0;I<n;++I)for(var i=0,s=ve(e,v+1,v=Qr($=u[I])),f=e;i<C;++i)(f=Yr($>0?w[i]+" "+s:R(s,/&\f/g,w[i])))&&(h[a++]=f);return ot(e,t,r,o===0?rt:d,h,b,g,p)}function jo(e,t,r,n){return ot(e,t,r,qr,Bt(bo()),ve(e,2,-2),0,n)}function cr(e,t,r,n,o){return ot(e,t,r,Nt,ve(e,0,n),ve(e,n+1,-1),n,o)}function Jr(e,t,r){switch(mo(e,t)){case 5103:return L+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return L+e+e;case 4789:return Oe+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return L+e+Oe+e+U+e+e;case 5936:switch(Q(e,t+11)){case 114:return L+e+U+R(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return L+e+U+R(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return L+e+U+R(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return L+e+U+e+e;case 6165:return L+e+U+"flex-"+e+e;case 5187:return L+e+R(e,/(\w+).+(:[^]+)/,L+"box-$1$2"+U+"flex-$1$2")+e;case 5443:return L+e+U+"flex-item-"+R(e,/flex-|-self/g,"")+(ae(e,/flex-|baseline/)?"":U+"grid-row-"+R(e,/flex-|-self/g,""))+e;case 4675:return L+e+U+"flex-line-pack"+R(e,/align-content|flex-|-self/g,"")+e;case 5548:return L+e+U+R(e,"shrink","negative")+e;case 5292:return L+e+U+R(e,"basis","preferred-size")+e;case 6060:return L+"box-"+R(e,"-grow","")+L+e+U+R(e,"grow","positive")+e;case 4554:return L+R(e,/([^-])(transform)/g,"$1"+L+"$2")+e;case 6187:return R(R(R(e,/(zoom-|grab)/,L+"$1"),/(image-set)/,L+"$1"),e,"")+e;case 5495:case 3959:return R(e,/(image-set\([^]*)/,L+"$1$`$1");case 4968:return R(R(e,/(.+:)(flex-)?(.*)/,L+"box-pack:$3"+U+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+L+e+e;case 4200:if(!ae(e,/flex-|baseline/))return U+"grid-column-align"+ve(e,t)+e;break;case 2592:case 3360:return U+R(e,"template-","")+e;case 4384:case 3616:return r&&r.some(function(n,o){return t=o,ae(n.props,/grid-\w+-end/)})?~We(e+(r=r[t].value),"span",0)?e:U+R(e,"-start","")+e+U+"grid-row-span:"+(~We(r,"span",0)?ae(r,/\d+/):+ae(r,/\d+/)-+ae(e,/\d+/))+";":U+R(e,"-start","")+e;case 4896:case 4128:return r&&r.some(function(n){return ae(n.props,/grid-\w+-start/)})?e:U+R(R(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return R(e,/(.+)-inline(.+)/,L+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ne(e)-1-t>6)switch(Q(e,t+1)){case 109:if(Q(e,t+4)!==45)break;case 102:return R(e,/(.+:)(.+)-([^]+)/,"$1"+L+"$2-$3$1"+Oe+(Q(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~We(e,"stretch",0)?Jr(R(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return R(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,o,c,u,d,h,b){return U+o+":"+c+b+(u?U+o+"-span:"+(d?h:+h-+c)+b:"")+e});case 4949:if(Q(e,t+6)===121)return R(e,":",":"+L)+e;break;case 6444:switch(Q(e,Q(e,14)===45?18:11)){case 120:return R(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+L+(Q(e,14)===45?"inline-":"")+"box$3$1"+L+"$2$3$1"+U+"$2box$3")+e;case 100:return R(e,":",":"+U)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return R(e,"scroll-","scroll-snap-")+e}return e}function Ze(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Io(e,t,r,n){switch(e.type){case ho:if(e.children.length)break;case fo:case Nt:return e.return=e.return||e.value;case qr:return"";case Gr:return e.return=e.value+"{"+Ze(e.children,n)+"}";case rt:if(!ne(e.value=e.props.join(",")))return""}return ne(r=Ze(e.children,n))?e.return=e.value+"{"+r+"}":""}function To(e){var t=Vr(e);return function(r,n,o,c){for(var u="",d=0;d<t;d++)u+=e[d](r,n,o,c)||"";return u}}function Ao(e){return function(t){t.root||(t=t.return)&&e(t)}}function Eo(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Nt:e.return=Jr(e.value,e.length,r);return;case Gr:return Ze([de(e,{value:R(e.value,"@","@"+L)})],n);case rt:if(e.length)return go(r=e.props,function(o){switch(ae(o,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":xe(de(e,{props:[R(o,/:(read-\w+)/,":"+Oe+"$1")]})),xe(de(e,{props:[o]})),At(e,{props:sr(r,n)});break;case"::placeholder":xe(de(e,{props:[R(o,/:(plac\w+)/,":"+L+"input-$1")]})),xe(de(e,{props:[R(o,/:(plac\w+)/,":"+Oe+"$1")]})),xe(de(e,{props:[R(o,/:(plac\w+)/,U+"input-$1")]})),xe(de(e,{props:[o]})),At(e,{props:sr(r,n)});break}return""})}}var Mo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Se=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Xr="active",en="data-styled-version",st="6.1.19",Lt=`/*!sc*/
76
- `,Je=typeof window<"u"&&typeof document<"u",Ro=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY),it=Object.freeze([]),Ce=Object.freeze({});function _o(e,t,r){return r===void 0&&(r=Ce),e.theme!==r.theme&&e.theme||t||r.theme}var tn=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Po=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Oo=/(^-|-$)/g;function lr(e){return e.replace(Po,"-").replace(Oo,"")}var Do=/(a)(d)/gi,Le=52,dr=function(e){return String.fromCharCode(e+(e>25?39:97))};function Rt(e){var t,r="";for(t=Math.abs(e);t>Le;t=t/Le|0)r=dr(t%Le)+r;return(dr(t%Le)+r).replace(Do,"$1-$2")}var bt,rn=5381,we=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},nn=function(e){return we(rn,e)};function zo(e){return Rt(nn(e)>>>0)}function No(e){return e.displayName||e.name||"Component"}function yt(e){return typeof e=="string"&&!0}var on=typeof Symbol=="function"&&Symbol.for,an=on?Symbol.for("react.memo"):60115,Bo=on?Symbol.for("react.forward_ref"):60112,Lo={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Fo={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},sn={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ko=((bt={})[Bo]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},bt[an]=sn,bt);function ur(e){return("type"in(t=e)&&t.type.$$typeof)===an?sn:"$$typeof"in e?Ko[e.$$typeof]:Lo;var t}var Wo=Object.defineProperty,Uo=Object.getOwnPropertyNames,pr=Object.getOwnPropertySymbols,Ho=Object.getOwnPropertyDescriptor,qo=Object.getPrototypeOf,fr=Object.prototype;function cn(e,t,r){if(typeof t!="string"){if(fr){var n=qo(t);n&&n!==fr&&cn(e,n,r)}var o=Uo(t);pr&&(o=o.concat(pr(t)));for(var c=ur(e),u=ur(t),d=0;d<o.length;++d){var h=o[d];if(!(h in Fo||r&&r[h]||u&&h in u||c&&h in c)){var b=Ho(t,h);try{Wo(e,h,b)}catch{}}}}return e}function je(e){return typeof e=="function"}function Ft(e){return typeof e=="object"&&"styledComponentId"in e}function he(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function hr(e,t){if(e.length===0)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function ze(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function _t(e,t,r){if(r===void 0&&(r=!1),!r&&!ze(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=_t(e[n],t[n]);else if(ze(t))for(var n in t)e[n]=_t(e[n],t[n]);return e}function Kt(e,t){Object.defineProperty(e,"toString",{value:t})}function Ne(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Go=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var r=0,n=0;n<t;n++)r+=this.groupSizes[n];return r},e.prototype.insertRules=function(t,r){if(t>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,c=o;t>=c;)if((c<<=1)<0)throw Ne(16,"".concat(t));this.groupSizes=new Uint32Array(c),this.groupSizes.set(n),this.length=c;for(var u=o;u<c;u++)this.groupSizes[u]=0}for(var d=this.indexOfGroup(t+1),h=(u=0,r.length);u<h;u++)this.tag.insertRule(d,r[u])&&(this.groupSizes[t]++,d++)},e.prototype.clearGroup=function(t){if(t<this.length){var r=this.groupSizes[t],n=this.indexOfGroup(t),o=n+r;this.groupSizes[t]=0;for(var c=n;c<o;c++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(t){var r="";if(t>=this.length||this.groupSizes[t]===0)return r;for(var n=this.groupSizes[t],o=this.indexOfGroup(t),c=o+n,u=o;u<c;u++)r+="".concat(this.tag.getRule(u)).concat(Lt);return r},e}(),qe=new Map,Xe=new Map,Ge=1,Fe=function(e){if(qe.has(e))return qe.get(e);for(;Xe.has(Ge);)Ge++;var t=Ge++;return qe.set(e,t),Xe.set(t,e),t},Qo=function(e,t){Ge=t+1,qe.set(e,t),Xe.set(t,e)},Yo="style[".concat(Se,"][").concat(en,'="').concat(st,'"]'),Vo=new RegExp("^".concat(Se,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Zo=function(e,t,r){for(var n,o=r.split(","),c=0,u=o.length;c<u;c++)(n=o[c])&&e.registerName(t,n)},Jo=function(e,t){for(var r,n=((r=t.textContent)!==null&&r!==void 0?r:"").split(Lt),o=[],c=0,u=n.length;c<u;c++){var d=n[c].trim();if(d){var h=d.match(Vo);if(h){var b=0|parseInt(h[1],10),g=h[2];b!==0&&(Qo(g,b),Zo(e,g,h[3]),e.getTag().insertRules(b,o)),o.length=0}else o.push(d)}}},mr=function(e){for(var t=document.querySelectorAll(Yo),r=0,n=t.length;r<n;r++){var o=t[r];o&&o.getAttribute(Se)!==Xr&&(Jo(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function Xo(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var ln=function(e){var t=document.head,r=e||t,n=document.createElement("style"),o=function(d){var h=Array.from(d.querySelectorAll("style[".concat(Se,"]")));return h[h.length-1]}(r),c=o!==void 0?o.nextSibling:null;n.setAttribute(Se,Xr),n.setAttribute(en,st);var u=Xo();return u&&n.setAttribute("nonce",u),r.insertBefore(n,c),n},ea=function(){function e(t){this.element=ln(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(r){if(r.sheet)return r.sheet;for(var n=document.styleSheets,o=0,c=n.length;o<c;o++){var u=n[o];if(u.ownerNode===r)return u}throw Ne(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,r){try{return this.sheet.insertRule(r,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var r=this.sheet.cssRules[t];return r&&r.cssText?r.cssText:""},e}(),ta=function(){function e(t){this.element=ln(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,r){if(t<=this.length&&t>=0){var n=document.createTextNode(r);return this.element.insertBefore(n,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),ra=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,r){return t<=this.length&&(this.rules.splice(t,0,r),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),gr=Je,na={isServer:!Je,useCSSOMInjection:!Ro},dn=function(){function e(t,r,n){t===void 0&&(t=Ce),r===void 0&&(r={});var o=this;this.options=X(X({},na),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&Je&&gr&&(gr=!1,mr(this)),Kt(this,function(){return function(c){for(var u=c.getTag(),d=u.length,h="",b=function(p){var v=function(a){return Xe.get(a)}(p);if(v===void 0)return"continue";var w=c.names.get(v),C=u.getGroup(p);if(w===void 0||!w.size||C.length===0)return"continue";var I="".concat(Se,".g").concat(p,'[id="').concat(v,'"]'),$="";w!==void 0&&w.forEach(function(a){a.length>0&&($+="".concat(a,","))}),h+="".concat(C).concat(I,'{content:"').concat($,'"}').concat(Lt)},g=0;g<d;g++)b(g);return h}(o)})}return e.registerId=function(t){return Fe(t)},e.prototype.rehydrate=function(){!this.server&&Je&&mr(this)},e.prototype.reconstructWithOptions=function(t,r){return r===void 0&&(r=!0),new e(X(X({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(r){var n=r.useCSSOMInjection,o=r.target;return r.isServer?new ra(o):n?new ea(o):new ta(o)}(this.options),new Go(t)));var t},e.prototype.hasNameForId=function(t,r){return this.names.has(t)&&this.names.get(t).has(r)},e.prototype.registerName=function(t,r){if(Fe(t),this.names.has(t))this.names.get(t).add(r);else{var n=new Set;n.add(r),this.names.set(t,n)}},e.prototype.insertRules=function(t,r,n){this.registerName(t,r),this.getTag().insertRules(Fe(t),n)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Fe(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),oa=/&/g,aa=/^\s*\/\/.*$/gm;function un(e,t){return e.map(function(r){return r.type==="rule"&&(r.value="".concat(t," ").concat(r.value),r.value=r.value.replaceAll(",",",".concat(t," ")),r.props=r.props.map(function(n){return"".concat(t," ").concat(n)})),Array.isArray(r.children)&&r.type!=="@keyframes"&&(r.children=un(r.children,t)),r})}function sa(e){var t,r,n,o=Ce,c=o.options,u=c===void 0?Ce:c,d=o.plugins,h=d===void 0?it:d,b=function(v,w,C){return C.startsWith(r)&&C.endsWith(r)&&C.replaceAll(r,"").length>0?".".concat(t):v},g=h.slice();g.push(function(v){v.type===rt&&v.value.includes("&")&&(v.props[0]=v.props[0].replace(oa,r).replace(n,b))}),u.prefix&&g.push(Eo),g.push(Io);var p=function(v,w,C,I){w===void 0&&(w=""),C===void 0&&(C=""),I===void 0&&(I="&"),t=I,r=w,n=new RegExp("\\".concat(r,"\\b"),"g");var $=v.replace(aa,""),a=Co(C||w?"".concat(C," ").concat(w," { ").concat($," }"):$);u.namespace&&(a=un(a,u.namespace));var i=[];return Ze(a,To(g.concat(Ao(function(s){return i.push(s)})))),i};return p.hash=h.length?h.reduce(function(v,w){return w.name||Ne(15),we(v,w.name)},rn).toString():"",p}var ia=new dn,Pt=sa(),pn=x.createContext({shouldForwardProp:void 0,styleSheet:ia,stylis:Pt});pn.Consumer;x.createContext(void 0);function br(){return x.useContext(pn)}var ca=function(){function e(t,r){var n=this;this.inject=function(o,c){c===void 0&&(c=Pt);var u=n.name+c.hash;o.hasNameForId(n.id,u)||o.insertRules(n.id,u,c(n.rules,u,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=r,Kt(this,function(){throw Ne(12,String(n.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Pt),this.name+t.hash},e}(),la=function(e){return e>="A"&&e<="Z"};function yr(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(r===1&&n==="-"&&e[0]==="-")return e;la(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var fn=function(e){return e==null||e===!1||e===""},hn=function(e){var t,r,n=[];for(var o in e){var c=e[o];e.hasOwnProperty(o)&&!fn(c)&&(Array.isArray(c)&&c.isCss||je(c)?n.push("".concat(yr(o),":"),c,";"):ze(c)?n.push.apply(n,Ve(Ve(["".concat(o," {")],hn(c),!1),["}"],!1)):n.push("".concat(yr(o),": ").concat((t=o,(r=c)==null||typeof r=="boolean"||r===""?"":typeof r!="number"||r===0||t in Mo||t.startsWith("--")?String(r).trim():"".concat(r,"px")),";")))}return n};function ge(e,t,r,n){if(fn(e))return[];if(Ft(e))return[".".concat(e.styledComponentId)];if(je(e)){if(!je(c=e)||c.prototype&&c.prototype.isReactComponent||!t)return[e];var o=e(t);return ge(o,t,r,n)}var c;return e instanceof ca?r?(e.inject(r,n),[e.getName(n)]):[e]:ze(e)?hn(e):Array.isArray(e)?Array.prototype.concat.apply(it,e.map(function(u){return ge(u,t,r,n)})):[e.toString()]}function da(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(je(r)&&!Ft(r))return!1}return!0}var ua=nn(st),pa=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&da(t),this.componentId=r,this.baseHash=we(ua,r),this.baseStyle=n,dn.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,r,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(this.componentId,this.staticRulesId))o=he(o,this.staticRulesId);else{var c=hr(ge(this.rules,t,r,n)),u=Rt(we(this.baseHash,c)>>>0);if(!r.hasNameForId(this.componentId,u)){var d=n(c,".".concat(u),void 0,this.componentId);r.insertRules(this.componentId,u,d)}o=he(o,u),this.staticRulesId=u}else{for(var h=we(this.baseHash,n.hash),b="",g=0;g<this.rules.length;g++){var p=this.rules[g];if(typeof p=="string")b+=p;else if(p){var v=hr(ge(p,t,r,n));h=we(h,v+g),b+=v}}if(b){var w=Rt(h>>>0);r.hasNameForId(this.componentId,w)||r.insertRules(this.componentId,w,n(b,".".concat(w),void 0,this.componentId)),o=he(o,w)}}return o},e}(),mn=x.createContext(void 0);mn.Consumer;var xt={};function fa(e,t,r){var n=Ft(e),o=e,c=!yt(e),u=t.attrs,d=u===void 0?it:u,h=t.componentId,b=h===void 0?function(f,m){var k=typeof f!="string"?"sc":lr(f);xt[k]=(xt[k]||0)+1;var y="".concat(k,"-").concat(zo(st+k+xt[k]));return m?"".concat(m,"-").concat(y):y}(t.displayName,t.parentComponentId):h,g=t.displayName,p=g===void 0?function(f){return yt(f)?"styled.".concat(f):"Styled(".concat(No(f),")")}(e):g,v=t.displayName&&t.componentId?"".concat(lr(t.displayName),"-").concat(t.componentId):t.componentId||b,w=n&&o.attrs?o.attrs.concat(d).filter(Boolean):d,C=t.shouldForwardProp;if(n&&o.shouldForwardProp){var I=o.shouldForwardProp;if(t.shouldForwardProp){var $=t.shouldForwardProp;C=function(f,m){return I(f,m)&&$(f,m)}}else C=I}var a=new pa(r,v,n?o.componentStyle:void 0);function i(f,m){return function(k,y,A){var M=k.attrs,z=k.componentStyle,P=k.defaultProps,K=k.foldedComponentIds,j=k.styledComponentId,W=k.target,T=x.useContext(mn),D=br(),H=k.shouldForwardProp||D.shouldForwardProp,S=_o(y,T,P)||Ce,O=function(q,V,Z){for(var se,ie=X(X({},V),{className:void 0,theme:Z}),Ee=0;Ee<q.length;Ee+=1){var pe=je(se=q[Ee])?se(ie):se;for(var J in pe)ie[J]=J==="className"?he(ie[J],pe[J]):J==="style"?X(X({},ie[J]),pe[J]):pe[J]}return V.className&&(ie.className=he(ie.className,V.className)),ie}(M,y,S),N=O.as||W,F={};for(var _ in O)O[_]===void 0||_[0]==="$"||_==="as"||_==="theme"&&O.theme===S||(_==="forwardedAs"?F.as=O.forwardedAs:H&&!H(_,N)||(F[_]=O[_]));var Y=function(q,V){var Z=br(),se=q.generateAndInjectStyles(V,Z.styleSheet,Z.stylis);return se}(z,O),B=he(K,j);return Y&&(B+=" "+Y),O.className&&(B+=" "+O.className),F[yt(N)&&!tn.has(N)?"class":"className"]=B,A&&(F.ref=A),x.createElement(N,F)}(s,f,m)}i.displayName=p;var s=x.forwardRef(i);return s.attrs=w,s.componentStyle=a,s.displayName=p,s.shouldForwardProp=C,s.foldedComponentIds=n?he(o.foldedComponentIds,o.styledComponentId):"",s.styledComponentId=v,s.target=n?o.target:e,Object.defineProperty(s,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(f){this._foldedDefaultProps=n?function(m){for(var k=[],y=1;y<arguments.length;y++)k[y-1]=arguments[y];for(var A=0,M=k;A<M.length;A++)_t(m,M[A],!0);return m}({},o.defaultProps,f):f}}),Kt(s,function(){return".".concat(s.styledComponentId)}),c&&cn(s,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),s}function xr(e,t){for(var r=[e[0]],n=0,o=t.length;n<o;n+=1)r.push(t[n],e[n+1]);return r}var kr=function(e){return Object.assign(e,{isCss:!0})};function ha(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(je(e)||ze(e))return kr(ge(xr(it,Ve([e],t,!0))));var n=e;return t.length===0&&n.length===1&&typeof n[0]=="string"?ge(n):kr(ge(xr(n,t)))}function Ot(e,t,r){if(r===void 0&&(r=Ce),!t)throw Ne(1,t);var n=function(o){for(var c=[],u=1;u<arguments.length;u++)c[u-1]=arguments[u];return e(t,r,ha.apply(void 0,Ve([o],c,!1)))};return n.attrs=function(o){return Ot(e,t,X(X({},r),{attrs:Array.prototype.concat(r.attrs,o).filter(Boolean)}))},n.withConfig=function(o){return Ot(e,t,X(X({},r),o))},n}var gn=function(e){return Ot(fa,e)},E=gn;tn.forEach(function(e){E[e]=gn(e)});const ma=E.div`
75
+ */const po=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fo=Te("x",po);var X=function(){return X=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},X.apply(this,arguments)};function Ze(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,c;n<o;n++)(c||!(n in t))&&(c||(c=Array.prototype.slice.call(t,0,n)),c[n]=t[n]);return e.concat(c||Array.prototype.slice.call(t))}var U="-ms-",Oe="-moz-",L="-webkit-",Gr="comm",nt="rule",Bt="decl",ho="@import",Qr="@keyframes",mo="@layer",Yr=Math.abs,Lt=String.fromCharCode,Et=Object.assign;function go(e,t){return Q(e,0)^45?(((t<<2^Q(e,0))<<2^Q(e,1))<<2^Q(e,2))<<2^Q(e,3):0}function Vr(e){return e.trim()}function ae(e,t){return(e=t.exec(e))?e[0]:e}function M(e,t,r){return e.replace(t,r)}function Ue(e,t,r){return e.indexOf(t,r)}function Q(e,t){return e.charCodeAt(t)|0}function ve(e,t,r){return e.slice(t,r)}function ne(e){return e.length}function Zr(e){return e.length}function _e(e,t){return t.push(e),e}function bo(e,t){return e.map(t).join("")}function ir(e,t){return e.filter(function(r){return!ae(r,t)})}var ot=1,$e=1,Jr=0,ee=0,G=0,Ae="";function at(e,t,r,n,o,c,u,d){return{value:e,root:t,parent:r,type:n,props:o,children:c,line:ot,column:$e,length:u,return:"",siblings:d}}function de(e,t){return Et(at("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function xe(e){for(;e.root;)e=de(e.root,{children:[e]});_e(e,e.siblings)}function yo(){return G}function xo(){return G=ee>0?Q(Ae,--ee):0,$e--,G===10&&($e=1,ot--),G}function te(){return G=ee<Jr?Q(Ae,ee++):0,$e++,G===10&&($e=1,ot++),G}function me(){return Q(Ae,ee)}function He(){return ee}function st(e,t){return ve(Ae,e,t)}function Rt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ko(e){return ot=$e=1,Jr=ne(Ae=e),ee=0,[]}function wo(e){return Ae="",e}function bt(e){return Vr(st(ee-1,Mt(e===91?e+2:e===40?e+1:e)))}function vo(e){for(;(G=me())&&G<33;)te();return Rt(e)>2||Rt(G)>3?"":" "}function $o(e,t){for(;--t&&te()&&!(G<48||G>102||G>57&&G<65||G>70&&G<97););return st(e,He()+(t<6&&me()==32&&te()==32))}function Mt(e){for(;te();)switch(G){case e:return ee;case 34:case 39:e!==34&&e!==39&&Mt(G);break;case 40:e===41&&Mt(e);break;case 92:te();break}return ee}function So(e,t){for(;te()&&e+G!==57;)if(e+G===84&&me()===47)break;return"/*"+st(t,ee-1)+"*"+Lt(e===47?e:te())}function Co(e){for(;!Rt(me());)te();return st(e,ee)}function jo(e){return wo(qe("",null,null,null,[""],e=ko(e),0,[0],e))}function qe(e,t,r,n,o,c,u,d,h){for(var b=0,g=0,p=u,v=0,w=0,C=0,I=1,$=1,a=1,i=0,s="",f=o,m=c,k=n,y=s;$;)switch(C=i,i=te()){case 40:if(C!=108&&Q(y,p-1)==58){Ue(y+=M(bt(i),"&","&\f"),"&\f",Yr(b?d[b-1]:0))!=-1&&(a=-1);break}case 34:case 39:case 91:y+=bt(i);break;case 9:case 10:case 13:case 32:y+=vo(C);break;case 92:y+=$o(He()-1,7);continue;case 47:switch(me()){case 42:case 47:_e(Io(So(te(),He()),t,r,h),h);break;default:y+="/"}break;case 123*I:d[b++]=ne(y)*a;case 125*I:case 59:case 0:switch(i){case 0:case 125:$=0;case 59+g:a==-1&&(y=M(y,/\f/g,"")),w>0&&ne(y)-p&&_e(w>32?lr(y+";",n,r,p-1,h):lr(M(y," ","")+";",n,r,p-2,h),h);break;case 59:y+=";";default:if(_e(k=cr(y,t,r,b,g,o,d,s,f=[],m=[],p,c),c),i===123)if(g===0)qe(y,t,k,k,f,c,p,d,m);else switch(v===99&&Q(y,3)===110?100:v){case 100:case 108:case 109:case 115:qe(e,k,k,n&&_e(cr(e,k,k,0,0,o,d,s,o,f=[],p,m),m),o,m,p,d,n?f:m);break;default:qe(y,k,k,k,[""],m,0,d,m)}}b=g=w=0,I=a=1,s=y="",p=u;break;case 58:p=1+ne(y),w=C;default:if(I<1){if(i==123)--I;else if(i==125&&I++==0&&xo()==125)continue}switch(y+=Lt(i),i*I){case 38:a=g>0?1:(y+="\f",-1);break;case 44:d[b++]=(ne(y)-1)*a,a=1;break;case 64:me()===45&&(y+=bt(te())),v=me(),g=p=ne(s=y+=Co(He())),i++;break;case 45:C===45&&ne(y)==2&&(I=0)}}return c}function cr(e,t,r,n,o,c,u,d,h,b,g,p){for(var v=o-1,w=o===0?c:[""],C=Zr(w),I=0,$=0,a=0;I<n;++I)for(var i=0,s=ve(e,v+1,v=Yr($=u[I])),f=e;i<C;++i)(f=Vr($>0?w[i]+" "+s:M(s,/&\f/g,w[i])))&&(h[a++]=f);return at(e,t,r,o===0?nt:d,h,b,g,p)}function Io(e,t,r,n){return at(e,t,r,Gr,Lt(yo()),ve(e,2,-2),0,n)}function lr(e,t,r,n,o){return at(e,t,r,Bt,ve(e,0,n),ve(e,n+1,-1),n,o)}function Xr(e,t,r){switch(go(e,t)){case 5103:return L+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return L+e+e;case 4789:return Oe+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return L+e+Oe+e+U+e+e;case 5936:switch(Q(e,t+11)){case 114:return L+e+U+M(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return L+e+U+M(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return L+e+U+M(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return L+e+U+e+e;case 6165:return L+e+U+"flex-"+e+e;case 5187:return L+e+M(e,/(\w+).+(:[^]+)/,L+"box-$1$2"+U+"flex-$1$2")+e;case 5443:return L+e+U+"flex-item-"+M(e,/flex-|-self/g,"")+(ae(e,/flex-|baseline/)?"":U+"grid-row-"+M(e,/flex-|-self/g,""))+e;case 4675:return L+e+U+"flex-line-pack"+M(e,/align-content|flex-|-self/g,"")+e;case 5548:return L+e+U+M(e,"shrink","negative")+e;case 5292:return L+e+U+M(e,"basis","preferred-size")+e;case 6060:return L+"box-"+M(e,"-grow","")+L+e+U+M(e,"grow","positive")+e;case 4554:return L+M(e,/([^-])(transform)/g,"$1"+L+"$2")+e;case 6187:return M(M(M(e,/(zoom-|grab)/,L+"$1"),/(image-set)/,L+"$1"),e,"")+e;case 5495:case 3959:return M(e,/(image-set\([^]*)/,L+"$1$`$1");case 4968:return M(M(e,/(.+:)(flex-)?(.*)/,L+"box-pack:$3"+U+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+L+e+e;case 4200:if(!ae(e,/flex-|baseline/))return U+"grid-column-align"+ve(e,t)+e;break;case 2592:case 3360:return U+M(e,"template-","")+e;case 4384:case 3616:return r&&r.some(function(n,o){return t=o,ae(n.props,/grid-\w+-end/)})?~Ue(e+(r=r[t].value),"span",0)?e:U+M(e,"-start","")+e+U+"grid-row-span:"+(~Ue(r,"span",0)?ae(r,/\d+/):+ae(r,/\d+/)-+ae(e,/\d+/))+";":U+M(e,"-start","")+e;case 4896:case 4128:return r&&r.some(function(n){return ae(n.props,/grid-\w+-start/)})?e:U+M(M(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return M(e,/(.+)-inline(.+)/,L+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ne(e)-1-t>6)switch(Q(e,t+1)){case 109:if(Q(e,t+4)!==45)break;case 102:return M(e,/(.+:)(.+)-([^]+)/,"$1"+L+"$2-$3$1"+Oe+(Q(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ue(e,"stretch",0)?Xr(M(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return M(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,o,c,u,d,h,b){return U+o+":"+c+b+(u?U+o+"-span:"+(d?h:+h-+c)+b:"")+e});case 4949:if(Q(e,t+6)===121)return M(e,":",":"+L)+e;break;case 6444:switch(Q(e,Q(e,14)===45?18:11)){case 120:return M(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+L+(Q(e,14)===45?"inline-":"")+"box$3$1"+L+"$2$3$1"+U+"$2box$3")+e;case 100:return M(e,":",":"+U)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return M(e,"scroll-","scroll-snap-")+e}return e}function Je(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function To(e,t,r,n){switch(e.type){case mo:if(e.children.length)break;case ho:case Bt:return e.return=e.return||e.value;case Gr:return"";case Qr:return e.return=e.value+"{"+Je(e.children,n)+"}";case nt:if(!ne(e.value=e.props.join(",")))return""}return ne(r=Je(e.children,n))?e.return=e.value+"{"+r+"}":""}function Ao(e){var t=Zr(e);return function(r,n,o,c){for(var u="",d=0;d<t;d++)u+=e[d](r,n,o,c)||"";return u}}function Eo(e){return function(t){t.root||(t=t.return)&&e(t)}}function Ro(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Bt:e.return=Xr(e.value,e.length,r);return;case Qr:return Je([de(e,{value:M(e.value,"@","@"+L)})],n);case nt:if(e.length)return bo(r=e.props,function(o){switch(ae(o,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":xe(de(e,{props:[M(o,/:(read-\w+)/,":"+Oe+"$1")]})),xe(de(e,{props:[o]})),Et(e,{props:ir(r,n)});break;case"::placeholder":xe(de(e,{props:[M(o,/:(plac\w+)/,":"+L+"input-$1")]})),xe(de(e,{props:[M(o,/:(plac\w+)/,":"+Oe+"$1")]})),xe(de(e,{props:[M(o,/:(plac\w+)/,U+"input-$1")]})),xe(de(e,{props:[o]})),Et(e,{props:ir(r,n)});break}return""})}}var Mo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Se=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",en="active",tn="data-styled-version",it="6.1.19",Ft=`/*!sc*/
76
+ `,Xe=typeof window<"u"&&typeof document<"u",_o=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY),ct=Object.freeze([]),Ce=Object.freeze({});function Po(e,t,r){return r===void 0&&(r=Ce),e.theme!==r.theme&&e.theme||t||r.theme}var rn=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Oo=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Do=/(^-|-$)/g;function dr(e){return e.replace(Oo,"-").replace(Do,"")}var zo=/(a)(d)/gi,Fe=52,ur=function(e){return String.fromCharCode(e+(e>25?39:97))};function _t(e){var t,r="";for(t=Math.abs(e);t>Fe;t=t/Fe|0)r=ur(t%Fe)+r;return(ur(t%Fe)+r).replace(zo,"$1-$2")}var yt,nn=5381,we=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},on=function(e){return we(nn,e)};function No(e){return _t(on(e)>>>0)}function Bo(e){return e.displayName||e.name||"Component"}function xt(e){return typeof e=="string"&&!0}var an=typeof Symbol=="function"&&Symbol.for,sn=an?Symbol.for("react.memo"):60115,Lo=an?Symbol.for("react.forward_ref"):60112,Fo={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Ko={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},cn={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Wo=((yt={})[Lo]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yt[sn]=cn,yt);function pr(e){return("type"in(t=e)&&t.type.$$typeof)===sn?cn:"$$typeof"in e?Wo[e.$$typeof]:Fo;var t}var Uo=Object.defineProperty,Ho=Object.getOwnPropertyNames,fr=Object.getOwnPropertySymbols,qo=Object.getOwnPropertyDescriptor,Go=Object.getPrototypeOf,hr=Object.prototype;function ln(e,t,r){if(typeof t!="string"){if(hr){var n=Go(t);n&&n!==hr&&ln(e,n,r)}var o=Ho(t);fr&&(o=o.concat(fr(t)));for(var c=pr(e),u=pr(t),d=0;d<o.length;++d){var h=o[d];if(!(h in Ko||r&&r[h]||u&&h in u||c&&h in c)){var b=qo(t,h);try{Uo(e,h,b)}catch{}}}}return e}function je(e){return typeof e=="function"}function Kt(e){return typeof e=="object"&&"styledComponentId"in e}function he(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function mr(e,t){if(e.length===0)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function ze(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Pt(e,t,r){if(r===void 0&&(r=!1),!r&&!ze(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=Pt(e[n],t[n]);else if(ze(t))for(var n in t)e[n]=Pt(e[n],t[n]);return e}function Wt(e,t){Object.defineProperty(e,"toString",{value:t})}function Ne(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Qo=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var r=0,n=0;n<t;n++)r+=this.groupSizes[n];return r},e.prototype.insertRules=function(t,r){if(t>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,c=o;t>=c;)if((c<<=1)<0)throw Ne(16,"".concat(t));this.groupSizes=new Uint32Array(c),this.groupSizes.set(n),this.length=c;for(var u=o;u<c;u++)this.groupSizes[u]=0}for(var d=this.indexOfGroup(t+1),h=(u=0,r.length);u<h;u++)this.tag.insertRule(d,r[u])&&(this.groupSizes[t]++,d++)},e.prototype.clearGroup=function(t){if(t<this.length){var r=this.groupSizes[t],n=this.indexOfGroup(t),o=n+r;this.groupSizes[t]=0;for(var c=n;c<o;c++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(t){var r="";if(t>=this.length||this.groupSizes[t]===0)return r;for(var n=this.groupSizes[t],o=this.indexOfGroup(t),c=o+n,u=o;u<c;u++)r+="".concat(this.tag.getRule(u)).concat(Ft);return r},e}(),Ge=new Map,et=new Map,Qe=1,Ke=function(e){if(Ge.has(e))return Ge.get(e);for(;et.has(Qe);)Qe++;var t=Qe++;return Ge.set(e,t),et.set(t,e),t},Yo=function(e,t){Qe=t+1,Ge.set(e,t),et.set(t,e)},Vo="style[".concat(Se,"][").concat(tn,'="').concat(it,'"]'),Zo=new RegExp("^".concat(Se,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Jo=function(e,t,r){for(var n,o=r.split(","),c=0,u=o.length;c<u;c++)(n=o[c])&&e.registerName(t,n)},Xo=function(e,t){for(var r,n=((r=t.textContent)!==null&&r!==void 0?r:"").split(Ft),o=[],c=0,u=n.length;c<u;c++){var d=n[c].trim();if(d){var h=d.match(Zo);if(h){var b=0|parseInt(h[1],10),g=h[2];b!==0&&(Yo(g,b),Jo(e,g,h[3]),e.getTag().insertRules(b,o)),o.length=0}else o.push(d)}}},gr=function(e){for(var t=document.querySelectorAll(Vo),r=0,n=t.length;r<n;r++){var o=t[r];o&&o.getAttribute(Se)!==en&&(Xo(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function ea(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var dn=function(e){var t=document.head,r=e||t,n=document.createElement("style"),o=function(d){var h=Array.from(d.querySelectorAll("style[".concat(Se,"]")));return h[h.length-1]}(r),c=o!==void 0?o.nextSibling:null;n.setAttribute(Se,en),n.setAttribute(tn,it);var u=ea();return u&&n.setAttribute("nonce",u),r.insertBefore(n,c),n},ta=function(){function e(t){this.element=dn(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(r){if(r.sheet)return r.sheet;for(var n=document.styleSheets,o=0,c=n.length;o<c;o++){var u=n[o];if(u.ownerNode===r)return u}throw Ne(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,r){try{return this.sheet.insertRule(r,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var r=this.sheet.cssRules[t];return r&&r.cssText?r.cssText:""},e}(),ra=function(){function e(t){this.element=dn(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,r){if(t<=this.length&&t>=0){var n=document.createTextNode(r);return this.element.insertBefore(n,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),na=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,r){return t<=this.length&&(this.rules.splice(t,0,r),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),br=Xe,oa={isServer:!Xe,useCSSOMInjection:!_o},un=function(){function e(t,r,n){t===void 0&&(t=Ce),r===void 0&&(r={});var o=this;this.options=X(X({},oa),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&Xe&&br&&(br=!1,gr(this)),Wt(this,function(){return function(c){for(var u=c.getTag(),d=u.length,h="",b=function(p){var v=function(a){return et.get(a)}(p);if(v===void 0)return"continue";var w=c.names.get(v),C=u.getGroup(p);if(w===void 0||!w.size||C.length===0)return"continue";var I="".concat(Se,".g").concat(p,'[id="').concat(v,'"]'),$="";w!==void 0&&w.forEach(function(a){a.length>0&&($+="".concat(a,","))}),h+="".concat(C).concat(I,'{content:"').concat($,'"}').concat(Ft)},g=0;g<d;g++)b(g);return h}(o)})}return e.registerId=function(t){return Ke(t)},e.prototype.rehydrate=function(){!this.server&&Xe&&gr(this)},e.prototype.reconstructWithOptions=function(t,r){return r===void 0&&(r=!0),new e(X(X({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(r){var n=r.useCSSOMInjection,o=r.target;return r.isServer?new na(o):n?new ta(o):new ra(o)}(this.options),new Qo(t)));var t},e.prototype.hasNameForId=function(t,r){return this.names.has(t)&&this.names.get(t).has(r)},e.prototype.registerName=function(t,r){if(Ke(t),this.names.has(t))this.names.get(t).add(r);else{var n=new Set;n.add(r),this.names.set(t,n)}},e.prototype.insertRules=function(t,r,n){this.registerName(t,r),this.getTag().insertRules(Ke(t),n)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Ke(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),aa=/&/g,sa=/^\s*\/\/.*$/gm;function pn(e,t){return e.map(function(r){return r.type==="rule"&&(r.value="".concat(t," ").concat(r.value),r.value=r.value.replaceAll(",",",".concat(t," ")),r.props=r.props.map(function(n){return"".concat(t," ").concat(n)})),Array.isArray(r.children)&&r.type!=="@keyframes"&&(r.children=pn(r.children,t)),r})}function ia(e){var t,r,n,o=Ce,c=o.options,u=c===void 0?Ce:c,d=o.plugins,h=d===void 0?ct:d,b=function(v,w,C){return C.startsWith(r)&&C.endsWith(r)&&C.replaceAll(r,"").length>0?".".concat(t):v},g=h.slice();g.push(function(v){v.type===nt&&v.value.includes("&")&&(v.props[0]=v.props[0].replace(aa,r).replace(n,b))}),u.prefix&&g.push(Ro),g.push(To);var p=function(v,w,C,I){w===void 0&&(w=""),C===void 0&&(C=""),I===void 0&&(I="&"),t=I,r=w,n=new RegExp("\\".concat(r,"\\b"),"g");var $=v.replace(sa,""),a=jo(C||w?"".concat(C," ").concat(w," { ").concat($," }"):$);u.namespace&&(a=pn(a,u.namespace));var i=[];return Je(a,Ao(g.concat(Eo(function(s){return i.push(s)})))),i};return p.hash=h.length?h.reduce(function(v,w){return w.name||Ne(15),we(v,w.name)},nn).toString():"",p}var ca=new un,Ot=ia(),fn=x.createContext({shouldForwardProp:void 0,styleSheet:ca,stylis:Ot});fn.Consumer;x.createContext(void 0);function yr(){return x.useContext(fn)}var la=function(){function e(t,r){var n=this;this.inject=function(o,c){c===void 0&&(c=Ot);var u=n.name+c.hash;o.hasNameForId(n.id,u)||o.insertRules(n.id,u,c(n.rules,u,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=r,Wt(this,function(){throw Ne(12,String(n.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Ot),this.name+t.hash},e}(),da=function(e){return e>="A"&&e<="Z"};function xr(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(r===1&&n==="-"&&e[0]==="-")return e;da(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var hn=function(e){return e==null||e===!1||e===""},mn=function(e){var t,r,n=[];for(var o in e){var c=e[o];e.hasOwnProperty(o)&&!hn(c)&&(Array.isArray(c)&&c.isCss||je(c)?n.push("".concat(xr(o),":"),c,";"):ze(c)?n.push.apply(n,Ze(Ze(["".concat(o," {")],mn(c),!1),["}"],!1)):n.push("".concat(xr(o),": ").concat((t=o,(r=c)==null||typeof r=="boolean"||r===""?"":typeof r!="number"||r===0||t in Mo||t.startsWith("--")?String(r).trim():"".concat(r,"px")),";")))}return n};function ge(e,t,r,n){if(hn(e))return[];if(Kt(e))return[".".concat(e.styledComponentId)];if(je(e)){if(!je(c=e)||c.prototype&&c.prototype.isReactComponent||!t)return[e];var o=e(t);return ge(o,t,r,n)}var c;return e instanceof la?r?(e.inject(r,n),[e.getName(n)]):[e]:ze(e)?mn(e):Array.isArray(e)?Array.prototype.concat.apply(ct,e.map(function(u){return ge(u,t,r,n)})):[e.toString()]}function ua(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(je(r)&&!Kt(r))return!1}return!0}var pa=on(it),fa=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&ua(t),this.componentId=r,this.baseHash=we(pa,r),this.baseStyle=n,un.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,r,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(this.componentId,this.staticRulesId))o=he(o,this.staticRulesId);else{var c=mr(ge(this.rules,t,r,n)),u=_t(we(this.baseHash,c)>>>0);if(!r.hasNameForId(this.componentId,u)){var d=n(c,".".concat(u),void 0,this.componentId);r.insertRules(this.componentId,u,d)}o=he(o,u),this.staticRulesId=u}else{for(var h=we(this.baseHash,n.hash),b="",g=0;g<this.rules.length;g++){var p=this.rules[g];if(typeof p=="string")b+=p;else if(p){var v=mr(ge(p,t,r,n));h=we(h,v+g),b+=v}}if(b){var w=_t(h>>>0);r.hasNameForId(this.componentId,w)||r.insertRules(this.componentId,w,n(b,".".concat(w),void 0,this.componentId)),o=he(o,w)}}return o},e}(),gn=x.createContext(void 0);gn.Consumer;var kt={};function ha(e,t,r){var n=Kt(e),o=e,c=!xt(e),u=t.attrs,d=u===void 0?ct:u,h=t.componentId,b=h===void 0?function(f,m){var k=typeof f!="string"?"sc":dr(f);kt[k]=(kt[k]||0)+1;var y="".concat(k,"-").concat(No(it+k+kt[k]));return m?"".concat(m,"-").concat(y):y}(t.displayName,t.parentComponentId):h,g=t.displayName,p=g===void 0?function(f){return xt(f)?"styled.".concat(f):"Styled(".concat(Bo(f),")")}(e):g,v=t.displayName&&t.componentId?"".concat(dr(t.displayName),"-").concat(t.componentId):t.componentId||b,w=n&&o.attrs?o.attrs.concat(d).filter(Boolean):d,C=t.shouldForwardProp;if(n&&o.shouldForwardProp){var I=o.shouldForwardProp;if(t.shouldForwardProp){var $=t.shouldForwardProp;C=function(f,m){return I(f,m)&&$(f,m)}}else C=I}var a=new fa(r,v,n?o.componentStyle:void 0);function i(f,m){return function(k,y,A){var R=k.attrs,z=k.componentStyle,P=k.defaultProps,K=k.foldedComponentIds,j=k.styledComponentId,W=k.target,T=x.useContext(gn),D=yr(),H=k.shouldForwardProp||D.shouldForwardProp,S=Po(y,T,P)||Ce,O=function(q,V,Z){for(var se,ie=X(X({},V),{className:void 0,theme:Z}),Ee=0;Ee<q.length;Ee+=1){var pe=je(se=q[Ee])?se(ie):se;for(var J in pe)ie[J]=J==="className"?he(ie[J],pe[J]):J==="style"?X(X({},ie[J]),pe[J]):pe[J]}return V.className&&(ie.className=he(ie.className,V.className)),ie}(R,y,S),N=O.as||W,F={};for(var _ in O)O[_]===void 0||_[0]==="$"||_==="as"||_==="theme"&&O.theme===S||(_==="forwardedAs"?F.as=O.forwardedAs:H&&!H(_,N)||(F[_]=O[_]));var Y=function(q,V){var Z=yr(),se=q.generateAndInjectStyles(V,Z.styleSheet,Z.stylis);return se}(z,O),B=he(K,j);return Y&&(B+=" "+Y),O.className&&(B+=" "+O.className),F[xt(N)&&!rn.has(N)?"class":"className"]=B,A&&(F.ref=A),x.createElement(N,F)}(s,f,m)}i.displayName=p;var s=x.forwardRef(i);return s.attrs=w,s.componentStyle=a,s.displayName=p,s.shouldForwardProp=C,s.foldedComponentIds=n?he(o.foldedComponentIds,o.styledComponentId):"",s.styledComponentId=v,s.target=n?o.target:e,Object.defineProperty(s,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(f){this._foldedDefaultProps=n?function(m){for(var k=[],y=1;y<arguments.length;y++)k[y-1]=arguments[y];for(var A=0,R=k;A<R.length;A++)Pt(m,R[A],!0);return m}({},o.defaultProps,f):f}}),Wt(s,function(){return".".concat(s.styledComponentId)}),c&&ln(s,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),s}function kr(e,t){for(var r=[e[0]],n=0,o=t.length;n<o;n+=1)r.push(t[n],e[n+1]);return r}var wr=function(e){return Object.assign(e,{isCss:!0})};function Be(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(je(e)||ze(e))return wr(ge(kr(ct,Ze([e],t,!0))));var n=e;return t.length===0&&n.length===1&&typeof n[0]=="string"?ge(n):wr(ge(kr(n,t)))}function Dt(e,t,r){if(r===void 0&&(r=Ce),!t)throw Ne(1,t);var n=function(o){for(var c=[],u=1;u<arguments.length;u++)c[u-1]=arguments[u];return e(t,r,Be.apply(void 0,Ze([o],c,!1)))};return n.attrs=function(o){return Dt(e,t,X(X({},r),{attrs:Array.prototype.concat(r.attrs,o).filter(Boolean)}))},n.withConfig=function(o){return Dt(e,t,X(X({},r),o))},n}var bn=function(e){return Dt(ha,e)},E=bn;rn.forEach(function(e){E[e]=bn(e)});const ma=E.div`
77
77
  display: flex;
78
78
  align-items: center;
79
79
  gap: 4px;
80
80
  margin-top: 6px;
81
81
  padding-left: 2px;
82
- `,wr=E.button`
82
+ `,vr=E.button`
83
83
  cursor: pointer;
84
84
  display: inline-flex;
85
85
  align-items: center;
@@ -111,19 +111,12 @@ ${n}
111
111
  color: #f9fafb;
112
112
  }
113
113
  }
114
- `;function bn({content:e,disabled:t,onExportPdf:r}){const[n,o]=x.useState(!1),c=()=>{Qn(e)},u=async()=>{o(!0);try{await r(e)}finally{o(!1)}};return l.jsxs(ma,{children:[l.jsx(wr,{type:"button",onClick:c,disabled:t,"aria-label":"Copy message",title:"Copy",children:l.jsx(to,{size:16,strokeWidth:1.75})}),l.jsx(wr,{type:"button",onClick:()=>void u(),disabled:t||n,"aria-label":"Download PDF",title:"Download PDF",children:l.jsx(no,{size:16,strokeWidth:1.75})})]})}const ga=E.div`
114
+ `;function yn({content:e,disabled:t,onExportPdf:r}){const[n,o]=x.useState(!1),c=()=>{Yn(e)},u=async()=>{o(!0);try{await r(e)}finally{o(!1)}};return l.jsxs(ma,{children:[l.jsx(vr,{type:"button",onClick:c,disabled:t,"aria-label":"Copy message",title:"Copy",children:l.jsx(ro,{size:16,strokeWidth:1.75})}),l.jsx(vr,{type:"button",onClick:()=>void u(),disabled:t||n,"aria-label":"Download PDF",title:"Download PDF",children:l.jsx(oo,{size:16,strokeWidth:1.75})})]})}const ga=E.div`
115
115
  display: flex;
116
116
  flex-wrap: wrap;
117
117
  gap: 6px;
118
118
  margin-bottom: 6px;
119
- `,ba=E.div`
120
- display: inline-flex;
121
- align-items: center;
122
- gap: 6px;
123
- max-width: 220px;
124
- padding: 4px 8px;
125
- border-radius: 8px;
126
- font-size: 12px;
119
+ `,ba=Be`
127
120
  background: ${e=>e.$isImage?"rgba(59, 130, 246, 0.12)":"rgba(107, 114, 128, 0.12)"};
128
121
  color: #374151;
129
122
  border: 1px solid #e5e7eb;
@@ -133,18 +126,52 @@ ${n}
133
126
  border-color: #4b5563;
134
127
  background: ${e=>e.$isImage?"rgba(59, 130, 246, 0.2)":"rgba(107, 114, 128, 0.25)"};
135
128
  }
136
- `,ya=E.img`
129
+ `,ya=Be`
130
+ background: ${e=>e.$isImage?"rgba(255, 255, 255, 0.22)":"rgba(255, 255, 255, 0.16)"};
131
+ color: #ffffff;
132
+ border: 1px solid rgba(255, 255, 255, 0.45);
133
+ `,xa=E.div`
134
+ display: inline-flex;
135
+ align-items: center;
136
+ gap: 6px;
137
+ max-width: 220px;
138
+ padding: 5px 10px;
139
+ border-radius: 8px;
140
+ font-size: 12px;
141
+ font-weight: 500;
142
+ line-height: 1.3;
143
+ transition:
144
+ background-color 0.2s ease,
145
+ border-color 0.2s ease;
146
+
147
+ ${e=>e.$tone==="onPrimary"?ya:ba}
148
+ `,ka=E.img`
137
149
  width: 28px;
138
150
  height: 28px;
139
151
  object-fit: cover;
140
152
  border-radius: 4px;
141
- `,xa=E.span`
153
+ flex-shrink: 0;
154
+ `,wa=E.span`
142
155
  overflow: hidden;
143
156
  text-overflow: ellipsis;
144
157
  white-space: nowrap;
145
158
  flex: 1;
146
159
  min-width: 0;
147
- `,ka=E.button`
160
+ `,va=Be`
161
+ color: #6b7280;
162
+
163
+ &:hover {
164
+ color: #ef4444;
165
+ background: rgba(239, 68, 68, 0.1);
166
+ }
167
+ `,$a=Be`
168
+ color: rgba(255, 255, 255, 0.85);
169
+
170
+ &:hover {
171
+ color: #ffffff;
172
+ background: rgba(255, 255, 255, 0.2);
173
+ }
174
+ `,Sa=E.button`
148
175
  display: flex;
149
176
  align-items: center;
150
177
  justify-content: center;
@@ -152,30 +179,29 @@ ${n}
152
179
  border: none;
153
180
  background: transparent;
154
181
  cursor: pointer;
155
- color: #6b7280;
156
182
  border-radius: 4px;
183
+ transition:
184
+ color 0.2s ease,
185
+ background-color 0.2s ease;
157
186
 
158
- &:hover {
159
- color: #ef4444;
160
- background: rgba(239, 68, 68, 0.1);
161
- }
162
- `;function be({attachments:e,onRemove:t,readOnly:r}){return e.length?l.jsx(ga,{children:e.map(n=>{const o=n.type==="image",c=o&&(n.preview||n.url);return l.jsxs(ba,{$isImage:o,title:n.name,children:[c?l.jsx(ya,{src:n.preview||n.url,alt:"",loading:"lazy",decoding:"async"}):o?l.jsx(io,{size:16,"aria-hidden":!0}):l.jsx(ao,{size:16,"aria-hidden":!0}),l.jsx(xa,{children:n.name}),!r&&t&&l.jsx(ka,{type:"button",onClick:()=>t(n.id),"aria-label":`Remove ${n.name}`,children:l.jsx(po,{size:14})})]},n.id)})}):null}function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fe.apply(this,arguments)}const wa=["children","options"],vr=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),$r={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},va=["style","script","pre"],$a=["src","href","data","formAction","srcDoc","action"],Sa=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Ca=/mailto:/i,ja=/\n{2,}$/,Sr=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Ia=/^ *> ?/gm,Ta=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Aa=/^ {2,}\n/,Ea=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,Cr=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,jr=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Ma=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,Ra=/^(?:\n *)*\n/,_a=/\r\n?/g,Pa=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Oa=/^\[\^([^\]]+)]/,Da=/\f/g,za=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Na=/^\s*?\[(x|\s)\]/,Ir=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Tr=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Ar=/^([^\n]+)\n *(=|-){3,} *\n/,kt=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Ba=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,Er=/^<!--[\s\S]*?(?:-->)/,La=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,wt=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Fa=/^\{.*\}$/,Ka=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Wa=/^<([^ >]+@[^ >]+)>/,Ua=/^<([^ >]+:\/[^ >]+)>/,Ha=/-([a-z])?/gi,Mr=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,qa=/^[^\n]+(?: \n|\n{2,})/,Ga=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,Qa=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Ya=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Va=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Za=/\t/g,Ja=/(^ *\||\| *$)/g,Xa=/^ *:-+: *$/,es=/^ *:-+ *$/,ts=/^ *-+: *$/,ct=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,lt="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",rs=RegExp(`^([*_])\\1${ct(1)}${lt}\\1\\1(?!\\1)`),ns=RegExp(`^([*_])${ct(0)}${lt}\\1(?!\\1)`),os=RegExp(`^(==)${ct(0)}${lt}\\1`),as=RegExp(`^(~~)${ct(0)}${lt}\\1`),ss=/^(:[a-zA-Z0-9-_]+:)/,is=/^\\([^0-9A-Za-z\s])/,cs=/\\([^0-9A-Za-z\s])/g,ls=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,ds=/^\n+/,us=/^([ \t]*)/,ps=/(?:^|\n)( *)$/,Wt="(?:\\d+\\.)",Ut="(?:[*+-])";function yn(e){return"( *)("+(e===1?Wt:Ut)+") +"}const xn=yn(1),kn=yn(2);function wn(e){return RegExp("^"+(e===1?xn:kn))}const fs=wn(1),hs=wn(2);function vn(e){return RegExp("^"+(e===1?xn:kn)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Wt:Ut)+" )[^\\n]*)*(\\n|$)","gm")}const ms=vn(1),gs=vn(2);function $n(e){const t=e===1?Wt:Ut;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const Sn=$n(1),Cn=$n(2);function Rr(e,t){const r=t===1,n=r?Sn:Cn,o=r?ms:gs,c=r?fs:hs;return{t:u=>c.test(u),o:Ie(function(u,d){const h=ps.exec(d.prevCapture);return h&&(d.list||!d.inline&&!d.simple)?n.exec(u=h[1]+u):null}),i:1,u(u,d,h){const b=r?+u[2]:void 0,g=u[0].replace(ja,`
187
+ ${e=>e.$tone==="onPrimary"?$a:va}
188
+ `;function be({attachments:e,onRemove:t,readOnly:r,tone:n="default"}){return e.length?l.jsx(ga,{children:e.map(o=>{const c=o.type==="image",u=c&&(o.preview||o.url);return l.jsxs(xa,{$isImage:c,$tone:n,title:o.name,children:[u?l.jsx(ka,{src:o.preview||o.url,alt:"",loading:"lazy",decoding:"async"}):c?l.jsx(co,{size:16,"aria-hidden":!0}):l.jsx(so,{size:16,"aria-hidden":!0}),l.jsx(wa,{children:o.name}),!r&&t&&l.jsx(Sa,{type:"button",$tone:n,onClick:()=>t(o.id),"aria-label":`Remove ${o.name}`,children:l.jsx(fo,{size:14})})]},o.id)})}):null}function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fe.apply(this,arguments)}const Ca=["children","options"],$r=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),Sr={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},ja=["style","script","pre"],Ia=["src","href","data","formAction","srcDoc","action"],Ta=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Aa=/mailto:/i,Ea=/\n{2,}$/,Cr=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Ra=/^ *> ?/gm,Ma=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,_a=/^ {2,}\n/,Pa=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,jr=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,Ir=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Oa=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,Da=/^(?:\n *)*\n/,za=/\r\n?/g,Na=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Ba=/^\[\^([^\]]+)]/,La=/\f/g,Fa=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Ka=/^\s*?\[(x|\s)\]/,Tr=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Ar=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Er=/^([^\n]+)\n *(=|-){3,} *\n/,wt=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Wa=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,Rr=/^<!--[\s\S]*?(?:-->)/,Ua=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,vt=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Ha=/^\{.*\}$/,qa=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Ga=/^<([^ >]+@[^ >]+)>/,Qa=/^<([^ >]+:\/[^ >]+)>/,Ya=/-([a-z])?/gi,Mr=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,Va=/^[^\n]+(?: \n|\n{2,})/,Za=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,Ja=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Xa=/^\[([^\]]*)\] ?\[([^\]]*)\]/,es=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,ts=/\t/g,rs=/(^ *\||\| *$)/g,ns=/^ *:-+: *$/,os=/^ *:-+ *$/,as=/^ *-+: *$/,lt=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,dt="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",ss=RegExp(`^([*_])\\1${lt(1)}${dt}\\1\\1(?!\\1)`),is=RegExp(`^([*_])${lt(0)}${dt}\\1(?!\\1)`),cs=RegExp(`^(==)${lt(0)}${dt}\\1`),ls=RegExp(`^(~~)${lt(0)}${dt}\\1`),ds=/^(:[a-zA-Z0-9-_]+:)/,us=/^\\([^0-9A-Za-z\s])/,ps=/\\([^0-9A-Za-z\s])/g,fs=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,hs=/^\n+/,ms=/^([ \t]*)/,gs=/(?:^|\n)( *)$/,Ut="(?:\\d+\\.)",Ht="(?:[*+-])";function xn(e){return"( *)("+(e===1?Ut:Ht)+") +"}const kn=xn(1),wn=xn(2);function vn(e){return RegExp("^"+(e===1?kn:wn))}const bs=vn(1),ys=vn(2);function $n(e){return RegExp("^"+(e===1?kn:wn)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Ut:Ht)+" )[^\\n]*)*(\\n|$)","gm")}const xs=$n(1),ks=$n(2);function Sn(e){const t=e===1?Ut:Ht;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const Cn=Sn(1),jn=Sn(2);function _r(e,t){const r=t===1,n=r?Cn:jn,o=r?xs:ks,c=r?bs:ys;return{t:u=>c.test(u),o:Ie(function(u,d){const h=gs.exec(d.prevCapture);return h&&(d.list||!d.inline&&!d.simple)?n.exec(u=h[1]+u):null}),i:1,u(u,d,h){const b=r?+u[2]:void 0,g=u[0].replace(Ea,`
163
189
  `).match(o);let p=!1;return{items:g.map(function(v,w){const C=c.exec(v)[0].length,I=RegExp("^ {1,"+C+"}","gm"),$=v.replace(I,"").replace(c,""),a=w===g.length-1,i=$.indexOf(`
164
190
 
165
191
  `)!==-1||a&&p;p=i;const s=h.inline,f=h.list;let m;h.list=!0,i?(h.inline=!1,m=De($)+`
166
192
 
167
- `):(h.inline=!0,m=De($));const k=d(m,h);return h.inline=s,h.list=f,k}),ordered:r,start:b}},l:(u,d,h)=>e(u.ordered?"ol":"ul",{key:h.key,start:u.type==="20"?u.start:void 0},u.items.map(function(b,g){return e("li",{key:g},d(b,h))}))}}const bs=RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`),ys=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function De(e){let t=e.length;for(;t>0&&e[t-1]<=" ";)t--;return e.slice(0,t)}function Qe(e,t){return e.startsWith(t)}function xs(e,t,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(Qe(e,r[n]))return!0;return!1}return r(e,t)}function Re(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function ks(e){return ts.test(e)?"right":Xa.test(e)?"center":es.test(e)?"left":null}function _r(e,t,r,n){const o=r.inTable;r.inTable=!0;let c=[[]],u="";function d(){if(!u)return;const h=c[c.length-1];h.push.apply(h,t(u,r)),u=""}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((h,b,g)=>{h.trim()==="|"&&(d(),n)?b!==0&&b!==g.length-1&&c.push([]):u+=h}),d(),r.inTable=o,c}function ws(e,t,r){r.inline=!0;const n=e[2]?e[2].replace(Ja,"").split("|").map(ks):[],o=e[3]?function(u,d,h){return u.trim().split(`
168
- `).map(function(b){return _r(b,d,h,!0)})}(e[3],t,r):[],c=_r(e[1],t,r,!!o.length);return r.inline=!1,o.length?{align:n,cells:o,header:c,type:"25"}:{children:c,type:"21"}}function Pr(e,t){return e.align[t]==null?{}:{textAlign:e.align[t]}}function Ie(e){return e.inline=1,e}function ce(e){return Ie(function(t,r){return r.inline?e.exec(t):null})}function le(e){return Ie(function(t,r){return r.inline||r.simple?e.exec(t):null})}function oe(e){return function(t,r){return r.inline||r.simple?null:e.exec(t)}}function Ke(e){return Ie(function(t){return e.exec(t)})}const vs=/(javascript|vbscript|data(?!:image)):/i;function $s(e){try{const t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(vs.test(t))return null}catch{return null}return e}function re(e){return e&&e.replace(cs,"$1")}function Ye(e,t,r){const n=r.inline||!1,o=r.simple||!1;r.inline=!0,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=o,c}function Ss(e,t,r){const n=r.inline||!1,o=r.simple||!1;r.inline=!1,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=o,c}function Cs(e,t,r){const n=r.inline||!1;r.inline=!1;const o=e(t,r);return r.inline=n,o}const vt=(e,t,r)=>({children:Ye(t,e[2],r)});function $t(){return{}}function St(){return null}function js(...e){return e.filter(Boolean).join(" ")}function Ct(e,t,r){let n=e;const o=t.split(".");for(;o.length&&(n=n[o[0]],n!==void 0);)o.shift();return n||r}function Is(e="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?fe({},$r,t.namedCodesToUnicode):$r;const r=t.slugify||Re,n=t.sanitizer||$s,o=t.createElement||zt.createElement,c=[Sr,Cr,jr,t.enforceAtxHeadings?Tr:Ir,Ar,Mr,Sn,Cn],u=[...c,qa,kt,Er,wt];function d(a,i,...s){const f=Ct(t.overrides,a+".props",{});return o(function(m,k){const y=Ct(k,m);return y?typeof y=="function"||typeof y=="object"&&"render"in y?y:Ct(k,m+".component",m):m}(a,t.overrides),fe({},i,f,{className:js(i==null?void 0:i.className,f.className)||void 0}),...s)}function h(a){a=a.replace(za,"");let i=!1;t.forceInline?i=!0:t.forceBlock||(i=Va.test(a)===!1);const s=C(w(i?a:De(a).replace(ds,"")+`
193
+ `):(h.inline=!0,m=De($));const k=d(m,h);return h.inline=s,h.list=f,k}),ordered:r,start:b}},l:(u,d,h)=>e(u.ordered?"ol":"ul",{key:h.key,start:u.type==="20"?u.start:void 0},u.items.map(function(b,g){return e("li",{key:g},d(b,h))}))}}const ws=RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`),vs=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function De(e){let t=e.length;for(;t>0&&e[t-1]<=" ";)t--;return e.slice(0,t)}function Ye(e,t){return e.startsWith(t)}function $s(e,t,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(Ye(e,r[n]))return!0;return!1}return r(e,t)}function Me(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function Ss(e){return as.test(e)?"right":ns.test(e)?"center":os.test(e)?"left":null}function Pr(e,t,r,n){const o=r.inTable;r.inTable=!0;let c=[[]],u="";function d(){if(!u)return;const h=c[c.length-1];h.push.apply(h,t(u,r)),u=""}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((h,b,g)=>{h.trim()==="|"&&(d(),n)?b!==0&&b!==g.length-1&&c.push([]):u+=h}),d(),r.inTable=o,c}function Cs(e,t,r){r.inline=!0;const n=e[2]?e[2].replace(rs,"").split("|").map(Ss):[],o=e[3]?function(u,d,h){return u.trim().split(`
194
+ `).map(function(b){return Pr(b,d,h,!0)})}(e[3],t,r):[],c=Pr(e[1],t,r,!!o.length);return r.inline=!1,o.length?{align:n,cells:o,header:c,type:"25"}:{children:c,type:"21"}}function Or(e,t){return e.align[t]==null?{}:{textAlign:e.align[t]}}function Ie(e){return e.inline=1,e}function ce(e){return Ie(function(t,r){return r.inline?e.exec(t):null})}function le(e){return Ie(function(t,r){return r.inline||r.simple?e.exec(t):null})}function oe(e){return function(t,r){return r.inline||r.simple?null:e.exec(t)}}function We(e){return Ie(function(t){return e.exec(t)})}const js=/(javascript|vbscript|data(?!:image)):/i;function Is(e){try{const t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(js.test(t))return null}catch{return null}return e}function re(e){return e&&e.replace(ps,"$1")}function Ve(e,t,r){const n=r.inline||!1,o=r.simple||!1;r.inline=!0,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=o,c}function Ts(e,t,r){const n=r.inline||!1,o=r.simple||!1;r.inline=!1,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=o,c}function As(e,t,r){const n=r.inline||!1;r.inline=!1;const o=e(t,r);return r.inline=n,o}const $t=(e,t,r)=>({children:Ve(t,e[2],r)});function St(){return{}}function Ct(){return null}function Es(...e){return e.filter(Boolean).join(" ")}function jt(e,t,r){let n=e;const o=t.split(".");for(;o.length&&(n=n[o[0]],n!==void 0);)o.shift();return n||r}function Rs(e="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?fe({},Sr,t.namedCodesToUnicode):Sr;const r=t.slugify||Me,n=t.sanitizer||Is,o=t.createElement||Nt.createElement,c=[Cr,jr,Ir,t.enforceAtxHeadings?Ar:Tr,Er,Mr,Cn,jn],u=[...c,Va,wt,Rr,vt];function d(a,i,...s){const f=jt(t.overrides,a+".props",{});return o(function(m,k){const y=jt(k,m);return y?typeof y=="function"||typeof y=="object"&&"render"in y?y:jt(k,m+".component",m):m}(a,t.overrides),fe({},i,f,{className:Es(i==null?void 0:i.className,f.className)||void 0}),...s)}function h(a){a=a.replace(Fa,"");let i=!1;t.forceInline?i=!0:t.forceBlock||(i=es.test(a)===!1);const s=C(w(i?a:De(a).replace(hs,"")+`
169
195
 
170
- `,{inline:i}));for(;typeof s[s.length-1]=="string"&&!s[s.length-1].trim();)s.pop();if(t.wrapper===null)return s;const f=t.wrapper||(i?"span":"div");let m;if(s.length>1||t.forceWrapper)m=s;else{if(s.length===1)return m=s[0],typeof m=="string"?d("span",{key:"outer"},m):m;m=null}return o(f,{key:"outer"},m)}function b(a,i){if(!i||!i.trim())return null;const s=i.match(Sa);return s?s.reduce(function(f,m){const k=m.indexOf("=");if(k!==-1){const y=function(P){return P.indexOf("-")!==-1&&P.match(La)===null&&(P=P.replace(Ha,function(K,j){return j.toUpperCase()})),P}(m.slice(0,k)).trim(),A=function(P){const K=P[0];return(K==='"'||K==="'")&&P.length>=2&&P[P.length-1]===K?P.slice(1,-1):P}(m.slice(k+1).trim()),M=vr[y]||y;if(M==="ref")return f;const z=f[M]=function(P,K,j,W){return K==="style"?function(T){const D=[];let H="",S=!1,O=!1,N="";if(!T)return D;for(let _=0;_<T.length;_++){const Y=T[_];if(Y!=='"'&&Y!=="'"||S||(O?Y===N&&(O=!1,N=""):(O=!0,N=Y)),Y==="("&&H.endsWith("url")?S=!0:Y===")"&&S&&(S=!1),Y!==";"||O||S)H+=Y;else{const B=H.trim();if(B){const q=B.indexOf(":");if(q>0){const V=B.slice(0,q).trim(),Z=B.slice(q+1).trim();D.push([V,Z])}}H=""}}const F=H.trim();if(F){const _=F.indexOf(":");if(_>0){const Y=F.slice(0,_).trim(),B=F.slice(_+1).trim();D.push([Y,B])}}return D}(j).reduce(function(T,[D,H]){return T[D.replace(/(-[a-z])/g,S=>S[1].toUpperCase())]=W(H,P,D),T},{}):$a.indexOf(K)!==-1?W(re(j),P,K):(j.match(Fa)&&(j=re(j.slice(1,j.length-1))),j==="true"||j!=="false"&&j)}(a,y,A,n);typeof z=="string"&&(kt.test(z)||wt.test(z))&&(f[M]=h(z.trim()))}else m!=="style"&&(f[vr[m]||m]=!0);return f},{}):null}const g=[],p={},v={0:{t:[">"],o:oe(Sr),i:1,u(a,i,s){const[,f,m]=a[0].replace(Ia,"").match(Ta);return{alert:f,children:i(m,s)}},l(a,i,s){const f={key:s.key};return a.alert&&(f.className="markdown-alert-"+r(a.alert.toLowerCase(),Re),a.children.unshift({attrs:{},children:[{type:"27",text:a.alert}],noInnerParse:!0,type:"11",tag:"header"})),d("blockquote",f,i(a.children,s))}},1:{o:Ke(Aa),i:1,u:$t,l:(a,i,s)=>d("br",{key:s.key})},2:{t:a=>{const i=a[0];return i==="-"||i==="*"||i==="_"},o:oe(Ea),i:1,u:$t,l:(a,i,s)=>d("hr",{key:s.key})},3:{t:[" "],o:oe(jr),i:0,u:a=>({lang:void 0,text:re(De(a[0].replace(/^ {4}/gm,"")))}),l:(a,i,s)=>d("pre",{key:s.key},d("code",fe({},a.attrs,{className:a.lang?"lang-"+a.lang:""}),a.text))},4:{t:["```","~~~"],o:oe(Cr),i:0,u:a=>({attrs:b("code",a[3]||""),lang:a[2]||void 0,text:a[4],type:"3"})},5:{t:["`"],o:le(Ma),i:3,u:a=>({text:re(a[2])}),l:(a,i,s)=>d("code",{key:s.key},a.text)},6:{t:["[^"],o:oe(Pa),i:0,u:a=>(g.push({footnote:a[2],identifier:a[1]}),{}),l:St},7:{t:["[^"],o:ce(Oa),i:1,u:a=>({target:"#"+r(a[1],Re),text:a[1]}),l:(a,i,s)=>d("a",{key:s.key,href:n(a.target,"a","href")},d("sup",{key:s.key},a.text))},8:{t:["[ ]","[x]"],o:ce(Na),i:1,u:a=>({completed:a[1].toLowerCase()==="x"}),l:(a,i,s)=>d("input",{checked:a.completed,key:s.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:oe(t.enforceAtxHeadings?Tr:Ir),i:1,u:(a,i,s)=>({children:Ye(i,a[2],s),id:r(a[2],Re),level:a[1].length}),l:(a,i,s)=>d("h"+a.level,{id:a.id,key:s.key},i(a.children,s))},10:{o:oe(Ar),i:0,u:(a,i,s)=>({children:Ye(i,a[1],s),level:a[2]==="="?1:2,type:"9"})},11:{t:["<"],o:Ke(kt),i:1,u(a,i,s){const[,f]=a[3].match(us),m=RegExp("^"+f,"gm"),k=a[3].replace(m,""),y=(A=k,u.some(j=>j.test(A))?Cs:Ye);var A;const M=a[1].toLowerCase(),z=va.indexOf(M)!==-1,P=(z?M:a[1]).trim(),K={attrs:b(P,a[2]),noInnerParse:z,tag:P};if(s.inAnchor=s.inAnchor||M==="a",z)K.text=a[3];else{const j=s.inHTML;s.inHTML=!0,K.children=y(i,k,s),s.inHTML=j}return s.inAnchor=!1,K},l:(a,i,s)=>d(a.tag,fe({key:s.key},a.attrs),a.text||(a.children?i(a.children,s):""))},13:{t:["<"],o:Ke(wt),i:1,u(a){const i=a[1].trim();return{attrs:b(i,a[2]||""),tag:i}},l:(a,i,s)=>d(a.tag,fe({},a.attrs,{key:s.key}))},12:{t:["<!--"],o:Ke(Er),i:1,u:()=>({}),l:St},14:{t:["!["],o:le(ys),i:1,u:a=>({alt:re(a[1]),target:re(a[2]),title:re(a[3])}),l:(a,i,s)=>d("img",{key:s.key,alt:a.alt||void 0,title:a.title||void 0,src:n(a.target,"img","src")})},15:{t:["["],o:ce(bs),i:3,u:(a,i,s)=>({children:Ss(i,a[1],s),target:re(a[2]),title:re(a[3])}),l:(a,i,s)=>d("a",{key:s.key,href:n(a.target,"a","href"),title:a.title},i(a.children,s))},16:{t:["<"],o:ce(Ua),i:0,u:a=>({children:[{text:a[1],type:"27"}],target:a[1],type:"15"})},17:{t:(a,i)=>!i.inAnchor&&!t.disableAutoLink&&(Qe(a,"http://")||Qe(a,"https://")),o:ce(Ka),i:0,u:a=>({children:[{text:a[1],type:"27"}],target:a[1],title:void 0,type:"15"})},18:{t:["<"],o:ce(Wa),i:0,u(a){let i=a[1],s=a[1];return Ca.test(s)||(s="mailto:"+s),{children:[{text:i.replace("mailto:",""),type:"27"}],target:s,type:"15"}}},20:Rr(d,1),33:Rr(d,2),19:{o:oe(Ra),i:3,u:$t,l:()=>`
196
+ `,{inline:i}));for(;typeof s[s.length-1]=="string"&&!s[s.length-1].trim();)s.pop();if(t.wrapper===null)return s;const f=t.wrapper||(i?"span":"div");let m;if(s.length>1||t.forceWrapper)m=s;else{if(s.length===1)return m=s[0],typeof m=="string"?d("span",{key:"outer"},m):m;m=null}return o(f,{key:"outer"},m)}function b(a,i){if(!i||!i.trim())return null;const s=i.match(Ta);return s?s.reduce(function(f,m){const k=m.indexOf("=");if(k!==-1){const y=function(P){return P.indexOf("-")!==-1&&P.match(Ua)===null&&(P=P.replace(Ya,function(K,j){return j.toUpperCase()})),P}(m.slice(0,k)).trim(),A=function(P){const K=P[0];return(K==='"'||K==="'")&&P.length>=2&&P[P.length-1]===K?P.slice(1,-1):P}(m.slice(k+1).trim()),R=$r[y]||y;if(R==="ref")return f;const z=f[R]=function(P,K,j,W){return K==="style"?function(T){const D=[];let H="",S=!1,O=!1,N="";if(!T)return D;for(let _=0;_<T.length;_++){const Y=T[_];if(Y!=='"'&&Y!=="'"||S||(O?Y===N&&(O=!1,N=""):(O=!0,N=Y)),Y==="("&&H.endsWith("url")?S=!0:Y===")"&&S&&(S=!1),Y!==";"||O||S)H+=Y;else{const B=H.trim();if(B){const q=B.indexOf(":");if(q>0){const V=B.slice(0,q).trim(),Z=B.slice(q+1).trim();D.push([V,Z])}}H=""}}const F=H.trim();if(F){const _=F.indexOf(":");if(_>0){const Y=F.slice(0,_).trim(),B=F.slice(_+1).trim();D.push([Y,B])}}return D}(j).reduce(function(T,[D,H]){return T[D.replace(/(-[a-z])/g,S=>S[1].toUpperCase())]=W(H,P,D),T},{}):Ia.indexOf(K)!==-1?W(re(j),P,K):(j.match(Ha)&&(j=re(j.slice(1,j.length-1))),j==="true"||j!=="false"&&j)}(a,y,A,n);typeof z=="string"&&(wt.test(z)||vt.test(z))&&(f[R]=h(z.trim()))}else m!=="style"&&(f[$r[m]||m]=!0);return f},{}):null}const g=[],p={},v={0:{t:[">"],o:oe(Cr),i:1,u(a,i,s){const[,f,m]=a[0].replace(Ra,"").match(Ma);return{alert:f,children:i(m,s)}},l(a,i,s){const f={key:s.key};return a.alert&&(f.className="markdown-alert-"+r(a.alert.toLowerCase(),Me),a.children.unshift({attrs:{},children:[{type:"27",text:a.alert}],noInnerParse:!0,type:"11",tag:"header"})),d("blockquote",f,i(a.children,s))}},1:{o:We(_a),i:1,u:St,l:(a,i,s)=>d("br",{key:s.key})},2:{t:a=>{const i=a[0];return i==="-"||i==="*"||i==="_"},o:oe(Pa),i:1,u:St,l:(a,i,s)=>d("hr",{key:s.key})},3:{t:[" "],o:oe(Ir),i:0,u:a=>({lang:void 0,text:re(De(a[0].replace(/^ {4}/gm,"")))}),l:(a,i,s)=>d("pre",{key:s.key},d("code",fe({},a.attrs,{className:a.lang?"lang-"+a.lang:""}),a.text))},4:{t:["```","~~~"],o:oe(jr),i:0,u:a=>({attrs:b("code",a[3]||""),lang:a[2]||void 0,text:a[4],type:"3"})},5:{t:["`"],o:le(Oa),i:3,u:a=>({text:re(a[2])}),l:(a,i,s)=>d("code",{key:s.key},a.text)},6:{t:["[^"],o:oe(Na),i:0,u:a=>(g.push({footnote:a[2],identifier:a[1]}),{}),l:Ct},7:{t:["[^"],o:ce(Ba),i:1,u:a=>({target:"#"+r(a[1],Me),text:a[1]}),l:(a,i,s)=>d("a",{key:s.key,href:n(a.target,"a","href")},d("sup",{key:s.key},a.text))},8:{t:["[ ]","[x]"],o:ce(Ka),i:1,u:a=>({completed:a[1].toLowerCase()==="x"}),l:(a,i,s)=>d("input",{checked:a.completed,key:s.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:oe(t.enforceAtxHeadings?Ar:Tr),i:1,u:(a,i,s)=>({children:Ve(i,a[2],s),id:r(a[2],Me),level:a[1].length}),l:(a,i,s)=>d("h"+a.level,{id:a.id,key:s.key},i(a.children,s))},10:{o:oe(Er),i:0,u:(a,i,s)=>({children:Ve(i,a[1],s),level:a[2]==="="?1:2,type:"9"})},11:{t:["<"],o:We(wt),i:1,u(a,i,s){const[,f]=a[3].match(ms),m=RegExp("^"+f,"gm"),k=a[3].replace(m,""),y=(A=k,u.some(j=>j.test(A))?As:Ve);var A;const R=a[1].toLowerCase(),z=ja.indexOf(R)!==-1,P=(z?R:a[1]).trim(),K={attrs:b(P,a[2]),noInnerParse:z,tag:P};if(s.inAnchor=s.inAnchor||R==="a",z)K.text=a[3];else{const j=s.inHTML;s.inHTML=!0,K.children=y(i,k,s),s.inHTML=j}return s.inAnchor=!1,K},l:(a,i,s)=>d(a.tag,fe({key:s.key},a.attrs),a.text||(a.children?i(a.children,s):""))},13:{t:["<"],o:We(vt),i:1,u(a){const i=a[1].trim();return{attrs:b(i,a[2]||""),tag:i}},l:(a,i,s)=>d(a.tag,fe({},a.attrs,{key:s.key}))},12:{t:["<!--"],o:We(Rr),i:1,u:()=>({}),l:Ct},14:{t:["!["],o:le(vs),i:1,u:a=>({alt:re(a[1]),target:re(a[2]),title:re(a[3])}),l:(a,i,s)=>d("img",{key:s.key,alt:a.alt||void 0,title:a.title||void 0,src:n(a.target,"img","src")})},15:{t:["["],o:ce(ws),i:3,u:(a,i,s)=>({children:Ts(i,a[1],s),target:re(a[2]),title:re(a[3])}),l:(a,i,s)=>d("a",{key:s.key,href:n(a.target,"a","href"),title:a.title},i(a.children,s))},16:{t:["<"],o:ce(Qa),i:0,u:a=>({children:[{text:a[1],type:"27"}],target:a[1],type:"15"})},17:{t:(a,i)=>!i.inAnchor&&!t.disableAutoLink&&(Ye(a,"http://")||Ye(a,"https://")),o:ce(qa),i:0,u:a=>({children:[{text:a[1],type:"27"}],target:a[1],title:void 0,type:"15"})},18:{t:["<"],o:ce(Ga),i:0,u(a){let i=a[1],s=a[1];return Aa.test(s)||(s="mailto:"+s),{children:[{text:i.replace("mailto:",""),type:"27"}],target:s,type:"15"}}},20:_r(d,1),33:_r(d,2),19:{o:oe(Da),i:3,u:St,l:()=>`
171
197
  `},21:{o:Ie(function(a,i){if(i.inline||i.simple||i.inHTML&&a.indexOf(`
172
198
 
173
199
  `)===-1&&i.prevCapture.indexOf(`
174
200
 
175
201
  `)===-1)return null;let s="";a.split(`
176
202
  `).every(m=>(m+=`
177
- `,!c.some(k=>k.test(m))&&(s+=m,!!m.trim())));const f=De(s);return f===""?null:[s,,f]}),i:3,u:vt,l:(a,i,s)=>d("p",{key:s.key},i(a.children,s))},22:{t:["["],o:ce(Ga),i:0,u:a=>(p[a[1]]={target:a[2],title:a[4]},{}),l:St},23:{t:["!["],o:le(Qa),i:0,u:a=>({alt:a[1]?re(a[1]):void 0,ref:a[2]}),l:(a,i,s)=>p[a.ref]?d("img",{key:s.key,alt:a.alt,src:n(p[a.ref].target,"img","src"),title:p[a.ref].title}):null},24:{t:a=>a[0]==="["&&a.indexOf("](")===-1,o:ce(Ya),i:0,u:(a,i,s)=>({children:i(a[1],s),fallbackChildren:a[0],ref:a[2]}),l:(a,i,s)=>p[a.ref]?d("a",{key:s.key,href:n(p[a.ref].target,"a","href"),title:p[a.ref].title},i(a.children,s)):d("span",{key:s.key},a.fallbackChildren)},25:{t:["|"],o:oe(Mr),i:1,u:ws,l(a,i,s){const f=a;return d("table",{key:s.key},d("thead",null,d("tr",null,f.header.map(function(m,k){return d("th",{key:k,style:Pr(f,k)},i(m,s))}))),d("tbody",null,f.cells.map(function(m,k){return d("tr",{key:k},m.map(function(y,A){return d("td",{key:A,style:Pr(f,A)},i(y,s))}))})))}},27:{o:Ie(function(a,i){let s;return Qe(a,":")&&(s=ss.exec(a)),s||ls.exec(a)}),i:4,u(a){const i=a[0];return{text:i.indexOf("&")===-1?i:i.replace(Ba,(s,f)=>t.namedCodesToUnicode[f]||s)}},l:a=>a.text},28:{t:["**","__"],o:le(rs),i:2,u:(a,i,s)=>({children:i(a[2],s)}),l:(a,i,s)=>d("strong",{key:s.key},i(a.children,s))},29:{t:a=>{const i=a[0];return(i==="*"||i==="_")&&a[1]!==i},o:le(ns),i:3,u:(a,i,s)=>({children:i(a[2],s)}),l:(a,i,s)=>d("em",{key:s.key},i(a.children,s))},30:{t:["\\"],o:le(is),i:1,u:a=>({text:a[1],type:"27"})},31:{t:["=="],o:le(os),i:3,u:vt,l:(a,i,s)=>d("mark",{key:s.key},i(a.children,s))},32:{t:["~~"],o:le(as),i:3,u:vt,l:(a,i,s)=>d("del",{key:s.key},i(a.children,s))}};t.disableParsingRawHTML===!0&&(delete v[11],delete v[13]);const w=function(a){var i=Object.keys(a);function s(f,m){var k=[];if(m.prevCapture=m.prevCapture||"",f.trim())for(;f;)for(var y=0;y<i.length;){var A=i[y],M=a[A];if(!M.t||xs(f,m,M.t)){var z=M.o(f,m);if(z&&z[0]){f=f.substring(z[0].length);var P=M.u(z,s,m);m.prevCapture+=z[0],P.type||(P.type=A),k.push(P);break}y++}else y++}return m.prevCapture="",k}return i.sort(function(f,m){return a[f].i-a[m].i||(f<m?-1:1)}),function(f,m){return s(function(k){return k.replace(_a,`
178
- `).replace(Da,"").replace(Za," ")}(f),m)}}(v),C=(I=function(a,i){return function(s,f,m){const k=a[s.type].l;return i?i(()=>k(s,f,m),s,f,m):k(s,f,m)}}(v,t.renderRule),function a(i,s={}){if(Array.isArray(i)){const f=s.key,m=[];let k=!1;for(let y=0;y<i.length;y++){s.key=y;const A=a(i[y],s),M=typeof A=="string";M&&k?m[m.length-1]+=A:A!==null&&m.push(A),k=M}return s.key=f,m}return I(i,a,s)});var I;const $=h(e);return g.length?d("div",null,$,d("footer",{key:"footer"},g.map(function(a){return d("div",{id:r(a.identifier,Re),key:a.identifier},a.identifier,C(w(a.footnote,{inline:!0})))}))):$}const Ts=e=>{let{children:t="",options:r}=e,n=function(o,c){if(o==null)return{};var u,d,h={},b=Object.keys(o);for(d=0;d<b.length;d++)c.indexOf(u=b[d])>=0||(h[u]=o[u]);return h}(e,wa);return zt.cloneElement(Is(t,r),n)},As=E.div`
203
+ `,!c.some(k=>k.test(m))&&(s+=m,!!m.trim())));const f=De(s);return f===""?null:[s,,f]}),i:3,u:$t,l:(a,i,s)=>d("p",{key:s.key},i(a.children,s))},22:{t:["["],o:ce(Za),i:0,u:a=>(p[a[1]]={target:a[2],title:a[4]},{}),l:Ct},23:{t:["!["],o:le(Ja),i:0,u:a=>({alt:a[1]?re(a[1]):void 0,ref:a[2]}),l:(a,i,s)=>p[a.ref]?d("img",{key:s.key,alt:a.alt,src:n(p[a.ref].target,"img","src"),title:p[a.ref].title}):null},24:{t:a=>a[0]==="["&&a.indexOf("](")===-1,o:ce(Xa),i:0,u:(a,i,s)=>({children:i(a[1],s),fallbackChildren:a[0],ref:a[2]}),l:(a,i,s)=>p[a.ref]?d("a",{key:s.key,href:n(p[a.ref].target,"a","href"),title:p[a.ref].title},i(a.children,s)):d("span",{key:s.key},a.fallbackChildren)},25:{t:["|"],o:oe(Mr),i:1,u:Cs,l(a,i,s){const f=a;return d("table",{key:s.key},d("thead",null,d("tr",null,f.header.map(function(m,k){return d("th",{key:k,style:Or(f,k)},i(m,s))}))),d("tbody",null,f.cells.map(function(m,k){return d("tr",{key:k},m.map(function(y,A){return d("td",{key:A,style:Or(f,A)},i(y,s))}))})))}},27:{o:Ie(function(a,i){let s;return Ye(a,":")&&(s=ds.exec(a)),s||fs.exec(a)}),i:4,u(a){const i=a[0];return{text:i.indexOf("&")===-1?i:i.replace(Wa,(s,f)=>t.namedCodesToUnicode[f]||s)}},l:a=>a.text},28:{t:["**","__"],o:le(ss),i:2,u:(a,i,s)=>({children:i(a[2],s)}),l:(a,i,s)=>d("strong",{key:s.key},i(a.children,s))},29:{t:a=>{const i=a[0];return(i==="*"||i==="_")&&a[1]!==i},o:le(is),i:3,u:(a,i,s)=>({children:i(a[2],s)}),l:(a,i,s)=>d("em",{key:s.key},i(a.children,s))},30:{t:["\\"],o:le(us),i:1,u:a=>({text:a[1],type:"27"})},31:{t:["=="],o:le(cs),i:3,u:$t,l:(a,i,s)=>d("mark",{key:s.key},i(a.children,s))},32:{t:["~~"],o:le(ls),i:3,u:$t,l:(a,i,s)=>d("del",{key:s.key},i(a.children,s))}};t.disableParsingRawHTML===!0&&(delete v[11],delete v[13]);const w=function(a){var i=Object.keys(a);function s(f,m){var k=[];if(m.prevCapture=m.prevCapture||"",f.trim())for(;f;)for(var y=0;y<i.length;){var A=i[y],R=a[A];if(!R.t||$s(f,m,R.t)){var z=R.o(f,m);if(z&&z[0]){f=f.substring(z[0].length);var P=R.u(z,s,m);m.prevCapture+=z[0],P.type||(P.type=A),k.push(P);break}y++}else y++}return m.prevCapture="",k}return i.sort(function(f,m){return a[f].i-a[m].i||(f<m?-1:1)}),function(f,m){return s(function(k){return k.replace(za,`
204
+ `).replace(La,"").replace(ts," ")}(f),m)}}(v),C=(I=function(a,i){return function(s,f,m){const k=a[s.type].l;return i?i(()=>k(s,f,m),s,f,m):k(s,f,m)}}(v,t.renderRule),function a(i,s={}){if(Array.isArray(i)){const f=s.key,m=[];let k=!1;for(let y=0;y<i.length;y++){s.key=y;const A=a(i[y],s),R=typeof A=="string";R&&k?m[m.length-1]+=A:A!==null&&m.push(A),k=R}return s.key=f,m}return I(i,a,s)});var I;const $=h(e);return g.length?d("div",null,$,d("footer",{key:"footer"},g.map(function(a){return d("div",{id:r(a.identifier,Me),key:a.identifier},a.identifier,C(w(a.footnote,{inline:!0})))}))):$}const Ms=e=>{let{children:t="",options:r}=e,n=function(o,c){if(o==null)return{};var u,d,h={},b=Object.keys(o);for(d=0;d<b.length;d++)c.indexOf(u=b[d])>=0||(h[u]=o[u]);return h}(e,Ca);return Nt.cloneElement(Rs(t,r),n)},_s=E.div`
179
205
  overflow-wrap: anywhere;
180
206
 
181
207
  > *:first-child {
@@ -211,7 +237,7 @@ ${n}
211
237
  background-color: #374151 !important;
212
238
  color: #f9fafb !important;
213
239
  }
214
- `,Es={marginTop:0,marginBottom:"12px",paddingLeft:"20px",listStyleType:"disc",listStylePosition:"outside",lineHeight:1.5},Ms={marginTop:0,marginBottom:"12px",paddingLeft:"20px",listStyleType:"decimal",listStylePosition:"outside",lineHeight:1.5},Rs={marginBottom:"4px",lineHeight:1.5,color:"inherit"},ke=e=>({fontSize:e,fontWeight:700,marginTop:"16px",marginBottom:"8px",color:"inherit"});function _s({children:e,...t}){return l.jsx("div",{style:{display:"block",overflowX:"auto",marginBottom:"12px",maxWidth:"100%",WebkitOverflowScrolling:"touch"},children:l.jsx("table",{...t,style:{borderCollapse:"collapse",width:"100%",fontSize:"inherit",color:"inherit"},children:e})})}function jn({content:e,className:t}){return l.jsx(As,{className:t,children:l.jsx(Ts,{options:{overrides:{p:{props:{style:{marginTop:0,marginBottom:"12px",lineHeight:1.5,color:"inherit"}}},strong:{props:{style:{fontWeight:700,color:"inherit"}}},em:{props:{style:{fontStyle:"italic",color:"inherit"}}},code:{props:{style:{backgroundColor:"#f3f4f6",padding:"2px 6px",borderRadius:"4px",fontSize:"14px",fontFamily:"monospace",color:"#111827"}}},pre:{props:{style:{backgroundColor:"#f3f4f6",padding:"12px",borderRadius:"6px",fontSize:"14px",fontFamily:"monospace",color:"#111827",overflowX:"auto",marginTop:0,marginBottom:"12px"}}},ul:{props:{style:Es}},ol:{props:{style:Ms}},li:{props:{style:Rs}},table:{component:_s},th:{props:{style:{border:"1px solid #e5e7eb",padding:"6px 8px",textAlign:"left",backgroundColor:"#f9fafb",fontWeight:600,color:"inherit"}}},td:{props:{style:{border:"1px solid #e5e7eb",padding:"6px 8px",textAlign:"left",verticalAlign:"top",color:"inherit"}}},tr:{props:{style:{backgroundColor:"transparent"}}},thead:{props:{style:{backgroundColor:"transparent"}}},tbody:{props:{style:{backgroundColor:"transparent"}}},blockquote:{props:{style:{borderLeft:"4px solid #93c5fd",padding:"8px",paddingLeft:"16px",fontStyle:"italic",marginTop:0,marginBottom:"12px",backgroundColor:"#eff6ff",borderRadius:"4px",color:"inherit"}}},h1:{props:{style:ke("20px")}},h2:{props:{style:ke("18px")}},h3:{props:{style:ke("16px")}},h4:{props:{style:ke("14px")}},h5:{props:{style:ke("14px")}},h6:{props:{style:ke("14px")}},hr:{props:{style:{margin:"16px 0",borderColor:"#e5e7eb",borderWidth:"1px",borderStyle:"solid"}}},a:{props:{style:{color:"#2563eb",textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer"}},img:{props:{style:{maxWidth:"100%",height:"auto",borderRadius:"8px",display:"block",marginBottom:"10px"},loading:"lazy",decoding:"async"}}}},children:e})})}function Ht({message:e,className:t}){const r=e.attachments||[],n=r.filter(c=>c.type==="image"&&c.url),o=r.filter(c=>!(c.type==="image"&&c.url));return l.jsxs(l.Fragment,{children:[n.map(c=>l.jsx("img",{src:c.url,alt:c.name||"Generated image",loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:8,marginBottom:10,display:"block"}},c.id)),o.length>0&&l.jsx(be,{attachments:o,readOnly:!0}),l.jsx(jn,{content:e.content,className:t})]})}const In=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv","text/plain","text/markdown","application/json","image/png","image/jpeg","image/webp","image/gif"],Ps={".pdf":"application/pdf",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function Os(e){const t=e.lastIndexOf(".");if(!(t<0))return Ps[e.slice(t).toLowerCase()]}async function qt(e){var r;if(!e)return[];const t=[];if((r=e.files)!=null&&r.length)for(let n=0;n<e.files.length;n++)t.push(e.files[n]);return t}function Tn(e,t,r){if(e.size>t)return`File too large (max ${Math.floor(t/(1024*1024))}MB)`;if(r.includes(e.type))return null;const n=Os(e.name);return n&&r.includes(n)?null:"File type not allowed for attachments"}const Ds=E.button`
240
+ `,Ps={marginTop:0,marginBottom:"12px",paddingLeft:"20px",listStyleType:"disc",listStylePosition:"outside",lineHeight:1.5},Os={marginTop:0,marginBottom:"12px",paddingLeft:"20px",listStyleType:"decimal",listStylePosition:"outside",lineHeight:1.5},Ds={marginBottom:"4px",lineHeight:1.5,color:"inherit"},ke=e=>({fontSize:e,fontWeight:700,marginTop:"16px",marginBottom:"8px",color:"inherit"});function zs({children:e,...t}){return l.jsx("div",{style:{display:"block",overflowX:"auto",marginBottom:"12px",maxWidth:"100%",WebkitOverflowScrolling:"touch"},children:l.jsx("table",{...t,style:{borderCollapse:"collapse",width:"100%",fontSize:"inherit",color:"inherit"},children:e})})}function In({content:e,className:t}){return l.jsx(_s,{className:t,children:l.jsx(Ms,{options:{overrides:{p:{props:{style:{marginTop:0,marginBottom:"12px",lineHeight:1.5,color:"inherit"}}},strong:{props:{style:{fontWeight:700,color:"inherit"}}},em:{props:{style:{fontStyle:"italic",color:"inherit"}}},code:{props:{style:{backgroundColor:"#f3f4f6",padding:"2px 6px",borderRadius:"4px",fontSize:"14px",fontFamily:"monospace",color:"#111827"}}},pre:{props:{style:{backgroundColor:"#f3f4f6",padding:"12px",borderRadius:"6px",fontSize:"14px",fontFamily:"monospace",color:"#111827",overflowX:"auto",marginTop:0,marginBottom:"12px"}}},ul:{props:{style:Ps}},ol:{props:{style:Os}},li:{props:{style:Ds}},table:{component:zs},th:{props:{style:{border:"1px solid #e5e7eb",padding:"6px 8px",textAlign:"left",backgroundColor:"#f9fafb",fontWeight:600,color:"inherit"}}},td:{props:{style:{border:"1px solid #e5e7eb",padding:"6px 8px",textAlign:"left",verticalAlign:"top",color:"inherit"}}},tr:{props:{style:{backgroundColor:"transparent"}}},thead:{props:{style:{backgroundColor:"transparent"}}},tbody:{props:{style:{backgroundColor:"transparent"}}},blockquote:{props:{style:{borderLeft:"4px solid #93c5fd",padding:"8px",paddingLeft:"16px",fontStyle:"italic",marginTop:0,marginBottom:"12px",backgroundColor:"#eff6ff",borderRadius:"4px",color:"inherit"}}},h1:{props:{style:ke("20px")}},h2:{props:{style:ke("18px")}},h3:{props:{style:ke("16px")}},h4:{props:{style:ke("14px")}},h5:{props:{style:ke("14px")}},h6:{props:{style:ke("14px")}},hr:{props:{style:{margin:"16px 0",borderColor:"#e5e7eb",borderWidth:"1px",borderStyle:"solid"}}},a:{props:{style:{color:"#2563eb",textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer"}},img:{props:{style:{maxWidth:"100%",height:"auto",borderRadius:"8px",display:"block",marginBottom:"10px"},loading:"lazy",decoding:"async"}}}},children:e})})}function qt({message:e,className:t}){const r=e.attachments||[],n=r.filter(c=>c.type==="image"&&c.url),o=r.filter(c=>!(c.type==="image"&&c.url));return l.jsxs(l.Fragment,{children:[n.map(c=>l.jsx("img",{src:c.url,alt:c.name||"Generated image",loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:8,marginBottom:10,display:"block"}},c.id)),o.length>0&&l.jsx(be,{attachments:o,readOnly:!0}),l.jsx(In,{content:e.content,className:t})]})}const Tn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv","text/plain","text/markdown","application/json","image/png","image/jpeg","image/webp","image/gif"],Ns={".pdf":"application/pdf",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function Bs(e){const t=e.lastIndexOf(".");if(!(t<0))return Ns[e.slice(t).toLowerCase()]}async function Gt(e){var r;if(!e)return[];const t=[];if((r=e.files)!=null&&r.length)for(let n=0;n<e.files.length;n++)t.push(e.files[n]);return t}function An(e,t,r){if(e.size>t)return`File too large (max ${Math.floor(t/(1024*1024))}MB)`;if(r.includes(e.type))return null;const n=Bs(e.name);return n&&r.includes(n)?null:"File type not allowed for attachments"}const Ls=E.button`
215
241
  display: flex;
216
242
  align-items: center;
217
243
  justify-content: center;
@@ -242,7 +268,7 @@ ${n}
242
268
  border-color: #4b5563;
243
269
  color: #e5e7eb;
244
270
  }
245
- `,zs=E.button`
271
+ `,Fs=E.button`
246
272
  display: flex;
247
273
  align-items: center;
248
274
  justify-content: center;
@@ -276,7 +302,7 @@ ${n}
276
302
  color: #e2e8f0;
277
303
  }
278
304
  }
279
- `;function Gt({disabled:e,integrated:t=!1,maxFileBytes:r,maxFiles:n,allowedMime:o=In,currentCount:c,uploadAttachment:u,onUploaded:d,onError:h}){const b=x.useRef(null),[g,p]=x.useState(!1),v=x.useMemo(()=>[".pdf,.docx,.xlsx,.xls,.csv,.txt,.md,.json","image/png,image/jpeg,image/webp,image/gif"].join(","),[]),w=x.useCallback(async i=>{const s=Array.from(i);if(!s.length)return;let f=0;for(const m of s){if(c+f>=n){h==null||h(`You can attach at most ${n} files per message.`);break}const k=Tn(m,r,o);if(k){h==null||h(`${m.name}: ${k}`);continue}try{p(!0);const y=await u(m);d(y),f+=1}catch(y){const A=y instanceof Error?y.message:"Upload failed";h==null||h(A)}finally{p(!1)}}},[o,c,r,n,h,d,u]),C=i=>{const s=i.target.files;s!=null&&s.length&&w(s),i.target.value=""},I=c>=n,$=!!(e||g||I),a=t?zs:Ds;return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:b,type:"file",multiple:!0,accept:v,style:{display:"none"},onChange:C}),l.jsx(a,{type:"button",disabled:$,"aria-label":"Attach file",title:"Attach file",onClick:()=>{var i;return(i=b.current)==null?void 0:i.click()},children:l.jsx(lo,{size:16,strokeWidth:2})})]})}const An=E.div`
305
+ `;function Qt({disabled:e,integrated:t=!1,maxFileBytes:r,maxFiles:n,allowedMime:o=Tn,currentCount:c,uploadAttachment:u,onUploaded:d,onError:h}){const b=x.useRef(null),[g,p]=x.useState(!1),v=x.useMemo(()=>[".pdf,.docx,.xlsx,.xls,.csv,.txt,.md,.json","image/png,image/jpeg,image/webp,image/gif"].join(","),[]),w=x.useCallback(async i=>{const s=Array.from(i);if(!s.length)return;let f=0;for(const m of s){if(c+f>=n){h==null||h(`You can attach at most ${n} files per message.`);break}const k=An(m,r,o);if(k){h==null||h(`${m.name}: ${k}`);continue}try{p(!0);const y=await u(m);d(y),f+=1}catch(y){const A=y instanceof Error?y.message:"Upload failed";h==null||h(A)}finally{p(!1)}}},[o,c,r,n,h,d,u]),C=i=>{const s=i.target.files;s!=null&&s.length&&w(s),i.target.value=""},I=c>=n,$=!!(e||g||I),a=t?Fs:Ls;return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:b,type:"file",multiple:!0,accept:v,style:{display:"none"},onChange:C}),l.jsx(a,{type:"button",disabled:$,"aria-label":"Attach file",title:"Attach file",onClick:()=>{var i;return(i=b.current)==null?void 0:i.click()},children:l.jsx(uo,{size:16,strokeWidth:2})})]})}const En=E.div`
280
306
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
281
307
  background-color: white;
282
308
  border: 1px solid #e5e7eb;
@@ -354,7 +380,7 @@ ${n}
354
380
  color: inherit;
355
381
  }
356
382
  }
357
- `,Qt=E.div`
383
+ `,Yt=E.div`
358
384
  display: flex;
359
385
  flex-direction: column;
360
386
  flex: 1;
@@ -378,7 +404,7 @@ ${n}
378
404
  border-color: rgba(255, 255, 255, 0.3);
379
405
  }
380
406
  }
381
- `,Yt=E.div`
407
+ `,Vt=E.div`
382
408
  display: flex;
383
409
  align-items: center;
384
410
  justify-content: space-between;
@@ -392,7 +418,7 @@ ${n}
392
418
  border-top-color: #52525b;
393
419
  background-color: #3f3f46;
394
420
  }
395
- `,Ns=E.textarea`
421
+ `,Ks=E.textarea`
396
422
  display: block;
397
423
  width: 100%;
398
424
  min-width: 0;
@@ -429,7 +455,7 @@ ${n}
429
455
  color: #9ca3af;
430
456
  }
431
457
  }
432
- `,Vt=E.div`
458
+ `,Zt=E.div`
433
459
  display: flex;
434
460
  align-items: center;
435
461
  gap: 8px;
@@ -441,7 +467,7 @@ ${n}
441
467
  background-color: #1f2937;
442
468
  border-top-color: #374151;
443
469
  }
444
- `,Bs=E.textarea`
470
+ `,Ws=E.textarea`
445
471
  flex: 1;
446
472
  width: 100%;
447
473
  margin: 0;
@@ -486,7 +512,7 @@ ${n}
486
512
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
487
513
  }
488
514
  }
489
- `,Ls=E.button`
515
+ `,Us=E.button`
490
516
  width: 32px;
491
517
  height: 32px;
492
518
  min-width: 32px;
@@ -546,7 +572,7 @@ ${n}
546
572
  color: #6b7280;
547
573
  }
548
574
  }
549
- `,Zt=E.button`
575
+ `,Jt=E.button`
550
576
  width: 26px;
551
577
  height: 26px;
552
578
  min-width: 26px;
@@ -621,14 +647,14 @@ ${n}
621
647
  color: #6b7280;
622
648
  }
623
649
  }
624
- `,jt=(e,t=.15)=>{if(e&&e.startsWith("#")){const r=e.replace("#",""),n=parseInt(r,16);if(isNaN(n))return e;const o=Math.max(0,Math.min(255,n>>16&255)*(1-t)),c=Math.max(0,Math.min(255,n>>8&255)*(1-t)),u=Math.max(0,Math.min(255,n&255)*(1-t));return`#${Math.floor(o).toString(16).padStart(2,"0")}${Math.floor(c).toString(16).padStart(2,"0")}${Math.floor(u).toString(16).padStart(2,"0")}`}return e||"#2563eb"},Fs=E.button`
650
+ `,It=(e,t=.15)=>{if(e&&e.startsWith("#")){const r=e.replace("#",""),n=parseInt(r,16);if(isNaN(n))return e;const o=Math.max(0,Math.min(255,n>>16&255)*(1-t)),c=Math.max(0,Math.min(255,n>>8&255)*(1-t)),u=Math.max(0,Math.min(255,n&255)*(1-t));return`#${Math.floor(o).toString(16).padStart(2,"0")}${Math.floor(c).toString(16).padStart(2,"0")}${Math.floor(u).toString(16).padStart(2,"0")}`}return e||"#2563eb"},Hs=E.button`
625
651
  position: fixed;
626
652
  z-index: 50;
627
653
  height: 48px;
628
654
  padding: 0 16px;
629
655
  box-sizing: border-box;
630
656
  line-height: normal;
631
- background: ${e=>{if(e.$primaryColor){const t=jt(e.$primaryColor,.1);return`linear-gradient(135deg, ${e.$primaryColor} 0%, ${t} 100%)`}return"linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)"}};
657
+ background: ${e=>{if(e.$primaryColor){const t=It(e.$primaryColor,.1);return`linear-gradient(135deg, ${e.$primaryColor} 0%, ${t} 100%)`}return"linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)"}};
632
658
  color: white;
633
659
  border: none;
634
660
  border-radius: 24px;
@@ -645,7 +671,7 @@ ${n}
645
671
  ${e=>{switch(e.$position){case"bottom-left":return"bottom: 24px; left: 24px;";case"top-right":return"top: 24px; right: 24px;";case"top-left":return"top: 24px; left: 24px;";default:return"bottom: 24px; right: 24px;"}}}
646
672
 
647
673
  &:hover {
648
- background: ${e=>{if(e.$primaryColor){const t=jt(e.$primaryColor,.2),r=jt(e.$primaryColor,.3);return`linear-gradient(135deg, ${t} 0%, ${r} 100%)`}return"linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%)"}};
674
+ background: ${e=>{if(e.$primaryColor){const t=It(e.$primaryColor,.2),r=It(e.$primaryColor,.3);return`linear-gradient(135deg, ${t} 0%, ${r} 100%)`}return"linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%)"}};
649
675
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
650
676
  }
651
677
 
@@ -658,7 +684,7 @@ ${n}
658
684
  align-items: center;
659
685
  justify-content: center;
660
686
  }
661
- `,Ks=E.div`
687
+ `,qs=E.div`
662
688
  position: fixed;
663
689
  z-index: 50;
664
690
  width: 320px;
@@ -770,7 +796,7 @@ ${n}
770
796
  background: #9ca3af;
771
797
  }
772
798
  }
773
- `;const Jt=E.div`
799
+ `;const Xt=E.div`
774
800
  display: flex;
775
801
  gap: 4px;
776
802
  align-items: center;
@@ -809,7 +835,7 @@ ${n}
809
835
  [data-theme="dark"] & {
810
836
  color: ${e=>e.$isUser?"rgba(255, 255, 255, 0.8)":"#d1d5db"};
811
837
  }
812
- `;const Xt=E.div`
838
+ `;const er=E.div`
813
839
  font-size: 14px;
814
840
  color: #dc2626;
815
841
  text-align: center;
@@ -819,7 +845,7 @@ ${n}
819
845
  [data-theme="dark"] & {
820
846
  color: #f87171;
821
847
  }
822
- `,Ws=E.div`
848
+ `,Gs=E.div`
823
849
  position: absolute;
824
850
  ${e=>e.$position==="top"?"top: 0;":"bottom: 0;"}
825
851
  left: 0;
@@ -851,7 +877,7 @@ ${n}
851
877
  flex-shrink: 0;
852
878
  border: 2px solid rgba(255, 255, 255, 0.2);
853
879
  background-color: rgba(255, 255, 255, 0.1);
854
- `,Us=E.div`
880
+ `,Qs=E.div`
855
881
  display: flex;
856
882
  flex-direction: column;
857
883
  align-items: center;
@@ -873,7 +899,7 @@ ${n}
873
899
  [data-theme="light"] & {
874
900
  background: ${e=>e.$primaryColor?`linear-gradient(to bottom, ${e.$primaryColor} 0%, ${e.$primaryColor} 20%, rgba(255, 255, 255, 0.3) 45%, rgba(255, 255, 255, 0.7) 65%, rgba(255, 255, 255, 1) 100%)`:"#ffffff"};
875
901
  }
876
- `,Hs=E.div`
902
+ `,Ys=E.div`
877
903
  font-size: 18px;
878
904
  font-weight: 600;
879
905
  text-align: center;
@@ -887,7 +913,7 @@ ${n}
887
913
  [data-theme="light"] & {
888
914
  color: #111827;
889
915
  }
890
- `,qs=E.img`
916
+ `,Vs=E.img`
891
917
  max-width: 120px;
892
918
  max-height: 120px;
893
919
  width: auto;
@@ -895,14 +921,14 @@ ${n}
895
921
  object-fit: contain;
896
922
  margin-bottom: 8px;
897
923
  border-radius: 8px;
898
- `,Gs=E.div`
924
+ `,Zs=E.div`
899
925
  display: flex;
900
926
  flex-direction: column;
901
927
  gap: 12px;
902
928
  width: 100%;
903
929
  max-width: 100%;
904
930
  margin-bottom: 16px;
905
- `,Qs=E.button`
931
+ `,Js=E.button`
906
932
  width: 100%;
907
933
  padding: 12px 16px;
908
934
  box-sizing: border-box;
@@ -943,7 +969,7 @@ ${n}
943
969
  border-color: ${e=>e.$primaryColor||"#6b7280"};
944
970
  }
945
971
  }
946
- `,Ys=E.div`
972
+ `,Xs=E.div`
947
973
  display: flex;
948
974
  align-items: center;
949
975
  gap: 8px;
@@ -955,10 +981,10 @@ ${n}
955
981
  [data-theme="dark"] & {
956
982
  border-top-color: #374151;
957
983
  }
958
- `,dt=x.forwardRef(function({value:t,onChange:r,onKeyDown:n,placeholder:o="Type a message...",disabled:c=!1,className:u,maxLength:d=2e3,variant:h="default"},b){const g=w=>{r(w.target.value)},p=w=>{w.key==="Enter"&&!w.shiftKey&&w.preventDefault(),n(w)},v=h==="composer"?Ns:Bs;return l.jsx(v,{ref:b,value:t,onChange:g,onKeyDown:p,placeholder:o,disabled:c,maxLength:d,className:u,onInput:w=>{const C=w.target;C.style.height="auto";const I=h==="composer"?96:120;C.style.height=`${Math.min(C.scrollHeight,I)}px`}})});function ut({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})}function er({config:e,onQuestionClick:t,onSendMessage:r,isLoading:n}){const[o,c]=x.useState(""),u=x.useRef(null),d=async()=>{!o.trim()||n||(await r(o.trim()),c(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},b=e.welcomeMessage||"Hi there 👋 How can we help?";return l.jsxs(Us,{$primaryColor:e.primaryColor,children:[e.welcomeImage&&l.jsx(qs,{src:e.welcomeImage,alt:"Welcome"}),l.jsx(Hs,{children:b}),e.quickQuestions&&e.quickQuestions.length>0&&l.jsx(Gs,{children:e.quickQuestions.map((g,p)=>l.jsx(Qs,{onClick:()=>t(g),disabled:n,$primaryColor:e.primaryColor,children:g},p))}),l.jsxs(Ys,{children:[l.jsx(dt,{ref:u,value:o,onChange:c,onKeyDown:h,placeholder:e.placeholder||"Type a message...",disabled:n}),l.jsx(Ls,{onClick:d,disabled:n||!o.trim(),children:l.jsx(ut,{size:16})})]})]})}function pt(e,t){var I;const r=(e.maxAttachmentSizeMB??10)*1024*1024,n=e.maxAttachments??3,o=(I=e.allowedAttachmentTypes)!=null&&I.length?e.allowedAttachmentTypes:In,c=!!(e.enableAttachments&&e.publishableKey),[u,d]=x.useState([]),[h,b]=x.useState(null),g=x.useRef([]);x.useEffect(()=>{g.current=u},[u]);const p=x.useCallback(async $=>{if(c){b(null);for(const a of $){if(g.current.length>=n){b(`At most ${n} attachments per message.`);break}const i=Tn(a,r,o);if(i){b(`${a.name}: ${i}`);continue}try{const s=await t(a);d(f=>{if(f.length>=n)return f;const m=[...f,s];return g.current=m,m})}catch(s){b(s instanceof Error?s.message:"Upload failed")}}}},[o,c,r,n,t]),v=x.useCallback($=>{d(a=>{const i=a.filter(s=>s.id!==$);return g.current=i,i})},[]),w=x.useCallback(()=>{d([]),g.current=[],b(null)},[]),C=x.useCallback($=>{b(null),d(a=>{if(a.length>=n)return a;const i=[...a,$];return g.current=i,i})},[n]);return{enabled:c,staged:u,attachmentError:h,setAttachmentError:b,addFiles:p,appendStaged:C,removeStaged:v,clearStaged:w,maxFiles:n,maxBytes:r,allowed:o}}function En(e,t,r){if(e.role!=="assistant"||!e.content.trim())return!1;const n=t[t.length-1];return n?!(r&&n.role==="assistant"&&n.id===e.id):!0}function Vs({size:e=16}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Zs({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18 6 6 18"}),l.jsx("path",{d:"m6 6 12 12"})]})}/*!---------------------------------------------------------------------------------------------
984
+ `,ut=x.forwardRef(function({value:t,onChange:r,onKeyDown:n,placeholder:o="Type a message...",disabled:c=!1,className:u,maxLength:d=2e3,variant:h="default"},b){const g=w=>{r(w.target.value)},p=w=>{w.key==="Enter"&&!w.shiftKey&&w.preventDefault(),n(w)},v=h==="composer"?Ks:Ws;return l.jsx(v,{ref:b,value:t,onChange:g,onKeyDown:p,placeholder:o,disabled:c,maxLength:d,className:u,onInput:w=>{const C=w.target;C.style.height="auto";const I=h==="composer"?96:120;C.style.height=`${Math.min(C.scrollHeight,I)}px`}})});function pt({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})}function tr({config:e,onQuestionClick:t,onSendMessage:r,isLoading:n}){const[o,c]=x.useState(""),u=x.useRef(null),d=async()=>{!o.trim()||n||(await r(o.trim()),c(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},b=e.welcomeMessage||"Hi there 👋 How can we help?";return l.jsxs(Qs,{$primaryColor:e.primaryColor,children:[e.welcomeImage&&l.jsx(Vs,{src:e.welcomeImage,alt:"Welcome"}),l.jsx(Ys,{children:b}),e.quickQuestions&&e.quickQuestions.length>0&&l.jsx(Zs,{children:e.quickQuestions.map((g,p)=>l.jsx(Js,{onClick:()=>t(g),disabled:n,$primaryColor:e.primaryColor,children:g},p))}),l.jsxs(Xs,{children:[l.jsx(ut,{ref:u,value:o,onChange:c,onKeyDown:h,placeholder:e.placeholder||"Type a message...",disabled:n}),l.jsx(Us,{onClick:d,disabled:n||!o.trim(),children:l.jsx(pt,{size:16})})]})]})}function ft(e,t){var I;const r=(e.maxAttachmentSizeMB??10)*1024*1024,n=e.maxAttachments??3,o=(I=e.allowedAttachmentTypes)!=null&&I.length?e.allowedAttachmentTypes:Tn,c=!!(e.enableAttachments&&e.publishableKey),[u,d]=x.useState([]),[h,b]=x.useState(null),g=x.useRef([]);x.useEffect(()=>{g.current=u},[u]);const p=x.useCallback(async $=>{if(c){b(null);for(const a of $){if(g.current.length>=n){b(`At most ${n} attachments per message.`);break}const i=An(a,r,o);if(i){b(`${a.name}: ${i}`);continue}try{const s=await t(a);d(f=>{if(f.length>=n)return f;const m=[...f,s];return g.current=m,m})}catch(s){b(s instanceof Error?s.message:"Upload failed")}}}},[o,c,r,n,t]),v=x.useCallback($=>{d(a=>{const i=a.filter(s=>s.id!==$);return g.current=i,i})},[]),w=x.useCallback(()=>{d([]),g.current=[],b(null)},[]),C=x.useCallback($=>{b(null),d(a=>{if(a.length>=n)return a;const i=[...a,$];return g.current=i,i})},[n]);return{enabled:c,staged:u,attachmentError:h,setAttachmentError:b,addFiles:p,appendStaged:C,removeStaged:v,clearStaged:w,maxFiles:n,maxBytes:r,allowed:o}}function Rn(e,t,r){if(e.role!=="assistant"||!e.content.trim())return!1;const n=t[t.length-1];return n?!(r&&n.role==="assistant"&&n.id===e.id):!0}function ei({size:e=16}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function ti({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18 6 6 18"}),l.jsx("path",{d:"m6 6 12 12"})]})}/*!---------------------------------------------------------------------------------------------
959
985
  * Copyright (c) StackBlitz. All rights reserved.
960
986
  * Licensed under the MIT License. See License.txt in the project root for license information.
961
- *--------------------------------------------------------------------------------------------*/const Js={damping:.7,stiffness:.05,mass:1.25},Xs=70,ei=1e3/60,ti=350;let ft=!1;var Dr;(Dr=globalThis.document)==null||Dr.addEventListener("mousedown",()=>{ft=!0});var zr;(zr=globalThis.document)==null||zr.addEventListener("mouseup",()=>{ft=!1});var Nr;(Nr=globalThis.document)==null||Nr.addEventListener("click",()=>{ft=!1});const ri=(e={})=>{const[t,r]=x.useState(!1),[n,o]=x.useState(e.initial!==!1),[c,u]=x.useState(!1),d=x.useRef(null);d.current=e;const h=x.useCallback(()=>{var f;if(!ft)return!1;const i=window.getSelection();if(!i||!i.rangeCount)return!1;const s=i.getRangeAt(0);return s.commonAncestorContainer.contains($.current)||((f=$.current)==null?void 0:f.contains(s.commonAncestorContainer))},[]),b=x.useCallback(i=>{p.isAtBottom=i,o(i)},[]),g=x.useCallback(i=>{p.escapedFromLock=i,r(i)},[]),p=x.useMemo(()=>{let i;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var s;return((s=$.current)==null?void 0:s.scrollTop)??0},set scrollTop(s){$.current&&($.current.scrollTop=s,p.ignoreScrollToTop=$.current.scrollTop)},get targetScrollTop(){return!$.current||!a.current?0:$.current.scrollHeight-1-$.current.clientHeight},get calculatedTargetScrollTop(){if(!$.current||!a.current)return 0;const{targetScrollTop:s}=this;if(!e.targetScrollTop)return s;if((i==null?void 0:i.targetScrollTop)===s)return i.calculatedScrollTop;const f=Math.max(Math.min(e.targetScrollTop(s,{scrollElement:$.current,contentElement:a.current}),s),0);return i={targetScrollTop:s,calculatedScrollTop:f},requestAnimationFrame(()=>{i=void 0}),f},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Xs}}},[]),v=x.useCallback((i={})=>{var M;typeof i=="string"&&(i={animation:i}),i.preserveScrollPosition||b(!0);const s=Date.now()+(Number(i.wait)||0),f=Tt(d.current,i.animation),{ignoreEscapes:m=!1}=i;let k,y=p.calculatedTargetScrollTop;i.duration instanceof Promise?i.duration.finally(()=>{k=Date.now()}):k=s+(i.duration??0);const A=async()=>{const z=new Promise(requestAnimationFrame).then(()=>{var W;if(!p.isAtBottom)return p.animation=void 0,!1;const{scrollTop:P}=p,K=performance.now(),j=(K-(p.lastTick??K))/ei;if(p.animation||(p.animation={behavior:f,promise:z,ignoreEscapes:m}),p.animation.behavior===f&&(p.lastTick=K),h()||s>Date.now())return A();if(P<Math.min(y,p.calculatedTargetScrollTop)){if(((W=p.animation)==null?void 0:W.behavior)===f){if(f==="instant")return p.scrollTop=p.calculatedTargetScrollTop,A();p.velocity=(f.damping*p.velocity+f.stiffness*p.scrollDifference)/f.mass,p.accumulated+=p.velocity*j,p.scrollTop+=p.accumulated,p.scrollTop!==P&&(p.accumulated=0)}return A()}return k>Date.now()?(y=p.calculatedTargetScrollTop,A()):(p.animation=void 0,p.scrollTop<p.calculatedTargetScrollTop?v({animation:Tt(d.current,d.current.resize),ignoreEscapes:m,duration:Math.max(0,k-Date.now())||void 0}):p.isAtBottom)});return z.then(P=>(requestAnimationFrame(()=>{p.animation||(p.lastTick=void 0,p.velocity=0)}),P))};return i.wait!==!0&&(p.animation=void 0),((M=p.animation)==null?void 0:M.behavior)===f?p.animation.promise:A()},[b,h,p]),w=x.useCallback(()=>{g(!0),b(!1)},[g,b]),C=x.useCallback(({target:i})=>{if(i!==$.current)return;const{scrollTop:s,ignoreScrollToTop:f}=p;let{lastScrollTop:m=s}=p;p.lastScrollTop=s,p.ignoreScrollToTop=void 0,f&&f>s&&(m=f),u(p.isNearBottom),setTimeout(()=>{var A;if(p.resizeDifference||s===f)return;if(h()){g(!0),b(!1);return}const k=s>m,y=s<m;if((A=p.animation)!=null&&A.ignoreEscapes){p.scrollTop=m;return}y&&(g(!0),b(!1)),k&&g(!1),!p.escapedFromLock&&p.isNearBottom&&b(!0)},1)},[g,b,h,p]),I=x.useCallback(({target:i,deltaY:s})=>{var m;let f=i;for(;!["scroll","auto"].includes(getComputedStyle(f).overflow);){if(!f.parentElement)return;f=f.parentElement}f===$.current&&s<0&&$.current.scrollHeight>$.current.clientHeight&&!((m=p.animation)!=null&&m.ignoreEscapes)&&(g(!0),b(!1))},[g,b,p]),$=Or(i=>{var s,f;(s=$.current)==null||s.removeEventListener("scroll",C),(f=$.current)==null||f.removeEventListener("wheel",I),i==null||i.addEventListener("scroll",C,{passive:!0}),i==null||i.addEventListener("wheel",I,{passive:!0})},[]),a=Or(i=>{var f,m;if((f=p.resizeObserver)==null||f.disconnect(),!i)return;let s;p.resizeObserver=new ResizeObserver(([k])=>{const{height:y}=k.contentRect,A=y-(s??y);if(p.resizeDifference=A,p.scrollTop>p.targetScrollTop&&(p.scrollTop=p.targetScrollTop),u(p.isNearBottom),A>=0){const M=Tt(d.current,s?d.current.resize:d.current.initial);v({animation:M,wait:!0,preserveScrollPosition:!0,duration:M==="instant"?void 0:ti})}else p.isNearBottom&&(g(!1),b(!0));s=y,requestAnimationFrame(()=>{setTimeout(()=>{p.resizeDifference===A&&(p.resizeDifference=0)},1)})}),(m=p.resizeObserver)==null||m.observe(i)},[]);return{contentRef:a,scrollRef:$,scrollToBottom:v,stopScroll:w,isAtBottom:n||c,isNearBottom:c,escapedFromLock:t,state:p}};function Or(e,t){const r=x.useCallback(n=>(r.current=n,e(n)),t);return r}const It=new Map;function Tt(...e){const t={...Js};let r=!1;for(const o of e){if(o==="instant"){r=!0;continue}typeof o=="object"&&(r=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const n=JSON.stringify(t);return It.has(n)||It.set(n,Object.freeze(t)),r?"instant":It.get(n)}const Mn=x.createContext(null),ni=typeof window<"u"?x.useLayoutEffect:x.useEffect;function et({instance:e,children:t,resize:r,initial:n,mass:o,damping:c,stiffness:u,targetScrollTop:d,contextRef:h,...b}){const g=x.useRef(null),p=zt.useCallback((m,k)=>{const y=(f==null?void 0:f.targetScrollTop)??d;return(y==null?void 0:y(m,k))??m},[d]),v=ri({mass:o,damping:c,stiffness:u,resize:r,initial:n,targetScrollTop:p}),{scrollRef:w,contentRef:C,scrollToBottom:I,stopScroll:$,isAtBottom:a,escapedFromLock:i,state:s}=e??v,f=x.useMemo(()=>({scrollToBottom:I,stopScroll:$,scrollRef:w,isAtBottom:a,escapedFromLock:i,contentRef:C,state:s,get targetScrollTop(){return g.current},set targetScrollTop(m){g.current=m}}),[I,a,C,w,$,i,s]);return x.useImperativeHandle(h,()=>f,[f]),ni(()=>{w.current&&getComputedStyle(w.current).overflow==="visible"&&(w.current.style.overflow="auto")},[]),l.jsx(Mn.Provider,{value:f,children:l.jsx("div",{...b,children:typeof t=="function"?t(f):t})})}(function(e){function t({children:r,...n}){const o=oi();return l.jsx("div",{ref:o.scrollRef,style:{height:"100%",width:"100%"},children:l.jsx("div",{...n,ref:o.contentRef,children:typeof r=="function"?r(o):r})})}e.Content=t})(et||(et={}));function oi(){const e=x.useContext(Mn);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const ai=E(et)`
987
+ *--------------------------------------------------------------------------------------------*/const ri={damping:.7,stiffness:.05,mass:1.25},ni=70,oi=1e3/60,ai=350;let ht=!1;var zr;(zr=globalThis.document)==null||zr.addEventListener("mousedown",()=>{ht=!0});var Nr;(Nr=globalThis.document)==null||Nr.addEventListener("mouseup",()=>{ht=!1});var Br;(Br=globalThis.document)==null||Br.addEventListener("click",()=>{ht=!1});const si=(e={})=>{const[t,r]=x.useState(!1),[n,o]=x.useState(e.initial!==!1),[c,u]=x.useState(!1),d=x.useRef(null);d.current=e;const h=x.useCallback(()=>{var f;if(!ht)return!1;const i=window.getSelection();if(!i||!i.rangeCount)return!1;const s=i.getRangeAt(0);return s.commonAncestorContainer.contains($.current)||((f=$.current)==null?void 0:f.contains(s.commonAncestorContainer))},[]),b=x.useCallback(i=>{p.isAtBottom=i,o(i)},[]),g=x.useCallback(i=>{p.escapedFromLock=i,r(i)},[]),p=x.useMemo(()=>{let i;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var s;return((s=$.current)==null?void 0:s.scrollTop)??0},set scrollTop(s){$.current&&($.current.scrollTop=s,p.ignoreScrollToTop=$.current.scrollTop)},get targetScrollTop(){return!$.current||!a.current?0:$.current.scrollHeight-1-$.current.clientHeight},get calculatedTargetScrollTop(){if(!$.current||!a.current)return 0;const{targetScrollTop:s}=this;if(!e.targetScrollTop)return s;if((i==null?void 0:i.targetScrollTop)===s)return i.calculatedScrollTop;const f=Math.max(Math.min(e.targetScrollTop(s,{scrollElement:$.current,contentElement:a.current}),s),0);return i={targetScrollTop:s,calculatedScrollTop:f},requestAnimationFrame(()=>{i=void 0}),f},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ni}}},[]),v=x.useCallback((i={})=>{var R;typeof i=="string"&&(i={animation:i}),i.preserveScrollPosition||b(!0);const s=Date.now()+(Number(i.wait)||0),f=At(d.current,i.animation),{ignoreEscapes:m=!1}=i;let k,y=p.calculatedTargetScrollTop;i.duration instanceof Promise?i.duration.finally(()=>{k=Date.now()}):k=s+(i.duration??0);const A=async()=>{const z=new Promise(requestAnimationFrame).then(()=>{var W;if(!p.isAtBottom)return p.animation=void 0,!1;const{scrollTop:P}=p,K=performance.now(),j=(K-(p.lastTick??K))/oi;if(p.animation||(p.animation={behavior:f,promise:z,ignoreEscapes:m}),p.animation.behavior===f&&(p.lastTick=K),h()||s>Date.now())return A();if(P<Math.min(y,p.calculatedTargetScrollTop)){if(((W=p.animation)==null?void 0:W.behavior)===f){if(f==="instant")return p.scrollTop=p.calculatedTargetScrollTop,A();p.velocity=(f.damping*p.velocity+f.stiffness*p.scrollDifference)/f.mass,p.accumulated+=p.velocity*j,p.scrollTop+=p.accumulated,p.scrollTop!==P&&(p.accumulated=0)}return A()}return k>Date.now()?(y=p.calculatedTargetScrollTop,A()):(p.animation=void 0,p.scrollTop<p.calculatedTargetScrollTop?v({animation:At(d.current,d.current.resize),ignoreEscapes:m,duration:Math.max(0,k-Date.now())||void 0}):p.isAtBottom)});return z.then(P=>(requestAnimationFrame(()=>{p.animation||(p.lastTick=void 0,p.velocity=0)}),P))};return i.wait!==!0&&(p.animation=void 0),((R=p.animation)==null?void 0:R.behavior)===f?p.animation.promise:A()},[b,h,p]),w=x.useCallback(()=>{g(!0),b(!1)},[g,b]),C=x.useCallback(({target:i})=>{if(i!==$.current)return;const{scrollTop:s,ignoreScrollToTop:f}=p;let{lastScrollTop:m=s}=p;p.lastScrollTop=s,p.ignoreScrollToTop=void 0,f&&f>s&&(m=f),u(p.isNearBottom),setTimeout(()=>{var A;if(p.resizeDifference||s===f)return;if(h()){g(!0),b(!1);return}const k=s>m,y=s<m;if((A=p.animation)!=null&&A.ignoreEscapes){p.scrollTop=m;return}y&&(g(!0),b(!1)),k&&g(!1),!p.escapedFromLock&&p.isNearBottom&&b(!0)},1)},[g,b,h,p]),I=x.useCallback(({target:i,deltaY:s})=>{var m;let f=i;for(;!["scroll","auto"].includes(getComputedStyle(f).overflow);){if(!f.parentElement)return;f=f.parentElement}f===$.current&&s<0&&$.current.scrollHeight>$.current.clientHeight&&!((m=p.animation)!=null&&m.ignoreEscapes)&&(g(!0),b(!1))},[g,b,p]),$=Dr(i=>{var s,f;(s=$.current)==null||s.removeEventListener("scroll",C),(f=$.current)==null||f.removeEventListener("wheel",I),i==null||i.addEventListener("scroll",C,{passive:!0}),i==null||i.addEventListener("wheel",I,{passive:!0})},[]),a=Dr(i=>{var f,m;if((f=p.resizeObserver)==null||f.disconnect(),!i)return;let s;p.resizeObserver=new ResizeObserver(([k])=>{const{height:y}=k.contentRect,A=y-(s??y);if(p.resizeDifference=A,p.scrollTop>p.targetScrollTop&&(p.scrollTop=p.targetScrollTop),u(p.isNearBottom),A>=0){const R=At(d.current,s?d.current.resize:d.current.initial);v({animation:R,wait:!0,preserveScrollPosition:!0,duration:R==="instant"?void 0:ai})}else p.isNearBottom&&(g(!1),b(!0));s=y,requestAnimationFrame(()=>{setTimeout(()=>{p.resizeDifference===A&&(p.resizeDifference=0)},1)})}),(m=p.resizeObserver)==null||m.observe(i)},[]);return{contentRef:a,scrollRef:$,scrollToBottom:v,stopScroll:w,isAtBottom:n||c,isNearBottom:c,escapedFromLock:t,state:p}};function Dr(e,t){const r=x.useCallback(n=>(r.current=n,e(n)),t);return r}const Tt=new Map;function At(...e){const t={...ri};let r=!1;for(const o of e){if(o==="instant"){r=!0;continue}typeof o=="object"&&(r=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const n=JSON.stringify(t);return Tt.has(n)||Tt.set(n,Object.freeze(t)),r?"instant":Tt.get(n)}const Mn=x.createContext(null),ii=typeof window<"u"?x.useLayoutEffect:x.useEffect;function tt({instance:e,children:t,resize:r,initial:n,mass:o,damping:c,stiffness:u,targetScrollTop:d,contextRef:h,...b}){const g=x.useRef(null),p=Nt.useCallback((m,k)=>{const y=(f==null?void 0:f.targetScrollTop)??d;return(y==null?void 0:y(m,k))??m},[d]),v=si({mass:o,damping:c,stiffness:u,resize:r,initial:n,targetScrollTop:p}),{scrollRef:w,contentRef:C,scrollToBottom:I,stopScroll:$,isAtBottom:a,escapedFromLock:i,state:s}=e??v,f=x.useMemo(()=>({scrollToBottom:I,stopScroll:$,scrollRef:w,isAtBottom:a,escapedFromLock:i,contentRef:C,state:s,get targetScrollTop(){return g.current},set targetScrollTop(m){g.current=m}}),[I,a,C,w,$,i,s]);return x.useImperativeHandle(h,()=>f,[f]),ii(()=>{w.current&&getComputedStyle(w.current).overflow==="visible"&&(w.current.style.overflow="auto")},[]),l.jsx(Mn.Provider,{value:f,children:l.jsx("div",{...b,children:typeof t=="function"?t(f):t})})}(function(e){function t({children:r,...n}){const o=ci();return l.jsx("div",{ref:o.scrollRef,style:{height:"100%",width:"100%"},children:l.jsx("div",{...n,ref:o.contentRef,children:typeof r=="function"?r(o):r})})}e.Content=t})(tt||(tt={}));function ci(){const e=x.useContext(Mn);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const li=E(tt)`
962
988
  position: relative;
963
989
  flex: 1;
964
990
  overflow-y: auto;
@@ -997,7 +1023,7 @@ ${n}
997
1023
  background-color: rgba(100, 116, 139, 0.75);
998
1024
  }
999
1025
  }
1000
- `,si=E(et.Content)`
1026
+ `,di=E(tt.Content)`
1001
1027
  padding: 16px;
1002
1028
  `;E.button`
1003
1029
  position: absolute;
@@ -1039,7 +1065,7 @@ ${n}
1039
1065
  color: #d1d5db;
1040
1066
  }
1041
1067
  }
1042
- `;function tr({className:e,children:t,style:r,surfaceTheme:n="light",onDragOver:o,onDragLeave:c,onDrop:u}){const d=n==="dark"?"dark":"light";return l.jsx(ai,{className:e,style:r,$surfaceTheme:d,initial:"smooth",resize:"smooth",role:"log",onDragOver:o,onDragLeave:c,onDrop:u,children:t})}function rr({className:e,children:t}){return l.jsx(si,{className:e,children:t})}function Rn({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,exportMessagePdf:c,isLoading:u,error:d,hasSessionStarted:h}=t,[b,g]=x.useState(""),[p,v]=x.useState(!1),w=x.useRef(null),{enabled:C,staged:I,attachmentError:$,setAttachmentError:a,addFiles:i,appendStaged:s,removeStaged:f,clearStaged:m,maxFiles:k,maxBytes:y,allowed:A}=pt(e,o),M=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":p?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const T=()=>{v(window.matchMedia("(prefers-color-scheme: dark)").matches)};T();const D=window.matchMedia("(prefers-color-scheme: dark)");return D.addEventListener("change",T),()=>D.removeEventListener("change",T)}else v(e.theme==="dark")},[e.theme]);const z=async()=>{const T=b.trim();!T&&I.length===0||u||(await n(T,void 0,I.length?I:void 0),g(""),m(),setTimeout(()=>{var D;(D=w.current)==null||D.focus()},100))},P=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),z())},K=x.useMemo(()=>e.height==="100%"||e.height==="100vh"?{height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:"8px"}:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},[e.height]),j=T=>{C&&(T.preventDefault(),T.dataTransfer.dropEffect="copy")},W=async T=>{if(!C)return;T.preventDefault();const D=await qt(T.dataTransfer);D.length&&await i(D)};return l.jsx(An,{"data-theme":M(),style:{...K,...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.textColor?{color:e.textColor}:{},...e.borderRadius!=null&&e.borderRadius!==""?{borderRadius:e.borderRadius}:{}},children:e.quickQuestions&&e.quickQuestions.length>0&&!h?l.jsx(er,{config:e,onQuestionClick:async T=>{await n(T)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(tr,{style:{flex:1},surfaceTheme:M(),onDragOver:j,onDrop:W,children:l.jsxs(rr,{children:[r.map(T=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:T.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[T.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),T.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(Ht,{message:T})}),En(T,r,u)&&l.jsx(bn,{content:T.content,disabled:u,onExportPdf:D=>c(D)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[T.attachments&&T.attachments.length>0&&l.jsx(be,{attachments:T.attachments,readOnly:!0}),T.content?T.content:null]})})]},T.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Jt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(Xt,{children:d})]})}),l.jsxs(Vt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[($||C&&I.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[$&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:$}),C&&I.length>0&&l.jsx(be,{attachments:I,onRemove:f})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Qt,{children:[l.jsx(dt,{ref:w,variant:"composer",value:b,onChange:g,onKeyDown:P,placeholder:e.placeholder,disabled:u}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:C&&l.jsx(Gt,{integrated:!0,disabled:u,maxFileBytes:y,maxFiles:k,allowedMime:A,currentCount:I.length,uploadAttachment:o,onUploaded:s,onError:a})}),l.jsx(Zt,{type:"button",onClick:z,disabled:u||!b.trim()&&I.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}const ii=E.div`
1068
+ `;function rr({className:e,children:t,style:r,surfaceTheme:n="light",onDragOver:o,onDragLeave:c,onDrop:u}){const d=n==="dark"?"dark":"light";return l.jsx(li,{className:e,style:r,$surfaceTheme:d,initial:"smooth",resize:"smooth",role:"log",onDragOver:o,onDragLeave:c,onDrop:u,children:t})}function nr({className:e,children:t}){return l.jsx(di,{className:e,children:t})}function _n({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,exportMessagePdf:c,isLoading:u,error:d,hasSessionStarted:h}=t,[b,g]=x.useState(""),[p,v]=x.useState(!1),w=x.useRef(null),{enabled:C,staged:I,attachmentError:$,setAttachmentError:a,addFiles:i,appendStaged:s,removeStaged:f,clearStaged:m,maxFiles:k,maxBytes:y,allowed:A}=ft(e,o),R=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":p?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const T=()=>{v(window.matchMedia("(prefers-color-scheme: dark)").matches)};T();const D=window.matchMedia("(prefers-color-scheme: dark)");return D.addEventListener("change",T),()=>D.removeEventListener("change",T)}else v(e.theme==="dark")},[e.theme]);const z=async()=>{const T=b.trim();!T&&I.length===0||u||(await n(T,void 0,I.length?I:void 0),g(""),m(),setTimeout(()=>{var D;(D=w.current)==null||D.focus()},100))},P=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),z())},K=x.useMemo(()=>e.height==="100%"||e.height==="100vh"?{height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:"8px"}:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},[e.height]),j=T=>{C&&(T.preventDefault(),T.dataTransfer.dropEffect="copy")},W=async T=>{if(!C)return;T.preventDefault();const D=await Gt(T.dataTransfer);D.length&&await i(D)};return l.jsx(En,{"data-theme":R(),style:{...K,...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.textColor?{color:e.textColor}:{},...e.borderRadius!=null&&e.borderRadius!==""?{borderRadius:e.borderRadius}:{}},children:e.quickQuestions&&e.quickQuestions.length>0&&!h?l.jsx(tr,{config:e,onQuestionClick:async T=>{await n(T)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(rr,{style:{flex:1},surfaceTheme:R(),onDragOver:j,onDrop:W,children:l.jsxs(nr,{children:[r.map(T=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:T.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[T.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),T.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(qt,{message:T})}),Rn(T,r,u)&&l.jsx(yn,{content:T.content,disabled:u,onExportPdf:D=>c(D)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[T.attachments&&T.attachments.length>0&&l.jsx(be,{attachments:T.attachments,readOnly:!0,tone:"onPrimary"}),T.content?T.content:null]})})]},T.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Xt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(er,{children:d})]})}),l.jsxs(Zt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[($||C&&I.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[$&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:$}),C&&I.length>0&&l.jsx(be,{attachments:I,onRemove:f})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Yt,{children:[l.jsx(ut,{ref:w,variant:"composer",value:b,onChange:g,onKeyDown:P,placeholder:e.placeholder,disabled:u}),l.jsxs(Vt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:C&&l.jsx(Qt,{integrated:!0,disabled:u,maxFileBytes:y,maxFiles:k,allowedMime:A,currentCount:I.length,uploadAttachment:o,onUploaded:s,onError:a})}),l.jsx(Jt,{type:"button",onClick:z,disabled:u||!b.trim()&&I.length===0,"aria-label":"Send message",children:l.jsx(pt,{size:13})})]})]})})]})]})})}const ui=E.div`
1043
1069
  display: flex;
1044
1070
  align-items: center;
1045
1071
  justify-content: space-between;
@@ -1059,15 +1085,15 @@ ${n}
1059
1085
  background: ${e=>e.$showWelcomeScreen&&e.$primaryColor?e.$primaryColor:"#ffffff"};
1060
1086
  color: ${e=>e.$showWelcomeScreen&&e.$primaryColor?"white":"#111827"};
1061
1087
  }
1062
- `,ci=E.div`
1088
+ `,pi=E.div`
1063
1089
  display: flex;
1064
1090
  align-items: center;
1065
1091
  gap: 12px;
1066
- `,li=E.div`
1092
+ `,fi=E.div`
1067
1093
  display: flex;
1068
1094
  align-items: center;
1069
1095
  gap: 8px;
1070
- `,di=E.div`
1096
+ `,hi=E.div`
1071
1097
  width: 8px;
1072
1098
  height: 8px;
1073
1099
  background: #10b981;
@@ -1082,14 +1108,14 @@ ${n}
1082
1108
  opacity: 0.5;
1083
1109
  }
1084
1110
  }
1085
- `,ui=E.span`
1111
+ `,mi=E.span`
1086
1112
  font-weight: 500;
1087
1113
  font-size: 14px;
1088
- `,pi=E.div`
1114
+ `,gi=E.div`
1089
1115
  display: flex;
1090
1116
  align-items: center;
1091
1117
  gap: 4px;
1092
- `,fi=E.button`
1118
+ `,bi=E.button`
1093
1119
  padding: 4px;
1094
1120
  background: transparent;
1095
1121
  border: none;
@@ -1109,4 +1135,4 @@ ${n}
1109
1135
  width: 16px;
1110
1136
  height: 16px;
1111
1137
  }
1112
- `;function hi({chatName:e="Chat Assistant",showCloseButton:t=!0,onClose:r,agentImage:n,className:o,primaryColor:c,showWelcomeScreen:u=!1}){return l.jsxs(ii,{className:o,$primaryColor:c,$showWelcomeScreen:u,children:[l.jsxs(ci,{children:[n&&l.jsx(ye,{src:n,alt:e||"Agent",$size:"32px"}),l.jsxs(li,{children:[l.jsx(di,{}),l.jsx(ui,{children:e})]})]}),l.jsx(pi,{children:t&&l.jsx(fi,{onClick:r,"aria-label":"Close",children:l.jsx(Zs,{size:16})})})]})}function Dt({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,exportMessagePdf:c,isLoading:u,error:d,isOpen:h,setIsOpen:b,hasSessionStarted:g}=t,[p,v]=x.useState(""),[w,C]=x.useState(e.height||600),[I,$]=x.useState(!1),a=x.useRef(null),{enabled:i,staged:s,attachmentError:f,setAttachmentError:m,addFiles:k,appendStaged:y,removeStaged:A,clearStaged:M,maxFiles:z,maxBytes:P,allowed:K}=pt(e,o),j=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":I?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const S=()=>{$(window.matchMedia("(prefers-color-scheme: dark)").matches)};S();const O=window.matchMedia("(prefers-color-scheme: dark)");return O.addEventListener("change",S),()=>O.removeEventListener("change",S)}else $(e.theme==="dark")},[e.theme]);const W=async()=>{const S=p.trim();!S&&s.length===0||u||(await n(S,void 0,s.length?s:void 0),v(""),M(),setTimeout(()=>{var O;(O=a.current)==null||O.focus()},100))},T=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),W())},D=S=>{i&&(S.preventDefault(),S.dataTransfer.dropEffect="copy")},H=async S=>{if(!i)return;S.preventDefault();const O=await qt(S.dataTransfer);O.length&&await k(O)};return h?l.jsxs(Ks,{$position:e.position||"bottom-right","data-theme":j(),style:{height:w,...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.textColor?{color:e.textColor}:{},...e.chatWindowStyle},children:[e.resizable!==!1&&l.jsx(Ws,{$position:"top",onMouseDown:S=>{S.preventDefault();const O=S.clientY,N=typeof w=="number"?w:600,F=Y=>{const B=Y.clientY-O,q=N-B;C(Math.max(200,Math.min(600,q)))},_=()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",_)}}),e.showHeader!==!1&&l.jsx(hi,{agentImage:e.agentImage,chatName:e.chatName,onClose:()=>b(!1),primaryColor:e.primaryColor,showWelcomeScreen:e.quickQuestions&&e.quickQuestions.length>0&&!g}),e.quickQuestions&&e.quickQuestions.length>0&&!g?l.jsx(er,{config:e,onQuestionClick:async S=>{await n(S)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(tr,{surfaceTheme:j(),onDragOver:D,onDrop:H,children:l.jsxs(rr,{children:[r.map(S=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:S.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[S.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),S.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(Ht,{message:S})}),En(S,r,u)&&l.jsx(bn,{content:S.content,disabled:u,onExportPdf:O=>c(O)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[S.attachments&&S.attachments.length>0&&l.jsx(be,{attachments:S.attachments,readOnly:!0}),S.content?S.content:null]})})]},S.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Jt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(Xt,{children:d})]})}),l.jsxs(Vt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(f||i&&s.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[f&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:f}),i&&s.length>0&&l.jsx(be,{attachments:s,onRemove:A})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Qt,{children:[l.jsx(dt,{ref:a,variant:"composer",value:p,onChange:v,onKeyDown:T,placeholder:e.placeholder,disabled:u}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:i&&l.jsx(Gt,{integrated:!0,disabled:u,maxFileBytes:P,maxFiles:z,allowedMime:K,currentCount:s.length,uploadAttachment:o,onUploaded:y,onError:m})}),l.jsx(Zt,{type:"button",onClick:W,disabled:u||!p.trim()&&s.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})]}):l.jsxs(Fs,{onClick:()=>b(!0),style:e.buttonStyle,$position:e.position||"bottom-right",$primaryColor:e.primaryColor,"aria-label":"Open chat",children:[l.jsx("div",{className:"icon-container",children:l.jsx(Vs,{size:16})}),l.jsx("span",{children:e.buttonText||e.chatName||"AI Chat"})]})}function mi(e){const t=Ur(e),r=Wr(t);switch(t.mode){case"floating":return l.jsx(Dt,{config:t,chat:r});case"embedded":return l.jsx(Rn,{config:t,chat:r});default:return l.jsx(Dt,{config:t,chat:r})}}function gi({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,isLoading:c,error:u,hasSessionStarted:d}=t,[h,b]=x.useState(""),g=x.useRef(null),{enabled:p,staged:v,attachmentError:w,setAttachmentError:C,addFiles:I,appendStaged:$,removeStaged:a,clearStaged:i,maxFiles:s,maxBytes:f,allowed:m}=pt(e,o),[k,y]=x.useState(!1),A=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":k?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const j=()=>{y(window.matchMedia("(prefers-color-scheme: dark)").matches)};j();const W=window.matchMedia("(prefers-color-scheme: dark)");return W.addEventListener("change",j),()=>W.removeEventListener("change",j)}else y(e.theme==="dark")},[e.theme]);const M=async()=>{const j=h.trim();!j&&v.length===0||c||(await n(j,void 0,v.length?v:void 0),b(""),i(),setTimeout(()=>{var W;(W=g.current)==null||W.focus()},100))},z=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),M())},P=j=>{p&&(j.preventDefault(),j.dataTransfer.dropEffect="copy")},K=async j=>{if(!p)return;j.preventDefault();const W=await qt(j.dataTransfer);W.length&&await I(W)};return l.jsx(An,{"data-theme":A(),style:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},children:e.quickQuestions&&e.quickQuestions.length>0&&!d?l.jsx(er,{config:e,onQuestionClick:async j=>{await n(j)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(tr,{style:{flex:1},surfaceTheme:A(),onDragOver:P,onDrop:K,children:l.jsxs(rr,{children:[r.map(j=>l.jsxs("div",{style:{display:"flex",marginBottom:"12px",justifyContent:j.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[j.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:j.role==="user",children:j.role==="assistant"?l.jsx(Ht,{message:j}):l.jsxs(l.Fragment,{children:[j.attachments&&j.attachments.length>0&&l.jsx(be,{attachments:j.attachments,readOnly:!0}),j.content?j.content:null]})})]},j.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"12px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Jt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(Xt,{children:u})]})}),l.jsxs(Vt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(w||p&&v.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[w&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:w}),p&&v.length>0&&l.jsx(be,{attachments:v,onRemove:a})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Qt,{children:[l.jsx(dt,{ref:g,variant:"composer",value:h,onChange:b,onKeyDown:z,placeholder:e.placeholder,disabled:c}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:p&&l.jsx(Gt,{integrated:!0,disabled:c,maxFileBytes:f,maxFiles:s,allowedMime:m,currentCount:v.length,uploadAttachment:o,onUploaded:$,onError:C})}),l.jsx(Zt,{type:"button",onClick:M,disabled:c||!h.trim()&&v.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}exports.EmbeddedChat=Rn;exports.FloatingChat=Dt;exports.InlineChat=gi;exports.MarkdownRenderer=jn;exports.OrdifyApiClient=Fr;exports.OrdifyChat=mi;exports.debounce=Wn;exports.formatTime=Kn;exports.generateId=Pe;exports.parseStreamingResponse=Kr;exports.throttle=Un;exports.useOrdifyChat=Wr;exports.useOrdifyConfig=Ur;exports.useWidgetAttachmentStaging=pt;
1138
+ `;function yi({chatName:e="Chat Assistant",showCloseButton:t=!0,onClose:r,agentImage:n,className:o,primaryColor:c,showWelcomeScreen:u=!1}){return l.jsxs(ui,{className:o,$primaryColor:c,$showWelcomeScreen:u,children:[l.jsxs(pi,{children:[n&&l.jsx(ye,{src:n,alt:e||"Agent",$size:"32px"}),l.jsxs(fi,{children:[l.jsx(hi,{}),l.jsx(mi,{children:e})]})]}),l.jsx(gi,{children:t&&l.jsx(bi,{onClick:r,"aria-label":"Close",children:l.jsx(ti,{size:16})})})]})}function zt({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,exportMessagePdf:c,isLoading:u,error:d,isOpen:h,setIsOpen:b,hasSessionStarted:g}=t,[p,v]=x.useState(""),[w,C]=x.useState(e.height||600),[I,$]=x.useState(!1),a=x.useRef(null),{enabled:i,staged:s,attachmentError:f,setAttachmentError:m,addFiles:k,appendStaged:y,removeStaged:A,clearStaged:R,maxFiles:z,maxBytes:P,allowed:K}=ft(e,o),j=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":I?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const S=()=>{$(window.matchMedia("(prefers-color-scheme: dark)").matches)};S();const O=window.matchMedia("(prefers-color-scheme: dark)");return O.addEventListener("change",S),()=>O.removeEventListener("change",S)}else $(e.theme==="dark")},[e.theme]);const W=async()=>{const S=p.trim();!S&&s.length===0||u||(await n(S,void 0,s.length?s:void 0),v(""),R(),setTimeout(()=>{var O;(O=a.current)==null||O.focus()},100))},T=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),W())},D=S=>{i&&(S.preventDefault(),S.dataTransfer.dropEffect="copy")},H=async S=>{if(!i)return;S.preventDefault();const O=await Gt(S.dataTransfer);O.length&&await k(O)};return h?l.jsxs(qs,{$position:e.position||"bottom-right","data-theme":j(),style:{height:w,...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.textColor?{color:e.textColor}:{},...e.chatWindowStyle},children:[e.resizable!==!1&&l.jsx(Gs,{$position:"top",onMouseDown:S=>{S.preventDefault();const O=S.clientY,N=typeof w=="number"?w:600,F=Y=>{const B=Y.clientY-O,q=N-B;C(Math.max(200,Math.min(600,q)))},_=()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",F),document.addEventListener("mouseup",_)}}),e.showHeader!==!1&&l.jsx(yi,{agentImage:e.agentImage,chatName:e.chatName,onClose:()=>b(!1),primaryColor:e.primaryColor,showWelcomeScreen:e.quickQuestions&&e.quickQuestions.length>0&&!g}),e.quickQuestions&&e.quickQuestions.length>0&&!g?l.jsx(tr,{config:e,onQuestionClick:async S=>{await n(S)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(rr,{surfaceTheme:j(),onDragOver:D,onDrop:H,children:l.jsxs(nr,{children:[r.map(S=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:S.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[S.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),S.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(qt,{message:S})}),Rn(S,r,u)&&l.jsx(yn,{content:S.content,disabled:u,onExportPdf:O=>c(O)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[S.attachments&&S.attachments.length>0&&l.jsx(be,{attachments:S.attachments,readOnly:!0,tone:"onPrimary"}),S.content?S.content:null]})})]},S.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Xt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(er,{children:d})]})}),l.jsxs(Zt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(f||i&&s.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[f&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:f}),i&&s.length>0&&l.jsx(be,{attachments:s,onRemove:A})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Yt,{children:[l.jsx(ut,{ref:a,variant:"composer",value:p,onChange:v,onKeyDown:T,placeholder:e.placeholder,disabled:u}),l.jsxs(Vt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:i&&l.jsx(Qt,{integrated:!0,disabled:u,maxFileBytes:P,maxFiles:z,allowedMime:K,currentCount:s.length,uploadAttachment:o,onUploaded:y,onError:m})}),l.jsx(Jt,{type:"button",onClick:W,disabled:u||!p.trim()&&s.length===0,"aria-label":"Send message",children:l.jsx(pt,{size:13})})]})]})})]})]})]}):l.jsxs(Hs,{onClick:()=>b(!0),style:e.buttonStyle,$position:e.position||"bottom-right",$primaryColor:e.primaryColor,"aria-label":"Open chat",children:[l.jsx("div",{className:"icon-container",children:l.jsx(ei,{size:16})}),l.jsx("span",{children:e.buttonText||e.chatName||"AI Chat"})]})}function xi(e){const t=Hr(e),r=Ur(t);switch(t.mode){case"floating":return l.jsx(zt,{config:t,chat:r});case"embedded":return l.jsx(_n,{config:t,chat:r});default:return l.jsx(zt,{config:t,chat:r})}}function ki({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:o,isLoading:c,error:u,hasSessionStarted:d}=t,[h,b]=x.useState(""),g=x.useRef(null),{enabled:p,staged:v,attachmentError:w,setAttachmentError:C,addFiles:I,appendStaged:$,removeStaged:a,clearStaged:i,maxFiles:s,maxBytes:f,allowed:m}=ft(e,o),[k,y]=x.useState(!1),A=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":k?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const j=()=>{y(window.matchMedia("(prefers-color-scheme: dark)").matches)};j();const W=window.matchMedia("(prefers-color-scheme: dark)");return W.addEventListener("change",j),()=>W.removeEventListener("change",j)}else y(e.theme==="dark")},[e.theme]);const R=async()=>{const j=h.trim();!j&&v.length===0||c||(await n(j,void 0,v.length?v:void 0),b(""),i(),setTimeout(()=>{var W;(W=g.current)==null||W.focus()},100))},z=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),R())},P=j=>{p&&(j.preventDefault(),j.dataTransfer.dropEffect="copy")},K=async j=>{if(!p)return;j.preventDefault();const W=await Gt(j.dataTransfer);W.length&&await I(W)};return l.jsx(En,{"data-theme":A(),style:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},children:e.quickQuestions&&e.quickQuestions.length>0&&!d?l.jsx(tr,{config:e,onQuestionClick:async j=>{await n(j)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(rr,{style:{flex:1},surfaceTheme:A(),onDragOver:P,onDrop:K,children:l.jsxs(nr,{children:[r.map(j=>l.jsxs("div",{style:{display:"flex",marginBottom:"12px",justifyContent:j.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[j.role==="assistant"&&e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:j.role==="user",children:j.role==="assistant"?l.jsx(qt,{message:j}):l.jsxs(l.Fragment,{children:[j.attachments&&j.attachments.length>0&&l.jsx(be,{attachments:j.attachments,readOnly:!0,tone:"onPrimary"}),j.content?j.content:null]})})]},j.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"12px"},children:[e.agentImage&&l.jsx(ye,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Xt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(er,{children:u})]})}),l.jsxs(Zt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(w||p&&v.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[w&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:w}),p&&v.length>0&&l.jsx(be,{attachments:v,onRemove:a})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Yt,{children:[l.jsx(ut,{ref:g,variant:"composer",value:h,onChange:b,onKeyDown:z,placeholder:e.placeholder,disabled:c}),l.jsxs(Vt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:p&&l.jsx(Qt,{integrated:!0,disabled:c,maxFileBytes:f,maxFiles:s,allowedMime:m,currentCount:v.length,uploadAttachment:o,onUploaded:$,onError:C})}),l.jsx(Jt,{type:"button",onClick:R,disabled:c||!h.trim()&&v.length===0,"aria-label":"Send message",children:l.jsx(pt,{size:13})})]})]})})]})]})})}exports.EmbeddedChat=_n;exports.FloatingChat=zt;exports.InlineChat=ki;exports.MarkdownRenderer=In;exports.OrdifyApiClient=Kr;exports.OrdifyChat=xi;exports.debounce=Un;exports.formatTime=Wn;exports.generateId=Pe;exports.parseStreamingResponse=Wr;exports.throttle=Hn;exports.useOrdifyChat=Ur;exports.useOrdifyConfig=Hr;exports.useWidgetAttachmentStaging=ft;