@kafca/agentdock 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/renderer/assets/{Badge-Bg_nNvBL.js → Badge-CDTbmw1h.js} +1 -1
- package/dist/renderer/assets/Card-DayUo35w.js +1 -0
- package/dist/renderer/assets/Config-ByGMQuzR.js +21 -0
- package/dist/renderer/assets/CronList-XqHdVlgu.js +1 -0
- package/dist/renderer/assets/Dashboard-CZj-oANw.js +41 -0
- package/dist/renderer/assets/{EmptyState-C60g3RMj.js → EmptyState-EFMkOjZO.js} +1 -1
- package/dist/renderer/assets/HighlightedMarkdown-DyvF3DHK.js +12 -0
- package/dist/renderer/assets/Input-DxoWVc9d.js +1 -0
- package/dist/renderer/assets/{KnowledgeDetail-CC5C7JYe.js → KnowledgeDetail-CbUb2tG7.js} +2 -2
- package/dist/renderer/assets/{KnowledgeHome-3rlvxgWf.js → KnowledgeHome-BWV1gz4f.js} +3 -3
- package/dist/renderer/assets/Logs-DqnanQTc.js +6 -0
- package/dist/renderer/assets/{Modal-BQUW9LSf.js → Modal-yY7TzR0x.js} +3 -3
- package/dist/renderer/assets/MonitorList-CIjGQkFs.js +1 -0
- package/dist/renderer/assets/Page-vwHNUdoj.js +1 -0
- package/dist/renderer/assets/{Select-CfRkos3z.js → Select-CmbK36pN.js} +2 -2
- package/dist/renderer/assets/ThreadChat-4OceMgM4.js +86 -0
- package/dist/renderer/assets/Workspace-DplPJOjJ.js +19 -0
- package/dist/renderer/assets/{arrow-left-D1DbXrLA.js → arrow-left-C8HfBt2K.js} +1 -1
- package/dist/renderer/assets/{book-open-BxC1z1C1.js → book-open-BCdZWncQ.js} +1 -1
- package/dist/renderer/assets/channels-hgO3cAIx.js +6 -0
- package/dist/renderer/assets/chevron-down-BPk77tqY.js +11 -0
- package/dist/renderer/assets/index-BIKL3fTP.css +11 -0
- package/dist/renderer/assets/index-BlA4xPdd.js +41 -0
- package/dist/renderer/assets/index-wYpjqVqC.js +167 -0
- package/dist/renderer/assets/knowledge-7pl06KuH.js +1 -0
- package/dist/renderer/assets/{pencil-X44UaxwR.js → pencil-CB1SWZ9A.js} +1 -1
- package/dist/renderer/assets/{play-ujo-De38.js → play-BvsoXUrM.js} +1 -1
- package/dist/renderer/assets/{plus-BHgVdG_A.js → plus-CokBDnaL.js} +1 -1
- package/dist/renderer/assets/{save-Cz6giKrE.js → save-D-w4kATO.js} +1 -1
- package/dist/renderer/assets/{search-DKWvTqi5.js → search-Cnsn6i4Q.js} +1 -1
- package/dist/renderer/assets/{shield-check-V82O8AC1.js → shield-check-Cjja2Gh6.js} +1 -1
- package/dist/renderer/assets/threads-BCm6j4eI.js +1 -0
- package/dist/renderer/assets/{trash-2-_Fgwk8mc.js → trash-2-CIxz9qYY.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/packages/contracts/src/automation.js +2 -0
- package/dist-electron/packages/contracts/src/channels.js +2 -0
- package/dist-electron/packages/contracts/src/knowledge.js +2 -0
- package/dist-electron/packages/contracts/src/local-core.js +15 -0
- package/dist-electron/packages/contracts/src/runtime.js +2 -0
- package/dist-electron/packages/contracts/src/scheduler.js +2 -0
- package/dist-electron/packages/contracts/src/threads.js +2 -0
- package/dist-electron/packages/core-sdk/src/automation.js +32 -0
- package/dist-electron/packages/core-sdk/src/channels.js +121 -0
- package/dist-electron/packages/core-sdk/src/client.js +455 -0
- package/dist-electron/packages/core-sdk/src/index.js +43 -607
- package/dist-electron/packages/core-sdk/src/knowledge.js +85 -0
- package/dist-electron/packages/core-sdk/src/request.js +22 -0
- package/dist-electron/packages/core-sdk/src/runtime.js +214 -0
- package/dist-electron/packages/core-sdk/src/scheduler.js +32 -0
- package/dist-electron/packages/core-sdk/src/threads.js +67 -0
- package/dist-electron/packages/plugin-sdk/src/agents.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/automation.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/channels.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/index.js +21 -0
- package/dist-electron/packages/plugin-sdk/src/knowledge.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/runtime.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/scheduler.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/threads.js +2 -0
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +6 -9
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/agent-task-store.js +5 -5
- package/dist-electron/services/local-ai-core/src/acp/store/automation-monitor-store.js +12 -12
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/store/scheduler-store.js +11 -11
- package/dist-electron/services/local-ai-core/src/acp/store/security-store.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/thread-store.js +7 -7
- package/dist-electron/services/local-ai-core/src/acp/workspace-acp-permissions.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +4 -4
- package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/pi/provider-materializer.js +1 -1
- package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +4 -4
- package/dist-electron/services/local-ai-core/src/channel/lark/cards.js +33 -18
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/lark/gateway-utils.js +91 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound-handler.js +180 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +52 -456
- package/dist-electron/services/local-ai-core/src/channel/lark/outbound-transport.js +124 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/inbound-attachment-store.js +93 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/inbound-authorization.js +54 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-media.js +21 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +167 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +98 -483
- package/dist-electron/services/local-ai-core/src/channel/weixin/runtime-state.js +156 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/text-utils.js +100 -0
- package/dist-electron/services/local-ai-core/src/cli/lac.js +6 -6
- package/dist-electron/services/local-ai-core/src/cli/monitor-cli-parsers.js +2 -2
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +28 -70
- package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +33 -5
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-ai-vector-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-noop-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/router/workspace-bridge-event-stream.js +29 -0
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +5 -5
- package/dist-electron/services/local-ai-core/src/router/workspace-router.js +47 -60
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +5 -5
- package/dist-electron/services/local-ai-core/src/runtime/config-migration.js +6 -6
- package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +3 -3
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +3 -1
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +11 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +12 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +18 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +7 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +28 -3
- package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +18 -5
- package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +14 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +18 -15
- package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +13 -2
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +35 -8
- package/dist-electron/services/local-ai-core/src/runtime/request-validation.js +79 -0
- package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +9 -9
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +10 -1
- package/dist-electron/services/local-ai-core/src/runtime/server.js +2 -1
- package/dist-electron/services/local-ai-core/src/runtime/workspace-project-registry.js +76 -0
- package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +8 -8
- package/dist-electron/services/local-ai-core/src/thread/agent-message-policy.js +75 -0
- package/dist-electron/shared/desktop.js +1 -64
- package/dist-electron/src/components/chat/chat-controller-state.js +60 -0
- package/dist-electron/src/components/chat/chat-event-gate.js +146 -0
- package/dist-electron/src/components/chat/markdown-code-block.js +8 -0
- package/dist-electron/src/pages/Desktop/workspace-model.js +212 -0
- package/dist-electron/src/pages/Threads/thread-chat-model.js +50 -51
- package/dist-electron/tests/contracts/agent-message-policy.test.js +21 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +56 -33
- package/dist-electron/tests/contracts/chat-event-gate.test.js +114 -0
- package/dist-electron/tests/contracts/chat-markdown.test.js +16 -0
- package/dist-electron/tests/contracts/thread-task-state.test.js +32 -0
- package/dist-electron/tests/contracts/workspace-identity.test.js +23 -0
- package/dist-electron/tests/electron/core-client.test.js +284 -0
- package/dist-electron/tests/electron/plugin-kernel.test.js +54 -0
- package/dist-electron/tests/electron/renderer-packaging.test.js +9 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +31 -0
- package/dist-electron/tests/integration/channel-inbound-attachment-store.test.js +117 -0
- package/dist-electron/tests/integration/channel-inbound-authorization.test.js +80 -0
- package/dist-electron/tests/integration/lark-gateway-utils.test.js +13 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +58 -4
- package/dist-electron/tests/integration/local-core-errors.test.js +41 -0
- package/dist-electron/tests/integration/weixin-gateway.test.js +36 -0
- package/dist-electron/tests/integration/weixin-runtime-state.test.js +32 -0
- package/dist-electron/tests/integration/weixin-text-utils.test.js +15 -0
- package/package.json +9 -4
- package/dist/renderer/assets/Chat-BJveQQKu.js +0 -2
- package/dist/renderer/assets/ChatMarkdown-Bqn2HJ6f.js +0 -45
- package/dist/renderer/assets/Config-CMtZDRAE.js +0 -21
- package/dist/renderer/assets/CronList-C-ILB_Ae.js +0 -1
- package/dist/renderer/assets/Dashboard-CsKBSQIe.js +0 -26
- package/dist/renderer/assets/Logs-CktemGN0.js +0 -1
- package/dist/renderer/assets/MonitorList-B0hxjuOZ.js +0 -1
- package/dist/renderer/assets/Page-DL_Nv2i5.js +0 -1
- package/dist/renderer/assets/ProjectDetail-Djr9-MyT.js +0 -11
- package/dist/renderer/assets/ProjectList-BKl4eW7q.js +0 -1
- package/dist/renderer/assets/SessionChat-Dxv8D5DW.js +0 -1
- package/dist/renderer/assets/SessionList-BJ2GjXvR.js +0 -1
- package/dist/renderer/assets/ThreadChat-CAsIl9qf.js +0 -28
- package/dist/renderer/assets/Workspace-CaUhiGBX.js +0 -19
- package/dist/renderer/assets/bot-Fw3IzhJA.js +0 -6
- package/dist/renderer/assets/check-5zCTgp3A.js +0 -6
- package/dist/renderer/assets/chevron-down-N3PxTNxH.js +0 -6
- package/dist/renderer/assets/circle-C_chUflo.js +0 -6
- package/dist/renderer/assets/desktop-DkQTZNhe.js +0 -1
- package/dist/renderer/assets/desktop-JQkhNOF4.js +0 -5
- package/dist/renderer/assets/funnel-B8ZAv6I7.js +0 -6
- package/dist/renderer/assets/heart-M9A3E4Ed.js +0 -6
- package/dist/renderer/assets/index-Bwv855ID.js +0 -41
- package/dist/renderer/assets/index-CjCuR6DI.css +0 -11
- package/dist/renderer/assets/index-DJ8w4e0l.js +0 -182
- package/dist/renderer/assets/projects-DB1FLZ3A.js +0 -1
- package/dist/renderer/assets/server-BsuHcYl4.js +0 -11
- package/dist/renderer/assets/session-utils-DnAWL3eo.js +0 -6
- package/dist/renderer/assets/sessions-DptxO_BE.js +0 -1
- package/dist/renderer/assets/user-DQKTaUcR.js +0 -6
- package/dist/renderer/assets/wifi-off-vjH-MD2w.js +0 -11
- package/dist-electron/src/api/client.js +0 -73
- package/dist-electron/src/api/sessions.js +0 -21
- package/dist-electron/src/lib/session-utils.js +0 -51
- package/dist-electron/src/pages/Projects/project-provider-config.js +0 -75
- package/dist-electron/tests/electron/project-provider-config.test.js +0 -71
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,g as i}from"./index-wYpjqVqC.js";function t({label:s,className:o,...r}){return e.jsxs("div",{className:"space-y-1.5",children:[s&&e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s}),e.jsx("input",{className:i("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",o),...r})]})}function l({label:s,className:o,...r}){return e.jsxs("div",{className:"space-y-1.5",children:[s&&e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s}),e.jsx("textarea",{className:i("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",o),...r})]})}export{t as I,l as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as y,
|
|
1
|
+
import{c as y,Y as q,r as t,j as e,L as C,B as p,S as H,g as P,E as _}from"./index-wYpjqVqC.js";import{C as x}from"./Card-DayUo35w.js";import{I as U}from"./Input-DxoWVc9d.js";import{E as F}from"./EmptyState-EFMkOjZO.js";import{g as E,h as O,a as V,i as Z,j as G,k as Q,s as Y}from"./knowledge-7pl06KuH.js";import{A as J}from"./arrow-left-C8HfBt2K.js";import{S as W}from"./search-Cnsn6i4Q.js";import{T as X}from"./trash-2-CIxz9qYY.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as y,E as R,r as t,aP as C,a$ as q,aQ as H,b0 as U,b1 as G,b2 as O,b3 a
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const re=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],K=y("upload",re);function B(a){return a==="success"?"border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/30 dark:bg-violet-950/20 dark:text-violet-300":a==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function
|
|
16
|
+
*/const re=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],K=y("upload",re);function B(a){return a==="success"?"border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/30 dark:bg-violet-950/20 dark:text-violet-300":a==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ge(){const{knowledgebaseId:a=""}=q(),[f,u]=t.useState(!0),[j,b]=t.useState(!1),[I,k]=t.useState(!1),[m,M]=t.useState(!1),[r,A]=t.useState(null),[N,z]=t.useState([]),[g,D]=t.useState([]),[w,v]=t.useState([]),[n,T]=t.useState(""),[h,c]=t.useState(null),o=t.useCallback(async()=>{if(a){u(!0);try{const[s,d,l,R]=await Promise.all([E(),O(a),V(),Z(a).catch(()=>({files:[]}))]);M(!!s.baseUrl),A(d),z(l.folders||[]),D(R.files||[])}catch(s){c({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{u(!1)}}},[a]);t.useEffect(()=>{o()},[o]);const i=t.useMemo(()=>N.find(s=>s.id===(r==null?void 0:r.folderId))||null,[r==null?void 0:r.folderId,N]),$=t.useCallback(async s=>{const d=Array.from(s.target.files||[]);if(!(!a||d.length===0)){b(!0);try{const l=await E();await G(a,{files:d,collection:l.defaultCollection,folder:i==null?void 0:i.path}),c({tone:"success",message:"Files uploaded and indexed."}),await o(),s.target.value=""}catch(l){c({tone:"error",message:l instanceof Error?l.message:String(l)})}finally{b(!1)}}},[i==null?void 0:i.path,a,o]),L=t.useCallback(async s=>{if(!(!a||!window.confirm(`Delete file "${s.fileName}"?`)))try{await Q(a,s.fileId),c({tone:"success",message:"File deleted."}),await o()}catch(d){c({tone:"error",message:d instanceof Error?d.message:String(d)})}},[a,o]),S=t.useCallback(async()=>{if(!a||!n.trim()){v([]);return}k(!0);try{const s=await Y(a,{query:n.trim(),limit:8});v(s.results||[])}catch(s){c({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{k(!1)}},[a,n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(C,{to:"/knowledge",children:e.jsxs(p,{variant:"secondary",children:[e.jsx(J,{size:14})," 返回知识库"]})}),r&&e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[e.jsx("span",{className:"text-gray-900 dark:text-white",children:r.name}),i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"/"}),e.jsx("span",{children:i.path})]}):null]})]}),h&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${B(h.tone)}`,children:h.message}),!m&&!f&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${B("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge retrieval is not configured."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector connection in System settings to upload files and search this knowledge base."})]}),e.jsx(C,{to:"/system",children:e.jsxs(p,{variant:"secondary",children:[e.jsx(H,{size:14})," Open System Settings"]})})]})}),f?e.jsx(x,{children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库详情…"})}):r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:r.name}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400",children:r.description||"上传文档后,这个知识库会变成你当前项目的专属 RAG 索引。"})]}),e.jsxs("label",{className:P("inline-flex cursor-pointer items-center gap-2 rounded-xl px-4 py-2 text-sm font-medium",m?"bg-accent text-white hover:bg-accent-dim":"bg-gray-200 text-gray-500 dark:bg-white/[0.08] dark:text-gray-500"),children:[e.jsx(K,{size:14}),j?"上传中…":"上传文件",e.jsx("input",{type:"file",multiple:!0,className:"hidden",disabled:!m||j,onChange:s=>void $(s)})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"文档数"}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-gray-900 dark:text-white",children:g.length})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"字符统计"}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-gray-900 dark:text-white",children:g.reduce((s,d)=>s+Number(d.wordCount||0),0)})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400",children:"最近更新"}),e.jsx("p",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-white",children:_(r.updatedAt)})]})]})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"内容搜索"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"在当前知识库内检索已解析内容,快速确认切块与召回效果。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(W,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(U,{value:n,onChange:s=>T(s.target.value),placeholder:"例如:升级流程、性能测试结论",className:"pl-9",onKeyDown:s=>{s.key==="Enter"&&S()}})]}),e.jsxs(p,{onClick:()=>void S(),disabled:!m||!n.trim(),loading:I,children:[e.jsx(se,{size:14})," 搜索"]})]}),w.length===0?e.jsx("div",{className:"rounded-2xl border border-dashed border-gray-200/80 px-4 py-8 text-center text-sm text-gray-400 dark:border-white/[0.08]",children:n?"还没有搜索结果。":"输入关键词后可以查看召回片段。"}):e.jsx("div",{className:"space-y-3",children:w.map(s=>e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 px-4 py-4 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s.title}),e.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["chunk #",s.chunkOffset," · score ",s.score.toFixed(4)]})]}),e.jsx("span",{className:"rounded-full bg-gray-100 px-2.5 py-1 text-xs text-gray-500 dark:bg-white/[0.06] dark:text-gray-400",children:s.fileName})]}),e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm leading-7 text-gray-600 dark:text-gray-300",children:s.snippet})]},s.id))})]})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"文件列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"当前知识库内已完成解析并入库的文件。"})]})}),g.length===0?e.jsx(F,{message:"还没有文件,上传文档后会出现在这里。",icon:K}):e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-200/80 dark:border-white/[0.08]",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_120px_120px_160px_60px] gap-3 border-b border-gray-200/80 bg-gray-50/80 px-4 py-3 text-xs font-medium uppercase tracking-wide text-gray-500 dark:border-white/[0.08] dark:bg-white/[0.03]",children:[e.jsx("span",{children:"文件"}),e.jsx("span",{children:"类型"}),e.jsx("span",{children:"字符数"}),e.jsx("span",{children:"创建时间"}),e.jsx("span",{})]}),g.map(s=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_120px_120px_160px_60px] gap-3 border-b border-gray-200/70 px-4 py-3 text-sm last:border-b-0 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-medium text-gray-900 dark:text-white",children:s.fileName}),e.jsx("p",{className:"mt-1 truncate text-xs text-gray-400",children:s.fileId})]}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:s.fileType}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:s.wordCount||0}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:_(s.createTime)}),e.jsx("button",{type:"button",onClick:()=>void L(s),className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${s.fileName}`,children:e.jsx(X,{size:15})})]},s.fileId))]})]})]}):e.jsx(x,{children:e.jsx(F,{message:"没有找到这个知识库。",icon:te})})]})}export{ge as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as T,r as t,j as e,L as D,B as d,S as se,g as I,C as ae,Q as te,E as re}from"./index-wYpjqVqC.js";import{C as x}from"./Card-DayUo35w.js";import{M as L}from"./Modal-yY7TzR0x.js";import{I as C,T as ne}from"./Input-DxoWVc9d.js";import{E as R}from"./EmptyState-EFMkOjZO.js";import{g as ie,a as le,l as oe,c as de,b as ce,u as me,d as xe,e as ge,f as pe}from"./knowledge-7pl06KuH.js";import{P}from"./pencil-CB1SWZ9A.js";import{T as O}from"./trash-2-CIxz9qYY.js";import{S as he}from"./search-Cnsn6i4Q.js";import{P as ue}from"./plus-CokBDnaL.js";import{B as fe}from"./book-open-BCdZWncQ.js";import"./index-BlA4xPdd.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const ye=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],je=T("folder-plus",ye);/**
|
|
7
7
|
* @license lucide-react v0.487.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const be=[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]],S=_("folders",be);function T(o){return o==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":o==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ve(o){switch(o){case"file":return"bg-blue-500";case"spark":return"bg-amber-500";case"screen":return"bg-fuchsia-500";default:return"bg-indigo-500"}}function we(o){return o.split("/").length-1}function Me(){const[o,F]=t.useState(!0),[m,q]=t.useState([]),[j,A]=t.useState([]),[l,b]=t.useState(null),[g,U]=t.useState(""),[H,V]=t.useState(!1),[G,p]=t.useState(!1),[Q,h]=t.useState(!1),[u,B]=t.useState(""),[y,K]=t.useState(""),[v,z]=t.useState(""),[w,r]=t.useState(null),[E,f]=t.useState(null),n=t.useCallback(async()=>{F(!0);try{const[a,s,i]=await Promise.all([ae(),se(),te()]);V(!!a.baseUrl),q(s.folders||[]),A(i.bases||[])}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}finally{F(!1)}},[]);t.useEffect(()=>{n()},[n]);const N=t.useMemo(()=>{if(!l)return null;const a=m.find(i=>i.id===l);if(!a)return null;const s=new Set([a.id]);return m.forEach(i=>{i.path.startsWith(`${a.path}/`)&&s.add(i.id)}),s},[m,l]),M=t.useMemo(()=>{const a=g.trim().toLowerCase();return j.filter(s=>(N?N.has(s.folderId||""):!0)?a?[s.name,s.description,s.creatorName].join(" ").toLowerCase().includes(a):!0:!1)},[j,N,g]),W=t.useCallback(async()=>{if(!u.trim()){r({tone:"warning",message:"Folder name is required."});return}f("folder");try{await re({name:u.trim(),parentId:l}),B(""),p(!1),r({tone:"success",message:"Folder created."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}finally{f(null)}},[u,n,l]),Z=t.useCallback(async()=>{if(!y.trim()){r({tone:"warning",message:"Knowledge base name is required."});return}f("base");try{await ne({name:y.trim(),description:v.trim(),folderId:l}),K(""),z(""),h(!1),r({tone:"success",message:"Knowledge base created."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}finally{f(null)}},[v,y,n,l]),X=t.useCallback(async a=>{var i;const s=(i=window.prompt("Rename folder",a.name))==null?void 0:i.trim();if(!(!s||s===a.name))try{await ie(a.id,{name:s}),r({tone:"success",message:"Folder updated."}),await n()}catch(c){r({tone:"error",message:c instanceof Error?c.message:String(c)})}},[n]),J=t.useCallback(async a=>{if(window.confirm(`Delete folder "${a.name}"?`))try{await le(a.id),l===a.id&&b(null),r({tone:"success",message:"Folder deleted."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}},[n,l]),Y=t.useCallback(async a=>{var c,$;const s=(c=window.prompt("Knowledge base name",a.name))==null?void 0:c.trim();if(!s)return;const i=(($=window.prompt("Description",a.description))==null?void 0:$.trim())??a.description;try{await oe(a.id,{name:s,description:i}),r({tone:"success",message:"Knowledge base updated."}),await n()}catch(k){r({tone:"error",message:k instanceof Error?k.message:String(k)})}},[n]),ee=t.useCallback(async a=>{if(window.confirm(`Delete knowledge base "${a.name}"?`))try{await de(a.id),r({tone:"success",message:"Knowledge base deleted."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}},[n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[w&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${T(w.tone)}`,children:w.message}),!H&&!o&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${T("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge search is not configured yet."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector base URL in System settings before uploading files or running retrieval."})]}),e.jsx(D,{to:"/system",children:e.jsxs(d,{variant:"secondary",children:[e.jsx(ce,{size:14})," Open System Settings"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[300px_minmax(0,1fr)]",children:[e.jsxs(x,{className:"app-panel p-0 overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"创建目录并管理知识库分类。"})]}),e.jsxs(d,{size:"sm",variant:"secondary",onClick:()=>p(!0),children:[e.jsx(je,{size:14})," 文件夹"]})]})}),e.jsx("div",{className:"px-5 py-4",children:e.jsxs("button",{type:"button",onClick:()=>b(null),className:I("flex w-full items-center justify-between rounded-[16px] px-3 py-2.5 text-left text-sm transition-colors",l?"hover:bg-gray-100/80 text-gray-600 dark:text-gray-300 dark:hover:bg-white/[0.06]":"bg-primary/10 text-gray-900 ring-1 ring-primary/25 dark:text-white"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16}),"全部知识库"]}),e.jsx("span",{className:"text-xs opacity-70",children:j.length})]})}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-3 pb-4",children:m.length===0?e.jsx(R,{message:"还没有目录,先创建一个文件夹吧。",icon:S}):e.jsx("div",{className:"space-y-1",children:m.map(a=>{const s=a.id===l;return e.jsx("div",{className:I("group rounded-[16px] px-2 py-1",s?"bg-primary/10 ring-1 ring-primary/25":"hover:bg-gray-100/80 dark:hover:bg-white/[0.04]"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(a.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2 py-2 text-left",style:{paddingLeft:`${8+we(a.path)*18}px`},children:[e.jsx(me,{size:14,className:"text-gray-400"}),e.jsx(S,{size:15,className:"text-amber-500"}),e.jsx("span",{className:"truncate text-sm text-gray-800 dark:text-gray-100",children:a.name})]}),e.jsx("button",{type:"button",onClick:()=>void X(a),className:"rounded-md p-1 text-gray-400 transition hover:bg-gray-200/70 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white","aria-label":`Rename ${a.name}`,children:e.jsx(P,{size:14})}),e.jsx("button",{type:"button",onClick:()=>void J(a),className:"rounded-md p-1 text-gray-400 transition hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${a.name}`,children:e.jsx(O,{size:14})})]})},a.id)})})})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(x,{className:"app-toolbar",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"目录筛选、本地搜索,以及知识库卡片概览都在这里。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative min-w-[260px]",children:[e.jsx(he,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(C,{value:g,onChange:a=>U(a.target.value),placeholder:"搜索名称、描述或创建者","aria-label":"搜索名称、描述或创建者",className:"pl-9"})]}),e.jsxs(d,{variant:"secondary",onClick:()=>h(!0),children:[e.jsx(ue,{size:14})," 创建知识库"]})]})]})}),o?e.jsx(x,{className:"app-panel",children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库…"})}):M.length===0?e.jsx(x,{className:"app-panel",children:e.jsx(R,{message:g?"没有匹配的知识库。":"还没有知识库,先创建一个开始上传文档。",icon:xe})}):e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 2xl:grid-cols-3",children:M.map(a=>e.jsxs(x,{className:"group app-panel relative overflow-hidden p-5 hover:border-primary/25",children:[e.jsxs("div",{className:"absolute right-4 top-4 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void Y(a),"aria-label":`编辑 ${a.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-gray-100/90 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white",children:e.jsx(P,{size:15})}),e.jsx("button",{type:"button",onClick:()=>void ee(a),"aria-label":`删除 ${a.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500",children:e.jsx(O,{size:15})})]}),e.jsxs(D,{to:`/knowledge/${encodeURIComponent(a.id)}`,className:"block space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`mt-1 flex h-11 w-11 items-center justify-center rounded-full text-white ${ve(a.icon)}`,children:e.jsx(ye,{size:22})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate pr-8 text-xl font-semibold text-gray-900 dark:text-white",children:a.name}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["创建者: ",a.creatorName||"系统管理员"]})]})]}),e.jsx("div",{className:"min-h-[60px] text-sm leading-6 text-gray-600 dark:text-gray-300",children:a.description||"这个知识库还没有描述,点击进入后可以上传文件并开始检索。"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm font-medium text-gray-700 dark:bg-white/[0.05] dark:text-gray-200",children:[e.jsxs("span",{children:[a.fileCount," 文档数"]}),e.jsxs("span",{children:[(a.wordCount/1e3).toFixed(a.wordCount>0?1:0),"k 字符"]})]}),e.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:["更新于 ",ge(a.updatedAt)]})]})]},a.id))})]})]}),e.jsx(L,{open:G,onClose:()=>p(!1),title:"创建文件夹",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"文件夹名称",value:u,onChange:a=>B(a.target.value),placeholder:"例如:产品文档"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>p(!1),children:"取消"}),e.jsx(d,{onClick:()=>void W(),loading:E==="folder",children:"创建"})]})]})}),e.jsx(L,{open:Q,onClose:()=>h(!1),title:"创建知识库",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"名称",value:y,onChange:a=>K(a.target.value),placeholder:"例如:运营文档库"}),e.jsx(pe,{label:"描述",rows:4,value:v,onChange:a=>z(a.target.value),placeholder:"一句话说明这个知识库主要收录什么内容"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>h(!1),children:"取消"}),e.jsx(d,{onClick:()=>void Z(),loading:E==="base",children:"创建"})]})]})})]})}export{Me as default};
|
|
11
|
+
*/const be=[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]],S=T("folders",be);function _(o){return o==="success"?"border-primary/20 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/10 dark:text-blue-200":o==="warning"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300":"border-red-200 bg-red-50 text-red-700 dark:border-red-900/30 dark:bg-red-950/20 dark:text-red-300"}function ve(o){switch(o){case"file":return"bg-blue-500";case"spark":return"bg-amber-500";case"screen":return"bg-fuchsia-500";default:return"bg-indigo-500"}}function we(o){return o.split("/").length-1}function Ie(){const[o,F]=t.useState(!0),[m,q]=t.useState([]),[j,A]=t.useState([]),[l,b]=t.useState(null),[g,H]=t.useState(""),[U,Q]=t.useState(!1),[V,p]=t.useState(!1),[Z,h]=t.useState(!1),[u,B]=t.useState(""),[f,K]=t.useState(""),[v,E]=t.useState(""),[w,r]=t.useState(null),[z,y]=t.useState(null),n=t.useCallback(async()=>{F(!0);try{const[s,a,i]=await Promise.all([ie(),le(),oe()]);Q(!!s.baseUrl),q(a.folders||[]),A(i.bases||[])}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{F(!1)}},[]);t.useEffect(()=>{n()},[n]);const N=t.useMemo(()=>{if(!l)return null;const s=m.find(i=>i.id===l);if(!s)return null;const a=new Set([s.id]);return m.forEach(i=>{i.path.startsWith(`${s.path}/`)&&a.add(i.id)}),a},[m,l]),M=t.useMemo(()=>{const s=g.trim().toLowerCase();return j.filter(a=>(N?N.has(a.folderId||""):!0)?s?[a.name,a.description,a.creatorName].join(" ").toLowerCase().includes(s):!0:!1)},[j,N,g]),G=t.useCallback(async()=>{if(!u.trim()){r({tone:"warning",message:"Folder name is required."});return}y("folder");try{await de({name:u.trim(),parentId:l}),B(""),p(!1),r({tone:"success",message:"Folder created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[u,n,l]),W=t.useCallback(async()=>{if(!f.trim()){r({tone:"warning",message:"Knowledge base name is required."});return}y("base");try{await ce({name:f.trim(),description:v.trim(),folderId:l}),K(""),E(""),h(!1),r({tone:"success",message:"Knowledge base created."}),await n()}catch(s){r({tone:"error",message:s instanceof Error?s.message:String(s)})}finally{y(null)}},[v,f,n,l]),J=t.useCallback(async s=>{var i;const a=(i=window.prompt("Rename folder",s.name))==null?void 0:i.trim();if(!(!a||a===s.name))try{await me(s.id,{name:a}),r({tone:"success",message:"Folder updated."}),await n()}catch(c){r({tone:"error",message:c instanceof Error?c.message:String(c)})}},[n]),X=t.useCallback(async s=>{if(window.confirm(`Delete folder "${s.name}"?`))try{await xe(s.id),l===s.id&&b(null),r({tone:"success",message:"Folder deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n,l]),Y=t.useCallback(async s=>{var c,$;const a=(c=window.prompt("Knowledge base name",s.name))==null?void 0:c.trim();if(!a)return;const i=(($=window.prompt("Description",s.description))==null?void 0:$.trim())??s.description;try{await ge(s.id,{name:a,description:i}),r({tone:"success",message:"Knowledge base updated."}),await n()}catch(k){r({tone:"error",message:k instanceof Error?k.message:String(k)})}},[n]),ee=t.useCallback(async s=>{if(window.confirm(`Delete knowledge base "${s.name}"?`))try{await pe(s.id),r({tone:"success",message:"Knowledge base deleted."}),await n()}catch(a){r({tone:"error",message:a instanceof Error?a.message:String(a)})}},[n]);return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[w&&e.jsx("div",{className:`rounded-xl border px-4 py-3 text-sm ${_(w.tone)}`,children:w.message}),!U&&!o&&e.jsx("div",{className:`rounded-2xl border px-5 py-4 ${_("warning")}`,children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Knowledge search is not configured yet."}),e.jsx("p",{className:"mt-1 text-sm opacity-90",children:"Add the ai_vector base URL in System settings before uploading files or running retrieval."})]}),e.jsx(D,{to:"/system",children:e.jsxs(d,{variant:"secondary",children:[e.jsx(se,{size:14})," Open System Settings"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[300px_minmax(0,1fr)]",children:[e.jsxs(x,{className:"app-panel p-0 overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"创建目录并管理知识库分类。"})]}),e.jsxs(d,{size:"sm",variant:"secondary",onClick:()=>p(!0),children:[e.jsx(je,{size:14})," 文件夹"]})]})}),e.jsx("div",{className:"px-5 py-4",children:e.jsxs("button",{type:"button",onClick:()=>b(null),className:I("flex w-full items-center justify-between rounded-[16px] px-3 py-2.5 text-left text-sm transition-colors",l?"hover:bg-gray-100/80 text-gray-600 dark:text-gray-300 dark:hover:bg-white/[0.06]":"bg-primary/10 text-gray-900 ring-1 ring-primary/25 dark:text-white"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16}),"全部知识库"]}),e.jsx("span",{className:"text-xs opacity-70",children:j.length})]})}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-3 pb-4",children:m.length===0?e.jsx(R,{message:"还没有目录,先创建一个文件夹吧。",icon:S}):e.jsx("div",{className:"space-y-1",children:m.map(s=>{const a=s.id===l;return e.jsx("div",{className:I("group rounded-[16px] px-2 py-1",a?"bg-primary/10 ring-1 ring-primary/25":"hover:bg-gray-100/80 dark:hover:bg-white/[0.04]"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(s.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2 py-2 text-left",style:{paddingLeft:`${8+we(s.path)*18}px`},children:[e.jsx(ae,{size:14,className:"text-gray-400"}),e.jsx(S,{size:15,className:"text-amber-500"}),e.jsx("span",{className:"truncate text-sm text-gray-800 dark:text-gray-100",children:s.name})]}),e.jsx("button",{type:"button",onClick:()=>void J(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-gray-200/70 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white","aria-label":`Rename ${s.name}`,children:e.jsx(P,{size:14})}),e.jsx("button",{type:"button",onClick:()=>void X(s),className:"rounded-md p-1 text-gray-400 transition hover:bg-red-500/10 hover:text-red-500","aria-label":`Delete ${s.name}`,children:e.jsx(O,{size:14})})]})},s.id)})})})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(x,{className:"app-toolbar",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"知识库列表"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"目录筛选、本地搜索,以及知识库卡片概览都在这里。"})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative min-w-[260px]",children:[e.jsx(he,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(C,{value:g,onChange:s=>H(s.target.value),placeholder:"搜索名称、描述或创建者","aria-label":"搜索名称、描述或创建者",className:"pl-9"})]}),e.jsxs(d,{variant:"secondary",onClick:()=>h(!0),children:[e.jsx(ue,{size:14})," 创建知识库"]})]})]})}),o?e.jsx(x,{className:"app-panel",children:e.jsx("div",{className:"py-16 text-center text-sm text-gray-400",children:"正在加载知识库…"})}):M.length===0?e.jsx(x,{className:"app-panel",children:e.jsx(R,{message:g?"没有匹配的知识库。":"还没有知识库,先创建一个开始上传文档。",icon:te})}):e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 2xl:grid-cols-3",children:M.map(s=>e.jsxs(x,{className:"group app-panel relative overflow-hidden p-5 hover:border-primary/25",children:[e.jsxs("div",{className:"absolute right-4 top-4 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void Y(s),"aria-label":`编辑 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-gray-100/90 hover:text-gray-700 dark:hover:bg-white/[0.08] dark:hover:text-white",children:e.jsx(P,{size:15})}),e.jsx("button",{type:"button",onClick:()=>void ee(s),"aria-label":`删除 ${s.name}`,className:"rounded-lg p-2 text-gray-400 hover:bg-red-500/10 hover:text-red-500",children:e.jsx(O,{size:15})})]}),e.jsxs(D,{to:`/knowledge/${encodeURIComponent(s.id)}`,className:"block space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`mt-1 flex h-11 w-11 items-center justify-center rounded-full text-white ${ve(s.icon)}`,children:e.jsx(fe,{size:22})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate pr-8 text-xl font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["创建者: ",s.creatorName||"系统管理员"]})]})]}),e.jsx("div",{className:"min-h-[60px] text-sm leading-6 text-gray-600 dark:text-gray-300",children:s.description||"这个知识库还没有描述,点击进入后可以上传文件并开始检索。"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm font-medium text-gray-700 dark:bg-white/[0.05] dark:text-gray-200",children:[e.jsxs("span",{children:[s.fileCount," 文档数"]}),e.jsxs("span",{children:[(s.wordCount/1e3).toFixed(s.wordCount>0?1:0),"k 字符"]})]}),e.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:["更新于 ",re(s.updatedAt)]})]})]},s.id))})]})]}),e.jsx(L,{open:V,onClose:()=>p(!1),title:"创建文件夹",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"文件夹名称",value:u,onChange:s=>B(s.target.value),placeholder:"例如:产品文档"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>p(!1),children:"取消"}),e.jsx(d,{onClick:()=>void G(),loading:z==="folder",children:"创建"})]})]})}),e.jsx(L,{open:Z,onClose:()=>h(!1),title:"创建知识库",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(C,{label:"名称",value:f,onChange:s=>K(s.target.value),placeholder:"例如:运营文档库"}),e.jsx(ne,{label:"描述",rows:4,value:v,onChange:s=>E(s.target.value),placeholder:"一句话说明这个知识库主要收录什么内容"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>h(!1),children:"取消"}),e.jsx(d,{onClick:()=>void W(),loading:z==="base",children:"创建"})]})]})})]})}export{Ie as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as b,u as N,r as t,O as L,j as e,L as S,B as m}from"./index-wYpjqVqC.js";import{C}from"./Card-DayUo35w.js";import{B as E}from"./Badge-CDTbmw1h.js";import{I as k}from"./Input-DxoWVc9d.js";import{S as f}from"./Select-CmbK36pN.js";import{P as z}from"./Page-vwHNUdoj.js";import{A}from"./arrow-left-C8HfBt2K.js";import{S as I}from"./search-Cnsn6i4Q.js";import"./index-BlA4xPdd.js";import"./chevron-down-BPk77tqY.js";/**
|
|
2
|
+
* @license lucide-react v0.487.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const B=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],_=b("funnel",B),R={sys:"text-gray-300",debug:"text-gray-400",info:"text-blue-400",warn:"text-amber-400",error:"text-red-400"},q={sys:"default",debug:"default",info:"info",warn:"warning",error:"danger"};function G(){const{t:o}=N(),[n,h]=t.useState([]),[l,v]=t.useState("sys"),[i,g]=t.useState("100"),[c,j]=t.useState(""),[d,w]=t.useState(!1),[y,u]=t.useState(!0),a=t.useCallback(async()=>{u(!0);try{const s=await L(l,Number(i));h(s.entries||[])}finally{u(!1)}},[l,i]);t.useEffect(()=>{a()},[a]),t.useEffect(()=>{if(!d)return;const s=window.setInterval(()=>{a()},3e3);return()=>window.clearInterval(s)},[d,a]);const x=t.useMemo(()=>{const s=c.trim().toLowerCase();return s?n.filter(r=>[r.level,r.time,r.message].join(" ").toLowerCase().includes(s)):n},[n,c]);return e.jsxs("div",{className:"space-y-4 animate-fade-in",children:[e.jsx(z,{title:o("system.logs"),description:"Filtered runtime logs for troubleshooting.",actions:e.jsx(S,{to:"/system",children:e.jsxs(m,{variant:"secondary",size:"sm",children:[e.jsx(A,{size:14})," ",o("nav.system")]})})}),e.jsxs("div",{className:"app-toolbar flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{size:14,className:"text-muted-foreground"}),e.jsxs(f,{value:l,onChange:s=>v(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"sys",children:"Sys"}),e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]})]}),e.jsxs(f,{value:i,onChange:s=>g(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"500",children:"500"}),e.jsx("option",{value:"1000",children:"1000"})]}),e.jsx(m,{size:"sm",variant:"secondary",onClick:a,children:o("common.refresh")}),e.jsx(m,{size:"sm",variant:d?"primary":"secondary",onClick:()=>w(s=>!s),children:"Auto"}),e.jsxs("div",{className:"relative min-w-[16rem] flex-1",children:[e.jsx(I,{size:15,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{value:c,onChange:s=>j(s.target.value),placeholder:"Search logs","aria-label":"Search logs",className:"pl-9"})]})]}),e.jsx(C,{className:"app-panel",children:y?e.jsx("div",{className:"text-muted-foreground animate-pulse text-sm",children:"Loading..."}):x.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o("common.noData")}):e.jsx("div",{className:"max-h-[65vh] overflow-auto font-mono text-xs [scrollbar-gutter:stable]",children:x.map((s,r)=>{var p;return e.jsxs("div",{className:"grid min-w-[760px] grid-cols-[9rem_5rem_minmax(0,1fr)] items-start gap-3 border-b py-2 last:border-0",children:[e.jsx("span",{className:"text-muted-foreground shrink-0 w-36",children:(p=s.time)==null?void 0:p.slice(0,19)}),e.jsx(E,{variant:q[s.level]||"default",children:s.level}),e.jsx("span",{className:`${R[s.level]||"text-gray-500"} whitespace-pre-wrap break-words`,children:s.message})]},r)})})})]})}export{G as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{c as K,r as s,
|
|
1
|
+
import{c as K,r as s,P as C,j as i,g as M}from"./index-wYpjqVqC.js";import{u as I,d as X,e as O,g as Y,P as x,f as N,R as Z,h as J,c as Q,a as ee,i as te,F as ne,D as oe,j as re}from"./index-BlA4xPdd.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ae=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ie=K("x",ae);function se(e,t){return s.useReducer((o,n)=>t[o][n]??o,e)}var y=e=>{const{present:t,children:o}=e,n=ce(t),r=typeof o=="function"?o({present:n.isPresent}):s.Children.only(o),a=C(n.ref,le(r));return typeof o=="function"||n.isPresent?s.cloneElement(r,{ref:a}):null};y.displayName="Presence";function ce(e){const[t,o]=s.useState(),n=s.useRef(null),r=s.useRef(e),a=s.useRef("none"),c=e?"mounted":"unmounted",[u,d]=se(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const l=h(n.current);a.current=u==="mounted"?l:"none"},[u]),I(()=>{const l=n.current,g=r.current;if(g!==e){const D=a.current,p=h(l);e?d("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(g&&D!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,d]),I(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const H=h(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&H&&(d("ANIMATION_END"),!r.current)){const q=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=q)})}},D=p=>{p.target===t&&(a.current=h(n.current))};return t.addEventListener("animationstart",D),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",D),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(l=>{n.current=l?getComputedStyle(l):null,o(l)},[])}}function h(e){return(e==null?void 0:e.animationName)||"none"}function le(e){var n,r;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var E="Dialog",[T]=Q(E),[ue,f]=T(E),b=e=>{const{__scopeDialog:t,children:o,open:n,defaultOpen:r,onOpenChange:a,modal:c=!0}=e,u=s.useRef(null),d=s.useRef(null),[l,g]=X({prop:n,defaultProp:r??!1,onChange:a,caller:E});return i.jsx(ue,{scope:t,triggerRef:u,contentRef:d,contentId:O(),titleId:O(),descriptionId:O(),open:l,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(m=>!m),[g]),modal:c,children:o})};b.displayName=E;var j="DialogTrigger",de=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(j,o),a=C(t,r.triggerRef);return i.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":
|
|
6
|
+
*/const ae=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ie=K("x",ae);function se(e,t){return s.useReducer((o,n)=>t[o][n]??o,e)}var y=e=>{const{present:t,children:o}=e,n=ce(t),r=typeof o=="function"?o({present:n.isPresent}):s.Children.only(o),a=C(n.ref,le(r));return typeof o=="function"||n.isPresent?s.cloneElement(r,{ref:a}):null};y.displayName="Presence";function ce(e){const[t,o]=s.useState(),n=s.useRef(null),r=s.useRef(e),a=s.useRef("none"),c=e?"mounted":"unmounted",[u,d]=se(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const l=h(n.current);a.current=u==="mounted"?l:"none"},[u]),I(()=>{const l=n.current,g=r.current;if(g!==e){const D=a.current,p=h(l);e?d("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(g&&D!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,d]),I(()=>{if(t){let l;const g=t.ownerDocument.defaultView??window,m=p=>{const H=h(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&H&&(d("ANIMATION_END"),!r.current)){const q=t.style.animationFillMode;t.style.animationFillMode="forwards",l=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=q)})}},D=p=>{p.target===t&&(a.current=h(n.current))};return t.addEventListener("animationstart",D),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(l),t.removeEventListener("animationstart",D),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(l=>{n.current=l?getComputedStyle(l):null,o(l)},[])}}function h(e){return(e==null?void 0:e.animationName)||"none"}function le(e){var n,r;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var E="Dialog",[T]=Q(E),[ue,f]=T(E),b=e=>{const{__scopeDialog:t,children:o,open:n,defaultOpen:r,onOpenChange:a,modal:c=!0}=e,u=s.useRef(null),d=s.useRef(null),[l,g]=X({prop:n,defaultProp:r??!1,onChange:a,caller:E});return i.jsx(ue,{scope:t,triggerRef:u,contentRef:d,contentId:O(),titleId:O(),descriptionId:O(),open:l,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(m=>!m),[g]),modal:c,children:o})};b.displayName=E;var j="DialogTrigger",de=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(j,o),a=C(t,r.triggerRef);return i.jsx(x.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":P(r.open),...n,ref:a,onClick:N(e.onClick,r.onOpenToggle)})});de.displayName=j;var A="DialogPortal",[fe,w]=T(A,{forceMount:void 0}),S=e=>{const{__scopeDialog:t,forceMount:o,children:n,container:r}=e,a=f(A,t);return i.jsx(fe,{scope:t,forceMount:o,children:s.Children.map(n,c=>i.jsx(y,{present:o||a.open,children:i.jsx(Y,{asChild:!0,container:r,children:c})}))})};S.displayName=A;var R="DialogOverlay",F=s.forwardRef((e,t)=>{const o=w(R,e.__scopeDialog),{forceMount:n=o.forceMount,...r}=e,a=f(R,e.__scopeDialog);return a.modal?i.jsx(y,{present:n||a.open,children:i.jsx(me,{...r,ref:t})}):null});F.displayName=R;var ge=ee("DialogOverlay.RemoveScroll"),me=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(R,o);return i.jsx(Z,{as:ge,allowPinchZoom:!0,shards:[r.contentRef],children:i.jsx(x.div,{"data-state":P(r.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),v="DialogContent",W=s.forwardRef((e,t)=>{const o=w(v,e.__scopeDialog),{forceMount:n=o.forceMount,...r}=e,a=f(v,e.__scopeDialog);return i.jsx(y,{present:n||a.open,children:a.modal?i.jsx(pe,{...r,ref:t}):i.jsx(ve,{...r,ref:t})})});W.displayName=v;var pe=s.forwardRef((e,t)=>{const o=f(v,e.__scopeDialog),n=s.useRef(null),r=C(t,o.contentRef,n);return s.useEffect(()=>{const a=n.current;if(a)return J(a)},[]),i.jsx(L,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:N(e.onCloseAutoFocus,a=>{var c;a.preventDefault(),(c=o.triggerRef.current)==null||c.focus()}),onPointerDownOutside:N(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&a.preventDefault()}),onFocusOutside:N(e.onFocusOutside,a=>a.preventDefault())})}),ve=s.forwardRef((e,t)=>{const o=f(v,e.__scopeDialog),n=s.useRef(!1),r=s.useRef(!1);return i.jsx(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,a),a.defaultPrevented||(n.current||(u=o.triggerRef.current)==null||u.focus(),a.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:a=>{var d,l;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=a.target;((l=o.triggerRef.current)==null?void 0:l.contains(c))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),L=s.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:a,...c}=e,u=f(v,o),d=s.useRef(null),l=C(t,d);return te(),i.jsxs(i.Fragment,{children:[i.jsx(ne,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:a,children:i.jsx(oe,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":P(u.open),...c,ref:l,onDismiss:()=>u.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(xe,{titleId:u.titleId}),i.jsx(he,{contentRef:d,descriptionId:u.descriptionId})]})]})}),_="DialogTitle",k=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(_,o);return i.jsx(x.h2,{id:r.titleId,...n,ref:t})});k.displayName=_;var U="DialogDescription",Ne=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(U,o);return i.jsx(x.p,{id:r.descriptionId,...n,ref:t})});Ne.displayName=U;var G="DialogClose",$=s.forwardRef((e,t)=>{const{__scopeDialog:o,...n}=e,r=f(G,o);return i.jsx(x.button,{type:"button",...n,ref:t,onClick:N(e.onClick,()=>r.onOpenChange(!1))})});$.displayName=G;function P(e){return e?"open":"closed"}var z="DialogTitleWarning",[Me,B]=re(z,{contentName:v,titleName:_,docsSlug:"dialog"}),xe=({titleId:e})=>{const t=B(z),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
7
7
|
|
|
8
8
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
9
9
|
|
|
10
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},De="DialogDescriptionWarning",he=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${B(De).contentName}}.`;return s.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Re=b,Ce=S,ye=F,Ee=W,Oe=k,Ae=$;function Ie({open:e,onClose:t,title:o,children:n,className:r}){return i.jsx(Re,{open:e,onOpenChange:a=>{a||t()},children:i.jsxs(Ce,{children:[i.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-fade-in"}),i.jsxs(Ee,{className:
|
|
10
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},De="DialogDescriptionWarning",he=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${B(De).contentName}}.`;return s.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Re=b,Ce=S,ye=F,Ee=W,Oe=k,Ae=$;function Ie({open:e,onClose:t,title:o,children:n,className:r}){return i.jsx(Re,{open:e,onOpenChange:a=>{a||t()},children:i.jsxs(Ce,{children:[i.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-fade-in"}),i.jsxs(Ee,{className:M("fixed inset-x-4 top-1/2 z-50 grid max-h-[calc(100dvh-2rem)] max-w-lg -translate-y-1/2 gap-4 overflow-y-auto","rounded-lg border bg-popover p-5 text-popover-foreground shadow-lg outline-none sm:left-1/2 sm:right-auto sm:w-[calc(100%-2rem)] sm:-translate-x-1/2 sm:p-6",r),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Oe,{className:"text-lg font-semibold leading-none tracking-tight",children:o}),i.jsx(Ae,{className:M("rounded-sm p-1 opacity-70 transition-opacity hover:opacity-100","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"),"aria-label":"Close",children:i.jsx(ie,{size:18})})]}),n]})]})})}export{Ie as M,ie as X};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as R,z as x,u as q,r,j as s,s as D,B as u,G as B,E as F}from"./index-wYpjqVqC.js";import{l as L}from"./threads-BCm6j4eI.js";import{C as O}from"./Card-DayUo35w.js";import{B as g}from"./Badge-CDTbmw1h.js";import{M as U}from"./Modal-yY7TzR0x.js";import{I as f,T as W}from"./Input-DxoWVc9d.js";import{S as v}from"./Select-CmbK36pN.js";import{E as G}from"./EmptyState-EFMkOjZO.js";import{P as H}from"./Page-vwHNUdoj.js";import{P as V}from"./plus-CokBDnaL.js";import{P as Q}from"./play-BvsoXUrM.js";import{P as Z}from"./pencil-CB1SWZ9A.js";import{T as J}from"./trash-2-CIxz9qYY.js";import"./index-BlA4xPdd.js";import"./chevron-down-BPk77tqY.js";function K(t){const n=R({workspace_id:t});return x("GET",`/automation/monitors${n}`)}function X(t){return x("POST","/automation/monitors",t)}function Y(t,n){return x("PATCH",`/automation/monitors/${encodeURIComponent(t)}`,n)}function ee(t){return x("DELETE",`/automation/monitors/${encodeURIComponent(t)}`)}function te(t){return x("POST",`/automation/monitors/${encodeURIComponent(t)}/run`)}const b={workspaceId:"",title:"",sourceType:"stock.quote",symbol:"",condition:"abs_change_percent >= 3",promptTemplate:"",cooldownMinutes:"15",executionMode:"side-thread",enabled:!0};function k(t){const n=t.trim();if(n.includes("&&")||n.includes("||"))return{metric:"expression",operator:"==",value:!0,expression:n};const c=n.match(/^([a-zA-Z0-9_.-]+)\s*(>=|<=|==|!=|>|<)\s*(.+)$/);if(!c)return null;const l=String(c[3]||"").trim(),h=Number(l);return{metric:String(c[1]||"").trim(),operator:c[2],value:Number.isFinite(h)&&l!==""?h:l}}function T(t){return t.condition.expression?t.condition.expression:`${t.condition.metric} ${t.condition.operator} ${t.condition.value}`}function se(t){return t?{workspaceId:t.workspaceId,title:t.title,sourceType:"stock.quote",symbol:String(t.sourceConfig.symbol||""),condition:T(t),promptTemplate:t.promptTemplate,cooldownMinutes:String(Math.round(t.cooldownMs/6e4)),executionMode:t.executionMode,enabled:t.enabled}:b}function ae(t){const n=k(t.condition);if(!n)throw new Error("Invalid condition");return{workspaceId:t.workspaceId,title:t.title,sourceType:t.sourceType,sourceConfig:w[t.sourceType].buildConfig(t),condition:n,promptTemplate:t.promptTemplate,executionMode:t.executionMode,cooldownMs:Math.max(0,Number(t.cooldownMinutes||"0")*6e4),enabled:t.enabled}}const w={"stock.quote":{label:"Stock quote",buildConfig:t=>({symbol:t.symbol.toUpperCase()}),renderSummary:t=>String(t.sourceConfig.symbol||"")}};function je(){const{t}=q(),[n,c]=r.useState([]),[l,h]=r.useState([]),[S,C]=r.useState(!0),[N,p]=r.useState(!1),[E,M]=r.useState(!1),[j,y]=r.useState(null),[a,o]=r.useState(b),I=r.useMemo(()=>l.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),[l]),d=r.useCallback(async()=>{C(!0);try{const[e,i]=await Promise.all([K(),L().then(m=>m.workspaces)]);c(e.monitors||[]),h(i),o(m=>m.workspaceId||i.length===0?m:{...m,workspaceId:i[0].id})}finally{C(!1)}},[]);r.useEffect(()=>{d();const e=D(i=>{(i.type==="automation.monitor.updated"||i.type==="automation.monitor.run.updated")&&d()});return()=>e()},[d]);const P=()=>{var e;y(null),o({...b,workspaceId:((e=l[0])==null?void 0:e.id)||""}),p(!0)},A=e=>{y(e),o(se(e)),p(!0)},_=async()=>{if(!(!a.workspaceId||!a.title.trim()||!a.symbol.trim()||!a.promptTemplate.trim()||!k(a.condition))){M(!0);try{const e=ae(a);j?await Y(j.id,e):await X(e),p(!1),y(null),o(b),await d()}finally{M(!1)}}},z=async e=>{confirm(t("common.confirmDelete"))&&(await ee(e),await d())},$=async e=>{await te(e),await d()};return S&&n.length===0?s.jsx("div",{className:"flex h-64 items-center justify-center text-gray-400 animate-pulse",children:t("common.loading")}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsx(H,{title:t("monitors.title"),description:"Create event monitors that trigger agent analysis and stream results back to channels.",actions:s.jsxs(u,{onClick:P,children:[s.jsx(V,{size:16})," ",t("monitors.add")]})}),n.length===0?s.jsx(G,{message:t("monitors.noMonitors"),icon:B}):s.jsx("div",{className:"space-y-3",children:n.map(e=>s.jsx(O,{className:"app-panel",children:s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.title}),s.jsx(g,{variant:e.enabled?"success":"default",children:e.enabled?t("monitors.enabled"):"disabled"}),s.jsx(g,{variant:"default",children:e.sourceType}),s.jsx(g,{variant:"default",children:e.platform}),e.lastStatus&&s.jsx(g,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Subject:"})," ",w["stock.quote"].renderSummary(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Condition:"})," ",T(e)]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),s.jsxs("span",{children:[s.jsx("strong",{children:"Cooldown:"})," ",Math.round(e.cooldownMs/6e4),"m"]}),e.lastTriggeredAt&&s.jsxs("span",{children:[s.jsxs("strong",{children:[t("monitors.lastRun"),":"]})," ",F(e.lastTriggeredAt)]})]}),s.jsx("p",{className:"mt-3 line-clamp-3 rounded-[16px] bg-black/[0.035] px-3 py-2 text-sm leading-6 text-gray-700 dark:bg-white/[0.05] dark:text-gray-300",children:e.promptTemplate}),e.lastError&&s.jsx("p",{className:"mt-2 text-xs text-red-500",children:e.lastError})]}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(u,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>$(e.id),title:t("monitors.run"),"aria-label":t("monitors.run"),children:s.jsx(Q,{size:14})}),s.jsx(u,{variant:"secondary",size:"sm",className:"app-icon-button",onClick:()=>A(e),title:t("common.save"),"aria-label":t("common.save"),children:s.jsx(Z,{size:14})}),s.jsx(u,{variant:"danger",size:"sm",className:"app-icon-button",onClick:()=>z(e.id),title:t("common.delete"),"aria-label":t("common.delete"),children:s.jsx(J,{size:14})})]})]})},e.id))}),s.jsx(U,{open:N,title:t(j?"monitors.edit":"monitors.add"),onClose:()=>p(!1),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(v,{label:"Workspace",value:a.workspaceId,onChange:e=>o({...a,workspaceId:e.target.value}),children:I}),s.jsx(f,{label:t("monitors.monitorTitle"),value:a.title,onChange:e=>o({...a,title:e.target.value})}),s.jsx(v,{label:"Source",value:a.sourceType,onChange:e=>o({...a,sourceType:e.target.value}),children:Object.entries(w).map(([e,i])=>s.jsx("option",{value:e,children:i.label},e))}),a.sourceType==="stock.quote"&&s.jsx(f,{label:"Symbol",value:a.symbol,onChange:e=>o({...a,symbol:e.target.value}),placeholder:"AAPL"}),s.jsx(f,{label:t("monitors.condition"),value:a.condition,onChange:e=>o({...a,condition:e.target.value}),placeholder:"abs_change_percent >= 3"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:[["abs_change_percent >= 3","+/- 3%"],["price >= 500","Price >= 500"],["volume_ratio >= 2","Volume spike"]].map(([e,i])=>s.jsx("button",{type:"button",onClick:()=>o({...a,condition:e}),className:`app-segment text-xs ${a.condition===e?"app-segment-active":"app-segment-idle"}`,children:i},e))}),k(a.condition)?null:s.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-200",children:"Condition should look like metric >= value or a boolean expression."}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(f,{label:t("monitors.cooldown"),value:a.cooldownMinutes,onChange:e=>o({...a,cooldownMinutes:e.target.value})}),s.jsxs(v,{label:"Execution",value:a.executionMode,onChange:e=>o({...a,executionMode:e.target.value}),children:[s.jsx("option",{value:"side-thread",children:"side-thread"}),s.jsx("option",{value:"same-thread",children:"same-thread"})]})]}),s.jsx(W,{label:t("monitors.prompt"),rows:6,value:a.promptTemplate,onChange:e=>o({...a,promptTemplate:e.target.value})}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[s.jsx("input",{type:"checkbox",checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),t("monitors.enabled")]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(u,{variant:"secondary",onClick:()=>p(!1),children:t("common.cancel")}),s.jsx(u,{onClick:_,disabled:E,children:t("common.save")})]})]})})]})}export{je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,g as a}from"./index-wYpjqVqC.js";import{C as n}from"./Card-DayUo35w.js";function o({title:s,description:r,actions:t}){return e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:s}),r?e.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]})}function b({title:s,description:r,actions:t,children:l,className:d,bodyClassName:m}){return e.jsxs(n,{className:a("p-0",d),children:[(s||r||t)&&e.jsxs("div",{className:"flex flex-col gap-3 border-b px-5 py-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[s?e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:s}):null,r?e.jsx("p",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:r}):null]}),t?e.jsx("div",{className:"flex shrink-0 flex-wrap gap-2",children:t}):null]}),e.jsx("div",{className:a("p-5",m),children:l})]})}const x={neutral:"border-border bg-muted text-muted-foreground",success:"border-primary/20 bg-primary/10 text-primary",warning:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",danger:"border-destructive/20 bg-destructive/10 text-destructive dark:text-red-200",info:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-400/20 dark:bg-blue-500/10 dark:text-blue-200"};function c({children:s,tone:r="neutral"}){return e.jsx("span",{className:a("inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium",x[r]),children:s})}export{o as P,b as S,c as a};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as jn,
|
|
1
|
+
import{c as jn,n as he,P as Y,j as S,r as p,g as vt}from"./index-wYpjqVqC.js";import{c as ct,a as Je,r as lt,P as z,u as J,b as kt,d as yt,e as at,f as $,g as kn,h as Hn,i as Vn,R as Bn,F as Wn,D as Fn}from"./index-BlA4xPdd.js";import{a as St,C as $n}from"./chevron-down-BPk77tqY.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const zn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Un=jn("chevron-up",zn);function bt(e,[t,n]){return Math.min(n,Math.max(t,e))}function Kn(e){const t=e+"CollectionProvider",[n,o]=ct(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=u=>{const{scope:w,children:y}=u,h=he.useRef(null),v=he.useRef(new Map).current;return S.jsx(r,{scope:w,itemMap:v,collectionRef:h,children:y})};i.displayName=t;const c=e+"CollectionSlot",l=Je(c),a=he.forwardRef((u,w)=>{const{scope:y,children:h}=u,v=s(c,y),b=Y(w,v.collectionRef);return S.jsx(l,{ref:b,children:h})});a.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",g=Je(f),m=he.forwardRef((u,w)=>{const{scope:y,children:h,...v}=u,b=he.useRef(null),C=Y(w,b),R=s(f,y);return he.useEffect(()=>(R.itemMap.set(b,{ref:b,...v}),()=>void R.itemMap.delete(b))),S.jsx(g,{[d]:"",ref:C,children:h})});m.displayName=f;function x(u){const w=s(e+"CollectionConsumer",u);return he.useCallback(()=>{const h=w.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((R,T)=>v.indexOf(R.ref.current)-v.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:a,ItemSlot:m},x,o]}var Yn=p.createContext(void 0);function Xn(e){const t=p.useContext(Yn);return e||t||"ltr"}const Gn=["top","right","bottom","left"],fe=Math.min,G=Math.max,ke=Math.round,Le=Math.floor,oe=e=>({x:e,y:e}),qn={left:"right",right:"left",bottom:"top",top:"bottom"};function Qe(e,t,n){return G(e,fe(t,n))}function se(e,t){return typeof e=="function"?e(t):e}function ce(e){return e.split("-")[0]}function Ce(e){return e.split("-")[1]}function ft(e){return e==="x"?"y":"x"}function ut(e){return e==="y"?"height":"width"}function ne(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function dt(e){return ft(ne(e))}function Zn(e,t,n){n===void 0&&(n=!1);const o=Ce(e),r=dt(e),s=ut(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=He(i)),[i,He(i)]}function Jn(e){const t=He(e);return[et(e),t,et(t)]}function et(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ct=["left","right"],Rt=["right","left"],Qn=["top","bottom"],eo=["bottom","top"];function to(e,t,n){switch(e){case"top":case"bottom":return n?t?Rt:Ct:t?Ct:Rt;case"left":case"right":return t?Qn:eo;default:return[]}}function no(e,t,n,o){const r=Ce(e);let s=to(ce(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(et)))),s}function He(e){const t=ce(e);return qn[t]+e.slice(t.length)}function oo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ht(e){return typeof e!="number"?oo(e):{top:e,right:e,bottom:e,left:e}}function Ve(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function At(e,t,n){let{reference:o,floating:r}=e;const s=ne(t),i=dt(t),c=ut(i),l=ce(t),a=s==="y",f=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,g=o[c]/2-r[c]/2;let m;switch(l){case"top":m={x:f,y:o.y-r.height};break;case"bottom":m={x:f,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-r.width,y:d};break;default:m={x:o.x,y:o.y}}switch(Ce(t)){case"start":m[i]-=g*(n&&a?-1:1);break;case"end":m[i]+=g*(n&&a?-1:1);break}return m}async function ro(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:l}=e,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:g=!1,padding:m=0}=se(t,e),x=Ht(m),w=c[g?d==="floating"?"reference":"floating":d],y=Ve(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),h=d==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},C=Ve(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:v,strategy:l}):h);return{top:(y.top-C.top+x.top)/b.y,bottom:(C.bottom-y.bottom+x.bottom)/b.y,left:(y.left-C.left+x.left)/b.x,right:(C.right-y.right+x.right)/b.x}}const io=50,so=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:ro},l=await(i.isRTL==null?void 0:i.isRTL(t));let a=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:d}=At(a,o,l),g=o,m=0;const x={};for(let u=0;u<s.length;u++){const w=s[u];if(!w)continue;const{name:y,fn:h}=w,{x:v,y:b,data:C,reset:R}=await h({x:f,y:d,initialPlacement:o,placement:g,strategy:r,middlewareData:x,rects:a,platform:c,elements:{reference:e,floating:t}});f=v??f,d=b??d,x[y]={...x[y],...C},R&&m<io&&(m++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(a=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:d}=At(a,g,l)),u=-1)}return{x:f,y:d,placement:g,strategy:r,middlewareData:x}},co=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:l}=t,{element:a,padding:f=0}=se(e,t)||{};if(a==null)return{};const d=Ht(f),g={x:n,y:o},m=dt(r),x=ut(m),u=await i.getDimensions(a),w=m==="y",y=w?"top":"left",h=w?"bottom":"right",v=w?"clientHeight":"clientWidth",b=s.reference[x]+s.reference[m]-g[m]-s.floating[x],C=g[m]-s.reference[m],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a));let T=R?R[v]:0;(!T||!await(i.isElement==null?void 0:i.isElement(R)))&&(T=c.floating[v]||s.floating[x]);const N=b/2-C/2,W=T/2-u[x]/2-1,L=fe(d[y],W),k=fe(d[h],W),H=L,_=T-u[x]-k,O=T/2-u[x]/2+N,F=Qe(H,O,_),E=!l.arrow&&Ce(r)!=null&&O!==F&&s.reference[x]/2-(O<H?L:k)-u[x]/2<0,I=E?O<H?O-H:O-_:0;return{[m]:g[m]+I,data:{[m]:F,centerOffset:O-F-I,...E&&{alignmentOffset:I}},reset:E}}}),lo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:l,elements:a}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:u=!0,...w}=se(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=ce(r),h=ne(c),v=ce(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=g||(v||!u?[He(c)]:Jn(c)),R=x!=="none";!g&&R&&C.push(...no(c,u,x,b));const T=[c,...C],N=await l.detectOverflow(t,w),W=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&W.push(N[y]),d){const O=Zn(r,i,b);W.push(N[O[0]],N[O[1]])}if(L=[...L,{placement:r,overflows:W}],!W.every(O=>O<=0)){var k,H;const O=(((k=s.flip)==null?void 0:k.index)||0)+1,F=T[O];if(F&&(!(d==="alignment"?h!==ne(F):!1)||L.every(A=>ne(A.placement)===h?A.overflows[0]>0:!0)))return{data:{index:O,overflows:L},reset:{placement:F}};let E=(H=L.filter(I=>I.overflows[0]<=0).sort((I,A)=>I.overflows[1]-A.overflows[1])[0])==null?void 0:H.placement;if(!E)switch(m){case"bestFit":{var _;const I=(_=L.filter(A=>{if(R){const V=ne(A.placement);return V===h||V==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(V=>V>0).reduce((V,K)=>V+K,0)]).sort((A,V)=>A[1]-V[1])[0])==null?void 0:_[0];I&&(E=I);break}case"initialPlacement":E=c;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function Pt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Tt(e){return Gn.some(t=>e[t]>=0)}const ao=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=se(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),c=Pt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Tt(c)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),c=Pt(i,n.floating);return{data:{escapedOffsets:c,escaped:Tt(c)}}}default:return{}}}}},Vt=new Set(["left","top"]);async function fo(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ce(n),c=Ce(n),l=ne(n)==="y",a=Vt.has(i)?-1:1,f=s&&l?-1:1,d=se(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof x=="number"&&(m=c==="end"?x*-1:x),l?{x:m*f,y:g*a}:{x:g*a,y:m*f}}const uo=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=t,l=await fo(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:i}}}}},po=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x:h,y:v}=y;return{x:h,y:v}}},...a}=se(e,t),f={x:n,y:o},d=await s.detectOverflow(t,a),g=ne(ce(r)),m=ft(g);let x=f[m],u=f[g];if(i){const y=m==="y"?"top":"left",h=m==="y"?"bottom":"right",v=x+d[y],b=x-d[h];x=Qe(v,x,b)}if(c){const y=g==="y"?"top":"left",h=g==="y"?"bottom":"right",v=u+d[y],b=u-d[h];u=Qe(v,u,b)}const w=l.fn({...t,[m]:x,[g]:u});return{...w,data:{x:w.x-n,y:w.y-o,enabled:{[m]:i,[g]:c}}}}}},mo=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:l=!0,crossAxis:a=!0}=se(e,t),f={x:n,y:o},d=ne(r),g=ft(d);let m=f[g],x=f[d];const u=se(c,t),w=typeof u=="number"?{mainAxis:u,crossAxis:0}:{mainAxis:0,crossAxis:0,...u};if(l){const v=g==="y"?"height":"width",b=s.reference[g]-s.floating[v]+w.mainAxis,C=s.reference[g]+s.reference[v]-w.mainAxis;m<b?m=b:m>C&&(m=C)}if(a){var y,h;const v=g==="y"?"width":"height",b=Vt.has(ce(r)),C=s.reference[d]-s.floating[v]+(b&&((y=i.offset)==null?void 0:y[d])||0)+(b?0:w.crossAxis),R=s.reference[d]+s.reference[v]+(b?0:((h=i.offset)==null?void 0:h[d])||0)-(b?w.crossAxis:0);x<C?x=C:x>R&&(x=R)}return{[g]:m,[d]:x}}}},ho=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:c}=t,{apply:l=()=>{},...a}=se(e,t),f=await i.detectOverflow(t,a),d=ce(r),g=Ce(r),m=ne(r)==="y",{width:x,height:u}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(y=d,w=g==="end"?"top":"bottom");const h=u-f.top-f.bottom,v=x-f.left-f.right,b=fe(u-f[w],h),C=fe(x-f[y],v),R=!t.middlewareData.shift;let T=b,N=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=v),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=h),R&&!g){const L=G(f.left,0),k=G(f.right,0),H=G(f.top,0),_=G(f.bottom,0);m?N=x-2*(L!==0||k!==0?L+k:G(f.left,f.right)):T=u-2*(H!==0||_!==0?H+_:G(f.top,f.bottom))}await l({...t,availableWidth:N,availableHeight:T});const W=await i.getDimensions(c.floating);return x!==W.width||u!==W.height?{reset:{rects:!0}}:{}}}};function Fe(){return typeof window<"u"}function Re(e){return Bt(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function re(e){var t;return(t=(Bt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bt(e){return Fe()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return Fe()?e instanceof Element||e instanceof q(e).Element:!1}function le(e){return Fe()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Et(e){return!Fe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function Me(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function go(e){return/^(table|td|th)$/.test(Re(e))}function $e(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xo=/transform|translate|scale|rotate|perspective|filter/,wo=/paint|layout|strict|content/,ge=e=>!!e&&e!=="none";let Ge;function pt(e){const t=Q(e)?ee(e):e;return ge(t.transform)||ge(t.translate)||ge(t.scale)||ge(t.rotate)||ge(t.perspective)||!mt()&&(ge(t.backdropFilter)||ge(t.filter))||xo.test(t.willChange||"")||wo.test(t.contain||"")}function vo(e){let t=ue(e);for(;le(t)&&!be(t);){if(pt(t))return t;if($e(t))return null;t=ue(t)}return null}function mt(){return Ge==null&&(Ge=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ge}function be(e){return/^(html|body|#document)$/.test(Re(e))}function ee(e){return q(e).getComputedStyle(e)}function ze(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ue(e){if(Re(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Et(e)&&e.host||re(e);return Et(t)?t.host:t}function Wt(e){const t=ue(e);return be(t)?e.ownerDocument?e.ownerDocument.body:e.body:le(t)&&Me(t)?t:Wt(t)}function _e(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Wt(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=q(r);if(s){const c=tt(i);return t.concat(i,i.visualViewport||[],Me(r)?r:[],c&&n?_e(c):[])}else return t.concat(r,_e(r,[],n))}function tt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ft(e){const t=ee(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=le(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,c=ke(n)!==s||ke(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function ht(e){return Q(e)?e:e.contextElement}function Se(e){const t=ht(e);if(!le(t))return oe(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Ft(t);let i=(s?ke(n.width):n.width)/o,c=(s?ke(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const yo=oe(0);function $t(e){const t=q(e);return!mt()||!t.visualViewport?yo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function So(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function xe(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=ht(e);let i=oe(1);t&&(o?Q(o)&&(i=Se(o)):i=Se(e));const c=So(s,n,o)?$t(s):oe(0);let l=(r.left+c.x)/i.x,a=(r.top+c.y)/i.y,f=r.width/i.x,d=r.height/i.y;if(s){const g=q(s),m=o&&Q(o)?q(o):o;let x=g,u=tt(x);for(;u&&o&&m!==x;){const w=Se(u),y=u.getBoundingClientRect(),h=ee(u),v=y.left+(u.clientLeft+parseFloat(h.paddingLeft))*w.x,b=y.top+(u.clientTop+parseFloat(h.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,d*=w.y,l+=v,a+=b,x=q(u),u=tt(x)}}return Ve({width:f,height:d,x:l,y:a})}function Ue(e,t){const n=ze(e).scrollLeft;return t?t.left+n:xe(re(e)).left+n}function zt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ue(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function bo(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=re(o),c=t?$e(t.floating):!1;if(o===i||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=oe(1);const f=oe(0),d=le(o);if((d||!d&&!s)&&((Re(o)!=="body"||Me(i))&&(l=ze(o)),d)){const m=xe(o);a=Se(o),f.x=m.x+o.clientLeft,f.y=m.y+o.clientTop}const g=i&&!d&&!s?zt(i,l):oe(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x+g.x,y:n.y*a.y-l.scrollTop*a.y+f.y+g.y}}function Co(e){return Array.from(e.getClientRects())}function Ro(e){const t=re(e),n=ze(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ue(e);const c=-n.scrollTop;return ee(o).direction==="rtl"&&(i+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Ot=25;function Ao(e,t){const n=q(e),o=re(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,l=0;if(r){s=r.width,i=r.height;const f=mt();(!f||f&&t==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}const a=Ue(o);if(a<=0){const f=o.ownerDocument,d=f.body,g=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(o.clientWidth-d.clientWidth-m);x<=Ot&&(s-=x)}else a<=Ot&&(s+=a);return{width:s,height:i,x:c,y:l}}function Po(e,t){const n=xe(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=le(e)?Se(e):oe(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,a=o*s.y;return{width:i,height:c,x:l,y:a}}function It(e,t,n){let o;if(t==="viewport")o=Ao(e,n);else if(t==="document")o=Ro(re(e));else if(Q(t))o=Po(t,n);else{const r=$t(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ve(o)}function Ut(e,t){const n=ue(e);return n===t||!Q(n)||be(n)?!1:ee(n).position==="fixed"||Ut(n,t)}function To(e,t){const n=t.get(e);if(n)return n;let o=_e(e,[],!1).filter(c=>Q(c)&&Re(c)!=="body"),r=null;const s=ee(e).position==="fixed";let i=s?ue(e):e;for(;Q(i)&&!be(i);){const c=ee(i),l=pt(i);!l&&c.position==="fixed"&&(r=null),(s?!l&&!r:!l&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Me(i)&&!l&&Ut(e,i))?o=o.filter(f=>f!==i):r=c,i=ue(i)}return t.set(e,o),o}function Eo(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?$e(t)?[]:To(t,this._c):[].concat(n),o],c=It(t,i[0],r);let l=c.top,a=c.right,f=c.bottom,d=c.left;for(let g=1;g<i.length;g++){const m=It(t,i[g],r);l=G(m.top,l),a=fe(m.right,a),f=fe(m.bottom,f),d=G(m.left,d)}return{width:a-d,height:f-l,x:d,y:l}}function Oo(e){const{width:t,height:n}=Ft(e);return{width:t,height:n}}function Io(e,t,n){const o=le(t),r=re(t),s=n==="fixed",i=xe(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=oe(0);function a(){l.x=Ue(r)}if(o||!o&&!s)if((Re(t)!=="body"||Me(r))&&(c=ze(t)),o){const m=xe(t,!0,s,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else r&&a();s&&!o&&r&&a();const f=r&&!o&&!s?zt(r,c):oe(0),d=i.left+c.scrollLeft-l.x-f.x,g=i.top+c.scrollTop-l.y-f.y;return{x:d,y:g,width:i.width,height:i.height}}function qe(e){return ee(e).position==="static"}function Nt(e,t){if(!le(e)||ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return re(e)===n&&(n=n.ownerDocument.body),n}function Kt(e,t){const n=q(e);if($e(e))return n;if(!le(e)){let r=ue(e);for(;r&&!be(r);){if(Q(r)&&!qe(r))return r;r=ue(r)}return n}let o=Nt(e,t);for(;o&&go(o)&&qe(o);)o=Nt(o,t);return o&&be(o)&&qe(o)&&!pt(o)?n:o||vo(e)||n}const No=async function(e){const t=this.getOffsetParent||Kt,n=this.getDimensions,o=await n(e.floating);return{reference:Io(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function _o(e){return ee(e).direction==="rtl"}const Mo={convertOffsetParentRelativeRectToViewportRelativeRect:bo,getDocumentElement:re,getClippingRect:Eo,getOffsetParent:Kt,getElementRects:No,getClientRects:Co,getDimensions:Oo,getScale:Se,isElement:Q,isRTL:_o};function Yt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Do(e,t){let n=null,o;const r=re(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const a=e.getBoundingClientRect(),{left:f,top:d,width:g,height:m}=a;if(c||t(),!g||!m)return;const x=Le(d),u=Le(r.clientWidth-(f+g)),w=Le(r.clientHeight-(d+m)),y=Le(f),v={rootMargin:-x+"px "+-u+"px "+-w+"px "+-y+"px",threshold:G(0,fe(1,l))||1};let b=!0;function C(R){const T=R[0].intersectionRatio;if(T!==l){if(!b)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Yt(a,e.getBoundingClientRect())&&i(),b=!1}try{n=new IntersectionObserver(C,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return i(!0),s}function Lo(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=ht(e),f=r||s?[...a?_e(a):[],...t?_e(t):[]]:[];f.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=a&&c?Do(a,n):null;let g=-1,m=null;i&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===a&&m&&t&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),a&&!l&&m.observe(a),t&&m.observe(t));let x,u=l?xe(e):null;l&&w();function w(){const y=xe(e);u&&!Yt(u,y)&&n(),u=y,x=requestAnimationFrame(w)}return n(),()=>{var y;f.forEach(h=>{r&&h.removeEventListener("scroll",n),s&&h.removeEventListener("resize",n)}),d==null||d(),(y=m)==null||y.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const jo=uo,ko=po,Ho=lo,Vo=ho,Bo=ao,_t=co,Wo=mo,Fo=(e,t,n)=>{const o=new Map,r={platform:Mo,...n},s={...r.platform,_c:o};return so(e,t,{...r,platform:s})};var $o=typeof document<"u",zo=function(){},je=$o?p.useLayoutEffect:zo;function Be(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Be(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Be(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Xt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mt(e,t){const n=Xt(e);return Math.round(t*n)/n}function Ze(e){const t=p.useRef(e);return je(()=>{t.current=e}),t}function Uo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:l,open:a}=e,[f,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,m]=p.useState(o);Be(g,o)||m(o);const[x,u]=p.useState(null),[w,y]=p.useState(null),h=p.useCallback(A=>{A!==R.current&&(R.current=A,u(A))},[]),v=p.useCallback(A=>{A!==T.current&&(T.current=A,y(A))},[]),b=s||x,C=i||w,R=p.useRef(null),T=p.useRef(null),N=p.useRef(f),W=l!=null,L=Ze(l),k=Ze(r),H=Ze(a),_=p.useCallback(()=>{if(!R.current||!T.current)return;const A={placement:t,strategy:n,middleware:g};k.current&&(A.platform=k.current),Fo(R.current,T.current,A).then(V=>{const K={...V,isPositioned:H.current!==!1};O.current&&!Be(N.current,K)&&(N.current=K,lt.flushSync(()=>{d(K)}))})},[g,t,n,k,H]);je(()=>{a===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[a]);const O=p.useRef(!1);je(()=>(O.current=!0,()=>{O.current=!1}),[]),je(()=>{if(b&&(R.current=b),C&&(T.current=C),b&&C){if(L.current)return L.current(b,C,_);_()}},[b,C,_,L,W]);const F=p.useMemo(()=>({reference:R,floating:T,setReference:h,setFloating:v}),[h,v]),E=p.useMemo(()=>({reference:b,floating:C}),[b,C]),I=p.useMemo(()=>{const A={position:n,left:0,top:0};if(!E.floating)return A;const V=Mt(E.floating,f.x),K=Mt(E.floating,f.y);return c?{...A,transform:"translate("+V+"px, "+K+"px)",...Xt(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:K}},[n,c,E.floating,f.x,f.y]);return p.useMemo(()=>({...f,update:_,refs:F,elements:E,floatingStyles:I}),[f,_,F,E,I])}const Ko=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?_t({element:o.current,padding:r}).fn(n):{}:o?_t({element:o,padding:r}).fn(n):{}}}},Yo=(e,t)=>{const n=jo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xo=(e,t)=>{const n=ko(e);return{name:n.name,fn:n.fn,options:[e,t]}},Go=(e,t)=>({fn:Wo(e).fn,options:[e,t]}),qo=(e,t)=>{const n=Ho(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zo=(e,t)=>{const n=Vo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jo=(e,t)=>{const n=Bo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qo=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}};var er="Arrow",Gt=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return S.jsx(z.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});Gt.displayName=er;var tr=Gt;function nr(e){const[t,n]=p.useState(void 0);return J(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let i,c;if("borderBoxSize"in s){const l=s.borderBoxSize,a=Array.isArray(l)?l[0]:l;i=a.inlineSize,c=a.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var gt="Popper",[qt,Zt]=ct(gt),[or,Jt]=qt(gt),Qt=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return S.jsx(or,{scope:t,anchor:o,onAnchorChange:r,children:n})};Qt.displayName=gt;var en="PopperAnchor",tn=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Jt(en,n),i=p.useRef(null),c=Y(t,i),l=p.useRef(null);return p.useEffect(()=>{const a=l.current;l.current=(o==null?void 0:o.current)||i.current,a!==l.current&&s.onAnchorChange(l.current)}),o?null:S.jsx(z.div,{...r,ref:c})});tn.displayName=en;var xt="PopperContent",[rr,ir]=qt(xt),nn=p.forwardRef((e,t)=>{var P,B,U,j,M,D;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:a=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:g=!1,updatePositionStrategy:m="optimized",onPlaced:x,...u}=e,w=Jt(xt,n),[y,h]=p.useState(null),v=Y(t,X=>h(X)),[b,C]=p.useState(null),R=nr(b),T=(R==null?void 0:R.width)??0,N=(R==null?void 0:R.height)??0,W=o+(s!=="center"?"-"+s:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(a)?a:[a],H=k.length>0,_={padding:L,boundary:k.filter(cr),altBoundary:H},{refs:O,floatingStyles:F,placement:E,isPositioned:I,middlewareData:A}=Uo({strategy:"fixed",placement:W,whileElementsMounted:(...X)=>Lo(...X,{animationFrame:m==="always"}),elements:{reference:w.anchor},middleware:[Yo({mainAxis:r+N,alignmentAxis:i}),l&&Xo({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Go():void 0,..._}),l&&qo({..._}),Zo({..._,apply:({elements:X,rects:te,availableWidth:Ee,availableHeight:Oe})=>{const{width:Ie,height:Ln}=te.reference,De=X.floating.style;De.setProperty("--radix-popper-available-width",`${Ee}px`),De.setProperty("--radix-popper-available-height",`${Oe}px`),De.setProperty("--radix-popper-anchor-width",`${Ie}px`),De.setProperty("--radix-popper-anchor-height",`${Ln}px`)}}),b&&Qo({element:b,padding:c}),lr({arrowWidth:T,arrowHeight:N}),g&&Jo({strategy:"referenceHidden",..._})]}),[V,K]=sn(E),ie=kt(x);J(()=>{I&&(ie==null||ie())},[I,ie]);const Pe=(P=A.arrow)==null?void 0:P.x,Te=(B=A.arrow)==null?void 0:B.y,ae=((U=A.arrow)==null?void 0:U.centerOffset)!==0,[ye,me]=p.useState();return J(()=>{y&&me(window.getComputedStyle(y).zIndex)},[y]),S.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:I?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ye,"--radix-popper-transform-origin":[(j=A.transformOrigin)==null?void 0:j.x,(M=A.transformOrigin)==null?void 0:M.y].join(" "),...((D=A.hide)==null?void 0:D.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:S.jsx(rr,{scope:n,placedSide:V,onArrowChange:C,arrowX:Pe,arrowY:Te,shouldHideArrow:ae,children:S.jsx(z.div,{"data-side":V,"data-align":K,...u,ref:v,style:{...u.style,animation:I?void 0:"none"}})})})});nn.displayName=xt;var on="PopperArrow",sr={top:"bottom",right:"left",bottom:"top",left:"right"},rn=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=ir(on,o),i=sr[s.placedSide];return S.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:S.jsx(tr,{...r,ref:n,style:{...r.style,display:"block"}})})});rn.displayName=on;function cr(e){return e!==null}var lr=e=>({name:"transformOrigin",options:e,fn(t){var w,y,h;const{placement:n,rects:o,middlewareData:r}=t,i=((w=r.arrow)==null?void 0:w.centerOffset)!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[a,f]=sn(n),d={start:"0%",center:"50%",end:"100%"}[f],g=(((y=r.arrow)==null?void 0:y.x)??0)+c/2,m=(((h=r.arrow)==null?void 0:h.y)??0)+l/2;let x="",u="";return a==="bottom"?(x=i?d:`${g}px`,u=`${-l}px`):a==="top"?(x=i?d:`${g}px`,u=`${o.floating.height+l}px`):a==="right"?(x=`${-l}px`,u=i?d:`${m}px`):a==="left"&&(x=`${o.floating.width+l}px`,u=i?d:`${m}px`),{data:{x,y:u}}}});function sn(e){const[t,n="center"]=e.split("-");return[t,n]}var ar=Qt,fr=tn,ur=nn,dr=rn;function pr(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var cn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mr="VisuallyHidden",hr=p.forwardRef((e,t)=>S.jsx(z.span,{...e,ref:t,style:{...cn,...e.style}}));hr.displayName=mr;var gr=[" ","Enter","ArrowUp","ArrowDown"],xr=[" ","Enter"],we="Select",[Ke,Ye,wr]=Kn(we),[Ae]=ct(we,[wr,Zt]),Xe=Zt(),[vr,de]=Ae(we),[yr,Sr]=Ae(we),ln=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:i,defaultValue:c,onValueChange:l,dir:a,name:f,autoComplete:d,disabled:g,required:m,form:x}=e,u=Xe(t),[w,y]=p.useState(null),[h,v]=p.useState(null),[b,C]=p.useState(!1),R=Xn(a),[T,N]=yt({prop:o,defaultProp:r??!1,onChange:s,caller:we}),[W,L]=yt({prop:i,defaultProp:c,onChange:l,caller:we}),k=p.useRef(null),H=w?x||!!w.closest("form"):!0,[_,O]=p.useState(new Set),F=Array.from(_).map(E=>E.props.value).join(";");return S.jsx(ar,{...u,children:S.jsxs(vr,{required:m,scope:t,trigger:w,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:at(),value:W,onValueChange:L,open:T,onOpenChange:N,dir:R,triggerPointerDownPosRef:k,disabled:g,children:[S.jsx(Ke.Provider,{scope:t,children:S.jsx(yr,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(E=>{O(I=>new Set(I).add(E))},[]),onNativeOptionRemove:p.useCallback(E=>{O(I=>{const A=new Set(I);return A.delete(E),A})},[]),children:n})}),H?S.jsxs(In,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:W,onChange:E=>L(E.target.value),disabled:g,form:x,children:[W===void 0?S.jsx("option",{value:""}):null,Array.from(_)]},F):null]})})};ln.displayName=we;var an="SelectTrigger",fn=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=Xe(n),i=de(an,n),c=i.disabled||o,l=Y(t,i.onTriggerChange),a=Ye(n),f=p.useRef("touch"),[d,g,m]=_n(u=>{const w=a().filter(v=>!v.disabled),y=w.find(v=>v.value===i.value),h=Mn(w,u,y);h!==void 0&&i.onValueChange(h.value)}),x=u=>{c||(i.onOpenChange(!0),m()),u&&(i.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return S.jsx(fr,{asChild:!0,...s,children:S.jsx(z.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Nn(i.value)?"":void 0,...r,ref:l,onClick:$(r.onClick,u=>{u.currentTarget.focus(),f.current!=="mouse"&&x(u)}),onPointerDown:$(r.onPointerDown,u=>{f.current=u.pointerType;const w=u.target;w.hasPointerCapture(u.pointerId)&&w.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(x(u),u.preventDefault())}),onKeyDown:$(r.onKeyDown,u=>{const w=d.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&g(u.key),!(w&&u.key===" ")&&gr.includes(u.key)&&(x(),u.preventDefault())})})})});fn.displayName=an;var un="SelectValue",dn=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:i="",...c}=e,l=de(un,n),{onValueNodeHasChildrenChange:a}=l,f=s!==void 0,d=Y(t,l.onValueNodeChange);return J(()=>{a(f)},[a,f]),S.jsx(z.span,{...c,ref:d,style:{pointerEvents:"none"},children:Nn(l.value)?S.jsx(S.Fragment,{children:i}):s})});dn.displayName=un;var br="SelectIcon",pn=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return S.jsx(z.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});pn.displayName=br;var Cr="SelectPortal",mn=e=>S.jsx(kn,{asChild:!0,...e});mn.displayName=Cr;var ve="SelectContent",hn=p.forwardRef((e,t)=>{const n=de(ve,e.__scopeSelect),[o,r]=p.useState();if(J(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?lt.createPortal(S.jsx(gn,{scope:e.__scopeSelect,children:S.jsx(Ke.Slot,{scope:e.__scopeSelect,children:S.jsx("div",{children:e.children})})}),s):null}return S.jsx(xn,{...e,ref:t})});hn.displayName=ve;var Z=10,[gn,pe]=Ae(ve),Rr="SelectContentImpl",Ar=Je("SelectContent.RemoveScroll"),xn=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:i,side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:x,hideWhenDetached:u,avoidCollisions:w,...y}=e,h=de(ve,n),[v,b]=p.useState(null),[C,R]=p.useState(null),T=Y(t,P=>b(P)),[N,W]=p.useState(null),[L,k]=p.useState(null),H=Ye(n),[_,O]=p.useState(!1),F=p.useRef(!1);p.useEffect(()=>{if(v)return Hn(v)},[v]),Vn();const E=p.useCallback(P=>{const[B,...U]=H().map(D=>D.ref.current),[j]=U.slice(-1),M=document.activeElement;for(const D of P)if(D===M||(D==null||D.scrollIntoView({block:"nearest"}),D===B&&C&&(C.scrollTop=0),D===j&&C&&(C.scrollTop=C.scrollHeight),D==null||D.focus(),document.activeElement!==M))return},[H,C]),I=p.useCallback(()=>E([N,v]),[E,N,v]);p.useEffect(()=>{_&&I()},[_,I]);const{onOpenChange:A,triggerPointerDownPosRef:V}=h;p.useEffect(()=>{if(v){let P={x:0,y:0};const B=j=>{var M,D;P={x:Math.abs(Math.round(j.pageX)-(((M=V.current)==null?void 0:M.x)??0)),y:Math.abs(Math.round(j.pageY)-(((D=V.current)==null?void 0:D.y)??0))}},U=j=>{P.x<=10&&P.y<=10?j.preventDefault():v.contains(j.target)||A(!1),document.removeEventListener("pointermove",B),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",B),document.addEventListener("pointerup",U,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",U,{capture:!0})}}},[v,A,V]),p.useEffect(()=>{const P=()=>A(!1);return window.addEventListener("blur",P),window.addEventListener("resize",P),()=>{window.removeEventListener("blur",P),window.removeEventListener("resize",P)}},[A]);const[K,ie]=_n(P=>{const B=H().filter(M=>!M.disabled),U=B.find(M=>M.ref.current===document.activeElement),j=Mn(B,P,U);j&&setTimeout(()=>j.ref.current.focus())}),Pe=p.useCallback((P,B,U)=>{const j=!F.current&&!U;(h.value!==void 0&&h.value===B||j)&&(W(P),j&&(F.current=!0))},[h.value]),Te=p.useCallback(()=>v==null?void 0:v.focus(),[v]),ae=p.useCallback((P,B,U)=>{const j=!F.current&&!U;(h.value!==void 0&&h.value===B||j)&&k(P)},[h.value]),ye=o==="popper"?nt:wn,me=ye===nt?{side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:x,hideWhenDetached:u,avoidCollisions:w}:{};return S.jsx(gn,{scope:n,content:v,viewport:C,onViewportChange:R,itemRefCallback:Pe,selectedItem:N,onItemLeave:Te,itemTextRefCallback:ae,focusSelectedItem:I,selectedItemText:L,position:o,isPositioned:_,searchRef:K,children:S.jsx(Bn,{as:Ar,allowPinchZoom:!0,children:S.jsx(Wn,{asChild:!0,trapped:h.open,onMountAutoFocus:P=>{P.preventDefault()},onUnmountAutoFocus:$(r,P=>{var B;(B=h.trigger)==null||B.focus({preventScroll:!0}),P.preventDefault()}),children:S.jsx(Fn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:P=>P.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:S.jsx(ye,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:P=>P.preventDefault(),...y,...me,onPlaced:()=>O(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:$(y.onKeyDown,P=>{const B=P.ctrlKey||P.altKey||P.metaKey;if(P.key==="Tab"&&P.preventDefault(),!B&&P.key.length===1&&ie(P.key),["ArrowUp","ArrowDown","Home","End"].includes(P.key)){let j=H().filter(M=>!M.disabled).map(M=>M.ref.current);if(["ArrowUp","End"].includes(P.key)&&(j=j.slice().reverse()),["ArrowUp","ArrowDown"].includes(P.key)){const M=P.target,D=j.indexOf(M);j=j.slice(D+1)}setTimeout(()=>E(j)),P.preventDefault()}})})})})})})});xn.displayName=Rr;var Pr="SelectItemAlignedPosition",wn=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=de(ve,n),i=pe(ve,n),[c,l]=p.useState(null),[a,f]=p.useState(null),d=Y(t,T=>f(T)),g=Ye(n),m=p.useRef(!1),x=p.useRef(!0),{viewport:u,selectedItem:w,selectedItemText:y,focusSelectedItem:h}=i,v=p.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&a&&u&&w&&y){const T=s.trigger.getBoundingClientRect(),N=a.getBoundingClientRect(),W=s.valueNode.getBoundingClientRect(),L=y.getBoundingClientRect();if(s.dir!=="rtl"){const M=L.left-N.left,D=W.left-M,X=T.left-D,te=T.width+X,Ee=Math.max(te,N.width),Oe=window.innerWidth-Z,Ie=bt(D,[Z,Math.max(Z,Oe-Ee)]);c.style.minWidth=te+"px",c.style.left=Ie+"px"}else{const M=N.right-L.right,D=window.innerWidth-W.right-M,X=window.innerWidth-T.right-D,te=T.width+X,Ee=Math.max(te,N.width),Oe=window.innerWidth-Z,Ie=bt(D,[Z,Math.max(Z,Oe-Ee)]);c.style.minWidth=te+"px",c.style.right=Ie+"px"}const k=g(),H=window.innerHeight-Z*2,_=u.scrollHeight,O=window.getComputedStyle(a),F=parseInt(O.borderTopWidth,10),E=parseInt(O.paddingTop,10),I=parseInt(O.borderBottomWidth,10),A=parseInt(O.paddingBottom,10),V=F+E+_+A+I,K=Math.min(w.offsetHeight*5,V),ie=window.getComputedStyle(u),Pe=parseInt(ie.paddingTop,10),Te=parseInt(ie.paddingBottom,10),ae=T.top+T.height/2-Z,ye=H-ae,me=w.offsetHeight/2,P=w.offsetTop+me,B=F+E+P,U=V-B;if(B<=ae){const M=k.length>0&&w===k[k.length-1].ref.current;c.style.bottom="0px";const D=a.clientHeight-u.offsetTop-u.offsetHeight,X=Math.max(ye,me+(M?Te:0)+D+I),te=B+X;c.style.height=te+"px"}else{const M=k.length>0&&w===k[0].ref.current;c.style.top="0px";const X=Math.max(ae,F+u.offsetTop+(M?Pe:0)+me)+U;c.style.height=X+"px",u.scrollTop=B-ae+u.offsetTop}c.style.margin=`${Z}px 0`,c.style.minHeight=K+"px",c.style.maxHeight=H+"px",o==null||o(),requestAnimationFrame(()=>m.current=!0)}},[g,s.trigger,s.valueNode,c,a,u,w,y,s.dir,o]);J(()=>v(),[v]);const[b,C]=p.useState();J(()=>{a&&C(window.getComputedStyle(a).zIndex)},[a]);const R=p.useCallback(T=>{T&&x.current===!0&&(v(),h==null||h(),x.current=!1)},[v,h]);return S.jsx(Er,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:R,children:S.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:S.jsx(z.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});wn.displayName=Pr;var Tr="SelectPopperPosition",nt=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=Z,...s}=e,i=Xe(n);return S.jsx(ur,{...i,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nt.displayName=Tr;var[Er,wt]=Ae(ve,{}),ot="SelectViewport",vn=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=pe(ot,n),i=wt(ot,n),c=Y(t,s.onViewportChange),l=p.useRef(0);return S.jsxs(S.Fragment,{children:[S.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),S.jsx(Ke.Slot,{scope:n,children:S.jsx(z.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:$(r.onScroll,a=>{const f=a.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&d){const m=Math.abs(l.current-f.scrollTop);if(m>0){const x=window.innerHeight-Z*2,u=parseFloat(d.style.minHeight),w=parseFloat(d.style.height),y=Math.max(u,w);if(y<x){const h=y+m,v=Math.min(x,h),b=h-v;d.style.height=v+"px",d.style.bottom==="0px"&&(f.scrollTop=b>0?b:0,d.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});vn.displayName=ot;var yn="SelectGroup",[Or,Ir]=Ae(yn),Nr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=at();return S.jsx(Or,{scope:n,id:r,children:S.jsx(z.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Nr.displayName=yn;var Sn="SelectLabel",_r=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ir(Sn,n);return S.jsx(z.div,{id:r.id,...o,ref:t})});_r.displayName=Sn;var We="SelectItem",[Mr,bn]=Ae(We),Cn=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...i}=e,c=de(We,n),l=pe(We,n),a=c.value===o,[f,d]=p.useState(s??""),[g,m]=p.useState(!1),x=Y(t,h=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,h,o,r)}),u=at(),w=p.useRef("touch"),y=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return S.jsx(Mr,{scope:n,value:o,disabled:r,textId:u,isSelected:a,onItemTextChange:p.useCallback(h=>{d(v=>v||((h==null?void 0:h.textContent)??"").trim())},[]),children:S.jsx(Ke.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:S.jsx(z.div,{role:"option","aria-labelledby":u,"data-highlighted":g?"":void 0,"aria-selected":a&&g,"data-state":a?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:x,onFocus:$(i.onFocus,()=>m(!0)),onBlur:$(i.onBlur,()=>m(!1)),onClick:$(i.onClick,()=>{w.current!=="mouse"&&y()}),onPointerUp:$(i.onPointerUp,()=>{w.current==="mouse"&&y()}),onPointerDown:$(i.onPointerDown,h=>{w.current=h.pointerType}),onPointerMove:$(i.onPointerMove,h=>{var v;w.current=h.pointerType,r?(v=l.onItemLeave)==null||v.call(l):w.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$(i.onPointerLeave,h=>{var v;h.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:$(i.onKeyDown,h=>{var b;((b=l.searchRef)==null?void 0:b.current)!==""&&h.key===" "||(xr.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Cn.displayName=We;var Ne="SelectItemText",Rn=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,i=de(Ne,n),c=pe(Ne,n),l=bn(Ne,n),a=Sr(Ne,n),[f,d]=p.useState(null),g=Y(t,y=>d(y),l.onItemTextChange,y=>{var h;return(h=c.itemTextRefCallback)==null?void 0:h.call(c,y,l.value,l.disabled)}),m=f==null?void 0:f.textContent,x=p.useMemo(()=>S.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:u,onNativeOptionRemove:w}=a;return J(()=>(u(x),()=>w(x)),[u,w,x]),S.jsxs(S.Fragment,{children:[S.jsx(z.span,{id:l.textId,...s,ref:g}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?lt.createPortal(s.children,i.valueNode):null]})});Rn.displayName=Ne;var An="SelectItemIndicator",Pn=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return bn(An,n).isSelected?S.jsx(z.span,{"aria-hidden":!0,...o,ref:t}):null});Pn.displayName=An;var rt="SelectScrollUpButton",Tn=p.forwardRef((e,t)=>{const n=pe(rt,e.__scopeSelect),o=wt(rt,e.__scopeSelect),[r,s]=p.useState(!1),i=Y(t,o.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let c=function(){const a=l.scrollTop>0;s(a)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?S.jsx(On,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Tn.displayName=rt;var it="SelectScrollDownButton",En=p.forwardRef((e,t)=>{const n=pe(it,e.__scopeSelect),o=wt(it,e.__scopeSelect),[r,s]=p.useState(!1),i=Y(t,o.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let c=function(){const a=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<a;s(f)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?S.jsx(On,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});En.displayName=it;var On=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=pe("SelectScrollButton",n),i=p.useRef(null),c=Ye(n),l=p.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return p.useEffect(()=>()=>l(),[l]),J(()=>{var f;const a=c().find(d=>d.ref.current===document.activeElement);(f=a==null?void 0:a.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),S.jsx(z.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:$(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:$(r.onPointerMove,()=>{var a;(a=s.onItemLeave)==null||a.call(s),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:$(r.onPointerLeave,()=>{l()})})}),Dr="SelectSeparator",Lr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return S.jsx(z.div,{"aria-hidden":!0,...o,ref:t})});Lr.displayName=Dr;var st="SelectArrow",jr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Xe(n),s=de(st,n),i=pe(st,n);return s.open&&i.position==="popper"?S.jsx(dr,{...r,...o,ref:t}):null});jr.displayName=st;var kr="SelectBubbleInput",In=p.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=p.useRef(null),s=Y(o,r),i=pr(t);return p.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&f){const d=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(d)}},[i,t]),S.jsx(z.select,{...n,style:{...cn,...n.style},ref:s,defaultValue:t})});In.displayName=kr;function Nn(e){return e===""||e===void 0}function _n(e){const t=kt(e),n=p.useRef(""),o=p.useRef(0),r=p.useCallback(i=>{const c=n.current+i;t(c),(function l(a){n.current=a,window.clearTimeout(o.current),a!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=p.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function Mn(e,t,n){const r=t.length>1&&Array.from(t).every(a=>a===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Hr(e,Math.max(s,0));r.length===1&&(i=i.filter(a=>a!==n));const l=i.find(a=>a.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function Hr(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Vr=ln,Br=fn,Wr=dn,Fr=pn,$r=mn,zr=hn,Ur=vn,Kr=Cn,Yr=Rn,Xr=Pn,Gr=Tn,qr=En;const Dn="__radix_empty_value__";function Dt(e){return typeof e=="string"||typeof e=="number"?String(e):p.Children.toArray(e).map(t=>typeof t=="string"||typeof t=="number"?String(t):"").join("")}function Zr(e){return p.Children.toArray(e).flatMap(t=>{if(!p.isValidElement(t))return[];const n=t;if(n.type!=="option")return[];const o=n.props.value??Dt(n.props.children);return[{value:String(o),label:Dt(n.props.children),disabled:n.props.disabled}]})}function Lt(e){return e===""||e===void 0||e===null?Dn:String(e)}function jt(e){return e===Dn?"":e}function ni({label:e,className:t,children:n,...o}){var a;const r=Zr(n),s=Lt(o.value??o.defaultValue??""),i=r.find(f=>f.value===jt(s)),c=(a=r.find(f=>f.value===""))==null?void 0:a.label,l=f=>{var g;const d=jt(f);(g=o.onChange)==null||g.call(o,{target:{value:d},currentTarget:{value:d}})};return S.jsxs("div",{className:"space-y-1.5",children:[e&&S.jsx("label",{className:"block text-sm font-medium text-foreground",children:e}),S.jsxs(Vr,{value:s,onValueChange:l,disabled:o.disabled,name:o.name,children:[S.jsxs(Br,{id:o.id,className:vt("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors","placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),children:[S.jsx(Wr,{placeholder:c,children:i==null?void 0:i.label}),S.jsx(Fr,{asChild:!0,children:S.jsx(St,{className:"h-4 w-4 opacity-50"})})]}),S.jsx($r,{children:S.jsxs(zr,{className:"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-fade-in",children:[S.jsx(Gr,{className:"flex cursor-default items-center justify-center py-1",children:S.jsx(Un,{className:"h-4 w-4"})}),S.jsx(Ur,{className:"p-1",children:r.map(f=>S.jsxs(Kr,{value:Lt(f.value),disabled:f.disabled,className:vt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-accent/10 focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"),children:[S.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:S.jsx(Xr,{children:S.jsx($n,{className:"h-4 w-4"})})}),S.jsx(Yr,{children:f.label})]},`${f.value}-${f.label}`))}),S.jsx(qr,{className:"flex cursor-default items-center justify-center py-1",children:S.jsx(St,{className:"h-4 w-4"})})]})})]})]})}export{ni as S};
|
|
6
|
+
*/const zn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Un=jn("chevron-up",zn);function bt(e,[t,n]){return Math.min(n,Math.max(t,e))}function Kn(e){const t=e+"CollectionProvider",[n,o]=ct(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=u=>{const{scope:w,children:y}=u,h=he.useRef(null),v=he.useRef(new Map).current;return S.jsx(r,{scope:w,itemMap:v,collectionRef:h,children:y})};i.displayName=t;const c=e+"CollectionSlot",l=Je(c),a=he.forwardRef((u,w)=>{const{scope:y,children:h}=u,v=s(c,y),b=Y(w,v.collectionRef);return S.jsx(l,{ref:b,children:h})});a.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",g=Je(f),m=he.forwardRef((u,w)=>{const{scope:y,children:h,...v}=u,b=he.useRef(null),C=Y(w,b),R=s(f,y);return he.useEffect(()=>(R.itemMap.set(b,{ref:b,...v}),()=>void R.itemMap.delete(b))),S.jsx(g,{[d]:"",ref:C,children:h})});m.displayName=f;function x(u){const w=s(e+"CollectionConsumer",u);return he.useCallback(()=>{const h=w.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((R,T)=>v.indexOf(R.ref.current)-v.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:a,ItemSlot:m},x,o]}var Yn=p.createContext(void 0);function Xn(e){const t=p.useContext(Yn);return e||t||"ltr"}const Gn=["top","right","bottom","left"],fe=Math.min,G=Math.max,ke=Math.round,Le=Math.floor,oe=e=>({x:e,y:e}),qn={left:"right",right:"left",bottom:"top",top:"bottom"};function Qe(e,t,n){return G(e,fe(t,n))}function se(e,t){return typeof e=="function"?e(t):e}function ce(e){return e.split("-")[0]}function Ce(e){return e.split("-")[1]}function ft(e){return e==="x"?"y":"x"}function ut(e){return e==="y"?"height":"width"}function ne(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function dt(e){return ft(ne(e))}function Zn(e,t,n){n===void 0&&(n=!1);const o=Ce(e),r=dt(e),s=ut(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=He(i)),[i,He(i)]}function Jn(e){const t=He(e);return[et(e),t,et(t)]}function et(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ct=["left","right"],Rt=["right","left"],Qn=["top","bottom"],eo=["bottom","top"];function to(e,t,n){switch(e){case"top":case"bottom":return n?t?Rt:Ct:t?Ct:Rt;case"left":case"right":return t?Qn:eo;default:return[]}}function no(e,t,n,o){const r=Ce(e);let s=to(ce(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(et)))),s}function He(e){const t=ce(e);return qn[t]+e.slice(t.length)}function oo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ht(e){return typeof e!="number"?oo(e):{top:e,right:e,bottom:e,left:e}}function Ve(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function At(e,t,n){let{reference:o,floating:r}=e;const s=ne(t),i=dt(t),c=ut(i),l=ce(t),a=s==="y",f=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,g=o[c]/2-r[c]/2;let m;switch(l){case"top":m={x:f,y:o.y-r.height};break;case"bottom":m={x:f,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-r.width,y:d};break;default:m={x:o.x,y:o.y}}switch(Ce(t)){case"start":m[i]-=g*(n&&a?-1:1);break;case"end":m[i]+=g*(n&&a?-1:1);break}return m}async function ro(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:l}=e,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:g=!1,padding:m=0}=se(t,e),x=Ht(m),w=c[g?d==="floating"?"reference":"floating":d],y=Ve(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:f,strategy:l})),h=d==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},C=Ve(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:v,strategy:l}):h);return{top:(y.top-C.top+x.top)/b.y,bottom:(C.bottom-y.bottom+x.bottom)/b.y,left:(y.left-C.left+x.left)/b.x,right:(C.right-y.right+x.right)/b.x}}const io=50,so=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:ro},l=await(i.isRTL==null?void 0:i.isRTL(t));let a=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:d}=At(a,o,l),g=o,m=0;const x={};for(let u=0;u<s.length;u++){const w=s[u];if(!w)continue;const{name:y,fn:h}=w,{x:v,y:b,data:C,reset:R}=await h({x:f,y:d,initialPlacement:o,placement:g,strategy:r,middlewareData:x,rects:a,platform:c,elements:{reference:e,floating:t}});f=v??f,d=b??d,x[y]={...x[y],...C},R&&m<io&&(m++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(a=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:d}=At(a,g,l)),u=-1)}return{x:f,y:d,placement:g,strategy:r,middlewareData:x}},co=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:l}=t,{element:a,padding:f=0}=se(e,t)||{};if(a==null)return{};const d=Ht(f),g={x:n,y:o},m=dt(r),x=ut(m),u=await i.getDimensions(a),w=m==="y",y=w?"top":"left",h=w?"bottom":"right",v=w?"clientHeight":"clientWidth",b=s.reference[x]+s.reference[m]-g[m]-s.floating[x],C=g[m]-s.reference[m],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a));let T=R?R[v]:0;(!T||!await(i.isElement==null?void 0:i.isElement(R)))&&(T=c.floating[v]||s.floating[x]);const N=b/2-C/2,W=T/2-u[x]/2-1,L=fe(d[y],W),k=fe(d[h],W),H=L,_=T-u[x]-k,O=T/2-u[x]/2+N,F=Qe(H,O,_),E=!l.arrow&&Ce(r)!=null&&O!==F&&s.reference[x]/2-(O<H?L:k)-u[x]/2<0,I=E?O<H?O-H:O-_:0;return{[m]:g[m]+I,data:{[m]:F,centerOffset:O-F-I,...E&&{alignmentOffset:I}},reset:E}}}),lo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:l,elements:a}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:u=!0,...w}=se(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=ce(r),h=ne(c),v=ce(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),C=g||(v||!u?[He(c)]:Jn(c)),R=x!=="none";!g&&R&&C.push(...no(c,u,x,b));const T=[c,...C],N=await l.detectOverflow(t,w),W=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&W.push(N[y]),d){const O=Zn(r,i,b);W.push(N[O[0]],N[O[1]])}if(L=[...L,{placement:r,overflows:W}],!W.every(O=>O<=0)){var k,H;const O=(((k=s.flip)==null?void 0:k.index)||0)+1,F=T[O];if(F&&(!(d==="alignment"?h!==ne(F):!1)||L.every(A=>ne(A.placement)===h?A.overflows[0]>0:!0)))return{data:{index:O,overflows:L},reset:{placement:F}};let E=(H=L.filter(I=>I.overflows[0]<=0).sort((I,A)=>I.overflows[1]-A.overflows[1])[0])==null?void 0:H.placement;if(!E)switch(m){case"bestFit":{var _;const I=(_=L.filter(A=>{if(R){const V=ne(A.placement);return V===h||V==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(V=>V>0).reduce((V,K)=>V+K,0)]).sort((A,V)=>A[1]-V[1])[0])==null?void 0:_[0];I&&(E=I);break}case"initialPlacement":E=c;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function Pt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Tt(e){return Gn.some(t=>e[t]>=0)}const ao=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=se(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),c=Pt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Tt(c)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),c=Pt(i,n.floating);return{data:{escapedOffsets:c,escaped:Tt(c)}}}default:return{}}}}},Vt=new Set(["left","top"]);async function fo(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ce(n),c=Ce(n),l=ne(n)==="y",a=Vt.has(i)?-1:1,f=s&&l?-1:1,d=se(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof x=="number"&&(m=c==="end"?x*-1:x),l?{x:m*f,y:g*a}:{x:g*a,y:m*f}}const uo=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=t,l=await fo(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:i}}}}},po=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x:h,y:v}=y;return{x:h,y:v}}},...a}=se(e,t),f={x:n,y:o},d=await s.detectOverflow(t,a),g=ne(ce(r)),m=ft(g);let x=f[m],u=f[g];if(i){const y=m==="y"?"top":"left",h=m==="y"?"bottom":"right",v=x+d[y],b=x-d[h];x=Qe(v,x,b)}if(c){const y=g==="y"?"top":"left",h=g==="y"?"bottom":"right",v=u+d[y],b=u-d[h];u=Qe(v,u,b)}const w=l.fn({...t,[m]:x,[g]:u});return{...w,data:{x:w.x-n,y:w.y-o,enabled:{[m]:i,[g]:c}}}}}},mo=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:l=!0,crossAxis:a=!0}=se(e,t),f={x:n,y:o},d=ne(r),g=ft(d);let m=f[g],x=f[d];const u=se(c,t),w=typeof u=="number"?{mainAxis:u,crossAxis:0}:{mainAxis:0,crossAxis:0,...u};if(l){const v=g==="y"?"height":"width",b=s.reference[g]-s.floating[v]+w.mainAxis,C=s.reference[g]+s.reference[v]-w.mainAxis;m<b?m=b:m>C&&(m=C)}if(a){var y,h;const v=g==="y"?"width":"height",b=Vt.has(ce(r)),C=s.reference[d]-s.floating[v]+(b&&((y=i.offset)==null?void 0:y[d])||0)+(b?0:w.crossAxis),R=s.reference[d]+s.reference[v]+(b?0:((h=i.offset)==null?void 0:h[d])||0)-(b?w.crossAxis:0);x<C?x=C:x>R&&(x=R)}return{[g]:m,[d]:x}}}},ho=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:c}=t,{apply:l=()=>{},...a}=se(e,t),f=await i.detectOverflow(t,a),d=ce(r),g=Ce(r),m=ne(r)==="y",{width:x,height:u}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(y=d,w=g==="end"?"top":"bottom");const h=u-f.top-f.bottom,v=x-f.left-f.right,b=fe(u-f[w],h),C=fe(x-f[y],v),R=!t.middlewareData.shift;let T=b,N=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=v),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=h),R&&!g){const L=G(f.left,0),k=G(f.right,0),H=G(f.top,0),_=G(f.bottom,0);m?N=x-2*(L!==0||k!==0?L+k:G(f.left,f.right)):T=u-2*(H!==0||_!==0?H+_:G(f.top,f.bottom))}await l({...t,availableWidth:N,availableHeight:T});const W=await i.getDimensions(c.floating);return x!==W.width||u!==W.height?{reset:{rects:!0}}:{}}}};function Fe(){return typeof window<"u"}function Re(e){return Bt(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function re(e){var t;return(t=(Bt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bt(e){return Fe()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return Fe()?e instanceof Element||e instanceof q(e).Element:!1}function le(e){return Fe()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Et(e){return!Fe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function Me(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function go(e){return/^(table|td|th)$/.test(Re(e))}function $e(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xo=/transform|translate|scale|rotate|perspective|filter/,wo=/paint|layout|strict|content/,ge=e=>!!e&&e!=="none";let Ge;function pt(e){const t=Q(e)?ee(e):e;return ge(t.transform)||ge(t.translate)||ge(t.scale)||ge(t.rotate)||ge(t.perspective)||!mt()&&(ge(t.backdropFilter)||ge(t.filter))||xo.test(t.willChange||"")||wo.test(t.contain||"")}function vo(e){let t=ue(e);for(;le(t)&&!be(t);){if(pt(t))return t;if($e(t))return null;t=ue(t)}return null}function mt(){return Ge==null&&(Ge=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ge}function be(e){return/^(html|body|#document)$/.test(Re(e))}function ee(e){return q(e).getComputedStyle(e)}function ze(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ue(e){if(Re(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Et(e)&&e.host||re(e);return Et(t)?t.host:t}function Wt(e){const t=ue(e);return be(t)?e.ownerDocument?e.ownerDocument.body:e.body:le(t)&&Me(t)?t:Wt(t)}function _e(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Wt(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=q(r);if(s){const c=tt(i);return t.concat(i,i.visualViewport||[],Me(r)?r:[],c&&n?_e(c):[])}else return t.concat(r,_e(r,[],n))}function tt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ft(e){const t=ee(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=le(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,c=ke(n)!==s||ke(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function ht(e){return Q(e)?e:e.contextElement}function Se(e){const t=ht(e);if(!le(t))return oe(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Ft(t);let i=(s?ke(n.width):n.width)/o,c=(s?ke(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const yo=oe(0);function $t(e){const t=q(e);return!mt()||!t.visualViewport?yo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function So(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function xe(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=ht(e);let i=oe(1);t&&(o?Q(o)&&(i=Se(o)):i=Se(e));const c=So(s,n,o)?$t(s):oe(0);let l=(r.left+c.x)/i.x,a=(r.top+c.y)/i.y,f=r.width/i.x,d=r.height/i.y;if(s){const g=q(s),m=o&&Q(o)?q(o):o;let x=g,u=tt(x);for(;u&&o&&m!==x;){const w=Se(u),y=u.getBoundingClientRect(),h=ee(u),v=y.left+(u.clientLeft+parseFloat(h.paddingLeft))*w.x,b=y.top+(u.clientTop+parseFloat(h.paddingTop))*w.y;l*=w.x,a*=w.y,f*=w.x,d*=w.y,l+=v,a+=b,x=q(u),u=tt(x)}}return Ve({width:f,height:d,x:l,y:a})}function Ue(e,t){const n=ze(e).scrollLeft;return t?t.left+n:xe(re(e)).left+n}function zt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ue(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function bo(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=re(o),c=t?$e(t.floating):!1;if(o===i||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=oe(1);const f=oe(0),d=le(o);if((d||!d&&!s)&&((Re(o)!=="body"||Me(i))&&(l=ze(o)),d)){const m=xe(o);a=Se(o),f.x=m.x+o.clientLeft,f.y=m.y+o.clientTop}const g=i&&!d&&!s?zt(i,l):oe(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+f.x+g.x,y:n.y*a.y-l.scrollTop*a.y+f.y+g.y}}function Co(e){return Array.from(e.getClientRects())}function Ro(e){const t=re(e),n=ze(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ue(e);const c=-n.scrollTop;return ee(o).direction==="rtl"&&(i+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Ot=25;function Ao(e,t){const n=q(e),o=re(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,l=0;if(r){s=r.width,i=r.height;const f=mt();(!f||f&&t==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}const a=Ue(o);if(a<=0){const f=o.ownerDocument,d=f.body,g=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(o.clientWidth-d.clientWidth-m);x<=Ot&&(s-=x)}else a<=Ot&&(s+=a);return{width:s,height:i,x:c,y:l}}function Po(e,t){const n=xe(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=le(e)?Se(e):oe(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,a=o*s.y;return{width:i,height:c,x:l,y:a}}function It(e,t,n){let o;if(t==="viewport")o=Ao(e,n);else if(t==="document")o=Ro(re(e));else if(Q(t))o=Po(t,n);else{const r=$t(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ve(o)}function Ut(e,t){const n=ue(e);return n===t||!Q(n)||be(n)?!1:ee(n).position==="fixed"||Ut(n,t)}function To(e,t){const n=t.get(e);if(n)return n;let o=_e(e,[],!1).filter(c=>Q(c)&&Re(c)!=="body"),r=null;const s=ee(e).position==="fixed";let i=s?ue(e):e;for(;Q(i)&&!be(i);){const c=ee(i),l=pt(i);!l&&c.position==="fixed"&&(r=null),(s?!l&&!r:!l&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Me(i)&&!l&&Ut(e,i))?o=o.filter(f=>f!==i):r=c,i=ue(i)}return t.set(e,o),o}function Eo(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?$e(t)?[]:To(t,this._c):[].concat(n),o],c=It(t,i[0],r);let l=c.top,a=c.right,f=c.bottom,d=c.left;for(let g=1;g<i.length;g++){const m=It(t,i[g],r);l=G(m.top,l),a=fe(m.right,a),f=fe(m.bottom,f),d=G(m.left,d)}return{width:a-d,height:f-l,x:d,y:l}}function Oo(e){const{width:t,height:n}=Ft(e);return{width:t,height:n}}function Io(e,t,n){const o=le(t),r=re(t),s=n==="fixed",i=xe(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=oe(0);function a(){l.x=Ue(r)}if(o||!o&&!s)if((Re(t)!=="body"||Me(r))&&(c=ze(t)),o){const m=xe(t,!0,s,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else r&&a();s&&!o&&r&&a();const f=r&&!o&&!s?zt(r,c):oe(0),d=i.left+c.scrollLeft-l.x-f.x,g=i.top+c.scrollTop-l.y-f.y;return{x:d,y:g,width:i.width,height:i.height}}function qe(e){return ee(e).position==="static"}function Nt(e,t){if(!le(e)||ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return re(e)===n&&(n=n.ownerDocument.body),n}function Kt(e,t){const n=q(e);if($e(e))return n;if(!le(e)){let r=ue(e);for(;r&&!be(r);){if(Q(r)&&!qe(r))return r;r=ue(r)}return n}let o=Nt(e,t);for(;o&&go(o)&&qe(o);)o=Nt(o,t);return o&&be(o)&&qe(o)&&!pt(o)?n:o||vo(e)||n}const No=async function(e){const t=this.getOffsetParent||Kt,n=this.getDimensions,o=await n(e.floating);return{reference:Io(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function _o(e){return ee(e).direction==="rtl"}const Mo={convertOffsetParentRelativeRectToViewportRelativeRect:bo,getDocumentElement:re,getClippingRect:Eo,getOffsetParent:Kt,getElementRects:No,getClientRects:Co,getDimensions:Oo,getScale:Se,isElement:Q,isRTL:_o};function Yt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Do(e,t){let n=null,o;const r=re(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const a=e.getBoundingClientRect(),{left:f,top:d,width:g,height:m}=a;if(c||t(),!g||!m)return;const x=Le(d),u=Le(r.clientWidth-(f+g)),w=Le(r.clientHeight-(d+m)),y=Le(f),v={rootMargin:-x+"px "+-u+"px "+-w+"px "+-y+"px",threshold:G(0,fe(1,l))||1};let b=!0;function C(R){const T=R[0].intersectionRatio;if(T!==l){if(!b)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Yt(a,e.getBoundingClientRect())&&i(),b=!1}try{n=new IntersectionObserver(C,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return i(!0),s}function Lo(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=ht(e),f=r||s?[...a?_e(a):[],...t?_e(t):[]]:[];f.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=a&&c?Do(a,n):null;let g=-1,m=null;i&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===a&&m&&t&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),a&&!l&&m.observe(a),t&&m.observe(t));let x,u=l?xe(e):null;l&&w();function w(){const y=xe(e);u&&!Yt(u,y)&&n(),u=y,x=requestAnimationFrame(w)}return n(),()=>{var y;f.forEach(h=>{r&&h.removeEventListener("scroll",n),s&&h.removeEventListener("resize",n)}),d==null||d(),(y=m)==null||y.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const jo=uo,ko=po,Ho=lo,Vo=ho,Bo=ao,_t=co,Wo=mo,Fo=(e,t,n)=>{const o=new Map,r={platform:Mo,...n},s={...r.platform,_c:o};return so(e,t,{...r,platform:s})};var $o=typeof document<"u",zo=function(){},je=$o?p.useLayoutEffect:zo;function Be(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Be(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Be(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Xt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mt(e,t){const n=Xt(e);return Math.round(t*n)/n}function Ze(e){const t=p.useRef(e);return je(()=>{t.current=e}),t}function Uo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:l,open:a}=e,[f,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,m]=p.useState(o);Be(g,o)||m(o);const[x,u]=p.useState(null),[w,y]=p.useState(null),h=p.useCallback(A=>{A!==R.current&&(R.current=A,u(A))},[]),v=p.useCallback(A=>{A!==T.current&&(T.current=A,y(A))},[]),b=s||x,C=i||w,R=p.useRef(null),T=p.useRef(null),N=p.useRef(f),W=l!=null,L=Ze(l),k=Ze(r),H=Ze(a),_=p.useCallback(()=>{if(!R.current||!T.current)return;const A={placement:t,strategy:n,middleware:g};k.current&&(A.platform=k.current),Fo(R.current,T.current,A).then(V=>{const K={...V,isPositioned:H.current!==!1};O.current&&!Be(N.current,K)&&(N.current=K,lt.flushSync(()=>{d(K)}))})},[g,t,n,k,H]);je(()=>{a===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[a]);const O=p.useRef(!1);je(()=>(O.current=!0,()=>{O.current=!1}),[]),je(()=>{if(b&&(R.current=b),C&&(T.current=C),b&&C){if(L.current)return L.current(b,C,_);_()}},[b,C,_,L,W]);const F=p.useMemo(()=>({reference:R,floating:T,setReference:h,setFloating:v}),[h,v]),E=p.useMemo(()=>({reference:b,floating:C}),[b,C]),I=p.useMemo(()=>{const A={position:n,left:0,top:0};if(!E.floating)return A;const V=Mt(E.floating,f.x),K=Mt(E.floating,f.y);return c?{...A,transform:"translate("+V+"px, "+K+"px)",...Xt(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:K}},[n,c,E.floating,f.x,f.y]);return p.useMemo(()=>({...f,update:_,refs:F,elements:E,floatingStyles:I}),[f,_,F,E,I])}const Ko=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?_t({element:o.current,padding:r}).fn(n):{}:o?_t({element:o,padding:r}).fn(n):{}}}},Yo=(e,t)=>{const n=jo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xo=(e,t)=>{const n=ko(e);return{name:n.name,fn:n.fn,options:[e,t]}},Go=(e,t)=>({fn:Wo(e).fn,options:[e,t]}),qo=(e,t)=>{const n=Ho(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zo=(e,t)=>{const n=Vo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jo=(e,t)=>{const n=Bo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qo=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}};var er="Arrow",Gt=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return S.jsx(z.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});Gt.displayName=er;var tr=Gt;function nr(e){const[t,n]=p.useState(void 0);return J(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let i,c;if("borderBoxSize"in s){const l=s.borderBoxSize,a=Array.isArray(l)?l[0]:l;i=a.inlineSize,c=a.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var gt="Popper",[qt,Zt]=ct(gt),[or,Jt]=qt(gt),Qt=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return S.jsx(or,{scope:t,anchor:o,onAnchorChange:r,children:n})};Qt.displayName=gt;var en="PopperAnchor",tn=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Jt(en,n),i=p.useRef(null),c=Y(t,i),l=p.useRef(null);return p.useEffect(()=>{const a=l.current;l.current=(o==null?void 0:o.current)||i.current,a!==l.current&&s.onAnchorChange(l.current)}),o?null:S.jsx(z.div,{...r,ref:c})});tn.displayName=en;var xt="PopperContent",[rr,ir]=qt(xt),nn=p.forwardRef((e,t)=>{var P,B,U,j,M,D;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:a=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:g=!1,updatePositionStrategy:m="optimized",onPlaced:x,...u}=e,w=Jt(xt,n),[y,h]=p.useState(null),v=Y(t,X=>h(X)),[b,C]=p.useState(null),R=nr(b),T=(R==null?void 0:R.width)??0,N=(R==null?void 0:R.height)??0,W=o+(s!=="center"?"-"+s:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(a)?a:[a],H=k.length>0,_={padding:L,boundary:k.filter(cr),altBoundary:H},{refs:O,floatingStyles:F,placement:E,isPositioned:I,middlewareData:A}=Uo({strategy:"fixed",placement:W,whileElementsMounted:(...X)=>Lo(...X,{animationFrame:m==="always"}),elements:{reference:w.anchor},middleware:[Yo({mainAxis:r+N,alignmentAxis:i}),l&&Xo({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Go():void 0,..._}),l&&qo({..._}),Zo({..._,apply:({elements:X,rects:te,availableWidth:Ee,availableHeight:Oe})=>{const{width:Ie,height:Ln}=te.reference,De=X.floating.style;De.setProperty("--radix-popper-available-width",`${Ee}px`),De.setProperty("--radix-popper-available-height",`${Oe}px`),De.setProperty("--radix-popper-anchor-width",`${Ie}px`),De.setProperty("--radix-popper-anchor-height",`${Ln}px`)}}),b&&Qo({element:b,padding:c}),lr({arrowWidth:T,arrowHeight:N}),g&&Jo({strategy:"referenceHidden",..._})]}),[V,K]=sn(E),ie=kt(x);J(()=>{I&&(ie==null||ie())},[I,ie]);const Pe=(P=A.arrow)==null?void 0:P.x,Te=(B=A.arrow)==null?void 0:B.y,ae=((U=A.arrow)==null?void 0:U.centerOffset)!==0,[ye,me]=p.useState();return J(()=>{y&&me(window.getComputedStyle(y).zIndex)},[y]),S.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:I?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ye,"--radix-popper-transform-origin":[(j=A.transformOrigin)==null?void 0:j.x,(M=A.transformOrigin)==null?void 0:M.y].join(" "),...((D=A.hide)==null?void 0:D.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:S.jsx(rr,{scope:n,placedSide:V,onArrowChange:C,arrowX:Pe,arrowY:Te,shouldHideArrow:ae,children:S.jsx(z.div,{"data-side":V,"data-align":K,...u,ref:v,style:{...u.style,animation:I?void 0:"none"}})})})});nn.displayName=xt;var on="PopperArrow",sr={top:"bottom",right:"left",bottom:"top",left:"right"},rn=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=ir(on,o),i=sr[s.placedSide];return S.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:S.jsx(tr,{...r,ref:n,style:{...r.style,display:"block"}})})});rn.displayName=on;function cr(e){return e!==null}var lr=e=>({name:"transformOrigin",options:e,fn(t){var w,y,h;const{placement:n,rects:o,middlewareData:r}=t,i=((w=r.arrow)==null?void 0:w.centerOffset)!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[a,f]=sn(n),d={start:"0%",center:"50%",end:"100%"}[f],g=(((y=r.arrow)==null?void 0:y.x)??0)+c/2,m=(((h=r.arrow)==null?void 0:h.y)??0)+l/2;let x="",u="";return a==="bottom"?(x=i?d:`${g}px`,u=`${-l}px`):a==="top"?(x=i?d:`${g}px`,u=`${o.floating.height+l}px`):a==="right"?(x=`${-l}px`,u=i?d:`${m}px`):a==="left"&&(x=`${o.floating.width+l}px`,u=i?d:`${m}px`),{data:{x,y:u}}}});function sn(e){const[t,n="center"]=e.split("-");return[t,n]}var ar=Qt,fr=tn,ur=nn,dr=rn;function pr(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var cn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mr="VisuallyHidden",hr=p.forwardRef((e,t)=>S.jsx(z.span,{...e,ref:t,style:{...cn,...e.style}}));hr.displayName=mr;var gr=[" ","Enter","ArrowUp","ArrowDown"],xr=[" ","Enter"],we="Select",[Ke,Ye,wr]=Kn(we),[Ae]=ct(we,[wr,Zt]),Xe=Zt(),[vr,de]=Ae(we),[yr,Sr]=Ae(we),ln=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:i,defaultValue:c,onValueChange:l,dir:a,name:f,autoComplete:d,disabled:g,required:m,form:x}=e,u=Xe(t),[w,y]=p.useState(null),[h,v]=p.useState(null),[b,C]=p.useState(!1),R=Xn(a),[T,N]=yt({prop:o,defaultProp:r??!1,onChange:s,caller:we}),[W,L]=yt({prop:i,defaultProp:c,onChange:l,caller:we}),k=p.useRef(null),H=w?x||!!w.closest("form"):!0,[_,O]=p.useState(new Set),F=Array.from(_).map(E=>E.props.value).join(";");return S.jsx(ar,{...u,children:S.jsxs(vr,{required:m,scope:t,trigger:w,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:at(),value:W,onValueChange:L,open:T,onOpenChange:N,dir:R,triggerPointerDownPosRef:k,disabled:g,children:[S.jsx(Ke.Provider,{scope:t,children:S.jsx(yr,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(E=>{O(I=>new Set(I).add(E))},[]),onNativeOptionRemove:p.useCallback(E=>{O(I=>{const A=new Set(I);return A.delete(E),A})},[]),children:n})}),H?S.jsxs(In,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:W,onChange:E=>L(E.target.value),disabled:g,form:x,children:[W===void 0?S.jsx("option",{value:""}):null,Array.from(_)]},F):null]})})};ln.displayName=we;var an="SelectTrigger",fn=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=Xe(n),i=de(an,n),c=i.disabled||o,l=Y(t,i.onTriggerChange),a=Ye(n),f=p.useRef("touch"),[d,g,m]=_n(u=>{const w=a().filter(v=>!v.disabled),y=w.find(v=>v.value===i.value),h=Mn(w,u,y);h!==void 0&&i.onValueChange(h.value)}),x=u=>{c||(i.onOpenChange(!0),m()),u&&(i.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return S.jsx(fr,{asChild:!0,...s,children:S.jsx(z.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Nn(i.value)?"":void 0,...r,ref:l,onClick:$(r.onClick,u=>{u.currentTarget.focus(),f.current!=="mouse"&&x(u)}),onPointerDown:$(r.onPointerDown,u=>{f.current=u.pointerType;const w=u.target;w.hasPointerCapture(u.pointerId)&&w.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(x(u),u.preventDefault())}),onKeyDown:$(r.onKeyDown,u=>{const w=d.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&g(u.key),!(w&&u.key===" ")&&gr.includes(u.key)&&(x(),u.preventDefault())})})})});fn.displayName=an;var un="SelectValue",dn=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:i="",...c}=e,l=de(un,n),{onValueNodeHasChildrenChange:a}=l,f=s!==void 0,d=Y(t,l.onValueNodeChange);return J(()=>{a(f)},[a,f]),S.jsx(z.span,{...c,ref:d,style:{pointerEvents:"none"},children:Nn(l.value)?S.jsx(S.Fragment,{children:i}):s})});dn.displayName=un;var br="SelectIcon",pn=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return S.jsx(z.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});pn.displayName=br;var Cr="SelectPortal",mn=e=>S.jsx(kn,{asChild:!0,...e});mn.displayName=Cr;var ve="SelectContent",hn=p.forwardRef((e,t)=>{const n=de(ve,e.__scopeSelect),[o,r]=p.useState();if(J(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?lt.createPortal(S.jsx(gn,{scope:e.__scopeSelect,children:S.jsx(Ke.Slot,{scope:e.__scopeSelect,children:S.jsx("div",{children:e.children})})}),s):null}return S.jsx(xn,{...e,ref:t})});hn.displayName=ve;var Z=10,[gn,pe]=Ae(ve),Rr="SelectContentImpl",Ar=Je("SelectContent.RemoveScroll"),xn=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:i,side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:x,hideWhenDetached:u,avoidCollisions:w,...y}=e,h=de(ve,n),[v,b]=p.useState(null),[C,R]=p.useState(null),T=Y(t,P=>b(P)),[N,W]=p.useState(null),[L,k]=p.useState(null),H=Ye(n),[_,O]=p.useState(!1),F=p.useRef(!1);p.useEffect(()=>{if(v)return Hn(v)},[v]),Vn();const E=p.useCallback(P=>{const[B,...U]=H().map(D=>D.ref.current),[j]=U.slice(-1),M=document.activeElement;for(const D of P)if(D===M||(D==null||D.scrollIntoView({block:"nearest"}),D===B&&C&&(C.scrollTop=0),D===j&&C&&(C.scrollTop=C.scrollHeight),D==null||D.focus(),document.activeElement!==M))return},[H,C]),I=p.useCallback(()=>E([N,v]),[E,N,v]);p.useEffect(()=>{_&&I()},[_,I]);const{onOpenChange:A,triggerPointerDownPosRef:V}=h;p.useEffect(()=>{if(v){let P={x:0,y:0};const B=j=>{var M,D;P={x:Math.abs(Math.round(j.pageX)-(((M=V.current)==null?void 0:M.x)??0)),y:Math.abs(Math.round(j.pageY)-(((D=V.current)==null?void 0:D.y)??0))}},U=j=>{P.x<=10&&P.y<=10?j.preventDefault():v.contains(j.target)||A(!1),document.removeEventListener("pointermove",B),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",B),document.addEventListener("pointerup",U,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",U,{capture:!0})}}},[v,A,V]),p.useEffect(()=>{const P=()=>A(!1);return window.addEventListener("blur",P),window.addEventListener("resize",P),()=>{window.removeEventListener("blur",P),window.removeEventListener("resize",P)}},[A]);const[K,ie]=_n(P=>{const B=H().filter(M=>!M.disabled),U=B.find(M=>M.ref.current===document.activeElement),j=Mn(B,P,U);j&&setTimeout(()=>j.ref.current.focus())}),Pe=p.useCallback((P,B,U)=>{const j=!F.current&&!U;(h.value!==void 0&&h.value===B||j)&&(W(P),j&&(F.current=!0))},[h.value]),Te=p.useCallback(()=>v==null?void 0:v.focus(),[v]),ae=p.useCallback((P,B,U)=>{const j=!F.current&&!U;(h.value!==void 0&&h.value===B||j)&&k(P)},[h.value]),ye=o==="popper"?nt:wn,me=ye===nt?{side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:x,hideWhenDetached:u,avoidCollisions:w}:{};return S.jsx(gn,{scope:n,content:v,viewport:C,onViewportChange:R,itemRefCallback:Pe,selectedItem:N,onItemLeave:Te,itemTextRefCallback:ae,focusSelectedItem:I,selectedItemText:L,position:o,isPositioned:_,searchRef:K,children:S.jsx(Bn,{as:Ar,allowPinchZoom:!0,children:S.jsx(Wn,{asChild:!0,trapped:h.open,onMountAutoFocus:P=>{P.preventDefault()},onUnmountAutoFocus:$(r,P=>{var B;(B=h.trigger)==null||B.focus({preventScroll:!0}),P.preventDefault()}),children:S.jsx(Fn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:P=>P.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:S.jsx(ye,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:P=>P.preventDefault(),...y,...me,onPlaced:()=>O(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:$(y.onKeyDown,P=>{const B=P.ctrlKey||P.altKey||P.metaKey;if(P.key==="Tab"&&P.preventDefault(),!B&&P.key.length===1&&ie(P.key),["ArrowUp","ArrowDown","Home","End"].includes(P.key)){let j=H().filter(M=>!M.disabled).map(M=>M.ref.current);if(["ArrowUp","End"].includes(P.key)&&(j=j.slice().reverse()),["ArrowUp","ArrowDown"].includes(P.key)){const M=P.target,D=j.indexOf(M);j=j.slice(D+1)}setTimeout(()=>E(j)),P.preventDefault()}})})})})})})});xn.displayName=Rr;var Pr="SelectItemAlignedPosition",wn=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=de(ve,n),i=pe(ve,n),[c,l]=p.useState(null),[a,f]=p.useState(null),d=Y(t,T=>f(T)),g=Ye(n),m=p.useRef(!1),x=p.useRef(!0),{viewport:u,selectedItem:w,selectedItemText:y,focusSelectedItem:h}=i,v=p.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&a&&u&&w&&y){const T=s.trigger.getBoundingClientRect(),N=a.getBoundingClientRect(),W=s.valueNode.getBoundingClientRect(),L=y.getBoundingClientRect();if(s.dir!=="rtl"){const M=L.left-N.left,D=W.left-M,X=T.left-D,te=T.width+X,Ee=Math.max(te,N.width),Oe=window.innerWidth-Z,Ie=bt(D,[Z,Math.max(Z,Oe-Ee)]);c.style.minWidth=te+"px",c.style.left=Ie+"px"}else{const M=N.right-L.right,D=window.innerWidth-W.right-M,X=window.innerWidth-T.right-D,te=T.width+X,Ee=Math.max(te,N.width),Oe=window.innerWidth-Z,Ie=bt(D,[Z,Math.max(Z,Oe-Ee)]);c.style.minWidth=te+"px",c.style.right=Ie+"px"}const k=g(),H=window.innerHeight-Z*2,_=u.scrollHeight,O=window.getComputedStyle(a),F=parseInt(O.borderTopWidth,10),E=parseInt(O.paddingTop,10),I=parseInt(O.borderBottomWidth,10),A=parseInt(O.paddingBottom,10),V=F+E+_+A+I,K=Math.min(w.offsetHeight*5,V),ie=window.getComputedStyle(u),Pe=parseInt(ie.paddingTop,10),Te=parseInt(ie.paddingBottom,10),ae=T.top+T.height/2-Z,ye=H-ae,me=w.offsetHeight/2,P=w.offsetTop+me,B=F+E+P,U=V-B;if(B<=ae){const M=k.length>0&&w===k[k.length-1].ref.current;c.style.bottom="0px";const D=a.clientHeight-u.offsetTop-u.offsetHeight,X=Math.max(ye,me+(M?Te:0)+D+I),te=B+X;c.style.height=te+"px"}else{const M=k.length>0&&w===k[0].ref.current;c.style.top="0px";const X=Math.max(ae,F+u.offsetTop+(M?Pe:0)+me)+U;c.style.height=X+"px",u.scrollTop=B-ae+u.offsetTop}c.style.margin=`${Z}px 0`,c.style.minHeight=K+"px",c.style.maxHeight=H+"px",o==null||o(),requestAnimationFrame(()=>m.current=!0)}},[g,s.trigger,s.valueNode,c,a,u,w,y,s.dir,o]);J(()=>v(),[v]);const[b,C]=p.useState();J(()=>{a&&C(window.getComputedStyle(a).zIndex)},[a]);const R=p.useCallback(T=>{T&&x.current===!0&&(v(),h==null||h(),x.current=!1)},[v,h]);return S.jsx(Er,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:R,children:S.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:S.jsx(z.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});wn.displayName=Pr;var Tr="SelectPopperPosition",nt=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=Z,...s}=e,i=Xe(n);return S.jsx(ur,{...i,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nt.displayName=Tr;var[Er,wt]=Ae(ve,{}),ot="SelectViewport",vn=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=pe(ot,n),i=wt(ot,n),c=Y(t,s.onViewportChange),l=p.useRef(0);return S.jsxs(S.Fragment,{children:[S.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),S.jsx(Ke.Slot,{scope:n,children:S.jsx(z.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:$(r.onScroll,a=>{const f=a.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&d){const m=Math.abs(l.current-f.scrollTop);if(m>0){const x=window.innerHeight-Z*2,u=parseFloat(d.style.minHeight),w=parseFloat(d.style.height),y=Math.max(u,w);if(y<x){const h=y+m,v=Math.min(x,h),b=h-v;d.style.height=v+"px",d.style.bottom==="0px"&&(f.scrollTop=b>0?b:0,d.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});vn.displayName=ot;var yn="SelectGroup",[Or,Ir]=Ae(yn),Nr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=at();return S.jsx(Or,{scope:n,id:r,children:S.jsx(z.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Nr.displayName=yn;var Sn="SelectLabel",_r=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ir(Sn,n);return S.jsx(z.div,{id:r.id,...o,ref:t})});_r.displayName=Sn;var We="SelectItem",[Mr,bn]=Ae(We),Cn=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...i}=e,c=de(We,n),l=pe(We,n),a=c.value===o,[f,d]=p.useState(s??""),[g,m]=p.useState(!1),x=Y(t,h=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,h,o,r)}),u=at(),w=p.useRef("touch"),y=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return S.jsx(Mr,{scope:n,value:o,disabled:r,textId:u,isSelected:a,onItemTextChange:p.useCallback(h=>{d(v=>v||((h==null?void 0:h.textContent)??"").trim())},[]),children:S.jsx(Ke.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:S.jsx(z.div,{role:"option","aria-labelledby":u,"data-highlighted":g?"":void 0,"aria-selected":a&&g,"data-state":a?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:x,onFocus:$(i.onFocus,()=>m(!0)),onBlur:$(i.onBlur,()=>m(!1)),onClick:$(i.onClick,()=>{w.current!=="mouse"&&y()}),onPointerUp:$(i.onPointerUp,()=>{w.current==="mouse"&&y()}),onPointerDown:$(i.onPointerDown,h=>{w.current=h.pointerType}),onPointerMove:$(i.onPointerMove,h=>{var v;w.current=h.pointerType,r?(v=l.onItemLeave)==null||v.call(l):w.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$(i.onPointerLeave,h=>{var v;h.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:$(i.onKeyDown,h=>{var b;((b=l.searchRef)==null?void 0:b.current)!==""&&h.key===" "||(xr.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});Cn.displayName=We;var Ne="SelectItemText",Rn=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,i=de(Ne,n),c=pe(Ne,n),l=bn(Ne,n),a=Sr(Ne,n),[f,d]=p.useState(null),g=Y(t,y=>d(y),l.onItemTextChange,y=>{var h;return(h=c.itemTextRefCallback)==null?void 0:h.call(c,y,l.value,l.disabled)}),m=f==null?void 0:f.textContent,x=p.useMemo(()=>S.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:u,onNativeOptionRemove:w}=a;return J(()=>(u(x),()=>w(x)),[u,w,x]),S.jsxs(S.Fragment,{children:[S.jsx(z.span,{id:l.textId,...s,ref:g}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?lt.createPortal(s.children,i.valueNode):null]})});Rn.displayName=Ne;var An="SelectItemIndicator",Pn=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return bn(An,n).isSelected?S.jsx(z.span,{"aria-hidden":!0,...o,ref:t}):null});Pn.displayName=An;var rt="SelectScrollUpButton",Tn=p.forwardRef((e,t)=>{const n=pe(rt,e.__scopeSelect),o=wt(rt,e.__scopeSelect),[r,s]=p.useState(!1),i=Y(t,o.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let c=function(){const a=l.scrollTop>0;s(a)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?S.jsx(On,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Tn.displayName=rt;var it="SelectScrollDownButton",En=p.forwardRef((e,t)=>{const n=pe(it,e.__scopeSelect),o=wt(it,e.__scopeSelect),[r,s]=p.useState(!1),i=Y(t,o.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let c=function(){const a=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<a;s(f)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?S.jsx(On,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});En.displayName=it;var On=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=pe("SelectScrollButton",n),i=p.useRef(null),c=Ye(n),l=p.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return p.useEffect(()=>()=>l(),[l]),J(()=>{var f;const a=c().find(d=>d.ref.current===document.activeElement);(f=a==null?void 0:a.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),S.jsx(z.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:$(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:$(r.onPointerMove,()=>{var a;(a=s.onItemLeave)==null||a.call(s),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:$(r.onPointerLeave,()=>{l()})})}),Dr="SelectSeparator",Lr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return S.jsx(z.div,{"aria-hidden":!0,...o,ref:t})});Lr.displayName=Dr;var st="SelectArrow",jr=p.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Xe(n),s=de(st,n),i=pe(st,n);return s.open&&i.position==="popper"?S.jsx(dr,{...r,...o,ref:t}):null});jr.displayName=st;var kr="SelectBubbleInput",In=p.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=p.useRef(null),s=Y(o,r),i=pr(t);return p.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&f){const d=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(d)}},[i,t]),S.jsx(z.select,{...n,style:{...cn,...n.style},ref:s,defaultValue:t})});In.displayName=kr;function Nn(e){return e===""||e===void 0}function _n(e){const t=kt(e),n=p.useRef(""),o=p.useRef(0),r=p.useCallback(i=>{const c=n.current+i;t(c),(function l(a){n.current=a,window.clearTimeout(o.current),a!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=p.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function Mn(e,t,n){const r=t.length>1&&Array.from(t).every(a=>a===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Hr(e,Math.max(s,0));r.length===1&&(i=i.filter(a=>a!==n));const l=i.find(a=>a.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function Hr(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Vr=ln,Br=fn,Wr=dn,Fr=pn,$r=mn,zr=hn,Ur=vn,Kr=Cn,Yr=Rn,Xr=Pn,Gr=Tn,qr=En;const Dn="__radix_empty_value__";function Dt(e){return typeof e=="string"||typeof e=="number"?String(e):p.Children.toArray(e).map(t=>typeof t=="string"||typeof t=="number"?String(t):"").join("")}function Zr(e){return p.Children.toArray(e).flatMap(t=>{if(!p.isValidElement(t))return[];const n=t;if(n.type!=="option")return[];const o=n.props.value??Dt(n.props.children);return[{value:String(o),label:Dt(n.props.children),disabled:n.props.disabled}]})}function Lt(e){return e===""||e===void 0||e===null?Dn:String(e)}function jt(e){return e===Dn?"":e}function ti({label:e,className:t,children:n,...o}){var a;const r=Zr(n),s=Lt(o.value??o.defaultValue??""),i=r.find(f=>f.value===jt(s)),c=(a=r.find(f=>f.value===""))==null?void 0:a.label,l=f=>{var g;const d=jt(f);(g=o.onChange)==null||g.call(o,{target:{value:d},currentTarget:{value:d}})};return S.jsxs("div",{className:"space-y-1.5",children:[e&&S.jsx("label",{className:"block text-sm font-medium text-foreground",children:e}),S.jsxs(Vr,{value:s,onValueChange:l,disabled:o.disabled,name:o.name,children:[S.jsxs(Br,{id:o.id,className:vt("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors","placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),children:[S.jsx(Wr,{placeholder:c,children:i==null?void 0:i.label}),S.jsx(Fr,{asChild:!0,children:S.jsx(St,{className:"h-4 w-4 opacity-50"})})]}),S.jsx($r,{children:S.jsxs(zr,{className:"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-fade-in",children:[S.jsx(Gr,{className:"flex cursor-default items-center justify-center py-1",children:S.jsx(Un,{className:"h-4 w-4"})}),S.jsx(Ur,{className:"p-1",children:r.map(f=>S.jsxs(Kr,{value:Lt(f.value),disabled:f.disabled,className:vt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-accent/10 focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"),children:[S.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:S.jsx(Xr,{children:S.jsx($n,{className:"h-4 w-4"})})}),S.jsx(Yr,{children:f.label})]},`${f.value}-${f.label}`))}),S.jsx(qr,{className:"flex cursor-default items-center justify-center py-1",children:S.jsx(St,{className:"h-4 w-4"})})]})})]})]})}export{ti as S};
|