vpschatbotwidget 1.2.5 → 1.2.6

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 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**.
1
+ "use strict";var zc=Object.create;var sr=Object.defineProperty;var Gc=Object.getOwnPropertyDescriptor;var Kc=Object.getOwnPropertyNames;var Yc=Object.getPrototypeOf,Xc=Object.prototype.hasOwnProperty;var Qc=(e,t,n)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kc(t))!Xc.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Gc(t,o))||r.enumerable});return e};var Zc=(e,t,n)=>(n=e!=null?zc(Yc(e)):{},Jc(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var ce=(e,t,n)=>Qc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),O=require("react"),ea=require("react-dom");var ir=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(O),ht=zs(ea),ta={};function wt(e){if(e!=null&&e.trim()!=="")return e.trim().replace(/\/+$/,"");const t=(typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ir&&ir.tagName.toUpperCase()==="SCRIPT"&&ir.src||new URL("vps-chatbot.cjs",document.baseURI).href}<"u"&&ta,"");return String(t).trim().replace(/\/+$/,"")}function Tn(e,t){const n=wt(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 Go(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&&!na(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 na(e){return/traceback|sql|exception|stack|api[_ ]?key|password/i.test(e)}function cr(e){return{chunkId:e.chunk_id,source:e.source,score:e.score,title:e.title,...e.url?{url:e.url}:{},snippet:e.snippet}}function ar(e){return{toolName:e.tool_name,arguments:e.arguments??{},result:e.result??{}}}function lr(e){return{model:e.model,promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,totalTokens:e.total_tokens}}function ra(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 ur(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Kr(e){const t=wt(e);async function n(r,o){let s;const i=Tn(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 ur(s);if(!s.ok)throw Go(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.service?{service:s.service}:{},...s!=null&&s.modelId?{model_id:s.modelId}:{}})});return{requestId:c.request_id,sessionId:c.session_id,answer:c.answer,sources:(c.sources||[]).map(cr),toolCalls:(c.tool_calls||[]).map(ar),usage:lr(c.usage),durationMs:c.duration_ms,suggestions:c.suggestions}},async sendMessageStream(r,o,s,i,c,a){var u,f;const l=Tn(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.service?{service:s.service}:{},...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 C=await ur(h);throw Go(C,"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 C=zo(await ur(h));if(typeof C.answer!="string"||!C.usage)throw{message:"The response stream ended unexpectedly."};return{requestId:C.request_id,sessionId:C.session_id,answer:C.answer,sources:(C.sources||[]).map(cr),toolCalls:(C.tool_calls||[]).map(ar),usage:lr(C.usage),durationMs:C.duration_ms,suggestions:C.suggestions}}const m=h.body.getReader(),d=new TextDecoder;let g="";const b={value:null},v=C=>{const w=C.split(/\r?\n/).filter(S=>S.startsWith("data:")).map(S=>S.slice(5).trimStart()).join(`
2
+ `);if(!w)return;let E={};try{const S=JSON.parse(w);if(!S||typeof S!="object")return;E=S}catch{return}if(E.type==="progress"&&typeof E.stage=="string")i==null||i(E.stage);else if(E.type==="token"&&typeof E.text=="string")c==null||c(E.text);else if(E.type==="complete")b.value={requestId:E.request_id||"",sessionId:E.session_id||r,answer:E.answer||"",sources:(E.sources||[]).map(cr),toolCalls:(E.tool_calls||[]).map(ar),usage:E.usage?lr(E.usage):{model:"",promptTokens:0,completionTokens:0,totalTokens:0},durationMs:E.duration_ms,suggestions:E.suggestions};else if(E.type==="error")throw{message:E.message||"I couldn't process that request right now.",requestId:E.request_id}};try{for(;!b.value;){const{done:C,value:w}=await m.read();if(C)break;if(g+=d.decode(w,{stream:!0}),g.length>1e6)throw{message:"The response stream was too large."};const E=g.split(/\r?\n\r?\n/);g=E.pop()||"";for(const S of E)if(v(S),b.value)break}g+=d.decode(),!b.value&&g.trim()&&v(g)}finally{await m.cancel().catch(()=>{}),m.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(ra)}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=Tn(t,"/health");return(await fetch(r)).ok}catch{return!1}}}}const oa=Kr(),sa=[{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?"}],$t=["vessel","tot"],Gs={1:{name:"CC Report",client:"web",services:$t,topics:"finding, filtering, and downloading reports",questions:["How do I download a fuel report?","How do I filter lubricant reports?","How do I find a transformer oil report?"],serviceQuestions:{vessel:["How do I download a fuel report?","How do I filter lubricant reports?"],tot:["How do I find a transformer oil report?","How do I download a transformer oil report as a PDF?"]}},2:{name:"Client Admin",client:"admin",services:$t,topics:"client access, Vessel and TOT workflows, and VPS support",questions:["How do I add a client user?","How do I find reports for a vessel or transformer?","Why is a portal menu missing for a client user?"]},6:{name:"Fleet Manager",client:"web",services:["vessel"],topics:"vessels, marine samples, reports, and fleet trends",questions:["How do I find reports for a vessel?","Where can I find a vessel's sample status?","How do I review fleet fuel trends?"]},7:{name:"High Level Management",client:"web",services:$t,topics:"management dashboards and trend comparisons",questions:["How do I compare fuel trends across vessels?","How do I review transformer oil trends?","Where is the CII Dashboard?"]},9:{name:"Sampler",client:"mobile",services:$t,topics:"sample pre-registration, barcode scanning, and labels in the mobile app",questions:["How do I pre-register a vessel sample in the mobile app?","How do I scan a sample label?","How do I pre-register a transformer sample in the mobile app?"],serviceQuestions:{vessel:["How do I pre-register a vessel sample in the mobile app?","How do I scan a vessel sample label?"],tot:["How do I pre-register a transformer sample in the mobile app?","How do I scan a transformer sample label?"]},webQuestions:["How do I pre-register a vessel sample in the portal?","How do I pre-register a transformer sample in the portal?"],webServiceQuestions:{vessel:["How do I pre-register a vessel sample in the portal?","Where can I download my fuel report?"],tot:["How do I pre-register a transformer sample in the portal?","Where can I download a transformer oil report?"]}},10:{name:"VPS Admin",client:"admin",services:$t,topics:"Vessel and TOT workflows, portal administration, and VPS support",questions:["How do I review a portal registration request?","Where do I find vessel reports?","How do I view transformer oil test trends?"]},11:{name:"Transoil",client:"web",services:["tot"],topics:"transformer assets, oil reports, and trends",questions:["How do I find my transformer equipment?","Where can I download a transformer oil report?","How do I review transformer oil trends?"]},12:{name:"Bunker Master Only",client:"mobile",services:["vessel"],topics:"Bunker Master access, calculators, and Fuel Change-Over",questions:["How do I request Bunker Master access?","Where can I find the Bunker Master calculators?","How do I download the Fuel Change-Over workbook?"]},13:{name:"Fleet Manager Transoil",client:"web",services:["tot"],topics:"transformer equipment, reports, and fleet trends",questions:["How do I compare transformer oil trends for equipment?","How do I filter transformer oil reports by site?","How do I pre-register a transformer sample?"]}};function Ks(e){return Gs[e]}const Ko="vps-chatbot-response-sound";function ia(){const[e,t]=O.useState(!0),n=O.useRef(!0),r=O.useRef(null);O.useEffect(()=>{try{n.current=window.localStorage.getItem(Ko)!=="off",t(n.current)}catch{}return()=>{var c;(c=r.current)==null||c.close().catch(()=>{}),r.current=null}},[]);const o=O.useCallback(()=>{if(!(!n.current||typeof AudioContext>"u"))try{const c=r.current??(r.current=new AudioContext);c.state!=="running"&&c.resume().catch(()=>{})}catch{}},[]),s=O.useCallback(()=>{const c=!n.current;n.current=c,t(c);try{window.localStorage.setItem(Ko,c?"on":"off")}catch{}c&&o()},[o]),i=O.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(),m=c.createGain();h.frequency.value=u,m.gain.setValueAtTime(.001,f),m.gain.exponentialRampToValueAtTime(.06,f+.015),m.gain.exponentialRampToValueAtTime(.001,f+.14),h.connect(m),m.connect(c.destination),h.onended=()=>{h.disconnect(),m.disconnect()},h.start(f),h.stop(f+.15)}}catch{}},[]);return{soundEnabled:e,toggleSound:s,prepareSound:o,playSound:i}}const Yr=O.createContext(null);function Ys(){const e=O.useContext(Yr);if(!e)throw new Error("useChatbot must be used inside ChatProvider.");return e}function Gn(){return O.useContext(Yr)}function It(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 ca=`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,175 +8,175 @@ 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 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()}/**
11
+ Feel free to ask a question or select one of the suggested topics below!`;function Yo(e){return`${e}-${crypto.randomUUID()}`}function aa(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 Xr=e=>{var o,s,i,c,a;const t=e.roleId??((o=e.userContext)==null?void 0:o.roleId),n=e.client??((s=e.userContext)==null?void 0:s.client)??((i=Ks(t))==null?void 0:i.client),r=JSON.stringify([t,n,(c=e.userContext)==null?void 0:c.customerId,(a=e.userContext)==null?void 0:a.email]);return p.jsx(la,{...e,roleId:t,client:n},r)},la=({children:e,userContext:t={},role:n,roleId:r,client:o,service:s,welcomeMessage:i,suggestions:c,disableSuggestions:a=!1,initialMessage:l,apiBaseUrl:u,apiUrl:f,proxyUrl:h,api:m,hideInspectSources:d=!1,showGroundedSources:g=!1,modelId:b="auto"})=>{var Le;const v=u??f??h,x=O.useMemo(()=>m??Kr(v),[m,v]),C=Ks(r),w=s??t.service,E=O.useMemo(()=>{if(c)return c;if(!C)return sa;const K=o==="web"&&C.webQuestions,J=K?C.webServiceQuestions:C.serviceQuestions;return(w&&(J==null?void 0:J[w])||K||C.questions).map(L=>({label:L,query:L}))},[w,o,C,c]),S=O.useMemo(()=>({...t,role:n??t.role??(C==null?void 0:C.name),...r!==void 0?{roleId:r}:{},...o!==void 0?{client:o}:{},...s!==void 0?{service:s}:{}}),[t,n,r,o,C,s]),R=O.useMemo(()=>i===""?null:{id:"welcome-default",role:"assistant",content:i??(C?`Hello! I’m your **VPS Veritas assistant**. I can help with ${C.topics}. What would you like to do?`:ca),createdAt:new Date().toISOString(),status:"complete"},[C,i]),[T,P]=O.useState(null),[k,M]=O.useState(()=>R?[R]:[]),[_,D]=O.useState("idle"),[N,I]=O.useState(null),F=O.useRef(null),U=O.useRef(!1),A=O.useRef(null),j=O.useRef(null),q=O.useRef(!1),[z,ae]=O.useState([]),[re,B]=O.useState(b),{soundEnabled:G,toggleSound:V,prepareSound:H,playSound:Z}=ia();O.useEffect(()=>B(b),[b]),O.useEffect(()=>{var J;let K=!0;return ae([]),(J=x.listModels)==null||J.call(x).then(ue=>{K&&ae((ue==null?void 0:ue.models)||[])}).catch(()=>{}),()=>{K=!1}},[x]);const oe=O.useCallback(K=>{!q.current&&(K==="auto"||z.some(J=>J.id===K&&J.configured))&&B(K)},[z]);O.useEffect(()=>()=>{var K;return(K=A.current)==null?void 0:K.abort()},[]),O.useLayoutEffect(()=>{const K=j.current;if(!K)return;const J=k.find(L=>L.id===K.messageId),ue=performance.now();(J==null?void 0:J.status)==="complete"&&K.completedAt!==void 0?(It("completion-to-commit",K.completedAt,ue),It("submit-to-complete-commit",K.startedAt,ue),j.current=null):(J==null?void 0:J.status)==="pending"&&J.content&&K.firstTokenAt!==void 0&&!K.firstCommitRecorded&&(It("first-token-to-commit",K.firstTokenAt,ue),K.firstCommitRecorded=!0)},[k]);const ee=O.useCallback(async K=>{if(T)return T;D("connecting");const J=await x.createSession(K);if(K.aborted)throw new DOMException("Aborted","AbortError");return P(J.sessionId),J.sessionId},[T,x]),te=O.useCallback(async K=>{if(q.current)return;H(),q.current=!0;const J=new AbortController;A.current=J;let ue,L="";const Y=()=>{ue!==void 0&&cancelAnimationFrame(ue),ue=void 0};F.current=K;const Ee={id:Yo("user"),role:"user",content:K,createdAt:new Date().toISOString(),status:"complete"},me=Yo("asst"),Re="Preparing your answer…",W={id:me,streamId:me,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"pending",progressText:Re,progressSteps:[Re]},Q=performance.now(),X={messageId:me,startedAt:Q};j.current=X,M(Se=>[...Se,Ee,W]),D("awaiting"),I(null);const ie=Se=>{const de=Se.trim();!de||J.signal.aborted||M(_e=>_e.map(Te=>Te.id===me&&Te.progressText!==de?{...Te,progressText:de,progressSteps:[...Te.progressSteps??[],de]}:Te))};try{const Se=await ee(J.signal),de=performance.now();It("request-preparation",Q,de);const _e=x.sendMessageStream?await x.sendMessageStream(Se,K,{roleId:S.roleId,client:S.client,service:S.service,modelId:re},ie,Te=>{J.signal.aborted||(Te&&X.firstTokenAt===void 0&&(X.firstTokenAt=performance.now(),It("first-token-received",de,X.firstTokenAt)),L+=Te,ue===void 0&&(ue=requestAnimationFrame(()=>{ue=void 0,J.signal.aborted||M(qe=>qe.map($e=>$e.id===me?{...$e,content:L}:$e))})))},J.signal):await x.sendMessage(Se,K,{roleId:S.roleId,client:S.client,service:S.service,modelId:re},J.signal);if(Y(),J.signal.aborted)return;X.messageId=_e.requestId||me,X.completedAt=performance.now(),It("completion-received",de,X.completedAt,_e.requestId),M(Te=>Te.map(qe=>qe.id===me?{...qe,id:_e.requestId||me,content:_e.answer,status:"complete",progressText:void 0,sources:_e.sources,suggestions:_e.suggestions,toolCalls:_e.toolCalls,usage:_e.usage,durationMs:Math.max(Math.round(performance.now()-Q),_e.durationMs??0)}:qe)),D("idle"),Z()}catch(Se){if(Y(),j.current===X&&(j.current=null),J.signal.aborted)return;const de=aa(Se);M(_e=>_e.map(Te=>Te.id===me?{...Te,content:de,status:"error",progressText:void 0}:Te)),I(de),D("error")}finally{Y(),A.current===J&&(A.current=null,q.current=!1)}},[ee,x,S.client,S.roleId,S.service,re,H,Z]),$=O.useCallback(async K=>{const J=K.trim();!J||_==="awaiting"||_==="connecting"||await te(J)},[te,_]),ne=O.useCallback(async()=>{if(q.current)return;const K=F.current;K&&(M(J=>J.filter(ue=>ue.status!=="error")),await te(K))},[te]),se=O.useCallback(()=>{const K=A.current;K&&(K.abort(),A.current=null,q.current=!1,j.current=null,M(J=>J.map(ue=>ue.status==="pending"?{...ue,status:"stopped",progressText:void 0}:ue)),D("idle"))},[]),be=O.useCallback((K,J)=>{M(ue=>ue.map(L=>L.id===K?{...L,feedback:L.feedback===J?void 0:J}:L))},[]),ve=O.useCallback(async()=>{},[]),Oe=O.useCallback(()=>{},[]),Ae=O.useCallback(async()=>{var K;(K=A.current)==null||K.abort(),A.current=null,q.current=!1,P(null),M(R?[R]:[]),D("idle"),I(null),F.current=null,T&&await x.closeSession(T)},[T,x,R]);O.useEffect(()=>{!l||U.current||(U.current=!0,$(l))},[l,$]);const xe=(Le=k[k.length-1])==null?void 0:Le.suggestions,Me=O.useMemo(()=>({messages:k,status:_,error:N,sessionId:T,pendingTicket:null,ticketBusy:!1,lastTicket:null,suggestions:xe!=null&&xe.length?xe.map(K=>({label:K,query:K})):E,showSuggestions:!a&&_==="idle"&&(k.length===0||k.length===1&&k[0].id==="welcome-default"||k.some(K=>K.role==="assistant"&&K.status==="complete"&&!K.id.startsWith("welcome"))),suggestionBadgesEnabled:!a,userContext:S,apiBaseUrl:x.apiBaseUrl,hideInspectSources:d,showGroundedSources:g,soundEnabled:G,toggleSound:V,sendMessage:$,stopResponse:se,toggleMessageFeedback:be,retryLast:ne,confirmTicket:ve,cancelTicket:Oe,resetConversation:Ae,models:z,selectedModelId:re,selectModel:oe}),[k,_,N,T,E,xe,a,S,x.apiBaseUrl,d,g,G,V,$,se,be,ne,ve,Oe,Ae,z,re,oe]);return p.jsx(Yr.Provider,{value:Me,children:e})};function Xs(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=Xs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Xs(e))&&(r&&(r+=" "),r+=t);return r}function le(...e){return Qs(e)}function Js({className:e,variant:t="default",...n}){return p.jsx("div",{...n,"data-slot":"marker","data-variant":t,className:le("chat-marker",e)})}function ua({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-icon",className:le("chat-marker-icon",e),"aria-hidden":"true"})}function Zs({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-content",className:le("chat-marker-content",e)})}function tn(){return Ys()}/**
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 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();/**
16
+ */const fa=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ei=(...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 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"};/**
21
+ */var da={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 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]]));/**
26
+ */const pa=O.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>O.createElement("svg",{ref:a,...da,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ei("lucide",o),...c},[...i.map(([l,u])=>O.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(la,{ref:s,iconNode:t,className:Js(`lucide-${ca(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
31
+ */const ye=(e,t)=>{const n=O.forwardRef(({className:r,...o},s)=>O.createElement(pa,{ref:s,iconNode:t,className:ei(`lucide-${fa(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 ua=ye("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
36
+ */const ha=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 fa=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
41
+ */const ma=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 da=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
46
+ */const ga=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 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"}]]);/**
51
+ */const ba=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 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"}]]);/**
56
+ */const va=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.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const Xr=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
61
+ */const Qr=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
62
62
  * @license lucide-react v0.468.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
65
65
  * See the LICENSE file in the root directory of this source tree.
66
- */const ga=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
66
+ */const ya=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
67
67
  * @license lucide-react v0.468.0 - ISC
68
68
  *
69
69
  * This source code is licensed under the ISC license.
70
70
  * See the LICENSE file in the root directory of this source tree.
71
- */const Zs=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
71
+ */const ti=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
72
72
  * @license lucide-react v0.468.0 - ISC
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const ma=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
76
+ */const xa=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
77
77
  * @license lucide-react v0.468.0 - ISC
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const Qs=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
81
+ */const ni=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
82
82
  * @license lucide-react v0.468.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
85
85
  * See the LICENSE file in the root directory of this source tree.
86
- */const ba=ye("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
86
+ */const wa=ye("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
87
87
  * @license lucide-react v0.468.0 - ISC
88
88
  *
89
89
  * This source code is licensed under the ISC license.
90
90
  * See the LICENSE file in the root directory of this source tree.
91
- */const ei=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
91
+ */const ri=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
92
92
  * @license lucide-react v0.468.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const va=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
96
+ */const Ca=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
97
97
  * @license lucide-react v0.468.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */const ya=ye("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
101
+ */const Sa=ye("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
102
102
  * @license lucide-react v0.468.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const xa=ye("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
106
+ */const Ea=ye("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
107
107
  * @license lucide-react v0.468.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const ti=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
111
+ */const oi=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
112
112
  * @license lucide-react v0.468.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const 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"}]]);/**
116
+ */const Ra=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.
120
120
  * See the LICENSE file in the root directory of this source tree.
121
- */const Ea=ye("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
121
+ */const Ta=ye("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
122
122
  * @license lucide-react v0.468.0 - ISC
123
123
  *
124
124
  * This source code is licensed under the ISC license.
125
125
  * See the LICENSE file in the root directory of this source tree.
126
- */const Sa=ye("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
126
+ */const Ia=ye("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
127
127
  * @license lucide-react v0.468.0 - ISC
128
128
  *
129
129
  * This source code is licensed under the ISC license.
130
130
  * See the LICENSE file in the root directory of this source tree.
131
- */const wa=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
131
+ */const Oa=ye("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
132
132
  * @license lucide-react v0.468.0 - ISC
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 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"}]]);/**
136
+ */const Pa=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 ni=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
141
+ */const si=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 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"}]]);/**
146
+ */const ka=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 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"}]]);/**
151
+ */const _a=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 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"}]]);/**
156
+ */const Aa=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 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"}]]);/**
161
+ */const Na=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 _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"}]]);/**
166
+ */const Ma=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 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"}]]);/**
171
+ */const ja=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 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={};/**
176
+ */const Da=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:le("chat-message",t)})}function ii({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-avatar",className:le("chat-message-avatar",e)})}function Zr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-content",className:le("chat-message-content",e)})}function Fa({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-header",className:le("chat-message-header",e)})}function Rr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-footer",className:le("chat-message-footer",e)})}const ot={...y},Xo={};function Ze(e,t){const n=y.useRef(Xo);return n.current===Xo&&(n.current=e(t)),n}const fr=ot.useInsertionEffect,La=fr&&fr!==ot.useLayoutEffect?fr:e=>e();function fe(e){const t=Ze(Ba).current;return t.next=e,La(t.effect),t.trampoline}function Ba(){const e={next:void 0,callback:Va,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function Va(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}function Tr(e,t,n,r){const o=Ze(ci).current;return $a(o,e,t,n,r)&&ai(o,[e,t,n,r]),o.callback}function Ha(e){const t=Ze(ci).current;return Ua(t,e)&&ai(t,e),t.callback}function ci(){return{callback:null,cleanup:null,refs:[]}}function $a(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Ua(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function ai(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 Wa=parseInt(y.version,10);function li(e){return Wa>=e}function Qo(e){if(!y.isValidElement(e))return null;const t=e,n=t.props;return(li(19)?n==null?void 0:n.ref:t.ref)??null}function Ir(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let Or;process.env.NODE_ENV!=="production"&&(Or=new Set);function ui(e,t){return function(...r){if(process.env.NODE_ENV!=="production"){const o=r.join(" "),s=`${t}: ${o}`,i=`${e}:${s}`;Or.has(i)||(Or.add(i),e==="warn"?console.warn(s):console.error(s))}}}const eo=ui("warn","Base UI");function to(){}const qa=Object.freeze([]),Ve=Object.freeze({});function za(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 Ga(e,t){return typeof e=="function"?e(t):e}function fi(e,t){return typeof e=="function"?e(t):e}const di={};function no(e,t,n,r,o){if(!n&&!r&&!e)return An(t);let s=An(e);return t&&(s=In(s,t)),n&&(s=In(s,n)),r&&(s=In(s,r)),s}function Ka(e){if(e.length===0)return di;if(e.length===1)return An(e[0]);let t=An(e[0]);for(let n=1;n<e.length;n+=1)t=In(t,e[n]);return t}function An(e){return hi(e)?{...e(di)}:Ya(e)}function In(e,t){return hi(t)?t(e):Xa(e,t)}function Ya(e){const t={...e};for(const n in t){const r=t[n];pi(n,r)&&(t[n]=mi(r))}return t}function Xa(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Ir(e.style,r);break}case"className":{e[n]=gi(e.className,r);break}default:pi(n,r)?e[n]=Qa(e[n],r):e[n]=r}}return e}function pi(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 hi(e){return typeof e=="function"}function Qa(e,t){return t?e?(...n)=>{const r=n[0];if(bi(r)){const s=r;Nn(s);const i=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),i}const o=t(...n);return e==null||e(...n),o}:mi(t):e}function mi(e){return e&&((...t)=>{const n=t[0];return bi(n)&&Nn(n),e(...t)})}function Nn(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gi(e,t){return t?e?t+" "+e:t:e}function bi(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function mt(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=rl(r));const o=Ja(t,n,r);if(n.enabled===!1)return null;const s=n.state??Ve;return ol(e,r,o,s)}function Ja(e,t,n){const{className:r,style:o}=e,{state:s=Ve,ref:i,props:c,stateAttributesMapping:a,enabled:l=!0}=t,u=l?Ga(r,s):void 0,f=l?fi(o,s):void 0,h=l?za(s,a):Ve,m=l&&c?Za(c):void 0,d=l?Ir(h,m)??{}:Ve;return typeof document<"u"&&(l?Array.isArray(i)?d.ref=Ha([d.ref,Qo(n),...i]):d.ref=Tr(d.ref,Qo(n),i):Tr(null,null)),l?(u!==void 0&&(d.className=gi(d.className,u)),f!==void 0&&(d.style=Ir(d.style,f)),d):Ve}function Za(e){return Array.isArray(e)?Ka(e):no(void 0,e)}const el=Symbol.for("react.lazy"),tl=/^[A-Z][A-Za-z0-9$]*$/,nl=/[a-z]/;function rl(e){if((e==null?void 0:e.$$typeof)!==el)return e;const t=y.Children.toArray(e)[0];return y.isValidElement(t)?t:e}function ol(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&sl(t),t(n,r);const o=no(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 il(e,n)}function sl(e){const t=e.name;t.length!==0&&tl.test(t)&&nl.test(t)&&eo(`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 il(e,t){return e==="button"?O.createElement("button",{type:"button",...t,key:t.key}):e==="img"?O.createElement("img",{alt:"",...t,key:t.key}):y.createElement(e,t)}const Mn=ui("error","Base UI");function cl({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)&&Mn([`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)&&Mn([`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 vi(){const[,e]=y.useState({});return y.useCallback(()=>{e({})},[])}let Zo=0;function al(e,t="mui"){const n=y.useRef(void 0),r=vi(),o=e??n.current;return y.useEffect(()=>{n.current==null&&(Zo+=1,n.current=`${t}-${Zo}`,e==null&&r())},[e,t,r]),o}const es=ot.useId;function Kn(e,t){if(es!==void 0){const n=es();return e??(t?`${t}-${n}`:n)}return al(e,t)}function yi(e){return Kn(e,"base-ui")}function ke(e,t,n,r){let o=!1,s=!1;const i=Ve;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 xi="none",Yn="trigger-press",Ye="trigger-hover",On="trigger-focus",ll="outside-press",ul="focus-out",ro="escape-key",Pr="imperative-action",fl=()=>{},he=typeof document<"u"?y.useLayoutEffect:fl;function oo(e){y.useEffect(e,qa)}const hn=null;let ts=globalThis.requestAnimationFrame;class dl{constructor(){ce(this,"callbacks",[]);ce(this,"callbacksCount",0);ce(this,"nextId",1);ce(this,"startId",1);ce(this,"isScheduled",!1);ce(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"&&ts!==requestAnimationFrame&&(ts=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 mn=new dl;class Fe{constructor(){ce(this,"currentId",hn);ce(this,"cancel",()=>{this.currentId!==hn&&(mn.cancel(this.currentId),this.currentId=hn)});ce(this,"disposeEffect",()=>this.cancel)}static create(){return new Fe}static request(t){return mn.request(t)}static cancel(t){return mn.cancel(t)}request(t){this.cancel(),this.currentId=mn.request(()=>{this.currentId=hn,t()})}}function pl(){const e=Ze(Fe.create).current;return oo(e.disposeEffect),e}function wi(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),he(()=>{if(!e&&i&&o!=="ending"&&n){const a=Fe.request(()=>{s("ending")});return()=>{Fe.cancel(a)}}},[e,i,o,n]),he(()=>{if(!e||t||o===void 0)return;const a=Fe.request(()=>{s(void 0)});return()=>{Fe.cancel(a)}},[t,e,o]),he(()=>{if(!e||!t)return;e&&i&&o!=="idle"&&s("starting");const a=Fe.request(()=>{s("idle")});return()=>{Fe.cancel(a)}},[t,e,i,o]),{mounted:i,setMounted:c,transitionStatus:o}}function hl(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=cl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=wi(s,!0,!0),u=yi(),[f,h]=y.useState(),m=f===null?void 0:f??u,d=fe(g=>{const b=!s,v=ke(Yn,g.nativeEvent);r(b,v),!v.isCanceled&&i(b)});return y.useMemo(()=>({defaultPanelId:u,disabled:o,handleTrigger:d,mounted:c,open:s,panelId:m,setMounted:a,setOpen:i,setPanelIdState:h,transitionStatus:l}),[u,o,d,c,s,m,a,i,h,l])}function ml(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 Rt=ml("https://base-ui.com/production-error","Base UI"),so=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(so.displayName="CollapsibleRootContext");function Ci(){const e=y.useContext(so);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>.":Rt(15));return e}const io="data-starting-style",gl="data-ending-style",bl={[io]:""},vl={[gl]:""},co={transitionStatus(e){return e==="starting"?bl:e==="ending"?vl:null}},yl="data-open",xl="data-closed",gn=io,wl="data-panel-open",Cl={[yl]:""},Sl={[xl]:""},El={open(e){return e?{[wl]:""}:null}},Rl={open(e){return e?Cl:Sl}},Si={...Rl,...co},Ei=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=hl({open:a,defaultOpen:s,onOpenChange:f,disabled:i}),m=y.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),d=y.useMemo(()=>({...h,onOpenChange:f,state:m}),[h,f,m]),g=mt("div",t,{state:m,ref:n,props:u,stateAttributesMapping:Si});return p.jsx(so.Provider,{value:d,children:g})});process.env.NODE_ENV!=="production"&&(Ei.displayName="CollapsibleRoot");function Xn(){return typeof window<"u"}function He(e){return ao(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ct(e){var t;return(t=(ao(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ao(e){return Xn()?e instanceof Node||e instanceof Ne(e).Node:!1}function ge(e){return Xn()?e instanceof Element||e instanceof Ne(e).Element:!1}function je(e){return Xn()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function At(e){return!Xn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}function Qn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Tl(e){return/^(table|td|th)$/.test(He(e))}function Jn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Il=/transform|translate|scale|rotate|perspective|filter/,Ol=/paint|layout|strict|content/,vt=e=>!!e&&e!=="none";let dr;function lo(e){const t=ge(e)?We(e):e;return vt(t.transform)||vt(t.translate)||vt(t.scale)||vt(t.rotate)||vt(t.perspective)||!uo()&&(vt(t.backdropFilter)||vt(t.filter))||Il.test(t.willChange||"")||Ol.test(t.contain||"")}function Pl(e){let t=ft(e);for(;je(t)&&!lt(t);){if(lo(t))return t;if(Jn(t))return null;t=ft(t)}return null}function uo(){return dr==null&&(dr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dr}function lt(e){return/^(html|body|#document)$/.test(He(e))}function We(e){return Ne(e).getComputedStyle(e)}function Zn(e){return ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(He(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||ct(e);return At(t)?t.host:t}function Ri(e){const t=ft(e);return lt(t)?(e.ownerDocument||e).body:je(t)&&Qn(t)?t:Ri(t)}function Kt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ri(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ne(o);if(s){const c=kr(i);return t.concat(i,i.visualViewport||[],Qn(o)?o:[],c&&n?Kt(c):[])}else return t.concat(o,Kt(o,[],n))}function kr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ti=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ti.displayName="CompositeRootContext");function kl(e=!1){const t=y.useContext(Ti);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>.":Rt(16));return t}function _l(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 Je(e){return(e==null?void 0:e.ownerDocument)||document}function pr(e,t,{detail:n=0,pointerType:r=""}={}){e.dispatchEvent(new(Ne(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 Ii(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=y.useRef(null),c=kl(!0),a=s??c!==void 0,{props:l}=_l({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&y.useEffect(()=>{var d,g;if(!i.current)return;const m=bn(i.current);if(o){if(!m){const b=((d=ot.captureOwnerStack)==null?void 0:d.call(ot))||"";Mn(`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(m){const b=((g=ot.captureOwnerStack)==null?void 0:g.call(ot))||"";Mn(`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 m=i.current;bn(m)&&a&&t&&l.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,l.disabled,a]);he(u,[u]);const f=y.useCallback((m={})=>{const{onClick:d,onMouseDown:g,onKeyUp:b,onKeyDown:v,onPointerDown:x,...C}=m;return no({onClick(w){if(t){w.preventDefault();return}d==null||d(w)},onMouseDown(w){t||g==null||g(w)},onKeyDown(w){if(t||(Nn(w),v==null||v(w),w.baseUIHandlerPrevented))return;const E=w.target===w.currentTarget,S=w.currentTarget,R=bn(S),T=!o&&Al(S),P=E&&(o?R:!T),k=w.key==="Enter",M=w.key===" ",_=S.getAttribute("role"),D=(_==null?void 0:_.startsWith("menuitem"))||_==="option"||_==="gridcell";if(E&&a&&M){if(w.defaultPrevented&&D)return;w.preventDefault(),(!o||R)&&(w.preventBaseUIHandler(),pr(S,w));return}if(!P||o||!M&&!k){E&&T&&M&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),k&&(w.preventBaseUIHandler(),pr(S,w)))},onKeyUp(w){if(!t){if(Nn(w),b==null||b(w),w.target===w.currentTarget&&o&&a&&bn(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!o&&!a&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),pr(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}x==null||x(w)}},o?{type:"button"}:{role:"button"},l,C)},[t,l,a,o]),h=fe(m=>{i.current=m,u()});return{getButtonProps:f,buttonRef:h}}function bn(e){return je(e)&&e.tagName==="BUTTON"}function Al(e){return je(e)&&e.tagName==="A"&&!!e.href}const Nl={...El,...co},Oi=y.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=Ci(),{className:a,disabled:l=c,render:u,nativeButton:f=!0,style:h,...m}=t,{getButtonProps:d,buttonRef:g}=Ii({disabled:l,native:f});return mt("button",t,{state:i,ref:[n,g],props:[{"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s},m,d],stateAttributesMapping:Nl})});process.env.NODE_ENV!=="production"&&(Oi.displayName="CollapsibleTrigger");function Ce(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const Ut=0;class dt{constructor(){ce(this,"currentId",Ut);ce(this,"clear",()=>{this.currentId!==Ut&&(clearTimeout(this.currentId),this.currentId=Ut)});ce(this,"disposeEffect",()=>this.clear)}static create(){return new dt}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ut,n()},t)}isStarted(){return this.currentId!==Ut}}function qt(){const e=Ze(dt.create).current;return oo(e.disposeEffect),e}function Xe(e){const t=Ze(Ml,e).current;return t.next=e,he(t.effect),t}function Ml(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function jl(e){return e==null?e:"current"in e?e.current:e}function ns(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 vn=null;function Dl(e){if(!vn){const t=[];vn=t,queueMicrotask(()=>{vn=null,ht.flushSync(()=>{for(const n of t)n()})})}vn.push(e)}function Pi(e,t=!1,n=!1){const r=pl();return fe((o,s=null)=>{r.cancel();const i=jl(e);if(i==null)return;const c=i,a=()=>{if(!n){ht.flushSync(o);return}Dl(()=>{s!=null&&s.aborted||o()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(ns(c).map(u=>u.finished.then(to))).then(()=>{s!=null&&s.aborted||a()},()=>{if(s!=null&&s.aborted)return;if(ns(c).some(f=>f.pending||f.playState!=="finished")){l();return}a()})}if(t){const u=io;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 fo(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 Fl(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),[m,d]=y.useState(Ot),g=y.useRef(Ot),b=y.useRef(!1),v=y.useRef(c),x=y.useRef(!1),[C,w]=y.useState(!1),E=y.useRef(null),S=Tr(t,f),R=Xe(c),T=Pi(f),P=!c&&!s,k=C?"idle":u,M=c&&(v.current||x.current),_=!c&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?g.current:m,D=n&&P&&h.current!=="css-animation",N=fe((j,q=!0)=>{q&&(g.current=j),d(j)}),I=fe(()=>{var j;(j=E.current)==null||j.call(E),E.current=null}),F=fe(j=>{I(),E.current=()=>{E.current=null,j()}}),U=fe(()=>{c&&s&&h.current==="css-animation"&&(x.current=!0)});he(()=>{!C||u==="starting"||w(!1)},[C,u]),y.useEffect(()=>()=>{U(),I()},[U,I]),he(()=>{c||(v.current=!1,x.current=!1);const j=f.current;if(!j)return;!c&&E.current&&I();const q=Ll(j,M);if(h.current=q,c&&u==="idle"&&v.current&&q==="css-animation"){g.current=Pt(j);return}if(c&&u==="starting"){const re=b.current;if(b.current=!1,q==="none"){N(Pt(j)),w(!0);return}if(q==="css-transition"){const V=Bl(j);if(N(Pt(j)),!re)return V;const H=yn(j,"transition-duration","0s");return F(H),w(!0),V}N(Pt(j));const B=yn(j,"animation-name","none");if(!re){B();return}const G=yn(j,"animation-duration","0s");B(),F(G),w(!0);return}if(!c&&s&&(u==="idle"||u==="starting")){if(q==="none"){N(Ot,!1),a(!1);return}N(Pt(j));return}if(u!=="ending")return;if(q==="none"){a(!1);return}const z=Pt(j);if(!(z.height>0||z.width>0)){a(!1);return}N(z),q==="css-animation"&&yn(j,"animation-name","none")()},[s,c,I,N,a,F,M,u]),fo({enabled:c&&s&&k==="idle",open:!0,ref:f,onComplete(){c&&N(Ot,!1)}}),y.useEffect(()=>{if(c||!s||k!=="ending")return;if(!f.current){a(!1),N(Ot,!1);return}const q=new AbortController;let z=-1;function ae(){R.current||(a(!1),N(Ot,!1))}return z=Fe.request(()=>{T(ae,q.signal)}),()=>{Fe.cancel(z),q.abort()}},[R,s,c,k,T,N,a]),he(()=>{const j=f.current;!j||!n||!P||j.setAttribute("hidden","until-found")},[P,n]),y.useEffect(function(){const q=f.current;if(!q)return;const z=dt.create();let ae=-1;const re=(V,H)=>{z.start(0,()=>{R.current||(ae=Fe.request(()=>{R.current||(V&&(b.current=!1),H&&q.setAttribute(gn,""),q.setAttribute("hidden","until-found"))}))})},G=Ce(q,"beforematch",V=>{const H=ke(xi,V);if(i(!0,H),H.isCanceled){re(!1,!1);return}b.current=!0;const Z=q.hasAttribute(gn);q.removeAttribute(gn),l(!0),re(!0,Z)});return()=>{z.clear(),Fe.cancel(ae),G()}},[R,i,l]);const A=o||n||s||c;return{height:_.height,props:{...D?{[gn]:""}:void 0,hidden:P,id:r},ref:S,shouldPreventOpenAnimation:M,shouldRender:A,transitionStatus:k,width:_.width}}function Pt(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Ll(e,t){const n=Ne(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&rs(n.animationDuration),o=rs(n.transitionDuration);return r&&o?(process.env.NODE_ENV!=="production"&&eo("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 rs(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function yn(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Bl(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=Fe.request(n);return()=>{Fe.cancel(r),n()}}const Vl="--collapsible-panel-height",Hl="--collapsible-panel-width",ki=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&&eo("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:m,setMounted:d,setPanelIdState:g,setOpen:b,state:v,transitionStatus:x}=Ci(),C=o??!1,w=s??!1,E=c||void 0,S=E??u;he(()=>(g(U=>E??(U===null?void 0:U)),()=>{g(U=>U===E?null:U)}),[E,g]);const{height:R,props:T,ref:P,shouldPreventOpenAnimation:k,shouldRender:M,transitionStatus:_,width:D}=Fl({externalRef:n,hiddenUntilFound:C,id:S,keepMounted:w,mounted:f,onOpenChange:h,open:m,setMounted:d,setOpen:b,transitionStatus:x}),N={...v,transitionStatus:_},I=fi(a,N),F=mt("div",{...t,style:void 0},{state:N,ref:P,props:[T,{style:{[Vl]:R===void 0?"auto":`${R}px`,[Hl]:D===void 0?"auto":`${D}px`}},l,I?{style:I}:void 0,k?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Si});return M?F:null});process.env.NODE_ENV!=="production"&&(ki.displayName="CollapsiblePanel");function yt({className:e,...t}){return p.jsx("div",{"data-slot":"trace",className:le("trace",e),...t})}function Nt({className:e,status:t,...n}){return p.jsx("span",{"data-slot":"trace-line","data-status":t,className:le("trace-line",e),...n})}function Ct({className:e,...t}){return p.jsx("span",{"data-slot":"trace-icon",className:le("trace-icon",e),...t,"aria-hidden":"true"})}function Mt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-title",className:le("trace-title",e),...t})}function Yt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-description",className:le("trace-description",e),...t})}function _i(e){return p.jsx(Ei,{"data-slot":"trace-collapsible",...e})}function Ai({children:e,className:t,...n}){return p.jsxs(Oi,{type:"button","data-slot":"trace-collapsible-trigger",className:le("trace-trigger",t),...n,children:[e,p.jsx(Ct,{className:"trace-chevron",children:p.jsx(ti,{size:13})})]})}function Ni({className:e,...t}){return p.jsx(ki,{...t,"data-slot":"trace-collapsible-content",className:le("trace-content",e)})}const $l=({message:e,onRetry:t})=>p.jsx(Jr,{className:"chat-error-banner",role:"alert",children:p.jsxs(Zr,{children:[p.jsx(yt,{className:"chat-message-body",children:p.jsxs(Nt,{status:"error",children:[p.jsx(Ct,{children:p.jsx(xa,{size:14})}),p.jsx(Mt,{className:"chat-error-title",children:e})]})}),t&&p.jsx(Rr,{children:p.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Ul={alpha:{label:"Alpha",Icon:Sa,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:ka,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Ta,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:wa,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Wl=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Ul[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})]})},po="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",ql=({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(ma,{size:16})}),p.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:po,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(Wl,{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(Na,{size:16,"aria-hidden":"true"}):p.jsx(Ma,{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(Pa,{size:15})}),n&&p.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:p.jsx(Ia,{size:16})})]})]});function zl(e,t){const n=O.useRef(e);O.useEffect(()=>{var r;n.current&&!e&&((r=t.current)==null||r.focus()),n.current=e},[e,t])}function Gl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group",className:le("chat-input-group",e)})}function Kl({className:e,...t}){return p.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:le("chat-textarea",e)})}function Yl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group-addon",className:le("chat-input-actions",e)})}function os({className:e,...t}){return p.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:le("chat-send-btn",e)})}const Mi=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}=Ii({disabled:s,focusableWhenDisabled:i,native:c});return mt("button",t,{state:{disabled:s},ref:[n,f],props:[l,u]})});process.env.NODE_ENV!=="production"&&(Mi.displayName="Button");const ss=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,is=Qs,Xl=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return is(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=ss(u)||ss(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,...m}=u;return Object.entries(m).every(d=>{let[g,b]=d;return Array.isArray(b)?b.includes({...s,...c}[g]):{...s,...c}[g]===b})?[...l,f,h]:l},[]);return is(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},Ql=Xl("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 ho({className:e,variant:t,size:n,...r}){return p.jsx(Mi,{type:"button","data-slot":"button",...r,className:o=>le(Ql({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Jl({className:e,...t}){return p.jsx("div",{...t,className:le("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Zl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return p.jsx(ho,{...i,variant:o,size:s,className:c=>le("shrink-0",typeof r=="function"?r(c):r),onClick:()=>t==null?void 0:t(e),children:n??e})}function eu(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const tu=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?p.jsx(Jl,{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(Zl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,nu=({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}=tn(),[f,h]=O.useState(""),m=O.useRef(null),d=O.useId(),g=O.useId(),b=w=>{w&&(w.style.height="auto",w.style.height=`${Math.min(w.scrollHeight,96)}px`)};zl(n,m),O.useImperativeHandle(o,()=>({edit(w){var E;n||(h(w),(E=m.current)==null||E.focus())}}),[n]),O.useEffect(()=>{b(m.current)},[f]);const v=O.useMemo(()=>{if(!c||n)return[];const w=f.trim();return w?eu(s,w):i?s:[]},[n,i,c,s,f]),x=w=>{h(w.query);const E=m.current;E==null||E.focus()},C=()=>{const w=f.trim();!w||n||(e(w),h(""))};return p.jsxs("div",{className:"chat-input-wrapper",children:[p.jsx(tu,{variant:"badge",suggestions:v,onSelect:x,disabled:n}),p.jsxs("form",{onSubmit:w=>{w.preventDefault(),C()},children:[p.jsx("label",{htmlFor:d,className:"sr-only",children:"Chat message"}),p.jsxs(Gl,{children:[p.jsx(Kl,{id:d,ref:m,rows:1,value:f,disabled:n,placeholder:r,onChange:w=>h(w.target.value),onKeyDown:w=>{var E;w.key==="Enter"&&!w.shiftKey&&!w.nativeEvent.isComposing&&(w.preventDefault(),(E=w.currentTarget.form)==null||E.requestSubmit())}}),p.jsxs(Yl,{children:[a.length>1&&p.jsxs("div",{className:"chat-model-picker",children:[p.jsx("label",{htmlFor:g,className:"sr-only",children:"AI model"}),p.jsxs("select",{id:g,value:l,disabled:n,onChange:w=>u(w.target.value),children:[p.jsx("option",{value:"auto",children:"Automatic"}),a.map(w=>p.jsx("option",{value:w.id,disabled:!w.configured,children:w.label},w.id))]})]}),t?p.jsx(os,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:p.jsx(si,{size:13,fill:"currentColor","aria-hidden":"true"})}):p.jsx(os,{type:"submit",disabled:n||!f.trim(),"aria-label":"Send message",title:"Send message",children:p.jsx(ga,{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 ru({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(ou(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:nn(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]=nn(i,s):iu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=su(s,i):t[o]=s}}return t}function ou(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 su(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function iu(e){return/^on[A-Z]/.test(e)}function nn(...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 cu=8,au=64,lu=0,jn=.5,uu=180,fu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),ji={start:!1,end:!1},du=[],Dn={currentAnchorId:null,visibleMessageIds:du};function pu({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return ji;let o=mo({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function hu({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:s}){if(!e||!o)return Dn;let i=o.getBoundingClientRect(),c=i.top+t+n,a=typeof IntersectionObserver>"u",l=[],u=null;for(let f of Xt(e,r)){let h=f.dataset.messageId;if(!h)continue;let m=f.dataset.scrollAnchor==="true",d=m||a?f.getBoundingClientRect():null;(a&&d?d.bottom>c&&d.top<i.bottom:s.has(h))&&l.push(h),m&&d&&d.top<=c+jn&&(u=h)}return l.length===0&&u===null?Dn:{currentAnchorId:u,visibleMessageIds:l}}function Xt(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function mu(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 gu(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function bu(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 vu(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 yu({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of Xt(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 xu({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let s=Di(t,o),i=t.getBoundingClientRect().height,c=Su(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 Di(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Pn(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function wu({content:e,scrollTop:t,spacer:n,viewport:r}){let o=mo({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function mo({content:e,spacer:t,viewport:n}){let r=Xt(e,t),o=Fi(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 Cu(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Fi(e){let t=window.getComputedStyle(e);return{end:Ar(t.paddingBlockEnd||t.paddingBottom),start:Ar(t.paddingBlockStart||t.paddingTop)}}function Su(e){let t=e==null?void 0:e.parentElement;return t?Fi(t):{end:0,start:0}}function Eu(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return Ar(n)}function Ar(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Li(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 cs(e,t){return Li(e,t)}function Ru(){return Li(Dn,Iu)}function Tu(e,t){return e.start===t.start&&e.end===t.end}function Iu(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Ou({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),m=y.useRef(e?"following-bottom":"free-scrolling"),d=y.useRef(new Map),g=y.useRef(null),b=y.useRef(null),v=y.useRef(null),x=y.useRef(o),C=y.useRef(!0),w=y.useRef(null),E=y.useRef(r),S=y.useRef(null),R=y.useRef(0),T=y.useRef(0),P=y.useRef(null),k=y.useRef(null),M=y.useRef(null),_=y.useRef(null),D=y.useRef(null),N=y.useRef(null),I=y.useRef(null),F=y.useRef(null),U=y.useRef(null),A=y.useRef(new Set),j=y.useRef(new WeakSet);return M.current===null&&(M.current=cs(t==="end"||t==="last-anchor",(q,z)=>q===z)),_.current===null&&(_.current=cs(ji,Tu)),U.current===null&&(U.current=Ru()),s.current=e,l.current=n,E.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:m,pendingScrollFrameRef:S,pendingScrollToMessageRef:g,prependRestoreRef:b,preserveScrollOnPrependRef:C,pendingDefaultScrollStore:M.current,rootRef:w,scrollEdgeThresholdRef:l,scrollMarginRef:E,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:T,spacerRef:P,stateFrameRef:k,stateStore:_.current,viewportRef:N,visibilityFrameRef:I,visibilityObserverRef:F,visibilityStore:U.current,visibleMessageIdsRef:A,handledScrollAnchorsRef:j}}function Bi(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function kn(e){e.defaultScrollPositionAppliedRef.current=!0,Bi(e)}function Pu({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:m,scrollMarginRef:d,scrollPreviousItemPeekRef:g,spacerGapRef:b,spacerHeightRef:v,spacerRef:x,viewportRef:C}=e,w=y.useCallback(_=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==_&&(i.current=_,t()),_&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},uu))},[t]),E=y.useCallback(_=>{let D=x.current;if(!D)return;let N=Math.max(0,Math.ceil(_));v.current!==N&&(v.current=N,D.hidden=N===0,D.style.height=`${N}px`,D.style.marginTop=N>0?`${-b.current}px`:"")},[]),S=y.useCallback((_,{behavior:D="auto",autoscrolling:N=!1}={})=>{let I=C.current;if(!I)return;let F=Math.max(0,_);if(Math.abs(I.scrollTop-F)<=jn){I.scrollTop=F,t();return}N&&w(!0),I.scrollTo({top:F,behavior:D}),n()},[t,n,w]),R=y.useCallback(({behavior:_="auto"}={})=>C.current?(E(0),o.current=null,f.current="free-scrolling",S(0,{behavior:_}),r(),!0):!1,[r,S,E]),T=y.useCallback(({behavior:_="auto"}={})=>{let D=C.current;return D?(E(0),o.current=null,f.current=s.current?"following-bottom":"free-scrolling",S(Cu(D),{autoscrolling:!0,behavior:_}),r(),!0):!1},[r,S,E]),P=y.useCallback((_,{align:D="start",behavior:N="auto",scrollMargin:I=d.current}={},{keepPreviousPeek:F=!1}={})=>{let U=a.current,A=C.current;if(!U||!A||!U.contains(_))return!1;let j=xu({align:D,element:_,scrollMargin:F?I+g.current:I,spacer:x.current,viewport:A}),q=wu({content:U,scrollTop:j,spacer:x.current,viewport:A});return E(q),m.current={element:_,viewportTop:Pn(_,A)},f.current=F?"anchored-to-message":"settling-jump",o.current=F?_:null,S(j,{behavior:N}),r(),!0},[r,S,E]),k=y.useCallback(()=>{let _=o.current;return!_||!_.isConnected||f.current!=="anchored-to-message"?!1:P(_,{align:"start"},{keepPreviousPeek:!0})},[P]),M=y.useCallback((_,D)=>{let N=u.current.get(_);return N?(kn(e),P(N,D)?(h.current=null,!0):(h.current={messageId:_,options:D},!0)):l.current===0?(h.current={messageId:_,options:D},kn(e),!0):!1},[P]);return{flushPendingScrollToMessage:y.useCallback(()=>{let _=h.current;if(!_)return!1;let D=u.current.get(_.messageId);return!D||!P(D,_.options)?!1:(h.current=null,kn(e),!0)},[P]),reanchorToAnchoredMessage:k,scrollToElement:P,scrollToEnd:T,scrollToMessage:M,scrollToStart:R}}function as(e,t){return y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function ku({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=cu,scrollPreviousItemPeek:r=au,scrollMargin:o=lu}){let s=Ou({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:m,lastScrollTopRef:d,messageElementsRef:g,modeRef:b,pendingScrollFrameRef:v,pendingScrollToMessageRef:x,prependRestoreRef:C,preserveScrollOnPrependRef:w,pendingDefaultScrollStore:E,rootRef:S,scrollEdgeThresholdRef:R,scrollMarginRef:T,scrollPreviousItemPeekRef:P,spacerGapRef:k,spacerHeightRef:M,spacerRef:_,stateFrameRef:D,stateStore:N,viewportRef:I,visibilityFrameRef:F,visibilityObserverRef:U,visibilityStore:A,visibleMessageIdsRef:j,handledScrollAnchorsRef:q}=s,z=y.useRef(t);z.current!==t&&(z.current=t,f.current=!1);let ae=y.useCallback(W=>{let Q=S.current,X=I.current,ie=[W.start&&"start",W.end&&"end"].filter(Boolean).join(" "),Se=a.current;for(let de of[Q,X])de&&(ie?de.setAttribute("data-scrollable",ie):de.removeAttribute("data-scrollable"),de.toggleAttribute("data-autoscrolling",Se))},[]),re=y.useCallback(W=>{var ie;let Q=((ie=I.current)==null?void 0:ie.scrollTop)??0,X=Q<d.current-jn;d.current=Q,c.current&&!W.end&&b.current!=="settling-jump"&&b.current!=="anchored-to-message"?b.current="following-bottom":b.current==="following-bottom"&&W.end&&X&&!a.current&&(b.current="free-scrolling")},[]),B=y.useCallback(()=>{let W=pu({content:u.current,scrollEdgeThreshold:R.current,spacer:_.current,viewport:I.current});re(W);let Q=b.current==="following-bottom"?{...W,end:!1}:W;ae(Q),N.setSnapshot(Q)},[re,N,ae]),G=y.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,B()}))},[B]),V=y.useCallback(()=>{A.hasListeners()&&F.current===null&&(F.current=window.requestAnimationFrame(()=>{F.current=null,A.hasListeners()&&A.setSnapshot(hu({content:u.current,scrollMargin:T.current,scrollPreviousItemPeek:P.current,spacer:_.current,viewport:I.current,visibleMessageIds:j.current}))}))},[A]),{flushPendingScrollToMessage:H,reanchorToAnchoredMessage:Z,scrollToElement:oe,scrollToEnd:ee,scrollToMessage:te,scrollToStart:$}=Pu({refs:s,commitScrollState:B,scheduleStateCommit:G,scheduleVisibilitySync:V}),ne=y.useCallback(()=>{let W=C.current,Q=I.current;if(!W||!Q||!W.element.isConnected)return!1;let X=Pn(W.element,Q)-W.viewportTop;return Math.abs(X)<=jn?!1:(Q.scrollTop+=X,W.viewportTop=Pn(W.element,Q),G(),V(),!0)},[G,V]),se=y.useCallback(()=>{let W=u.current,Q=I.current;if(!W||!Q){C.current=null;return}let X=yu({content:W,spacer:_.current,viewport:Q});C.current=X?{element:X,viewportTop:Pn(X,Q)}:null},[]),be=y.useCallback(()=>{v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null,H()&&se()}))},[se,H]),ve=y.useCallback(()=>{if(!t||f.current||m.current===0)return!1;let W=!1;if(t==="last-anchor"){let Q=u.current,X=I.current,ie=Q&&X?vu(Xt(Q,_.current)):null;if(!Q||!X||!ie)W=ee({behavior:"auto"});else{let Se=Di(ie,X);W=mo({content:Q,spacer:_.current,viewport:X})-Se<=X.clientHeight?ee({behavior:"auto"}):oe(ie,{align:"start"},{keepPreviousPeek:!0})}}else W=t==="end"?ee({behavior:"auto"}):$({behavior:"auto"});return W?(kn(s),!0):!1},[t,oe,ee,$]),Oe=y.useCallback(()=>{let W=u.current;if(!W)return;let Q=Xt(W,_.current),X=m.current,ie=h.current;m.current=Q.length,h.current=Q[0]??null,(()=>{if(H())return;if(X===0){if(ve()||Q.length>0&&c.current&&ee({behavior:"auto"}))return;B(),V();return}let Se=ie?Q.indexOf(ie):-1;if(w.current&&Se>0){ne();return}if(Q.length>X){let de=mu(Q,X);if(de){if(c.current&&b.current==="following-bottom"&&bu(Q,X)){ee({behavior:"auto"});return}oe(de,{align:"start"},{keepPreviousPeek:!0}),q.current.add(de);return}}if(Q.length===X){let de=gu(Q,q.current);if(de){oe(de,{align:"start"},{keepPreviousPeek:!0}),q.current.add(de);return}}b.current==="following-bottom"&&c.current?ee({behavior:"auto"}):(B(),V())})(),se()},[ve,se,B,H,ne,V,oe,ee]),Ae=y.useCallback(()=>{if(b.current==="following-bottom"&&c.current){ee({behavior:"auto"});return}let W=M.current;if(Z()){c.current&&W>0&&M.current===0&&ee({behavior:"auto"});return}G(),V()},[Z,G,V,ee]),xe=y.useCallback(()=>{let W=I.current;if(!(!W||!A.hasListeners())){if(typeof IntersectionObserver>"u"){V();return}U.current||(U.current=new IntersectionObserver(Q=>{for(let X of Q){let ie=X.target.dataset.messageId;ie&&(X.isIntersecting?j.current.add(ie):j.current.delete(ie))}V()},{root:W,rootMargin:`${-(T.current+P.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),g.current.forEach(Q=>{var X;(X=U.current)==null||X.observe(Q)}),V()}},[V,A]),Me=y.useCallback(()=>{var W;F.current!==null&&(window.cancelAnimationFrame(F.current),F.current=null),(W=U.current)==null||W.disconnect(),U.current=null,j.current.clear(),A.setSnapshot(Dn)},[A]),Le=y.useCallback((W,Q,X)=>{var ie,Se,de;if(Q){g.current.set(W,Q),(ie=U.current)==null||ie.observe(Q),V(),((Se=x.current)==null?void 0:Se.messageId)===W&&be();return}X&&g.current.get(W)===X&&(g.current.delete(W),j.current.delete(W),(de=U.current)==null||de.unobserve(X),V())},[be,V]),K=y.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),J=y.useCallback(()=>ae(N.getSnapshot()),[N,ae]),ue=as(S,J),L=as(I,J),Y=y.useCallback(W=>{u.current=W},[]),Ee=y.useCallback(W=>{_.current=W,k.current=Eu((W==null?void 0:W.parentElement)??null)},[]),me=y.useCallback(()=>{B(),V(),se()},[se,B,V]),Re=y.useMemo(()=>({handleContentChange:Oe,handleResize:Ae,observeVisibility:xe,pendingDefaultScrollStore:E,preserveScrollOnPrependRef:w,scrollToEnd:ee,scrollToMessage:te,scrollToStart:$,setContentElement:Y,setRootElement:ue,setSpacerElement:Ee,setViewportElement:L,stateStore:N,syncAfterScroll:me,unobserveVisibility:Me,userScrollIntent:K,viewportRef:I,visibilityStore:A}),[Oe,Ae,xe,E,ee,te,$,Y,ue,Ee,L,N,me,Me,K,A]);return y.useLayoutEffect(()=>{ve()||m.current===0&&Bi(s)},[ve]),y.useEffect(()=>()=>{var W;D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),F.current!==null&&(window.cancelAnimationFrame(F.current),F.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),v.current!==null&&(window.cancelAnimationFrame(v.current),v.current=null),(W=U.current)==null||W.disconnect(),U.current=null},[]),y.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&m.current>0){ee({behavior:"auto"});return}B()},[e,B,ee]),{context:Re,registerMessage:Le}}function _u(e){let t=y.useRef(e);return t.current=e,t}var Vi=y.createContext(null),Hi=y.createContext(null);function rn(){let e=y.useContext(Vi);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Au(){let e=y.useContext(Hi);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Nu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=ku({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return p.jsx(Vi.Provider,{value:i,children:p.jsx(Hi.Provider,{value:c,children:t})})}function $i(){let{pendingDefaultScrollStore:e}=rn();return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Mu({children:e,...t}){let{setRootElement:n}=rn(),r=$i();return p.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function ju({"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:m,syncAfterScroll:d,userScrollIntent:g,viewportRef:b}=rn(),v=$i();h.current=i;let x=y.useCallback(R=>{var T;m(R),(T=nn(c))==null||T(R)},[c,m]);function C(R){d(),r==null||r(R)}function w(R){g(),s==null||s(R)}function E(R){g(),o==null||o(R)}function S(R){fu.has(R.key)&&g(),n==null||n(R)}return y.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let T=0,P=new ResizeObserver(()=>{window.cancelAnimationFrame(T),T=window.requestAnimationFrame(f)});return P.observe(R),()=>{window.cancelAnimationFrame(T),P.disconnect()}},[f,b]),p.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:S,onScroll:C,onTouchMove:E,onWheel:w,...u,...v?{"data-pending-scroll":""}:null,children:t})}function Du({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=rn(),u=y.useRef(null),f=y.useCallback(h=>{var m;u.current=h,a(h),(m=nn(n))==null||m(h)},[n,a]);return y.useLayoutEffect(()=>{let h=u.current;if(!h||(i(),typeof MutationObserver>"u"))return;let m=new MutationObserver(()=>{i()});return m.observe(h,{childList:!0}),()=>m.disconnect()},[i]),y.useEffect(()=>{let h=u.current;if(!h||typeof ResizeObserver>"u")return;let m=0,d=new ResizeObserver(()=>{window.cancelAnimationFrame(m),m=window.requestAnimationFrame(c)});return d.observe(h),()=>{window.cancelAnimationFrame(m),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 Fu({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Au(),s=y.useRef(null),i=y.useCallback(c=>{var l;let a=s.current;s.current=c,e&&o(e,c,a),(l=nn(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 Lu({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}=rn(),f=_u(r),h=y.useCallback(b=>u.subscribe(b),[u]),m=y.useCallback(()=>{let b=u.getSnapshot();return n==="start"?b.start:b.end},[n,u]),d=y.useSyncExternalStore(h,m,m),g=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 ru({defaultTagName:"button",props:_r({type:i,inert:!d,tabIndex:d?s:-1,children:t??p.jsxs("span",{children:["Scroll to ",n]}),onClick:g},c),render:o,state:{active:d,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Nu,Root:Mu,Viewport:ju,Content:Du,Item:Fu,Button:Lu};function Bu(e){return p.jsx(Ft.Provider,{...e})}function Vu({className:e,...t}){return p.jsx(Ft.Root,{"data-slot":"message-scroller",className:le("msg-scroller-root",e),...t})}function Hu({className:e,...t}){return p.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:le("msg-scroller-viewport",e),...t})}function $u({className:e,...t}){return p.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:le("msg-scroller-content",e),...t})}function ls({className:e,scrollAnchor:t=!1,...n}){return p.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:le("msg-scroller-item",e),...n})}function Uu({direction:e="end",className:t,children:n,...r}){return p.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:le("msg-scroller-btn",t),...r,children:n??p.jsxs(p.Fragment,{children:[p.jsx(ha,{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 Nr({align:e="start",variant:t="muted",className:n,...r}){return p.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:le("chat-bubble",n)})}function Mr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"bubble-content",className:le("chat-bubble-content",e)})}const Wu=()=>p.jsxs(Jr,{children:[p.jsx(ii,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(va,{size:15})}),p.jsx(Zr,{children:p.jsx(Nr,{children:p.jsx(Mr,{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a suggested question."})})})]});function Ui(){const[e,t]=O.useState("idle");O.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 qu({message:e,onFeedback:t}){const{status:n,copy:r}=Ui();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(Qr,{size:16,"aria-hidden":"true"}):p.jsx(ri,{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(Aa,{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(_a,{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 zu(e){return Object.prototype.toString.call(e)==="[object Object]"}function us(e){return zu(e)||Array.isArray(e)}function Gu(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function bo(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}`:!us(c)||!us(a)?c===a:bo(c,a)})}function fs(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Ku(e,t){if(e.length!==t.length)return!1;const n=fs(e),r=fs(t);return n.every((o,s)=>{const i=r[s];return bo(o,i)})}function vo(e){return typeof e=="number"}function jr(e){return typeof e=="string"}function er(e){return typeof e=="boolean"}function ds(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ie(e){return Math.abs(e)}function yo(e){return Math.sign(e)}function zt(e,t){return Ie(e-t)}function Yu(e,t){if(e===0||t===0||Ie(e)<=Ie(t))return 0;const n=zt(Ie(e),Ie(t));return Ie(n/e)}function Xu(e){return Math.round(e*100)/100}function Qt(e){return Jt(e).map(Number)}function Qe(e){return e[on(e)]}function on(e){return Math.max(0,e.length-1)}function xo(e,t){return t===on(e)}function ps(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function Jt(e){return Object.keys(e)}function Wi(e,t){return[e,t].reduce((n,r)=>(Jt(r).forEach(o=>{const s=n[o],i=r[o],c=ds(s)&&ds(i);n[o]=c?Wi(s,i):i}),n),{})}function Dr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Qu(e,t){const n={start:r,center:o,end:s};function r(){return 0}function o(a){return s(a)/2}function s(a){return t-a}function i(a,l){return jr(e)?n[e](a):e(t,a,l)}return{measure:i}}function Zt(){let e=[];function t(o,s,i,c={passive:!0}){let a;if("addEventListener"in o)o.addEventListener(s,i,c),a=()=>o.removeEventListener(s,i,c);else{const l=o;l.addListener(i),a=()=>l.removeListener(i)}return e.push(a),r}function n(){e=e.filter(o=>o())}const r={add:t,clear:n};return r}function Ju(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(){m(),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 m(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function d(){i=null,c=0}return{init:l,destroy:u,start:h,stop:m,update:n,render:r}}function Zu(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:g,width:b}=d;return r?g: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 St(e=0,t=0){const n=Ie(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 qi(e,t,n){const{constrain:r}=St(0,e),o=e+1;let s=i(t);function i(h){return n?Ie((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 qi(e,c(),n)}const f={get:c,set:a,add:l,clone:u};return f}function ef(e,t,n,r,o,s,i,c,a,l,u,f,h,m,d,g,b,v,x){const{cross:C,direction:w}=e,E=["INPUT","SELECT","TEXTAREA"],S={passive:!1},R=Zt(),T=Zt(),P=St(50,225).constrain(m.measure(20)),k={mouse:300,touch:400},M={mouse:500,touch:600},_=d?43:25;let D=!1,N=0,I=0,F=!1,U=!1,A=!1,j=!1;function q($){if(!x)return;function ne(be){(er(x)||x($,be))&&V(be)}const se=t;R.add(se,"dragstart",be=>be.preventDefault(),S).add(se,"touchmove",()=>{},S).add(se,"touchend",()=>{}).add(se,"touchstart",ne).add(se,"mousedown",ne).add(se,"touchcancel",Z).add(se,"contextmenu",Z).add(se,"click",oe,!0)}function z(){R.clear(),T.clear()}function ae(){const $=j?n:t;T.add($,"touchmove",H,S).add($,"touchend",Z).add($,"mousemove",H,S).add($,"mouseup",Z)}function re($){const ne=$.nodeName||"";return E.includes(ne)}function B(){return(d?M:k)[j?"mouse":"touch"]}function G($,ne){const se=f.add(yo($)*-1),be=u.byDistance($,!d).distance;return d||Ie($)<P?be:b&&ne?be*.5:u.byIndex(se.get(),0).distance}function V($){const ne=Dr($,r);j=ne,A=d&&ne&&!$.buttons&&D,D=zt(o.get(),i.get())>=2,!(ne&&$.button!==0)&&(re($.target)||(F=!0,s.pointerDown($),l.useFriction(0).useDuration(0),o.set(i),ae(),N=s.readPoint($),I=s.readPoint($,C),h.emit("pointerDown")))}function H($){if(!Dr($,r)&&$.touches.length>=2)return Z($);const se=s.readPoint($),be=s.readPoint($,C),ve=zt(se,N),Oe=zt(be,I);if(!U&&!j&&(!$.cancelable||(U=ve>Oe,!U)))return Z($);const Ae=s.pointerMove($);ve>g&&(A=!0),l.useFriction(.3).useDuration(.75),c.start(),o.add(w(Ae)),$.preventDefault()}function Z($){const se=u.byDistance(0,!1).index!==f.get(),be=s.pointerUp($)*B(),ve=G(w(be),se),Oe=Yu(be,ve),Ae=_-10*Oe,xe=v+Oe/50;U=!1,F=!1,T.clear(),l.useDuration(Ae).useFriction(xe),a.distance(ve,!d),j=!1,h.emit("pointerUp")}function oe($){A&&($.stopPropagation(),$.preventDefault(),A=!1)}function ee(){return F}return{init:q,destroy:z,pointerDown:ee}}function tf(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(Dr(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),m=s(f)-s(r)>170;return o=f,m&&(r=f),h}function l(f){if(!r||!o)return 0;const h=i(o)-i(r),m=s(f)-s(r),d=s(f)-s(o)>170,g=h/m;return m&&!d&&Ie(g)>.1?g:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function nf(){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 rf(e){function t(r){return e*(r/100)}return{measure:t}}function of(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 m(b){if(!s)return;l=h(e),u=r.map(h);function v(x){for(const C of x){if(f)return;const w=C.target===e,E=r.indexOf(C.target),S=w?l:u[E],R=h(w?e:r[E]);if(Ie(R-S)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(er(s)||s(b,x))&&v(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function d(){f=!0,a&&a.disconnect()}return{init:m,destroy:d}}function sf(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 T=0;return R?(i=0,n.set(r),e.set(r),T=S):(n.set(e),i+=S/a,i*=l,u+=i,e.add(i),T=u-f),c=yo(T),f=u,E}function m(){const S=r.get()-t.get();return Ie(S)<.001}function d(){return a}function g(){return c}function b(){return i}function v(){return C(o)}function x(){return w(s)}function C(S){return a=S,E}function w(S){return l=S,E}const E={direction:g,duration:d,velocity:b,seek:h,settled:m,useBaseFriction:x,useBaseDuration:v,useFriction:w,useDuration:C};return E}function cf(e,t,n,r,o){const s=o.measure(10),i=o.measure(50),c=St(.1,.99);let a=!1;function l(){return!(a||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(m){if(!l())return;const d=e.reachedMin(t.get())?"min":"max",g=Ie(e[d]-t.get()),b=n.get()-t.get(),v=c.constrain(g/i);n.subtract(b*v),!m&&Ie(b)<s&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(m){a=!m}return{shouldConstrain:l,constrain:u,toggleActive:f}}function af(e,t,n,r,o){const s=St(-t+e,0),i=f(),c=u(),a=h();function l(d,g){return zt(d,g)<=1}function u(){const d=i[0],g=Qe(i),b=i.lastIndexOf(d),v=i.indexOf(g)+1;return St(b,v)}function f(){return n.map((d,g)=>{const{min:b,max:v}=s,x=s.constrain(d),C=!g,w=xo(n,g);return C?v:w||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:g}=c;return i.slice(d,g)}return{snapsContained:a,scrollContainLimit:c}}function lf(e,t,n){const r=t[0],o=n?r-e:Qe(t);return{limit:St(o,r)}}function uf(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=St(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 m=e*(h*-1);r.forEach(d=>d.add(m))}return{loop:u}}function ff(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function df(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=f().map(t.measure),l=h(),u=m();function f(){return c(r).map(g=>Qe(g)[i]-g[0][s]).map(Ie)}function h(){return r.map(g=>n[s]-g[s]).map(g=>-Ie(g))}function m(){return c(l).map(g=>g[0]).map((g,b)=>g+a[b])}return{snaps:l,snapsAligned:u}}function pf(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=u();function u(){const h=i(s),m=!e||t==="keepSnaps";return n.length===1?[s]:m?h:h.slice(c,a).map((d,g,b)=>{const v=!g,x=xo(b,g);if(v){const C=Qe(b[0])+1;return ps(C)}if(x){const C=on(s)-Qe(b)[0]+1;return ps(C,Qe(b)[0])}return d})}return{slideRegistry:l}}function hf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(d){return d.concat().sort((g,b)=>Ie(g)-Ie(b))[0]}function l(d){const g=e?i(d):c(d),b=t.map((x,C)=>({diff:u(x-g,0),index:C})).sort((x,C)=>Ie(x.diff)-Ie(C.diff)),{index:v}=b[0];return{index:v,distance:g}}function u(d,g){const b=[d,d+n,d-n];if(!e)return d;if(!g)return a(b);const v=b.filter(x=>yo(x)===g);return v.length?a(v):Qe(b)-n}function f(d,g){const b=t[d]-o.get(),v=u(b,g);return{index:d,distance:v}}function h(d,g){const b=o.get()+d,{index:v,distance:x}=l(b),C=!e&&s(b);if(!g||C)return{index:v,distance:d};const w=t[v]-x,E=d+u(w,0);return{index:v,distance:E}}return{byDistance:h,byIndex:f,shortcut:u}}function mf(e,t,n,r,o,s,i){function c(f){const h=f.distance,m=f.index!==t.get();s.add(h),h&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),m&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function a(f,h){const m=o.byDistance(f,h);c(m)}function l(f,h){const m=t.clone().set(f),d=o.byIndex(m.get(),h);c(d)}return{distance:a,index:l}}function gf(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function u(m){if(!c)return;function d(g){if(new Date().getTime()-l>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(C=>C.includes(g));vo(x)&&(o.useDuration(0),r.index(x,0),i.emit("slideFocus"))}s.add(document,"keydown",f,!1),t.forEach((g,b)=>{s.add(g,"focus",v=>{(er(c)||c(m,v))&&d(b)},a)})}function f(m){m.code==="Tab"&&(l=new Date().getTime())}return{init:u}}function Wt(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 vo(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 m=Xu(e.direction(h));m!==o&&(r.transform=n(m),o=m)}function l(h){s=!h}function u(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function bf(e,t,n,r,o,s,i,c,a){const u=Qt(o),f=Qt(o).reverse(),h=v().concat(x());function m(R,T){return R.reduce((P,k)=>P-o[k],T)}function d(R,T){return R.reduce((P,k)=>m(P,T)>0?P.concat([k]):P,[])}function g(R){return s.map((T,P)=>({start:T-r[P]+.5+R,end:T+t-.5+R}))}function b(R,T,P){const k=g(T);return R.map(M=>{const _=P?0:-n,D=P?n:0,N=P?"end":"start",I=k[M][N];return{index:M,loopPoint:I,slideLocation:Wt(-1),translate:zi(e,a[M]),target:()=>c.get()>I?_:D}})}function v(){const R=i[0],T=d(f,R);return b(T,n,!1)}function x(){const R=t-i[0]-1,T=d(u,R);return b(T,-n,!0)}function C(){return h.every(({index:R})=>{const T=u.filter(P=>P!==R);return m(T,t)<=.1})}function w(){h.forEach(R=>{const{target:T,translate:P,slideLocation:k}=R,M=T();M!==k.get()&&(P.to(M),k.set(M))})}function E(){h.forEach(R=>R.translate.clear())}return{canLoop:C,clear:E,loop:w,loopPoints:h}}function vf(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||(er(n)||n(a,u))&&l(u)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),o=!0}return{init:s,destroy:i}}function yf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(d=>{a||(d.forEach(g=>{const b=t.indexOf(g.target);o[b]=g}),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((g,b)=>{const v=parseInt(b),{isIntersecting:x}=o[v];return(d&&x||!d&&!x)&&g.push(v),g},[])}function h(d=!0){if(d&&s)return s;if(!d&&i)return i;const g=f(d);return d&&(s=g),d||(i=g),g}return{init:l,destroy:u,get:h}}function xf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,u=d(),f=g(),h=n.map(i),m=b();function d(){if(!l)return 0;const x=n[0];return Ie(t[c]-x[c])}function g(){if(!l)return 0;const x=s.getComputedStyle(Qe(r));return parseFloat(x.getPropertyValue(`margin-${a}`))}function b(){return n.map((x,C,w)=>{const E=!C,S=xo(w,C);return E?h[C]+u:S?h[C]+f:w[C+1][c]-x[c]}).map(Ie)}return{slideSizes:h,slideSizesWithGaps:m,startGap:u,endGap:f}}function wf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:u,direction:f}=e,h=vo(n);function m(v,x){return Qt(v).filter(C=>C%x===0).map(C=>v.slice(C,C+x))}function d(v){return v.length?Qt(v).reduce((x,C,w)=>{const E=Qe(x)||0,S=E===0,R=C===on(v),T=o[l]-s[E][l],P=o[l]-s[C][u],k=!r&&S?f(i):0,M=!r&&R?f(c):0,_=Ie(P-M-(T+k));return w&&_>t+a&&x.push(C),R&&x.push(v.length),x},[]).map((x,C,w)=>{const E=Math.max(w[C-1]||0);return v.slice(E,x)}):[]}function g(v){return h?m(v,n):d(v)}return{groupSlides:g}}function Cf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:u,loop:f,duration:h,dragFree:m,dragThreshold:d,inViewThreshold:g,slidesToScroll:b,skipSnaps:v,containScroll:x,watchResize:C,watchSlides:w,watchDrag:E,watchFocus:S}=s,R=2,T=nf(),P=T.measure(t),k=n.map(T.measure),M=Zu(a,l),_=M.measureSize(P),D=rf(_),N=Qu(c,_),I=!f&&!!x,F=f||!!x,{slideSizes:U,slideSizesWithGaps:A,startGap:j,endGap:q}=xf(M,P,k,n,F,o),z=wf(M,_,b,f,P,k,j,q,R),{snaps:ae,snapsAligned:re}=df(M,N,P,k,z),B=-Qe(ae)+Qe(A),{snapsContained:G,scrollContainLimit:V}=af(_,B,re,x,R),H=I?G:re,{limit:Z}=lf(B,H,f),oe=qi(on(H),u,f),ee=oe.clone(),te=Qt(n),$=({dragHandler:W,scrollBody:Q,scrollBounds:X,options:{loop:ie}})=>{ie||X.constrain(W.pointerDown()),Q.seek()},ne=({scrollBody:W,translate:Q,location:X,offsetLocation:ie,previousLocation:Se,scrollLooper:de,slideLooper:_e,dragHandler:Te,animation:qe,eventHandler:$e,scrollBounds:nt,options:{loop:gt}},bt)=>{const Lt=W.settled(),ln=!nt.shouldConstrain(),Bt=gt?Lt:Lt&&ln,Vt=Bt&&!Te.pointerDown();Vt&&qe.stop();const un=X.get()*bt+Se.get()*(1-bt);ie.set(un),gt&&(de.loop(W.direction()),_e.loop()),Q.to(ie.get()),Vt&&$e.emit("settle"),Bt||$e.emit("scroll")},se=Ju(r,o,()=>$(Re),W=>ne(Re,W)),be=.68,ve=H[oe.get()],Oe=Wt(ve),Ae=Wt(ve),xe=Wt(ve),Me=Wt(ve),Le=sf(Oe,xe,Ae,Me,h,be),K=hf(f,H,B,Z,Me),J=mf(se,oe,ee,Le,K,Me,i),ue=ff(Z),L=Zt(),Y=yf(t,n,i,g),{slideRegistry:Ee}=pf(I,x,H,V,z,te),me=gf(e,n,Ee,J,Le,L,i,S),Re={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:P,slideRects:k,animation:se,axis:M,dragHandler:ef(M,e,r,o,Me,tf(M,o),Oe,se,J,Le,K,oe,i,D,m,d,v,be,E),eventStore:L,percentOfView:D,index:oe,indexPrevious:ee,limit:Z,location:Oe,offsetLocation:xe,previousLocation:Ae,options:s,resizeHandler:of(t,i,o,n,M,C,T),scrollBody:Le,scrollBounds:cf(Z,xe,Me,Le,D),scrollLooper:uf(B,Z,xe,[Oe,xe,Ae,Me]),scrollProgress:ue,scrollSnapList:H.map(ue.get),scrollSnaps:H,scrollTarget:K,scrollTo:J,slideLooper:bf(M,_,B,U,A,ae,H,xe,n),slideFocus:me,slidesHandler:vf(t,i,w),slidesInView:Y,slideIndexes:te,slideRegistry:Ee,slidesToScroll:z,target:Me,translate:zi(M,t)};return Re}function Sf(){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 Ef={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 Rf(e){function t(s,i){return Wi(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 Tf(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 Fn(e,t,n){const r=e.ownerDocument,o=r.defaultView,s=Rf(o),i=Tf(s),c=Zt(),a=Sf(),{mergeOptions:l,optionsAtMedia:u,optionsMediaQueries:f}=s,{on:h,off:m,emit:d}=a,g=M;let b=!1,v,x=l(Ef,Fn.globalOptions),C=l(x),w=[],E,S,R;function T(){const{container:te,slides:$}=C;S=(jr(te)?e.querySelector(te):te)||e.children[0];const se=jr($)?S.querySelectorAll($):$;R=[].slice.call(se||S.children)}function P(te){const $=Cf(e,S,R,r,o,te,a);if(te.loop&&!$.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return P(ne)}return $}function k(te,$){b||(x=l(x,te),C=u(x),w=$||w,T(),v=P(C),f([x,...w.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",M)),C.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),E=i.init(ee,w)))}function M(te,$){const ne=z();_(),k(l({startIndex:ne},te),$),a.emit("reInit")}function _(){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.emit("destroy"),a.clear())}function N(te,$,ne){!C.active||b||(v.scrollBody.useBaseFriction().useDuration($===!0?0:C.duration),v.scrollTo.index(te,ne||0))}function I(te){const $=v.index.add(1).get();N($,te,-1)}function F(te){const $=v.index.add(-1).get();N($,te,1)}function U(){return v.index.add(1).get()!==z()}function A(){return v.index.add(-1).get()!==z()}function j(){return v.scrollSnapList}function q(){return v.scrollProgress.get(v.offsetLocation.get())}function z(){return v.index.get()}function ae(){return v.indexPrevious.get()}function re(){return v.slidesInView.get()}function B(){return v.slidesInView.get(!1)}function G(){return E}function V(){return v}function H(){return e}function Z(){return S}function oe(){return R}const ee={canScrollNext:U,canScrollPrev:A,containerNode:Z,internalEngine:V,destroy:D,off:m,on:h,emit:d,plugins:G,previousScrollSnap:ae,reInit:g,rootNode:H,scrollNext:I,scrollPrev:F,scrollProgress:q,scrollSnapList:j,scrollTo:N,selectedScrollSnap:z,slideNodes:oe,slidesInView:re,slidesNotInView:B};return k(t,n),setTimeout(()=>a.emit("init"),0),ee}Fn.globalOptions=void 0;function wo(e={},t=[]){const n=O.useRef(e),r=O.useRef(t),[o,s]=O.useState(),[i,c]=O.useState(),a=O.useCallback(()=>{o&&o.reInit(n.current,r.current)},[o]);return O.useEffect(()=>{bo(n.current,e)||(n.current=e,a())},[e,a]),O.useEffect(()=>{Ku(r.current,t)||(r.current=t,a())},[t,a]),O.useEffect(()=>{if(Gu()&&i){Fn.globalOptions=wo.globalOptions;const l=Fn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}wo.globalOptions=void 0;const Fr=[];let Lr;function If(){return Lr}function Of(e){Fr.push(e)}function Gi(e){const t=(n,r)=>{const o=Ze(kf).current;let s;try{Lr=o;for(const i of Fr)i.before(o);s=e(n,r);for(const i of Fr)i.after(o);o.didInitialize=!0}finally{Lr=void 0}return s};return t.displayName=e.displayName||e.name,t}function Pf(e){return y.forwardRef(Gi(e))}function kf(){return{didInitialize:!1}}function _f(){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:Af,platform:Nf,maxTouchPoints:Mf}=_f(),tr=Af.toLowerCase(),en=Nf.toLowerCase(),Ki=/^i(os$|p)/.test(en)||en==="macintel"&&Mf>1,hs="android",jf=en===hs||tr.includes(hs),Yi=!Ki&&en.startsWith("mac");en.startsWith("win");const Df=Yi||Ki;var qs;const sn=typeof CSS<"u"&&!!((qs=CSS.supports)!=null&&qs.call(CSS,"-webkit-backdrop-filter:none"));!sn&&tr.includes("firefox");!sn&&tr.includes("chrom");const Ff=Df,Lf=/jsdom|happydom/.test(tr);function Bf(e){return"nativeEvent"in e}function Vf(e){return e.pointerType===""&&e.isTrusted?!0:jf&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Br(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Hf(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Vr(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 Pe(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 Hr(e,t){let n=e;for(;n;){if(ge(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(At(n)?n.host:null)}return null}function xt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const $f="data-base-ui-focusable",Xi="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Uf="data-open",Wf="data-closed",qf="data-anchor-hidden",zf="data-popup-open",Gf={[zf]:""},Kf={[Uf]:""},Yf={[Wf]:""},Xf={[qf]:""},Qf={open(e){return e?Gf:null}},Qi={open(e){return e?Kf:Yf},anchorHidden(e){return e?Xf:null}},Jf={...Qi,...co},ms="data-trigger-disabled";function Ln(e,t){if(!ge(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(ms);for(const[,r]of t.entries())if(Pe(r,n))return!r.hasAttribute(ms);return!1}function hr(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 Zf(e){return e.matches("html,body")}function ed(e){return je(e)&&e.matches(Xi)}function td(e){return Hr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Xi}`)!=null}function nd(e){if(!e||Lf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function rd(e,t){return t!=null&&!Br(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=rd(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function gs(e){return typeof e=="function"?e():e}function Ji(e,t){return t||e==="click"||e==="mousedown"}function od(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}function ut(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}const sd={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},id={...sd,position:"fixed",margin:0,top:0,left:0},Ur=y.forwardRef(function(t,n){const[r,o]=y.useState();he(()=>{Ff&&sn&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:id,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Ur.displayName="FocusGuard");const jt=Math.min,st=Math.max,Bn=Math.round,xn=Math.floor,it=e=>({x:e,y:e}),cd={left:"right",right:"left",bottom:"top",top:"bottom"};function Zi(e,t,n){return st(e,jt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Ue(e){return e.split("-")[0]}function tt(e){return e.split("-")[1]}function Co(e){return e==="x"?"y":"x"}function So(e){return e==="y"?"height":"width"}function Ge(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Eo(e){return Co(Ge(e))}function ad(e,t,n){n===void 0&&(n=!1);const r=tt(e),o=Eo(e),s=So(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Vn(i)),[i,Vn(i)]}function ld(e){const t=Vn(e);return[Wr(e),t,Wr(t)]}function Wr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const bs=["left","right"],vs=["right","left"],ud=["top","bottom"],fd=["bottom","top"];function dd(e,t,n){switch(e){case"top":case"bottom":return n?t?vs:bs:t?bs:vs;case"left":case"right":return t?ud:fd;default:return[]}}function pd(e,t,n,r){const o=tt(e);let s=dd(Ue(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Wr)))),s}function Vn(e){const t=Ue(e);return cd[t]+e.slice(t.length)}function hd(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 ec(e){return typeof e!="number"?hd(e):{top:e,right:e,bottom:e,left:e}}function Hn(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 md(e){return e.visibility==="hidden"||e.visibility==="collapse"}function gd(e,t=e?We(e):null){return!e||!e.isConnected||!t||md(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const bd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function vd(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 qr(e){for(const t of Array.from(e.children))if(He(t)==="summary")return t;return null}function yd(e,t){const n=qr(t);return!!n&&(e===n||Pe(n,e))}function tc(e){const t=e?He(e):"";return e!=null&&e.matches(bd)&&(t!=="summary"||e.parentElement!=null&&He(e.parentElement)==="details"&&qr(e.parentElement)===e)&&(t!=="details"||qr(e)==null)&&(t!=="input"||e.type!=="hidden")}function xd(e){if(!tc(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=vd(t)){const n=t!==e,r=He(t)==="slot";if(t.hasAttribute("inert")||n&&He(t)==="details"&&!t.open&&!yd(e,t)||t.hasAttribute("hidden")||!r&&!wd(t,n))return!1}return!0}function wd(e,t){const n=We(e);return t?n.display!=="none":gd(e,n)}function Cd(e){const t=e.tabIndex;if(t<0){const n=He(e);if(n==="details"||n==="audio"||n==="video"||je(e)&&e.isContentEditable)return 0}return t}function mr(e){if(He(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Sd(e,t){const n=mr(e);if(!n)return!0;const r=t.find(o=>{const s=mr(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=mr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function nc(e){if(je(e)&&He(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return je(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function rc(e,t){nc(e).forEach(n=>{tc(n)&&t.push(n),rc(n,t)})}function oc(e,t,n){nc(e).forEach(r=>{je(r)&&r.matches(t)&&n.push(r),oc(r,t,n)})}function Ed(e){const t=[];return rc(e,t),t.filter(xd)}function sc(e){const t=Ed(e);return t.filter(n=>Cd(n)>=0&&Sd(n,t))}function ic(e,t){const n=sc(e),r=n.length;if(r===0)return;const o=Vr(Je(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Rd(e){return ic(Je(e).body,1)||e}function Td(e){return ic(Je(e).body,-1)||e}function gr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Pe(n,r)}function Id(e){sc(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ys(e){const t=[];oc(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 Ro(e){return`data-base-ui-${e}`}const Od={style:{transition:"none"}},Pd={fallbackAxisSide:"end"},kd={clipPath:"inset(50%)",position:"fixed",top:0,left:0},To=y.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="PortalContext");const _d=()=>y.useContext(To),Ad=Ro("portal");function cc(e={}){const{ref:t,container:n,componentProps:r=Ve,elementProps:o}=e,s=Kn(),i=_d(),c=i==null?void 0:i.portalNode,[a,l]=y.useState(null),[u,f]=y.useState(null),h=fe(b=>{b!==null&&f(b)}),m=y.useRef(null);he(()=>{if(n===null){m.current&&(m.current=null,f(null),l(null));return}const b=(n&&(ao(n)?n:n.current))??c??document.body;if(b==null){m.current&&(m.current=null,f(null),l(null));return}m.current!==b&&(m.current=b,f(null),l(b))},[n,c]);const d=mt("div",r,{ref:[t,h],props:[{id:s,[Ad]:""},o]}),g=a&&d?ht.createPortal(d,a):null;return{node:u,nodeId:y.isValidElement(d)?d.props.id:void 0,subtree:g}}const Nd=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}=cc({container:c,ref:n,componentProps:t,elementProps:l}),m=y.useRef(null),d=y.useRef(null),g=y.useRef(null),b=y.useRef(null),[v,x]=y.useState(null),C=y.useRef(!1),w=v==null?void 0:v.modal,E=v==null?void 0:v.open,S=!!v&&!v.modal&&v.open&&!!u;y.useEffect(()=>{if(!u||w)return;function T(P){u&&P.relatedTarget&&gr(P)&&(P.type==="focusin"?C.current&&(ys(u),C.current=!1):(Id(u),C.current=!0))}return ut(Ce(u,"focusin",T,!0),Ce(u,"focusout",T,!0))},[u,w]),he(()=>{!u||E!==!0||!C.current||(ys(u),C.current=!1)},[E,u]);const R=y.useMemo(()=>({beforeOutsideRef:m,afterOutsideRef:d,beforeInsideRef:g,afterInsideRef:b,portalNode:u,setFocusManagerState:x}),[u]);return p.jsxs(y.Fragment,{children:[h,p.jsxs(To.Provider,{value:R,children:[S&&u&&p.jsx(Ur,{"data-type":"outside",ref:m,onFocus:T=>{var P;if(gr(T,u))(P=g.current)==null||P.focus();else{const k=v?v.domReference:null,M=Td(k);M==null||M.focus()}}}),S&&u&&p.jsx("span",{role:a,"aria-owns":f,style:kd}),u&&ht.createPortal(i,u),S&&u&&p.jsx(Ur,{"data-type":"outside",ref:d,onFocus:T=>{var P;if(gr(T,u))(P=b.current)==null||P.focus();else{const k=v?v.domReference:null,M=Rd(k);M==null||M.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,ke(ul,T.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Nd.displayName="FloatingPortal");function ac(){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 Md{constructor(){ce(this,"nodesRef",{current:[]});ce(this,"events",ac())}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 Io=y.createContext(null);process.env.NODE_ENV!=="production"&&(Io.displayName="FloatingNodeContext");const Oo=y.createContext(null);process.env.NODE_ENV!=="production"&&(Oo.displayName="FloatingTreeContext");const nr=()=>{var e;return((e=y.useContext(Io))==null?void 0:e.id)||null},cn=e=>{const t=y.useContext(Oo);return e??t};function jd(e){const t=Kn(),n=cn(e),r=nr();return he(()=>{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 Dd(e){const{children:t,id:n}=e,r=nr();return p.jsx(Io.Provider,{value:y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Fd(e){const{children:t,externalTree:n}=e,r=Ze(()=>n??new Md).current;return p.jsx(Oo.Provider,{value:r,children:t})}function Ld(){return!1}function Bd(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 Vd(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=Ld,bubbles:c,externalTree:a}=t,l=e.useState("open"),u=e.useState("floatingElement"),{dataRef:f,events:h}=e.context,m=cn(a),d=fe(typeof o=="function"?o:()=>!1),g=typeof o=="function"?d:o,b=g!==!1,v=fe(()=>s),{escapeKey:x,outsidePress:C}=Bd(c),w=y.useRef(!1),E=y.useRef(!1),S=y.useRef(!1),R=y.useRef(!1),T=y.useRef(!1),P=y.useRef(""),k=y.useRef(null),M=qt(),_=qt(),D=qt(),N=fe(()=>{_.clear(),f.current.insideReactTree=!1}),I=fe(B=>{var H;const G=(H=f.current.floatingContext)==null?void 0:H.nodeId;return(m?Dt(m.nodesRef.current,G):[]).some(Z=>{var oe;return((oe=Z.context)==null?void 0:oe.open)&&!Z.context.dataRef.current[B]})}),F=fe(B=>hr(B,e.select("floatingElement"))||hr(B,e.select("domReferenceElement"))),U=fe(B=>{i()&&e.setOpen(!1,ke(Yn,B.nativeEvent))}),A=fe(B=>{if(!l||!n||!r||B.key!=="Escape")return;const G=Bf(B)?B.nativeEvent:B;if(T.current||G.isComposing||!x&&I("__escapeKeyBubbles"))return;const V=ke(ro,G);e.setOpen(!1,V),V.isCanceled||B.preventDefault(),!x&&!V.isPropagationAllowed&&B.stopPropagation()}),j=fe(()=>{f.current.insideReactTree=!0,_.start(0,N)}),q=fe(B=>{if(!l||!n||B.button!==0)return;const G=xt(B.nativeEvent);Pe(e.select("floatingElement"),G)&&(w.current||(w.current=!0,E.current=!1))}),z=fe(B=>{!l||!n||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&w.current&&(E.current=!0)});y.useEffect(()=>{function B(G){G.open||(R.current=!1)}return h.on("openchange",B),()=>{h.off("openchange",B)}},[h]),y.useEffect(()=>N,[N]),y.useEffect(()=>{if(!l||!n)return l||(R.current=!1,T.current=!1,P.current="",k.current=null),N;f.current.__escapeKeyBubbles=x,f.current.__outsidePressBubbles=C;const B=new dt,G=Je(u);function V(){D.clear(),T.current=!0}function H(){T.current=!0,D.start(sn?5:0,()=>{T.current=!1})}function Z(){S.current=!0,B.start(0,()=>{S.current=!1})}function oe(){w.current=!1,E.current=!1}function ee(){const L=P.current,Y=L==="pen"||!L?"mouse":L,Ee=v(),me=typeof Ee=="function"?Ee():Ee;return typeof me=="string"?me:me[Y]}function te(L){const Y=ee();return Y==="intentional"&&L.type!=="click"||Y==="sloppy"&&L.type==="click"}function $(L){var me;const Y=(me=f.current.floatingContext)==null?void 0:me.nodeId,Ee=m&&Dt(m.nodesRef.current,Y).some(Re=>{var W;return hr(L,(W=Re.context)==null?void 0:W.elements.floating)});return F(L)||Ee}function ne(L){if(te(L)){L.type!=="click"&&!F(L)&&(B.clear(),S.current=!1),N();return}if(f.current.insideReactTree){N();return}const Y=xt(L),Ee=`[${Ro("inert")}]`,me=ge(Y)?Y.getRootNode():null,Re=Array.from((At(me)?me:Je(e.select("floatingElement"))).querySelectorAll(Ee)),W=e.context.triggerElements;if(Y&&(W.hasElement(Y)||W.hasMatchingElement(X=>Pe(X,Y))))return;let Q=ge(Y)?Y:null;for(;Q&&!lt(Q);){const X=ft(Q);if(lt(X)||!ge(X))break;Q=X}if(!(Re.length&&ge(Y)&&!Zf(Y)&&!Pe(Y,e.select("floatingElement"))&&Re.every(X=>!Pe(Q,X)))){if(je(Y)&&!("touches"in L)){const X=lt(Y),ie=We(Y),Se=/auto|scroll/,de=X||Se.test(ie.overflowX),_e=X||Se.test(ie.overflowY),Te=de&&Y.clientWidth>0&&Y.scrollWidth>Y.clientWidth,qe=_e&&Y.clientHeight>0&&Y.scrollHeight>Y.clientHeight,$e=ie.direction==="rtl",nt=qe&&($e?L.offsetX<=Y.offsetWidth-Y.clientWidth:L.offsetX>Y.clientWidth),gt=Te&&L.offsetY>Y.clientHeight;if(nt||gt)return}if(!$(L)){if(ee()==="intentional"){if(L.detail!==0&&!Vf(L)&&!R.current)return;if(S.current){B.clear(),S.current=!1;return}}typeof g=="function"&&!g(L)||I("__outsidePressBubbles")||(e.setOpen(!1,ke(ll,L)),N())}}}function se(L){ee()!=="sloppy"||L.pointerType==="touch"||!e.select("open")||!n||F(L)||ne(L)}function be(L){if(ee()!=="sloppy"||!e.select("open")||!n||F(L))return;const Y=L.touches[0];Y&&(k.current={startTime:Date.now(),startX:Y.clientX,startY:Y.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},M.start(1e3,()=>{k.current&&(k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1)}))}function ve(L,Y){const Ee=xt(L);if(!Ee)return;const me=Ce(Ee,L.type,()=>{Y(L),me()})}function Oe(L){P.current="touch",ve(L,be)}function Ae(L){M.clear(),L.type==="pointerdown"&&(L.button===0&&(R.current=!0),P.current=L.pointerType),!(L.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)&&ve(L,Y=>{Y.type==="pointerdown"?se(Y):ne(Y)})}function xe(L){if(L.type==="pointercancel"&&(R.current=!1),!w.current)return;const Y=E.current;if(oe(),ee()==="intentional"){if(L.type==="pointercancel"){Y&&Z();return}if(!$(L)){if(Y){Z();return}typeof g=="function"&&!g(L)||(B.clear(),S.current=!0,N())}}}function Me(L){if(ee()!=="sloppy"||!k.current||F(L))return;const Y=L.touches[0];if(!Y)return;const Ee=Math.abs(Y.clientX-k.current.startX),me=Math.abs(Y.clientY-k.current.startY),Re=Math.sqrt(Ee*Ee+me*me);Re>5&&(k.current.dismissOnTouchEnd=!0),Re>10&&(ne(L),M.clear(),k.current=null)}function Le(L){ve(L,Me)}function K(L){ee()!=="sloppy"||!k.current||F(L)||(k.current.dismissOnTouchEnd&&ne(L),M.clear(),k.current=null)}function J(L){ve(L,K)}const ue=ut(r&&ut(Ce(G,"keydown",A),Ce(G,"compositionstart",V),Ce(G,"compositionend",H)),b&&ut(Ce(G,"click",Ae,!0),Ce(G,"pointerdown",Ae,!0),Ce(G,"pointerup",xe,!0),Ce(G,"pointercancel",xe,!0),Ce(G,"mousedown",Ae,!0),Ce(G,"mouseup",xe,!0),Ce(G,"touchstart",Oe,{capture:!0,passive:!0}),Ce(G,"touchmove",Le,{capture:!0,passive:!0}),Ce(G,"touchend",J,{capture:!0,passive:!0})));return()=>{ue(),B.clear(),oe(),S.current=!1}},[f,u,r,b,g,l,n,x,C,A,N,v,I,F,m,e,M,D]);const ae=y.useMemo(()=>({onKeyDown:A,onPointerDown:U,onClick:U}),[A,U]),re=y.useMemo(()=>({onKeyDown:A,onPointerDown:z,onMouseDown:z,onClickCapture:j,onMouseDownCapture(B){j(),q(B)},onPointerDownCapture(B){j(),q(B)},onMouseUpCapture:j,onTouchEndCapture:j,onTouchMoveCapture:j}),[A,j,q,z]);return y.useMemo(()=>n?{reference:ae,floating:re,trigger:ae}:{},[n,ae,re])}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 Hd(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function lc(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(Hd(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 uc(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function xs(e){return $n(e.left,e.top,e.right,e.bottom)}function $d(e,t,n){const{lines:r}=lc(e.getClientRects());if(r.length<2)return;const o=uc(r,t,n);return{x:t,y:n,lineIndex:o===-1?void 0:o,element:e}}function Ud(e,t,n){const{lines:r,fallback:o}=lc(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 xs(r[n.lineIndex]);if(s!=null&&i!=null){const d=uc(r,s,i);if(d!==-1)return xs(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],g=r[r.length-1],b=c==="t"?d:g;return $n(b.left,d.top,b.right,g.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],m=r[0];for(const d of r){l=Math.min(l,d.left),u=Math.max(u,d.right);const g=a?d.left:d.right;a&&g<f||!a&&g>f?(f=g,h=d,m=d):g===f&&(m=d)}return $n(l,h.top,u,m.bottom)}function Wd(e){return"contextElement"in e&&e.contextElement?e.contextElement:ge(e)?e:void 0}function qd(e,t){function n(o){fc(e,o.currentTarget,o.clientX,o.clientY)}function r(o){t||n(o)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function fc(e,t,n,r){const o=$d(t,n,r);return e.current=o,o}function zd(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Wd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Ud(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 Gd{constructor(t,n,r=!0){ce(this,"attachedStores",[]);ce(this,"attachedStoreValue",null);ce(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=Fe.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.`:Rt(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,ke(Pr,void 0,r))}closePopup(){const t=this.attachedStore;if(t===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);return}t.setOpen(!1,ke(Pr))}}function Kd(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),he(()=>{const f={open:c,floatingId:o,referenceElement:a,floatingElement:l};ge(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 Yd(e){const{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:o,onUnmount:s,animateInitialOpen:i}=e,c=fe(o),{mounted:a,setMounted:l,transitionStatus:u}=wi(t,!1,!1,i),f=t?!1:r;he(()=>{t&&c(!1)},[t,c]);const h=y.useRef(a),m=y.useRef(!1),d=vi(),g=()=>{h.current=!1,l(!1),s()};he(()=>{h.current=a,m.current&&(m.current=!1,!t&&a&&g())});const b=fe(()=>{if(h.current){if(t){m.current=!0,d();return}g()}});return fo({enabled:a&&!t&&!f,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:u,preventUnmountingOnClose:f,forceUnmount:b}}const Xd={tabIndex:-1,[$f]:""};function Qd(e,t=!1){const n=Kn(),r=nr()!=null,o=Ze(()=>e(n,r)).current;return Kd({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Jd({handle:e,store:t}){return he(()=>e.attachStore(t),[e,t]),null}function ws(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Zd(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),ws(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ws(t))})}function ep(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 tp(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function np(e,t,n,r={}){var u,f,h;const o=n.reason,s=o===Ye,i=t&&o===On,c=!t&&(o===Yn||o===ro),a=tp(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 m=ep(e.state,t,n.trigger,a()),d={...r.extraState,...m};i?d.instantType="focus":c?d.instantType="dismiss":s&&(d.instantType=void 0),e.update(d)};s?ht.flushSync(l):l()}function rp(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Zd(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 he(()=>(c(t.current),()=>c(null)),[c,t,n,e]),he(()=>{if(o){const a={activeTriggerElement:t.current,...r};n.update(a)}},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function op(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");he(()=>{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[m,d]of e.context.triggerElements.entries())if(d===e.state.activeTriggerElement){l.activeTriggerId=m,l.activeTriggerElement=d,r.current=m;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[m,d]=h.value;l.activeTriggerId=m,l.activeTriggerElement=d,r.current=m}}(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=ke(xi);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function sp(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=Yd({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 Ze(()=>(t.set("mounted",o),null)),t.useSyncedValues({mounted:o,transitionStatus:s}),{forceUnmount:i,transitionStatus:s}}function ip(e,t){e.useSyncedValues(t),he(()=>()=>{e.update({activeTriggerProps:Ve,inactiveTriggerProps:Ve,popupProps:Ve})},[e])}let kt;function cp(e){kt??(kt=new WeakMap);let t=kt.get(e);return t||(t=new WeakMap,kt.set(e,t)),t}class dc{constructor(){ce(this,"idMap",new Map)}add(t,n){if(process.env.NODE_ENV!=="production"){const r=cp(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=kt==null?void 0:kt.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 wn={exports:{}},br={};/**
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 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={};/**
187
+ */var Cs;function ap(){if(Cs)return br;Cs=1;var e=O;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 m=h(),d=r({inst:{value:m,getSnapshot:h}}),g=d[0].inst,b=d[1];return s(function(){g.value=m,g.getSnapshot=h,a(g)&&b({inst:g})},[f,m,h]),o(function(){return a(g)&&b({inst:g}),f(function(){a(g)&&b({inst:g})})},[f]),i(m),m}function a(f){var h=f.getSnapshot;f=f.value;try{var m=h();return!n(f,m)}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 br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,br}var vr={};/**
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){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={};/**
195
+ */var Ss;function lp(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,d){return m===d&&(m!==0||1/m===1/d)||m!==m&&d!==d}function t(m,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 g=d();if(!f){var b=d();s(g,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}b=i({inst:{value:g,getSnapshot:d}});var v=b[0].inst,x=b[1];return a(function(){v.value=g,v.getSnapshot=d,n(v)&&x({inst:v})},[m,g,d]),c(function(){return n(v)&&x({inst:v}),m(function(){n(v)&&x({inst:v})})},[m]),l(g),g}function n(m){var d=m.getSnapshot;m=m.value;try{var g=d();return!s(m,g)}catch{return!0}}function r(m,d){return d()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=O,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;vr.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())})()),vr}var Es;function Po(){return Es||(Es=1,process.env.NODE_ENV==="production"?wn.exports=ap():wn.exports=lp()),wn.exports}var ko=Po(),Cn={exports:{}},yr={};/**
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=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={};/**
203
+ */var Rs;function up(){if(Rs)return yr;Rs=1;var e=O,t=Po();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 yr.useSyncExternalStoreWithSelector=function(l,u,f,h,m){var d=s(null);if(d.current===null){var g={hasValue:!1,value:null};d.current=g}else g=d.current;d=c(function(){function v(S){if(!x){if(x=!0,C=S,S=h(S),m!==void 0&&g.hasValue){var R=g.value;if(m(R,S))return w=R}return w=S}if(R=w,r(C,S))return R;var T=h(S);return m!==void 0&&m(R,T)?(C=S,R):(C=S,w=T)}var x=!1,C,w,E=f===void 0?null:f;return[function(){return v(u())},E===null?void 0:function(){return v(E())}]},[u,f,h,m]);var b=o(l,d[0],d[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),a(b),b},yr}var xr={};/**
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 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,`
211
+ */var Ts;function fp(){return Ts||(Ts=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=O,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;xr.useSyncExternalStoreWithSelector=function(l,u,f,h,m){var d=s(null);if(d.current===null){var g={hasValue:!1,value:null};d.current=g}else g=d.current;d=c(function(){function v(S){if(!x){if(x=!0,C=S,S=h(S),m!==void 0&&g.hasValue){var R=g.value;if(m(R,S))return w=R}return w=S}if(R=w,r(C,S))return R;var T=h(S);return m!==void 0&&m(R,T)?(C=S,R):(C=S,w=T)}var x=!1,C,w,E=f===void 0?null:f;return[function(){return v(u())},E===null?void 0:function(){return v(E())}]},[u,f,h,m]);var b=o(l,d[0],d[1]);return i(function(){g.hasValue=!0,g.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())})()),xr}var Is;function dp(){return Is||(Is=1,process.env.NODE_ENV==="production"?Cn.exports=up():Cn.exports=fp()),Cn.exports}var pp=dp();const hp=li(19),mp=hp?bp:vp;function pc(e,t,n,r,o){return mp(e,t,n,r,o)}function gp(e,t,n,r,o){const s=y.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ko.useSyncExternalStore(e.subscribe,s,s)}Of({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()}}),ko.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bp(e,t,n,r,o){const s=If();if(!s)return gp(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 vp(e,t,n,r,o){return pp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class yp{constructor(t){ce(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ce(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 pc(this,t,n,r,o)}}class _o extends yp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){y.useDebugValue(t);const r=this;he(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;he(()=>(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);he(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){y.useDebugValue(t);const r=this,o=n!==void 0;if(he(()=>{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),pc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){y.useDebugValue(t);const r=fe(n??to);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 xp={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 wp 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:ac(),nested:o,triggerElements:i},xp);ce(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Hf(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ce(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)});ce(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 Cp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new wp({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:Ve,inactiveTriggerProps:Ve,popupProps:Ve}}const Gt=e=>e.triggerIdProp??e.activeTriggerId,Un=e=>e.openProp??e.open,Os=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function hc(e,t){return t!==void 0&&Un(e)&&Gt(e)===t}function Sp(e,t){return hc(e,t)?!0:t!==void 0&&Un(e)&&Gt(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}const Ep={open:Un,mounted:e=>e.mounted,transitionStatus:e=>Un(e)&&!e.mounted?"starting":e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Gt,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Os,isTriggerActive:(e,t)=>t!==void 0&&Gt(e)===t,isOpenedByTrigger:(e,t)=>hc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Gt(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Sp(e,t)?Os(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Rp(e){const t=y.useCallback(r=>e===void 0?to:e.subscribeStore(r),[e]),n=y.useCallback(()=>e===void 0?void 0:e.store,[e]);return ko.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}const wr=Yi&&sn;function Tp(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=qt();y.useEffect(()=>{const f=e.select("domReferenceElement");if(!n)return;const h=Ne(f);function m(){const b=e.select("domReferenceElement");!e.select("open")&&je(b)&&b===Vr(Je(b))&&(i.current=!0,c.current=b)}function d(){a.current=!0}function g(){a.current=!1}return ut(Ce(h,"blur",m),wr&&Ce(h,"keydown",d,!0),wr&&Ce(h,"pointerdown",g,!0))},[e,n]),y.useEffect(()=>{if(!n)return;function f(h){if(h.reason===Yn||h.reason===ro){const m=e.select("domReferenceElement");ge(m)&&(c.current=m,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 m=h.currentTarget;if(i.current){if(c.current===m)return;f()}const d=xt(h.nativeEvent);if(ge(d)){if(wr&&!h.relatedTarget){if(!a.current&&!ed(d))return}else if(!nd(d))return}const g=Ln(h.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:v}=h;if(e.select("open")&&g||!r){e.setOpen(!0,ke(On,b,v));return}l.start(r,()=>{i.current||e.setOpen(!0,ke(On,b,v))})},onBlur(h){f();const m=h.relatedTarget,d=h.nativeEvent,g=ge(m)&&m.hasAttribute(Ro("focus-guard"))&&m.getAttribute("data-type")==="outside";l.start(0,()=>{var C;const b=e.select("domReferenceElement"),v=Vr(Je(b));!m&&v===b||Pe((C=s.current.floatingContext)==null?void 0:C.refs.floating.current,v)||Pe(b,v)||g||Ln(m??v,e.context.triggerElements)||e.setOpen(!1,ke(On,d))})}}},[s,r,e,l]);return y.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}class Ao{constructor(){ce(this,"pointerType");ce(this,"interactedInside",!1);ce(this,"handler");ce(this,"blockMouseMove",!0);ce(this,"performedPointerEventsMutation",!1);ce(this,"pointerEventsScopeElement",null);ce(this,"pointerEventsReferenceElement",null);ce(this,"pointerEventsFloatingElement",null);ce(this,"restTimeoutPending",!1);ce(this,"openChangeTimeout",new dt);ce(this,"restTimeout",new dt);ce(this,"handleCloseOptions");ce(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ce(this,"disposeEffect",()=>this.dispose)}static create(){return new Ao}}const Wn=new WeakMap;function qn(e){var n,r,o;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Wn.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"),Wn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function mc(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Wn.get(n);s&&s!==e&&qn(s),qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Wn.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function gc(e){const t=e.context.dataRef.current,n=Ze(()=>t.hoverInteractionState??Ao.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),oo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ip(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=cn(),u=nr(),f=gc(e),h=qt(),m=fe(()=>{var b;return Ji((b=a.current.openEvent)==null?void 0:b.type,f.interactedInside)}),d=fe(()=>{var b;return od((b=a.current.openEvent)==null?void 0:b.type)}),g=fe(()=>{qn(f)});he(()=>{s||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[s,f,g]),y.useEffect(()=>g,[g]),he(()=>{var b,v,x,C,w;if(n&&s&&(b=f.handleCloseOptions)!=null&&b.blockPointerEvents&&d()&&ge(c)&&i){const E=c,S=i,R=Je(i),T=(x=(v=l==null?void 0:l.nodesRef.current.find(_=>_.id===u))==null?void 0:v.context)==null?void 0:x.elements.floating;T&&(T.style.pointerEvents="");const P=f.pointerEventsScopeElement!==S?f.pointerEventsScopeElement:null,k=T!==S?T:null,M=((w=(C=f.handleCloseOptions)==null?void 0:C.getScope)==null?void 0:w.call(C))??P??k??Hr(E,"[data-rootownerid]")??R.body;return mc(f,{scopeElement:M,referenceElement:E,floatingElement:S}),()=>{g()}}},[n,s,c,i,f,d,l,u,g]),y.useEffect(()=>{if(!n)return;function b(){return!!(l&&u&&Dt(l.nodesRef.current,u).length>0)}function v(R){const T=$r(r,"close",f.pointerType),P=()=>{e.setOpen(!1,ke(Ye,R)),l==null||l.events.emit("floating.closed",R)};T?f.openChangeTimeout.start(T,P):(f.openChangeTimeout.clear(),P())}function x(R){const T=xt(R);if(!td(T)){f.interactedInside=!1;return}f.interactedInside=Hr(T,"[aria-haspopup]")!=null}function C(){f.openChangeTimeout.clear(),h.clear(),l==null||l.events.off("floating.closed",E),g()}function w(R){var M;if(b()&&l){l.events.on("floating.closed",E);return}if(Ln(R.relatedTarget,e.context.triggerElements))return;const T=((M=a.current.floatingContext)==null?void 0:M.nodeId)??o,P=R.relatedTarget;if(!(l&&T&&ge(P)&&Dt(l.nodesRef.current,T,!1).some(_=>{var D;return Pe((D=_.context)==null?void 0:D.elements.floating,P)}))){if(f.handler){f.handler(R);return}g(),d()&&!m()&&v(R)}}function E(R){!l||!u||b()||h.start(0,()=>{l.events.off("floating.closed",E),e.setOpen(!1,ke(Ye,R)),l.events.emit("floating.closed",R)})}const S=i;return ut(S&&Ce(S,"mouseenter",C),S&&Ce(S,"mouseleave",w),S&&Ce(S,"pointerdown",x,!0),()=>{l==null||l.events.off("floating.closed",E)})},[n,i,e,a,r,o,d,m,g,f,l,u,h])}const Op={current:null};function Pp(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:a=Op,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:h,shouldOpen:m,guardStaleOpen:d=!1}=t,{dataRef:g,events:b}=e.context,v=cn(l),x=gc(e),C=y.useRef(!1),w=Xe(o),E=Xe(r),S=Xe(i),R=Xe(n),T=Xe(m),P=Xe(h),k=fe(()=>{var I;return Ji((I=g.current.openEvent)==null?void 0:I.type,x.interactedInside)}),M=fe(()=>{var I;return((I=T.current)==null?void 0:I.call(T))!==!1}),_=fe((I,F,U)=>{const A=e.context.triggerElements;if(A.hasElement(F))return!I||!Pe(I,F);if(!ge(U))return!1;const j=U;return A.hasMatchingElement(q=>Pe(q,j))&&(!I||!Pe(I,j))}),D=fe(()=>{if(!x.handler)return;Je(e.select("domReferenceElement")).removeEventListener("mousemove",x.handler),x.handler=void 0}),N=fe(()=>{qn(x)});return u&&(x.handleCloseOptions=o==null?void 0:o.__options),y.useEffect(()=>D,[D]),y.useEffect(()=>{if(!n)return;function I(F){F.open?C.current=!1:(C.current=F.reason===Ye,D(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}return b.on("openchange",I),()=>{b.off("openchange",I)}},[n,b,x,D]),y.useEffect(()=>{if(!n)return;function I(z,ae=!0){const re=$r(E.current,"close",x.pointerType);re?x.openChangeTimeout.start(re,()=>{e.setOpen(!1,ke(Ye,z)),v==null||v.events.emit("floating.closed",z)}):ae&&(x.openChangeTimeout.clear(),e.setOpen(!1,ke(Ye,z)),v==null||v.events.emit("floating.closed",z))}const F=a.current??(u?e.select("domReferenceElement"):null);if(!ge(F))return;function U(z){var ve;if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,s&&!Br(x.pointerType))return;const ae=gs(S.current),re=$r(E.current,"open",x.pointerType),B=xt(z),G=z.currentTarget??null,V=e.select("domReferenceElement");let H=G;if(ge(B)&&!e.context.triggerElements.hasElement(B)){for(const Oe of e.context.triggerElements.elements())if(Pe(Oe,B)){H=Oe;break}}ge(G)&&ge(V)&&!e.context.triggerElements.hasElement(G)&&Pe(G,V)&&(H=V);const Z=H==null?!1:_(V,H,B),oe=e.select("open"),ee=((ve=P.current)==null?void 0:ve.call(P))??e.select("transitionStatus")==="ending",te=!oe&&ee&&C.current,$=!Z&&ge(H)&&ge(V)&&Pe(V,H)&&te,ne=ae>0&&!re,se=Z&&(oe||te)||$,be=!oe||Z;if(se){M()&&e.setOpen(!0,ke(Ye,z,H));return}ne||(re?x.openChangeTimeout.start(re,()=>{be&&M()&&e.setOpen(!0,ke(Ye,z,H))}):be&&M()&&e.setOpen(!0,ke(Ye,z,H)))}function A(z){if(k()){N();return}D();const ae=e.select("domReferenceElement"),re=Je(ae);x.restTimeout.clear(),x.restTimeoutPending=!1;const B=g.current.floatingContext??(f==null?void 0:f());if(Ln(z.relatedTarget,e.context.triggerElements))return;if(w.current&&B){e.select("open")||x.openChangeTimeout.clear();const V=a.current;x.handler=w.current({...B,tree:v,x:z.clientX,y:z.clientY,onClose(){N(),D(),R.current&&!k()&&V===e.select("domReferenceElement")&&I(z,!0)}}),re.addEventListener("mousemove",x.handler),x.handler(z);return}(x.pointerType==="touch"?!Pe(e.select("floatingElement"),z.relatedTarget):!0)&&I(z)}function j(z){Pe(F,z.relatedTarget)||(x.openChangeTimeout.clear(),x.restTimeout.clear(),x.restTimeoutPending=!1)}const q=d?Ce(F,"mouseout",j):void 0;return c?ut(Ce(F,"mousemove",U,{once:!0}),Ce(F,"mouseenter",U),Ce(F,"mouseleave",A),q):ut(Ce(F,"mouseenter",U),Ce(F,"mouseleave",A),q)},[D,N,g,E,e,n,w,x,u,_,k,s,c,S,a,v,R,f,P,M,d]),y.useMemo(()=>{if(!n)return;function I(F){x.pointerType=F.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(F){var B,G,V;const{nativeEvent:U}=F,A=F.currentTarget,j=e.select("domReferenceElement"),q=e.select("open"),z=_(j,A,F.target);if(s&&!Br(x.pointerType))return;if(q&&z&&((B=x.handleCloseOptions)!=null&&B.blockPointerEvents)){const H=e.select("floatingElement");if(H){const Z=((V=(G=x.handleCloseOptions)==null?void 0:G.getScope)==null?void 0:V.call(G))??A.ownerDocument.body;mc(x,{scopeElement:Z,referenceElement:A,floatingElement:H})}}const ae=gs(S.current);if(q&&!z||ae===0||!z&&x.restTimeoutPending&&F.movementX**2+F.movementY**2<2)return;x.restTimeout.clear();function re(){if(x.restTimeoutPending=!1,k())return;const H=e.select("open");!x.blockMouseMove&&(!H||z)&&M()&&e.setOpen(!0,ke(Ye,U,A))}x.pointerType==="touch"?ht.flushSync(()=>{re()}):z&&q?re():(x.restTimeoutPending=!0,x.restTimeout.start(ae,re))}}},[n,x,k,_,s,e,S,M])}const Ps=.1,kp=Ps*Ps,we=.5;function Sn(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function En(e,t,n,r,o,s,i,c,a,l){let u=!1;return Sn(e,t,n,r,o,s)&&(u=!u),Sn(e,t,o,s,i,c)&&(u=!u),Sn(e,t,i,c,a,l)&&(u=!u),Sn(e,t,a,l,n,r)&&(u=!u),u}function _p(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Rn(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 Ap(e={}){const{blockPointerEvents:t=!1}=e,n=new dt,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,m=null,d=null,g=typeof performance<"u"?performance.now():0;function b(x,C){const w=performance.now(),E=w-g;if(m===null||d===null||E===0)return m=x,d=C,g=w,!1;const S=x-m,R=C-d,T=S*S+R*R,P=E*E*kp;return m=x,d=C,g=w,T<P}function v(){n.clear(),a()}return function(C){n.clear();const w=c.domReference,E=c.floating;if(!w||!E||f==null||o==null||s==null)return;const{clientX:S,clientY:R}=C,T=xt(C),P=C.type==="mouseleave",k=Pe(E,T),M=Pe(w,T);if(k&&(h=!0,!P))return;if(M&&(h=!1,!P)){h=!0;return}if(P&&ge(C.relatedTarget)&&Pe(E,C.relatedTarget))return;function _(){return!!(u&&Dt(u.nodesRef.current,l).length>0)}function D(){_()||v()}if(_())return;const N=w.getBoundingClientRect(),I=E.getBoundingClientRect(),F=o>I.right-I.width/2,U=s>I.bottom-I.height/2,A=I.width>N.width,j=I.height>N.height,q=(A?N:I).left,z=(A?N:I).right,ae=(j?N:I).top,re=(j?N:I).bottom;if(f==="top"&&s>=N.bottom-1||f==="bottom"&&s<=N.top+1||f==="left"&&o>=N.right-1||f==="right"&&o<=N.left+1){D();return}let B=!1;switch(f){case"top":B=Rn(S,R,q,N.top+1,z,I.bottom-1);break;case"bottom":B=Rn(S,R,q,I.top+1,z,N.bottom-1);break;case"left":B=Rn(S,R,I.right-1,re,N.left+1,ae);break;case"right":B=Rn(S,R,N.right-1,re,I.left+1,ae);break}if(B)return;if(h&&!_p(S,R,N)){D();return}if(!P&&b(S,R)){D();return}let G=!1;switch(f){case"top":{const V=A?we/2:we*4,H=A||F?o+V:o-V,Z=A?o-V:F?o+V:o-V,oe=s+we+1,ee=F||A?I.bottom-we:I.top,te=F?A?I.bottom-we:I.top:I.bottom-we;G=En(S,R,H,oe,Z,oe,I.left,ee,I.right,te);break}case"bottom":{const V=A?we/2:we*4,H=A||F?o+V:o-V,Z=A?o-V:F?o+V:o-V,oe=s-we,ee=F||A?I.top+we:I.bottom,te=F?A?I.top+we:I.bottom:I.top+we;G=En(S,R,H,oe,Z,oe,I.left,ee,I.right,te);break}case"left":{const V=j?we/2:we*4,H=j||U?s+V:s-V,Z=j?s-V:U?s+V:s-V,oe=o+we+1,ee=U||j?I.right-we:I.left,te=U?j?I.right-we:I.left:I.right-we;G=En(S,R,ee,I.top,te,I.bottom,oe,H,oe,Z);break}case"right":{const V=j?we/2:we*4,H=j||U?s+V:s-V,Z=j?s-V:U?s+V:s-V,oe=o-we,ee=U||j?I.left+we:I.right,te=U?j?I.left+we:I.right:I.left+we;G=En(S,R,oe,H,oe,Z,ee,I.top,te,I.bottom);break}}G?h||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function ks(e,t,n){let{reference:r,floating:o}=e;const s=Ge(t),i=Eo(t),c=So(i),a=Ue(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 m;switch(a){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}const d=tt(t);return d&&(m[i]+=h*(d==="end"?1:-1)*(n&&l?-1:1)),m}async function Np(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:m=0}=pt(t,e),d=ec(m),b=c[h?f==="floating"?"reference":"floating":f],v=Hn(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,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(C))&&await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1},E=Hn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:C,strategy:a}):x);return{top:(v.top-E.top+d.top)/w.y,bottom:(E.bottom-v.bottom+d.bottom)/w.y,left:(v.left-E.left+d.left)/w.x,right:(E.right-v.right+d.right)/w.x}}const Mp=50,jp=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Np},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}=ks(l,r,a),h=r,m=0;const d={};for(let g=0;g<s.length;g++){const b=s[g];if(!b)continue;const{name:v,fn:x}=b,{x:C,y:w,data:E,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=C??u,f=w??f,d[v]={...d[v],...E},S&&m<Mp&&(m++,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}=ks(l,h,a)),g=-1)}return{x:u,y:f,placement:h,strategy:o,middlewareData:d}},Dp=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:m="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:g=!0,...b}=pt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Ue(o),x=Ge(c),C=Ue(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(l.floating)),E=h||(C||!g?[Vn(c)]:ld(c)),S=d!=="none";!h&&S&&E.push(...pd(c,g,d,w));const R=[c,...E],T=await a.detectOverflow(t,b),P=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(T[v]),f){const N=ad(o,i,w);P.push(T[N[0]],T[N[1]])}if(k=[...k,{placement:o,overflows:P}],!P.every(N=>N<=0)){var M,_;const N=(((M=s.flip)==null?void 0:M.index)||0)+1,I=R[N];if(I&&(!(f==="alignment"?x!==Ge(I):!1)||k.every(A=>Ge(A.placement)===x?A.overflows[0]>0:!0)))return{data:{index:N,overflows:k},reset:{placement:I}};let F=(_=k.filter(U=>U.overflows[0]<=0).sort((U,A)=>U.overflows[1]-A.overflows[1])[0])==null?void 0:_.placement;if(!F)switch(m){case"bestFit":{var D;const U=(D=k.filter(A=>{if(S){const j=Ge(A.placement);return j===x||j==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(j=>j>0).reduce((j,q)=>j+q,0)]).sort((A,j)=>A[1]-j[1])[0])==null?void 0:D[0];U&&(F=U);break}case"initialPlacement":F=c;break}if(o!==F)return{reset:{placement:F}}}return{}}}},bc=new Set(["left","top"]);async function Fp(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ue(n),c=tt(n),a=Ge(n)==="y",l=bc.has(i)?-1:1,u=s&&a?-1:1,f=pt(t,e);let{mainAxis:h,crossAxis:m,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"&&(m=c==="end"?d*-1:d),a?{x:m*u,y:h*l}:{x:h*l,y:m*u}}const Lp=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 Fp(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}}}}},Bp=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:C,y:w}=x;return{x:C,y:w}}},...l}=pt(e,t),u={x:n,y:r},f=await s.detectOverflow(t,l),h=Ge(o),m=Co(h);let d=u[m],g=u[h];const b=(x,C)=>Zi(C+f[x==="y"?"top":"left"],C,C-f[x==="y"?"bottom":"right"]);i&&(d=b(m,d)),c&&(g=b(h,g));const v=a.fn({...t,[m]:d,[h]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:i,[h]:c}}}}}},Vp=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}=pt(e,t),h={x:o,y:s},m=Ge(i),d=Co(m);let g=h[d],b=h[m];const v=pt(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 E=d==="y"?"height":"width",S=c.reference[d]-c.floating[E]+x.mainAxis,R=c.reference[d]+c.reference[E]-x.mainAxis;g<S?g=S:g>R&&(g=R)}if(f){var C,w;const E=d==="y"?"width":"height",S=bc.has(Ue(i)),R=c.reference[m]-c.floating[E]+(S&&((C=a.offset)==null?void 0:C[m])||0)+(S?0:x.crossAxis),T=c.reference[m]+c.reference[E]+(S?0:((w=a.offset)==null?void 0:w[m])||0)-(S?x.crossAxis:0);b<R?b=R:b>T&&(b=T)}return{[d]:g,[m]:b}}}},Hp=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}=pt(e,t),a=await o.detectOverflow(t,c),l=Ue(n),u=tt(n),f=Ge(n)==="y",{width:h,height:m}=r.floating;let d,g;l==="top"||l==="bottom"?(d=l,g=u===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(g=l,d=u==="end"?"top":"bottom");const b=m-a.top-a.bottom,v=h-a.left-a.right,x=jt(m-a[d],b),C=jt(h-a[g],v),w=t.middlewareData.shift,E=!w;let S=x,R=C;w!=null&&w.enabled.x&&(R=v),w!=null&&w.enabled.y&&(S=b),E&&!u&&(f?R=h-2*st(a.left,a.right):S=m-2*st(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:S});const T=await o.getDimensions(s.floating);return h!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function vc(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=je(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bn(n)!==s||Bn(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function No(e){return ge(e)?e:e.contextElement}function _t(e){const t=No(e);if(!je(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=vc(t);let i=(s?Bn(n.width):n.width)/r,c=(s?Bn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const $p=it(0);function yc(e){const t=Ne(e);return!uo()||!t.visualViewport?$p:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Up(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ne(e)}function Et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=No(e);let i=it(1);t&&(r?ge(r)&&(i=_t(r)):i=_t(e));const c=Up(s,n,r)?yc(s):it(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=Ne(s),m=ge(r)?Ne(r):r;let d=h,g=kr(d);for(;g&&m!==d;){const b=_t(g),v=g.getBoundingClientRect(),x=We(g),C=v.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,w=v.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,u*=b.x,f*=b.y,a+=C,l+=w,d=Ne(g),g=kr(d)}}return Hn({width:u,height:f,x:a,y:l})}function rr(e,t){const n=Zn(e).scrollLeft;return t?t.left+n:Et(ct(e)).left+n}function xc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Wp(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ct(r),c=t?Jn(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=it(1);const u=it(0),f=je(r);if((f||!s)&&((He(r)!=="body"||Qn(i))&&(a=Zn(r)),f)){const m=Et(r);l=_t(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=i&&!f&&!s?xc(i,a):it(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 qp(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zp(e){const t=Zn(e),n=e.ownerDocument.body,r=st(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=st(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+rr(e);const i=-t.scrollTop;return We(n).direction==="rtl"&&(s+=st(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Gp=25;function Kp(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Ne(e),s=ct(e),i=o.visualViewport;let c=s.clientWidth,a=s.clientHeight,l=0,u=0;if(i){const h=!uo()||t==="fixed";r?h||(l=-i.offsetLeft,u=-i.offsetTop):(c=i.width,a=i.height,h&&(l=i.offsetLeft,u=i.offsetTop))}if(rr(s)<=0){const h=s.ownerDocument,m=h.body,d=getComputedStyle(m),g=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,b=Math.abs(s.clientWidth-m.clientWidth-g),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;v<=Gp&&(c-=v)}return{width:c,height:a,x:l,y:u}}function Yp(e,t){const n=Et(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=_t(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=Kp(e,n,t);else if(t==="document")r=zp(ct(e));else if(ge(t))r=Yp(t,n);else{const o=yc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Hn(r)}function Xp(e,t){const n=t.get(e);if(n)return n;let r=Kt(e,[],!1).filter(c=>ge(c)&&He(c)!=="body"),o=null;const s=We(e).position==="fixed";let i=s?ft(e):e;for(;ge(i)&&!lt(i);){const c=We(i),a=lo(i),l=o?o.position:s?"fixed":"";!a&&(l==="fixed"||l==="absolute"&&c.position==="static")?r=r.filter(f=>f!==i):o=c,i=ft(i)}return t.set(e,r),r}function Qp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:Xp(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 m=_s(t,i[h],o);a=st(m.top,a),l=jt(m.right,l),u=jt(m.bottom,u),f=st(m.left,f)}return{width:l-f,height:u-a,x:f,y:a}}function Jp(e){const{width:t,height:n}=vc(e);return{width:t,height:n}}function Zp(e,t,n){const r=je(t),o=ct(t),s=n==="fixed",i=Et(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=it(0);if((r||!s)&&((He(t)!=="body"||Qn(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=rr(o));const l=o&&!r&&!s?xc(o,c):it(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 We(e).position==="static"}function As(e,t){if(!je(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ct(e)===n&&(n=n.ownerDocument.body),n}function wc(e,t){const n=Ne(e);if(Jn(e))return n;if(!je(e)){let o=ft(e);for(;o&&!lt(o);){if(ge(o)&&!Cr(o))return o;o=ft(o)}return n}let r=As(e,t);for(;r&&Tl(r)&&Cr(r);)r=As(r,t);return r&&lt(r)&&Cr(r)&&!lo(r)?n:r||Pl(e)||n}const eh=async function(e){const t=this.getOffsetParent||wc,n=this.getDimensions,r=await n(e.floating);return{reference:Zp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function th(e){return We(e).direction==="rtl"}const nh={convertOffsetParentRelativeRectToViewportRelativeRect:Wp,getDocumentElement:ct,getClippingRect:Qp,getOffsetParent:wc,getElementRects:eh,getClientRects:qp,getDimensions:Jp,getScale:_t,isElement:ge,isRTL:th};function Cc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rh(e,t,n){let r=null,o;const s=ct(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:m,top:d,width:g,height:b}=h;if(u||t(),!g||!b)return;const v=xn(d),x=xn(s.clientWidth-(m+g)),C=xn(s.clientHeight-(d+b)),w=xn(m),S={rootMargin:-v+"px "+-x+"px "+-C+"px "+-w+"px",threshold:st(0,jt(1,f))||1};let R=!0;function T(P){const k=P[0].intersectionRatio;if(!Cc(h,e.getBoundingClientRect()))return c();if(k!==f){if(!R)return c();k?c(!1,k):o=setTimeout(()=>{c(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(T,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,S)}r.observe(e)}const a=Ne(e),l=()=>c(n);return a.addEventListener("resize",l),c(!0),()=>{a.removeEventListener("resize",l),i()}}function Ns(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=No(e),u=o||s?[...l?Kt(l):[],...t?Kt(t):[]]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const f=l&&c?rh(l,n,s):null;let h=-1,m=null;i&&(m=new ResizeObserver(v=>{let[x]=v;x&&x.target===l&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var C;(C=m)==null||C.observe(t)})),n()}),l&&!a&&m.observe(l),t&&m.observe(t));let d,g=a?Et(e):null;a&&b();function b(){const v=Et(e);g&&!Cc(g,v)&&n(),g=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=m)==null||v.disconnect(),m=null,a&&cancelAnimationFrame(d)}}const oh=Lp,sh=Bp,ih=Dp,ch=Hp,ah=Vp,lh=(e,t,n)=>{const r=new Map,o=n??{},s={...nh,...o.platform,_c:r};return jp(e,t,{...o,platform:s})};var uh=typeof document<"u",fh=function(){},_n=uh?O.useLayoutEffect:fh;function zn(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(!zn(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)&&!zn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Sc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ms(e,t){const n=Sc(e);return Math.round(t*n)/n}function Sr(e){const t=y.useRef(e);return _n(()=>{t.current=e}),t}function dh(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,m]=y.useState(r);zn(h,r)||m(r);const[d,g]=y.useState(null),[b,v]=y.useState(null),x=y.useCallback(A=>{A!==S.current&&(S.current=A,g(A))},[]),C=y.useCallback(A=>{A!==R.current&&(R.current=A,v(A))},[]),w=s||d,E=i||b,S=y.useRef(null),R=y.useRef(null),T=y.useRef(u),P=a!=null,k=Sr(a),M=Sr(o),_=Sr(l),D=y.useCallback(()=>{if(!S.current||!R.current)return;const A={placement:t,strategy:n,middleware:h};M.current&&(A.platform=M.current),lh(S.current,R.current,A).then(j=>{const q={...j,isPositioned:_.current!==!1};N.current&&!zn(T.current,q)&&(T.current=q,ht.flushSync(()=>{f(q)}))})},[h,t,n,M,_]);_n(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(A=>({...A,isPositioned:!1})))},[l]);const N=y.useRef(!1);_n(()=>(N.current=!0,()=>{N.current=!1}),[]),_n(()=>{if(w&&(S.current=w),E&&(R.current=E),w&&E){if(k.current)return k.current(w,E,D);D()}},[w,E,D,k,P]);const I=y.useMemo(()=>({reference:S,floating:R,setReference:x,setFloating:C}),[x,C]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),U=y.useMemo(()=>{const A={position:n,left:0,top:0};if(!F.floating)return A;const j=Ms(F.floating,u.x),q=Ms(F.floating,u.y);return c?{...A,transform:"translate("+j+"px, "+q+"px)",...Sc(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:q}},[n,c,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:D,refs:I,elements:F,floatingStyles:U}),[u,D,I,F,U])}const ph=(e,t)=>{const n=oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},hh=(e,t)=>{const n=sh(e);return{name:n.name,fn:n.fn,options:[e,t]}},mh=(e,t)=>({fn:ah(e).fn,options:[e,t]}),gh=(e,t)=>{const n=ih(e);return{name:n.name,fn:n.fn,options:[e,t]}},bh=(e,t)=>{const n=ch(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Mo.displayName="PreviewCardRootContext");function an(e){const t=y.useContext(Mo);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>.":Rt(50));return t}class vh extends _o{setState(t){}update(t){}set(t,n){}notifyAll(){}}const yh=600,Ec=300,Rc={...Ep,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class xh extends _o{constructor(n,r,o){const s=new dc;super(Tc(n,s,r,o),Ic(s),Rc);ce(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;np(this,n,r,{onBeforeDispatch(){var i;const s=r.event;n&&r.reason===Ye&&r.trigger&&"clientX"in s&&"clientY"in s&&((i=o.current)==null?void 0:i.element)!==r.trigger&&fc(o,r.trigger,s.clientX,s.clientY)}})})}}function wh(){const e=new dc;return new vh(Object.freeze(Tc(void 0,e)),Object.freeze(Ic(e)),Rc)}function Tc(e,t,n,r=!1){return{...Cp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Ec,...e}}function Ic(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=Qd((v,x)=>new xh({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"),m=u.useState("mounted"),d=u.useState("payload");op(u,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:g}=sp(f,u,()=>{u.context.inlineRectCoordsRef.current=void 0});he(()=>{f&&h==null&&u.set("payload",void 0)},[u,h,f]),y.useImperativeHandle(s,()=>({unmount:g,close:()=>u.setOpen(!1,ke(Pr))}),[g,u]);const b=f||m||i!=null;return p.jsxs(Mo.Provider,{value:u,children:[i&&p.jsx(Jd,{handle:i,store:u}),b&&p.jsx(Ch,{store:u}),typeof l=="function"?l({payload:d}):l]})}function Ch({store:e}){const t=e.useState("floatingRootContext"),n=Vd(t);return ip(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Oc=Gi(function(t){return an(!0)?p.jsx(js,{...t}):p.jsx(Fd,{children:p.jsx(js,{...t})})});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardRoot");const jo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPortalContext");function Sh(){const e=y.useContext(jo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Portal> is missing.":Rt(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:u}=cc({container:o,ref:n,componentProps:t,elementProps:a});return!u&&!l?null:p.jsxs(y.Fragment,{children:[u,l&&ht.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Pc.displayName="FloatingPortalLite");const kc=y.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return an().useState("mounted")||r?p.jsx(jo.Provider,{value:r,children:p.jsx(Pc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(kc.displayName="PreviewCardPortal");const _c=Pf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:u,...f}=t,h=an(!0),d=Rp(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.":Rt(89));const g=yi(c),b=d.useState("isTriggerActive",g),v=d.useState("isOpenedByTrigger",g),x=d.useState("floatingRootContext"),C=d.context.inlineRectCoordsRef,w=y.useRef(null),E=s??yh,S=i??Ec,{registerTrigger:R,isMountedByThisTrigger:T}=rp(g,w,d,{payload:a,closeDelay:S}),P=Pp(x,{mouseOnly:!0,move:!1,handleClose:Ap(),delay:()=>({open:E,close:S}),triggerElementRef:w,isActiveTrigger:b,isClosing:()=>d.select("transitionStatus")==="ending"}),k=Tp(x,{delay:E}),M={open:v},_=d.useState("triggerProps",T),D=qd(C,v);return mt("a",t,{state:M,ref:[n,R,w],props:[P,k.reference,_,D,{id:g},f],stateAttributesMapping:Qf})});process.env.NODE_ENV!=="production"&&(_c.displayName="PreviewCardTrigger");const Do=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Do.displayName="PreviewCardPositionerContext");function Eh(){const e=y.useContext(Do);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>.":Rt(49));return e}function Rh(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=cn(n),m=y.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),d=dh({...e,elements:{...m,...l&&{reference:l}}}),g=y.useCallback(C=>{const w=ge(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;u(w),d.refs.setReference(w)},[d.refs]),b=y.useMemo(()=>({...d.refs,setPositionReference:g,domReference:f}),[d.refs,g]),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 he(()=>{i&&(f.current=i)},[i]),he(()=>{r.context.dataRef.current.floatingContext=x;const C=h==null?void 0:h.nodesRef.current.find(w=>w.id===t);C&&(C.context=x)}),y.useMemo(()=>({...d,context:x,refs:b,elements:v,rootStore:r}),[d,b,v,x,r])}const Ac=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ac.displayName="DirectionContext");function Th(){const e=y.useContext(Ac);return(e==null?void 0:e.direction)??"ltr"}const Ih=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}=pt(e,t)||{};if(l==null)return{};const f=ec(u),h={x:n,y:r},m=Eo(o),d=So(m),g=await i.getDimensions(l),b=m==="y",v=b?"top":"left",x=b?"bottom":"right",C=b?"clientHeight":"clientWidth",w=s.reference[d]+s.reference[m]-h[m]-s.floating[d],E=h[m]-s.reference[m],S=c.floating[C]||s.floating[d],R=w/2-E/2,T=S/2-g[d]/2-1,P=Math.min(f[v],T),k=Math.min(f[x],T),M=P,_=S-g[d]-k,D=S/2-g[d]/2+R,N=Zi(M,D,_),I=!a.arrow&&tt(o)!=null&&D!==N&&s.reference[d]/2-(D<M?P:k)-g[d]/2<0,F=I?D<M?D-M:D-_:0;return{[m]:h[m]+F,data:{[m]:N,centerOffset:D-N-F,...I&&{alignmentOffset:F}},reset:I}}}),Oh=(e,t)=>{const{name:n,fn:r}=Ih(e);return{name:n,fn:r,options:[e,t]}},Ph={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}}}},kh={sideX:"left",sideY:"top"},_h="--available-width",Ah="--available-height",Nh="--anchor-width",Mh="--anchor-height",jh="--transform-origin",Ds=_h,Fs=Ah;function Nc(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 Ls(e,t,n){const{rects:r,placement:o}=e;return{side:Nc(t,Ue(o),n),align:tt(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Dh(e){return Fh(e,Rh)}function Fh(e,t){var Vt,un;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:m,keepMounted:d=!1,floatingRootContext:g,mounted:b,collisionAvoidance:v,shift:x,nodeId:C,adaptiveOrigin:w,lazyFlip:E=!1,externalTree:S}=e,R=v.side||"flip",T=v.align||"flip",P=v.fallbackAxisSide||"end",k=(x==null?void 0:x.crossAxis)??!1,M=x==null?void 0:x.rootBoundary,_=typeof n=="function"?n:void 0,D=fe(_),N=_?D:n,I=Xe(n),F=Xe(b),A=Th()==="rtl",[j,q]=y.useState(null);!b&&j!==null&&q(null);const z=E==="placement",ae=j?Ue(j):null,re=j&&z?tt(j)||"center":null,B=ae||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[o],G=re||i,V=G==="center"?B:`${B}-${G}`;let H=l;typeof H=="number"?H={top:H,right:H,bottom:H,left:H}:H&&(H={top:H.top||0,right:H.right||0,bottom:H.bottom||0,left:H.left||0});const Z=1,oe=o==="bottom"?Z:0,ee=o==="top"?Z:0,te=o==="right"?Z:0,$=o==="left"?Z:0,ne={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:H},se=y.useRef(null),be=Xe(s),ve=Xe(c),Oe=typeof s!="function"?s:0,Ae=typeof c!="function"?c:0,xe=[];m&&xe.push(m),xe.push(ph(pe=>{const De=Ls(pe,o,A),ze=typeof be.current=="function"?be.current(De):be.current,Be=typeof ve.current=="function"?ve.current(De):ve.current;return{mainAxis:ze,crossAxis:Be,alignmentAxis:Be}},[Oe,Ae,A,o]));const Me=T==="none"&&R!=="shift",Le=!Me&&(u||k||R==="shift"),K=R==="none"?null:gh({...ne,padding:{top:H.top+Z+oe,right:H.right+Z+$,bottom:H.bottom+Z+ee,left:H.left+Z+te},mainAxis:!k&&R==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),J=Me?null:hh({...ne,rootBoundary:M,mainAxis:T!=="none",crossAxis:Le,limiter:u||k?void 0:mh(pe=>{if(!se.current)return{};const{width:De,height:ze}=se.current.getBoundingClientRect(),Be=Ge(Ue(pe.placement)),et=Be==="y"?De:ze,Ke=Be==="y"?H.left+H.right:H.top+H.bottom;return{offset:et/2+Ke/2}})},[ne,u,k,M,H,T]);R==="shift"||T==="shift"||G==="center"?xe.push(J,K):xe.push(K,J),xe.push(bh({...ne,apply({elements:{floating:pe},availableWidth:De,availableHeight:ze,rects:Be}){if(!F.current)return;const et=pe.style;et.setProperty(Ds,`${De}px`),et.setProperty(Fs,`${ze}px`);const Ke=Ne(pe).devicePixelRatio||1,{x:fn,y:Tt,width:dn,height:at}=Be.reference,rt=(Math.round((fn+dn)*Ke)-Math.round(fn*Ke))/Ke,Ht=(Math.round((Tt+at)*Ke)-Math.round(Tt*Ke))/Ke;et.setProperty(Nh,`${rt}px`),et.setProperty(Mh,`${Ht}px`)}}),Oh(pe=>({element:se.current||Je(pe.elements.floating).createElement("div"),padding:se.current?f:0}),[f]),{name:"transformOrigin",fn(pe){var Vo,Ho,$o,Uo,Wo,qo;const{elements:{floating:De},middlewareData:ze,placement:Be,platform:et,rects:Ke,y:fn}=pe,Tt=Ue(Be),dn=tt(Be),at=Ge(Tt)==="y",rt=se.current,Ht=typeof s=="function"?s(Ls(pe,o,A)):s;let pn;if(!rt&&dn&&Math.abs(at?((Vo=ze.shift)==null?void 0:Vo.x)||0:((Ho=ze.shift)==null?void 0:Ho.y)||0)<=1)pn=dn==="start"===(at&&(($o=et.isRTL)==null?void 0:$o.call(et,De))===!0)?"100%":"0%";else{const Wc=at?((Uo=ze.arrow)==null?void 0:Uo.x)||0:((Wo=ze.arrow)==null?void 0:Wo.y)||0,qc=at?(rt==null?void 0:rt.clientWidth)||0:(rt==null?void 0:rt.clientHeight)||0;pn=`${Wc+qc/2}px`}let or=Tt==="top"||Tt==="left"?`calc(100% + ${Ht}px)`:`${-Ht}px`;return Le&&at&&Math.abs(((qo=ze.shift)==null?void 0:qo.y)||0)>Ht&&(or=`${Ke.reference.y+Ke.reference.height/2-fn}px`),De.style.setProperty(jh,at?`${pn} ${or}`:`${or} ${pn}`),{}}},Ph,w),he(()=>{!b&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,g]);const ue=y.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:L,elements:Y,x:Ee,y:me,middlewareData:Re,update:W,placement:Q,context:X,isPositioned:ie,floatingStyles:Se}=t({rootContext:g,open:d?b:void 0,placement:V,middleware:xe,strategy:r,whileElementsMounted:d?void 0:(...pe)=>Ns(...pe,ue),nodeId:C,externalTree:S}),{sideX:de,sideY:_e}=Re.adaptiveOrigin||kh,Te=ie?r:"fixed",qe=y.useMemo(()=>{let pe;return ie?w?pe={position:Te,[de]:Ee,[_e]:me}:pe={...Se,position:Te}:pe={position:Te,top:0,left:0},pe[Ds]="100vw",pe[Fs]="100vh",ie||(pe.opacity=0),pe},[w,Te,de,Ee,_e,me,Se,ie]),$e=y.useRef(null);he(()=>{if(!b)return;const pe=I.current,De=typeof pe=="function"?pe():pe,Be=(Bs(De)?De.current:De)||null||null;Be!==$e.current&&(L.setPositionReference(Be),$e.current=Be)},[b,L,N,I]),y.useEffect(()=>{if(!b)return;const pe=I.current;typeof pe!="function"&&Bs(pe)&&pe.current!==$e.current&&(L.setPositionReference(pe.current),$e.current=pe.current)},[b,L,N,I]),y.useEffect(()=>{if(d&&b&&Y.reference&&Y.floating)return Ns(Y.reference,Y.floating,W,ue)},[d,b,Y,W,ue]);const nt=Ue(Q),gt=Nc(o,nt,A),bt=tt(Q)||"center",Lt=!!((Vt=Re.hide)!=null&&Vt.referenceHidden);he(()=>{E&&b&&ie&&(nt!==B||z&&bt!==G)&&q(Q)},[E,z,b,ie,Q,nt,bt,B,G]);const ln=y.useMemo(()=>{var pe,De;return{position:"absolute",top:(pe=Re.arrow)==null?void 0:pe.y,left:(De=Re.arrow)==null?void 0:De.x}},[Re.arrow]),Bt=((un=Re.arrow)==null?void 0:un.centerOffset)!==0;return y.useMemo(()=>({positionerStyles:qe,arrowStyles:ln,arrowRef:se,arrowUncentered:Bt,side:gt,align:bt,physicalSide:nt,anchorHidden:Lt,refs:L,context:X,isPositioned:ie,update:W}),[qe,ln,se,Bt,gt,bt,nt,Lt,L,X,ie,W])}function Bs(e){return e!=null&&"current"in e}function Mc(e){return e==="starting"?Od:Ve}function Lh(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),mt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},Mc(r),o],stateAttributesMapping:Qi})}const jc=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:m=5,sticky:d=!1,disableAnchorTracking:g=!1,collisionAvoidance:b=Pd,style:v,...x}=t,C=an(),w=Sh(),E=jd(),S=C.useState("open"),R=C.useState("mounted"),T=C.useState("floatingRootContext"),P=C.useState("instantType"),k=C.useState("transitionStatus"),M=C.useState("adaptiveOrigin"),_=C.context.inlineRectCoordsRef,D=Dh({anchor:s,floatingRootContext:T,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:h,sticky:d,disableAnchorTracking:g,keepMounted:w,nodeId:E,collisionAvoidance:b,adaptiveOrigin:M,inline:zd(_)}),N=D.update;he(()=>{S&&R&&N()},[S,R,N]);const I={open:S,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P},F=Lh(t,I,{styles:D.positionerStyles,transitionStatus:k,props:x,refs:[n,C.useStateSetter("positionerElement")],hidden:!R,inert:!S});return p.jsx(Do.Provider,{value:D,children:p.jsx(Dd,{id:E,children:F})})});process.env.NODE_ENV!=="production"&&(jc.displayName="PreviewCardPositioner");const Dc=y.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=an(),{side:a,align:l}=Eh(),u=c.useState("open"),f=c.useState("instantType"),h=c.useState("transitionStatus"),m=c.useState("popupProps"),d=c.useState("floatingRootContext"),g=c.useState("closeDelay");return fo({open:u,ref:c.context.popupRef,onComplete(){var x,C;u&&((C=(x=c.context).onOpenChangeComplete)==null||C.call(x,!0))}}),Ip(d,{closeDelay:g}),mt("div",t,{state:{open:u,side:a,align:l,instant:f,transitionStatus:h},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[Xd,m,Mc(h),i],stateAttributesMapping:Jf})});process.env.NODE_ENV!=="production"&&(Dc.displayName="PreviewCardPopup");class Bh extends Gd{constructor(){super(wh(),"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 Vh(){return new Bh}const Hh=Vh;function $h(e){return p.jsx(Oc,{...e})}function Uh(e){return p.jsx(_c,{"data-slot":"hover-card-trigger",...e})}function Wh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return p.jsx(kc,{children:p.jsx(jc,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:p.jsx(Dc,{"data-slot":"hover-card-content",...s,className:i=>le("vps-hover-card",typeof e=="function"?e(i):e)})})})}function qh({className:e,...t}){return p.jsx("span",{className:le("inline-citation",e),...t})}const Fo=O.createContext(null);function Fc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function zh({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=O.useState(()=>Hh()),i=e??s,c=O.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return p.jsx(Fo.Provider,{value:c,children:p.jsx($h,{...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 zr(e){try{return new URL(e).hostname||e}catch{return e}}function Gh({sources:e,delay:t,closeDelay:n,id:r,children:o,onClick:s,...i}){const c=O.useContext(Fo),a=O.useId(),l=r??a,u=e[0],f=u?zr(u):"Source";return p.jsx(Uh,{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(ho,{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),Fc(c))}}),children:o??(e.length>1?`${f} +${e.length-1}`:f)})}function Kh({ref:e,onBlur:t,...n}){const r=O.useContext(Fo);return p.jsx(Wh,{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&&Fc(r))},onBlur:o=>{t==null||t(o),!(!r||o.defaultPrevented)&&o.relatedTarget!==r.trigger&&!o.currentTarget.contains(o.relatedTarget)&&r.handle.close()}})}const Lc=O.createContext(null);function Lo(){const e=O.useContext(Lc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function Yh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=wo({...e,axis:n==="vertical"?"y":"x"},t),[{selected:a,count:l},u]=O.useState({selected:0,count:0});return O.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(Lc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:p.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:le("inline-citation-carousel",o),"data-orientation":n})})}function Xh({className:e,...t}){const{viewportRef:n}=Lo();return p.jsx("div",{ref:n,className:"inline-citation-viewport",children:p.jsx("div",{className:le("inline-citation-track",e),...t})})}function Qh({className:e,...t}){return p.jsx("div",{role:"group","aria-roledescription":"slide",className:le("inline-citation-slide",e),...t})}function Jh({className:e,...t}){return p.jsx("div",{className:le("inline-citation-carousel-header",e),...t})}function Zh({children:e,...t}){const{selected:n,count:r}=Lo();return p.jsx("div",{"aria-live":"polite",...t,children:e??(r?`${n+1}/${r}`:"")})}function Bc({next:e,children:t,disabled:n,onClick:r,...o}){const{api:s}=Lo(),i=e?s==null?void 0:s.canScrollNext():s==null?void 0:s.canScrollPrev();return p.jsx(ho,{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(ti,{size:14,"aria-hidden":"true"}):p.jsx(ya,{size:14,"aria-hidden":"true"}))})}function em(e){return p.jsx(Bc,{...e,next:!1})}function tm(e){return p.jsx(Bc,{...e,next:!0})}function nm({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?go(t):void 0;return p.jsxs("div",{className:le("inline-citation-source",r),...s,children:[p.jsx("div",{className:"inline-citation-title",children:e||(i?zr(i):"Source")}),i&&p.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[zr(i),p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&p.jsx("p",{children:n}),o]})}function rm({className:e,...t}){return p.jsx("blockquote",{className:le("inline-citation-quote",e),...t})}const om={"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 Vc(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(om))if(n.includes(r))return o;return null}function Gr(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 sm=({sources:e,hideInspectSources:t=!1,showInspectSources:n=!0,defaultExpanded:r=!1,maxSources:o=5})=>{const s=t||n===!1,[i,c]=O.useState(r&&!s),[a,l]=O.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(Ct,{children:p.jsx(Ea,{size:14})}),p.jsx(Mt,{children:`${u.length} retrieved VPS ${f}`}),!s&&p.jsx(Yt,{children:i?"Hide Details":"Inspect Sources"})]}),m=p.jsx(yt,{className:"grounded-source-rows",children:u.map((d,g)=>{const b=a===g,v=p.jsxs(Nt,{children:[p.jsx(Ct,{children:p.jsx(ba,{size:13})}),p.jsxs(Mt,{children:["[S",g+1,"] ",Gr(d)]}),p.jsxs(Yt,{title:"Ranking score, not a probability of correctness",children:["Score ",d.score.toFixed(2)]})]});return s?p.jsx("div",{children:v},`${d.chunkId}-${g}`):p.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:g)},title:d.source,children:v},`${d.chunkId}-${g}`)})});return s?p.jsxs(yt,{className:"grounded-sources-card",children:[h,m]}):p.jsx(yt,{className:"grounded-sources-card",children:p.jsxs(_i,{open:i,onOpenChange:c,children:[p.jsx(Ai,{children:h}),m,p.jsx(Ni,{children:p.jsx("div",{className:"grounded-sources-details-list",children:u.map((d,g)=>{const b=Gr(d),v=Vc(d.source),x=a===g;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:["[",g+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:C=>{C.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[p.jsx("span",{children:v.label}),p.jsx(Ca,{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}-${g}`)})})})]})})};function im({label:e,sources:t}){const n=t.map(r=>{var i;const o=Gr(r),s=go(r.url||r.source)??((i=Vc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:p.jsxs(p.Fragment,{children:[p.jsx(nm,{title:o,url:s}),r.snippet&&p.jsx(rm,{children:r.snippet})]})}});return p.jsx(qh,{children:p.jsxs(zh,{children:[p.jsx(Gh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),p.jsx(Kh,{children:n.length===1?n[0].content:p.jsxs(Yh,{"aria-label":"Sources",children:[p.jsxs(Jh,{children:[p.jsx(Zh,{}),p.jsx(em,{}),p.jsx(tm,{})]}),p.jsx(Xh,{children:n.map((r,o)=>p.jsx(Qh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function cm(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(im,{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(O.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(O.Fragment,{children:o},s)})}function am(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()),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;
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=m=>m.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 lm({code:e,lang:t,streaming:n}){const{status:r,copy:o}=Ui();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(Qr,{size:15,"aria-hidden":"true"}):p.jsx(ri,{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 Vs=O.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=am(t),s=i=>cm(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(lm,{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(O.Fragment,{children:[s(a),l<i.lines.length-1&&p.jsx("br",{})]},l))},c)}})})}),um=O.lazy(async()=>({default:(await import("streamdown")).Streamdown})),Hc=O.createContext(null);function $c(){const e=O.useContext(Hc);if(!e)throw new Error("Reasoning parts must be rendered inside Reasoning.");return e}function fm({isStreaming:e=!1,open:t,defaultOpen:n,onOpenChange:r,duration:o,className:s,...i}){const[c,a]=O.useState(n),[l,u]=O.useState(),f=O.useRef(null),h=t??c??e;O.useEffect(()=>{e?f.current=performance.now():f.current!==null&&(u(Math.round((performance.now()-f.current)/1e3)),f.current=null)},[e]);function m(d){t===void 0&&a(d),r==null||r(d)}return p.jsx(Hc.Provider,{value:{isStreaming:e,isOpen:h,setIsOpen:m,duration:o??l},children:p.jsx(yt,{className:s,children:p.jsx(_i,{...i,open:h,onOpenChange:m})})})}function dm({getThinkingMessage:e,children:t,icon:n,description:r,...o}){const{isStreaming:s,duration:i}=$c(),c=s?"Thinking":i===void 0?"Thought":`Thought for ${i}s`;return p.jsx(Ai,{...o,children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(Ct,{children:n??(s?p.jsx(oi,{size:14,className:"trace-spinner"}):p.jsx(ni,{size:14}))}),p.jsx(Mt,{children:t??(e==null?void 0:e(s,i))??c}),r&&p.jsx(Yt,{"aria-hidden":s||void 0,children:r})]})})}function pm({children:e,className:t,...n}){const{isStreaming:r}=$c();return p.jsx(Ni,{className:le("reasoning-content",t),...n,children:typeof e=="string"?p.jsx(O.Suspense,{fallback:p.jsx("div",{className:"md-content reasoning-text",children:e}),children:p.jsx(um,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function hm(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const mm=({status:e="complete",progressText:t,progressSteps:n=[],durationMs:r,toolCalls:o=[]})=>{const s=e==="pending",i=e==="stopped",[c,a]=O.useState(0);O.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(fm,{className:"chat-response-trace",isStreaming:s,duration:u,children:[p.jsx(dm,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?p.jsx(si,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),p.jsx(pm,{children:p.jsxs(yt,{children:[n.map((f,h)=>p.jsxs(Js,{children:[p.jsx(ua,{children:p.jsx("span",{className:"chat-progress-dot"})}),p.jsx(Zs,{children:f})]},`${f}-${h}`)),o.map((f,h)=>p.jsxs(Nt,{children:[p.jsx(Ct,{children:p.jsx(ja,{size:13})}),p.jsx(Mt,{children:hm(f.toolName)})]},`${f.toolName}-${h}`))]})})]}):p.jsx(yt,{className:"chat-response-trace",children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(Ct,{children:s?p.jsx(oi,{size:14,className:"trace-spinner"}):p.jsx(ni,{size:14})}),p.jsx(Mt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?p.jsxs(Yt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&u!==void 0&&p.jsxs(Yt,{children:[u,"s"]})]})})},gm=({message:e,onEdit:t})=>{var m,d,g,b;const n=Gn(),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||!!((m=e.progressSteps)!=null&&m.length||(d=e.sources)!=null&&d.length||(g=e.toolCalls)!=null&&g.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(ii,{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:po,alt:"VPS Logo",style:{width:"16px",height:"16px"}})}),p.jsxs(Zr,{children:[f&&p.jsx(Fa,{children:p.jsx(mm,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?p.jsx(Nr,{align:"end",children:p.jsx(Mr,{className:"msg-user-pre",children:e.content})}):l||i?p.jsx(Nr,{variant:i?"destructive":"muted",children:p.jsx(Mr,{children:p.jsx(Vs,{text:e.content})})}):e.content&&p.jsxs("div",{className:"chat-message-body",children:[p.jsx(Vs,{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(sm,{sources:e.sources,hideInspectSources:r}):null]}),h&&n&&p.jsx(Rr,{children:p.jsx(qu,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&p.jsxs(Rr,{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(Oa,{size:14,"aria-hidden":"true"})}),p.jsx(Qr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},bm=({onEdit:e})=>{const{messages:t,status:n,suggestions:r,showSuggestions:o,sendMessage:s}=tn(),i=n==="awaiting"||n==="connecting",c=t.filter(a=>a.status!=="error");return p.jsx(Bu,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:p.jsxs(Vu,{children:[p.jsx(Hu,{"aria-label":"Chat messages",children:p.jsxs($u,{"aria-busy":i,children:[c.length===0&&p.jsx(ls,{messageId:"welcome",children:p.jsx(Wu,{})}),c.map(a=>p.jsx(ls,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:p.jsx(gm,{message:a,onEdit:e})},a.streamId??a.id))]})}),p.jsx(Uu,{})]})})},vm=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=tn(),s=!n.customerId&&!n.email,[i,c]=O.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},Bo=({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:m,pendingTicket:d,soundEnabled:g,toggleSound:b}=tn(),v=O.useRef(null),x=u==="awaiting"||u==="connecting",C=c[c.length-1],w=x?C==null?void 0:C.progressText:(C==null?void 0:C.status)==="stopped"?"Response stopped":void 0;return p.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[p.jsx(ql,{title:r,subtitle:o,onClose:t,onReset:()=>void h(),showMinimize:n,soundEnabled:g,onToggleSound:b,envStage:s,envPulse:i}),p.jsx("div",{className:"chat-panel-body",children:p.jsx(bm,{onEdit:E=>{var S;return(S=v.current)==null?void 0:S.edit(E)}})}),p.jsx(Js,{className:"sr-only",role:"status",children:p.jsx(Zs,{children:w})}),f&&u==="error"&&p.jsx($l,{message:f,onRetry:()=>void m()}),p.jsx(vm,{}),p.jsx(nu,{ref:v,onSend:E=>void a(E),onStop:x?l:void 0,disabled:x||!!d})]})},ym=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?p.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:p.jsx(Bo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,xm=({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(Da,{size:22}):p.jsx(Ra,{size:24})}),Hs=({defaultOpen:e=!1,open:t,onOpenChange:n,envStage:r,envPulse:o=!0})=>{const[s,i]=O.useState(e),c=t??s,a=l=>{n==null||n(l),t===void 0&&i(l)};return p.jsxs(p.Fragment,{children:[p.jsx(ym,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),p.jsx(xm,{open:c,onToggle:()=>a(!c)})]})},wm=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,...g})=>{const b=Gn(),v=e??t??n;return!!b&&(!v||wt(v)===wt(b==null?void 0:b.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&a===void 0&&!l&&u===void 0&&!f&&h===void 0&&m===void 0&&d===void 0?p.jsx(Hs,{...g}):p.jsx(Xr,{apiBaseUrl:v,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,children:p.jsx(Hs,{...g})})},Cm=({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(Bo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),Sm=5,Er=8,Uc="vps-embedded-assistant-top",$s=16;function Em(e,t,n){return Math.min(n,Math.max(t,e))}function Us(e,t){const n=Math.max(Er,window.innerHeight-t-Er);return Em(e,Er,n)}function Rm(){try{const e=window.localStorage.getItem(Uc);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function Tm(e){try{window.localStorage.setItem(Uc,String(e))}catch{}}const Im=({onOpen:e})=>{const t=O.useRef(null),n=O.useRef({pointerId:null,startY:0,startTop:0,moved:!1}),[r,o]=O.useState(()=>typeof window>"u"?null:Rm()),s=O.useRef(r),i=O.useRef(!1),[c,a]=O.useState(!1),[l,u]=O.useState(!1);O.useEffect(()=>{s.current=r},[r]),O.useEffect(()=>{const d=t.current;if(!d)return;const g=()=>{o(b=>{const x=Us(b??$s,d.offsetHeight);return s.current=x,x})};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]);const f=d=>{if(d.button!==0)return;const g=d.currentTarget,b=g.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:b.top,moved:!1};try{g.setPointerCapture(d.pointerId)}catch{}},h=d=>{if(n.current.pointerId!==d.pointerId)return;const g=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(g)<Sm)return;n.current.moved=!0,a(!0);const b=Us(n.current.startTop+g,d.currentTarget.offsetHeight);s.current=b,o(b)},m=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 g=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),g&&(i.current=!0,s.current!=null&&Tm(s.current))};return p.jsxs("button",{ref:t,type:"button",onPointerDown:f,onPointerMove:h,onPointerUp:m,onPointerCancel:m,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:po,alt:"",className:"embedded-trigger-icon","aria-hidden":"true"}),p.jsx("span",{className:"embedded-trigger-label",children:"Assistant"})]})},Ws=({defaultOpen:e=!1,open:t,onOpenChange:n,showTrigger:r=!0,envStage:o,envPulse:s=!0})=>{const[i,c]=O.useState(e),a=t??i,l=u=>{n==null||n(u),t===void 0&&c(u)};return O.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(Im,{onOpen:()=>l(!0)}),p.jsx(Cm,{open:a,onClose:()=>l(!1),envStage:o,envPulse:s})]})},Om=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,...g})=>{const b=Gn(),v=e??t??n;return!!b&&(!v||wt(v)===wt(b==null?void 0:b.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&a===void 0&&!l&&u===void 0&&!f&&h===void 0&&m===void 0&&d===void 0?p.jsx(Ws,{...g}):p.jsx(Xr,{apiBaseUrl:v,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,children:p.jsx(Ws,{...g})})},Pm={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.CUSTOMER_PORTAL_ROLES=Gs;exports.ChatPanel=Bo;exports.ChatProvider=Xr;exports.ChatbotWidget=wm;exports.ColorPalette=Pm;exports.EmbeddedChatbot=Om;exports.buildApiUrl=Tn;exports.chatApi=oa;exports.createChatApi=Kr;exports.resolveApiBaseUrl=wt;exports.useChatContext=Ys;exports.useChatbot=tn;exports.useOptionalChatContext=Gn;