@sciol/xyzen 0.3.16 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/xyzen.es.js CHANGED
@@ -14524,8 +14524,7 @@ const jNe = (e, t) => ({
14524
14524
  }
14525
14525
  }
14526
14526
  }), bg = {
14527
- Sidebar: "sidebar",
14528
- Fullscreen: "fullscreen"
14527
+ Sidebar: "sidebar"
14529
14528
  }, zNe = !1, UNe = !0;
14530
14529
  console.log("=== Environment Debug ===");
14531
14530
  console.log("MODE:", "production");
@@ -14534,7 +14533,7 @@ console.log("isProduction:", UNe);
14534
14533
  console.log("VITE_XYZEN_BACKEND_URL:", void 0);
14535
14534
  const $Ne = () => window !== void 0 ? `${window.location.protocol}//${window.location.host}` : "http://localhost:48196", Nf = $Ne();
14536
14535
  console.log("Final DEFAULT_BACKEND_URL:", Nf);
14537
- const VNe = () => localStorage.getItem("layoutStyle") ? localStorage.getItem("layoutStyle") : bg.Fullscreen, tle = VNe();
14536
+ const VNe = () => localStorage.getItem("layoutStyle") ? localStorage.getItem("layoutStyle") : bg.Sidebar, tle = VNe();
14538
14537
  console.log("Final DEFAULT_LAYOUT_STYLE:", tle);
14539
14538
  const HNe = 1024, GNe = 64 * 9, qNe = 64 * 15, Sx = 64 * 10;
14540
14539
  ku.setBackendUrl(Nf);
package/dist/xyzen.umd.js CHANGED
@@ -77,7 +77,7 @@ Defaulting to \`null\`.`}var Oke=k$,Pke=I$,n1="Tabs",[Fke]=Mc(n1,[Kb]),L$=Kb(),[
77
77
  `),i},Y4e=(e,t)=>({agents:[],agentsLoading:!1,publishedAgents:[],publishedAgentsLoading:!1,officialAgents:[],officialAgentsLoading:!1,hiddenGraphAgentIds:W4e(),systemAgents:[],systemAgentsLoading:!1,isCreatingAgent:!1,fetchAgents:async()=>{e({agentsLoading:!0});try{const[r,n]=await Promise.all([fetch(`${t().backendUrl}/xyzen/api/v1/agents/`,{headers:xa()}),fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/`,{headers:xa()})]);if(!r.ok)throw new Error("Failed to fetch regular agents");if(!n.ok)throw new Error("Failed to fetch graph agents");const a=await r.json(),i=await n.json(),o=a.map(u=>({...u,agent_type:"regular"})),s=i.map(u=>({...u,agent_type:"graph"})),l=[...o,...s];e({agents:l,agentsLoading:!1})}catch(r){throw console.error("Failed to fetch agents:",r),e({agentsLoading:!1}),r}},fetchPublishedGraphAgents:async()=>{e({publishedAgentsLoading:!0});try{const r=await fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/published`,{headers:xa()});if(!r.ok)throw new Error("Failed to fetch published graph agents");const a=(await r.json()).map(i=>({...i,agent_type:"graph",is_published:!0}));e({publishedAgents:a,publishedAgentsLoading:!1})}catch(r){throw console.error("Failed to fetch published graph agents:",r),e({publishedAgentsLoading:!1}),r}},fetchOfficialGraphAgents:async()=>{e({officialAgentsLoading:!0});try{const r=await fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/official`,{headers:xa()});if(!r.ok)throw new Error("Failed to fetch official graph agents");const a=(await r.json()).map(i=>({...i,agent_type:"graph",is_official:!0}));e({officialAgents:a,officialAgentsLoading:!1})}catch(r){throw console.error("Failed to fetch official graph agents:",r),e({officialAgentsLoading:!1}),r}},createAgent:async r=>{const{isCreatingAgent:n}=t();if(n){console.log("Agent creation already in progress");return}e({isCreatingAgent:!0});try{const a=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/`,{method:"POST",headers:xa(),body:JSON.stringify(r)});if(!a.ok){const i=await a.text();throw new Error(`Failed to create agent: ${i}`)}await t().fetchAgents()}catch(a){throw console.error(a),a}finally{e({isCreatingAgent:!1})}},updateAgent:async r=>{try{const n=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/${r.id}`,{method:"PATCH",headers:xa(),body:JSON.stringify(r)});if(!n.ok){const a=await n.text();throw new Error(`Failed to update agent: ${a}`)}await t().fetchAgents()}catch(n){throw console.error(n),n}},updateAgentProvider:async(r,n)=>{try{const a=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/${r}`,{method:"PATCH",headers:xa(),body:JSON.stringify({provider_id:n})});if(!a.ok){const i=await a.text();throw new Error(`Failed to update agent provider: ${i}`)}e(i=>{const o=i.agents.find(s=>s.id===r);o&&(o.provider_id=n)})}catch(a){throw console.error(a),a}},toggleGraphAgentPublish:async r=>{try{const n=await fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/${r}/toggle-publish`,{method:"PATCH",headers:xa()});if(!n.ok){const i=await n.text();throw new Error(`Failed to toggle publish status: ${i}`)}const a=await n.json();e(i=>{const o=i.agents.findIndex(l=>l.id===r);o!==-1&&(i.agents[o].is_published=a.is_published);const s=i.publishedAgents.findIndex(l=>l.id===r);a.is_published?s===-1?i.publishedAgents.push(a):i.publishedAgents[s]=a:s!==-1&&i.publishedAgents.splice(s,1)}),await t().fetchAgents(),await t().fetchPublishedGraphAgents()}catch(n){throw console.error(n),n}},setGraphAgentPublish:async(r,n)=>{try{const a=await fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/${r}`,{method:"PATCH",headers:xa(),body:JSON.stringify({is_published:n})});if(!a.ok){const o=await a.text();throw new Error(`Failed to set publish status: ${o}`)}const i=await a.json();e(o=>{const s=o.agents.findIndex(u=>u.id===r);s!==-1&&(o.agents[s].is_published=n);const l=o.publishedAgents.findIndex(u=>u.id===r);n?l===-1?o.publishedAgents.push(i):o.publishedAgents[l]=i:l!==-1&&o.publishedAgents.splice(l,1)}),await t().fetchAgents(),await t().fetchPublishedGraphAgents()}catch(a){throw console.error(a),a}},createGraphAgent:async r=>{try{const n=await fetch(`${t().backendUrl}/xyzen/api/v1/graph-agents/`,{method:"POST",headers:xa(),body:JSON.stringify({...r,state_schema:r.state_schema||{type:"object",properties:{messages:{type:"array"},current_step:{type:"string"},user_input:{type:"string"},final_output:{type:"string"},execution_context:{type:"object"}}}})});if(!n.ok){const a=await n.text();throw new Error(`Failed to create graph agent: ${a}`)}await t().fetchAgents()}catch(n){throw console.error(n),n}},deleteAgent:async r=>{try{const n=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/${r}`,{method:"DELETE",headers:xa()});if(!n.ok){const a=await n.text();throw new Error(`Failed to delete agent: ${a}`)}await t().fetchAgents()}catch(n){throw console.error(n),n}},removeGraphAgentFromSidebar:r=>{e(n=>{n.hiddenGraphAgentIds.includes(r)||n.hiddenGraphAgentIds.push(r),n.agents=n.agents.filter(a=>a.id!==r)}),TV(t().hiddenGraphAgentIds)},addGraphAgentToSidebar:r=>{e(n=>{n.hiddenGraphAgentIds=n.hiddenGraphAgentIds.filter(o=>o!==r);const a=n.officialAgents.find(o=>o.id===r),i=n.publishedAgents.find(o=>o.id===r);if(a&&!n.agents.some(o=>o.id===r)){const o={...a,agent_type:"graph",is_official:!0};n.agents.push(o)}else if(i&&!n.agents.some(o=>o.id===r)){const o={...i,agent_type:"graph",is_published:!0};n.agents.push(o)}}),TV(t().hiddenGraphAgentIds)},fetchSystemAgents:async()=>{e({systemAgentsLoading:!0});try{const r=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/system/all`,{headers:xa()});if(!r.ok)throw new Error("Failed to fetch system agents");const n=await r.json(),{mcpServers:a}=t(),i=n.map(o=>EA(o,a));e({systemAgents:i,systemAgentsLoading:!1})}catch(r){throw console.error("Failed to fetch system agents:",r),e({systemAgentsLoading:!1}),r}},getSystemChatAgent:async()=>{try{const r=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/system/chat`,{headers:xa()});if(!r.ok)throw new Error("Failed to fetch system chat agent");const n=await r.json(),{mcpServers:a}=t();return EA(n,a)}catch(r){throw console.error("Failed to fetch system chat agent:",r),r}},getSystemWorkshopAgent:async()=>{try{const r=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/system/workshop`,{headers:xa()});if(!r.ok)throw new Error("Failed to fetch system workshop agent");const n=await r.json(),{mcpServers:a}=t();return EA(n,a)}catch(r){throw console.error("Failed to fetch system workshop agent:",r),r}},syncSystemAgentMcps:async()=>{console.log(`
78
78
  🔄 Syncing System Agent MCPs with Backend...`);try{const r=t();if(r.mcpServers.length===0){console.log(" - ❌ No MCP servers loaded yet, skipping sync");return}for(const n of r.systemAgents){if(!SV(n.id))continue;const a=xV(n.id),i=wV(r.mcpServers,a);console.log(` - 🤖 Processing ${n.name} (${n.id})`),console.log(` Expected MCPs: [${a.join(", ")}]`),console.log(` Found MCP IDs: [${i.join(", ")}]`);const o=n.mcp_server_ids||[];if(!(i.length>0&&(o.length===0||!i.every(u=>o.includes(u))))){console.log(" ✅ Agent already has correct MCPs in backend");continue}console.log(" 🔧 Updating agent in backend with MCP servers...");const l=await fetch(`${t().backendUrl}/xyzen/api/v1/agents/system/${n.id}`,{method:"PATCH",headers:xa(),body:JSON.stringify({mcp_server_ids:i})});if(l.ok)console.log(` ✅ Successfully updated ${n.name} with ${i.length} MCP servers`),e(u=>{const c=u.systemAgents.findIndex(d=>d.id===n.id);c!==-1&&(u.systemAgents[c].mcp_server_ids=i,u.systemAgents[c].mcp_servers=i.map(d=>({id:d})))});else{const u=await l.text();console.log(` ❌ Failed to update ${n.name}: ${u}`),console.log(" 💡 Backend might not support system agent MCP updates")}}console.log(`🔄 System Agent MCP sync completed!
79
79
  `)}catch(r){console.error("Failed to sync system agent MCPs:",r)}},getRegularAgents:()=>t().agents.filter(r=>r.agent_type==="regular"),getGraphAgents:()=>t().agents.filter(r=>r.agent_type==="graph"),getSystemAgents:()=>t().systemAgents,getAgentStats:()=>{const{agents:r}=t(),n=r.filter(o=>o.agent_type==="regular"),a=r.filter(o=>o.agent_type==="graph"),i=r.filter(o=>o.agent_type==="builtin"||o.agent_type==="system");return{total:r.length,regular:n.length,graph:a.length,system:i.length,regularAgents:n.map(o=>({id:o.id,name:o.name})),graphAgents:a.map(o=>({id:o.id,name:o.name,is_published:o.agent_type==="graph"?o.is_published:void 0}))}}}),X4e=e=>({user:null,token:null,status:"idle",setUser:t=>e({user:t}),setToken:t=>e({token:t}),setStatus:t=>e({status:t})});class K4e{ws=null;onMessageCallback=null;onMessageEventCallback=null;onStatusChangeCallback=null;backendUrl="";setBackendUrl(t){this.backendUrl=t}connect(t,r,n,a,i){if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.log("WebSocket is already connected.");return}this.onMessageCallback=n,this.onMessageEventCallback=i||null,this.onStatusChangeCallback=a;const o=Jr.getToken();if(!o){console.error("XyzenService: No authentication token available"),this.onStatusChangeCallback?.({connected:!1,error:"Authentication required"});return}const s=`${this.backendUrl.replace(/^http(s?):\/\//,"ws$1://")}/xyzen/ws/v1/chat/sessions/${t}/topics/${r}?token=${encodeURIComponent(o)}`;this.ws=new WebSocket(s),this.ws.onopen=()=>{console.log("XyzenService: WebSocket connected"),this.onStatusChangeCallback?.({connected:!0,error:null})},this.ws.onmessage=l=>{try{const u=JSON.parse(l.data);u.type&&this.onMessageEventCallback?this.onMessageEventCallback(u):this.onMessageCallback?.(u)}catch(u){console.error("XyzenService: Failed to parse message data:",u)}},this.ws.onclose=l=>{console.log(`XyzenService: WebSocket disconnected (code: ${l.code}, reason: ${l.reason})`),this.onStatusChangeCallback?.({connected:!1,error:l.reason||"Connection closed."})},this.ws.onerror=l=>{console.error("XyzenService: WebSocket error:",l),this.onStatusChangeCallback?.({connected:!1,error:"A connection error occurred."})}}sendMessage(t){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify({message:t})):console.error("XyzenService: WebSocket is not connected.")}sendStructuredMessage(t){this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(t)):console.error("XyzenService: WebSocket is not connected.")}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}}const Js=new K4e;function _V(e){try{const t=JSON.parse(e);return t.event==="tool_call_request"||t.event==="tool_call_response"?t:null}catch{return null}}function Z4e(e){return e.event==="tool_call_request"?{id:e.id||"",name:e.name||"Unknown Tool",description:e.description,arguments:e.arguments||{},status:e.status||"pending",timestamp:e.timestamp?new Date(e.timestamp).toISOString():new Date().toISOString()}:e.event==="tool_call_response"?{id:e.toolCallId||e.id||"",name:"Tool Response",arguments:{},status:e.status||"completed",result:e.result?JSON.stringify(e.result):void 0,error:e.error,timestamp:new Date().toISOString()}:null}function Q4e(e){const t=[],r=new Map,n=i=>({...i,arguments:{...i.arguments||{}}}),a=i=>({...i,toolCalls:i.toolCalls?i.toolCalls.map(o=>n(o)):void 0});for(const i of e){if(i.role!=="tool"){const c=a(i);t.push(c),c.toolCalls&&c.toolCalls.forEach(d=>{r.set(d.id,{toolCall:d,message:c})});continue}const o=_V(i.content);if(!o){t.push(a(i));continue}if(o.event==="tool_call_request"){const c=o.id||o.toolCallId||i.id||crypto.randomUUID(),d={id:c,name:o.name||"Unknown Tool",description:o.description,arguments:{...o.arguments||{}},status:o.status||"waiting_confirmation",timestamp:o.timestamp?new Date(o.timestamp).toISOString():i.created_at},f={id:i.id||`tool-call-${c}`,role:"assistant",content:"我需要使用工具来帮助回答您的问题。",created_at:i.created_at,toolCalls:[d]};t.push(f),r.set(c,{toolCall:d,message:f});continue}const s=o.toolCallId||o.id||i.id||"";if(!s)continue;let l=r.get(s);if(!l){const c={id:s,name:"工具调用",arguments:{},status:o.status||"completed",timestamp:i.created_at},d={id:i.id||`tool-response-${s}`,role:"assistant",content:"工具调用更新",created_at:i.created_at,toolCalls:[c]};t.push(d),l={toolCall:c,message:d},r.set(s,l)}const{toolCall:u}=l;o.status&&(u.status=o.status),o.result!==void 0&&(u.result=typeof o.result=="string"?o.result:JSON.stringify(o.result)),o.error&&(u.error=o.error,u.status="failed")}return t}const J4e=(e,t)=>({activeChatChannel:null,chatHistory:[],chatHistoryLoading:!0,channels:{},activeWorkshopChannel:null,workshopHistory:[],workshopHistoryLoading:!0,workshopChannels:{},notification:null,setActiveChatChannel:r=>e({activeChatChannel:r}),fetchChatHistory:async()=>{const{setLoading:r}=t();r("chatHistory",!0);try{const n=Jr.getToken();if(!n){console.error("ChatSlice: No authentication token available");return}const a={"Content-Type":"application/json",Authorization:`Bearer ${n}`},i=await fetch(`${t().backendUrl}/xyzen/api/v1/sessions/`,{headers:a});if(!i.ok){const c=await i.text();throw console.error(`ChatSlice: Sessions API error: ${i.status} - ${c}`),new Error(`Failed to fetch chat history: ${i.status} ${c}`)}const o=await i.json(),l={...t().channels},u=o.flatMap(c=>c.topics?.map(d=>(l[d.id]?l[d.id]={...l[d.id],sessionId:c.id,title:d.name,agentId:c.agent_id}:l[d.id]={id:d.id,sessionId:c.id,title:d.name,messages:[],agentId:c.agent_id,connected:!1,error:null},{id:d.id,sessionId:c.id,title:d.name,updatedAt:d.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1}))||[]);e({chatHistory:u,channels:l,chatHistoryLoading:!1})}catch(n){console.error("ChatSlice: Failed to fetch chat history:",n),e({chatHistoryLoading:!1})}finally{r("chatHistory",!1)}},togglePinChat:r=>{e(n=>{const a=n.chatHistory.find(i=>i.id===r);a&&(a.isPinned=!a.isPinned)})},activateChannel:async r=>{const{channels:n,activeChatChannel:a,connectToChannel:i,backendUrl:o}=t();if(r===a&&n[r]?.connected)return;e({activeChatChannel:r});let s=n[r];if(!s)try{const l=Jr.getToken(),u={"Content-Type":"application/json"};l&&(u.Authorization=`Bearer ${l}`);const c=await fetch(`${o}/xyzen/api/v1/sessions/`,{headers:u});if(!c.ok)throw new Error("Failed to fetch sessions");const d=await c.json();let f=null,h=null,p;for(const m of d){const g=m.topics.find(v=>v.id===r);if(g){f=m.id,h=g.name,p=m.agent_id;break}}if(f&&h)s={id:r,sessionId:f,title:h,messages:[],agentId:p,connected:!1,error:null},e(m=>{m.channels[r]=s});else{console.error(`Topic ${r} not found in any session, refetching history...`),await t().fetchChatHistory();const m=t().channels;if(m[r])s=m[r];else{console.error(`Topic ${r} still not found after refetch.`);return}}}catch(l){console.error("Failed to find session for topic:",l);return}if(s){if(s.messages.length===0){const{setLoading:l}=t(),u=`topicMessages-${r}`;l(u,!0);try{const c=Jr.getToken(),d={"Content-Type":"application/json"};c&&(d.Authorization=`Bearer ${c}`);const f=await fetch(`${o}/xyzen/api/v1/topics/${r}/messages`,{headers:d});if(f.ok){const h=await f.json(),p=Q4e(h);e(m=>{m.channels[r]&&(m.channels[r].messages=p)})}else{const h=await f.text();console.error(`ChatSlice: Failed to load messages for topic ${r}: ${f.status} ${h}`),(f.status===401||f.status===403)&&console.error("ChatSlice: Authentication/authorization issue loading messages")}}catch(c){console.error("Failed to load topic messages:",c)}finally{l(u,!1)}}i(s.sessionId,s.id)}},connectToChannel:(r,n)=>{Js.disconnect(),Js.connect(r,n,a=>{e(i=>{const o=i.channels[n];o&&(o.messages.some(s=>s.id===a.id)||o.messages.push(a))})},a=>{e(i=>{const o=i.channels[n];o&&(o.connected=a.connected,o.error=a.error)})},a=>{e(i=>{const o=i.channels[n];if(o)switch(a.type){case"processing":{o.responding=!0;const s=`loading-${Date.now()}`;o.messages.findIndex(u=>u.isLoading)===-1&&o.messages.push({id:s,role:"assistant",content:"",created_at:new Date().toISOString(),isLoading:!0,isStreaming:!1});break}case"loading":{o.responding=!0;const s=`loading-${Date.now()}`;o.messages.findIndex(u=>u.isLoading)===-1&&o.messages.push({id:s,role:"assistant",content:"",created_at:new Date().toISOString(),isLoading:!0,isStreaming:!1});break}case"streaming_start":{o.responding=!0;const s=o.messages.findIndex(u=>u.isLoading),l=a.data;if(s!==-1){const{isLoading:u,...c}=o.messages[s];o.messages[s]={...c,id:l.id,isStreaming:!0,content:""}}else o.messages.push({id:l.id,role:"assistant",content:"",created_at:new Date().toISOString(),isStreaming:!0});break}case"streaming_chunk":{const s=a.data,l=o.messages.findIndex(u=>u.id===s.id);if(l===-1)o.messages.push({id:s.id,role:"assistant",content:s.content,created_at:new Date().toISOString(),isStreaming:!0});else{const u=o.messages[l].content;o.messages[l].content=u+s.content}break}case"streaming_end":{o.responding=!1;const s=a.data,l=o.messages.findIndex(u=>u.id===s.id);if(l!==-1){const u={...o.messages[l]};delete u.isLoading,delete u.isStreaming,o.messages[l]={...u,created_at:s.created_at||new Date().toISOString()}}break}case"message":{const s=a.data;o.messages.some(l=>l.id===s.id)||o.messages.push(s);break}case"message_saved":{const s=a.data,l=o.messages.findIndex(u=>u.id===s.stream_id);l!==-1&&(o.messages[l]={...o.messages[l],id:s.db_id,created_at:s.created_at});break}case"tool_call_request":{o.responding=!0;const s=a.data,l=o.messages.findIndex(d=>d.isLoading);l!==-1&&o.messages.splice(l,1);const c={id:`tool-call-${s.id}`,role:"assistant",content:"我需要使用工具来帮助回答您的问题。",created_at:new Date().toISOString(),isLoading:!1,isStreaming:!1,toolCalls:[{id:s.id,name:s.name,description:s.description,arguments:s.arguments,status:s.status,timestamp:new Date(s.timestamp).toISOString()}]};o.messages.push(c),console.log(`ChatSlice: Created new tool call message with tool ${s.name}`);break}case"tool_call_response":{const s=a.data;o.messages.forEach(l=>{l.toolCalls&&l.toolCalls.forEach(u=>{u.id===s.toolCallId&&(u.status=s.status,s.result&&(u.result=JSON.stringify(s.result)),s.error&&(u.error=s.error))})});break}case"error":{o.responding=!1;const s=a.data,l=o.messages.findIndex(u=>u.isLoading);l!==-1&&o.messages.splice(l,1),console.error("Chat error:",s.error);break}case"insufficient_balance":{const s=a.data;console.warn("Insufficient balance:",s),t().showNotification("Insufficient Balance",s.message_cn||s.message||"Your photon balance is insufficient. Please recharge to continue.","warning","Recharge",()=>{console.log("User clicked recharge button")});const l=o.messages.findIndex(u=>u.isLoading);l!==-1&&o.messages.splice(l,1);break}}})})},disconnectFromChannel:()=>{Js.disconnect()},sendMessage:r=>{const{activeChatChannel:n}=t();n&&(e(a=>{const i=a.channels[n];i&&(i.responding=!0)}),Js.sendMessage(r))},createDefaultChannel:async r=>{try{const n=r||"default",a=Jr.getToken();if(!a){console.error("No authentication token available");return}const i={"Content-Type":"application/json",Authorization:`Bearer ${a}`};try{const d=await fetch(`${t().backendUrl}/xyzen/api/v1/sessions/by-agent/${n}`,{headers:i});if(d.ok){const f=await d.json(),h=await fetch(`${t().backendUrl}/xyzen/api/v1/topics/`,{method:"POST",headers:i,body:JSON.stringify({name:"新的聊天",session_id:f.id})});if(!h.ok)throw new Error("Failed to create new topic in existing session");const p=await h.json(),m={id:p.id,sessionId:f.id,title:p.name,messages:[],agentId:f.agent_id,connected:!1,error:null},g={id:p.id,sessionId:f.id,title:p.name,updatedAt:p.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1};e(v=>{v.channels[p.id]=m,v.chatHistory.unshift(g),v.activeChatChannel=p.id,v.activeTabIndex=1}),t().connectToChannel(f.id,p.id);return}}catch{console.log("No existing session found, creating new session")}const o=t(),s=[...o.agents,...o.systemAgents].find(d=>d.id===r),l={name:"New Session",agent_id:r};s?.mcp_servers?.length?(l.mcp_server_ids=s.mcp_servers.map(d=>d.id),console.log(` - ✅ Including ${s.mcp_servers.length} MCP servers in session creation`)):console.log(" - ⚠️ No MCP servers to include for this agent");const u=await fetch(`${t().backendUrl}/xyzen/api/v1/sessions/`,{method:"POST",headers:i,body:JSON.stringify(l)});if(!u.ok)throw new Error("Failed to create new session with default topic");const c=await u.json();if(!u.ok){const d=await u.text();throw console.error("❌ Session creation failed:",u.status,d),new Error(`Failed to create new session:
80
- ${u.status} ${d}`)}if(console.log("✅ Session creation successful, parsing response..."),console.log("🔍 Session response data:",JSON.stringify(c,null,2)),c.topics&&c.topics.length>0){const d=c.topics[0],f={id:d.id,sessionId:c.id,title:d.name,messages:[],agentId:c.agent_id,connected:!1,error:null},h={id:d.id,sessionId:c.id,title:d.name,updatedAt:d.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1};e(p=>{p.channels[d.id]=f,p.chatHistory.unshift(h),p.activeChatChannel=d.id,p.activeTabIndex=1}),t().connectToChannel(c.id,d.id)}else{console.log("⚠️ Session created without topics, creating default topic...");const d=await fetch(`${t().backendUrl}/xyzen/api/v1/topics/`,{method:"POST",headers:i,body:JSON.stringify({name:"新的聊天",session_id:c.id})});if(!d.ok){const m=await d.text();throw console.error("❌ Failed to create default topic:",d.status,m),new Error(`Failed to create default topic for new session: ${d.status} ${m}`)}const f=await d.json();console.log("✅ Default topic created:",f.id);const h={id:f.id,sessionId:c.id,title:f.name,messages:[],agentId:c.agent_id,connected:!1,error:null},p={id:f.id,sessionId:c.id,title:f.name,updatedAt:f.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1};e(m=>{m.channels[f.id]=h,m.chatHistory.unshift(p),m.activeChatChannel=f.id,m.activeTabIndex=1}),console.log("🚀 Navigating to new topic:",f.id),t().connectToChannel(c.id,f.id)}}catch(n){console.error("Failed to create channel:",n)}},updateTopicName:async(r,n)=>{try{const a=Jr.getToken();if(!a){console.error("No authentication token available");return}const i={"Content-Type":"application/json",Authorization:`Bearer ${a}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/topics/${r}`,{method:"PUT",headers:i,body:JSON.stringify({name:n})})).ok)throw new Error("Failed to update topic name");e(s=>{s.channels[r]&&(s.channels[r].title=n);const l=s.chatHistory.find(u=>u.id===r);l&&(l.title=n)}),console.log(`Topic ${r} name updated to: ${n}`)}catch(a){throw console.error("Failed to update topic name:",a),a}},deleteTopic:async r=>{try{const n=Jr.getToken();if(!n){console.error("No authentication token available");return}const a={"Content-Type":"application/json",Authorization:`Bearer ${n}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/topics/${r}`,{method:"DELETE",headers:a})).ok)throw new Error("Failed to delete topic");e(o=>{if(delete o.channels[r],o.chatHistory=o.chatHistory.filter(s=>s.id!==r),o.activeChatChannel===r){const s=o.chatHistory[0];s?(o.activeChatChannel=s.id,t().activateChannel(s.id)):o.activeChatChannel=null}}),console.log(`Topic ${r} deleted`)}catch(n){throw console.error("Failed to delete topic:",n),n}},clearSessionTopics:async r=>{try{const n=Jr.getToken();if(!n){console.error("No authentication token available");return}const a={"Content-Type":"application/json",Authorization:`Bearer ${n}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/sessions/${r}/topics`,{method:"DELETE",headers:a})).ok)throw new Error("Failed to clear session topics");await t().fetchChatHistory(),console.log(`Session ${r} topics cleared`)}catch(n){throw console.error("Failed to clear session topics:",n),n}},setActiveWorkshopChannel:r=>e({activeWorkshopChannel:r}),fetchWorkshopHistory:async()=>{console.log("ChatSlice: Fetching workshop history (reusing chat history endpoints)...");try{e({workshopHistoryLoading:!0}),await t().fetchChatHistory();const{channels:r,chatHistory:n}=t();e({workshopChannels:r,workshopHistory:n,workshopHistoryLoading:!1}),console.log("ChatSlice: Workshop history synced from chat history")}catch(r){console.error("ChatSlice: Error fetching workshop history:",r),e({workshopHistoryLoading:!1})}},togglePinWorkshopChat:r=>{e(n=>{const a=n.workshopHistory.find(i=>i.id===r);a&&(a.isPinned=!a.isPinned)})},activateWorkshopChannel:async r=>{const{workshopChannels:n,activeWorkshopChannel:a}=t();if(r===a&&n[r]?.connected)return;console.log(`Activating workshop channel: ${r}`),e({activeWorkshopChannel:r}),await t().activateChannel(r);const{channels:i}=t();i[r]&&e(o=>{o.workshopChannels[r]=i[r]})},connectToWorkshopChannel:(r,n)=>{console.log(`Connecting to workshop channel: ${n} (reusing chat connection logic)`),t().connectToChannel(r,n);const{channels:a}=t();a[n]&&e(i=>{i.workshopChannels[n]=a[n]})},disconnectFromWorkshopChannel:()=>{const{activeWorkshopChannel:r}=t();r&&(console.log(`Disconnecting from workshop channel: ${r}`),t().disconnectFromChannel(),e(n=>{n.workshopChannels[r]&&(n.workshopChannels[r].connected=!1)}))},sendWorkshopMessage:r=>{const{activeWorkshopChannel:n}=t();if(n){e(o=>{const s=o.workshopChannels[n];s&&(s.responding=!0)}),t().sendMessage(r);const a=()=>{const o=t(),s=o.channels[o.activeChatChannel||n],l=o.workshopChannels[n];s&&l&&e(u=>{u.workshopChannels[n].messages=[...s.messages],u.workshopChannels[n].responding=s.responding,u.workshopChannels[n].connected=s.connected,u.workshopChannels[n].error=s.error})};a();const i=setInterval(()=>{if(!t().workshopChannels[n]?.responding){clearInterval(i);return}a()},100);setTimeout(()=>clearInterval(i),3e4)}},createDefaultWorkshopChannel:async r=>{try{const n=r||"00000000-0000-0000-0000-000000000002";console.log(`Creating default workshop channel for agent: ${n}`),await t().createDefaultChannel(n);const{activeChatChannel:a,channels:i,chatHistory:o}=t();a&&i[a]&&(e(s=>{s.workshopChannels[a]=i[a],s.workshopHistory=o,s.activeWorkshopChannel=a,s.activeChatChannel=null}),console.log(`Workshop channel created: ${a}`))}catch(n){console.error("Failed to create default workshop channel:",n),t().showNotification("创建失败","无法创建新的工作坊会话,请稍后重试","error")}},updateWorkshopTopicName:async(r,n)=>{await t().updateTopicName(r,n),e(a=>{a.workshopChannels[r]&&(a.workshopChannels[r].title=n);const i=a.workshopHistory.find(o=>o.id===r);i&&(i.title=n)}),console.log(`Workshop topic ${r} name updated to: ${n}`)},deleteWorkshopTopic:async r=>{await t().deleteTopic(r),e(n=>{if(delete n.workshopChannels[r],n.workshopHistory=n.workshopHistory.filter(a=>a.id!==r),n.activeWorkshopChannel===r){const a=n.workshopHistory[0];a?(n.activeWorkshopChannel=a.id,t().activateWorkshopChannel(a.id)):n.activeWorkshopChannel=null}}),console.log(`Workshop topic ${r} deleted`)},clearWorkshopSessionTopics:async r=>{await t().clearSessionTopics(r),await t().fetchWorkshopHistory(),console.log(`Workshop session ${r} topics cleared`)},confirmToolCall:(r,n)=>{Js.sendStructuredMessage({type:"tool_call_confirm",data:{toolCallId:n}}),e(a=>{a.channels[r]&&a.channels[r].messages.forEach(i=>{i.toolCalls&&i.toolCalls.forEach(o=>{o.id===n&&o.status==="waiting_confirmation"&&(o.status="executing")})})})},cancelToolCall:(r,n)=>{Js.sendStructuredMessage({type:"tool_call_cancel",data:{toolCallId:n}}),e(a=>{a.channels[r]&&a.channels[r].messages.forEach(i=>{i.toolCalls&&i.toolCalls.forEach(o=>{o.id===n&&o.status==="waiting_confirmation"&&(o.status="failed",o.error="用户取消执行")})})})},showNotification:(r,n,a="info",i,o)=>{e({notification:{isOpen:!0,title:r,message:n,type:a,actionLabel:i,onAction:o}})},closeNotification:()=>{e({notification:null})}}),eNe=(e,t)=>({loadingStates:{},setLoading:(r,n)=>{e(a=>{n?a.loadingStates[r]=!0:delete a.loadingStates[r]})},getLoading:r=>t().loadingStates[r]||!1,clearAllLoading:()=>{e(r=>{r.loadingStates={}})}}),Sa={MCP_SERVERS:"mcpServers",MCP_SERVER_CREATE:"mcpServerCreate",MCP_SERVER_UPDATE:"mcpServerUpdate",MCP_SERVER_DELETE:"mcpServerDelete"},zc=()=>{const e=Ze.getState().backendUrl;return(!e||e===""||e==="http://")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:e},Uc=()=>{const e={"Content-Type":"application/json"},t=Jr.getToken();return t&&(e.Authorization=`Bearer ${t}`),e},su={async getMcpServers(){const e=await fetch(`${zc()}/xyzen/api/v1/mcps`,{headers:Uc()});if(!e.ok)throw new Error("Failed to fetch MCP servers");return e.json()},async createMcpServer(e){const t=await fetch(`${zc()}/xyzen/api/v1/mcps`,{method:"POST",headers:Uc(),body:JSON.stringify(e)});if(!t.ok){const r=await t.text();throw new Error(`Failed to create MCP server: ${t.status} ${r}`)}return t.json()},async updateMcpServer(e,t){const r=await fetch(`${zc()}/xyzen/api/v1/mcps/${e}`,{method:"PATCH",headers:Uc(),body:JSON.stringify(t)});if(!r.ok){const n=await r.text();throw new Error(`Failed to update MCP server: ${r.status} ${n}`)}return r.json()},async deleteMcpServer(e){const t=await fetch(`${zc()}/xyzen/api/v1/mcps/${e}`,{method:"DELETE",headers:Uc()});if(!t.ok){const r=await t.text();throw new Error(`Failed to delete MCP server: ${t.status} ${r}`)}},async refreshMcpServers(){const e=await fetch(`${zc()}/xyzen/api/v1/mcps/refresh`,{method:"POST",headers:Uc()});if(!e.ok){const t=await e.text();throw new Error(`Failed to trigger MCP server refresh: ${e.status} ${t}`)}},async activateSmitheryServer(e,t){const r=await fetch(`${zc()}/xyzen/api/v1/mcps/smithery/activate`,{method:"POST",headers:Uc(),body:JSON.stringify({qualifiedName:e,profile:t})});if(!r.ok){const n=await r.text();throw new Error(`Failed to activate Smithery server: ${r.status} ${n}`)}return r.json()},async getBuiltinMcpServers(){try{const e=await fetch(`${zc()}/xyzen/api/v1/mcps/discover`,{headers:Uc()});return e.ok?e.json():(console.warn("Failed to discover builtin MCP servers"),[])}catch(e){return console.warn("Error discovering builtin MCP servers:",e),[]}}};function tNe(e){if("data"in e&&"source"in e&&e.source==="official")return e;const t=e,r={name:t.name,module_name:t.module_name,mount_path:t.mount_path,description:t.description,is_builtin:!0,requires_auth:t.requires_auth||!1,is_default:t.is_default,banner:t.banner};return{id:t.module_name,name:t.name,description:t.description,source:"official",cover:t.banner,data:r}}function rNe(e){return Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map(t=>tNe(t)):(console.warn("convertBuiltinServers: input is not an array",e),[])}const nNe=(e,t)=>({mcpServers:[],builtinMcpServers:[],lastFetchTime:0,isEditMcpServerModalOpen:!1,editingMcpServer:null,openEditMcpServerModal:r=>{e({isEditMcpServerModalOpen:!0,editingMcpServer:r})},closeEditMcpServerModal:()=>{e({isEditMcpServerModalOpen:!1,editingMcpServer:null})},fetchMcpServers:async()=>{const{setLoading:r}=t(),n=Date.now(),{lastFetchTime:a}=t();if(n-a<5e3){console.log("McpSlice: 使用缓存的MCP服务器数据");return}r(Sa.MCP_SERVERS,!0);try{console.log("McpSlice: Starting to fetch MCP servers...");const i=await su.getMcpServers();console.log(`McpSlice: Loaded ${i.length} MCP servers`),e({mcpServers:i,lastFetchTime:n})}catch(i){console.error("Failed to fetch MCP servers:",i)}finally{r(Sa.MCP_SERVERS,!1)}},fetchBuiltinMcpServers:async()=>{try{const r=await su.getBuiltinMcpServers(),n=rNe(r),{mcpServers:a,backendUrl:i}=t(),o=a.map(l=>l.url),s=n.filter(l=>{const u=l.data.mount_path.endsWith("/")?l.data.mount_path:`${l.data.mount_path}/`,c=`${i}${u}`;return!o.includes(c)});e({builtinMcpServers:s})}catch(r){console.error("Failed to fetch builtin MCP servers:",r),e({builtinMcpServers:[]})}},refreshMcpServers:async()=>{const{setLoading:r}=t();r(Sa.MCP_SERVERS,!0);try{await su.refreshMcpServers(),setTimeout(()=>{t().fetchMcpServers()},1e3)}catch(n){console.error("Failed to refresh MCP servers:",n)}finally{setTimeout(()=>r(Sa.MCP_SERVERS,!1),1500)}},addMcpServer:async r=>{const{setLoading:n}=t();n(Sa.MCP_SERVER_CREATE,!0);try{const a=await su.createMcpServer(r);e(i=>{i.mcpServers.push(a)}),t().closeAddMcpServerModal()}catch(a){throw console.error("Failed to add MCP server:",a),a}finally{n(Sa.MCP_SERVER_CREATE,!1)}},quickAddBuiltinServer:async r=>{const{backendUrl:n,token:a,setLoading:i}=t();i(Sa.MCP_SERVER_CREATE,!0);try{const o=r.data.mount_path.endsWith("/")?r.data.mount_path:`${r.data.mount_path}/`,s={name:r.name,description:r.description,url:`${n}${o}`,token:a||""},l=await su.createMcpServer(s);e(u=>{u.mcpServers.push(l),u.builtinMcpServers=u.builtinMcpServers.filter(c=>c.data.module_name!==r.data.module_name)}),t().closeAddMcpServerModal()}catch(o){throw console.error("Failed to add builtin MCP server:",o),o}finally{i(Sa.MCP_SERVER_CREATE,!1)}},activateSmitheryServer:async(r,n)=>{const{setLoading:a}=t();a(Sa.MCP_SERVER_CREATE,!0);try{const i=await su.activateSmitheryServer(r,n);e(o=>{o.mcpServers.push(i)}),t().closeAddMcpServerModal()}catch(i){throw console.error("Failed to activate Smithery MCP server:",i),i}finally{a(Sa.MCP_SERVER_CREATE,!1)}},editMcpServer:async(r,n)=>{const{setLoading:a}=t();a(Sa.MCP_SERVER_UPDATE,!0);try{const i=await su.updateMcpServer(r,n);e(o=>{const s=o.mcpServers.findIndex(l=>l.id===r);s!==-1&&(o.mcpServers[s]=i)})}catch(i){throw console.error("Failed to edit MCP server:",i),i}finally{a(Sa.MCP_SERVER_UPDATE,!1)}},removeMcpServer:async r=>{const{setLoading:n}=t();n(Sa.MCP_SERVER_DELETE,!0);try{await su.deleteMcpServer(r),e(a=>{a.mcpServers=a.mcpServers.filter(i=>i.id!==r)})}catch(a){throw console.error("Failed to remove MCP server:",a),a}finally{n(Sa.MCP_SERVER_DELETE,!1)}},updateMcpServerInList:r=>{e(n=>{const a=n.mcpServers.findIndex(i=>i.id===r.id);a!==-1?n.mcpServers[a]=r:n.mcpServers.push(r)})}}),aNe=(e,t)=>({toolTestModal:{isOpen:!1},toolExecutionHistory:[],openToolTestModal:(r,n,a)=>{e(i=>{i.toolTestModal={isOpen:!0,server:r,toolName:n,toolDescription:a}})},closeToolTestModal:()=>{e(r=>{r.toolTestModal={isOpen:!1}})},addToolExecution:r=>{e(n=>{const a={...r,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,timestamp:new Date};n.toolExecutionHistory.unshift(a),n.toolExecutionHistory.length>100&&(n.toolExecutionHistory=n.toolExecutionHistory.slice(0,100))})},clearToolExecutionHistory:()=>{e(r=>{r.toolExecutionHistory=[]})},getToolExecutionHistory:(r,n)=>{const{toolExecutionHistory:a}=t();return!r&&!n?a:a.filter(i=>{const o=!r||i.serverId===r,s=!n||i.toolName===n;return o&&s})}});class iNe{getBackendUrl(){const{backendUrl:t}=Ze.getState();return(!t||t==="")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:t}createAuthHeaders(){const t={"Content-Type":"application/json"},r=Jr.getToken();return r&&(t.Authorization=`Bearer ${r}`),t}async getProviderTemplates(){const t=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/templates`);if(!t.ok)throw new Error("Failed to fetch provider templates");return t.json()}async getMyProviders(){const t=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/me`,{headers:this.createAuthHeaders()});if(!t.ok)throw new Error("Failed to fetch your providers");return t.json()}async createProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/`,{method:"POST",headers:this.createAuthHeaders(),body:JSON.stringify(t)});if(!r.ok){const n=await r.text();throw new Error(`Failed to create provider: ${n}`)}return r.json()}async getProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{headers:this.createAuthHeaders()});if(!r.ok)throw new Error("Failed to fetch provider");return r.json()}async updateProvider(t,r){const n=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{method:"PATCH",headers:this.createAuthHeaders(),body:JSON.stringify(r)});if(!n.ok){const a=await n.text();throw new Error(`Failed to update provider: ${a}`)}return n.json()}async deleteProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{method:"DELETE",headers:this.createAuthHeaders()});if(!r.ok){const n=await r.text();throw new Error(`Failed to delete provider: ${n}`)}}}const vm=new iNe;class ym{static STORAGE_KEY="xyzen_provider_preferences";static getPreferences(){try{const t=localStorage.getItem(this.STORAGE_KEY);if(t){const r=JSON.parse(t);return{defaultProviderId:r.defaultProviderId||null,lastUsedProviders:r.lastUsedProviders||{}}}}catch(t){console.warn("Failed to load provider preferences:",t)}return{defaultProviderId:null,lastUsedProviders:{}}}static savePreferences(t){try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(r){console.error("Failed to save provider preferences:",r)}}static setDefaultProvider(t){const r=this.getPreferences();r.defaultProviderId=t,this.savePreferences(r)}static getDefaultProviderId(){return this.getPreferences().defaultProviderId}static getDefaultProvider(t){const r=this.getDefaultProviderId();return r&&t.find(n=>n.id===r)||null}static setLastUsedProviderForAgent(t,r){const n=this.getPreferences();n.lastUsedProviders[t]=r,this.savePreferences(n)}static getLastUsedProviderForAgent(t){return this.getPreferences().lastUsedProviders[t]||null}static clearPreferences(){try{localStorage.removeItem(this.STORAGE_KEY)}catch(t){console.error("Failed to clear provider preferences:",t)}}static migrateFromDatabaseDefault(t){if(!this.getPreferences().defaultProviderId){const n=t.find(a=>a.is_default&&!a.is_system);n&&(console.info("Migrating database default provider to local preferences:",n.name),this.setDefaultProvider(n.id))}}}function oNe(e,t){if(e?.provider_id){const i=t.find(o=>o.id===e.provider_id);if(i)return i}const r=ym.getDefaultProvider(t);if(r&&!r.is_system)return r;const n=t.find(i=>i.is_system);return n||t.filter(i=>!i.is_system)[0]||null}function sNe(e,t,r){return t?e?.provider_id===t.id?"助手指定":ym.getDefaultProvider(r)?.id===t.id&&!t.is_system?"全局默认":t.is_system?"系统":"自动选择":"无提供商"}const lNe=(e,t)=>({llmProviders:[],llmProvidersLoading:!1,providerTemplates:[],templatesLoading:!1,userDefaultProviderId:null,fetchProviderTemplates:async()=>{e({templatesLoading:!0});try{const r=await vm.getProviderTemplates();e({providerTemplates:r,templatesLoading:!1})}catch(r){console.error("Failed to fetch provider templates:",r),e({templatesLoading:!1})}},fetchMyProviders:async()=>{e({llmProvidersLoading:!0});try{const r=await vm.getMyProviders();e({llmProviders:r,llmProvidersLoading:!1}),t().initializeProviderPreferences(),ym.migrateFromDatabaseDefault(r)}catch(r){console.error("Failed to fetch your providers:",r),e({llmProvidersLoading:!1})}},initializeProviderPreferences:()=>{const r=ym.getDefaultProviderId();e({userDefaultProviderId:r})},setUserDefaultProvider:r=>{ym.setDefaultProvider(r),e({userDefaultProviderId:r})},getUserDefaultProvider:()=>{const{llmProviders:r,userDefaultProviderId:n}=t();return n&&r.find(a=>a.id===n)||null},resolveProviderForAgent:r=>{const{llmProviders:n}=t();return oNe(r,n)},addProvider:async r=>{try{const n=await vm.createProvider(r);e(s=>{s.llmProviders.push(n)});const{llmProviders:a,userDefaultProviderId:i}=t();a.filter(s=>!s.is_system).length===1&&!i&&t().setUserDefaultProvider(n.id),t().closeAddLlmProviderModal(),t().closeSettingsModal()}catch(n){throw console.error("Failed to add provider:",n),n}},updateProvider:async(r,n)=>{try{const a=await vm.updateProvider(r,n);e(i=>{const o=i.llmProviders.findIndex(s=>s.id===r);o!==-1&&(i.llmProviders[o]=a)})}catch(a){throw console.error("Failed to update provider:",a),a}},removeProvider:async r=>{try{await vm.deleteProvider(r),e(a=>{a.llmProviders=a.llmProviders.filter(i=>i.id!==r)});const{userDefaultProviderId:n}=t();n===r&&t().setUserDefaultProvider(null)}catch(n){throw console.error("Failed to remove provider:",n),n}}}),bm={Sidebar:"sidebar",Fullscreen:"fullscreen"},uNe=!1,cNe=!0;console.log("=== Environment Debug ==="),console.log("MODE:","production"),console.log("isDevelopment:",uNe),console.log("isProduction:",cNe),console.log("VITE_XYZEN_BACKEND_URL:",void 0);const $c=window!==void 0?`${window.location.protocol}//${window.location.host}`:"http://localhost:48196";console.log("Final DEFAULT_BACKEND_URL:",$c);const AV=localStorage.getItem("layoutStyle")?localStorage.getItem("layoutStyle"):bm.Fullscreen;console.log("Final DEFAULT_LAYOUT_STYLE:",AV);const dNe=1024,fNe=64*9,hNe=64*15,h1=64*10;Js.setBackendUrl($c);const pNe=e=>({backendUrl:$c,isXyzenOpen:!1,panelWidth:h1,activeTabIndex:0,activePanel:"chat",theme:localStorage.getItem("theme")||"system",layoutStyle:AV,isMcpListModalOpen:!1,isLlmProvidersModalOpen:!1,isAddMcpServerModalOpen:!1,isAddLlmProviderModalOpen:!1,isSettingsModalOpen:!1,activeSettingsCategory:"provider",activeUiSetting:"theme",selectedProviderId:null,pendingInput:"",toggleXyzen:()=>e(t=>({isXyzenOpen:!t.isXyzenOpen})),openXyzen:()=>e({isXyzenOpen:!0}),closeXyzen:()=>e({isXyzenOpen:!1}),setPanelWidth:t=>e({panelWidth:t}),setTabIndex:t=>e({activeTabIndex:t}),setActivePanel:t=>e({activePanel:t}),setTheme:t=>{typeof window<"u"&&localStorage.setItem("theme",t),e({theme:t})},setLayoutStyle:t=>{typeof window<"u"&&localStorage.setItem("layoutStyle",t),e({layoutStyle:t})},setBackendUrl:t=>{e({backendUrl:t}),Js.setBackendUrl(t)},openMcpListModal:()=>e({isMcpListModalOpen:!0}),closeMcpListModal:()=>e({isMcpListModalOpen:!1}),openLlmProvidersModal:()=>e({isLlmProvidersModalOpen:!0}),closeLlmProvidersModal:()=>e({isLlmProvidersModalOpen:!1}),openAddMcpServerModal:()=>e({isAddMcpServerModalOpen:!0}),closeAddMcpServerModal:()=>e({isAddMcpServerModalOpen:!1}),openAddLlmProviderModal:()=>e({isAddLlmProviderModalOpen:!0}),closeAddLlmProviderModal:()=>e({isAddLlmProviderModalOpen:!1}),openSettingsModal:(t="provider")=>e({isSettingsModalOpen:!0,activeSettingsCategory:t}),closeSettingsModal:()=>e({isSettingsModalOpen:!1,selectedProviderId:null}),setActiveSettingsCategory:t=>e({activeSettingsCategory:t}),setActiveUiSetting:t=>e({activeUiSetting:t}),setSelectedProvider:t=>e({selectedProviderId:t}),setPendingInput:t=>e({pendingInput:t}),submitInput:()=>e(()=>({isXyzenOpen:!0,activeTabIndex:1,activePanel:"chat"}))}),Ze=D4e()(M4e(G4e((...e)=>({...pNe(...e),...J4e(...e),...Y4e(...e),...nNe(...e),...aNe(...e),...lNe(...e),...X4e(...e),...eNe(...e)})),{name:"xyzen-storage",storage:sV(()=>localStorage),partialize:e=>({isXyzenOpen:e.isXyzenOpen,panelWidth:e.panelWidth,activePanel:e.activePanel,theme:e.theme,token:e.token,user:e.user,backendUrl:e.backendUrl})})),TA=()=>{const e=Ze.getState().backendUrl;return(!e||e==="")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:e};class xm{static TOKEN_KEY="access_token";getToken(){return typeof localStorage<"u"?localStorage.getItem(xm.TOKEN_KEY):null}setToken(t){typeof localStorage<"u"&&localStorage.setItem(xm.TOKEN_KEY,t)}removeToken(){typeof localStorage<"u"&&localStorage.removeItem(xm.TOKEN_KEY)}async getAuthStatus(){const t=await fetch(`${TA()}/xyzen/api/v1/auth/status`);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async validateToken(t){const r=t||this.getToken();if(!r)return{success:!1,error_code:"NO_TOKEN",error_message:"No access token available"};const n=await fetch(`${TA()}/xyzen/api/v1/auth/validate`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(!n.ok)throw n.status===401&&this.removeToken(),new Error(`HTTP error! status: ${n.status}`);return n.json()}async getAuthConfig(){const t=await fetch(`${TA()}/xyzen/api/v1/auth/config`);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}logout(){this.removeToken()}}const Jr=new xm,mNe="access_token";function gNe(e,t){const r=t??(typeof document<"u"?document.cookie:"");if(!r)return null;const n=r.match(new RegExp("(^|;\\s*)"+e+"=([^;]+)"));return n?decodeURIComponent(n[2]):null}function vNe(e,t={}){const{storageKey:r=mNe,storage:n=typeof window<"u"?window.localStorage:void 0,cookieString:a,allowExisting:i=!0}=t;if(!n)return null;const o=n.getItem(r);if(o&&i)return o;if(o)return null;const s=gNe(e,a);return s?(n.setItem(r,s),s):null}const yNe=e=>({id:e.id,username:e.display_name||e.username||"Unknown",avatar:e.avatar_url||"https://storage.sciol.ac.cn/library/default_avatar.png"}),_A=async(e=!1)=>{const{setStatus:t,setUser:r,setToken:n}=Ze.getState();t("loading");try{if(!(await Jr.getAuthStatus()).is_configured){t("failed");return}let i=Jr.getToken();if(i||(i=vNe("appAccessKey")??null),!i){r(null),n(null),t("failed");return}const o=await Jr.validateToken(i);if(!o.success||!o.user_info){Jr.removeToken(),r(null),n(null),t("failed");return}console.log("Auth validation succeeded:",o);const s=yNe(o.user_info);r(s),n(i),t("succeeded")}catch(a){console.error("Auth check failed in Core:",a),r(null),n(null),t("failed"),Jr.removeToken()}},bNe=async e=>{const{setStatus:t,setUser:r,setToken:n}=Ze.getState();t("loading");try{Jr.setToken(e),await _A(!0)}catch(a){console.error("Login failed in Core:",a),r(null),n(null),t("failed")}},xNe=()=>{const{setStatus:e,setUser:t,setToken:r}=Ze.getState();Jr.logout(),t(null),r(null),e("idle")},CV=async()=>{await _A(!0)},kV=e=>Symbol.iterator in e,NV=e=>"entries"in e,IV=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(const[a,i]of r)if(!Object.is(i,n.get(a)))return!1;return!0},SNe=(e,t)=>{const r=e[Symbol.iterator](),n=t[Symbol.iterator]();let a=r.next(),i=n.next();for(;!a.done&&!i.done;){if(!Object.is(a.value,i.value))return!1;a=r.next(),i=n.next()}return!!a.done&&!!i.done};function wNe(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:kV(e)&&kV(t)?NV(e)&&NV(t)?IV(e,t):SNe(e,t):IV({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function ENe(e){const t=N.useRef(void 0);return r=>{const n=e(r);return wNe(t.current,n)?t.current:t.current=n}}function AA(){const{user:e,token:t,status:r}=Ze(ENe(l=>({user:l.user,token:l.token,status:l.status}))),n=r==="succeeded"&&!!e,a=r==="loading",i=N.useCallback(async l=>{await bNe(l)},[]),o=N.useCallback(()=>{xNe()},[]),s=N.useCallback(async(l=!1)=>{await _A(l)},[]);return{user:e,token:t,status:r,isLoading:a,isAuthenticated:n,login:i,logout:o,checkAuth:s}}var Sm=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vc=typeof window>"u"||"Deno"in globalThis;function ja(){}function TNe(e,t){return typeof e=="function"?e(t):e}function CA(e){return typeof e=="number"&&e>=0&&e!==1/0}function DV(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lu(e,t){return typeof e=="function"?e(t):e}function Ii(e,t){return typeof e=="function"?e(t):e}function MV(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==kA(o,t.options))return!1}else if(!Em(t.queryKey,o))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||a&&a!==t.state.fetchStatus||i&&!i(t))}function RV(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(wm(t.options.mutationKey)!==wm(i))return!1}else if(!Em(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function kA(e,t){return(t?.queryKeyHashFn||wm)(e)}function wm(e){return JSON.stringify(e,(t,r)=>DA(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function Em(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Em(e[r],t[r])):!1}function NA(e,t){if(e===t)return e;const r=LV(e)&&LV(t);if(r||DA(e)&&DA(t)){const n=r?e:Object.keys(e),a=n.length,i=r?t:Object.keys(t),o=i.length,s=r?[]:{},l=new Set(n);let u=0;for(let c=0;c<o;c++){const d=r?c:i[c];(!r&&l.has(d)||r)&&e[d]===void 0&&t[d]===void 0?(s[d]=void 0,u++):(s[d]=NA(e[d],t[d]),s[d]===e[d]&&e[d]!==void 0&&u++)}return a===o&&u===a?e:s}return t}function IA(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function LV(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function DA(e){if(!OV(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!OV(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function OV(e){return Object.prototype.toString.call(e)==="[object Object]"}function _Ne(e){return new Promise(t=>{setTimeout(t,e)})}function MA(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return NA(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return NA(e,t)}return t}function ANe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function CNe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var p1=Symbol();function PV(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===p1&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===p1?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kNe(e,t){return typeof e=="function"?e(...t):!!e}var NNe=class extends Sm{#t;#e;#r;constructor(){super(),this.#r=e=>{if(!Vc&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},RA=new NNe,INe=class extends Sm{#t=!0;#e;#r;constructor(){super(),this.#r=e=>{if(!Vc&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},m1=new INe;function LA(){let e,t;const r=new Promise((a,i)=>{e=a,t=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}function DNe(e){return Math.min(1e3*2**e,3e4)}function FV(e){return(e??"online")==="online"?m1.isOnline():!0}var BV=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function OA(e){return e instanceof BV}function jV(e){let t=!1,r=0,n=!1,a;const i=LA(),o=m=>{n||(f(new BV(m)),e.abort?.())},s=()=>{t=!0},l=()=>{t=!1},u=()=>RA.isFocused()&&(e.networkMode==="always"||m1.isOnline())&&e.canRun(),c=()=>FV(e.networkMode)&&e.canRun(),d=m=>{n||(n=!0,e.onSuccess?.(m),a?.(),i.resolve(m))},f=m=>{n||(n=!0,e.onError?.(m),a?.(),i.reject(m))},h=()=>new Promise(m=>{a=g=>{(n||u())&&m(g)},e.onPause?.()}).then(()=>{a=void 0,n||e.onContinue?.()}),p=()=>{if(n)return;let m;const g=r===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(d).catch(v=>{if(n)return;const y=e.retry??(Vc?0:3),x=e.retryDelay??DNe,S=typeof x=="function"?x(r,v):x,E=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,v);if(t||!E){f(v);return}r++,e.onFail?.(r,v),_Ne(S).then(()=>u()?void 0:h()).then(()=>{t?f(v):p()})})};return{promise:i,cancel:o,continue:()=>(a?.(),i),cancelRetry:s,continueRetry:l,canStart:c,start:()=>(c()?p():h().then(p),i)}}var MNe=e=>setTimeout(e,0);function RNe(){let e=[],t=0,r=s=>{s()},n=s=>{s()},a=MNe;const i=s=>{t?e.push(s):a(()=>{r(s)})},o=()=>{const s=e;e=[],s.length&&a(()=>{n(()=>{s.forEach(l=>{r(l)})})})};return{batch:s=>{let l;t++;try{l=s()}finally{t--,t||o()}return l},batchCalls:s=>(...l)=>{i(()=>{s(...l)})},schedule:i,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{a=s}}}var jn=RNe(),zV=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),CA(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vc?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},LNe=class extends zV{#t;#e;#r;#n;#a;#s;#o;constructor(e){super(),this.#o=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.client,this.#r=this.#n.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ONe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=MA(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ja).catch(ja):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>Ii(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===p1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>lu(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!DV(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#o?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(u=>u.options.queryFn);l&&this.setOptions(l.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},a=()=>{const l=PV(this.options,t),c=(()=>{const d={client:this.#n,queryKey:this.queryKey,meta:this.meta};return n(d),d})();return this.#o=!1,this.options.persister?this.options.persister(l,c,this):l(c)},o=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta});const s=l=>{OA(l)&&l.silent||this.#i({type:"error",error:l}),OA(l)||(this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this)),this.scheduleGc()};return this.#a=jV({initialPromise:t?.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:l=>{if(l===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(l)}catch(u){s(u);return}this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),this.scheduleGc()},onError:s,onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}),this.#a.start()}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...UV(r.data,this.options),fetchMeta:e.meta??null};case"success":return this.#e=void 0,{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return OA(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),jn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function UV(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:FV(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ONe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var PNe=class extends Sm{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,a=t.queryHash??kA(n,t);let i=this.get(a);return i||(i=new LNe({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(i)),i}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){jn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>MV(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>MV(e,r)):t}notify(e){jn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){jn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){jn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},FNe=class extends zV{#t;#e;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||BNe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})};this.#r=jV({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#n({type:"failed",failureCount:a,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const r=this.state.status==="pending",n=!this.#r.canStart();try{if(r)t();else{this.#n({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const i=await this.options.onMutate?.(e);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:n})}const a=await this.#r.start();return await this.#e.config.onSuccess?.(a,e,this.state.context,this),await this.options.onSuccess?.(a,e,this.state.context),await this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(a,null,e,this.state.context),this.#n({type:"success",data:a}),a}catch(a){try{throw await this.#e.config.onError?.(a,e,this.state.context,this),await this.options.onError?.(a,e,this.state.context),await this.#e.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,a,e,this.state.context),a}finally{this.#n({type:"error",error:a})}}finally{this.#e.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),jn.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function BNe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jNe=class extends Sm{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#r=0}#t;#e;#r;build(e,t,r){const n=new FNe({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=g1(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=g1(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=g1(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(a=>a.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=g1(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){jn.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>RV(t,r))}findAll(e={}){return this.getAll().filter(t=>RV(e,t))}notify(e){jn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return jn.batch(()=>Promise.all(e.map(t=>t.continue().catch(ja))))}};function g1(e){return e.options.scope?.id}function v1(e){return{onFetch:(t,r)=>{const n=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},l=0;const u=async()=>{let c=!1;const d=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=PV(t.options,t.fetchOptions),h=async(p,m,g)=>{if(c)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const y=(()=>{const w={client:t.client,queryKey:t.queryKey,pageParam:m,direction:g?"backward":"forward",meta:t.options.meta};return d(w),w})(),x=await f(y),{maxPages:S}=t.options,E=g?CNe:ANe;return{pages:E(p.pages,x,S),pageParams:E(p.pageParams,m,S)}};if(a&&i.length){const p=a==="backward",m=p?$V:PA,g={pages:i,pageParams:o},v=m(n,g);s=await h(g,v,p)}else{const p=e??i.length;do{const m=l===0?o[0]??n.initialPageParam:PA(n,s);if(l>0&&m==null)break;s=await h(s,m),l++}while(l<p)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function PA(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function $V(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function zNe(e,t){return t?PA(e,t)!=null:!1}function UNe(e,t){return!t||!e.getPreviousPageParam?!1:$V(e,t)!=null}var $Ne=class{#t;#e;#r;#n;#a;#s;#o;#i;constructor(e={}){this.#t=e.queryCache||new PNe,this.#e=e.mutationCache||new jNe,this.#r=e.defaultOptions||{},this.#n=new Map,this.#a=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=RA.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=m1.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(lu(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#t.get(n.queryHash)?.state.data,o=TNe(t,i);if(o!==void 0)return this.#t.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return jn.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;jn.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t;return jn.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=jn.batch(()=>this.#t.findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(ja).catch(ja)}invalidateQueries(e,t={}){return jn.batch(()=>(this.#t.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=jn.batch(()=>this.#t.findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(ja)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(ja)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(lu(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ja).catch(ja)}fetchInfiniteQuery(e){return e.behavior=v1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ja).catch(ja)}ensureInfiniteQueryData(e){return e.behavior=v1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return m1.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(wm(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{Em(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(wm(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()],r={};return t.forEach(n=>{Em(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=kA(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===p1&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},VV=class extends Sm{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#o=LA(),this.options.experimental_prefetchInRender||this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#r=void 0;#n=void 0;#a;#s;#o;#i;#m;#f;#h;#u;#c;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),HV(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return FA(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return FA(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,r=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ii(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#e.setOptions(this.options),t._defaulted&&!IA(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&GV(this.#e,r,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==r||Ii(this.options.enabled,this.#e)!==Ii(t.enabled,this.#e)||lu(this.options.staleTime,this.#e)!==lu(t.staleTime,this.#e))&&this.#g();const a=this.#v();n&&(this.#e!==r||Ii(this.options.enabled,this.#e)!==Ii(t.enabled,this.#e)||a!==this.#l)&&this.#y(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return HNe(this,r)&&(this.#n=r,this.#s=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),Reflect.get(r,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(e){this.#w();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ja)),t}#g(){this.#x();const e=lu(this.options.staleTime,this.#e);if(Vc||this.#n.isStale||!CA(e))return;const r=DV(this.#n.dataUpdatedAt,e)+1;this.#u=setTimeout(()=>{this.#n.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#S(),this.#l=e,!(Vc||Ii(this.options.enabled,this.#e)===!1||!CA(this.#l)||this.#l===0)&&(this.#c=setInterval(()=>{(this.options.refetchIntervalInBackground||RA.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#S(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const r=this.#e,n=this.options,a=this.#n,i=this.#a,o=this.#s,l=e!==r?e.state:this.#r,{state:u}=e;let c={...u},d=!1,f;if(t._optimisticResults){const _=this.hasListeners(),A=!_&&HV(e,t),C=_&&GV(e,r,t,n);(A||C)&&(c={...c,...UV(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:m}=c;f=c.data;let g=!1;if(t.placeholderData!==void 0&&f===void 0&&m==="pending"){let _;a?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(_=a.data,g=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,_!==void 0&&(m="success",f=MA(a?.data,_,t),d=!0)}if(t.select&&f!==void 0&&!g)if(a&&f===i?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=MA(a?.data,f,t),this.#f=f,this.#i=null}catch(_){this.#i=_}this.#i&&(h=this.#i,f=this.#f,p=Date.now(),m="error");const v=c.fetchStatus==="fetching",y=m==="pending",x=m==="error",S=y&&v,E=f!==void 0,T={status:m,fetchStatus:c.fetchStatus,isPending:y,isSuccess:m==="success",isError:x,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:c.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:x&&!E,isPaused:c.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:x&&E,isStale:BA(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ii(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const _=I=>{T.status==="error"?I.reject(T.error):T.data!==void 0&&I.resolve(T.data)},A=()=>{const I=this.#o=T.promise=LA();_(I)},C=this.#o;switch(C.status){case"pending":e.queryHash===r.queryHash&&_(C);break;case"fulfilled":(T.status==="error"||T.data!==C.value)&&A();break;case"rejected":(T.status!=="error"||T.error!==C.reason)&&A();break}}return T}updateResult(){const e=this.#n,t=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#s=this.options,this.#a.data!==void 0&&(this.#h=this.#e),IA(t,e))return;this.#n=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!this.#p.size)return!0;const i=new Set(a??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#n).some(o=>{const s=o;return this.#n[s]!==e[s]&&i.has(s)})};this.#E({listeners:r()})}#w(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#E(e){jn.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function VNe(e,t){return Ii(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function HV(e,t){return VNe(e,t)||e.state.data!==void 0&&FA(e,t,t.refetchOnMount)}function FA(e,t,r){if(Ii(t.enabled,e)!==!1&&lu(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&BA(e,t)}return!1}function GV(e,t,r,n){return(e!==t||Ii(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&BA(e,r)}function BA(e,t){return Ii(t.enabled,e)!==!1&&e.isStaleByTime(lu(t.staleTime,e))}function HNe(e,t){return!IA(e.getCurrentResult(),t)}var GNe=class extends VV{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:v1()})}getOptimisticResult(e){return e.behavior=v1(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,n=super.createResult(e,t),{isFetching:a,isRefetching:i,isError:o,isRefetchError:s}=n,l=r.fetchMeta?.fetchMore?.direction,u=o&&l==="forward",c=a&&l==="forward",d=o&&l==="backward",f=a&&l==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:zNe(t,r.data),hasPreviousPage:UNe(t,r.data),isFetchNextPageError:u,isFetchingNextPage:c,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!u&&!d,isRefetching:i&&!c&&!f}}},qV=O.createContext(void 0),qNe=e=>{const t=O.useContext(qV);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WNe=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),b.jsx(qV.Provider,{value:e,children:t})),WV=O.createContext(!1),YNe=()=>O.useContext(WV);WV.Provider;function XNe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var KNe=O.createContext(XNe()),ZNe=()=>O.useContext(KNe),QNe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},JNe=e=>{O.useEffect(()=>{e.clearReset()},[e])},eIe=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||kNe(r,[e.error,n])),tIe=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},rIe=(e,t)=>e.isLoading&&e.isFetching&&!t,nIe=(e,t)=>e?.suspense&&t.isPending,YV=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function XV(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=YNe(),a=ZNe(),i=qNe(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",tIe(o),QNe(o,a),JNe(a);const s=!i.getQueryCache().get(o.queryHash),[l]=O.useState(()=>new t(i,o)),u=l.getOptimisticResult(o),c=!n&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(d=>{const f=c?l.subscribe(jn.batchCalls(d)):ja;return l.updateResult(),f},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),O.useEffect(()=>{l.setOptions(o)},[o,l]),nIe(o,u))throw YV(o,l,a);if(eIe({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Vc&&rIe(u,n)&&(s?YV(o,l,a):i.getQueryCache().get(o.queryHash)?.promise)?.catch(ja).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function KV(e,t){return XV(e,VV)}function ZV(e,t){return XV(e,GNe)}function aIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}const iIe=O.forwardRef(aIe);function oIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const QV=O.forwardRef(oIe);function sIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const y1=O.forwardRef(sIe);function lIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))}const uIe=O.forwardRef(lIe);function cIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.745 3.745 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z"}))}const dIe=O.forwardRef(cIe);function fIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const gh=O.forwardRef(fIe);function hIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const vh=O.forwardRef(hIe);function pIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const JV=O.forwardRef(pIe);function mIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const gIe=O.forwardRef(mIe);function vIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const eH=O.forwardRef(vIe);function yIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const bIe=O.forwardRef(yIe);function xIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"}))}const tH=O.forwardRef(xIe);function SIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const rH=O.forwardRef(SIe);function wIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const EIe=O.forwardRef(wIe);function TIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const jA=O.forwardRef(TIe);function _Ie({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"}))}const nH=O.forwardRef(_Ie);function AIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}const CIe=O.forwardRef(AIe);function kIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"}))}const aH=O.forwardRef(kIe);function NIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const IIe=O.forwardRef(NIe);function DIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"}))}const zA=O.forwardRef(DIe);function MIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const Tm=O.forwardRef(MIe);function RIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const iH=O.forwardRef(RIe);function LIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const oH=O.forwardRef(LIe);function OIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"}))}const sH=O.forwardRef(OIe);function PIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const lH=O.forwardRef(PIe);function FIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))}const uH=O.forwardRef(FIe);function BIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"}))}const jIe=O.forwardRef(BIe);function zIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const UA=O.forwardRef(zIe);function UIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const $Ie=O.forwardRef(UIe);function VIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.53 16.122a3 3 0 0 0-5.78 1.128 2.25 2.25 0 0 1-2.4 2.245 4.5 4.5 0 0 0 8.4-2.245c0-.399-.078-.78-.22-1.128Zm0 0a15.998 15.998 0 0 0 3.388-1.62m-5.043-.025a15.994 15.994 0 0 1 1.622-3.395m3.42 3.42a15.995 15.995 0 0 0 4.764-4.648l3.876-5.814a1.151 1.151 0 0 0-1.597-1.597L14.146 6.32a15.996 15.996 0 0 0-4.649 4.763m3.42 3.42a6.776 6.776 0 0 0-3.42-3.42"}))}const HIe=O.forwardRef(VIe);function GIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5"}))}const qIe=O.forwardRef(GIe);function WIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"}))}const cH=O.forwardRef(WIe);function YIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const _m=O.forwardRef(YIe);function XIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const KIe=O.forwardRef(XIe);function ZIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}const yh=O.forwardRef(ZIe);function QIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 0 1-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 0 0 6.16-12.12A14.98 14.98 0 0 0 9.631 8.41m5.96 5.96a14.926 14.926 0 0 1-5.841 2.58m-.119-8.54a6 6 0 0 0-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 0 0-2.58 5.84m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 0 1-2.448-2.448 14.9 14.9 0 0 1 .06-.312m-2.24 2.39a4.493 4.493 0 0 0-1.757 4.306 4.493 4.493 0 0 0 4.306-1.758M16.5 9a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"}))}const dH=O.forwardRef(QIe);function JIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 14.25h13.5m-13.5 0a3 3 0 0 1-3-3m3 3a3 3 0 1 0 0 6h13.5a3 3 0 1 0 0-6m-16.5-3a3 3 0 0 1 3-3h13.5a3 3 0 0 1 3 3m-19.5 0a4.5 4.5 0 0 1 .9-2.7L5.737 5.1a3.375 3.375 0 0 1 2.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 0 1 .9 2.7m0 0a3 3 0 0 1-3 3m0 3h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Zm-3 6h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Z"}))}const Am=O.forwardRef(JIe);function e3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"}))}const t3e=O.forwardRef(e3e);function r3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const $A=O.forwardRef(r3e);function n3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const fH=O.forwardRef(n3e);function a3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}const hH=O.forwardRef(a3e);function i3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const o3e=O.forwardRef(i3e);function s3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const VA=O.forwardRef(s3e);function l3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))}const b1=O.forwardRef(l3e);function u3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125Z"}))}const c3e=O.forwardRef(u3e);function d3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"}))}const pH=O.forwardRef(d3e);function f3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const h3e=O.forwardRef(f3e);function p3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const x1=O.forwardRef(p3e);function m3e({isOpen:e,onClose:t,onSubmit:r}){const[n,a]=N.useState(""),i=l=>{l.preventDefault(),n.trim()&&(r(n.trim()),a(""),t())},o=N.useCallback(()=>{a(""),t()},[t]),s=l=>{l.target===l.currentTarget&&o()};return N.useEffect(()=>{const l=u=>{u.key==="Escape"&&o()};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,o]),e?b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:s,children:b.jsxs("div",{className:"w-full max-w-md rounded-sm bg-white p-6 shadow-xl dark:bg-neutral-800",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"text-lg font-medium text-neutral-900 dark:text-neutral-100",children:"输入访问令牌"}),b.jsx("button",{onClick:o,className:"rounded-sm p-1 text-neutral-400 hover:bg-neutral-100 hover:text-neutral-500 dark:hover:bg-neutral-700",children:b.jsx(x1,{className:"h-5 w-5"})})]}),b.jsxs("form",{onSubmit:i,children:[b.jsxs("div",{className:"mb-4",children:[b.jsx("label",{htmlFor:"token-input",className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"访问令牌"}),b.jsx("input",{id:"token-input",type:"password",value:n,onChange:l=>a(l.target.value),placeholder:"请输入您的访问令牌",className:"w-full rounded-sm border border-neutral-300 px-3 py-2 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100",autoFocus:!0,required:!0}),b.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"请输入有效的访问令牌进行身份验证"})]}),b.jsxs("div",{className:"flex justify-end space-x-3",children:[b.jsx("button",{type:"button",onClick:o,className:"rounded-sm px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-50 dark:text-neutral-300 dark:hover:bg-neutral-700",children:"取消"}),b.jsx("button",{type:"submit",className:"rounded-sm bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:"确认"})]})]})]})}):null}function mH({onTokenInput:e,className:t=""}){const r=AA(),[n,a]=N.useState(!1),i=async s=>{await r.login(s),e?.(s)};if(r.isLoading)return b.jsxs("div",{className:`flex items-center space-x-2 ${t}`,children:[b.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600 dark:border-neutral-700 dark:border-t-indigo-500"}),b.jsx("span",{className:"text-sm text-neutral-500",children:"检查认证状态..."})]});if(r.isAuthenticated)return b.jsx("div",{className:`flex items-center space-x-2 ${t}`,children:b.jsxs("div",{className:"flex items-center space-x-2",children:[r.user?.avatar?b.jsx("img",{src:r.user.avatar,alt:r.user.username,className:"h-6 w-6 rounded-full"}):b.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-indigo-100 dark:bg-indigo-900",children:b.jsx(b1,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"})}),b.jsx("div",{className:"flex flex-col",children:b.jsx("span",{className:"text-sm font-medium max-w-32 truncate text-neutral-900 dark:text-neutral-100",children:r.user?.username})})]})});const o=r.status==="failed"?"认证错误或未配置":"未授权的用户";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:`flex items-center space-x-2 ${t}`,children:b.jsx("button",{onClick:()=>a(!0),className:"flex items-center justify-center h-6 w-6 rounded-full text-amber-600 hover:bg-amber-50 dark:text-amber-400 dark:hover:bg-amber-900/20 transition-colors",title:o,children:b.jsx(Tm,{className:"h-4 w-4"})})}),b.jsx(m3e,{isOpen:n,onClose:()=>a(!1),onSubmit:i})]})}const gH=({className:e,title:t="设置"})=>{const{openSettingsModal:r}=Ze();return b.jsx("button",{className:`rounded-sm p-1.5 text-neutral-500 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800${e?` ${e}`:""}`,title:t,onClick:()=>r("provider"),"aria-label":t,type:"button",children:b.jsx(EIe,{className:"h-5 w-5"})})},HA=()=>{const[e,t]=N.useState("system"),r=Ze(o=>o.setTheme),n=N.useCallback(o=>{const s=window.document.documentElement,l=o==="dark"||o==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches,u=document.createElement("style");u.innerHTML="*, *::before, *::after { transition: none !important; }",document.head.appendChild(u),s.classList.toggle("dark",l),localStorage.setItem("theme",o),setTimeout(()=>{document.head.contains(u)&&document.head.removeChild(u)},50)},[]);return N.useEffect(()=>{const s=localStorage.getItem("theme")||"system";t(s),n(s)},[n]),N.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{e==="system"&&n("system")};return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e,n]),{theme:e,cycleTheme:()=>{const o=["light","dark","system"],s=o.indexOf(e),l=o[(s+1)%o.length];t(l),n(l)},setTheme:o=>{t(o),n(o),r(o)}}};function g3e(){const{isXyzenOpen:e,pendingInput:t,setPendingInput:r,submitInput:n,sendMessage:a,activeChatChannel:i,createDefaultChannel:o,openXyzen:s,setTabIndex:l}=Ze(),u=N.useRef(null),[c,d]=N.useState(!1),f=!e;N.useEffect(()=>{const g=setTimeout(()=>{d(!0)},100);return()=>clearTimeout(g)},[]),N.useEffect(()=>{if(f&&u.current){const g=setTimeout(()=>{u.current?.focus()},100);return()=>clearTimeout(g)}},[f]);const h=async g=>{if(g.key==="Enter"&&t.trim()){g.preventDefault();const v=t.trim();n();try{i||await o("default-chat"),setTimeout(()=>{a(v),r("")},200)}catch(y){console.error("Failed to create channel or send message:",y),r("")}}else g.key==="Escape"&&(g.preventDefault(),r(""),u.current?.blur())},p=()=>{},m=()=>{s(),l(1)};return f?b.jsx("div",{className:xr("fixed bottom-6 left-1/2 z-50 w-full max-w-sm -translate-x-1/2 px-4","transition-all duration-700 ease-out",c?"translate-y-0 opacity-100":"translate-y-20 opacity-0"),children:b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs("div",{className:"relative flex-1 group",children:[b.jsx("input",{ref:u,type:"text",value:t,onChange:g=>r(g.target.value),onKeyDown:h,onFocus:p,placeholder:"Type your message...",className:xr("w-full appearance-none focus:outline-none rounded-full border border-neutral-200/50 bg-white/60 backdrop-blur-md py-2.5 px-5 pr-10 text-sm text-neutral-950 placeholder:text-neutral-500","shadow-lg transition-all duration-300 ease-out origin-right","focus:outline-none focus:ring-2 focus:ring-indigo-400/50 focus:border-indigo-300 focus:bg-white/80 focus:shadow-xl focus:scale-x-110 focus:scale-y-105 focus:backdrop-blur-lg","hover:scale-[1.01] hover:shadow-xl hover:bg-white/70 hover:backdrop-blur-lg","dark:border-neutral-700/50 dark:bg-neutral-900/60 dark:text-white dark:placeholder:text-neutral-400","dark:focus:ring-indigo-500/50 dark:focus:border-indigo-600 dark:focus:bg-neutral-900/80","dark:hover:bg-neutral-900/70")}),b.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-neutral-400 dark:text-neutral-500 pointer-events-none transition-opacity duration-300 focus-within:opacity-0",children:"↵"})]}),b.jsx("button",{onClick:m,className:xr("flex h-10 w-10 items-center justify-center rounded-full border border-neutral-200/50 bg-white/60 backdrop-blur-md text-neutral-600","shadow-lg transition-all duration-300 ease-out","hover:bg-white/80 hover:text-indigo-600 hover:border-indigo-200/50 hover:shadow-xl hover:scale-110 hover:backdrop-blur-lg","focus:outline-none focus:ring-2 focus:ring-indigo-400/50 focus:border-indigo-300","active:scale-95","dark:border-neutral-700/50 dark:bg-neutral-900/60 dark:text-neutral-400","dark:hover:bg-neutral-900/80 dark:hover:text-indigo-400 dark:hover:border-indigo-700/50"),title:"Open sidebar",children:b.jsx(bIe,{className:"h-4 w-4"})})]})}):null}function v3e(...e){return t=>{e.forEach(r=>{r&&(typeof r=="function"?r(t):r.current=t)})}}function y3e(e,t){const r={...e,...t};return(e.className||t.className)&&(r.className=Dr(e.className,t.className)),(e.style||t.style)&&(r.style={...e.style,...t.style}),r}function bh({children:e,ref:t,...r}){const n=typeof e.type=="object"&&e.type!==null&&e2e(e.type),a=O.useMemo(()=>n?e.type:Ht.create(e.type),[n,e.type]);if(!O.isValidElement(e))return null;const{ref:i,...o}=e.props,s=y3e(o,r);return b.jsx(a,{...s,ref:v3e(i,t)})}function b3e({delay:e="0.3s",fillHeight:t="3px",hoverScale:r=1.05,tapScale:n=.95,asChild:a=!1,...i}){const o=a?bh:Ht.button;return b.jsx(o,{whileTap:{scale:n},whileHover:{scale:r,"--liquid-button-fill-width":"100%","--liquid-button-fill-height":"100%","--liquid-button-delay":e,transition:{"--liquid-button-fill-width":{duration:0},"--liquid-button-fill-height":{duration:0},"--liquid-button-delay":{duration:0}}},style:{"--liquid-button-fill-width":"-1%","--liquid-button-fill-height":t,"--liquid-button-delay":"0s",background:"linear-gradient(var(--liquid-button-color) 0 0) no-repeat calc(200% - var(--liquid-button-fill-width, -1%)) 100% / 200% var(--liquid-button-fill-height, 0.2em)",backgroundColor:"var(--liquid-button-background-color)",transition:`background ${e} var(--liquid-button-delay, 0s), color ${e} ${e}, background-position ${e} calc(${e} - var(--liquid-button-delay, 0s))`},...i})}const vH=typeof document<"u"?N.useLayoutEffect:()=>{};function x3e(e){const t=N.useRef(null);return vH(()=>{t.current=e},[e]),N.useCallback((...r)=>{const n=t.current;return n?.(...r)},[])}const uu=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},Hc=e=>e&&"window"in e&&e.window===e?e:uu(e).defaultView||window;function S3e(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function w3e(e){return S3e(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let E3e=!1;function GA(){return E3e}function yH(e,t){if(!GA())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let r=t;for(;r!==null;){if(r===e)return!0;r.tagName==="SLOT"&&r.assignedSlot?r=r.assignedSlot.parentNode:w3e(r)?r=r.host:r=r.parentNode}return!1}const qA=(e=document)=>{var t;if(!GA())return e.activeElement;let r=e.activeElement;for(;r&&"shadowRoot"in r&&(!((t=r.shadowRoot)===null||t===void 0)&&t.activeElement);)r=r.shadowRoot.activeElement;return r};function bH(e){return GA()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function S1(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(r=>e.test(r.brand)))||e.test(window.navigator.userAgent)}function WA(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function el(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const YA=el(function(){return WA(/^Mac/i)}),T3e=el(function(){return WA(/^iPhone/i)}),_3e=el(function(){return WA(/^iPad/i)||YA()&&navigator.maxTouchPoints>1}),A3e=el(function(){return T3e()||_3e()});el(function(){return YA()||A3e()}),el(function(){return S1(/AppleWebKit/i)&&!C3e()});const C3e=el(function(){return S1(/Chrome/i)}),k3e=el(function(){return S1(/Android/i)});el(function(){return S1(/Firefox/i)});function xH(){let e=N.useRef(new Map),t=N.useCallback((a,i,o,s)=>{let l=s?.once?(...u)=>{e.current.delete(o),o(...u)}:o;e.current.set(o,{type:i,eventTarget:a,fn:l,options:s}),a.addEventListener(i,l,s)},[]),r=N.useCallback((a,i,o,s)=>{var l;let u=((l=e.current.get(o))===null||l===void 0?void 0:l.fn)||o;a.removeEventListener(i,u,s),e.current.delete(o)},[]),n=N.useCallback(()=>{e.current.forEach((a,i)=>{r(a.eventTarget,a.type,i,a.options)})},[r]);return N.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function N3e(e){return e.mozInputSource===0&&e.isTrusted?!0:k3e()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function SH(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function I3e(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function wH(e){let t=N.useRef({isFocused:!1,observer:null});vH(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]);let r=x3e(n=>{e?.(n)});return N.useCallback(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let a=n.target,i=o=>{if(t.current.isFocused=!1,a.disabled){let s=SH(o);r(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};a.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&a.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let s=a===document.activeElement?null:document.activeElement;a.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),a.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(a,{attributes:!0,attributeFilter:["disabled"]})}},[r])}let D3e=!1,Cm=null,XA=new Set,km=new Map,Gc=!1,KA=!1;const M3e={Tab:!0,Escape:!0};function ZA(e,t){for(let r of XA)r(e,t)}function R3e(e){return!(e.metaKey||!YA()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function w1(e){Gc=!0,R3e(e)&&(Cm="keyboard",ZA("keyboard",e))}function Di(e){Cm="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Gc=!0,ZA("pointer",e))}function EH(e){N3e(e)&&(Gc=!0,Cm="virtual")}function TH(e){e.target===window||e.target===document||D3e||!e.isTrusted||(!Gc&&!KA&&(Cm="virtual",ZA("virtual",e)),Gc=!1,KA=!1)}function _H(){Gc=!1,KA=!0}function QA(e){if(typeof window>"u"||typeof document>"u"||km.get(Hc(e)))return;const t=Hc(e),r=uu(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Gc=!0,n.apply(this,arguments)},r.addEventListener("keydown",w1,!0),r.addEventListener("keyup",w1,!0),r.addEventListener("click",EH,!0),t.addEventListener("focus",TH,!0),t.addEventListener("blur",_H,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",Di,!0),r.addEventListener("pointermove",Di,!0),r.addEventListener("pointerup",Di,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",Di,!0),r.addEventListener("mousemove",Di,!0),r.addEventListener("mouseup",Di,!0)),t.addEventListener("beforeunload",()=>{AH(e)},{once:!0}),km.set(t,{focus:n})}const AH=(e,t)=>{const r=Hc(e),n=uu(e);t&&n.removeEventListener("DOMContentLoaded",t),km.has(r)&&(r.HTMLElement.prototype.focus=km.get(r).focus,n.removeEventListener("keydown",w1,!0),n.removeEventListener("keyup",w1,!0),n.removeEventListener("click",EH,!0),r.removeEventListener("focus",TH,!0),r.removeEventListener("blur",_H,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",Di,!0),n.removeEventListener("pointermove",Di,!0),n.removeEventListener("pointerup",Di,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",Di,!0),n.removeEventListener("mousemove",Di,!0),n.removeEventListener("mouseup",Di,!0)),km.delete(r))};function L3e(e){const t=uu(e);let r;return t.readyState!=="loading"?QA(e):(r=()=>{QA(e)},t.addEventListener("DOMContentLoaded",r)),()=>AH(e,r)}typeof document<"u"&&L3e();function CH(){return Cm!=="pointer"}const O3e=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function P3e(e,t,r){let n=uu(r?.target);const a=typeof window<"u"?Hc(r?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?Hc(r?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?Hc(r?.target).HTMLElement:HTMLElement,s=typeof window<"u"?Hc(r?.target).KeyboardEvent:KeyboardEvent;return e=e||n.activeElement instanceof a&&!O3e.has(n.activeElement.type)||n.activeElement instanceof i||n.activeElement instanceof o&&n.activeElement.isContentEditable,!(e&&t==="keyboard"&&r instanceof s&&!M3e[r.key])}function F3e(e,t,r){QA(),N.useEffect(()=>{let n=(a,i)=>{P3e(!!r?.isTextInput,a,i)&&e(CH())};return XA.add(n),()=>{XA.delete(n)}},t)}function B3e(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:a}=e;const i=N.useCallback(l=>{if(l.target===l.currentTarget)return n&&n(l),a&&a(!1),!0},[n,a]),o=wH(i),s=N.useCallback(l=>{const u=uu(l.target),c=u?qA(u):qA();l.target===l.currentTarget&&c===bH(l.nativeEvent)&&(r&&r(l),a&&a(!0),o(l))},[a,r,o]);return{focusProps:{onFocus:!t&&(r||a||n)?s:void 0,onBlur:!t&&(n||a)?i:void 0}}}function j3e(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:a}=e,i=N.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=xH(),l=N.useCallback(d=>{d.currentTarget.contains(d.target)&&i.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(i.current.isFocusWithin=!1,s(),r&&r(d),a&&a(!1))},[r,a,i,s]),u=wH(l),c=N.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=uu(d.target),h=qA(f);if(!i.current.isFocusWithin&&h===bH(d.nativeEvent)){n&&n(d),a&&a(!0),i.current.isFocusWithin=!0,u(d);let p=d.currentTarget;o(f,"focus",m=>{if(i.current.isFocusWithin&&!yH(p,m.target)){let g=new f.defaultView.FocusEvent("blur",{relatedTarget:m.target});I3e(g,p);let v=SH(g);l(v)}},{capture:!0})}},[n,a,u,o,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:l}}}let E1=!1,JA=0;function eC(){E1=!0,setTimeout(()=>{E1=!1},50)}function kH(e){e.pointerType==="touch"&&eC()}function z3e(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",kH):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",eC),JA++,()=>{JA--,!(JA>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",kH):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",eC))}}function Nm(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:a}=e,[i,o]=N.useState(!1),s=N.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;N.useEffect(z3e,[]);let{addGlobalListener:l,removeAllGlobalListeners:u}=xH(),{hoverProps:c,triggerHoverEnd:d}=N.useMemo(()=>{let f=(m,g)=>{if(s.pointerType=g,a||g==="touch"||s.isHovered||!m.currentTarget.contains(m.target))return;s.isHovered=!0;let v=m.currentTarget;s.target=v,l(uu(m.target),"pointerover",y=>{s.isHovered&&s.target&&!yH(s.target,y.target)&&h(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:v,pointerType:g}),r&&r(!0),o(!0)},h=(m,g)=>{let v=s.target;s.pointerType="",s.target=null,!(g==="touch"||!s.isHovered||!v)&&(s.isHovered=!1,u(),n&&n({type:"hoverend",target:v,pointerType:g}),r&&r(!1),o(!1))},p={};return typeof PointerEvent<"u"?(p.onPointerEnter=m=>{E1&&m.pointerType==="mouse"||f(m,m.pointerType)},p.onPointerLeave=m=>{!a&&m.currentTarget.contains(m.target)&&h(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(p.onTouchStart=()=>{s.ignoreEmulatedMouseEvents=!0},p.onMouseEnter=m=>{!s.ignoreEmulatedMouseEvents&&!E1&&f(m,"mouse"),s.ignoreEmulatedMouseEvents=!1},p.onMouseLeave=m=>{!a&&m.currentTarget.contains(m.target)&&h(m,"mouse")}),{hoverProps:p,triggerHoverEnd:h}},[t,r,n,a,s,l,u]);return N.useEffect(()=>{a&&d({currentTarget:s.target},s.pointerType)},[a]),{hoverProps:c,isHovered:i}}function Im(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,a=N.useRef({isFocused:!1,isFocusVisible:t||CH()}),[i,o]=N.useState(!1),[s,l]=N.useState(()=>a.current.isFocused&&a.current.isFocusVisible),u=N.useCallback(()=>l(a.current.isFocused&&a.current.isFocusVisible),[]),c=N.useCallback(h=>{a.current.isFocused=h,o(h),u()},[u]);F3e(h=>{a.current.isFocusVisible=h,u()},[],{isTextInput:r});let{focusProps:d}=B3e({isDisabled:n,onFocusChange:c}),{focusWithinProps:f}=j3e({isDisabled:!n,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:s,focusProps:n?f:d}}var U3e=Object.defineProperty,$3e=(e,t,r)=>t in e?U3e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tC=(e,t,r)=>($3e(e,typeof t!="symbol"?t+"":t,r),r);let V3e=class{constructor(){tC(this,"current",this.detect()),tC(this,"handoffState","pending"),tC(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Zo=new V3e;function xh(e){var t;return Zo.isServer?null:e==null?document:(t=e?.ownerDocument)!=null?t:document}function rC(e){var t,r;return Zo.isServer?null:e==null?document:(r=(t=e?.getRootNode)==null?void 0:t.call(e))!=null?r:document}function NH(e){var t,r;return(r=(t=rC(e))==null?void 0:t.activeElement)!=null?r:null}function T1(e){return NH(e)===e}function _1(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function tl(){let e=[],t={addEventListener(r,n,a,i){return r.addEventListener(n,a,i),t.add(()=>r.removeEventListener(n,a,i))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return _1(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,a){let i=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:a}),this.add(()=>{Object.assign(r.style,{[n]:i})})},group(r){let n=tl();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let a of e.splice(n,1))a()}},dispose(){for(let r of e.splice(0))r()}};return t}function qc(){let[e]=N.useState(tl);return N.useEffect(()=>()=>e.dispose(),[e]),e}let zn=(e,t)=>{Zo.isServer?N.useEffect(e,t):N.useLayoutEffect(e,t)};function rl(e){let t=N.useRef(e);return zn(()=>{t.current=e},[e]),t}let kt=function(e){let t=rl(e);return N.useCallback((...r)=>t.current(...r),[t])};function H3e(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function G3e(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function IH({disabled:e=!1}={}){let t=N.useRef(null),[r,n]=N.useState(!1),a=qc(),i=kt(()=>{t.current=null,n(!1),a.dispose()}),o=kt(s=>{if(a.dispose(),t.current===null){t.current=s.currentTarget,n(!0);{let l=xh(s.currentTarget);a.addEventListener(l,"pointerup",i,!1),a.addEventListener(l,"pointermove",u=>{if(t.current){let c=H3e(u);n(G3e(c,t.current.getBoundingClientRect()))}},!1),a.addEventListener(l,"pointercancel",i,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:o,onPointerUp:i,onClick:i}}}function oi(e){return N.useMemo(()=>e,Object.values(e))}let DH=N.createContext(void 0);function cu(){return N.useContext(DH)}function q3e({value:e,children:t}){return N.createElement(DH.Provider,{value:e},t)}function nC(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Qo(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qo),n}var A1=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(A1||{}),du=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(du||{});function Vr(){let e=Y3e();return N.useCallback(t=>W3e({mergeRefs:e,...t}),[e])}function W3e({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:i=!0,name:o,mergeRefs:s}){s=s??X3e;let l=MH(t,e);if(i)return C1(l,r,n,o,s);let u=a??0;if(u&2){let{static:c=!1,...d}=l;if(c)return C1(d,r,n,o,s)}if(u&1){let{unmount:c=!0,...d}=l;return Qo(c?0:1,{0(){return null},1(){return C1({...d,hidden:!0,style:{display:"none"}},r,n,o,s)}})}return C1(l,r,n,o,s)}function C1(e,t={},r,n,a){let{as:i=r,children:o,refName:s="ref",...l}=aC(e,["unmount","static"]),u=e.ref!==void 0?{[s]:e.ref}:{},c=typeof o=="function"?o(t):o;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t)),l["aria-labelledby"]&&l["aria-labelledby"]===l.id&&(l["aria-labelledby"]=void 0);let d={};if(t){let f=!1,h=[];for(let[p,m]of Object.entries(t))typeof m=="boolean"&&(f=!0),m===!0&&h.push(p.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(f){d["data-headlessui-state"]=h.join(" ");for(let p of h)d[`data-${p}`]=""}}if(Mm(i)&&(Object.keys(fu(l)).length>0||Object.keys(fu(d)).length>0))if(!N.isValidElement(c)||Array.isArray(c)&&c.length>1||Z3e(c)){if(Object.keys(fu(l)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(fu(l)).concat(Object.keys(fu(d))).map(f=>` - ${f}`).join(`
80
+ ${u.status} ${d}`)}if(console.log("✅ Session creation successful, parsing response..."),console.log("🔍 Session response data:",JSON.stringify(c,null,2)),c.topics&&c.topics.length>0){const d=c.topics[0],f={id:d.id,sessionId:c.id,title:d.name,messages:[],agentId:c.agent_id,connected:!1,error:null},h={id:d.id,sessionId:c.id,title:d.name,updatedAt:d.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1};e(p=>{p.channels[d.id]=f,p.chatHistory.unshift(h),p.activeChatChannel=d.id,p.activeTabIndex=1}),t().connectToChannel(c.id,d.id)}else{console.log("⚠️ Session created without topics, creating default topic...");const d=await fetch(`${t().backendUrl}/xyzen/api/v1/topics/`,{method:"POST",headers:i,body:JSON.stringify({name:"新的聊天",session_id:c.id})});if(!d.ok){const m=await d.text();throw console.error("❌ Failed to create default topic:",d.status,m),new Error(`Failed to create default topic for new session: ${d.status} ${m}`)}const f=await d.json();console.log("✅ Default topic created:",f.id);const h={id:f.id,sessionId:c.id,title:f.name,messages:[],agentId:c.agent_id,connected:!1,error:null},p={id:f.id,sessionId:c.id,title:f.name,updatedAt:f.updated_at,assistantTitle:"通用助理",lastMessage:"",isPinned:!1};e(m=>{m.channels[f.id]=h,m.chatHistory.unshift(p),m.activeChatChannel=f.id,m.activeTabIndex=1}),console.log("🚀 Navigating to new topic:",f.id),t().connectToChannel(c.id,f.id)}}catch(n){console.error("Failed to create channel:",n)}},updateTopicName:async(r,n)=>{try{const a=Jr.getToken();if(!a){console.error("No authentication token available");return}const i={"Content-Type":"application/json",Authorization:`Bearer ${a}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/topics/${r}`,{method:"PUT",headers:i,body:JSON.stringify({name:n})})).ok)throw new Error("Failed to update topic name");e(s=>{s.channels[r]&&(s.channels[r].title=n);const l=s.chatHistory.find(u=>u.id===r);l&&(l.title=n)}),console.log(`Topic ${r} name updated to: ${n}`)}catch(a){throw console.error("Failed to update topic name:",a),a}},deleteTopic:async r=>{try{const n=Jr.getToken();if(!n){console.error("No authentication token available");return}const a={"Content-Type":"application/json",Authorization:`Bearer ${n}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/topics/${r}`,{method:"DELETE",headers:a})).ok)throw new Error("Failed to delete topic");e(o=>{if(delete o.channels[r],o.chatHistory=o.chatHistory.filter(s=>s.id!==r),o.activeChatChannel===r){const s=o.chatHistory[0];s?(o.activeChatChannel=s.id,t().activateChannel(s.id)):o.activeChatChannel=null}}),console.log(`Topic ${r} deleted`)}catch(n){throw console.error("Failed to delete topic:",n),n}},clearSessionTopics:async r=>{try{const n=Jr.getToken();if(!n){console.error("No authentication token available");return}const a={"Content-Type":"application/json",Authorization:`Bearer ${n}`};if(!(await fetch(`${t().backendUrl}/xyzen/api/v1/sessions/${r}/topics`,{method:"DELETE",headers:a})).ok)throw new Error("Failed to clear session topics");await t().fetchChatHistory(),console.log(`Session ${r} topics cleared`)}catch(n){throw console.error("Failed to clear session topics:",n),n}},setActiveWorkshopChannel:r=>e({activeWorkshopChannel:r}),fetchWorkshopHistory:async()=>{console.log("ChatSlice: Fetching workshop history (reusing chat history endpoints)...");try{e({workshopHistoryLoading:!0}),await t().fetchChatHistory();const{channels:r,chatHistory:n}=t();e({workshopChannels:r,workshopHistory:n,workshopHistoryLoading:!1}),console.log("ChatSlice: Workshop history synced from chat history")}catch(r){console.error("ChatSlice: Error fetching workshop history:",r),e({workshopHistoryLoading:!1})}},togglePinWorkshopChat:r=>{e(n=>{const a=n.workshopHistory.find(i=>i.id===r);a&&(a.isPinned=!a.isPinned)})},activateWorkshopChannel:async r=>{const{workshopChannels:n,activeWorkshopChannel:a}=t();if(r===a&&n[r]?.connected)return;console.log(`Activating workshop channel: ${r}`),e({activeWorkshopChannel:r}),await t().activateChannel(r);const{channels:i}=t();i[r]&&e(o=>{o.workshopChannels[r]=i[r]})},connectToWorkshopChannel:(r,n)=>{console.log(`Connecting to workshop channel: ${n} (reusing chat connection logic)`),t().connectToChannel(r,n);const{channels:a}=t();a[n]&&e(i=>{i.workshopChannels[n]=a[n]})},disconnectFromWorkshopChannel:()=>{const{activeWorkshopChannel:r}=t();r&&(console.log(`Disconnecting from workshop channel: ${r}`),t().disconnectFromChannel(),e(n=>{n.workshopChannels[r]&&(n.workshopChannels[r].connected=!1)}))},sendWorkshopMessage:r=>{const{activeWorkshopChannel:n}=t();if(n){e(o=>{const s=o.workshopChannels[n];s&&(s.responding=!0)}),t().sendMessage(r);const a=()=>{const o=t(),s=o.channels[o.activeChatChannel||n],l=o.workshopChannels[n];s&&l&&e(u=>{u.workshopChannels[n].messages=[...s.messages],u.workshopChannels[n].responding=s.responding,u.workshopChannels[n].connected=s.connected,u.workshopChannels[n].error=s.error})};a();const i=setInterval(()=>{if(!t().workshopChannels[n]?.responding){clearInterval(i);return}a()},100);setTimeout(()=>clearInterval(i),3e4)}},createDefaultWorkshopChannel:async r=>{try{const n=r||"00000000-0000-0000-0000-000000000002";console.log(`Creating default workshop channel for agent: ${n}`),await t().createDefaultChannel(n);const{activeChatChannel:a,channels:i,chatHistory:o}=t();a&&i[a]&&(e(s=>{s.workshopChannels[a]=i[a],s.workshopHistory=o,s.activeWorkshopChannel=a,s.activeChatChannel=null}),console.log(`Workshop channel created: ${a}`))}catch(n){console.error("Failed to create default workshop channel:",n),t().showNotification("创建失败","无法创建新的工作坊会话,请稍后重试","error")}},updateWorkshopTopicName:async(r,n)=>{await t().updateTopicName(r,n),e(a=>{a.workshopChannels[r]&&(a.workshopChannels[r].title=n);const i=a.workshopHistory.find(o=>o.id===r);i&&(i.title=n)}),console.log(`Workshop topic ${r} name updated to: ${n}`)},deleteWorkshopTopic:async r=>{await t().deleteTopic(r),e(n=>{if(delete n.workshopChannels[r],n.workshopHistory=n.workshopHistory.filter(a=>a.id!==r),n.activeWorkshopChannel===r){const a=n.workshopHistory[0];a?(n.activeWorkshopChannel=a.id,t().activateWorkshopChannel(a.id)):n.activeWorkshopChannel=null}}),console.log(`Workshop topic ${r} deleted`)},clearWorkshopSessionTopics:async r=>{await t().clearSessionTopics(r),await t().fetchWorkshopHistory(),console.log(`Workshop session ${r} topics cleared`)},confirmToolCall:(r,n)=>{Js.sendStructuredMessage({type:"tool_call_confirm",data:{toolCallId:n}}),e(a=>{a.channels[r]&&a.channels[r].messages.forEach(i=>{i.toolCalls&&i.toolCalls.forEach(o=>{o.id===n&&o.status==="waiting_confirmation"&&(o.status="executing")})})})},cancelToolCall:(r,n)=>{Js.sendStructuredMessage({type:"tool_call_cancel",data:{toolCallId:n}}),e(a=>{a.channels[r]&&a.channels[r].messages.forEach(i=>{i.toolCalls&&i.toolCalls.forEach(o=>{o.id===n&&o.status==="waiting_confirmation"&&(o.status="failed",o.error="用户取消执行")})})})},showNotification:(r,n,a="info",i,o)=>{e({notification:{isOpen:!0,title:r,message:n,type:a,actionLabel:i,onAction:o}})},closeNotification:()=>{e({notification:null})}}),eNe=(e,t)=>({loadingStates:{},setLoading:(r,n)=>{e(a=>{n?a.loadingStates[r]=!0:delete a.loadingStates[r]})},getLoading:r=>t().loadingStates[r]||!1,clearAllLoading:()=>{e(r=>{r.loadingStates={}})}}),Sa={MCP_SERVERS:"mcpServers",MCP_SERVER_CREATE:"mcpServerCreate",MCP_SERVER_UPDATE:"mcpServerUpdate",MCP_SERVER_DELETE:"mcpServerDelete"},zc=()=>{const e=Ze.getState().backendUrl;return(!e||e===""||e==="http://")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:e},Uc=()=>{const e={"Content-Type":"application/json"},t=Jr.getToken();return t&&(e.Authorization=`Bearer ${t}`),e},su={async getMcpServers(){const e=await fetch(`${zc()}/xyzen/api/v1/mcps`,{headers:Uc()});if(!e.ok)throw new Error("Failed to fetch MCP servers");return e.json()},async createMcpServer(e){const t=await fetch(`${zc()}/xyzen/api/v1/mcps`,{method:"POST",headers:Uc(),body:JSON.stringify(e)});if(!t.ok){const r=await t.text();throw new Error(`Failed to create MCP server: ${t.status} ${r}`)}return t.json()},async updateMcpServer(e,t){const r=await fetch(`${zc()}/xyzen/api/v1/mcps/${e}`,{method:"PATCH",headers:Uc(),body:JSON.stringify(t)});if(!r.ok){const n=await r.text();throw new Error(`Failed to update MCP server: ${r.status} ${n}`)}return r.json()},async deleteMcpServer(e){const t=await fetch(`${zc()}/xyzen/api/v1/mcps/${e}`,{method:"DELETE",headers:Uc()});if(!t.ok){const r=await t.text();throw new Error(`Failed to delete MCP server: ${t.status} ${r}`)}},async refreshMcpServers(){const e=await fetch(`${zc()}/xyzen/api/v1/mcps/refresh`,{method:"POST",headers:Uc()});if(!e.ok){const t=await e.text();throw new Error(`Failed to trigger MCP server refresh: ${e.status} ${t}`)}},async activateSmitheryServer(e,t){const r=await fetch(`${zc()}/xyzen/api/v1/mcps/smithery/activate`,{method:"POST",headers:Uc(),body:JSON.stringify({qualifiedName:e,profile:t})});if(!r.ok){const n=await r.text();throw new Error(`Failed to activate Smithery server: ${r.status} ${n}`)}return r.json()},async getBuiltinMcpServers(){try{const e=await fetch(`${zc()}/xyzen/api/v1/mcps/discover`,{headers:Uc()});return e.ok?e.json():(console.warn("Failed to discover builtin MCP servers"),[])}catch(e){return console.warn("Error discovering builtin MCP servers:",e),[]}}};function tNe(e){if("data"in e&&"source"in e&&e.source==="official")return e;const t=e,r={name:t.name,module_name:t.module_name,mount_path:t.mount_path,description:t.description,is_builtin:!0,requires_auth:t.requires_auth||!1,is_default:t.is_default,banner:t.banner};return{id:t.module_name,name:t.name,description:t.description,source:"official",cover:t.banner,data:r}}function rNe(e){return Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map(t=>tNe(t)):(console.warn("convertBuiltinServers: input is not an array",e),[])}const nNe=(e,t)=>({mcpServers:[],builtinMcpServers:[],lastFetchTime:0,isEditMcpServerModalOpen:!1,editingMcpServer:null,openEditMcpServerModal:r=>{e({isEditMcpServerModalOpen:!0,editingMcpServer:r})},closeEditMcpServerModal:()=>{e({isEditMcpServerModalOpen:!1,editingMcpServer:null})},fetchMcpServers:async()=>{const{setLoading:r}=t(),n=Date.now(),{lastFetchTime:a}=t();if(n-a<5e3){console.log("McpSlice: 使用缓存的MCP服务器数据");return}r(Sa.MCP_SERVERS,!0);try{console.log("McpSlice: Starting to fetch MCP servers...");const i=await su.getMcpServers();console.log(`McpSlice: Loaded ${i.length} MCP servers`),e({mcpServers:i,lastFetchTime:n})}catch(i){console.error("Failed to fetch MCP servers:",i)}finally{r(Sa.MCP_SERVERS,!1)}},fetchBuiltinMcpServers:async()=>{try{const r=await su.getBuiltinMcpServers(),n=rNe(r),{mcpServers:a,backendUrl:i}=t(),o=a.map(l=>l.url),s=n.filter(l=>{const u=l.data.mount_path.endsWith("/")?l.data.mount_path:`${l.data.mount_path}/`,c=`${i}${u}`;return!o.includes(c)});e({builtinMcpServers:s})}catch(r){console.error("Failed to fetch builtin MCP servers:",r),e({builtinMcpServers:[]})}},refreshMcpServers:async()=>{const{setLoading:r}=t();r(Sa.MCP_SERVERS,!0);try{await su.refreshMcpServers(),setTimeout(()=>{t().fetchMcpServers()},1e3)}catch(n){console.error("Failed to refresh MCP servers:",n)}finally{setTimeout(()=>r(Sa.MCP_SERVERS,!1),1500)}},addMcpServer:async r=>{const{setLoading:n}=t();n(Sa.MCP_SERVER_CREATE,!0);try{const a=await su.createMcpServer(r);e(i=>{i.mcpServers.push(a)}),t().closeAddMcpServerModal()}catch(a){throw console.error("Failed to add MCP server:",a),a}finally{n(Sa.MCP_SERVER_CREATE,!1)}},quickAddBuiltinServer:async r=>{const{backendUrl:n,token:a,setLoading:i}=t();i(Sa.MCP_SERVER_CREATE,!0);try{const o=r.data.mount_path.endsWith("/")?r.data.mount_path:`${r.data.mount_path}/`,s={name:r.name,description:r.description,url:`${n}${o}`,token:a||""},l=await su.createMcpServer(s);e(u=>{u.mcpServers.push(l),u.builtinMcpServers=u.builtinMcpServers.filter(c=>c.data.module_name!==r.data.module_name)}),t().closeAddMcpServerModal()}catch(o){throw console.error("Failed to add builtin MCP server:",o),o}finally{i(Sa.MCP_SERVER_CREATE,!1)}},activateSmitheryServer:async(r,n)=>{const{setLoading:a}=t();a(Sa.MCP_SERVER_CREATE,!0);try{const i=await su.activateSmitheryServer(r,n);e(o=>{o.mcpServers.push(i)}),t().closeAddMcpServerModal()}catch(i){throw console.error("Failed to activate Smithery MCP server:",i),i}finally{a(Sa.MCP_SERVER_CREATE,!1)}},editMcpServer:async(r,n)=>{const{setLoading:a}=t();a(Sa.MCP_SERVER_UPDATE,!0);try{const i=await su.updateMcpServer(r,n);e(o=>{const s=o.mcpServers.findIndex(l=>l.id===r);s!==-1&&(o.mcpServers[s]=i)})}catch(i){throw console.error("Failed to edit MCP server:",i),i}finally{a(Sa.MCP_SERVER_UPDATE,!1)}},removeMcpServer:async r=>{const{setLoading:n}=t();n(Sa.MCP_SERVER_DELETE,!0);try{await su.deleteMcpServer(r),e(a=>{a.mcpServers=a.mcpServers.filter(i=>i.id!==r)})}catch(a){throw console.error("Failed to remove MCP server:",a),a}finally{n(Sa.MCP_SERVER_DELETE,!1)}},updateMcpServerInList:r=>{e(n=>{const a=n.mcpServers.findIndex(i=>i.id===r.id);a!==-1?n.mcpServers[a]=r:n.mcpServers.push(r)})}}),aNe=(e,t)=>({toolTestModal:{isOpen:!1},toolExecutionHistory:[],openToolTestModal:(r,n,a)=>{e(i=>{i.toolTestModal={isOpen:!0,server:r,toolName:n,toolDescription:a}})},closeToolTestModal:()=>{e(r=>{r.toolTestModal={isOpen:!1}})},addToolExecution:r=>{e(n=>{const a={...r,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,timestamp:new Date};n.toolExecutionHistory.unshift(a),n.toolExecutionHistory.length>100&&(n.toolExecutionHistory=n.toolExecutionHistory.slice(0,100))})},clearToolExecutionHistory:()=>{e(r=>{r.toolExecutionHistory=[]})},getToolExecutionHistory:(r,n)=>{const{toolExecutionHistory:a}=t();return!r&&!n?a:a.filter(i=>{const o=!r||i.serverId===r,s=!n||i.toolName===n;return o&&s})}});class iNe{getBackendUrl(){const{backendUrl:t}=Ze.getState();return(!t||t==="")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:t}createAuthHeaders(){const t={"Content-Type":"application/json"},r=Jr.getToken();return r&&(t.Authorization=`Bearer ${r}`),t}async getProviderTemplates(){const t=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/templates`);if(!t.ok)throw new Error("Failed to fetch provider templates");return t.json()}async getMyProviders(){const t=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/me`,{headers:this.createAuthHeaders()});if(!t.ok)throw new Error("Failed to fetch your providers");return t.json()}async createProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/`,{method:"POST",headers:this.createAuthHeaders(),body:JSON.stringify(t)});if(!r.ok){const n=await r.text();throw new Error(`Failed to create provider: ${n}`)}return r.json()}async getProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{headers:this.createAuthHeaders()});if(!r.ok)throw new Error("Failed to fetch provider");return r.json()}async updateProvider(t,r){const n=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{method:"PATCH",headers:this.createAuthHeaders(),body:JSON.stringify(r)});if(!n.ok){const a=await n.text();throw new Error(`Failed to update provider: ${a}`)}return n.json()}async deleteProvider(t){const r=await fetch(`${this.getBackendUrl()}/xyzen/api/v1/providers/${t}`,{method:"DELETE",headers:this.createAuthHeaders()});if(!r.ok){const n=await r.text();throw new Error(`Failed to delete provider: ${n}`)}}}const vm=new iNe;class ym{static STORAGE_KEY="xyzen_provider_preferences";static getPreferences(){try{const t=localStorage.getItem(this.STORAGE_KEY);if(t){const r=JSON.parse(t);return{defaultProviderId:r.defaultProviderId||null,lastUsedProviders:r.lastUsedProviders||{}}}}catch(t){console.warn("Failed to load provider preferences:",t)}return{defaultProviderId:null,lastUsedProviders:{}}}static savePreferences(t){try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(r){console.error("Failed to save provider preferences:",r)}}static setDefaultProvider(t){const r=this.getPreferences();r.defaultProviderId=t,this.savePreferences(r)}static getDefaultProviderId(){return this.getPreferences().defaultProviderId}static getDefaultProvider(t){const r=this.getDefaultProviderId();return r&&t.find(n=>n.id===r)||null}static setLastUsedProviderForAgent(t,r){const n=this.getPreferences();n.lastUsedProviders[t]=r,this.savePreferences(n)}static getLastUsedProviderForAgent(t){return this.getPreferences().lastUsedProviders[t]||null}static clearPreferences(){try{localStorage.removeItem(this.STORAGE_KEY)}catch(t){console.error("Failed to clear provider preferences:",t)}}static migrateFromDatabaseDefault(t){if(!this.getPreferences().defaultProviderId){const n=t.find(a=>a.is_default&&!a.is_system);n&&(console.info("Migrating database default provider to local preferences:",n.name),this.setDefaultProvider(n.id))}}}function oNe(e,t){if(e?.provider_id){const i=t.find(o=>o.id===e.provider_id);if(i)return i}const r=ym.getDefaultProvider(t);if(r&&!r.is_system)return r;const n=t.find(i=>i.is_system);return n||t.filter(i=>!i.is_system)[0]||null}function sNe(e,t,r){return t?e?.provider_id===t.id?"助手指定":ym.getDefaultProvider(r)?.id===t.id&&!t.is_system?"全局默认":t.is_system?"系统":"自动选择":"无提供商"}const lNe=(e,t)=>({llmProviders:[],llmProvidersLoading:!1,providerTemplates:[],templatesLoading:!1,userDefaultProviderId:null,fetchProviderTemplates:async()=>{e({templatesLoading:!0});try{const r=await vm.getProviderTemplates();e({providerTemplates:r,templatesLoading:!1})}catch(r){console.error("Failed to fetch provider templates:",r),e({templatesLoading:!1})}},fetchMyProviders:async()=>{e({llmProvidersLoading:!0});try{const r=await vm.getMyProviders();e({llmProviders:r,llmProvidersLoading:!1}),t().initializeProviderPreferences(),ym.migrateFromDatabaseDefault(r)}catch(r){console.error("Failed to fetch your providers:",r),e({llmProvidersLoading:!1})}},initializeProviderPreferences:()=>{const r=ym.getDefaultProviderId();e({userDefaultProviderId:r})},setUserDefaultProvider:r=>{ym.setDefaultProvider(r),e({userDefaultProviderId:r})},getUserDefaultProvider:()=>{const{llmProviders:r,userDefaultProviderId:n}=t();return n&&r.find(a=>a.id===n)||null},resolveProviderForAgent:r=>{const{llmProviders:n}=t();return oNe(r,n)},addProvider:async r=>{try{const n=await vm.createProvider(r);e(s=>{s.llmProviders.push(n)});const{llmProviders:a,userDefaultProviderId:i}=t();a.filter(s=>!s.is_system).length===1&&!i&&t().setUserDefaultProvider(n.id),t().closeAddLlmProviderModal(),t().closeSettingsModal()}catch(n){throw console.error("Failed to add provider:",n),n}},updateProvider:async(r,n)=>{try{const a=await vm.updateProvider(r,n);e(i=>{const o=i.llmProviders.findIndex(s=>s.id===r);o!==-1&&(i.llmProviders[o]=a)})}catch(a){throw console.error("Failed to update provider:",a),a}},removeProvider:async r=>{try{await vm.deleteProvider(r),e(a=>{a.llmProviders=a.llmProviders.filter(i=>i.id!==r)});const{userDefaultProviderId:n}=t();n===r&&t().setUserDefaultProvider(null)}catch(n){throw console.error("Failed to remove provider:",n),n}}}),bm={Sidebar:"sidebar"},uNe=!1,cNe=!0;console.log("=== Environment Debug ==="),console.log("MODE:","production"),console.log("isDevelopment:",uNe),console.log("isProduction:",cNe),console.log("VITE_XYZEN_BACKEND_URL:",void 0);const $c=window!==void 0?`${window.location.protocol}//${window.location.host}`:"http://localhost:48196";console.log("Final DEFAULT_BACKEND_URL:",$c);const AV=localStorage.getItem("layoutStyle")?localStorage.getItem("layoutStyle"):bm.Sidebar;console.log("Final DEFAULT_LAYOUT_STYLE:",AV);const dNe=1024,fNe=64*9,hNe=64*15,h1=64*10;Js.setBackendUrl($c);const pNe=e=>({backendUrl:$c,isXyzenOpen:!1,panelWidth:h1,activeTabIndex:0,activePanel:"chat",theme:localStorage.getItem("theme")||"system",layoutStyle:AV,isMcpListModalOpen:!1,isLlmProvidersModalOpen:!1,isAddMcpServerModalOpen:!1,isAddLlmProviderModalOpen:!1,isSettingsModalOpen:!1,activeSettingsCategory:"provider",activeUiSetting:"theme",selectedProviderId:null,pendingInput:"",toggleXyzen:()=>e(t=>({isXyzenOpen:!t.isXyzenOpen})),openXyzen:()=>e({isXyzenOpen:!0}),closeXyzen:()=>e({isXyzenOpen:!1}),setPanelWidth:t=>e({panelWidth:t}),setTabIndex:t=>e({activeTabIndex:t}),setActivePanel:t=>e({activePanel:t}),setTheme:t=>{typeof window<"u"&&localStorage.setItem("theme",t),e({theme:t})},setLayoutStyle:t=>{typeof window<"u"&&localStorage.setItem("layoutStyle",t),e({layoutStyle:t})},setBackendUrl:t=>{e({backendUrl:t}),Js.setBackendUrl(t)},openMcpListModal:()=>e({isMcpListModalOpen:!0}),closeMcpListModal:()=>e({isMcpListModalOpen:!1}),openLlmProvidersModal:()=>e({isLlmProvidersModalOpen:!0}),closeLlmProvidersModal:()=>e({isLlmProvidersModalOpen:!1}),openAddMcpServerModal:()=>e({isAddMcpServerModalOpen:!0}),closeAddMcpServerModal:()=>e({isAddMcpServerModalOpen:!1}),openAddLlmProviderModal:()=>e({isAddLlmProviderModalOpen:!0}),closeAddLlmProviderModal:()=>e({isAddLlmProviderModalOpen:!1}),openSettingsModal:(t="provider")=>e({isSettingsModalOpen:!0,activeSettingsCategory:t}),closeSettingsModal:()=>e({isSettingsModalOpen:!1,selectedProviderId:null}),setActiveSettingsCategory:t=>e({activeSettingsCategory:t}),setActiveUiSetting:t=>e({activeUiSetting:t}),setSelectedProvider:t=>e({selectedProviderId:t}),setPendingInput:t=>e({pendingInput:t}),submitInput:()=>e(()=>({isXyzenOpen:!0,activeTabIndex:1,activePanel:"chat"}))}),Ze=D4e()(M4e(G4e((...e)=>({...pNe(...e),...J4e(...e),...Y4e(...e),...nNe(...e),...aNe(...e),...lNe(...e),...X4e(...e),...eNe(...e)})),{name:"xyzen-storage",storage:sV(()=>localStorage),partialize:e=>({isXyzenOpen:e.isXyzenOpen,panelWidth:e.panelWidth,activePanel:e.activePanel,theme:e.theme,token:e.token,user:e.user,backendUrl:e.backendUrl})})),TA=()=>{const e=Ze.getState().backendUrl;return(!e||e==="")&&typeof window<"u"?`${window.location.protocol}//${window.location.host}`:e};class xm{static TOKEN_KEY="access_token";getToken(){return typeof localStorage<"u"?localStorage.getItem(xm.TOKEN_KEY):null}setToken(t){typeof localStorage<"u"&&localStorage.setItem(xm.TOKEN_KEY,t)}removeToken(){typeof localStorage<"u"&&localStorage.removeItem(xm.TOKEN_KEY)}async getAuthStatus(){const t=await fetch(`${TA()}/xyzen/api/v1/auth/status`);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async validateToken(t){const r=t||this.getToken();if(!r)return{success:!1,error_code:"NO_TOKEN",error_message:"No access token available"};const n=await fetch(`${TA()}/xyzen/api/v1/auth/validate`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(!n.ok)throw n.status===401&&this.removeToken(),new Error(`HTTP error! status: ${n.status}`);return n.json()}async getAuthConfig(){const t=await fetch(`${TA()}/xyzen/api/v1/auth/config`);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}logout(){this.removeToken()}}const Jr=new xm,mNe="access_token";function gNe(e,t){const r=t??(typeof document<"u"?document.cookie:"");if(!r)return null;const n=r.match(new RegExp("(^|;\\s*)"+e+"=([^;]+)"));return n?decodeURIComponent(n[2]):null}function vNe(e,t={}){const{storageKey:r=mNe,storage:n=typeof window<"u"?window.localStorage:void 0,cookieString:a,allowExisting:i=!0}=t;if(!n)return null;const o=n.getItem(r);if(o&&i)return o;if(o)return null;const s=gNe(e,a);return s?(n.setItem(r,s),s):null}const yNe=e=>({id:e.id,username:e.display_name||e.username||"Unknown",avatar:e.avatar_url||"https://storage.sciol.ac.cn/library/default_avatar.png"}),_A=async(e=!1)=>{const{setStatus:t,setUser:r,setToken:n}=Ze.getState();t("loading");try{if(!(await Jr.getAuthStatus()).is_configured){t("failed");return}let i=Jr.getToken();if(i||(i=vNe("appAccessKey")??null),!i){r(null),n(null),t("failed");return}const o=await Jr.validateToken(i);if(!o.success||!o.user_info){Jr.removeToken(),r(null),n(null),t("failed");return}console.log("Auth validation succeeded:",o);const s=yNe(o.user_info);r(s),n(i),t("succeeded")}catch(a){console.error("Auth check failed in Core:",a),r(null),n(null),t("failed"),Jr.removeToken()}},bNe=async e=>{const{setStatus:t,setUser:r,setToken:n}=Ze.getState();t("loading");try{Jr.setToken(e),await _A(!0)}catch(a){console.error("Login failed in Core:",a),r(null),n(null),t("failed")}},xNe=()=>{const{setStatus:e,setUser:t,setToken:r}=Ze.getState();Jr.logout(),t(null),r(null),e("idle")},CV=async()=>{await _A(!0)},kV=e=>Symbol.iterator in e,NV=e=>"entries"in e,IV=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(const[a,i]of r)if(!Object.is(i,n.get(a)))return!1;return!0},SNe=(e,t)=>{const r=e[Symbol.iterator](),n=t[Symbol.iterator]();let a=r.next(),i=n.next();for(;!a.done&&!i.done;){if(!Object.is(a.value,i.value))return!1;a=r.next(),i=n.next()}return!!a.done&&!!i.done};function wNe(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:kV(e)&&kV(t)?NV(e)&&NV(t)?IV(e,t):SNe(e,t):IV({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function ENe(e){const t=N.useRef(void 0);return r=>{const n=e(r);return wNe(t.current,n)?t.current:t.current=n}}function AA(){const{user:e,token:t,status:r}=Ze(ENe(l=>({user:l.user,token:l.token,status:l.status}))),n=r==="succeeded"&&!!e,a=r==="loading",i=N.useCallback(async l=>{await bNe(l)},[]),o=N.useCallback(()=>{xNe()},[]),s=N.useCallback(async(l=!1)=>{await _A(l)},[]);return{user:e,token:t,status:r,isLoading:a,isAuthenticated:n,login:i,logout:o,checkAuth:s}}var Sm=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vc=typeof window>"u"||"Deno"in globalThis;function ja(){}function TNe(e,t){return typeof e=="function"?e(t):e}function CA(e){return typeof e=="number"&&e>=0&&e!==1/0}function DV(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lu(e,t){return typeof e=="function"?e(t):e}function Ii(e,t){return typeof e=="function"?e(t):e}function MV(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==kA(o,t.options))return!1}else if(!Em(t.queryKey,o))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||a&&a!==t.state.fetchStatus||i&&!i(t))}function RV(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(wm(t.options.mutationKey)!==wm(i))return!1}else if(!Em(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function kA(e,t){return(t?.queryKeyHashFn||wm)(e)}function wm(e){return JSON.stringify(e,(t,r)=>DA(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function Em(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Em(e[r],t[r])):!1}function NA(e,t){if(e===t)return e;const r=LV(e)&&LV(t);if(r||DA(e)&&DA(t)){const n=r?e:Object.keys(e),a=n.length,i=r?t:Object.keys(t),o=i.length,s=r?[]:{},l=new Set(n);let u=0;for(let c=0;c<o;c++){const d=r?c:i[c];(!r&&l.has(d)||r)&&e[d]===void 0&&t[d]===void 0?(s[d]=void 0,u++):(s[d]=NA(e[d],t[d]),s[d]===e[d]&&e[d]!==void 0&&u++)}return a===o&&u===a?e:s}return t}function IA(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function LV(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function DA(e){if(!OV(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!OV(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function OV(e){return Object.prototype.toString.call(e)==="[object Object]"}function _Ne(e){return new Promise(t=>{setTimeout(t,e)})}function MA(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return NA(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return NA(e,t)}return t}function ANe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function CNe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var p1=Symbol();function PV(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===p1&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===p1?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function kNe(e,t){return typeof e=="function"?e(...t):!!e}var NNe=class extends Sm{#t;#e;#r;constructor(){super(),this.#r=e=>{if(!Vc&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},RA=new NNe,INe=class extends Sm{#t=!0;#e;#r;constructor(){super(),this.#r=e=>{if(!Vc&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},m1=new INe;function LA(){let e,t;const r=new Promise((a,i)=>{e=a,t=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}function DNe(e){return Math.min(1e3*2**e,3e4)}function FV(e){return(e??"online")==="online"?m1.isOnline():!0}var BV=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function OA(e){return e instanceof BV}function jV(e){let t=!1,r=0,n=!1,a;const i=LA(),o=m=>{n||(f(new BV(m)),e.abort?.())},s=()=>{t=!0},l=()=>{t=!1},u=()=>RA.isFocused()&&(e.networkMode==="always"||m1.isOnline())&&e.canRun(),c=()=>FV(e.networkMode)&&e.canRun(),d=m=>{n||(n=!0,e.onSuccess?.(m),a?.(),i.resolve(m))},f=m=>{n||(n=!0,e.onError?.(m),a?.(),i.reject(m))},h=()=>new Promise(m=>{a=g=>{(n||u())&&m(g)},e.onPause?.()}).then(()=>{a=void 0,n||e.onContinue?.()}),p=()=>{if(n)return;let m;const g=r===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(d).catch(v=>{if(n)return;const y=e.retry??(Vc?0:3),x=e.retryDelay??DNe,S=typeof x=="function"?x(r,v):x,E=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,v);if(t||!E){f(v);return}r++,e.onFail?.(r,v),_Ne(S).then(()=>u()?void 0:h()).then(()=>{t?f(v):p()})})};return{promise:i,cancel:o,continue:()=>(a?.(),i),cancelRetry:s,continueRetry:l,canStart:c,start:()=>(c()?p():h().then(p),i)}}var MNe=e=>setTimeout(e,0);function RNe(){let e=[],t=0,r=s=>{s()},n=s=>{s()},a=MNe;const i=s=>{t?e.push(s):a(()=>{r(s)})},o=()=>{const s=e;e=[],s.length&&a(()=>{n(()=>{s.forEach(l=>{r(l)})})})};return{batch:s=>{let l;t++;try{l=s()}finally{t--,t||o()}return l},batchCalls:s=>(...l)=>{i(()=>{s(...l)})},schedule:i,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{a=s}}}var jn=RNe(),zV=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),CA(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vc?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},LNe=class extends zV{#t;#e;#r;#n;#a;#s;#o;constructor(e){super(),this.#o=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.client,this.#r=this.#n.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ONe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=MA(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ja).catch(ja):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>Ii(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===p1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>lu(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!DV(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#o?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(u=>u.options.queryFn);l&&this.setOptions(l.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},a=()=>{const l=PV(this.options,t),c=(()=>{const d={client:this.#n,queryKey:this.queryKey,meta:this.meta};return n(d),d})();return this.#o=!1,this.options.persister?this.options.persister(l,c,this):l(c)},o=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta});const s=l=>{OA(l)&&l.silent||this.#i({type:"error",error:l}),OA(l)||(this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this)),this.scheduleGc()};return this.#a=jV({initialPromise:t?.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:l=>{if(l===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(l)}catch(u){s(u);return}this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),this.scheduleGc()},onError:s,onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}),this.#a.start()}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...UV(r.data,this.options),fetchMeta:e.meta??null};case"success":return this.#e=void 0,{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return OA(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),jn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function UV(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:FV(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ONe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var PNe=class extends Sm{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,a=t.queryHash??kA(n,t);let i=this.get(a);return i||(i=new LNe({client:e,queryKey:n,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(i)),i}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){jn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>MV(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>MV(e,r)):t}notify(e){jn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){jn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){jn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},FNe=class extends zV{#t;#e;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||BNe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})};this.#r=jV({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#n({type:"failed",failureCount:a,error:i})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const r=this.state.status==="pending",n=!this.#r.canStart();try{if(r)t();else{this.#n({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const i=await this.options.onMutate?.(e);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:n})}const a=await this.#r.start();return await this.#e.config.onSuccess?.(a,e,this.state.context,this),await this.options.onSuccess?.(a,e,this.state.context),await this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(a,null,e,this.state.context),this.#n({type:"success",data:a}),a}catch(a){try{throw await this.#e.config.onError?.(a,e,this.state.context,this),await this.options.onError?.(a,e,this.state.context),await this.#e.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,a,e,this.state.context),a}finally{this.#n({type:"error",error:a})}}finally{this.#e.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),jn.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function BNe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jNe=class extends Sm{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#r=0}#t;#e;#r;build(e,t,r){const n=new FNe({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=g1(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=g1(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=g1(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(a=>a.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=g1(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){jn.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>RV(t,r))}findAll(e={}){return this.getAll().filter(t=>RV(e,t))}notify(e){jn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return jn.batch(()=>Promise.all(e.map(t=>t.continue().catch(ja))))}};function g1(e){return e.options.scope?.id}function v1(e){return{onFetch:(t,r)=>{const n=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},l=0;const u=async()=>{let c=!1;const d=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=PV(t.options,t.fetchOptions),h=async(p,m,g)=>{if(c)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const y=(()=>{const w={client:t.client,queryKey:t.queryKey,pageParam:m,direction:g?"backward":"forward",meta:t.options.meta};return d(w),w})(),x=await f(y),{maxPages:S}=t.options,E=g?CNe:ANe;return{pages:E(p.pages,x,S),pageParams:E(p.pageParams,m,S)}};if(a&&i.length){const p=a==="backward",m=p?$V:PA,g={pages:i,pageParams:o},v=m(n,g);s=await h(g,v,p)}else{const p=e??i.length;do{const m=l===0?o[0]??n.initialPageParam:PA(n,s);if(l>0&&m==null)break;s=await h(s,m),l++}while(l<p)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function PA(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function $V(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function zNe(e,t){return t?PA(e,t)!=null:!1}function UNe(e,t){return!t||!e.getPreviousPageParam?!1:$V(e,t)!=null}var $Ne=class{#t;#e;#r;#n;#a;#s;#o;#i;constructor(e={}){this.#t=e.queryCache||new PNe,this.#e=e.mutationCache||new jNe,this.#r=e.defaultOptions||{},this.#n=new Map,this.#a=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=RA.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=m1.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(lu(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#t.get(n.queryHash)?.state.data,o=TNe(t,i);if(o!==void 0)return this.#t.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return jn.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;jn.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t;return jn.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=jn.batch(()=>this.#t.findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(ja).catch(ja)}invalidateQueries(e,t={}){return jn.batch(()=>(this.#t.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=jn.batch(()=>this.#t.findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(ja)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(ja)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(lu(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ja).catch(ja)}fetchInfiniteQuery(e){return e.behavior=v1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ja).catch(ja)}ensureInfiniteQueryData(e){return e.behavior=v1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return m1.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(wm(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{Em(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(wm(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()],r={};return t.forEach(n=>{Em(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=kA(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===p1&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},VV=class extends Sm{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#o=LA(),this.options.experimental_prefetchInRender||this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#r=void 0;#n=void 0;#a;#s;#o;#i;#m;#f;#h;#u;#c;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),HV(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return FA(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return FA(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,r=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ii(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#e.setOptions(this.options),t._defaulted&&!IA(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&GV(this.#e,r,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==r||Ii(this.options.enabled,this.#e)!==Ii(t.enabled,this.#e)||lu(this.options.staleTime,this.#e)!==lu(t.staleTime,this.#e))&&this.#g();const a=this.#v();n&&(this.#e!==r||Ii(this.options.enabled,this.#e)!==Ii(t.enabled,this.#e)||a!==this.#l)&&this.#y(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return HNe(this,r)&&(this.#n=r,this.#s=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),Reflect.get(r,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(e){this.#w();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ja)),t}#g(){this.#x();const e=lu(this.options.staleTime,this.#e);if(Vc||this.#n.isStale||!CA(e))return;const r=DV(this.#n.dataUpdatedAt,e)+1;this.#u=setTimeout(()=>{this.#n.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#S(),this.#l=e,!(Vc||Ii(this.options.enabled,this.#e)===!1||!CA(this.#l)||this.#l===0)&&(this.#c=setInterval(()=>{(this.options.refetchIntervalInBackground||RA.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#S(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const r=this.#e,n=this.options,a=this.#n,i=this.#a,o=this.#s,l=e!==r?e.state:this.#r,{state:u}=e;let c={...u},d=!1,f;if(t._optimisticResults){const _=this.hasListeners(),A=!_&&HV(e,t),C=_&&GV(e,r,t,n);(A||C)&&(c={...c,...UV(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:m}=c;f=c.data;let g=!1;if(t.placeholderData!==void 0&&f===void 0&&m==="pending"){let _;a?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(_=a.data,g=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,_!==void 0&&(m="success",f=MA(a?.data,_,t),d=!0)}if(t.select&&f!==void 0&&!g)if(a&&f===i?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=MA(a?.data,f,t),this.#f=f,this.#i=null}catch(_){this.#i=_}this.#i&&(h=this.#i,f=this.#f,p=Date.now(),m="error");const v=c.fetchStatus==="fetching",y=m==="pending",x=m==="error",S=y&&v,E=f!==void 0,T={status:m,fetchStatus:c.fetchStatus,isPending:y,isSuccess:m==="success",isError:x,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:c.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:x&&!E,isPaused:c.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:x&&E,isStale:BA(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ii(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const _=I=>{T.status==="error"?I.reject(T.error):T.data!==void 0&&I.resolve(T.data)},A=()=>{const I=this.#o=T.promise=LA();_(I)},C=this.#o;switch(C.status){case"pending":e.queryHash===r.queryHash&&_(C);break;case"fulfilled":(T.status==="error"||T.data!==C.value)&&A();break;case"rejected":(T.status!=="error"||T.error!==C.reason)&&A();break}}return T}updateResult(){const e=this.#n,t=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#s=this.options,this.#a.data!==void 0&&(this.#h=this.#e),IA(t,e))return;this.#n=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!this.#p.size)return!0;const i=new Set(a??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#n).some(o=>{const s=o;return this.#n[s]!==e[s]&&i.has(s)})};this.#E({listeners:r()})}#w(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#E(e){jn.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function VNe(e,t){return Ii(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function HV(e,t){return VNe(e,t)||e.state.data!==void 0&&FA(e,t,t.refetchOnMount)}function FA(e,t,r){if(Ii(t.enabled,e)!==!1&&lu(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&BA(e,t)}return!1}function GV(e,t,r,n){return(e!==t||Ii(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&BA(e,r)}function BA(e,t){return Ii(t.enabled,e)!==!1&&e.isStaleByTime(lu(t.staleTime,e))}function HNe(e,t){return!IA(e.getCurrentResult(),t)}var GNe=class extends VV{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:v1()})}getOptimisticResult(e){return e.behavior=v1(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,n=super.createResult(e,t),{isFetching:a,isRefetching:i,isError:o,isRefetchError:s}=n,l=r.fetchMeta?.fetchMore?.direction,u=o&&l==="forward",c=a&&l==="forward",d=o&&l==="backward",f=a&&l==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:zNe(t,r.data),hasPreviousPage:UNe(t,r.data),isFetchNextPageError:u,isFetchingNextPage:c,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!u&&!d,isRefetching:i&&!c&&!f}}},qV=O.createContext(void 0),qNe=e=>{const t=O.useContext(qV);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WNe=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),b.jsx(qV.Provider,{value:e,children:t})),WV=O.createContext(!1),YNe=()=>O.useContext(WV);WV.Provider;function XNe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var KNe=O.createContext(XNe()),ZNe=()=>O.useContext(KNe),QNe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},JNe=e=>{O.useEffect(()=>{e.clearReset()},[e])},eIe=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||kNe(r,[e.error,n])),tIe=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},rIe=(e,t)=>e.isLoading&&e.isFetching&&!t,nIe=(e,t)=>e?.suspense&&t.isPending,YV=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function XV(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=YNe(),a=ZNe(),i=qNe(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",tIe(o),QNe(o,a),JNe(a);const s=!i.getQueryCache().get(o.queryHash),[l]=O.useState(()=>new t(i,o)),u=l.getOptimisticResult(o),c=!n&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(d=>{const f=c?l.subscribe(jn.batchCalls(d)):ja;return l.updateResult(),f},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),O.useEffect(()=>{l.setOptions(o)},[o,l]),nIe(o,u))throw YV(o,l,a);if(eIe({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Vc&&rIe(u,n)&&(s?YV(o,l,a):i.getQueryCache().get(o.queryHash)?.promise)?.catch(ja).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function KV(e,t){return XV(e,VV)}function ZV(e,t){return XV(e,GNe)}function aIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}const iIe=O.forwardRef(aIe);function oIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const QV=O.forwardRef(oIe);function sIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const y1=O.forwardRef(sIe);function lIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))}const uIe=O.forwardRef(lIe);function cIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.745 3.745 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z"}))}const dIe=O.forwardRef(cIe);function fIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const gh=O.forwardRef(fIe);function hIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const vh=O.forwardRef(hIe);function pIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const JV=O.forwardRef(pIe);function mIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const gIe=O.forwardRef(mIe);function vIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const eH=O.forwardRef(vIe);function yIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const bIe=O.forwardRef(yIe);function xIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"}))}const tH=O.forwardRef(xIe);function SIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const rH=O.forwardRef(SIe);function wIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const EIe=O.forwardRef(wIe);function TIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const jA=O.forwardRef(TIe);function _Ie({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"}))}const nH=O.forwardRef(_Ie);function AIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}const CIe=O.forwardRef(AIe);function kIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"}))}const aH=O.forwardRef(kIe);function NIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const IIe=O.forwardRef(NIe);function DIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"}))}const zA=O.forwardRef(DIe);function MIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const Tm=O.forwardRef(MIe);function RIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const iH=O.forwardRef(RIe);function LIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const oH=O.forwardRef(LIe);function OIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"}))}const sH=O.forwardRef(OIe);function PIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const lH=O.forwardRef(PIe);function FIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))}const uH=O.forwardRef(FIe);function BIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"}))}const jIe=O.forwardRef(BIe);function zIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const UA=O.forwardRef(zIe);function UIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const $Ie=O.forwardRef(UIe);function VIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.53 16.122a3 3 0 0 0-5.78 1.128 2.25 2.25 0 0 1-2.4 2.245 4.5 4.5 0 0 0 8.4-2.245c0-.399-.078-.78-.22-1.128Zm0 0a15.998 15.998 0 0 0 3.388-1.62m-5.043-.025a15.994 15.994 0 0 1 1.622-3.395m3.42 3.42a15.995 15.995 0 0 0 4.764-4.648l3.876-5.814a1.151 1.151 0 0 0-1.597-1.597L14.146 6.32a15.996 15.996 0 0 0-4.649 4.763m3.42 3.42a6.776 6.776 0 0 0-3.42-3.42"}))}const HIe=O.forwardRef(VIe);function GIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5"}))}const qIe=O.forwardRef(GIe);function WIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"}))}const cH=O.forwardRef(WIe);function YIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const _m=O.forwardRef(YIe);function XIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const KIe=O.forwardRef(XIe);function ZIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}const yh=O.forwardRef(ZIe);function QIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 0 1-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 0 0 6.16-12.12A14.98 14.98 0 0 0 9.631 8.41m5.96 5.96a14.926 14.926 0 0 1-5.841 2.58m-.119-8.54a6 6 0 0 0-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 0 0-2.58 5.84m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 0 1-2.448-2.448 14.9 14.9 0 0 1 .06-.312m-2.24 2.39a4.493 4.493 0 0 0-1.757 4.306 4.493 4.493 0 0 0 4.306-1.758M16.5 9a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"}))}const dH=O.forwardRef(QIe);function JIe({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 14.25h13.5m-13.5 0a3 3 0 0 1-3-3m3 3a3 3 0 1 0 0 6h13.5a3 3 0 1 0 0-6m-16.5-3a3 3 0 0 1 3-3h13.5a3 3 0 0 1 3 3m-19.5 0a4.5 4.5 0 0 1 .9-2.7L5.737 5.1a3.375 3.375 0 0 1 2.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 0 1 .9 2.7m0 0a3 3 0 0 1-3 3m0 3h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Zm-3 6h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Z"}))}const Am=O.forwardRef(JIe);function e3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"}))}const t3e=O.forwardRef(e3e);function r3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const $A=O.forwardRef(r3e);function n3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const fH=O.forwardRef(n3e);function a3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}const hH=O.forwardRef(a3e);function i3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const o3e=O.forwardRef(i3e);function s3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const VA=O.forwardRef(s3e);function l3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))}const b1=O.forwardRef(l3e);function u3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125Z"}))}const c3e=O.forwardRef(u3e);function d3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"}))}const pH=O.forwardRef(d3e);function f3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const h3e=O.forwardRef(f3e);function p3e({title:e,titleId:t,...r},n){return O.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?O.createElement("title",{id:t},e):null,O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const x1=O.forwardRef(p3e);function m3e({isOpen:e,onClose:t,onSubmit:r}){const[n,a]=N.useState(""),i=l=>{l.preventDefault(),n.trim()&&(r(n.trim()),a(""),t())},o=N.useCallback(()=>{a(""),t()},[t]),s=l=>{l.target===l.currentTarget&&o()};return N.useEffect(()=>{const l=u=>{u.key==="Escape"&&o()};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,o]),e?b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:s,children:b.jsxs("div",{className:"w-full max-w-md rounded-sm bg-white p-6 shadow-xl dark:bg-neutral-800",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"text-lg font-medium text-neutral-900 dark:text-neutral-100",children:"输入访问令牌"}),b.jsx("button",{onClick:o,className:"rounded-sm p-1 text-neutral-400 hover:bg-neutral-100 hover:text-neutral-500 dark:hover:bg-neutral-700",children:b.jsx(x1,{className:"h-5 w-5"})})]}),b.jsxs("form",{onSubmit:i,children:[b.jsxs("div",{className:"mb-4",children:[b.jsx("label",{htmlFor:"token-input",className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"访问令牌"}),b.jsx("input",{id:"token-input",type:"password",value:n,onChange:l=>a(l.target.value),placeholder:"请输入您的访问令牌",className:"w-full rounded-sm border border-neutral-300 px-3 py-2 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100",autoFocus:!0,required:!0}),b.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"请输入有效的访问令牌进行身份验证"})]}),b.jsxs("div",{className:"flex justify-end space-x-3",children:[b.jsx("button",{type:"button",onClick:o,className:"rounded-sm px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-50 dark:text-neutral-300 dark:hover:bg-neutral-700",children:"取消"}),b.jsx("button",{type:"submit",className:"rounded-sm bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",children:"确认"})]})]})]})}):null}function mH({onTokenInput:e,className:t=""}){const r=AA(),[n,a]=N.useState(!1),i=async s=>{await r.login(s),e?.(s)};if(r.isLoading)return b.jsxs("div",{className:`flex items-center space-x-2 ${t}`,children:[b.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600 dark:border-neutral-700 dark:border-t-indigo-500"}),b.jsx("span",{className:"text-sm text-neutral-500",children:"检查认证状态..."})]});if(r.isAuthenticated)return b.jsx("div",{className:`flex items-center space-x-2 ${t}`,children:b.jsxs("div",{className:"flex items-center space-x-2",children:[r.user?.avatar?b.jsx("img",{src:r.user.avatar,alt:r.user.username,className:"h-6 w-6 rounded-full"}):b.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-indigo-100 dark:bg-indigo-900",children:b.jsx(b1,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"})}),b.jsx("div",{className:"flex flex-col",children:b.jsx("span",{className:"text-sm font-medium max-w-32 truncate text-neutral-900 dark:text-neutral-100",children:r.user?.username})})]})});const o=r.status==="failed"?"认证错误或未配置":"未授权的用户";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:`flex items-center space-x-2 ${t}`,children:b.jsx("button",{onClick:()=>a(!0),className:"flex items-center justify-center h-6 w-6 rounded-full text-amber-600 hover:bg-amber-50 dark:text-amber-400 dark:hover:bg-amber-900/20 transition-colors",title:o,children:b.jsx(Tm,{className:"h-4 w-4"})})}),b.jsx(m3e,{isOpen:n,onClose:()=>a(!1),onSubmit:i})]})}const gH=({className:e,title:t="设置"})=>{const{openSettingsModal:r}=Ze();return b.jsx("button",{className:`rounded-sm p-1.5 text-neutral-500 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800${e?` ${e}`:""}`,title:t,onClick:()=>r("provider"),"aria-label":t,type:"button",children:b.jsx(EIe,{className:"h-5 w-5"})})},HA=()=>{const[e,t]=N.useState("system"),r=Ze(o=>o.setTheme),n=N.useCallback(o=>{const s=window.document.documentElement,l=o==="dark"||o==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches,u=document.createElement("style");u.innerHTML="*, *::before, *::after { transition: none !important; }",document.head.appendChild(u),s.classList.toggle("dark",l),localStorage.setItem("theme",o),setTimeout(()=>{document.head.contains(u)&&document.head.removeChild(u)},50)},[]);return N.useEffect(()=>{const s=localStorage.getItem("theme")||"system";t(s),n(s)},[n]),N.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{e==="system"&&n("system")};return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e,n]),{theme:e,cycleTheme:()=>{const o=["light","dark","system"],s=o.indexOf(e),l=o[(s+1)%o.length];t(l),n(l)},setTheme:o=>{t(o),n(o),r(o)}}};function g3e(){const{isXyzenOpen:e,pendingInput:t,setPendingInput:r,submitInput:n,sendMessage:a,activeChatChannel:i,createDefaultChannel:o,openXyzen:s,setTabIndex:l}=Ze(),u=N.useRef(null),[c,d]=N.useState(!1),f=!e;N.useEffect(()=>{const g=setTimeout(()=>{d(!0)},100);return()=>clearTimeout(g)},[]),N.useEffect(()=>{if(f&&u.current){const g=setTimeout(()=>{u.current?.focus()},100);return()=>clearTimeout(g)}},[f]);const h=async g=>{if(g.key==="Enter"&&t.trim()){g.preventDefault();const v=t.trim();n();try{i||await o("default-chat"),setTimeout(()=>{a(v),r("")},200)}catch(y){console.error("Failed to create channel or send message:",y),r("")}}else g.key==="Escape"&&(g.preventDefault(),r(""),u.current?.blur())},p=()=>{},m=()=>{s(),l(1)};return f?b.jsx("div",{className:xr("fixed bottom-6 left-1/2 z-50 w-full max-w-sm -translate-x-1/2 px-4","transition-all duration-700 ease-out",c?"translate-y-0 opacity-100":"translate-y-20 opacity-0"),children:b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs("div",{className:"relative flex-1 group",children:[b.jsx("input",{ref:u,type:"text",value:t,onChange:g=>r(g.target.value),onKeyDown:h,onFocus:p,placeholder:"Type your message...",className:xr("w-full appearance-none focus:outline-none rounded-full border border-neutral-200/50 bg-white/60 backdrop-blur-md py-2.5 px-5 pr-10 text-sm text-neutral-950 placeholder:text-neutral-500","shadow-lg transition-all duration-300 ease-out origin-right","focus:outline-none focus:ring-2 focus:ring-indigo-400/50 focus:border-indigo-300 focus:bg-white/80 focus:shadow-xl focus:scale-x-110 focus:scale-y-105 focus:backdrop-blur-lg","hover:scale-[1.01] hover:shadow-xl hover:bg-white/70 hover:backdrop-blur-lg","dark:border-neutral-700/50 dark:bg-neutral-900/60 dark:text-white dark:placeholder:text-neutral-400","dark:focus:ring-indigo-500/50 dark:focus:border-indigo-600 dark:focus:bg-neutral-900/80","dark:hover:bg-neutral-900/70")}),b.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-neutral-400 dark:text-neutral-500 pointer-events-none transition-opacity duration-300 focus-within:opacity-0",children:"↵"})]}),b.jsx("button",{onClick:m,className:xr("flex h-10 w-10 items-center justify-center rounded-full border border-neutral-200/50 bg-white/60 backdrop-blur-md text-neutral-600","shadow-lg transition-all duration-300 ease-out","hover:bg-white/80 hover:text-indigo-600 hover:border-indigo-200/50 hover:shadow-xl hover:scale-110 hover:backdrop-blur-lg","focus:outline-none focus:ring-2 focus:ring-indigo-400/50 focus:border-indigo-300","active:scale-95","dark:border-neutral-700/50 dark:bg-neutral-900/60 dark:text-neutral-400","dark:hover:bg-neutral-900/80 dark:hover:text-indigo-400 dark:hover:border-indigo-700/50"),title:"Open sidebar",children:b.jsx(bIe,{className:"h-4 w-4"})})]})}):null}function v3e(...e){return t=>{e.forEach(r=>{r&&(typeof r=="function"?r(t):r.current=t)})}}function y3e(e,t){const r={...e,...t};return(e.className||t.className)&&(r.className=Dr(e.className,t.className)),(e.style||t.style)&&(r.style={...e.style,...t.style}),r}function bh({children:e,ref:t,...r}){const n=typeof e.type=="object"&&e.type!==null&&e2e(e.type),a=O.useMemo(()=>n?e.type:Ht.create(e.type),[n,e.type]);if(!O.isValidElement(e))return null;const{ref:i,...o}=e.props,s=y3e(o,r);return b.jsx(a,{...s,ref:v3e(i,t)})}function b3e({delay:e="0.3s",fillHeight:t="3px",hoverScale:r=1.05,tapScale:n=.95,asChild:a=!1,...i}){const o=a?bh:Ht.button;return b.jsx(o,{whileTap:{scale:n},whileHover:{scale:r,"--liquid-button-fill-width":"100%","--liquid-button-fill-height":"100%","--liquid-button-delay":e,transition:{"--liquid-button-fill-width":{duration:0},"--liquid-button-fill-height":{duration:0},"--liquid-button-delay":{duration:0}}},style:{"--liquid-button-fill-width":"-1%","--liquid-button-fill-height":t,"--liquid-button-delay":"0s",background:"linear-gradient(var(--liquid-button-color) 0 0) no-repeat calc(200% - var(--liquid-button-fill-width, -1%)) 100% / 200% var(--liquid-button-fill-height, 0.2em)",backgroundColor:"var(--liquid-button-background-color)",transition:`background ${e} var(--liquid-button-delay, 0s), color ${e} ${e}, background-position ${e} calc(${e} - var(--liquid-button-delay, 0s))`},...i})}const vH=typeof document<"u"?N.useLayoutEffect:()=>{};function x3e(e){const t=N.useRef(null);return vH(()=>{t.current=e},[e]),N.useCallback((...r)=>{const n=t.current;return n?.(...r)},[])}const uu=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},Hc=e=>e&&"window"in e&&e.window===e?e:uu(e).defaultView||window;function S3e(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function w3e(e){return S3e(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let E3e=!1;function GA(){return E3e}function yH(e,t){if(!GA())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let r=t;for(;r!==null;){if(r===e)return!0;r.tagName==="SLOT"&&r.assignedSlot?r=r.assignedSlot.parentNode:w3e(r)?r=r.host:r=r.parentNode}return!1}const qA=(e=document)=>{var t;if(!GA())return e.activeElement;let r=e.activeElement;for(;r&&"shadowRoot"in r&&(!((t=r.shadowRoot)===null||t===void 0)&&t.activeElement);)r=r.shadowRoot.activeElement;return r};function bH(e){return GA()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function S1(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(r=>e.test(r.brand)))||e.test(window.navigator.userAgent)}function WA(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function el(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const YA=el(function(){return WA(/^Mac/i)}),T3e=el(function(){return WA(/^iPhone/i)}),_3e=el(function(){return WA(/^iPad/i)||YA()&&navigator.maxTouchPoints>1}),A3e=el(function(){return T3e()||_3e()});el(function(){return YA()||A3e()}),el(function(){return S1(/AppleWebKit/i)&&!C3e()});const C3e=el(function(){return S1(/Chrome/i)}),k3e=el(function(){return S1(/Android/i)});el(function(){return S1(/Firefox/i)});function xH(){let e=N.useRef(new Map),t=N.useCallback((a,i,o,s)=>{let l=s?.once?(...u)=>{e.current.delete(o),o(...u)}:o;e.current.set(o,{type:i,eventTarget:a,fn:l,options:s}),a.addEventListener(i,l,s)},[]),r=N.useCallback((a,i,o,s)=>{var l;let u=((l=e.current.get(o))===null||l===void 0?void 0:l.fn)||o;a.removeEventListener(i,u,s),e.current.delete(o)},[]),n=N.useCallback(()=>{e.current.forEach((a,i)=>{r(a.eventTarget,a.type,i,a.options)})},[r]);return N.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function N3e(e){return e.mozInputSource===0&&e.isTrusted?!0:k3e()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function SH(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function I3e(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function wH(e){let t=N.useRef({isFocused:!1,observer:null});vH(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]);let r=x3e(n=>{e?.(n)});return N.useCallback(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let a=n.target,i=o=>{if(t.current.isFocused=!1,a.disabled){let s=SH(o);r(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};a.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&a.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let s=a===document.activeElement?null:document.activeElement;a.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),a.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(a,{attributes:!0,attributeFilter:["disabled"]})}},[r])}let D3e=!1,Cm=null,XA=new Set,km=new Map,Gc=!1,KA=!1;const M3e={Tab:!0,Escape:!0};function ZA(e,t){for(let r of XA)r(e,t)}function R3e(e){return!(e.metaKey||!YA()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function w1(e){Gc=!0,R3e(e)&&(Cm="keyboard",ZA("keyboard",e))}function Di(e){Cm="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Gc=!0,ZA("pointer",e))}function EH(e){N3e(e)&&(Gc=!0,Cm="virtual")}function TH(e){e.target===window||e.target===document||D3e||!e.isTrusted||(!Gc&&!KA&&(Cm="virtual",ZA("virtual",e)),Gc=!1,KA=!1)}function _H(){Gc=!1,KA=!0}function QA(e){if(typeof window>"u"||typeof document>"u"||km.get(Hc(e)))return;const t=Hc(e),r=uu(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Gc=!0,n.apply(this,arguments)},r.addEventListener("keydown",w1,!0),r.addEventListener("keyup",w1,!0),r.addEventListener("click",EH,!0),t.addEventListener("focus",TH,!0),t.addEventListener("blur",_H,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",Di,!0),r.addEventListener("pointermove",Di,!0),r.addEventListener("pointerup",Di,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",Di,!0),r.addEventListener("mousemove",Di,!0),r.addEventListener("mouseup",Di,!0)),t.addEventListener("beforeunload",()=>{AH(e)},{once:!0}),km.set(t,{focus:n})}const AH=(e,t)=>{const r=Hc(e),n=uu(e);t&&n.removeEventListener("DOMContentLoaded",t),km.has(r)&&(r.HTMLElement.prototype.focus=km.get(r).focus,n.removeEventListener("keydown",w1,!0),n.removeEventListener("keyup",w1,!0),n.removeEventListener("click",EH,!0),r.removeEventListener("focus",TH,!0),r.removeEventListener("blur",_H,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",Di,!0),n.removeEventListener("pointermove",Di,!0),n.removeEventListener("pointerup",Di,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",Di,!0),n.removeEventListener("mousemove",Di,!0),n.removeEventListener("mouseup",Di,!0)),km.delete(r))};function L3e(e){const t=uu(e);let r;return t.readyState!=="loading"?QA(e):(r=()=>{QA(e)},t.addEventListener("DOMContentLoaded",r)),()=>AH(e,r)}typeof document<"u"&&L3e();function CH(){return Cm!=="pointer"}const O3e=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function P3e(e,t,r){let n=uu(r?.target);const a=typeof window<"u"?Hc(r?.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?Hc(r?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?Hc(r?.target).HTMLElement:HTMLElement,s=typeof window<"u"?Hc(r?.target).KeyboardEvent:KeyboardEvent;return e=e||n.activeElement instanceof a&&!O3e.has(n.activeElement.type)||n.activeElement instanceof i||n.activeElement instanceof o&&n.activeElement.isContentEditable,!(e&&t==="keyboard"&&r instanceof s&&!M3e[r.key])}function F3e(e,t,r){QA(),N.useEffect(()=>{let n=(a,i)=>{P3e(!!r?.isTextInput,a,i)&&e(CH())};return XA.add(n),()=>{XA.delete(n)}},t)}function B3e(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:a}=e;const i=N.useCallback(l=>{if(l.target===l.currentTarget)return n&&n(l),a&&a(!1),!0},[n,a]),o=wH(i),s=N.useCallback(l=>{const u=uu(l.target),c=u?qA(u):qA();l.target===l.currentTarget&&c===bH(l.nativeEvent)&&(r&&r(l),a&&a(!0),o(l))},[a,r,o]);return{focusProps:{onFocus:!t&&(r||a||n)?s:void 0,onBlur:!t&&(n||a)?i:void 0}}}function j3e(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:a}=e,i=N.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=xH(),l=N.useCallback(d=>{d.currentTarget.contains(d.target)&&i.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(i.current.isFocusWithin=!1,s(),r&&r(d),a&&a(!1))},[r,a,i,s]),u=wH(l),c=N.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=uu(d.target),h=qA(f);if(!i.current.isFocusWithin&&h===bH(d.nativeEvent)){n&&n(d),a&&a(!0),i.current.isFocusWithin=!0,u(d);let p=d.currentTarget;o(f,"focus",m=>{if(i.current.isFocusWithin&&!yH(p,m.target)){let g=new f.defaultView.FocusEvent("blur",{relatedTarget:m.target});I3e(g,p);let v=SH(g);l(v)}},{capture:!0})}},[n,a,u,o,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:l}}}let E1=!1,JA=0;function eC(){E1=!0,setTimeout(()=>{E1=!1},50)}function kH(e){e.pointerType==="touch"&&eC()}function z3e(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",kH):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",eC),JA++,()=>{JA--,!(JA>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",kH):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",eC))}}function Nm(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:a}=e,[i,o]=N.useState(!1),s=N.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;N.useEffect(z3e,[]);let{addGlobalListener:l,removeAllGlobalListeners:u}=xH(),{hoverProps:c,triggerHoverEnd:d}=N.useMemo(()=>{let f=(m,g)=>{if(s.pointerType=g,a||g==="touch"||s.isHovered||!m.currentTarget.contains(m.target))return;s.isHovered=!0;let v=m.currentTarget;s.target=v,l(uu(m.target),"pointerover",y=>{s.isHovered&&s.target&&!yH(s.target,y.target)&&h(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:v,pointerType:g}),r&&r(!0),o(!0)},h=(m,g)=>{let v=s.target;s.pointerType="",s.target=null,!(g==="touch"||!s.isHovered||!v)&&(s.isHovered=!1,u(),n&&n({type:"hoverend",target:v,pointerType:g}),r&&r(!1),o(!1))},p={};return typeof PointerEvent<"u"?(p.onPointerEnter=m=>{E1&&m.pointerType==="mouse"||f(m,m.pointerType)},p.onPointerLeave=m=>{!a&&m.currentTarget.contains(m.target)&&h(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(p.onTouchStart=()=>{s.ignoreEmulatedMouseEvents=!0},p.onMouseEnter=m=>{!s.ignoreEmulatedMouseEvents&&!E1&&f(m,"mouse"),s.ignoreEmulatedMouseEvents=!1},p.onMouseLeave=m=>{!a&&m.currentTarget.contains(m.target)&&h(m,"mouse")}),{hoverProps:p,triggerHoverEnd:h}},[t,r,n,a,s,l,u]);return N.useEffect(()=>{a&&d({currentTarget:s.target},s.pointerType)},[a]),{hoverProps:c,isHovered:i}}function Im(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,a=N.useRef({isFocused:!1,isFocusVisible:t||CH()}),[i,o]=N.useState(!1),[s,l]=N.useState(()=>a.current.isFocused&&a.current.isFocusVisible),u=N.useCallback(()=>l(a.current.isFocused&&a.current.isFocusVisible),[]),c=N.useCallback(h=>{a.current.isFocused=h,o(h),u()},[u]);F3e(h=>{a.current.isFocusVisible=h,u()},[],{isTextInput:r});let{focusProps:d}=B3e({isDisabled:n,onFocusChange:c}),{focusWithinProps:f}=j3e({isDisabled:!n,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:s,focusProps:n?f:d}}var U3e=Object.defineProperty,$3e=(e,t,r)=>t in e?U3e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tC=(e,t,r)=>($3e(e,typeof t!="symbol"?t+"":t,r),r);let V3e=class{constructor(){tC(this,"current",this.detect()),tC(this,"handoffState","pending"),tC(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Zo=new V3e;function xh(e){var t;return Zo.isServer?null:e==null?document:(t=e?.ownerDocument)!=null?t:document}function rC(e){var t,r;return Zo.isServer?null:e==null?document:(r=(t=e?.getRootNode)==null?void 0:t.call(e))!=null?r:document}function NH(e){var t,r;return(r=(t=rC(e))==null?void 0:t.activeElement)!=null?r:null}function T1(e){return NH(e)===e}function _1(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function tl(){let e=[],t={addEventListener(r,n,a,i){return r.addEventListener(n,a,i),t.add(()=>r.removeEventListener(n,a,i))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return _1(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,a){let i=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:a}),this.add(()=>{Object.assign(r.style,{[n]:i})})},group(r){let n=tl();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let a of e.splice(n,1))a()}},dispose(){for(let r of e.splice(0))r()}};return t}function qc(){let[e]=N.useState(tl);return N.useEffect(()=>()=>e.dispose(),[e]),e}let zn=(e,t)=>{Zo.isServer?N.useEffect(e,t):N.useLayoutEffect(e,t)};function rl(e){let t=N.useRef(e);return zn(()=>{t.current=e},[e]),t}let kt=function(e){let t=rl(e);return N.useCallback((...r)=>t.current(...r),[t])};function H3e(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function G3e(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function IH({disabled:e=!1}={}){let t=N.useRef(null),[r,n]=N.useState(!1),a=qc(),i=kt(()=>{t.current=null,n(!1),a.dispose()}),o=kt(s=>{if(a.dispose(),t.current===null){t.current=s.currentTarget,n(!0);{let l=xh(s.currentTarget);a.addEventListener(l,"pointerup",i,!1),a.addEventListener(l,"pointermove",u=>{if(t.current){let c=H3e(u);n(G3e(c,t.current.getBoundingClientRect()))}},!1),a.addEventListener(l,"pointercancel",i,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:o,onPointerUp:i,onClick:i}}}function oi(e){return N.useMemo(()=>e,Object.values(e))}let DH=N.createContext(void 0);function cu(){return N.useContext(DH)}function q3e({value:e,children:t}){return N.createElement(DH.Provider,{value:e},t)}function nC(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Qo(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qo),n}var A1=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(A1||{}),du=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(du||{});function Vr(){let e=Y3e();return N.useCallback(t=>W3e({mergeRefs:e,...t}),[e])}function W3e({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:i=!0,name:o,mergeRefs:s}){s=s??X3e;let l=MH(t,e);if(i)return C1(l,r,n,o,s);let u=a??0;if(u&2){let{static:c=!1,...d}=l;if(c)return C1(d,r,n,o,s)}if(u&1){let{unmount:c=!0,...d}=l;return Qo(c?0:1,{0(){return null},1(){return C1({...d,hidden:!0,style:{display:"none"}},r,n,o,s)}})}return C1(l,r,n,o,s)}function C1(e,t={},r,n,a){let{as:i=r,children:o,refName:s="ref",...l}=aC(e,["unmount","static"]),u=e.ref!==void 0?{[s]:e.ref}:{},c=typeof o=="function"?o(t):o;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t)),l["aria-labelledby"]&&l["aria-labelledby"]===l.id&&(l["aria-labelledby"]=void 0);let d={};if(t){let f=!1,h=[];for(let[p,m]of Object.entries(t))typeof m=="boolean"&&(f=!0),m===!0&&h.push(p.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(f){d["data-headlessui-state"]=h.join(" ");for(let p of h)d[`data-${p}`]=""}}if(Mm(i)&&(Object.keys(fu(l)).length>0||Object.keys(fu(d)).length>0))if(!N.isValidElement(c)||Array.isArray(c)&&c.length>1||Z3e(c)){if(Object.keys(fu(l)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(fu(l)).concat(Object.keys(fu(d))).map(f=>` - ${f}`).join(`
81
81
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(f=>` - ${f}`).join(`
82
82
  `)].join(`
83
83
  `))}else{let f=c.props,h=f?.className,p=typeof h=="function"?(...v)=>nC(h(...v),l.className):nC(h,l.className),m=p?{className:p}:{},g=MH(c.props,fu(aC(l,["ref"])));for(let v in d)v in g&&delete d[v];return N.cloneElement(c,Object.assign({},g,d,u,{ref:a(K3e(c),u.ref)},m))}return N.createElement(i,Object.assign({},aC(l,["ref"]),!Mm(i)&&u,!Mm(i)&&d),c)}function Y3e(){let e=N.useRef([]),t=N.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function X3e(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function MH(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[a=>{var i;return(i=a?.preventDefault)==null?void 0:i.call(a)}]);for(let n in r)Object.assign(t,{[n](a,...i){let o=r[n];for(let s of o){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;s(a,...i)}}});return t}function Dm(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];for(let n in r)Object.assign(t,{[n](...a){let i=r[n];for(let o of i)o?.(...a)}});return t}function Mr(e){var t;return Object.assign(N.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function fu(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function aC(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function K3e(e){return N.version.split(".")[0]>="19"?e.props.ref:e.ref}function Mm(e){return e===N.Fragment||e===Symbol.for("react.fragment")}function Z3e(e){return Mm(e.type)}let Q3e="button";function J3e(e,t){var r;let n=cu(),{disabled:a=n||!1,autoFocus:i=!1,...o}=e,{isFocusVisible:s,focusProps:l}=Im({autoFocus:i}),{isHovered:u,hoverProps:c}=Nm({isDisabled:a}),{pressed:d,pressProps:f}=IH({disabled:a}),h=Dm({ref:t,type:(r=o.type)!=null?r:"button",disabled:a||void 0,autoFocus:i},l,c,f),p=oi({disabled:a,hover:u,focus:s,active:d,autofocus:i});return Vr()({ourProps:h,theirProps:o,slot:p,defaultTag:Q3e,name:"Button"})}let en=Mr(J3e);function RH(e,t,r){let[n,a]=N.useState(r),i=e!==void 0,o=N.useRef(i),s=N.useRef(!1),l=N.useRef(!1);return i&&!o.current&&!s.current?(s.current=!0,o.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&o.current&&!l.current&&(l.current=!0,o.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:n,kt(u=>(i||go.flushSync(()=>a(u)),t?.(u)))]}function LH(e){let[t]=N.useState(e);return t}function OH(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))FH(r,PH(t,n),a);return r}function PH(e,t){return e?e+"["+t+"]":t}function FH(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())FH(e,PH(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):e5e(r)&&!N.isValidElement(r)&&OH(r,t,e)}function BH(e){var t,r;let n=(t=e?.form)!=null?t:e.closest("form");if(n){for(let a of n.elements)if(a!==e&&(a.tagName==="INPUT"&&a.type==="submit"||a.tagName==="BUTTON"&&a.type==="submit"||a.nodeName==="INPUT"&&a.type==="image")){a.click();return}(r=n.requestSubmit)==null||r.call(n)}}function e5e(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let t5e="span";var Wc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Wc||{});function r5e(e,t){var r;let{features:n=1,...a}=e,i={ref:t,"aria-hidden":(n&2)===2?!0:(r=a["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Vr()({ourProps:i,theirProps:a,slot:{},defaultTag:t5e,name:"Hidden"})}let Sh=Mr(r5e),jH=N.createContext(null);function n5e(e){let[t,r]=N.useState(null);return N.createElement(jH.Provider,{value:{target:t}},e.children,N.createElement(Sh,{features:Wc.Hidden,ref:r}))}function a5e({children:e}){let t=N.useContext(jH);if(!t)return N.createElement(N.Fragment,null,e);let{target:r}=t;return r?go.createPortal(N.createElement(N.Fragment,null,e),r):null}function zH({data:e,form:t,disabled:r,onReset:n,overrides:a}){let[i,o]=N.useState(null),s=qc();return N.useEffect(()=>{if(n&&i)return s.addEventListener(i,"reset",n)},[i,t,n]),N.createElement(a5e,null,N.createElement(i5e,{setForm:o,formId:t}),OH(e).map(([l,u])=>N.createElement(Sh,{features:Wc.Hidden,...fu({key:l,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:l,value:u,...a})})))}function i5e({setForm:e,formId:t}){return N.useEffect(()=>{if(t){let r=document.getElementById(t);r&&e(r)}},[e,t]),t?null:N.createElement(Sh,{features:Wc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:r=>{if(!r)return;let n=r.closest("form");n&&e(n)}})}let UH=N.createContext(void 0);function k1(){return N.useContext(UH)}function o5e({id:e,children:t}){return N.createElement(UH.Provider,{value:e},t)}function s5e(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function nl(e){return s5e(e)&&"tagName"in e}function Jo(e){return nl(e)&&"accessKey"in e}function hu(e){return nl(e)&&"tabIndex"in e}function l5e(e){return nl(e)&&"style"in e}function u5e(e){return Jo(e)&&e.nodeName==="IFRAME"}function $H(e){return Jo(e)&&e.nodeName==="INPUT"}function iC(e){return Jo(e)&&e.nodeName==="LABEL"}function c5e(e){return Jo(e)&&e.nodeName==="FIELDSET"}function VH(e){return Jo(e)&&e.nodeName==="LEGEND"}function d5e(e){return nl(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function oC(e){let t=e.parentElement,r=null;for(;t&&!c5e(t);)VH(t)&&(r=t),t=t.parentElement;let n=t?.getAttribute("disabled")==="";return n&&f5e(r)?!1:n}function f5e(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(VH(t))return!1;t=t.previousElementSibling}return!0}let HH=Symbol();function h5e(e,t=!0){return Object.assign(e,{[HH]:t})}function wa(...e){let t=N.useRef(e);N.useEffect(()=>{t.current=e},[e]);let r=kt(n=>{for(let a of t.current)a!=null&&(typeof a=="function"?a(n):a.current=n)});return e.every(n=>n==null||n?.[HH])?void 0:r}let N1=N.createContext(null);N1.displayName="DescriptionContext";function GH(){let e=N.useContext(N1);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,GH),t}return e}function sC(){var e,t;return(t=(e=N.useContext(N1))==null?void 0:e.value)!=null?t:void 0}function Rm(){let[e,t]=N.useState([]);return[e.length>0?e.join(" "):void 0,N.useMemo(()=>function(r){let n=kt(i=>(t(o=>[...o,i]),()=>t(o=>{let s=o.slice(),l=s.indexOf(i);return l!==-1&&s.splice(l,1),s}))),a=N.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return N.createElement(N1.Provider,{value:a},r.children)},[t])]}let p5e="p";function m5e(e,t){let r=N.useId(),n=cu(),{id:a=`headlessui-description-${r}`,...i}=e,o=GH(),s=wa(t);zn(()=>o.register(a),[a,o.register]);let l=oi({...o.slot,disabled:n||!1}),u={ref:s,...o.props,id:a};return Vr()({ourProps:u,theirProps:i,slot:l,defaultTag:p5e,name:o.name||"Description"})}let g5e=Mr(m5e),lC=Object.assign(g5e,{});var es=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(es||{});let I1=N.createContext(null);I1.displayName="LabelContext";function qH(){let e=N.useContext(I1);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,qH),t}return e}function D1(e){var t,r,n;let a=(r=(t=N.useContext(I1))==null?void 0:t.value)!=null?r:void 0;return((n=void 0)!=null?n:0)>0?[a,...e].filter(Boolean).join(" "):a}function M1({inherit:e=!1}={}){let t=D1(),[r,n]=N.useState([]),a=e?[t,...r].filter(Boolean):r;return[a.length>0?a.join(" "):void 0,N.useMemo(()=>function(i){let o=kt(l=>(n(u=>[...u,l]),()=>n(u=>{let c=u.slice(),d=c.indexOf(l);return d!==-1&&c.splice(d,1),c}))),s=N.useMemo(()=>({register:o,slot:i.slot,name:i.name,props:i.props,value:i.value}),[o,i.slot,i.name,i.props,i.value]);return N.createElement(I1.Provider,{value:s},i.children)},[n])]}let v5e="label";function y5e(e,t){var r;let n=N.useId(),a=qH(),i=k1(),o=cu(),{id:s=`headlessui-label-${n}`,htmlFor:l=i??((r=a.props)==null?void 0:r.htmlFor),passive:u=!1,...c}=e,d=wa(t);zn(()=>a.register(s),[s,a.register]);let f=kt(m=>{let g=m.currentTarget;if(!(m.target!==m.currentTarget&&d5e(m.target))&&(iC(g)&&m.preventDefault(),a.props&&"onClick"in a.props&&typeof a.props.onClick=="function"&&a.props.onClick(m),iC(g))){let v=document.getElementById(g.htmlFor);if(v){let y=v.getAttribute("disabled");if(y==="true"||y==="")return;let x=v.getAttribute("aria-disabled");if(x==="true"||x==="")return;($H(v)&&(v.type==="file"||v.type==="radio"||v.type==="checkbox")||v.role==="radio"||v.role==="checkbox"||v.role==="switch")&&v.click(),v.focus({preventScroll:!0})}}}),h=oi({...a.slot,disabled:o||!1}),p={ref:d,...a.props,id:s,htmlFor:l,onClick:f};return u&&("onClick"in p&&(delete p.htmlFor,delete p.onClick),"onClick"in c&&delete c.onClick),Vr()({ourProps:p,theirProps:c,slot:h,defaultTag:l?v5e:"div",name:a.name||"Label"})}let b5e=Mr(y5e),Xt=Object.assign(b5e,{}),x5e=N.createContext(()=>{});function S5e({value:e,children:t}){return N.createElement(x5e.Provider,{value:e},t)}function w5e(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function E5e(e=w5e){return N.useCallback((t,r)=>{if(typeof e=="string"){let n=e;return t?.[n]===r?.[n]}return e(t,r)},[e])}let WH=class extends Map{constructor(t){super(),this.factory=t}get(t){let r=super.get(t);return r===void 0&&(r=this.factory(t),this.set(t,r)),r}};var T5e=Object.defineProperty,_5e=(e,t,r)=>t in e?T5e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A5e=(e,t,r)=>(_5e(e,t+"",r),r),YH=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Mi=(e,t,r)=>(YH(e,t,"read from private field"),r?r.call(e):t.get(e)),uC=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},XH=(e,t,r,n)=>(YH(e,t,"write to private field"),t.set(e,r),r),ts,Lm,Om;let C5e=class{constructor(t){uC(this,ts,{}),uC(this,Lm,new WH(()=>new Set)),uC(this,Om,new Set),A5e(this,"disposables",tl()),XH(this,ts,t),Zo.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Mi(this,ts)}subscribe(t,r){if(Zo.isServer)return()=>{};let n={selector:t,callback:r,current:t(Mi(this,ts))};return Mi(this,Om).add(n),this.disposables.add(()=>{Mi(this,Om).delete(n)})}on(t,r){return Zo.isServer?()=>{}:(Mi(this,Lm).get(t).add(r),this.disposables.add(()=>{Mi(this,Lm).get(t).delete(r)}))}send(t){let r=this.reduce(Mi(this,ts),t);if(r!==Mi(this,ts)){XH(this,ts,r);for(let n of Mi(this,Om)){let a=n.selector(Mi(this,ts));KH(n.current,a)||(n.current=a,n.callback(a))}for(let n of Mi(this,Lm).get(t.type))n(Mi(this,ts),t)}}};ts=new WeakMap,Lm=new WeakMap,Om=new WeakMap;function KH(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:cC(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:cC(e.entries(),t.entries()):ZH(e)&&ZH(t)?cC(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function cC(e,t){do{let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}while(!0)}function ZH(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var k5e=Object.defineProperty,N5e=(e,t,r)=>t in e?k5e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QH=(e,t,r)=>(N5e(e,typeof t!="symbol"?t+"":t,r),r),I5e=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(I5e||{});let D5e={0(e,t){let r=t.id,n=e.stack,a=e.stack.indexOf(r);if(a!==-1){let i=e.stack.slice();return i.splice(a,1),i.push(r),n=i,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(n===-1)return e;let a=e.stack.slice();return a.splice(n,1),{...e,stack:a}}},M5e=class wxe extends C5e{constructor(){super(...arguments),QH(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),QH(this,"selectors",{isTop:(t,r)=>t.stack[t.stack.length-1]===r,inStack:(t,r)=>t.stack.includes(r)})}static new(){return new wxe({stack:[]})}reduce(t,r){return Qo(r.type,D5e,t,r)}};const JH=new WH(()=>M5e.new());var R1={exports:{}},dC={};/**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sciol/xyzen",
3
3
  "type": "module",
4
4
  "packageManager": "yarn@4.9.2",
5
- "version": "0.3.16",
5
+ "version": "0.3.17",
6
6
  "description": "A modern, lightweight, and extensible chat component for React.",
7
7
  "author": "Haohui <harveyque@outlook.com>",
8
8
  "license": "GPL-3.0-only",