@aiquants/enrichment-react 0.1.1 → 0.2.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/dist/index.cjs CHANGED
@@ -1 +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});
1
+ "use strict";var ft=Object.defineProperty;var Ia=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Ca=Object.prototype.hasOwnProperty;var Pa=(e,t)=>{for(var o in t)ft(e,o,{get:t[o],enumerable:!0})},La=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of _a(t))!Ca.call(e,l)&&l!==o&&ft(e,l,{get:()=>t[l],enumerable:!(c=Ia(t,l))||c.enumerable});return e};var $a=e=>La(ft({},"__esModule",{value:!0}),e);var $s={};Pa($s,{CHUNK_SOURCE_LABELS:()=>ca,DegradedSearchBanner:()=>xt,DocumentIngestConsole:()=>Ba,EnrichmentStrategyBoard:()=>Ua,FLOW_FOCUS_RING:()=>Te,FLOW_GEOMETRY:()=>ia,FLOW_NODE_TEXT:()=>Me,FinishedInstant:()=>Xe,GATE_POLICY_LABELS:()=>Ot,GATE_STATE_PRESENTATION:()=>Mt,InfrastructureHealthMonitor:()=>Va,MetadataSearchWorkbench:()=>Qa,ModelComparisonWorkbench:()=>Xa,NOTHING_TO_READ_LABELS:()=>jt,OntologyStatusCard:()=>Za,PHASE_LABELS:()=>Tt,PIPELINE_RUN_STATUS_PRESENTATION:()=>De,PIPELINE_STEP_STATUS_PRESENTATION:()=>ot,PIPELINE_TRIGGER_LABELS:()=>rt,PipelineFlowViewer:()=>ds,PipelineRunInspector:()=>vs,QdrantStorageCard:()=>Cs,REASON_LABELS:()=>Ut,RecordedInstant:()=>ge,SCORE_DISPLAY_DECIMALS:()=>Pt,SEARCH_MODE_LABELS:()=>It,SEARCH_PRESETS:()=>oa,STEP_CARDS_OPEN_LIMIT:()=>ba,SyncStatusMonitor:()=>Ls,UNFINISHED_LABEL:()=>vt,formatComparisonScore:()=>Ct,gateCaption:()=>ua,gateState:()=>Ft,gateStateOf:()=>wt,ingestRowAction:()=>Yt,layoutFlow:()=>$t,pipelineRunPresentationKey:()=>Le,rankAgreement:()=>ra,skipReasonLabel:()=>ht,stepGatePolicy:()=>At,stepGateState:()=>pa});module.exports=$a($s);var Re=require("react/jsx-runtime"),Ut={empty_query:"\u691C\u7D22\u8A9E\u304C\u7A7A\u306E\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",caller_token_unavailable:"\u8A8D\u8A3C\u60C5\u5831\u3092\u53D6\u5F97\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u304F\u3060\u3055\u3044\u3002",time_window_unsupported:"\u671F\u9593\u306E\u7D5E\u308A\u8FBC\u307F\u306F\u610F\u5473\u691C\u7D22\u3067\u306F\u6307\u5B9A\u3067\u304D\u306A\u3044\u305F\u3081\u3001\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u30D9\u30AF\u30C8\u30EB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C 1 \u3064\u3082\u306A\u3044\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u672A\u4F5C\u6210\u306E\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u5B8C\u4E86\u3059\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",remote_tiers_unavailable:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u306B\u63A5\u7D9A\u3067\u304D\u306A\u3044\u304B\u3001\u505C\u6B62\u4E2D\u3067\u3059\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002",remote_tiers_timed_out:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u6642\u9593\u5185\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002\u518D\u8A66\u884C\u3059\u308B\u304B\u6761\u4EF6\u3092\u7D5E\u3063\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_refused_caller:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u3053\u306E\u5229\u7528\u8005\u306E\u8981\u6C42\u3092\u62D2\u5426\u3057\u307E\u3057\u305F (\u8A8D\u8A3C\u307E\u305F\u306F\u6A29\u9650)\u3002\u518D\u30B5\u30A4\u30F3\u30A4\u30F3\u3059\u308B\u304B\u3001\u6A29\u9650\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_rejected_request:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u691C\u7D22\u6761\u4EF6\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u6761\u4EF6\u3092\u898B\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_failed:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u51E6\u7406\u4E2D\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002\u7D9A\u304F\u5834\u5408\u306F\u7BA1\u7406\u8005\u3078\u9023\u7D61\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_not_executed:"\u610F\u5473\u691C\u7D22\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F (\u7406\u7531\u306F\u5831\u544A\u3055\u308C\u3066\u3044\u307E\u305B\u3093)\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","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"};function xt({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let c=(e.degradation_reason??"").split(",").map(l=>l.trim()).filter(l=>l.length>0);return(0,Re.jsx)("div",{role:"status","data-testid":"degraded-search-banner","data-quality-tier":e.quality_tier,"data-search-mode":e.search_mode,"data-degraded":"true",style:{padding:"12px 16px",borderRadius:"6px",border:"1px solid #f59e0b",backgroundColor:"#fffbeb",color:"#92400e",marginBottom:"12px"},children:(0,Re.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("p",{"data-testid":"degraded-mode-message",style:{margin:0,fontWeight:600},children:["\u691C\u7D22\u7D50\u679C\u306F\u7E2E\u9000\u30E2\u30FC\u30C9 (",e.search_mode,") \u3067\u53D6\u5F97\u3055\u308C\u3066\u3044\u307E\u3059\u3002"]}),c.length>0&&(0,Re.jsx)("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:c.map(l=>(0,Re.jsx)("li",{"data-testid":`degraded-reason-${l}`,children:Ut[l]??l},l))})]}),t&&(0,Re.jsx)("button",{type:"button","data-testid":"degraded-banner-dismiss",onClick:t,"aria-label":"\u9589\u3058\u308B",style:{background:"none",border:"none",cursor:"pointer",color:"#92400e",fontWeight:"bold",fontSize:"14px",padding:"2px 6px"},children:"\u2715"})]})})}var Ee=require("@aiquants/enrichment-core"),V=require("react");var qt=require("@aiquants/console-ui/core");function Ae(e,t,o){try{(0,qt.formatCount)(e,o)}catch(c){throw new RangeError(`${t}: ${c.message}`,{cause:c})}return e}var Ht=1024,Ta=[{name:"B",power:0,fractionDigits:0},{name:"KiB",power:1,fractionDigits:1},{name:"MiB",power:2,fractionDigits:1},{name:"GiB",power:3,fractionDigits:2},{name:"TiB",power:4,fractionDigits:2}];function Gt(e,t){return Number((e/Ht**t.power).toFixed(t.fractionDigits))}function st(e,t,o){Ae(e,t,o);let[c,...l]=Ta,p=c,b=Gt(e,p);for(let m of l){if(b<Ht)break;p=m,b=Gt(e,p)}return`${new Intl.NumberFormat(o,{minimumFractionDigits:p.fractionDigits,maximumFractionDigits:p.fractionDigits,useGrouping:!0}).format(b)} ${p.name}`}var qe=require("@aiquants/console-ui"),yt=require("react");var We="ja-JP";function te(){let e=(0,qe.useConsoleUi)();if(e.locale!=="ja"||e.formatLocale!==We)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${We}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function q(e){return te(),(0,yt.createElement)(qe.Measured,e)}function zt(e){return te(),(0,yt.createElement)(qe.RowButton,e)}var je=require("react/jsx-runtime"),Je=/[^\s\x1c-\x1f\x85\ufeff]/,Aa={fontVariantNumeric:"tabular-nums"},Da={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Wt({text:e,testId:t,slot:o}){if(te(),e===null)return(0,je.jsx)(q,{value:null,testId:t});if(!Je.test(e))throw new RangeError(`${t}: a measured text must not be empty or only white space (pass null when the value was not measured)`);return(0,je.jsx)("span",{"data-measured":"true","data-testid":t,style:o,children:e})}function Qe({text:e,testId:t}){return(0,je.jsx)(Wt,{text:e,testId:t,slot:Aa})}function Se({text:e,testId:t}){return(0,je.jsx)(Wt,{text:e,testId:t,slot:Da})}var nt=require("@aiquants/enrichment-core"),De={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800"},FAILED_RETRY_SCHEDULED:{label:"\u5931\u6557 (\u518D\u8A66\u884C\u4E88\u5B9A)",className:"bg-amber-100 text-amber-800"}},ot={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800",bar:"bg-blue-400"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800",bar:"bg-emerald-500"},SKIPPED:{label:"\u7701\u7565",className:"bg-slate-100 text-slate-700",bar:"bg-slate-300"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800",bar:"bg-red-500"}},rt={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},vt="\u672A\u5B8C\u4E86";function Le(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var jt={no_pages:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u30DA\u30FC\u30B8\u306A\u3057)",no_pages_rendered:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u63CF\u753B\u3067\u304D\u305F\u30DA\u30FC\u30B8\u306A\u3057)"};function ht(e){let t=(0,nt.parseSkipReason)(e);if(t===null)return e;switch(t.kind){case"gate_closed":return`${t.featureFlagKey} \u304C\u7121\u52B9`;case"no_children":return"\u5B50\u30A2\u30BB\u30C3\u30C8\u306A\u3057";case"source_skipped":return`${nt.PIPELINE_STEPS[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return jt[t.token]}}var Jt=require("@aiquants/console-ui/core");function Qt(e,t){return(0,Jt.formatInstant)(e,We,t)}var Nt=require("react/jsx-runtime");function ge({iso:e,testId:t}){let{timeZone:o}=te();return(0,Nt.jsx)(Se,{text:e===null?null:Qt(e,o),testId:t})}function Xe({iso:e,testId:t}){return te(),e===null?vt:(0,Nt.jsx)(ge,{iso:e,testId:t})}var s=require("react/jsx-runtime"),Ma=new Set(Ee.EnrichmentSyncStatusSchema.options.filter(e=>e.startsWith("FAILED"))),Oa=new Set(Ee.EnrichmentSyncStatusSchema.options);function Yt(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Ma.has(e.syncStatus)?{kind:"retry"}:Oa.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Xt(e,t,o){let c=e?.find(l=>l.confidentialityLevel===t&&l.capability===o);return c?c.isEnabled:null}var Fa={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"},Ka=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function St({field:e}){return(0,s.jsx)("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Ba({policies:e,tenantId:t,domainOptions:o,recentItems:c=[],inspectionResult:l=null,isSubmitting:p=!1,isInspecting:b=!1,onInspectUri:m,onIngestDocument:y,onRetryItem:N,onShowHistory:h}){let{formatLocale:C}=te(),E=(0,V.useId)(),J=(0,V.useId)(),ae=(0,V.useId)(),K=(0,V.useId)(),I=(0,V.useId)(),Q=(0,V.useId)(),R=(0,V.useId)(),O=(0,V.useId)(),[A,L]=(0,V.useState)("gdrive://"),[G,g]=(0,V.useState)(""),[$,B]=(0,V.useState)(""),[D,re]=(0,V.useState)("CONFIDENTIAL"),[Z,be]=(0,V.useState)(null),[fe,_]=(0,V.useState)(""),[ie,H]=(0,V.useState)(""),[X,U]=(0,V.useState)([]),[xe,ne]=(0,V.useState)(""),[he,Ie]=(0,V.useState)("user"),[le,ye]=(0,V.useState)(1),[u,T]=(0,V.useState)(!1),ee=Z!==null&&o.some(r=>r.key===Z)?Z:o.length>0?o[0].key:null,z=(0,V.useMemo)(()=>({vectorEnabled:Xt(e,D,"vector_indexing"),graphEnabled:Xt(e,D,"graph_indexing")}),[e,D]),se=(0,V.useMemo)(()=>{let r=$.trim();if(!r)return{valid:!1,error:null};if(!(r.startsWith("file://")||r.startsWith("gdrive://")||r.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 W=r.replace(/^(file|gdrive|gcs):\/\//,"");return!W.trim()||W.trim()==="<id>"||W.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:r.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}},[$]),Fe=r=>{let k=r.trim(),W=k.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(W)return W[1];let ve=k.match(/[?&]id=([a-zA-Z0-9_-]+)/);return ve?ve[1]:null},_e=r=>{if(L(r),G.trim()){let k=G.trim().replace(/^(file|gdrive|gcs):\/\//,"");B(`${r}${k}`)}else B("")},Ke=r=>{let k=r.trim();if(!k){g(""),B("");return}let W=Fe(k);if(W){L("gdrive://"),g(W),B(`gdrive://${W}`);return}if(k.startsWith("gdrive://")){L("gdrive://");let ve=k.replace(/^gdrive:\/\//,"");g(ve),B(k);return}if(k.startsWith("file://")){L("file://");let ve=k.replace(/^file:\/\//,"");g(ve),B(k);return}if(k.startsWith("gcs://")){L("gcs://");let ve=k.replace(/^gcs:\/\//,"");g(ve),B(k);return}if(k.includes("://")){g(r),B(k);return}g(r),B(`${A}${k}`)},we=r=>{switch(r){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)"}},M=()=>{let r=xe.trim();r&&(X.some(k=>k.labelKey===r)||(U(k=>[...k,{labelKey:r,category:he,confidenceScore:Number(le.toFixed(2))}]),ne("")))},Be=r=>{X.some(k=>k.labelKey===r)||U(k=>[...k,{labelKey:r,category:"domain",confidenceScore:1}])},Ne=r=>{U(k=>k.filter(W=>W.labelKey!==r))},at=r=>{if(r.preventDefault(),!se.valid||ee===null)return;let k={fileUri:$.trim(),confidentialityLevel:D,targetDomainKey:ee,departmentId:fe.trim()?Number(fe):null,titleOverride:ie.trim()?ie.trim():null,labels:X};y?.(k)},Ue=r=>{let k=Yt(r);if(k.kind==="blocked")return(0,s.jsx)("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${r.id}`,"data-reason":k.reason,children:k.reason});let W=k.kind==="retry";return(0,s.jsx)("button",{type:"button",onClick:()=>N?.(r.id),"aria-label":`${r.fileName} \u3092${W?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:W?"rounded-sm border border-red-200 border-solid bg-red-50 px-2 py-1 font-semibold text-red-700 text-xs hover:bg-red-100":"rounded-sm border border-emerald-200 border-solid bg-emerald-50 px-2 py-1 font-semibold text-emerald-700 text-xs hover:bg-emerald-100","data-testid":`ingest-${k.kind}-button-${r.id}`,children:W?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},bt=r=>{switch(r){case"SYNCED":return(0,s.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,s.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,s.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,s.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,s.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 r.startsWith("FAILED")?(0,s.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: ",r]}):(0,s.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:r})}};return(0,s.jsxs)("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,s.jsxs)("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210"}),(0,s.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,s.jsxs)("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",(0,s.jsx)("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),(0,s.jsxs)("form",{onSubmit:at,className:"mt-6 space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("label",{htmlFor:E,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",(0,s.jsx)(St,{field:"uri"})]}),(0,s.jsxs)("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",(0,s.jsx)("strong",{className:"font-semibold text-indigo-600",children:A})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),(0,s.jsx)("button",{type:"button",onClick:()=>_e("gdrive://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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,s.jsx)("button",{type:"button",onClick:()=>_e("file://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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,s.jsx)("button",{type:"button",onClick:()=>_e("gcs://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${A==="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,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[(0,s.jsxs)("div",{className:`flex min-w-0 grow basis-full rounded-lg border border-solid shadow-sm transition-colors focus-within:ring-2 sm:basis-0 ${se.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,s.jsx)("span",{className:"inline-flex select-none items-center rounded-l-lg border-slate-200 border-r border-solid bg-slate-50 px-3.5 font-mono font-semibold text-slate-700 text-sm","data-testid":"scheme-prefix-badge",children:A}),(0,s.jsx)("input",{id:E,type:"text",value:G,onChange:r=>Ke(r.target.value),placeholder:we(A),"aria-invalid":!!se.error,"aria-describedby":se.error?"ingest-uri-error":void 0,className:"min-w-0 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,s.jsx)("button",{type:"button",onClick:()=>m?.($.trim()),disabled:!se.valid||b,className:"inline-flex items-center justify-center rounded-lg border border-slate-300 border-solid 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:b?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[(0,s.jsxs)("p",{className:"text-slate-500",children:[A==="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",A==="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",A==="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"]}),$&&(0,s.jsxs)("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[(0,s.jsx)("span",{children:"\u89E3\u6C7A URI:"}),(0,s.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:$})]})]})]}),se.error&&(0,s.jsx)("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:se.error})]}),l&&l.fileUri===$.trim()&&(0,s.jsxs)("section",{"aria-live":"polite","aria-label":"\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",className:`rounded-lg border border-solid p-4 text-sm transition-all ${l.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,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold",children:l.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,s.jsx)("span",{className:"font-mono text-slate-500 text-xs",children:l.fileUri})]}),l.exists&&(0,s.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.fileName})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:(0,s.jsx)(Se,{text:st(l.fileSize,"fileSize",C),testId:"inspection-file-size-value"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"MIME:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.mimeType})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),(0,s.jsx)("span",{className:"font-semibold text-slate-800",children:l.revisionId?.slice(0,8)??"N/A"})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:J,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",(0,s.jsx)(St,{field:"confidentiality"})]}),(0,s.jsx)("select",{id:J,value:D,onChange:r=>re(r.target.value),className:"w-full rounded-lg border border-slate-300 border-solid 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:Ee.ConfidentialityLevelSchema.options.map(r=>(0,s.jsxs)("option",{value:r,children:[r," (",Fa[r],")"]},r))})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:ae,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",(0,s.jsx)(St,{field:"domain"})]}),(0,s.jsx)("select",{id:ae,value:ee===null?"":ee,onChange:r=>be(r.target.value),disabled:o.length===0,className:"w-full rounded-lg border border-slate-300 border-solid 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 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":"ingest-domain-select",children:o.map(r=>(0,s.jsx)("option",{value:r.key,children:r.label},r.key))}),o.length===0&&(0,s.jsx)("p",{className:"text-[11px] text-amber-800","data-testid":"ingest-domain-empty",children:"\u9078\u3079\u308B\u30C9\u30E1\u30A4\u30F3\u304C\u6E21\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30C9\u30E1\u30A4\u30F3\u304C\u7121\u3044\u3068\u53D6\u308A\u8FBC\u307F\u306F\u6295\u5165\u3067\u304D\u307E\u305B\u3093\u3002"})]})]}),D===Ee.QUARANTINED_CONFIDENTIALITY_LEVEL&&(0,s.jsxs)("div",{className:"rounded-lg border border-amber-300 border-solid bg-amber-50 p-3 text-amber-900 text-xs",role:"alert","data-testid":"restricted-warning-banner",children:[(0,s.jsx)("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Ee.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,s.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,s.jsxs)("div",{className:"space-y-2 rounded-lg border border-indigo-100 border-solid bg-indigo-50/30 p-4","data-testid":"projection-capability-card",children:[(0,s.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,s.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,s.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),(0,s.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":z.vectorEnabled===null?"unknown":String(z.vectorEnabled),children:z.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":z.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${D} \u306E\u8A2D\u5B9A)`})]}),(0,s.jsxs)("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[(0,s.jsx)("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),(0,s.jsx)("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":z.graphEnabled===null?"unknown":String(z.graphEnabled),children:z.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":z.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${D} \u306E\u8A2D\u5B9A)`})]})]}),(0,s.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,s.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,s.jsxs)("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),(0,s.jsxs)("span",{className:"text-slate-500 text-xs",children:[X.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),Ka.map(r=>(0,s.jsxs)("button",{type:"button",onClick:()=>Be(r),className:"rounded-full border border-slate-200 border-solid 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-${r}`,children:["+ ",r]},r))]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[(0,s.jsxs)("div",{className:"space-y-1 sm:col-span-2",children:[(0,s.jsx)("label",{htmlFor:Q,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),(0,s.jsx)("input",{id:Q,type:"text",value:xe,onChange:r=>ne(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),M())},placeholder:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04, 2026\u5E74\u5EA6",className:"w-full rounded-sm border border-slate-300 border-solid 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,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:R,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),(0,s.jsxs)("select",{id:R,value:he,onChange:r=>Ie(r.target.value),className:"w-full rounded-sm border border-slate-300 border-solid 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,s.jsx)("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),(0,s.jsx)("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),(0,s.jsx)("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("label",{htmlFor:O,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",le.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,s.jsx)("input",{id:O,type:"range",min:"0.0",max:"1.0",step:"0.05",value:le,"aria-valuenow":le,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(le*100)}%`,onChange:r=>ye(Number.parseFloat(r.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),(0,s.jsx)("div",{children:(0,s.jsx)("button",{type:"button",onClick:M,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"})})]}),X.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:X.map(r=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-200 border-solid bg-indigo-50 px-2.5 py-1 font-medium text-indigo-800 text-xs","data-testid":`active-label-${r.labelKey}`,children:[(0,s.jsx)("span",{className:"font-semibold",children:r.labelKey}),(0,s.jsxs)("span",{className:"text-indigo-400",children:["(",r.category,")"]}),(0,s.jsx)("button",{type:"button",onClick:()=>Ne(r.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${r.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${r.labelKey}`,children:"\xD7"})]},r.labelKey))})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":u,"aria-controls":"advanced-settings-panel",onClick:()=>T(r=>!r),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,s.jsxs)("span",{children:[u?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),u&&(0,s.jsxs)("section",{id:"advanced-settings-panel","aria-labelledby":"advanced-settings-toggle",className:"space-y-4 rounded-lg border border-slate-200 border-solid bg-slate-50/40 p-4","data-testid":"advanced-settings-panel",children:[(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:I,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),(0,s.jsx)("input",{id:I,type:"text",value:ie,onChange:r=>H(r.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 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-title-override-input"})]})}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{htmlFor:K,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),(0,s.jsx)("input",{id:K,type:"number",value:fe,onChange:r=>_(r.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-department-input"})]})})]})]}),(0,s.jsx)("div",{className:"flex justify-end pt-2",children:(0,s.jsx)("button",{type:"submit",disabled:!se.valid||ee===null||p||b,"aria-busy":p,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:p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),(0,s.jsx)("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):(0,s.jsx)("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),(0,s.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,s.jsx)("div",{className:"flex items-center justify-between",children:(0,s.jsxs)("div",{children:[(0,s.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,s.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"})]})}),c.length===0?(0,s.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,s.jsx)("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:(0,s.jsxs)("table",{className:"min-w-full divide-y divide-solid 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,s.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),(0,s.jsx)("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:c.map(r=>(0,s.jsxs)("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${r.id}`,children:[(0,s.jsx)("td",{className:"px-3 py-2 font-bold",children:r.id}),(0,s.jsxs)("td",{className:"max-w-xs truncate px-3 py-2",title:r.fileUri,children:[(0,s.jsx)("div",{className:"font-sans font-semibold text-slate-900",children:r.fileName}),(0,s.jsx)("div",{className:"truncate text-[11px] text-slate-600",children:r.fileUri})]}),(0,s.jsx)("td",{className:"px-3 py-2",children:(0,s.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:r.confidentialityLevel})}),(0,s.jsxs)("td",{className:"px-3 py-2 text-slate-600",children:["rev.",r.revision,r.isCurrent===!1&&(0,s.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-600","data-testid":`ingest-item-superseded-${r.id}`,children:"\u65E7\u7248"})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans",children:[bt(r.syncStatus),r.errorMessage!==null&&r.errorMessage!==void 0&&r.errorMessage!==""&&(0,s.jsx)("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${r.id}`,title:r.errorMessage,children:r.errorMessage})]}),(0,s.jsxs)("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${r.id}`,children:[r.lastRun===null?(0,s.jsx)("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${r.id}`,children:"\u8A18\u9332\u306A\u3057"}):(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${De[Le(r.lastRun)].className}`,"data-testid":`ingest-last-run-status-${r.id}`,"data-status":r.lastRun.status,"data-presentation":Le(r.lastRun),children:De[Le(r.lastRun)].label}),r.lastRun.failedStepKey!==null&&(0,s.jsx)("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${r.id}`,children:Ee.PIPELINE_STEPS[r.lastRun.failedStepKey].label}),(0,s.jsx)("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${r.id}`,children:(0,s.jsx)(Xe,{iso:r.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${r.id}`})})]}),h!==void 0&&(0,s.jsx)("button",{type:"button",onClick:()=>h(r.id),"aria-label":`${r.fileName} \u306E\u5C65\u6B74`,className:"mt-1 rounded-sm border border-slate-300 border-solid bg-white px-2 py-0.5 font-semibold text-[11px] text-slate-700 hover:bg-slate-50","data-testid":`ingest-history-button-${r.id}`,children:"\u5C65\u6B74"})]}),(0,s.jsx)("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${r.id}`,children:(0,s.jsx)(ge,{iso:r.createdAt,testId:`ingest-created-at-value-${r.id}`})}),(0,s.jsx)("td",{className:"px-3 py-2 text-right font-sans",children:Ue(r)})]},r.id))})]})})]})]})}var dt=require("@aiquants/enrichment-core"),F=require("react/jsx-runtime"),Zt={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 wt(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Ua({strategies:e,featureFlags:t,onToggleStage:o,isUpdating:c=!1}){let l=o===void 0;return(0,F.jsxs)("div",{"data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),(0,F.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,F.jsx)("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",e.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",dt.ENRICHMENT_STAGES.length," \u6BB5\u3002"]}),l&&(0,F.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"})]}),e.length===0?(0,F.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,F.jsx)("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:(0,F.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,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-left font-semibold text-slate-600",children:"\u30C9\u30E1\u30A4\u30F3"}),dt.ENRICHMENT_STAGES.map(p=>{let b=wt(p.featureFlagKey,t);return(0,F.jsxs)("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[(0,F.jsx)("div",{children:p.label}),(0,F.jsx)("div",{"data-testid":`strategy-gate-${p.key}`,"data-gate":b,className:"mt-0.5 font-normal text-[10px]",style:{color:Zt[b].color},children:Zt[b].label})]},p.key)})]})}),(0,F.jsx)("tbody",{children:e.map(p=>(0,F.jsxs)("tr",{"data-testid":`strategy-row-${p.domainKey}`,"data-provenance":p.provenance,"data-active":String(p.isActive),children:[(0,F.jsxs)("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[(0,F.jsx)("div",{className:"font-semibold text-slate-900",children:p.domainLabel}),(0,F.jsxs)("div",{className:"text-[10px] text-slate-500",children:[(0,F.jsx)("code",{children:p.domainKey})," / ",p.strategyName]}),(0,F.jsx)("div",{"data-testid":`strategy-provenance-${p.domainKey}`,className:"text-[10px] text-slate-500",children:p.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"}),!p.isActive&&(0,F.jsx)("div",{"data-testid":`strategy-inactive-${p.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"})]}),dt.ENRICHMENT_STAGES.map(b=>{let m=p.stages[b.key],y=wt(b.featureFlagKey,t);return(0,F.jsxs)("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[(0,F.jsx)("button",{type:"button",role:"switch","aria-checked":m,"aria-label":`${p.domainLabel} \u306E ${b.label}`,"data-testid":`strategy-stage-${p.domainKey}-${b.key}`,"data-enabled":String(m),"data-effective":String(m&&(y==="open"||y==="absent")),disabled:l||c,onClick:()=>o?.(p,b.key,!m),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${m?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${l||c?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:m?"\u958B":"\u9589"}),m&&y==="unmeasured"&&(0,F.jsx)("div",{"data-testid":`strategy-unmeasured-${p.domainKey}-${b.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"}),m&&y==="closed"&&(0,F.jsx)("div",{"data-testid":`strategy-blocked-${p.domainKey}-${b.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"})]},b.key)})]},`${p.domainKey}:${p.strategyName}`))})]})})]})}var Ge={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},He={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};var f=require("react/jsx-runtime"),qa={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"},ea=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],Ga=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),it={atomic:{label:"min-w-0 text-muted-foreground",slot:"shrink-0 whitespace-nowrap text-right"},anywhere:{label:"shrink-0 text-muted-foreground",slot:"wrap-anywhere min-w-0 text-right"}};function ta(e){return e.kind==="text"?"anywhere":"atomic"}function sa(e,t){return t===null?{kind:"unmeasured"}:Ga.has(e)&&typeof t=="number"?{kind:"count",count:t}:typeof t=="boolean"?{kind:"word",text:t?"\u6709\u52B9":"\u7121\u52B9"}:typeof t=="number"?{kind:"number",value:t}:{kind:"text",text:t}}function Ha(e){let t=ea.filter(c=>c in e),o=Object.keys(e).filter(c=>!ea.includes(c)).sort();return[...t,...o].map(c=>({key:c,label:qa[c]??c,value:sa(c,e[c])}))}function aa(e,t){switch(e.kind){case"count":return(0,f.jsx)(q,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return(0,f.jsx)(Se,{text:null,testId:t});case"number":if(!Number.isFinite(e.value))throw new RangeError(`${t}: a number the probe read must be finite, got ${e.value} (pass null when the probe could not read it)`);return(0,f.jsx)(Se,{text:String(e.value),testId:t});case"word":return(0,f.jsx)(Se,{text:e.text,testId:t});case"text":return(0,f.jsx)(Qe,{text:e.text,testId:t})}}function Va({health:e,isRefreshing:t=!1,onRefresh:o,className:c=""}){let{services:l,allHealthy:p,checkedAt:b}=e;te();let m=[{key:"qdrant",data:l.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:l.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:l.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:l.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:l.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return(0,f.jsxs)("section",{className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${c}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(p),children:[(0,f.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[(0,f.jsxs)("div",{className:"flex items-center gap-3",children:[(0,f.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,f.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,f.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,f.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,f.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,f.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),(0,f.jsxs)("div",{children:[(0,f.jsx)("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),(0,f.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",(0,f.jsx)("span",{"data-testid":"health-checked-at",children:(0,f.jsx)(ge,{iso:b,testId:"health-checked-at-value"})})," ","| \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]})]})]}),(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,f.jsx)("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...He[p?"connected":"error"],"data-testid":"health-overall-status-badge",children:p?(0,f.jsxs)(f.Fragment,{children:[(0,f.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,f.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,f.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,f.jsxs)("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ge.connected]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.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,f.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,f.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,f.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),(0,f.jsxs)("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ge.error]})]})}),o&&(0,f.jsxs)("button",{type:"button",onClick:o,disabled:t,"data-testid":"health-refresh-button",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-solid 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,f.jsxs)("svg",{className:`h-3.5 w-3.5 ${t?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,f.jsx)("path",{d:"M3 3v5h5"}),(0,f.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,f.jsx)("path",{d:"M16 21h5v-5"})]}),(0,f.jsx)("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),(0,f.jsx)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:m.map(({key:y,data:N,title:h,subtitle:C})=>{let E=sa("version",N.version),J=it[ta(E)],ae=aa(E,`service-version-value-${y}`);return(0,f.jsxs)("div",{"data-testid":`service-card-${y}`,className:"flex flex-col justify-between rounded-md border border-border border-solid bg-card/60 p-3.5 transition-colors hover:bg-muted/40",children:[(0,f.jsxs)("div",{children:[(0,f.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[(0,f.jsx)("span",{className:"font-semibold text-sm",children:h}),(0,f.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...He[N.status],"data-testid":`service-status-${y}`,children:[(0,f.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${y}`}),Ge[N.status]]})]}),(0,f.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:C}),(0,f.jsxs)("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${y}`,children:[(0,f.jsx)("span",{className:J.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),(0,f.jsx)("span",{className:`${J.slot} font-medium text-[11px]`,"data-testid":`service-version-${y}`,children:E.kind==="text"?(0,f.jsx)("code",{className:"font-mono font-semibold",children:ae}):ae})]}),(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${y}`,children:[(0,f.jsx)("span",{className:it.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),(0,f.jsx)("span",{className:`${it.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${y}`,children:(0,f.jsx)(q,{value:N.latencyMs,unit:"ms",testId:`health-latency-value-${y}`})})]}),Ha(N.details).map(K=>{let I=it[ta(K.value)];return(0,f.jsxs)("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${y}-${K.key}`,children:[(0,f.jsxs)("span",{className:I.label,children:[K.label,":"]}),(0,f.jsx)("span",{className:`${I.slot} font-medium text-[11px]`,"data-testid":`health-detail-${y}-${K.key}`,children:aa(K.value,`health-detail-value-${y}-${K.key}`)})]},K.key)})]})]}),(0,f.jsxs)("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[(0,f.jsx)("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${y}`,children:N.endpoint}),N.errorMessage!==void 0&&Je.test(N.errorMessage)&&(0,f.jsx)("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...He.error,"data-testid":`service-error-${y}`,children:N.errorMessage})]})]},y)})})]})}var oe=require("@aiquants/enrichment-core"),P=require("react");var a=require("react/jsx-runtime"),It={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"}},Ve="\u672A\u5B9F\u884C",za=(oe.SEARCH_PARAM_LIMITS.threshold.min+oe.SEARCH_PARAM_LIMITS.threshold.max)/2,Wa=2e3;function ja(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`LINEAR (alpha=${e.alpha})`:"\u878D\u5408\u306A\u3057 (\u5358\u4E00\u9806\u4F4D\u30E2\u30FC\u30C9)"}var Et={cosine:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",format:e=>`${(e*100).toFixed(1)}%`,title:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 (0\u301C1)"},bm25:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",format:e=>e.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:e=>e.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"}},oa=[{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 na(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function Ja(e,t){let o=t.trim();if(!(o&&e))return e;let c=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`(${c})`,"gi");return e.split(l).map((m,y)=>({id:`chunk-${y}-${m.slice(0,8)}`,part:m,isMatch:m.toLowerCase()===o.toLowerCase()})).map(m=>m.isMatch?(0,a.jsx)("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:m.part},m.id):m.part)}function kt(e){return e==="OPEN"?"bg-red-100 font-bold text-red-800":e==="HALF_OPEN"?"bg-amber-100 font-bold text-amber-800":"bg-slate-200 text-slate-500"}function Rt(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function Qa({tenantId:e,onSearch:t,initialParams:o,initialResult:c=null,circuitBreakerStatus:l={},isLoading:p=!1}){let b=(0,P.useId)(),m=(0,P.useId)(),y=(0,P.useId)(),N=(0,P.useId)(),h=(0,P.useId)(),C=(0,P.useId)(),E=(0,P.useId)(),J=(0,P.useId)(),ae=(0,P.useId)(),K=(0,P.useId)(),[I,Q]=(0,P.useState)(o?.q??""),[R,O]=(0,P.useState)(o?.mode??"HYBRID"),[A,L]=(0,P.useState)(o?.limit??oe.SEARCH_PARAM_LIMITS.limit.default),[G,g]=(0,P.useState)(o?.threshold??za),[$,B]=(0,P.useState)(o?.fusion??"rrf"),[D,re]=(0,P.useState)(o?.rrf_k??oe.SEARCH_PARAM_LIMITS.rrfK.default),[Z,be]=(0,P.useState)(o?.alpha??oe.SEARCH_PARAM_LIMITS.alpha.default),[fe,_]=(0,P.useState)(o?.confidentiality_level??"ALL"),[ie,H]=(0,P.useState)(o?.department_id?String(o.department_id):""),[X,U]=(0,P.useState)(o?.mime_type??""),[xe,ne]=(0,P.useState)(o?.tag??""),he=(0,P.useRef)(0),[Ie,le]=(0,P.useState)(!1),[ye,u]=(0,P.useState)(!1),[T,ee]=(0,P.useState)("request"),[z,se]=(0,P.useState)(null),[Fe,_e]=(0,P.useState)(new Set),[Ke,we]=(0,P.useState)(!1),[M,Be]=(0,P.useState)(c),[Ne,at]=(0,P.useState)(null),[Ue,bt]=(0,P.useState)(null),r=p||Ke,k=oe.MODE_TIERS[R],W=[k.dense,k.sparse,k.graph,k.lexical].filter(Boolean).length>1,ve=k.dense&&!k.sparse,ke=M?.search_metadata.circuit_breaker_status??l,ce=M?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},gt=Ue??{};(0,P.useEffect)(()=>{if(!ye)return;let n=Y=>{Y.key==="Escape"&&u(!1)};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[ye]);let Sa=n=>{O(n.params.mode),L(n.params.limit),n.params.threshold!==void 0&&g(n.params.threshold),n.params.fusion!==void 0&&B(n.params.fusion),n.params.rrf_k!==void 0&&re(n.params.rrf_k)},wa=async()=>{if(r)return;let n=ie.trim()?Number.parseInt(ie.trim(),10):void 0,Y={q:I.trim(),mode:R,limit:A,threshold:ve?G:void 0,fusion:W?$:void 0,rrf_k:W&&$==="rrf"?D:void 0,alpha:W&&$==="linear"?Z:void 0,department_id:n,confidentiality_level:fe==="ALL"?void 0:fe,mime_type:X.trim()||void 0,tag:xe.trim()||void 0},pe=he.current+1;he.current=pe,at(null),we(!0);try{let Ce=await t(Y);if(pe!==he.current)return;Be(Ce),bt(Y)}catch(Ce){if(pe!==he.current)return;at(Ce instanceof Error?Ce.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{pe===he.current&&we(!1)}},ze=(0,P.useRef)(void 0);(0,P.useEffect)(()=>()=>{ze.current!==void 0&&clearTimeout(ze.current)},[]);let Ea=async(n,Y)=>{try{await navigator.clipboard.writeText(n),se(Y),ze.current!==void 0&&clearTimeout(ze.current),ze.current=setTimeout(()=>se(null),Wa)}catch{}},ka=n=>{_e(Y=>{let pe=new Set(Y);return pe.has(n)?pe.delete(n):pe.add(n),pe})};return(0,a.jsxs)("div",{"data-testid":"metadata-search-workbench","data-mode":R,"data-loading":String(r),className:"space-y-6",children:[(0,a.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h2",{className:"font-bold text-base text-slate-900 tracking-tight",children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u691C\u7D22\u30EF\u30FC\u30AF\u30D9\u30F3\u30C1"}),(0,a.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: ",e]})]}),(0,a.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,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":ye,"aria-controls":K,onClick:()=>u(n=>!n),className:"inline-flex items-center gap-2 rounded-lg border border-slate-300 border-solid 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,a.jsx)("span",{className:"font-mono text-xs",children:"{ }"}),(0,a.jsx)("span",{children:ye?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),(0,a.jsxs)("div",{className:"mt-5 border-slate-100 border-t border-solid pt-4",children:[(0,a.jsx)("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:oa.map(n=>(0,a.jsx)("button",{type:"button","data-testid":`preset-button-${n.id}`,onClick:()=>Sa(n),className:"inline-flex items-center rounded-lg border border-slate-200 border-solid 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,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-slate-800",children:n.title}),(0,a.jsxs)("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",n.description,")"]})]})},n.id))})]})]}),(0,a.jsx)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:(0,a.jsxs)("form",{onSubmit:n=>{n.preventDefault(),wa()},className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)("label",{htmlFor:b,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),(0,a.jsx)("input",{id:b,type:"text","data-testid":"search-query-input",value:I,onChange:n=>Q(n.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 border-solid 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"}),I&&(0,a.jsx)("button",{type:"button","data-testid":"clear-query-button",onClick:()=>Q(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),(0,a.jsx)("div",{"data-testid":"search-modes",className:"flex flex-wrap items-center gap-1 rounded-lg border border-slate-200 border-solid bg-slate-100 p-1",children:oe.SEARCH_MODES.map(n=>{let Y=R===n;return(0,a.jsx)("button",{type:"button","aria-pressed":Y,title:It[n].description,"data-testid":`search-mode-${n}`,"data-active":String(Y),onClick:()=>O(n),className:`shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 font-medium text-xs transition-all ${Y?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:It[n].label},n)})}),(0,a.jsx)("button",{type:"submit","data-testid":"execute-search-button",disabled:r,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:r?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),(0,a.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,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:m,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),(0,a.jsx)("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:A})]}),(0,a.jsx)("input",{id:m,type:"range","data-testid":"limit-slider",min:oe.SEARCH_PARAM_LIMITS.limit.min,max:oe.SEARCH_PARAM_LIMITS.limit.max,step:1,value:A,onChange:n=>L(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:y,className:"font-medium text-slate-700 text-xs",title:ve?"\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,a.jsx)("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:G.toFixed(2)})]}),(0,a.jsx)("input",{id:y,type:"range","data-testid":"threshold-slider",min:oe.SEARCH_PARAM_LIMITS.threshold.min,max:oe.SEARCH_PARAM_LIMITS.threshold.max,step:.01,value:G,disabled:!ve,onChange:n=>g(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),(0,a.jsx)("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:$.toUpperCase()})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>B("rrf"),disabled:!W,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${$==="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,a.jsx)("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>B("linear"),disabled:!W,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${$==="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,a.jsx)("div",{className:"space-y-1.5",children:$==="rrf"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:N,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),(0,a.jsx)("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:D})]}),(0,a.jsx)("input",{id:N,type:"range","data-testid":"rrf-k-slider",min:oe.SEARCH_PARAM_LIMITS.rrfK.min,max:oe.SEARCH_PARAM_LIMITS.rrfK.max,step:1,value:D,disabled:!W,onChange:n=>re(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("label",{htmlFor:h,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),(0,a.jsx)("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Z.toFixed(2)})]}),(0,a.jsx)("input",{id:h,type:"range","data-testid":"alpha-slider",min:oe.SEARCH_PARAM_LIMITS.alpha.min,max:oe.SEARCH_PARAM_LIMITS.alpha.max,step:.05,value:Z,disabled:!W,onChange:n=>be(Number(n.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>le(n=>!n),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,a.jsx)("span",{children:Ie?"\u25BC":"\u25B6"}),(0,a.jsxs)("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",Ie?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),Ie&&(0,a.jsxs)("div",{"data-testid":"advanced-filters-panel",className:"mt-3 grid grid-cols-1 gap-4 rounded-lg border border-slate-200 border-solid bg-white p-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:E,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),(0,a.jsxs)("select",{id:E,"data-testid":"filter-confidentiality",value:fe,onChange:n=>_(n.target.value),className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500",children:[(0,a.jsx)("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),(0,a.jsx)("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),(0,a.jsx)("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),(0,a.jsx)("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),(0,a.jsx)("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:C,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),(0,a.jsx)("input",{id:C,type:"number","data-testid":"filter-department-id",value:ie,onChange:n=>H(n.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:J,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),(0,a.jsx)("input",{id:J,type:"text","data-testid":"filter-mime-type",value:X,onChange:n=>U(n.target.value),placeholder:"application/pdf, image/...",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:ae,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),(0,a.jsx)("input",{id:ae,type:"text","data-testid":"filter-tag",value:xe,onChange:n=>ne(n.target.value),placeholder:"\u4F8B: \u6C7A\u7B97, \u5951\u7D04\u66F8...",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]})]})]})]})}),Ne&&(0,a.jsx)("div",{role:"alert","data-testid":"search-error-alert",className:"rounded-xl border border-red-200 border-solid bg-red-50 p-4 font-medium text-red-700 text-sm shadow-sm",children:Ne}),M?.search_metadata&&(0,a.jsx)(xt,{metadata:M.search_metadata}),M&&(0,a.jsxs)("div",{"data-testid":"search-summary-bar",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-slate-200 border-solid bg-slate-50 px-4 py-3 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",(0,a.jsx)("span",{className:"font-bold text-indigo-600",children:M.count})," \u4EF6"]}),M.search_metadata.execution_time_ms!==void 0&&(0,a.jsxs)("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",(0,a.jsxs)("span",{className:"font-mono font-semibold text-slate-700",children:[M.search_metadata.execution_time_ms," ms"]})]}),(0,a.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: ",M.search_metadata.quality_tier]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),(0,a.jsxs)("span",{"data-testid":"tier-badge-sql","data-active":String(ce.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",ce.sql?"\u2713":"-"]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-sparse","data-active":String(ce.sparse),"data-breaker":ke.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.sparse?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",ce.sparse?"\u2713":Rt(ke.vector)]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-dense","data-active":String(ce.dense),"data-breaker":ke.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.dense?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",ce.dense?"\u2713":Rt(ke.vector)]}),(0,a.jsxs)("span",{"data-testid":"tier-badge-graph","data-active":String(ce.graph),"data-breaker":ke.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${ce.graph?"bg-emerald-100 font-semibold text-emerald-800":kt(ke.graph)}`,children:["\u30B0\u30E9\u30D5 ",ce.graph?"\u2713":Rt(ke.graph)]})]})]}),(0,a.jsxs)("div",{"data-testid":"search-results-container",className:"space-y-4",children:[M&&M.hits.length===0&&(0,a.jsxs)("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 border-solid bg-white p-12 text-center",children:[(0,a.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,a.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"})]}),M?.hits.map((n,Y)=>{let pe=Fe.has(n.id),Ce=n.scores?.fused;return(0,a.jsxs)("div",{"data-testid":`search-hit-card-${n.id}`,"data-hit-id":n.id,"data-rank":Y+1,className:"rounded-xl border border-slate-200 border-solid bg-white p-5 shadow-sm transition-all hover:border-slate-300 hover:shadow-md",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("span",{"data-testid":`hit-rank-${n.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",Y+1]}),(0,a.jsx)("h3",{"data-testid":`hit-filename-${n.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:n.file_name}),(0,a.jsx)("span",{"data-testid":`hit-confidentiality-${n.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${n.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":n.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":n.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:n.confidentiality_level}),n.department_id!==null&&(0,a.jsxs)("span",{"data-testid":`hit-department-${n.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",n.department_id]}),(0,a.jsx)("span",{"data-testid":`hit-mimetype-${n.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:n.mime_type})]}),(0,a.jsx)("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:n.file_uri})]}),Ce!==void 0&&(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:text-right",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),(0,a.jsx)("div",{"data-testid":`hit-fused-score-${n.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:Ce.toFixed(3)})]}),(0,a.jsx)("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:(0,a.jsx)("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,Ce*100))}%`}})})]})]}),n.ai_summary&&(0,a.jsx)("div",{"data-testid":`hit-summary-${n.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:Ja(n.ai_summary,Ue?.q??I)}),n.scores&&(0,a.jsxs)("div",{"data-testid":`hit-score-breakdown-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),n.scores.vector!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-vector-${n.id}`,"data-score-kind":n.scores.vector.kind,title:Et[n.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Et[n.scores.vector.kind].label,": ",Et[n.scores.vector.kind].format(n.scores.vector.value)]}),n.scores.lexicalRank!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-lexical-${n.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: ",na(n.scores.lexicalRank)]}),n.scores.graphRank!==void 0&&(0,a.jsxs)("span",{"data-testid":`score-graph-${n.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: ",na(n.scores.graphRank)]})]}),n.tags&&n.tags.length>0&&(0,a.jsx)("div",{"data-testid":`hit-tags-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:n.tags.map(Pe=>(0,a.jsxs)("span",{"data-testid":`hit-tag-${n.id}-${Pe}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",Pe]},`tag-${n.id}-${Pe}`))}),n.graph_relations&&n.graph_relations.length>0&&(0,a.jsxs)("div",{"data-testid":`hit-graph-relations-${n.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),n.graph_relations.map((Pe,Ra)=>(0,a.jsxs)("span",{"data-testid":`hit-relation-${n.id}-${Ra}`,className:"rounded-sm border border-purple-200 border-solid bg-purple-50 px-2 py-0.5 font-mono text-[11px] text-purple-800",children:["-[:",Pe.relation,"]-> ",Pe.target_name]},`rel-${n.id}-${Pe.relation}-${Pe.target_name}`))]}),n.structured_data!==null&&n.structured_data!==void 0&&(0,a.jsxs)("div",{className:"mt-3 border-slate-100 border-t border-solid pt-2",children:[(0,a.jsxs)("button",{type:"button","data-testid":`toggle-structured-data-${n.id}`,onClick:()=>ka(n.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[(0,a.jsx)("span",{children:pe?"\u25BC":"\u25B6"}),(0,a.jsxs)("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",pe?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),pe&&(0,a.jsx)("pre",{"data-testid":`structured-data-json-${n.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(n.structured_data,null,2)})]})]},n.id)})]}),ye&&(0,a.jsxs)("section",{id:K,"aria-label":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF","data-testid":"developer-inspector-drawer",className:"rounded-xl border border-slate-300 border-solid bg-slate-900 p-5 text-slate-200 shadow-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-slate-800 border-b border-solid pb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),(0,a.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,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let n=JSON.stringify(T==="request"?Ue??{}:M??{},null,2);Ea(n,"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:z==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),(0,a.jsx)("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>u(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),(0,a.jsx)("div",{className:"mt-3 flex gap-2 border-slate-800 border-b border-solid pb-2",children:["request","response","pipeline","graph-trace"].map(n=>{let Y={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},pe=T===n;return(0,a.jsx)("button",{type:"button","data-testid":`inspector-tab-${n}`,"data-active":String(pe),onClick:()=>ee(n),className:`rounded-sm px-3 py-1 font-medium text-xs ${pe?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:Y[n]},n)})}),(0,a.jsxs)("div",{className:"mt-4",children:[T==="request"&&(0,a.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(Ue??{},null,2)}),T==="response"&&(0,a.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(M??{},null,2)}),T==="pipeline"&&(0,a.jsxs)("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),(0,a.jsx)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-query-analysis",children:M?(0,a.jsxs)(a.Fragment,{children:["mode: ",gt.mode,' | q: "',gt.q,'"']}):Ve}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),(0,a.jsx)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-tier-retrieval",children:M?(0,a.jsxs)(a.Fragment,{children:["SQL SoT: ",ce.sql?"ACTIVE":"SKIPPED"," | Sparse: ",ce.sparse?"ACTIVE":"OFFLINE"," | Dense: ",ce.dense?"ACTIVE":"OFFLINE"," | Graph: ",ce.graph?"ACTIVE":"OFFLINE"]}):Ve}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),(0,a.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,a.jsxs)("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",M?ja(gt):Ve]})," | ",(0,a.jsxs)("span",{"data-testid":"inspector-output-count",children:["Output count: ",M?M.count:Ve]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),(0,a.jsx)("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),(0,a.jsxs)("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[(0,a.jsxs)("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",M?M.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":Ve]})," | ",(0,a.jsxs)("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",M?M.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":Ve]})," | ","tenant: ",e]})]}),T==="graph-trace"&&(0,a.jsxs)("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[(0,a.jsx)("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),M?.hits.some(n=>n.graph_relations&&n.graph_relations.length>0)?(0,a.jsx)("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:M.hits.map(n=>n.graph_relations?.map(Y=>(0,a.jsxs)("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",n.id,', file: "',n.file_name,'"}) -[:',Y.relation,']-> (:Entity {name: "',Y.target_name,'"})']},`gtrace-${n.id}-${Y.relation}-${Y.target_name}`)))}):(0,a.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 lt=require("@aiquants/enrichment-core"),me=require("react"),S=require("react/jsx-runtime"),Pt=4;function Ct(e){return e.toFixed(Pt)}function ra(e,t){let o=N=>{let h=new Map;return N.forEach((C,E)=>{h.has(C)||h.set(C,E+1)}),h},c=o(e),l=o(t),p=[...c.keys()].filter(N=>l.has(N)),b=new Set([...c.keys(),...l.keys()]).size,m=b===0?null:p.length/b,y=p.length===0?null:p.reduce((N,h)=>N+Math.abs(c.get(h)-l.get(h)),0)/p.length;return{sharedCount:p.length,overlapRatio:m,meanAbsoluteRankDifference:y}}function _t(e){return`${e.label} (${e.embeddingModel})`}function Xa({variants:e,onCompare:t}){let o=(0,me.useId)(),c=(0,me.useId)(),l=(0,me.useId)(),p=(0,me.useId)(),b=(0,me.useId)(),[m,y]=(0,me.useState)(null),[N,h]=(0,me.useState)(null),[C,E]=(0,me.useState)(""),[J,ae]=(0,me.useState)(lt.SEARCH_PARAM_LIMITS.limit.default),[K,I]=(0,me.useState)(!1),[Q,R]=(0,me.useState)(null),[O,A]=(0,me.useState)(null),L=e.length>=2,G=e.map(_=>_.strategyId),g=m!==null&&G.includes(m)?m:L?G[0]:null,$=N!==null&&G.includes(N)?N:L?G[1]:null,B=g!==null&&g===$,D=C.trim(),re=L&&!B&&D!==""&&!K,Z=async _=>{if(_.preventDefault(),!re||g===null||$===null)return;let ie={query:D,strategyIds:[g,$],limit:J};I(!0),R(null);try{let H=await t(ie);if(!H.ok){A(null),R(H.reason);return}let X=H.results.find(xe=>xe.strategyId===g),U=H.results.find(xe=>xe.strategyId===$);if(X===void 0||U===void 0){A(null),R(`\u5FDC\u7B54\u306B\u6226\u7565 #${X===void 0?g:$} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}A({input:ie,left:X,right:U})}catch(H){A(null),R(`\u6BD4\u8F03\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${H instanceof Error?H.message:String(H)}`)}finally{I(!1)}},be=O===null?null:ra(O.left.hits.map(_=>_.id),O.right.hits.map(_=>_.id)),fe=_=>{let ie=e.find(H=>H.strategyId===_.strategyId);return(0,S.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${_.strategyId}`,children:[(0,S.jsx)("h3",{className:"font-bold text-base text-slate-900",children:ie===void 0?`\u6226\u7565 #${_.strategyId}`:_t(ie)}),(0,S.jsx)("p",{className:"mt-1 text-[11px] text-slate-500",children:(0,S.jsxs)("span",{"data-testid":`compare-execution-ms-${_.strategyId}`,children:[_.executionMs," ms"]})}),_.hits.length===0?(0,S.jsx)("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${_.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):(0,S.jsx)("ol",{className:"mt-3 space-y-2",children:_.hits.map((H,X)=>(0,S.jsxs)("li",{"aria-label":`${X+1} \u4F4D ${H.title} (\u30B9\u30B3\u30A2 ${Ct(H.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${_.strategyId}-${X+1}`,"data-hit-id":H.id,"data-score":String(H.score),children:[(0,S.jsx)("span",{className:"w-6 text-right font-mono text-slate-500",children:X+1}),(0,S.jsx)("span",{title:H.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${_.strategyId}-${X+1}`,children:H.title}),(0,S.jsx)("span",{title:String(H.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${_.strategyId}-${X+1}`,children:Ct(H.score)})]},X))})]})};return(0,S.jsxs)("section",{className:"space-y-6","aria-labelledby":o,"data-testid":"model-comparison-workbench","data-running":K,children:[(0,S.jsxs)("form",{onSubmit:Z,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,S.jsx)("h2",{id:o,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),(0,S.jsxs)("p",{className:"mt-2 text-[13px] text-slate-500",children:["\u540C\u3058\u30AF\u30A8\u30EA\u3092 2 \u3064\u306E\u6226\u7565\u5909\u7A2E\u3067\u5B9F\u884C\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u3066\u6BD4\u3079\u307E\u3059\u3002\u30B9\u30B3\u30A2\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u305B\u305A\u3001\u5C0F\u6570\u7B2C ",Pt," \u4F4D\u307E\u3067\u793A\u3057\u307E\u3059 (\u5168\u6841\u306F\u30B9\u30B3\u30A2\u306B\u30DD\u30A4\u30F3\u30BF\u3092\u5F53\u3066\u308B\u3068\u51FA\u307E\u3059)\u3002"]}),!L&&(0,S.jsxs)("p",{className:"mt-4 rounded-lg border border-amber-300 border-solid bg-amber-50 p-3 text-[13px] text-amber-900","data-testid":"compare-variants-insufficient",children:["\u6BD4\u8F03\u306B\u306F 2 \u3064\u4EE5\u4E0A\u306E\u5909\u7A2E\u304C\u5FC5\u8981\u3067\u3059 (\u73FE\u5728 ",e.length," \u4EF6)\u3002"]}),(0,S.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:p,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),(0,S.jsx)("select",{id:p,value:g===null?"":String(g),onChange:_=>y(Number(_.target.value)),disabled:!L,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-variant-a",children:e.map(_=>(0,S.jsx)("option",{value:String(_.strategyId),children:_t(_)},_.strategyId))})]}),(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:b,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),(0,S.jsx)("select",{id:b,value:$===null?"":String($),onChange:_=>h(Number(_.target.value)),disabled:!L,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-variant-b",children:e.map(_=>(0,S.jsx)("option",{value:String(_.strategyId),children:_t(_)},_.strategyId))})]})]}),B&&(0,S.jsx)("p",{className:"mt-2 text-[13px] text-amber-800","data-testid":"compare-same-variant-note",children:"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u8F03\u3067\u304D\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002"}),(0,S.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:c,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),(0,S.jsx)("input",{id:c,type:"text",value:C,onChange:_=>E(_.target.value),disabled:!L,className:"w-full rounded-lg border border-slate-300 border-solid px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-query-input"})]}),(0,S.jsxs)("div",{className:"space-y-1",children:[(0,S.jsx)("label",{htmlFor:l,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),(0,S.jsx)("input",{id:l,type:"number",min:lt.SEARCH_PARAM_LIMITS.limit.min,max:lt.SEARCH_PARAM_LIMITS.limit.max,step:1,value:J,onChange:_=>ae(Number(_.target.value)),disabled:!L,className:"w-24 rounded-lg border border-slate-300 border-solid px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-limit-input"})]})]}),(0,S.jsx)("div",{className:"mt-4",children:(0,S.jsx)("button",{type:"submit",disabled:!re,className:"rounded-lg bg-indigo-600 px-4 py-2 font-semibold text-[13px] text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"compare-run-button",children:K?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),Q!==null&&(0,S.jsx)("div",{role:"alert",className:"rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"compare-failure",children:Q}),O!==null&&be!==null&&(0,S.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[(0,S.jsxs)("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),(0,S.jsxs)("dd",{"data-testid":"compare-shared-count",children:[be.sharedCount," \u4EF6 (A ",O.left.hits.length," \u4EF6 / B ",O.right.hits.length," \u4EF6)"]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),(0,S.jsx)("dd",{"data-testid":"compare-overlap-ratio",children:be.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(be.overlapRatio*100).toFixed(1)}%`})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),(0,S.jsx)("dd",{"data-testid":"compare-rank-difference",children:be.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":be.meanAbsoluteRankDifference.toFixed(2)})]})]}),(0,S.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[fe(O.left),fe(O.right)]})]})]})}var x=require("react/jsx-runtime");function da(e){return e===null?Ze:`${e.length} \u7A2E`}var Ze="\u672A\u8A2D\u5B9A";function Ye(e,t=""){return e===null?Ze:`${e}${t}`}function ct(e){return e===null?Ze:`${e} \u4EF6`}function Ya(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?Ze:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??Ze})`}function Za({tenantId:e,ontologyStatus:t}){let o=t.classes,c=t.predicates;return(0,x.jsxs)("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.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,x.jsx)("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 font-bold text-xs ${t.autonomousEvolutionEnabled?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-700"}`,"data-testid":"ontology-evolution-badge",children:t.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),(0,x.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:Ya(t)})]}),(0,x.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,x.jsxs)("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid 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,x.jsx)("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),(0,x.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:ct(t.totalConstraints)})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:ct(t.searchIndexes)}),(0,x.jsxs)("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",ct(t.totalIndexes)]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),(0,x.jsxs)("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[Ye(t.promotionThresholds.confidence)," / ",Ye(t.promotionThresholds.cooccurrence," \u56DE")]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[(0,x.jsx)("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),(0,x.jsx)("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:ct(t.unresolvedCandidatesCount)})]})]})]}),(0,x.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,x.jsxs)("div",{children:[(0,x.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,x.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,x.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:da(o)})]}),(0,x.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[o===null&&(0,x.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"}),o?.map(l=>(0,x.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${l.name}`,children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:l.name}),(0,x.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),typeof l.count=="number"&&(0,x.jsx)("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:l.count.toLocaleString()})]},l.name))]})]}),(0,x.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between pb-3",children:[(0,x.jsxs)("div",{children:[(0,x.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,x.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,x.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:da(c)})]}),(0,x.jsxs)("div",{className:"divide-y divide-solid divide-slate-100",children:[c===null&&(0,x.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"}),c?.map(l=>(0,x.jsxs)("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${l.name}`,children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:l.name}),(0,x.jsx)("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),(0,x.jsx)("span",{className:"rounded-sm border border-slate-200 border-solid bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-600",children:l.direction})]},l.name))]})]})]}),(0,x.jsxs)("div",{className:"rounded-xl border border-indigo-100 border-solid bg-indigo-50/40 p-5 shadow-sm","data-testid":"ontology-evolution-policy-card",children:[(0,x.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,x.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[(0,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),(0,x.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 ",Ye(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",Ye(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",Ye(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),(0,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),(0,x.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,x.jsxs)("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[(0,x.jsx)("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),(0,x.jsxs)("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",(0,x.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 j=require("@aiquants/enrichment-core"),de=require("react");var pt=require("@aiquants/console-ui/core"),ut=require("@aiquants/enrichment-core"),Me={inset:12,labelFontSize:13,captionFontSize:11},Te={offset:3,stroke:2},ia={node:{width:(0,pt.ceil8)(Math.max(...Object.values(ut.PIPELINE_STEPS).map(e=>(0,pt.textWidthEm)(e.label)))*Me.labelFontSize+2*Me.inset),height:56},gap:{column:48,row:24},padding:24};function $e(e){return Math.round(e*1e3)/1e3}function es(e){let t=new Map;for(let o of e){let c=o.dependsOn.reduce((l,p)=>Math.max(l,t.get(p)),-1);t.set(o.step,c+1)}return t}function Lt(e,t){return`${e}->${t}`}function ts(e,t){let o=[],c=new Map;return{slots:[...e.map(p=>{let b=t.get(p.step),m=p.dependsOn.map(y=>{let N=[],h=y;for(let C=t.get(y)+1;C<b;C+=1){let E=`${Lt(y,p.step)}@${C}`;o.push({id:E,rank:C,predecessors:[h]}),N.push(E),h=E}return c.set(Lt(y,p.step),N),h});return{id:p.step,rank:b,predecessors:m}}),...o],chains:c}}function as(e){let t=new Map,o=Math.max(...e.map(c=>c.rank));for(let c=0;c<=o;c+=1){let p=e.filter(b=>b.rank===c).map((b,m)=>{let y=c===0?m:b.predecessors.reduce((N,h)=>N+t.get(h),0)/b.predecessors.length;return{slot:b,barycenter:y}});p.sort((b,m)=>b.barycenter-m.barycenter),p.forEach(({slot:b},m)=>{t.set(b.id,m)})}return t}function $t(e,t=ia){let o=(0,ut.orderedSteps)(e),c=es(o),{slots:l,chains:p}=ts(o,c),b=as(l),{node:m,gap:y,padding:N}=t,h=R=>({x:$e(N+R.rank*(m.width+y.column)),y:$e(N+b.get(R.id)*(m.height+y.row))}),C=new Map(l.map(R=>[R.id,h(R)])),E=o.map(R=>{let O=C.get(R.step);return{key:R.step,x:O.x,y:O.y,rank:c.get(R.step),order:b.get(R.step),width:m.width,height:m.height}}),J=R=>$e(R+m.height/2),ae=o.flatMap(R=>R.dependsOn.map(O=>{let A=C.get(O),L=C.get(R.step),G=$e(A.x+m.width),g=J(A.y),$=`M ${G} ${g}`,B=(D,re)=>{let Z=$e((G+D)/2);$+=` C ${Z} ${g}, ${Z} ${re}, ${D} ${re}`};for(let D of p.get(Lt(O,R.step))){let re=C.get(D),Z=J(re.y);B(re.x,Z),G=$e(re.x+m.width),g=Z,$+=` L ${G} ${g}`}return B(L.x,J(L.y)),{from:O,to:R.step,path:$}})),K=[...C.values()],I=$e(Math.max(...K.map(R=>R.x+m.width))+N),Q=$e(Math.max(...K.map(R=>R.y+m.height))+N);return{width:I,height:Q,steps:E,edges:ae}}var i=require("react/jsx-runtime"),la="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Tt={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},ca={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},Mt={open:{badge:"\u9580: \u958B",stroke:"stroke-emerald-500",dash:void 0},"closed-skip":{badge:"\u9580: \u9589 (\u7701\u7565)",stroke:"stroke-amber-500",dash:void 0},"closed-fail":{badge:"\u9580: \u9589 (\u5931\u6557)",stroke:"stroke-red-500",dash:void 0},unmeasured:{badge:"\u9580: \u672A\u6E2C\u5B9A",stroke:"stroke-slate-400",dash:"6 4"}},Ot={none:"\u9580\u306A\u3057",skip:"\u9589\u3058\u305F\u3089\u7701\u7565",fail:"\u9589\u3058\u305F\u3089\u5931\u6557",mixed:"\u9589\u3058\u305F\u9580\u3067\u7570\u306A\u308B"},ss={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},et="rgb(248 250 252)",ns={backgroundColor:et,backgroundImage:`linear-gradient(to right, ${et}, ${et}), linear-gradient(to right, ${et}, ${et}), linear-gradient(to right, rgb(15 23 42 / 0.2), transparent), linear-gradient(to left, rgb(15 23 42 / 0.2), transparent)`,backgroundPosition:"left center, right center, left center, right center",backgroundRepeat:"no-repeat",backgroundSize:"24px 100%, 24px 100%, 12px 100%, 12px 100%",backgroundAttachment:"local, local, scroll, scroll"};function Ft(e,t){let o=t[e.featureFlagKey];return o===void 0?"unmeasured":o?"open":"closed"}function pa(e,t){let o=e.map(c=>({gate:c,state:Ft(c,t)}));return o.some(({gate:c,state:l})=>l==="closed"&&c.whenClosed==="fail")?"closed-fail":o.some(({state:c})=>c==="closed")?"closed-skip":o.some(({state:c})=>c==="unmeasured")?"unmeasured":"open"}function At(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function ua(e,t){let{badge:o}=Mt[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?o:`${o}\u30FB${Ot[t]}`}function os(e){return e.whenClosed==="skip"?"\u9589\u3058\u305F\u3068\u304D\u306F\u6BB5\u3092\u7701\u7565":`\u9589\u3058\u305F\u3068\u304D\u306F ${e.failureStatus} \u3067\u5931\u6557`}function Dt(e){return e.map(t=>j.PIPELINE_STEPS[t].label).join("\u3001")}function rs(e){return e.dependsOn.length===0?la:`\u4F9D\u5B58: ${Dt(e.dependsOn)}`}function ds({featureFlags:e,metrics:t,metricSampleWindow:o,selectedKind:c,onSelectKind:l,selectedStepKey:p,onSelectStep:b}){if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${o}.`);let m=(0,de.useId)(),y=(0,de.useId)(),N=(0,de.useId)(),h=(0,de.useId)(),C=(0,de.useId)(),[E,J]=(0,de.useState)(j.DOCUMENT_KINDS[0]),[ae,K]=(0,de.useState)(null),[I,Q]=(0,de.useState)(null),R=(0,de.useRef)(new Map),O=(0,de.useRef)(new Map),A=(0,de.useRef)(null),L=(0,de.useRef)(null),{labels:G}=te(),g=c!==void 0?c:E,$=p!==void 0?p:ae,B=(0,j.flowFor)(g),D=$t(B),re=new Map(B.steps.map(u=>[u.step,u])),Z=u=>{K(u),b?.(u)},be=u=>{J(u),l?.(u),Z(null)},fe=(u,T)=>{let ee=j.DOCUMENT_KINDS.length-1,z;switch(u.key){case"ArrowRight":z=T===ee?0:T+1;break;case"ArrowLeft":z=T===0?ee:T-1;break;case"Home":z=0;break;case"End":z=ee;break;default:return}u.preventDefault();let se=j.DOCUMENT_KINDS[z];be(se),R.current.get(se)?.focus()},_=u=>{let T=L.current;if(Z(null),T?.isConnected){T.focus();return}O.current.get(u)?.focus()},ie=u=>{Z(u===$?null:u)},H=(u,T)=>{u.currentTarget.focus(),ie(T)},X=(u,T)=>{u.key==="Enter"||u.key===" "?(u.preventDefault(),ie(T)):u.key==="Escape"&&Z(null)},U=$===null?void 0:re.get($),xe=U===void 0?null:U.step;(0,de.useEffect)(()=>{if(xe===null){L.current=null;return}let u=document.activeElement;(u instanceof HTMLElement||u instanceof SVGElement)&&u!==document.body&&A.current?.contains(u)===!1&&(L.current=u)},[xe]);let ne=U===void 0?void 0:j.PIPELINE_STEPS[U.step],he=U===void 0?[]:(0,j.flowStepGates)(U),Ie=U===void 0?[]:B.steps.filter(u=>u.dependsOn.includes(U.step)).map(u=>u.step),le=ne===void 0?void 0:t.find(u=>u.documentKind===g&&u.stepKey===ne.key),ye=j.DOCUMENT_KIND_LABELS[g];return(0,i.jsxs)("section",{className:"space-y-6","aria-labelledby":m,"data-testid":"pipeline-flow-viewer","data-kind":g,children:[(0,i.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,i.jsx)("h2",{id:m,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),(0,i.jsx)("p",{className:"mt-2 text-[13px] text-slate-500",children:"\u6587\u66F8\u306E\u7A2E\u985E\u3054\u3068\u306B\u3001\u5B9F\u969B\u306B\u8D70\u308B\u6BB5\u3068\u305D\u306E\u4F9D\u5B58\u3092\u63CF\u304D\u307E\u3059\u3002\u5404\u6BB5\u304C\u5F85\u3064\u6BB5\u306F\u3001\u6BB5\u306E\u8AAC\u660E\u3068\u8A73\u7D30\u306B\u3082\u6587\u5B57\u3067\u793A\u3057\u307E\u3059\u3002\u9580\u306E\u72B6\u614B\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3092\u91CD\u306D\u305F\u3082\u306E\u3067\u3059\u3002"}),(0,i.jsx)("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:j.DOCUMENT_KINDS.map((u,T)=>{let ee=u===g;return(0,i.jsx)("button",{ref:z=>{z===null?R.current.delete(u):R.current.set(u,z)},type:"button",role:"tab","aria-selected":ee,"aria-controls":y,tabIndex:ee?0:-1,onClick:()=>be(u),onKeyDown:z=>fe(z,T),className:ee?"rounded-lg border border-indigo-600 border-solid bg-indigo-600 px-3 py-1.5 font-semibold text-[13px] text-white":"rounded-lg border border-slate-300 border-solid bg-white px-3 py-1.5 font-medium text-[13px] text-slate-700 hover:bg-slate-50","data-testid":`flow-kind-${u}`,children:j.DOCUMENT_KIND_LABELS[u]},u)})}),(0,i.jsx)("div",{id:y,role:"tabpanel","aria-label":`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u6D41\u308C`,"aria-describedby":N,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:ns,"data-testid":"flow-scroll",children:(0,i.jsxs)("svg",{viewBox:`0 0 ${D.width} ${D.height}`,width:D.width,height:D.height,role:"group","aria-label":`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[(0,i.jsx)("title",{children:`${j.DOCUMENT_KIND_LABELS[g]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),(0,i.jsx)("defs",{children:(0,i.jsx)("marker",{id:`${y}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:(0,i.jsx)("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),D.edges.map(u=>(0,i.jsx)("path",{d:u.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${y}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${u.from}-${u.to}`},`${u.from}-${u.to}`)),D.steps.map(u=>{let T=j.PIPELINE_STEPS[u.key],ee=re.get(u.key),z=(0,j.flowStepGates)(ee),se=pa(z,e),Fe=At(z),_e=Mt[se],Ke=ua(se,Fe),we=u.key===$,M=u.key===I,Be=`${y}-depends-${u.key}`;return(0,i.jsxs)("g",{ref:Ne=>{Ne===null?O.current.delete(u.key):O.current.set(u.key,Ne)},transform:`translate(${u.x} ${u.y})`,role:"button",tabIndex:0,"aria-label":`${T.label} (${Ke})`,"aria-describedby":Be,"aria-expanded":we,"aria-controls":we?C:void 0,onClick:Ne=>H(Ne,u.key),onKeyDown:Ne=>X(Ne,u.key),onFocus:()=>Q(u.key),onBlur:()=>Q(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${u.key}`,"data-step-key":u.key,"data-gate-state":se,"data-gate-policy":Fe,"data-selected":we,"data-focused":M,children:[(0,i.jsx)("desc",{id:Be,"data-testid":`flow-node-dependencies-${u.key}`,children:rs(ee)}),M&&(0,i.jsx)("rect",{x:-Te.offset,y:-Te.offset,width:u.width+2*Te.offset,height:u.height+2*Te.offset,rx:8+Te.offset,fill:"none",strokeWidth:Te.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${u.key}`}),(0,i.jsx)("rect",{width:u.width,height:u.height,rx:8,strokeWidth:we?3:1.5,strokeDasharray:_e.dash,className:`${_e.stroke} ${we?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${u.key}`}),(0,i.jsx)("text",{x:Me.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${u.key}`,children:T.label}),(0,i.jsx)("text",{x:Me.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${u.key}`,children:Tt[T.phase]}),(0,i.jsx)("text",{x:Me.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${u.key}`,"data-gate-state":se,children:Ke})]},u.key)})]})}),(0,i.jsxs)("p",{id:N,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",D.width," px) \u3067\u63CF\u304D\u307E\u3059\u3002\u8868\u793A\u5E45\u306B\u53CE\u307E\u3089\u306A\u3044\u3068\u304D\u306F\u6A2A\u306B\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u304F\u3060\u3055\u3044 (Tab \u3067\u6BB5\u3078\u79FB\u308B\u3068\u3001\u305D\u306E\u6BB5\u304C\u898B\u3048\u308B\u4F4D\u7F6E\u307E\u3067\u52D5\u304D\u307E\u3059)\u3002"]})]}),ne!==void 0&&U!==void 0&&(0,i.jsxs)("section",{id:C,ref:A,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":h,"data-testid":"flow-step-detail","data-step-key":ne.key,children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{id:h,className:"font-bold text-base text-slate-900",children:ne.label}),(0,i.jsx)("p",{className:"mt-1 text-[13px] text-slate-600",children:ne.description})]}),(0,i.jsx)("button",{type:"button",onClick:()=>_(ne.key),className:"rounded-lg border border-slate-300 border-solid px-3 py-1.5 text-[13px] text-slate-700 hover:bg-slate-50","data-testid":"flow-step-detail-close",children:"\u9589\u3058\u308B"})]}),(0,i.jsxs)("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),(0,i.jsx)("dd",{children:(0,i.jsx)("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:ne.endpoint})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),(0,i.jsxs)("dd",{"data-testid":"flow-step-phase",children:[Tt[ne.phase]," (",ne.phase,")"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),(0,i.jsx)("dd",{"data-testid":"flow-step-capability",children:ne.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":ne.capability})]}),U.chunkSource!==void 0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),(0,i.jsxs)("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":U.chunkSource,children:[ca[U.chunkSource]," (",U.chunkSource,")"]})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),(0,i.jsx)("dd",{"data-testid":"flow-step-depends-on",children:U.dependsOn.length===0?la:Dt(U.dependsOn)})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),(0,i.jsx)("dd",{"data-testid":"flow-step-dependents",children:Ie.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":Dt(Ie)})]}),(0,i.jsxs)("div",{className:"sm:col-span-2",children:[(0,i.jsx)("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),(0,i.jsx)("dd",{children:he.length===0?(0,i.jsx)("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:"space-y-1",children:he.map(u=>{let T=Ft(u,e);return(0,i.jsxs)("li",{"data-testid":`flow-gate-${u.featureFlagKey}`,"data-gate-state":T,"data-when-closed":u.whenClosed,children:[(0,i.jsx)("code",{className:"font-mono",children:u.featureFlagKey}),": ",ss[T]," \u2014 ",os(u)]},u.featureFlagKey)})}),U.gatePolicy!==void 0&&(0,i.jsxs)("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[ye," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",Ot[At(ne.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",U.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),(0,i.jsxs)("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":g,children:[(0,i.jsxs)("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",ye,"\u30FB\u76F4\u8FD1 ",o," \u4EF6)"]}),(0,i.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[ye," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",o," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),le===void 0?(0,i.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[G.unmeasured," (",ye," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-sample-count",children:(0,i.jsx)(q,{value:le.sampleCount,testId:"flow-metric-sample-count-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6210\u529F"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-succeeded",children:(0,i.jsx)(q,{value:le.succeeded,testId:"flow-metric-succeeded-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u5931\u6557"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-failed",children:(0,i.jsx)(q,{value:le.failed,testId:"flow-metric-failed-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u7701\u7565"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-skipped",children:(0,i.jsx)(q,{value:le.skipped,testId:"flow-metric-skipped-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"p50"}),(0,i.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:(0,i.jsx)(q,{value:le.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"p95"}),(0,i.jsx)("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:(0,i.jsx)(q,{value:le.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),(0,i.jsxs)("div",{className:"col-span-2",children:[(0,i.jsx)("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),(0,i.jsx)("dd",{"data-testid":"flow-metric-last-started-at",children:(0,i.jsx)(ge,{iso:le.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),(0,i.jsxs)("p",{className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-metric-note","data-unmeasured-note":!0,children:["p50 / p95 \u306F\u6240\u8981\u3092\u6E2C\u3063\u305F\u8A18\u9332\u3060\u3051\u304B\u3089\u6C42\u3081\u307E\u3059\u3002\u7701\u7565\u3057\u305F\u6BB5\u306F\u300C\u7701\u7565\u300D\u306B\u3060\u3051\u6570\u3048\u3001\u6A19\u672C\u6570\u306B\u3082\u6240\u8981\u306B\u3082\u5165\u308A\u307E\u305B\u3093\u3002\u4F55\u3082\u547C\u3070\u305A\u306B\u6B62\u307E\u3063\u305F\u5931\u6557 (\u6240\u8981 ",G.unmeasured,") \u306F\u6A19\u672C\u6570\u3068\u300C\u5931\u6557\u300D\u306B\u306F\u5165\u308A\u307E\u3059\u304C\u3001\u6240\u8981\u306B\u306F\u5165\u308A\u307E\u305B\u3093\u3002"]})]})]})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[(0,i.jsx)("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),(0,i.jsxs)("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",(0,i.jsx)("code",{className:"font-mono",children:"*"})," \u3067\u7D42\u308F\u308B\u898F\u5247\u306F\u524D\u65B9\u4E00\u81F4\u3001\u305D\u308C\u4EE5\u5916\u306F\u5B8C\u5168\u4E00\u81F4\u3067\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u898F\u5247\u304C\u52DD\u3061\u307E\u3059\u3002\u3069\u306E\u898F\u5247\u306B\u3082\u4E00\u81F4\u3057\u306A\u3044\u578B\u306F\u300C",j.DOCUMENT_KIND_LABELS.other,"\u300D\u3067\u3059\u3002"]}),(0,i.jsx)("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:(0,i.jsxs)("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[(0,i.jsx)("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),(0,i.jsx)("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),(0,i.jsx)("tbody",{className:"divide-y divide-solid divide-slate-100",children:j.MIME_KIND_RULES.map(([u,T],ee)=>(0,i.jsxs)("tr",{className:T===g?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${ee}`,"data-kind":T,"data-selected":T===g,children:[(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{className:"font-mono",children:u})}),(0,i.jsx)("td",{className:"px-3 py-2",children:j.DOCUMENT_KIND_LABELS[T]})]},u))})]})})]})]})}var Oe=require("@aiquants/enrichment-core"),ue=require("react");var d=require("react/jsx-runtime"),ba=8,is={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},ls={provider:"\u30D7\u30ED\u30D0\u30A4\u30C0",model:"\u30E2\u30C7\u30EB",engine:"\u30A8\u30F3\u30B8\u30F3",prompt_key:"\u30D7\u30ED\u30F3\u30D7\u30C8",prompt_version:"\u7248",duration_ms:"\u51E6\u7406\u6642\u9593",input_chars:"\u5165\u529B\u6587\u5B57\u6570",output_chars:"\u51FA\u529B\u6587\u5B57\u6570",chunk_count:"\u30C1\u30E3\u30F3\u30AF",points_upserted:"\u6295\u5165\u70B9\u6570",collection:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",embedding_model:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",graph_nodes:"\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9"},ga={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},cs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],ps=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],us={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function fa(e){return Object.hasOwn(ga,e)}function tt(e,t){return`run-step-provenance-value-${e}-${t}`}function ms(e,t,o){if(fa(t)){let l=e[t];return l===null?null:(0,d.jsx)(q,{value:l,unit:ga[t],testId:tt(o,t)})}let c=e[t];return c===null?null:(0,d.jsx)(Qe,{text:String(c),testId:tt(o,t)})}function bs(e,t){let o=cs.map(p=>({key:p,label:ls[p],value:ms(e,p,t),breaks:fa(p)?"atomic":"anywhere"})),c=e.pages_read!==null||e.pages_total!==null,l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(q,{value:e.pages_read,testId:tt(t,"pages_read")})," / ",(0,d.jsx)(q,{value:e.pages_total,testId:tt(t,"pages_total")})]});return[...o,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:c?l:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:(0,d.jsx)(Qe,{text:is[e.body_source],testId:tt(t,"body_source")}),breaks:"anywhere"}]}function gs(e){let t=[],o=new Map;for(let c of[...e.steps].sort((l,p)=>l.sequence-p.sequence)){if(Oe.PIPELINE_STEPS[c.stepKey].fanOut!=="children"||c.targetMetadataId===e.metadataId){t.push({kind:"step",step:c});continue}let l=o.get(c.stepKey);if(l!==void 0){l.push(c);continue}let p=[c];o.set(c.stepKey,p),t.push({kind:"fan_out",stepKey:c.stepKey,steps:p})}return t}function fs(e){if(e.skipReason===null)throw new RangeError(`Step record #${e.id} is SKIPPED without a skip reason, which the pipeline record schema refuses.`);return e.skipReason}function xs({step:e}){let{labels:t}=te();if(e.status==="SKIPPED")return(0,d.jsxs)("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",ht(fs(e))]});if(e.provenance===null)return(0,d.jsx)("p",{className:"text-[13px] text-slate-500","data-testid":`run-step-provenance-missing-${e.sequence}`,children:"\u6BB5\u306E\u5831\u544A\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});let o=e.provenance,c=bs(o,e.sequence),l=c.filter(b=>b.value!==null),p=c.filter(b=>b.value===null);return(0,d.jsxs)(d.Fragment,{children:[l.length>0&&(0,d.jsx)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[13px] sm:grid-cols-3","data-testid":`run-step-provenance-${e.sequence}`,children:l.map(b=>(0,d.jsxs)("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:b.label}),(0,d.jsx)("dd",{className:`text-slate-800 ${us[b.breaks]}`,"data-provenance-key":b.key,children:b.value})]},b.key))}),p.length>0&&(0,d.jsxs)("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",p.map(b=>b.label).join("\u3001")]}),Object.keys(o.detail).length>0&&(0,d.jsxs)("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[(0,d.jsx)("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),(0,d.jsx)("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(o.detail,null,2)})]})]})}function ma(e,t,o,c){let l=ot[e.status];return(0,d.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":e.stepKey,children:(0,d.jsxs)("details",{open:c,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),(0,d.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&(0,d.jsxs)("span",{className:"rounded-sm bg-indigo-50 px-1.5 py-0.5 text-[11px] text-indigo-800","data-testid":`run-step-strategy-${e.sequence}`,children:["\u6226\u7565 #",e.strategyId]}),(0,d.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${l.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:l.label}),(0,d.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:(0,d.jsx)(q,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),(0,d.jsxs)("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&o>0&&(0,d.jsx)("div",{className:"h-2 rounded-full bg-slate-100",children:(0,d.jsx)("div",{className:`h-2 rounded-full ${l.bar}`,style:{width:`${e.durationMs/o*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&(0,d.jsxs)("p",{className:"wrap-anywhere text-[13px] text-red-700","data-testid":`run-step-error-${e.sequence}`,children:[e.errorCode===null?"":`${e.errorCode}: `,e.errorMessage,e.httpStatus===null?"":` (HTTP ${e.httpStatus})`]}),(0,d.jsx)(xs,{step:e})]})]})},e.id)}function ys(e,t,o){let c=Le(e),l=De[c],p=e.steps.reduce((m,y)=>y.durationMs===null?m:Math.max(m,y.durationMs),0),b=e.steps.length<=ba;return(0,d.jsxs)("section",{className:"space-y-4","aria-labelledby":t,"data-testid":"run-detail","data-run-id":e.id,children:[(0,d.jsxs)("h3",{ref:o,id:t,tabIndex:-1,className:"font-bold text-base text-slate-900 focus:outline-none","data-testid":"run-detail-heading",children:[Oe.DOCUMENT_KIND_LABELS[e.documentKind]," \u306E\u5B9F\u884C #",e.id]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u304D\u3063\u304B\u3051"}),(0,d.jsx)("dd",{"data-testid":"run-trigger","data-trigger":e.trigger,children:rt[e.trigger]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u8A66\u884C"}),(0,d.jsx)("dd",{"data-testid":"run-attempt",children:e.attempt})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u72B6\u614B"}),(0,d.jsx)("dd",{children:(0,d.jsx)("span",{className:`inline-flex rounded-full px-2.5 py-0.5 font-semibold text-[11px] ${l.className}`,"data-testid":"run-status","data-status":e.status,"data-presentation":c,children:l.label})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u8981\u6C42\u8005"}),(0,d.jsx)("dd",{className:"wrap-anywhere","data-testid":"run-requested-by",children:e.requestedBy})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u958B\u59CB"}),(0,d.jsx)("dd",{"data-testid":"run-started-at",children:(0,d.jsx)(ge,{iso:e.startedAt,testId:"run-started-at-value"})})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7D42\u4E86"}),(0,d.jsx)("dd",{"data-testid":"run-finished-at",children:(0,d.jsx)(Xe,{iso:e.finishedAt,testId:"run-finished-at-value"})})]}),(0,d.jsxs)("div",{className:"col-span-2",children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u30B8\u30E7\u30D6"}),(0,d.jsx)("dd",{children:(0,d.jsx)("code",{className:"wrap-anywhere font-mono","data-testid":"run-job-id",children:e.jobId})})]})]}),e.errorMessage!==null&&(0,d.jsx)("div",{className:"wrap-anywhere rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"run-error",children:e.errorMessage}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-bold text-[13px] text-slate-900",children:"\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3"}),(0,d.jsx)("ol",{className:"mt-3 space-y-3","data-testid":"run-steps",children:gs(e).map(m=>{if(m.kind==="step"){let h=m.step,C=(0,d.jsxs)(d.Fragment,{children:[Oe.PIPELINE_STEPS[h.stepKey].label,h.targetMetadataId!==e.metadataId&&(0,d.jsxs)("span",{className:"ml-2 rounded-sm bg-slate-100 px-1.5 py-0.5 font-normal text-[11px] text-slate-600","data-testid":`run-step-target-${h.sequence}`,children:["\u5BFE\u8C61 #",h.targetMetadataId]})]});return ma(h,C,p,h.status==="FAILED"||b)}let y=m.steps.some(h=>h.status==="FAILED"),N=ps.map(h=>({status:h,count:m.steps.filter(C=>C.status===h).length})).filter(({count:h})=>h>0);return(0,d.jsx)("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${m.stepKey}`,"data-count":m.steps.length,children:(0,d.jsxs)("details",{open:y||b,className:"group/fanout","data-testid":`run-step-group-card-${m.stepKey}`,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),(0,d.jsx)("span",{className:"font-semibold text-[13px] text-slate-900",children:Oe.PIPELINE_STEPS[m.stepKey].label}),(0,d.jsxs)("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${m.stepKey}`,children:["\u5BFE\u8C61 ",m.steps.length," \u4EF6"]}),(0,d.jsx)("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${m.stepKey}`,children:N.map(({status:h,count:C})=>`${ot[h].label} ${C}`).join(" \xB7 ")})]}),(0,d.jsx)("ol",{className:"space-y-3 px-4 pb-4",children:m.steps.map(h=>ma(h,(0,d.jsxs)("span",{"data-testid":`run-step-target-${h.sequence}`,children:["\u5BFE\u8C61 #",h.targetMetadataId]}),p,h.status==="FAILED"||b))})]})},`group-${m.stepKey}`)})})]})]})}function vs({metadataId:e,runs:t,selectedRunId:o,onSelectRun:c,isLoading:l,failure:p,onClose:b,openRequest:m,returnFocusFallback:y}){let N=(0,ue.useId)(),h=(0,ue.useId)(),C=(0,ue.useId)(),E=(0,ue.useRef)(null),J=(0,ue.useRef)(null),ae=(0,ue.useRef)(null),K=(0,ue.useRef)(null),I=(0,ue.useRef)(null),Q=(0,ue.useRef)(null),R=(0,ue.useRef)(y);te(),(0,ue.useEffect)(()=>{R.current=y},[y]),(0,ue.useEffect)(()=>{if(I.current!==m){I.current=m,Q.current=null;let g=document.activeElement;E.current?.contains(g)!==!0&&(K.current=(g instanceof HTMLElement||g instanceof SVGElement)&&g!==document.body?g:null),J.current?.focus();return}o!==null&&o===Q.current&&(Q.current=null,ae.current?.focus())},[m,o]),(0,ue.useEffect)(()=>()=>{I.current=null;let g=K.current;if(g?.isConnected){g.focus();return}R.current()?.focus()},[]);let O=g=>{Q.current=g===o?null:g,c(g)},A=g=>{g.key==="Escape"&&(g.stopPropagation(),b())},L=o===null?void 0:t.find(g=>g.id===o),G=()=>t.length===0?(0,d.jsx)("p",{role:"status",className:"rounded-lg border border-slate-200 border-solid bg-slate-50 p-4 text-[13px] text-slate-700","data-testid":"run-inspector-no-runs",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u3055\u308C\u305F\u5B9F\u884C\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("section",{"aria-labelledby":h,"data-testid":"run-history",children:[(0,d.jsxs)("h3",{id:h,className:"font-bold text-base text-slate-900",children:["\u5B9F\u884C\u306E\u5C65\u6B74 (",t.length," \u4EF6\u3001\u65B0\u3057\u3044\u9806)"]}),(0,d.jsx)("ol",{className:"mt-3 space-y-1","data-testid":"run-history-list",children:t.map(g=>{let $=g.id===o,B=Le(g),D=De[B];return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onClick:()=>O(g.id),"aria-current":$?"true":void 0,className:`flex w-full flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-solid px-3 py-2 text-left text-[13px] ${$?"border-indigo-500 bg-indigo-50":"border-slate-200 bg-white hover:bg-slate-50"}`,"data-testid":`run-history-item-${g.id}`,"data-selected":$,children:[(0,d.jsxs)("span",{className:"font-mono font-semibold text-slate-900",children:["#",g.id]}),(0,d.jsx)("span",{className:"text-slate-700","data-testid":`run-history-trigger-${g.id}`,"data-trigger":g.trigger,children:rt[g.trigger]}),(0,d.jsxs)("span",{className:"text-slate-600","data-testid":`run-history-attempt-${g.id}`,children:["\u8A66\u884C ",g.attempt]}),(0,d.jsx)("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${D.className}`,"data-testid":`run-history-status-${g.id}`,"data-status":g.status,"data-presentation":B,children:D.label}),(0,d.jsx)("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-history-started-at-${g.id}`,children:(0,d.jsx)(ge,{iso:g.startedAt,testId:`run-history-started-at-value-${g.id}`})})]})},g.id)})})]}),L!==void 0?ys(L,C,ae):o===null?(0,d.jsx)("p",{className:"text-[13px] text-slate-500","data-testid":"run-inspector-select-prompt",children:"\u4E00\u89A7\u304B\u3089\u5B9F\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5B9F\u884C\u306E\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u3092\u793A\u3057\u307E\u3059\u3002"}):(0,d.jsxs)("p",{role:"status",className:"text-[13px] text-slate-600","data-testid":"run-inspector-selection-missing",children:["\u5B9F\u884C #",o," \u306F\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u89A7\u304B\u3089\u5B9F\u884C\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002"]})]});return(0,d.jsxs)("section",{ref:E,role:"dialog","aria-labelledby":N,onKeyDown:A,className:"space-y-6 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"run-inspector","data-metadata-id":e,children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("h2",{ref:J,id:N,tabIndex:-1,className:"font-bold text-base text-slate-900 focus:outline-none","data-testid":"run-inspector-heading",children:["\u6587\u66F8 #",e," \u306E\u51E6\u7406\u5C65\u6B74",L===void 0?"":` (\u5B9F\u884C #${L.id})`]}),(0,d.jsx)("button",{type:"button",onClick:b,className:"rounded-lg border border-slate-300 border-solid px-3 py-1.5 text-[13px] text-slate-700 hover:bg-slate-50","data-testid":"run-inspector-close",children:"\u9589\u3058\u308B"})]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-document",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u6587\u66F8"}),(0,d.jsxs)("dd",{"data-testid":"run-document-id",children:["#",e]})]}),L!==void 0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7248"}),(0,d.jsx)("dd",{"data-testid":"run-document-revision",children:L.revision})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u7A2E\u985E"}),(0,d.jsx)("dd",{"data-testid":"run-document-kind","data-kind":L.documentKind,children:Oe.DOCUMENT_KIND_LABELS[L.documentKind]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{className:"text-slate-500",children:"\u6D41\u308C"}),(0,d.jsx)("dd",{children:(0,d.jsx)("code",{className:"font-mono","data-testid":"run-document-flow",children:L.flowKey})})]})]})]}),p!==null?(0,d.jsx)("div",{role:"alert",className:"wrap-anywhere rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"run-inspector-failure",children:p}):l?(0,d.jsx)("p",{"aria-busy":"true",className:"text-[13px] text-slate-500","data-testid":"run-inspector-loading",children:"\u51E6\u7406\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):G()]})}var mt=require("@aiquants/console-ui/core"),Na=require("react");var v=require("react/jsx-runtime");function hs(e,t){return e==null?null:Ae(e,"segment_count",t)}function xa(e,t,o){return e==null?null:st(e,t,o)}function Ns(e){let t=e.probe_failure;if(t===null)return null;if(!Je.test(t))throw new RangeError("overview.probe_failure must name why the collections could not be read (pass null when they were measured)");if(e.collections.length>0)throw new RangeError(`overview carries ${e.collections.length} collections and a probe_failure; pass the collections with probe_failure null, or an empty list with the reason`);return t}function ya(e,t,o){return e.reduce((c,l)=>c+Ae(l[t],`${t} of collection ${l.collection_name}`,o),0)}var Ss=(0,mt.cssVar)("space-1"),ws={padding:0,height:"1px",color:"#1e293b"},Es={display:"flex",height:"100%"},ks={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},Rs={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},Is={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Kt={whiteSpace:"nowrap"},va=(0,mt.cssVar)("space-3"),_s=(0,mt.cssVar)("info-tint"),Bt={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function ha(e,t){return`vectors_config.${e}.size of collection ${t}`}function Cs({overview:e,health:t,resources:o,onRefresh:c,isRefreshing:l=!1,selection:p}){let{formatLocale:b}=te(),m=(0,Na.useId)(),{collections:y}=e,N=Ns(e),h=N===null,C=h?ya(y,"points_count",b):null,E=h?ya(y,"vectors_count",b):null,J=xa(o?.ram_bytes,"ram_bytes",b),ae=xa(o?.disk_bytes,"disk_bytes",b),K=hs(o?.segment_count,b);return(0,v.jsxs)("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,v.jsxs)("div",{"data-testid":"qdrant-card-header",style:Rs,children:[(0,v.jsxs)("div",{"data-testid":"qdrant-card-title-group",style:Is,children:[(0,v.jsx)("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996"}),t!==void 0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...He[t.healthy?"connected":"error"],style:{...Kt,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ge[t.healthy?"connected":"error"]}),(0,v.jsxs)("span",{"data-testid":"qdrant-latency",style:{...Kt,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",(0,v.jsx)(q,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),c&&(0,v.jsx)("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:l,onClick:c,style:{...Kt,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:l?"not-allowed":"pointer",fontSize:"13px"},children:l?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),(0,v.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:C,testId:"qdrant-total-points-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:E,testId:"qdrant-total-vectors-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),(0,v.jsx)("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(Se,{text:J,testId:"qdrant-ram-usage-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),(0,v.jsx)("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(Se,{text:ae,testId:"qdrant-disk-usage-value"})})]}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),(0,v.jsx)("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:(0,v.jsx)(q,{value:K,testId:"qdrant-segment-count-value"})})]})]}),(0,v.jsxs)("div",{children:[(0,v.jsxs)("h3",{id:m,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",(0,v.jsx)(q,{value:h?y.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),N!==null?(0,v.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:N}):y.length===0?(0,v.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,v.jsx)("section",{tabIndex:0,"aria-labelledby":m,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Ss},children:(0,v.jsxs)("table",{"aria-labelledby":m,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,v.jsx)("thead",{children:(0,v.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[(0,v.jsx)("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${va}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),(0,v.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),(0,v.jsx)("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),(0,v.jsx)("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),(0,v.jsx)("tbody",{children:y.map(I=>{let Q=p!==void 0&&I.collection_name===p.selectedCollectionName,R=(0,v.jsx)("span",{style:ks,children:I.collection_name}),{dense:O,sparse:A,image:L}=I.vectors_config,G=O===void 0?null:Ae(O.size,ha("dense",I.collection_name),b),g=L===void 0?null:Ae(L.size,ha("image",I.collection_name),b);return(0,v.jsxs)("tr",{"data-testid":`collection-row-${I.collection_name}`,"data-collection-name":I.collection_name,"data-selected":String(Q),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:Q?_s:"transparent"},children:[p===void 0?(0,v.jsx)("td",{style:{padding:`8px ${va}`,color:"#1e293b"},children:R}):(0,v.jsx)("td",{style:ws,children:(0,v.jsx)("div",{style:Es,children:(0,v.jsx)(zt,{selected:Q,controls:p.detailId,onSelect:()=>p.onSelectCollection(I.collection_name),testId:`collection-select-${I.collection_name}`,children:R})})}),(0,v.jsx)("td",{style:{padding:"8px",color:"#475569"},children:I.domain_key}),(0,v.jsx)("td",{"data-testid":`collection-points-${I.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:(0,v.jsx)(q,{value:I.points_count,testId:`collection-points-value-${I.collection_name}`})}),(0,v.jsx)("td",{style:{padding:"8px"},children:(0,v.jsxs)("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[G!==null&&(0,v.jsxs)("span",{"data-testid":`vector-tag-dense-${I.collection_name}`,style:{...Bt,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",(0,v.jsx)(q,{value:G,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${I.collection_name}`})]}),A!==void 0&&(0,v.jsx)("span",{"data-testid":`vector-tag-sparse-${I.collection_name}`,style:{...Bt,backgroundColor:"#fef3c7",color:"#92400e"},children:A.modifier?`Sparse (${A.modifier.toUpperCase()})`:"Sparse"}),g!==null&&(0,v.jsxs)("span",{"data-testid":`vector-tag-image-${I.collection_name}`,style:{...Bt,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",(0,v.jsx)(q,{value:g,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${I.collection_name}`})]})]})})]},I.collection_name)})})]})})]})]})}var w=require("react/jsx-runtime"),Ps="\u5BFE\u8C61\u306A\u3057";function Ls({counts:e,totalFiles:t,failedItems:o=[],onRetryAll:c,onRetryItem:l,isRetrying:p=!1,onRefresh:b}){te();let m=e.SYNCED??0,y=e.PENDING??0,N=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),h=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),C=t>0?`${(m/t*100).toFixed(1)}%`:Ps;return(0,w.jsxs)("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),(0,w.jsxs)("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",(0,w.jsx)("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",(0,w.jsx)("span",{"data-testid":"success-rate-value",children:C}),")"]})]}),(0,w.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[b&&(0,w.jsx)("button",{type:"button","data-testid":"sync-refresh-button",onClick:b,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),c&&(0,w.jsx)("button",{type:"button","data-testid":"retry-all-button",disabled:p||h===0,onClick:c,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:p||h===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:p||h===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:p?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),(0,w.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[(0,w.jsxs)("div",{"data-testid":"status-card-synced","data-count":m,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),(0,w.jsx)("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:m})]}),(0,w.jsxs)("div",{"data-testid":"status-card-processing","data-count":N,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),(0,w.jsx)("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:N})]}),(0,w.jsxs)("div",{"data-testid":"status-card-pending","data-count":y,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),(0,w.jsx)("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:y})]}),(0,w.jsxs)("div",{"data-testid":"status-card-failed","data-count":h,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[(0,w.jsx)("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),(0,w.jsx)("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:h})]})]}),(0,w.jsxs)("div",{"data-testid":"failed-items-section",children:[(0,w.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 (",o.length<h?`\u4E0A\u4F4D ${o.length} \u4EF6 / \u5168 ${h} \u4EF6`:`${o.length} \u4EF6`,")"]}),o.length===0?(0,w.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,w.jsx)("div",{style:{overflowX:"auto"},children:(0,w.jsxs)("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[(0,w.jsx)("thead",{children:(0,w.jsxs)("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),(0,w.jsx)("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),(0,w.jsx)("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),(0,w.jsx)("tbody",{children:o.map(E=>(0,w.jsxs)("tr",{"data-testid":`failed-item-row-${E.id}`,"data-file-uri":E.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[(0,w.jsxs)("td",{"data-testid":`failed-item-uri-${E.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[(0,w.jsx)("div",{style:{fontWeight:600,color:"#0f172a"},children:E.file_name}),(0,w.jsx)("div",{style:{fontSize:"11px",color:"#64748b"},children:E.file_uri})]}),(0,w.jsx)("td",{style:{padding:"8px"},children:(0,w.jsx)("span",{"data-testid":`failed-item-status-${E.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:E.sync_status})}),(0,w.jsx)("td",{"data-testid":`failed-item-error-${E.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:E.error_message??"",children:E.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),(0,w.jsx)("td",{"data-testid":`failed-item-time-${E.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:E.failed_at===null?"\u8A18\u9332\u306A\u3057":(0,w.jsx)(ge,{iso:E.failed_at,testId:`failed-item-time-value-${E.id}`})}),(0,w.jsx)("td",{style:{padding:"8px",textAlign:"right"},children:l&&(0,w.jsx)("button",{type:"button","data-testid":`retry-item-button-${E.id}`,"aria-label":`${E.file_name} (${E.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:p,onClick:()=>l(E.id,E.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:p?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},E.id))})]})})]})]})}0&&(module.exports={CHUNK_SOURCE_LABELS,DegradedSearchBanner,DocumentIngestConsole,EnrichmentStrategyBoard,FLOW_FOCUS_RING,FLOW_GEOMETRY,FLOW_NODE_TEXT,FinishedInstant,GATE_POLICY_LABELS,GATE_STATE_PRESENTATION,InfrastructureHealthMonitor,MetadataSearchWorkbench,ModelComparisonWorkbench,NOTHING_TO_READ_LABELS,OntologyStatusCard,PHASE_LABELS,PIPELINE_RUN_STATUS_PRESENTATION,PIPELINE_STEP_STATUS_PRESENTATION,PIPELINE_TRIGGER_LABELS,PipelineFlowViewer,PipelineRunInspector,QdrantStorageCard,REASON_LABELS,RecordedInstant,SCORE_DISPLAY_DECIMALS,SEARCH_MODE_LABELS,SEARCH_PRESETS,STEP_CARDS_OPEN_LIMIT,SyncStatusMonitor,UNFINISHED_LABEL,formatComparisonScore,gateCaption,gateState,gateStateOf,ingestRowAction,layoutFlow,pipelineRunPresentationKey,rankAgreement,skipReasonLabel,stepGatePolicy,stepGateState});