@aiquants/enrichment-react 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Quants
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @aiquants/enrichment-react
2
+
3
+ React UI components for storage metadata AI enrichment: DegradedSearchBanner, RAGPipelineGraphViewer, SyncStatusMonitor, and QdrantStorageCard.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js >= 18.0.0
8
+ - React >= 18.0.0
9
+ - `@aiquants/enrichment-core`
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pnpm add @aiquants/enrichment-react @aiquants/enrichment-core
15
+ ```
16
+
17
+ ## Exported Components
18
+
19
+ ### 1. `DegradedSearchBanner`
20
+ Non-blocking warning banner shown when search runs in degraded mode (e.g. Qdrant unreachable, BM25 fallback, or circuit breaker open).
21
+ Conforms to non-blocking UX principles with strict `data-*` DOM hooks (`data-testid="degraded-search-banner"`, `data-quality-tier`).
22
+
23
+ ```tsx
24
+ import { DegradedSearchBanner } from "@aiquants/enrichment-react"
25
+
26
+ <DegradedSearchBanner
27
+ metadata={{
28
+ is_degraded: true,
29
+ search_mode: "KEYWORD",
30
+ quality_tier: "DEGRADED_KEYWORD_ONLY",
31
+ degradation_reason: "circuit_breaker_open:vector"
32
+ }}
33
+ onDismiss={() => console.log("Banner dismissed")}
34
+ />
35
+ ```
36
+
37
+ ### 2. `RAGPipelineGraphViewer`
38
+ Interactive DAG pipeline graph viewer visualizing RAG ingestion, chunking, embedding, vector indexing, graph indexing, and synthesis stages with circuit breaker indicators and latency/throughput telemetry.
39
+
40
+ ```tsx
41
+ import { RAGPipelineGraphViewer } from "@aiquants/enrichment-react"
42
+
43
+ <RAGPipelineGraphViewer
44
+ pipelineConfig={{
45
+ enable_summary_generation: true,
46
+ enable_vector_indexing: true,
47
+ enable_graph_indexing: false,
48
+ }}
49
+ circuitBreakerStatus={{ vector: "CLOSED", graph: "OPEN" }}
50
+ onNodeSelect={(nodeId) => console.log("Selected stage:", nodeId)}
51
+ />
52
+ ```
53
+
54
+ ### 3. `SyncStatusMonitor`
55
+ Telemetry monitor and re-enqueue widget displaying SQL Server `sync_status` breakdown (synced, processing, pending, degraded, failed) and individual/bulk retry controls.
56
+
57
+ ```tsx
58
+ import { SyncStatusMonitor } from "@aiquants/enrichment-react"
59
+
60
+ <SyncStatusMonitor
61
+ totalFiles={1250}
62
+ counts={{ SYNCED: 1200, PENDING: 30, EXTRACTING: 10, FAILED_VECTOR: 10 }}
63
+ onRetryAll={() => triggerRetryAll()}
64
+ />
65
+ ```
66
+
67
+ ### 4. `QdrantStorageCard`
68
+ Telemetry card displaying Qdrant vector collections, vector counts, named vector dimensions (`dense`, `sparse`, `image`), health latency, and memory/disk resource utilization.
69
+
70
+ ```tsx
71
+ import { QdrantStorageCard } from "@aiquants/enrichment-react"
72
+
73
+ <QdrantStorageCard
74
+ collections={[
75
+ {
76
+ collection_name: "default_general_dense",
77
+ domain_key: "GENERAL_DOCUMENT",
78
+ points_count: 5000,
79
+ vectors_count: 5000,
80
+ vectors_config: { dense: { size: 1024, distance: "Cosine" } }
81
+ }
82
+ ]}
83
+ health={{ healthy: true, latency_ms: 12 }}
84
+ />
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var Pe=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var ct=(s,i)=>{for(var l in i)Pe(s,l,{get:i[l],enumerable:!0})},pt=(s,i,l,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of dt(i))!lt.call(s,d)&&d!==l&&Pe(s,d,{get:()=>i[d],enumerable:!(r=ot(i,d))||r.enumerable});return s};var mt=s=>pt(Pe({},"__esModule",{value:!0}),s);var Ot={};ct(Ot,{DegradedSearchBanner:()=>Me,DocumentIngestConsole:()=>yt,EnrichmentStrategyBoard:()=>ht,InfrastructureHealthMonitor:()=>_t,MetadataSearchWorkbench:()=>Rt,OntologyStatusCard:()=>Lt,QdrantStorageCard:()=>Tt,RAGPipelineGraphViewer:()=>Pt,REASON_LABELS:()=>ze,SEARCH_MODE_LABELS:()=>Ue,SEARCH_PRESETS:()=>Ve,SyncStatusMonitor:()=>Ft,gateStateOf:()=>Fe,ingestRowAction:()=>Ge});module.exports=mt(Ot);var V=require("react/jsx-runtime"),ze={remote_tiers_unavailable:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002"};function Me({metadata:s,onDismiss:i}){if(!s.is_degraded)return null;let r=(s.degradation_reason??"").split(",").map(d=>d.trim()).filter(d=>d.length>0);return(0,V.jsx)("div",{role:"status","data-testid":"degraded-search-banner","data-quality-tier":s.quality_tier,"data-search-mode":s.search_mode,"data-degraded":"true",style:{padding:"12px 16px",borderRadius:"6px",border:"1px solid #f59e0b",backgroundColor:"#fffbeb",color:"#92400e",marginBottom:"12px"},children:(0,V.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,V.jsxs)("div",{children:[(0,V.jsxs)("p",{"data-testid":"degraded-mode-message",style:{margin:0,fontWeight:600},children:["\u691C\u7D22\u7D50\u679C\u306F\u7E2E\u9000\u30E2\u30FC\u30C9 (",s.search_mode,") \u3067\u53D6\u5F97\u3055\u308C\u3066\u3044\u307E\u3059\u3002"]}),r.length>0&&(0,V.jsx)("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:r.map(d=>(0,V.jsx)("li",{"data-testid":`degraded-reason-${d}`,children:ze[d]??d},d))})]}),i&&(0,V.jsx)("button",{type:"button","data-testid":"degraded-banner-dismiss",onClick:i,"aria-label":"\u9589\u3058\u308B",style:{background:"none",border:"none",cursor:"pointer",color:"#92400e",fontWeight:"bold",fontSize:"14px",padding:"2px 6px"},children:"\u2715"})]})})}var X=require("@aiquants/enrichment-core"),w=require("react"),t=require("react/jsx-runtime"),ut=new Set(X.EnrichmentSyncStatusSchema.options.filter(s=>s.startsWith("FAILED"))),gt=new Set(X.EnrichmentSyncStatusSchema.options);function Ge(s){return s.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:s.syncStatus==="SYNCED"?{kind:"resync"}:ut.has(s.syncStatus)?{kind:"retry"}:gt.has(s.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function qe(s,i,l){let r=s?.find(d=>d.confidentialityLevel===i&&d.capability===l);return r?r.isEnabled:null}var ft={PUBLIC:"\u5168\u516C\u958B",INTERNAL:"\u793E\u5185\u5171\u6709",DEPARTMENT:"\u90E8\u9580\u9650\u5B9A",CONFIDENTIAL:"\u6A5F\u5BC6 - \u65E2\u5B9A",RESTRICTED:"\u691C\u7D22\u5B8C\u5168\u9664\u5916\u30FB\u4FDD\u8B77"},xt=[{key:"GENERAL_DOCUMENT",label:"\u4E00\u822C\u6587\u66F8 (GENERAL_DOCUMENT)"},{key:"CONTRACT_LEGAL",label:"\u5951\u7D04\u66F8\u30FB\u6CD5\u52D9 (CONTRACT_LEGAL)"},{key:"FINANCIAL_REPORT",label:"\u8CA1\u52D9\u8AF8\u8868\u30FB\u6C7A\u7B97\u77ED\u4FE1 (FINANCIAL_REPORT)"},{key:"TECHNICAL_SPEC",label:"\u6280\u8853\u4ED5\u69D8\u66F8\u30FB\u8A2D\u8A08\u66F8 (TECHNICAL_SPEC)"},{key:"DAILY_REPORT",label:"\u696D\u52D9\u65E5\u5831 (DAILY_REPORT)"},{key:"EMAIL_THREAD",label:"\u30E1\u30FC\u30EB\u30B9\u30EC\u30C3\u30C9 (EMAIL_THREAD)"},{key:"MASTER_DATA",label:"\u30DE\u30B9\u30BF\u30C7\u30FC\u30BF (MASTER_DATA)"},{key:"MEDIA_ASSET",label:"\u753B\u50CF\u30FB\u97F3\u58F0\u30E1\u30C7\u30A3\u30A2 (MEDIA_ASSET)"}],bt=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function vt(s){if(s<=0)return"0 B";let i=1024,l=["B","KB","MB","GB"],r=Math.floor(Math.log(s)/Math.log(i));return`${(s/i**r).toFixed(1)} ${l[r]}`}function yt({policies:s,tenantId:i,recentItems:l=[],inspectionResult:r=null,isSubmitting:d=!1,isInspecting:m=!1,onInspectUri:h,onIngestDocument:N,onRetryItem:I}){let k=(0,w.useId)(),_=(0,w.useId)(),b=(0,w.useId)(),f=(0,w.useId)(),S=(0,w.useId)(),L=(0,w.useId)(),B=(0,w.useId)(),$=(0,w.useId)(),[D,M]=(0,w.useState)("gdrive://"),[ne,K]=(0,w.useState)(""),[z,P]=(0,w.useState)(""),[U,j]=(0,w.useState)("CONFIDENTIAL"),[ie,le]=(0,w.useState)("GENERAL_DOCUMENT"),[re,ce]=(0,w.useState)(""),[oe,pe]=(0,w.useState)(""),[Q,Y]=(0,w.useState)([]),[be,me]=(0,w.useState)(""),[ve,ye]=(0,w.useState)("user"),[Z,ee]=(0,w.useState)(1),[te,we]=(0,w.useState)(!1),F=(0,w.useMemo)(()=>({vectorEnabled:qe(s,U,"vector_indexing"),graphEnabled:qe(s,U,"graph_indexing")}),[s,U]),O=(0,w.useMemo)(()=>{let n=z.trim();if(!n)return{valid:!1,error:null};if(!(n.startsWith("file://")||n.startsWith("gdrive://")||n.startsWith("gcs://")))return{valid:!1,error:"\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (file://, gdrive://, gcs://) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"};let A=n.replace(/^(file|gdrive|gcs):\/\//,"");return!A.trim()||A.trim()==="<id>"||A.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:n.includes("..")?{valid:!1,error:"\u76F8\u5BFE\u30D1\u30B9\u8A18\u53F7 (..) \u306B\u3088\u308B\u30D1\u30B9\u30C8\u30E9\u30D0\u30FC\u30B5\u30EB\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002"}:{valid:!0,error:null}},[z]),J=n=>{let g=n.trim(),A=g.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(A)return A[1];let q=g.match(/[?&]id=([a-zA-Z0-9_-]+)/);return q?q[1]:null},ue=n=>{if(M(n),ne.trim()){let g=ne.trim().replace(/^(file|gdrive|gcs):\/\//,"");P(`${n}${g}`)}else P("")},Re=n=>{let g=n.trim();if(!g){K(""),P("");return}let A=J(g);if(A){M("gdrive://"),K(A),P(`gdrive://${A}`);return}if(g.startsWith("gdrive://")){M("gdrive://");let q=g.replace(/^gdrive:\/\//,"");K(q),P(g);return}if(g.startsWith("file://")){M("file://");let q=g.replace(/^file:\/\//,"");K(q),P(g);return}if(g.startsWith("gcs://")){M("gcs://");let q=g.replace(/^gcs:\/\//,"");K(q),P(g);return}if(g.includes("://")){K(n),P(g);return}K(n),P(`${D}${g}`)},he=n=>{switch(n){case"gdrive://":return"1EXAMPLEFILEID0000000000000000000 (\u30D5\u30A1\u30A4\u30EB ID \u307E\u305F\u306F\u5171\u6709\u30EA\u30F3\u30AF)";case"file://":return"/srv/documents/specification.md (\u7D76\u5BFE\u30D1\u30B9)";case"gcs://":return"my-bucket/documents/report.pdf (\u30D0\u30B1\u30C3\u30C8\u540D/\u30D1\u30B9)"}},Ne=()=>{let n=be.trim();n&&(Q.some(g=>g.labelKey===n)||(Y(g=>[...g,{labelKey:n,category:ve,confidenceScore:Number(Z.toFixed(2))}]),me("")))},Ae=n=>{Q.some(g=>g.labelKey===n)||Y(g=>[...g,{labelKey:n,category:"domain",confidenceScore:1}])},Le=n=>{Y(g=>g.filter(A=>A.labelKey!==n))},Se=n=>{if(n.preventDefault(),!O.valid)return;let g={fileUri:z.trim(),confidentialityLevel:U,targetDomainKey:ie,departmentId:re.trim()?Number(re):null,titleOverride:oe.trim()?oe.trim():null,labels:Q};N?.(g)},C=n=>{let g=Ge(n);if(g.kind==="blocked")return(0,t.jsx)("span",{className:"font-sans text-[11px] text-slate-400","data-testid":`ingest-action-blocked-${n.id}`,"data-reason":g.reason,children:g.reason});let A=g.kind==="retry";return(0,t.jsx)("button",{type:"button",onClick:()=>I?.(n.id),"aria-label":`${n.fileName} \u3092${A?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:A?"rounded-sm border border-red-200 bg-red-50 px-2 py-1 font-semibold text-red-700 text-xs hover:bg-red-100":"rounded-sm border border-emerald-200 bg-emerald-50 px-2 py-1 font-semibold text-emerald-700 text-xs hover:bg-emerald-100","data-testid":`ingest-${g.kind}-button-${n.id}`,children:A?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},Te=n=>{switch(n){case"SYNCED":return(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 font-semibold text-emerald-800 text-xs",children:"\u540C\u671F\u5B8C\u4E86"});case"PENDING":return(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:"\u5F85\u6A5F\u4E2D"});case"EXTRACTING":return(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 font-medium text-blue-800 text-xs",children:"\u672C\u6587\u62BD\u51FA\u4E2D"});case"ENRICHING":return(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-2.5 py-0.5 font-medium text-purple-800 text-xs",children:"AI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u4E2D"});case"PROJECTING":return(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-indigo-100 px-2.5 py-0.5 font-medium text-indigo-800 text-xs",children:"\u30D9\u30AF\u30C8\u30EB/\u30B0\u30E9\u30D5\u6295\u5F71\u4E2D"});default:return n.startsWith("FAILED")?(0,t.jsxs)("span",{className:"inline-flex items-center rounded-full bg-red-100 px-2.5 py-0.5 font-semibold text-red-800 text-xs",children:["\u5931\u6557: ",n]}):(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:n})}};return(0,t.jsxs)("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[(0,t.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-bold text-lg text-slate-900",children:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210"}),(0,t.jsx)("p",{className:"mt-1 text-slate-500 text-sm",children:"\u5BFE\u8C61 URI \u3092\u6307\u5B9A\u3057\u3066\u672C\u6587\u62BD\u51FA\u30FBAI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u30E1\u30BF\u30C7\u30FC\u30BF\u4ED8\u4E0E\u30FBQdrant \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Neo4j \u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002"})]}),(0,t.jsxs)("div",{className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",(0,t.jsx)("span",{className:"ml-1.5 font-bold text-slate-800",children:i})]})]}),(0,t.jsxs)("form",{onSubmit:Se,className:"mt-6 space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("label",{htmlFor:k,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsxs)("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",(0,t.jsx)("strong",{className:"font-semibold text-indigo-600",children:D})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),(0,t.jsx)("button",{type:"button",onClick:()=>ue("gdrive://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${D==="gdrive://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gdrive",children:"gdrive:// (Google Drive)"}),(0,t.jsx)("button",{type:"button",onClick:()=>ue("file://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${D==="file://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-file",children:"file:// (\u30ED\u30FC\u30AB\u30EB)"}),(0,t.jsx)("button",{type:"button",onClick:()=>ue("gcs://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${D==="gcs://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gcs",children:"gcs:// (GCS)"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("div",{className:`flex flex-1 rounded-lg border shadow-sm transition-colors focus-within:ring-2 ${O.error?"border-red-300 focus-within:border-red-500 focus-within:ring-red-200":"border-slate-300 focus-within:border-indigo-500 focus-within:ring-indigo-100"}`,children:[(0,t.jsx)("span",{className:"inline-flex select-none items-center rounded-l-lg border-slate-200 border-r bg-slate-50 px-3.5 font-mono font-semibold text-slate-700 text-sm","data-testid":"scheme-prefix-badge",children:D}),(0,t.jsx)("input",{id:k,type:"text",value:ne,onChange:n=>Re(n.target.value),placeholder:he(D),"aria-invalid":!!O.error,"aria-describedby":O.error?"ingest-uri-error":void 0,className:"flex-1 rounded-r-lg px-3.5 py-2 font-mono text-sm focus:outline-none","data-testid":"ingest-file-uri-input",required:!0})]}),(0,t.jsx)("button",{type:"button",onClick:()=>h?.(z.trim()),disabled:!O.valid||m,className:"inline-flex items-center justify-center rounded-lg border border-slate-300 bg-white px-4 py-2 font-medium text-slate-700 text-sm shadow-sm hover:bg-slate-50 disabled:opacity-50","data-testid":"ingest-inspect-uri-button",children:m?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[(0,t.jsxs)("p",{className:"text-slate-500",children:[D==="gdrive://"&&"Google Drive \u306E\u30D5\u30A1\u30A4\u30EB ID (\u4F8B: 1EXAMPLEFILEID0000000000000000000) \u307E\u305F\u306F URL \u3092\u8CBC\u308A\u4ED8\u3051\u308B\u3068\u81EA\u52D5\u62BD\u51FA\u3055\u308C\u307E\u3059\u3002",D==="file://"&&"\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u7D76\u5BFE\u30D1\u30B9 (\u4F8B: /srv/documents/sample.md) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",D==="gcs://"&&"GCS \u306E\u30D0\u30B1\u30C3\u30C8\u540D/\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30D1\u30B9 (\u4F8B: my-bucket/documents/report.pdf) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),z&&(0,t.jsxs)("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[(0,t.jsx)("span",{children:"\u89E3\u6C7A URI:"}),(0,t.jsx)("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:z})]})]})]}),O.error&&(0,t.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:O.error})]}),r&&r.fileUri===z.trim()&&(0,t.jsxs)("section",{"aria-live":"polite","aria-label":"\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",className:`rounded-lg border p-4 text-sm transition-all ${r.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-semibold",children:r.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),(0,t.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.exists&&(0,t.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),(0,t.jsx)("span",{className:"font-semibold text-slate-800",children:r.fileName})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),(0,t.jsx)("span",{className:"font-semibold text-slate-800",children:vt(r.fileSize)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"block text-slate-500",children:"MIME:"}),(0,t.jsx)("span",{className:"font-semibold text-slate-800",children:r.mimeType})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),(0,t.jsx)("span",{className:"font-semibold text-slate-800",children:r.revisionId?.slice(0,8)??"N/A"})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{htmlFor:_,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("select",{id:_,value:U,onChange:n=>j(n.target.value),className:"w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-confidentiality-select",children:X.ConfidentialityLevelSchema.options.map(n=>(0,t.jsxs)("option",{value:n,children:[n," (",ft[n],")"]},n))})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{htmlFor:b,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("select",{id:b,value:ie,onChange:n=>le(n.target.value),className:"w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-domain-select",children:xt.map(n=>(0,t.jsx)("option",{value:n.key,children:n.label},n.key))})]})]}),U===X.QUARANTINED_CONFIDENTIALITY_LEVEL&&(0,t.jsxs)("div",{className:"rounded-lg border border-amber-300 bg-amber-50 p-3 text-amber-900 text-xs",role:"alert","data-testid":"restricted-warning-banner",children:[(0,t.jsx)("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",X.QUARANTINED_CONFIDENTIALITY_LEVEL," \u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6587\u66F8\u306F\u3001\u6CD5\u4EE4\u9075\u5B88\u30FB\u4FC2\u4E89\u4FDD\u5168\u306E\u305F\u3081\u691C\u7D22\u7D50\u679C\u306B\u4E00\u5207\u51FA\u73FE\u3057\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u3067\u306F\u306A\u304F\u4FDD\u8A3C\u3067\u3042\u308A\u3001\u30DD\u30EA\u30B7\u30FC\u306E\u5024\u306B\u4F9D\u3089\u305A\u5E38\u306B\u6210\u7ACB\u3057\u307E\u3059\u3002",(0,t.jsx)("span",{className:"mt-1 block text-amber-800",children:"\u7D22\u5F15\u305D\u306E\u3082\u306E\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059 (\u4E0B\u306E\u6295\u5F71\u5148\u3092\u53C2\u7167)\u3002\u7D22\u5F15\u3055\u308C\u305F\u6587\u66F8\u3082\u691C\u7D22\u7D50\u679C\u306B\u306F\u73FE\u308C\u307E\u305B\u3093\u3002"})]}),(0,t.jsxs)("div",{className:"space-y-2 rounded-lg border border-indigo-100 bg-indigo-50/30 p-4","data-testid":"projection-capability-card",children:[(0,t.jsx)("span",{className:"block font-semibold text-indigo-950 text-xs",children:"\u3053\u306E\u6A5F\u5BC6\u533A\u5206\u306B\u5BFE\u3059\u308B\u6295\u5F71\u306E\u53EF\u5426 (Projection)"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,t.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 bg-white p-2.5",children:[(0,t.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),(0,t.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":String(F.vectorEnabled),children:F.vectorEnabled===void 0?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":F.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${U} \u306E\u8A2D\u5B9A)`})]}),(0,t.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 bg-white p-2.5",children:[(0,t.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),(0,t.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":String(F.graphEnabled),children:F.graphEnabled===void 0?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":F.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${U} \u306E\u8A2D\u5B9A)`})]})]}),(0,t.jsxs)("p",{className:"text-[11px] text-slate-600","data-testid":"projection-destination-note",children:["\u6295\u5F71\u5148\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D\u30FB\u30B0\u30E9\u30D5\u30E9\u30D9\u30EB\u30FB\u30C1\u30E3\u30F3\u30AF\u5206\u5272\u65B9\u5F0F\u306F\u3001\u9078\u629E\u3057\u305F\u30C9\u30E1\u30A4\u30F3\u306B\u5BFE\u3059\u308B\u914D\u5099\u306E\u53D6\u308A\u8FBC\u307F\u6226\u7565 (",(0,t.jsx)("code",{className:"font-mono",children:"tm_enrichment_strategy"}),") \u304C\u6C7A\u3081\u307E\u3059\u3002\u3053\u306E\u753B\u9762\u3067\u306F\u63A8\u5B9A\u3057\u307E\u305B\u3093\u3002"]})]}),(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border border-slate-200 bg-slate-50/50 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),(0,t.jsxs)("span",{className:"text-slate-500 text-xs",children:[Q.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),bt.map(n=>(0,t.jsxs)("button",{type:"button",onClick:()=>Ae(n),className:"rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-slate-700 text-xs transition-colors hover:border-indigo-300 hover:text-indigo-600","data-testid":`preset-tag-${n}`,children:["+ ",n]},n))]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[(0,t.jsxs)("div",{className:"space-y-1 sm:col-span-2",children:[(0,t.jsx)("label",{htmlFor:L,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,t.jsx)("input",{id:L,type:"text",value:be,onChange:n=>me(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),Ne())},placeholder:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04, 2026\u5E74\u5EA6",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-key-input"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:B,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,t.jsxs)("select",{id:B,value:ve,onChange:n=>ye(n.target.value),className:"w-full rounded-sm border border-slate-300 bg-white px-2 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-category-select",children:[(0,t.jsx)("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),(0,t.jsx)("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),(0,t.jsx)("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{htmlFor:$,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Z.toFixed(2),": 0.00\u301C1.00 AI/\u81EA\u52D5\u5224\u5B9A\u306E\u4FE1\u983C\u5EA6\u30B9\u30B3\u30A2\u30020.80 \u4EE5\u4E0A\u3067\u81EA\u52D5\u9069\u7528\u63A8\u5968)"]}),(0,t.jsx)("input",{id:$,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Z,"aria-valuenow":Z,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Z*100)}%`,onChange:n=>ee(Number.parseFloat(n.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"button",onClick:Ne,className:"w-full rounded-sm bg-slate-800 px-3 py-1.5 font-semibold text-white text-xs hover:bg-slate-700","data-testid":"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]}),Q.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:Q.map(n=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-200 bg-indigo-50 px-2.5 py-1 font-medium text-indigo-800 text-xs","data-testid":`active-label-${n.labelKey}`,children:[(0,t.jsx)("span",{className:"font-semibold",children:n.labelKey}),(0,t.jsxs)("span",{className:"text-indigo-400",children:["(",n.category,")"]}),(0,t.jsx)("button",{type:"button",onClick:()=>Le(n.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${n.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${n.labelKey}`,children:"\xD7"})]},n.labelKey))})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":te,"aria-controls":"advanced-settings-panel",onClick:()=>we(n=>!n),className:"inline-flex items-center gap-1.5 font-semibold text-indigo-600 text-xs hover:text-indigo-800","data-testid":"ingest-toggle-advanced-button",children:(0,t.jsxs)("span",{children:[te?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),te&&(0,t.jsxs)("section",{id:"advanced-settings-panel","aria-labelledby":"advanced-settings-toggle",className:"space-y-4 rounded-lg border border-slate-200 bg-slate-50/40 p-4","data-testid":"advanced-settings-panel",children:[(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:S,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),(0,t.jsx)("input",{id:S,type:"text",value:oe,onChange:n=>pe(n.target.value),placeholder:"\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u307E\u305F\u306F AI \u62BD\u51FA\u30BF\u30A4\u30C8\u30EB\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059",className:"w-full rounded-sm border border-slate-300 bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-title-override-input"})]})}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:f,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,t.jsx)("input",{id:f,type:"number",value:re,onChange:n=>ce(n.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-department-input"})]})})]})]}),(0,t.jsx)("div",{className:"flex justify-end pt-2",children:(0,t.jsx)("button",{type:"submit",disabled:!O.valid||d||m,"aria-busy":d,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-6 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50","data-testid":"ingest-submit-button",children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),(0,t.jsx)("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):(0,t.jsx)("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),(0,t.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),(0,t.jsx)("p",{className:"text-slate-500 text-xs",children:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C"})]})}),l.length===0?(0,t.jsx)("div",{className:"py-8 text-center text-slate-500 text-xs","data-testid":"recent-items-empty",children:"\u53D6\u308A\u8FBC\u307F\u5C65\u6B74\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full divide-y divide-slate-200 text-left text-xs","aria-label":"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u5C65\u6B74","data-testid":"recent-items-table",children:[(0,t.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),(0,t.jsx)("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-slate-100 font-mono text-slate-800",children:l.map(n=>(0,t.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${n.id}`,children:[(0,t.jsx)("td",{className:"px-3 py-2 font-bold",children:n.id}),(0,t.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:n.fileUri,children:[(0,t.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:n.fileName}),(0,t.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:n.fileUri})]}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:n.confidentialityLevel})}),(0,t.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",n.revision,n.isCurrent===!1&&(0,t.jsx)("span",{className:"ml-1.5 inline-flex items-center rounded-sm bg-slate-100 px-1.5 py-0.5 font-medium font-sans text-[10px] text-slate-500","data-testid":`ingest-item-superseded-${n.id}`,children:"\u65E7\u7248"})]}),(0,t.jsxs)("td",{className:"px-3 py-2 font-sans",children:[Te(n.syncStatus),n.errorMessage!==null&&n.errorMessage!==void 0&&n.errorMessage!==""&&(0,t.jsx)("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${n.id}`,title:n.errorMessage,children:n.errorMessage})]}),(0,t.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500",children:new Date(n.createdAt).toLocaleString("ja-JP")}),(0,t.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:C(n)})]},n.id))})]})})]})]})}var ke=require("@aiquants/enrichment-core"),E=require("react/jsx-runtime"),je={open:{label:"\u30D5\u30E9\u30B0\u6709\u52B9",color:"#047857"},closed:{label:"\u30D5\u30E9\u30B0\u7121\u52B9",color:"#b45309"},unmeasured:{label:"\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A",color:"#64748b"},absent:{label:"\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057",color:"#64748b"}};function Fe(s,i){return s===null?"absent":s in i?i[s]?"open":"closed":"unmeasured"}function ht({strategies:s,featureFlags:i,onToggleStage:l,isUpdating:r=!1}){let d=l===void 0;return(0,E.jsxs)("div",{"data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,E.jsxs)("div",{children:[(0,E.jsx)("h2",{className:"font-bold text-lg text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,E.jsxs)("p",{className:"text-slate-500 text-xs",children:["\u6BB5\u304C\u8D70\u308B\u306E\u306F\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3068\u3001\u3053\u306E\u30C9\u30E1\u30A4\u30F3\u306E\u6226\u7565\u306E",(0,E.jsx)("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",s.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",ke.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),d&&(0,E.jsx)("p",{"data-testid":"strategy-read-only-note",className:"mt-1 text-slate-500 text-xs",children:"\u3053\u306E\u914D\u5099\u3067\u306F\u66F8\u304D\u8FBC\u307F\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\u3067\u3059\u3002"})]}),s.length===0?(0,E.jsx)("p",{"data-testid":"strategy-empty-note",className:"text-slate-500 text-sm",children:"\u767B\u9332\u3055\u308C\u305F\u30C9\u30E1\u30A4\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,E.jsx)("div",{className:"overflow-x-auto",children:(0,E.jsxs)("table",{"data-testid":"strategy-grid","aria-label":"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565",className:"w-full border-collapse text-xs",children:[(0,E.jsx)("thead",{children:(0,E.jsxs)("tr",{children:[(0,E.jsx)("th",{scope:"col",className:"border-slate-200 border-b p-2 text-left font-semibold text-slate-600",children:"\u30C9\u30E1\u30A4\u30F3"}),ke.ENRICHMENT_STAGES.map(m=>{let h=Fe(m.featureFlagKey,i);return(0,E.jsxs)("th",{scope:"col",className:"border-slate-200 border-b p-2 text-center font-semibold text-slate-600",children:[(0,E.jsx)("div",{children:m.label}),(0,E.jsx)("div",{"data-testid":`strategy-gate-${m.key}`,"data-gate":h,className:"mt-0.5 font-normal text-[10px]",style:{color:je[h].color},children:je[h].label})]},m.key)})]})}),(0,E.jsx)("tbody",{children:s.map(m=>(0,E.jsxs)("tr",{"data-testid":`strategy-row-${m.domainKey}`,"data-provenance":m.provenance,"data-active":String(m.isActive),children:[(0,E.jsxs)("th",{scope:"row",className:"border-slate-100 border-b p-2 text-left font-normal",children:[(0,E.jsx)("div",{className:"font-semibold text-slate-900",children:m.domainLabel}),(0,E.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,E.jsx)("code",{children:m.domainKey})," / ",m.strategyName]}),(0,E.jsx)("div",{"data-testid":`strategy-provenance-${m.domainKey}`,className:"text-[10px] text-slate-500",children:m.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!m.isActive&&(0,E.jsx)("div",{"data-testid":`strategy-inactive-${m.domainKey}`,className:"text-[10px] text-amber-700",children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]}),ke.ENRICHMENT_STAGES.map(h=>{let N=m.stages[h.key],I=Fe(h.featureFlagKey,i);return(0,E.jsxs)("td",{className:"border-slate-100 border-b p-2 text-center",children:[(0,E.jsx)("button",{type:"button",role:"switch","aria-checked":N,"aria-label":`${m.domainLabel} \u306E ${h.label}`,"data-testid":`strategy-stage-${m.domainKey}-${h.key}`,"data-enabled":String(N),"data-effective":String(N&&(I==="open"||I==="absent")),disabled:d||r,onClick:()=>l?.(m,h.key,!N),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${N?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-500"} ${d||r?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:N?"\u958B":"\u9589"}),N&&I==="unmeasured"&&(0,E.jsx)("div",{"data-testid":`strategy-unmeasured-${m.domainKey}-${h.key}`,className:"mt-0.5 text-[10px] text-slate-500",children:"\u30D5\u30E9\u30B0\u3092\u8AAD\u3081\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8D70\u308B\u304B\u3069\u3046\u304B\u5224\u308A\u307E\u305B\u3093"}),N&&I==="closed"&&(0,E.jsx)("div",{"data-testid":`strategy-blocked-${m.domainKey}-${h.key}`,className:"mt-0.5 text-[10px] text-amber-700",children:"\u30D5\u30E9\u30B0\u304C\u9589\u3058\u3066\u3044\u308B\u305F\u3081\u8D70\u308A\u307E\u305B\u3093"})]},h.key)})]},`${m.domainKey}:${m.strategyName}`))})]})})]})}var c=require("react/jsx-runtime");var Nt={engine:"\u30A8\u30F3\u30B8\u30F3",edition:"\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3",fullVersion:"\u5B8C\u5168\u30D0\u30FC\u30B8\u30E7\u30F3",title:"\u540D\u79F0",collectionsCount:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",nodeCount:"\u30CE\u30FC\u30C9\u6570 (\u30C6\u30CA\u30F3\u30C8)",totalKeys:"\u30AD\u30FC\u7DCF\u6570",database:"DB",endpointsCount:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",port:"\u30DD\u30FC\u30C8",restPort:"REST \u30DD\u30FC\u30C8",boltUri:"Bolt URI",tls:"TLS"},He=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],St=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]);function Et(s,i){return i===null?"\u672A\u6E2C\u5B9A":typeof i=="boolean"?i?"\u6709\u52B9":"\u7121\u52B9":typeof i=="number"&&St.has(s)?`${i.toLocaleString()} \u4EF6`:String(i)}function kt(s){let i=He.filter(r=>r in s),l=Object.keys(s).filter(r=>!He.includes(r)).sort();return[...i,...l].map(r=>({key:r,label:Nt[r]??r,text:Et(r,s[r])}))}function _t({health:s,isRefreshing:i=!1,onRefresh:l,className:r=""}){let{services:d,allHealthy:m,checkedAt:h}=s,N=[{key:"qdrant",data:d.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:d.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:d.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:d.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:d.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return(0,c.jsxs)("section",{className:`rounded-lg border bg-card p-5 text-card-foreground shadow-sm ${r}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(m),children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b pb-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,c.jsxs)("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,c.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,c.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,c.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,c.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h2",{className:"font-semibold text-lg",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,c.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D: ",new Date(h).toLocaleTimeString("ja-JP")," | \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]})]})]}),(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-xs ${m?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":"health-overall-status-badge",children:m?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,c.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,c.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,c.jsx)("span",{children:"\u5168\u30B5\u30FC\u30D3\u30B9\u6B63\u5E38\u63A5\u7D9A"})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,c.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,c.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,c.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,c.jsx)("span",{children:"\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9\u63A5\u7D9A\u30A8\u30E9\u30FC"})]})}),l&&(0,c.jsxs)("button",{type:"button",onClick:l,disabled:i,"data-testid":"health-refresh-button",className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[(0,c.jsxs)("svg",{className:`h-3.5 w-3.5 ${i?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,c.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,c.jsx)("path",{d:"M3 3v5h5"}),(0,c.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,c.jsx)("path",{d:"M16 21h5v-5"})]}),(0,c.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,c.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:N.map(({key:I,data:k,title:_,subtitle:b})=>{let f=k.status==="connected";return(0,c.jsxs)("div",{"data-testid":`service-card-${I}`,className:`flex flex-col justify-between rounded-md border p-3.5 transition-colors ${f?"border-border bg-card/60 hover:bg-muted/40":"border-destructive/40 bg-destructive/5"}`,children:[(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"font-semibold text-sm",children:_}),(0,c.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 font-medium text-[11px] ${f?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":`service-status-${I}`,children:[(0,c.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${f?"animate-pulse bg-emerald-500":"bg-destructive"}`}),f?"Connected":"Error"]})]}),(0,c.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:b}),(0,c.jsxs)("div",{className:"mt-3 space-y-1.5 border-t pt-2 text-xs",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-muted-foreground",children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,c.jsx)("code",{className:"font-mono font-semibold text-[11px]","data-testid":`service-version-${I}`,children:k.version??"N/A"})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-muted-foreground",children:"\u5FDC\u7B54\u6642\u9593:"}),(0,c.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground",children:[k.latencyMs," ms"]})]}),kt(k.details).map(S=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-muted-foreground",children:[S.label,":"]}),(0,c.jsx)("span",{className:"font-medium text-[11px]","data-testid":`health-detail-${I}-${S.key}`,children:S.text})]},S.key))]})]}),(0,c.jsxs)("div",{className:"mt-3 truncate border-t pt-1.5 text-[10px] text-muted-foreground",children:[(0,c.jsx)("span",{className:"font-mono",children:k.endpoint}),k.errorMessage&&(0,c.jsx)("p",{className:"mt-0.5 line-clamp-2 text-destructive",children:k.errorMessage})]})]},I)})})]})}var se=require("@aiquants/enrichment-core"),x=require("react");var e=require("react/jsx-runtime"),Ue={KEYWORD:{label:"SQL",description:"SQL Server \u306E\u8A9E\u53E5\u4E00\u81F4\u306E\u307F\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306A\u3069\u306E\u5B8C\u5168\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB\u306E\u610F\u5473\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u4E00\u81F4\u3092\u9806\u4F4D\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u691C\u7D22\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u691C\u7D22\u3057\u307E\u3059\u3002\u6587\u66F8\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u8EF8\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},_e="\u672A\u5B9F\u884C",It=2e3;function Ct(s){return s.fusion?s.fusion==="rrf"?`RRF (k=${s.rrf_k??"\u65E2\u5B9A"})`:`LINEAR (alpha=${s.alpha??"\u65E2\u5B9A"})`:"\u878D\u5408\u306A\u3057 (\u5358\u4E00\u9806\u4F4D\u30E2\u30FC\u30C9)"}var Oe={cosine:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",format:s=>`${(s*100).toFixed(1)}%`,title:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 (0\u301C1)"},bm25:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",format:s=>s.toFixed(3),title:"BM25 \u30B9\u30B3\u30A2 (\u4E0A\u9650\u306A\u3057\u3002\u5272\u5408\u3067\u306F\u306A\u3044)"},mixed:{label:"\u30D9\u30AF\u30C8\u30EB",format:s=>s.toFixed(3),title:"\u5BC6\u3068\u758E\u306E\u53CC\u65B9\u304C\u8D70\u3063\u305F\u305F\u3081\u3001\u3053\u306E\u5024\u304C\u3069\u3061\u3089\u306E\u91CF\u304B\u5B9A\u307E\u3089\u306A\u3044"}},Ve=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9 (Balanced Hybrid)",description:"RRF \u878D\u5408 (k=60) \u306B\u3088\u308B\u8A9E\u5F59\u3068\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u306E\u8ABF\u548C\u30D0\u30E9\u30F3\u30B9\u63A2\u7D22",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB (Dense Dominant)",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u63A2\u7D22\u306B\u3088\u308B\u9AD8\u9069\u5408\u7387\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u691C\u7D22",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9 (Strict Lexical)",description:"\u30CF\u30EB\u30B7\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u6392\u9664\u3059\u308B SQL SoT / \u8A9E\u5F59\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u76F4\u63A5\u691C\u7D22",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB (Sparse BM25)",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u5B8C\u5168\u4E00\u81F4\u3092\u72D9\u3046\u691C\u7D22",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A\u63A8\u8AD6 (Graph Deep Reasoning)",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u9806\u4F4D\u3092\u4E3B\u8EF8\u306B\u636E\u3048\u305F\u63A8\u8AD6\u691C\u7D22",params:{mode:"GRAPH_TRAVERSE",limit:30}}];function We(s){return s===void 0||Number.isNaN(s)?"N/A":`${(s*100).toFixed(1)}%`}function wt(s,i){let l=i.trim();if(!(l&&s))return s;let r=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(${r})`,"gi");return s.split(d).map((N,I)=>({id:`chunk-${I}-${N.slice(0,8)}`,part:N,isMatch:N.toLowerCase()===l.toLowerCase()})).map(N=>N.isMatch?(0,e.jsx)("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:N.part},N.id):N.part)}function Be(s){return s==="OPEN"?"bg-red-100 font-bold text-red-800":s==="HALF_OPEN"?"bg-amber-100 font-bold text-amber-800":"bg-slate-200 text-slate-500"}function Ke(s){return s==="OPEN"?"OPEN":s==="HALF_OPEN"?"HALF":"-"}function Rt({tenantId:s,onSearch:i,initialParams:l,initialResult:r=null,circuitBreakerStatus:d={},isLoading:m=!1}){let h=(0,x.useId)(),N=(0,x.useId)(),I=(0,x.useId)(),k=(0,x.useId)(),_=(0,x.useId)(),b=(0,x.useId)(),f=(0,x.useId)(),S=(0,x.useId)(),L=(0,x.useId)(),B=(0,x.useId)(),[$,D]=(0,x.useState)(l?.q??""),[M,ne]=(0,x.useState)(l?.mode??"HYBRID"),[K,z]=(0,x.useState)(l?.limit??20),[P,U]=(0,x.useState)(l?.threshold??.5),[j,ie]=(0,x.useState)(l?.fusion??"rrf"),[le,re]=(0,x.useState)(l?.rrf_k??60),[ce,oe]=(0,x.useState)(l?.alpha??.7),[pe,Q]=(0,x.useState)(l?.confidentiality_level??"ALL"),[Y,be]=(0,x.useState)(l?.department_id?String(l.department_id):""),[me,ve]=(0,x.useState)(l?.mime_type??""),[ye,Z]=(0,x.useState)(l?.tag??""),ee=(0,x.useRef)(0),[te,we]=(0,x.useState)(!1),[F,O]=(0,x.useState)(!1),[J,ue]=(0,x.useState)("request"),[Re,he]=(0,x.useState)(null),[Ne,Ae]=(0,x.useState)(new Set),[Le,Se]=(0,x.useState)(!1),[C,Te]=(0,x.useState)(r),[n,g]=(0,x.useState)(null),[A,q]=(0,x.useState)(null),Ee=m||Le,de=se.MODE_TIERS[M],ae=[de.dense,de.sparse,de.graph,de.lexical].filter(Boolean).length>1,De=de.dense&&!de.sparse,H=C?.search_metadata.circuit_breaker_status??d,T=C?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},$e=A??{};(0,x.useEffect)(()=>{if(!F)return;let a=v=>{v.key==="Escape"&&O(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[F]);let tt=a=>{a.params.mode!==void 0&&ne(a.params.mode),a.params.limit!==void 0&&z(a.params.limit),a.params.threshold!==void 0&&U(a.params.threshold),a.params.fusion!==void 0&&ie(a.params.fusion),a.params.rrf_k!==void 0&&re(a.params.rrf_k),a.params.alpha!==void 0&&oe(a.params.alpha)},at=async a=>{let v=new URL("/api/storage/search",window.location.origin);v.searchParams.set("q",a.q),v.searchParams.set("limit",String(a.limit)),v.searchParams.set("mode",a.mode),a.threshold!==void 0&&v.searchParams.set("threshold",String(a.threshold)),a.fusion!==void 0&&v.searchParams.set("fusion",a.fusion),a.rrf_k!==void 0&&v.searchParams.set("rrf_k",String(a.rrf_k)),a.alpha!==void 0&&v.searchParams.set("alpha",String(a.alpha)),a.department_id!==void 0&&v.searchParams.set("department_id",String(a.department_id)),a.confidentiality_level!==void 0&&v.searchParams.set("confidentiality_level",a.confidentiality_level),a.mime_type!==void 0&&v.searchParams.set("mime_type",a.mime_type),a.tag!==void 0&&v.searchParams.set("tag",a.tag);let R=await fetch(v.toString(),{method:"GET",headers:{Accept:"application/json"}});if(!(R.headers.get("content-type")??"").includes("application/json"))throw new Error("\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u518D\u5EA6\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(!R.ok){let G=await R.json().catch(()=>({}));throw new Error(G.error??`\u691C\u7D22\u30A8\u30E9\u30FC: HTTP ${R.status}`)}return await R.json()},st=async()=>{if(Ee)return;let a=Y.trim()?Number.parseInt(Y.trim(),10):void 0,v={q:$.trim(),mode:M,limit:K,threshold:De?P:void 0,fusion:ae?j:void 0,rrf_k:ae&&j==="rrf"?le:void 0,alpha:ae&&j==="linear"?ce:void 0,department_id:Number.isNaN(a)?void 0:a,confidentiality_level:pe==="ALL"?void 0:pe,mime_type:me.trim()||void 0,tag:ye.trim()||void 0},R=ee.current+1;ee.current=R,g(null),Se(!0);try{let W=i?await i(v):await at(v);if(R!==ee.current)return;Te(W),q(v)}catch(W){if(R!==ee.current)return;g(W instanceof Error?W.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{R===ee.current&&Se(!1)}},ge=(0,x.useRef)(void 0);(0,x.useEffect)(()=>()=>{ge.current!==void 0&&clearTimeout(ge.current)},[]);let nt=async(a,v)=>{try{await navigator.clipboard.writeText(a),he(v),ge.current!==void 0&&clearTimeout(ge.current),ge.current=setTimeout(()=>he(null),It)}catch{}},it=a=>{Ae(v=>{let R=new Set(v);return R.has(a)?R.delete(a):R.add(a),R})};return(0,e.jsxs)("div",{"data-testid":"metadata-search-workbench","data-mode":M,"data-loading":String(Ee),className:"space-y-6",children:[(0,e.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"font-bold text-slate-900 text-xl tracking-tight",children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u691C\u7D22\u30EF\u30FC\u30AF\u30D9\u30F3\u30C1"}),(0,e.jsxs)("span",{"data-testid":"workbench-tenant-badge",className:"rounded-full bg-indigo-50 px-2.5 py-0.5 font-semibold text-indigo-700 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",s]})]}),(0,e.jsx)("p",{className:"mt-1 text-slate-500 text-sm",children:"\u30AD\u30FC\u30EF\u30FC\u30C9\u30FB\u5BC6\u30D9\u30AF\u30C8\u30EB\u30FB\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u691C\u7D22\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u5FAE\u8ABF\u6574\u3057\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u306B\u53D6\u5F97\u7CBE\u5EA6\u3068\u63A8\u8AD6\u7D50\u679C\u3092\u691C\u8A3C\u3057\u307E\u3059\u3002"})]}),(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsxs)("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":F,"aria-controls":B,onClick:()=>O(a=>!a),className:"inline-flex items-center gap-2 rounded-lg border border-slate-300 bg-slate-50 px-3.5 py-2 font-medium text-slate-700 text-sm shadow-sm transition-colors hover:bg-slate-100",children:[(0,e.jsx)("span",{className:"font-mono text-xs",children:"{ }"}),(0,e.jsx)("span",{children:F?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),(0,e.jsxs)("div",{className:"mt-5 border-slate-100 border-t pt-4",children:[(0,e.jsx)("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),(0,e.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:Ve.map(a=>(0,e.jsx)("button",{type:"button","data-testid":`preset-button-${a.id}`,onClick:()=>tt(a),className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-left text-xs transition-colors hover:border-indigo-300 hover:bg-indigo-50/50",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:"font-semibold text-slate-800",children:a.title}),(0,e.jsxs)("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",a.description,")"]})]})},a.id))})]})]}),(0,e.jsx)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:(0,e.jsxs)("form",{onSubmit:a=>{a.preventDefault(),st()},className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,e.jsxs)("div",{className:"relative flex-1",children:[(0,e.jsx)("label",{htmlFor:h,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),(0,e.jsx)("input",{id:h,type:"text","data-testid":"search-query-input",value:$,onChange:a=>D(a.target.value),placeholder:"\u691C\u7D22\u30AF\u30A8\u30EA\u3092\u5165\u529B (\u4F8B: \u300C\u56DB\u534A\u671F \u6C7A\u7B97\u5831\u544A\u66F8\u300D\u300C\u696D\u52D9\u65E5\u5831 \u539F\u4FA1\u6309\u5206\u300D)...",className:"w-full rounded-lg border border-slate-300 bg-white px-4 py-2.5 text-slate-900 text-sm shadow-sm transition-colors placeholder:text-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),$&&(0,e.jsx)("button",{type:"button","data-testid":"clear-query-button",onClick:()=>D(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),(0,e.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-100 p-1",children:se.SEARCH_MODES.map(a=>{let v=M===a;return(0,e.jsx)("button",{type:"button","aria-pressed":v,title:Ue[a].description,"data-testid":`search-mode-${a}`,"data-active":String(v),onClick:()=>ne(a),className:`rounded-md px-3 py-1.5 font-medium text-xs transition-all ${v?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:Ue[a].label},a)})}),(0,e.jsx)("button",{type:"submit","data-testid":"execute-search-button",disabled:Ee,className:"inline-flex items-center justify-center rounded-lg bg-indigo-600 px-5 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 disabled:opacity-50",children:Ee?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("label",{htmlFor:N,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),(0,e.jsx)("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:K})]}),(0,e.jsx)("input",{id:N,type:"range","data-testid":"limit-slider",min:se.SEARCH_PARAM_LIMITS.limit.min,max:se.SEARCH_PARAM_LIMITS.limit.max,step:1,value:K,onChange:a=>z(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("label",{htmlFor:I,className:"font-medium text-slate-700 text-xs",title:De?"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650\u3067\u3059\u3002":"\u3053\u306E\u6226\u7565\u306E\u30B9\u30B3\u30A2\u306F\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u3067\u306F\u306A\u3044\u305F\u3081\u9069\u7528\u3057\u307E\u305B\u3093\u3002",children:"\u985E\u4F3C\u5EA6\u95BE\u5024 (Threshold):"}),(0,e.jsx)("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:P.toFixed(2)})]}),(0,e.jsx)("input",{id:I,type:"range","data-testid":"threshold-slider",min:0,max:1,step:.01,value:P,disabled:!De,onChange:a=>U(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),(0,e.jsx)("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:j.toUpperCase()})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>ie("rrf"),disabled:!ae,className:`flex-1 rounded-sm border py-1 font-medium text-xs ${j==="rrf"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"RRF"}),(0,e.jsx)("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>ie("linear"),disabled:!ae,className:`flex-1 rounded-sm border py-1 font-medium text-xs ${j==="linear"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"\u7DDA\u5F62\u7D50\u5408 (Alpha)"})]})]}),(0,e.jsx)("div",{className:"space-y-1.5",children:j==="rrf"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("label",{htmlFor:k,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),(0,e.jsx)("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:le})]}),(0,e.jsx)("input",{id:k,type:"range","data-testid":"rrf-k-slider",min:10,max:120,step:5,value:le,disabled:!ae,onChange:a=>re(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("label",{htmlFor:_,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),(0,e.jsx)("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:ce.toFixed(2)})]}),(0,e.jsx)("input",{id:_,type:"range","data-testid":"alpha-slider",min:0,max:1,step:.05,value:ce,disabled:!ae,onChange:a=>oe(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>we(a=>!a),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,e.jsx)("span",{children:te?"\u25BC":"\u25B6"}),(0,e.jsxs)("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",te?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),te&&(0,e.jsxs)("div",{"data-testid":"advanced-filters-panel",className:"mt-3 grid grid-cols-1 gap-4 rounded-lg border border-slate-200 bg-white p-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{htmlFor:f,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),(0,e.jsxs)("select",{id:f,"data-testid":"filter-confidentiality",value:pe,onChange:a=>Q(a.target.value),className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500",children:[(0,e.jsx)("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),(0,e.jsx)("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),(0,e.jsx)("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),(0,e.jsx)("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),(0,e.jsx)("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{htmlFor:b,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),(0,e.jsx)("input",{id:b,type:"number","data-testid":"filter-department-id",value:Y,onChange:a=>be(a.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{htmlFor:S,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),(0,e.jsx)("input",{id:S,type:"text","data-testid":"filter-mime-type",value:me,onChange:a=>ve(a.target.value),placeholder:"application/pdf, image/...",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{htmlFor:L,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),(0,e.jsx)("input",{id:L,type:"text","data-testid":"filter-tag",value:ye,onChange:a=>Z(a.target.value),placeholder:"\u4F8B: \u6C7A\u7B97, \u5951\u7D04\u66F8...",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]})]})]})]})}),n&&(0,e.jsx)("div",{role:"alert","data-testid":"search-error-alert",className:"rounded-xl border border-red-200 bg-red-50 p-4 font-medium text-red-700 text-sm shadow-sm",children:n}),C?.search_metadata&&(0,e.jsx)(Me,{metadata:C.search_metadata}),C&&(0,e.jsxs)("div",{"data-testid":"search-summary-bar",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3 text-xs",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",(0,e.jsx)("span",{className:"font-bold text-indigo-600",children:C.count})," \u4EF6"]}),C.search_metadata.execution_time_ms!==void 0&&(0,e.jsxs)("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",(0,e.jsxs)("span",{className:"font-mono font-semibold text-slate-700",children:[C.search_metadata.execution_time_ms," ms"]})]}),(0,e.jsxs)("span",{"data-testid":"quality-tier-badge",className:"rounded-full bg-slate-200 px-2 py-0.5 font-medium font-mono text-slate-800",children:["Tier: ",C.search_metadata.quality_tier]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),(0,e.jsxs)("span",{"data-testid":"tier-badge-sql","data-active":String(T.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${T.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",T.sql?"\u2713":"-"]}),(0,e.jsxs)("span",{"data-testid":"tier-badge-sparse","data-active":String(T.sparse),"data-breaker":H.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${T.sparse?"bg-emerald-100 font-semibold text-emerald-800":Be(H.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",T.sparse?"\u2713":Ke(H.vector)]}),(0,e.jsxs)("span",{"data-testid":"tier-badge-dense","data-active":String(T.dense),"data-breaker":H.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${T.dense?"bg-emerald-100 font-semibold text-emerald-800":Be(H.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",T.dense?"\u2713":Ke(H.vector)]}),(0,e.jsxs)("span",{"data-testid":"tier-badge-graph","data-active":String(T.graph),"data-breaker":H.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${T.graph?"bg-emerald-100 font-semibold text-emerald-800":Be(H.graph)}`,children:["\u30B0\u30E9\u30D5 ",T.graph?"\u2713":Ke(H.graph)]})]})]}),(0,e.jsxs)("div",{"data-testid":"search-results-container",className:"space-y-4",children:[C&&C.hits.length===0&&(0,e.jsxs)("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 bg-white p-12 text-center",children:[(0,e.jsx)("p",{className:"font-semibold text-base text-slate-700",children:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30E1\u30BF\u30C7\u30FC\u30BF\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F"}),(0,e.jsx)("p",{className:"mt-1 text-slate-500 text-sm",children:"\u691C\u7D22\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u7C21\u6F54\u306B\u3059\u308B\u304B\u3001\u985E\u4F3C\u5EA6\u95BE\u5024\u3092\u4E0B\u3052\u308B\uFF08\u4F8B: 0.30\uFF09\u3001\u307E\u305F\u306F\u300C\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9\u300D\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"})]}),C?.hits.map((a,v)=>{let R=Ne.has(a.id),W=a.scores?.fused;return(0,e.jsxs)("div",{"data-testid":`search-hit-card-${a.id}`,"data-hit-id":a.id,"data-rank":v+1,className:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm transition-all hover:border-slate-300 hover:shadow-md",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)("span",{"data-testid":`hit-rank-${a.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",v+1]}),(0,e.jsx)("h3",{"data-testid":`hit-filename-${a.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:a.file_name}),(0,e.jsx)("span",{"data-testid":`hit-confidentiality-${a.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${a.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":a.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":a.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:a.confidentiality_level}),a.department_id!==null&&(0,e.jsxs)("span",{"data-testid":`hit-department-${a.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",a.department_id]}),(0,e.jsx)("span",{"data-testid":`hit-mimetype-${a.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:a.mime_type})]}),(0,e.jsx)("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:a.file_uri})]}),W!==void 0&&(0,e.jsxs)("div",{className:"flex items-center gap-3 sm:text-right",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),(0,e.jsx)("div",{"data-testid":`hit-fused-score-${a.id}`,className:"font-bold font-mono text-indigo-600 text-sm",title:"\u5404\u5C64\u3067\u306E\u9806\u4F4D\u304B\u3089\u7D44\u307F\u7ACB\u3066\u305F\u5024 (0\u301C1)\u3002\u985E\u4F3C\u5EA6\u3067\u3082\u78BA\u4FE1\u5EA6\u3067\u3082\u306A\u304F\u3001\u3069\u306E\u5C64\u3067\u3082 1 \u4F4D\u306A\u3089 1.000 \u306B\u306A\u308B",children:W.toFixed(3)})]}),(0,e.jsx)("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:(0,e.jsx)("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,W*100))}%`}})})]})]}),a.ai_summary&&(0,e.jsx)("div",{"data-testid":`hit-summary-${a.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:wt(a.ai_summary,A?.q??$)}),a.scores&&(0,e.jsxs)("div",{"data-testid":`hit-score-breakdown-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[(0,e.jsx)("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),a.scores.vector!==void 0&&(0,e.jsxs)("span",{"data-testid":`score-vector-${a.id}`,"data-score-kind":a.scores.vector.kind,title:Oe[a.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Oe[a.scores.vector.kind].label,": ",Oe[a.scores.vector.kind].format(a.scores.vector.value)]}),a.scores.lexicalRank!==void 0&&(0,e.jsxs)("span",{"data-testid":`score-lexical-${a.id}`,title:"\u5B57\u53E5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-amber-50 px-2 py-0.5 font-mono text-amber-700",children:["\u5B57\u53E5\u9806\u4F4D: ",We(a.scores.lexicalRank)]}),a.scores.graphRank!==void 0&&(0,e.jsxs)("span",{"data-testid":`score-graph-${a.id}`,title:"\u30B0\u30E9\u30D5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-purple-50 px-2 py-0.5 font-mono text-purple-700",children:["\u30B0\u30E9\u30D5\u9806\u4F4D: ",We(a.scores.graphRank)]})]}),a.tags&&a.tags.length>0&&(0,e.jsx)("div",{"data-testid":`hit-tags-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:a.tags.map(G=>(0,e.jsxs)("span",{"data-testid":`hit-tag-${a.id}-${G}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",G]},`tag-${a.id}-${G}`))}),a.graph_relations&&a.graph_relations.length>0&&(0,e.jsxs)("div",{"data-testid":`hit-graph-relations-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),a.graph_relations.map((G,rt)=>(0,e.jsxs)("span",{"data-testid":`hit-relation-${a.id}-${rt}`,className:"rounded-sm border border-purple-200 bg-purple-50 px-2 py-0.5 font-mono text-[11px] text-purple-800",children:["-[:",G.relation,"]-> ",G.target_name]},`rel-${a.id}-${G.relation}-${G.target_name}`))]}),a.structured_data!==null&&a.structured_data!==void 0&&(0,e.jsxs)("div",{className:"mt-3 border-slate-100 border-t pt-2",children:[(0,e.jsxs)("button",{type:"button","data-testid":`toggle-structured-data-${a.id}`,onClick:()=>it(a.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,e.jsx)("span",{children:R?"\u25BC":"\u25B6"}),(0,e.jsxs)("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",R?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),R&&(0,e.jsx)("pre",{"data-testid":`structured-data-json-${a.id}`,tabIndex:0,className:"mt-2 max-h-48 overflow-auto rounded-sm bg-slate-900 p-3 font-mono text-slate-200 text-xs",children:JSON.stringify(a.structured_data,null,2)})]})]},a.id)})]}),F&&(0,e.jsxs)("section",{id:B,"aria-label":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF","data-testid":"developer-inspector-drawer",className:"rounded-xl border border-slate-300 bg-slate-900 p-5 text-slate-200 shadow-xl",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-slate-800 border-b pb-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),(0,e.jsx)("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let a=JSON.stringify(J==="request"?A??{}:C??{},null,2);nt(a,"inspector")},className:"rounded-sm bg-slate-800 px-2.5 py-1 font-medium text-slate-300 text-xs transition-colors hover:bg-slate-700",children:Re==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),(0,e.jsx)("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>O(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),(0,e.jsx)("div",{className:"mt-3 flex gap-2 border-slate-800 border-b pb-2",children:["request","response","pipeline","graph-trace"].map(a=>{let v={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},R=J===a;return(0,e.jsx)("button",{type:"button","data-testid":`inspector-tab-${a}`,"data-active":String(R),onClick:()=>ue(a),className:`rounded-sm px-3 py-1 font-medium text-xs ${R?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:v[a]},a)})}),(0,e.jsxs)("div",{className:"mt-4",children:[J==="request"&&(0,e.jsx)("pre",{"data-testid":"inspector-request-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-emerald-400 text-xs",children:JSON.stringify(A??{},null,2)}),J==="response"&&(0,e.jsx)("pre",{"data-testid":"inspector-response-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-sky-400 text-xs",children:JSON.stringify(C??{},null,2)}),J==="pipeline"&&(0,e.jsxs)("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),(0,e.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),(0,e.jsxs)("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:["mode: ",$e.mode,' | q: "',$e.q,'"']}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),(0,e.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),(0,e.jsxs)("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:["SQL SoT: ",T.sql?"ACTIVE":"SKIPPED"," | Sparse: ",T.sparse?"ACTIVE":"OFFLINE"," | Dense: ",T.dense?"ACTIVE":"OFFLINE"," | Graph: ",T.graph?"ACTIVE":"OFFLINE"]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),(0,e.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),(0,e.jsxs)("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:[(0,e.jsxs)("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",C?Ct($e):_e]})," | ",(0,e.jsxs)("span",{"data-testid":"inspector-output-count",children:["Output count: ",C?C.count:_e]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),(0,e.jsx)("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),(0,e.jsxs)("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:[(0,e.jsxs)("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",C?C.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":_e]})," | ",(0,e.jsxs)("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",C?C.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":_e]})," | ","tenant: ",s]})]}),J==="graph-trace"&&(0,e.jsxs)("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[(0,e.jsx)("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),C?.hits.some(a=>a.graph_relations&&a.graph_relations.length>0)?(0,e.jsx)("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:C.hits.map(a=>a.graph_relations?.map(v=>(0,e.jsxs)("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",a.id,', file: "',a.file_name,'"}) -[:',v.relation,']-> (:Entity {name: "',v.target_name,'"})']},`gtrace-${a.id}-${v.relation}-${v.target_name}`)))}):(0,e.jsx)("p",{className:"mt-2 text-slate-500",children:"\u95A2\u9023\u3059\u308B\u30B0\u30E9\u30D5\u30D1\u30B9\u306F\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002"})]})]})]})]})}var o=require("react/jsx-runtime");function Qe(s){return s===null?xe:`${s.length} \u7A2E`}var xe="\u672A\u8A2D\u5B9A";function fe(s,i=""){return s===null?xe:`${s}${i}`}function Ie(s){return s===null?xe:`${s} \u4EF6`}function At(s){if(s.currentVersion===null&&s.lifecyclePhase===null)return`${s.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let i=s.currentVersion===null?xe:`v${s.currentVersion}`;return`${s.schemaName} ${i} (${s.lifecyclePhase??xe})`}function Lt({tenantId:s,ontologyStatus:i}){let l=i.classes,r=i.predicates;return(0,o.jsxs)("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[(0,o.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,o.jsxs)("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC & \u30B9\u30AD\u30FC\u30DE\u30AC\u30D0\u30CA\u30F3\u30B9\u72B6\u614B"}),(0,o.jsx)("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 font-bold text-xs ${i.autonomousEvolutionEnabled?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-700"}`,"data-testid":"ontology-evolution-badge",children:i.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),(0,o.jsx)("span",{className:"inline-flex items-center rounded-sm bg-indigo-100 px-2 py-0.5 font-mono font-semibold text-indigo-800 text-xs","data-testid":"ontology-schema-version",children:At(i)})]}),(0,o.jsx)("p",{className:"mt-1 text-slate-500 text-xs",children:"Neo4j \u7269\u7406\u30B0\u30E9\u30D5\u30B9\u30AD\u30FC\u30DE\u5236\u7D04\u3001\u8AD6\u7406\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30AF\u30E9\u30B9\u4F53\u7CFB\u3001\u304A\u3088\u3073\u4EBA\u9593\u53C2\u52A0\u578B (HITL) \u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u7A3C\u50CD\u72B6\u6CC1"})]}),(0,o.jsxs)("div",{className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8\u540D\u524D\u7A7A\u9593:"," ",(0,o.jsx)("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:s})]})]}),(0,o.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,o.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[(0,o.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),(0,o.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:Ie(i.totalConstraints)})]}),(0,o.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[(0,o.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),(0,o.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:Ie(i.searchIndexes)}),(0,o.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",Ie(i.totalIndexes)]})]}),(0,o.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[(0,o.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),(0,o.jsxs)("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[fe(i.promotionThresholds.confidence)," / ",fe(i.promotionThresholds.cooccurrence," \u56DE")]})]}),(0,o.jsxs)("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[(0,o.jsx)("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),(0,o.jsx)("span",{className:"mt-1 block font-bold font-mono text-amber-600 text-base","data-testid":"ontology-unresolved-count",children:Ie(i.unresolvedCandidatesCount)})]})]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,o.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u4E3B\u8981\u30AF\u30E9\u30B9\u4F53\u7CFB (Node Labels)"}),(0,o.jsx)("p",{className:"text-slate-500 text-xs",children:"\u30B0\u30E9\u30D5\u5185\u3067\u30E2\u30C7\u30EB\u5316\u3055\u308C\u3066\u3044\u308B\u6B63\u6E96\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30CE\u30FC\u30C9\u7A2E\u5225"})]}),(0,o.jsx)("span",{className:"rounded-sm bg-indigo-50 px-2 py-0.5 font-semibold text-indigo-700 text-xs","data-testid":"ontology-classes-count",children:Qe(l)})]}),(0,o.jsxs)("div",{className:"divide-y divide-slate-100",children:[l===null&&(0,o.jsx)("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-classes-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u30AF\u30E9\u30B9\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),l?.map(d=>(0,o.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${d.name}`,children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:d.name}),(0,o.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:d.description})]}),typeof d.count=="number"&&(0,o.jsx)("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:d.count.toLocaleString()})]},d.name))]})]}),(0,o.jsxs)("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),(0,o.jsx)("p",{className:"text-slate-500 text-xs",children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u9593\u306E\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u95A2\u4FC2\u3068\u6709\u5411\u6027"})]}),(0,o.jsx)("span",{className:"rounded-sm bg-amber-50 px-2 py-0.5 font-semibold text-amber-700 text-xs","data-testid":"ontology-predicates-count",children:Qe(r)})]}),(0,o.jsxs)("div",{className:"divide-y divide-slate-100",children:[r===null&&(0,o.jsx)("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-predicates-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u8FF0\u8A9E\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),r?.map(d=>(0,o.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${d.name}`,children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:d.name}),(0,o.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:d.description})]}),(0,o.jsx)("span",{className:"rounded-sm border border-slate-200 bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-600",children:d.direction})]},d.name))]})]})]}),(0,o.jsxs)("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50/40 p-5 shadow-sm","data-testid":"ontology-evolution-policy-card",children:[(0,o.jsx)("h3",{className:"font-bold text-indigo-950 text-sm",children:"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316 (Autonomous Ontology Evolution) \u30DD\u30EA\u30B7\u30FC"}),(0,o.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[(0,o.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[(0,o.jsx)("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),(0,o.jsxs)("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",fe(i.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",fe(i.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",fe(i.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),(0,o.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[(0,o.jsx)("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),(0,o.jsx)("p",{className:"mt-1 text-slate-600",children:"\u904B\u7528\u8005\u306B\u3088\u308A\u6607\u683C\u3092\u5374\u4E0B\u3055\u308C\u305F\u5019\u88DC\u306F\u3001\u524D\u56DE\u306E\u5171\u8D77\u6570\u306E 2 \u500D\u4EE5\u4E0A\u306E\u983B\u5EA6\u3067\u518D\u8A00\u53CA\u3055\u308C\u308B\u307E\u3067\u6607\u683C\u30AD\u30E5\u30FC\u3078\u306E\u518D\u6D6E\u4E0A\u3092\u81EA\u52D5\u6291\u5236\u3002"})]}),(0,o.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[(0,o.jsx)("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),(0,o.jsxs)("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",(0,o.jsx)("code",{className:"font-mono text-indigo-800",children:"tenantId = $tenant_id"})," \u3068\u6A5F\u5BC6\u533A\u5206\u8FF0\u8A9E\u3092\u4E0D\u53EF\u5206\u306B\u5408\u6210\u3057\u3001\u30C6\u30CA\u30F3\u30C8\u5B8C\u5168\u9694\u96E2\u3092\u62C5\u4FDD\u3002"]})]})]})]})]})}var u=require("react/jsx-runtime");function Je(s){return s==null||s<0?"\u672A\u6E2C\u5B9A":s<1024*1024?`${(s/1024).toFixed(1)} KB`:s<1024*1024*1024?`${(s/(1024*1024)).toFixed(1)} MB`:`${(s/(1024*1024*1024)).toFixed(2)} GB`}function Tt({collections:s,probeFailure:i=null,health:l,resources:r,onRefresh:d,isRefreshing:m=!1,onSelectCollection:h,selectedCollectionName:N}){let I=i===null,k=I?s.reduce((b,f)=>b+f.points_count,0):null,_=I?s.reduce((b,f)=>b+f.vectors_count,0):null;return(0,u.jsxs)("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,u.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,u.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996"}),l&&(0,u.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(l.healthy),style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:l.healthy?"#d1fae5":"#fee2e2",color:l.healthy?"#065f46":"#991b1b",fontWeight:600},children:l.healthy?"\u6B63\u5E38\u7A3C\u50CD":"\u969C\u5BB3\u767A\u751F"}),l?.latency_ms!==void 0&&(0,u.jsxs)("span",{"data-testid":"qdrant-latency",style:{fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u901F\u5EA6: ",l.latency_ms," ms"]})]}),d&&(0,u.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:m,onClick:d,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:m?"not-allowed":"pointer",fontSize:"13px"},children:m?"\u66F4\u65B0\u4E2D...":"\u66F4\u65B0"})]}),(0,u.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,u.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:k===null?"\u672A\u6E2C\u5B9A":k.toLocaleString()})]}),(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,u.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:_===null?"\u672A\u6E2C\u5B9A":_.toLocaleString()})]}),(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,u.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:Je(r?.ram_bytes)})]}),(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,u.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:Je(r?.disk_bytes)})]}),(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,u.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:r?.segment_count??"\u672A\u6E2C\u5B9A"})]})]}),(0,u.jsxs)("div",{children:[(0,u.jsxs)("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",I?`${s.length} \u4EF6`:"\u672A\u6E2C\u5B9A",")"]}),i!==null?(0,u.jsx)("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:i}):s.length===0?(0,u.jsx)("p",{"data-testid":"no-collections-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,u.jsx)("div",{style:{overflowX:"auto"},children:(0,u.jsxs)("table",{"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,u.jsx)("th",{style:{padding:"6px 8px"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,u.jsx)("th",{style:{padding:"6px 8px"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,u.jsx)("th",{style:{padding:"6px 8px"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,u.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,u.jsx)("tbody",{children:s.map(b=>{let f=b.collection_name===N,S=b.vectors_config.dense!==void 0,L=b.vectors_config.sparse!==void 0,B=b.vectors_config.image!==void 0;return(0,u.jsxs)("tr",{"data-testid":`collection-row-${b.collection_name}`,"data-collection-name":b.collection_name,"data-selected":String(f),role:h?"button":void 0,tabIndex:h?0:void 0,"aria-selected":f,onClick:()=>h?.(b.collection_name),onKeyDown:$=>{h&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),h(b.collection_name))},style:{borderBottom:"1px solid #f1f5f9",backgroundColor:f?"#eff6ff":"transparent",cursor:h?"pointer":"default",outline:"none"},children:[(0,u.jsx)("td",{style:{padding:"8px",fontWeight:500,color:"#1e293b"},children:b.collection_name}),(0,u.jsx)("td",{style:{padding:"8px",color:"#475569"},children:b.domain_key}),(0,u.jsx)("td",{"data-testid":`collection-points-${b.collection_name}`,style:{padding:"8px",color:"#0f172a"},children:b.points_count.toLocaleString()}),(0,u.jsx)("td",{style:{padding:"8px"},children:(0,u.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[S&&(0,u.jsxs)("span",{"data-testid":`vector-tag-dense-${b.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",b.vectors_config.dense?.size," dim"]}),L&&(0,u.jsx)("span",{"data-testid":`vector-tag-sparse-${b.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fef3c7",color:"#92400e"},children:b.vectors_config.sparse?.modifier?`Sparse (${b.vectors_config.sparse.modifier.toUpperCase()})`:"Sparse"}),B&&(0,u.jsxs)("span",{"data-testid":`vector-tag-image-${b.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",b.vectors_config.image?.size," dim"]})]})})]},b.collection_name)})})]})})]})]})}var et=require("react"),y=require("react/jsx-runtime"),Xe=[{id:"ingestion",title:"\u6587\u66F8\u53D6\u308A\u8FBC\u307F",description:"\u751F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u62BD\u51FA\u3068\u6B63\u898F\u5316\u51E6\u7406\u3092\u5B9F\u884C\u3002"},{id:"chunking",title:"\u968E\u5C64\u30C1\u30E3\u30F3\u30AF\u5206\u5272",description:"\u89AA\u5B50\u30C1\u30E3\u30F3\u30AF\u69CB\u9020\u304A\u3088\u3073\u30C8\u30FC\u30AF\u30F3\u5883\u754C\u5206\u5272\u3002"},{id:"embedding",title:"\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u57CB\u3081\u8FBC\u307F",description:"Dense \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Sparse \u30D9\u30AF\u30C8\u30EB\u751F\u6210\u3002"},{id:"vector_indexing",title:"\u30D9\u30AF\u30C8\u30EB\u683C\u7D0D",description:"Qdrant \u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3078\u306E\u30D9\u30AF\u30C8\u30EB\u767B\u9332\u3002",circuitBreakerKey:"vector",configKey:"enable_vector_indexing"},{id:"graph_indexing",title:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u683C\u7D0D",description:"Neo4j \u3078\u306E\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304A\u3088\u3073\u95A2\u4FC2\u6027\u6295\u5F71\u3002",circuitBreakerKey:"graph",configKey:"enable_graph_indexing"},{id:"asset_extraction",title:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA",description:"\u753B\u50CF\u30FB\u8868\u30FB\u30E1\u30C7\u30A3\u30A2\u30A2\u30BB\u30C3\u30C8\u306E\u5207\u308A\u51FA\u3057\u3068 OCR \u51E6\u7406\u3002",configKey:"enable_asset_extraction"},{id:"synthesis",title:"\u8981\u7D04\u30FB\u63A8\u8AD6\u751F\u6210",description:"LLM \u306B\u3088\u308B\u69CB\u9020\u5316\u62BD\u51FA\u304A\u3088\u3073\u8981\u7D04\u5408\u6210\u3002",circuitBreakerKey:"llm",configKey:"enable_summary_generation"}],Ce="\u672A\u6E2C\u5B9A (\u53CE\u96C6\u7D4C\u8DEF\u304C\u672A\u7D50\u7DDA)",Dt={active:"\u7A3C\u50CD\u4E2D",partial:"\u4E00\u90E8\u30C9\u30E1\u30A4\u30F3\u306E\u307F",degraded:"\u7E2E\u9000",disabled:"\u7121\u52B9",unmeasured:"\u672A\u6E2C\u5B9A"},Ye={active:{background:"#d1fae5",text:"#065f46"},partial:{background:"#dbeafe",text:"#1e40af"},degraded:{background:"#fef3c7",text:"#92400e"},disabled:{background:"#e2e8f0",text:"#475569"},unmeasured:{background:"#f1f5f9",text:"#64748b"}};function $t(s){if(!s)return"";let i=[];return s.featureFlagKey===null?i.push("\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057"):s.featureFlag===!1?i.push("\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u304C\u7121\u52B9"):s.featureFlag===null&&i.push("\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A"),s.domainsEnabled!==null&&s.domainsTotal!==null?i.push(`\u6709\u52B9\u30C9\u30E1\u30A4\u30F3 ${s.domainsEnabled}/${s.domainsTotal}`):i.push("\u30C9\u30E1\u30A4\u30F3\u6226\u7565\u672A\u6E2C\u5B9A"),i.join(" \uFF5C ")}function Ze(s,i,l){let r=s.configKey===void 0?void 0:i[s.configKey];if(r){if(r.featureFlag===!1||r.domainsEnabled===0)return"disabled";if((r.featureFlag===!0||r.featureFlagKey===null)&&r.domainsEnabled!==null&&r.domainsTotal!==null&&r.domainsEnabled<r.domainsTotal)return"partial";if(r.featureFlagKey!==null&&r.featureFlag===null||r.domainsEnabled===null)return"unmeasured"}if(s.circuitBreakerKey&&l){let d=l[s.circuitBreakerKey];if(d==="OPEN"||d==="HALF_OPEN")return"degraded"}return s.configKey===void 0&&s.circuitBreakerKey===void 0?"unmeasured":"active"}function Pt({pipelineConfig:s,circuitBreakerStatus:i,stageMetrics:l,selectedNodeId:r,onNodeSelect:d}){let[m,h]=(0,et.useState)(null),N=r!==void 0?r:m,I=S=>{h(S),d&&d(S)},k=Xe.find(S=>S.id===N),_=k&&l?l[k.id]:void 0,b=k?Ze(k,s,i):null,f=k?.circuitBreakerKey&&i?i[k.circuitBreakerKey]:void 0;return(0,y.jsxs)("div",{"data-testid":"rag-pipeline-graph-viewer",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#f8fafc"},children:[(0,y.jsx)("h2",{"data-testid":"rag-graph-title",style:{margin:"0 0 12px 0",fontSize:"16px",color:"#1e293b"},children:"RAG \u5B9F\u884C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u69CB\u6210"}),(0,y.jsx)("div",{"data-testid":"rag-nodes-container",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"12px",marginBottom:"16px"},children:Xe.map(S=>{let L=Ze(S,s,i),B=S.id===N,$=S.circuitBreakerKey&&i?i[S.circuitBreakerKey]:void 0,D=B?"#2563eb":L==="active"?"#10b981":L==="degraded"?"#f59e0b":"#94a3b8",M=L==="active"?"#ecfdf5":L==="degraded"?"#fffbeb":"#f1f5f9";return(0,y.jsxs)("button",{type:"button","data-testid":`rag-node-${S.id}`,"data-node-id":S.id,"data-node-status":L,"data-selected":String(B),"aria-pressed":B,...$?{"data-circuit-breaker":$}:{},onClick:()=>I(S.id),style:{border:`2px solid ${D}`,backgroundColor:M,borderRadius:"6px",padding:"10px",cursor:"pointer",transition:"all 0.15s ease",textAlign:"left",width:"100%"},children:[(0,y.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px"},children:[(0,y.jsx)("span",{style:{fontWeight:600,fontSize:"14px",color:"#0f172a"},children:S.title}),(0,y.jsx)("span",{"data-testid":`badge-${S.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:Ye[L].background,color:Ye[L].text,fontWeight:500},children:Dt[L]})]}),(0,y.jsx)("p",{style:{margin:0,fontSize:"12px",color:"#64748b",lineHeight:1.4},children:S.description}),S.configKey!==void 0&&(0,y.jsx)("p",{"data-testid":`gates-${S.id}`,style:{margin:"4px 0 0 0",fontSize:"11px",color:"#475569",lineHeight:1.4},children:$t(s[S.configKey])})]},S.id)})}),k&&(0,y.jsxs)("div",{"data-testid":"rag-node-detail-panel",style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"14px",backgroundColor:"#ffffff"},children:[(0,y.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[(0,y.jsxs)("h3",{"data-testid":"detail-stage-title",style:{margin:0,fontSize:"15px",color:"#0f172a"},children:[k.title," \u8A73\u7D30"]}),(0,y.jsx)("button",{type:"button","data-testid":"close-detail-panel","aria-label":"\u8A73\u7D30\u30D1\u30CD\u30EB\u3092\u9589\u3058\u308B",onClick:()=>{h(null),d&&d(null)},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#64748b"},children:"\u2715"})]}),(0,y.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"8px",fontSize:"13px"},children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u7A3C\u50CD\u30B9\u30C6\u30FC\u30BF\u30B9: "}),(0,y.jsx)("span",{"data-testid":"node-detail-status",children:b})]}),f&&(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u56DE\u8DEF\u906E\u65AD\u5668: "}),(0,y.jsx)("span",{"data-testid":"node-detail-circuit-breaker",children:f})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u30EC\u30A4\u30C6\u30F3\u30B7 (p50): "}),(0,y.jsx)("span",{"data-testid":"node-metric-latency-p50",children:_?`${_.latency_p50_ms} ms`:Ce})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u30EC\u30A4\u30C6\u30F3\u30B7 (p95): "}),(0,y.jsx)("span",{"data-testid":"node-metric-latency-p95",children:_?`${_.latency_p95_ms} ms`:Ce})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8: "}),(0,y.jsx)("span",{"data-testid":"node-metric-throughput",children:_?`${_.throughput_rps} rps`:Ce})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:"\u6210\u529F\u7387: "}),(0,y.jsx)("span",{"data-testid":"node-metric-success-rate",children:_?`${(_.success_rate*100).toFixed(1)}%`:Ce})]})]})]})]})}var p=require("react/jsx-runtime"),Mt="\u5BFE\u8C61\u306A\u3057";function Ft({counts:s,totalFiles:i,failedItems:l=[],onRetryAll:r,onRetryItem:d,isRetrying:m=!1,onRefresh:h}){let N=s.SYNCED??0,I=s.PENDING??0,k=(s.EXTRACTING??0)+(s.ENRICHING??0)+(s.PROJECTING??0),_=(s.FAILED_EXTRACT??0)+(s.FAILED_ENRICH??0)+(s.FAILED_VECTOR??0)+(s.FAILED_GRAPH??0),b=i>0?`${(N/i*100).toFixed(1)}%`:Mt;return(0,p.jsxs)("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,p.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,p.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,p.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:i})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,p.jsx)("span",{"data-testid":"success-rate-value",children:b}),")"]})]}),(0,p.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[h&&(0,p.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:h,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),r&&(0,p.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:m||_===0,onClick:r,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:m||_===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:m||_===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:m?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,p.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,p.jsxs)("div",{"data-testid":"status-card-synced","data-count":N,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,p.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,p.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:N})]}),(0,p.jsxs)("div",{"data-testid":"status-card-processing","data-count":k,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,p.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,p.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:k})]}),(0,p.jsxs)("div",{"data-testid":"status-card-pending","data-count":I,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,p.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,p.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:I})]}),(0,p.jsxs)("div",{"data-testid":"status-card-failed","data-count":_,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,p.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,p.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:_})]})]}),(0,p.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,p.jsxs)("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},"data-testid":"failed-items-heading",children:["\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7 (",l.length<_?`\u4E0A\u4F4D ${l.length} \u4EF6 / \u5168 ${_} \u4EF6`:`${l.length} \u4EF6`,")"]}),l.length===0?(0,p.jsx)("p",{"data-testid":"no-failed-items-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,p.jsx)("div",{style:{overflowX:"auto"},children:(0,p.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,p.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,p.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,p.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,p.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,p.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,p.jsx)("tbody",{children:l.map(f=>(0,p.jsxs)("tr",{"data-testid":`failed-item-row-${f.id}`,"data-file-uri":f.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,p.jsxs)("td",{"data-testid":`failed-item-uri-${f.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,p.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:f.file_name}),(0,p.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:f.file_uri})]}),(0,p.jsx)("td",{style:{padding:"8px"},children:(0,p.jsx)("span",{"data-testid":`failed-item-status-${f.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:f.sync_status})}),(0,p.jsx)("td",{"data-testid":`failed-item-error-${f.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:f.error_message??"",children:f.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,p.jsx)("td",{"data-testid":`failed-item-time-${f.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:f.failed_at??"\u8A18\u9332\u306A\u3057"}),(0,p.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:d&&(0,p.jsx)("button",{type:"button","data-testid":`retry-item-button-${f.id}`,"aria-label":`${f.file_name} (${f.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:m,onClick:()=>d(f.id,f.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:m?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},f.id))})]})})]})]})}0&&(module.exports={DegradedSearchBanner,DocumentIngestConsole,EnrichmentStrategyBoard,InfrastructureHealthMonitor,MetadataSearchWorkbench,OntologyStatusCard,QdrantStorageCard,RAGPipelineGraphViewer,REASON_LABELS,SEARCH_MODE_LABELS,SEARCH_PRESETS,SyncStatusMonitor,gateStateOf,ingestRowAction});