vpschatbotwidget 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var zc=Object.create;var or=Object.defineProperty;var Wc=Object.getOwnPropertyDescriptor;var qc=Object.getOwnPropertyNames;var Gc=Object.getPrototypeOf,Kc=Object.prototype.hasOwnProperty;var Yc=(e,t,n)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qc(t))!Kc.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=Wc(t,o))||r.enumerable});return e};var Jc=(e,t,n)=>(n=e!=null?zc(Gc(e)):{},Xc(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var ae=(e,t,n)=>Yc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),I=require("react"),Zc=require("react-dom");var sr=typeof document<"u"?document.currentScript:null;function zs(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 y=zs(I),dt=zs(Zc),Qc={};function yt(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"&&Qc,"");return String(t).trim().replace(/\/+$/,"")}function Rn(e,t){const n=yt(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&&!ea(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 ea(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 ta(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=yt(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 h=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(!h.ok){if(h.status===404||h.status===405)return await this.sendMessage(r,o,s,a);const S=await lr(h);throw Wo(S,"I couldn't process that request right now.",h.status)}if(!h.body||(u=(f=h.headers)==null?void 0:f.get("content-type"))!=null&&u.includes("application/json")){const S=zo(await lr(h));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=h.body.getReader(),d=new TextDecoder;let m="";const b={value:null},v=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+=d.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(v(w),b.value)break}m+=d.decode(),!b.value&&m.trim()&&v(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(h){throw!(h instanceof Error)&&h&&typeof h=="object"&&"message"in h?h:{message:"Something went wrong while connecting. Please try again."}}},async getHistory(r){try{return((await n(`/api/v1/sessions/${r}/messages`)).messages||[]).map(ta)}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 na=Gr(),ra=[{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 oa(){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,h=c.createOscillator(),g=c.createGain();h.frequency.value=f,g.gain.setValueAtTime(.001,u),g.gain.exponentialRampToValueAtTime(.06,u+.015),g.gain.exponentialRampToValueAtTime(.001,u+.14),h.connect(g),g.connect(c.destination),h.onended=()=>{h.disconnect(),g.disconnect()},h.start(u),h.stop(u+.15)}}catch{}},[]);return{soundEnabled:e,toggleSound:s,prepareSound:o,playSound:i}}const Kr=I.createContext(null);function Ws(){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 Pt(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 sa=`Hello! I am your **VPS Veritas assistant**.
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 p=require("react/jsx-runtime"),I=require("react"),Jc=require("react-dom");var sr=typeof document<"u"?document.currentScript:null;function Ws(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 y=Ws(I),dt=Ws(Jc),Zc={};function yt(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=yt(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 Wo(e){return e&&typeof e=="object"&&"data"in e&&e.success!==!1?e.data:e}function qo(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=yt(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 qo(c,"I couldn't process that request right now.",s.status);return Wo(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 u,f;const l=Rn(t,`/api/v1/sessions/${r}/messages/stream`);try{const h=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(!h.ok){if(h.status===404||h.status===405)return await this.sendMessage(r,o,s,a);const E=await lr(h);throw qo(E,"I couldn't process that request right now.",h.status)}if(!h.body||(f=(u=h.headers)==null?void 0:u.get("content-type"))!=null&&f.includes("application/json")){const E=Wo(await lr(h));if(typeof E.answer!="string"||!E.usage)throw{message:"The response stream ended unexpectedly."};return{requestId:E.request_id,sessionId:E.session_id,answer:E.answer,sources:(E.sources||[]).map(ir),toolCalls:(E.tool_calls||[]).map(cr),usage:ar(E.usage),durationMs:E.duration_ms}}const g=h.body.getReader(),d=new TextDecoder;let m="";const b={value:null},v=E=>{const C=E.split(/\r?\n/).filter(S=>S.startsWith("data:")).map(S=>S.slice(5).trimStart()).join(`
2
+ `);if(!C)return;let w={};try{const S=JSON.parse(C);if(!S||typeof S!="object")return;w=S}catch{return}if(w.type==="progress"&&typeof w.stage=="string")i==null||i(w.stage);else if(w.type==="token"&&typeof w.text=="string")c==null||c(w.text);else if(w.type==="complete")b.value={requestId:w.request_id||"",sessionId:w.session_id||r,answer:w.answer||"",sources:(w.sources||[]).map(ir),toolCalls:(w.tool_calls||[]).map(cr),usage:w.usage?ar(w.usage):{model:"",promptTokens:0,completionTokens:0,totalTokens:0},durationMs:w.duration_ms};else if(w.type==="error")throw{message:w.message||"I couldn't process that request right now.",requestId:w.request_id}};try{for(;!b.value;){const{done:E,value:C}=await g.read();if(E)break;if(m+=d.decode(C,{stream:!0}),m.length>1e6)throw{message:"The response stream was too large."};const w=m.split(/\r?\n\r?\n/);m=w.pop()||"";for(const S of w)if(v(S),b.value)break}m+=d.decode(),!b.value&&m.trim()&&v(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(h){throw!(h instanceof Error)&&h&&typeof h=="object"&&"message"in h?h:{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?"}],Go="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(Go)!=="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(Go,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,u]of[660,880].entries()){const f=a+l*.09,h=c.createOscillator(),g=c.createGain();h.frequency.value=u,g.gain.setValueAtTime(.001,f),g.gain.exponentialRampToValueAtTime(.06,f+.015),g.gain.exponentialRampToValueAtTime(.001,f+.14),h.connect(g),g.connect(c.destination),h.onended=()=>{h.disconnect(),g.disconnect()},h.start(f),h.stop(f+.15)}}catch{}},[]);return{soundEnabled:e,toggleSound:s,prepareSound:o,playSound:i}}const Kr=I.createContext(null);function qs(){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 Pt(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,52 +8,52 @@ 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 Go(e){return`${e}-${crypto.randomUUID()}`}function ia(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=ra,disableSuggestions:c=!1,initialMessage:a,apiBaseUrl:l,apiUrl:f,proxyUrl:u,api:h,hideInspectSources:g=!1,showGroundedSources:d=!1,modelId:m="auto"})=>{const b=l??f??u,v=I.useMemo(()=>h??Gr(b),[h,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||sa,createdAt:new Date().toISOString(),status:"complete"},[s]),[E,C]=I.useState(null),[w,R]=I.useState(()=>S?[S]:[]),[P,O]=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}=oa();I.useEffect(()=>Y(m),[m]),I.useEffect(()=>{var J;let z=!0;return j([]),(J=v.listModels)==null||J.call(v).then(ce=>{z&&j((ce==null?void 0:ce.models)||[])}).catch(()=>{}),()=>{z=!1}},[v]);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?(Pt("completion-to-commit",z.completedAt,ce),Pt("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&&(Pt("first-token-to-commit",z.firstTokenAt,ce),z.firstCommitRecorded=!0)},[w]);const B=I.useCallback(async z=>{if(E)return E;O("connecting");const J=await v.createSession(z);if(z.aborted)throw new DOMException("Aborted","AbortError");return C(J.sessionId),J.sessionId},[E,v]),$=I.useCallback(async z=>{if(k.current)return;ie(),k.current=!0;const J=new AbortController;_.current=J;let ce,he="";const Oe=()=>{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]),O("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();Pt("request-preparation",H,ge);const V=v.sendMessageStream?await v.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(),Pt("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 v.sendMessage(be,z,{roleId:x.roleId,client:x.client,modelId:N},J.signal);if(Oe(),J.signal.aborted)return;G.messageId=V.requestId||Re,G.completedAt=performance.now(),Pt("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)),O("idle"),L()}catch(be){if(Oe(),T.current===G&&(T.current=null),J.signal.aborted)return;const ge=ia(be);R(V=>V.map(q=>q.id===Re?{...q,content:ge,status:"error",progressText:void 0}:q)),F(ge),O("error")}finally{Oe(),_.current===J&&(_.current=null,k.current=!1)}},[B,v,x.client,x.roleId,N,ie,L]),Q=I.useCallback(async z=>{const J=z.trim();!J||P==="awaiting"||P==="connecting"||await $(J)},[$,P]),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)),O("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]:[]),O("idle"),F(null),A.current=null,E&&await v.closeSession(E)},[E,v,S]);I.useEffect(()=>{!a||D.current||(D.current=!0,Q(a))},[a,Q]);const ve=I.useMemo(()=>({messages:w,status:P,error:M,sessionId:E,pendingTicket:null,ticketBusy:!1,lastTicket:null,suggestions:i,showSuggestions:!c&&P==="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:v.apiBaseUrl,hideInspectSources:g,showGroundedSources:d,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,P,M,E,i,c,x,v.apiBaseUrl,g,d,K,le,Q,ee,te,re,W,ne,oe,U,N,X]);return p.jsx(Kr.Provider,{value:ve,children:e})};function qs(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=qs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Gs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=qs(e))&&(r&&(r+=" "),r+=t);return r}function ue(...e){return Gs(e)}function Ks({className:e,variant:t="default",...n}){return p.jsx("div",{...n,"data-slot":"marker","data-variant":t,className:ue("chat-marker",e)})}function ca({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-icon",className:ue("chat-marker-icon",e),"aria-hidden":"true"})}function Ys({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-content",className:ue("chat-marker-content",e)})}function en(){return Ws()}/**
11
+ Feel free to ask a question or select one of the suggested topics below!`;function Ko(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:u,proxyUrl:f,api:h,hideInspectSources:g=!1,showGroundedSources:d=!1,modelId:m="auto"})=>{const b=l??u??f,v=I.useMemo(()=>h??Gr(b),[h,b]),x=I.useMemo(()=>({...t,...n!==void 0?{role:n}:{},...r!==void 0?{roleId:r}:{},...o!==void 0?{client:o}:{}}),[t,n,r,o]),E=I.useMemo(()=>s===""?null:{id:"welcome-default",role:"assistant",content:s||oa,createdAt:new Date().toISOString(),status:"complete"},[s]),[C,w]=I.useState(null),[S,R]=I.useState(()=>E?[E]:[]),[P,O]=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=v.listModels)==null||J.call(v).then(ce=>{z&&j((ce==null?void 0:ce.models)||[])}).catch(()=>{}),()=>{z=!1}},[v]);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=S.find(he=>he.id===z.messageId),ce=performance.now();(J==null?void 0:J.status)==="complete"&&z.completedAt!==void 0?(Pt("completion-to-commit",z.completedAt,ce),Pt("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&&(Pt("first-token-to-commit",z.firstTokenAt,ce),z.firstCommitRecorded=!0)},[S]);const B=I.useCallback(async z=>{if(C)return C;O("connecting");const J=await v.createSession(z);if(z.aborted)throw new DOMException("Aborted","AbortError");return w(J.sessionId),J.sessionId},[C,v]),$=I.useCallback(async z=>{if(k.current)return;ie(),k.current=!0;const J=new AbortController;_.current=J;let ce,he="";const Oe=()=>{ce!==void 0&&cancelAnimationFrame(ce),ce=void 0};A.current=z;const je={id:Ko("user"),role:"user",content:z,createdAt:new Date().toISOString(),status:"complete"},Re=Ko("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]),O("awaiting"),F(null);const Ee=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();Pt("request-preparation",H,ge);const V=v.sendMessageStream?await v.sendMessageStream(be,z,{roleId:x.roleId,client:x.client,modelId:N},Ee,q=>{J.signal.aborted||(q&&G.firstTokenAt===void 0&&(G.firstTokenAt=performance.now(),Pt("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 v.sendMessage(be,z,{roleId:x.roleId,client:x.client,modelId:N},J.signal);if(Oe(),J.signal.aborted)return;G.messageId=V.requestId||Re,G.completedAt=performance.now(),Pt("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)),O("idle"),L()}catch(be){if(Oe(),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),O("error")}finally{Oe(),_.current===J&&(_.current=null,k.current=!1)}},[B,v,x.client,x.roleId,N,ie,L]),Q=I.useCallback(async z=>{const J=z.trim();!J||P==="awaiting"||P==="connecting"||await $(J)},[$,P]),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)),O("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,w(null),R(E?[E]:[]),O("idle"),F(null),A.current=null,C&&await v.closeSession(C)},[C,v,E]);I.useEffect(()=>{!a||D.current||(D.current=!0,Q(a))},[a,Q]);const ve=I.useMemo(()=>({messages:S,status:P,error:M,sessionId:C,pendingTicket:null,ticketBusy:!1,lastTicket:null,suggestions:i,showSuggestions:!c&&P==="idle"&&(S.length===0||S.length===1&&S[0].id==="welcome-default"||S.some(z=>z.role==="assistant"&&z.status==="complete"&&!z.id.startsWith("welcome"))),suggestionBadgesEnabled:!c,userContext:x,apiBaseUrl:v.apiBaseUrl,hideInspectSources:g,showGroundedSources:d,soundEnabled:K,toggleSound:le,sendMessage:Q,stopResponse:ee,toggleMessageFeedback:te,retryLast:re,confirmTicket:W,cancelTicket:ne,resetConversation:oe,models:U,selectedModelId:N,selectModel:X}),[S,P,M,C,i,c,x,v.apiBaseUrl,g,d,K,le,Q,ee,te,re,W,ne,oe,U,N,X]);return p.jsx(Kr.Provider,{value:ve,children:e})};function Gs(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=Gs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ks(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Gs(e))&&(r&&(r+=" "),r+=t);return r}function ue(...e){return Ks(e)}function Ys({className:e,variant:t="default",...n}){return p.jsx("div",{...n,"data-slot":"marker","data-variant":t,className:ue("chat-marker",e)})}function ia({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-icon",className:ue("chat-marker-icon",e),"aria-hidden":"true"})}function Xs({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-content",className:ue("chat-marker-content",e)})}function en(){return qs()}/**
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 aa=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xs=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
16
+ */const ca=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Js=(...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 la={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"};/**
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 ua=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,...la,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Xs("lucide",o),...c},[...i.map(([l,f])=>I.createElement(l,f)),...Array.isArray(s)?s:[s]]));/**
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:Js("lucide",o),...c},[...i.map(([l,u])=>I.createElement(l,u)),...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 ye=(e,t)=>{const n=I.forwardRef(({className:r,...o},s)=>I.createElement(ua,{ref:s,iconNode:t,className:Xs(`lucide-${aa(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
31
+ */const ye=(e,t)=>{const n=I.forwardRef(({className:r,...o},s)=>I.createElement(la,{ref:s,iconNode:t,className:Js(`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 fa=ye("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
36
+ */const ua=ye("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 da=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
41
+ */const fa=ye("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 pa=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
46
+ */const da=ye("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 ha=ye("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"}]]);/**
51
+ */const pa=ye("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 Js=ye("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"}]]);/**
56
+ */const ha=ye("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.
@@ -113,7 +113,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
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 ni=ye("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"}]]);/**
116
+ */const Ca=ye("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.
@@ -133,50 +133,50 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
133
133
  *
134
134
  * This source code is licensed under the ISC license.
135
135
  * See the LICENSE file in the root directory of this source tree.
136
- */const Ca=ye("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"}]]);/**
136
+ */const Ra=ye("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
137
  * @license lucide-react v0.468.0 - ISC
138
138
  *
139
139
  * This source code is licensed under the ISC license.
140
140
  * See the LICENSE file in the root directory of this source tree.
141
- */const ri=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
141
+ */const ni=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
142
142
  * @license lucide-react v0.468.0 - ISC
143
143
  *
144
144
  * This source code is licensed under the ISC license.
145
145
  * See the LICENSE file in the root directory of this source tree.
146
- */const Ra=ye("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"}]]);/**
146
+ */const Ta=ye("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
147
  * @license lucide-react v0.468.0 - ISC
148
148
  *
149
149
  * This source code is licensed under the ISC license.
150
150
  * See the LICENSE file in the root directory of this source tree.
151
- */const Ta=ye("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"}]]);/**
151
+ */const Pa=ye("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
152
  * @license lucide-react v0.468.0 - ISC
153
153
  *
154
154
  * This source code is licensed under the ISC license.
155
155
  * See the LICENSE file in the root directory of this source tree.
156
- */const Pa=ye("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"}]]);/**
156
+ */const Oa=ye("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
157
  * @license lucide-react v0.468.0 - ISC
158
158
  *
159
159
  * This source code is licensed under the ISC license.
160
160
  * See the LICENSE file in the root directory of this source tree.
161
- */const Oa=ye("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"}]]);/**
161
+ */const Ia=ye("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
162
  * @license lucide-react v0.468.0 - ISC
163
163
  *
164
164
  * This source code is licensed under the ISC license.
165
165
  * See the LICENSE file in the root directory of this source tree.
166
- */const Ia=ye("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"}]]);/**
166
+ */const _a=ye("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
167
  * @license lucide-react v0.468.0 - ISC
168
168
  *
169
169
  * This source code is licensed under the ISC license.
170
170
  * See the LICENSE file in the root directory of this source tree.
171
- */const _a=ye("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"}]]);/**
171
+ */const ka=ye("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
172
  * @license lucide-react v0.468.0 - ISC
173
173
  *
174
174
  * This source code is licensed under the ISC license.
175
175
  * See the LICENSE file in the root directory of this source tree.
176
- */const ka=ye("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 p.jsx("div",{...n,"data-slot":"message","data-align":e,className:ue("chat-message",t)})}function oi({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-avatar",className:ue("chat-message-avatar",e)})}function Zr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-content",className:ue("chat-message-content",e)})}function Aa({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-header",className:ue("chat-message-header",e)})}function Cr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-footer",className:ue("chat-message-footer",e)})}const tt={...y},Ko={};function Ye(e,t){const n=y.useRef(Ko);return n.current===Ko&&(n.current=e(t)),n}const ur=tt.useInsertionEffect,Na=ur&&ur!==tt.useLayoutEffect?ur:e=>e();function fe(e){const t=Ye(ja).current;return t.next=e,Na(t.effect),t.trampoline}function ja(){const e={next:void 0,callback:Ma,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function Ma(){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(si).current;return Fa(o,e,t,n,r)&&ii(o,[e,t,n,r]),o.callback}function Da(e){const t=Ye(si).current;return La(t,e)&&ii(t,e),t.callback}function si(){return{callback:null,cleanup:null,refs:[]}}function Fa(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function La(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function ii(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 Ba=parseInt(y.version,10);function ci(e){return Ba>=e}function Yo(e){if(!y.isValidElement(e))return null;const t=e,n=t.props;return(ci(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 Pr;process.env.NODE_ENV!=="production"&&(Pr=new Set);function ai(e,t){return function(...r){if(process.env.NODE_ENV!=="production"){const o=r.join(" "),s=`${t}: ${o}`,i=`${e}:${s}`;Pr.has(i)||(Pr.add(i),e==="warn"?console.warn(s):console.error(s))}}}const Qr=ai("warn","Base UI");function eo(){}const Va=Object.freeze([]),Fe=Object.freeze({});function $a(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 Ha(e,t){return typeof e=="function"?e(t):e}function li(e,t){return typeof e=="function"?e(t):e}const ui={};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 Ua(e){if(e.length===0)return ui;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 di(e)?{...e(ui)}:za(e)}function Tn(e,t){return di(t)?t(e):Wa(e,t)}function za(e){const t={...e};for(const n in t){const r=t[n];fi(n,r)&&(t[n]=pi(r))}return t}function Wa(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]=hi(e.className,r);break}default:fi(n,r)?e[n]=qa(e[n],r):e[n]=r}}return e}function fi(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 di(e){return typeof e=="function"}function qa(e,t){return t?e?(...n)=>{const r=n[0];if(gi(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}:pi(t):e}function pi(e){return e&&((...t)=>{const n=t[0];return gi(n)&&An(n),e(...t)})}function An(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function hi(e,t){return t?e?t+" "+e:t:e}function gi(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function pt(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Za(r));const o=Ga(t,n,r);if(n.enabled===!1)return null;const s=n.state??Fe;return Qa(e,r,o,s)}function Ga(e,t,n){const{className:r,style:o}=e,{state:s=Fe,ref:i,props:c,stateAttributesMapping:a,enabled:l=!0}=t,f=l?Ha(r,s):void 0,u=l?li(o,s):void 0,h=l?$a(s,a):Fe,g=l&&c?Ka(c):void 0,d=l?Tr(h,g)??{}:Fe;return typeof document<"u"&&(l?Array.isArray(i)?d.ref=Da([d.ref,Yo(n),...i]):d.ref=Rr(d.ref,Yo(n),i):Rr(null,null)),l?(f!==void 0&&(d.className=hi(d.className,f)),u!==void 0&&(d.style=Tr(d.style,u)),d):Fe}function Ka(e){return Array.isArray(e)?Ua(e):to(void 0,e)}const Ya=Symbol.for("react.lazy"),Xa=/^[A-Z][A-Za-z0-9$]*$/,Ja=/[a-z]/;function Za(e){if((e==null?void 0:e.$$typeof)!==Ya)return e;const t=y.Children.toArray(e)[0];return y.isValidElement(t)?t:e}function Qa(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&el(t),t(n,r);const o=to(n,t.props);if(o.ref=n.ref,process.env.NODE_ENV!=="production"&&!y.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 y.cloneElement(t,o)}return tl(e,n)}function el(e){const t=e.name;t.length!==0&&Xa.test(t)&&Ja.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 tl(e,t){return e==="button"?I.createElement("button",{type:"button",...t,key:t.key}):e==="img"?I.createElement("img",{alt:"",...t,key:t.key}):y.createElement(e,t)}const Nn=ai("error","Base UI");function nl({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=y.useRef(e!==void 0),[s,i]=y.useState(()=>t),c=o&&e!==void 0?e:s;if(process.env.NODE_ENV!=="production"){y.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}=y.useRef(t);y.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=y.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 mi(){const[,e]=y.useState({});return y.useCallback(()=>{e({})},[])}let Jo=0;function rl(e,t="mui"){const n=y.useRef(void 0),r=mi(),o=e??n.current;return y.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 rl(e,t)}function bi(e){return Gn(e,"base-ui")}function Pe(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 vi="none",Kn="trigger-press",We="trigger-hover",Pn="trigger-focus",ol="outside-press",sl="focus-out",no="escape-key",Or="imperative-action",il=()=>{},pe=typeof document<"u"?y.useLayoutEffect:il;function ro(e){y.useEffect(e,Va)}const pn=null;let Qo=globalThis.requestAnimationFrame;class cl{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 cl;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 al(){const e=Ye(Ne.create).current;return ro(e.disposeEffect),e}function yi(e,t=!1,n=!1,r=!1){const[o,s]=y.useState(e&&t?"idle":void 0),[i,c]=y.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 ll(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=nl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=yi(s,!0,!0),f=bi(),[u,h]=y.useState(),g=u===null?void 0:u??f,d=fe(m=>{const b=!s,v=Pe(Kn,m.nativeEvent);r(b,v),!v.isCanceled&&i(b)});return y.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:d,mounted:c,open:s,panelId:g,setMounted:a,setOpen:i,setPanelIdState:h,transitionStatus:l}),[f,o,d,c,s,g,a,i,h,l])}function ul(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=ul("https://base-ui.com/production-error","Base UI"),oo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(oo.displayName="CollapsibleRootContext");function xi(){const e=y.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",fl="data-ending-style",dl={[so]:""},pl={[fl]:""},io={transitionStatus(e){return e==="starting"?dl:e==="ending"?pl:null}},hl="data-open",gl="data-closed",gn=so,ml="data-panel-open",bl={[hl]:""},vl={[gl]:""},yl={open(e){return e?{[ml]:""}:null}},xl={open(e){return e?bl:vl}},Ei={...xl,...io},Si=y.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),h=ll({open:a,defaultOpen:s,onOpenChange:u,disabled:i}),g=y.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),d=y.useMemo(()=>({...h,onOpenChange:u,state:g}),[h,u,g]),m=pt("div",t,{state:g,ref:n,props:f,stateAttributesMapping:Ei});return p.jsx(oo.Provider,{value:d,children:m})});process.env.NODE_ENV!=="production"&&(Si.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 El(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 Sl=/transform|translate|scale|rotate|perspective|filter/,wl=/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))||Sl.test(t.willChange||"")||wl.test(t.contain||"")}function Cl(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 wi(e){const t=lt(e);return ct(t)?(e.ownerDocument||e).body:_e(t)&&Xn(t)?t:wi(t)}function Gt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=wi(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 Ci=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ci.displayName="CompositeRootContext");function Rl(e=!1){const t=y.useContext(Ci);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 Tl(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:y.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 Ri(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=y.useRef(null),c=Rl(!0),a=s??c!==void 0,{props:l}=Tl({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&y.useEffect(()=>{var d,m;if(!i.current)return;const g=mn(i.current);if(o){if(!g){const b=((d=tt.captureOwnerStack)==null?void 0:d.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=y.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=y.useCallback((g={})=>{const{onClick:d,onMouseDown:m,onKeyUp:b,onKeyDown:v,onPointerDown:x,...S}=g;return to({onClick(E){if(t){E.preventDefault();return}d==null||d(E)},onMouseDown(E){t||m==null||m(E)},onKeyDown(E){if(t||(An(E),v==null||v(E),E.baseUIHandlerPrevented))return;const C=E.target===E.currentTarget,w=E.currentTarget,R=mn(w),P=!o&&Pl(w),O=C&&(o?R:!P),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(!O||o||!F&&!M){C&&P&&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]),h=fe(g=>{i.current=g,f()});return{getButtonProps:u,buttonRef:h}}function mn(e){return _e(e)&&e.tagName==="BUTTON"}function Pl(e){return _e(e)&&e.tagName==="A"&&!!e.href}const Ol={...yl,...io},Ti=y.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=xi(),{className:a,disabled:l=c,render:f,nativeButton:u=!0,style:h,...g}=t,{getButtonProps:d,buttonRef:m}=Ri({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,d],stateAttributesMapping:Ol})});process.env.NODE_ENV!=="production"&&(Ti.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(Il,e).current;return t.next=e,pe(t.effect),t}function Il(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function _l(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 kl(e){if(!bn){const t=[];bn=t,queueMicrotask(()=>{bn=null,dt.flushSync(()=>{for(const n of t)n()})})}bn.push(e)}function Pi(e,t=!1,n=!1){const r=al();return fe((o,s=null)=>{r.cancel();const i=_l(e);if(i==null)return;const c=i,a=()=>{if(!n){dt.flushSync(o);return}kl(()=>{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=Pi(r,n,o);y.useEffect(()=>{if(!t)return;const a=new AbortController;return c(i,a.signal),()=>{a.abort()}},[t,n,i,c])}const Ot={height:void 0,width:void 0};function Al(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:c,setMounted:a,setOpen:l,transitionStatus:f}=e,u=y.useRef(null),h=y.useRef(null),[g,d]=y.useState(Ot),m=y.useRef(Ot),b=y.useRef(!1),v=y.useRef(c),x=y.useRef(!1),[S,E]=y.useState(!1),C=y.useRef(null),w=Rr(t,u),R=qe(c),P=Pi(u),O=!c&&!s,M=S?"idle":f,F=c&&(v.current||x.current),A=!c&&s&&h.current==="css-animation"&&g.height===void 0&&g.width===void 0?m.current:g,D=n&&O&&h.current!=="css-animation",_=fe((N,Y=!0)=>{Y&&(m.current=N),d(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&&h.current==="css-animation"&&(x.current=!0)});pe(()=>{!S||f==="starting"||E(!1)},[S,f]),y.useEffect(()=>()=>{U(),T()},[U,T]),pe(()=>{c||(v.current=!1,x.current=!1);const N=u.current;if(!N)return;!c&&C.current&&T();const Y=Nl(N,F);if(h.current=Y,c&&f==="idle"&&v.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=jl(N);if(_(It(N)),!ie)return B;const $=vn(N,"transition-duration","0s");return k($),E(!0),B}_(It(N));const L=vn(N,"animation-name","none");if(!ie){L();return}const X=vn(N,"animation-duration","0s");L(),k(X),E(!0);return}if(!c&&s&&(f==="idle"||f==="starting")){if(Y==="none"){_(Ot,!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"&&vn(N,"animation-name","none")()},[s,c,T,_,a,k,F,f]),uo({enabled:c&&s&&M==="idle",open:!0,ref:u,onComplete(){c&&_(Ot,!1)}}),y.useEffect(()=>{if(c||!s||M!=="ending")return;if(!u.current){a(!1),_(Ot,!1);return}const Y=new AbortController;let K=-1;function le(){R.current||(a(!1),_(Ot,!1))}return K=Ne.request(()=>{P(le,Y.signal)}),()=>{Ne.cancel(K),Y.abort()}},[R,s,c,M,P,_,a]),pe(()=>{const N=u.current;!N||!n||!O||N.setAttribute("hidden","until-found")},[O,n]),y.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 $=Pe(vi,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:O,id:r},ref:w,shouldPreventOpenAnimation:F,shouldRender:j,transitionStatus:M,width:A.width}}function It(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Nl(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 vn(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 jl(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 Ml="--collapsible-panel-height",Dl="--collapsible-panel-width",Oi=y.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:c,style:a,...l}=t;process.env.NODE_ENV!=="production"&&y.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:h,open:g,setMounted:d,setPanelIdState:m,setOpen:b,state:v,transitionStatus:x}=xi(),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:P,ref:O,shouldPreventOpenAnimation:M,shouldRender:F,transitionStatus:A,width:D}=Al({externalRef:n,hiddenUntilFound:S,id:w,keepMounted:E,mounted:u,onOpenChange:h,open:g,setMounted:d,setOpen:b,transitionStatus:x}),_={...v,transitionStatus:A},T=li(a,_),k=pt("div",{...t,style:void 0},{state:_,ref:O,props:[P,{style:{[Ml]:R===void 0?"auto":`${R}px`,[Dl]:D===void 0?"auto":`${D}px`}},l,T?{style:T}:void 0,M?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Ei});return F?k:null});process.env.NODE_ENV!=="production"&&(Oi.displayName="CollapsiblePanel");function bt({className:e,...t}){return p.jsx("div",{"data-slot":"trace",className:ue("trace",e),...t})}function Nt({className:e,status:t,...n}){return p.jsx("span",{"data-slot":"trace-line","data-status":t,className:ue("trace-line",e),...n})}function xt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-icon",className:ue("trace-icon",e),...t,"aria-hidden":"true"})}function jt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-title",className:ue("trace-title",e),...t})}function Kt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-description",className:ue("trace-description",e),...t})}function Ii(e){return p.jsx(Si,{"data-slot":"trace-collapsible",...e})}function _i({children:e,className:t,...n}){return p.jsxs(Ti,{type:"button","data-slot":"trace-collapsible-trigger",className:ue("trace-trigger",t),...n,children:[e,p.jsx(xt,{className:"trace-chevron",children:p.jsx(Zs,{size:13})})]})}function ki({className:e,...t}){return p.jsx(Oi,{...t,"data-slot":"trace-collapsible-content",className:ue("trace-content",e)})}const Fl=({message:e,onRetry:t})=>p.jsx(Jr,{className:"chat-error-banner",role:"alert",children:p.jsxs(Zr,{children:[p.jsx(bt,{className:"chat-message-body",children:p.jsxs(Nt,{status:"error",children:[p.jsx(xt,{children:p.jsx(ma,{size:14})}),p.jsx(jt,{className:"chat-error-title",children:e})]})}),t&&p.jsx(Cr,{children:p.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Ll={alpha:{label:"Alpha",Icon:ya,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:Ra,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Ea,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:ba,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Bl=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Ll[e];return p.jsxs("span",{className:`env-badge-inline ${s} ${n}`.trim(),title:i,"aria-label":`${r} build`,role:"status",children:[p.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),p.jsx("span",{className:"env-badge-inline-label",children:r})]})},Vl=e=>p.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:p.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"})}),$l=({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})=>p.jsxs("header",{className:"chat-header",children:[p.jsxs("div",{className:"chat-header-left",children:[o&&p.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:p.jsx(da,{size:16})}),p.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Vl,{width:"16px",height:"16px",color:"white"})}),p.jsxs("div",{children:[p.jsxs("div",{className:"chat-header-title-row",children:[p.jsx("h2",{className:"chat-header-title",children:e}),p.jsx(Bl,{stage:a,pulse:l})]}),p.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),p.jsxs("div",{className:"chat-header-actions",children:[i&&p.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?p.jsx(Oa,{size:16,"aria-hidden":"true"}):p.jsx(Ia,{size:16,"aria-hidden":"true"})}),r&&p.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:p.jsx(Ca,{size:15})}),n&&p.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:p.jsx(Sa,{size:16})})]})]});function Hl(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 Ul({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group",className:ue("chat-input-group",e)})}function zl({className:e,...t}){return p.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:ue("chat-textarea",e)})}function Wl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group-addon",className:ue("chat-input-actions",e)})}function ns({className:e,...t}){return p.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:ue("chat-send-btn",e)})}const Ai=y.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}=Ri({disabled:s,focusableWhenDisabled:i,native:c});return pt("button",t,{state:{disabled:s},ref:[n,u],props:[l,f]})});process.env.NODE_ENV!=="production"&&(Ai.displayName="Button");const rs=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,os=Gs,ql=(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 h=rs(f)||rs(u);return o[l][h]}),c=n&&Object.entries(n).reduce((l,f)=>{let[u,h]=f;return h===void 0||(l[u]=h),l},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,f)=>{let{class:u,className:h,...g}=f;return Object.entries(g).every(d=>{let[m,b]=d;return Array.isArray(b)?b.includes({...s,...c}[m]):{...s,...c}[m]===b})?[...l,u,h]:l},[]);return os(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},Gl=ql("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 p.jsx(Ai,{type:"button","data-slot":"button",...r,className:o=>ue(Gl({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Kl({className:e,...t}){return p.jsx("div",{...t,className:ue("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Yl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return p.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 Xl(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const Jl=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?p.jsx(Kl,{className:r==="badge"?"chat-suggestion-strip":"suggestions-list",role:"list","aria-label":"Suggested questions",children:e.map(o=>p.jsx("div",{role:"listitem",children:p.jsx(Yl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,Zl=({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,h]=I.useState(""),g=I.useRef(null),d=I.useId(),m=I.useId(),b=E=>{E&&(E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,96)}px`)};Hl(n,g),I.useImperativeHandle(o,()=>({edit(E){var C;n||(h(E),(C=g.current)==null||C.focus())}}),[n]),I.useEffect(()=>{b(g.current)},[u]);const v=I.useMemo(()=>{if(!c||n)return[];const E=u.trim();return E?Xl(s,E):i?s:[]},[n,i,c,s,u]),x=E=>{h(E.query);const C=g.current;C==null||C.focus()},S=()=>{const E=u.trim();!E||n||(e(E),h(""))};return p.jsxs("div",{className:"chat-input-wrapper",children:[p.jsx(Jl,{variant:"badge",suggestions:v,onSelect:x,disabled:n}),p.jsxs("form",{onSubmit:E=>{E.preventDefault(),S()},children:[p.jsx("label",{htmlFor:d,className:"sr-only",children:"Chat message"}),p.jsxs(Ul,{children:[p.jsx(zl,{id:d,ref:g,rows:1,value:u,disabled:n,placeholder:r,onChange:E=>h(E.target.value),onKeyDown:E=>{var C;E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),(C=E.currentTarget.form)==null||C.requestSubmit())}}),p.jsxs(Wl,{children:[a.length>1&&p.jsxs("div",{className:"chat-model-picker",children:[p.jsx("label",{htmlFor:m,className:"sr-only",children:"AI model"}),p.jsxs("select",{id:m,value:l,disabled:n,onChange:E=>f(E.target.value),children:[p.jsx("option",{value:"auto",children:"Automatic"}),a.map(E=>p.jsx("option",{value:E.id,disabled:!E.configured,children:E.label},E.id))]})]}),t?p.jsx(ns,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:p.jsx(ri,{size:13,fill:"currentColor","aria-hidden":"true"})}):p.jsx(ns,{type:"submit",disabled:n||!u.trim(),"aria-label":"Send message",title:"Send message",children:p.jsx(pa,{size:16,"aria-hidden":"true"})})]})]})]}),p.jsxs("p",{className:"chat-input-footer",children:[p.jsx("span",{className:"chat-input-note",children:"AI can make mistakes."}),"Powered by ",p.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function Ql({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(eu(r,o),t);if(!n)return y.createElement(e,s);if(typeof n=="function")return n(s,r);if(!y.isValidElement(n))return null;let i=n.props,c={..._r(s,i),ref:tn(s.ref,i.ref)};return y.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):nu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=tu(s,i):t[o]=s}}return t}function eu(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 tu(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function nu(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 ru=8,ou=64,su=0,jn=.5,iu=180,cu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),Ni={start:!1,end:!1},au=[],Mn={currentAnchorId:null,visibleMessageIds:au};function lu({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ni;let o=po({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function uu({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 h=u.dataset.messageId;if(!h)continue;let g=u.dataset.scrollAnchor==="true",d=g||a?u.getBoundingClientRect():null;(a&&d?d.bottom>c&&d.top<i.bottom:s.has(h))&&l.push(h),g&&d&&d.top<=c+jn&&(f=h)}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 fu(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 du(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function pu(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 hu(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 gu({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 mu({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let s=ji(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 ji(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function On(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function bu({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=Mi(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 vu(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Mi(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?Mi(t):{end:0,start:0}}function xu(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 Di(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 Di(e,t)}function Eu(){return Di(Mn,wu)}function Su(e,t){return e.start===t.start&&e.end===t.end}function wu(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Cu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:o}){let s=y.useRef(e),i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!1),l=y.useRef(n),f=y.useRef(0),u=y.useRef(null),h=y.useRef(0),g=y.useRef(e?"following-bottom":"free-scrolling"),d=y.useRef(new Map),m=y.useRef(null),b=y.useRef(null),v=y.useRef(null),x=y.useRef(o),S=y.useRef(!0),E=y.useRef(null),C=y.useRef(r),w=y.useRef(null),R=y.useRef(0),P=y.useRef(0),O=y.useRef(null),M=y.useRef(null),F=y.useRef(null),A=y.useRef(null),D=y.useRef(null),_=y.useRef(null),T=y.useRef(null),k=y.useRef(null),U=y.useRef(null),j=y.useRef(new Set),N=y.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(Ni,Su)),U.current===null&&(U.current=Eu()),s.current=e,l.current=n,C.current=r,x.current=o,{autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:D,streamingTurnRef:v,contentRef:c,defaultScrollPositionAppliedRef:a,firstItemRef:u,itemCountRef:f,lastScrollTopRef:h,messageElementsRef:d,modeRef:g,pendingScrollFrameRef:w,pendingScrollToMessageRef:m,prependRestoreRef:b,preserveScrollOnPrependRef:S,pendingDefaultScrollStore:F.current,rootRef:E,scrollEdgeThresholdRef:l,scrollMarginRef:C,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:P,spacerRef:O,stateFrameRef:M,stateStore:A.current,viewportRef:_,visibilityFrameRef:T,visibilityObserverRef:k,visibilityStore:U.current,visibleMessageIdsRef:j,handledScrollAnchorsRef:N}}function Fi(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function In(e){e.defaultScrollPositionAppliedRef.current=!0,Fi(e)}function Ru({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:h,prependRestoreRef:g,scrollMarginRef:d,scrollPreviousItemPeekRef:m,spacerGapRef:b,spacerHeightRef:v,spacerRef:x,viewportRef:S}=e,E=y.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()},iu))},[t]),C=y.useCallback(A=>{let D=x.current;if(!D)return;let _=Math.max(0,Math.ceil(A));v.current!==_&&(v.current=_,D.hidden=_===0,D.style.height=`${_}px`,D.style.marginTop=_>0?`${-b.current}px`:"")},[]),w=y.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=y.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]),P=y.useCallback(({behavior:A="auto"}={})=>{let D=S.current;return D?(C(0),o.current=null,u.current=s.current?"following-bottom":"free-scrolling",w(vu(D),{autoscrolling:!0,behavior:A}),r(),!0):!1},[r,w,C]),O=y.useCallback((A,{align:D="start",behavior:_="auto",scrollMargin:T=d.current}={},{keepPreviousPeek:k=!1}={})=>{let U=a.current,j=S.current;if(!U||!j||!U.contains(A))return!1;let N=mu({align:D,element:A,scrollMargin:k?T+m.current:T,spacer:x.current,viewport:j}),Y=bu({content:U,scrollTop:N,spacer:x.current,viewport:j});return C(Y),g.current={element:A,viewportTop:On(A,j)},u.current=k?"anchored-to-message":"settling-jump",o.current=k?A:null,w(N,{behavior:_}),r(),!0},[r,w,C]),M=y.useCallback(()=>{let A=o.current;return!A||!A.isConnected||u.current!=="anchored-to-message"?!1:O(A,{align:"start"},{keepPreviousPeek:!0})},[O]),F=y.useCallback((A,D)=>{let _=f.current.get(A);return _?(In(e),O(_,D)?(h.current=null,!0):(h.current={messageId:A,options:D},!0)):l.current===0?(h.current={messageId:A,options:D},In(e),!0):!1},[O]);return{flushPendingScrollToMessage:y.useCallback(()=>{let A=h.current;if(!A)return!1;let D=f.current.get(A.messageId);return!D||!O(D,A.options)?!1:(h.current=null,In(e),!0)},[O]),reanchorToAnchoredMessage:M,scrollToElement:O,scrollToEnd:P,scrollToMessage:F,scrollToStart:R}}function is(e,t){return y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Tu({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=ru,scrollPreviousItemPeek:r=ou,scrollMargin:o=su}){let s=Cu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:a,autoscrollingTimeoutRef:l,contentRef:f,defaultScrollPositionAppliedRef:u,firstItemRef:h,itemCountRef:g,lastScrollTopRef:d,messageElementsRef:m,modeRef:b,pendingScrollFrameRef:v,pendingScrollToMessageRef:x,prependRestoreRef:S,preserveScrollOnPrependRef:E,pendingDefaultScrollStore:C,rootRef:w,scrollEdgeThresholdRef:R,scrollMarginRef:P,scrollPreviousItemPeekRef:O,spacerGapRef:M,spacerHeightRef:F,spacerRef:A,stateFrameRef:D,stateStore:_,viewportRef:T,visibilityFrameRef:k,visibilityObserverRef:U,visibilityStore:j,visibleMessageIdsRef:N,handledScrollAnchorsRef:Y}=s,K=y.useRef(t);K.current!==t&&(K.current=t,u.current=!1);let le=y.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=y.useCallback(V=>{var se;let q=((se=T.current)==null?void 0:se.scrollTop)??0,Z=q<d.current-jn;d.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=y.useCallback(()=>{let V=lu({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=y.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,L()}))},[L]),B=y.useCallback(()=>{j.hasListeners()&&k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,j.hasListeners()&&j.setSnapshot(uu({content:f.current,scrollMargin:P.current,scrollPreviousItemPeek:O.current,spacer:A.current,viewport:T.current,visibleMessageIds:N.current}))}))},[j]),{flushPendingScrollToMessage:$,reanchorToAnchoredMessage:Q,scrollToElement:re,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W}=Ru({refs:s,commitScrollState:L,scheduleStateCommit:X,scheduleVisibilitySync:B}),ne=y.useCallback(()=>{let V=S.current,q=T.current;if(!V||!q||!V.element.isConnected)return!1;let Z=On(V.element,q)-V.viewportTop;return Math.abs(Z)<=jn?!1:(q.scrollTop+=Z,V.viewportTop=On(V.element,q),X(),B(),!0)},[X,B]),oe=y.useCallback(()=>{let V=f.current,q=T.current;if(!V||!q){S.current=null;return}let Z=gu({content:V,spacer:A.current,viewport:q});S.current=Z?{element:Z,viewportTop:On(Z,q)}:null},[]),ve=y.useCallback(()=>{v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null,$()&&oe()}))},[oe,$]),z=y.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?hu(Yt(q,A.current)):null;if(!q||!Z||!se)V=ee({behavior:"auto"});else{let ke=ji(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=y.useCallback(()=>{let V=f.current;if(!V)return;let q=Yt(V,A.current),Z=g.current,se=h.current;g.current=q.length,h.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=fu(q,Z);if(Ce){if(c.current&&b.current==="following-bottom"&&pu(q,Z)){ee({behavior:"auto"});return}re(Ce,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(Ce);return}}if(q.length===Z){let Ce=du(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=y.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=y.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:`${-(P.current+O.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]),Oe=y.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=y.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&&ve();return}Z&&m.current.get(V)===Z&&(m.current.delete(V),N.current.delete(V),(Ce=U.current)==null||Ce.unobserve(Z),B())},[ve,B]),Re=y.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),Me=y.useCallback(()=>le(_.getSnapshot()),[_,le]),Be=is(w,Me),H=is(T,Me),G=y.useCallback(V=>{f.current=V},[]),Se=y.useCallback(V=>{A.current=V,M.current=xu((V==null?void 0:V.parentElement)??null)},[]),be=y.useCallback(()=>{L(),B(),oe()},[oe,L,B]),ge=y.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:Oe,userScrollIntent:Re,viewportRef:T,visibilityStore:j}),[J,ce,he,C,ee,te,W,G,Be,Se,H,_,be,Oe,Re,j]);return y.useLayoutEffect(()=>{z()||g.current===0&&Fi(s)},[z]),y.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),v.current!==null&&(window.cancelAnimationFrame(v.current),v.current=null),(V=U.current)==null||V.disconnect(),U.current=null},[]),y.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&g.current>0){ee({behavior:"auto"});return}L()},[e,L,ee]),{context:ge,registerMessage:je}}function Pu(e){let t=y.useRef(e);return t.current=e,t}var Li=y.createContext(null),Bi=y.createContext(null);function nn(){let e=y.useContext(Li);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ou(){let e=y.useContext(Bi);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Iu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=Tu({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return p.jsx(Li.Provider,{value:i,children:p.jsx(Bi.Provider,{value:c,children:t})})}function Vi(){let{pendingDefaultScrollStore:e}=nn();return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function _u({children:e,...t}){let{setRootElement:n}=nn(),r=Vi();return p.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function ku({"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:h,setViewportElement:g,syncAfterScroll:d,userScrollIntent:m,viewportRef:b}=nn(),v=Vi();h.current=i;let x=y.useCallback(R=>{var P;g(R),(P=tn(c))==null||P(R)},[c,g]);function S(R){d(),r==null||r(R)}function E(R){m(),s==null||s(R)}function C(R){m(),o==null||o(R)}function w(R){cu.has(R.key)&&m(),n==null||n(R)}return y.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let P=0,O=new ResizeObserver(()=>{window.cancelAnimationFrame(P),P=window.requestAnimationFrame(u)});return O.observe(R),()=>{window.cancelAnimationFrame(P),O.disconnect()}},[u,b]),p.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:w,onScroll:S,onTouchMove:C,onWheel:E,...f,...v?{"data-pending-scroll":""}:null,children:t})}function Au({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=nn(),f=y.useRef(null),u=y.useCallback(h=>{var g;f.current=h,a(h),(g=tn(n))==null||g(h)},[n,a]);return y.useLayoutEffect(()=>{let h=f.current;if(!h||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(h,{childList:!0}),()=>g.disconnect()},[i]),y.useEffect(()=>{let h=f.current;if(!h||typeof ResizeObserver>"u")return;let g=0,d=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return d.observe(h),()=>{window.cancelAnimationFrame(g),d.disconnect()}},[c]),p.jsxs("div",{ref:u,role:r??"log","aria-relevant":e??"additions",...s,children:[t,p.jsx("div",{ref:l,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Nu({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ou(),s=y.useRef(null),i=y.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 p.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function ju({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=Pu(r),h=y.useCallback(b=>f.subscribe(b),[f]),g=y.useCallback(()=>{let b=f.getSnapshot();return n==="start"?b.start:b.end},[n,f]),d=y.useSyncExternalStore(h,g,g),m=y.useCallback(b=>{var v;d&&((v=u.current)==null||v.call(u,b),b.defaultPrevented||(b.currentTarget.blur(),n==="start"?l({behavior:e}):a({behavior:e})))},[e,n,d,u,a,l]);return Ql({defaultTagName:"button",props:_r({type:i,inert:!d,tabIndex:d?s:-1,children:t??p.jsxs("span",{children:["Scroll to ",n]}),onClick:m},c),render:o,state:{active:d,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Iu,Root:_u,Viewport:ku,Content:Au,Item:Nu,Button:ju};function Mu(e){return p.jsx(Ft.Provider,{...e})}function Du({className:e,...t}){return p.jsx(Ft.Root,{"data-slot":"message-scroller",className:ue("msg-scroller-root",e),...t})}function Fu({className:e,...t}){return p.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:ue("msg-scroller-viewport",e),...t})}function Lu({className:e,...t}){return p.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:ue("msg-scroller-content",e),...t})}function cs({className:e,scrollAnchor:t=!1,...n}){return p.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:ue("msg-scroller-item",e),...n})}function Bu({direction:e="end",className:t,children:n,...r}){return p.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:ue("msg-scroller-btn",t),...r,children:n??p.jsxs(p.Fragment,{children:[p.jsx(fa,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),p.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 p.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:ue("chat-bubble",n)})}function Nr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"bubble-content",className:ue("chat-bubble-content",e)})}const Vu=()=>p.jsxs(Jr,{children:[p.jsx(oi,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Js,{size:15})}),p.jsx(Zr,{children:p.jsx(Ar,{children:p.jsx(Nr,{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a suggested question."})})})]});function $i(){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 $u({message:e,onFeedback:t}){const{status:n,copy:r}=$i();return p.jsxs("div",{className:"chat-message-actions",role:"group","aria-label":"Response actions",children:[p.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"?p.jsx(Xr,{size:16,"aria-hidden":"true"}):p.jsx(ei,{size:16,"aria-hidden":"true"})}),p.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:p.jsx(Pa,{size:16,"aria-hidden":"true"})}),p.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:p.jsx(Ta,{size:16,"aria-hidden":"true"})}),p.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 Hu(e){return Object.prototype.toString.call(e)==="[object Object]"}function as(e){return Hu(e)||Array.isArray(e)}function Uu(){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 zu(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 Wu(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 qu(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 vo(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 Hi(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?Hi(s,i):i}),n),{})}function Mr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Gu(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 Ku(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&&d()})}function f(){g(),o.clear()}function u(b){if(!a)return;i||(i=b,n(),n());const v=b-i;for(i=b,c+=v;c>=s;)n(),c-=s;const x=c/s;r(x),a&&(a=t.requestAnimationFrame(u))}function h(){a||(a=t.requestAnimationFrame(u))}function g(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function d(){i=null,c=0}return{init:l,destroy:f,start:h,stop:g,update:n,render:r}}function Yu(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(d){const{height:m,width:b}=d;return r?m:b}function f(){return r?"top":n?"right":"left"}function u(){return r?"bottom":n?"left":"right"}function h(d){return d*i}return{scroll:o,cross:s,startEdge:c,endEdge:a,measureSize:l,direction:h}}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 Ui(e,t,n){const{constrain:r}=Et(0,e),o=e+1;let s=i(t);function i(h){return n?we((o+h)%o):r(h)}function c(){return s}function a(h){return s=i(h),u}function l(h){return f().set(c()+h)}function f(){return Ui(e,c(),n)}const u={get:c,set:a,add:l,clone:f};return u}function Xu(e,t,n,r,o,s,i,c,a,l,f,u,h,g,d,m,b,v,x){const{cross:S,direction:E}=e,C=["INPUT","SELECT","TEXTAREA"],w={passive:!1},R=Zt(),P=Zt(),O=Et(50,225).constrain(g.measure(20)),M={mouse:300,touch:400},F={mouse:500,touch:600},A=d?43:25;let D=!1,_=0,T=0,k=!1,U=!1,j=!1,N=!1;function Y(W){if(!x)return;function ne(ve){(Qn(x)||x(W,ve))&&B(ve)}const oe=t;R.add(oe,"dragstart",ve=>ve.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(),P.clear()}function le(){const W=N?n:t;P.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(d?F:M)[N?"mouse":"touch"]}function X(W,ne){const oe=u.add(bo(W)*-1),ve=f.byDistance(W,!d).distance;return d||we(W)<O?ve:b&&ne?ve*.5:f.byIndex(oe.get(),0).distance}function B(W){const ne=Mr(W,r);N=ne,j=d&&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),h.emit("pointerDown")))}function $(W){if(!Mr(W,r)&&W.touches.length>=2)return Q(W);const oe=s.readPoint(W),ve=s.readPoint(W,S),z=Wt(oe,_),J=Wt(ve,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(),ve=s.pointerUp(W)*L(),z=X(E(ve),oe),J=Wu(ve,z),ce=A-10*J,he=v+J/50;U=!1,k=!1,P.clear(),l.useDuration(ce).useFriction(he),a.distance(z,!d),N=!1,h.emit("pointerUp")}function re(W){j&&(W.stopPropagation(),W.preventDefault(),j=!1)}function ee(){return k}return{init:Y,destroy:K,pointerDown:ee}}function Ju(e,t){let r,o;function s(u){return u.timeStamp}function i(u,h){const d=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Mr(u,t)?u:u.touches[0])[d]}function c(u){return r=u,o=u,i(u)}function a(u){const h=i(u)-i(o),g=s(u)-s(r)>170;return o=u,g&&(r=u),h}function l(u){if(!r||!o)return 0;const h=i(o)-i(r),g=s(u)-s(r),d=s(u)-s(o)>170,m=h/g;return g&&!d&&we(m)>.1?m:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function Zu(){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 Qu(e){function t(r){return e*(r/100)}return{measure:t}}function ef(e,t,n,r,o,s,i){const c=[e].concat(r);let a,l,f=[],u=!1;function h(b){return o.measureSize(i.measure(b))}function g(b){if(!s)return;l=h(e),f=r.map(h);function v(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=h(E?e:r[C]);if(we(R-w)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(Qn(s)||s(b,x))&&v(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function d(){u=!0,a&&a.disconnect()}return{init:g,destroy:d}}function tf(e,t,n,r,o,s){let i=0,c=0,a=o,l=s,f=e.get(),u=0;function h(){const w=r.get()-e.get(),R=!a;let P=0;return R?(i=0,n.set(r),e.set(r),P=w):(n.set(e),i+=w/a,i*=l,f+=i,e.add(i),P=f-u),c=bo(P),u=f,C}function g(){const w=r.get()-t.get();return we(w)<.001}function d(){return a}function m(){return c}function b(){return i}function v(){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:d,velocity:b,seek:h,settled:g,useBaseFriction:x,useBaseDuration:v,useFriction:E,useDuration:S};return C}function nf(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 d=e.reachedMin(t.get())?"min":"max",m=we(e[d]-t.get()),b=n.get()-t.get(),v=c.constrain(m/i);n.subtract(b*v),!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 rf(e,t,n,r,o){const s=Et(-t+e,0),i=u(),c=f(),a=h();function l(d,m){return Wt(d,m)<=1}function f(){const d=i[0],m=Ge(i),b=i.lastIndexOf(d),v=i.indexOf(m)+1;return Et(b,v)}function u(){return n.map((d,m)=>{const{min:b,max:v}=s,x=s.constrain(d),S=!m,E=vo(n,m);return S?v:E||l(b,x)?b:l(v,x)?v:x}).map(d=>parseFloat(d.toFixed(3)))}function h(){if(t<=e+o)return[s.max];if(r==="keepSnaps")return i;const{min:d,max:m}=c;return i.slice(d,m)}return{snapsContained:a,scrollContainLimit:c}}function of(e,t,n){const r=t[0],o=n?r-e:Ge(t);return{limit:Et(o,r)}}function sf(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=Et(s,i);function l(h){return h===1?a(n.get()):h===-1?c(n.get()):!1}function f(h){if(!l(h))return;const g=e*(h*-1);r.forEach(d=>d.add(g))}return{loop:f}}function cf(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function af(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=u().map(t.measure),l=h(),f=g();function u(){return c(r).map(m=>Ge(m)[i]-m[0][s]).map(we)}function h(){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 lf(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=f();function f(){const h=i(s),g=!e||t==="keepSnaps";return n.length===1?[s]:g?h:h.slice(c,a).map((d,m,b)=>{const v=!m,x=vo(b,m);if(v){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 d})}return{slideRegistry:l}}function uf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(d){return d.concat().sort((m,b)=>we(m)-we(b))[0]}function l(d){const m=e?i(d):c(d),b=t.map((x,S)=>({diff:f(x-m,0),index:S})).sort((x,S)=>we(x.diff)-we(S.diff)),{index:v}=b[0];return{index:v,distance:m}}function f(d,m){const b=[d,d+n,d-n];if(!e)return d;if(!m)return a(b);const v=b.filter(x=>bo(x)===m);return v.length?a(v):Ge(b)-n}function u(d,m){const b=t[d]-o.get(),v=f(b,m);return{index:d,distance:v}}function h(d,m){const b=o.get()+d,{index:v,distance:x}=l(b),S=!e&&s(b);if(!m||S)return{index:v,distance:d};const E=t[v]-x,C=d+f(E,0);return{index:v,distance:C}}return{byDistance:h,byIndex:u,shortcut:f}}function ff(e,t,n,r,o,s,i){function c(u){const h=u.distance,g=u.index!==t.get();s.add(h),h&&(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,h){const g=o.byDistance(u,h);c(g)}function l(u,h){const g=t.clone().set(u),d=o.byIndex(g.get(),h);c(d)}return{distance:a,index:l}}function df(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function f(g){if(!c)return;function d(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",v=>{(Qn(c)||c(g,v))&&d(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 zi(e,t){const n=e.scroll==="x"?i:c,r=t.style;let o=null,s=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function c(h){return`translate3d(0px,${h}px,0px)`}function a(h){if(s)return;const g=qu(e.direction(h));g!==o&&(r.transform=n(g),o=g)}function l(h){s=!h}function f(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:f,to:a,toggleActive:l}}function pf(e,t,n,r,o,s,i,c,a){const f=Xt(o),u=Xt(o).reverse(),h=v().concat(x());function g(R,P){return R.reduce((O,M)=>O-o[M],P)}function d(R,P){return R.reduce((O,M)=>g(O,P)>0?O.concat([M]):O,[])}function m(R){return s.map((P,O)=>({start:P-r[O]+.5+R,end:P+t-.5+R}))}function b(R,P,O){const M=m(P);return R.map(F=>{const A=O?0:-n,D=O?n:0,_=O?"end":"start",T=M[F][_];return{index:F,loopPoint:T,slideLocation:Ut(-1),translate:zi(e,a[F]),target:()=>c.get()>T?A:D}})}function v(){const R=i[0],P=d(u,R);return b(P,n,!1)}function x(){const R=t-i[0]-1,P=d(f,R);return b(P,-n,!0)}function S(){return h.every(({index:R})=>{const P=f.filter(O=>O!==R);return g(P,t)<=.1})}function E(){h.forEach(R=>{const{target:P,translate:O,slideLocation:M}=R,F=P();F!==M.get()&&(O.to(F),M.set(F))})}function C(){h.forEach(R=>R.translate.clear())}return{canLoop:S,clear:C,loop:E,loopPoints:h}}function hf(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 gf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(d=>{a||(d.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(d=>c.observe(d))}function f(){c&&c.disconnect(),a=!0}function u(d){return Jt(o).reduce((m,b)=>{const v=parseInt(b),{isIntersecting:x}=o[v];return(d&&x||!d&&!x)&&m.push(v),m},[])}function h(d=!0){if(d&&s)return s;if(!d&&i)return i;const m=u(d);return d&&(s=m),d||(i=m),m}return{init:l,destroy:f,get:h}}function mf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,f=d(),u=m(),h=n.map(i),g=b();function d(){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=vo(E,S);return C?h[S]+f:w?h[S]+u:E[S+1][c]-x[c]}).map(we)}return{slideSizes:h,slideSizesWithGaps:g,startGap:f,endGap:u}}function bf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:f,direction:u}=e,h=mo(n);function g(v,x){return Xt(v).filter(S=>S%x===0).map(S=>v.slice(S,S+x))}function d(v){return v.length?Xt(v).reduce((x,S,E)=>{const C=Ge(x)||0,w=C===0,R=S===rn(v),P=o[l]-s[C][l],O=o[l]-s[S][f],M=!r&&w?u(i):0,F=!r&&R?u(c):0,A=we(O-F-(P+M));return E&&A>t+a&&x.push(S),R&&x.push(v.length),x},[]).map((x,S,E)=>{const C=Math.max(E[S-1]||0);return v.slice(C,x)}):[]}function m(v){return h?g(v,n):d(v)}return{groupSlides:m}}function vf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:f,loop:u,duration:h,dragFree:g,dragThreshold:d,inViewThreshold:m,slidesToScroll:b,skipSnaps:v,containScroll:x,watchResize:S,watchSlides:E,watchDrag:C,watchFocus:w}=s,R=2,P=Zu(),O=P.measure(t),M=n.map(P.measure),F=Yu(a,l),A=F.measureSize(O),D=Qu(A),_=Gu(c,A),T=!u&&!!x,k=u||!!x,{slideSizes:U,slideSizesWithGaps:j,startGap:N,endGap:Y}=mf(F,O,M,n,k,o),K=bf(F,A,b,u,O,M,N,Y,R),{snaps:le,snapsAligned:ie}=af(F,_,O,M,K),L=-Ge(le)+Ge(j),{snapsContained:X,scrollContainLimit:B}=rf(A,L,ie,x,R),$=T?X:ie,{limit:Q}=of(L,$,u),re=Ui(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=Ku(r,o,()=>W(ge),V=>ne(ge,V)),ve=.68,z=$[re.get()],J=Ut(z),ce=Ut(z),he=Ut(z),Oe=Ut(z),je=tf(J,he,ce,Oe,h,ve),Re=uf(u,$,L,Q,Oe),Me=ff(oe,re,ee,je,Re,Oe,i),Be=cf(Q),H=Zt(),G=gf(t,n,i,m),{slideRegistry:Se}=lf(T,x,$,B,K,te),be=df(e,n,Se,Me,je,H,i,w),ge={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:O,slideRects:M,animation:oe,axis:F,dragHandler:Xu(F,e,r,o,Oe,Ju(F,o),J,oe,Me,je,Re,re,i,D,g,d,v,ve,C),eventStore:H,percentOfView:D,index:re,indexPrevious:ee,limit:Q,location:J,offsetLocation:he,previousLocation:ce,options:s,resizeHandler:ef(t,i,o,n,F,S,P),scrollBody:je,scrollBounds:nf(Q,he,Oe,je,D),scrollLooper:sf(L,Q,he,[J,he,ce,Oe]),scrollProgress:Be,scrollSnapList:$.map(Be.get),scrollSnaps:$,scrollTarget:Re,scrollTo:Me,slideLooper:pf(F,A,L,U,j,le,$,he,n),slideFocus:be,slidesHandler:hf(t,i,E),slidesInView:G,slideIndexes:te,slideRegistry:Se,slidesToScroll:K,target:Oe,translate:zi(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 xf={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 Ef(e){function t(s,i){return Hi(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 Sf(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=Ef(o),i=Sf(s),c=Zt(),a=yf(),{mergeOptions:l,optionsAtMedia:f,optionsMediaQueries:u}=s,{on:h,off:g,emit:d}=a,m=F;let b=!1,v,x=l(xf,Dn.globalOptions),S=l(x),E=[],C,w,R;function P(){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 O(te){const W=vf(e,w,R,r,o,te,a);if(te.loop&&!W.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return O(ne)}return W}function M(te,W){b||(x=l(x,te),S=f(x),E=W||E,P(),v=O(S),u([x,...E.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",F)),S.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(ee),v.eventHandler.init(ee),v.resizeHandler.init(ee),v.slidesHandler.init(ee),v.options.loop&&v.slideLooper.loop(),w.offsetParent&&R.length&&v.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(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.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||(v.scrollBody.useBaseFriction().useDuration(W===!0?0:S.duration),v.scrollTo.index(te,ne||0))}function T(te){const W=v.index.add(1).get();_(W,te,-1)}function k(te){const W=v.index.add(-1).get();_(W,te,1)}function U(){return v.index.add(1).get()!==K()}function j(){return v.index.add(-1).get()!==K()}function N(){return v.scrollSnapList}function Y(){return v.scrollProgress.get(v.offsetLocation.get())}function K(){return v.index.get()}function le(){return v.indexPrevious.get()}function ie(){return v.slidesInView.get()}function L(){return v.slidesInView.get(!1)}function X(){return C}function B(){return v}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:h,emit:d,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 yo(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(()=>{zu(r.current,t)||(r.current=t,a())},[t,a]),I.useEffect(()=>{if(Uu()&&i){Dn.globalOptions=yo.globalOptions;const l=Dn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}yo.globalOptions=void 0;const Dr=[];let Fr;function wf(){return Fr}function Cf(e){Dr.push(e)}function Wi(e){const t=(n,r)=>{const o=Ye(Tf).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 Rf(e){return y.forwardRef(Wi(e))}function Tf(){return{didInitialize:!1}}function Pf(){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:If,maxTouchPoints:_f}=Pf(),er=Of.toLowerCase(),Qt=If.toLowerCase(),qi=/^i(os$|p)/.test(Qt)||Qt==="macintel"&&_f>1,ds="android",kf=Qt===ds||er.includes(ds),Gi=!qi&&Qt.startsWith("mac");Qt.startsWith("win");const Af=Gi||qi;var Us;const on=typeof CSS<"u"&&!!((Us=CSS.supports)!=null&&Us.call(CSS,"-webkit-backdrop-filter:none"));!on&&er.includes("firefox");!on&&er.includes("chrom");const Nf=Af,jf=/jsdom|happydom/.test(er);function Mf(e){return"nativeEvent"in e}function Df(e){return e.pointerType===""&&e.isTrusted?!0:kf&&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 Ff(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 vt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Lf="data-base-ui-focusable",Ki="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Bf="data-open",Vf="data-closed",$f="data-anchor-hidden",Hf="data-popup-open",Uf={[Hf]:""},zf={[Bf]:""},Wf={[Vf]:""},qf={[$f]:""},Gf={open(e){return e?Uf:null}},Yi={open(e){return e?zf:Wf},anchorHidden(e){return e?qf:null}},Kf={...Yi,...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 Yf(e){return e.matches("html,body")}function Xf(e){return _e(e)&&e.matches(Ki)}function Jf(e){return Vr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ki}`)!=null}function Zf(e){if(!e||jf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qf(e,t){return t!=null&&!Lr(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=Qf(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function hs(e){return typeof e=="function"?e():e}function Xi(e,t){return t||e==="click"||e==="mousedown"}function ed(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 td={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},nd={...td,position:"fixed",margin:0,top:0,left:0},Hr=y.forwardRef(function(t,n){const[r,o]=y.useState();pe(()=>{Nf&&on&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:nd,"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,yn=Math.floor,rt=e=>({x:e,y:e}),rd={left:"right",right:"left",bottom:"top",top:"bottom"};function Ji(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 od(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 sd(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"],id=["top","bottom"],cd=["bottom","top"];function ad(e,t,n){switch(e){case"top":case"bottom":return n?t?ms:gs:t?gs:ms;case"left":case"right":return t?id:cd;default:return[]}}function ld(e,t,n,r){const o=Je(e);let s=ad(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 rd[t]+e.slice(t.length)}function ud(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 Zi(e){return typeof e!="number"?ud(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 fd(e){return e.visibility==="hidden"||e.visibility==="collapse"}function dd(e,t=e?$e(e):null){return!e||!e.isConnected||!t||fd(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const pd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function hd(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 gd(e,t){const n=zr(t);return!!n&&(e===n||Te(n,e))}function Qi(e){const t=e?Le(e):"";return e!=null&&e.matches(pd)&&(t!=="summary"||e.parentElement!=null&&Le(e.parentElement)==="details"&&zr(e.parentElement)===e)&&(t!=="details"||zr(e)==null)&&(t!=="input"||e.type!=="hidden")}function md(e){if(!Qi(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=hd(t)){const n=t!==e,r=Le(t)==="slot";if(t.hasAttribute("inert")||n&&Le(t)==="details"&&!t.open&&!gd(e,t)||t.hasAttribute("hidden")||!r&&!bd(t,n))return!1}return!0}function bd(e,t){const n=$e(e);return t?n.display!=="none":dd(e,n)}function vd(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 ec(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 tc(e,t){ec(e).forEach(n=>{Qi(n)&&t.push(n),tc(n,t)})}function nc(e,t,n){ec(e).forEach(r=>{_e(r)&&r.matches(t)&&n.push(r),nc(r,t,n)})}function xd(e){const t=[];return tc(e,t),t.filter(md)}function rc(e){const t=xd(e);return t.filter(n=>vd(n)>=0&&yd(n,t))}function oc(e,t){const n=rc(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 Ed(e){return oc(Ke(e).body,1)||e}function Sd(e){return oc(Ke(e).body,-1)||e}function gr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Te(n,r)}function wd(e){rc(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bs(e){const t=[];nc(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 Cd={style:{transition:"none"}},Rd={fallbackAxisSide:"end"},Td={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Co=y.createContext(null);process.env.NODE_ENV!=="production"&&(Co.displayName="PortalContext");const Pd=()=>y.useContext(Co),Od=wo("portal");function sc(e={}){const{ref:t,container:n,componentProps:r=Fe,elementProps:o}=e,s=Gn(),i=Pd(),c=i==null?void 0:i.portalNode,[a,l]=y.useState(null),[f,u]=y.useState(null),h=fe(b=>{b!==null&&u(b)}),g=y.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 d=pt("div",r,{ref:[t,h],props:[{id:s,[Od]:""},o]}),m=a&&d?dt.createPortal(d,a):null;return{node:f,nodeId:y.isValidElement(d)?d.props.id:void 0,subtree:m}}const Id=y.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:c,portalOwnerRole:a,...l}=t,{node:f,nodeId:u,subtree:h}=sc({container:c,ref:n,componentProps:t,elementProps:l}),g=y.useRef(null),d=y.useRef(null),m=y.useRef(null),b=y.useRef(null),[v,x]=y.useState(null),S=y.useRef(!1),E=v==null?void 0:v.modal,C=v==null?void 0:v.open,w=!!v&&!v.modal&&v.open&&!!f;y.useEffect(()=>{if(!f||E)return;function P(O){f&&O.relatedTarget&&gr(O)&&(O.type==="focusin"?S.current&&(bs(f),S.current=!1):(wd(f),S.current=!0))}return at(Ee(f,"focusin",P,!0),Ee(f,"focusout",P,!0))},[f,E]),pe(()=>{!f||C!==!0||!S.current||(bs(f),S.current=!1)},[C,f]);const R=y.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:d,beforeInsideRef:m,afterInsideRef:b,portalNode:f,setFocusManagerState:x}),[f]);return p.jsxs(y.Fragment,{children:[h,p.jsxs(Co.Provider,{value:R,children:[w&&f&&p.jsx(Hr,{"data-type":"outside",ref:g,onFocus:P=>{var O;if(gr(P,f))(O=m.current)==null||O.focus();else{const M=v?v.domReference:null,F=Sd(M);F==null||F.focus()}}}),w&&f&&p.jsx("span",{role:a,"aria-owns":u,style:Td}),f&&dt.createPortal(i,f),w&&f&&p.jsx(Hr,{"data-type":"outside",ref:d,onFocus:P=>{var O;if(gr(P,f))(O=b.current)==null||O.focus();else{const M=v?v.domReference:null,F=Ed(M);F==null||F.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,Pe(sl,P.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Id.displayName="FloatingPortal");function ic(){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 _d{constructor(){ae(this,"nodesRef",{current:[]});ae(this,"events",ic())}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=y.createContext(null);process.env.NODE_ENV!=="production"&&(Ro.displayName="FloatingNodeContext");const To=y.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="FloatingTreeContext");const tr=()=>{var e;return((e=y.useContext(Ro))==null?void 0:e.id)||null},sn=e=>{const t=y.useContext(To);return e??t};function kd(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 Ad(e){const{children:t,id:n}=e,r=tr();return p.jsx(Ro.Provider,{value:y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nd(e){const{children:t,externalTree:n}=e,r=Ye(()=>n??new _d).current;return p.jsx(To.Provider,{value:r,children:t})}function jd(){return!1}function Md(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 Dd(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=jd,bubbles:c,externalTree:a}=t,l=e.useState("open"),f=e.useState("floatingElement"),{dataRef:u,events:h}=e.context,g=sn(a),d=fe(typeof o=="function"?o:()=>!1),m=typeof o=="function"?d:o,b=m!==!1,v=fe(()=>s),{escapeKey:x,outsidePress:S}=Md(c),E=y.useRef(!1),C=y.useRef(!1),w=y.useRef(!1),R=y.useRef(!1),P=y.useRef(!1),O=y.useRef(""),M=y.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,Pe(Kn,L.nativeEvent))}),j=fe(L=>{if(!l||!n||!r||L.key!=="Escape")return;const X=Mf(L)?L.nativeEvent:L;if(P.current||X.isComposing||!x&&T("__escapeKeyBubbles"))return;const B=Pe(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=vt(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)});y.useEffect(()=>{function L(X){X.open||(R.current=!1)}return h.on("openchange",L),()=>{h.off("openchange",L)}},[h]),y.useEffect(()=>_,[_]),y.useEffect(()=>{if(!l||!n)return l||(R.current=!1,P.current=!1,O.current="",M.current=null),_;u.current.__escapeKeyBubbles=x,u.current.__outsidePressBubbles=S;const L=new ut,X=Ke(f);function B(){D.clear(),P.current=!0}function $(){P.current=!0,D.start(on?5:0,()=>{P.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=O.current,G=H==="pen"||!H?"mouse":H,Se=v(),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=vt(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)&&!Yf(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&&!Df(H)&&!R.current)return;if(w.current){L.clear(),w.current=!1;return}}typeof m=="function"&&!m(H)||T("__outsidePressBubbles")||(e.setOpen(!1,Pe(ol,H)),_())}}}function oe(H){ee()!=="sloppy"||H.pointerType==="touch"||!e.select("open")||!n||k(H)||ne(H)}function ve(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=vt(H);if(!Se)return;const be=Ee(Se,H.type,()=>{G(H),be()})}function J(H){O.current="touch",z(H,ve)}function ce(H){F.clear(),H.type==="pointerdown"&&(H.button===0&&(R.current=!0),O.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 Oe(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,Oe)}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,_,v,T,k,g,e,F,D]);const le=y.useMemo(()=>({onKeyDown:j,onPointerDown:U,onClick:U}),[j,U]),ie=y.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 y.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 Fd(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function cc(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(Fd(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 ac(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function vs(e){return $n(e.left,e.top,e.right,e.bottom)}function Ld(e,t,n){const{lines:r}=cc(e.getClientRects());if(r.length<2)return;const o=ac(r,t,n);return{x:t,y:n,lineIndex:o===-1?void 0:o,element:e}}function Bd(e,t,n){const{lines:r,fallback:o}=cc(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 vs(r[n.lineIndex]);if(s!=null&&i!=null){const d=ac(r,s,i);if(d!==-1)return vs(r[d])}if(r.length===2&&r[0].left>r[1].right&&s!=null&&i!=null)return o;if(c==="t"||c==="b"){const d=r[0],m=r[r.length-1],b=c==="t"?d:m;return $n(b.left,d.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,h=r[0],g=r[0];for(const d of r){l=Math.min(l,d.left),f=Math.max(f,d.right);const m=a?d.left:d.right;a&&m<u||!a&&m>u?(u=m,h=d,g=d):m===u&&(g=d)}return $n(l,h.top,f,g.bottom)}function Vd(e){return"contextElement"in e&&e.contextElement?e.contextElement:me(e)?e:void 0}function $d(e,t){function n(o){lc(e,o.currentTarget,o.clientX,o.clientY)}function r(o){t||n(o)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function lc(e,t,n,r){const o=Ld(t,n,r);return e.current=o,o}function Hd(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Vd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Bd(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 Ud{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,Pe(Or,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,Pe(Or))}}function zd(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 Wd(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 h=y.useRef(a),g=y.useRef(!1),d=mi(),m=()=>{h.current=!1,l(!1),s()};pe(()=>{h.current=a,g.current&&(g.current=!1,!t&&a&&m())});const b=fe(()=>{if(h.current){if(t){g.current=!0,d();return}m()}});return uo({enabled:a&&!t&&!u,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:f,preventUnmountingOnClose:u,forceUnmount:b}}const qd={tabIndex:-1,[Lf]:""};function Gd(e,t=!1){const n=Gn(),r=tr()!=null,o=Ye(()=>e(n,r)).current;return zd({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Kd({handle:e,store:t}){return pe(()=>e.attachStore(t),[e,t]),null}function ys(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Yd(e,t){const n=y.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),ys(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ys(t))})}function Xd(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 Jd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Zd(e,t,n,r={}){var f,u,h;const o=n.reason,s=o===We,i=t&&o===Pn,c=!t&&(o===Kn||o===no),a=Jd(n);if((u=(f=e.context).onOpenChange)==null||u.call(f,t,n),n.isCanceled)return;(h=r.onBeforeDispatch)==null||h.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const g=Xd(e.state,t,n.trigger,a()),d={...r.extraState,...g};i?d.instantType="focus":c?d.instantType="dismiss":s&&(d.instantType=void 0),e.update(d)};s?dt.flushSync(l):l()}function Qd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Yd(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 ep(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=y.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 h=e.context.triggerElements.getById(f);if(h)r.current=f,h!==e.state.activeTriggerElement&&(l.activeTriggerElement=h);else{for(const[g,d]of e.context.triggerElements.entries())if(d===e.state.activeTriggerElement){l.activeTriggerId=g,l.activeTriggerElement=d,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 h=e.context.triggerElements.entries().next();if(!h.done){const[g,d]=h.value;l.activeTriggerId=g,l.activeTriggerElement=d,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 h=Pe(vi);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function tp(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=Wd({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 np(e,t){e.useSyncedValues(t),pe(()=>()=>{e.update({activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe})},[e])}let _t;function rp(e){_t??(_t=new WeakMap);let t=_t.get(e);return t||(t=new WeakMap,_t.set(e,t)),t}class uc{constructor(){ae(this,"idMap",new Map)}add(t,n){if(process.env.NODE_ENV!=="production"){const r=rp(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={};/**
176
+ */const Aa=ye("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 p.jsx("div",{...n,"data-slot":"message","data-align":e,className:ue("chat-message",t)})}function ri({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-avatar",className:ue("chat-message-avatar",e)})}function Zr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-content",className:ue("chat-message-content",e)})}function Na({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-header",className:ue("chat-message-header",e)})}function wr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-footer",className:ue("chat-message-footer",e)})}const tt={...y},Yo={};function Ye(e,t){const n=y.useRef(Yo);return n.current===Yo&&(n.current=e(t)),n}const ur=tt.useInsertionEffect,ja=ur&&ur!==tt.useLayoutEffect?ur:e=>e();function fe(e){const t=Ye(Ma).current;return t.next=e,ja(t.effect),t.trampoline}function Ma(){const e={next:void 0,callback:Da,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function Da(){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 La(o,e,t,n,r)&&si(o,[e,t,n,r]),o.callback}function Fa(e){const t=Ye(oi).current;return Ba(t,e)&&si(t,e),t.callback}function oi(){return{callback:null,cleanup:null,refs:[]}}function La(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Ba(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 Va=parseInt(y.version,10);function ii(e){return Va>=e}function Xo(e){if(!y.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 Pr;process.env.NODE_ENV!=="production"&&(Pr=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}`;Pr.has(i)||(Pr.add(i),e==="warn"?console.warn(s):console.error(s))}}}const Qr=ci("warn","Base UI");function eo(){}const $a=Object.freeze([]),Fe=Object.freeze({});function Ha(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 Ua(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 za(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)}:Wa(e)}function Tn(e,t){return fi(t)?t(e):qa(e,t)}function Wa(e){const t={...e};for(const n in t){const r=t[n];ui(n,r)&&(t[n]=di(r))}return t}function qa(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]=Ga(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 Ga(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=Qa(r));const o=Ka(t,n,r);if(n.enabled===!1)return null;const s=n.state??Fe;return el(e,r,o,s)}function Ka(e,t,n){const{className:r,style:o}=e,{state:s=Fe,ref:i,props:c,stateAttributesMapping:a,enabled:l=!0}=t,u=l?Ua(r,s):void 0,f=l?ai(o,s):void 0,h=l?Ha(s,a):Fe,g=l&&c?Ya(c):void 0,d=l?Tr(h,g)??{}:Fe;return typeof document<"u"&&(l?Array.isArray(i)?d.ref=Fa([d.ref,Xo(n),...i]):d.ref=Rr(d.ref,Xo(n),i):Rr(null,null)),l?(u!==void 0&&(d.className=pi(d.className,u)),f!==void 0&&(d.style=Tr(d.style,f)),d):Fe}function Ya(e){return Array.isArray(e)?za(e):to(void 0,e)}const Xa=Symbol.for("react.lazy"),Ja=/^[A-Z][A-Za-z0-9$]*$/,Za=/[a-z]/;function Qa(e){if((e==null?void 0:e.$$typeof)!==Xa)return e;const t=y.Children.toArray(e)[0];return y.isValidElement(t)?t:e}function el(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&tl(t),t(n,r);const o=to(n,t.props);if(o.ref=n.ref,process.env.NODE_ENV!=="production"&&!y.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 y.cloneElement(t,o)}return nl(e,n)}function tl(e){const t=e.name;t.length!==0&&Ja.test(t)&&Za.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 nl(e,t){return e==="button"?I.createElement("button",{type:"button",...t,key:t.key}):e==="img"?I.createElement("img",{alt:"",...t,key:t.key}):y.createElement(e,t)}const Nn=ci("error","Base UI");function rl({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=y.useRef(e!==void 0),[s,i]=y.useState(()=>t),c=o&&e!==void 0?e:s;if(process.env.NODE_ENV!=="production"){y.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}=y.useRef(t);y.useEffect(()=>{!o&&Jo(l)!==Jo(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=y.useCallback(l=>{o||i(l)},[]);return[c,a]}function Jo(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]=y.useState({});return y.useCallback(()=>{e({})},[])}let Zo=0;function ol(e,t="mui"){const n=y.useRef(void 0),r=gi(),o=e??n.current;return y.useEffect(()=>{n.current==null&&(Zo+=1,n.current=`${t}-${Zo}`,e==null&&r())},[e,t,r]),o}const Qo=tt.useId;function Gn(e,t){if(Qo!==void 0){const n=Qo();return e??(t?`${t}-${n}`:n)}return ol(e,t)}function mi(e){return Gn(e,"base-ui")}function Pe(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",Pn="trigger-focus",sl="outside-press",il="focus-out",no="escape-key",Or="imperative-action",cl=()=>{},pe=typeof document<"u"?y.useLayoutEffect:cl;function ro(e){y.useEffect(e,$a)}const pn=null;let es=globalThis.requestAnimationFrame;class al{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"&&es!==requestAnimationFrame&&(es=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 al;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 ll(){const e=Ye(Ne.create).current;return ro(e.disposeEffect),e}function vi(e,t=!1,n=!1,r=!1){const[o,s]=y.useState(e&&t?"idle":void 0),[i,c]=y.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 ul(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=rl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=vi(s,!0,!0),u=mi(),[f,h]=y.useState(),g=f===null?void 0:f??u,d=fe(m=>{const b=!s,v=Pe(Kn,m.nativeEvent);r(b,v),!v.isCanceled&&i(b)});return y.useMemo(()=>({defaultPanelId:u,disabled:o,handleTrigger:d,mounted:c,open:s,panelId:g,setMounted:a,setOpen:i,setPanelIdState:h,transitionStatus:l}),[u,o,d,c,s,g,a,i,h,l])}function fl(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 St=fl("https://base-ui.com/production-error","Base UI"),oo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(oo.displayName="CollapsibleRootContext");function yi(){const e=y.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>.":St(15));return e}const so="data-starting-style",dl="data-ending-style",pl={[so]:""},hl={[dl]:""},io={transitionStatus(e){return e==="starting"?pl:e==="ending"?hl:null}},gl="data-open",ml="data-closed",gn=so,bl="data-panel-open",vl={[gl]:""},yl={[ml]:""},xl={open(e){return e?{[bl]:""}:null}},Cl={open(e){return e?vl:yl}},xi={...Cl,...io},Ci=y.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:i=!1,onOpenChange:c,open:a,style:l,...u}=t,f=fe(c),h=ul({open:a,defaultOpen:s,onOpenChange:f,disabled:i}),g=y.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),d=y.useMemo(()=>({...h,onOpenChange:f,state:g}),[h,f,g]),m=pt("div",t,{state:g,ref:n,props:u,stateAttributesMapping:xi});return p.jsx(oo.Provider,{value:d,children:m})});process.env.NODE_ENV!=="production"&&(Ci.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 El(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 Sl=/transform|translate|scale|rotate|perspective|filter/,wl=/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))||Sl.test(t.willChange||"")||wl.test(t.contain||"")}function Rl(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 Ei(e){const t=lt(e);return ct(t)?(e.ownerDocument||e).body:_e(t)&&Xn(t)?t:Ei(t)}function Gt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ei(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 Si=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Si.displayName="CompositeRootContext");function Tl(e=!1){const t=y.useContext(Si);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>.":St(16));return t}function Pl(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:y.useMemo(()=>{const l={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.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 wi(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=y.useRef(null),c=Tl(!0),a=s??c!==void 0,{props:l}=Pl({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&y.useEffect(()=>{var d,m;if(!i.current)return;const g=mn(i.current);if(o){if(!g){const b=((d=tt.captureOwnerStack)==null?void 0:d.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 u=y.useCallback(()=>{const g=i.current;mn(g)&&a&&t&&l.disabled===void 0&&g.disabled&&(g.disabled=!1)},[t,l.disabled,a]);pe(u,[u]);const f=y.useCallback((g={})=>{const{onClick:d,onMouseDown:m,onKeyUp:b,onKeyDown:v,onPointerDown:x,...E}=g;return to({onClick(C){if(t){C.preventDefault();return}d==null||d(C)},onMouseDown(C){t||m==null||m(C)},onKeyDown(C){if(t||(An(C),v==null||v(C),C.baseUIHandlerPrevented))return;const w=C.target===C.currentTarget,S=C.currentTarget,R=mn(S),P=!o&&Ol(S),O=w&&(o?R:!P),M=C.key==="Enter",F=C.key===" ",A=S.getAttribute("role"),D=(A==null?void 0:A.startsWith("menuitem"))||A==="option"||A==="gridcell";if(w&&a&&F){if(C.defaultPrevented&&D)return;C.preventDefault(),(!o||R)&&(C.preventBaseUIHandler(),dr(S,C));return}if(!O||o||!F&&!M){w&&P&&F&&C.preventDefault();return}C.defaultPrevented||(C.preventDefault(),M&&(C.preventBaseUIHandler(),dr(S,C)))},onKeyUp(C){if(!t){if(An(C),b==null||b(C),C.target===C.currentTarget&&o&&a&&mn(C.currentTarget)&&C.key===" "){C.preventDefault();return}C.baseUIHandlerPrevented||C.target===C.currentTarget&&!o&&!a&&!C.defaultPrevented&&C.key===" "&&(C.preventBaseUIHandler(),dr(C.currentTarget,C))}},onPointerDown(C){if(t){C.preventDefault();return}x==null||x(C)}},o?{type:"button"}:{role:"button"},l,E)},[t,l,a,o]),h=fe(g=>{i.current=g,u()});return{getButtonProps:f,buttonRef:h}}function mn(e){return _e(e)&&e.tagName==="BUTTON"}function Ol(e){return _e(e)&&e.tagName==="A"&&!!e.href}const Il={...xl,...io},Ri=y.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=yi(),{className:a,disabled:l=c,render:u,nativeButton:f=!0,style:h,...g}=t,{getButtonProps:d,buttonRef:m}=wi({disabled:l,native:f});return pt("button",t,{state:i,ref:[n,m],props:[{"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s},g,d],stateAttributesMapping:Il})});process.env.NODE_ENV!=="production"&&(Ri.displayName="CollapsibleTrigger");function Ce(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(_l,e).current;return t.next=e,pe(t.effect),t}function _l(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function kl(e){return e==null?e:"current"in e?e.current:e}function ts(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 Al(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=ll();return fe((o,s=null)=>{r.cancel();const i=kl(e);if(i==null)return;const c=i,a=()=>{if(!n){dt.flushSync(o);return}Al(()=>{s!=null&&s.aborted||o()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(ts(c).map(u=>u.finished.then(eo))).then(()=>{s!=null&&s.aborted||a()},()=>{if(s!=null&&s.aborted)return;if(ts(c).some(f=>f.pending||f.playState!=="finished")){l();return}a()})}if(t){const u=so;if(!c.hasAttribute(u)){r.request(l);return}const f=new MutationObserver(()=>{c.hasAttribute(u)||(f.disconnect(),l())});f.observe(c,{attributes:!0,attributeFilter:[u]}),s==null||s.addEventListener("abort",()=>f.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);y.useEffect(()=>{if(!t)return;const a=new AbortController;return c(i,a.signal),()=>{a.abort()}},[t,n,i,c])}const Ot={height:void 0,width:void 0};function Nl(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:c,setMounted:a,setOpen:l,transitionStatus:u}=e,f=y.useRef(null),h=y.useRef(null),[g,d]=y.useState(Ot),m=y.useRef(Ot),b=y.useRef(!1),v=y.useRef(c),x=y.useRef(!1),[E,C]=y.useState(!1),w=y.useRef(null),S=Rr(t,f),R=qe(c),P=Ti(f),O=!c&&!s,M=E?"idle":u,F=c&&(v.current||x.current),A=!c&&s&&h.current==="css-animation"&&g.height===void 0&&g.width===void 0?m.current:g,D=n&&O&&h.current!=="css-animation",_=fe((N,Y=!0)=>{Y&&(m.current=N),d(N)}),T=fe(()=>{var N;(N=w.current)==null||N.call(w),w.current=null}),k=fe(N=>{T(),w.current=()=>{w.current=null,N()}}),U=fe(()=>{c&&s&&h.current==="css-animation"&&(x.current=!0)});pe(()=>{!E||u==="starting"||C(!1)},[E,u]),y.useEffect(()=>()=>{U(),T()},[U,T]),pe(()=>{c||(v.current=!1,x.current=!1);const N=f.current;if(!N)return;!c&&w.current&&T();const Y=jl(N,F);if(h.current=Y,c&&u==="idle"&&v.current&&Y==="css-animation"){m.current=It(N);return}if(c&&u==="starting"){const ie=b.current;if(b.current=!1,Y==="none"){_(It(N)),C(!0);return}if(Y==="css-transition"){const B=Ml(N);if(_(It(N)),!ie)return B;const $=vn(N,"transition-duration","0s");return k($),C(!0),B}_(It(N));const L=vn(N,"animation-name","none");if(!ie){L();return}const X=vn(N,"animation-duration","0s");L(),k(X),C(!0);return}if(!c&&s&&(u==="idle"||u==="starting")){if(Y==="none"){_(Ot,!1),a(!1);return}_(It(N));return}if(u!=="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"&&vn(N,"animation-name","none")()},[s,c,T,_,a,k,F,u]),uo({enabled:c&&s&&M==="idle",open:!0,ref:f,onComplete(){c&&_(Ot,!1)}}),y.useEffect(()=>{if(c||!s||M!=="ending")return;if(!f.current){a(!1),_(Ot,!1);return}const Y=new AbortController;let K=-1;function le(){R.current||(a(!1),_(Ot,!1))}return K=Ne.request(()=>{P(le,Y.signal)}),()=>{Ne.cancel(K),Y.abort()}},[R,s,c,M,P,_,a]),pe(()=>{const N=f.current;!N||!n||!O||N.setAttribute("hidden","until-found")},[O,n]),y.useEffect(function(){const Y=f.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=Ce(Y,"beforematch",B=>{const $=Pe(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:O,id:r},ref:S,shouldPreventOpenAnimation:F,shouldRender:j,transitionStatus:M,width:A.width}}function It(e){return{height:e.scrollHeight,width:e.scrollWidth}}function jl(e,t){const n=Ie(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&ns(n.animationDuration),o=ns(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 ns(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function vn(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 Ml(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 Dl="--collapsible-panel-height",Fl="--collapsible-panel-width",Pi=y.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:c,style:a,...l}=t;process.env.NODE_ENV!=="production"&&y.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:u,mounted:f,onOpenChange:h,open:g,setMounted:d,setPanelIdState:m,setOpen:b,state:v,transitionStatus:x}=yi(),E=o??!1,C=s??!1,w=c||void 0,S=w??u;pe(()=>(m(U=>w??(U===null?void 0:U)),()=>{m(U=>U===w?null:U)}),[w,m]);const{height:R,props:P,ref:O,shouldPreventOpenAnimation:M,shouldRender:F,transitionStatus:A,width:D}=Nl({externalRef:n,hiddenUntilFound:E,id:S,keepMounted:C,mounted:f,onOpenChange:h,open:g,setMounted:d,setOpen:b,transitionStatus:x}),_={...v,transitionStatus:A},T=ai(a,_),k=pt("div",{...t,style:void 0},{state:_,ref:O,props:[P,{style:{[Dl]:R===void 0?"auto":`${R}px`,[Fl]: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"&&(Pi.displayName="CollapsiblePanel");function bt({className:e,...t}){return p.jsx("div",{"data-slot":"trace",className:ue("trace",e),...t})}function Nt({className:e,status:t,...n}){return p.jsx("span",{"data-slot":"trace-line","data-status":t,className:ue("trace-line",e),...n})}function xt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-icon",className:ue("trace-icon",e),...t,"aria-hidden":"true"})}function jt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-title",className:ue("trace-title",e),...t})}function Kt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-description",className:ue("trace-description",e),...t})}function Oi(e){return p.jsx(Ci,{"data-slot":"trace-collapsible",...e})}function Ii({children:e,className:t,...n}){return p.jsxs(Ri,{type:"button","data-slot":"trace-collapsible-trigger",className:ue("trace-trigger",t),...n,children:[e,p.jsx(xt,{className:"trace-chevron",children:p.jsx(Zs,{size:13})})]})}function _i({className:e,...t}){return p.jsx(Pi,{...t,"data-slot":"trace-collapsible-content",className:ue("trace-content",e)})}const Ll=({message:e,onRetry:t})=>p.jsx(Jr,{className:"chat-error-banner",role:"alert",children:p.jsxs(Zr,{children:[p.jsx(bt,{className:"chat-message-body",children:p.jsxs(Nt,{status:"error",children:[p.jsx(xt,{children:p.jsx(ma,{size:14})}),p.jsx(jt,{className:"chat-error-title",children:e})]})}),t&&p.jsx(wr,{children:p.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Bl={alpha:{label:"Alpha",Icon:ya,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:Ta,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Ea,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:ba,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Vl=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Bl[e];return p.jsxs("span",{className:`env-badge-inline ${s} ${n}`.trim(),title:i,"aria-label":`${r} build`,role:"status",children:[p.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),p.jsx("span",{className:"env-badge-inline-label",children:r})]})},fo="data:image/svg+xml,%3csvg%20width='300'%20height='322'%20viewBox='0%200%20300%20322'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M213.058%2052.9833C228.726%2054.9056%20244.193%2057.9635%20259.583%2061.4059C269.998%2063.5987%20280.269%2066.4233%20290.34%2069.864C292.753%2070.7216%20295.072%2071.8691%20297.438%2072.8214C298.27%2073.1024%20298.978%2073.6651%20299.439%2074.4125C299.9%2075.1598%20300.085%2076.0447%20299.963%2076.9144C299.963%2077.4408%20299.963%2077.9672%20299.963%2078.4936C299.963%20112.823%20299.963%20147.15%20299.963%20181.475C299.985%20185.264%20298.951%20188.983%20296.976%20192.217C289.695%20204.395%20281.876%20216.225%20273.844%20227.918C264.972%20240.848%20255.632%20253.458%20245.66%20265.577C240.775%20271.492%20235.924%20277.472%20230.944%20283.322C227.815%20286.989%20224.438%20290.419%20221.232%20294.039C214.578%20301.551%20207.54%20308.696%20200.394%20315.728C199.125%20317.122%20197.691%20318.355%20196.124%20319.402C194.628%20320.262%20192.963%20320.789%20191.244%20320.945C187.118%20321.36%20182.97%20321.524%20178.823%20321.436C155.756%20320.549%20132.653%20321.288%20109.568%20321.04C108.093%20321.056%20106.63%20320.771%20105.27%20320.203C103.909%20319.634%20102.679%20318.794%20101.654%20317.734C95.4904%20311.523%2089.2326%20305.419%2083.1227%20299.132C79.4615%20295.346%2076.0664%20291.295%2072.5767%20287.349C69.087%20283.404%2065.4258%20279.382%2061.9893%20275.289C57.9732%20270.492%2053.9925%20265.66%2050.2071%20260.686C43.1094%20251.323%2035.9466%20241.966%2029.1269%20232.39C23.2654%20224.156%2017.7884%20215.651%2012.2403%20207.205C9.05229%20202.354%206.0712%20197.362%202.97778%20192.447C0.696594%20189.116%20-0.326373%20185.083%200.091433%20181.067C0.156556%20180.164%200.168387%20179.257%200.126902%20178.352V78.3221C0.126902%2073.8446%200.387122%2073.2532%204.69898%2071.7212C10.661%2069.5978%2016.6645%2067.5336%2022.739%2065.8065C34.7232%2062.4186%2046.872%2059.643%2059.1384%2057.4904C68.2649%2055.8283%2077.4741%2054.4916%2086.6006%2053.0129C87.0442%2052.936%2087.4937%2052.8591%2087.9314%2052.7526L90.2973%2052.2913C90.2973%2052.8236%2090.2973%2056.68%2090.2973%2057.2064C90.2973%2098.2351%2090.2815%20139.27%2090.25%20180.31C90.1517%20184.707%2091.5027%20189.013%2094.0946%20192.566C99.4178%20199.953%20104.611%20207.488%20110.106%20214.764C117.925%20225.103%20125.88%20235.341%20133.972%20245.479C138.059%20250.583%20142.536%20255.386%20146.984%20260.207C149.823%20263.294%20150.569%20263.164%20153.378%20260.023L153.68%20259.686C155.555%20257.527%20157.448%20255.38%20159.317%20253.215C162.363%20249.667%20165.539%20246.236%20168.413%20242.569C175.381%20233.697%20182.307%20224.724%20189.062%20215.657C194.977%20207.743%20200.631%20199.646%20206.374%20191.607C208.444%20188.701%20209.517%20185.202%20209.432%20181.635C209.373%20160.815%20209.403%20139.995%20209.403%20119.175V56.9107C209.403%2056.2305%20209.403%2053.2495%20209.403%2052.5693'%20fill='white'/%3e%3cpath%20d='M90.3197%2052.5822C90.3612%2049.0806%2090.3197%2043.1185%2090.3197%2039.6347V8.54682C90.3197%207.87845%2090.3197%207.20414%2090.3197%206.53578C90.2821%206.17841%2090.3153%205.81714%2090.4174%205.47261C90.5195%205.12808%2090.6886%204.80708%2090.915%204.52799C91.1413%204.24889%2091.4205%204.01719%2091.7365%203.84613C92.0525%203.67507%2092.3992%203.56802%2092.7566%203.53111C94.2873%203.22177%2095.8362%203.01037%2097.3938%202.89822C101.534%202.4901%20105.674%202.11747%20109.815%201.75075C112.849%201.47867%20115.895%201.24801%20118.935%200.993674C119.231%200.993674%20119.527%200.904963%20119.823%200.893134C124.134%200.72752%20128.452%200.526411%20132.77%200.414031C139.696%200.236588%20146.622%200.0118295%20153.548%200C159.357%200%20165.165%200.171503%20170.967%200.455411C177.805%200.792552%20184.636%201.2835%20191.462%201.804C195.987%202.15297%20200.5%202.67346%20205.019%203.14072C208.284%203.47786%20209.283%204.55433%20209.301%207.94348C209.336%2014.9466%20209.301%2021.9555%20209.301%2028.9645C209.301%2035.8197%20209.301%2045.727%20209.301%2052.5822L206.344%2052.316C203.315%2051.9729%20200.281%2051.6299%20197.241%2051.3637C190.569%2050.7722%20183.909%2050.0861%20177.225%2049.6958C171.311%2049.3468%20165.313%2049.1753%20159.363%2049.2167C148.633%2049.3054%20137.898%2048.7375%20127.175%2049.6011C122.135%2050.0092%20117.066%2050.1216%20112.027%2050.5238C105.799%2051.0147%2099.606%2051.6358%2093.36%2052.2628'%20fill='%23FF4717'/%3e%3c/svg%3e",$l=({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})=>p.jsxs("header",{className:"chat-header",children:[p.jsxs("div",{className:"chat-header-left",children:[o&&p.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:p.jsx(fa,{size:16})}),p.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:fo,alt:"VPS Logo",style:{width:"16px",height:"16px"}})}),p.jsxs("div",{children:[p.jsxs("div",{className:"chat-header-title-row",children:[p.jsx("h2",{className:"chat-header-title",children:e}),p.jsx(Vl,{stage:a,pulse:l})]}),p.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),p.jsxs("div",{className:"chat-header-actions",children:[i&&p.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?p.jsx(Ia,{size:16,"aria-hidden":"true"}):p.jsx(_a,{size:16,"aria-hidden":"true"})}),r&&p.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:p.jsx(Ra,{size:15})}),n&&p.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:p.jsx(Sa,{size:16})})]})]});function Hl(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 Ul({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group",className:ue("chat-input-group",e)})}function zl({className:e,...t}){return p.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:ue("chat-textarea",e)})}function Wl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group-addon",className:ue("chat-input-actions",e)})}function rs({className:e,...t}){return p.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:ue("chat-send-btn",e)})}const ki=y.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:c=!0,style:a,...l}=t,{getButtonProps:u,buttonRef:f}=wi({disabled:s,focusableWhenDisabled:i,native:c});return pt("button",t,{state:{disabled:s},ref:[n,f],props:[l,u]})});process.env.NODE_ENV!=="production"&&(ki.displayName="Button");const os=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ss=Ks,ql=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ss(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 u=n==null?void 0:n[l],f=s==null?void 0:s[l];if(u===null)return null;const h=os(u)||os(f);return o[l][h]}),c=n&&Object.entries(n).reduce((l,u)=>{let[f,h]=u;return h===void 0||(l[f]=h),l},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,u)=>{let{class:f,className:h,...g}=u;return Object.entries(g).every(d=>{let[m,b]=d;return Array.isArray(b)?b.includes({...s,...c}[m]):{...s,...c}[m]===b})?[...l,f,h]:l},[]);return ss(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},Gl=ql("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 po({className:e,variant:t,size:n,...r}){return p.jsx(ki,{type:"button","data-slot":"button",...r,className:o=>ue(Gl({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Kl({className:e,...t}){return p.jsx("div",{...t,className:ue("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Yl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return p.jsx(po,{...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 Xl(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const Jl=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?p.jsx(Kl,{className:r==="badge"?"chat-suggestion-strip":"suggestions-list",role:"list","aria-label":"Suggested questions",children:e.map(o=>p.jsx("div",{role:"listitem",children:p.jsx(Yl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,Zl=({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:u}=en(),[f,h]=I.useState(""),g=I.useRef(null),d=I.useId(),m=I.useId(),b=C=>{C&&(C.style.height="auto",C.style.height=`${Math.min(C.scrollHeight,96)}px`)};Hl(n,g),I.useImperativeHandle(o,()=>({edit(C){var w;n||(h(C),(w=g.current)==null||w.focus())}}),[n]),I.useEffect(()=>{b(g.current)},[f]);const v=I.useMemo(()=>{if(!c||n)return[];const C=f.trim();return C?Xl(s,C):i?s:[]},[n,i,c,s,f]),x=C=>{h(C.query);const w=g.current;w==null||w.focus()},E=()=>{const C=f.trim();!C||n||(e(C),h(""))};return p.jsxs("div",{className:"chat-input-wrapper",children:[p.jsx(Jl,{variant:"badge",suggestions:v,onSelect:x,disabled:n}),p.jsxs("form",{onSubmit:C=>{C.preventDefault(),E()},children:[p.jsx("label",{htmlFor:d,className:"sr-only",children:"Chat message"}),p.jsxs(Ul,{children:[p.jsx(zl,{id:d,ref:g,rows:1,value:f,disabled:n,placeholder:r,onChange:C=>h(C.target.value),onKeyDown:C=>{var w;C.key==="Enter"&&!C.shiftKey&&!C.nativeEvent.isComposing&&(C.preventDefault(),(w=C.currentTarget.form)==null||w.requestSubmit())}}),p.jsxs(Wl,{children:[a.length>1&&p.jsxs("div",{className:"chat-model-picker",children:[p.jsx("label",{htmlFor:m,className:"sr-only",children:"AI model"}),p.jsxs("select",{id:m,value:l,disabled:n,onChange:C=>u(C.target.value),children:[p.jsx("option",{value:"auto",children:"Automatic"}),a.map(C=>p.jsx("option",{value:C.id,disabled:!C.configured,children:C.label},C.id))]})]}),t?p.jsx(rs,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:p.jsx(ni,{size:13,fill:"currentColor","aria-hidden":"true"})}):p.jsx(rs,{type:"submit",disabled:n||!f.trim(),"aria-label":"Send message",title:"Send message",children:p.jsx(da,{size:16,"aria-hidden":"true"})})]})]})]}),p.jsxs("p",{className:"chat-input-footer",children:[p.jsx("span",{className:"chat-input-note",children:"AI can make mistakes."}),"Powered by ",p.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function Ql({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(eu(r,o),t);if(!n)return y.createElement(e,s);if(typeof n=="function")return n(s,r);if(!y.isValidElement(n))return null;let i=n.props,c={..._r(s,i),ref:tn(s.ref,i.ref)};return y.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):nu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=tu(s,i):t[o]=s}}return t}function eu(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 tu(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function nu(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 ru=8,ou=64,su=0,jn=.5,iu=180,cu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),Ai={start:!1,end:!1},au=[],Mn={currentAnchorId:null,visibleMessageIds:au};function lu({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ai;let o=ho({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function uu({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=[],u=null;for(let f of Yt(e,r)){let h=f.dataset.messageId;if(!h)continue;let g=f.dataset.scrollAnchor==="true",d=g||a?f.getBoundingClientRect():null;(a&&d?d.bottom>c&&d.top<i.bottom:s.has(h))&&l.push(h),g&&d&&d.top<=c+jn&&(u=h)}return l.length===0&&u===null?Mn:{currentAnchorId:u,visibleMessageIds:l}}function Yt(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function fu(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 du(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function pu(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 hu(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 gu({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 mu({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,u=o.scrollTop+o.clientHeight-c.end;return s>=l&&a<=u?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 On(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function bu({content:e,scrollTop:t,spacer:n,viewport:r}){let o=ho({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function ho({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 vu(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 xu(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 is(e,t){return Mi(e,t)}function Cu(){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=y.useRef(e),i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!1),l=y.useRef(n),u=y.useRef(0),f=y.useRef(null),h=y.useRef(0),g=y.useRef(e?"following-bottom":"free-scrolling"),d=y.useRef(new Map),m=y.useRef(null),b=y.useRef(null),v=y.useRef(null),x=y.useRef(o),E=y.useRef(!0),C=y.useRef(null),w=y.useRef(r),S=y.useRef(null),R=y.useRef(0),P=y.useRef(0),O=y.useRef(null),M=y.useRef(null),F=y.useRef(null),A=y.useRef(null),D=y.useRef(null),_=y.useRef(null),T=y.useRef(null),k=y.useRef(null),U=y.useRef(null),j=y.useRef(new Set),N=y.useRef(new WeakSet);return F.current===null&&(F.current=is(t==="end"||t==="last-anchor",(Y,K)=>Y===K)),A.current===null&&(A.current=is(Ai,Eu)),U.current===null&&(U.current=Cu()),s.current=e,l.current=n,w.current=r,x.current=o,{autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:D,streamingTurnRef:v,contentRef:c,defaultScrollPositionAppliedRef:a,firstItemRef:f,itemCountRef:u,lastScrollTopRef:h,messageElementsRef:d,modeRef:g,pendingScrollFrameRef:S,pendingScrollToMessageRef:m,prependRestoreRef:b,preserveScrollOnPrependRef:E,pendingDefaultScrollStore:F.current,rootRef:C,scrollEdgeThresholdRef:l,scrollMarginRef:w,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:P,spacerRef:O,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 Ru({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:a,itemCountRef:l,messageElementsRef:u,modeRef:f,pendingScrollToMessageRef:h,prependRestoreRef:g,scrollMarginRef:d,scrollPreviousItemPeekRef:m,spacerGapRef:b,spacerHeightRef:v,spacerRef:x,viewportRef:E}=e,C=y.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()},iu))},[t]),w=y.useCallback(A=>{let D=x.current;if(!D)return;let _=Math.max(0,Math.ceil(A));v.current!==_&&(v.current=_,D.hidden=_===0,D.style.height=`${_}px`,D.style.marginTop=_>0?`${-b.current}px`:"")},[]),S=y.useCallback((A,{behavior:D="auto",autoscrolling:_=!1}={})=>{let T=E.current;if(!T)return;let k=Math.max(0,A);if(Math.abs(T.scrollTop-k)<=jn){T.scrollTop=k,t();return}_&&C(!0),T.scrollTo({top:k,behavior:D}),n()},[t,n,C]),R=y.useCallback(({behavior:A="auto"}={})=>E.current?(w(0),o.current=null,f.current="free-scrolling",S(0,{behavior:A}),r(),!0):!1,[r,S,w]),P=y.useCallback(({behavior:A="auto"}={})=>{let D=E.current;return D?(w(0),o.current=null,f.current=s.current?"following-bottom":"free-scrolling",S(vu(D),{autoscrolling:!0,behavior:A}),r(),!0):!1},[r,S,w]),O=y.useCallback((A,{align:D="start",behavior:_="auto",scrollMargin:T=d.current}={},{keepPreviousPeek:k=!1}={})=>{let U=a.current,j=E.current;if(!U||!j||!U.contains(A))return!1;let N=mu({align:D,element:A,scrollMargin:k?T+m.current:T,spacer:x.current,viewport:j}),Y=bu({content:U,scrollTop:N,spacer:x.current,viewport:j});return w(Y),g.current={element:A,viewportTop:On(A,j)},f.current=k?"anchored-to-message":"settling-jump",o.current=k?A:null,S(N,{behavior:_}),r(),!0},[r,S,w]),M=y.useCallback(()=>{let A=o.current;return!A||!A.isConnected||f.current!=="anchored-to-message"?!1:O(A,{align:"start"},{keepPreviousPeek:!0})},[O]),F=y.useCallback((A,D)=>{let _=u.current.get(A);return _?(In(e),O(_,D)?(h.current=null,!0):(h.current={messageId:A,options:D},!0)):l.current===0?(h.current={messageId:A,options:D},In(e),!0):!1},[O]);return{flushPendingScrollToMessage:y.useCallback(()=>{let A=h.current;if(!A)return!1;let D=u.current.get(A.messageId);return!D||!O(D,A.options)?!1:(h.current=null,In(e),!0)},[O]),reanchorToAnchoredMessage:M,scrollToElement:O,scrollToEnd:P,scrollToMessage:F,scrollToStart:R}}function cs(e,t){return y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Tu({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=ru,scrollPreviousItemPeek:r=ou,scrollMargin:o=su}){let s=wu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:a,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:f,firstItemRef:h,itemCountRef:g,lastScrollTopRef:d,messageElementsRef:m,modeRef:b,pendingScrollFrameRef:v,pendingScrollToMessageRef:x,prependRestoreRef:E,preserveScrollOnPrependRef:C,pendingDefaultScrollStore:w,rootRef:S,scrollEdgeThresholdRef:R,scrollMarginRef:P,scrollPreviousItemPeekRef:O,spacerGapRef:M,spacerHeightRef:F,spacerRef:A,stateFrameRef:D,stateStore:_,viewportRef:T,visibilityFrameRef:k,visibilityObserverRef:U,visibilityStore:j,visibleMessageIdsRef:N,handledScrollAnchorsRef:Y}=s,K=y.useRef(t);K.current!==t&&(K.current=t,f.current=!1);let le=y.useCallback(V=>{let q=S.current,Z=T.current,se=[V.start&&"start",V.end&&"end"].filter(Boolean).join(" "),ke=a.current;for(let we of[q,Z])we&&(se?we.setAttribute("data-scrollable",se):we.removeAttribute("data-scrollable"),we.toggleAttribute("data-autoscrolling",ke))},[]),ie=y.useCallback(V=>{var se;let q=((se=T.current)==null?void 0:se.scrollTop)??0,Z=q<d.current-jn;d.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=y.useCallback(()=>{let V=lu({content:u.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=y.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,L()}))},[L]),B=y.useCallback(()=>{j.hasListeners()&&k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,j.hasListeners()&&j.setSnapshot(uu({content:u.current,scrollMargin:P.current,scrollPreviousItemPeek:O.current,spacer:A.current,viewport:T.current,visibleMessageIds:N.current}))}))},[j]),{flushPendingScrollToMessage:$,reanchorToAnchoredMessage:Q,scrollToElement:re,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W}=Ru({refs:s,commitScrollState:L,scheduleStateCommit:X,scheduleVisibilitySync:B}),ne=y.useCallback(()=>{let V=E.current,q=T.current;if(!V||!q||!V.element.isConnected)return!1;let Z=On(V.element,q)-V.viewportTop;return Math.abs(Z)<=jn?!1:(q.scrollTop+=Z,V.viewportTop=On(V.element,q),X(),B(),!0)},[X,B]),oe=y.useCallback(()=>{let V=u.current,q=T.current;if(!V||!q){E.current=null;return}let Z=gu({content:V,spacer:A.current,viewport:q});E.current=Z?{element:Z,viewportTop:On(Z,q)}:null},[]),ve=y.useCallback(()=>{v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null,$()&&oe()}))},[oe,$]),z=y.useCallback(()=>{if(!t||f.current||g.current===0)return!1;let V=!1;if(t==="last-anchor"){let q=u.current,Z=T.current,se=q&&Z?hu(Yt(q,A.current)):null;if(!q||!Z||!se)V=ee({behavior:"auto"});else{let ke=Ni(se,Z);V=ho({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=y.useCallback(()=>{let V=u.current;if(!V)return;let q=Yt(V,A.current),Z=g.current,se=h.current;g.current=q.length,h.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(C.current&&ke>0){ne();return}if(q.length>Z){let we=fu(q,Z);if(we){if(c.current&&b.current==="following-bottom"&&pu(q,Z)){ee({behavior:"auto"});return}re(we,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(we);return}}if(q.length===Z){let we=du(q,Y.current);if(we){re(we,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(we);return}}b.current==="following-bottom"&&c.current?ee({behavior:"auto"}):(L(),B())})(),oe()},[z,oe,L,$,ne,B,re,ee]),ce=y.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=y.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:`${-(P.current+O.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]),Oe=y.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=y.useCallback((V,q,Z)=>{var se,ke,we;if(q){m.current.set(V,q),(se=U.current)==null||se.observe(q),B(),((ke=x.current)==null?void 0:ke.messageId)===V&&ve();return}Z&&m.current.get(V)===Z&&(m.current.delete(V),N.current.delete(V),(we=U.current)==null||we.unobserve(Z),B())},[ve,B]),Re=y.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),Me=y.useCallback(()=>le(_.getSnapshot()),[_,le]),Be=cs(S,Me),H=cs(T,Me),G=y.useCallback(V=>{u.current=V},[]),Ee=y.useCallback(V=>{A.current=V,M.current=xu((V==null?void 0:V.parentElement)??null)},[]),be=y.useCallback(()=>{L(),B(),oe()},[oe,L,B]),ge=y.useMemo(()=>({handleContentChange:J,handleResize:ce,observeVisibility:he,pendingDefaultScrollStore:w,preserveScrollOnPrependRef:C,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W,setContentElement:G,setRootElement:Be,setSpacerElement:Ee,setViewportElement:H,stateStore:_,syncAfterScroll:be,unobserveVisibility:Oe,userScrollIntent:Re,viewportRef:T,visibilityStore:j}),[J,ce,he,w,ee,te,W,G,Be,Ee,H,_,be,Oe,Re,j]);return y.useLayoutEffect(()=>{z()||g.current===0&&Di(s)},[z]),y.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),v.current!==null&&(window.cancelAnimationFrame(v.current),v.current=null),(V=U.current)==null||V.disconnect(),U.current=null},[]),y.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&g.current>0){ee({behavior:"auto"});return}L()},[e,L,ee]),{context:ge,registerMessage:je}}function Pu(e){let t=y.useRef(e);return t.current=e,t}var Fi=y.createContext(null),Li=y.createContext(null);function nn(){let e=y.useContext(Fi);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ou(){let e=y.useContext(Li);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Iu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=Tu({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return p.jsx(Fi.Provider,{value:i,children:p.jsx(Li.Provider,{value:c,children:t})})}function Bi(){let{pendingDefaultScrollStore:e}=nn();return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function _u({children:e,...t}){let{setRootElement:n}=nn(),r=Bi();return p.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function ku({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:s,preserveScrollOnPrepend:i=!0,ref:c,role:a,tabIndex:l,...u}){let{handleResize:f,preserveScrollOnPrependRef:h,setViewportElement:g,syncAfterScroll:d,userScrollIntent:m,viewportRef:b}=nn(),v=Bi();h.current=i;let x=y.useCallback(R=>{var P;g(R),(P=tn(c))==null||P(R)},[c,g]);function E(R){d(),r==null||r(R)}function C(R){m(),s==null||s(R)}function w(R){m(),o==null||o(R)}function S(R){cu.has(R.key)&&m(),n==null||n(R)}return y.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let P=0,O=new ResizeObserver(()=>{window.cancelAnimationFrame(P),P=window.requestAnimationFrame(f)});return O.observe(R),()=>{window.cancelAnimationFrame(P),O.disconnect()}},[f,b]),p.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:S,onScroll:E,onTouchMove:w,onWheel:C,...u,...v?{"data-pending-scroll":""}:null,children:t})}function Au({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=nn(),u=y.useRef(null),f=y.useCallback(h=>{var g;u.current=h,a(h),(g=tn(n))==null||g(h)},[n,a]);return y.useLayoutEffect(()=>{let h=u.current;if(!h||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(h,{childList:!0}),()=>g.disconnect()},[i]),y.useEffect(()=>{let h=u.current;if(!h||typeof ResizeObserver>"u")return;let g=0,d=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return d.observe(h),()=>{window.cancelAnimationFrame(g),d.disconnect()}},[c]),p.jsxs("div",{ref:f,role:r??"log","aria-relevant":e??"additions",...s,children:[t,p.jsx("div",{ref:l,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Nu({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ou(),s=y.useRef(null),i=y.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 p.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function ju({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:s,type:i="button",...c}){let{scrollToEnd:a,scrollToStart:l,stateStore:u}=nn(),f=Pu(r),h=y.useCallback(b=>u.subscribe(b),[u]),g=y.useCallback(()=>{let b=u.getSnapshot();return n==="start"?b.start:b.end},[n,u]),d=y.useSyncExternalStore(h,g,g),m=y.useCallback(b=>{var v;d&&((v=f.current)==null||v.call(f,b),b.defaultPrevented||(b.currentTarget.blur(),n==="start"?l({behavior:e}):a({behavior:e})))},[e,n,d,f,a,l]);return Ql({defaultTagName:"button",props:_r({type:i,inert:!d,tabIndex:d?s:-1,children:t??p.jsxs("span",{children:["Scroll to ",n]}),onClick:m},c),render:o,state:{active:d,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Iu,Root:_u,Viewport:ku,Content:Au,Item:Nu,Button:ju};function Mu(e){return p.jsx(Ft.Provider,{...e})}function Du({className:e,...t}){return p.jsx(Ft.Root,{"data-slot":"message-scroller",className:ue("msg-scroller-root",e),...t})}function Fu({className:e,...t}){return p.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:ue("msg-scroller-viewport",e),...t})}function Lu({className:e,...t}){return p.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:ue("msg-scroller-content",e),...t})}function as({className:e,scrollAnchor:t=!1,...n}){return p.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:ue("msg-scroller-item",e),...n})}function Bu({direction:e="end",className:t,children:n,...r}){return p.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:ue("msg-scroller-btn",t),...r,children:n??p.jsxs(p.Fragment,{children:[p.jsx(ua,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),p.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 p.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:ue("chat-bubble",n)})}function Nr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"bubble-content",className:ue("chat-bubble-content",e)})}const Vu=()=>p.jsxs(Jr,{children:[p.jsx(ri,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(ha,{size:15})}),p.jsx(Zr,{children:p.jsx(Ar,{children:p.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 $u({message:e,onFeedback:t}){const{status:n,copy:r}=Vi();return p.jsxs("div",{className:"chat-message-actions",role:"group","aria-label":"Response actions",children:[p.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"?p.jsx(Xr,{size:16,"aria-hidden":"true"}):p.jsx(ei,{size:16,"aria-hidden":"true"})}),p.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:p.jsx(Oa,{size:16,"aria-hidden":"true"})}),p.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:p.jsx(Pa,{size:16,"aria-hidden":"true"})}),p.jsxs("span",{className:"chat-message-copy-status",role:"status",children:[n==="copied"&&"Copied",n==="failed"&&"Couldn’t copy"]})]})}function go(e){const t=e.trim();if(!/[\u0000-\u001f\u007f]/.test(t)&&/^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))return t}function Hu(e){return Object.prototype.toString.call(e)==="[object Object]"}function ls(e){return Hu(e)||Array.isArray(e)}function Uu(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function mo(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}`:!ls(c)||!ls(a)?c===a:mo(c,a)})}function us(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function zu(e,t){if(e.length!==t.length)return!1;const n=us(e),r=us(t);return n.every((o,s)=>{const i=r[s];return mo(o,i)})}function bo(e){return typeof e=="number"}function jr(e){return typeof e=="string"}function Qn(e){return typeof e=="boolean"}function fs(e){return Object.prototype.toString.call(e)==="[object Object]"}function Se(e){return Math.abs(e)}function vo(e){return Math.sign(e)}function Wt(e,t){return Se(e-t)}function Wu(e,t){if(e===0||t===0||Se(e)<=Se(t))return 0;const n=Wt(Se(e),Se(t));return Se(n/e)}function qu(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 ds(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=fs(s)&&fs(i);n[o]=c?$i(s,i):i}),n),{})}function Mr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Gu(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 Ku(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&&d()})}function u(){g(),o.clear()}function f(b){if(!a)return;i||(i=b,n(),n());const v=b-i;for(i=b,c+=v;c>=s;)n(),c-=s;const x=c/s;r(x),a&&(a=t.requestAnimationFrame(f))}function h(){a||(a=t.requestAnimationFrame(f))}function g(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function d(){i=null,c=0}return{init:l,destroy:u,start:h,stop:g,update:n,render:r}}function Yu(e,t){const n=t==="rtl",r=e==="y",o=r?"y":"x",s=r?"x":"y",i=!r&&n?-1:1,c=u(),a=f();function l(d){const{height:m,width:b}=d;return r?m:b}function u(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function h(d){return d*i}return{scroll:o,cross:s,startEdge:c,endEdge:a,measureSize:l,direction:h}}function Ct(e=0,t=0){const n=Se(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}=Ct(0,e),o=e+1;let s=i(t);function i(h){return n?Se((o+h)%o):r(h)}function c(){return s}function a(h){return s=i(h),f}function l(h){return u().set(c()+h)}function u(){return Hi(e,c(),n)}const f={get:c,set:a,add:l,clone:u};return f}function Xu(e,t,n,r,o,s,i,c,a,l,u,f,h,g,d,m,b,v,x){const{cross:E,direction:C}=e,w=["INPUT","SELECT","TEXTAREA"],S={passive:!1},R=Zt(),P=Zt(),O=Ct(50,225).constrain(g.measure(20)),M={mouse:300,touch:400},F={mouse:500,touch:600},A=d?43:25;let D=!1,_=0,T=0,k=!1,U=!1,j=!1,N=!1;function Y(W){if(!x)return;function ne(ve){(Qn(x)||x(W,ve))&&B(ve)}const oe=t;R.add(oe,"dragstart",ve=>ve.preventDefault(),S).add(oe,"touchmove",()=>{},S).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(),P.clear()}function le(){const W=N?n:t;P.add(W,"touchmove",$,S).add(W,"touchend",Q).add(W,"mousemove",$,S).add(W,"mouseup",Q)}function ie(W){const ne=W.nodeName||"";return w.includes(ne)}function L(){return(d?F:M)[N?"mouse":"touch"]}function X(W,ne){const oe=f.add(vo(W)*-1),ve=u.byDistance(W,!d).distance;return d||Se(W)<O?ve:b&&ne?ve*.5:u.byIndex(oe.get(),0).distance}function B(W){const ne=Mr(W,r);N=ne,j=d&&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,E),h.emit("pointerDown")))}function $(W){if(!Mr(W,r)&&W.touches.length>=2)return Q(W);const oe=s.readPoint(W),ve=s.readPoint(W,E),z=Wt(oe,_),J=Wt(ve,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(C(ce)),W.preventDefault()}function Q(W){const oe=u.byDistance(0,!1).index!==f.get(),ve=s.pointerUp(W)*L(),z=X(C(ve),oe),J=Wu(ve,z),ce=A-10*J,he=v+J/50;U=!1,k=!1,P.clear(),l.useDuration(ce).useFriction(he),a.distance(z,!d),N=!1,h.emit("pointerUp")}function re(W){j&&(W.stopPropagation(),W.preventDefault(),j=!1)}function ee(){return k}return{init:Y,destroy:K,pointerDown:ee}}function Ju(e,t){let r,o;function s(f){return f.timeStamp}function i(f,h){const d=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Mr(f,t)?f:f.touches[0])[d]}function c(f){return r=f,o=f,i(f)}function a(f){const h=i(f)-i(o),g=s(f)-s(r)>170;return o=f,g&&(r=f),h}function l(f){if(!r||!o)return 0;const h=i(o)-i(r),g=s(f)-s(r),d=s(f)-s(o)>170,m=h/g;return g&&!d&&Se(m)>.1?m:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function Zu(){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 Qu(e){function t(r){return e*(r/100)}return{measure:t}}function ef(e,t,n,r,o,s,i){const c=[e].concat(r);let a,l,u=[],f=!1;function h(b){return o.measureSize(i.measure(b))}function g(b){if(!s)return;l=h(e),u=r.map(h);function v(x){for(const E of x){if(f)return;const C=E.target===e,w=r.indexOf(E.target),S=C?l:u[w],R=h(C?e:r[w]);if(Se(R-S)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(Qn(s)||s(b,x))&&v(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function d(){f=!0,a&&a.disconnect()}return{init:g,destroy:d}}function tf(e,t,n,r,o,s){let i=0,c=0,a=o,l=s,u=e.get(),f=0;function h(){const S=r.get()-e.get(),R=!a;let P=0;return R?(i=0,n.set(r),e.set(r),P=S):(n.set(e),i+=S/a,i*=l,u+=i,e.add(i),P=u-f),c=vo(P),f=u,w}function g(){const S=r.get()-t.get();return Se(S)<.001}function d(){return a}function m(){return c}function b(){return i}function v(){return E(o)}function x(){return C(s)}function E(S){return a=S,w}function C(S){return l=S,w}const w={direction:m,duration:d,velocity:b,seek:h,settled:g,useBaseFriction:x,useBaseDuration:v,useFriction:C,useDuration:E};return w}function nf(e,t,n,r,o){const s=o.measure(10),i=o.measure(50),c=Ct(.1,.99);let a=!1;function l(){return!(a||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(g){if(!l())return;const d=e.reachedMin(t.get())?"min":"max",m=Se(e[d]-t.get()),b=n.get()-t.get(),v=c.constrain(m/i);n.subtract(b*v),!g&&Se(b)<s&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(g){a=!g}return{shouldConstrain:l,constrain:u,toggleActive:f}}function rf(e,t,n,r,o){const s=Ct(-t+e,0),i=f(),c=u(),a=h();function l(d,m){return Wt(d,m)<=1}function u(){const d=i[0],m=Ge(i),b=i.lastIndexOf(d),v=i.indexOf(m)+1;return Ct(b,v)}function f(){return n.map((d,m)=>{const{min:b,max:v}=s,x=s.constrain(d),E=!m,C=yo(n,m);return E?v:C||l(b,x)?b:l(v,x)?v:x}).map(d=>parseFloat(d.toFixed(3)))}function h(){if(t<=e+o)return[s.max];if(r==="keepSnaps")return i;const{min:d,max:m}=c;return i.slice(d,m)}return{snapsContained:a,scrollContainLimit:c}}function of(e,t,n){const r=t[0],o=n?r-e:Ge(t);return{limit:Ct(o,r)}}function sf(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=Ct(s,i);function l(h){return h===1?a(n.get()):h===-1?c(n.get()):!1}function u(h){if(!l(h))return;const g=e*(h*-1);r.forEach(d=>d.add(g))}return{loop:u}}function cf(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function af(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=f().map(t.measure),l=h(),u=g();function f(){return c(r).map(m=>Ge(m)[i]-m[0][s]).map(Se)}function h(){return r.map(m=>n[s]-m[s]).map(m=>-Se(m))}function g(){return c(l).map(m=>m[0]).map((m,b)=>m+a[b])}return{snaps:l,snapsAligned:u}}function lf(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=u();function u(){const h=i(s),g=!e||t==="keepSnaps";return n.length===1?[s]:g?h:h.slice(c,a).map((d,m,b)=>{const v=!m,x=yo(b,m);if(v){const E=Ge(b[0])+1;return ds(E)}if(x){const E=rn(s)-Ge(b)[0]+1;return ds(E,Ge(b)[0])}return d})}return{slideRegistry:l}}function uf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(d){return d.concat().sort((m,b)=>Se(m)-Se(b))[0]}function l(d){const m=e?i(d):c(d),b=t.map((x,E)=>({diff:u(x-m,0),index:E})).sort((x,E)=>Se(x.diff)-Se(E.diff)),{index:v}=b[0];return{index:v,distance:m}}function u(d,m){const b=[d,d+n,d-n];if(!e)return d;if(!m)return a(b);const v=b.filter(x=>vo(x)===m);return v.length?a(v):Ge(b)-n}function f(d,m){const b=t[d]-o.get(),v=u(b,m);return{index:d,distance:v}}function h(d,m){const b=o.get()+d,{index:v,distance:x}=l(b),E=!e&&s(b);if(!m||E)return{index:v,distance:d};const C=t[v]-x,w=d+u(C,0);return{index:v,distance:w}}return{byDistance:h,byIndex:f,shortcut:u}}function ff(e,t,n,r,o,s,i){function c(f){const h=f.distance,g=f.index!==t.get();s.add(h),h&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),g&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function a(f,h){const g=o.byDistance(f,h);c(g)}function l(f,h){const g=t.clone().set(f),d=o.byIndex(g.get(),h);c(d)}return{distance:a,index:l}}function df(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function u(g){if(!c)return;function d(m){if(new Date().getTime()-l>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(m));bo(x)&&(o.useDuration(0),r.index(x,0),i.emit("slideFocus"))}s.add(document,"keydown",f,!1),t.forEach((m,b)=>{s.add(m,"focus",v=>{(Qn(c)||c(g,v))&&d(b)},a)})}function f(g){g.code==="Tab"&&(l=new Date().getTime())}return{init:u}}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 bo(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(h){return`translate3d(${h}px,0px,0px)`}function c(h){return`translate3d(0px,${h}px,0px)`}function a(h){if(s)return;const g=qu(e.direction(h));g!==o&&(r.transform=n(g),o=g)}function l(h){s=!h}function u(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function pf(e,t,n,r,o,s,i,c,a){const u=Xt(o),f=Xt(o).reverse(),h=v().concat(x());function g(R,P){return R.reduce((O,M)=>O-o[M],P)}function d(R,P){return R.reduce((O,M)=>g(O,P)>0?O.concat([M]):O,[])}function m(R){return s.map((P,O)=>({start:P-r[O]+.5+R,end:P+t-.5+R}))}function b(R,P,O){const M=m(P);return R.map(F=>{const A=O?0:-n,D=O?n:0,_=O?"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 v(){const R=i[0],P=d(f,R);return b(P,n,!1)}function x(){const R=t-i[0]-1,P=d(u,R);return b(P,-n,!0)}function E(){return h.every(({index:R})=>{const P=u.filter(O=>O!==R);return g(P,t)<=.1})}function C(){h.forEach(R=>{const{target:P,translate:O,slideLocation:M}=R,F=P();F!==M.get()&&(O.to(F),M.set(F))})}function w(){h.forEach(R=>R.translate.clear())}return{canLoop:E,clear:w,loop:C,loopPoints:h}}function hf(e,t,n){let r,o=!1;function s(a){if(!n)return;function l(u){for(const f of u)if(f.type==="childList"){a.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(u=>{o||(Qn(n)||n(a,u))&&l(u)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),o=!0}return{init:s,destroy:i}}function gf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(d=>{a||(d.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(d=>c.observe(d))}function u(){c&&c.disconnect(),a=!0}function f(d){return Jt(o).reduce((m,b)=>{const v=parseInt(b),{isIntersecting:x}=o[v];return(d&&x||!d&&!x)&&m.push(v),m},[])}function h(d=!0){if(d&&s)return s;if(!d&&i)return i;const m=f(d);return d&&(s=m),d||(i=m),m}return{init:l,destroy:u,get:h}}function mf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,u=d(),f=m(),h=n.map(i),g=b();function d(){if(!l)return 0;const x=n[0];return Se(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,E,C)=>{const w=!E,S=yo(C,E);return w?h[E]+u:S?h[E]+f:C[E+1][c]-x[c]}).map(Se)}return{slideSizes:h,slideSizesWithGaps:g,startGap:u,endGap:f}}function bf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:u,direction:f}=e,h=bo(n);function g(v,x){return Xt(v).filter(E=>E%x===0).map(E=>v.slice(E,E+x))}function d(v){return v.length?Xt(v).reduce((x,E,C)=>{const w=Ge(x)||0,S=w===0,R=E===rn(v),P=o[l]-s[w][l],O=o[l]-s[E][u],M=!r&&S?f(i):0,F=!r&&R?f(c):0,A=Se(O-F-(P+M));return C&&A>t+a&&x.push(E),R&&x.push(v.length),x},[]).map((x,E,C)=>{const w=Math.max(C[E-1]||0);return v.slice(w,x)}):[]}function m(v){return h?g(v,n):d(v)}return{groupSlides:m}}function vf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:u,loop:f,duration:h,dragFree:g,dragThreshold:d,inViewThreshold:m,slidesToScroll:b,skipSnaps:v,containScroll:x,watchResize:E,watchSlides:C,watchDrag:w,watchFocus:S}=s,R=2,P=Zu(),O=P.measure(t),M=n.map(P.measure),F=Yu(a,l),A=F.measureSize(O),D=Qu(A),_=Gu(c,A),T=!f&&!!x,k=f||!!x,{slideSizes:U,slideSizesWithGaps:j,startGap:N,endGap:Y}=mf(F,O,M,n,k,o),K=bf(F,A,b,f,O,M,N,Y,R),{snaps:le,snapsAligned:ie}=af(F,_,O,M,K),L=-Ge(le)+Ge(j),{snapsContained:X,scrollContainLimit:B}=rf(A,L,ie,x,R),$=T?X:ie,{limit:Q}=of(L,$,f),re=Hi(rn($),u,f),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:we,slideLooper:wt,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&&(we.loop(V.direction()),wt.loop()),q.to(se.get()),Vt&&Ze.emit("settle"),Bt||Ze.emit("scroll")},oe=Ku(r,o,()=>W(ge),V=>ne(ge,V)),ve=.68,z=$[re.get()],J=Ut(z),ce=Ut(z),he=Ut(z),Oe=Ut(z),je=tf(J,he,ce,Oe,h,ve),Re=uf(f,$,L,Q,Oe),Me=ff(oe,re,ee,je,Re,Oe,i),Be=cf(Q),H=Zt(),G=gf(t,n,i,m),{slideRegistry:Ee}=lf(T,x,$,B,K,te),be=df(e,n,Ee,Me,je,H,i,S),ge={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:O,slideRects:M,animation:oe,axis:F,dragHandler:Xu(F,e,r,o,Oe,Ju(F,o),J,oe,Me,je,Re,re,i,D,g,d,v,ve,w),eventStore:H,percentOfView:D,index:re,indexPrevious:ee,limit:Q,location:J,offsetLocation:he,previousLocation:ce,options:s,resizeHandler:ef(t,i,o,n,F,E,P),scrollBody:je,scrollBounds:nf(Q,he,Oe,je,D),scrollLooper:sf(L,Q,he,[J,he,ce,Oe]),scrollProgress:Be,scrollSnapList:$.map(Be.get),scrollSnaps:$,scrollTarget:Re,scrollTo:Me,slideLooper:pf(F,A,L,U,j,le,$,he,n),slideFocus:be,slidesHandler:hf(t,i,C),slidesInView:G,slideIndexes:te,slideRegistry:Ee,slidesToScroll:K,target:Oe,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(u=>u(t,l)),a}function s(l,u){return e[l]=r(l).concat([u]),a}function i(l,u){return e[l]=r(l).filter(f=>f!==u),a}function c(){e={}}const a={init:n,emit:o,off:i,on:s,clear:c};return a}const xf={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 Cf(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=Cf(o),i=Ef(s),c=Zt(),a=yf(),{mergeOptions:l,optionsAtMedia:u,optionsMediaQueries:f}=s,{on:h,off:g,emit:d}=a,m=F;let b=!1,v,x=l(xf,Dn.globalOptions),E=l(x),C=[],w,S,R;function P(){const{container:te,slides:W}=E;S=(jr(te)?e.querySelector(te):te)||e.children[0];const oe=jr(W)?S.querySelectorAll(W):W;R=[].slice.call(oe||S.children)}function O(te){const W=vf(e,S,R,r,o,te,a);if(te.loop&&!W.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return O(ne)}return W}function M(te,W){b||(x=l(x,te),E=u(x),C=W||C,P(),v=O(E),f([x,...C.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",F)),E.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(ee),v.eventHandler.init(ee),v.resizeHandler.init(ee),v.slidesHandler.init(ee),v.options.loop&&v.slideLooper.loop(),S.offsetParent&&R.length&&v.dragHandler.init(ee),w=i.init(ee,C)))}function F(te,W){const ne=K();A(),M(l({startIndex:ne},te),W),a.emit("reInit")}function A(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),i.destroy(),c.clear()}function D(){b||(b=!0,c.clear(),A(),a.emit("destroy"),a.clear())}function _(te,W,ne){!E.active||b||(v.scrollBody.useBaseFriction().useDuration(W===!0?0:E.duration),v.scrollTo.index(te,ne||0))}function T(te){const W=v.index.add(1).get();_(W,te,-1)}function k(te){const W=v.index.add(-1).get();_(W,te,1)}function U(){return v.index.add(1).get()!==K()}function j(){return v.index.add(-1).get()!==K()}function N(){return v.scrollSnapList}function Y(){return v.scrollProgress.get(v.offsetLocation.get())}function K(){return v.index.get()}function le(){return v.indexPrevious.get()}function ie(){return v.slidesInView.get()}function L(){return v.slidesInView.get(!1)}function X(){return w}function B(){return v}function $(){return e}function Q(){return S}function re(){return R}const ee={canScrollNext:U,canScrollPrev:j,containerNode:Q,internalEngine:B,destroy:D,off:g,on:h,emit:d,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 xo(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(()=>{mo(n.current,e)||(n.current=e,a())},[e,a]),I.useEffect(()=>{zu(r.current,t)||(r.current=t,a())},[t,a]),I.useEffect(()=>{if(Uu()&&i){Dn.globalOptions=xo.globalOptions;const l=Dn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}xo.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(Tf).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 Rf(e){return y.forwardRef(zi(e))}function Tf(){return{didInitialize:!1}}function Pf(){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:If,maxTouchPoints:_f}=Pf(),er=Of.toLowerCase(),Qt=If.toLowerCase(),Wi=/^i(os$|p)/.test(Qt)||Qt==="macintel"&&_f>1,ps="android",kf=Qt===ps||er.includes(ps),qi=!Wi&&Qt.startsWith("mac");Qt.startsWith("win");const Af=qi||Wi;var zs;const on=typeof CSS<"u"&&!!((zs=CSS.supports)!=null&&zs.call(CSS,"-webkit-backdrop-filter:none"));!on&&er.includes("firefox");!on&&er.includes("chrom");const Nf=Af,jf=/jsdom|happydom/.test(er);function Mf(e){return"nativeEvent"in e}function Df(e){return e.pointerType===""&&e.isTrusted?!0:kf&&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 Ff(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 vt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Lf="data-base-ui-focusable",Gi="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Bf="data-open",Vf="data-closed",$f="data-anchor-hidden",Hf="data-popup-open",Uf={[Hf]:""},zf={[Bf]:""},Wf={[Vf]:""},qf={[$f]:""},Gf={open(e){return e?Uf:null}},Ki={open(e){return e?zf:Wf},anchorHidden(e){return e?qf:null}},Kf={...Ki,...io},hs="data-trigger-disabled";function Fn(e,t){if(!me(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(hs);for(const[,r]of t.entries())if(Te(r,n))return!r.hasAttribute(hs);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 Yf(e){return e.matches("html,body")}function Xf(e){return _e(e)&&e.matches(Gi)}function Jf(e){return Vr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Gi}`)!=null}function Zf(e){if(!e||jf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qf(e,t){return t!=null&&!Lr(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=Qf(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function gs(e){return typeof e=="function"?e():e}function Yi(e,t){return t||e==="click"||e==="mousedown"}function ed(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 td={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},nd={...td,position:"fixed",margin:0,top:0,left:0},Hr=y.forwardRef(function(t,n){const[r,o]=y.useState();pe(()=>{Nf&&on&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:nd,"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,yn=Math.floor,rt=e=>({x:e,y:e}),rd={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 Co(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 Co(Ue(e))}function od(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 sd(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 ms=["left","right"],bs=["right","left"],id=["top","bottom"],cd=["bottom","top"];function ad(e,t,n){switch(e){case"top":case"bottom":return n?t?bs:ms:t?ms:bs;case"left":case"right":return t?id:cd;default:return[]}}function ld(e,t,n,r){const o=Je(e);let s=ad(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 rd[t]+e.slice(t.length)}function ud(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"?ud(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 fd(e){return e.visibility==="hidden"||e.visibility==="collapse"}function dd(e,t=e?$e(e):null){return!e||!e.isConnected||!t||fd(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const pd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function hd(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 gd(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(pd)&&(t!=="summary"||e.parentElement!=null&&Le(e.parentElement)==="details"&&zr(e.parentElement)===e)&&(t!=="details"||zr(e)==null)&&(t!=="input"||e.type!=="hidden")}function md(e){if(!Zi(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=hd(t)){const n=t!==e,r=Le(t)==="slot";if(t.hasAttribute("inert")||n&&Le(t)==="details"&&!t.open&&!gd(e,t)||t.hasAttribute("hidden")||!r&&!bd(t,n))return!1}return!0}function bd(e,t){const n=$e(e);return t?n.display!=="none":dd(e,n)}function vd(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 xd(e){const t=[];return ec(e,t),t.filter(md)}function nc(e){const t=xd(e);return t.filter(n=>vd(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 Cd(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 vs(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"}},Rd={fallbackAxisSide:"end"},Td={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ro=y.createContext(null);process.env.NODE_ENV!=="production"&&(Ro.displayName="PortalContext");const Pd=()=>y.useContext(Ro),Od=wo("portal");function oc(e={}){const{ref:t,container:n,componentProps:r=Fe,elementProps:o}=e,s=Gn(),i=Pd(),c=i==null?void 0:i.portalNode,[a,l]=y.useState(null),[u,f]=y.useState(null),h=fe(b=>{b!==null&&f(b)}),g=y.useRef(null);pe(()=>{if(n===null){g.current&&(g.current=null,f(null),l(null));return}const b=(n&&(co(n)?n:n.current))??c??document.body;if(b==null){g.current&&(g.current=null,f(null),l(null));return}g.current!==b&&(g.current=b,f(null),l(b))},[n,c]);const d=pt("div",r,{ref:[t,h],props:[{id:s,[Od]:""},o]}),m=a&&d?dt.createPortal(d,a):null;return{node:u,nodeId:y.isValidElement(d)?d.props.id:void 0,subtree:m}}const Id=y.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:c,portalOwnerRole:a,...l}=t,{node:u,nodeId:f,subtree:h}=oc({container:c,ref:n,componentProps:t,elementProps:l}),g=y.useRef(null),d=y.useRef(null),m=y.useRef(null),b=y.useRef(null),[v,x]=y.useState(null),E=y.useRef(!1),C=v==null?void 0:v.modal,w=v==null?void 0:v.open,S=!!v&&!v.modal&&v.open&&!!u;y.useEffect(()=>{if(!u||C)return;function P(O){u&&O.relatedTarget&&gr(O)&&(O.type==="focusin"?E.current&&(vs(u),E.current=!1):(Sd(u),E.current=!0))}return at(Ce(u,"focusin",P,!0),Ce(u,"focusout",P,!0))},[u,C]),pe(()=>{!u||w!==!0||!E.current||(vs(u),E.current=!1)},[w,u]);const R=y.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:d,beforeInsideRef:m,afterInsideRef:b,portalNode:u,setFocusManagerState:x}),[u]);return p.jsxs(y.Fragment,{children:[h,p.jsxs(Ro.Provider,{value:R,children:[S&&u&&p.jsx(Hr,{"data-type":"outside",ref:g,onFocus:P=>{var O;if(gr(P,u))(O=m.current)==null||O.focus();else{const M=v?v.domReference:null,F=Ed(M);F==null||F.focus()}}}),S&&u&&p.jsx("span",{role:a,"aria-owns":f,style:Td}),u&&dt.createPortal(i,u),S&&u&&p.jsx(Hr,{"data-type":"outside",ref:d,onFocus:P=>{var O;if(gr(P,u))(O=b.current)==null||O.focus();else{const M=v?v.domReference:null,F=Cd(M);F==null||F.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,Pe(il,P.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Id.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 _d{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 To=y.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="FloatingNodeContext");const Po=y.createContext(null);process.env.NODE_ENV!=="production"&&(Po.displayName="FloatingTreeContext");const tr=()=>{var e;return((e=y.useContext(To))==null?void 0:e.id)||null},sn=e=>{const t=y.useContext(Po);return e??t};function kd(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 Ad(e){const{children:t,id:n}=e,r=tr();return p.jsx(To.Provider,{value:y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nd(e){const{children:t,externalTree:n}=e,r=Ye(()=>n??new _d).current;return p.jsx(Po.Provider,{value:r,children:t})}function jd(){return!1}function Md(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 Dd(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=jd,bubbles:c,externalTree:a}=t,l=e.useState("open"),u=e.useState("floatingElement"),{dataRef:f,events:h}=e.context,g=sn(a),d=fe(typeof o=="function"?o:()=>!1),m=typeof o=="function"?d:o,b=m!==!1,v=fe(()=>s),{escapeKey:x,outsidePress:E}=Md(c),C=y.useRef(!1),w=y.useRef(!1),S=y.useRef(!1),R=y.useRef(!1),P=y.useRef(!1),O=y.useRef(""),M=y.useRef(null),F=zt(),A=zt(),D=zt(),_=fe(()=>{A.clear(),f.current.insideReactTree=!1}),T=fe(L=>{var $;const X=($=f.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,Pe(Kn,L.nativeEvent))}),j=fe(L=>{if(!l||!n||!r||L.key!=="Escape")return;const X=Mf(L)?L.nativeEvent:L;if(P.current||X.isComposing||!x&&T("__escapeKeyBubbles"))return;const B=Pe(no,X);e.setOpen(!1,B),B.isCanceled||L.preventDefault(),!x&&!B.isPropagationAllowed&&L.stopPropagation()}),N=fe(()=>{f.current.insideReactTree=!0,A.start(0,_)}),Y=fe(L=>{if(!l||!n||L.button!==0)return;const X=vt(L.nativeEvent);Te(e.select("floatingElement"),X)&&(C.current||(C.current=!0,w.current=!1))}),K=fe(L=>{!l||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&C.current&&(w.current=!0)});y.useEffect(()=>{function L(X){X.open||(R.current=!1)}return h.on("openchange",L),()=>{h.off("openchange",L)}},[h]),y.useEffect(()=>_,[_]),y.useEffect(()=>{if(!l||!n)return l||(R.current=!1,P.current=!1,O.current="",M.current=null),_;f.current.__escapeKeyBubbles=x,f.current.__outsidePressBubbles=E;const L=new ut,X=Ke(u);function B(){D.clear(),P.current=!0}function $(){P.current=!0,D.start(on?5:0,()=>{P.current=!1})}function Q(){S.current=!0,L.start(0,()=>{S.current=!1})}function re(){C.current=!1,w.current=!1}function ee(){const H=O.current,G=H==="pen"||!H?"mouse":H,Ee=v(),be=typeof Ee=="function"?Ee():Ee;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=f.current.floatingContext)==null?void 0:be.nodeId,Ee=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)||Ee}function ne(H){if(te(H)){H.type!=="click"&&!k(H)&&(L.clear(),S.current=!1),_();return}if(f.current.insideReactTree){_();return}const G=vt(H),Ee=`[${wo("inert")}]`,be=me(G)?G.getRootNode():null,ge=Array.from((At(be)?be:Ke(e.select("floatingElement"))).querySelectorAll(Ee)),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)&&!Yf(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/,we=Z||ke.test(se.overflowX),wt=Z||ke.test(se.overflowY),st=we&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,Rt=wt&&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&&!Df(H)&&!R.current)return;if(S.current){L.clear(),S.current=!1;return}}typeof m=="function"&&!m(H)||T("__outsidePressBubbles")||(e.setOpen(!1,Pe(sl,H)),_())}}}function oe(H){ee()!=="sloppy"||H.pointerType==="touch"||!e.select("open")||!n||k(H)||ne(H)}function ve(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 Ee=vt(H);if(!Ee)return;const be=Ce(Ee,H.type,()=>{G(H),be()})}function J(H){O.current="touch",z(H,ve)}function ce(H){F.clear(),H.type==="pointerdown"&&(H.button===0&&(R.current=!0),O.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),!C.current)return;const G=w.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(),S.current=!0,_())}}}function Oe(H){if(ee()!=="sloppy"||!M.current||k(H))return;const G=H.touches[0];if(!G)return;const Ee=Math.abs(G.clientX-M.current.startX),be=Math.abs(G.clientY-M.current.startY),ge=Math.sqrt(Ee*Ee+be*be);ge>5&&(M.current.dismissOnTouchEnd=!0),ge>10&&(ne(H),F.clear(),M.current=null)}function je(H){z(H,Oe)}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(Ce(X,"keydown",j),Ce(X,"compositionstart",B),Ce(X,"compositionend",$)),b&&at(Ce(X,"click",ce,!0),Ce(X,"pointerdown",ce,!0),Ce(X,"pointerup",he,!0),Ce(X,"pointercancel",he,!0),Ce(X,"mousedown",ce,!0),Ce(X,"mouseup",he,!0),Ce(X,"touchstart",J,{capture:!0,passive:!0}),Ce(X,"touchmove",je,{capture:!0,passive:!0}),Ce(X,"touchend",Me,{capture:!0,passive:!0})));return()=>{Be(),L.clear(),re(),S.current=!1}},[f,u,r,b,m,l,n,x,E,j,_,v,T,k,g,e,F,D]);const le=y.useMemo(()=>({onKeyDown:j,onPointerDown:U,onClick:U}),[j,U]),ie=y.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 y.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 Fd(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(Fd(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 Ld(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 Bd(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 d=cc(r,s,i);if(d!==-1)return ys(r[d])}if(r.length===2&&r[0].left>r[1].right&&s!=null&&i!=null)return o;if(c==="t"||c==="b"){const d=r[0],m=r[r.length-1],b=c==="t"?d:m;return $n(b.left,d.top,b.right,m.bottom)}const a=c==="l";let l=r[0].left,u=r[0].right,f=a?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,h=r[0],g=r[0];for(const d of r){l=Math.min(l,d.left),u=Math.max(u,d.right);const m=a?d.left:d.right;a&&m<f||!a&&m>f?(f=m,h=d,g=d):m===f&&(g=d)}return $n(l,h.top,u,g.bottom)}function Vd(e){return"contextElement"in e&&e.contextElement?e.contextElement:me(e)?e:void 0}function $d(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=Ld(t,n,r);return e.current=o,o}function Hd(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Vd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Bd(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 Ud{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.`:St(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,Pe(Or,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,Pe(Or))}}function zd(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"),u=i;return t.useSyncedValue("floatingId",o),pe(()=>{const f={open:c,floatingId:o,referenceElement:a,floatingElement:l};me(a)&&(f.domReferenceElement=a),r.state.positionReference===r.state.referenceElement&&(f.positionReference=a),r.update(f)},[c,o,a,l,r]),r.context.onOpenChange=u,r.context.nested=s,r}function Wd(e){const{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:o,onUnmount:s,animateInitialOpen:i}=e,c=fe(o),{mounted:a,setMounted:l,transitionStatus:u}=vi(t,!1,!1,i),f=t?!1:r;pe(()=>{t&&c(!1)},[t,c]);const h=y.useRef(a),g=y.useRef(!1),d=gi(),m=()=>{h.current=!1,l(!1),s()};pe(()=>{h.current=a,g.current&&(g.current=!1,!t&&a&&m())});const b=fe(()=>{if(h.current){if(t){g.current=!0,d();return}m()}});return uo({enabled:a&&!t&&!f,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:u,preventUnmountingOnClose:f,forceUnmount:b}}const qd={tabIndex:-1,[Lf]:""};function Gd(e,t=!1){const n=Gn(),r=tr()!=null,o=Ye(()=>e(n,r)).current;return zd({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Kd({handle:e,store:t}){return pe(()=>e.attachStore(t),[e,t]),null}function xs(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Yd(e,t){const n=y.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),xs(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),xs(t))})}function Xd(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 Jd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Zd(e,t,n,r={}){var u,f,h;const o=n.reason,s=o===We,i=t&&o===Pn,c=!t&&(o===Kn||o===no),a=Jd(n);if((f=(u=e.context).onOpenChange)==null||f.call(u,t,n),n.isCanceled)return;(h=r.onBeforeDispatch)==null||h.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const g=Xd(e.state,t,n.trigger,a()),d={...r.extraState,...g};i?d.instantType="focus":c?d.instantType="dismiss":s&&(d.instantType=void 0),e.update(d)};s?dt.flushSync(l):l()}function Qd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Yd(e,n),i=fe(a=>{const l=n.select("open"),u=n.select("activeTriggerId");if(u===e){const f={activeTriggerElement:a,...l?r:null};n.update(f);return}if(u==null&&l&&!n.state.openedWithoutTrigger){const f={activeTriggerId:e??null,activeTriggerElement:a,...r};n.update(f)}}),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 ep(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=y.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 u=e.select("activeTriggerId");let f=null;if(u){const h=e.context.triggerElements.getById(u);if(h)r.current=u,h!==e.state.activeTriggerElement&&(l.activeTriggerElement=h);else{for(const[g,d]of e.context.triggerElements.entries())if(d===e.state.activeTriggerElement){l.activeTriggerId=g,l.activeTriggerElement=d,r.current=g;break}l.activeTriggerId===void 0&&(r.current===u?f=u:r.current=null)}}else r.current=null;if(!f&&!u&&!e.state.openedWithoutTrigger&&a===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[g,d]=h.value;l.activeTriggerId=g,l.activeTriggerElement=d,r.current=g}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){const h=Pe(bi);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function tp(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=Wd({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 np(e,t){e.useSyncedValues(t),pe(()=>()=>{e.update({activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe})},[e])}let _t;function rp(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=rp(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
180
  * @license React
181
181
  * use-sync-external-store-shim.production.js
182
182
  *
@@ -184,7 +184,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
184
184
  *
185
185
  * This source code is licensed under the MIT license found in the
186
186
  * LICENSE file in the root directory of this source tree.
187
- */var xs;function op(){if(xs)return mr;xs=1;var e=I;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(u,h){var g=h(),d=r({inst:{value:g,getSnapshot:h}}),m=d[0].inst,b=d[1];return s(function(){m.value=g,m.getSnapshot=h,a(m)&&b({inst:m})},[u,g,h]),o(function(){return a(m)&&b({inst:m}),u(function(){a(m)&&b({inst:m})})},[u]),i(g),g}function a(u){var h=u.getSnapshot;u=u.value;try{var g=h();return!n(u,g)}catch{return!0}}function l(u,h){return h()}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={};/**
187
+ */var Cs;function op(){if(Cs)return mr;Cs=1;var e=I;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(f,h){var g=h(),d=r({inst:{value:g,getSnapshot:h}}),m=d[0].inst,b=d[1];return s(function(){m.value=g,m.getSnapshot=h,a(m)&&b({inst:m})},[f,g,h]),o(function(){return a(m)&&b({inst:m}),f(function(){a(m)&&b({inst:m})})},[f]),i(g),g}function a(f){var h=f.getSnapshot;f=f.value;try{var g=h();return!n(f,g)}catch{return!0}}function l(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return mr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,mr}var br={};/**
188
188
  * @license React
189
189
  * use-sync-external-store-shim.development.js
190
190
  *
@@ -192,7 +192,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
192
192
  *
193
193
  * This source code is licensed under the MIT license found in the
194
194
  * LICENSE file in the root directory of this source tree.
195
- */var Es;function sp(){return Es||(Es=1,process.env.NODE_ENV!=="production"&&(function(){function e(g,d){return g===d&&(g!==0||1/g===1/d)||g!==g&&d!==d}function t(g,d){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=d();if(!u){var b=d();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:d}});var v=b[0].inst,x=b[1];return a(function(){v.value=m,v.getSnapshot=d,n(v)&&x({inst:v})},[g,m,d]),c(function(){return n(v)&&x({inst:v}),g(function(){n(v)&&x({inst:v})})},[g]),l(m),m}function n(g){var d=g.getSnapshot;g=g.value;try{var m=d();return!s(g,m)}catch{return!0}}function r(g,d){return d()}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,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;br.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),br}var Ss;function Po(){return Ss||(Ss=1,process.env.NODE_ENV==="production"?xn.exports=op():xn.exports=sp()),xn.exports}var Oo=Po(),En={exports:{}},vr={};/**
195
+ */var Es;function sp(){return Es||(Es=1,process.env.NODE_ENV!=="production"&&(function(){function e(g,d){return g===d&&(g!==0||1/g===1/d)||g!==g&&d!==d}function t(g,d){u||o.startTransition===void 0||(u=!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=d();if(!f){var b=d();s(m,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}b=i({inst:{value:m,getSnapshot:d}});var v=b[0].inst,x=b[1];return a(function(){v.value=m,v.getSnapshot=d,n(v)&&x({inst:v})},[g,m,d]),c(function(){return n(v)&&x({inst:v}),g(function(){n(v)&&x({inst:v})})},[g]),l(m),m}function n(g){var d=g.getSnapshot;g=g.value;try{var m=d();return!s(g,m)}catch{return!0}}function r(g,d){return d()}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,u=!1,f=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;br.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:h,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=op():xn.exports=sp()),xn.exports}var Io=Oo(),Cn={exports:{}},vr={};/**
196
196
  * @license React
197
197
  * use-sync-external-store-shim/with-selector.production.js
198
198
  *
@@ -200,7 +200,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
200
200
  *
201
201
  * This source code is licensed under the MIT license found in the
202
202
  * LICENSE file in the root directory of this source tree.
203
- */var ws;function ip(){if(ws)return vr;ws=1;var e=I,t=Po();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 vr.useSyncExternalStoreWithSelector=function(l,f,u,h,g){var d=s(null);if(d.current===null){var m={hasValue:!1,value:null};d.current=m}else m=d.current;d=c(function(){function v(w){if(!x){if(x=!0,S=w,w=h(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 P=h(w);return g!==void 0&&g(R,P)?(S=w,R):(S=w,E=P)}var x=!1,S,E,C=u===void 0?null:u;return[function(){return v(f())},C===null?void 0:function(){return v(C())}]},[f,u,h,g]);var b=o(l,d[0],d[1]);return i(function(){m.hasValue=!0,m.value=b},[b]),a(b),b},vr}var yr={};/**
203
+ */var ws;function ip(){if(ws)return vr;ws=1;var e=I,t=Oo();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}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 vr.useSyncExternalStoreWithSelector=function(l,u,f,h,g){var d=s(null);if(d.current===null){var m={hasValue:!1,value:null};d.current=m}else m=d.current;d=c(function(){function v(S){if(!x){if(x=!0,E=S,S=h(S),g!==void 0&&m.hasValue){var R=m.value;if(g(R,S))return C=R}return C=S}if(R=C,r(E,S))return R;var P=h(S);return g!==void 0&&g(R,P)?(E=S,R):(E=S,C=P)}var x=!1,E,C,w=f===void 0?null:f;return[function(){return v(u())},w===null?void 0:function(){return v(w())}]},[u,f,h,g]);var b=o(l,d[0],d[1]);return i(function(){m.hasValue=!0,m.value=b},[b]),a(b),b},vr}var yr={};/**
204
204
  * @license React
205
205
  * use-sync-external-store-shim/with-selector.development.js
206
206
  *
@@ -208,8 +208,8 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
208
208
  *
209
209
  * This source code is licensed under the MIT license found in the
210
210
  * LICENSE file in the root directory of this source tree.
211
- */var Cs;function cp(){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=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;yr.useSyncExternalStoreWithSelector=function(l,f,u,h,g){var d=s(null);if(d.current===null){var m={hasValue:!1,value:null};d.current=m}else m=d.current;d=c(function(){function v(w){if(!x){if(x=!0,S=w,w=h(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 P=h(w);return g!==void 0&&g(R,P)?(S=w,R):(S=w,E=P)}var x=!1,S,E,C=u===void 0?null:u;return[function(){return v(f())},C===null?void 0:function(){return v(C())}]},[f,u,h,g]);var b=o(l,d[0],d[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())})()),yr}var Rs;function ap(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?En.exports=ip():En.exports=cp()),En.exports}var lp=ap();const up=ci(19),fp=up?pp:hp;function fc(e,t,n,r,o){return fp(e,t,n,r,o)}function dp(e,t,n,r,o){const s=y.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Oo.useSyncExternalStore(e.subscribe,s,s)}Cf({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()}}),Oo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pp(e,t,n,r,o){const s=wf();if(!s)return dp(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 hp(e,t,n,r,o){return lp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class gp{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 fc(this,t,n,r,o)}}class Io extends gp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){y.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"){y.useDebugValue(t,i=>Object.keys(i));const o=y.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){y.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 y.useDebugValue(t),fc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){y.useDebugValue(t);const r=fe(n??eo);this.context[t]=r}useStateSetter(t){const n=y.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 mp={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 bp 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:ic(),nested:o,triggerElements:i},mp);ae(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Ff(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 vp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new bp({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 dc(e,t){return t!==void 0&&Hn(e)&&qt(e)===t}function yp(e,t){return dc(e,t)?!0:t!==void 0&&Hn(e)&&qt(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}const xp={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)=>dc(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 Ep(e){const t=y.useCallback(r=>e===void 0?eo:e.subscribeStore(r),[e]),n=y.useCallback(()=>e===void 0?void 0:e.store,[e]);return Oo.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}const xr=Gi&&on;function Sp(e,t={}){const{enabled:n=!0,delay:r}=t,{events:o,dataRef:s}=e.context,i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!0),l=zt();y.useEffect(()=>{const u=e.select("domReferenceElement");if(!n)return;const h=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 d(){a.current=!0}function m(){a.current=!1}return at(Ee(h,"blur",g),xr&&Ee(h,"keydown",d,!0),xr&&Ee(h,"pointerdown",m,!0))},[e,n]),y.useEffect(()=>{if(!n)return;function u(h){if(h.reason===Kn||h.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=y.useMemo(()=>{function u(){i.current=!1,c.current=null}return{onMouseLeave(){u()},onFocus(h){const g=h.currentTarget;if(i.current){if(c.current===g)return;u()}const d=vt(h.nativeEvent);if(me(d)){if(xr&&!h.relatedTarget){if(!a.current&&!Xf(d))return}else if(!Zf(d))return}const m=Fn(h.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:v}=h;if(e.select("open")&&m||!r){e.setOpen(!0,Pe(Pn,b,v));return}l.start(r,()=>{i.current||e.setOpen(!0,Pe(Pn,b,v))})},onBlur(h){u();const g=h.relatedTarget,d=h.nativeEvent,m=me(g)&&g.hasAttribute(wo("focus-guard"))&&g.getAttribute("data-type")==="outside";l.start(0,()=>{var S;const b=e.select("domReferenceElement"),v=Br(Ke(b));!g&&v===b||Te((S=s.current.floatingContext)==null?void 0:S.refs.floating.current,v)||Te(b,v)||m||Fn(g??v,e.context.triggerElements)||e.setOpen(!1,Pe(Pn,d))})}}},[s,r,e,l]);return y.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 pc(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 hc(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 wp(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=hc(e),h=zt(),g=fe(()=>{var b;return Xi((b=a.current.openEvent)==null?void 0:b.type,u.interactedInside)}),d=fe(()=>{var b;return ed((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]),y.useEffect(()=>m,[m]),pe(()=>{var b,v,x,S,E;if(n&&s&&(b=u.handleCloseOptions)!=null&&b.blockPointerEvents&&d()&&me(c)&&i){const C=c,w=i,R=Ke(i),P=(x=(v=l==null?void 0:l.nodesRef.current.find(A=>A.id===f))==null?void 0:v.context)==null?void 0:x.elements.floating;P&&(P.style.pointerEvents="");const O=u.pointerEventsScopeElement!==w?u.pointerEventsScopeElement:null,M=P!==w?P:null,F=((E=(S=u.handleCloseOptions)==null?void 0:S.getScope)==null?void 0:E.call(S))??O??M??Vr(C,"[data-rootownerid]")??R.body;return pc(u,{scopeElement:F,referenceElement:C,floatingElement:w}),()=>{m()}}},[n,s,c,i,u,d,l,f,m]),y.useEffect(()=>{if(!n)return;function b(){return!!(l&&f&&Dt(l.nodesRef.current,f).length>0)}function v(R){const P=$r(r,"close",u.pointerType),O=()=>{e.setOpen(!1,Pe(We,R)),l==null||l.events.emit("floating.closed",R)};P?u.openChangeTimeout.start(P,O):(u.openChangeTimeout.clear(),O())}function x(R){const P=vt(R);if(!Jf(P)){u.interactedInside=!1;return}u.interactedInside=Vr(P,"[aria-haspopup]")!=null}function S(){u.openChangeTimeout.clear(),h.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 P=((F=a.current.floatingContext)==null?void 0:F.nodeId)??o,O=R.relatedTarget;if(!(l&&P&&me(O)&&Dt(l.nodesRef.current,P,!1).some(A=>{var D;return Te((D=A.context)==null?void 0:D.elements.floating,O)}))){if(u.handler){u.handler(R);return}m(),d()&&!g()&&v(R)}}function C(R){!l||!f||b()||h.start(0,()=>{l.events.off("floating.closed",C),e.setOpen(!1,Pe(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,d,g,m,u,l,f,h])}const Cp={current:null};function Rp(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:a=Cp,externalTree:l,isActiveTrigger:f=!0,getHandleCloseContext:u,isClosing:h,shouldOpen:g,guardStaleOpen:d=!1}=t,{dataRef:m,events:b}=e.context,v=sn(l),x=hc(e),S=y.useRef(!1),E=qe(o),C=qe(r),w=qe(i),R=qe(n),P=qe(g),O=qe(h),M=fe(()=>{var T;return Xi((T=m.current.openEvent)==null?void 0:T.type,x.interactedInside)}),F=fe(()=>{var T;return((T=P.current)==null?void 0:T.call(P))!==!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),y.useEffect(()=>D,[D]),y.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]),y.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,Pe(We,K)),v==null||v.events.emit("floating.closed",K)}):le&&(x.openChangeTimeout.clear(),e.setOpen(!1,Pe(We,K)),v==null||v.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=vt(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=O.current)==null?void 0:z.call(O))??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,ve=!re||Q;if(oe){F()&&e.setOpen(!0,Pe(We,K,$));return}ne||(ie?x.openChangeTimeout.start(ie,()=>{ve&&F()&&e.setOpen(!0,Pe(We,K,$))}):ve&&F()&&e.setOpen(!0,Pe(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:v,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=d?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,v,R,u,O,F,d]),y.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;pc(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,Pe(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 Ps=.1,Tp=Ps*Ps,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 Pp(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 h=!1,g=null,d=null,m=typeof performance<"u"?performance.now():0;function b(x,S){const E=performance.now(),C=E-m;if(g===null||d===null||C===0)return g=x,d=S,m=E,!1;const w=x-g,R=S-d,P=w*w+R*R,O=C*C*Tp;return g=x,d=S,m=E,P<O}function v(){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,P=vt(S),O=S.type==="mouseleave",M=Te(C,P),F=Te(E,P);if(M&&(h=!0,!O))return;if(F&&(h=!1,!O)){h=!0;return}if(O&&me(S.relatedTarget)&&Te(C,S.relatedTarget))return;function A(){return!!(f&&Dt(f.nodesRef.current,l).length>0)}function D(){A()||v()}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(h&&!Pp(w,R,_)){D();return}if(!O&&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?h||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function Os(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,h=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 d=Je(t);return d&&(g[i]+=h*(d==="end"?1:-1)*(n&&l?-1:1)),g}async function Ip(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:h=!1,padding:g=0}=ft(t,e),d=Zi(g),b=c[h?u==="floating"?"reference":"floating":u],v=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:(v.top-C.top+d.top)/E.y,bottom:(C.bottom-v.bottom+d.bottom)/E.y,left:(v.left-C.left+d.left)/E.x,right:(C.right-v.right+d.right)/E.x}}const _p=50,kp=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Ip},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}=Os(l,r,a),h=r,g=0;const d={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:v,fn:x}=b,{x:S,y:E,data:C,reset:w}=await x({x:f,y:u,initialPlacement:r,placement:h,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});f=S??f,u=E??u,d[v]={...d[v],...C},w&&g<_p&&(g++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(l=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:f,y:u}=Os(l,h,a)),m=-1)}return{x:f,y:u,placement:h,strategy:o,middlewareData:d}},Ap=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:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...b}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Ve(o),x=Ue(c),S=Ve(c)===c,E=await(a.isRTL==null?void 0:a.isRTL(l.floating)),C=h||(S||!m?[Bn(c)]:sd(c)),w=d!=="none";!h&&w&&C.push(...ld(c,m,d,E));const R=[c,...C],P=await a.detectOverflow(t,b),O=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&O.push(P[v]),u){const _=od(o,i,E);O.push(P[_[0]],P[_[1]])}if(M=[...M,{placement:o,overflows:O}],!O.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{}}}},gc=new Set(["left","top"]);async function Np(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=gc.has(i)?-1:1,f=s&&a?-1:1,u=ft(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:d}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof d=="number"&&(g=c==="end"?d*-1:d),a?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const jp=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 Np(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}}}}},Mp=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),h=Ue(o),g=xo(h);let d=f[g],m=f[h];const b=(x,S)=>Ji(S+u[x==="y"?"top":"left"],S,S-u[x==="y"?"bottom":"right"]);i&&(d=b(g,d)),c&&(m=b(h,m));const v=a.fn({...t,[g]:d,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[g]:i,[h]:c}}}}}},Dp=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),h={x:o,y:s},g=Ue(i),d=xo(g);let m=h[d],b=h[g];const v=ft(l,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(f){const C=d==="y"?"height":"width",w=c.reference[d]-c.floating[C]+x.mainAxis,R=c.reference[d]+c.reference[C]-x.mainAxis;m<w?m=w:m>R&&(m=R)}if(u){var S,E;const C=d==="y"?"width":"height",w=gc.has(Ve(i)),R=c.reference[g]-c.floating[C]+(w&&((S=a.offset)==null?void 0:S[g])||0)+(w?0:x.crossAxis),P=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>P&&(b=P)}return{[d]:m,[g]:b}}}},Fp=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:h,height:g}=r.floating;let d,m;l==="top"||l==="bottom"?(d=l,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,d=f==="end"?"top":"bottom");const b=g-a.top-a.bottom,v=h-a.left-a.right,x=Mt(g-a[d],b),S=Mt(h-a[m],v),E=t.middlewareData.shift,C=!E;let w=x,R=S;E!=null&&E.enabled.x&&(R=v),E!=null&&E.enabled.y&&(w=b),C&&!f&&(u?R=h-2*nt(a.left,a.right):w=g-2*nt(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:w});const P=await o.getDimensions(s.floating);return h!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function mc(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}=mc(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 Lp=rt(0);function bc(e){const t=Ie(e);return!lo()||!t.visualViewport?Lp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bp(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=Bp(s,n,r)?bc(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 h=Ie(s),g=me(r)?Ie(r):r;let d=h,m=Ir(d);for(;m&&g!==d;){const b=kt(m),v=m.getBoundingClientRect(),x=$e(m),S=v.left+(m.clientLeft+parseFloat(x.paddingLeft))*b.x,E=v.top+(m.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,f*=b.x,u*=b.y,a+=S,l+=E,d=Ie(m),m=Ir(d)}}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 vc(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 Vp(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 h=i&&!u&&!s?vc(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+h.x,y:n.y*l.y-a.scrollTop*l.y+f.y+h.y}}function $p(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hp(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 Up=25;function zp(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 h=!lo()||t==="fixed";r?h||(l=-i.offsetLeft,f=-i.offsetTop):(c=i.width,a=i.height,h&&(l=i.offsetLeft,f=i.offsetTop))}if(nr(s)<=0){const h=s.ownerDocument,g=h.body,d=getComputedStyle(g),m=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,b=Math.abs(s.clientWidth-g.clientWidth-m),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;v<=Up&&(c-=v)}return{width:c,height:a,x:l,y:f}}function Wp(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=zp(e,n,t);else if(t==="document")r=Hp(ot(e));else if(me(t))r=Wp(t,n);else{const o=bc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Vn(r)}function qp(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 Gp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:qp(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 h=1;h<i.length;h++){const g=Is(t,i[h],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 Kp(e){const{width:t,height:n}=mc(e);return{width:t,height:n}}function Yp(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 h=St(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}!r&&o&&(a.x=nr(o));const l=o&&!r&&!s?vc(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&&El(r)&&Er(r);)r=_s(r,t);return r&&ct(r)&&Er(r)&&!ao(r)?n:r||Cl(e)||n}const Xp=async function(e){const t=this.getOffsetParent||yc,n=this.getDimensions,r=await n(e.floating);return{reference:Yp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jp(e){return $e(e).direction==="rtl"}const Zp={convertOffsetParentRelativeRectToViewportRelativeRect:Vp,getDocumentElement:ot,getClippingRect:Gp,getOffsetParent:yc,getElementRects:Xp,getClientRects:$p,getDimensions:Kp,getScale:kt,isElement:me,isRTL:Jp};function xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qp(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 h=e.getBoundingClientRect(),{left:g,top:d,width:m,height:b}=h;if(f||t(),!m||!b)return;const v=yn(d),x=yn(s.clientWidth-(g+m)),S=yn(s.clientHeight-(d+b)),E=yn(g),w={rootMargin:-v+"px "+-x+"px "+-S+"px "+-E+"px",threshold:nt(0,Mt(1,u))||1};let R=!0;function P(O){const M=O[0].intersectionRatio;if(!xc(h,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(P,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(P,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(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const u=l&&c?Qp(l,n,s):null;let h=-1,g=null;i&&(g=new ResizeObserver(v=>{let[x]=v;x&&x.target===l&&g&&t&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),l&&!a&&g.observe(l),t&&g.observe(t));let d,m=a?St(e):null;a&&b();function b(){const v=St(e);m&&!xc(m,v)&&n(),m=v,d=requestAnimationFrame(b)}return n(),()=>{var v;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),u==null||u(),(v=g)==null||v.disconnect(),g=null,a&&cancelAnimationFrame(d)}}const eh=jp,th=Mp,nh=Ap,rh=Fp,oh=Dp,sh=(e,t,n)=>{const r=new Map,o=n??{},s={...Zp,...o.platform,_c:r};return kp(e,t,{...o,platform:s})};var ih=typeof document<"u",ch=function(){},_n=ih?I.useLayoutEffect:ch;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 Ec(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function As(e,t){const n=Ec(e);return Math.round(t*n)/n}function Sr(e){const t=y.useRef(e);return _n(()=>{t.current=e}),t}function ah(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]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=y.useState(r);Wn(h,r)||g(r);const[d,m]=y.useState(null),[b,v]=y.useState(null),x=y.useCallback(j=>{j!==w.current&&(w.current=j,m(j))},[]),S=y.useCallback(j=>{j!==R.current&&(R.current=j,v(j))},[]),E=s||d,C=i||b,w=y.useRef(null),R=y.useRef(null),P=y.useRef(f),O=a!=null,M=Sr(a),F=Sr(o),A=Sr(l),D=y.useCallback(()=>{if(!w.current||!R.current)return;const j={placement:t,strategy:n,middleware:h};F.current&&(j.platform=F.current),sh(w.current,R.current,j).then(N=>{const Y={...N,isPositioned:A.current!==!1};_.current&&!Wn(P.current,Y)&&(P.current=Y,dt.flushSync(()=>{u(Y)}))})},[h,t,n,F,A]);_n(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(j=>({...j,isPositioned:!1})))},[l]);const _=y.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,O]);const T=y.useMemo(()=>({reference:w,floating:R,setReference:x,setFloating:S}),[x,S]),k=y.useMemo(()=>({reference:E,floating:C}),[E,C]),U=y.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)",...Ec(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:Y}},[n,c,k.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:D,refs:T,elements:k,floatingStyles:U}),[f,D,T,k,U])}const lh=(e,t)=>{const n=eh(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh=(e,t)=>{const n=th(e);return{name:n.name,fn:n.fn,options:[e,t]}},fh=(e,t)=>({fn:oh(e).fn,options:[e,t]}),dh=(e,t)=>{const n=nh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ph=(e,t)=>{const n=rh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ao=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ao.displayName="PreviewCardRootContext");function cn(e){const t=y.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 hh extends Io{setState(t){}update(t){}set(t,n){}notifyAll(){}}const gh=600,Sc=300,wc={...xp,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class mh extends Io{constructor(n,r,o){const s=new uc;super(Cc(n,s,r,o),Rc(s),wc);ae(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;Zd(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&&lc(o,r.trigger,s.clientX,s.clientY)}})})}}function bh(){const e=new uc;return new hh(Object.freeze(Cc(void 0,e)),Object.freeze(Rc(e)),wc)}function Cc(e,t,n,r=!1){return{...vp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Sc,...e}}function Rc(e){return{popupRef:y.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=Gd((v,x)=>new mh({open:n,openProp:t,activeTriggerId:a,triggerIdProp:c},v,x));f.useControlledProp("openProp",t),f.useControlledProp("triggerIdProp",c),f.useContextCallback("onOpenChange",r),f.useContextCallback("onOpenChangeComplete",o);const u=f.useState("open"),h=f.useState("activeTriggerId"),g=f.useState("mounted"),d=f.useState("payload");ep(f,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:m}=tp(u,f,()=>{f.context.inlineRectCoordsRef.current=void 0});pe(()=>{u&&h==null&&f.set("payload",void 0)},[f,h,u]),y.useImperativeHandle(s,()=>({unmount:m,close:()=>f.setOpen(!1,Pe(Or))}),[m,f]);const b=u||g||i!=null;return p.jsxs(Ao.Provider,{value:f,children:[i&&p.jsx(Kd,{handle:i,store:f}),b&&p.jsx(vh,{store:f}),typeof l=="function"?l({payload:d}):l]})}function vh({store:e}){const t=e.useState("floatingRootContext"),n=Dd(t);return np(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Tc=Wi(function(t){return cn(!0)?p.jsx(Ns,{...t}):p.jsx(Nd,{children:p.jsx(Ns,{...t})})});process.env.NODE_ENV!=="production"&&(Tc.displayName="PreviewCardRoot");const No=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(No.displayName="PreviewCardPortalContext");function yh(){const e=y.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 Pc=y.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:c,...a}=t,{node:l,subtree:f}=sc({container:o,ref:n,componentProps:t,elementProps:a});return!f&&!l?null:p.jsxs(y.Fragment,{children:[f,l&&dt.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Pc.displayName="FloatingPortalLite");const Oc=y.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return cn().useState("mounted")||r?p.jsx(No.Provider,{value:r,children:p.jsx(Pc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardPortal");const Ic=Rf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:f,...u}=t,h=cn(!0),d=Ep(l)??h;if(!d)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=bi(c),b=d.useState("isTriggerActive",m),v=d.useState("isOpenedByTrigger",m),x=d.useState("floatingRootContext"),S=d.context.inlineRectCoordsRef,E=y.useRef(null),C=s??gh,w=i??Sc,{registerTrigger:R,isMountedByThisTrigger:P}=Qd(m,E,d,{payload:a,closeDelay:w}),O=Rp(x,{mouseOnly:!0,move:!1,handleClose:Op(),delay:()=>({open:C,close:w}),triggerElementRef:E,isActiveTrigger:b,isClosing:()=>d.select("transitionStatus")==="ending"}),M=Sp(x,{delay:C}),F={open:v},A=d.useState("triggerProps",P),D=$d(S,v);return pt("a",t,{state:F,ref:[n,R,E],props:[O,M.reference,A,D,{id:m},u],stateAttributesMapping:Gf})});process.env.NODE_ENV!=="production"&&(Ic.displayName="PreviewCardTrigger");const jo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPositionerContext");function xh(){const e=y.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 Eh(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]=y.useState(null),u=y.useRef(null),h=sn(n),g=y.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),d=ah({...e,elements:{...g,...l&&{reference:l}}}),m=y.useCallback(S=>{const E=me(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(E),d.refs.setReference(E)},[d.refs]),b=y.useMemo(()=>({...d.refs,setPositionReference:m,domReference:u}),[d.refs,m]),v=y.useMemo(()=>({...d.elements,domReference:i}),[d.elements,i]),x=y.useMemo(()=>({...d,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:a,refs:b,elements:v,nodeId:t,rootStore:r}),[d,b,v,t,r,c,a]);return pe(()=>{i&&(u.current=i)},[i]),pe(()=>{r.context.dataRef.current.floatingContext=x;const S=h==null?void 0:h.nodesRef.current.find(E=>E.id===t);S&&(S.context=x)}),y.useMemo(()=>({...d,context:x,refs:b,elements:v,rootStore:r}),[d,b,v,x,r])}const _c=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(_c.displayName="DirectionContext");function Sh(){const e=y.useContext(_c);return(e==null?void 0:e.direction)??"ltr"}const wh=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=Zi(f),h={x:n,y:r},g=So(o),d=Eo(g),m=await i.getDimensions(l),b=g==="y",v=b?"top":"left",x=b?"bottom":"right",S=b?"clientHeight":"clientWidth",E=s.reference[d]+s.reference[g]-h[g]-s.floating[d],C=h[g]-s.reference[g],w=c.floating[S]||s.floating[d],R=E/2-C/2,P=w/2-m[d]/2-1,O=Math.min(u[v],P),M=Math.min(u[x],P),F=O,A=w-m[d]-M,D=w/2-m[d]/2+R,_=Ji(F,D,A),T=!a.arrow&&Je(o)!=null&&D!==_&&s.reference[d]/2-(D<F?O:M)-m[d]/2<0,k=T?D<F?D-F:D-A:0;return{[g]:h[g]+k,data:{[g]:_,centerOffset:D-_-k,...T&&{alignmentOffset:k}},reset:T}}}),Ch=(e,t)=>{const{name:n,fn:r}=wh(e);return{name:n,fn:r,options:[e,t]}},Rh={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}}}},Th={sideX:"left",sideY:"top"},Ph="--available-width",Oh="--available-height",Ih="--anchor-width",_h="--anchor-height",kh="--transform-origin",js=Ph,Ms=Oh;function kc(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:kc(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 Ah(e){return Nh(e,Eh)}function Nh(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:h=!1,inline:g,keepMounted:d=!1,floatingRootContext:m,mounted:b,collisionAvoidance:v,shift:x,nodeId:S,adaptiveOrigin:E,lazyFlip:C=!1,externalTree:w}=e,R=v.side||"flip",P=v.align||"flip",O=v.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=Sh()==="rtl",[N,Y]=y.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=y.useRef(null),ve=qe(s),z=qe(c),J=typeof s!="function"?s:0,ce=typeof c!="function"?c:0,he=[];g&&he.push(g),he.push(lh(de=>{const Ae=Ds(de,o,j),He=typeof ve.current=="function"?ve.current(Ae):ve.current,De=typeof z.current=="function"?z.current(Ae):z.current;return{mainAxis:He,crossAxis:De,alignmentAxis:De}},[J,ce,j,o]));const Oe=P==="none"&&R!=="shift",je=!Oe&&(f||M||R==="shift"),Re=R==="none"?null:dh({...ne,padding:{top:$.top+Q+re,right:$.right+Q+W,bottom:$.bottom+Q+ee,left:$.left+Q+te},mainAxis:!M&&R==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:O}),Me=Oe?null:uh({...ne,rootBoundary:F,mainAxis:P!=="none",crossAxis:je,limiter:f||M?void 0:fh(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,$,P]);R==="shift"||P==="shift"||X==="center"?he.push(Me,Re):he.push(Re,Me),he.push(ph({...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(Ih,`${et}px`),Xe.setProperty(_h,`${$t}px`)}}),Ch(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 Hc=it?(($o=He.arrow)==null?void 0:$o.x)||0:((Ho=He.arrow)==null?void 0:Ho.y)||0,Uc=it?(et==null?void 0:et.clientWidth)||0:(et==null?void 0:et.clientHeight)||0;dn=`${Hc+Uc/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(kh,it?`${dn} ${rr}`:`${rr} ${dn}`),{}}},Rh,E),pe(()=>{!b&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,m]);const Be=y.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:H,elements:G,x:Se,y:be,middlewareData:ge,update:V,placement:q,context:Z,isPositioned:se,floatingStyles:ke}=t({rootContext:m,open:d?b:void 0,placement:B,middleware:he,strategy:r,whileElementsMounted:d?void 0:(...de)=>ks(...de,Be),nodeId:S,externalTree:w}),{sideX:Ce,sideY:Ct}=ge.adaptiveOrigin||Th,st=se?r:"fixed",Rt=y.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=y.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]),y.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]),y.useEffect(()=>{if(d&&b&&G.reference&&G.floating)return ks(G.reference,G.floating,V,Be)},[d,b,G,V,Be]);const Qe=Ve(q),ht=kc(o,Qe,j),gt=Je(q)||"center",Lt=!!((Vt=ge.hide)!=null&&Vt.referenceHidden);pe(()=>{C&&b&&se&&(Qe!==L||K&&gt!==X)&&Y(q)},[C,K,b,se,q,Qe,gt,L,X]);const an=y.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 y.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 Ac(e){return e==="starting"?Cd:Fe}function jh(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},Ac(r),o],stateAttributesMapping:Yi})}const Nc=y.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:h=5,arrowPadding:g=5,sticky:d=!1,disableAnchorTracking:m=!1,collisionAvoidance:b=Rd,style:v,...x}=t,S=cn(),E=yh(),C=kd(),w=S.useState("open"),R=S.useState("mounted"),P=S.useState("floatingRootContext"),O=S.useState("instantType"),M=S.useState("transitionStatus"),F=S.useState("adaptiveOrigin"),A=S.context.inlineRectCoordsRef,D=Ah({anchor:s,floatingRootContext:P,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:g,collisionBoundary:u,collisionPadding:h,sticky:d,disableAnchorTracking:m,keepMounted:E,nodeId:C,collisionAvoidance:b,adaptiveOrigin:F,inline:Hd(A)}),_=D.update;pe(()=>{w&&R&&_()},[w,R,_]);const T={open:w,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:O},k=jh(t,T,{styles:D.positionerStyles,transitionStatus:M,props:x,refs:[n,S.useStateSetter("positionerElement")],hidden:!R,inert:!w});return p.jsx(jo.Provider,{value:D,children:p.jsx(Ad,{id:C,children:k})})});process.env.NODE_ENV!=="production"&&(Nc.displayName="PreviewCardPositioner");const jc=y.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=cn(),{side:a,align:l}=xh(),f=c.useState("open"),u=c.useState("instantType"),h=c.useState("transitionStatus"),g=c.useState("popupProps"),d=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))}}),wp(d,{closeDelay:m}),pt("div",t,{state:{open:f,side:a,align:l,instant:u,transitionStatus:h},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[qd,g,Ac(h),i],stateAttributesMapping:Kf})});process.env.NODE_ENV!=="production"&&(jc.displayName="PreviewCardPopup");class Mh extends Ud{constructor(){super(bh(),"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 Dh(){return new Mh}const Fh=Dh;function Lh(e){return p.jsx(Tc,{...e})}function Bh(e){return p.jsx(Ic,{"data-slot":"hover-card-trigger",...e})}function Vh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return p.jsx(Oc,{children:p.jsx(Nc,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:p.jsx(jc,{"data-slot":"hover-card-content",...s,className:i=>ue("vps-hover-card",typeof e=="function"?e(i):e)})})})}function $h({className:e,...t}){return p.jsx("span",{className:ue("inline-citation",e),...t})}const Mo=I.createContext(null);function Mc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function Hh({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=I.useState(()=>Fh()),i=e??s,c=I.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return p.jsx(Mo.Provider,{value:c,children:p.jsx(Lh,{...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 Uh({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 p.jsx(Bh,{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:p.jsx(fo,{variant:"secondary",size:"xs","aria-haspopup":"dialog",...i,onClick:h=>{s==null||s(h),!(!c||h.defaultPrevented)&&(c.trigger=h.currentTarget,c.focusRequested=!0,c.handle.open(l),Mc(c))}}),children:o??(e.length>1?`${u} +${e.length-1}`:u)})}function zh({ref:e,onBlur:t,...n}){const r=I.useContext(Mo);return p.jsx(Vh,{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&&Mc(r))},onBlur:o=>{t==null||t(o),!(!r||o.defaultPrevented)&&o.relatedTarget!==r.trigger&&!o.currentTarget.contains(o.relatedTarget)&&r.handle.close()}})}const Dc=I.createContext(null);function Do(){const e=I.useContext(Dc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function Wh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=yo({...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]),p.jsx(Dc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:p.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:ue("inline-citation-carousel",o),"data-orientation":n})})}function qh({className:e,...t}){const{viewportRef:n}=Do();return p.jsx("div",{ref:n,className:"inline-citation-viewport",children:p.jsx("div",{className:ue("inline-citation-track",e),...t})})}function Gh({className:e,...t}){return p.jsx("div",{role:"group","aria-roledescription":"slide",className:ue("inline-citation-slide",e),...t})}function Kh({className:e,...t}){return p.jsx("div",{className:ue("inline-citation-carousel-header",e),...t})}function Yh({children:e,...t}){const{selected:n,count:r}=Do();return p.jsx("div",{"aria-live":"polite",...t,children:e??(r?`${n+1}/${r}`:"")})}function Fc({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 p.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?p.jsx(Zs,{size:14,"aria-hidden":"true"}):p.jsx(ga,{size:14,"aria-hidden":"true"}))})}function Xh(e){return p.jsx(Fc,{...e,next:!1})}function Jh(e){return p.jsx(Fc,{...e,next:!0})}function Zh({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?ho(t):void 0;return p.jsxs("div",{className:ue("inline-citation-source",r),...s,children:[p.jsx("div",{className:"inline-citation-title",children:e||(i?Wr(i):"Source")}),i&&p.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[Wr(i),p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&p.jsx("p",{children:n}),o]})}function Qh({className:e,...t}){return p.jsx("blockquote",{className:ue("inline-citation-quote",e),...t})}const eg={"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 Lc(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(eg))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 tg=({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",h=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(xa,{size:14})}),p.jsx(jt,{children:`${f.length} retrieved VPS ${u}`}),!s&&p.jsx(Kt,{children:i?"Hide Details":"Inspect Sources"})]}),g=p.jsx(bt,{className:"grounded-source-rows",children:f.map((d,m)=>{const b=a===m,v=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(ha,{size:13})}),p.jsxs(jt,{children:["[S",m+1,"] ",qr(d)]}),p.jsxs(Kt,{title:"Ranking score, not a probability of correctness",children:["Score ",d.score.toFixed(2)]})]});return s?p.jsx("div",{children:v},`${d.chunkId}-${m}`):p.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:m)},title:d.source,children:v},`${d.chunkId}-${m}`)})});return s?p.jsxs(bt,{className:"grounded-sources-card",children:[h,g]}):p.jsx(bt,{className:"grounded-sources-card",children:p.jsxs(Ii,{open:i,onOpenChange:c,children:[p.jsx(_i,{children:h}),g,p.jsx(ki,{children:p.jsx("div",{className:"grounded-sources-details-list",children:f.map((d,m)=>{const b=qr(d),v=Lc(d.source),x=a===m;return p.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[p.jsxs("div",{className:"grounded-detail-top",children:[p.jsxs("div",{className:"grounded-detail-title-group",children:[p.jsxs("span",{className:"grounded-detail-index",children:["[",m+1,"]"]}),p.jsx("span",{className:"grounded-detail-title",children:b})]}),p.jsxs("div",{className:"grounded-detail-meta",children:[p.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",d.score.toFixed(2)]}),v&&p.jsxs("a",{href:v.path,onClick:S=>{S.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[p.jsx("span",{children:v.label}),p.jsx(va,{size:10,"aria-hidden":"true"})]})]})]}),p.jsx("div",{className:"grounded-detail-path",children:p.jsx("code",{children:d.source})}),d.snippet&&p.jsxs("p",{className:"grounded-detail-snippet",children:['"',d.snippet,'"']})]},`detail-${d.chunkId}-${m}`)})})})]})})};function ng({label:e,sources:t}){const n=t.map(r=>{var i;const o=qr(r),s=ho(r.url||r.source)??((i=Lc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:p.jsxs(p.Fragment,{children:[p.jsx(Zh,{title:o,url:s}),r.snippet&&p.jsx(Qh,{children:r.snippet})]})}});return p.jsx($h,{children:p.jsxs(Hh,{children:[p.jsx(Uh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),p.jsx(zh,{children:n.length===1?n[0].content:p.jsxs(Wh,{"aria-label":"Sources",children:[p.jsxs(Kh,{children:[p.jsx(Yh,{}),p.jsx(Xh,{}),p.jsx(Jh,{})]}),p.jsx(qh,{children:n.map((r,o)=>p.jsx(Gh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function rg(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 p.jsx(ng,{label:o,sources:c},s)}const i=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(i){const c=i[1],a=i[2],l=ho(a);if(!l)return p.jsx(I.Fragment,{children:c},s);const f=/^https?:\/\//i.test(a);return p.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?p.jsx("strong",{children:o.slice(2,-2)},s):o.startsWith("*")&&o.endsWith("*")&&o.length>=2?p.jsx("em",{children:o.slice(1,-1)},s):o.startsWith("`")&&o.endsWith("`")&&o.length>=2?p.jsx("code",{className:"md-code",children:o.slice(1,-1)},s):/^https?:\/\//i.test(o)?p.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:o},s):p.jsx(I.Fragment,{children:o},s)})}function og(e){const t=e.replace(/\r\n/g,`
211
+ */var Rs;function cp(){return Rs||(Rs=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}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;yr.useSyncExternalStoreWithSelector=function(l,u,f,h,g){var d=s(null);if(d.current===null){var m={hasValue:!1,value:null};d.current=m}else m=d.current;d=c(function(){function v(S){if(!x){if(x=!0,E=S,S=h(S),g!==void 0&&m.hasValue){var R=m.value;if(g(R,S))return C=R}return C=S}if(R=C,r(E,S))return R;var P=h(S);return g!==void 0&&g(R,P)?(E=S,R):(E=S,C=P)}var x=!1,E,C,w=f===void 0?null:f;return[function(){return v(u())},w===null?void 0:function(){return v(w())}]},[u,f,h,g]);var b=o(l,d[0],d[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())})()),yr}var Ts;function ap(){return Ts||(Ts=1,process.env.NODE_ENV==="production"?Cn.exports=ip():Cn.exports=cp()),Cn.exports}var lp=ap();const up=ii(19),fp=up?pp:hp;function uc(e,t,n,r,o){return fp(e,t,n,r,o)}function dp(e,t,n,r,o){const s=y.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Io.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()}}),Io.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pp(e,t,n,r,o){const s=Sf();if(!s)return dp(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 hp(e,t,n,r,o){return lp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class gp{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 _o extends gp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){y.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"){y.useDebugValue(t,i=>Object.keys(i));const o=y.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){y.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 y.useDebugValue(t),uc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){y.useDebugValue(t);const r=fe(n??eo);this.context[t]=r}useStateSetter(t){const n=y.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 mp={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 bp extends _o{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},mp);ae(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Ff(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 vp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new bp({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,Ps=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 xp={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:Ps,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)?Ps(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Cp(e){const t=y.useCallback(r=>e===void 0?eo:e.subscribeStore(r),[e]),n=y.useCallback(()=>e===void 0?void 0:e.store,[e]);return Io.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=y.useRef(!1),c=y.useRef(null),a=y.useRef(!0),l=zt();y.useEffect(()=>{const f=e.select("domReferenceElement");if(!n)return;const h=Ie(f);function g(){const b=e.select("domReferenceElement");!e.select("open")&&_e(b)&&b===Br(Ke(b))&&(i.current=!0,c.current=b)}function d(){a.current=!0}function m(){a.current=!1}return at(Ce(h,"blur",g),xr&&Ce(h,"keydown",d,!0),xr&&Ce(h,"pointerdown",m,!0))},[e,n]),y.useEffect(()=>{if(!n)return;function f(h){if(h.reason===Kn||h.reason===no){const g=e.select("domReferenceElement");me(g)&&(c.current=g,i.current=!0)}}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,n,e]);const u=y.useMemo(()=>{function f(){i.current=!1,c.current=null}return{onMouseLeave(){f()},onFocus(h){const g=h.currentTarget;if(i.current){if(c.current===g)return;f()}const d=vt(h.nativeEvent);if(me(d)){if(xr&&!h.relatedTarget){if(!a.current&&!Xf(d))return}else if(!Zf(d))return}const m=Fn(h.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:v}=h;if(e.select("open")&&m||!r){e.setOpen(!0,Pe(Pn,b,v));return}l.start(r,()=>{i.current||e.setOpen(!0,Pe(Pn,b,v))})},onBlur(h){f();const g=h.relatedTarget,d=h.nativeEvent,m=me(g)&&g.hasAttribute(wo("focus-guard"))&&g.getAttribute("data-type")==="outside";l.start(0,()=>{var E;const b=e.select("domReferenceElement"),v=Br(Ke(b));!g&&v===b||Te((E=s.current.floatingContext)==null?void 0:E.refs.floating.current,v)||Te(b,v)||m||Fn(g??v,e.context.triggerElements)||e.setOpen(!1,Pe(Pn,d))})}}},[s,r,e,l]);return y.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}class ko{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 ko}}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??ko.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(),u=tr(),f=pc(e),h=zt(),g=fe(()=>{var b;return Yi((b=a.current.openEvent)==null?void 0:b.type,f.interactedInside)}),d=fe(()=>{var b;return ed((b=a.current.openEvent)==null?void 0:b.type)}),m=fe(()=>{zn(f)});pe(()=>{s||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,m())},[s,f,m]),y.useEffect(()=>m,[m]),pe(()=>{var b,v,x,E,C;if(n&&s&&(b=f.handleCloseOptions)!=null&&b.blockPointerEvents&&d()&&me(c)&&i){const w=c,S=i,R=Ke(i),P=(x=(v=l==null?void 0:l.nodesRef.current.find(A=>A.id===u))==null?void 0:v.context)==null?void 0:x.elements.floating;P&&(P.style.pointerEvents="");const O=f.pointerEventsScopeElement!==S?f.pointerEventsScopeElement:null,M=P!==S?P:null,F=((C=(E=f.handleCloseOptions)==null?void 0:E.getScope)==null?void 0:C.call(E))??O??M??Vr(w,"[data-rootownerid]")??R.body;return dc(f,{scopeElement:F,referenceElement:w,floatingElement:S}),()=>{m()}}},[n,s,c,i,f,d,l,u,m]),y.useEffect(()=>{if(!n)return;function b(){return!!(l&&u&&Dt(l.nodesRef.current,u).length>0)}function v(R){const P=$r(r,"close",f.pointerType),O=()=>{e.setOpen(!1,Pe(We,R)),l==null||l.events.emit("floating.closed",R)};P?f.openChangeTimeout.start(P,O):(f.openChangeTimeout.clear(),O())}function x(R){const P=vt(R);if(!Jf(P)){f.interactedInside=!1;return}f.interactedInside=Vr(P,"[aria-haspopup]")!=null}function E(){f.openChangeTimeout.clear(),h.clear(),l==null||l.events.off("floating.closed",w),m()}function C(R){var F;if(b()&&l){l.events.on("floating.closed",w);return}if(Fn(R.relatedTarget,e.context.triggerElements))return;const P=((F=a.current.floatingContext)==null?void 0:F.nodeId)??o,O=R.relatedTarget;if(!(l&&P&&me(O)&&Dt(l.nodesRef.current,P,!1).some(A=>{var D;return Te((D=A.context)==null?void 0:D.elements.floating,O)}))){if(f.handler){f.handler(R);return}m(),d()&&!g()&&v(R)}}function w(R){!l||!u||b()||h.start(0,()=>{l.events.off("floating.closed",w),e.setOpen(!1,Pe(We,R)),l.events.emit("floating.closed",R)})}const S=i;return at(S&&Ce(S,"mouseenter",E),S&&Ce(S,"mouseleave",C),S&&Ce(S,"pointerdown",x,!0),()=>{l==null||l.events.off("floating.closed",w)})},[n,i,e,a,r,o,d,g,m,f,l,u,h])}const wp={current:null};function Rp(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:u=!0,getHandleCloseContext:f,isClosing:h,shouldOpen:g,guardStaleOpen:d=!1}=t,{dataRef:m,events:b}=e.context,v=sn(l),x=pc(e),E=y.useRef(!1),C=qe(o),w=qe(r),S=qe(i),R=qe(n),P=qe(g),O=qe(h),M=fe(()=>{var T;return Yi((T=m.current.openEvent)==null?void 0:T.type,x.interactedInside)}),F=fe(()=>{var T;return((T=P.current)==null?void 0:T.call(P))!==!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 u&&(x.handleCloseOptions=o==null?void 0:o.__options),y.useEffect(()=>D,[D]),y.useEffect(()=>{if(!n)return;function T(k){k.open?E.current=!1:(E.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]),y.useEffect(()=>{if(!n)return;function T(K,le=!0){const ie=$r(w.current,"close",x.pointerType);ie?x.openChangeTimeout.start(ie,()=>{e.setOpen(!1,Pe(We,K)),v==null||v.events.emit("floating.closed",K)}):le&&(x.openChangeTimeout.clear(),e.setOpen(!1,Pe(We,K)),v==null||v.events.emit("floating.closed",K))}const k=a.current??(u?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=gs(S.current),ie=$r(w.current,"open",x.pointerType),L=vt(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=O.current)==null?void 0:z.call(O))??e.select("transitionStatus")==="ending",te=!re&&ee&&E.current,W=!Q&&me($)&&me(B)&&Te(B,$)&&te,ne=le>0&&!ie,oe=Q&&(re||te)||W,ve=!re||Q;if(oe){F()&&e.setOpen(!0,Pe(We,K,$));return}ne||(ie?x.openChangeTimeout.start(ie,()=>{ve&&F()&&e.setOpen(!0,Pe(We,K,$))}):ve&&F()&&e.setOpen(!0,Pe(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??(f==null?void 0:f());if(Fn(K.relatedTarget,e.context.triggerElements))return;if(C.current&&L){e.select("open")||x.openChangeTimeout.clear();const B=a.current;x.handler=C.current({...L,tree:v,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=d?Ce(k,"mouseout",N):void 0;return c?at(Ce(k,"mousemove",U,{once:!0}),Ce(k,"mouseenter",U),Ce(k,"mouseleave",j),Y):at(Ce(k,"mouseenter",U),Ce(k,"mouseleave",j),Y)},[D,_,m,w,e,n,C,x,u,A,M,s,c,S,a,v,R,f,O,F,d]),y.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=gs(S.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,Pe(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,S,F])}const Os=.1,Tp=Os*Os,xe=.5;function En(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Sn(e,t,n,r,o,s,i,c,a,l){let u=!1;return En(e,t,n,r,o,s)&&(u=!u),En(e,t,o,s,i,c)&&(u=!u),En(e,t,i,c,a,l)&&(u=!u),En(e,t,a,l,n,r)&&(u=!u),u}function Pp(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function wn(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:u})=>{const f=i==null?void 0:i.split("-")[0];let h=!1,g=null,d=null,m=typeof performance<"u"?performance.now():0;function b(x,E){const C=performance.now(),w=C-m;if(g===null||d===null||w===0)return g=x,d=E,m=C,!1;const S=x-g,R=E-d,P=S*S+R*R,O=w*w*Tp;return g=x,d=E,m=C,P<O}function v(){n.clear(),a()}return function(E){n.clear();const C=c.domReference,w=c.floating;if(!C||!w||f==null||o==null||s==null)return;const{clientX:S,clientY:R}=E,P=vt(E),O=E.type==="mouseleave",M=Te(w,P),F=Te(C,P);if(M&&(h=!0,!O))return;if(F&&(h=!1,!O)){h=!0;return}if(O&&me(E.relatedTarget)&&Te(w,E.relatedTarget))return;function A(){return!!(u&&Dt(u.nodesRef.current,l).length>0)}function D(){A()||v()}if(A())return;const _=C.getBoundingClientRect(),T=w.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(f==="top"&&s>=_.bottom-1||f==="bottom"&&s<=_.top+1||f==="left"&&o>=_.right-1||f==="right"&&o<=_.left+1){D();return}let L=!1;switch(f){case"top":L=wn(S,R,Y,_.top+1,K,T.bottom-1);break;case"bottom":L=wn(S,R,Y,T.top+1,K,_.bottom-1);break;case"left":L=wn(S,R,T.right-1,ie,_.left+1,le);break;case"right":L=wn(S,R,_.right-1,ie,T.left+1,le);break}if(L)return;if(h&&!Pp(S,R,_)){D();return}if(!O&&b(S,R)){D();return}let X=!1;switch(f){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=Sn(S,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=Sn(S,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=Sn(S,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=Sn(S,R,re,$,re,Q,ee,T.top,te,T.bottom);break}}X?h||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function Is(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",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[c]/2-o[c]/2;let g;switch(a){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}const d=Je(t);return d&&(g[i]+=h*(d==="end"?1:-1)*(n&&l?-1:1)),g}async function Ip(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:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ft(t,e),d=Ji(g),b=c[h?f==="floating"?"reference":"floating":f],v=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:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(E))&&await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1},w=Vn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:E,strategy:a}):x);return{top:(v.top-w.top+d.top)/C.y,bottom:(w.bottom-v.bottom+d.bottom)/C.y,left:(v.left-w.left+d.left)/C.x,right:(w.right-v.right+d.right)/C.x}}const _p=50,kp=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Ip},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Is(l,r,a),h=r,g=0;const d={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:v,fn:x}=b,{x:E,y:C,data:w,reset:S}=await x({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});u=E??u,f=C??f,d[v]={...d[v],...w},S&&g<_p&&(g++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(l=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:u,y:f}=Is(l,h,a)),m=-1)}return{x:u,y:f,placement:h,strategy:o,middlewareData:d}},Ap=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:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...b}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Ve(o),x=Ue(c),E=Ve(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(l.floating)),w=h||(E||!m?[Bn(c)]:sd(c)),S=d!=="none";!h&&S&&w.push(...ld(c,m,d,C));const R=[c,...w],P=await a.detectOverflow(t,b),O=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&O.push(P[v]),f){const _=od(o,i,C);O.push(P[_[0]],P[_[1]])}if(M=[...M,{placement:o,overflows:O}],!O.every(_=>_<=0)){var F,A;const _=(((F=s.flip)==null?void 0:F.index)||0)+1,T=R[_];if(T&&(!(f==="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(S){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 Np(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,u=s&&a?-1:1,f=ft(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof d=="number"&&(g=c==="end"?d*-1:d),a?{x:g*u,y:h*l}:{x:h*l,y:g*u}}const jp=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 Np(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}}}}},Mp=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:E,y:C}=x;return{x:E,y:C}}},...l}=ft(e,t),u={x:n,y:r},f=await s.detectOverflow(t,l),h=Ue(o),g=Co(h);let d=u[g],m=u[h];const b=(x,E)=>Xi(E+f[x==="y"?"top":"left"],E,E-f[x==="y"?"bottom":"right"]);i&&(d=b(g,d)),c&&(m=b(h,m));const v=a.fn({...t,[g]:d,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[g]:i,[h]:c}}}}}},Dp=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:u=!0,crossAxis:f=!0}=ft(e,t),h={x:o,y:s},g=Ue(i),d=Co(g);let m=h[d],b=h[g];const v=ft(l,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(u){const w=d==="y"?"height":"width",S=c.reference[d]-c.floating[w]+x.mainAxis,R=c.reference[d]+c.reference[w]-x.mainAxis;m<S?m=S:m>R&&(m=R)}if(f){var E,C;const w=d==="y"?"width":"height",S=hc.has(Ve(i)),R=c.reference[g]-c.floating[w]+(S&&((E=a.offset)==null?void 0:E[g])||0)+(S?0:x.crossAxis),P=c.reference[g]+c.reference[w]+(S?0:((C=a.offset)==null?void 0:C[g])||0)-(S?x.crossAxis:0);b<R?b=R:b>P&&(b=P)}return{[d]:m,[g]:b}}}},Fp=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),u=Je(n),f=Ue(n)==="y",{width:h,height:g}=r.floating;let d,m;l==="top"||l==="bottom"?(d=l,m=u===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,d=u==="end"?"top":"bottom");const b=g-a.top-a.bottom,v=h-a.left-a.right,x=Mt(g-a[d],b),E=Mt(h-a[m],v),C=t.middlewareData.shift,w=!C;let S=x,R=E;C!=null&&C.enabled.x&&(R=v),C!=null&&C.enabled.y&&(S=b),w&&!u&&(f?R=h-2*nt(a.left,a.right):S=g-2*nt(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:S});const P=await o.getDimensions(s.floating);return h!==P.width||g!==P.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 Ao(e){return me(e)?e:e.contextElement}function kt(e){const t=Ao(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 Lp=rt(0);function mc(e){const t=Ie(e);return!lo()||!t.visualViewport?Lp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ie(e)}function Et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ao(e);let i=rt(1);t&&(r?me(r)&&(i=kt(r)):i=kt(e));const c=Bp(s,n,r)?mc(s):rt(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s&&r){const h=Ie(s),g=me(r)?Ie(r):r;let d=h,m=Ir(d);for(;m&&g!==d;){const b=kt(m),v=m.getBoundingClientRect(),x=$e(m),E=v.left+(m.clientLeft+parseFloat(x.paddingLeft))*b.x,C=v.top+(m.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,u*=b.x,f*=b.y,a+=E,l+=C,d=Ie(m),m=Ir(d)}}return Vn({width:u,height:f,x:a,y:l})}function nr(e,t){const n=Zn(e).scrollLeft;return t?t.left+n:Et(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 Vp(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 u=rt(0),f=_e(r);if((f||!s)&&((Le(r)!=="body"||Xn(i))&&(a=Zn(r)),f)){const g=Et(r);l=kt(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}const h=i&&!f&&!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+u.x+h.x,y:n.y*l.y-a.scrollTop*l.y+u.y+h.y}}function $p(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hp(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 Up=25;function zp(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,u=0;if(i){const h=!lo()||t==="fixed";r?h||(l=-i.offsetLeft,u=-i.offsetTop):(c=i.width,a=i.height,h&&(l=i.offsetLeft,u=i.offsetTop))}if(nr(s)<=0){const h=s.ownerDocument,g=h.body,d=getComputedStyle(g),m=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,b=Math.abs(s.clientWidth-g.clientWidth-m),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;v<=Up&&(c-=v)}return{width:c,height:a,x:l,y:u}}function Wp(e,t){const n=Et(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 _s(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=zp(e,n,t);else if(t==="document")r=Hp(ot(e));else if(me(t))r=Wp(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 qp(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(f=>f!==i):o=c,i=lt(i)}return t.set(e,r),r}function Gp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:qp(t,this._c):[].concat(n),r],c=_s(t,i[0],o);let a=c.top,l=c.right,u=c.bottom,f=c.left;for(let h=1;h<i.length;h++){const g=_s(t,i[h],o);a=nt(g.top,a),l=Mt(g.right,l),u=Mt(g.bottom,u),f=nt(g.left,f)}return{width:l-f,height:u-a,x:f,y:a}}function Kp(e){const{width:t,height:n}=gc(e);return{width:t,height:n}}function Yp(e,t,n){const r=_e(t),o=ot(t),s=n==="fixed",i=Et(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 h=Et(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}!r&&o&&(a.x=nr(o));const l=o&&!r&&!s?bc(o,c):rt(0),u=i.left+c.scrollLeft-a.x-l.x,f=i.top+c.scrollTop-a.y-l.y;return{x:u,y:f,width:i.width,height:i.height}}function Cr(e){return $e(e).position==="static"}function ks(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 vc(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)&&!Cr(o))return o;o=lt(o)}return n}let r=ks(e,t);for(;r&&El(r)&&Cr(r);)r=ks(r,t);return r&&ct(r)&&Cr(r)&&!ao(r)?n:r||Rl(e)||n}const Xp=async function(e){const t=this.getOffsetParent||vc,n=this.getDimensions,r=await n(e.floating);return{reference:Yp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jp(e){return $e(e).direction==="rtl"}const Zp={convertOffsetParentRelativeRectToViewportRelativeRect:Vp,getDocumentElement:ot,getClippingRect:Gp,getOffsetParent:vc,getElementRects:Xp,getClientRects:$p,getDimensions:Kp,getScale:kt,isElement:me,isRTL:Jp};function yc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qp(e,t,n){let r=null,o;const s=ot(e);function i(){var u;clearTimeout(o),(u=r)==null||u.disconnect(),r=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),i();const h=e.getBoundingClientRect(),{left:g,top:d,width:m,height:b}=h;if(u||t(),!m||!b)return;const v=yn(d),x=yn(s.clientWidth-(g+m)),E=yn(s.clientHeight-(d+b)),C=yn(g),S={rootMargin:-v+"px "+-x+"px "+-E+"px "+-C+"px",threshold:nt(0,Mt(1,f))||1};let R=!0;function P(O){const M=O[0].intersectionRatio;if(!yc(h,e.getBoundingClientRect()))return c();if(M!==f){if(!R)return c();M?c(!1,M):o=setTimeout(()=>{c(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(P,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(P,S)}r.observe(e)}const a=Ie(e),l=()=>c(n);return a.addEventListener("resize",l),c(!0),()=>{a.removeEventListener("resize",l),i()}}function As(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=Ao(e),u=o||s?[...l?Gt(l):[],...t?Gt(t):[]]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const f=l&&c?Qp(l,n,s):null;let h=-1,g=null;i&&(g=new ResizeObserver(v=>{let[x]=v;x&&x.target===l&&g&&t&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=g)==null||E.observe(t)})),n()}),l&&!a&&g.observe(l),t&&g.observe(t));let d,m=a?Et(e):null;a&&b();function b(){const v=Et(e);m&&!yc(m,v)&&n(),m=v,d=requestAnimationFrame(b)}return n(),()=>{var v;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(v=g)==null||v.disconnect(),g=null,a&&cancelAnimationFrame(d)}}const eh=jp,th=Mp,nh=Ap,rh=Fp,oh=Dp,sh=(e,t,n)=>{const r=new Map,o=n??{},s={...Zp,...o.platform,_c:r};return kp(e,t,{...o,platform:s})};var ih=typeof document<"u",ch=function(){},_n=ih?I.useLayoutEffect:ch;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 Ns(e,t){const n=xc(e);return Math.round(t*n)/n}function Er(e){const t=y.useRef(e);return _n(()=>{t.current=e}),t}function ah(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,[u,f]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=y.useState(r);Wn(h,r)||g(r);const[d,m]=y.useState(null),[b,v]=y.useState(null),x=y.useCallback(j=>{j!==S.current&&(S.current=j,m(j))},[]),E=y.useCallback(j=>{j!==R.current&&(R.current=j,v(j))},[]),C=s||d,w=i||b,S=y.useRef(null),R=y.useRef(null),P=y.useRef(u),O=a!=null,M=Er(a),F=Er(o),A=Er(l),D=y.useCallback(()=>{if(!S.current||!R.current)return;const j={placement:t,strategy:n,middleware:h};F.current&&(j.platform=F.current),sh(S.current,R.current,j).then(N=>{const Y={...N,isPositioned:A.current!==!1};_.current&&!Wn(P.current,Y)&&(P.current=Y,dt.flushSync(()=>{f(Y)}))})},[h,t,n,F,A]);_n(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(j=>({...j,isPositioned:!1})))},[l]);const _=y.useRef(!1);_n(()=>(_.current=!0,()=>{_.current=!1}),[]),_n(()=>{if(C&&(S.current=C),w&&(R.current=w),C&&w){if(M.current)return M.current(C,w,D);D()}},[C,w,D,M,O]);const T=y.useMemo(()=>({reference:S,floating:R,setReference:x,setFloating:E}),[x,E]),k=y.useMemo(()=>({reference:C,floating:w}),[C,w]),U=y.useMemo(()=>{const j={position:n,left:0,top:0};if(!k.floating)return j;const N=Ns(k.floating,u.x),Y=Ns(k.floating,u.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,u.x,u.y]);return y.useMemo(()=>({...u,update:D,refs:T,elements:k,floatingStyles:U}),[u,D,T,k,U])}const lh=(e,t)=>{const n=eh(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh=(e,t)=>{const n=th(e);return{name:n.name,fn:n.fn,options:[e,t]}},fh=(e,t)=>({fn:oh(e).fn,options:[e,t]}),dh=(e,t)=>{const n=nh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ph=(e,t)=>{const n=rh(e);return{name:n.name,fn:n.fn,options:[e,t]}},No=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(No.displayName="PreviewCardRootContext");function cn(e){const t=y.useContext(No);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>.":St(50));return t}class hh extends _o{setState(t){}update(t){}set(t,n){}notifyAll(){}}const gh=600,Cc=300,Ec={...xp,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class mh extends _o{constructor(n,r,o){const s=new lc;super(Sc(n,s,r,o),wc(s),Ec);ae(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;Zd(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 bh(){const e=new lc;return new hh(Object.freeze(Sc(void 0,e)),Object.freeze(wc(e)),Ec)}function Sc(e,t,n,r=!1){return{...vp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Cc,...e}}function wc(e){return{popupRef:y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function js(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:o,actionsRef:s,handle:i,triggerId:c,defaultTriggerId:a=null,children:l}=e,u=Gd((v,x)=>new mh({open:n,openProp:t,activeTriggerId:a,triggerIdProp:c},v,x));u.useControlledProp("openProp",t),u.useControlledProp("triggerIdProp",c),u.useContextCallback("onOpenChange",r),u.useContextCallback("onOpenChangeComplete",o);const f=u.useState("open"),h=u.useState("activeTriggerId"),g=u.useState("mounted"),d=u.useState("payload");ep(u,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:m}=tp(f,u,()=>{u.context.inlineRectCoordsRef.current=void 0});pe(()=>{f&&h==null&&u.set("payload",void 0)},[u,h,f]),y.useImperativeHandle(s,()=>({unmount:m,close:()=>u.setOpen(!1,Pe(Or))}),[m,u]);const b=f||g||i!=null;return p.jsxs(No.Provider,{value:u,children:[i&&p.jsx(Kd,{handle:i,store:u}),b&&p.jsx(vh,{store:u}),typeof l=="function"?l({payload:d}):l]})}function vh({store:e}){const t=e.useState("floatingRootContext"),n=Dd(t);return np(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Rc=zi(function(t){return cn(!0)?p.jsx(js,{...t}):p.jsx(Nd,{children:p.jsx(js,{...t})})});process.env.NODE_ENV!=="production"&&(Rc.displayName="PreviewCardRoot");const jo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPortalContext");function yh(){const e=y.useContext(jo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Portal> is missing.":St(48));return e}const Tc=y.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:c,...a}=t,{node:l,subtree:u}=oc({container:o,ref:n,componentProps:t,elementProps:a});return!u&&!l?null:p.jsxs(y.Fragment,{children:[u,l&&dt.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Tc.displayName="FloatingPortalLite");const Pc=y.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return cn().useState("mounted")||r?p.jsx(jo.Provider,{value:r,children:p.jsx(Tc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(Pc.displayName="PreviewCardPortal");const Oc=Rf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:u,...f}=t,h=cn(!0),d=Cp(l)??h;if(!d)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.":St(89));const m=mi(c),b=d.useState("isTriggerActive",m),v=d.useState("isOpenedByTrigger",m),x=d.useState("floatingRootContext"),E=d.context.inlineRectCoordsRef,C=y.useRef(null),w=s??gh,S=i??Cc,{registerTrigger:R,isMountedByThisTrigger:P}=Qd(m,C,d,{payload:a,closeDelay:S}),O=Rp(x,{mouseOnly:!0,move:!1,handleClose:Op(),delay:()=>({open:w,close:S}),triggerElementRef:C,isActiveTrigger:b,isClosing:()=>d.select("transitionStatus")==="ending"}),M=Ep(x,{delay:w}),F={open:v},A=d.useState("triggerProps",P),D=$d(E,v);return pt("a",t,{state:F,ref:[n,R,C],props:[O,M.reference,A,D,{id:m},f],stateAttributesMapping:Gf})});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardTrigger");const Mo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Mo.displayName="PreviewCardPositionerContext");function xh(){const e=y.useContext(Mo);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>.":St(49));return e}function Ch(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,u]=y.useState(null),f=y.useRef(null),h=sn(n),g=y.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),d=ah({...e,elements:{...g,...l&&{reference:l}}}),m=y.useCallback(E=>{const C=me(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;u(C),d.refs.setReference(C)},[d.refs]),b=y.useMemo(()=>({...d.refs,setPositionReference:m,domReference:f}),[d.refs,m]),v=y.useMemo(()=>({...d.elements,domReference:i}),[d.elements,i]),x=y.useMemo(()=>({...d,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:a,refs:b,elements:v,nodeId:t,rootStore:r}),[d,b,v,t,r,c,a]);return pe(()=>{i&&(f.current=i)},[i]),pe(()=>{r.context.dataRef.current.floatingContext=x;const E=h==null?void 0:h.nodesRef.current.find(C=>C.id===t);E&&(E.context=x)}),y.useMemo(()=>({...d,context:x,refs:b,elements:v,rootStore:r}),[d,b,v,x,r])}const Ic=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ic.displayName="DirectionContext");function Eh(){const e=y.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:u=0}=ft(e,t)||{};if(l==null)return{};const f=Ji(u),h={x:n,y:r},g=So(o),d=Eo(g),m=await i.getDimensions(l),b=g==="y",v=b?"top":"left",x=b?"bottom":"right",E=b?"clientHeight":"clientWidth",C=s.reference[d]+s.reference[g]-h[g]-s.floating[d],w=h[g]-s.reference[g],S=c.floating[E]||s.floating[d],R=C/2-w/2,P=S/2-m[d]/2-1,O=Math.min(f[v],P),M=Math.min(f[x],P),F=O,A=S-m[d]-M,D=S/2-m[d]/2+R,_=Xi(F,D,A),T=!a.arrow&&Je(o)!=null&&D!==_&&s.reference[d]/2-(D<F?O:M)-m[d]/2<0,k=T?D<F?D-F:D-A:0;return{[g]:h[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]}},Rh={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}}}},Th={sideX:"left",sideY:"top"},Ph="--available-width",Oh="--available-height",Ih="--anchor-width",_h="--anchor-height",kh="--transform-origin",Ms=Ph,Ds=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 Fs(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 Ah(e){return Nh(e,Ch)}function Nh(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:u=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,inline:g,keepMounted:d=!1,floatingRootContext:m,mounted:b,collisionAvoidance:v,shift:x,nodeId:E,adaptiveOrigin:C,lazyFlip:w=!1,externalTree:S}=e,R=v.side||"flip",P=v.align||"flip",O=v.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]=y.useState(null);!b&&N!==null&&Y(null);const K=w==="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=y.useRef(null),ve=qe(s),z=qe(c),J=typeof s!="function"?s:0,ce=typeof c!="function"?c:0,he=[];g&&he.push(g),he.push(lh(de=>{const Ae=Fs(de,o,j),He=typeof ve.current=="function"?ve.current(Ae):ve.current,De=typeof z.current=="function"?z.current(Ae):z.current;return{mainAxis:He,crossAxis:De,alignmentAxis:De}},[J,ce,j,o]));const Oe=P==="none"&&R!=="shift",je=!Oe&&(u||M||R==="shift"),Re=R==="none"?null:dh({...ne,padding:{top:$.top+Q+re,right:$.right+Q+W,bottom:$.bottom+Q+ee,left:$.left+Q+te},mainAxis:!M&&R==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:O}),Me=Oe?null:uh({...ne,rootBoundary:F,mainAxis:P!=="none",crossAxis:je,limiter:u||M?void 0:fh(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,u,M,F,$,P]);R==="shift"||P==="shift"||X==="center"?he.push(Me,Re):he.push(Re,Me),he.push(ph({...ne,apply({elements:{floating:de},availableWidth:Ae,availableHeight:He,rects:De}){if(!k.current)return;const Xe=de.style;Xe.setProperty(Ms,`${Ae}px`),Xe.setProperty(Ds,`${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(Ih,`${et}px`),Xe.setProperty(_h,`${$t}px`)}}),wh(de=>({element:oe.current||Ke(de.elements.floating).createElement("div"),padding:oe.current?f:0}),[f]),{name:"transformOrigin",fn(de){var Bo,Vo,$o,Ho,Uo,zo;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(Fs(de,o,j)):s;let dn;if(!et&&fn&&Math.abs(it?((Bo=He.shift)==null?void 0:Bo.x)||0:((Vo=He.shift)==null?void 0:Vo.y)||0)<=1)dn=fn==="start"===(it&&(($o=Xe.isRTL)==null?void 0:$o.call(Xe,Ae))===!0)?"100%":"0%";else{const $c=it?((Ho=He.arrow)==null?void 0:Ho.x)||0:((Uo=He.arrow)==null?void 0:Uo.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(((zo=He.shift)==null?void 0:zo.y)||0)>$t&&(rr=`${ze.reference.y+ze.reference.height/2-un}px`),Ae.style.setProperty(kh,it?`${dn} ${rr}`:`${rr} ${dn}`),{}}},Rh,C),pe(()=>{!b&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,m]);const Be=y.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:H,elements:G,x:Ee,y:be,middlewareData:ge,update:V,placement:q,context:Z,isPositioned:se,floatingStyles:ke}=t({rootContext:m,open:d?b:void 0,placement:B,middleware:he,strategy:r,whileElementsMounted:d?void 0:(...de)=>As(...de,Be),nodeId:E,externalTree:S}),{sideX:we,sideY:wt}=ge.adaptiveOrigin||Th,st=se?r:"fixed",Rt=y.useMemo(()=>{let de;return se?C?de={position:st,[we]:Ee,[wt]:be}:de={...ke,position:st}:de={position:st,top:0,left:0},de[Ms]="100vw",de[Ds]="100vh",se||(de.opacity=0),de},[C,st,we,Ee,wt,be,ke,se]),Ze=y.useRef(null);pe(()=>{if(!b)return;const de=T.current,Ae=typeof de=="function"?de():de,De=(Ls(Ae)?Ae.current:Ae)||null||null;De!==Ze.current&&(H.setPositionReference(De),Ze.current=De)},[b,H,_,T]),y.useEffect(()=>{if(!b)return;const de=T.current;typeof de!="function"&&Ls(de)&&de.current!==Ze.current&&(H.setPositionReference(de.current),Ze.current=de.current)},[b,H,_,T]),y.useEffect(()=>{if(d&&b&&G.reference&&G.floating)return As(G.reference,G.floating,V,Be)},[d,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(()=>{w&&b&&se&&(Qe!==L||K&&gt!==X)&&Y(q)},[w,K,b,se,q,Qe,gt,L,X]);const an=y.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 y.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 Ls(e){return e!=null&&"current"in e}function kc(e){return e==="starting"?wd:Fe}function jh(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=y.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:c="bottom",align:a="center",sideOffset:l=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:h=5,arrowPadding:g=5,sticky:d=!1,disableAnchorTracking:m=!1,collisionAvoidance:b=Rd,style:v,...x}=t,E=cn(),C=yh(),w=kd(),S=E.useState("open"),R=E.useState("mounted"),P=E.useState("floatingRootContext"),O=E.useState("instantType"),M=E.useState("transitionStatus"),F=E.useState("adaptiveOrigin"),A=E.context.inlineRectCoordsRef,D=Ah({anchor:s,floatingRootContext:P,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:u,arrowPadding:g,collisionBoundary:f,collisionPadding:h,sticky:d,disableAnchorTracking:m,keepMounted:C,nodeId:w,collisionAvoidance:b,adaptiveOrigin:F,inline:Hd(A)}),_=D.update;pe(()=>{S&&R&&_()},[S,R,_]);const T={open:S,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:O},k=jh(t,T,{styles:D.positionerStyles,transitionStatus:M,props:x,refs:[n,E.useStateSetter("positionerElement")],hidden:!R,inert:!S});return p.jsx(Mo.Provider,{value:D,children:p.jsx(Ad,{id:w,children:k})})});process.env.NODE_ENV!=="production"&&(Ac.displayName="PreviewCardPositioner");const Nc=y.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=cn(),{side:a,align:l}=xh(),u=c.useState("open"),f=c.useState("instantType"),h=c.useState("transitionStatus"),g=c.useState("popupProps"),d=c.useState("floatingRootContext"),m=c.useState("closeDelay");return uo({open:u,ref:c.context.popupRef,onComplete(){var x,E;u&&((E=(x=c.context).onOpenChangeComplete)==null||E.call(x,!0))}}),Sp(d,{closeDelay:m}),pt("div",t,{state:{open:u,side:a,align:l,instant:f,transitionStatus:h},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[qd,g,kc(h),i],stateAttributesMapping:Kf})});process.env.NODE_ENV!=="production"&&(Nc.displayName="PreviewCardPopup");class Mh extends Ud{constructor(){super(bh(),"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 Dh(){return new Mh}const Fh=Dh;function Lh(e){return p.jsx(Rc,{...e})}function Bh(e){return p.jsx(Oc,{"data-slot":"hover-card-trigger",...e})}function Vh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return p.jsx(Pc,{children:p.jsx(Ac,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:p.jsx(Nc,{"data-slot":"hover-card-content",...s,className:i=>ue("vps-hover-card",typeof e=="function"?e(i):e)})})})}function $h({className:e,...t}){return p.jsx("span",{className:ue("inline-citation",e),...t})}const Do=I.createContext(null);function jc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function Hh({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=I.useState(()=>Fh()),i=e??s,c=I.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return p.jsx(Do.Provider,{value:c,children:p.jsx(Lh,{...o,handle:i,onOpenChange:(a,l)=>{var u,f;t==null||t(a,l),!a&&l.reason==="escape-key"&&((u=c.popup)!=null&&u.contains(document.activeElement))&&((f=c.trigger)==null||f.focus())}})})}function Wr(e){try{return new URL(e).hostname||e}catch{return e}}function Uh({sources:e,delay:t,closeDelay:n,id:r,children:o,onClick:s,...i}){const c=I.useContext(Do),a=I.useId(),l=r??a,u=e[0],f=u?Wr(u):"Source";return p.jsx(Bh,{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:p.jsx(po,{variant:"secondary",size:"xs","aria-haspopup":"dialog",...i,onClick:h=>{s==null||s(h),!(!c||h.defaultPrevented)&&(c.trigger=h.currentTarget,c.focusRequested=!0,c.handle.open(l),jc(c))}}),children:o??(e.length>1?`${f} +${e.length-1}`:f)})}function zh({ref:e,onBlur:t,...n}){const r=I.useContext(Do);return p.jsx(Vh,{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 Fo(){const e=I.useContext(Mc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function Wh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=xo({...e,axis:n==="vertical"?"y":"x"},t),[{selected:a,count:l},u]=I.useState({selected:0,count:0});return I.useEffect(()=>{if(!c)return;r==null||r(c);const f=()=>u({selected:c.selectedScrollSnap(),count:c.scrollSnapList().length});return f(),c.on("select",f).on("reInit",f),()=>{c.off("select",f).off("reInit",f)}},[c,r]),p.jsx(Mc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:p.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:ue("inline-citation-carousel",o),"data-orientation":n})})}function qh({className:e,...t}){const{viewportRef:n}=Fo();return p.jsx("div",{ref:n,className:"inline-citation-viewport",children:p.jsx("div",{className:ue("inline-citation-track",e),...t})})}function Gh({className:e,...t}){return p.jsx("div",{role:"group","aria-roledescription":"slide",className:ue("inline-citation-slide",e),...t})}function Kh({className:e,...t}){return p.jsx("div",{className:ue("inline-citation-carousel-header",e),...t})}function Yh({children:e,...t}){const{selected:n,count:r}=Fo();return p.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}=Fo(),i=e?s==null?void 0:s.canScrollNext():s==null?void 0:s.canScrollPrev();return p.jsx(po,{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?p.jsx(Zs,{size:14,"aria-hidden":"true"}):p.jsx(ga,{size:14,"aria-hidden":"true"}))})}function Xh(e){return p.jsx(Dc,{...e,next:!1})}function Jh(e){return p.jsx(Dc,{...e,next:!0})}function Zh({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?go(t):void 0;return p.jsxs("div",{className:ue("inline-citation-source",r),...s,children:[p.jsx("div",{className:"inline-citation-title",children:e||(i?Wr(i):"Source")}),i&&p.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[Wr(i),p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&p.jsx("p",{children:n}),o]})}function Qh({className:e,...t}){return p.jsx("blockquote",{className:ue("inline-citation-quote",e),...t})}const eg={"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(eg))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 tg=({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 u=e.slice(0,o),f=u.length===1?"source":"sources",h=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(xa,{size:14})}),p.jsx(jt,{children:`${u.length} retrieved VPS ${f}`}),!s&&p.jsx(Kt,{children:i?"Hide Details":"Inspect Sources"})]}),g=p.jsx(bt,{className:"grounded-source-rows",children:u.map((d,m)=>{const b=a===m,v=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(pa,{size:13})}),p.jsxs(jt,{children:["[S",m+1,"] ",qr(d)]}),p.jsxs(Kt,{title:"Ranking score, not a probability of correctness",children:["Score ",d.score.toFixed(2)]})]});return s?p.jsx("div",{children:v},`${d.chunkId}-${m}`):p.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:m)},title:d.source,children:v},`${d.chunkId}-${m}`)})});return s?p.jsxs(bt,{className:"grounded-sources-card",children:[h,g]}):p.jsx(bt,{className:"grounded-sources-card",children:p.jsxs(Oi,{open:i,onOpenChange:c,children:[p.jsx(Ii,{children:h}),g,p.jsx(_i,{children:p.jsx("div",{className:"grounded-sources-details-list",children:u.map((d,m)=>{const b=qr(d),v=Fc(d.source),x=a===m;return p.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[p.jsxs("div",{className:"grounded-detail-top",children:[p.jsxs("div",{className:"grounded-detail-title-group",children:[p.jsxs("span",{className:"grounded-detail-index",children:["[",m+1,"]"]}),p.jsx("span",{className:"grounded-detail-title",children:b})]}),p.jsxs("div",{className:"grounded-detail-meta",children:[p.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",d.score.toFixed(2)]}),v&&p.jsxs("a",{href:v.path,onClick:E=>{E.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[p.jsx("span",{children:v.label}),p.jsx(va,{size:10,"aria-hidden":"true"})]})]})]}),p.jsx("div",{className:"grounded-detail-path",children:p.jsx("code",{children:d.source})}),d.snippet&&p.jsxs("p",{className:"grounded-detail-snippet",children:['"',d.snippet,'"']})]},`detail-${d.chunkId}-${m}`)})})})]})})};function ng({label:e,sources:t}){const n=t.map(r=>{var i;const o=qr(r),s=go(r.url||r.source)??((i=Fc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:p.jsxs(p.Fragment,{children:[p.jsx(Zh,{title:o,url:s}),r.snippet&&p.jsx(Qh,{children:r.snippet})]})}});return p.jsx($h,{children:p.jsxs(Hh,{children:[p.jsx(Uh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),p.jsx(zh,{children:n.length===1?n[0].content:p.jsxs(Wh,{"aria-label":"Sources",children:[p.jsxs(Kh,{children:[p.jsx(Yh,{}),p.jsx(Xh,{}),p.jsx(Jh,{})]}),p.jsx(qh,{children:n.map((r,o)=>p.jsx(Gh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function rg(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 p.jsx(ng,{label:o,sources:c},s)}const i=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(i){const c=i[1],a=i[2],l=go(a);if(!l)return p.jsx(I.Fragment,{children:c},s);const u=/^https?:\/\//i.test(a);return p.jsx("a",{href:l,target:u?"_blank":void 0,rel:u?"noopener noreferrer":void 0,className:"md-link",children:c},s)}return o.startsWith("**")&&o.endsWith("**")&&o.length>=4?p.jsx("strong",{children:o.slice(2,-2)},s):o.startsWith("*")&&o.endsWith("*")&&o.length>=2?p.jsx("em",{children:o.slice(1,-1)},s):o.startsWith("`")&&o.endsWith("`")&&o.length>=2?p.jsx("code",{className:"md-code",children:o.slice(1,-1)},s):/^https?:\/\//i.test(o)?p.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:o},s):p.jsx(I.Fragment,{children:o},s)})}function og(e){const t=e.replace(/\r\n/g,`
212
212
  `).split(`
213
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(d=>d.trim()),f=l(a[0]),u=a[1].includes("-")?2:1,h=a.slice(u).map(l);n.push({type:"table",headers:f,rows:h});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 sg({code:e,lang:t,streaming:n}){const{status:r,copy:o}=$i();return p.jsxs("div",{className:"md-code-block",children:[p.jsxs("div",{className:"md-code-header",children:[p.jsx("span",{children:t||"Code"}),!n&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"md-code-status",role:"status",children:[r==="copied"&&"Copied",r==="failed"&&"Couldn’t copy"]}),p.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"?p.jsx(Xr,{size:15,"aria-hidden":"true"}):p.jsx(ei,{size:15,"aria-hidden":"true"})})]})]}),p.jsx("pre",{className:"md-pre",children:p.jsx("code",{children:e.split(`
215
- `).map((s,i)=>p.jsxs("span",{className:"md-code-line",children:[p.jsx("span",{className:"md-code-number","aria-hidden":"true",children:i+1}),p.jsx("span",{children:s||" "})]},i))})})]})}const Ls=I.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=og(t),s=i=>rg(i,r);return p.jsx("div",{className:"md-content",children:o.map((i,c)=>{switch(i.type){case"h":return i.level===1?p.jsx("h2",{className:"md-h1",children:s(i.content)},c):i.level===2?p.jsx("h3",{className:"md-h2",children:s(i.content)},c):i.level===3?p.jsx("h4",{className:"md-h3",children:s(i.content)},c):p.jsx("h5",{className:"md-h4",children:s(i.content)},c);case"ul":return p.jsx("ul",{className:"md-ul",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"ol":return p.jsx("ol",{className:"md-ol",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"code":return p.jsx(sg,{code:i.code,lang:i.lang,streaming:n},c);case"quote":return p.jsx("blockquote",{className:"md-quote",children:i.lines.map((a,l)=>p.jsx("p",{children:s(a)},l))},c);case"hr":return p.jsx("hr",{className:"md-hr"},c);case"table":return p.jsx("div",{className:"md-table-wrap",children:p.jsxs("table",{className:"md-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.headers.map((a,l)=>p.jsx("th",{children:s(a)},l))})}),p.jsx("tbody",{children:i.rows.map((a,l)=>p.jsx("tr",{children:a.map((f,u)=>p.jsx("td",{children:s(f)},u))},l))})]})},c);case"p":default:return p.jsx("p",{className:"md-p",children:i.lines.map((a,l)=>p.jsxs(I.Fragment,{children:[s(a),l<i.lines.length-1&&p.jsx("br",{})]},l))},c)}})})}),ig=I.lazy(async()=>({default:(await import("streamdown")).Streamdown})),Bc=I.createContext(null);function Vc(){const e=I.useContext(Bc);if(!e)throw new Error("Reasoning parts must be rendered inside Reasoning.");return e}function cg({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),h=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(d){t===void 0&&a(d),r==null||r(d)}return p.jsx(Bc.Provider,{value:{isStreaming:e,isOpen:h,setIsOpen:g,duration:o??l},children:p.jsx(bt,{className:s,children:p.jsx(Ii,{...i,open:h,onOpenChange:g})})})}function ag({getThinkingMessage:e,children:t,icon:n,description:r,...o}){const{isStreaming:s,duration:i}=Vc(),c=s?"Thinking":i===void 0?"Thought":`Thought for ${i}s`;return p.jsx(_i,{...o,children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:n??(s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14}))}),p.jsx(jt,{children:t??(e==null?void 0:e(s,i))??c}),r&&p.jsx(Kt,{"aria-hidden":s||void 0,children:r})]})})}function lg({children:e,className:t,...n}){const{isStreaming:r}=Vc();return p.jsx(ki,{className:ue("reasoning-content",t),...n,children:typeof e=="string"?p.jsx(I.Suspense,{fallback:p.jsx("div",{className:"md-content reasoning-text",children:e}),children:p.jsx(ig,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function ug(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const fg=({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(),h=setInterval(()=>{a(Number(((Date.now()-u)/1e3).toFixed(1)))},250);return()=>clearInterval(h)},[s]);const l=n.length>0||o.length>0,f=r===void 0?void 0:Number((r/1e3).toFixed(1));return l?p.jsxs(cg,{className:"chat-response-trace",isStreaming:s,duration:f,children:[p.jsx(ag,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?p.jsx(ri,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),p.jsx(lg,{children:p.jsxs(bt,{children:[n.map((u,h)=>p.jsxs(Ks,{children:[p.jsx(ca,{children:p.jsx("span",{className:"chat-progress-dot"})}),p.jsx(Ys,{children:u})]},`${u}-${h}`)),o.map((u,h)=>p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(_a,{size:13})}),p.jsx(jt,{children:ug(u.toolName)})]},`${u.toolName}-${h}`))]})})]}):p.jsx(bt,{className:"chat-response-trace",children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14})}),p.jsx(jt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?p.jsxs(Kt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&f!==void 0&&p.jsxs(Kt,{children:[f,"s"]})]})})},dg=({message:e,onEdit:t})=>{var g,d,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||(d=e.sources)!=null&&d.length||(m=e.toolCalls)!=null&&m.length||e.usage)),h=f&&!c&&!a&&e.content.trim().length>0;return p.jsxs(Jr,{align:s?"end":"start",children:[e.role==="assistant"&&p.jsx(oi,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Js,{size:15})}),p.jsxs(Zr,{children:[u&&p.jsx(Aa,{children:p.jsx(fg,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?p.jsx(Ar,{align:"end",children:p.jsx(Nr,{className:"msg-user-pre",children:e.content})}):l||i?p.jsx(Ar,{variant:i?"destructive":"muted",children:p.jsx(Nr,{children:p.jsx(Ls,{text:e.content})})}):e.content&&p.jsxs("div",{className:"chat-message-body",children:[p.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)?p.jsx(tg,{sources:e.sources,hideInspectSources:r}):null]}),h&&n&&p.jsx(Cr,{children:p.jsx($u,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&p.jsxs(Cr,{children:[t&&p.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:p.jsx(wa,{size:14,"aria-hidden":"true"})}),p.jsx(Xr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},pg=({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 p.jsx(Mu,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:p.jsxs(Du,{children:[p.jsx(Fu,{"aria-label":"Chat messages",children:p.jsxs(Lu,{"aria-busy":i,children:[c.length===0&&p.jsx(cs,{messageId:"welcome",children:p.jsx(Vu,{})}),c.map(a=>p.jsx(cs,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:p.jsx(dg,{message:a,onEdit:e})},a.streamId??a.id))]})}),p.jsx(Bu,{})]})})},hg=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=en(),s=!n.customerId&&!n.email,[i,c]=I.useState("");return e?p.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[p.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),p.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),p.jsx("p",{className:"ticket-card-body",children:e.description}),s&&p.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",p.jsx("input",{value:i,onChange:a=>c(a.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),p.jsxs("div",{className:"ticket-actions",children:[p.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),p.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:h,retryLast:g,pendingTicket:d,soundEnabled:m,toggleSound:b}=en(),v=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 p.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[p.jsx($l,{title:r,subtitle:o,onClose:t,onReset:()=>void h(),showMinimize:n,soundEnabled:m,onToggleSound:b,envStage:s,envPulse:i}),p.jsx("div",{className:"chat-panel-body",children:p.jsx(pg,{onEdit:C=>{var w;return(w=v.current)==null?void 0:w.edit(C)}})}),p.jsx(Ks,{className:"sr-only",role:"status",children:p.jsx(Ys,{children:E})}),u&&f==="error"&&p.jsx(Fl,{message:u,onRetry:()=>void g()}),p.jsx(hg,{}),p.jsx(Zl,{ref:v,onSend:C=>void a(C),onStop:x?l:void 0,disabled:x||!!d})]})},gg=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?p.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:p.jsx(Fo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,mg=({open:e,onToggle:t})=>p.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?p.jsx(ka,{size:22}):p.jsx(ni,{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 p.jsxs(p.Fragment,{children:[p.jsx(gg,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),p.jsx(mg,{open:c,onToggle:()=>a(!c)})]})},bg=({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:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(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&&h===void 0&&g===void 0?p.jsx(Bs,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,children:p.jsx(Bs,{...d})})},vg=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:s=!0})=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),p.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&p.jsx(Fo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),yg=5,wr=8,$c="vps-embedded-assistant-top",Vs=16;function xg(e,t,n){return Math.min(n,Math.max(t,e))}function $s(e,t){const n=Math.max(wr,window.innerHeight-t-wr);return xg(e,wr,n)}function Eg(){try{const e=window.localStorage.getItem($c);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function Sg(e){try{window.localStorage.setItem($c,String(e))}catch{}}const wg=({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:Eg()),s=I.useRef(r),i=I.useRef(!1),[c,a]=I.useState(!1),[l,f]=I.useState(!1);I.useEffect(()=>{s.current=r},[r]),I.useEffect(()=>{const d=t.current;if(!d)return;const m=()=>{o(b=>{const x=$s(b??Vs,d.offsetHeight);return s.current=x,x})};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const u=d=>{if(d.button!==0)return;const m=d.currentTarget,b=m.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:b.top,moved:!1};try{m.setPointerCapture(d.pointerId)}catch{}},h=d=>{if(n.current.pointerId!==d.pointerId)return;const m=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(m)<yg)return;n.current.moved=!0,a(!0);const b=$s(n.current.startTop+m,d.currentTarget.offsetHeight);s.current=b,o(b)},g=d=>{var b,v;if(n.current.pointerId!==d.pointerId)return;try{(v=(b=d.currentTarget).hasPointerCapture)!=null&&v.call(b,d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const m=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),m&&(i.current=!0,s.current!=null&&Sg(s.current))};return p.jsxs("button",{ref:t,type:"button",onPointerDown:u,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),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"}${l?" embedded-trigger-btn--expanded":" embedded-trigger-btn--collapsed"}`,style:{top:r??Vs,transform:void 0},children:[p.jsx(ni,{size:18}),p.jsx("span",{className:"embedded-trigger-label",children:"Assistant"})]})},Hs=({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 p.jsxs(p.Fragment,{children:[r&&!a&&p.jsx(wg,{onOpen:()=>l(!0)}),p.jsx(vg,{open:a,onClose:()=>l(!1),envStage:o,envPulse:s})]})},Cg=({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:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(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&&h===void 0&&g===void 0?p.jsx(Hs,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,children:p.jsx(Hs,{...d})})},Rg={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=bg;exports.ColorPalette=Rg;exports.EmbeddedChatbot=Cg;exports.buildApiUrl=Rn;exports.chatApi=na;exports.createChatApi=Gr;exports.resolveApiBaseUrl=yt;exports.useChatContext=Ws;exports.useChatbot=en;exports.useOptionalChatContext=qn;
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(d=>d.trim()),u=l(a[0]),f=a[1].includes("-")?2:1,h=a.slice(f).map(l);n.push({type:"table",headers:u,rows:h});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 sg({code:e,lang:t,streaming:n}){const{status:r,copy:o}=Vi();return p.jsxs("div",{className:"md-code-block",children:[p.jsxs("div",{className:"md-code-header",children:[p.jsx("span",{children:t||"Code"}),!n&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"md-code-status",role:"status",children:[r==="copied"&&"Copied",r==="failed"&&"Couldn’t copy"]}),p.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"?p.jsx(Xr,{size:15,"aria-hidden":"true"}):p.jsx(ei,{size:15,"aria-hidden":"true"})})]})]}),p.jsx("pre",{className:"md-pre",children:p.jsx("code",{children:e.split(`
215
+ `).map((s,i)=>p.jsxs("span",{className:"md-code-line",children:[p.jsx("span",{className:"md-code-number","aria-hidden":"true",children:i+1}),p.jsx("span",{children:s||" "})]},i))})})]})}const Bs=I.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=og(t),s=i=>rg(i,r);return p.jsx("div",{className:"md-content",children:o.map((i,c)=>{switch(i.type){case"h":return i.level===1?p.jsx("h2",{className:"md-h1",children:s(i.content)},c):i.level===2?p.jsx("h3",{className:"md-h2",children:s(i.content)},c):i.level===3?p.jsx("h4",{className:"md-h3",children:s(i.content)},c):p.jsx("h5",{className:"md-h4",children:s(i.content)},c);case"ul":return p.jsx("ul",{className:"md-ul",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"ol":return p.jsx("ol",{className:"md-ol",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"code":return p.jsx(sg,{code:i.code,lang:i.lang,streaming:n},c);case"quote":return p.jsx("blockquote",{className:"md-quote",children:i.lines.map((a,l)=>p.jsx("p",{children:s(a)},l))},c);case"hr":return p.jsx("hr",{className:"md-hr"},c);case"table":return p.jsx("div",{className:"md-table-wrap",children:p.jsxs("table",{className:"md-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.headers.map((a,l)=>p.jsx("th",{children:s(a)},l))})}),p.jsx("tbody",{children:i.rows.map((a,l)=>p.jsx("tr",{children:a.map((u,f)=>p.jsx("td",{children:s(u)},f))},l))})]})},c);case"p":default:return p.jsx("p",{className:"md-p",children:i.lines.map((a,l)=>p.jsxs(I.Fragment,{children:[s(a),l<i.lines.length-1&&p.jsx("br",{})]},l))},c)}})})}),ig=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 cg({isStreaming:e=!1,open:t,defaultOpen:n,onOpenChange:r,duration:o,className:s,...i}){const[c,a]=I.useState(n),[l,u]=I.useState(),f=I.useRef(null),h=t??c??e;I.useEffect(()=>{e?f.current=performance.now():f.current!==null&&(u(Math.round((performance.now()-f.current)/1e3)),f.current=null)},[e]);function g(d){t===void 0&&a(d),r==null||r(d)}return p.jsx(Lc.Provider,{value:{isStreaming:e,isOpen:h,setIsOpen:g,duration:o??l},children:p.jsx(bt,{className:s,children:p.jsx(Oi,{...i,open:h,onOpenChange:g})})})}function ag({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 p.jsx(Ii,{...o,children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:n??(s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14}))}),p.jsx(jt,{children:t??(e==null?void 0:e(s,i))??c}),r&&p.jsx(Kt,{"aria-hidden":s||void 0,children:r})]})})}function lg({children:e,className:t,...n}){const{isStreaming:r}=Bc();return p.jsx(_i,{className:ue("reasoning-content",t),...n,children:typeof e=="string"?p.jsx(I.Suspense,{fallback:p.jsx("div",{className:"md-content reasoning-text",children:e}),children:p.jsx(ig,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function ug(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const fg=({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 f=Date.now(),h=setInterval(()=>{a(Number(((Date.now()-f)/1e3).toFixed(1)))},250);return()=>clearInterval(h)},[s]);const l=n.length>0||o.length>0,u=r===void 0?void 0:Number((r/1e3).toFixed(1));return l?p.jsxs(cg,{className:"chat-response-trace",isStreaming:s,duration:u,children:[p.jsx(ag,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?p.jsx(ni,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),p.jsx(lg,{children:p.jsxs(bt,{children:[n.map((f,h)=>p.jsxs(Ys,{children:[p.jsx(ia,{children:p.jsx("span",{className:"chat-progress-dot"})}),p.jsx(Xs,{children:f})]},`${f}-${h}`)),o.map((f,h)=>p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(ka,{size:13})}),p.jsx(jt,{children:ug(f.toolName)})]},`${f.toolName}-${h}`))]})})]}):p.jsx(bt,{className:"chat-response-trace",children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14})}),p.jsx(jt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?p.jsxs(Kt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&u!==void 0&&p.jsxs(Kt,{children:[u,"s"]})]})})},dg=({message:e,onEdit:t})=>{var g,d,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"),u=e.role==="assistant"&&!l&&!i,f=u&&(c||a||e.durationMs!==void 0||!!((g=e.progressSteps)!=null&&g.length||(d=e.sources)!=null&&d.length||(m=e.toolCalls)!=null&&m.length||e.usage)),h=u&&!c&&!a&&e.content.trim().length>0;return p.jsxs(Jr,{align:s?"end":"start",children:[e.role==="assistant"&&p.jsx(ri,{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:fo,alt:"VPS Logo",style:{width:"16px",height:"16px"}})}),p.jsxs(Zr,{children:[f&&p.jsx(Na,{children:p.jsx(fg,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?p.jsx(Ar,{align:"end",children:p.jsx(Nr,{className:"msg-user-pre",children:e.content})}):l||i?p.jsx(Ar,{variant:i?"destructive":"muted",children:p.jsx(Nr,{children:p.jsx(Bs,{text:e.content})})}):e.content&&p.jsxs("div",{className:"chat-message-body",children:[p.jsx(Bs,{text:e.content,streaming:c,sources:u&&!c&&!a&&!r?e.sources:void 0}),u&&!c&&!a&&o&&((b=e.sources)!=null&&b.length)?p.jsx(tg,{sources:e.sources,hideInspectSources:r}):null]}),h&&n&&p.jsx(wr,{children:p.jsx($u,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&p.jsxs(wr,{children:[t&&p.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:p.jsx(wa,{size:14,"aria-hidden":"true"})}),p.jsx(Xr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},pg=({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 p.jsx(Mu,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:p.jsxs(Du,{children:[p.jsx(Fu,{"aria-label":"Chat messages",children:p.jsxs(Lu,{"aria-busy":i,children:[c.length===0&&p.jsx(as,{messageId:"welcome",children:p.jsx(Vu,{})}),c.map(a=>p.jsx(as,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:p.jsx(dg,{message:a,onEdit:e})},a.streamId??a.id))]})}),p.jsx(Bu,{})]})})},hg=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=en(),s=!n.customerId&&!n.email,[i,c]=I.useState("");return e?p.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[p.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),p.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),p.jsx("p",{className:"ticket-card-body",children:e.description}),s&&p.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",p.jsx("input",{value:i,onChange:a=>c(a.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),p.jsxs("div",{className:"ticket-actions",children:[p.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),p.jsx("button",{type:"button",onClick:()=>void r(i),disabled:t||s&&!i.trim(),className:"ticket-confirm-btn",children:t?"Creating…":"Create ticket"})]})]}):null},Lo=({className:e,onClose:t,showMinimize:n,title:r,subtitle:o,envStage:s,envPulse:i=!0})=>{const{messages:c,sendMessage:a,stopResponse:l,status:u,error:f,resetConversation:h,retryLast:g,pendingTicket:d,soundEnabled:m,toggleSound:b}=en(),v=I.useRef(null),x=u==="awaiting"||u==="connecting",E=c[c.length-1],C=x?E==null?void 0:E.progressText:(E==null?void 0:E.status)==="stopped"?"Response stopped":void 0;return p.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[p.jsx($l,{title:r,subtitle:o,onClose:t,onReset:()=>void h(),showMinimize:n,soundEnabled:m,onToggleSound:b,envStage:s,envPulse:i}),p.jsx("div",{className:"chat-panel-body",children:p.jsx(pg,{onEdit:w=>{var S;return(S=v.current)==null?void 0:S.edit(w)}})}),p.jsx(Ys,{className:"sr-only",role:"status",children:p.jsx(Xs,{children:C})}),f&&u==="error"&&p.jsx(Ll,{message:f,onRetry:()=>void g()}),p.jsx(hg,{}),p.jsx(Zl,{ref:v,onSend:w=>void a(w),onStop:x?l:void 0,disabled:x||!!d})]})},gg=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?p.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:p.jsx(Lo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,mg=({open:e,onToggle:t})=>p.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?p.jsx(Aa,{size:22}):p.jsx(Ca,{size:24})}),Vs=({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 p.jsxs(p.Fragment,{children:[p.jsx(gg,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),p.jsx(mg,{open:c,onToggle:()=>a(!c)})]})},bg=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:u,hideInspectSources:f,showGroundedSources:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!u&&f===void 0&&h===void 0&&g===void 0?p.jsx(Vs,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:u,hideInspectSources:f,showGroundedSources:h,modelId:g,children:p.jsx(Vs,{...d})})},vg=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:s=!0})=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),p.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&p.jsx(Lo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),yg=5,Sr=8,Vc="vps-embedded-assistant-top",$s=16;function xg(e,t,n){return Math.min(n,Math.max(t,e))}function Hs(e,t){const n=Math.max(Sr,window.innerHeight-t-Sr);return xg(e,Sr,n)}function Cg(){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:Cg()),s=I.useRef(r),i=I.useRef(!1),[c,a]=I.useState(!1),[l,u]=I.useState(!1);I.useEffect(()=>{s.current=r},[r]),I.useEffect(()=>{const d=t.current;if(!d)return;const m=()=>{o(b=>{const x=Hs(b??$s,d.offsetHeight);return s.current=x,x})};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const f=d=>{if(d.button!==0)return;const m=d.currentTarget,b=m.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:b.top,moved:!1};try{m.setPointerCapture(d.pointerId)}catch{}},h=d=>{if(n.current.pointerId!==d.pointerId)return;const m=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(m)<yg)return;n.current.moved=!0,a(!0);const b=Hs(n.current.startTop+m,d.currentTarget.offsetHeight);s.current=b,o(b)},g=d=>{var b,v;if(n.current.pointerId!==d.pointerId)return;try{(v=(b=d.currentTarget).hasPointerCapture)!=null&&v.call(b,d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const m=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),m&&(i.current=!0,s.current!=null&&Eg(s.current))};return p.jsxs("button",{ref:t,type:"button",onPointerDown:f,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),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"}${l?" embedded-trigger-btn--expanded":" embedded-trigger-btn--collapsed"}`,style:{top:r??$s,transform:void 0},children:[p.jsx("img",{src:fo,alt:"",className:"embedded-trigger-icon","aria-hidden":"true"}),p.jsx("span",{className:"embedded-trigger-label",children:"Assistant"})]})},Us=({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=u=>{n==null||n(u),t===void 0&&c(u)};return I.useEffect(()=>{if(a){window.history.pushState({vpsChatOpen:!0},"");const u=()=>{l(!1)};return window.addEventListener("popstate",u),()=>{window.removeEventListener("popstate",u)}}},[a]),p.jsxs(p.Fragment,{children:[r&&!a&&p.jsx(Sg,{onOpen:()=>l(!0)}),p.jsx(vg,{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:u,hideInspectSources:f,showGroundedSources:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!u&&f===void 0&&h===void 0&&g===void 0?p.jsx(Us,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:u,hideInspectSources:f,showGroundedSources:h,modelId:g,children:p.jsx(Us,{...d})})},Rg={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=Lo;exports.ChatProvider=Yr;exports.ChatbotWidget=bg;exports.ColorPalette=Rg;exports.EmbeddedChatbot=wg;exports.buildApiUrl=Rn;exports.chatApi=ta;exports.createChatApi=Gr;exports.resolveApiBaseUrl=yt;exports.useChatContext=qs;exports.useChatbot=en;exports.useOptionalChatContext=qn;