vpschatbotwidget 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -16
- package/dist-lib/types/chatbot/api/chatbot-types.d.ts +8 -1
- package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +4 -1
- package/dist-lib/types/chatbot/core/ChatContext.d.ts +5 -1
- package/dist-lib/types/chatbot/core/ChatHeader.d.ts +2 -0
- package/dist-lib/types/chatbot/core/ChatInlineCitation.d.ts +5 -0
- package/dist-lib/types/chatbot/core/ChatInput.d.ts +5 -0
- package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +4 -1
- package/dist-lib/types/chatbot/core/ChatMessage.d.ts +1 -0
- package/dist-lib/types/chatbot/core/ChatMessageActions.d.ts +7 -0
- package/dist-lib/types/chatbot/core/ChatMessageList.d.ts +3 -1
- package/dist-lib/types/chatbot/core/ChatProvider.d.ts +2 -2
- package/dist-lib/types/chatbot/core/GroundedSources.d.ts +5 -0
- package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +2 -2
- package/dist-lib/types/chatbot/hooks/useCopyText.d.ts +4 -0
- package/dist-lib/types/chatbot/hooks/useResponseSound.d.ts +6 -0
- package/dist-lib/types/chatbot/index.d.ts +1 -1
- package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +2 -2
- package/dist-lib/types/components/ai-elements/inline-citation.d.ts +52 -0
- package/dist-lib/types/components/ai-elements/reasoning.d.ts +21 -0
- package/dist-lib/types/components/ai-elements/suggestion.d.ts +9 -0
- package/dist-lib/types/components/ui/bubble.d.ts +6 -0
- package/dist-lib/types/components/ui/button.d.ts +8 -0
- package/dist-lib/types/components/ui/hover-card.d.ts +5 -0
- package/dist-lib/types/components/ui/input-group.d.ts +5 -0
- package/dist-lib/types/components/ui/marker.d.ts +6 -0
- package/dist-lib/types/components/ui/message.d.ts +8 -0
- package/dist-lib/types/components/ui/trace.d.ts +19 -0
- package/dist-lib/types/lib/safeHref.d.ts +1 -0
- package/dist-lib/vps-chatbot.cjs +110 -29
- package/dist-lib/vps-chatbot.js +9540 -1654
- package/package.json +6 -2
- package/src/chatbot/api/chatbot-api.ts +1 -0
- package/src/chatbot/api/chatbot-types.ts +9 -1
- package/src/chatbot/chatbot.test.tsx +125 -7
- package/src/chatbot/core/AgentReasoning.tsx +68 -36
- package/src/chatbot/core/ChatContext.tsx +5 -0
- package/src/chatbot/core/ChatEmptyState.tsx +14 -13
- package/src/chatbot/core/ChatError.tsx +20 -12
- package/src/chatbot/core/ChatHeader.tsx +17 -1
- package/src/chatbot/core/ChatInlineCitation.tsx +63 -0
- package/src/chatbot/core/ChatInput.tsx +73 -51
- package/src/chatbot/core/ChatMarkdown.tsx +70 -24
- package/src/chatbot/core/ChatMessage.tsx +77 -88
- package/src/chatbot/core/ChatMessageActions.tsx +51 -0
- package/src/chatbot/core/ChatMessageList.tsx +15 -7
- package/src/chatbot/core/ChatPanel.tsx +19 -7
- package/src/chatbot/core/ChatProvider.tsx +58 -10
- package/src/chatbot/core/ChatSuggestions.tsx +14 -34
- package/src/chatbot/core/GroundedSources.tsx +113 -90
- package/src/chatbot/core/grounding.test.tsx +111 -4
- package/src/chatbot/embedded/EmbeddedChatbot.tsx +2 -2
- package/src/chatbot/hooks/useCopyText.ts +23 -0
- package/src/chatbot/hooks/useResponseSound.ts +74 -0
- package/src/chatbot/index.ts +1 -0
- package/src/chatbot/widget/ChatbotWidget.tsx +2 -2
- package/src/components/ai-elements/inline-citation.tsx +299 -0
- package/src/components/ai-elements/reasoning.tsx +126 -0
- package/src/components/ai-elements/suggestion.tsx +42 -0
- package/src/components/ui/bubble.tsx +18 -0
- package/src/components/ui/button.tsx +43 -0
- package/src/components/ui/hover-card.tsx +43 -0
- package/src/components/ui/input-group.tsx +18 -0
- package/src/components/ui/marker.tsx +18 -0
- package/src/components/ui/message.tsx +26 -0
- package/src/components/ui/trace.tsx +68 -0
- package/src/index.css +579 -272
- package/src/lib/safeHref.ts +6 -0
package/dist-lib/vps-chatbot.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`);if(!
|
|
1
|
+
"use strict";var Uc=Object.create;var or=Object.defineProperty;var zc=Object.getOwnPropertyDescriptor;var Wc=Object.getOwnPropertyNames;var qc=Object.getPrototypeOf,Gc=Object.prototype.hasOwnProperty;var Kc=(e,t,n)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Yc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wc(t))!Gc.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=zc(t,o))||r.enumerable});return e};var Xc=(e,t,n)=>(n=e!=null?Uc(qc(e)):{},Yc(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var ae=(e,t,n)=>Kc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),I=require("react"),Jc=require("react-dom");var sr=typeof document<"u"?document.currentScript:null;function Us(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const v=Us(I),dt=Us(Jc),Zc={};function vt(e){if(e!=null&&e.trim()!=="")return e.trim().replace(/\/+$/,"");const t=(typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:sr&&sr.tagName.toUpperCase()==="SCRIPT"&&sr.src||new URL("vps-chatbot.cjs",document.baseURI).href}<"u"&&Zc,"");return String(t).trim().replace(/\/+$/,"")}function Rn(e,t){const n=vt(e);if(!n)return t;if(n.endsWith("/api")&&t.startsWith("/api/"))return`${n}${t.slice(4)}`;if(n.endsWith("/api")&&t==="/health"){const o=n.slice(0,-4);return o?`${o}/health`:"/health"}const r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`}function zo(e){return e&&typeof e=="object"&&"data"in e&&e.success!==!1?e.data:e}function Wo(e,t,n){var s,i,c;const r=e,o=(s=r==null?void 0:r.error)==null?void 0:s.message;return o&&!Qc(o)?{code:(i=r==null?void 0:r.error)==null?void 0:i.code,message:o,requestId:(c=r==null?void 0:r.error)==null?void 0:c.request_id}:n>=500?{message:"I couldn't process that request right now."}:n===0?{message:"Something went wrong while connecting. Please try again."}:{message:t}}function Qc(e){return/traceback|sql|exception|stack|api[_ ]?key|password/i.test(e)}function ir(e){return{chunkId:e.chunk_id,source:e.source,score:e.score,title:e.title,...e.url?{url:e.url}:{},snippet:e.snippet}}function cr(e){return{toolName:e.tool_name,arguments:e.arguments??{},result:e.result??{}}}function ar(e){return{model:e.model,promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,totalTokens:e.total_tokens}}function ea(e){const t=e.role==="user"||e.role==="system"?e.role:"assistant";return{id:String(e.id),role:t,content:e.content,createdAt:e.created_at||new Date().toISOString(),status:"complete",usage:e.model?{model:e.model,promptTokens:e.prompt_tokens||0,completionTokens:e.completion_tokens||0,totalTokens:(e.prompt_tokens||0)+(e.completion_tokens||0)}:void 0}}async function lr(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Gr(e){const t=vt(e);async function n(r,o){let s;const i=Rn(t,r);try{s=await fetch(i,{...o,headers:{"Content-Type":"application/json",...(o==null?void 0:o.headers)??{}}})}catch{throw{message:"Something went wrong while connecting. Please try again."}}if(s.status===204)return;const c=await lr(s);if(!s.ok)throw Wo(c,"I couldn't process that request right now.",s.status);return zo(c)}return{apiBaseUrl:t,async listModels(){try{const r=await n("/api/v1/models");return{defaultModelId:r.default_model_id,complexModelId:r.complex_model_id,models:r.models||[]}}catch{return null}},async createSession(r){const o=await n("/api/v1/sessions",{method:"POST",signal:r,body:JSON.stringify({})});return{sessionId:o.session_id,createdAt:o.created_at}},async sendMessage(r,o,s,i){const c=await n(`/api/v1/sessions/${r}/messages`,{method:"POST",signal:i,body:JSON.stringify({message:o,...(s==null?void 0:s.roleId)!==void 0?{role_id:s.roleId}:{},...s!=null&&s.client?{client:s.client}:{},...s!=null&&s.modelId?{model_id:s.modelId}:{}})});return{requestId:c.request_id,sessionId:c.session_id,answer:c.answer,sources:(c.sources||[]).map(ir),toolCalls:(c.tool_calls||[]).map(cr),usage:ar(c.usage),durationMs:c.duration_ms}},async sendMessageStream(r,o,s,i,c,a){var f,u;const l=Rn(t,`/api/v1/sessions/${r}/messages/stream`);try{const d=await fetch(l,{method:"POST",signal:a,headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o,...(s==null?void 0:s.roleId)!==void 0?{role_id:s.roleId}:{},...s!=null&&s.client?{client:s.client}:{},...s!=null&&s.modelId?{model_id:s.modelId}:{}})});if(!d.ok){if(d.status===404||d.status===405)return await this.sendMessage(r,o,s,a);const S=await lr(d);throw Wo(S,"I couldn't process that request right now.",d.status)}if(!d.body||(u=(f=d.headers)==null?void 0:f.get("content-type"))!=null&&u.includes("application/json")){const S=zo(await lr(d));if(typeof S.answer!="string"||!S.usage)throw{message:"The response stream ended unexpectedly."};return{requestId:S.request_id,sessionId:S.session_id,answer:S.answer,sources:(S.sources||[]).map(ir),toolCalls:(S.tool_calls||[]).map(cr),usage:ar(S.usage),durationMs:S.duration_ms}}const g=d.body.getReader(),p=new TextDecoder;let m="";const b={value:null},y=S=>{const E=S.split(/\r?\n/).filter(w=>w.startsWith("data:")).map(w=>w.slice(5).trimStart()).join(`
|
|
2
|
+
`);if(!E)return;let C={};try{const w=JSON.parse(E);if(!w||typeof w!="object")return;C=w}catch{return}if(C.type==="progress"&&typeof C.stage=="string")i==null||i(C.stage);else if(C.type==="token"&&typeof C.text=="string")c==null||c(C.text);else if(C.type==="complete")b.value={requestId:C.request_id||"",sessionId:C.session_id||r,answer:C.answer||"",sources:(C.sources||[]).map(ir),toolCalls:(C.tool_calls||[]).map(cr),usage:C.usage?ar(C.usage):{model:"",promptTokens:0,completionTokens:0,totalTokens:0},durationMs:C.duration_ms};else if(C.type==="error")throw{message:C.message||"I couldn't process that request right now.",requestId:C.request_id}};try{for(;!b.value;){const{done:S,value:E}=await g.read();if(S)break;if(m+=p.decode(E,{stream:!0}),m.length>1e6)throw{message:"The response stream was too large."};const C=m.split(/\r?\n\r?\n/);m=C.pop()||"";for(const w of C)if(y(w),b.value)break}m+=p.decode(),!b.value&&m.trim()&&y(m)}finally{await g.cancel().catch(()=>{}),g.releaseLock()}const x=b.value;if(x)return x;throw{message:"The response stream ended before the answer was complete."}}catch(d){throw!(d instanceof Error)&&d&&typeof d=="object"&&"message"in d?d:{message:"Something went wrong while connecting. Please try again."}}},async getHistory(r){try{return((await n(`/api/v1/sessions/${r}/messages`)).messages||[]).map(ea)}catch{return[]}},async closeSession(r){try{await n(`/api/v1/sessions/${r}`,{method:"DELETE"})}catch{}},async createTicket(){throw new Error("Ticket creation has been removed.")},async checkHealth(){try{const r=Rn(t,"/health");return(await fetch(r)).ok}catch{return!1}}}}const ta=Gr(),na=[{label:"How do I access my reports?",query:"How do I access my reports in the VPS Customer Portal?"},{label:"Where can I find sample status?",query:"Where can I find my sample status?"},{label:"How do I pre-register a sample?",query:"How do I pre-register a sample in the portal?"},{label:"How do I contact VPS Support?",query:"How can I contact VPS Customer Support?"}],qo="vps-chatbot-response-sound";function ra(){const[e,t]=I.useState(!0),n=I.useRef(!0),r=I.useRef(null);I.useEffect(()=>{try{n.current=window.localStorage.getItem(qo)!=="off",t(n.current)}catch{}return()=>{var c;(c=r.current)==null||c.close().catch(()=>{}),r.current=null}},[]);const o=I.useCallback(()=>{if(!(!n.current||typeof AudioContext>"u"))try{const c=r.current??(r.current=new AudioContext);c.state!=="running"&&c.resume().catch(()=>{})}catch{}},[]),s=I.useCallback(()=>{const c=!n.current;n.current=c,t(c);try{window.localStorage.setItem(qo,c?"on":"off")}catch{}c&&o()},[o]),i=I.useCallback(()=>{const c=r.current;if(!(!n.current||(c==null?void 0:c.state)!=="running"))try{const a=c.currentTime;for(const[l,f]of[660,880].entries()){const u=a+l*.09,d=c.createOscillator(),g=c.createGain();d.frequency.value=f,g.gain.setValueAtTime(.001,u),g.gain.exponentialRampToValueAtTime(.06,u+.015),g.gain.exponentialRampToValueAtTime(.001,u+.14),d.connect(g),g.connect(c.destination),d.onended=()=>{d.disconnect(),g.disconnect()},d.start(u),d.stop(u+.15)}}catch{}},[]);return{soundEnabled:e,toggleSound:s,prepareSound:o,playSound:i}}const Kr=I.createContext(null);function zs(){const e=I.useContext(Kr);if(!e)throw new Error("useChatbot must be used inside ChatProvider.");return e}function qn(){return I.useContext(Kr)}function Ot(e,t,n,r){if(typeof performance.measure!="function")return;const o=`vps-chatbot:${e}`;performance.clearMeasures(o),performance.measure(o,{start:t,end:n,detail:r?{requestId:r}:null})}const oa=`Hello! I am your **VPS Veritas assistant**.
|
|
3
3
|
|
|
4
4
|
I can help you with:
|
|
5
5
|
- **Fuel Quality Testing (FQT)** & **Oil Condition Monitoring (OCM)**
|
|
@@ -8,127 +8,208 @@ I can help you with:
|
|
|
8
8
|
- **FSC & FSQ E-Forms** — paperless fuel system checks and bunker sample pre-registration
|
|
9
9
|
- **Samplogic** sample logistics, report downloads, and support tickets
|
|
10
10
|
|
|
11
|
-
Feel free to ask a question or select one of the suggested topics below!`;function
|
|
11
|
+
Feel free to ask a question or select one of the suggested topics below!`;function Go(e){return`${e}-${crypto.randomUUID()}`}function sa(e){if(e&&typeof e=="object"&&"message"in e){const t=String(e.message);if(t&&!/traceback|sql|exception|stack|api[_ ]?key|password/i.test(t))return t}return"I couldn't process that request right now."}const Yr=({children:e,userContext:t={},role:n,roleId:r,client:o,welcomeMessage:s,suggestions:i=na,disableSuggestions:c=!1,initialMessage:a,apiBaseUrl:l,apiUrl:f,proxyUrl:u,api:d,hideInspectSources:g=!1,showGroundedSources:p=!1,modelId:m="auto"})=>{const b=l??f??u,y=I.useMemo(()=>d??Gr(b),[d,b]),x=I.useMemo(()=>({...t,...n!==void 0?{role:n}:{},...r!==void 0?{roleId:r}:{},...o!==void 0?{client:o}:{}}),[t,n,r,o]),S=I.useMemo(()=>s===""?null:{id:"welcome-default",role:"assistant",content:s||oa,createdAt:new Date().toISOString(),status:"complete"},[s]),[E,C]=I.useState(null),[w,R]=I.useState(()=>S?[S]:[]),[O,P]=I.useState("idle"),[M,F]=I.useState(null),A=I.useRef(null),D=I.useRef(!1),_=I.useRef(null),T=I.useRef(null),k=I.useRef(!1),[U,j]=I.useState([]),[N,Y]=I.useState(m),{soundEnabled:K,toggleSound:le,prepareSound:ie,playSound:L}=ra();I.useEffect(()=>Y(m),[m]),I.useEffect(()=>{var J;let z=!0;return j([]),(J=y.listModels)==null||J.call(y).then(ce=>{z&&j((ce==null?void 0:ce.models)||[])}).catch(()=>{}),()=>{z=!1}},[y]);const X=I.useCallback(z=>{!k.current&&(z==="auto"||U.some(J=>J.id===z&&J.configured))&&Y(z)},[U]);I.useEffect(()=>()=>{var z;return(z=_.current)==null?void 0:z.abort()},[]),I.useLayoutEffect(()=>{const z=T.current;if(!z)return;const J=w.find(he=>he.id===z.messageId),ce=performance.now();(J==null?void 0:J.status)==="complete"&&z.completedAt!==void 0?(Ot("completion-to-commit",z.completedAt,ce),Ot("submit-to-complete-commit",z.startedAt,ce),T.current=null):(J==null?void 0:J.status)==="pending"&&J.content&&z.firstTokenAt!==void 0&&!z.firstCommitRecorded&&(Ot("first-token-to-commit",z.firstTokenAt,ce),z.firstCommitRecorded=!0)},[w]);const B=I.useCallback(async z=>{if(E)return E;P("connecting");const J=await y.createSession(z);if(z.aborted)throw new DOMException("Aborted","AbortError");return C(J.sessionId),J.sessionId},[E,y]),$=I.useCallback(async z=>{if(k.current)return;ie(),k.current=!0;const J=new AbortController;_.current=J;let ce,he="";const Pe=()=>{ce!==void 0&&cancelAnimationFrame(ce),ce=void 0};A.current=z;const je={id:Go("user"),role:"user",content:z,createdAt:new Date().toISOString(),status:"complete"},Re=Go("asst"),Me="Preparing your answer…",Be={id:Re,streamId:Re,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"pending",progressText:Me,progressSteps:[Me]},H=performance.now(),G={messageId:Re,startedAt:H};T.current=G,R(be=>[...be,je,Be]),P("awaiting"),F(null);const Se=be=>{const ge=be.trim();!ge||J.signal.aborted||R(V=>V.map(q=>q.id===Re&&q.progressText!==ge?{...q,progressText:ge,progressSteps:[...q.progressSteps??[],ge]}:q))};try{const be=await B(J.signal),ge=performance.now();Ot("request-preparation",H,ge);const V=y.sendMessageStream?await y.sendMessageStream(be,z,{roleId:x.roleId,client:x.client,modelId:N},Se,q=>{J.signal.aborted||(q&&G.firstTokenAt===void 0&&(G.firstTokenAt=performance.now(),Ot("first-token-received",ge,G.firstTokenAt)),he+=q,ce===void 0&&(ce=requestAnimationFrame(()=>{ce=void 0,J.signal.aborted||R(Z=>Z.map(se=>se.id===Re?{...se,content:he}:se))})))},J.signal):await y.sendMessage(be,z,{roleId:x.roleId,client:x.client,modelId:N},J.signal);if(Pe(),J.signal.aborted)return;G.messageId=V.requestId||Re,G.completedAt=performance.now(),Ot("completion-received",ge,G.completedAt,V.requestId),R(q=>q.map(Z=>Z.id===Re?{...Z,id:V.requestId||Re,content:V.answer,status:"complete",progressText:void 0,sources:V.sources,toolCalls:V.toolCalls,usage:V.usage,durationMs:Math.max(Math.round(performance.now()-H),V.durationMs??0)}:Z)),P("idle"),L()}catch(be){if(Pe(),T.current===G&&(T.current=null),J.signal.aborted)return;const ge=sa(be);R(V=>V.map(q=>q.id===Re?{...q,content:ge,status:"error",progressText:void 0}:q)),F(ge),P("error")}finally{Pe(),_.current===J&&(_.current=null,k.current=!1)}},[B,y,x.client,x.roleId,N,ie,L]),Q=I.useCallback(async z=>{const J=z.trim();!J||O==="awaiting"||O==="connecting"||await $(J)},[$,O]),re=I.useCallback(async()=>{if(k.current)return;const z=A.current;z&&(R(J=>J.filter(ce=>ce.status!=="error")),await $(z))},[$]),ee=I.useCallback(()=>{const z=_.current;z&&(z.abort(),_.current=null,k.current=!1,T.current=null,R(J=>J.map(ce=>ce.status==="pending"?{...ce,status:"stopped",progressText:void 0}:ce)),P("idle"))},[]),te=I.useCallback((z,J)=>{R(ce=>ce.map(he=>he.id===z?{...he,feedback:he.feedback===J?void 0:J}:he))},[]),W=I.useCallback(async()=>{},[]),ne=I.useCallback(()=>{},[]),oe=I.useCallback(async()=>{var z;(z=_.current)==null||z.abort(),_.current=null,k.current=!1,C(null),R(S?[S]:[]),P("idle"),F(null),A.current=null,E&&await y.closeSession(E)},[E,y,S]);I.useEffect(()=>{!a||D.current||(D.current=!0,Q(a))},[a,Q]);const ye=I.useMemo(()=>({messages:w,status:O,error:M,sessionId:E,pendingTicket:null,ticketBusy:!1,lastTicket:null,suggestions:i,showSuggestions:!c&&O==="idle"&&(w.length===0||w.length===1&&w[0].id==="welcome-default"||w.some(z=>z.role==="assistant"&&z.status==="complete"&&!z.id.startsWith("welcome"))),suggestionBadgesEnabled:!c,userContext:x,apiBaseUrl:y.apiBaseUrl,hideInspectSources:g,showGroundedSources:p,soundEnabled:K,toggleSound:le,sendMessage:Q,stopResponse:ee,toggleMessageFeedback:te,retryLast:re,confirmTicket:W,cancelTicket:ne,resetConversation:oe,models:U,selectedModelId:N,selectModel:X}),[w,O,M,E,i,c,x,y.apiBaseUrl,g,p,K,le,Q,ee,te,re,W,ne,oe,U,N,X]);return h.jsx(Kr.Provider,{value:ye,children:e})};function Ws(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ws(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function qs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ws(e))&&(r&&(r+=" "),r+=t);return r}function ue(...e){return qs(e)}function Gs({className:e,variant:t="default",...n}){return h.jsx("div",{...n,"data-slot":"marker","data-variant":t,className:ue("chat-marker",e)})}function ia({className:e,...t}){return h.jsx("span",{...t,"data-slot":"marker-icon",className:ue("chat-marker-icon",e),"aria-hidden":"true"})}function Ks({className:e,...t}){return h.jsx("span",{...t,"data-slot":"marker-content",className:ue("chat-marker-content",e)})}function en(){return zs()}/**
|
|
12
12
|
* @license lucide-react v0.468.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const ca=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ys=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
17
17
|
* @license lucide-react v0.468.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var
|
|
21
|
+
*/var aa={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"};/**
|
|
22
22
|
* @license lucide-react v0.468.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const la=I.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>I.createElement("svg",{ref:a,...aa,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ys("lucide",o),...c},[...i.map(([l,f])=>I.createElement(l,f)),...Array.isArray(s)?s:[s]]));/**
|
|
27
27
|
* @license lucide-react v0.468.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const ve=(e,t)=>{const n=I.forwardRef(({className:r,...o},s)=>I.createElement(la,{ref:s,iconNode:t,className:Ys(`lucide-${ca(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
32
32
|
* @license lucide-react v0.468.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const ua=ve("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
|
|
37
37
|
* @license lucide-react v0.468.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const fa=ve("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
42
42
|
* @license lucide-react v0.468.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const da=ve("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
47
47
|
* @license lucide-react v0.468.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const pa=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
52
52
|
* @license lucide-react v0.468.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const Xs=ve("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/**
|
|
57
57
|
* @license lucide-react v0.468.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const Xr=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
62
62
|
* @license lucide-react v0.468.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const ha=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
67
67
|
* @license lucide-react v0.468.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const Js=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
72
72
|
* @license lucide-react v0.468.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const ga=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
77
77
|
* @license lucide-react v0.468.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const Zs=ve("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
82
82
|
* @license lucide-react v0.468.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const ma=ve("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
|
|
87
87
|
* @license lucide-react v0.468.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const Qs=ve("Copy",[["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"}]]);/**
|
|
92
92
|
* @license lucide-react v0.468.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const ba=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
97
97
|
* @license lucide-react v0.468.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const ya=ve("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
|
|
102
102
|
* @license lucide-react v0.468.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const va=ve("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
107
107
|
* @license lucide-react v0.468.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const ei=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
112
112
|
* @license lucide-react v0.468.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const ti=ve("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
117
117
|
* @license lucide-react v0.468.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const
|
|
121
|
+
*/const xa=ve("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
|
|
122
122
|
* @license lucide-react v0.468.0 - ISC
|
|
123
123
|
*
|
|
124
124
|
* This source code is licensed under the ISC license.
|
|
125
125
|
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const
|
|
126
|
+
*/const Ea=ve("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
127
127
|
* @license lucide-react v0.468.0 - ISC
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const Jt=z("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Kt={alpha:{label:"Alpha",Icon:zt,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:Yt,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Wt,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:qt,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Qt=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:l,tooltip:a}=Kt[e];return s.jsxs("span",{className:`env-badge-inline ${l} ${n}`.trim(),title:a,"aria-label":`${r} build`,role:"status",children:[s.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),s.jsx("span",{className:"env-badge-inline-label",children:r})]})},Xt=e=>s.jsx("svg",{width:e.width||"24px",height:e.height||"24px",viewBox:"0 0 24 24",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:e.Color||"currentColor",...e,children:s.jsx("path",{d:"M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z"})}),Zt=({title:e="VPS AI Assistant",subtitle:t="Customer portal support",onClose:n,onReset:r,onBack:o,showMinimize:l=!1,envStage:a,envPulse:i=!0})=>s.jsxs("header",{className:"chat-header",children:[s.jsxs("div",{className:"chat-header-left",children:[o&&s.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:s.jsx(It,{size:16})}),s.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:s.jsx(Xt,{width:"16px",height:"16px",color:"white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"chat-header-title-row",children:[s.jsx("h2",{className:"chat-header-title",children:e}),s.jsx(Qt,{stage:a,pulse:i})]}),s.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),s.jsxs("div",{className:"chat-header-actions",children:[r&&s.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:s.jsx(Gt,{size:15})}),n&&s.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":l?"Minimize chat":"Close chat",children:s.jsx(Vt,{size:16})})]})]});function er(e,t){const n=g.useRef(e);g.useEffect(()=>{var r;n.current&&!e&&((r=t.current)==null||r.focus()),n.current=e},[e,t])}function tr(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const rr=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?r==="badge"?s.jsx("ul",{className:"suggestions-badge-list","aria-label":"Suggested questions",children:e.map(o=>s.jsx("li",{className:"suggestion-badge-item",children:s.jsx("button",{type:"button",disabled:n,onClick:()=>t(o),title:o.query,className:"suggestion-badge-btn",children:o.label})},o.query))}):s.jsx("div",{className:"suggestions-list",children:e.map(o=>s.jsx("button",{type:"button",disabled:n,onClick:()=>t(o),className:"suggestion-list-btn",children:o.label},o.query))}):null,nr=({onSend:e,disabled:t=!1,placeholder:n="Ask something…"})=>{const{suggestions:r,showSuggestions:o,suggestionBadgesEnabled:l,models:a,selectedModelId:i,selectModel:u}=xe(),[h,b]=g.useState(""),p=g.useRef(null),c=g.useId(),f=m=>{m&&(m.style.height="auto",m.style.height=`${Math.min(m.scrollHeight,96)}px`)};er(t,p),g.useEffect(()=>{f(p.current)},[h]);const v=g.useMemo(()=>{if(!l||t)return[];const m=h.trim();return m?tr(r,m):o?r:[]},[t,o,l,r,h]),x=m=>{b(m.query);const I=p.current;I==null||I.focus()},_=()=>{const m=h.trim();!m||t||(e(m),b(""),p.current&&(p.current.style.height="auto"))};return s.jsxs("div",{className:"chat-input-wrapper",children:[s.jsx(rr,{variant:"badge",suggestions:v,onSelect:x,disabled:t}),s.jsx("label",{htmlFor:"vps-chat-input",className:"sr-only",children:"Chat message"}),s.jsxs("div",{className:"chat-input-row",children:[s.jsx("textarea",{id:"vps-chat-input",ref:p,rows:1,value:h,disabled:t,placeholder:n,onChange:m=>{b(m.target.value),f(m.target)},onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),_())},className:"chat-textarea"}),s.jsx("button",{type:"button",onClick:_,disabled:t||!h.trim(),"aria-label":"Send message",className:"chat-send-btn",children:s.jsx(Nt,{size:16})})]}),a.length>1&&s.jsxs("div",{className:"chat-model-picker",children:[s.jsx("label",{htmlFor:c,children:"AI model"}),s.jsxs("select",{id:c,"aria-label":"AI model",value:i,disabled:t,onChange:m=>u(m.target.value),children:[s.jsx("option",{value:"auto",children:"Automatic"}),a.map(m=>s.jsx("option",{value:m.id,disabled:!m.configured,children:m.label},m.id))]})]}),s.jsxs("p",{className:"chat-input-footer",children:["Powered by ",s.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function sr({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=qe(or(r,o),t);if(!n)return d.createElement(e,l);if(typeof n=="function")return n(l,r);if(!d.isValidElement(n))return null;let a=n.props,i={...qe(l,a),ref:ke(l.ref,a.ref)};return d.cloneElement(n,i)}function qe(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let l=r[o];if(l===void 0)continue;let a=t[o];o==="className"?t[o]=[a,l].filter(Boolean).join(" "):o==="style"?t[o]={...a,...l}:o==="ref"?t[o]=ke(a,l):ar(o)&&typeof a=="function"&&typeof l=="function"?t[o]=lr(l,a):t[o]=l}}return t}function or(e,t){var r;let n={};for(let o of Object.keys(e)){let l=e[o],a=(r=t==null?void 0:t[o])==null?void 0:r.call(t,l);if(a){Object.assign(n,a);continue}if(o==="slot"){n["data-slot"]=l;continue}let i=`data-${String(o).replace(/[A-Z]/g,u=>`-${u.toLowerCase()}`)}`;typeof l=="boolean"?n[i]=l?"":void 0:l!=null&&(n[i]=String(l))}return n}function lr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function ar(e){return/^on[A-Z]/.test(e)}function ke(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var ir=8,cr=64,ur=0,Ae=.5,dr=180,hr=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),ct={start:!1,end:!1},fr=[],Me={currentAnchorId:null,visibleMessageIds:fr};function pr({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return ct;let o=Ve({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function mr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return Me;let a=o.getBoundingClientRect(),i=a.top+t+n,u=typeof IntersectionObserver>"u",h=[],b=null;for(let p of ye(e,r)){let c=p.dataset.messageId;if(!c)continue;let f=p.dataset.scrollAnchor==="true",v=f||u?p.getBoundingClientRect():null;(u&&v?v.bottom>i&&v.top<a.bottom:l.has(c))&&h.push(c),f&&v&&v.top<=i+Ae&&(b=c)}return h.length===0&&b===null?Me:{currentAnchorId:b,visibleMessageIds:h}}function ye(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function gr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if((r==null?void 0:r.dataset.scrollAnchor)==="true")return r}return null}function br(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function vr(e,t){var r;let n=0;for(let o=t;o<e.length;o++)if(((r=e[o])==null?void 0:r.dataset.scrollAnchor)==="true"&&(n+=1,n>1))return!0;return!1}function _r(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if((n==null?void 0:n.dataset.scrollAnchor)==="true")return n}return null}function wr({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of ye(e,t)){if(!o.dataset.messageId)continue;let l=o.getBoundingClientRect();if(l.bottom>r.top&&l.top<r.bottom)return o}return null}function yr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=ut(t,o),a=t.getBoundingClientRect().height,i=Cr(r);if(e==="center"){let u=Math.max(0,o.clientHeight-i.start-i.end);return l-i.start-(u-a)/2-n}if(e==="end")return l-o.clientHeight+a+i.end+n;if(e==="nearest"){let u=l+a,h=o.scrollTop+i.start,b=o.scrollTop+o.clientHeight-i.end;return l>=h&&u<=b?o.scrollTop:l<h?l-i.start-n:u-o.clientHeight+i.end+n}return l-i.start-n}function ut(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Te(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function xr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Ve({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Ve({content:e,spacer:t,viewport:n}){let r=ye(e,t),o=dt(e),l=n.getBoundingClientRect(),a=n.scrollTop,i=o.start+o.end;for(let u of r){let h=u.getBoundingClientRect();i=Math.max(i,h.bottom-l.top+a+o.end)}return i}function kr(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function dt(e){let t=window.getComputedStyle(e);return{end:$e(t.paddingBlockEnd||t.paddingBottom),start:$e(t.paddingBlockStart||t.paddingTop)}}function Cr(e){let t=e==null?void 0:e.parentElement;return t?dt(t):{end:0,start:0}}function Sr(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return $e(n)}function $e(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function ht(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(l=>l()))},subscribe:(o,l,a)=>{let i=r.size===0;return r.add(o),i&&(l==null||l()),()=>{r.delete(o),r.size===0&&(a==null||a())}}}}function Xe(e,t){return ht(e,t)}function jr(){return ht(Me,Fr)}function Rr(e,t){return e.start===t.start&&e.end===t.end}function Fr(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Tr({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:o}){let l=d.useRef(e),a=d.useRef(!1),i=d.useRef(null),u=d.useRef(!1),h=d.useRef(n),b=d.useRef(0),p=d.useRef(null),c=d.useRef(0),f=d.useRef(e?"following-bottom":"free-scrolling"),v=d.useRef(new Map),x=d.useRef(null),_=d.useRef(null),m=d.useRef(null),I=d.useRef(o),R=d.useRef(!0),B=d.useRef(null),C=d.useRef(r),T=d.useRef(null),A=d.useRef(0),H=d.useRef(0),L=d.useRef(null),se=d.useRef(null),K=d.useRef(null),k=d.useRef(null),E=d.useRef(null),M=d.useRef(null),N=d.useRef(null),D=d.useRef(null),P=d.useRef(null),q=d.useRef(new Set),G=d.useRef(new WeakSet);return K.current===null&&(K.current=Xe(t==="end"||t==="last-anchor",(ee,ie)=>ee===ie)),k.current===null&&(k.current=Xe(ct,Rr)),P.current===null&&(P.current=jr()),l.current=e,h.current=n,C.current=r,I.current=o,{autoScrollRef:l,autoscrollingRef:a,autoscrollingTimeoutRef:E,streamingTurnRef:m,contentRef:i,defaultScrollPositionAppliedRef:u,firstItemRef:p,itemCountRef:b,lastScrollTopRef:c,messageElementsRef:v,modeRef:f,pendingScrollFrameRef:T,pendingScrollToMessageRef:x,prependRestoreRef:_,preserveScrollOnPrependRef:R,pendingDefaultScrollStore:K.current,rootRef:B,scrollEdgeThresholdRef:h,scrollMarginRef:C,scrollPreviousItemPeekRef:I,spacerGapRef:A,spacerHeightRef:H,spacerRef:L,stateFrameRef:se,stateStore:k.current,viewportRef:M,visibilityFrameRef:N,visibilityObserverRef:D,visibilityStore:P.current,visibleMessageIdsRef:q,handledScrollAnchorsRef:G}}function ft(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function Ee(e){e.defaultScrollPositionAppliedRef.current=!0,ft(e)}function Er({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:a,autoscrollingTimeoutRef:i,contentRef:u,itemCountRef:h,messageElementsRef:b,modeRef:p,pendingScrollToMessageRef:c,prependRestoreRef:f,scrollMarginRef:v,scrollPreviousItemPeekRef:x,spacerGapRef:_,spacerHeightRef:m,spacerRef:I,viewportRef:R}=e,B=d.useCallback(k=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null),a.current!==k&&(a.current=k,t()),k&&(i.current=window.setTimeout(()=>{i.current=null,a.current=!1,t()},dr))},[t]),C=d.useCallback(k=>{let E=I.current;if(!E)return;let M=Math.max(0,Math.ceil(k));m.current!==M&&(m.current=M,E.hidden=M===0,E.style.height=`${M}px`,E.style.marginTop=M>0?`${-_.current}px`:"")},[]),T=d.useCallback((k,{behavior:E="auto",autoscrolling:M=!1}={})=>{let N=R.current;if(!N)return;let D=Math.max(0,k);if(Math.abs(N.scrollTop-D)<=Ae){N.scrollTop=D,t();return}M&&B(!0),N.scrollTo({top:D,behavior:E}),n()},[t,n,B]),A=d.useCallback(({behavior:k="auto"}={})=>R.current?(C(0),o.current=null,p.current="free-scrolling",T(0,{behavior:k}),r(),!0):!1,[r,T,C]),H=d.useCallback(({behavior:k="auto"}={})=>{let E=R.current;return E?(C(0),o.current=null,p.current=l.current?"following-bottom":"free-scrolling",T(kr(E),{autoscrolling:!0,behavior:k}),r(),!0):!1},[r,T,C]),L=d.useCallback((k,{align:E="start",behavior:M="auto",scrollMargin:N=v.current}={},{keepPreviousPeek:D=!1}={})=>{let P=u.current,q=R.current;if(!P||!q||!P.contains(k))return!1;let G=yr({align:E,element:k,scrollMargin:D?N+x.current:N,spacer:I.current,viewport:q}),ee=xr({content:P,scrollTop:G,spacer:I.current,viewport:q});return C(ee),f.current={element:k,viewportTop:Te(k,q)},p.current=D?"anchored-to-message":"settling-jump",o.current=D?k:null,T(G,{behavior:M}),r(),!0},[r,T,C]),se=d.useCallback(()=>{let k=o.current;return!k||!k.isConnected||p.current!=="anchored-to-message"?!1:L(k,{align:"start"},{keepPreviousPeek:!0})},[L]),K=d.useCallback((k,E)=>{let M=b.current.get(k);return M?(Ee(e),L(M,E)?(c.current=null,!0):(c.current={messageId:k,options:E},!0)):h.current===0?(c.current={messageId:k,options:E},Ee(e),!0):!1},[L]);return{flushPendingScrollToMessage:d.useCallback(()=>{let k=c.current;if(!k)return!1;let E=b.current.get(k.messageId);return!E||!L(E,k.options)?!1:(c.current=null,Ee(e),!0)},[L]),reanchorToAnchoredMessage:se,scrollToElement:L,scrollToEnd:H,scrollToMessage:K,scrollToStart:A}}function Ze(e,t){return d.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Ar({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=ir,scrollPreviousItemPeek:r=cr,scrollMargin:o=ur}){let l=Tr({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:a,autoScrollRef:i,autoscrollingRef:u,autoscrollingTimeoutRef:h,contentRef:b,defaultScrollPositionAppliedRef:p,firstItemRef:c,itemCountRef:f,lastScrollTopRef:v,messageElementsRef:x,modeRef:_,pendingScrollFrameRef:m,pendingScrollToMessageRef:I,prependRestoreRef:R,preserveScrollOnPrependRef:B,pendingDefaultScrollStore:C,rootRef:T,scrollEdgeThresholdRef:A,scrollMarginRef:H,scrollPreviousItemPeekRef:L,spacerGapRef:se,spacerHeightRef:K,spacerRef:k,stateFrameRef:E,stateStore:M,viewportRef:N,visibilityFrameRef:D,visibilityObserverRef:P,visibilityStore:q,visibleMessageIdsRef:G,handledScrollAnchorsRef:ee}=l,ie=d.useRef(t);ie.current!==t&&(ie.current=t,p.current=!1);let ce=d.useCallback(y=>{let S=T.current,F=N.current,W=[y.start&&"start",y.end&&"end"].filter(Boolean).join(" "),ae=u.current;for(let Y of[S,F])Y&&(W?Y.setAttribute("data-scrollable",W):Y.removeAttribute("data-scrollable"),Y.toggleAttribute("data-autoscrolling",ae))},[]),ue=d.useCallback(y=>{var W;let S=((W=N.current)==null?void 0:W.scrollTop)??0,F=S<v.current-Ae;v.current=S,i.current&&!y.end&&_.current!=="settling-jump"&&_.current!=="anchored-to-message"?_.current="following-bottom":_.current==="following-bottom"&&y.end&&F&&!u.current&&(_.current="free-scrolling")},[]),U=d.useCallback(()=>{let y=pr({content:b.current,scrollEdgeThreshold:A.current,spacer:k.current,viewport:N.current});ue(y);let S=_.current==="following-bottom"?{...y,end:!1}:y;ce(S),M.setSnapshot(S)},[ue,M,ce]),oe=d.useCallback(()=>{E.current===null&&(E.current=window.requestAnimationFrame(()=>{E.current=null,U()}))},[U]),$=d.useCallback(()=>{q.hasListeners()&&D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,q.hasListeners()&&q.setSnapshot(mr({content:b.current,scrollMargin:H.current,scrollPreviousItemPeek:L.current,spacer:k.current,viewport:N.current,visibleMessageIds:G.current}))}))},[q]),{flushPendingScrollToMessage:de,reanchorToAnchoredMessage:we,scrollToElement:he,scrollToEnd:w,scrollToMessage:j,scrollToStart:O}=Er({refs:l,commitScrollState:U,scheduleStateCommit:oe,scheduleVisibilitySync:$}),fe=d.useCallback(()=>{let y=R.current,S=N.current;if(!y||!S||!y.element.isConnected)return!1;let F=Te(y.element,S)-y.viewportTop;return Math.abs(F)<=Ae?!1:(S.scrollTop+=F,y.viewportTop=Te(y.element,S),oe(),$(),!0)},[oe,$]),te=d.useCallback(()=>{let y=b.current,S=N.current;if(!y||!S){R.current=null;return}let F=wr({content:y,spacer:k.current,viewport:S});R.current=F?{element:F,viewportTop:Te(F,S)}:null},[]),Se=d.useCallback(()=>{m.current===null&&(m.current=window.requestAnimationFrame(()=>{m.current=null,de()&&te()}))},[te,de]),J=d.useCallback(()=>{if(!t||p.current||f.current===0)return!1;let y=!1;if(t==="last-anchor"){let S=b.current,F=N.current,W=S&&F?_r(ye(S,k.current)):null;if(!S||!F||!W)y=w({behavior:"auto"});else{let ae=ut(W,F);y=Ve({content:S,spacer:k.current,viewport:F})-ae<=F.clientHeight?w({behavior:"auto"}):he(W,{align:"start"},{keepPreviousPeek:!0})}}else y=t==="end"?w({behavior:"auto"}):O({behavior:"auto"});return y?(Ee(l),!0):!1},[t,he,w,O]),je=d.useCallback(()=>{let y=b.current;if(!y)return;let S=ye(y,k.current),F=f.current,W=c.current;f.current=S.length,c.current=S[0]??null,(()=>{if(de())return;if(F===0){if(J()||S.length>0&&i.current&&w({behavior:"auto"}))return;U(),$();return}let ae=W?S.indexOf(W):-1;if(B.current&&ae>0){fe();return}if(S.length>F){let Y=gr(S,F);if(Y){if(i.current&&_.current==="following-bottom"&&vr(S,F)){w({behavior:"auto"});return}he(Y,{align:"start"},{keepPreviousPeek:!0}),ee.current.add(Y);return}}if(S.length===F){let Y=br(S,ee.current);if(Y){he(Y,{align:"start"},{keepPreviousPeek:!0}),ee.current.add(Y);return}}_.current==="following-bottom"&&i.current?w({behavior:"auto"}):(U(),$())})(),te()},[J,te,U,de,fe,$,he,w]),me=d.useCallback(()=>{if(_.current==="following-bottom"&&i.current){w({behavior:"auto"});return}let y=K.current;if(we()){i.current&&y>0&&K.current===0&&w({behavior:"auto"});return}oe(),$()},[we,oe,$,w]),Q=d.useCallback(()=>{let y=N.current;if(!(!y||!q.hasListeners())){if(typeof IntersectionObserver>"u"){$();return}P.current||(P.current=new IntersectionObserver(S=>{for(let F of S){let W=F.target.dataset.messageId;W&&(F.isIntersecting?G.current.add(W):G.current.delete(W))}$()},{root:y,rootMargin:`${-(H.current+L.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),x.current.forEach(S=>{var F;(F=P.current)==null||F.observe(S)}),$()}},[$,q]),Re=d.useCallback(()=>{var y;D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),(y=P.current)==null||y.disconnect(),P.current=null,G.current.clear(),q.setSnapshot(Me)},[q]),re=d.useCallback((y,S,F)=>{var W,ae,Y;if(S){x.current.set(y,S),(W=P.current)==null||W.observe(S),$(),((ae=I.current)==null?void 0:ae.messageId)===y&&Se();return}F&&x.current.get(y)===F&&(x.current.delete(y),G.current.delete(y),(Y=P.current)==null||Y.unobserve(F),$())},[Se,$]),X=d.useCallback(()=>{(_.current==="following-bottom"||_.current==="anchored-to-message"||_.current==="settling-jump")&&(a.current=null,_.current="free-scrolling")},[]),V=d.useCallback(()=>ce(M.getSnapshot()),[M,ce]),Z=Ze(T,V),le=Ze(N,V),ge=d.useCallback(y=>{b.current=y},[]),Ue=d.useCallback(y=>{k.current=y,se.current=Sr((y==null?void 0:y.parentElement)??null)},[]),Ye=d.useCallback(()=>{U(),$(),te()},[te,U,$]),_t=d.useMemo(()=>({handleContentChange:je,handleResize:me,observeVisibility:Q,pendingDefaultScrollStore:C,preserveScrollOnPrependRef:B,scrollToEnd:w,scrollToMessage:j,scrollToStart:O,setContentElement:ge,setRootElement:Z,setSpacerElement:Ue,setViewportElement:le,stateStore:M,syncAfterScroll:Ye,unobserveVisibility:Re,userScrollIntent:X,viewportRef:N,visibilityStore:q}),[je,me,Q,C,w,j,O,ge,Z,Ue,le,M,Ye,Re,X,q]);return d.useLayoutEffect(()=>{J()||f.current===0&&ft(l)},[J]),d.useEffect(()=>()=>{var y;E.current!==null&&(window.cancelAnimationFrame(E.current),E.current=null),D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),m.current!==null&&(window.cancelAnimationFrame(m.current),m.current=null),(y=P.current)==null||y.disconnect(),P.current=null},[]),d.useLayoutEffect(()=>{if(e&&_.current==="following-bottom"&&f.current>0){w({behavior:"auto"});return}U()},[e,U,w]),{context:_t,registerMessage:re}}function Mr(e){let t=d.useRef(e);return t.current=e,t}var pt=d.createContext(null),mt=d.createContext(null);function Ce(){let e=d.useContext(pt);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ir(){let e=d.useContext(mt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Nr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:a,registerMessage:i}=Ar({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(pt.Provider,{value:a,children:s.jsx(mt.Provider,{value:i,children:t})})}function gt(){let{pendingDefaultScrollStore:e}=Ce();return d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Dr({children:e,...t}){let{setRootElement:n}=Ce(),r=gt();return s.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function Br({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:a=!0,ref:i,role:u,tabIndex:h,...b}){let{handleResize:p,preserveScrollOnPrependRef:c,setViewportElement:f,syncAfterScroll:v,userScrollIntent:x,viewportRef:_}=Ce(),m=gt();c.current=a;let I=d.useCallback(A=>{var H;f(A),(H=ke(i))==null||H(A)},[i,f]);function R(A){v(),r==null||r(A)}function B(A){x(),l==null||l(A)}function C(A){x(),o==null||o(A)}function T(A){hr.has(A.key)&&x(),n==null||n(A)}return d.useEffect(()=>{let A=_.current;if(!A||typeof ResizeObserver>"u")return;let H=0,L=new ResizeObserver(()=>{window.cancelAnimationFrame(H),H=window.requestAnimationFrame(p)});return L.observe(A),()=>{window.cancelAnimationFrame(H),L.disconnect()}},[p,_]),s.jsx("div",{ref:I,role:u??"region","aria-label":e??"Messages",tabIndex:h??0,onKeyDown:T,onScroll:R,onTouchMove:C,onWheel:B,...b,...m?{"data-pending-scroll":""}:null,children:t})}function Pr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:a,handleResize:i,setContentElement:u,setSpacerElement:h}=Ce(),b=d.useRef(null),p=d.useCallback(c=>{var f;b.current=c,u(c),(f=ke(n))==null||f(c)},[n,u]);return d.useLayoutEffect(()=>{let c=b.current;if(!c||(a(),typeof MutationObserver>"u"))return;let f=new MutationObserver(()=>{a()});return f.observe(c,{childList:!0}),()=>f.disconnect()},[a]),d.useEffect(()=>{let c=b.current;if(!c||typeof ResizeObserver>"u")return;let f=0,v=new ResizeObserver(()=>{window.cancelAnimationFrame(f),f=window.requestAnimationFrame(i)});return v.observe(c),()=>{window.cancelAnimationFrame(f),v.disconnect()}},[i]),s.jsxs("div",{ref:p,role:r??"log","aria-relevant":e??"additions",...l,children:[t,s.jsx("div",{ref:h,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Lr({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ir(),l=d.useRef(null),a=d.useCallback(i=>{var h;let u=l.current;l.current=i,e&&o(e,i,u),(h=ke(t))==null||h(i)},[e,t,o]);return s.jsx("div",{ref:a,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Or({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:a="button",...i}){let{scrollToEnd:u,scrollToStart:h,stateStore:b}=Ce(),p=Mr(r),c=d.useCallback(_=>b.subscribe(_),[b]),f=d.useCallback(()=>{let _=b.getSnapshot();return n==="start"?_.start:_.end},[n,b]),v=d.useSyncExternalStore(c,f,f),x=d.useCallback(_=>{var m;v&&((m=p.current)==null||m.call(p,_),_.defaultPrevented||(_.currentTarget.blur(),n==="start"?h({behavior:e}):u({behavior:e})))},[e,n,v,p,u,h]);return sr({defaultTagName:"button",props:qe({type:a,inert:!v,tabIndex:v?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:x},i),render:o,state:{active:v,direction:n},stateAttributesMapping:{active:_=>({"data-active":_?"true":"false"})}})}var ve={Provider:Nr,Root:Dr,Viewport:Br,Content:Pr,Item:Lr,Button:Or};function bt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=bt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function qr(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=bt(e))&&(r&&(r+=" "),r+=t);return r}function _e(...e){return qr(e)}function $r(e){return s.jsx(ve.Provider,{...e})}function zr({className:e,...t}){return s.jsx(ve.Root,{"data-slot":"message-scroller",className:_e("msg-scroller-root",e),...t})}function Hr({className:e,...t}){return s.jsx(ve.Viewport,{"data-slot":"message-scroller-viewport",className:_e("msg-scroller-viewport",e),...t})}function Wr({className:e,...t}){return s.jsx(ve.Content,{"data-slot":"message-scroller-content",className:_e("msg-scroller-content",e),...t})}function et({className:e,scrollAnchor:t=!1,...n}){return s.jsx(ve.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:_e("msg-scroller-item",e),...n})}function Vr({direction:e="end",className:t,children:n,...r}){return s.jsx(ve.Button,{"data-slot":"message-scroller-button",direction:e,className:_e("msg-scroller-btn",t),...r,children:n??s.jsxs(s.Fragment,{children:[s.jsx(Mt,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),s.jsx("span",{className:"sr-only",children:e==="end"?"Jump to latest":"Jump to start"})]})})}const Gr=()=>s.jsxs("div",{className:"chat-empty-row",children:[s.jsx("div",{className:"avatar-circle avatar-circle--mt","aria-hidden":"true",children:s.jsx(at,{size:15})}),s.jsx("div",{className:"chat-empty-bubble",children:s.jsx("p",{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a question below the text box."})})]});function Ur(e){const t=e.trim();if(!/[\u0000-\u001f\u007f]/.test(t)&&/^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))return t}function ne(e){if(!e)return[];const t=/(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+)/g;return e.split(t).map((r,o)=>{if(!r)return null;const l=r.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(l){const a=l[1],i=l[2],u=Ur(i);if(!u)return s.jsx(g.Fragment,{children:a},o);const h=/^https?:\/\//i.test(i);return s.jsx("a",{href:u,target:h?"_blank":void 0,rel:h?"noopener noreferrer":void 0,className:"md-link",children:a},o)}return r.startsWith("**")&&r.endsWith("**")&&r.length>=4?s.jsx("strong",{children:r.slice(2,-2)},o):r.startsWith("*")&&r.endsWith("*")&&r.length>=2?s.jsx("em",{children:r.slice(1,-1)},o):r.startsWith("`")&&r.endsWith("`")&&r.length>=2?s.jsx("code",{className:"md-code",children:r.slice(1,-1)},o):/^https?:\/\//i.test(r)?s.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:r},o):s.jsx(g.Fragment,{children:r},o)})}function Yr(e){const t=e.replace(/\r\n/g,`
|
|
131
|
+
*/const Sa=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
132
|
+
* @license lucide-react v0.468.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const wa=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
137
|
+
* @license lucide-react v0.468.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const ni=ve("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
142
|
+
* @license lucide-react v0.468.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Ca=ve("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/**
|
|
147
|
+
* @license lucide-react v0.468.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Ra=ve("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
|
|
152
|
+
* @license lucide-react v0.468.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const Ta=ve("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
|
|
157
|
+
* @license lucide-react v0.468.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const Oa=ve("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
162
|
+
* @license lucide-react v0.468.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const Pa=ve("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
|
167
|
+
* @license lucide-react v0.468.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const Ia=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
172
|
+
* @license lucide-react v0.468.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const _a=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Jr({align:e="start",className:t,...n}){return h.jsx("div",{...n,"data-slot":"message","data-align":e,className:ue("chat-message",t)})}function ri({className:e,...t}){return h.jsx("div",{...t,"data-slot":"message-avatar",className:ue("chat-message-avatar",e)})}function Zr({className:e,...t}){return h.jsx("div",{...t,"data-slot":"message-content",className:ue("chat-message-content",e)})}function ka({className:e,...t}){return h.jsx("div",{...t,"data-slot":"message-header",className:ue("chat-message-header",e)})}function Cr({className:e,...t}){return h.jsx("div",{...t,"data-slot":"message-footer",className:ue("chat-message-footer",e)})}const tt={...v},Ko={};function Ye(e,t){const n=v.useRef(Ko);return n.current===Ko&&(n.current=e(t)),n}const ur=tt.useInsertionEffect,Aa=ur&&ur!==tt.useLayoutEffect?ur:e=>e();function fe(e){const t=Ye(Na).current;return t.next=e,Aa(t.effect),t.trampoline}function Na(){const e={next:void 0,callback:ja,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function ja(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}function Rr(e,t,n,r){const o=Ye(oi).current;return Da(o,e,t,n,r)&&si(o,[e,t,n,r]),o.callback}function Ma(e){const t=Ye(oi).current;return Fa(t,e)&&si(t,e),t.callback}function oi(){return{callback:null,cleanup:null,refs:[]}}function Da(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Fa(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function si(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const La=parseInt(v.version,10);function ii(e){return La>=e}function Yo(e){if(!v.isValidElement(e))return null;const t=e,n=t.props;return(ii(19)?n==null?void 0:n.ref:t.ref)??null}function Tr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let Or;process.env.NODE_ENV!=="production"&&(Or=new Set);function ci(e,t){return function(...r){if(process.env.NODE_ENV!=="production"){const o=r.join(" "),s=`${t}: ${o}`,i=`${e}:${s}`;Or.has(i)||(Or.add(i),e==="warn"?console.warn(s):console.error(s))}}}const Qr=ci("warn","Base UI");function eo(){}const Ba=Object.freeze([]),Fe=Object.freeze({});function Va(e,t){const n={};for(const r in e){const o=e[r];if(t!=null&&t.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function $a(e,t){return typeof e=="function"?e(t):e}function ai(e,t){return typeof e=="function"?e(t):e}const li={};function to(e,t,n,r,o){if(!n&&!r&&!e)return kn(t);let s=kn(e);return t&&(s=Tn(s,t)),n&&(s=Tn(s,n)),r&&(s=Tn(s,r)),s}function Ha(e){if(e.length===0)return li;if(e.length===1)return kn(e[0]);let t=kn(e[0]);for(let n=1;n<e.length;n+=1)t=Tn(t,e[n]);return t}function kn(e){return fi(e)?{...e(li)}:Ua(e)}function Tn(e,t){return fi(t)?t(e):za(e,t)}function Ua(e){const t={...e};for(const n in t){const r=t[n];ui(n,r)&&(t[n]=di(r))}return t}function za(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Tr(e.style,r);break}case"className":{e[n]=pi(e.className,r);break}default:ui(n,r)?e[n]=Wa(e[n],r):e[n]=r}}return e}function ui(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function fi(e){return typeof e=="function"}function Wa(e,t){return t?e?(...n)=>{const r=n[0];if(hi(r)){const s=r;An(s);const i=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),i}const o=t(...n);return e==null||e(...n),o}:di(t):e}function di(e){return e&&((...t)=>{const n=t[0];return hi(n)&&An(n),e(...t)})}function An(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function pi(e,t){return t?e?t+" "+e:t:e}function hi(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function pt(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Ja(r));const o=qa(t,n,r);if(n.enabled===!1)return null;const s=n.state??Fe;return Za(e,r,o,s)}function qa(e,t,n){const{className:r,style:o}=e,{state:s=Fe,ref:i,props:c,stateAttributesMapping:a,enabled:l=!0}=t,f=l?$a(r,s):void 0,u=l?ai(o,s):void 0,d=l?Va(s,a):Fe,g=l&&c?Ga(c):void 0,p=l?Tr(d,g)??{}:Fe;return typeof document<"u"&&(l?Array.isArray(i)?p.ref=Ma([p.ref,Yo(n),...i]):p.ref=Rr(p.ref,Yo(n),i):Rr(null,null)),l?(f!==void 0&&(p.className=pi(p.className,f)),u!==void 0&&(p.style=Tr(p.style,u)),p):Fe}function Ga(e){return Array.isArray(e)?Ha(e):to(void 0,e)}const Ka=Symbol.for("react.lazy"),Ya=/^[A-Z][A-Za-z0-9$]*$/,Xa=/[a-z]/;function Ja(e){if((e==null?void 0:e.$$typeof)!==Ka)return e;const t=v.Children.toArray(e)[0];return v.isValidElement(t)?t:e}function Za(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&Qa(t),t(n,r);const o=to(n,t.props);if(o.ref=n.ref,process.env.NODE_ENV!=="production"&&!v.isValidElement(t))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
|
|
177
|
+
`));return v.cloneElement(t,o)}return el(e,n)}function Qa(e){const t=e.name;t.length!==0&&Ya.test(t)&&Xa.test(t)&&Qr(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function el(e,t){return e==="button"?I.createElement("button",{type:"button",...t,key:t.key}):e==="img"?I.createElement("img",{alt:"",...t,key:t.key}):v.createElement(e,t)}const Nn=ci("error","Base UI");function tl({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=v.useRef(e!==void 0),[s,i]=v.useState(()=>t),c=o&&e!==void 0?e:s;if(process.env.NODE_ENV!=="production"){v.useEffect(()=>{o!==(e!==void 0)&&Nn([`A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
178
|
+
`))},[r,n,e]);const{current:l}=v.useRef(t);v.useEffect(()=>{!o&&Xo(l)!==Xo(t)&&Nn([`A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
179
|
+
`))},[t])}const a=v.useCallback(l=>{o||i(l)},[]);return[c,a]}function Xo(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const c=n.get(i);if(c!==void 0)return`__object__:${c}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}function gi(){const[,e]=v.useState({});return v.useCallback(()=>{e({})},[])}let Jo=0;function nl(e,t="mui"){const n=v.useRef(void 0),r=gi(),o=e??n.current;return v.useEffect(()=>{n.current==null&&(Jo+=1,n.current=`${t}-${Jo}`,e==null&&r())},[e,t,r]),o}const Zo=tt.useId;function Gn(e,t){if(Zo!==void 0){const n=Zo();return e??(t?`${t}-${n}`:n)}return nl(e,t)}function mi(e){return Gn(e,"base-ui")}function Oe(e,t,n,r){let o=!1,s=!1;const i=Fe;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}const bi="none",Kn="trigger-press",We="trigger-hover",On="trigger-focus",rl="outside-press",ol="focus-out",no="escape-key",Pr="imperative-action",sl=()=>{},pe=typeof document<"u"?v.useLayoutEffect:sl;function ro(e){v.useEffect(e,Ba)}const pn=null;let Qo=globalThis.requestAnimationFrame;class il{constructor(){ae(this,"callbacks",[]);ae(this,"callbacksCount",0);ae(this,"nextId",1);ae(this,"startId",1);ae(this,"isScheduled",!1);ae(this,"tick",t=>{var o;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)(o=n[s])==null||o.call(n,t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&Qo!==requestAnimationFrame&&(Qo=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let hn=new il;class Ne{constructor(){ae(this,"currentId",pn);ae(this,"cancel",()=>{this.currentId!==pn&&(hn.cancel(this.currentId),this.currentId=pn)});ae(this,"disposeEffect",()=>this.cancel)}static create(){return new Ne}static request(t){return hn.request(t)}static cancel(t){return hn.cancel(t)}request(t){this.cancel(),this.currentId=hn.request(()=>{this.currentId=pn,t()})}}function cl(){const e=Ye(Ne.create).current;return ro(e.disposeEffect),e}function yi(e,t=!1,n=!1,r=!1){const[o,s]=v.useState(e&&t?"idle":void 0),[i,c]=v.useState(e&&!r);return e&&!i&&(c(!0),s("starting")),!e&&i&&o!=="ending"&&!n&&s("ending"),!e&&!i&&o==="ending"&&s(void 0),pe(()=>{if(!e&&i&&o!=="ending"&&n){const a=Ne.request(()=>{s("ending")});return()=>{Ne.cancel(a)}}},[e,i,o,n]),pe(()=>{if(!e||t||o===void 0)return;const a=Ne.request(()=>{s(void 0)});return()=>{Ne.cancel(a)}},[t,e,o]),pe(()=>{if(!e||!t)return;e&&i&&o!=="idle"&&s("starting");const a=Ne.request(()=>{s("idle")});return()=>{Ne.cancel(a)}},[t,e,i,o]),{mounted:i,setMounted:c,transitionStatus:o}}function al(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=tl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=yi(s,!0,!0),f=mi(),[u,d]=v.useState(),g=u===null?void 0:u??f,p=fe(m=>{const b=!s,y=Oe(Kn,m.nativeEvent);r(b,y),!y.isCanceled&&i(b)});return v.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:p,mounted:c,open:s,panelId:g,setMounted:a,setOpen:i,setPanelIdState:d,transitionStatus:l}),[f,o,p,c,s,g,a,i,d,l])}function ll(e,t){return function(r,...o){const s=new URL(e);return s.searchParams.set("code",r.toString()),o.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${r}; visit ${s} for the full message.`}}const wt=ll("https://base-ui.com/production-error","Base UI"),oo=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(oo.displayName="CollapsibleRootContext");function vi(){const e=v.useContext(oo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":wt(15));return e}const so="data-starting-style",ul="data-ending-style",fl={[so]:""},dl={[ul]:""},io={transitionStatus(e){return e==="starting"?fl:e==="ending"?dl:null}},pl="data-open",hl="data-closed",gn=so,gl="data-panel-open",ml={[pl]:""},bl={[hl]:""},yl={open(e){return e?{[gl]:""}:null}},vl={open(e){return e?ml:bl}},xi={...vl,...io},Ei=v.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:i=!1,onOpenChange:c,open:a,style:l,...f}=t,u=fe(c),d=al({open:a,defaultOpen:s,onOpenChange:u,disabled:i}),g=v.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=v.useMemo(()=>({...d,onOpenChange:u,state:g}),[d,u,g]),m=pt("div",t,{state:g,ref:n,props:f,stateAttributesMapping:xi});return h.jsx(oo.Provider,{value:p,children:m})});process.env.NODE_ENV!=="production"&&(Ei.displayName="CollapsibleRoot");function Yn(){return typeof window<"u"}function Le(e){return co(e)?(e.nodeName||"").toLowerCase():"#document"}function Ie(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ot(e){var t;return(t=(co(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function co(e){return Yn()?e instanceof Node||e instanceof Ie(e).Node:!1}function me(e){return Yn()?e instanceof Element||e instanceof Ie(e).Element:!1}function _e(e){return Yn()?e instanceof HTMLElement||e instanceof Ie(e).HTMLElement:!1}function At(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ie(e).ShadowRoot}function Xn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function xl(e){return/^(table|td|th)$/.test(Le(e))}function Jn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const El=/transform|translate|scale|rotate|perspective|filter/,Sl=/paint|layout|strict|content/,mt=e=>!!e&&e!=="none";let fr;function ao(e){const t=me(e)?$e(e):e;return mt(t.transform)||mt(t.translate)||mt(t.scale)||mt(t.rotate)||mt(t.perspective)||!lo()&&(mt(t.backdropFilter)||mt(t.filter))||El.test(t.willChange||"")||Sl.test(t.contain||"")}function wl(e){let t=lt(e);for(;_e(t)&&!ct(t);){if(ao(t))return t;if(Jn(t))return null;t=lt(t)}return null}function lo(){return fr==null&&(fr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fr}function ct(e){return/^(html|body|#document)$/.test(Le(e))}function $e(e){return Ie(e).getComputedStyle(e)}function Zn(e){return me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(Le(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||ot(e);return At(t)?t.host:t}function Si(e){const t=lt(e);return ct(t)?(e.ownerDocument||e).body:_e(t)&&Xn(t)?t:Si(t)}function Gt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Si(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ie(o);if(s){const c=Ir(i);return t.concat(i,i.visualViewport||[],Xn(o)?o:[],c&&n?Gt(c):[])}else return t.concat(o,Gt(o,[],n))}function Ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const wi=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(wi.displayName="CompositeRootContext");function Cl(e=!1){const t=v.useContext(wi);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":wt(16));return t}function Rl(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,c=r&&t===!1;return{props:v.useMemo(()=>{const l={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return r||(l.tabIndex=o,!s&&n&&(l.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||c)&&(l.disabled=n),l},[r,n,t,i,c,s,o])}}function Ke(e){return(e==null?void 0:e.ownerDocument)||document}function dr(e,t,{detail:n=0,pointerType:r=""}={}){e.dispatchEvent(new(Ie(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Ci(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=v.useRef(null),c=Cl(!0),a=s??c!==void 0,{props:l}=Rl({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&v.useEffect(()=>{var p,m;if(!i.current)return;const g=mn(i.current);if(o){if(!g){const b=((p=tt.captureOwnerStack)==null?void 0:p.call(tt))||"";Nn(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${b}`)}}else if(g){const b=((m=tt.captureOwnerStack)==null?void 0:m.call(tt))||"";Nn(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${b}`)}},[o]);const f=v.useCallback(()=>{const g=i.current;mn(g)&&a&&t&&l.disabled===void 0&&g.disabled&&(g.disabled=!1)},[t,l.disabled,a]);pe(f,[f]);const u=v.useCallback((g={})=>{const{onClick:p,onMouseDown:m,onKeyUp:b,onKeyDown:y,onPointerDown:x,...S}=g;return to({onClick(E){if(t){E.preventDefault();return}p==null||p(E)},onMouseDown(E){t||m==null||m(E)},onKeyDown(E){if(t||(An(E),y==null||y(E),E.baseUIHandlerPrevented))return;const C=E.target===E.currentTarget,w=E.currentTarget,R=mn(w),O=!o&&Tl(w),P=C&&(o?R:!O),M=E.key==="Enter",F=E.key===" ",A=w.getAttribute("role"),D=(A==null?void 0:A.startsWith("menuitem"))||A==="option"||A==="gridcell";if(C&&a&&F){if(E.defaultPrevented&&D)return;E.preventDefault(),(!o||R)&&(E.preventBaseUIHandler(),dr(w,E));return}if(!P||o||!F&&!M){C&&O&&F&&E.preventDefault();return}E.defaultPrevented||(E.preventDefault(),M&&(E.preventBaseUIHandler(),dr(w,E)))},onKeyUp(E){if(!t){if(An(E),b==null||b(E),E.target===E.currentTarget&&o&&a&&mn(E.currentTarget)&&E.key===" "){E.preventDefault();return}E.baseUIHandlerPrevented||E.target===E.currentTarget&&!o&&!a&&!E.defaultPrevented&&E.key===" "&&(E.preventBaseUIHandler(),dr(E.currentTarget,E))}},onPointerDown(E){if(t){E.preventDefault();return}x==null||x(E)}},o?{type:"button"}:{role:"button"},l,S)},[t,l,a,o]),d=fe(g=>{i.current=g,f()});return{getButtonProps:u,buttonRef:d}}function mn(e){return _e(e)&&e.tagName==="BUTTON"}function Tl(e){return _e(e)&&e.tagName==="A"&&!!e.href}const Ol={...yl,...io},Ri=v.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=vi(),{className:a,disabled:l=c,render:f,nativeButton:u=!0,style:d,...g}=t,{getButtonProps:p,buttonRef:m}=Ci({disabled:l,native:u});return pt("button",t,{state:i,ref:[n,m],props:[{"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s},g,p],stateAttributesMapping:Ol})});process.env.NODE_ENV!=="production"&&(Ri.displayName="CollapsibleTrigger");function Ee(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const Ht=0;class ut{constructor(){ae(this,"currentId",Ht);ae(this,"clear",()=>{this.currentId!==Ht&&(clearTimeout(this.currentId),this.currentId=Ht)});ae(this,"disposeEffect",()=>this.clear)}static create(){return new ut}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ht,n()},t)}isStarted(){return this.currentId!==Ht}}function zt(){const e=Ye(ut.create).current;return ro(e.disposeEffect),e}function qe(e){const t=Ye(Pl,e).current;return t.next=e,pe(t.effect),t}function Pl(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Il(e){return e==null?e:"current"in e?e.current:e}function es(e,t){return e.getAnimations(t).filter(n=>{var o;const r=(o=n.effect)==null?void 0:o.getTiming();return(r==null?void 0:r.duration)!==1/0&&(r==null?void 0:r.iterations)!==1/0})}let bn=null;function _l(e){if(!bn){const t=[];bn=t,queueMicrotask(()=>{bn=null,dt.flushSync(()=>{for(const n of t)n()})})}bn.push(e)}function Ti(e,t=!1,n=!1){const r=cl();return fe((o,s=null)=>{r.cancel();const i=Il(e);if(i==null)return;const c=i,a=()=>{if(!n){dt.flushSync(o);return}_l(()=>{s!=null&&s.aborted||o()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(es(c).map(f=>f.finished.then(eo))).then(()=>{s!=null&&s.aborted||a()},()=>{if(s!=null&&s.aborted)return;if(es(c).some(u=>u.pending||u.playState!=="finished")){l();return}a()})}if(t){const f=so;if(!c.hasAttribute(f)){r.request(l);return}const u=new MutationObserver(()=>{c.hasAttribute(f)||(u.disconnect(),l())});u.observe(c,{attributes:!0,attributeFilter:[f]}),s==null||s.addEventListener("abort",()=>u.disconnect(),{once:!0});return}r.request(l)})}function uo(e){const{enabled:t=!0,open:n,ref:r,batch:o=!1,onComplete:s}=e,i=fe(s),c=Ti(r,n,o);v.useEffect(()=>{if(!t)return;const a=new AbortController;return c(i,a.signal),()=>{a.abort()}},[t,n,i,c])}const Pt={height:void 0,width:void 0};function kl(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:c,setMounted:a,setOpen:l,transitionStatus:f}=e,u=v.useRef(null),d=v.useRef(null),[g,p]=v.useState(Pt),m=v.useRef(Pt),b=v.useRef(!1),y=v.useRef(c),x=v.useRef(!1),[S,E]=v.useState(!1),C=v.useRef(null),w=Rr(t,u),R=qe(c),O=Ti(u),P=!c&&!s,M=S?"idle":f,F=c&&(y.current||x.current),A=!c&&s&&d.current==="css-animation"&&g.height===void 0&&g.width===void 0?m.current:g,D=n&&P&&d.current!=="css-animation",_=fe((N,Y=!0)=>{Y&&(m.current=N),p(N)}),T=fe(()=>{var N;(N=C.current)==null||N.call(C),C.current=null}),k=fe(N=>{T(),C.current=()=>{C.current=null,N()}}),U=fe(()=>{c&&s&&d.current==="css-animation"&&(x.current=!0)});pe(()=>{!S||f==="starting"||E(!1)},[S,f]),v.useEffect(()=>()=>{U(),T()},[U,T]),pe(()=>{c||(y.current=!1,x.current=!1);const N=u.current;if(!N)return;!c&&C.current&&T();const Y=Al(N,F);if(d.current=Y,c&&f==="idle"&&y.current&&Y==="css-animation"){m.current=It(N);return}if(c&&f==="starting"){const ie=b.current;if(b.current=!1,Y==="none"){_(It(N)),E(!0);return}if(Y==="css-transition"){const B=Nl(N);if(_(It(N)),!ie)return B;const $=yn(N,"transition-duration","0s");return k($),E(!0),B}_(It(N));const L=yn(N,"animation-name","none");if(!ie){L();return}const X=yn(N,"animation-duration","0s");L(),k(X),E(!0);return}if(!c&&s&&(f==="idle"||f==="starting")){if(Y==="none"){_(Pt,!1),a(!1);return}_(It(N));return}if(f!=="ending")return;if(Y==="none"){a(!1);return}const K=It(N);if(!(K.height>0||K.width>0)){a(!1);return}_(K),Y==="css-animation"&&yn(N,"animation-name","none")()},[s,c,T,_,a,k,F,f]),uo({enabled:c&&s&&M==="idle",open:!0,ref:u,onComplete(){c&&_(Pt,!1)}}),v.useEffect(()=>{if(c||!s||M!=="ending")return;if(!u.current){a(!1),_(Pt,!1);return}const Y=new AbortController;let K=-1;function le(){R.current||(a(!1),_(Pt,!1))}return K=Ne.request(()=>{O(le,Y.signal)}),()=>{Ne.cancel(K),Y.abort()}},[R,s,c,M,O,_,a]),pe(()=>{const N=u.current;!N||!n||!P||N.setAttribute("hidden","until-found")},[P,n]),v.useEffect(function(){const Y=u.current;if(!Y)return;const K=ut.create();let le=-1;const ie=(B,$)=>{K.start(0,()=>{R.current||(le=Ne.request(()=>{R.current||(B&&(b.current=!1),$&&Y.setAttribute(gn,""),Y.setAttribute("hidden","until-found"))}))})},X=Ee(Y,"beforematch",B=>{const $=Oe(bi,B);if(i(!0,$),$.isCanceled){ie(!1,!1);return}b.current=!0;const Q=Y.hasAttribute(gn);Y.removeAttribute(gn),l(!0),ie(!0,Q)});return()=>{K.clear(),Ne.cancel(le),X()}},[R,i,l]);const j=o||n||s||c;return{height:A.height,props:{...D?{[gn]:""}:void 0,hidden:P,id:r},ref:w,shouldPreventOpenAnimation:F,shouldRender:j,transitionStatus:M,width:A.width}}function It(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Al(e,t){const n=Ie(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&ts(n.animationDuration),o=ts(n.transitionDuration);return r&&o?(process.env.NODE_ENV!=="production"&&Qr("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."),"css-transition"):o?"css-transition":r?"css-animation":"none"}function ts(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function yn(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Nl(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=Ne.request(n);return()=>{Ne.cancel(r),n()}}const jl="--collapsible-panel-height",Ml="--collapsible-panel-width",Oi=v.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:c,style:a,...l}=t;process.env.NODE_ENV!=="production"&&v.useEffect(()=>{o&&s===!1&&Qr("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.")},[o,s]);const{defaultPanelId:f,mounted:u,onOpenChange:d,open:g,setMounted:p,setPanelIdState:m,setOpen:b,state:y,transitionStatus:x}=vi(),S=o??!1,E=s??!1,C=c||void 0,w=C??f;pe(()=>(m(U=>C??(U===null?void 0:U)),()=>{m(U=>U===C?null:U)}),[C,m]);const{height:R,props:O,ref:P,shouldPreventOpenAnimation:M,shouldRender:F,transitionStatus:A,width:D}=kl({externalRef:n,hiddenUntilFound:S,id:w,keepMounted:E,mounted:u,onOpenChange:d,open:g,setMounted:p,setOpen:b,transitionStatus:x}),_={...y,transitionStatus:A},T=ai(a,_),k=pt("div",{...t,style:void 0},{state:_,ref:P,props:[O,{style:{[jl]:R===void 0?"auto":`${R}px`,[Ml]:D===void 0?"auto":`${D}px`}},l,T?{style:T}:void 0,M?{style:{animationName:"none"}}:void 0],stateAttributesMapping:xi});return F?k:null});process.env.NODE_ENV!=="production"&&(Oi.displayName="CollapsiblePanel");function bt({className:e,...t}){return h.jsx("div",{"data-slot":"trace",className:ue("trace",e),...t})}function Nt({className:e,status:t,...n}){return h.jsx("span",{"data-slot":"trace-line","data-status":t,className:ue("trace-line",e),...n})}function xt({className:e,...t}){return h.jsx("span",{"data-slot":"trace-icon",className:ue("trace-icon",e),...t,"aria-hidden":"true"})}function jt({className:e,...t}){return h.jsx("span",{"data-slot":"trace-title",className:ue("trace-title",e),...t})}function Kt({className:e,...t}){return h.jsx("span",{"data-slot":"trace-description",className:ue("trace-description",e),...t})}function Pi(e){return h.jsx(Ei,{"data-slot":"trace-collapsible",...e})}function Ii({children:e,className:t,...n}){return h.jsxs(Ri,{type:"button","data-slot":"trace-collapsible-trigger",className:ue("trace-trigger",t),...n,children:[e,h.jsx(xt,{className:"trace-chevron",children:h.jsx(Js,{size:13})})]})}function _i({className:e,...t}){return h.jsx(Oi,{...t,"data-slot":"trace-collapsible-content",className:ue("trace-content",e)})}const Dl=({message:e,onRetry:t})=>h.jsx(Jr,{className:"chat-error-banner",role:"alert",children:h.jsxs(Zr,{children:[h.jsx(bt,{className:"chat-message-body",children:h.jsxs(Nt,{status:"error",children:[h.jsx(xt,{children:h.jsx(ga,{size:14})}),h.jsx(jt,{className:"chat-error-title",children:e})]})}),t&&h.jsx(Cr,{children:h.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Fl={alpha:{label:"Alpha",Icon:ya,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:Ca,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:xa,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:ma,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Ll=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Fl[e];return h.jsxs("span",{className:`env-badge-inline ${s} ${n}`.trim(),title:i,"aria-label":`${r} build`,role:"status",children:[h.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),h.jsx("span",{className:"env-badge-inline-label",children:r})]})},Bl=e=>h.jsx("svg",{width:e.width||"24px",height:e.height||"24px",viewBox:"0 0 24 24",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:e.Color||"currentColor",...e,children:h.jsx("path",{d:"M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z"})}),Vl=({title:e="VPS AI Assistant",subtitle:t="Customer portal support",onClose:n,onReset:r,onBack:o,soundEnabled:s,onToggleSound:i,showMinimize:c=!1,envStage:a,envPulse:l=!0})=>h.jsxs("header",{className:"chat-header",children:[h.jsxs("div",{className:"chat-header-left",children:[o&&h.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:h.jsx(fa,{size:16})}),h.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:h.jsx(Bl,{width:"16px",height:"16px",color:"white"})}),h.jsxs("div",{children:[h.jsxs("div",{className:"chat-header-title-row",children:[h.jsx("h2",{className:"chat-header-title",children:e}),h.jsx(Ll,{stage:a,pulse:l})]}),h.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),h.jsxs("div",{className:"chat-header-actions",children:[i&&h.jsx("button",{type:"button",className:"icon-btn-action chat-sound-btn","aria-label":"Response sound","aria-pressed":!!s,title:s?"Mute response sound":"Enable response sound",onClick:i,children:s?h.jsx(Oa,{size:16,"aria-hidden":"true"}):h.jsx(Pa,{size:16,"aria-hidden":"true"})}),r&&h.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:h.jsx(wa,{size:15})}),n&&h.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:h.jsx(Ea,{size:16})})]})]});function $l(e,t){const n=I.useRef(e);I.useEffect(()=>{var r;n.current&&!e&&((r=t.current)==null||r.focus()),n.current=e},[e,t])}function Hl({className:e,...t}){return h.jsx("div",{...t,"data-slot":"input-group",className:ue("chat-input-group",e)})}function Ul({className:e,...t}){return h.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:ue("chat-textarea",e)})}function zl({className:e,...t}){return h.jsx("div",{...t,"data-slot":"input-group-addon",className:ue("chat-input-actions",e)})}function ns({className:e,...t}){return h.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:ue("chat-send-btn",e)})}const ki=v.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:c=!0,style:a,...l}=t,{getButtonProps:f,buttonRef:u}=Ci({disabled:s,focusableWhenDisabled:i,native:c});return pt("button",t,{state:{disabled:s},ref:[n,u],props:[l,f]})});process.env.NODE_ENV!=="production"&&(ki.displayName="Button");const rs=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,os=qs,Wl=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return os(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(l=>{const f=n==null?void 0:n[l],u=s==null?void 0:s[l];if(f===null)return null;const d=rs(f)||rs(u);return o[l][d]}),c=n&&Object.entries(n).reduce((l,f)=>{let[u,d]=f;return d===void 0||(l[u]=d),l},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,f)=>{let{class:u,className:d,...g}=f;return Object.entries(g).every(p=>{let[m,b]=p;return Array.isArray(b)?b.includes({...s,...c}[m]):{...s,...c}[m]===b})?[...l,u,d]:l},[]);return os(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},ql=Wl("vps-ui-button",{variants:{variant:{default:"vps-ui-button--default",outline:"vps-ui-button--outline",secondary:"vps-ui-button--secondary",ghost:"vps-ui-button--ghost",destructive:"vps-ui-button--destructive",link:"vps-ui-button--link"},size:{default:"vps-ui-button--size-default",xs:"vps-ui-button--size-xs",sm:"vps-ui-button--size-sm",lg:"vps-ui-button--size-lg",icon:"vps-ui-button--size-icon","icon-xs":"vps-ui-button--size-icon-xs","icon-sm":"vps-ui-button--size-icon-sm","icon-lg":"vps-ui-button--size-icon-lg"}},defaultVariants:{variant:"default",size:"default"}});function fo({className:e,variant:t,size:n,...r}){return h.jsx(ki,{type:"button","data-slot":"button",...r,className:o=>ue(ql({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Gl({className:e,...t}){return h.jsx("div",{...t,className:ue("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Kl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return h.jsx(fo,{...i,variant:o,size:s,className:c=>ue("shrink-0",typeof r=="function"?r(c):r),onClick:()=>t==null?void 0:t(e),children:n??e})}function Yl(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const Xl=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?h.jsx(Gl,{className:r==="badge"?"chat-suggestion-strip":"suggestions-list",role:"list","aria-label":"Suggested questions",children:e.map(o=>h.jsx("div",{role:"listitem",children:h.jsx(Kl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,Jl=({onSend:e,onStop:t,disabled:n=!1,placeholder:r="Ask something…",ref:o})=>{const{suggestions:s,showSuggestions:i,suggestionBadgesEnabled:c,models:a,selectedModelId:l,selectModel:f}=en(),[u,d]=I.useState(""),g=I.useRef(null),p=I.useId(),m=I.useId(),b=E=>{E&&(E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,96)}px`)};$l(n,g),I.useImperativeHandle(o,()=>({edit(E){var C;n||(d(E),(C=g.current)==null||C.focus())}}),[n]),I.useEffect(()=>{b(g.current)},[u]);const y=I.useMemo(()=>{if(!c||n)return[];const E=u.trim();return E?Yl(s,E):i?s:[]},[n,i,c,s,u]),x=E=>{d(E.query);const C=g.current;C==null||C.focus()},S=()=>{const E=u.trim();!E||n||(e(E),d(""))};return h.jsxs("div",{className:"chat-input-wrapper",children:[h.jsx(Xl,{variant:"badge",suggestions:y,onSelect:x,disabled:n}),h.jsxs("form",{onSubmit:E=>{E.preventDefault(),S()},children:[h.jsx("label",{htmlFor:p,className:"sr-only",children:"Chat message"}),h.jsxs(Hl,{children:[h.jsx(Ul,{id:p,ref:g,rows:1,value:u,disabled:n,placeholder:r,onChange:E=>d(E.target.value),onKeyDown:E=>{var C;E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),(C=E.currentTarget.form)==null||C.requestSubmit())}}),h.jsxs(zl,{children:[a.length>1&&h.jsxs("div",{className:"chat-model-picker",children:[h.jsx("label",{htmlFor:m,className:"sr-only",children:"AI model"}),h.jsxs("select",{id:m,value:l,disabled:n,onChange:E=>f(E.target.value),children:[h.jsx("option",{value:"auto",children:"Automatic"}),a.map(E=>h.jsx("option",{value:E.id,disabled:!E.configured,children:E.label},E.id))]})]}),t?h.jsx(ns,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:h.jsx(ni,{size:13,fill:"currentColor","aria-hidden":"true"})}):h.jsx(ns,{type:"submit",disabled:n||!u.trim(),"aria-label":"Send message",title:"Send message",children:h.jsx(da,{size:16,"aria-hidden":"true"})})]})]})]}),h.jsxs("p",{className:"chat-input-footer",children:[h.jsx("span",{className:"chat-input-note",children:"AI can make mistakes."}),"Powered by ",h.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function Zl({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(Ql(r,o),t);if(!n)return v.createElement(e,s);if(typeof n=="function")return n(s,r);if(!v.isValidElement(n))return null;let i=n.props,c={..._r(s,i),ref:tn(s.ref,i.ref)};return v.cloneElement(n,c)}function _r(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let s=r[o];if(s===void 0)continue;let i=t[o];o==="className"?t[o]=[i,s].filter(Boolean).join(" "):o==="style"?t[o]={...i,...s}:o==="ref"?t[o]=tn(i,s):tu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=eu(s,i):t[o]=s}}return t}function Ql(e,t){var r;let n={};for(let o of Object.keys(e)){let s=e[o],i=(r=t==null?void 0:t[o])==null?void 0:r.call(t,s);if(i){Object.assign(n,i);continue}if(o==="slot"){n["data-slot"]=s;continue}let c=`data-${String(o).replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;typeof s=="boolean"?n[c]=s?"":void 0:s!=null&&(n[c]=String(s))}return n}function eu(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function tu(e){return/^on[A-Z]/.test(e)}function tn(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var nu=8,ru=64,ou=0,jn=.5,su=180,iu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),Ai={start:!1,end:!1},cu=[],Mn={currentAnchorId:null,visibleMessageIds:cu};function au({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ai;let o=po({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function lu({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:s}){if(!e||!o)return Mn;let i=o.getBoundingClientRect(),c=i.top+t+n,a=typeof IntersectionObserver>"u",l=[],f=null;for(let u of Yt(e,r)){let d=u.dataset.messageId;if(!d)continue;let g=u.dataset.scrollAnchor==="true",p=g||a?u.getBoundingClientRect():null;(a&&p?p.bottom>c&&p.top<i.bottom:s.has(d))&&l.push(d),g&&p&&p.top<=c+jn&&(f=d)}return l.length===0&&f===null?Mn:{currentAnchorId:f,visibleMessageIds:l}}function Yt(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function uu(e,t){for(let n=t;n<e.length;n++){let r=e[n];if((r==null?void 0:r.dataset.scrollAnchor)==="true")return r}return null}function fu(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function du(e,t){var r;let n=0;for(let o=t;o<e.length;o++)if(((r=e[o])==null?void 0:r.dataset.scrollAnchor)==="true"&&(n+=1,n>1))return!0;return!1}function pu(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if((n==null?void 0:n.dataset.scrollAnchor)==="true")return n}return null}function hu({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of Yt(e,t)){if(!o.dataset.messageId)continue;let s=o.getBoundingClientRect();if(s.bottom>r.top&&s.top<r.bottom)return o}return null}function gu({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let s=Ni(t,o),i=t.getBoundingClientRect().height,c=yu(r);if(e==="center"){let a=Math.max(0,o.clientHeight-c.start-c.end);return s-c.start-(a-i)/2-n}if(e==="end")return s-o.clientHeight+i+c.end+n;if(e==="nearest"){let a=s+i,l=o.scrollTop+c.start,f=o.scrollTop+o.clientHeight-c.end;return s>=l&&a<=f?o.scrollTop:s<l?s-c.start-n:a-o.clientHeight+c.end+n}return s-c.start-n}function Ni(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Pn(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function mu({content:e,scrollTop:t,spacer:n,viewport:r}){let o=po({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function po({content:e,spacer:t,viewport:n}){let r=Yt(e,t),o=ji(e),s=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let a of r){let l=a.getBoundingClientRect();c=Math.max(c,l.bottom-s.top+i+o.end)}return c}function bu(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function ji(e){let t=window.getComputedStyle(e);return{end:kr(t.paddingBlockEnd||t.paddingBottom),start:kr(t.paddingBlockStart||t.paddingTop)}}function yu(e){let t=e==null?void 0:e.parentElement;return t?ji(t):{end:0,start:0}}function vu(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return kr(n)}function kr(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Mi(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(s=>s()))},subscribe:(o,s,i)=>{let c=r.size===0;return r.add(o),c&&(s==null||s()),()=>{r.delete(o),r.size===0&&(i==null||i())}}}}function ss(e,t){return Mi(e,t)}function xu(){return Mi(Mn,Su)}function Eu(e,t){return e.start===t.start&&e.end===t.end}function Su(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function wu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:o}){let s=v.useRef(e),i=v.useRef(!1),c=v.useRef(null),a=v.useRef(!1),l=v.useRef(n),f=v.useRef(0),u=v.useRef(null),d=v.useRef(0),g=v.useRef(e?"following-bottom":"free-scrolling"),p=v.useRef(new Map),m=v.useRef(null),b=v.useRef(null),y=v.useRef(null),x=v.useRef(o),S=v.useRef(!0),E=v.useRef(null),C=v.useRef(r),w=v.useRef(null),R=v.useRef(0),O=v.useRef(0),P=v.useRef(null),M=v.useRef(null),F=v.useRef(null),A=v.useRef(null),D=v.useRef(null),_=v.useRef(null),T=v.useRef(null),k=v.useRef(null),U=v.useRef(null),j=v.useRef(new Set),N=v.useRef(new WeakSet);return F.current===null&&(F.current=ss(t==="end"||t==="last-anchor",(Y,K)=>Y===K)),A.current===null&&(A.current=ss(Ai,Eu)),U.current===null&&(U.current=xu()),s.current=e,l.current=n,C.current=r,x.current=o,{autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:D,streamingTurnRef:y,contentRef:c,defaultScrollPositionAppliedRef:a,firstItemRef:u,itemCountRef:f,lastScrollTopRef:d,messageElementsRef:p,modeRef:g,pendingScrollFrameRef:w,pendingScrollToMessageRef:m,prependRestoreRef:b,preserveScrollOnPrependRef:S,pendingDefaultScrollStore:F.current,rootRef:E,scrollEdgeThresholdRef:l,scrollMarginRef:C,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:O,spacerRef:P,stateFrameRef:M,stateStore:A.current,viewportRef:_,visibilityFrameRef:T,visibilityObserverRef:k,visibilityStore:U.current,visibleMessageIdsRef:j,handledScrollAnchorsRef:N}}function Di(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function In(e){e.defaultScrollPositionAppliedRef.current=!0,Di(e)}function Cu({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:a,itemCountRef:l,messageElementsRef:f,modeRef:u,pendingScrollToMessageRef:d,prependRestoreRef:g,scrollMarginRef:p,scrollPreviousItemPeekRef:m,spacerGapRef:b,spacerHeightRef:y,spacerRef:x,viewportRef:S}=e,E=v.useCallback(A=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==A&&(i.current=A,t()),A&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},su))},[t]),C=v.useCallback(A=>{let D=x.current;if(!D)return;let _=Math.max(0,Math.ceil(A));y.current!==_&&(y.current=_,D.hidden=_===0,D.style.height=`${_}px`,D.style.marginTop=_>0?`${-b.current}px`:"")},[]),w=v.useCallback((A,{behavior:D="auto",autoscrolling:_=!1}={})=>{let T=S.current;if(!T)return;let k=Math.max(0,A);if(Math.abs(T.scrollTop-k)<=jn){T.scrollTop=k,t();return}_&&E(!0),T.scrollTo({top:k,behavior:D}),n()},[t,n,E]),R=v.useCallback(({behavior:A="auto"}={})=>S.current?(C(0),o.current=null,u.current="free-scrolling",w(0,{behavior:A}),r(),!0):!1,[r,w,C]),O=v.useCallback(({behavior:A="auto"}={})=>{let D=S.current;return D?(C(0),o.current=null,u.current=s.current?"following-bottom":"free-scrolling",w(bu(D),{autoscrolling:!0,behavior:A}),r(),!0):!1},[r,w,C]),P=v.useCallback((A,{align:D="start",behavior:_="auto",scrollMargin:T=p.current}={},{keepPreviousPeek:k=!1}={})=>{let U=a.current,j=S.current;if(!U||!j||!U.contains(A))return!1;let N=gu({align:D,element:A,scrollMargin:k?T+m.current:T,spacer:x.current,viewport:j}),Y=mu({content:U,scrollTop:N,spacer:x.current,viewport:j});return C(Y),g.current={element:A,viewportTop:Pn(A,j)},u.current=k?"anchored-to-message":"settling-jump",o.current=k?A:null,w(N,{behavior:_}),r(),!0},[r,w,C]),M=v.useCallback(()=>{let A=o.current;return!A||!A.isConnected||u.current!=="anchored-to-message"?!1:P(A,{align:"start"},{keepPreviousPeek:!0})},[P]),F=v.useCallback((A,D)=>{let _=f.current.get(A);return _?(In(e),P(_,D)?(d.current=null,!0):(d.current={messageId:A,options:D},!0)):l.current===0?(d.current={messageId:A,options:D},In(e),!0):!1},[P]);return{flushPendingScrollToMessage:v.useCallback(()=>{let A=d.current;if(!A)return!1;let D=f.current.get(A.messageId);return!D||!P(D,A.options)?!1:(d.current=null,In(e),!0)},[P]),reanchorToAnchoredMessage:M,scrollToElement:P,scrollToEnd:O,scrollToMessage:F,scrollToStart:R}}function is(e,t){return v.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Ru({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=nu,scrollPreviousItemPeek:r=ru,scrollMargin:o=ou}){let s=wu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:a,autoscrollingTimeoutRef:l,contentRef:f,defaultScrollPositionAppliedRef:u,firstItemRef:d,itemCountRef:g,lastScrollTopRef:p,messageElementsRef:m,modeRef:b,pendingScrollFrameRef:y,pendingScrollToMessageRef:x,prependRestoreRef:S,preserveScrollOnPrependRef:E,pendingDefaultScrollStore:C,rootRef:w,scrollEdgeThresholdRef:R,scrollMarginRef:O,scrollPreviousItemPeekRef:P,spacerGapRef:M,spacerHeightRef:F,spacerRef:A,stateFrameRef:D,stateStore:_,viewportRef:T,visibilityFrameRef:k,visibilityObserverRef:U,visibilityStore:j,visibleMessageIdsRef:N,handledScrollAnchorsRef:Y}=s,K=v.useRef(t);K.current!==t&&(K.current=t,u.current=!1);let le=v.useCallback(V=>{let q=w.current,Z=T.current,se=[V.start&&"start",V.end&&"end"].filter(Boolean).join(" "),ke=a.current;for(let Ce of[q,Z])Ce&&(se?Ce.setAttribute("data-scrollable",se):Ce.removeAttribute("data-scrollable"),Ce.toggleAttribute("data-autoscrolling",ke))},[]),ie=v.useCallback(V=>{var se;let q=((se=T.current)==null?void 0:se.scrollTop)??0,Z=q<p.current-jn;p.current=q,c.current&&!V.end&&b.current!=="settling-jump"&&b.current!=="anchored-to-message"?b.current="following-bottom":b.current==="following-bottom"&&V.end&&Z&&!a.current&&(b.current="free-scrolling")},[]),L=v.useCallback(()=>{let V=au({content:f.current,scrollEdgeThreshold:R.current,spacer:A.current,viewport:T.current});ie(V);let q=b.current==="following-bottom"?{...V,end:!1}:V;le(q),_.setSnapshot(q)},[ie,_,le]),X=v.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,L()}))},[L]),B=v.useCallback(()=>{j.hasListeners()&&k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,j.hasListeners()&&j.setSnapshot(lu({content:f.current,scrollMargin:O.current,scrollPreviousItemPeek:P.current,spacer:A.current,viewport:T.current,visibleMessageIds:N.current}))}))},[j]),{flushPendingScrollToMessage:$,reanchorToAnchoredMessage:Q,scrollToElement:re,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W}=Cu({refs:s,commitScrollState:L,scheduleStateCommit:X,scheduleVisibilitySync:B}),ne=v.useCallback(()=>{let V=S.current,q=T.current;if(!V||!q||!V.element.isConnected)return!1;let Z=Pn(V.element,q)-V.viewportTop;return Math.abs(Z)<=jn?!1:(q.scrollTop+=Z,V.viewportTop=Pn(V.element,q),X(),B(),!0)},[X,B]),oe=v.useCallback(()=>{let V=f.current,q=T.current;if(!V||!q){S.current=null;return}let Z=hu({content:V,spacer:A.current,viewport:q});S.current=Z?{element:Z,viewportTop:Pn(Z,q)}:null},[]),ye=v.useCallback(()=>{y.current===null&&(y.current=window.requestAnimationFrame(()=>{y.current=null,$()&&oe()}))},[oe,$]),z=v.useCallback(()=>{if(!t||u.current||g.current===0)return!1;let V=!1;if(t==="last-anchor"){let q=f.current,Z=T.current,se=q&&Z?pu(Yt(q,A.current)):null;if(!q||!Z||!se)V=ee({behavior:"auto"});else{let ke=Ni(se,Z);V=po({content:q,spacer:A.current,viewport:Z})-ke<=Z.clientHeight?ee({behavior:"auto"}):re(se,{align:"start"},{keepPreviousPeek:!0})}}else V=t==="end"?ee({behavior:"auto"}):W({behavior:"auto"});return V?(In(s),!0):!1},[t,re,ee,W]),J=v.useCallback(()=>{let V=f.current;if(!V)return;let q=Yt(V,A.current),Z=g.current,se=d.current;g.current=q.length,d.current=q[0]??null,(()=>{if($())return;if(Z===0){if(z()||q.length>0&&c.current&&ee({behavior:"auto"}))return;L(),B();return}let ke=se?q.indexOf(se):-1;if(E.current&&ke>0){ne();return}if(q.length>Z){let Ce=uu(q,Z);if(Ce){if(c.current&&b.current==="following-bottom"&&du(q,Z)){ee({behavior:"auto"});return}re(Ce,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(Ce);return}}if(q.length===Z){let Ce=fu(q,Y.current);if(Ce){re(Ce,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(Ce);return}}b.current==="following-bottom"&&c.current?ee({behavior:"auto"}):(L(),B())})(),oe()},[z,oe,L,$,ne,B,re,ee]),ce=v.useCallback(()=>{if(b.current==="following-bottom"&&c.current){ee({behavior:"auto"});return}let V=F.current;if(Q()){c.current&&V>0&&F.current===0&&ee({behavior:"auto"});return}X(),B()},[Q,X,B,ee]),he=v.useCallback(()=>{let V=T.current;if(!(!V||!j.hasListeners())){if(typeof IntersectionObserver>"u"){B();return}U.current||(U.current=new IntersectionObserver(q=>{for(let Z of q){let se=Z.target.dataset.messageId;se&&(Z.isIntersecting?N.current.add(se):N.current.delete(se))}B()},{root:V,rootMargin:`${-(O.current+P.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),m.current.forEach(q=>{var Z;(Z=U.current)==null||Z.observe(q)}),B()}},[B,j]),Pe=v.useCallback(()=>{var V;k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),(V=U.current)==null||V.disconnect(),U.current=null,N.current.clear(),j.setSnapshot(Mn)},[j]),je=v.useCallback((V,q,Z)=>{var se,ke,Ce;if(q){m.current.set(V,q),(se=U.current)==null||se.observe(q),B(),((ke=x.current)==null?void 0:ke.messageId)===V&&ye();return}Z&&m.current.get(V)===Z&&(m.current.delete(V),N.current.delete(V),(Ce=U.current)==null||Ce.unobserve(Z),B())},[ye,B]),Re=v.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),Me=v.useCallback(()=>le(_.getSnapshot()),[_,le]),Be=is(w,Me),H=is(T,Me),G=v.useCallback(V=>{f.current=V},[]),Se=v.useCallback(V=>{A.current=V,M.current=vu((V==null?void 0:V.parentElement)??null)},[]),be=v.useCallback(()=>{L(),B(),oe()},[oe,L,B]),ge=v.useMemo(()=>({handleContentChange:J,handleResize:ce,observeVisibility:he,pendingDefaultScrollStore:C,preserveScrollOnPrependRef:E,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W,setContentElement:G,setRootElement:Be,setSpacerElement:Se,setViewportElement:H,stateStore:_,syncAfterScroll:be,unobserveVisibility:Pe,userScrollIntent:Re,viewportRef:T,visibilityStore:j}),[J,ce,he,C,ee,te,W,G,Be,Se,H,_,be,Pe,Re,j]);return v.useLayoutEffect(()=>{z()||g.current===0&&Di(s)},[z]),v.useEffect(()=>()=>{var V;D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),y.current!==null&&(window.cancelAnimationFrame(y.current),y.current=null),(V=U.current)==null||V.disconnect(),U.current=null},[]),v.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&g.current>0){ee({behavior:"auto"});return}L()},[e,L,ee]),{context:ge,registerMessage:je}}function Tu(e){let t=v.useRef(e);return t.current=e,t}var Fi=v.createContext(null),Li=v.createContext(null);function nn(){let e=v.useContext(Fi);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ou(){let e=v.useContext(Li);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Pu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=Ru({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return h.jsx(Fi.Provider,{value:i,children:h.jsx(Li.Provider,{value:c,children:t})})}function Bi(){let{pendingDefaultScrollStore:e}=nn();return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Iu({children:e,...t}){let{setRootElement:n}=nn(),r=Bi();return h.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function _u({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:s,preserveScrollOnPrepend:i=!0,ref:c,role:a,tabIndex:l,...f}){let{handleResize:u,preserveScrollOnPrependRef:d,setViewportElement:g,syncAfterScroll:p,userScrollIntent:m,viewportRef:b}=nn(),y=Bi();d.current=i;let x=v.useCallback(R=>{var O;g(R),(O=tn(c))==null||O(R)},[c,g]);function S(R){p(),r==null||r(R)}function E(R){m(),s==null||s(R)}function C(R){m(),o==null||o(R)}function w(R){iu.has(R.key)&&m(),n==null||n(R)}return v.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let O=0,P=new ResizeObserver(()=>{window.cancelAnimationFrame(O),O=window.requestAnimationFrame(u)});return P.observe(R),()=>{window.cancelAnimationFrame(O),P.disconnect()}},[u,b]),h.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:w,onScroll:S,onTouchMove:C,onWheel:E,...f,...y?{"data-pending-scroll":""}:null,children:t})}function ku({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=nn(),f=v.useRef(null),u=v.useCallback(d=>{var g;f.current=d,a(d),(g=tn(n))==null||g(d)},[n,a]);return v.useLayoutEffect(()=>{let d=f.current;if(!d||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(d,{childList:!0}),()=>g.disconnect()},[i]),v.useEffect(()=>{let d=f.current;if(!d||typeof ResizeObserver>"u")return;let g=0,p=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return p.observe(d),()=>{window.cancelAnimationFrame(g),p.disconnect()}},[c]),h.jsxs("div",{ref:u,role:r??"log","aria-relevant":e??"additions",...s,children:[t,h.jsx("div",{ref:l,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Au({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ou(),s=v.useRef(null),i=v.useCallback(c=>{var l;let a=s.current;s.current=c,e&&o(e,c,a),(l=tn(t))==null||l(c)},[e,t,o]);return h.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Nu({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:s,type:i="button",...c}){let{scrollToEnd:a,scrollToStart:l,stateStore:f}=nn(),u=Tu(r),d=v.useCallback(b=>f.subscribe(b),[f]),g=v.useCallback(()=>{let b=f.getSnapshot();return n==="start"?b.start:b.end},[n,f]),p=v.useSyncExternalStore(d,g,g),m=v.useCallback(b=>{var y;p&&((y=u.current)==null||y.call(u,b),b.defaultPrevented||(b.currentTarget.blur(),n==="start"?l({behavior:e}):a({behavior:e})))},[e,n,p,u,a,l]);return Zl({defaultTagName:"button",props:_r({type:i,inert:!p,tabIndex:p?s:-1,children:t??h.jsxs("span",{children:["Scroll to ",n]}),onClick:m},c),render:o,state:{active:p,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Pu,Root:Iu,Viewport:_u,Content:ku,Item:Au,Button:Nu};function ju(e){return h.jsx(Ft.Provider,{...e})}function Mu({className:e,...t}){return h.jsx(Ft.Root,{"data-slot":"message-scroller",className:ue("msg-scroller-root",e),...t})}function Du({className:e,...t}){return h.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:ue("msg-scroller-viewport",e),...t})}function Fu({className:e,...t}){return h.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:ue("msg-scroller-content",e),...t})}function cs({className:e,scrollAnchor:t=!1,...n}){return h.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:ue("msg-scroller-item",e),...n})}function Lu({direction:e="end",className:t,children:n,...r}){return h.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:ue("msg-scroller-btn",t),...r,children:n??h.jsxs(h.Fragment,{children:[h.jsx(ua,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),h.jsx("span",{className:"sr-only",children:e==="end"?"Jump to latest":"Jump to start"})]})})}function Ar({align:e="start",variant:t="muted",className:n,...r}){return h.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:ue("chat-bubble",n)})}function Nr({className:e,...t}){return h.jsx("div",{...t,"data-slot":"bubble-content",className:ue("chat-bubble-content",e)})}const Bu=()=>h.jsxs(Jr,{children:[h.jsx(ri,{className:"avatar-circle","aria-hidden":"true",children:h.jsx(Xs,{size:15})}),h.jsx(Zr,{children:h.jsx(Ar,{children:h.jsx(Nr,{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a suggested question."})})})]});function Vi(){const[e,t]=I.useState("idle");I.useEffect(()=>{if(e!=="copied")return;const r=window.setTimeout(()=>t("idle"),2e3);return()=>window.clearTimeout(r)},[e]);async function n(r){t("copying");try{await navigator.clipboard.writeText(r),t("copied")}catch{t("failed")}}return{status:e,copy:n}}function Vu({message:e,onFeedback:t}){const{status:n,copy:r}=Vi();return h.jsxs("div",{className:"chat-message-actions",role:"group","aria-label":"Response actions",children:[h.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Copy response",title:"Copy response",disabled:n==="copying",onClick:()=>void r(e.content),children:n==="copied"?h.jsx(Xr,{size:16,"aria-hidden":"true"}):h.jsx(Qs,{size:16,"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Like response",title:"Like response","aria-pressed":e.feedback==="like",onClick:()=>t(e.id,"like"),children:h.jsx(Ta,{size:16,"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Dislike response",title:"Dislike response","aria-pressed":e.feedback==="dislike",onClick:()=>t(e.id,"dislike"),children:h.jsx(Ra,{size:16,"aria-hidden":"true"})}),h.jsxs("span",{className:"chat-message-copy-status",role:"status",children:[n==="copied"&&"Copied",n==="failed"&&"Couldn’t copy"]})]})}function ho(e){const t=e.trim();if(!/[\u0000-\u001f\u007f]/.test(t)&&/^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))return t}function $u(e){return Object.prototype.toString.call(e)==="[object Object]"}function as(e){return $u(e)||Array.isArray(e)}function Hu(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function go(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const o=JSON.stringify(Object.keys(e.breakpoints||{})),s=JSON.stringify(Object.keys(t.breakpoints||{}));return o!==s?!1:n.every(i=>{const c=e[i],a=t[i];return typeof c=="function"?`${c}`==`${a}`:!as(c)||!as(a)?c===a:go(c,a)})}function ls(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Uu(e,t){if(e.length!==t.length)return!1;const n=ls(e),r=ls(t);return n.every((o,s)=>{const i=r[s];return go(o,i)})}function mo(e){return typeof e=="number"}function jr(e){return typeof e=="string"}function Qn(e){return typeof e=="boolean"}function us(e){return Object.prototype.toString.call(e)==="[object Object]"}function we(e){return Math.abs(e)}function bo(e){return Math.sign(e)}function Wt(e,t){return we(e-t)}function zu(e,t){if(e===0||t===0||we(e)<=we(t))return 0;const n=Wt(we(e),we(t));return we(n/e)}function Wu(e){return Math.round(e*100)/100}function Xt(e){return Jt(e).map(Number)}function Ge(e){return e[rn(e)]}function rn(e){return Math.max(0,e.length-1)}function yo(e,t){return t===rn(e)}function fs(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function Jt(e){return Object.keys(e)}function $i(e,t){return[e,t].reduce((n,r)=>(Jt(r).forEach(o=>{const s=n[o],i=r[o],c=us(s)&&us(i);n[o]=c?$i(s,i):i}),n),{})}function Mr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function qu(e,t){const n={start:r,center:o,end:s};function r(){return 0}function o(a){return s(a)/2}function s(a){return t-a}function i(a,l){return jr(e)?n[e](a):e(t,a,l)}return{measure:i}}function Zt(){let e=[];function t(o,s,i,c={passive:!0}){let a;if("addEventListener"in o)o.addEventListener(s,i,c),a=()=>o.removeEventListener(s,i,c);else{const l=o;l.addListener(i),a=()=>l.removeListener(i)}return e.push(a),r}function n(){e=e.filter(o=>o())}const r={add:t,clear:n};return r}function Gu(e,t,n,r){const o=Zt(),s=1e3/60;let i=null,c=0,a=0;function l(){o.add(e,"visibilitychange",()=>{e.hidden&&p()})}function f(){g(),o.clear()}function u(b){if(!a)return;i||(i=b,n(),n());const y=b-i;for(i=b,c+=y;c>=s;)n(),c-=s;const x=c/s;r(x),a&&(a=t.requestAnimationFrame(u))}function d(){a||(a=t.requestAnimationFrame(u))}function g(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function p(){i=null,c=0}return{init:l,destroy:f,start:d,stop:g,update:n,render:r}}function Ku(e,t){const n=t==="rtl",r=e==="y",o=r?"y":"x",s=r?"x":"y",i=!r&&n?-1:1,c=f(),a=u();function l(p){const{height:m,width:b}=p;return r?m:b}function f(){return r?"top":n?"right":"left"}function u(){return r?"bottom":n?"left":"right"}function d(p){return p*i}return{scroll:o,cross:s,startEdge:c,endEdge:a,measureSize:l,direction:d}}function Et(e=0,t=0){const n=we(e-t);function r(l){return l<e}function o(l){return l>t}function s(l){return r(l)||o(l)}function i(l){return s(l)?r(l)?e:t:l}function c(l){return n?l-n*Math.ceil((l-t)/n):l}return{length:n,max:t,min:e,constrain:i,reachedAny:s,reachedMax:o,reachedMin:r,removeOffset:c}}function Hi(e,t,n){const{constrain:r}=Et(0,e),o=e+1;let s=i(t);function i(d){return n?we((o+d)%o):r(d)}function c(){return s}function a(d){return s=i(d),u}function l(d){return f().set(c()+d)}function f(){return Hi(e,c(),n)}const u={get:c,set:a,add:l,clone:f};return u}function Yu(e,t,n,r,o,s,i,c,a,l,f,u,d,g,p,m,b,y,x){const{cross:S,direction:E}=e,C=["INPUT","SELECT","TEXTAREA"],w={passive:!1},R=Zt(),O=Zt(),P=Et(50,225).constrain(g.measure(20)),M={mouse:300,touch:400},F={mouse:500,touch:600},A=p?43:25;let D=!1,_=0,T=0,k=!1,U=!1,j=!1,N=!1;function Y(W){if(!x)return;function ne(ye){(Qn(x)||x(W,ye))&&B(ye)}const oe=t;R.add(oe,"dragstart",ye=>ye.preventDefault(),w).add(oe,"touchmove",()=>{},w).add(oe,"touchend",()=>{}).add(oe,"touchstart",ne).add(oe,"mousedown",ne).add(oe,"touchcancel",Q).add(oe,"contextmenu",Q).add(oe,"click",re,!0)}function K(){R.clear(),O.clear()}function le(){const W=N?n:t;O.add(W,"touchmove",$,w).add(W,"touchend",Q).add(W,"mousemove",$,w).add(W,"mouseup",Q)}function ie(W){const ne=W.nodeName||"";return C.includes(ne)}function L(){return(p?F:M)[N?"mouse":"touch"]}function X(W,ne){const oe=u.add(bo(W)*-1),ye=f.byDistance(W,!p).distance;return p||we(W)<P?ye:b&&ne?ye*.5:f.byIndex(oe.get(),0).distance}function B(W){const ne=Mr(W,r);N=ne,j=p&&ne&&!W.buttons&&D,D=Wt(o.get(),i.get())>=2,!(ne&&W.button!==0)&&(ie(W.target)||(k=!0,s.pointerDown(W),l.useFriction(0).useDuration(0),o.set(i),le(),_=s.readPoint(W),T=s.readPoint(W,S),d.emit("pointerDown")))}function $(W){if(!Mr(W,r)&&W.touches.length>=2)return Q(W);const oe=s.readPoint(W),ye=s.readPoint(W,S),z=Wt(oe,_),J=Wt(ye,T);if(!U&&!N&&(!W.cancelable||(U=z>J,!U)))return Q(W);const ce=s.pointerMove(W);z>m&&(j=!0),l.useFriction(.3).useDuration(.75),c.start(),o.add(E(ce)),W.preventDefault()}function Q(W){const oe=f.byDistance(0,!1).index!==u.get(),ye=s.pointerUp(W)*L(),z=X(E(ye),oe),J=zu(ye,z),ce=A-10*J,he=y+J/50;U=!1,k=!1,O.clear(),l.useDuration(ce).useFriction(he),a.distance(z,!p),N=!1,d.emit("pointerUp")}function re(W){j&&(W.stopPropagation(),W.preventDefault(),j=!1)}function ee(){return k}return{init:Y,destroy:K,pointerDown:ee}}function Xu(e,t){let r,o;function s(u){return u.timeStamp}function i(u,d){const p=`client${(d||e.scroll)==="x"?"X":"Y"}`;return(Mr(u,t)?u:u.touches[0])[p]}function c(u){return r=u,o=u,i(u)}function a(u){const d=i(u)-i(o),g=s(u)-s(r)>170;return o=u,g&&(r=u),d}function l(u){if(!r||!o)return 0;const d=i(o)-i(r),g=s(u)-s(r),p=s(u)-s(o)>170,m=d/g;return g&&!p&&we(m)>.1?m:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function Ju(){function e(n){const{offsetTop:r,offsetLeft:o,offsetWidth:s,offsetHeight:i}=n;return{top:r,right:o+s,bottom:r+i,left:o,width:s,height:i}}return{measure:e}}function Zu(e){function t(r){return e*(r/100)}return{measure:t}}function Qu(e,t,n,r,o,s,i){const c=[e].concat(r);let a,l,f=[],u=!1;function d(b){return o.measureSize(i.measure(b))}function g(b){if(!s)return;l=d(e),f=r.map(d);function y(x){for(const S of x){if(u)return;const E=S.target===e,C=r.indexOf(S.target),w=E?l:f[C],R=d(E?e:r[C]);if(we(R-w)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(Qn(s)||s(b,x))&&y(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function p(){u=!0,a&&a.disconnect()}return{init:g,destroy:p}}function ef(e,t,n,r,o,s){let i=0,c=0,a=o,l=s,f=e.get(),u=0;function d(){const w=r.get()-e.get(),R=!a;let O=0;return R?(i=0,n.set(r),e.set(r),O=w):(n.set(e),i+=w/a,i*=l,f+=i,e.add(i),O=f-u),c=bo(O),u=f,C}function g(){const w=r.get()-t.get();return we(w)<.001}function p(){return a}function m(){return c}function b(){return i}function y(){return S(o)}function x(){return E(s)}function S(w){return a=w,C}function E(w){return l=w,C}const C={direction:m,duration:p,velocity:b,seek:d,settled:g,useBaseFriction:x,useBaseDuration:y,useFriction:E,useDuration:S};return C}function tf(e,t,n,r,o){const s=o.measure(10),i=o.measure(50),c=Et(.1,.99);let a=!1;function l(){return!(a||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function f(g){if(!l())return;const p=e.reachedMin(t.get())?"min":"max",m=we(e[p]-t.get()),b=n.get()-t.get(),y=c.constrain(m/i);n.subtract(b*y),!g&&we(b)<s&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function u(g){a=!g}return{shouldConstrain:l,constrain:f,toggleActive:u}}function nf(e,t,n,r,o){const s=Et(-t+e,0),i=u(),c=f(),a=d();function l(p,m){return Wt(p,m)<=1}function f(){const p=i[0],m=Ge(i),b=i.lastIndexOf(p),y=i.indexOf(m)+1;return Et(b,y)}function u(){return n.map((p,m)=>{const{min:b,max:y}=s,x=s.constrain(p),S=!m,E=yo(n,m);return S?y:E||l(b,x)?b:l(y,x)?y:x}).map(p=>parseFloat(p.toFixed(3)))}function d(){if(t<=e+o)return[s.max];if(r==="keepSnaps")return i;const{min:p,max:m}=c;return i.slice(p,m)}return{snapsContained:a,scrollContainLimit:c}}function rf(e,t,n){const r=t[0],o=n?r-e:Ge(t);return{limit:Et(o,r)}}function of(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=Et(s,i);function l(d){return d===1?a(n.get()):d===-1?c(n.get()):!1}function f(d){if(!l(d))return;const g=e*(d*-1);r.forEach(p=>p.add(g))}return{loop:f}}function sf(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function cf(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=u().map(t.measure),l=d(),f=g();function u(){return c(r).map(m=>Ge(m)[i]-m[0][s]).map(we)}function d(){return r.map(m=>n[s]-m[s]).map(m=>-we(m))}function g(){return c(l).map(m=>m[0]).map((m,b)=>m+a[b])}return{snaps:l,snapsAligned:f}}function af(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=f();function f(){const d=i(s),g=!e||t==="keepSnaps";return n.length===1?[s]:g?d:d.slice(c,a).map((p,m,b)=>{const y=!m,x=yo(b,m);if(y){const S=Ge(b[0])+1;return fs(S)}if(x){const S=rn(s)-Ge(b)[0]+1;return fs(S,Ge(b)[0])}return p})}return{slideRegistry:l}}function lf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(p){return p.concat().sort((m,b)=>we(m)-we(b))[0]}function l(p){const m=e?i(p):c(p),b=t.map((x,S)=>({diff:f(x-m,0),index:S})).sort((x,S)=>we(x.diff)-we(S.diff)),{index:y}=b[0];return{index:y,distance:m}}function f(p,m){const b=[p,p+n,p-n];if(!e)return p;if(!m)return a(b);const y=b.filter(x=>bo(x)===m);return y.length?a(y):Ge(b)-n}function u(p,m){const b=t[p]-o.get(),y=f(b,m);return{index:p,distance:y}}function d(p,m){const b=o.get()+p,{index:y,distance:x}=l(b),S=!e&&s(b);if(!m||S)return{index:y,distance:p};const E=t[y]-x,C=p+f(E,0);return{index:y,distance:C}}return{byDistance:d,byIndex:u,shortcut:f}}function uf(e,t,n,r,o,s,i){function c(u){const d=u.distance,g=u.index!==t.get();s.add(d),d&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),g&&(n.set(t.get()),t.set(u.index),i.emit("select"))}function a(u,d){const g=o.byDistance(u,d);c(g)}function l(u,d){const g=t.clone().set(u),p=o.byIndex(g.get(),d);c(p)}return{distance:a,index:l}}function ff(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function f(g){if(!c)return;function p(m){if(new Date().getTime()-l>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(S=>S.includes(m));mo(x)&&(o.useDuration(0),r.index(x,0),i.emit("slideFocus"))}s.add(document,"keydown",u,!1),t.forEach((m,b)=>{s.add(m,"focus",y=>{(Qn(c)||c(g,y))&&p(b)},a)})}function u(g){g.code==="Tab"&&(l=new Date().getTime())}return{init:f}}function Ut(e){let t=e;function n(){return t}function r(a){t=i(a)}function o(a){t+=i(a)}function s(a){t-=i(a)}function i(a){return mo(a)?a:a.get()}return{get:n,set:r,add:o,subtract:s}}function Ui(e,t){const n=e.scroll==="x"?i:c,r=t.style;let o=null,s=!1;function i(d){return`translate3d(${d}px,0px,0px)`}function c(d){return`translate3d(0px,${d}px,0px)`}function a(d){if(s)return;const g=Wu(e.direction(d));g!==o&&(r.transform=n(g),o=g)}function l(d){s=!d}function f(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:f,to:a,toggleActive:l}}function df(e,t,n,r,o,s,i,c,a){const f=Xt(o),u=Xt(o).reverse(),d=y().concat(x());function g(R,O){return R.reduce((P,M)=>P-o[M],O)}function p(R,O){return R.reduce((P,M)=>g(P,O)>0?P.concat([M]):P,[])}function m(R){return s.map((O,P)=>({start:O-r[P]+.5+R,end:O+t-.5+R}))}function b(R,O,P){const M=m(O);return R.map(F=>{const A=P?0:-n,D=P?n:0,_=P?"end":"start",T=M[F][_];return{index:F,loopPoint:T,slideLocation:Ut(-1),translate:Ui(e,a[F]),target:()=>c.get()>T?A:D}})}function y(){const R=i[0],O=p(u,R);return b(O,n,!1)}function x(){const R=t-i[0]-1,O=p(f,R);return b(O,-n,!0)}function S(){return d.every(({index:R})=>{const O=f.filter(P=>P!==R);return g(O,t)<=.1})}function E(){d.forEach(R=>{const{target:O,translate:P,slideLocation:M}=R,F=O();F!==M.get()&&(P.to(F),M.set(F))})}function C(){d.forEach(R=>R.translate.clear())}return{canLoop:S,clear:C,loop:E,loopPoints:d}}function pf(e,t,n){let r,o=!1;function s(a){if(!n)return;function l(f){for(const u of f)if(u.type==="childList"){a.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(f=>{o||(Qn(n)||n(a,f))&&l(f)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),o=!0}return{init:s,destroy:i}}function hf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(p=>{a||(p.forEach(m=>{const b=t.indexOf(m.target);o[b]=m}),s=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:r}),t.forEach(p=>c.observe(p))}function f(){c&&c.disconnect(),a=!0}function u(p){return Jt(o).reduce((m,b)=>{const y=parseInt(b),{isIntersecting:x}=o[y];return(p&&x||!p&&!x)&&m.push(y),m},[])}function d(p=!0){if(p&&s)return s;if(!p&&i)return i;const m=u(p);return p&&(s=m),p||(i=m),m}return{init:l,destroy:f,get:d}}function gf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,f=p(),u=m(),d=n.map(i),g=b();function p(){if(!l)return 0;const x=n[0];return we(t[c]-x[c])}function m(){if(!l)return 0;const x=s.getComputedStyle(Ge(r));return parseFloat(x.getPropertyValue(`margin-${a}`))}function b(){return n.map((x,S,E)=>{const C=!S,w=yo(E,S);return C?d[S]+f:w?d[S]+u:E[S+1][c]-x[c]}).map(we)}return{slideSizes:d,slideSizesWithGaps:g,startGap:f,endGap:u}}function mf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:f,direction:u}=e,d=mo(n);function g(y,x){return Xt(y).filter(S=>S%x===0).map(S=>y.slice(S,S+x))}function p(y){return y.length?Xt(y).reduce((x,S,E)=>{const C=Ge(x)||0,w=C===0,R=S===rn(y),O=o[l]-s[C][l],P=o[l]-s[S][f],M=!r&&w?u(i):0,F=!r&&R?u(c):0,A=we(P-F-(O+M));return E&&A>t+a&&x.push(S),R&&x.push(y.length),x},[]).map((x,S,E)=>{const C=Math.max(E[S-1]||0);return y.slice(C,x)}):[]}function m(y){return d?g(y,n):p(y)}return{groupSlides:m}}function bf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:f,loop:u,duration:d,dragFree:g,dragThreshold:p,inViewThreshold:m,slidesToScroll:b,skipSnaps:y,containScroll:x,watchResize:S,watchSlides:E,watchDrag:C,watchFocus:w}=s,R=2,O=Ju(),P=O.measure(t),M=n.map(O.measure),F=Ku(a,l),A=F.measureSize(P),D=Zu(A),_=qu(c,A),T=!u&&!!x,k=u||!!x,{slideSizes:U,slideSizesWithGaps:j,startGap:N,endGap:Y}=gf(F,P,M,n,k,o),K=mf(F,A,b,u,P,M,N,Y,R),{snaps:le,snapsAligned:ie}=cf(F,_,P,M,K),L=-Ge(le)+Ge(j),{snapsContained:X,scrollContainLimit:B}=nf(A,L,ie,x,R),$=T?X:ie,{limit:Q}=rf(L,$,u),re=Hi(rn($),f,u),ee=re.clone(),te=Xt(n),W=({dragHandler:V,scrollBody:q,scrollBounds:Z,options:{loop:se}})=>{se||Z.constrain(V.pointerDown()),q.seek()},ne=({scrollBody:V,translate:q,location:Z,offsetLocation:se,previousLocation:ke,scrollLooper:Ce,slideLooper:Ct,dragHandler:st,animation:Rt,eventHandler:Ze,scrollBounds:Qe,options:{loop:ht}},gt)=>{const Lt=V.settled(),an=!Qe.shouldConstrain(),Bt=ht?Lt:Lt&&an,Vt=Bt&&!st.pointerDown();Vt&&Rt.stop();const ln=Z.get()*gt+ke.get()*(1-gt);se.set(ln),ht&&(Ce.loop(V.direction()),Ct.loop()),q.to(se.get()),Vt&&Ze.emit("settle"),Bt||Ze.emit("scroll")},oe=Gu(r,o,()=>W(ge),V=>ne(ge,V)),ye=.68,z=$[re.get()],J=Ut(z),ce=Ut(z),he=Ut(z),Pe=Ut(z),je=ef(J,he,ce,Pe,d,ye),Re=lf(u,$,L,Q,Pe),Me=uf(oe,re,ee,je,Re,Pe,i),Be=sf(Q),H=Zt(),G=hf(t,n,i,m),{slideRegistry:Se}=af(T,x,$,B,K,te),be=ff(e,n,Se,Me,je,H,i,w),ge={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:P,slideRects:M,animation:oe,axis:F,dragHandler:Yu(F,e,r,o,Pe,Xu(F,o),J,oe,Me,je,Re,re,i,D,g,p,y,ye,C),eventStore:H,percentOfView:D,index:re,indexPrevious:ee,limit:Q,location:J,offsetLocation:he,previousLocation:ce,options:s,resizeHandler:Qu(t,i,o,n,F,S,O),scrollBody:je,scrollBounds:tf(Q,he,Pe,je,D),scrollLooper:of(L,Q,he,[J,he,ce,Pe]),scrollProgress:Be,scrollSnapList:$.map(Be.get),scrollSnaps:$,scrollTarget:Re,scrollTo:Me,slideLooper:df(F,A,L,U,j,le,$,he,n),slideFocus:be,slidesHandler:pf(t,i,E),slidesInView:G,slideIndexes:te,slideRegistry:Se,slidesToScroll:K,target:Pe,translate:Ui(F,t)};return ge}function yf(){let e={},t;function n(l){t=l}function r(l){return e[l]||[]}function o(l){return r(l).forEach(f=>f(t,l)),a}function s(l,f){return e[l]=r(l).concat([f]),a}function i(l,f){return e[l]=r(l).filter(u=>u!==f),a}function c(){e={}}const a={init:n,emit:o,off:i,on:s,clear:c};return a}const vf={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function xf(e){function t(s,i){return $i(s,i||{})}function n(s){const i=s.breakpoints||{},c=Jt(i).filter(a=>e.matchMedia(a).matches).map(a=>i[a]).reduce((a,l)=>t(a,l),{});return t(s,c)}function r(s){return s.map(i=>Jt(i.breakpoints||{})).reduce((i,c)=>i.concat(c),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:r}}function Ef(e){let t=[];function n(s,i){return t=i.filter(({options:c})=>e.optionsAtMedia(c).active!==!1),t.forEach(c=>c.init(s,e)),i.reduce((c,a)=>Object.assign(c,{[a.name]:a}),{})}function r(){t=t.filter(s=>s.destroy())}return{init:n,destroy:r}}function Dn(e,t,n){const r=e.ownerDocument,o=r.defaultView,s=xf(o),i=Ef(s),c=Zt(),a=yf(),{mergeOptions:l,optionsAtMedia:f,optionsMediaQueries:u}=s,{on:d,off:g,emit:p}=a,m=F;let b=!1,y,x=l(vf,Dn.globalOptions),S=l(x),E=[],C,w,R;function O(){const{container:te,slides:W}=S;w=(jr(te)?e.querySelector(te):te)||e.children[0];const oe=jr(W)?w.querySelectorAll(W):W;R=[].slice.call(oe||w.children)}function P(te){const W=bf(e,w,R,r,o,te,a);if(te.loop&&!W.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return P(ne)}return W}function M(te,W){b||(x=l(x,te),S=f(x),E=W||E,O(),y=P(S),u([x,...E.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",F)),S.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(ee),y.eventHandler.init(ee),y.resizeHandler.init(ee),y.slidesHandler.init(ee),y.options.loop&&y.slideLooper.loop(),w.offsetParent&&R.length&&y.dragHandler.init(ee),C=i.init(ee,E)))}function F(te,W){const ne=K();A(),M(l({startIndex:ne},te),W),a.emit("reInit")}function A(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),i.destroy(),c.clear()}function D(){b||(b=!0,c.clear(),A(),a.emit("destroy"),a.clear())}function _(te,W,ne){!S.active||b||(y.scrollBody.useBaseFriction().useDuration(W===!0?0:S.duration),y.scrollTo.index(te,ne||0))}function T(te){const W=y.index.add(1).get();_(W,te,-1)}function k(te){const W=y.index.add(-1).get();_(W,te,1)}function U(){return y.index.add(1).get()!==K()}function j(){return y.index.add(-1).get()!==K()}function N(){return y.scrollSnapList}function Y(){return y.scrollProgress.get(y.offsetLocation.get())}function K(){return y.index.get()}function le(){return y.indexPrevious.get()}function ie(){return y.slidesInView.get()}function L(){return y.slidesInView.get(!1)}function X(){return C}function B(){return y}function $(){return e}function Q(){return w}function re(){return R}const ee={canScrollNext:U,canScrollPrev:j,containerNode:Q,internalEngine:B,destroy:D,off:g,on:d,emit:p,plugins:X,previousScrollSnap:le,reInit:m,rootNode:$,scrollNext:T,scrollPrev:k,scrollProgress:Y,scrollSnapList:N,scrollTo:_,selectedScrollSnap:K,slideNodes:re,slidesInView:ie,slidesNotInView:L};return M(t,n),setTimeout(()=>a.emit("init"),0),ee}Dn.globalOptions=void 0;function vo(e={},t=[]){const n=I.useRef(e),r=I.useRef(t),[o,s]=I.useState(),[i,c]=I.useState(),a=I.useCallback(()=>{o&&o.reInit(n.current,r.current)},[o]);return I.useEffect(()=>{go(n.current,e)||(n.current=e,a())},[e,a]),I.useEffect(()=>{Uu(r.current,t)||(r.current=t,a())},[t,a]),I.useEffect(()=>{if(Hu()&&i){Dn.globalOptions=vo.globalOptions;const l=Dn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}vo.globalOptions=void 0;const Dr=[];let Fr;function Sf(){return Fr}function wf(e){Dr.push(e)}function zi(e){const t=(n,r)=>{const o=Ye(Rf).current;let s;try{Fr=o;for(const i of Dr)i.before(o);s=e(n,r);for(const i of Dr)i.after(o);o.didInitialize=!0}finally{Fr=void 0}return s};return t.displayName=e.displayName||e.name,t}function Cf(e){return v.forwardRef(zi(e))}function Rf(){return{didInitialize:!1}}function Tf(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};if(process.env.NODE_ENV!=="production"){const e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Of,platform:Pf,maxTouchPoints:If}=Tf(),er=Of.toLowerCase(),Qt=Pf.toLowerCase(),Wi=/^i(os$|p)/.test(Qt)||Qt==="macintel"&&If>1,ds="android",_f=Qt===ds||er.includes(ds),qi=!Wi&&Qt.startsWith("mac");Qt.startsWith("win");const kf=qi||Wi;var Hs;const on=typeof CSS<"u"&&!!((Hs=CSS.supports)!=null&&Hs.call(CSS,"-webkit-backdrop-filter:none"));!on&&er.includes("firefox");!on&&er.includes("chrom");const Af=kf,Nf=/jsdom|happydom/.test(er);function jf(e){return"nativeEvent"in e}function Mf(e){return e.pointerType===""&&e.isTrusted?!0:_f&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Lr(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Df(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Br(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Te(e,t){var r;if(!e||!t)return!1;const n=(r=t.getRootNode)==null?void 0:r.call(t);if(e.contains(t))return!0;if(n&&At(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Vr(e,t){let n=e;for(;n;){if(me(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(At(n)?n.host:null)}return null}function yt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Ff="data-base-ui-focusable",Gi="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Lf="data-open",Bf="data-closed",Vf="data-anchor-hidden",$f="data-popup-open",Hf={[$f]:""},Uf={[Lf]:""},zf={[Bf]:""},Wf={[Vf]:""},qf={open(e){return e?Hf:null}},Ki={open(e){return e?Uf:zf},anchorHidden(e){return e?Wf:null}},Gf={...Ki,...io},ps="data-trigger-disabled";function Fn(e,t){if(!me(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(ps);for(const[,r]of t.entries())if(Te(r,n))return!r.hasAttribute(ps);return!1}function pr(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Kf(e){return e.matches("html,body")}function Yf(e){return _e(e)&&e.matches(Gi)}function Xf(e){return Vr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Gi}`)!=null}function Jf(e){if(!e||Nf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Zf(e,t){return t!=null&&!Lr(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=Zf(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function hs(e){return typeof e=="function"?e():e}function Yi(e,t){return t||e==="click"||e==="mousedown"}function Qf(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}function at(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}const ed={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},td={...ed,position:"fixed",margin:0,top:0,left:0},Hr=v.forwardRef(function(t,n){const[r,o]=v.useState();pe(()=>{Af&&on&&o("button")},[]);const s={tabIndex:0,role:r};return h.jsx("span",{...t,ref:n,style:td,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Hr.displayName="FocusGuard");const Mt=Math.min,nt=Math.max,Ln=Math.round,vn=Math.floor,rt=e=>({x:e,y:e}),nd={left:"right",right:"left",bottom:"top",top:"bottom"};function Xi(e,t,n){return nt(e,Mt(t,n))}function ft(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function Je(e){return e.split("-")[1]}function xo(e){return e==="x"?"y":"x"}function Eo(e){return e==="y"?"height":"width"}function Ue(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function So(e){return xo(Ue(e))}function rd(e,t,n){n===void 0&&(n=!1);const r=Je(e),o=So(e),s=Eo(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Bn(i)),[i,Bn(i)]}function od(e){const t=Bn(e);return[Ur(e),t,Ur(t)]}function Ur(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const gs=["left","right"],ms=["right","left"],sd=["top","bottom"],id=["bottom","top"];function cd(e,t,n){switch(e){case"top":case"bottom":return n?t?ms:gs:t?gs:ms;case"left":case"right":return t?sd:id;default:return[]}}function ad(e,t,n,r){const o=Je(e);let s=cd(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ur)))),s}function Bn(e){const t=Ve(e);return nd[t]+e.slice(t.length)}function ld(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Ji(e){return typeof e!="number"?ld(e):{top:e,right:e,bottom:e,left:e}}function Vn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ud(e){return e.visibility==="hidden"||e.visibility==="collapse"}function fd(e,t=e?$e(e):null){return!e||!e.isConnected||!t||ud(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const dd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function pd(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return At(n)?n.host:null}function zr(e){for(const t of Array.from(e.children))if(Le(t)==="summary")return t;return null}function hd(e,t){const n=zr(t);return!!n&&(e===n||Te(n,e))}function Zi(e){const t=e?Le(e):"";return e!=null&&e.matches(dd)&&(t!=="summary"||e.parentElement!=null&&Le(e.parentElement)==="details"&&zr(e.parentElement)===e)&&(t!=="details"||zr(e)==null)&&(t!=="input"||e.type!=="hidden")}function gd(e){if(!Zi(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=pd(t)){const n=t!==e,r=Le(t)==="slot";if(t.hasAttribute("inert")||n&&Le(t)==="details"&&!t.open&&!hd(e,t)||t.hasAttribute("hidden")||!r&&!md(t,n))return!1}return!0}function md(e,t){const n=$e(e);return t?n.display!=="none":fd(e,n)}function bd(e){const t=e.tabIndex;if(t<0){const n=Le(e);if(n==="details"||n==="audio"||n==="video"||_e(e)&&e.isContentEditable)return 0}return t}function hr(e){if(Le(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function yd(e,t){const n=hr(e);if(!n)return!0;const r=t.find(o=>{const s=hr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=hr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function Qi(e){if(_e(e)&&Le(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return _e(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function ec(e,t){Qi(e).forEach(n=>{Zi(n)&&t.push(n),ec(n,t)})}function tc(e,t,n){Qi(e).forEach(r=>{_e(r)&&r.matches(t)&&n.push(r),tc(r,t,n)})}function vd(e){const t=[];return ec(e,t),t.filter(gd)}function nc(e){const t=vd(e);return t.filter(n=>bd(n)>=0&&yd(n,t))}function rc(e,t){const n=nc(e),r=n.length;if(r===0)return;const o=Br(Ke(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function xd(e){return rc(Ke(e).body,1)||e}function Ed(e){return rc(Ke(e).body,-1)||e}function gr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Te(n,r)}function Sd(e){nc(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bs(e){const t=[];tc(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Dt(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>{var s;return[...!n||(s=o.context)!=null&&s.open?[o]:[],...Dt(e,o.id,n)]})}function wo(e){return`data-base-ui-${e}`}const wd={style:{transition:"none"}},Cd={fallbackAxisSide:"end"},Rd={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Co=v.createContext(null);process.env.NODE_ENV!=="production"&&(Co.displayName="PortalContext");const Td=()=>v.useContext(Co),Od=wo("portal");function oc(e={}){const{ref:t,container:n,componentProps:r=Fe,elementProps:o}=e,s=Gn(),i=Td(),c=i==null?void 0:i.portalNode,[a,l]=v.useState(null),[f,u]=v.useState(null),d=fe(b=>{b!==null&&u(b)}),g=v.useRef(null);pe(()=>{if(n===null){g.current&&(g.current=null,u(null),l(null));return}const b=(n&&(co(n)?n:n.current))??c??document.body;if(b==null){g.current&&(g.current=null,u(null),l(null));return}g.current!==b&&(g.current=b,u(null),l(b))},[n,c]);const p=pt("div",r,{ref:[t,d],props:[{id:s,[Od]:""},o]}),m=a&&p?dt.createPortal(p,a):null;return{node:f,nodeId:v.isValidElement(p)?p.props.id:void 0,subtree:m}}const Pd=v.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:c,portalOwnerRole:a,...l}=t,{node:f,nodeId:u,subtree:d}=oc({container:c,ref:n,componentProps:t,elementProps:l}),g=v.useRef(null),p=v.useRef(null),m=v.useRef(null),b=v.useRef(null),[y,x]=v.useState(null),S=v.useRef(!1),E=y==null?void 0:y.modal,C=y==null?void 0:y.open,w=!!y&&!y.modal&&y.open&&!!f;v.useEffect(()=>{if(!f||E)return;function O(P){f&&P.relatedTarget&&gr(P)&&(P.type==="focusin"?S.current&&(bs(f),S.current=!1):(Sd(f),S.current=!0))}return at(Ee(f,"focusin",O,!0),Ee(f,"focusout",O,!0))},[f,E]),pe(()=>{!f||C!==!0||!S.current||(bs(f),S.current=!1)},[C,f]);const R=v.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:b,portalNode:f,setFocusManagerState:x}),[f]);return h.jsxs(v.Fragment,{children:[d,h.jsxs(Co.Provider,{value:R,children:[w&&f&&h.jsx(Hr,{"data-type":"outside",ref:g,onFocus:O=>{var P;if(gr(O,f))(P=m.current)==null||P.focus();else{const M=y?y.domReference:null,F=Ed(M);F==null||F.focus()}}}),w&&f&&h.jsx("span",{role:a,"aria-owns":u,style:Rd}),f&&dt.createPortal(i,f),w&&f&&h.jsx(Hr,{"data-type":"outside",ref:p,onFocus:O=>{var P;if(gr(O,f))(P=b.current)==null||P.focus();else{const M=y?y.domReference:null,F=xd(M);F==null||F.focus(),y!=null&&y.closeOnFocusOut&&(y==null||y.onOpenChange(!1,Oe(ol,O.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Pd.displayName="FloatingPortal");function sc(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}class Id{constructor(){ae(this,"nodesRef",{current:[]});ae(this,"events",sc())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ro=v.createContext(null);process.env.NODE_ENV!=="production"&&(Ro.displayName="FloatingNodeContext");const To=v.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="FloatingTreeContext");const tr=()=>{var e;return((e=v.useContext(Ro))==null?void 0:e.id)||null},sn=e=>{const t=v.useContext(To);return e??t};function _d(e){const t=Gn(),n=sn(e),r=tr();return pe(()=>{if(!t)return;const o={id:t,parentId:r};return n==null||n.addNode(o),()=>{n==null||n.removeNode(o)}},[n,t,r]),t}function kd(e){const{children:t,id:n}=e,r=tr();return h.jsx(Ro.Provider,{value:v.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Ad(e){const{children:t,externalTree:n}=e,r=Ye(()=>n??new Id).current;return h.jsx(To.Provider,{value:r,children:t})}function Nd(){return!1}function jd(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function Md(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=Nd,bubbles:c,externalTree:a}=t,l=e.useState("open"),f=e.useState("floatingElement"),{dataRef:u,events:d}=e.context,g=sn(a),p=fe(typeof o=="function"?o:()=>!1),m=typeof o=="function"?p:o,b=m!==!1,y=fe(()=>s),{escapeKey:x,outsidePress:S}=jd(c),E=v.useRef(!1),C=v.useRef(!1),w=v.useRef(!1),R=v.useRef(!1),O=v.useRef(!1),P=v.useRef(""),M=v.useRef(null),F=zt(),A=zt(),D=zt(),_=fe(()=>{A.clear(),u.current.insideReactTree=!1}),T=fe(L=>{var $;const X=($=u.current.floatingContext)==null?void 0:$.nodeId;return(g?Dt(g.nodesRef.current,X):[]).some(Q=>{var re;return((re=Q.context)==null?void 0:re.open)&&!Q.context.dataRef.current[L]})}),k=fe(L=>pr(L,e.select("floatingElement"))||pr(L,e.select("domReferenceElement"))),U=fe(L=>{i()&&e.setOpen(!1,Oe(Kn,L.nativeEvent))}),j=fe(L=>{if(!l||!n||!r||L.key!=="Escape")return;const X=jf(L)?L.nativeEvent:L;if(O.current||X.isComposing||!x&&T("__escapeKeyBubbles"))return;const B=Oe(no,X);e.setOpen(!1,B),B.isCanceled||L.preventDefault(),!x&&!B.isPropagationAllowed&&L.stopPropagation()}),N=fe(()=>{u.current.insideReactTree=!0,A.start(0,_)}),Y=fe(L=>{if(!l||!n||L.button!==0)return;const X=yt(L.nativeEvent);Te(e.select("floatingElement"),X)&&(E.current||(E.current=!0,C.current=!1))}),K=fe(L=>{!l||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&E.current&&(C.current=!0)});v.useEffect(()=>{function L(X){X.open||(R.current=!1)}return d.on("openchange",L),()=>{d.off("openchange",L)}},[d]),v.useEffect(()=>_,[_]),v.useEffect(()=>{if(!l||!n)return l||(R.current=!1,O.current=!1,P.current="",M.current=null),_;u.current.__escapeKeyBubbles=x,u.current.__outsidePressBubbles=S;const L=new ut,X=Ke(f);function B(){D.clear(),O.current=!0}function $(){O.current=!0,D.start(on?5:0,()=>{O.current=!1})}function Q(){w.current=!0,L.start(0,()=>{w.current=!1})}function re(){E.current=!1,C.current=!1}function ee(){const H=P.current,G=H==="pen"||!H?"mouse":H,Se=y(),be=typeof Se=="function"?Se():Se;return typeof be=="string"?be:be[G]}function te(H){const G=ee();return G==="intentional"&&H.type!=="click"||G==="sloppy"&&H.type==="click"}function W(H){var be;const G=(be=u.current.floatingContext)==null?void 0:be.nodeId,Se=g&&Dt(g.nodesRef.current,G).some(ge=>{var V;return pr(H,(V=ge.context)==null?void 0:V.elements.floating)});return k(H)||Se}function ne(H){if(te(H)){H.type!=="click"&&!k(H)&&(L.clear(),w.current=!1),_();return}if(u.current.insideReactTree){_();return}const G=yt(H),Se=`[${wo("inert")}]`,be=me(G)?G.getRootNode():null,ge=Array.from((At(be)?be:Ke(e.select("floatingElement"))).querySelectorAll(Se)),V=e.context.triggerElements;if(G&&(V.hasElement(G)||V.hasMatchingElement(Z=>Te(Z,G))))return;let q=me(G)?G:null;for(;q&&!ct(q);){const Z=lt(q);if(ct(Z)||!me(Z))break;q=Z}if(!(ge.length&&me(G)&&!Kf(G)&&!Te(G,e.select("floatingElement"))&&ge.every(Z=>!Te(q,Z)))){if(_e(G)&&!("touches"in H)){const Z=ct(G),se=$e(G),ke=/auto|scroll/,Ce=Z||ke.test(se.overflowX),Ct=Z||ke.test(se.overflowY),st=Ce&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,Rt=Ct&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ze=se.direction==="rtl",Qe=Rt&&(Ze?H.offsetX<=G.offsetWidth-G.clientWidth:H.offsetX>G.clientWidth),ht=st&&H.offsetY>G.clientHeight;if(Qe||ht)return}if(!W(H)){if(ee()==="intentional"){if(H.detail!==0&&!Mf(H)&&!R.current)return;if(w.current){L.clear(),w.current=!1;return}}typeof m=="function"&&!m(H)||T("__outsidePressBubbles")||(e.setOpen(!1,Oe(rl,H)),_())}}}function oe(H){ee()!=="sloppy"||H.pointerType==="touch"||!e.select("open")||!n||k(H)||ne(H)}function ye(H){if(ee()!=="sloppy"||!e.select("open")||!n||k(H))return;const G=H.touches[0];G&&(M.current={startTime:Date.now(),startX:G.clientX,startY:G.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}function z(H,G){const Se=yt(H);if(!Se)return;const be=Ee(Se,H.type,()=>{G(H),be()})}function J(H){P.current="touch",z(H,ye)}function ce(H){F.clear(),H.type==="pointerdown"&&(H.button===0&&(R.current=!0),P.current=H.pointerType),!(H.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)&&z(H,G=>{G.type==="pointerdown"?oe(G):ne(G)})}function he(H){if(H.type==="pointercancel"&&(R.current=!1),!E.current)return;const G=C.current;if(re(),ee()==="intentional"){if(H.type==="pointercancel"){G&&Q();return}if(!W(H)){if(G){Q();return}typeof m=="function"&&!m(H)||(L.clear(),w.current=!0,_())}}}function Pe(H){if(ee()!=="sloppy"||!M.current||k(H))return;const G=H.touches[0];if(!G)return;const Se=Math.abs(G.clientX-M.current.startX),be=Math.abs(G.clientY-M.current.startY),ge=Math.sqrt(Se*Se+be*be);ge>5&&(M.current.dismissOnTouchEnd=!0),ge>10&&(ne(H),F.clear(),M.current=null)}function je(H){z(H,Pe)}function Re(H){ee()!=="sloppy"||!M.current||k(H)||(M.current.dismissOnTouchEnd&&ne(H),F.clear(),M.current=null)}function Me(H){z(H,Re)}const Be=at(r&&at(Ee(X,"keydown",j),Ee(X,"compositionstart",B),Ee(X,"compositionend",$)),b&&at(Ee(X,"click",ce,!0),Ee(X,"pointerdown",ce,!0),Ee(X,"pointerup",he,!0),Ee(X,"pointercancel",he,!0),Ee(X,"mousedown",ce,!0),Ee(X,"mouseup",he,!0),Ee(X,"touchstart",J,{capture:!0,passive:!0}),Ee(X,"touchmove",je,{capture:!0,passive:!0}),Ee(X,"touchend",Me,{capture:!0,passive:!0})));return()=>{Be(),L.clear(),re(),w.current=!1}},[u,f,r,b,m,l,n,x,S,j,_,y,T,k,g,e,F,D]);const le=v.useMemo(()=>({onKeyDown:j,onPointerDown:U,onClick:U}),[j,U]),ie=v.useMemo(()=>({onKeyDown:j,onPointerDown:K,onMouseDown:K,onClickCapture:N,onMouseDownCapture(L){N(),Y(L)},onPointerDownCapture(L){N(),Y(L)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[j,N,Y,K]);return v.useMemo(()=>n?{reference:le,floating:ie,trigger:le}:{},[n,le,ie])}function $n(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function Dd(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function ic(e){const t=[];let n,r=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of Array.from(e).sort((a,l)=>a.top-l.top)){if(r=Math.min(r,c.left),o=Math.min(o,c.top),s=Math.max(s,c.right),i=Math.max(i,c.bottom),!n||c.top-n.top>n.height/2)t.push(Dd(c));else{const a=t[t.length-1];a.left=Math.min(a.left,c.left),a.right=Math.max(a.right,c.right),a.bottom=Math.max(a.bottom,c.bottom),a.width=a.right-a.left,a.height=a.bottom-a.top}n=c}return{lines:t,fallback:$n(r,o,s,i)}}function cc(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function ys(e){return $n(e.left,e.top,e.right,e.bottom)}function Fd(e,t,n){const{lines:r}=ic(e.getClientRects());if(r.length<2)return;const o=cc(r,t,n);return{x:t,y:n,lineIndex:o===-1?void 0:o,element:e}}function Ld(e,t,n){const{lines:r,fallback:o}=ic(e.getClientRects());if(r.length<2)return null;const s=n==null?void 0:n.x,i=n==null?void 0:n.y,c=t[0];if((n==null?void 0:n.lineIndex)!=null&&r[n.lineIndex])return ys(r[n.lineIndex]);if(s!=null&&i!=null){const p=cc(r,s,i);if(p!==-1)return ys(r[p])}if(r.length===2&&r[0].left>r[1].right&&s!=null&&i!=null)return o;if(c==="t"||c==="b"){const p=r[0],m=r[r.length-1],b=c==="t"?p:m;return $n(b.left,p.top,b.right,m.bottom)}const a=c==="l";let l=r[0].left,f=r[0].right,u=a?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,d=r[0],g=r[0];for(const p of r){l=Math.min(l,p.left),f=Math.max(f,p.right);const m=a?p.left:p.right;a&&m<u||!a&&m>u?(u=m,d=p,g=p):m===u&&(g=p)}return $n(l,d.top,f,g.bottom)}function Bd(e){return"contextElement"in e&&e.contextElement?e.contextElement:me(e)?e:void 0}function Vd(e,t){function n(o){ac(e,o.currentTarget,o.clientX,o.clientY)}function r(o){t||n(o)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function ac(e,t,n,r){const o=Fd(t,n,r);return e.current=o,o}function $d(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Bd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Ld(n,t.placement,s);if(!i||typeof t.platform.getElementRects!="function")return{};const c=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return i}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===c.reference.x&&t.rects.reference.y===c.reference.y&&t.rects.reference.width===c.reference.width&&t.rects.reference.height===c.reference.height?{}:{reset:{rects:c}}}}}class Hd{constructor(t,n,r=!0){ae(this,"attachedStores",[]);ae(this,"attachedStoreValue",null);ae(this,"storeListeners",new Set);this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){if(this.attachedStores.push(t),this.setActiveStore(t),process.env.NODE_ENV!=="production"&&this.attachedStores.length>1){const n=this;(n.overlapWarningFrame??(n.overlapWarningFrame=Ne.create())).request(()=>{this.attachedStores.length>1&&console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.")})}return()=>{const n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){const n=this.attachedStore;if(n===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);return}let r;if(t){for(let o=this.attachedStores.length-1;o>=0&&!r;o-=1)r=this.attachedStores[o].context.triggerElements.getById(t);r??(r=this.fallbackStore.context.triggerElements.getById(t))}if(t&&!r){if(this.throwOnMissingTrigger)throw new Error(process.env.NODE_ENV!=="production"?`Base UI: ${this.componentName}Handle.open() was called with the trigger id "${t}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.`:wt(99,this.componentName,t,this.componentName));process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${t}". The popup will open, but the trigger will not be associated with it.`)}n.setOpen(!0,Oe(Pr,void 0,r))}closePopup(){const t=this.attachedStore;if(t===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);return}t.setOpen(!1,Oe(Pr))}}function Ud(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,c=t.useState("open"),a=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),f=i;return t.useSyncedValue("floatingId",o),pe(()=>{const u={open:c,floatingId:o,referenceElement:a,floatingElement:l};me(a)&&(u.domReferenceElement=a),r.state.positionReference===r.state.referenceElement&&(u.positionReference=a),r.update(u)},[c,o,a,l,r]),r.context.onOpenChange=f,r.context.nested=s,r}function zd(e){const{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:o,onUnmount:s,animateInitialOpen:i}=e,c=fe(o),{mounted:a,setMounted:l,transitionStatus:f}=yi(t,!1,!1,i),u=t?!1:r;pe(()=>{t&&c(!1)},[t,c]);const d=v.useRef(a),g=v.useRef(!1),p=gi(),m=()=>{d.current=!1,l(!1),s()};pe(()=>{d.current=a,g.current&&(g.current=!1,!t&&a&&m())});const b=fe(()=>{if(d.current){if(t){g.current=!0,p();return}m()}});return uo({enabled:a&&!t&&!u,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:f,preventUnmountingOnClose:u,forceUnmount:b}}const Wd={tabIndex:-1,[Ff]:""};function qd(e,t=!1){const n=Gn(),r=tr()!=null,o=Ye(()=>e(n,r)).current;return Ud({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Gd({handle:e,store:t}){return pe(()=>e.attachStore(t),[e,t]),null}function vs(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Kd(e,t){const n=v.useRef(null);return fe(r=>{const o=n.current;if(o!==null){if(o.element===r&&o.store===t&&o.id===e)return;n.current=null;const s=o.store;s.context.triggerElements.getById(o.id)===o.element&&(s.context.triggerElements.delete(o.id),vs(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),vs(t))})}function Yd(e,t,n,r=!1){let o=e.preventUnmountingOnClose;t?o=!1:r&&(o=!0);const s=(n==null?void 0:n.id)??null;let i=e.activeTriggerId,c=e.activeTriggerElement;return(s||t)&&(i=s,c=n??null),{open:t,preventUnmountingOnClose:o,activeTriggerId:i,activeTriggerElement:c,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Xd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Jd(e,t,n,r={}){var f,u,d;const o=n.reason,s=o===We,i=t&&o===On,c=!t&&(o===Kn||o===no),a=Xd(n);if((u=(f=e.context).onOpenChange)==null||u.call(f,t,n),n.isCanceled)return;(d=r.onBeforeDispatch)==null||d.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const g=Yd(e.state,t,n.trigger,a()),p={...r.extraState,...g};i?p.instantType="focus":c?p.instantType="dismiss":s&&(p.instantType=void 0),e.update(p)};s?dt.flushSync(l):l()}function Zd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Kd(e,n),i=fe(a=>{const l=n.select("open"),f=n.select("activeTriggerId");if(f===e){const u={activeTriggerElement:a,...l?r:null};n.update(u);return}if(f==null&&l&&!n.state.openedWithoutTrigger){const u={activeTriggerId:e??null,activeTriggerElement:a,...r};n.update(u)}}),c=fe(a=>{s(a),a&&i(a)});return pe(()=>(c(t.current),()=>c(null)),[c,t,n,e]),pe(()=>{if(o){const a={activeTriggerElement:t.current,...r};n.update(a)}},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function Qd(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=v.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");pe(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0),e.state.openedWithoutTrigger&&e.set("openedWithoutTrigger",!1);return}const a=e.context.triggerElements.size,l={};e.state.triggerCount!==a&&(l.triggerCount=a);const f=e.select("activeTriggerId");let u=null;if(f){const d=e.context.triggerElements.getById(f);if(d)r.current=f,d!==e.state.activeTriggerElement&&(l.activeTriggerElement=d);else{for(const[g,p]of e.context.triggerElements.entries())if(p===e.state.activeTriggerElement){l.activeTriggerId=g,l.activeTriggerElement=p,r.current=g;break}l.activeTriggerId===void 0&&(r.current===f?u=f:r.current=null)}}else r.current=null;if(!u&&!f&&!e.state.openedWithoutTrigger&&a===1){const d=e.context.triggerElements.entries().next();if(!d.done){const[g,p]=d.value;l.activeTriggerId=g,l.activeTriggerElement=p,r.current=g}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),u&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===u&&!e.context.triggerElements.getById(u)){const d=Oe(bi);e.setOpen(!1,d),d.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function ep(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=zd({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState("preventUnmountingOnClose"),setPreventUnmountOnClose:c=>t.set("preventUnmountingOnClose",c),animateInitialOpen:r,onUnmount(){var c,a;t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(a=(c=t.context).onOpenChangeComplete)==null||a.call(c,!1)}});return Ye(()=>(t.set("mounted",o),null)),t.useSyncedValues({mounted:o,transitionStatus:s}),{forceUnmount:i,transitionStatus:s}}function tp(e,t){e.useSyncedValues(t),pe(()=>()=>{e.update({activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe})},[e])}let _t;function np(e){_t??(_t=new WeakMap);let t=_t.get(e);return t||(t=new WeakMap,_t.set(e,t)),t}class lc{constructor(){ae(this,"idMap",new Map)}add(t,n){if(process.env.NODE_ENV!=="production"){const r=np(this),o=r.get(n);if(o!==void 0&&o!==t)throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");const s=this.idMap.get(t);s!==void 0&&s!==n&&r.delete(s),r.set(n,t)}this.idMap.set(t,n)}delete(t){var n;if(process.env.NODE_ENV!=="production"){const r=this.idMap.get(t);r!==void 0&&((n=_t==null?void 0:_t.get(this))==null||n.delete(r))}this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}var xn={exports:{}},mr={};/**
|
|
180
|
+
* @license React
|
|
181
|
+
* use-sync-external-store-shim.production.js
|
|
182
|
+
*
|
|
183
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the MIT license found in the
|
|
186
|
+
* LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/var xs;function rp(){if(xs)return mr;xs=1;var e=I;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(u,d){var g=d(),p=r({inst:{value:g,getSnapshot:d}}),m=p[0].inst,b=p[1];return s(function(){m.value=g,m.getSnapshot=d,a(m)&&b({inst:m})},[u,g,d]),o(function(){return a(m)&&b({inst:m}),u(function(){a(m)&&b({inst:m})})},[u]),i(g),g}function a(u){var d=u.getSnapshot;u=u.value;try{var g=d();return!n(u,g)}catch{return!0}}function l(u,d){return d()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return mr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,mr}var br={};/**
|
|
188
|
+
* @license React
|
|
189
|
+
* use-sync-external-store-shim.development.js
|
|
190
|
+
*
|
|
191
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the MIT license found in the
|
|
194
|
+
* LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/var Es;function op(){return Es||(Es=1,process.env.NODE_ENV!=="production"&&(function(){function e(g,p){return g===p&&(g!==0||1/g===1/p)||g!==g&&p!==p}function t(g,p){f||o.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!u){var b=p();s(m,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}b=i({inst:{value:m,getSnapshot:p}});var y=b[0].inst,x=b[1];return a(function(){y.value=m,y.getSnapshot=p,n(y)&&x({inst:y})},[g,m,p]),c(function(){return n(y)&&x({inst:y}),g(function(){n(y)&&x({inst:y})})},[g]),l(m),m}function n(g){var p=g.getSnapshot;g=g.value;try{var m=p();return!s(g,m)}catch{return!0}}function r(g,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=I,s=typeof Object.is=="function"?Object.is:e,i=o.useState,c=o.useEffect,a=o.useLayoutEffect,l=o.useDebugValue,f=!1,u=!1,d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;br.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),br}var Ss;function Oo(){return Ss||(Ss=1,process.env.NODE_ENV==="production"?xn.exports=rp():xn.exports=op()),xn.exports}var Po=Oo(),En={exports:{}},yr={};/**
|
|
196
|
+
* @license React
|
|
197
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
198
|
+
*
|
|
199
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the MIT license found in the
|
|
202
|
+
* LICENSE file in the root directory of this source tree.
|
|
203
|
+
*/var ws;function sp(){if(ws)return yr;ws=1;var e=I,t=Oo();function n(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,a=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(l,f,u,d,g){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function y(w){if(!x){if(x=!0,S=w,w=d(w),g!==void 0&&m.hasValue){var R=m.value;if(g(R,w))return E=R}return E=w}if(R=E,r(S,w))return R;var O=d(w);return g!==void 0&&g(R,O)?(S=w,R):(S=w,E=O)}var x=!1,S,E,C=u===void 0?null:u;return[function(){return y(f())},C===null?void 0:function(){return y(C())}]},[f,u,d,g]);var b=o(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=b},[b]),a(b),b},yr}var vr={};/**
|
|
204
|
+
* @license React
|
|
205
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
206
|
+
*
|
|
207
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the MIT license found in the
|
|
210
|
+
* LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/var Cs;function ip(){return Cs||(Cs=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=I,n=Oo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;vr.useSyncExternalStoreWithSelector=function(l,f,u,d,g){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function y(w){if(!x){if(x=!0,S=w,w=d(w),g!==void 0&&m.hasValue){var R=m.value;if(g(R,w))return E=R}return E=w}if(R=E,r(S,w))return R;var O=d(w);return g!==void 0&&g(R,O)?(S=w,R):(S=w,E=O)}var x=!1,S,E,C=u===void 0?null:u;return[function(){return y(f())},C===null?void 0:function(){return y(C())}]},[f,u,d,g]);var b=o(l,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=b},[b]),a(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var Rs;function cp(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?En.exports=sp():En.exports=ip()),En.exports}var ap=cp();const lp=ii(19),up=lp?dp:pp;function uc(e,t,n,r,o){return up(e,t,n,r,o)}function fp(e,t,n,r,o){const s=v.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Po.useSyncExternalStore(e.subscribe,s,s)}wf({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),Po.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function dp(e,t,n,r,o){const s=Sf();if(!s)return fp(e,t,n,r,o);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.value=t(e.getSnapshot(),n,r,o))):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(c)),c.value}function pp(e,t,n,r,o){return ap.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class hp{constructor(t){ae(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ae(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return uc(this,t,n,r,o)}}class Io extends hp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){v.useDebugValue(t);const r=this;pe(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;pe(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){v.useDebugValue(t,i=>Object.keys(i));const o=v.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,c)=>i!==s[c]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);pe(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){v.useDebugValue(t);const r=this,o=n!==void 0;if(pe(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o]),process.env.NODE_ENV!=="production"){const s=this.controlledValues??(this.controlledValues=new Map);s.has(t)||s.set(t,o);const i=s.get(t);i!==void 0&&i!==o&&console.error(`A component is changing the ${i?"":"un"}controlled state of ${t.toString()} to be ${i?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return v.useDebugValue(t),uc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){v.useDebugValue(t);const r=fe(n??eo);this.context[t]=r}useStateSetter(t){const n=v.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const gp={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class mp extends Io{constructor(n){const{syncOnly:r,nested:o,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:sc(),nested:o,triggerElements:i},gp);ae(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Df(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ae(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const o={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",o)});ae(this,"setOpen",(n,r)=>{var o,s,i,c;if(this.syncOnly){(s=(o=this.context).onOpenChange)==null||s.call(o,n,r);return}this.dispatchOpenChange(n,r),(c=(i=this.context).onOpenChange)==null||c.call(i,n,r)});this.syncOnly=r}}function bp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new mp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe}}const qt=e=>e.triggerIdProp??e.activeTriggerId,Hn=e=>e.openProp??e.open,Ts=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function fc(e,t){return t!==void 0&&Hn(e)&&qt(e)===t}function yp(e,t){return fc(e,t)?!0:t!==void 0&&Hn(e)&&qt(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}const vp={open:Hn,mounted:e=>e.mounted,transitionStatus:e=>Hn(e)&&!e.mounted?"starting":e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:qt,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Ts,isTriggerActive:(e,t)=>t!==void 0&&qt(e)===t,isOpenedByTrigger:(e,t)=>fc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&qt(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>yp(e,t)?Ts(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function xp(e){const t=v.useCallback(r=>e===void 0?eo:e.subscribeStore(r),[e]),n=v.useCallback(()=>e===void 0?void 0:e.store,[e]);return Po.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}const xr=qi&&on;function Ep(e,t={}){const{enabled:n=!0,delay:r}=t,{events:o,dataRef:s}=e.context,i=v.useRef(!1),c=v.useRef(null),a=v.useRef(!0),l=zt();v.useEffect(()=>{const u=e.select("domReferenceElement");if(!n)return;const d=Ie(u);function g(){const b=e.select("domReferenceElement");!e.select("open")&&_e(b)&&b===Br(Ke(b))&&(i.current=!0,c.current=b)}function p(){a.current=!0}function m(){a.current=!1}return at(Ee(d,"blur",g),xr&&Ee(d,"keydown",p,!0),xr&&Ee(d,"pointerdown",m,!0))},[e,n]),v.useEffect(()=>{if(!n)return;function u(d){if(d.reason===Kn||d.reason===no){const g=e.select("domReferenceElement");me(g)&&(c.current=g,i.current=!0)}}return o.on("openchange",u),()=>{o.off("openchange",u)}},[o,n,e]);const f=v.useMemo(()=>{function u(){i.current=!1,c.current=null}return{onMouseLeave(){u()},onFocus(d){const g=d.currentTarget;if(i.current){if(c.current===g)return;u()}const p=yt(d.nativeEvent);if(me(p)){if(xr&&!d.relatedTarget){if(!a.current&&!Yf(p))return}else if(!Jf(p))return}const m=Fn(d.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:y}=d;if(e.select("open")&&m||!r){e.setOpen(!0,Oe(On,b,y));return}l.start(r,()=>{i.current||e.setOpen(!0,Oe(On,b,y))})},onBlur(d){u();const g=d.relatedTarget,p=d.nativeEvent,m=me(g)&&g.hasAttribute(wo("focus-guard"))&&g.getAttribute("data-type")==="outside";l.start(0,()=>{var S;const b=e.select("domReferenceElement"),y=Br(Ke(b));!g&&y===b||Te((S=s.current.floatingContext)==null?void 0:S.refs.floating.current,y)||Te(b,y)||m||Fn(g??y,e.context.triggerElements)||e.setOpen(!1,Oe(On,p))})}}},[s,r,e,l]);return v.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}class _o{constructor(){ae(this,"pointerType");ae(this,"interactedInside",!1);ae(this,"handler");ae(this,"blockMouseMove",!0);ae(this,"performedPointerEventsMutation",!1);ae(this,"pointerEventsScopeElement",null);ae(this,"pointerEventsReferenceElement",null);ae(this,"pointerEventsFloatingElement",null);ae(this,"restTimeoutPending",!1);ae(this,"openChangeTimeout",new ut);ae(this,"restTimeout",new ut);ae(this,"handleCloseOptions");ae(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ae(this,"disposeEffect",()=>this.dispose)}static create(){return new _o}}const Un=new WeakMap;function zn(e){var n,r,o;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Un.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(o=e.pointerEventsFloatingElement)==null||o.style.removeProperty("pointer-events"),Un.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function dc(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Un.get(n);s&&s!==e&&zn(s),zn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Un.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function pc(e){const t=e.context.dataRef.current,n=Ye(()=>t.hoverInteractionState??_o.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),ro(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Sp(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s=e.useState("open"),i=e.useState("floatingElement"),c=e.useState("domReferenceElement"),{dataRef:a}=e.context,l=sn(),f=tr(),u=pc(e),d=zt(),g=fe(()=>{var b;return Yi((b=a.current.openEvent)==null?void 0:b.type,u.interactedInside)}),p=fe(()=>{var b;return Qf((b=a.current.openEvent)==null?void 0:b.type)}),m=fe(()=>{zn(u)});pe(()=>{s||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,m())},[s,u,m]),v.useEffect(()=>m,[m]),pe(()=>{var b,y,x,S,E;if(n&&s&&(b=u.handleCloseOptions)!=null&&b.blockPointerEvents&&p()&&me(c)&&i){const C=c,w=i,R=Ke(i),O=(x=(y=l==null?void 0:l.nodesRef.current.find(A=>A.id===f))==null?void 0:y.context)==null?void 0:x.elements.floating;O&&(O.style.pointerEvents="");const P=u.pointerEventsScopeElement!==w?u.pointerEventsScopeElement:null,M=O!==w?O:null,F=((E=(S=u.handleCloseOptions)==null?void 0:S.getScope)==null?void 0:E.call(S))??P??M??Vr(C,"[data-rootownerid]")??R.body;return dc(u,{scopeElement:F,referenceElement:C,floatingElement:w}),()=>{m()}}},[n,s,c,i,u,p,l,f,m]),v.useEffect(()=>{if(!n)return;function b(){return!!(l&&f&&Dt(l.nodesRef.current,f).length>0)}function y(R){const O=$r(r,"close",u.pointerType),P=()=>{e.setOpen(!1,Oe(We,R)),l==null||l.events.emit("floating.closed",R)};O?u.openChangeTimeout.start(O,P):(u.openChangeTimeout.clear(),P())}function x(R){const O=yt(R);if(!Xf(O)){u.interactedInside=!1;return}u.interactedInside=Vr(O,"[aria-haspopup]")!=null}function S(){u.openChangeTimeout.clear(),d.clear(),l==null||l.events.off("floating.closed",C),m()}function E(R){var F;if(b()&&l){l.events.on("floating.closed",C);return}if(Fn(R.relatedTarget,e.context.triggerElements))return;const O=((F=a.current.floatingContext)==null?void 0:F.nodeId)??o,P=R.relatedTarget;if(!(l&&O&&me(P)&&Dt(l.nodesRef.current,O,!1).some(A=>{var D;return Te((D=A.context)==null?void 0:D.elements.floating,P)}))){if(u.handler){u.handler(R);return}m(),p()&&!g()&&y(R)}}function C(R){!l||!f||b()||d.start(0,()=>{l.events.off("floating.closed",C),e.setOpen(!1,Oe(We,R)),l.events.emit("floating.closed",R)})}const w=i;return at(w&&Ee(w,"mouseenter",S),w&&Ee(w,"mouseleave",E),w&&Ee(w,"pointerdown",x,!0),()=>{l==null||l.events.off("floating.closed",C)})},[n,i,e,a,r,o,p,g,m,u,l,f,d])}const wp={current:null};function Cp(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:a=wp,externalTree:l,isActiveTrigger:f=!0,getHandleCloseContext:u,isClosing:d,shouldOpen:g,guardStaleOpen:p=!1}=t,{dataRef:m,events:b}=e.context,y=sn(l),x=pc(e),S=v.useRef(!1),E=qe(o),C=qe(r),w=qe(i),R=qe(n),O=qe(g),P=qe(d),M=fe(()=>{var T;return Yi((T=m.current.openEvent)==null?void 0:T.type,x.interactedInside)}),F=fe(()=>{var T;return((T=O.current)==null?void 0:T.call(O))!==!1}),A=fe((T,k,U)=>{const j=e.context.triggerElements;if(j.hasElement(k))return!T||!Te(T,k);if(!me(U))return!1;const N=U;return j.hasMatchingElement(Y=>Te(Y,N))&&(!T||!Te(T,N))}),D=fe(()=>{if(!x.handler)return;Ke(e.select("domReferenceElement")).removeEventListener("mousemove",x.handler),x.handler=void 0}),_=fe(()=>{zn(x)});return f&&(x.handleCloseOptions=o==null?void 0:o.__options),v.useEffect(()=>D,[D]),v.useEffect(()=>{if(!n)return;function T(k){k.open?S.current=!1:(S.current=k.reason===We,D(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}return b.on("openchange",T),()=>{b.off("openchange",T)}},[n,b,x,D]),v.useEffect(()=>{if(!n)return;function T(K,le=!0){const ie=$r(C.current,"close",x.pointerType);ie?x.openChangeTimeout.start(ie,()=>{e.setOpen(!1,Oe(We,K)),y==null||y.events.emit("floating.closed",K)}):le&&(x.openChangeTimeout.clear(),e.setOpen(!1,Oe(We,K)),y==null||y.events.emit("floating.closed",K))}const k=a.current??(f?e.select("domReferenceElement"):null);if(!me(k))return;function U(K){var z;if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,s&&!Lr(x.pointerType))return;const le=hs(w.current),ie=$r(C.current,"open",x.pointerType),L=yt(K),X=K.currentTarget??null,B=e.select("domReferenceElement");let $=X;if(me(L)&&!e.context.triggerElements.hasElement(L)){for(const J of e.context.triggerElements.elements())if(Te(J,L)){$=J;break}}me(X)&&me(B)&&!e.context.triggerElements.hasElement(X)&&Te(X,B)&&($=B);const Q=$==null?!1:A(B,$,L),re=e.select("open"),ee=((z=P.current)==null?void 0:z.call(P))??e.select("transitionStatus")==="ending",te=!re&&ee&&S.current,W=!Q&&me($)&&me(B)&&Te(B,$)&&te,ne=le>0&&!ie,oe=Q&&(re||te)||W,ye=!re||Q;if(oe){F()&&e.setOpen(!0,Oe(We,K,$));return}ne||(ie?x.openChangeTimeout.start(ie,()=>{ye&&F()&&e.setOpen(!0,Oe(We,K,$))}):ye&&F()&&e.setOpen(!0,Oe(We,K,$)))}function j(K){if(M()){_();return}D();const le=e.select("domReferenceElement"),ie=Ke(le);x.restTimeout.clear(),x.restTimeoutPending=!1;const L=m.current.floatingContext??(u==null?void 0:u());if(Fn(K.relatedTarget,e.context.triggerElements))return;if(E.current&&L){e.select("open")||x.openChangeTimeout.clear();const B=a.current;x.handler=E.current({...L,tree:y,x:K.clientX,y:K.clientY,onClose(){_(),D(),R.current&&!M()&&B===e.select("domReferenceElement")&&T(K,!0)}}),ie.addEventListener("mousemove",x.handler),x.handler(K);return}(x.pointerType==="touch"?!Te(e.select("floatingElement"),K.relatedTarget):!0)&&T(K)}function N(K){Te(k,K.relatedTarget)||(x.openChangeTimeout.clear(),x.restTimeout.clear(),x.restTimeoutPending=!1)}const Y=p?Ee(k,"mouseout",N):void 0;return c?at(Ee(k,"mousemove",U,{once:!0}),Ee(k,"mouseenter",U),Ee(k,"mouseleave",j),Y):at(Ee(k,"mouseenter",U),Ee(k,"mouseleave",j),Y)},[D,_,m,C,e,n,E,x,f,A,M,s,c,w,a,y,R,u,P,F,p]),v.useMemo(()=>{if(!n)return;function T(k){x.pointerType=k.pointerType}return{onPointerDown:T,onPointerEnter:T,onMouseMove(k){var L,X,B;const{nativeEvent:U}=k,j=k.currentTarget,N=e.select("domReferenceElement"),Y=e.select("open"),K=A(N,j,k.target);if(s&&!Lr(x.pointerType))return;if(Y&&K&&((L=x.handleCloseOptions)!=null&&L.blockPointerEvents)){const $=e.select("floatingElement");if($){const Q=((B=(X=x.handleCloseOptions)==null?void 0:X.getScope)==null?void 0:B.call(X))??j.ownerDocument.body;dc(x,{scopeElement:Q,referenceElement:j,floatingElement:$})}}const le=hs(w.current);if(Y&&!K||le===0||!K&&x.restTimeoutPending&&k.movementX**2+k.movementY**2<2)return;x.restTimeout.clear();function ie(){if(x.restTimeoutPending=!1,M())return;const $=e.select("open");!x.blockMouseMove&&(!$||K)&&F()&&e.setOpen(!0,Oe(We,U,j))}x.pointerType==="touch"?dt.flushSync(()=>{ie()}):K&&Y?ie():(x.restTimeoutPending=!0,x.restTimeout.start(le,ie))}}},[n,x,M,A,s,e,w,F])}const Os=.1,Rp=Os*Os,xe=.5;function Sn(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function wn(e,t,n,r,o,s,i,c,a,l){let f=!1;return Sn(e,t,n,r,o,s)&&(f=!f),Sn(e,t,o,s,i,c)&&(f=!f),Sn(e,t,i,c,a,l)&&(f=!f),Sn(e,t,a,l,n,r)&&(f=!f),f}function Tp(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Cn(e,t,n,r,o,s){const i=Math.min(n,o),c=Math.max(n,o),a=Math.min(r,s),l=Math.max(r,s);return e>=i&&e<=c&&t>=a&&t<=l}function Op(e={}){const{blockPointerEvents:t=!1}=e,n=new ut,r=({x:o,y:s,placement:i,elements:c,onClose:a,nodeId:l,tree:f})=>{const u=i==null?void 0:i.split("-")[0];let d=!1,g=null,p=null,m=typeof performance<"u"?performance.now():0;function b(x,S){const E=performance.now(),C=E-m;if(g===null||p===null||C===0)return g=x,p=S,m=E,!1;const w=x-g,R=S-p,O=w*w+R*R,P=C*C*Rp;return g=x,p=S,m=E,O<P}function y(){n.clear(),a()}return function(S){n.clear();const E=c.domReference,C=c.floating;if(!E||!C||u==null||o==null||s==null)return;const{clientX:w,clientY:R}=S,O=yt(S),P=S.type==="mouseleave",M=Te(C,O),F=Te(E,O);if(M&&(d=!0,!P))return;if(F&&(d=!1,!P)){d=!0;return}if(P&&me(S.relatedTarget)&&Te(C,S.relatedTarget))return;function A(){return!!(f&&Dt(f.nodesRef.current,l).length>0)}function D(){A()||y()}if(A())return;const _=E.getBoundingClientRect(),T=C.getBoundingClientRect(),k=o>T.right-T.width/2,U=s>T.bottom-T.height/2,j=T.width>_.width,N=T.height>_.height,Y=(j?_:T).left,K=(j?_:T).right,le=(N?_:T).top,ie=(N?_:T).bottom;if(u==="top"&&s>=_.bottom-1||u==="bottom"&&s<=_.top+1||u==="left"&&o>=_.right-1||u==="right"&&o<=_.left+1){D();return}let L=!1;switch(u){case"top":L=Cn(w,R,Y,_.top+1,K,T.bottom-1);break;case"bottom":L=Cn(w,R,Y,T.top+1,K,_.bottom-1);break;case"left":L=Cn(w,R,T.right-1,ie,_.left+1,le);break;case"right":L=Cn(w,R,_.right-1,ie,T.left+1,le);break}if(L)return;if(d&&!Tp(w,R,_)){D();return}if(!P&&b(w,R)){D();return}let X=!1;switch(u){case"top":{const B=j?xe/2:xe*4,$=j||k?o+B:o-B,Q=j?o-B:k?o+B:o-B,re=s+xe+1,ee=k||j?T.bottom-xe:T.top,te=k?j?T.bottom-xe:T.top:T.bottom-xe;X=wn(w,R,$,re,Q,re,T.left,ee,T.right,te);break}case"bottom":{const B=j?xe/2:xe*4,$=j||k?o+B:o-B,Q=j?o-B:k?o+B:o-B,re=s-xe,ee=k||j?T.top+xe:T.bottom,te=k?j?T.top+xe:T.bottom:T.top+xe;X=wn(w,R,$,re,Q,re,T.left,ee,T.right,te);break}case"left":{const B=N?xe/2:xe*4,$=N||U?s+B:s-B,Q=N?s-B:U?s+B:s-B,re=o+xe+1,ee=U||N?T.right-xe:T.left,te=U?N?T.right-xe:T.left:T.right-xe;X=wn(w,R,ee,T.top,te,T.bottom,re,$,re,Q);break}case"right":{const B=N?xe/2:xe*4,$=N||U?s+B:s-B,Q=N?s-B:U?s+B:s-B,re=o-xe,ee=U||N?T.left+xe:T.right,te=U?N?T.left+xe:T.right:T.left+xe;X=wn(w,R,re,$,re,Q,ee,T.top,te,T.bottom);break}}X?d||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function Ps(e,t,n){let{reference:r,floating:o}=e;const s=Ue(t),i=So(t),c=Eo(i),a=Ve(t),l=s==="y",f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let g;switch(a){case"top":g={x:f,y:r.y-o.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:u};break;case"left":g={x:r.x-o.width,y:u};break;default:g={x:r.x,y:r.y}}const p=Je(t);return p&&(g[i]+=d*(p==="end"?1:-1)*(n&&l?-1:1)),g}async function Pp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:g=0}=ft(t,e),p=Ji(g),b=c[d?u==="floating"?"reference":"floating":u],y=Vn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),x=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),E=await(s.isElement==null?void 0:s.isElement(S))&&await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1},C=Vn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:S,strategy:a}):x);return{top:(y.top-C.top+p.top)/E.y,bottom:(C.bottom-y.bottom+p.bottom)/E.y,left:(y.left-C.left+p.left)/E.x,right:(C.right-y.right+p.right)/E.x}}const Ip=50,_p=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Pp},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=Ps(l,r,a),d=r,g=0;const p={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:y,fn:x}=b,{x:S,y:E,data:C,reset:w}=await x({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:l,platform:c,elements:{reference:e,floating:t}});f=S??f,u=E??u,p[y]={...p[y],...C},w&&g<Ip&&(g++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(l=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:f,y:u}=Ps(l,d,a)),m=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:p}},kp=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...b}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ve(o),x=Ue(c),S=Ve(c)===c,E=await(a.isRTL==null?void 0:a.isRTL(l.floating)),C=d||(S||!m?[Bn(c)]:od(c)),w=p!=="none";!d&&w&&C.push(...ad(c,m,p,E));const R=[c,...C],O=await a.detectOverflow(t,b),P=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&P.push(O[y]),u){const _=rd(o,i,E);P.push(O[_[0]],O[_[1]])}if(M=[...M,{placement:o,overflows:P}],!P.every(_=>_<=0)){var F,A;const _=(((F=s.flip)==null?void 0:F.index)||0)+1,T=R[_];if(T&&(!(u==="alignment"?x!==Ue(T):!1)||M.every(j=>Ue(j.placement)===x?j.overflows[0]>0:!0)))return{data:{index:_,overflows:M},reset:{placement:T}};let k=(A=M.filter(U=>U.overflows[0]<=0).sort((U,j)=>U.overflows[1]-j.overflows[1])[0])==null?void 0:A.placement;if(!k)switch(g){case"bestFit":{var D;const U=(D=M.filter(j=>{if(w){const N=Ue(j.placement);return N===x||N==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(N=>N>0).reduce((N,Y)=>N+Y,0)]).sort((j,N)=>j[1]-N[1])[0])==null?void 0:D[0];U&&(k=U);break}case"initialPlacement":k=c;break}if(o!==k)return{reset:{placement:k}}}return{}}}},hc=new Set(["left","top"]);async function Ap(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=Je(n),a=Ue(n)==="y",l=hc.has(i)?-1:1,f=s&&a?-1:1,u=ft(t,e);let{mainAxis:d,crossAxis:g,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(g=c==="end"?p*-1:p),a?{x:g*f,y:d*l}:{x:d*l,y:g*f}}const Np=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await Ap(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},jp=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:S,y:E}=x;return{x:S,y:E}}},...l}=ft(e,t),f={x:n,y:r},u=await s.detectOverflow(t,l),d=Ue(o),g=xo(d);let p=f[g],m=f[d];const b=(x,S)=>Xi(S+u[x==="y"?"top":"left"],S,S-u[x==="y"?"bottom":"right"]);i&&(p=b(g,p)),c&&(m=b(d,m));const y=a.fn({...t,[g]:p,[d]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[g]:i,[d]:c}}}}}},Mp=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:c,middlewareData:a}=t,{offset:l=0,mainAxis:f=!0,crossAxis:u=!0}=ft(e,t),d={x:o,y:s},g=Ue(i),p=xo(g);let m=d[p],b=d[g];const y=ft(l,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(f){const C=p==="y"?"height":"width",w=c.reference[p]-c.floating[C]+x.mainAxis,R=c.reference[p]+c.reference[C]-x.mainAxis;m<w?m=w:m>R&&(m=R)}if(u){var S,E;const C=p==="y"?"width":"height",w=hc.has(Ve(i)),R=c.reference[g]-c.floating[C]+(w&&((S=a.offset)==null?void 0:S[g])||0)+(w?0:x.crossAxis),O=c.reference[g]+c.reference[C]+(w?0:((E=a.offset)==null?void 0:E[g])||0)-(w?x.crossAxis:0);b<R?b=R:b>O&&(b=O)}return{[p]:m,[g]:b}}}},Dp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=ft(e,t),a=await o.detectOverflow(t,c),l=Ve(n),f=Je(n),u=Ue(n)==="y",{width:d,height:g}=r.floating;let p,m;l==="top"||l==="bottom"?(p=l,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,p=f==="end"?"top":"bottom");const b=g-a.top-a.bottom,y=d-a.left-a.right,x=Mt(g-a[p],b),S=Mt(d-a[m],y),E=t.middlewareData.shift,C=!E;let w=x,R=S;E!=null&&E.enabled.x&&(R=y),E!=null&&E.enabled.y&&(w=b),C&&!f&&(u?R=d-2*nt(a.left,a.right):w=g-2*nt(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:w});const O=await o.getDimensions(s.floating);return d!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function gc(e){const t=$e(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=_e(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Ln(n)!==s||Ln(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function ko(e){return me(e)?e:e.contextElement}function kt(e){const t=ko(e);if(!_e(t))return rt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=gc(t);let i=(s?Ln(n.width):n.width)/r,c=(s?Ln(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Fp=rt(0);function mc(e){const t=Ie(e);return!lo()||!t.visualViewport?Fp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ie(e)}function St(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ko(e);let i=rt(1);t&&(r?me(r)&&(i=kt(r)):i=kt(e));const c=Lp(s,n,r)?mc(s):rt(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,f=o.width/i.x,u=o.height/i.y;if(s&&r){const d=Ie(s),g=me(r)?Ie(r):r;let p=d,m=Ir(p);for(;m&&g!==p;){const b=kt(m),y=m.getBoundingClientRect(),x=$e(m),S=y.left+(m.clientLeft+parseFloat(x.paddingLeft))*b.x,E=y.top+(m.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,f*=b.x,u*=b.y,a+=S,l+=E,p=Ie(m),m=Ir(p)}}return Vn({width:f,height:u,x:a,y:l})}function nr(e,t){const n=Zn(e).scrollLeft;return t?t.left+n:St(ot(e)).left+n}function bc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-nr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Bp(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ot(r),c=t?Jn(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=rt(1);const f=rt(0),u=_e(r);if((u||!s)&&((Le(r)!=="body"||Xn(i))&&(a=Zn(r)),u)){const g=St(r);l=kt(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const d=i&&!u&&!s?bc(i,a):rt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+f.x+d.x,y:n.y*l.y-a.scrollTop*l.y+f.y+d.y}}function Vp(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $p(e){const t=Zn(e),n=e.ownerDocument.body,r=nt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=nt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+nr(e);const i=-t.scrollTop;return $e(n).direction==="rtl"&&(s+=nt(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Hp=25;function Up(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Ie(e),s=ot(e),i=o.visualViewport;let c=s.clientWidth,a=s.clientHeight,l=0,f=0;if(i){const d=!lo()||t==="fixed";r?d||(l=-i.offsetLeft,f=-i.offsetTop):(c=i.width,a=i.height,d&&(l=i.offsetLeft,f=i.offsetTop))}if(nr(s)<=0){const d=s.ownerDocument,g=d.body,p=getComputedStyle(g),m=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(s.clientWidth-g.clientWidth-m),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;y<=Hp&&(c-=y)}return{width:c,height:a,x:l,y:f}}function zp(e,t){const n=St(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=kt(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function Is(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Up(e,n,t);else if(t==="document")r=$p(ot(e));else if(me(t))r=zp(t,n);else{const o=mc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Vn(r)}function Wp(e,t){const n=t.get(e);if(n)return n;let r=Gt(e,[],!1).filter(c=>me(c)&&Le(c)!=="body"),o=null;const s=$e(e).position==="fixed";let i=s?lt(e):e;for(;me(i)&&!ct(i);){const c=$e(i),a=ao(i),l=o?o.position:s?"fixed":"";!a&&(l==="fixed"||l==="absolute"&&c.position==="static")?r=r.filter(u=>u!==i):o=c,i=lt(i)}return t.set(e,r),r}function qp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:Wp(t,this._c):[].concat(n),r],c=Is(t,i[0],o);let a=c.top,l=c.right,f=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const g=Is(t,i[d],o);a=nt(g.top,a),l=Mt(g.right,l),f=Mt(g.bottom,f),u=nt(g.left,u)}return{width:l-u,height:f-a,x:u,y:a}}function Gp(e){const{width:t,height:n}=gc(e);return{width:t,height:n}}function Kp(e,t,n){const r=_e(t),o=ot(t),s=n==="fixed",i=St(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=rt(0);if((r||!s)&&((Le(t)!=="body"||Xn(o))&&(c=Zn(t)),r)){const d=St(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}!r&&o&&(a.x=nr(o));const l=o&&!r&&!s?bc(o,c):rt(0),f=i.left+c.scrollLeft-a.x-l.x,u=i.top+c.scrollTop-a.y-l.y;return{x:f,y:u,width:i.width,height:i.height}}function Er(e){return $e(e).position==="static"}function _s(e,t){if(!_e(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ot(e)===n&&(n=n.ownerDocument.body),n}function yc(e,t){const n=Ie(e);if(Jn(e))return n;if(!_e(e)){let o=lt(e);for(;o&&!ct(o);){if(me(o)&&!Er(o))return o;o=lt(o)}return n}let r=_s(e,t);for(;r&&xl(r)&&Er(r);)r=_s(r,t);return r&&ct(r)&&Er(r)&&!ao(r)?n:r||wl(e)||n}const Yp=async function(e){const t=this.getOffsetParent||yc,n=this.getDimensions,r=await n(e.floating);return{reference:Kp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xp(e){return $e(e).direction==="rtl"}const Jp={convertOffsetParentRelativeRectToViewportRelativeRect:Bp,getDocumentElement:ot,getClippingRect:qp,getOffsetParent:yc,getElementRects:Yp,getClientRects:Vp,getDimensions:Gp,getScale:kt,isElement:me,isRTL:Xp};function vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zp(e,t,n){let r=null,o;const s=ot(e);function i(){var f;clearTimeout(o),(f=r)==null||f.disconnect(),r=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),i();const d=e.getBoundingClientRect(),{left:g,top:p,width:m,height:b}=d;if(f||t(),!m||!b)return;const y=vn(p),x=vn(s.clientWidth-(g+m)),S=vn(s.clientHeight-(p+b)),E=vn(g),w={rootMargin:-y+"px "+-x+"px "+-S+"px "+-E+"px",threshold:nt(0,Mt(1,u))||1};let R=!0;function O(P){const M=P[0].intersectionRatio;if(!vc(d,e.getBoundingClientRect()))return c();if(M!==u){if(!R)return c();M?c(!1,M):o=setTimeout(()=>{c(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(O,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(O,w)}r.observe(e)}const a=Ie(e),l=()=>c(n);return a.addEventListener("resize",l),c(!0),()=>{a.removeEventListener("resize",l),i()}}function ks(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=ko(e),f=o||s?[...l?Gt(l):[],...t?Gt(t):[]]:[];f.forEach(y=>{o&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const u=l&&c?Zp(l,n,s):null;let d=-1,g=null;i&&(g=new ResizeObserver(y=>{let[x]=y;x&&x.target===l&&g&&t&&(g.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),l&&!a&&g.observe(l),t&&g.observe(t));let p,m=a?St(e):null;a&&b();function b(){const y=St(e);m&&!vc(m,y)&&n(),m=y,p=requestAnimationFrame(b)}return n(),()=>{var y;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),u==null||u(),(y=g)==null||y.disconnect(),g=null,a&&cancelAnimationFrame(p)}}const Qp=Np,eh=jp,th=kp,nh=Dp,rh=Mp,oh=(e,t,n)=>{const r=new Map,o=n??{},s={...Jp,...o.platform,_c:r};return _p(e,t,{...o,platform:s})};var sh=typeof document<"u",ih=function(){},_n=sh?I.useLayoutEffect:ih;function Wn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Wn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function As(e,t){const n=xc(e);return Math.round(t*n)/n}function Sr(e){const t=v.useRef(e);return _n(()=>{t.current=e}),t}function ch(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[f,u]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,g]=v.useState(r);Wn(d,r)||g(r);const[p,m]=v.useState(null),[b,y]=v.useState(null),x=v.useCallback(j=>{j!==w.current&&(w.current=j,m(j))},[]),S=v.useCallback(j=>{j!==R.current&&(R.current=j,y(j))},[]),E=s||p,C=i||b,w=v.useRef(null),R=v.useRef(null),O=v.useRef(f),P=a!=null,M=Sr(a),F=Sr(o),A=Sr(l),D=v.useCallback(()=>{if(!w.current||!R.current)return;const j={placement:t,strategy:n,middleware:d};F.current&&(j.platform=F.current),oh(w.current,R.current,j).then(N=>{const Y={...N,isPositioned:A.current!==!1};_.current&&!Wn(O.current,Y)&&(O.current=Y,dt.flushSync(()=>{u(Y)}))})},[d,t,n,F,A]);_n(()=>{l===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(j=>({...j,isPositioned:!1})))},[l]);const _=v.useRef(!1);_n(()=>(_.current=!0,()=>{_.current=!1}),[]),_n(()=>{if(E&&(w.current=E),C&&(R.current=C),E&&C){if(M.current)return M.current(E,C,D);D()}},[E,C,D,M,P]);const T=v.useMemo(()=>({reference:w,floating:R,setReference:x,setFloating:S}),[x,S]),k=v.useMemo(()=>({reference:E,floating:C}),[E,C]),U=v.useMemo(()=>{const j={position:n,left:0,top:0};if(!k.floating)return j;const N=As(k.floating,f.x),Y=As(k.floating,f.y);return c?{...j,transform:"translate("+N+"px, "+Y+"px)",...xc(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:Y}},[n,c,k.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:D,refs:T,elements:k,floatingStyles:U}),[f,D,T,k,U])}const ah=(e,t)=>{const n=Qp(e);return{name:n.name,fn:n.fn,options:[e,t]}},lh=(e,t)=>{const n=eh(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh=(e,t)=>({fn:rh(e).fn,options:[e,t]}),fh=(e,t)=>{const n=th(e);return{name:n.name,fn:n.fn,options:[e,t]}},dh=(e,t)=>{const n=nh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ao=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ao.displayName="PreviewCardRootContext");function cn(e){const t=v.useContext(Ao);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardRootContext is missing. PreviewCard parts must be placed within <PreviewCard.Root>.":wt(50));return t}class ph extends Io{setState(t){}update(t){}set(t,n){}notifyAll(){}}const hh=600,Ec=300,Sc={...vp,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class gh extends Io{constructor(n,r,o){const s=new lc;super(wc(n,s,r,o),Cc(s),Sc);ae(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;Jd(this,n,r,{onBeforeDispatch(){var i;const s=r.event;n&&r.reason===We&&r.trigger&&"clientX"in s&&"clientY"in s&&((i=o.current)==null?void 0:i.element)!==r.trigger&&ac(o,r.trigger,s.clientX,s.clientY)}})})}}function mh(){const e=new lc;return new ph(Object.freeze(wc(void 0,e)),Object.freeze(Cc(e)),Sc)}function wc(e,t,n,r=!1){return{...bp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Ec,...e}}function Cc(e){return{popupRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function Ns(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:o,actionsRef:s,handle:i,triggerId:c,defaultTriggerId:a=null,children:l}=e,f=qd((y,x)=>new gh({open:n,openProp:t,activeTriggerId:a,triggerIdProp:c},y,x));f.useControlledProp("openProp",t),f.useControlledProp("triggerIdProp",c),f.useContextCallback("onOpenChange",r),f.useContextCallback("onOpenChangeComplete",o);const u=f.useState("open"),d=f.useState("activeTriggerId"),g=f.useState("mounted"),p=f.useState("payload");Qd(f,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:m}=ep(u,f,()=>{f.context.inlineRectCoordsRef.current=void 0});pe(()=>{u&&d==null&&f.set("payload",void 0)},[f,d,u]),v.useImperativeHandle(s,()=>({unmount:m,close:()=>f.setOpen(!1,Oe(Pr))}),[m,f]);const b=u||g||i!=null;return h.jsxs(Ao.Provider,{value:f,children:[i&&h.jsx(Gd,{handle:i,store:f}),b&&h.jsx(bh,{store:f}),typeof l=="function"?l({payload:p}):l]})}function bh({store:e}){const t=e.useState("floatingRootContext"),n=Md(t);return tp(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Rc=zi(function(t){return cn(!0)?h.jsx(Ns,{...t}):h.jsx(Ad,{children:h.jsx(Ns,{...t})})});process.env.NODE_ENV!=="production"&&(Rc.displayName="PreviewCardRoot");const No=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(No.displayName="PreviewCardPortalContext");function yh(){const e=v.useContext(No);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Portal> is missing.":wt(48));return e}const Tc=v.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:c,...a}=t,{node:l,subtree:f}=oc({container:o,ref:n,componentProps:t,elementProps:a});return!f&&!l?null:h.jsxs(v.Fragment,{children:[f,l&&dt.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Tc.displayName="FloatingPortalLite");const Oc=v.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return cn().useState("mounted")||r?h.jsx(No.Provider,{value:r,children:h.jsx(Tc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardPortal");const Pc=Cf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:f,...u}=t,d=cn(!0),p=xp(l)??d;if(!p)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Trigger> must be either used within a <PreviewCard.Root> component or provided with a handle.":wt(89));const m=mi(c),b=p.useState("isTriggerActive",m),y=p.useState("isOpenedByTrigger",m),x=p.useState("floatingRootContext"),S=p.context.inlineRectCoordsRef,E=v.useRef(null),C=s??hh,w=i??Ec,{registerTrigger:R,isMountedByThisTrigger:O}=Zd(m,E,p,{payload:a,closeDelay:w}),P=Cp(x,{mouseOnly:!0,move:!1,handleClose:Op(),delay:()=>({open:C,close:w}),triggerElementRef:E,isActiveTrigger:b,isClosing:()=>p.select("transitionStatus")==="ending"}),M=Ep(x,{delay:C}),F={open:y},A=p.useState("triggerProps",O),D=Vd(S,y);return pt("a",t,{state:F,ref:[n,R,E],props:[P,M.reference,A,D,{id:m},u],stateAttributesMapping:qf})});process.env.NODE_ENV!=="production"&&(Pc.displayName="PreviewCardTrigger");const jo=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPositionerContext");function vh(){const e=v.useContext(jo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardPositionerContext is missing. PreviewCardPositioner parts must be placed within <PreviewCard.Positioner>.":wt(49));return e}function xh(e){const{nodeId:t,externalTree:n,rootContext:r}=e,o=r.useState("referenceElement"),s=r.useState("floatingElement"),i=r.useState("domReferenceElement"),c=r.useState("open"),a=r.useState("floatingId"),[l,f]=v.useState(null),u=v.useRef(null),d=sn(n),g=v.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),p=ch({...e,elements:{...g,...l&&{reference:l}}}),m=v.useCallback(S=>{const E=me(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(E),p.refs.setReference(E)},[p.refs]),b=v.useMemo(()=>({...p.refs,setPositionReference:m,domReference:u}),[p.refs,m]),y=v.useMemo(()=>({...p.elements,domReference:i}),[p.elements,i]),x=v.useMemo(()=>({...p,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:a,refs:b,elements:y,nodeId:t,rootStore:r}),[p,b,y,t,r,c,a]);return pe(()=>{i&&(u.current=i)},[i]),pe(()=>{r.context.dataRef.current.floatingContext=x;const S=d==null?void 0:d.nodesRef.current.find(E=>E.id===t);S&&(S.context=x)}),v.useMemo(()=>({...p,context:x,refs:b,elements:y,rootStore:r}),[p,b,y,x,r])}const Ic=v.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ic.displayName="DirectionContext");function Eh(){const e=v.useContext(Ic);return(e==null?void 0:e.direction)??"ltr"}const Sh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:f=0}=ft(e,t)||{};if(l==null)return{};const u=Ji(f),d={x:n,y:r},g=So(o),p=Eo(g),m=await i.getDimensions(l),b=g==="y",y=b?"top":"left",x=b?"bottom":"right",S=b?"clientHeight":"clientWidth",E=s.reference[p]+s.reference[g]-d[g]-s.floating[p],C=d[g]-s.reference[g],w=c.floating[S]||s.floating[p],R=E/2-C/2,O=w/2-m[p]/2-1,P=Math.min(u[y],O),M=Math.min(u[x],O),F=P,A=w-m[p]-M,D=w/2-m[p]/2+R,_=Xi(F,D,A),T=!a.arrow&&Je(o)!=null&&D!==_&&s.reference[p]/2-(D<F?P:M)-m[p]/2<0,k=T?D<F?D-F:D-A:0;return{[g]:d[g]+k,data:{[g]:_,centerOffset:D-_-k,...T&&{alignmentOffset:k}},reset:T}}}),wh=(e,t)=>{const{name:n,fn:r}=Sh(e);return{name:n,fn:r,options:[e,t]}},Ch={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},Rh={sideX:"left",sideY:"top"},Th="--available-width",Oh="--available-height",Ph="--anchor-width",Ih="--anchor-height",_h="--transform-origin",js=Th,Ms=Oh;function _c(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ds(e,t,n){const{rects:r,placement:o}=e;return{side:_c(t,Ve(o),n),align:Je(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function kh(e){return Ah(e,xh)}function Ah(e,t){var Vt,ln;const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:a,collisionPadding:l=5,sticky:f=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:g,keepMounted:p=!1,floatingRootContext:m,mounted:b,collisionAvoidance:y,shift:x,nodeId:S,adaptiveOrigin:E,lazyFlip:C=!1,externalTree:w}=e,R=y.side||"flip",O=y.align||"flip",P=y.fallbackAxisSide||"end",M=(x==null?void 0:x.crossAxis)??!1,F=x==null?void 0:x.rootBoundary,A=typeof n=="function"?n:void 0,D=fe(A),_=A?D:n,T=qe(n),k=qe(b),j=Eh()==="rtl",[N,Y]=v.useState(null);!b&&N!==null&&Y(null);const K=C==="placement",le=N?Ve(N):null,ie=N&&K?Je(N)||"center":null,L=le||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":j?"left":"right","inline-start":j?"right":"left"}[o],X=ie||i,B=X==="center"?L:`${L}-${X}`;let $=l;typeof $=="number"?$={top:$,right:$,bottom:$,left:$}:$&&($={top:$.top||0,right:$.right||0,bottom:$.bottom||0,left:$.left||0});const Q=1,re=o==="bottom"?Q:0,ee=o==="top"?Q:0,te=o==="right"?Q:0,W=o==="left"?Q:0,ne={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:$},oe=v.useRef(null),ye=qe(s),z=qe(c),J=typeof s!="function"?s:0,ce=typeof c!="function"?c:0,he=[];g&&he.push(g),he.push(ah(de=>{const Ae=Ds(de,o,j),He=typeof ye.current=="function"?ye.current(Ae):ye.current,De=typeof z.current=="function"?z.current(Ae):z.current;return{mainAxis:He,crossAxis:De,alignmentAxis:De}},[J,ce,j,o]));const Pe=O==="none"&&R!=="shift",je=!Pe&&(f||M||R==="shift"),Re=R==="none"?null:fh({...ne,padding:{top:$.top+Q+re,right:$.right+Q+W,bottom:$.bottom+Q+ee,left:$.left+Q+te},mainAxis:!M&&R==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),Me=Pe?null:lh({...ne,rootBoundary:F,mainAxis:O!=="none",crossAxis:je,limiter:f||M?void 0:uh(de=>{if(!oe.current)return{};const{width:Ae,height:He}=oe.current.getBoundingClientRect(),De=Ue(Ve(de.placement)),Xe=De==="y"?Ae:He,ze=De==="y"?$.left+$.right:$.top+$.bottom;return{offset:Xe/2+ze/2}})},[ne,f,M,F,$,O]);R==="shift"||O==="shift"||X==="center"?he.push(Me,Re):he.push(Re,Me),he.push(dh({...ne,apply({elements:{floating:de},availableWidth:Ae,availableHeight:He,rects:De}){if(!k.current)return;const Xe=de.style;Xe.setProperty(js,`${Ae}px`),Xe.setProperty(Ms,`${He}px`);const ze=Ie(de).devicePixelRatio||1,{x:un,y:Tt,width:fn,height:it}=De.reference,et=(Math.round((un+fn)*ze)-Math.round(un*ze))/ze,$t=(Math.round((Tt+it)*ze)-Math.round(Tt*ze))/ze;Xe.setProperty(Ph,`${et}px`),Xe.setProperty(Ih,`${$t}px`)}}),wh(de=>({element:oe.current||Ke(de.elements.floating).createElement("div"),padding:oe.current?u:0}),[u]),{name:"transformOrigin",fn(de){var Lo,Bo,Vo,$o,Ho,Uo;const{elements:{floating:Ae},middlewareData:He,placement:De,platform:Xe,rects:ze,y:un}=de,Tt=Ve(De),fn=Je(De),it=Ue(Tt)==="y",et=oe.current,$t=typeof s=="function"?s(Ds(de,o,j)):s;let dn;if(!et&&fn&&Math.abs(it?((Lo=He.shift)==null?void 0:Lo.x)||0:((Bo=He.shift)==null?void 0:Bo.y)||0)<=1)dn=fn==="start"===(it&&((Vo=Xe.isRTL)==null?void 0:Vo.call(Xe,Ae))===!0)?"100%":"0%";else{const $c=it?(($o=He.arrow)==null?void 0:$o.x)||0:((Ho=He.arrow)==null?void 0:Ho.y)||0,Hc=it?(et==null?void 0:et.clientWidth)||0:(et==null?void 0:et.clientHeight)||0;dn=`${$c+Hc/2}px`}let rr=Tt==="top"||Tt==="left"?`calc(100% + ${$t}px)`:`${-$t}px`;return je&&it&&Math.abs(((Uo=He.shift)==null?void 0:Uo.y)||0)>$t&&(rr=`${ze.reference.y+ze.reference.height/2-un}px`),Ae.style.setProperty(_h,it?`${dn} ${rr}`:`${rr} ${dn}`),{}}},Ch,E),pe(()=>{!b&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,m]);const Be=v.useMemo(()=>({ancestorScroll:!d,elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:H,elements:G,x:Se,y:be,middlewareData:ge,update:V,placement:q,context:Z,isPositioned:se,floatingStyles:ke}=t({rootContext:m,open:p?b:void 0,placement:B,middleware:he,strategy:r,whileElementsMounted:p?void 0:(...de)=>ks(...de,Be),nodeId:S,externalTree:w}),{sideX:Ce,sideY:Ct}=ge.adaptiveOrigin||Rh,st=se?r:"fixed",Rt=v.useMemo(()=>{let de;return se?E?de={position:st,[Ce]:Se,[Ct]:be}:de={...ke,position:st}:de={position:st,top:0,left:0},de[js]="100vw",de[Ms]="100vh",se||(de.opacity=0),de},[E,st,Ce,Se,Ct,be,ke,se]),Ze=v.useRef(null);pe(()=>{if(!b)return;const de=T.current,Ae=typeof de=="function"?de():de,De=(Fs(Ae)?Ae.current:Ae)||null||null;De!==Ze.current&&(H.setPositionReference(De),Ze.current=De)},[b,H,_,T]),v.useEffect(()=>{if(!b)return;const de=T.current;typeof de!="function"&&Fs(de)&&de.current!==Ze.current&&(H.setPositionReference(de.current),Ze.current=de.current)},[b,H,_,T]),v.useEffect(()=>{if(p&&b&&G.reference&&G.floating)return ks(G.reference,G.floating,V,Be)},[p,b,G,V,Be]);const Qe=Ve(q),ht=_c(o,Qe,j),gt=Je(q)||"center",Lt=!!((Vt=ge.hide)!=null&&Vt.referenceHidden);pe(()=>{C&&b&&se&&(Qe!==L||K&>!==X)&&Y(q)},[C,K,b,se,q,Qe,gt,L,X]);const an=v.useMemo(()=>{var de,Ae;return{position:"absolute",top:(de=ge.arrow)==null?void 0:de.y,left:(Ae=ge.arrow)==null?void 0:Ae.x}},[ge.arrow]),Bt=((ln=ge.arrow)==null?void 0:ln.centerOffset)!==0;return v.useMemo(()=>({positionerStyles:Rt,arrowStyles:an,arrowRef:oe,arrowUncentered:Bt,side:ht,align:gt,physicalSide:Qe,anchorHidden:Lt,refs:H,context:Z,isPositioned:se,update:V}),[Rt,an,oe,Bt,ht,gt,Qe,Lt,H,Z,se,V])}function Fs(e){return e!=null&&"current"in e}function kc(e){return e==="starting"?wd:Fe}function Nh(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),pt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},kc(r),o],stateAttributesMapping:Ki})}const Ac=v.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:c="bottom",align:a="center",sideOffset:l=0,alignOffset:f=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d=5,arrowPadding:g=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:b=Cd,style:y,...x}=t,S=cn(),E=yh(),C=_d(),w=S.useState("open"),R=S.useState("mounted"),O=S.useState("floatingRootContext"),P=S.useState("instantType"),M=S.useState("transitionStatus"),F=S.useState("adaptiveOrigin"),A=S.context.inlineRectCoordsRef,D=kh({anchor:s,floatingRootContext:O,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:g,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:E,nodeId:C,collisionAvoidance:b,adaptiveOrigin:F,inline:$d(A)}),_=D.update;pe(()=>{w&&R&&_()},[w,R,_]);const T={open:w,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P},k=Nh(t,T,{styles:D.positionerStyles,transitionStatus:M,props:x,refs:[n,S.useStateSetter("positionerElement")],hidden:!R,inert:!w});return h.jsx(jo.Provider,{value:D,children:h.jsx(kd,{id:C,children:k})})});process.env.NODE_ENV!=="production"&&(Ac.displayName="PreviewCardPositioner");const Nc=v.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=cn(),{side:a,align:l}=vh(),f=c.useState("open"),u=c.useState("instantType"),d=c.useState("transitionStatus"),g=c.useState("popupProps"),p=c.useState("floatingRootContext"),m=c.useState("closeDelay");return uo({open:f,ref:c.context.popupRef,onComplete(){var x,S;f&&((S=(x=c.context).onOpenChangeComplete)==null||S.call(x,!0))}}),Sp(p,{closeDelay:m}),pt("div",t,{state:{open:f,side:a,align:l,instant:u,transitionStatus:d},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[Wd,g,kc(d),i],stateAttributesMapping:Gf})});process.env.NODE_ENV!=="production"&&(Nc.displayName="PreviewCardPopup");class jh extends Hd{constructor(){super(mh(),"PreviewCard")}open(t){this.openByTrigger(t)}close(){this.closePopup()}get isOpen(){var t;return((t=this.attachedStore)==null?void 0:t.select("open"))??!1}}function Mh(){return new jh}const Dh=Mh;function Fh(e){return h.jsx(Rc,{...e})}function Lh(e){return h.jsx(Pc,{"data-slot":"hover-card-trigger",...e})}function Bh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return h.jsx(Oc,{children:h.jsx(Ac,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:h.jsx(Nc,{"data-slot":"hover-card-content",...s,className:i=>ue("vps-hover-card",typeof e=="function"?e(i):e)})})})}function Vh({className:e,...t}){return h.jsx("span",{className:ue("inline-citation",e),...t})}const Mo=I.createContext(null);function jc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function $h({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=I.useState(()=>Dh()),i=e??s,c=I.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return h.jsx(Mo.Provider,{value:c,children:h.jsx(Fh,{...o,handle:i,onOpenChange:(a,l)=>{var f,u;t==null||t(a,l),!a&&l.reason==="escape-key"&&((f=c.popup)!=null&&f.contains(document.activeElement))&&((u=c.trigger)==null||u.focus())}})})}function Wr(e){try{return new URL(e).hostname||e}catch{return e}}function Hh({sources:e,delay:t,closeDelay:n,id:r,children:o,onClick:s,...i}){const c=I.useContext(Mo),a=I.useId(),l=r??a,f=e[0],u=f?Wr(f):"Source";return h.jsx(Lh,{id:l,handle:c==null?void 0:c.handle,delay:t??(c==null?void 0:c.openDelay)??80,closeDelay:n??(c==null?void 0:c.closeDelay)??180,render:h.jsx(fo,{variant:"secondary",size:"xs","aria-haspopup":"dialog",...i,onClick:d=>{s==null||s(d),!(!c||d.defaultPrevented)&&(c.trigger=d.currentTarget,c.focusRequested=!0,c.handle.open(l),jc(c))}}),children:o??(e.length>1?`${u} +${e.length-1}`:u)})}function Uh({ref:e,onBlur:t,...n}){const r=I.useContext(Mo);return h.jsx(Bh,{tabIndex:-1,role:"dialog","aria-label":"Source preview",...n,ref:o=>{typeof e=="function"?e(o):e&&(e.current=o),r&&(r.popup=o,o&&jc(r))},onBlur:o=>{t==null||t(o),!(!r||o.defaultPrevented)&&o.relatedTarget!==r.trigger&&!o.currentTarget.contains(o.relatedTarget)&&r.handle.close()}})}const Mc=I.createContext(null);function Do(){const e=I.useContext(Mc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function zh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=vo({...e,axis:n==="vertical"?"y":"x"},t),[{selected:a,count:l},f]=I.useState({selected:0,count:0});return I.useEffect(()=>{if(!c)return;r==null||r(c);const u=()=>f({selected:c.selectedScrollSnap(),count:c.scrollSnapList().length});return u(),c.on("select",u).on("reInit",u),()=>{c.off("select",u).off("reInit",u)}},[c,r]),h.jsx(Mc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:h.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:ue("inline-citation-carousel",o),"data-orientation":n})})}function Wh({className:e,...t}){const{viewportRef:n}=Do();return h.jsx("div",{ref:n,className:"inline-citation-viewport",children:h.jsx("div",{className:ue("inline-citation-track",e),...t})})}function qh({className:e,...t}){return h.jsx("div",{role:"group","aria-roledescription":"slide",className:ue("inline-citation-slide",e),...t})}function Gh({className:e,...t}){return h.jsx("div",{className:ue("inline-citation-carousel-header",e),...t})}function Kh({children:e,...t}){const{selected:n,count:r}=Do();return h.jsx("div",{"aria-live":"polite",...t,children:e??(r?`${n+1}/${r}`:"")})}function Dc({next:e,children:t,disabled:n,onClick:r,...o}){const{api:s}=Do(),i=e?s==null?void 0:s.canScrollNext():s==null?void 0:s.canScrollPrev();return h.jsx(fo,{variant:"ghost",size:"icon-xs","aria-label":e?"Next source":"Previous source",...o,disabled:n||!i,onClick:c=>{r==null||r(c),!c.defaultPrevented&&(e?s==null||s.scrollNext():s==null||s.scrollPrev())},children:t??(e?h.jsx(Js,{size:14,"aria-hidden":"true"}):h.jsx(ha,{size:14,"aria-hidden":"true"}))})}function Yh(e){return h.jsx(Dc,{...e,next:!1})}function Xh(e){return h.jsx(Dc,{...e,next:!0})}function Jh({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?ho(t):void 0;return h.jsxs("div",{className:ue("inline-citation-source",r),...s,children:[h.jsx("div",{className:"inline-citation-title",children:e||(i?Wr(i):"Source")}),i&&h.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[Wr(i),h.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&h.jsx("p",{children:n}),o]})}function Zh({className:e,...t}){return h.jsx("blockquote",{className:ue("inline-citation-quote",e),...t})}const Qh={"fuel-defect-reporting":{label:"Fuel Defect Reporting",path:"/dashboard/fuel-Defect-Reporting"},"bunker-master":{label:"Bunker Master",path:"/dashboard/bunker-master"},"fsc-fsq-e-forms":{label:"Pre-Registration & E-Forms",path:"/dashboard/pre-registration"},"pre-registration-ship":{label:"Pre-Registration",path:"/dashboard/pre-registration"},"reports-fuel":{label:"Fuel Reports",path:"/dashboard/reports"},"sample-fuel":{label:"Sample Status",path:"/dashboard/sample-status"}};function Fc(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(Qh))if(n.includes(r))return o;return null}function qr(e){return e.title?e.title:(e.source.split(/[/\\]/).pop()||e.source).replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,n=>n.toUpperCase())}const eg=({sources:e,hideInspectSources:t=!1,showInspectSources:n=!0,defaultExpanded:r=!1,maxSources:o=5})=>{const s=t||n===!1,[i,c]=I.useState(r&&!s),[a,l]=I.useState(null);if(!e||!e.length)return null;const f=e.slice(0,o),u=f.length===1?"source":"sources",d=h.jsxs(Nt,{children:[h.jsx(xt,{children:h.jsx(va,{size:14})}),h.jsx(jt,{children:`${f.length} retrieved VPS ${u}`}),!s&&h.jsx(Kt,{children:i?"Hide Details":"Inspect Sources"})]}),g=h.jsx(bt,{className:"grounded-source-rows",children:f.map((p,m)=>{const b=a===m,y=h.jsxs(Nt,{children:[h.jsx(xt,{children:h.jsx(pa,{size:13})}),h.jsxs(jt,{children:["[S",m+1,"] ",qr(p)]}),h.jsxs(Kt,{title:"Ranking score, not a probability of correctness",children:["Score ",p.score.toFixed(2)]})]});return s?h.jsx("div",{children:y},`${p.chunkId}-${m}`):h.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:m)},title:p.source,children:y},`${p.chunkId}-${m}`)})});return s?h.jsxs(bt,{className:"grounded-sources-card",children:[d,g]}):h.jsx(bt,{className:"grounded-sources-card",children:h.jsxs(Pi,{open:i,onOpenChange:c,children:[h.jsx(Ii,{children:d}),g,h.jsx(_i,{children:h.jsx("div",{className:"grounded-sources-details-list",children:f.map((p,m)=>{const b=qr(p),y=Fc(p.source),x=a===m;return h.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[h.jsxs("div",{className:"grounded-detail-top",children:[h.jsxs("div",{className:"grounded-detail-title-group",children:[h.jsxs("span",{className:"grounded-detail-index",children:["[",m+1,"]"]}),h.jsx("span",{className:"grounded-detail-title",children:b})]}),h.jsxs("div",{className:"grounded-detail-meta",children:[h.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",p.score.toFixed(2)]}),y&&h.jsxs("a",{href:y.path,onClick:S=>{S.preventDefault(),window.location.href=y.path},className:"grounded-route-link",title:`Navigate to ${y.label}`,children:[h.jsx("span",{children:y.label}),h.jsx(ba,{size:10,"aria-hidden":"true"})]})]})]}),h.jsx("div",{className:"grounded-detail-path",children:h.jsx("code",{children:p.source})}),p.snippet&&h.jsxs("p",{className:"grounded-detail-snippet",children:['"',p.snippet,'"']})]},`detail-${p.chunkId}-${m}`)})})})]})})};function tg({label:e,sources:t}){const n=t.map(r=>{var i;const o=qr(r),s=ho(r.url||r.source)??((i=Fc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:h.jsxs(h.Fragment,{children:[h.jsx(Jh,{title:o,url:s}),r.snippet&&h.jsx(Zh,{children:r.snippet})]})}});return h.jsx(Vh,{children:h.jsxs($h,{children:[h.jsx(Hh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),h.jsx(Uh,{children:n.length===1?n[0].content:h.jsxs(zh,{"aria-label":"Sources",children:[h.jsxs(Gh,{children:[h.jsx(Kh,{}),h.jsx(Yh,{}),h.jsx(Xh,{})]}),h.jsx(Wh,{children:n.map((r,o)=>h.jsx(qh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function ng(e,t){if(!e)return[];const n=/(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+|\[S\d+(?:\s*,\s*S\d+)*\])/g;return e.split(n).map((o,s)=>{if(!o)return null;if(t!=null&&t.length&&/^\[S\d+(?:\s*,\s*S\d+)*\]$/.test(o)){const c=[...new Set(o.match(/\d+/g))].map(a=>t[Number(a)-1]);if(c.every(a=>a!==void 0))return h.jsx(tg,{label:o,sources:c},s)}const i=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(i){const c=i[1],a=i[2],l=ho(a);if(!l)return h.jsx(I.Fragment,{children:c},s);const f=/^https?:\/\//i.test(a);return h.jsx("a",{href:l,target:f?"_blank":void 0,rel:f?"noopener noreferrer":void 0,className:"md-link",children:c},s)}return o.startsWith("**")&&o.endsWith("**")&&o.length>=4?h.jsx("strong",{children:o.slice(2,-2)},s):o.startsWith("*")&&o.endsWith("*")&&o.length>=2?h.jsx("em",{children:o.slice(1,-1)},s):o.startsWith("`")&&o.endsWith("`")&&o.length>=2?h.jsx("code",{className:"md-code",children:o.slice(1,-1)},s):/^https?:\/\//i.test(o)?h.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:o},s):h.jsx(I.Fragment,{children:o},s)})}function rg(e){const t=e.replace(/\r\n/g,`
|
|
132
212
|
`).split(`
|
|
133
|
-
`),n=[];let r=0;for(;r<t.length;){const
|
|
134
|
-
`)});continue}if(/^(---|___|\*\*\*)$/.test(l)){n.push({type:"hr"}),r++;continue}const a=l.match(/^(#{1,4})\s+(.*)$/);if(a){n.push({type:"h",level:a[1].length,content:a[2]}),r++;continue}if(l.startsWith(">")){const u=[];for(;r<t.length&&t[r].trim().startsWith(">");)u.push(t[r].trim().replace(/^>\s?/,"")),r++;n.push({type:"quote",lines:u});continue}if(/^[-*]\s+/.test(l)){const u=[];for(;r<t.length&&/^[-*]\s+/.test(t[r].trim());)u.push(t[r].trim().replace(/^[-*]\s+/,"")),r++;n.push({type:"ul",items:u});continue}if(/^\d+\.\s+/.test(l)){const u=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r].trim());)u.push(t[r].trim().replace(/^\d+\.\s+/,"")),r++;n.push({type:"ol",items:u});continue}if(l.startsWith("|")&&l.endsWith("|")){const u=[];for(;r<t.length&&t[r].trim().startsWith("|")&&t[r].trim().endsWith("|");)u.push(t[r].trim()),r++;if(u.length>=2){const h=f=>f.slice(1,-1).split("|").map(v=>v.trim()),b=h(u[0]),p=u[1].includes("-")?2:1,c=u.slice(p).map(h);n.push({type:"table",headers:b,rows:c});continue}}const i=[];for(;r<t.length&&t[r].trim()&&!t[r].trim().startsWith("```")&&!/^(#{1,4})\s+/.test(t[r].trim())&&!/^[-*]\s+/.test(t[r].trim())&&!/^\d+\.\s+/.test(t[r].trim())&&!t[r].trim().startsWith(">")&&!/^(---|___|\*\*\*)$/.test(t[r].trim());)i.push(t[r].trim()),r++;i.length>0&&n.push({type:"p",lines:i})}return n}const Jr=g.memo(function({text:t}){if(!t)return null;const n=Yr(t);return s.jsx("div",{className:"md-content",children:n.map((r,o)=>{switch(r.type){case"h":return r.level===1?s.jsx("h2",{className:"md-h1",children:ne(r.content)},o):r.level===2?s.jsx("h3",{className:"md-h2",children:ne(r.content)},o):r.level===3?s.jsx("h4",{className:"md-h3",children:ne(r.content)},o):s.jsx("h5",{className:"md-h4",children:ne(r.content)},o);case"ul":return s.jsx("ul",{className:"md-ul",children:r.items.map((l,a)=>s.jsx("li",{className:"md-li",children:ne(l)},a))},o);case"ol":return s.jsx("ol",{className:"md-ol",children:r.items.map((l,a)=>s.jsx("li",{className:"md-li",children:ne(l)},a))},o);case"code":return s.jsx("pre",{className:"md-pre",children:s.jsx("code",{children:r.code})},o);case"quote":return s.jsx("blockquote",{className:"md-quote",children:r.lines.map((l,a)=>s.jsx("p",{children:ne(l)},a))},o);case"hr":return s.jsx("hr",{className:"md-hr"},o);case"table":return s.jsx("div",{className:"md-table-wrap",children:s.jsxs("table",{className:"md-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:r.headers.map((l,a)=>s.jsx("th",{children:ne(l)},a))})}),s.jsx("tbody",{children:r.rows.map((l,a)=>s.jsx("tr",{children:l.map((i,u)=>s.jsx("td",{children:ne(i)},u))},a))})]})},o);case"p":default:return s.jsx("p",{className:"md-p",children:r.lines.map((l,a)=>s.jsxs(g.Fragment,{children:[ne(l),a<r.lines.length-1&&s.jsx("br",{})]},a))},o)}})})}),Kr=({className:e,text:t})=>s.jsxs("div",{className:_e("typing-indicator-container",e),role:"status","aria-label":"Assistant is preparing a reply",children:[s.jsxs("div",{className:"typing-indicator","aria-hidden":"true",children:[s.jsx("span",{className:"typing-dot"}),s.jsx("span",{className:"typing-dot"}),s.jsx("span",{className:"typing-dot"})]}),t&&s.jsx("div",{className:"typing-progress-pill",children:t})]}),Qr=({status:e="complete",progressText:t,durationMs:n})=>{const r=e==="pending",[o,l]=g.useState(0);g.useEffect(()=>{if(!r)return;const i=Date.now(),u=setInterval(()=>{l(Number(((Date.now()-i)/1e3).toFixed(1)))},250);return()=>clearInterval(u)},[r]);const a=r?`${o.toFixed(1)}s`:n===void 0?void 0:`${(n/1e3).toFixed(1)}s`;return s.jsx("div",{className:`agent-reasoning-container${r?" agent-reasoning--active":""}`,children:s.jsx("div",{className:"agent-reasoning-header",role:"status","aria-live":"off",children:s.jsxs("div",{className:"agent-reasoning-header-left",children:[r?s.jsx(Ht,{size:13,className:"agent-reasoning-spinner","aria-hidden":"true"}):s.jsx(Ot,{size:13,className:"agent-reasoning-done-icon","aria-hidden":"true"}),s.jsx("span",{className:"agent-reasoning-title",children:r?`${t||"Working…"} · ${a}`:a?`Response generated in ${a}`:"Response generated"})]})})})},Xr={"fuel-defect-reporting":{label:"Fuel Defect Reporting",path:"/dashboard/fuel-Defect-Reporting"},"bunker-master":{label:"Bunker Master",path:"/dashboard/bunker-master"},"fsc-fsq-e-forms":{label:"Pre-Registration & E-Forms",path:"/dashboard/pre-registration"},"pre-registration-ship":{label:"Pre-Registration",path:"/dashboard/pre-registration"},"reports-fuel":{label:"Fuel Reports",path:"/dashboard/reports"},"sample-fuel":{label:"Sample Status",path:"/dashboard/sample-status"}};function Zr(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(Xr))if(n.includes(r))return o;return null}function tt(e){return e.title?e.title:(e.source.split(/[/\\]/).pop()||e.source).replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,n=>n.toUpperCase())}const en=({sources:e,hideInspectSources:t=!1,showInspectSources:n=!0,defaultExpanded:r=!1,maxSources:o=5})=>{const l=t||n===!1,[a,i]=g.useState(r&&!l),[u,h]=g.useState(null);if(!e||!e.length)return null;const b=e.slice(0,o);return s.jsxs("div",{className:"grounded-sources-card",children:[s.jsxs("div",{className:"grounded-sources-header",children:[s.jsxs("div",{className:"grounded-sources-badge",children:[s.jsx(Ut,{size:13,className:"grounded-shield-icon"}),s.jsxs("span",{children:[b.length," retrieved VPS sources"]})]}),!l&&s.jsxs("button",{type:"button",className:"grounded-toggle-btn",onClick:()=>i(p=>!p),"aria-expanded":a,children:[s.jsx("span",{children:a?"Hide Details":"Inspect Sources"}),a?s.jsx(Lt,{size:12}):s.jsx(Pt,{size:12})]})]}),s.jsx("div",{className:"grounded-pills-row",children:b.map((p,c)=>{const f=tt(p),v=u===c;return s.jsxs("button",{type:"button",className:`grounded-source-pill${v?" grounded-source-pill--selected":""}`,onClick:()=>{l||(i(!0),h(v?null:c))},title:p.source,children:[s.jsx(Dt,{size:11,className:"grounded-book-icon"}),s.jsxs("span",{className:"grounded-pill-title",children:["[S",c+1,"] ",f]}),s.jsxs("span",{className:"grounded-pill-score",title:"Ranking score, not a probability of correctness",children:["Score ",p.score.toFixed(2)]})]},`${p.chunkId}-${c}`)})}),!l&&a&&s.jsx("div",{className:"grounded-sources-details-list",children:b.map((p,c)=>{const f=tt(p),v=Zr(p.source),x=u===c;return s.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[s.jsxs("div",{className:"grounded-detail-top",children:[s.jsxs("div",{className:"grounded-detail-title-group",children:[s.jsxs("span",{className:"grounded-detail-index",children:["[",c+1,"]"]}),s.jsx("span",{className:"grounded-detail-title",children:f})]}),s.jsxs("div",{className:"grounded-detail-meta",children:[s.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",p.score.toFixed(2)]}),v&&s.jsxs("a",{href:v.path,onClick:_=>{_.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[s.jsx("span",{children:v.label}),s.jsx($t,{size:10})]})]})]}),s.jsx("div",{className:"grounded-detail-path",children:s.jsx("code",{children:p.source})}),p.snippet&&s.jsxs("p",{className:"grounded-detail-snippet",children:['"',p.snippet,'"']})]},`detail-${p.chunkId}-${c}`)})})]})};function tn(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}function rn({toolCalls:e}){return e.length?s.jsx("div",{className:"tool-badges",children:e.map((t,n)=>s.jsx("span",{className:"tool-badge",children:tn(t.toolName)},`${t.toolName}-${n}`))}):null}const nn=({message:e})=>{var b;const t=Ie(),n=(t==null?void 0:t.hideInspectSources)??!1,r=(t==null?void 0:t.showGroundedSources)??!0,o=e.role==="user",l=e.status==="error",a=e.status==="pending",i=e.id==="welcome-default"||e.id.startsWith("welcome")||e.id==="welcome",u=!!(a||e.durationMs!==void 0||e.sources&&e.sources.length>0||e.toolCalls&&e.toolCalls.length>0||e.usage),h=!o&&!l&&!i&&u;return s.jsxs("div",{className:`msg-row${o?" msg-row--user":""}`,children:[!o&&s.jsx("div",{className:"avatar-circle avatar-circle--mt","aria-hidden":"true",children:s.jsx(at,{size:15})}),s.jsxs("div",{className:`msg-col${o?" msg-col--user":""}`,children:[s.jsxs("div",{className:o?"msg-bubble msg-bubble--user":l?"msg-bubble msg-bubble--error":"msg-bubble msg-bubble--bot",children:[h&&s.jsx(Qr,{status:a?"pending":"complete",progressText:e.progressText,durationMs:e.durationMs}),a?e.content?s.jsx("div",{className:"msg-content-wrapper msg-content-wrapper--streaming",children:s.jsx("div",{className:"msg-streaming-text",children:e.content})}):s.jsx(Kr,{}):o?s.jsx("p",{className:"msg-user-pre",children:e.content}):s.jsx("div",{className:"msg-content-wrapper",children:s.jsx(Jr,{text:e.content})}),e.toolCalls?s.jsx(rn,{toolCalls:e.toolCalls}):null,!o&&!a&&!l&&r&&((b=e.sources)!=null&&b.length)?s.jsx(en,{sources:e.sources,hideInspectSources:n}):null]}),o&&e.status!=="error"&&s.jsx(Bt,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})},sn=()=>{const{messages:e,status:t,showSuggestions:n}=xe(),r=t==="awaiting"||t==="connecting";return s.jsx($r,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:s.jsxs(zr,{children:[s.jsx(Hr,{"aria-label":"Chat messages",children:s.jsxs(Wr,{"aria-busy":r,children:[e.length===0&&s.jsx(et,{messageId:"welcome",children:s.jsx(Gr,{})}),e.map(o=>s.jsx(et,{messageId:o.id,scrollAnchor:o.role==="user",children:s.jsx(nn,{message:o})},o.id))]})}),s.jsx(Vr,{})]})})},on=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=xe(),l=!n.customerId&&!n.email,[a,i]=g.useState("");return e?s.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[s.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),s.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),s.jsx("p",{className:"ticket-card-body",children:e.description}),l&&s.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",s.jsx("input",{value:a,onChange:u=>i(u.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),s.jsxs("div",{className:"ticket-actions",children:[s.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),s.jsx("button",{type:"button",onClick:()=>void r(a),disabled:t||l&&!a.trim(),className:"ticket-confirm-btn",children:t?"Creating…":"Create ticket"})]})]}):null},Ge=({className:e,onClose:t,showMinimize:n,title:r,subtitle:o,envStage:l,envPulse:a=!0})=>{const{sendMessage:i,status:u,error:h,resetConversation:b,retryLast:p,pendingTicket:c}=xe(),f=u==="awaiting"||u==="connecting"||!!c;return s.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[s.jsx(Zt,{title:r,subtitle:o,onClose:t,onReset:()=>void b(),showMinimize:n,envStage:l,envPulse:a}),s.jsx("div",{className:"chat-panel-body",children:s.jsx(sn,{})}),h&&u==="error"&&s.jsx(Ft,{message:h,onRetry:()=>void p()}),s.jsx(on,{}),s.jsx(nr,{onSend:v=>void i(v),disabled:f})]})},ln=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?s.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:s.jsx(Ge,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,an=({open:e,onToggle:t})=>s.jsx("button",{type:"button",onClick:t,"aria-expanded":e,"aria-controls":"vps-chatbot-widget-panel","aria-label":e?"Close assistant":"Open assistant",className:"widget-trigger-btn",children:e?s.jsx(Jt,{size:22}):s.jsx(it,{size:24})}),rt=({defaultOpen:e=!1,open:t,onOpenChange:n,envStage:r,envPulse:o=!0})=>{const[l,a]=g.useState(e),i=t??l,u=h=>{n==null||n(h),t===void 0&&a(h)};return s.jsxs(s.Fragment,{children:[s.jsx(ln,{open:i,onClose:()=>u(!1),envStage:r,envPulse:o}),s.jsx(an,{open:i,onToggle:()=>u(!i)})]})},cn=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:l,client:a,welcomeMessage:i,suggestions:u,disableSuggestions:h,initialMessage:b,hideInspectSources:p,showGroundedSources:c,modelId:f,...v})=>{const x=Ie(),_=e??t??n;return!!x&&(!_||pe(_)===pe(x==null?void 0:x.apiBaseUrl))&&!r&&o===void 0&&l===void 0&&a===void 0&&i===void 0&&!u&&h===void 0&&!b&&p===void 0&&c===void 0&&f===void 0?s.jsx(rt,{...v}):s.jsx(We,{apiBaseUrl:_,userContext:r,role:o,roleId:l,client:a,welcomeMessage:i,suggestions:u,disableSuggestions:h,initialMessage:b,hideInspectSources:p,showGroundedSources:c,modelId:f,children:s.jsx(rt,{...v})})},un=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:l=!0})=>s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),s.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&s.jsx(Ge,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:l})})]}),dn=5,Oe=8,vt="vps-embedded-assistant-top";function hn(e,t,n){return Math.min(n,Math.max(t,e))}function nt(e,t){const n=Math.max(Oe,window.innerHeight-t-Oe);return hn(e,Oe,n)}function fn(){try{const e=window.localStorage.getItem(vt);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function pn(e){try{window.localStorage.setItem(vt,String(e))}catch{}}const mn=({onOpen:e})=>{const t=g.useRef(null),n=g.useRef({pointerId:null,startY:0,startTop:0,moved:!1}),[r,o]=g.useState(()=>typeof window>"u"?null:fn()),l=g.useRef(r),a=g.useRef(!1),[i,u]=g.useState(!1);g.useEffect(()=>{l.current=r},[r]),g.useEffect(()=>{const c=t.current;if(!c)return;const f=()=>{o(v=>{const x=v??Math.round(window.innerHeight/2-c.offsetHeight/2),_=nt(x,c.offsetHeight);return l.current=_,_})};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const h=c=>{if(c.button!==0)return;const f=c.currentTarget,v=f.getBoundingClientRect();n.current={pointerId:c.pointerId,startY:c.clientY,startTop:v.top,moved:!1};try{f.setPointerCapture(c.pointerId)}catch{}},b=c=>{if(n.current.pointerId!==c.pointerId)return;const f=c.clientY-n.current.startY;if(!n.current.moved&&Math.abs(f)<dn)return;n.current.moved=!0,u(!0);const v=nt(n.current.startTop+f,c.currentTarget.offsetHeight);l.current=v,o(v)},p=c=>{var v,x;if(n.current.pointerId!==c.pointerId)return;try{(x=(v=c.currentTarget).hasPointerCapture)!=null&&x.call(v,c.pointerId)&&c.currentTarget.releasePointerCapture(c.pointerId)}catch{}const f=n.current.moved;n.current.pointerId=null,n.current.moved=!1,u(!1),f&&(a.current=!0,l.current!=null&&pn(l.current))};return s.jsxs("button",{ref:t,type:"button",onPointerDown:h,onPointerMove:b,onPointerUp:p,onPointerCancel:p,onClick:()=>{if(a.current){a.current=!1;return}e()},"aria-expanded":!1,"aria-controls":"vps-embedded-chat-panel","aria-label":"Assistant",className:`embedded-trigger-btn ${i?"embedded-trigger-btn--grabbing":"embedded-trigger-btn--grab"}`,style:{top:r??"50%",transform:r==null?"translateY(-50%)":void 0},children:[s.jsx(it,{size:16}),"Assistant"]})},st=({defaultOpen:e=!1,open:t,onOpenChange:n,showTrigger:r=!0,envStage:o,envPulse:l=!0})=>{const[a,i]=g.useState(e),u=t??a,h=b=>{n==null||n(b),t===void 0&&i(b)};return s.jsxs(s.Fragment,{children:[r&&!u&&s.jsx(mn,{onOpen:()=>h(!0)}),s.jsx(un,{open:u,onClose:()=>h(!1),envStage:o,envPulse:l})]})},gn=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:l,client:a,welcomeMessage:i,suggestions:u,disableSuggestions:h,initialMessage:b,hideInspectSources:p,showGroundedSources:c,modelId:f,...v})=>{const x=Ie(),_=e??t??n;return!!x&&(!_||pe(_)===pe(x==null?void 0:x.apiBaseUrl))&&!r&&o===void 0&&l===void 0&&a===void 0&&i===void 0&&!u&&h===void 0&&!b&&p===void 0&&c===void 0&&f===void 0?s.jsx(st,{...v}):s.jsx(We,{apiBaseUrl:_,userContext:r,role:o,roleId:l,client:a,welcomeMessage:i,suggestions:u,disableSuggestions:h,initialMessage:b,hideInspectSources:p,showGroundedSources:c,modelId:f,children:s.jsx(st,{...v})})},bn={Colors:{VPS_White:"#fff",VPS_Dark_Blue:"#1A1A31",VPS_Light_Blue:"#353552",VPS_Light_Grey:"#D1D1D6",VPS_Orange:"#FF4717",Dark_Blue_50:"#F1F5FC",Dark_Blue_100:"#E5EBFA",Dark_Blue_200:"#D1DAF4",Dark_Blue_300:"#B4C2ED",Dark_Blue_400:"#96A2E3",Dark_Blue_500:"#7C84D8",Dark_Blue_600:"#6262C9",Dark_Blue_700:"#5351B1",Dark_Blue_800:"#44448F",Dark_Blue_900:"#3C3D73",Dark_Blue_950:"#1A1A31",Light_Blue_50:"#F4F6FA",Light_Blue_100:"#E6E9F3",Light_Blue_200:"#D3D8EA",Light_Blue_300:"#B4BEDC",Light_Blue_400:"#909DCA",Light_Blue_500:"#7580BC",Light_Blue_600:"#6369AD",Light_Blue_700:"#575A9E",Light_Blue_800:"#4B4B82",Light_Blue_900:"#404168",Light_Blue_950:"#353552",Grey_50:"#F6F6F7",Grey_100:"#EFEFF0",Grey_200:"#E2E1E4",Grey_300:"#D1D1D6",Grey_400:"#B9B9C0",Grey_500:"#A7A6AE",Grey_600:"#93919A",Grey_700:"#7E7D85",Grey_800:"#67666D",Grey_900:"#56555A",Grey_950:"#323234",Orange_50:"#FFF3ED",Orange_100:"#FFE4D4",Orange_200:"#FFC5A8",Orange_300:"#FF9D70",Orange_400:"#FF6837",Orange_500:"#FF4717",Orange_600:"#F02706",Orange_700:"#C71807",Orange_800:"#9E150E",Orange_900:"#7F150F",Orange_950:"#450605",Success_50:"#F1FCF5",Success_100:"#DEFAEA",Success_200:"#BEF4D4",Success_300:"#8BEAB3",Success_400:"#52D689",Success_500:"#2ECC71",Success_600:"#1D9C53",Success_700:"#1B7A43",Success_800:"#1A6139",Success_900:"#175031",Success_950:"#072C18",Warning_50:"#FFFEEA",Warning_100:"#FFF9C5",Warning_200:"#FFF485",Warning_300:"#FFE846",Warning_400:"#FFD81B",Warning_500:"#FFB800",Warning_600:"#E28D00",Warning_700:"#BB6302",Warning_800:"#984C08",Warning_900:"#7C3F0B",Warning_950:"#482000",Error_50:"#FFF1F1",Error_100:"#FFDFDF",Error_200:"#FFC5C5",Error_300:"#FF9D9D",Error_400:"#FF6464",Error_500:"#FF2E2E",Error_600:"#ED1515",Error_700:"#C80D0D",Error_800:"#A50F0F",Error_900:"#881414",Error_950:"#4B0404",Netural_25:"#FDFDFD",Netural_50:"#FAFAFA",Netural_100:"#F5F5F5",Netural_200:"#E9EAEC",Netural_300:"#D6D7DB",Netural_400:"#A4A7AE",Netural_500:"#727681",Netural_600:"#545863",Netural_700:"#424651",Netural_800:"#252B37",Netural_900:"#191D28",Netural_950:"#0A0D12",Tint_Dark_Blue_100:"#1A1A31",Tint_Dark_Blue_90:"#313146",Tint_Dark_Blue_80:"#48485A",Tint_Dark_Blue_70:"#5F5F6F",Tint_Dark_Blue_60:"#767683",Tint_Dark_Blue_50:"#8C8C98",Tint_Dark_Blue_40:"#A3A3AD",Tint_Dark_Blue_30:"#BABAC1",Tint_Dark_Blue_20:"#D1D1D6",Tint_Dark_Blue_10:"#E8E8EA",Tint_Dark_Blue_5:"#F4F4F5",Tint_Light_Blue_100:"#353552",Tint_Light_Blue_90:"#494963",Tint_Light_Blue_80:"#5D5D75",Tint_Light_Blue_70:"#727286",Tint_Light_Blue_60:"#868697",Tint_Light_Blue_50:"#9A9AA8",Tint_Light_Blue_40:"#AEAEBA",Tint_Light_Blue_30:"#C2C2CB",Tint_Light_Blue_20:"#D7D7DC",Tint_Light_Blue_10:"#EBEBEE",Tint_Light_Blue_5:"#F5F5F6",Tint_Grey_100:"#D1D1D6",Tint_Grey_90:"#D6D6DA",Tint_Grey_80:"#DADADE",Tint_Grey_70:"#DFDFE2",Tint_Grey_60:"#E3E3E6",Tint_Grey_50:"#E8E8EB",Tint_Grey_40:"#EDEDEF",Tint_Grey_30:"#F1F1F3",Tint_Grey_20:"#F6F6F7",Tint_Grey_10:"#FAFAFB",Tint_Grey_5:"#FDFDFD",Tint_Solus_100:"#FF4717",Tint_Solus_90:"#FF592E",Tint_Solus_80:"#FF6C45",Tint_Solus_70:"#FF7E5D",Tint_Solus_60:"#FF9174",Tint_Solus_50:"#FFA38B",Tint_Solus_40:"#FFB5A2",Tint_Solus_30:"#FFC8B9",Tint_Solus_20:"#FFDAD1",Tint_Solus_10:"#FFEDE8",Tint_Solus_5:"#FFF6F3",Other_Color:"#00ABC9"},StatusColor:{tested:"#3E4784",received:"#EE46BC",InTransit:"#6938EF",registered:"#1570EF",reported:"#2ECC71",noStatus:"#727681",Action:"#FF2E2E",Caution:"#FFB800",Pass:"#2ECC71",No_Rating:"#FF6837",Received:"#EE46BC",Tested:"#3E4784",Reported:"#2ECC71",No_Status:"#6938EF",Overdue:"#FF2E2E",Duesoon:"#FFB800",Scheduled:"#1570EF",Good:"#2ECC71",NotApplicable:"#353552"}};exports.ChatPanel=Ge;exports.ChatProvider=We;exports.ChatbotWidget=cn;exports.ColorPalette=bn;exports.EmbeddedChatbot=gn;exports.buildApiUrl=Fe;exports.chatApi=Ct;exports.createChatApi=ze;exports.resolveApiBaseUrl=pe;exports.useChatContext=ot;exports.useChatbot=xe;exports.useOptionalChatContext=Ie;
|
|
213
|
+
`),n=[];let r=0;for(;r<t.length;){const s=t[r].trim();if(!s){r++;continue}if(s.startsWith("```")){const a=s.slice(3).trim(),l=[];for(r++;r<t.length&&!t[r].trim().startsWith("```");)l.push(t[r]),r++;r<t.length&&t[r].trim().startsWith("```")&&r++,n.push({type:"code",lang:a,code:l.join(`
|
|
214
|
+
`)});continue}if(/^(---|___|\*\*\*)$/.test(s)){n.push({type:"hr"}),r++;continue}const i=s.match(/^(#{1,4})\s+(.*)$/);if(i){n.push({type:"h",level:i[1].length,content:i[2]}),r++;continue}if(s.startsWith(">")){const a=[];for(;r<t.length&&t[r].trim().startsWith(">");)a.push(t[r].trim().replace(/^>\s?/,"")),r++;n.push({type:"quote",lines:a});continue}if(/^[-*]\s+/.test(s)){const a=[];for(;r<t.length&&/^[-*]\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^[-*]\s+/,"")),r++;n.push({type:"ul",items:a});continue}if(/^\d+\.\s+/.test(s)){const a=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^\d+\.\s+/,"")),r++;n.push({type:"ol",items:a});continue}if(s.startsWith("|")&&s.endsWith("|")){const a=[];for(;r<t.length&&t[r].trim().startsWith("|")&&t[r].trim().endsWith("|");)a.push(t[r].trim()),r++;if(a.length>=2){const l=g=>g.slice(1,-1).split("|").map(p=>p.trim()),f=l(a[0]),u=a[1].includes("-")?2:1,d=a.slice(u).map(l);n.push({type:"table",headers:f,rows:d});continue}}const c=[];for(;r<t.length&&t[r].trim()&&!t[r].trim().startsWith("```")&&!/^(#{1,4})\s+/.test(t[r].trim())&&!/^[-*]\s+/.test(t[r].trim())&&!/^\d+\.\s+/.test(t[r].trim())&&!t[r].trim().startsWith(">")&&!/^(---|___|\*\*\*)$/.test(t[r].trim());)c.push(t[r].trim()),r++;c.length>0&&n.push({type:"p",lines:c})}return n}function og({code:e,lang:t,streaming:n}){const{status:r,copy:o}=Vi();return h.jsxs("div",{className:"md-code-block",children:[h.jsxs("div",{className:"md-code-header",children:[h.jsx("span",{children:t||"Code"}),!n&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"md-code-status",role:"status",children:[r==="copied"&&"Copied",r==="failed"&&"Couldn’t copy"]}),h.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Copy code",title:"Copy code",disabled:r==="copying",onClick:()=>void o(e),children:r==="copied"?h.jsx(Xr,{size:15,"aria-hidden":"true"}):h.jsx(Qs,{size:15,"aria-hidden":"true"})})]})]}),h.jsx("pre",{className:"md-pre",children:h.jsx("code",{children:e.split(`
|
|
215
|
+
`).map((s,i)=>h.jsxs("span",{className:"md-code-line",children:[h.jsx("span",{className:"md-code-number","aria-hidden":"true",children:i+1}),h.jsx("span",{children:s||" "})]},i))})})]})}const Ls=I.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=rg(t),s=i=>ng(i,r);return h.jsx("div",{className:"md-content",children:o.map((i,c)=>{switch(i.type){case"h":return i.level===1?h.jsx("h2",{className:"md-h1",children:s(i.content)},c):i.level===2?h.jsx("h3",{className:"md-h2",children:s(i.content)},c):i.level===3?h.jsx("h4",{className:"md-h3",children:s(i.content)},c):h.jsx("h5",{className:"md-h4",children:s(i.content)},c);case"ul":return h.jsx("ul",{className:"md-ul",children:i.items.map((a,l)=>h.jsx("li",{className:"md-li",children:s(a)},l))},c);case"ol":return h.jsx("ol",{className:"md-ol",children:i.items.map((a,l)=>h.jsx("li",{className:"md-li",children:s(a)},l))},c);case"code":return h.jsx(og,{code:i.code,lang:i.lang,streaming:n},c);case"quote":return h.jsx("blockquote",{className:"md-quote",children:i.lines.map((a,l)=>h.jsx("p",{children:s(a)},l))},c);case"hr":return h.jsx("hr",{className:"md-hr"},c);case"table":return h.jsx("div",{className:"md-table-wrap",children:h.jsxs("table",{className:"md-table",children:[h.jsx("thead",{children:h.jsx("tr",{children:i.headers.map((a,l)=>h.jsx("th",{children:s(a)},l))})}),h.jsx("tbody",{children:i.rows.map((a,l)=>h.jsx("tr",{children:a.map((f,u)=>h.jsx("td",{children:s(f)},u))},l))})]})},c);case"p":default:return h.jsx("p",{className:"md-p",children:i.lines.map((a,l)=>h.jsxs(I.Fragment,{children:[s(a),l<i.lines.length-1&&h.jsx("br",{})]},l))},c)}})})}),sg=I.lazy(async()=>({default:(await import("streamdown")).Streamdown})),Lc=I.createContext(null);function Bc(){const e=I.useContext(Lc);if(!e)throw new Error("Reasoning parts must be rendered inside Reasoning.");return e}function ig({isStreaming:e=!1,open:t,defaultOpen:n,onOpenChange:r,duration:o,className:s,...i}){const[c,a]=I.useState(n),[l,f]=I.useState(),u=I.useRef(null),d=t??c??e;I.useEffect(()=>{e?u.current=performance.now():u.current!==null&&(f(Math.round((performance.now()-u.current)/1e3)),u.current=null)},[e]);function g(p){t===void 0&&a(p),r==null||r(p)}return h.jsx(Lc.Provider,{value:{isStreaming:e,isOpen:d,setIsOpen:g,duration:o??l},children:h.jsx(bt,{className:s,children:h.jsx(Pi,{...i,open:d,onOpenChange:g})})})}function cg({getThinkingMessage:e,children:t,icon:n,description:r,...o}){const{isStreaming:s,duration:i}=Bc(),c=s?"Thinking":i===void 0?"Thought":`Thought for ${i}s`;return h.jsx(Ii,{...o,children:h.jsxs(Nt,{status:s?"running":void 0,children:[h.jsx(xt,{children:n??(s?h.jsx(ei,{size:14,className:"trace-spinner"}):h.jsx(Zs,{size:14}))}),h.jsx(jt,{children:t??(e==null?void 0:e(s,i))??c}),r&&h.jsx(Kt,{"aria-hidden":s||void 0,children:r})]})})}function ag({children:e,className:t,...n}){const{isStreaming:r}=Bc();return h.jsx(_i,{className:ue("reasoning-content",t),...n,children:typeof e=="string"?h.jsx(I.Suspense,{fallback:h.jsx("div",{className:"md-content reasoning-text",children:e}),children:h.jsx(sg,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function lg(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const ug=({status:e="complete",progressText:t,progressSteps:n=[],durationMs:r,toolCalls:o=[]})=>{const s=e==="pending",i=e==="stopped",[c,a]=I.useState(0);I.useEffect(()=>{if(!s)return;const u=Date.now(),d=setInterval(()=>{a(Number(((Date.now()-u)/1e3).toFixed(1)))},250);return()=>clearInterval(d)},[s]);const l=n.length>0||o.length>0,f=r===void 0?void 0:Number((r/1e3).toFixed(1));return l?h.jsxs(ig,{className:"chat-response-trace",isStreaming:s,duration:f,children:[h.jsx(cg,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?h.jsx(ni,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),h.jsx(ag,{children:h.jsxs(bt,{children:[n.map((u,d)=>h.jsxs(Gs,{children:[h.jsx(ia,{children:h.jsx("span",{className:"chat-progress-dot"})}),h.jsx(Ks,{children:u})]},`${u}-${d}`)),o.map((u,d)=>h.jsxs(Nt,{children:[h.jsx(xt,{children:h.jsx(Ia,{size:13})}),h.jsx(jt,{children:lg(u.toolName)})]},`${u.toolName}-${d}`))]})})]}):h.jsx(bt,{className:"chat-response-trace",children:h.jsxs(Nt,{status:s?"running":void 0,children:[h.jsx(xt,{children:s?h.jsx(ei,{size:14,className:"trace-spinner"}):h.jsx(Zs,{size:14})}),h.jsx(jt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?h.jsxs(Kt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&f!==void 0&&h.jsxs(Kt,{children:[f,"s"]})]})})},fg=({message:e,onEdit:t})=>{var g,p,m,b;const n=qn(),r=(n==null?void 0:n.hideInspectSources)??!1,o=(n==null?void 0:n.showGroundedSources)??!1,s=e.role==="user",i=e.status==="error",c=e.status==="pending",a=e.status==="stopped",l=e.id.startsWith("welcome"),f=e.role==="assistant"&&!l&&!i,u=f&&(c||a||e.durationMs!==void 0||!!((g=e.progressSteps)!=null&&g.length||(p=e.sources)!=null&&p.length||(m=e.toolCalls)!=null&&m.length||e.usage)),d=f&&!c&&!a&&e.content.trim().length>0;return h.jsxs(Jr,{align:s?"end":"start",children:[e.role==="assistant"&&h.jsx(ri,{className:"avatar-circle","aria-hidden":"true",children:h.jsx(Xs,{size:15})}),h.jsxs(Zr,{children:[u&&h.jsx(ka,{children:h.jsx(ug,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?h.jsx(Ar,{align:"end",children:h.jsx(Nr,{className:"msg-user-pre",children:e.content})}):l||i?h.jsx(Ar,{variant:i?"destructive":"muted",children:h.jsx(Nr,{children:h.jsx(Ls,{text:e.content})})}):e.content&&h.jsxs("div",{className:"chat-message-body",children:[h.jsx(Ls,{text:e.content,streaming:c,sources:f&&!c&&!a&&!r?e.sources:void 0}),f&&!c&&!a&&o&&((b=e.sources)!=null&&b.length)?h.jsx(eg,{sources:e.sources,hideInspectSources:r}):null]}),d&&n&&h.jsx(Cr,{children:h.jsx(Vu,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&h.jsxs(Cr,{children:[t&&h.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Edit message",title:"Edit message",disabled:(n==null?void 0:n.status)==="awaiting"||(n==null?void 0:n.status)==="connecting"||!!(n!=null&&n.pendingTicket),onClick:()=>t(e.content),children:h.jsx(Sa,{size:14,"aria-hidden":"true"})}),h.jsx(Xr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},dg=({onEdit:e})=>{const{messages:t,status:n,suggestions:r,showSuggestions:o,sendMessage:s}=en(),i=n==="awaiting"||n==="connecting",c=t.filter(a=>a.status!=="error");return h.jsx(ju,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:h.jsxs(Mu,{children:[h.jsx(Du,{"aria-label":"Chat messages",children:h.jsxs(Fu,{"aria-busy":i,children:[c.length===0&&h.jsx(cs,{messageId:"welcome",children:h.jsx(Bu,{})}),c.map(a=>h.jsx(cs,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:h.jsx(fg,{message:a,onEdit:e})},a.streamId??a.id))]})}),h.jsx(Lu,{})]})})},pg=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=en(),s=!n.customerId&&!n.email,[i,c]=I.useState("");return e?h.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[h.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),h.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),h.jsx("p",{className:"ticket-card-body",children:e.description}),s&&h.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",h.jsx("input",{value:i,onChange:a=>c(a.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),h.jsxs("div",{className:"ticket-actions",children:[h.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),h.jsx("button",{type:"button",onClick:()=>void r(i),disabled:t||s&&!i.trim(),className:"ticket-confirm-btn",children:t?"Creating…":"Create ticket"})]})]}):null},Fo=({className:e,onClose:t,showMinimize:n,title:r,subtitle:o,envStage:s,envPulse:i=!0})=>{const{messages:c,sendMessage:a,stopResponse:l,status:f,error:u,resetConversation:d,retryLast:g,pendingTicket:p,soundEnabled:m,toggleSound:b}=en(),y=I.useRef(null),x=f==="awaiting"||f==="connecting",S=c[c.length-1],E=x?S==null?void 0:S.progressText:(S==null?void 0:S.status)==="stopped"?"Response stopped":void 0;return h.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[h.jsx(Vl,{title:r,subtitle:o,onClose:t,onReset:()=>void d(),showMinimize:n,soundEnabled:m,onToggleSound:b,envStage:s,envPulse:i}),h.jsx("div",{className:"chat-panel-body",children:h.jsx(dg,{onEdit:C=>{var w;return(w=y.current)==null?void 0:w.edit(C)}})}),h.jsx(Gs,{className:"sr-only",role:"status",children:h.jsx(Ks,{children:E})}),u&&f==="error"&&h.jsx(Dl,{message:u,onRetry:()=>void g()}),h.jsx(pg,{}),h.jsx(Jl,{ref:y,onSend:C=>void a(C),onStop:x?l:void 0,disabled:x||!!p})]})},hg=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?h.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:h.jsx(Fo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,gg=({open:e,onToggle:t})=>h.jsx("button",{type:"button",onClick:t,"aria-expanded":e,"aria-controls":"vps-chatbot-widget-panel","aria-label":e?"Close assistant":"Open assistant",className:"widget-trigger-btn",children:e?h.jsx(_a,{size:22}):h.jsx(ti,{size:24})}),Bs=({defaultOpen:e=!1,open:t,onOpenChange:n,envStage:r,envPulse:o=!0})=>{const[s,i]=I.useState(e),c=t??s,a=l=>{n==null||n(l),t===void 0&&i(l)};return h.jsxs(h.Fragment,{children:[h.jsx(hg,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),h.jsx(gg,{open:c,onToggle:()=>a(!c)})]})},mg=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:d,modelId:g,...p})=>{const m=qn(),b=e??t??n;return!!m&&(!b||vt(b)===vt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!f&&u===void 0&&d===void 0&&g===void 0?h.jsx(Bs,{...p}):h.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:d,modelId:g,children:h.jsx(Bs,{...p})})},bg=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:s=!0})=>h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),h.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&h.jsx(Fo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),yg=5,wr=8,Vc="vps-embedded-assistant-top";function vg(e,t,n){return Math.min(n,Math.max(t,e))}function Vs(e,t){const n=Math.max(wr,window.innerHeight-t-wr);return vg(e,wr,n)}function xg(){try{const e=window.localStorage.getItem(Vc);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function Eg(e){try{window.localStorage.setItem(Vc,String(e))}catch{}}const Sg=({onOpen:e})=>{const t=I.useRef(null),n=I.useRef({pointerId:null,startY:0,startTop:0,moved:!1}),[r,o]=I.useState(()=>typeof window>"u"?null:xg()),s=I.useRef(r),i=I.useRef(!1),[c,a]=I.useState(!1);I.useEffect(()=>{s.current=r},[r]),I.useEffect(()=>{const d=t.current;if(!d)return;const g=()=>{o(p=>{const m=p??Math.round(window.innerHeight/2-d.offsetHeight/2),b=Vs(m,d.offsetHeight);return s.current=b,b})};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]);const l=d=>{if(d.button!==0)return;const g=d.currentTarget,p=g.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:p.top,moved:!1};try{g.setPointerCapture(d.pointerId)}catch{}},f=d=>{if(n.current.pointerId!==d.pointerId)return;const g=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(g)<yg)return;n.current.moved=!0,a(!0);const p=Vs(n.current.startTop+g,d.currentTarget.offsetHeight);s.current=p,o(p)},u=d=>{var p,m;if(n.current.pointerId!==d.pointerId)return;try{(m=(p=d.currentTarget).hasPointerCapture)!=null&&m.call(p,d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const g=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),g&&(i.current=!0,s.current!=null&&Eg(s.current))};return h.jsxs("button",{ref:t,type:"button",onPointerDown:l,onPointerMove:f,onPointerUp:u,onPointerCancel:u,onClick:()=>{if(i.current){i.current=!1;return}e()},"aria-expanded":!1,"aria-controls":"vps-embedded-chat-panel","aria-label":"Assistant",className:`embedded-trigger-btn ${c?"embedded-trigger-btn--grabbing":"embedded-trigger-btn--grab"}`,style:{top:r??"50%",transform:r==null?"translateY(-50%)":void 0},children:[h.jsx(ti,{size:16}),"Assistant"]})},$s=({defaultOpen:e=!1,open:t,onOpenChange:n,showTrigger:r=!0,envStage:o,envPulse:s=!0})=>{const[i,c]=I.useState(e),a=t??i,l=f=>{n==null||n(f),t===void 0&&c(f)};return h.jsxs(h.Fragment,{children:[r&&!a&&h.jsx(Sg,{onOpen:()=>l(!0)}),h.jsx(bg,{open:a,onClose:()=>l(!1),envStage:o,envPulse:s})]})},wg=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:d,modelId:g,...p})=>{const m=qn(),b=e??t??n;return!!m&&(!b||vt(b)===vt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!f&&u===void 0&&d===void 0&&g===void 0?h.jsx($s,{...p}):h.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:d,modelId:g,children:h.jsx($s,{...p})})},Cg={Colors:{VPS_White:"#fff",VPS_Dark_Blue:"#1A1A31",VPS_Light_Blue:"#353552",VPS_Light_Grey:"#D1D1D6",VPS_Orange:"#FF4717",Dark_Blue_50:"#F1F5FC",Dark_Blue_100:"#E5EBFA",Dark_Blue_200:"#D1DAF4",Dark_Blue_300:"#B4C2ED",Dark_Blue_400:"#96A2E3",Dark_Blue_500:"#7C84D8",Dark_Blue_600:"#6262C9",Dark_Blue_700:"#5351B1",Dark_Blue_800:"#44448F",Dark_Blue_900:"#3C3D73",Dark_Blue_950:"#1A1A31",Light_Blue_50:"#F4F6FA",Light_Blue_100:"#E6E9F3",Light_Blue_200:"#D3D8EA",Light_Blue_300:"#B4BEDC",Light_Blue_400:"#909DCA",Light_Blue_500:"#7580BC",Light_Blue_600:"#6369AD",Light_Blue_700:"#575A9E",Light_Blue_800:"#4B4B82",Light_Blue_900:"#404168",Light_Blue_950:"#353552",Grey_50:"#F6F6F7",Grey_100:"#EFEFF0",Grey_200:"#E2E1E4",Grey_300:"#D1D1D6",Grey_400:"#B9B9C0",Grey_500:"#A7A6AE",Grey_600:"#93919A",Grey_700:"#7E7D85",Grey_800:"#67666D",Grey_900:"#56555A",Grey_950:"#323234",Orange_50:"#FFF3ED",Orange_100:"#FFE4D4",Orange_200:"#FFC5A8",Orange_300:"#FF9D70",Orange_400:"#FF6837",Orange_500:"#FF4717",Orange_600:"#F02706",Orange_700:"#C71807",Orange_800:"#9E150E",Orange_900:"#7F150F",Orange_950:"#450605",Success_50:"#F1FCF5",Success_100:"#DEFAEA",Success_200:"#BEF4D4",Success_300:"#8BEAB3",Success_400:"#52D689",Success_500:"#2ECC71",Success_600:"#1D9C53",Success_700:"#1B7A43",Success_800:"#1A6139",Success_900:"#175031",Success_950:"#072C18",Warning_50:"#FFFEEA",Warning_100:"#FFF9C5",Warning_200:"#FFF485",Warning_300:"#FFE846",Warning_400:"#FFD81B",Warning_500:"#FFB800",Warning_600:"#E28D00",Warning_700:"#BB6302",Warning_800:"#984C08",Warning_900:"#7C3F0B",Warning_950:"#482000",Error_50:"#FFF1F1",Error_100:"#FFDFDF",Error_200:"#FFC5C5",Error_300:"#FF9D9D",Error_400:"#FF6464",Error_500:"#FF2E2E",Error_600:"#ED1515",Error_700:"#C80D0D",Error_800:"#A50F0F",Error_900:"#881414",Error_950:"#4B0404",Netural_25:"#FDFDFD",Netural_50:"#FAFAFA",Netural_100:"#F5F5F5",Netural_200:"#E9EAEC",Netural_300:"#D6D7DB",Netural_400:"#A4A7AE",Netural_500:"#727681",Netural_600:"#545863",Netural_700:"#424651",Netural_800:"#252B37",Netural_900:"#191D28",Netural_950:"#0A0D12",Tint_Dark_Blue_100:"#1A1A31",Tint_Dark_Blue_90:"#313146",Tint_Dark_Blue_80:"#48485A",Tint_Dark_Blue_70:"#5F5F6F",Tint_Dark_Blue_60:"#767683",Tint_Dark_Blue_50:"#8C8C98",Tint_Dark_Blue_40:"#A3A3AD",Tint_Dark_Blue_30:"#BABAC1",Tint_Dark_Blue_20:"#D1D1D6",Tint_Dark_Blue_10:"#E8E8EA",Tint_Dark_Blue_5:"#F4F4F5",Tint_Light_Blue_100:"#353552",Tint_Light_Blue_90:"#494963",Tint_Light_Blue_80:"#5D5D75",Tint_Light_Blue_70:"#727286",Tint_Light_Blue_60:"#868697",Tint_Light_Blue_50:"#9A9AA8",Tint_Light_Blue_40:"#AEAEBA",Tint_Light_Blue_30:"#C2C2CB",Tint_Light_Blue_20:"#D7D7DC",Tint_Light_Blue_10:"#EBEBEE",Tint_Light_Blue_5:"#F5F5F6",Tint_Grey_100:"#D1D1D6",Tint_Grey_90:"#D6D6DA",Tint_Grey_80:"#DADADE",Tint_Grey_70:"#DFDFE2",Tint_Grey_60:"#E3E3E6",Tint_Grey_50:"#E8E8EB",Tint_Grey_40:"#EDEDEF",Tint_Grey_30:"#F1F1F3",Tint_Grey_20:"#F6F6F7",Tint_Grey_10:"#FAFAFB",Tint_Grey_5:"#FDFDFD",Tint_Solus_100:"#FF4717",Tint_Solus_90:"#FF592E",Tint_Solus_80:"#FF6C45",Tint_Solus_70:"#FF7E5D",Tint_Solus_60:"#FF9174",Tint_Solus_50:"#FFA38B",Tint_Solus_40:"#FFB5A2",Tint_Solus_30:"#FFC8B9",Tint_Solus_20:"#FFDAD1",Tint_Solus_10:"#FFEDE8",Tint_Solus_5:"#FFF6F3",Other_Color:"#00ABC9"},StatusColor:{tested:"#3E4784",received:"#EE46BC",InTransit:"#6938EF",registered:"#1570EF",reported:"#2ECC71",noStatus:"#727681",Action:"#FF2E2E",Caution:"#FFB800",Pass:"#2ECC71",No_Rating:"#FF6837",Received:"#EE46BC",Tested:"#3E4784",Reported:"#2ECC71",No_Status:"#6938EF",Overdue:"#FF2E2E",Duesoon:"#FFB800",Scheduled:"#1570EF",Good:"#2ECC71",NotApplicable:"#353552"}};exports.ChatPanel=Fo;exports.ChatProvider=Yr;exports.ChatbotWidget=mg;exports.ColorPalette=Cg;exports.EmbeddedChatbot=wg;exports.buildApiUrl=Rn;exports.chatApi=ta;exports.createChatApi=Gr;exports.resolveApiBaseUrl=vt;exports.useChatContext=zs;exports.useChatbot=en;exports.useOptionalChatContext=qn;
|