@aiquants/enrichment-react 0.5.0 → 0.6.0

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.js CHANGED
@@ -1,3 +1,3 @@
1
- var Ct="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",st={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\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\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\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\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Ra={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},Vt={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},Gt={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Ea={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\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"};function sn(e){return Object.hasOwn(Ea,e)?Ea[e]:e}var kt=3;function _a(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(kt)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function Ia(e,t){let n=i=>{let o=new Map;return i.forEach((b,P)=>{o.has(b)||o.set(b,P+1)}),o},a=n(e),s=n(t),r=[...a.keys()].filter(i=>s.has(i)),l=new Set([...a.keys(),...s.keys()]).size;return{sharedCount:r.length,overlapRatio:l===0?null:r.length/l,meanAbsoluteRankDifference:r.length===0?null:r.reduce((i,o)=>i+Math.abs(a.get(o)-s.get(o)),0)/r.length}}function Dn(e){return`${e.metadata_id}:${e.chunk_index}`}import{AlertMessage as ds,Button as ls,Card as cs,CardSection as us,Cluster as ps,CodeBlock as ms,ComparisonGrid as fs,DataTable as ys,DescriptionList as gs,Disclosure as bs,LoadMore as xs,MasterDetail as hs,Measured as vs,Meter as Ss,Notice as Ns,Pill as Es,ResourceFailed as Rs,RowButton as _s,SegmentedControl as Is,Select as Cs,SelectableList as ks,Slider as Ts,Stack as ws,Text as Ps,TextInput as Ls,VisuallyHidden as $s,useConsoleUi as Ds,useAnnounce as As,useFocusRescue as Ms,usePagedResource as Os,useResource as Fs}from"@aiquants/console-ui";import{createElement as ce}from"react";var qt="ja-JP";function I(){let e=Ds();if(e.locale!=="ja"||e.formatLocale!==qt)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${qt}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function Q(e){return I(),ce(vs,e)}function ka(e){return I(),ce(_s,e)}function on(e){return I(),ce(hs,e)}function dn(e){return I(),ce(fs,e)}function He(e){return I(),ce(Es,e)}function ot(e){return I(),ce(cs,e)}function he(e){return I(),ce(ls,e)}function Ve(e){return I(),ce(Ns,e)}function Ge(e){return I(),ce(ds,e)}function gt(e){return I(),ce(Rs,e)}function ln(e){return I(),ce(xs,e)}function Ta(e){return I(),ce($s,e)}function Tt(e){return I(),ce(ys,e)}function cn(e){return I(),ce(ks,e)}function An(e,t,n){return I(),Fs(e,t,n)}function un(e,t,n){return I(),Os(e,t,n)}function Je(e){return I(),Ms(e)}function Mn(e){return I(),ce(us,e)}function On(e){return I(),ce(ms,e)}function wt(e){return I(),ce(gs,e)}function pn(e){return I(),ce(bs,e)}function Fn(e){return I(),ce(Ss,e)}function mn(e){return I(),ce(Is,e)}function zt(e){return I(),ce(Cs,e)}function bt(e){return I(),ce(Ts,e)}function we(e){return I(),ce(ws,e)}function it(e){return I(),ce(ps,e)}function B(e){return I(),ce(Ps,e)}function xt(e){return I(),ce(Ls,e)}function Pt(){return I(),As()}import{jsx as Wt,jsxs as Us}from"react/jsx-runtime";function wa({metadata:e,testId:t}){if(I(),!e.is_degraded)return null;let n=e.executed_tiers,a=st[e.requested_mode].label,s=Vt[e.quality_tier],l=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${s})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u3001${st[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${s})\u3002`;return Wt(Ve,{tone:"warning",testId:t,children:Us(we,{gap:"space-2",testId:`${t}-body`,children:[Wt(B,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:l}),e.degradation_reasons.length>0&&Wt("ul",{"data-testid":`${t}-reasons`,children:e.degradation_reasons.map((i,o)=>Wt("li",{"data-reason":i,children:Wt(B,{fg:"fg",type:"prose",testId:`${t}-reason-${o}`,children:sn(i)})},`${o}-${i}`))})]})})}import{HTTP_FORBIDDEN as no,mapOutcome as sr}from"@aiquants/console-ui/core";import{DOCUMENT_CHANGE_FEED_PAGE_SIZE as ao}from"@aiquants/enrichment-core";import{useRef as or}from"react";import{reasonAside as Ks}from"@aiquants/console-ui/core";var ht={classification:"\u5206\u985E",metadata:"\u30E1\u30BF\u30C7\u30FC\u30BF",labels:"\u30E9\u30D9\u30EB",tags:"\u30BF\u30B0",structured_data:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",text:"\u672C\u6587",summary:"\u8981\u7D04",chunks:"\u30C1\u30E3\u30F3\u30AF",assets:"\u6DFB\u4ED8"},Lt={RUN:"\u5B9F\u884C\u306E\u5F8C\u306E\u8A18\u9332",PRE_WRITE:"\u4E0A\u66F8\u304D\u306E\u524D\u306E\u8A18\u9332",MANUAL:"\u624B\u52D5\u306E\u8A18\u9332",BACKFILL:"\u8A18\u9332\u306E\u8D77\u70B9"},Un={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Pa={EXACT:"\u305D\u306E\u307E\u307E\u518D\u73FE",WHITESPACE_NORMALIZED:"\u7A7A\u767D\u3092\u7E4B\u304E\u76F4\u3057\u3066\u518D\u73FE",UNVERIFIED:"\u518D\u73FE\u3067\u304D\u306A\u3044"},La="\u30C1\u30E3\u30F3\u30AF\u306E\u672C\u6587\u306F\u3053\u306E\u533A\u9593\u306E\u6587\u3092\u7A7A\u767D\u3067\u7E4B\u304E\u76F4\u3057\u305F\u5F62\u3067\u3059\u3002",$a="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",Da="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",fn={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function Yt(e){return Object.hasOwn(fn,e)?fn[e]:e}var $t="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Aa="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",yn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",Ma="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Oa="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",Kn="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",Fa="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Ua(e){return`\u3053\u306E\u5909\u5316\u306B\u306F\u8A18\u9332\u3055\u308C\u306A\u304B\u3063\u305F\u5B9F\u884C ${e.map(t=>`#${t}`).join("\u3001")} \u306E\u5909\u5316\u3082\u542B\u307E\u308C\u307E\u3059`}function Ye(e){return`r${e}`}function Bn(e,t){return e===t?`${Ye(t)} (\u540C\u3058\u7248)`:`${Ye(e)} \u2192 ${Ye(t)}`}function gn(e){let t=ht[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let a=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([s,r])=>s===null||s===0?[]:[`${r}${s}`]);return a.length===0?`${t} \u5909\u66F4`:`${t} ${a.join(" ")}`}function vt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var dt="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function bn(e,t,n){return e.failureSentence(t,dt,lt(n))}function lt(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${Ks(t)}\u3002`}import{RUN_TERMINAL_STEP_KEY as Ba}from"@aiquants/enrichment-core";var Ka=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Ha(e){let t=e.states.flatMap(o=>o.kind==="readable"?[o.item]:[]),n=e.runs.flatMap(o=>o.kind==="readable"?[o.item]:[]),a=new Set(n.map(o=>o.id)),s=[...n.map(o=>({kind:"run",key:`run:${o.id}`,time:o.startedAt,run:o,state:t.find(b=>b.runId===o.id)??null})),...t.filter(o=>o.runId===null||!a.has(o.runId)).map(o=>({kind:"state",key:`state:${o.stateId}`,time:o.settledAt,state:o}))].sort(Ka),l=[...new Set([...e.revisions.map(o=>o.revision),...s.map(o=>o.kind==="run"?o.run.revision:o.state.revision)])].sort((o,b)=>b-o).map(o=>({revision:o,isCurrent:e.revisions.some(b=>b.revision===o&&b.isCurrent),items:s.filter(b=>(b.kind==="run"?b.run.revision:b.state.revision)===o)})),i=[...e.states.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:state:${b}`,time:o.settledAt,mark:o}]:[]),...e.runs.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:run:${b}`,time:o.startedAt,mark:o}]:[])].sort(Ka);return{groups:l,marks:i,states:t,runs:n}}function Hn(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Ba);return t===void 0||t.status==="FAILED"}function Va(e,t){let n=t.states.find(r=>r.stateId===e.previousStateId);if(n===void 0)return[];let a=Date.parse(n.settledAt),s=Date.parse(e.settledAt);return t.runs.filter(r=>{let l=Date.parse(r.startedAt);return r.status!=="RUNNING"&&r.id!==e.runId&&l>=a&&l<s&&!t.states.some(i=>i.runId===r.id)&&!r.steps.some(i=>i.stepKey===Ba&&i.status==="SUCCEEDED")}).map(r=>r.id)}function Ga(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(a=>a.stateId===e.stateId);return n!==void 0&&t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function qa(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}import{useState as Bs}from"react";function Dt(e){let[t,n]=Bs({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}import{ceil8 as xn,monoTextWidthEm as Vn,TOKENS as Gn,textWidthEm as qn}from"@aiquants/console-ui/core";var ct=Gn.type.body.size,zn=Gn.space["space-3"],Hs=20,za=xn(ct*qn("\u3042".repeat(Hs))+2*zn),Wa=448,Vs=40,Gs=2,qs="+ ",zs=Gn.space["space-4"];function Ws(e){if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A line number is a non-negative safe integer: ${e}`);return String(e).length}function Ya(e){let n=Vn("0".repeat(Ws(e)+Gs))+Vn(qs)+Vn("0".repeat(Vs));return xn(ct*2*n+zs)}function St(e){return xn(ct*qn(e)+2*zn)}function Nt(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(St))}function hn(e){return xn(ct*qn(e)+4*zn)}var Xa="0000/00/00 00:00:00",Ue=St("\u3042".repeat(10));import{jsx as vn}from"react/jsx-runtime";var Xt=/[^\s\x1c-\x1f\x85\ufeff]/,Ys={fontVariantNumeric:"tabular-nums"},Xs={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function ja({text:e,testId:t,slot:n}){if(I(),e===null)return vn(Q,{value:null,testId:t});if(!Xt.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 vn("span",{"data-cui-migration":"pending","data-measured":"true","data-testid":t,style:n,children:e})}function jt({text:e,testId:t}){return vn(ja,{text:e,testId:t,slot:Ys})}function Ke({text:e,testId:t}){return vn(ja,{text:e,testId:t,slot:Xs})}import{DOCUMENT_KIND_LABELS as js,isUnknownTerm as Ja,PIPELINE_STEPS as Qa,parseSkipReason as Js,RUN_TERMINAL_STEP_KEY as Qs}from"@aiquants/enrichment-core";var rt={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"}},Wn={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"}},Yn={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},Zs="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Jt(e){return Ja(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===Qs?Zs:Qa[e].label}function Za(e){return Ja(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:js[e]}var er={RECORDED:"\u72B6\u614B\u3092\u8A18\u9332\u3057\u307E\u3057\u305F",UNCHANGED:"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093",ALREADY_RECORDED:"\u3053\u306E\u5B9F\u884C\u306E\u72B6\u614B\u306F\u8A18\u9332\u6E08\u307F\u3067\u3059"},tr="\u672A\u5B8C\u4E86";function ut(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var eo={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)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function nr(e){let t=Js(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`${Qa[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return eo[t.token];case"superseded":return"\u5B9F\u884C\u306E\u7248\u304C\u73FE\u5728\u306E\u7248\u3067\u306A\u304F\u306A\u3063\u305F";case"recording_disabled":return"\u8A18\u9332\u306E\u5207\u66FF\u304C\u7121\u52B9";case"recording_misconfigured":return"\u8A18\u9332\u306E\u5207\u66FF\u306E\u8A2D\u5B9A\u306E\u8AA4\u308A";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}import{formatInstant as to}from"@aiquants/console-ui/core";function ar(e,t){return to(e,qt,t)}import{jsx as rr}from"react/jsx-runtime";function fe({iso:e,testId:t}){let{timeZone:n}=I();return rr(Ke,{text:e===null?null:ar(e,n),testId:t})}function At({iso:e,testId:t}){return I(),e===null?tr:rr(fe,{iso:e,testId:t})}import{Fragment as ir,jsx as qe,jsxs as Xn}from"react/jsx-runtime";var ro="document-changes";function ll({host:e,onOpen:t}){let{labels:n}=I(),a=or(null),s=or(null),r=un(ro,{first:P=>e.loadChanges(null,P).then(T=>sr(T,u=>({rows:u.rows,next:u.next,meta:null}))),next:(P,T)=>e.loadChanges(P,T).then(u=>(!u.ok&&u.status===no&&r.reload(),sr(u,w=>({rows:w.rows,next:w.next}))))},0),l=Je(()=>a.current),i=r.state.kind==="ready"?r.state.refreshFailure:null,o=Dt(i);return qe(ot,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:a,testId:"change-feed",children:(()=>{if(r.state.kind==="failed")return qe(gt,{failure:r.state,onReload:r.reload,forbiddenMessage:dt,failureMessage:lt("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:l,testId:"change-feed-failed"});if(r.state.kind!=="ready")return qe("p",{"aria-busy":"true","data-testid":"change-feed-loading",children:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:P}=r.state,T=P.rows.map((u,w)=>({row:u,position:w}));return Xn(ir,{children:[i!==null&&qe(Ge,{occurrence:o,testId:"change-feed-refresh-failed",children:bn(n,i,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),qe(Tt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:St(Xa)},align:"start",cell:({row:u,position:w})=>qe(fe,{iso:u.kind==="readable"?u.item.settledAt:u.settledAt,testId:`change-feed-time-value-${w}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Ue},align:"start",cell:({row:u})=>u.kind==="readable"?Xn(ir,{children:[qe("span",{children:u.item.fileName})," ",qe("span",{children:u.item.fileUri})]}):qe("span",{"data-restricted-mark":"change",children:$t})},{key:"revision",header:"\u7248",width:{fixedPx:St("r00000 \u2192 r00000")},align:"start",cell:({row:u})=>u.kind==="readable"?Bn(u.item.previousRevision,u.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:Nt(Object.values(Lt))},align:"start",cell:({row:u})=>u.kind==="readable"?Lt[u.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Ue},align:"start",cell:({row:u})=>u.kind==="readable"?u.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Ue},align:"start",cell:({row:u,position:w})=>u.kind==="readable"?u.item.changes.map(D=>qe(He,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${w}-${D.facet}`,children:gn(D)},D.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:hn("\u958B\u304F")},align:"start",cell:({row:u})=>u.kind==="readable"?Xn(he,{variant:"secondary",onClick:()=>t(u.item.metadataId,u.item.stateId),testId:`change-feed-open-${u.item.stateId}`,children:["\u958B\u304F ",qe(Ta,{testId:`change-feed-open-name-${u.item.stateId}`,children:`${u.item.fileName} ${Bn(u.item.previousRevision,u.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:T,rowKey:({row:u,position:w})=>qa(u,w),rowTestId:"change-feed-row",rowData:({row:u})=>({"data-row-kind":u.kind}),rowSize:t===void 0?"row":"row-control",empty:"\u76F4\u8FD1\u306E\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"change-feed-table",ref:s}),qe(ln,{onLoad:r.loadMore,busy:P.loadingMore||r.state.refreshing,done:P.next===null,failure:P.moreFailure,limit:ao,rows:{count:T.length,ref:s},testId:"change-feed-more"})]})})()})}import{reasonAside as Qo,TOKENS as da}from"@aiquants/console-ui/core";import{useCallback as Zo,useEffect as _n,useId as sa,useRef as Ze,useState as Ft}from"react";import{TOKENS as vo}from"@aiquants/console-ui/core";import{DOCUMENT_FACETS as So}from"@aiquants/enrichment-core";import{useCallback as No,useEffect as Eo,useId as Ro,useMemo as _o,useState as Io}from"react";import{useState as mo}from"react";import{mapOutcome as dr}from"@aiquants/console-ui/core";import{DIFF_LINE_PAGE_MAX as jn}from"@aiquants/enrichment-core";import{useCallback as cr,useEffect as Qn,useId as so,useRef as ur,useState as Sn}from"react";import{Fragment as yr,jsx as A,jsxs as Re}from"react/jsx-runtime";var Zn="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",pr={context:"",removed:"\u2212",added:"+"},mr={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function Jn(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function oo(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function io(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function lo(e){let t=[],n=0;for(let a=1;a<=e.length;a++)(a===e.length||e[a].page!==e[n].page)&&(t.push(...co(e.slice(n,a).map(({line:s})=>s))),n=a);return t}function co(e){let t=[],n=[],a=[],s=()=>{for(let r=0;r<Math.max(n.length,a.length);r++)t.push({left:n[r]??null,right:a[r]??null});n=[],a=[]};for(let r of e)r.kind==="context"?(s(),t.push({left:r,right:r})):r.kind==="removed"?(a.length>0&&s(),n.push(r)):a.push(r);return s(),t}function fr(e){return e.segments.map((t,n)=>{let a=`${n}`;return t.kind==="removed"?A("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},a):t.kind==="added"?A("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},a):A("span",{children:t.text},a)})}function lr(e,t){return Re(yr,{children:[A("td",{"data-line-number":t,children:e===null?"":t==="old"?e.oldNumber:e.newNumber}),A("td",{"data-line-sign":!0,children:e===null?"":pr[e.kind]}),A("td",{style:mr,"data-line-text":t,children:e===null?null:fr(e)})]})}function uo({states:e,target:t,hunk:n,layout:a,tableLabel:s,readLines:r,rescueTarget:l,onLines:i,testId:o}){let b={...e,...t,hunk:n},P=JSON.stringify([e.fromStateId,e.toStateId,t,n]),T=un(P,{first:h=>r({...b,offset:0,limit:jn},h).then(L=>dr(L,W=>({rows:W.lines.map(ee=>({line:ee,page:0})),next:W.next,meta:null}))),next:(h,L)=>r({...b,offset:h,limit:jn},L).then(W=>dr(W,ee=>({rows:ee.lines.map(ie=>({line:ie,page:h})),next:ee.next})))},0),u=Je(l),w=ur(null),D=T.state.kind==="ready"?T.state.value.rows:null;if(Qn(()=>{D!==null&&i(io(D))},[D,i]),T.state.kind==="failed")return A(gt,{failure:T.state,onReload:T.reload,forbiddenMessage:dt,failureMessage:lt("\u5DEE\u5206\u306E\u884C"),rescueRef:u,testId:`${o}-failed`});if(T.state.kind!=="ready")return A("p",{"aria-busy":"true","data-testid":`${o}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:p}=T.state,E=a==="split"?lo(p.rows):null;return Re("div",{"data-testid":o,"data-layout":a,children:[Re("table",{"aria-label":s,"data-testid":`${o}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[A("thead",{children:a==="split"?Re("tr",{children:[A("th",{scope:"col",children:"\u65E7"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u53E4\u3044\u672C\u6587"}),A("th",{scope:"col",children:"\u65B0"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u65B0\u3057\u3044\u672C\u6587"})]}):Re("tr",{children:[A("th",{scope:"col",children:"\u65E7"}),A("th",{scope:"col",children:"\u65B0"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u672C\u6587"})]})}),A("tbody",{ref:w,children:E===null?p.rows.map(({line:h},L)=>Re("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":h.kind,children:[A("td",{"data-line-number":"old",children:h.oldNumber}),A("td",{"data-line-number":"new",children:h.newNumber}),A("td",{"data-line-sign":!0,children:pr[h.kind]}),A("td",{style:mr,"data-line-text":"unified",children:fr(h)})]},L)):E.map(h=>Re("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":h.left===h.right?"context":"changed",children:[lr(h.left,"old"),lr(h.right,"new")]},`${h.left?.oldNumber??""}:${h.right?.newNumber??""}`))})]}),A(ln,{onLoad:T.loadMore,busy:p.loadingMore||T.state.refreshing,done:p.next===null,failure:p.moreFailure,limit:jn,rows:{count:E===null?p.rows.length:E.length,ref:w},testId:`${o}-more`})]})}function po(){let[e,t]=Sn(null);return[cr((a=>{let s=new ResizeObserver(r=>{for(let l of r)t(l.contentRect.width)});return s.observe(a),()=>s.disconnect()}),[]),e]}function Nn({states:e,target:t,index:n,readLines:a,label:s,rescueTarget:r,onNarrowChange:l,testId:i}){I();let o=so(),[b,P]=Sn("split"),[T,u]=Sn(()=>new Set(n===null?[0]:[])),[w,D]=Sn(0),[p,E]=po(),h=ur(new Map),L=cr(_=>D(te=>Math.max(te,_)),[]),W=Ya(Math.max(n===null?0:oo(n.hunks),w)),ee=E!==null&&E>=W,ie=b==="split"&&ee?"split":"unified",ne=b==="split"&&E!==null&&!ee;Qn(()=>{l(o,ne)},[o,ne,l]),Qn(()=>()=>l(o,!1),[o,l]);let q=(_,te)=>u(Y=>{let Ie=new Set(Y);return te?Ie.add(_):Ie.delete(_),Ie}),se=_=>`${o}-hunk-${_}`,xe=(_,te)=>A(uo,{states:e,target:t,hunk:_,layout:ie,tableLabel:te,readLines:a,rescueTarget:()=>h.current.get(_)??r(),onLines:L,testId:`${i}-hunk-${_}-body`});return Re("div",{"data-cui-migration":"pending",ref:p,"data-testid":i,"data-layout":ie,"data-split-min-px":W,children:[n!==null&&Re(yr,{children:[Re("dl",{"data-testid":`${i}-stats`,children:[Re("div",{children:[A("dt",{children:"\u8FFD\u52A0\u3057\u305F\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesAdded,testId:`${i}-lines-added`})})]}),Re("div",{children:[A("dt",{children:"\u524A\u9664\u3057\u305F\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesRemoved,testId:`${i}-lines-removed`})})]}),Re("div",{children:[A("dt",{children:"\u5909\u308F\u3089\u306A\u3044\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesUnchanged,testId:`${i}-lines-unchanged`})})]}),Re("div",{children:[A("dt",{children:"\u8FFD\u52A0\u3057\u305F\u5B57"}),A("dd",{children:A(Q,{value:n.stats.charsAdded,testId:`${i}-chars-added`})})]}),Re("div",{children:[A("dt",{children:"\u524A\u9664\u3057\u305F\u5B57"}),A("dd",{children:A(Q,{value:n.stats.charsRemoved,testId:`${i}-chars-removed`})})]}),Re("div",{children:[A("dt",{children:"\u985E\u4F3C\u5EA6"}),A("dd",{children:A(Ke,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,testId:`${i}-similarity`})})]})]}),n.attributes.length>0&&A("ul",{"data-testid":`${i}-attributes`,children:n.attributes.map(_=>Re("li",{"data-field":_.field,children:[Yt(_.field)," ",vt(_.before)," \u2192 ",vt(_.after)]},_.field))}),n.hunks.length>0&&A("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${i}-hunk-index`,children:n.hunks.map(_=>A("li",{children:A("a",{href:`#${se(_.hunk)}`,onClick:()=>q(_.hunk,!0),"data-hunk":_.hunk,children:Jn(_)})},_.hunk))})]}),A(he,{variant:"secondary",onClick:()=>P(b==="split"?"unified":"split"),dataAttributes:{"data-preferred":b},testId:`${i}-layout-toggle`,children:b==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),ne&&A("p",{"data-testid":`${i}-narrow`,children:Zn}),n===null?xe(0,s):n.hunks.map(_=>{let te=T.has(_.hunk);return Re("div",{id:se(_.hunk),"data-testid":`${i}-hunk-${_.hunk}`,"data-open":te,children:[A(he,{variant:"secondary",expanded:te,controls:`${se(_.hunk)}-body`,onClick:()=>q(_.hunk,!te),ref:Y=>{Y===null?h.current.delete(_.hunk):h.current.set(_.hunk,Y)},testId:`${i}-hunk-${_.hunk}-toggle`,children:Jn(_)}),A("div",{id:`${se(_.hunk)}-body`,children:te&&xe(_.hunk,`${s} ${Jn(_)}`)})]},_.hunk)})]})}import{Fragment as yo,jsx as Mt,jsxs as En}from"react/jsx-runtime";function fo(e){let t=[e.page===null?null:`p.${e.page}`,e.sheet===null?null:`\u30B7\u30FC\u30C8 ${e.sheet}`,e.slide===null?null:`\u30B9\u30E9\u30A4\u30C9 ${e.slide}`,e.startSec===null?null:`${e.startSec}${e.endSec===null?"":`\u2013${e.endSec}`} \u79D2`].filter(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function gr(e){return e.new??e.old}function br(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function xr({states:e,stats:t,entries:n,textUnchangedChunkingChanged:a,readLines:s,rescueTarget:r,onNarrowChange:l,testId:i}){I();let[o,b]=mo(()=>new Set),P=u=>b(w=>{let D=new Set(w);return D.delete(u)||D.add(u),D}),T=u=>{let w=[u.old===null?null:["\u65E7",u.old],u.new===null?null:["\u65B0",u.new]].filter(p=>p!==null),D=new Set(w.flatMap(([,p])=>p.fidelity==="UNVERIFIED"?[$a]:p.fidelity==="WHITESPACE_NORMALIZED"?[La]:[]));return En(yo,{children:[w.map(([p,E])=>En("span",{"data-fidelity":E.fidelity,"data-side":p,children:[p," ",Pa[E.fidelity]," "]},p)),[...D].map(p=>Mt("span",{"data-chunk-note":!0,children:p},p))]})};return En("div",{"data-testid":i,children:[a&&Mt(Ve,{tone:"info",testId:`${i}-chunking-only`,children:Da}),En("p",{"data-testid":`${i}-stats`,children:["\u8FFD\u52A0 ",t.added,"\u30FB\u524A\u9664 ",t.removed,"\u30FB\u5909\u66F4 ",t.modified,"\u30FB\u79FB\u52D5 ",t.moved,"\u30FB\u5909\u308F\u3089\u306A\u3044 ",t.unchanged]}),Mt(Tt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:Nt(Object.values(Un))},align:"start",cell:u=>Un[u.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Ue},align:"start",cell:u=>fo(gr(u))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Ue},align:"start",cell:u=>gr(u).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:St("#00000 \u2192 #00000")},align:"start",cell:u=>`${u.old===null?"(\u306A\u3057)":`#${u.old.index}`} \u2192 ${u.new===null?"(\u306A\u3057)":`#${u.new.index}`}`},{key:"fidelity",header:"\u672C\u6587\u306E\u518D\u73FE",width:{minPx:Ue},align:"start",cell:T},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:hn("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:u=>br(u)?Mt(he,{variant:"secondary",expanded:o.has(u.entry),controls:`${i}-diff-${u.entry}`,onClick:()=>P(u.entry),testId:`${i}-diff-toggle-${u.entry}`,children:o.has(u.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:n,rowKey:u=>`${u.entry}`,rowTestId:`${i}-row`,rowData:u=>({"data-entry":u.entry,"data-kind":u.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${i}-table`}),n.filter(u=>br(u)&&o.has(u.entry)).map(u=>{let w=`\u30C1\u30E3\u30F3\u30AF #${u.old?.index} \u2192 #${u.new?.index} \u306E\u5DEE\u5206`;return Mt("section",{id:`${i}-diff-${u.entry}`,"aria-label":w,"data-testid":`${i}-diff-${u.entry}`,children:Mt(Nn,{states:e,target:{facet:"chunks",entry:u.entry},index:null,readLines:s,label:w,rescueTarget:r,onNarrowChange:l,testId:`${i}-diff-${u.entry}-view`})},u.entry)})]})}import{compareTreePaths as go,treePathLabel as bo}from"@aiquants/enrichment-core";import{useMemo as xo}from"react";import{jsx as hr}from"react/jsx-runtime";function ho(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:a})=>({path:n,label:bo(n),item:a})).sort((n,a)=>go(n.path,a.path))}function Rn({items:e,renderItem:t,testId:n}){I();let a=xo(()=>ho(e),[e]);return hr("ol",{role:"list","data-testid":n,children:a.map(({path:s,label:r,item:l})=>hr("li",{"data-testid":`${n}-item-${s}`,children:t(l,r,s)},s))})}import{Fragment as na,jsx as $e,jsxs as Qe}from"react/jsx-runtime";var Co={fontSize:`${ct}px`,fontWeight:vo.weight.bold},vr={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},Sr={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},ko=Nt(Object.values(fn));function To(e,t,n){let a=s=>Object.fromEntries(t.map(r=>[r.field,l=>$e("span",{"data-testid":`${n}-${r.field}-${s}-${l}`,children:vt(r[s])})]));return $e(dn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(s=>({key:s.field,label:Yt(s.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:a("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:a("after")}],attributePx:ko,columnMinPx:Ue,testId:n})}function Qt(e,t,n){return t.length===0?null:Qe("div",{"data-testid":n,children:[Qe("p",{children:[e," (",t.length,")"]}),$e("ul",{children:t.map(([a,s])=>$e("li",{children:s},a))})]})}function ea(e,t,n){return t.length===0?null:Qe("div",{"data-testid":n,children:[Qe("p",{children:[e," (",t.length,")"]}),$e(Rn,{items:t,renderItem:(a,s)=>`${s}: ${a}`,testId:`${n}-tree`})]})}var ta=e=>JSON.stringify(e.value),Er=e=>e.fields.map(t=>`${Yt(t.field)} ${vt(t.before)} \u2192 ${vt(t.after)}`).join("\u3001"),Nr=e=>[e.key,`${e.key}: ${ta(e)}`],wo=e=>[e.key,`${e.key}: ${Er(e)}`];function Po({diff:e,testId:t}){let n=_o(()=>({added:e.added.map(a=>({path:a.key,item:ta(a)})),removed:e.removed.map(a=>({path:a.key,item:ta(a)})),modified:e.modified.map(a=>({path:a.key,item:Er(a)}))}),[e]);return Qe(na,{children:[ea("\u8FFD\u52A0",n.added,`${t}-added`),ea("\u524A\u9664",n.removed,`${t}-removed`),ea("\u5909\u66F4",n.modified,`${t}-modified`)]})}function Rr({states:e,comparison:t,readLines:n,rescueTarget:a,testId:s}){let{announce:r}=I(),l=Ro(),[i,o]=Io(()=>new Set),b=No((p,E)=>o(h=>{if(h.has(p)===E)return h;let L=new Set(h);return E?L.add(p):L.delete(p),L}),[]),P=i.size>0;Eo(()=>{P&&r(Zn)},[P,r]);let T=t.facets.filter(p=>p.change==="CHANGED"),u=So.filter(p=>!T.some(E=>E.facet===p)),w=p=>`${l}-${p}`,D=p=>{let E=`${s}-${p.facet}`;switch(p.facet){case"classification":case"metadata":return To(ht[p.facet],p.fields,`${E}-grid`);case"labels":return Qe(na,{children:[Qt("\u8FFD\u52A0",p.added.map(Nr),`${E}-added`),Qt("\u524A\u9664",p.removed.map(Nr),`${E}-removed`),Qt("\u5909\u66F4",p.modified.map(wo),`${E}-modified`)]});case"assets":return $e(Po,{diff:p,testId:E});case"tags":return Qe(na,{children:[Qt("\u8FFD\u52A0",p.added.map(h=>[h,h]),`${E}-added`),Qt("\u524A\u9664",p.removed.map(h=>[h,h]),`${E}-removed`)]});case"structured_data":return $e(Tt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:Nt(Object.values(Sr))},align:"start",cell:({operation:h})=>Sr[h.op]},{key:"path",header:"\u9053",width:{minPx:Ue},align:"start",cell:({operation:h})=>h.path===""?"(\u6839)":h.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Ue},align:"start",cell:({operation:h})=>h.op==="add"?null:$e("pre",{style:vr,children:JSON.stringify(h.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Ue},align:"start",cell:({operation:h})=>h.op==="remove"?null:$e("pre",{style:vr,children:JSON.stringify(h.value,null,2)})}],rows:p.operations.map((h,L)=>({operation:h,position:L})),rowKey:({position:h})=>`${h}`,rowTestId:`${E}-operation`,rowData:({operation:h})=>({"data-op":h.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${E}-operations`});case"text":case"summary":return $e(Nn,{states:e,target:{facet:p.facet},index:p,readLines:n,label:ht[p.facet],rescueTarget:a,onNarrowChange:b,testId:`${E}-diff`});case"chunks":return $e(xr,{states:e,stats:p.stats,entries:p.entries,textUnchangedChunkingChanged:p.textUnchangedChunkingChanged,readLines:n,rescueTarget:a,onNarrowChange:b,testId:`${E}-table`})}};return Qe("div",{"data-cui-migration":"pending","data-testid":s,children:[T.length>0&&$e("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${s}-nav`,children:$e("ul",{children:T.map(p=>$e("li",{children:$e("a",{href:`#${w(p.facet)}`,"data-facet":p.facet,children:ht[p.facet]})},p.facet))})}),T.map(p=>Qe("section",{id:w(p.facet),"aria-labelledby":`${w(p.facet)}-heading`,"data-testid":`${s}-${p.facet}`,"data-facet":p.facet,children:[$e("h4",{id:`${w(p.facet)}-heading`,style:Co,children:ht[p.facet]}),D(p)]},p.facet)),u.length>0&&Qe("p",{"data-testid":`${s}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",u.map(p=>ht[p]).join("\u30FB")]})]})}import{isUnknownTerm as Lo,PIPELINE_STEPS as $o,RUN_TERMINAL_STEP_KEY as _r,RunTerminalStepDetailSchema as Do,storedTermText as Ao}from"@aiquants/enrichment-core";import{useMemo as Mo}from"react";import{Fragment as ra,jsx as j,jsxs as _e}from"react/jsx-runtime";var Oo=8,Fo={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Uo={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"},Ir={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Ko=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],Bo=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Ho="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)",Vo={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Cr(e){return Object.hasOwn(Ir,e)}function Zt(e,t){return`run-step-provenance-value-${e}-${t}`}function Go(e,t,n){if(Cr(t)){let s=e[t];return s===null?null:j(Q,{value:s,unit:Ir[t],testId:Zt(n,t)})}let a=e[t];return a===null?null:j(jt,{text:String(a),testId:Zt(n,t)})}function qo(e,t){let n=Ko.map(r=>({key:r,label:Uo[r],value:Go(e,r,t),breaks:Cr(r)?"atomic":"anywhere"})),a=e.pages_read!==null||e.pages_total!==null,s=_e(ra,{children:[j(Q,{value:e.pages_read,testId:Zt(t,"pages_read")})," / ",j(Q,{value:e.pages_total,testId:Zt(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:a?s:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:j(jt,{text:Fo[e.body_source],testId:Zt(t,"body_source")}),breaks:"anywhere"}]}function zo(e,t){let n=new Map,a=[];for(let r of t){if(r.targetTreePath===null){a.push(r);continue}let l=n.get(r.targetTreePath);l===void 0?n.set(r.targetTreePath,[r]):l.push(r)}let s=Array.from(n,([r,l])=>({path:r,item:l}));return{kind:"fan_out",stepKey:e,steps:t,placed:s,pathless:a}}function Wo(e){let t=[],n=new Map;for(let a of[...e.steps].sort((s,r)=>s.sequence-r.sequence)){let s=a.stepKey;if(s===_r||Lo(s)||$o[s].fanOut!=="children"||a.targetMetadataId===e.metadataId){t.push({kind:"step",step:a});continue}let r=n.get(s);if(r!==void 0){r.push(a);continue}let l=[a];n.set(s,l),t.push({kind:"fan_out",stepKey:s,steps:l})}return t.map(a=>a.kind==="step"?a:zo(a.stepKey,a.steps))}function Yo(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 Xo({step:e}){let{labels:t}=I();if(e.status==="SKIPPED")return _e("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",nr(Yo(e))]});if(e.stepKey===_r&&e.status==="SUCCEEDED"){let{outcome:l}=Do.parse(e.provenance?.detail);return j("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":l,children:er[l]})}if(e.provenance===null)return j("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 n=e.provenance,a=qo(n,e.sequence),s=a.filter(l=>l.value!==null),r=a.filter(l=>l.value===null);return _e(ra,{children:[s.length>0&&j("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:s.map(l=>_e("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[j("dt",{className:"text-slate-500",children:l.label}),j("dd",{className:`text-slate-800 ${Vo[l.breaks]}`,"data-provenance-key":l.key,children:l.value})]},l.key))}),r.length>0&&_e("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",r.map(l=>l.label).join("\u3001")]}),Object.keys(n.detail).length>0&&_e("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[j("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),j("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function aa(e,t,n,a,s){let r=Wn[e.status],l=s==="tree"?"div":"li",i=s==="alert"?{"data-cui-surface":"surface","data-cui-fg":"fg"}:void 0;return j(l,{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":Ao(e.stepKey),...i,children:_e("details",{open:a,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[_e("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[j("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),j("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&_e("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]}),j("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),j("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:j(Q,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),_e("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&j("div",{className:"h-2 rounded-full bg-slate-100",children:j("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&_e("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})`]}),j(Xo,{step:e})]})]})},e.id)}var jo=`${Ho}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function Jo({steps:e,longestDuration:t,opensEverything:n,testId:a}){let s=Dt(e);return j(Ge,{occurrence:s,testId:a,children:_e("div",{className:"space-y-3",children:[j("p",{"data-testid":`${a}-reason`,children:jo}),j("ol",{role:"list","data-testid":`${a}-list`,children:e.map(r=>aa(r,j("span",{"data-testid":`run-step-target-${r.sequence}`,children:`#${r.id} \u2192 #${r.targetMetadataId}`}),t,r.status==="FAILED"||n,"alert"))})]})})}function kr({run:e}){I();let t=e.steps.reduce((s,r)=>r.durationMs===null?s:Math.max(s,r.durationMs),0),n=e.steps.length<=Oo,a=Mo(()=>Wo(e),[e]);return j("ol",{"data-cui-migration":"pending",className:"space-y-3","data-testid":"run-steps",children:a.map(s=>{if(s.kind==="step"){let i=s.step,o=_e(ra,{children:[Jt(i.stepKey),i.targetMetadataId!==e.metadataId&&_e("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-${i.sequence}`,children:["\u5BFE\u8C61 #",i.targetMetadataId]})]});return aa(i,o,t,i.status==="FAILED"||n,"timeline")}let r=s.steps.some(i=>i.status==="FAILED"),l=Bo.map(i=>({status:i,count:s.steps.filter(o=>o.status===i).length})).filter(({count:i})=>i>0);return j("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${s.stepKey}`,"data-count":s.steps.length,children:_e("details",{open:r||s.pathless.length>0||n,className:"group/fanout","data-testid":`run-step-group-card-${s.stepKey}`,children:[_e("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[j("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),j("span",{className:"font-semibold text-[13px] text-slate-900",children:Jt(s.stepKey)}),_e("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${s.stepKey}`,children:["\u5BFE\u8C61 ",s.steps.length," \u4EF6"]}),j("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${s.stepKey}`,children:l.map(({status:i,count:o})=>`${Wn[i].label} ${o}`).join(" \xB7 ")})]}),_e("div",{className:"space-y-3 px-4 pb-4 [&_li+li]:mt-3 [&_li>div+div]:mt-3",children:[s.pathless.length>0&&j(Jo,{steps:s.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${s.stepKey}`}),s.placed.length>0&&j(Rn,{items:s.placed,renderItem:(i,o)=>i.map(b=>aa(b,j("span",{"data-testid":`run-step-target-${b.sequence}`,children:`${o} (#${b.targetMetadataId})`}),t,b.status==="FAILED"||n,"tree")),testId:`run-step-tree-${s.steps[0].sequence}`})]})]})},`group-${s.stepKey}`)})})}import{Fragment as Ot,jsx as g,jsxs as V}from"react/jsx-runtime";var ei={fontSize:`${da.type.title.size}px`,fontWeight:da.weight.bold},ti={fontSize:`${ct}px`,fontWeight:da.weight.bold},oa={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function Tr({host:e,fromStateId:t,toStateId:n,rescueTarget:a}){let s={fromStateId:t,toStateId:n},r=An(`${t}:${n}`,i=>e.compare(s,i),0),l=Je(a);return r.state.kind==="failed"?g(gt,{failure:r.state,onReload:r.reload,forbiddenMessage:dt,failureMessage:lt("\u6BD4\u8F03"),rescueRef:l,testId:"history-comparison-failed"}):r.state.kind!=="ready"?g("p",{"aria-busy":"true","data-testid":"history-comparison-loading",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):g(Rr,{states:s,comparison:r.state.value,readLines:e.readLines,rescueTarget:a,testId:"history-change"})}function ia(e,t,n){let a=Va(e,t);return[e.runOutcome==="FAILED"?g("span",{"data-testid":`${n}-failed-run`,"data-state-mark":"failed_run",children:Oa},"failed"):null,a.length>0?g("span",{"data-testid":`${n}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:Ua(a)},"unrecorded"):null,e.modelOnlyChange?g("span",{"data-testid":`${n}-model-only`,"data-state-mark":"model_only",children:Fa},"model"):null].filter(s=>s!==null)}function ni(e,t){return e.changes===null?null:g("span",{"data-testid":`${t}-badges`,children:e.changes.map(n=>g(He,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:gn(n)},n.facet))})}function ai({pinned:e,shown:t,onPin:n,onUnpin:a,fallback:s}){let r=Ze(null),l=Ze(null),i=Je(()=>l.current??r.current??s()),o=Zo(T=>(u=>{T.current=u;let w=i(u);return()=>{T.current=null,w()}}),[i]),[b]=Ft(()=>o(r)),[P]=Ft(()=>o(l));return e!==null?V("p",{"data-testid":"history-pin",children:[g(He,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",Ye(e.revision)," ",g(fe,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",g(he,{variant:"secondary",onClick:a,ref:P,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:g("p",{"data-testid":"history-pin",children:g(he,{variant:"secondary",onClick:()=>n(t.stateId),ref:b,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function cc({host:e,metadataId:t,target:n,openRequest:a,onClose:s,returnFocusFallback:r,captureState:l}){let{labels:i,announce:o}=I(),b=sa(),P=sa(),T=sa(),u=Ze(null),w=Ze(null),D=Ze(null),p=Ze(null),E=Ze(null),h=Ze(null),L=Ze(r),W=Ze(0),[ee,ie]=Ft(null),[ne,q]=Ft(null),[se,xe]=Ft({metadataId:t,groups:{}});se.metadataId!==t&&xe({metadataId:t,groups:{}});let[_,te]=Ft(null),Y=An(t,y=>e.loadHistory(t,y),a),Ie=Je(()=>w.current),We=Je(()=>w.current),De=Y.state.kind==="ready"?Y.state.refreshFailure:null,Ce=Dt(De),Le=Y.state.kind==="ready"&&Y.state.refreshing,oe=Y.state.kind==="ready"?Y.state.value:null,N=oe===null?null:Ha(oe),X=ee!==null&&ee.request===a?ee.key:N===null?null:Ga(n,N),M=N?.groups.flatMap(y=>y.items).find(y=>y.key===X),ae=M===void 0||Le?null:`revision:${M.kind==="run"?M.run.revision:M.state.revision}`,ge=Je(()=>X===null?w.current:D.current);_n(()=>{L.current=r},[r]),_n(()=>{if(E.current!==a){E.current=a,h.current=null;let y=document.activeElement;u.current?.contains(y)!==!0&&(p.current=(y instanceof HTMLElement||y instanceof SVGElement)&&y!==document.body?y:null),w.current?.focus();return}X!==null&&X===h.current&&(h.current=null,D.current?.focus())},[a,X]),_n(()=>{ae!==null&&xe(y=>y.groups[ae]===!0?y:{metadataId:y.metadataId,groups:{...y.groups,[ae]:!0}})},[ae,a]),_n(()=>()=>{E.current=null,W.current+=1;let y=p.current;if(y?.isConnected){y.focus();return}L.current()?.focus()},[]);let re=y=>{y.key==="Escape"&&(y.stopPropagation(),s())},Me=y=>{if(y===X){D.current?.focus();return}h.current=y,ie({request:a,key:y})},m=y=>{W.current+=1;let k=W.current,$=_?.metadataId===t?_.failure:null;te({metadataId:t,busy:!0,failure:$}),y(t).then(z=>{if(W.current===k){if(z.ok){te({metadataId:t,busy:!1,failure:null}),o(z.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),Y.refresh();return}te({metadataId:t,busy:!1,failure:{status:z.status,reason:z.reason,occurrence:($?.occurrence??0)+1}})}})},O=()=>{if(Y.state.kind==="failed")return g(gt,{failure:Y.state,onReload:Y.reload,forbiddenMessage:dt,failureMessage:lt("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:Ie,testId:"history-failed"});if(oe===null||N===null)return g("p",{"aria-busy":"true","data-testid":"history-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let y=N.states,k=N.runs[0],$=l!==void 0&&k!==void 0&&!y.some(U=>U.runId===k.id),z=_?.metadataId===t?_:null,ue=y[0];return V("div",{ref:We,"data-testid":"history-content",children:[V("dl",{"data-testid":"history-document",children:[V("div",{children:[g("dt",{children:"URI"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-document-uri",children:oe.document.fileUri})]}),V("div",{children:[g("dt",{children:"\u73FE\u5728\u306E\u7248"}),g("dd",{"data-testid":"history-document-revision",children:Ye(oe.document.revision)})]}),V("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-document-confidentiality",children:oe.document.confidentialityLevel})]}),V("div",{children:[g("dt",{children:"\u7248\u306E\u6570"}),g("dd",{"data-testid":"history-document-revisions",children:N.groups.length})]}),V("div",{children:[g("dt",{children:"\u6700\u5F8C\u306E\u5909\u5316"}),g("dd",{"data-testid":"history-document-last-change",children:ue===void 0?"\u8A18\u9332\u306A\u3057":g(fe,{iso:ue.settledAt,testId:"history-document-last-change-value"})})]})]}),De!==null&&g(Ge,{occurrence:Ce,testId:"history-refresh-failed",children:bn(i,De,"\u6587\u66F8\u306E\u5C65\u6B74")}),$&&g("p",{"data-testid":"history-capture",children:g(he,{variant:"primary",busy:z?.busy===!0,busyLabel:i.loading,onClick:()=>m(l),ref:ge,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),z!==null&&z.failure!==null&&g(Ge,{occurrence:z.failure.occurrence,testId:"history-capture-failed",children:i.failureSentence(z.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",U=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${Qo(U)}\u3002`)}),y.length===0&&N.runs.length===0&&N.marks.length===0?g("p",{role:"status","data-testid":"history-empty",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):g(on,{master:Oe(N),detail:Fe(N),masterMinPx:za,detailMinPx:Wa,testId:"history-master-detail"})]})},de=se.groups,le=(y,k)=>de[y]??k,ke=(y,k)=>xe({metadataId:t,groups:{...de,[y]:!le(y,k)}}),Be=ne!==null&&ne.request===a?ne.stateId:null,Oe=y=>V("div",{"data-testid":"history-timeline",children:[y.marks.length>0&&V("div",{"data-testid":"history-restricted-group",children:[V(he,{variant:"secondary",expanded:le("restricted",!1),controls:`${P}-restricted`,onClick:()=>ke("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",y.marks.length," \u4EF6)"]}),g("ul",{role:"list",id:`${P}-restricted`,hidden:!le("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:y.marks.map(({key:k,mark:$})=>g("li",{"data-restricted-mark":$.subject,"data-testid":"history-restricted-mark",children:$.subject==="state"?V(Ot,{children:[g("span",{children:Aa})," ",g(fe,{iso:$.settledAt,testId:`history-${k}-settled-at-value`})]}):V(Ot,{children:[g("span",{children:yn})," ",g(He,{tone:oa[$.status],variant:"tint",testId:`history-${k}-status`,children:rt[$.status].label})," ",g(fe,{iso:$.startedAt,testId:`history-${k}-started-at-value`})," \u301C ",g(At,{iso:$.finishedAt,testId:`history-${k}-finished-at-value`})]})},k))})]}),y.groups.map(k=>{let $=`revision:${k.revision}`,z=le($,k.isCurrent),ue=`${Ye(k.revision)}${k.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return V("div",{"data-testid":"history-revision-group","data-revision":k.revision,"data-current":k.isCurrent,children:[g(he,{variant:"secondary",expanded:z,controls:`${P}-${$}`,onClick:()=>ke($,k.isCurrent),testId:`history-revision-toggle-${k.revision}`,children:`${ue} \u2014 ${k.items.length} \u4EF6`}),g("div",{id:`${P}-${$}`,hidden:!z,children:g(cn,{label:ue,items:k.items,itemKey:U=>U.key,selectedKey:X,onSelect:U=>Me(U.key),detailId:P,renderRow:U=>nt(U,y),rowTestId:"history-item",rowData:U=>({"data-item-key":U.key,"data-pinned":U.state!==null&&U.state.stateId===Be}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${k.revision}`})})]},$)})]}),nt=(y,k)=>{let $=y.state,z=`history-row-${y.key}`,ue=$===null?[]:ia($,k,z);return V(Ot,{children:[y.kind==="run"?V("span",{children:["\u5B9F\u884C #",y.run.id," \xB7 ",Yn[y.run.trigger]," ",g(He,{tone:oa[ut(y.run)],variant:"tint",testId:`${z}-status`,children:rt[ut(y.run)].label})]}):g("span",{children:Lt[y.state.cause]}),g("span",{children:g(fe,{iso:y.time,testId:`${z}-time-value`})}),$!==null&&ni($,z),y.kind==="run"&&Hn(y.run)&&g("span",{"data-testid":`${z}-unrecorded`,children:Kn}),ue,$!==null&&$.stateId===Be&&g(He,{tone:"info",variant:"tint",testId:`${z}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},Te=(y,k)=>{let $=k.states.find(ye=>ye.stateId===Be)??null,z=g(ai,{pinned:$,shown:y,onPin:ye=>q({request:a,stateId:ye}),onUnpin:()=>q(null),fallback:()=>D.current});if(y===null)return z;let ue=()=>D.current,U;if($!==null&&$.stateId!==y.stateId){let[ye,It]=k.states.indexOf($)>k.states.indexOf(y)?[$,y]:[y,$];U=g(Tr,{host:e,fromStateId:ye.stateId,toStateId:It.stateId,rescueTarget:ue})}else y.previousStateId===null?U=g("p",{"data-testid":"history-no-previous",children:Ma}):U=g(Tr,{host:e,fromStateId:y.previousStateId,toStateId:y.stateId,rescueTarget:ue});return V(Ot,{children:[z,U]})},at=y=>{if(M===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let k=M.state,$=y.states.find(z=>z.stateId===Be);if($!==void 0&&k!==null&&$.stateId!==k.stateId){let[z,ue]=y.states.indexOf($)>y.states.indexOf(k)?[$,k]:[k,$];return`\u6BD4\u8F03: ${Ye(z.revision)} \u2192 ${Ye(ue.revision)}`}return M.kind==="run"?`${Ye(M.run.revision)} \u306E\u5B9F\u884C #${M.run.id}`:`${Ye(M.state.revision)} \u306E\u5909\u5316`},Ae=y=>{if(X===null)return y.groups.some(ue=>ue.items.length>0)?g("p",{"data-testid":"history-select-prompt",children:"\u6642\u7CFB\u5217\u304B\u3089\u8A18\u9332\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5909\u5316\u3092\u793A\u3057\u307E\u3059\u3002"}):g("p",{role:"status","data-testid":"history-no-selectable",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});if(M===void 0&&Le)return g("p",{"aria-busy":"true","data-testid":"history-detail-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});if(M===void 0)return V("p",{role:"status","data-testid":"history-selection-missing",children:[X.startsWith("run:")?`\u5B9F\u884C #${X.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(M.kind==="state"){let{state:ue}=M;return V(Ot,{children:[V("dl",{"data-testid":"history-state-summary",children:[V("div",{children:[g("dt",{children:"\u5951\u6A5F"}),g("dd",{"data-testid":"history-state-cause",children:Lt[ue.cause]})]}),V("div",{children:[g("dt",{children:"\u6642\u523B"}),g("dd",{children:g(fe,{iso:ue.settledAt,testId:"history-state-settled-at-value"})})]}),V("div",{children:[g("dt",{children:"\u64CD\u4F5C\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-state-actor",children:ue.actor})]}),V("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-state-confidentiality",children:ue.classification.confidentialityLevel})]})]}),ia(ue,y,"history-detail"),Te(ue,y)]})}let{run:k,state:$}=M,z=ut(k);return V(Ot,{children:[V("dl",{"data-testid":"history-run-summary","data-run-id":k.id,children:[V("div",{children:[g("dt",{children:"\u304D\u3063\u304B\u3051"}),g("dd",{"data-testid":"history-run-trigger","data-trigger":k.trigger,children:Yn[k.trigger]})]}),V("div",{children:[g("dt",{children:"\u8A66\u884C"}),g("dd",{"data-testid":"history-run-attempt",children:k.attempt})]}),V("div",{children:[g("dt",{children:"\u72B6\u614B"}),g("dd",{children:g(He,{tone:oa[z],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":k.status,"data-presentation":z},children:rt[z].label})})]}),V("div",{children:[g("dt",{children:"\u7A2E\u985E"}),g("dd",{"data-testid":"history-run-kind",children:Za(k.documentKind)})]}),V("div",{children:[g("dt",{children:"\u8981\u6C42\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-requested-by",children:k.requestedBy})]}),V("div",{children:[g("dt",{children:"\u958B\u59CB"}),g("dd",{children:g(fe,{iso:k.startedAt,testId:"history-run-started-at-value"})})]}),V("div",{children:[g("dt",{children:"\u7D42\u4E86"}),g("dd",{"data-testid":"history-run-finished-at",children:g(At,{iso:k.finishedAt,testId:"history-run-finished-at-value"})})]}),V("div",{children:[g("dt",{children:"\u30B8\u30E7\u30D6"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-job-id",children:k.jobId})]})]}),k.errorMessage!==null&&g("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:k.errorMessage}),Hn(k)&&g("p",{"data-testid":"history-run-unrecorded",children:Kn}),$===null?g("p",{"data-testid":"history-run-no-state",children:"\u3053\u306E\u5B9F\u884C\u304C\u4F5C\u3063\u305F\u72B6\u614B\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):ia($,y,"history-detail"),Te($,y),V("details",{"data-testid":"history-run-steps",children:[g("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),g(kr,{run:k})]})]})},Fe=y=>V("section",{id:P,"aria-labelledby":T,"data-testid":"history-detail","data-selected-key":X??"",children:[g("h3",{ref:D,id:T,tabIndex:-1,style:ti,"data-testid":"history-detail-heading",children:at(y)}),Ae(y)]});return V("section",{"data-cui-migration":"pending",ref:u,role:"dialog","aria-labelledby":b,onKeyDown:re,"data-testid":"history-inspector","data-metadata-id":t,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans",children:[V("div",{children:[g("h2",{ref:w,id:b,tabIndex:-1,style:ei,"data-testid":"history-heading",children:oe===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${oe.document.fileName}`}),g(he,{variant:"secondary",onClick:s,testId:"history-close",children:i.close})]}),O()]})}import{COPY_REASON_LABELS as si,ConfidentialityLevelSchema as oi,EnrichmentSyncStatusSchema as Or,identifierMatches as ii,isPromotable as di,PROTECTION_SCHEME_LABELS as li,pastedIdentifier as ci,QUARANTINED_CONFIDENTIALITY_LEVEL as $r,sourceOfUri as la,UNLOCK_DISPOSITION_LABELS as ui}from"@aiquants/enrichment-core";import{useId as mt,useLayoutEffect as pi,useMemo as Dr,useRef as Ar,useState as ze}from"react";import{formatCount as wr}from"@aiquants/console-ui/core";function pt(e,t,n){try{wr(e,n)}catch(a){throw new RangeError(`${t}: ${a.message}`,{cause:a})}return e}function In(e,t,n){return wr(pt(e,t,n),n)}var Lr=1024,ri=[{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 Pr(e,t){return Number((e/Lr**t.power).toFixed(t.fractionDigits))}function Cn(e,t,n){pt(e,t,n);let[a,...s]=ri,r=a,l=Pr(e,r);for(let i of s){if(l<Lr)break;r=i,l=Pr(e,r)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:r.fractionDigits,maximumFractionDigits:r.fractionDigits,useGrouping:!0}).format(l)} ${r.name}`}import{Fragment as vi,jsx as c,jsxs as v}from"react/jsx-runtime";var mi="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",fi=new Set(Or.options.filter(e=>e.startsWith("FAILED"))),yi=new Set(Or.options);function gi(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:fi.has(e.syncStatus)?{kind:"retry"}:yi.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Mr(e,t,n){let a=e?.find(s=>s.confidentialityLevel===t&&s.capability===n);return a?a.isEnabled:null}var bi={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"},xi=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function hi(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ca({field:e}){return c("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function _c({policies:e,tenantId:t,sources:n,domainOptions:a,recentItems:s=[],inspectionResult:r=null,isSubmitting:l=!1,isInspecting:i=!1,isBusy:o=!1,promotingId:b=null,onInspectUri:P,onIngestDocument:T,onRetryItem:u,onShowHistory:w,onPromoteUnlockedCopy:D,listRefusal:p}){let{formatLocale:E}=I(),h=Pt(),L=Ar(new Map),W=Ar(null),ee=mt(),ie=mt(),ne=mt(),q=mt(),se=mt(),xe=mt(),_=mt(),te=mt(),[Y,Ie]=ze(null),[We,De]=ze(""),[Ce,Le]=ze(""),[oe,N]=ze("CONFIDENTIAL"),[X,M]=ze(null),[ae,ge]=ze(""),[re,Me]=ze(""),[m,O]=ze([]),[de,le]=ze(""),[ke,Be]=ze("user"),[Oe,nt]=ze(1),[Te,at]=ze(!1),Ae=X!==null&&a.some(d=>d.key===X)?X:a.length>0?a[0].key:null,Fe=Y===null?void 0:n.find(d=>d.uri_prefix===Y),y=Fe!==void 0?Fe:n.length>0?n[0]:null,k=Dr(()=>({vectorEnabled:Mr(e,oe,"vector_indexing"),graphEnabled:Mr(e,oe,"graph_indexing")}),[e,oe]),$=Dr(()=>{let d=Ce.trim();if(!d||n.length===0)return{valid:!1,error:null};let R=la(n,d);if(R===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(je=>je.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let x=d.slice(R.uri_prefix.length);return x.trim()?d.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"}:ii(R,x)?{valid:!0,error:null}:{valid:!1,error:`${hi(R.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${R.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[Ce,n]),z=d=>{if(Ie(d),We.trim()){let R=We.trim(),x=la(n,R),je=x===void 0?R:R.slice(x.uri_prefix.length);Le(`${d}${je}`)}else Le("")},ue=d=>{let R=d.trim();if(!R){De(""),Le("");return}let x=ci(n,R);if(x!==void 0){Ie(x.source.uri_prefix),De(x.identifier),Le(`${x.source.uri_prefix}${x.identifier}`);return}let je=la(n,R);if(je!==void 0){Ie(je.uri_prefix),De(R.slice(je.uri_prefix.length)),Le(R);return}if(R.includes("://")){De(d),Le(R);return}De(d),Le(y===null?R:`${y.uri_prefix}${R}`)},U=()=>{let d=de.trim();d&&(m.some(R=>R.labelKey===d)||(O(R=>[...R,{labelKey:d,category:ke,confidenceScore:Number(Oe.toFixed(2))}]),le("")))},ye=d=>{m.some(R=>R.labelKey===d)||O(R=>[...R,{labelKey:d,category:"domain",confidenceScore:1}])},It=d=>{O(R=>R.filter(x=>x.labelKey!==d))},Ht=d=>{if(d.preventDefault(),!$.valid||Ae===null)return;let R={fileUri:Ce.trim(),confidentialityLevel:oe,targetDomainKey:Ae,departmentId:ae.trim()?Number(ae):null,titleOverride:re.trim()?re.trim():null,labels:m};T?.(R)};pi(()=>{let d=W.current;if(d===null)return;let R=s.find(x=>x.kind==="readable"&&x.item.id===d)?.item;R?.unlock?.disposition==="copy_promoted"&&(W.current=null,document.activeElement===document.body&&L.current.get(d)?.focus(),h(`${R.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[s,h]);let $n=d=>{let R=d.unlock;if(R===null)return null;let x=R.disposition==="copy_original"&&R.copyReason!==null&&di(R.copyReason)&&d.isCurrent!==!1,je=b===d.id,Sa=je?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return v("div",{ref:Na=>{Na===null?L.current.delete(d.id):L.current.set(d.id,Na)},tabIndex:-1,className:"mt-1 max-w-xs space-y-1 text-[11px] text-slate-700","data-testid":`ingest-unlock-${d.id}`,"data-disposition":R.disposition,"data-protection":R.protectionScheme,children:[v("div",{children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",li[R.protectionScheme]]}),v("div",{"data-testid":`ingest-unlock-disposition-${d.id}`,children:[ui[R.disposition],R.copyReason!==null&&` (${si[R.copyReason]})`]}),x&&D!==void 0&&c("button",{type:"button",onClick:()=>{W.current=d.id,D(d.id)},disabled:o,"aria-busy":je,"aria-label":`${d.fileName} \u306E${Sa}`,className:"min-h-11 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 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":`ingest-promote-button-${d.id}`,children:Sa})]})},f=d=>{let R=gi(d);if(R.kind==="blocked")return c("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${d.id}`,"data-reason":R.reason,children:R.reason});let x=R.kind==="retry";return c("button",{type:"button",onClick:()=>u?.(d.id),disabled:o,"aria-label":`${d.fileName} \u3092${x?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:x?"min-h-11 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 disabled:cursor-not-allowed":"min-h-11 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 disabled:cursor-not-allowed","data-testid":`ingest-${R.kind}-button-${d.id}`,children:x?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},ve=d=>{switch(d){case"SYNCED":return c("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 c("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 c("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 c("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 c("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 d.startsWith("FAILED")?v("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: ",d]}):c("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:d})}};return v("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"document-ingest-console",children:[v("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[v("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[v("div",{children:[c("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"}),c("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"})]}),v("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: ",c("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),v("form",{onSubmit:Ht,className:"mt-6 space-y-6",children:[v("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[v("label",{htmlFor:ee,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",c(ca,{field:"uri"})]}),y!==null&&v("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",c("strong",{className:"font-semibold text-indigo-600",children:y.uri_prefix})]})]}),y===null&&c(Ve,{tone:"warning",testId:"ingest-no-sources",children:"\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002"}),v("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),n.map(d=>c("button",{type:"button",onClick:()=>z(d.uri_prefix),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${y?.uri_prefix===d.uri_prefix?"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-${d.scheme}`,children:`${d.scheme}:// (${d.title.ja})`},d.scheme))]}),v("div",{className:"space-y-1.5",children:[v("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[v("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 ${$.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:[c("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:y?.uri_prefix}),c("input",{id:ee,type:"text",value:We,onChange:d=>ue(d.target.value),placeholder:y?.input_hint.ja,disabled:y===null,"aria-invalid":!!$.error,"aria-describedby":$.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})]}),c("button",{type:"button",onClick:()=>P?.(Ce.trim()),disabled:!$.valid||i||o,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:i?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),v("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[y!==null&&c("p",{className:"text-slate-500",children:y.guidance.ja}),Ce&&v("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[c("span",{children:"\u89E3\u6C7A URI:"}),c("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:Ce})]})]})]}),$.error&&c("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:$.error})]}),r&&r.fileUri===Ce.trim()&&v("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 ${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:[v("div",{className:"flex items-center justify-between",children:[c("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)"}),c("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.exists&&v("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),c("span",{className:"font-semibold text-slate-800",children:r.fileName})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),c("span",{className:"font-semibold text-slate-800",children:c(Ke,{text:Cn(r.fileSize,"fileSize",E),testId:"inspection-file-size-value"})})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"MIME:"}),c("span",{className:"font-semibold text-slate-800",children:r.mimeType})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),c("span",{className:"font-semibold text-slate-800",children:r.revisionId?.slice(0,8)??"N/A"})]})]})]}),v("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[v("div",{className:"space-y-1",children:[v("label",{htmlFor:ie,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",c(ca,{field:"confidentiality"})]}),c("select",{id:ie,value:oe,onChange:d=>N(d.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:oi.options.map(d=>v("option",{value:d,children:[d," (",bi[d],")"]},d))})]}),v("div",{className:"space-y-1",children:[v("label",{htmlFor:ne,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",c(ca,{field:"domain"})]}),c("select",{id:ne,value:Ae===null?"":Ae,onChange:d=>M(d.target.value),disabled:a.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:a.map(d=>c("option",{value:d.key,children:d.label},d.key))}),a.length===0&&c("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"})]})]}),oe===$r&&v("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:[c("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",$r," \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",c("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"})]}),v("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:[c("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)"}),v("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[v("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":k.vectorEnabled===null?"unknown":String(k.vectorEnabled),children:k.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":k.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${oe} \u306E\u8A2D\u5B9A)`})]}),v("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":k.graphEnabled===null?"unknown":String(k.graphEnabled),children:k.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":k.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${oe} \u306E\u8A2D\u5B9A)`})]})]}),v("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 (",c("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"]})]}),v("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[v("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),v("span",{className:"text-slate-500 text-xs",children:[m.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),v("div",{className:"flex flex-wrap items-center gap-1.5",children:[c("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),xi.map(d=>v("button",{type:"button",onClick:()=>ye(d),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-${d}`,children:["+ ",d]},d))]}),v("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[v("div",{className:"space-y-1 sm:col-span-2",children:[c("label",{htmlFor:xe,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),c("input",{id:xe,type:"text",value:de,onChange:d=>le(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),U())},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"})]}),v("div",{className:"space-y-1",children:[c("label",{htmlFor:_,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),v("select",{id:_,value:ke,onChange:d=>Be(d.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:[c("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),c("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),c("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),v("div",{className:"space-y-1",children:[v("label",{htmlFor:te,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Oe.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)"]}),c("input",{id:te,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Oe,"aria-valuenow":Oe,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Oe*100)}%`,onChange:d=>nt(Number.parseFloat(d.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),c("div",{children:c("button",{type:"button",onClick:U,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"})})]}),m.length>0&&c("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:m.map(d=>v("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-${d.labelKey}`,children:[c("span",{className:"font-semibold",children:d.labelKey}),v("span",{className:"text-indigo-400",children:["(",d.category,")"]}),c("button",{type:"button",onClick:()=>It(d.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${d.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${d.labelKey}`,children:"\xD7"})]},d.labelKey))})]}),v("div",{className:"space-y-3",children:[c("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":Te,"aria-controls":"advanced-settings-panel",onClick:()=>at(d=>!d),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:v("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&&v("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:[c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:v("div",{className:"space-y-1",children:[c("label",{htmlFor:se,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),c("input",{id:se,type:"text",value:re,onChange:d=>Me(d.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"})]})}),c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:v("div",{className:"space-y-1",children:[c("label",{htmlFor:q,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),c("input",{id:q,type:"number",value:ae,onChange:d=>ge(d.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"})]})})]})]}),c("div",{className:"flex justify-end pt-2",children:c("button",{type:"submit",disabled:!$.valid||Ae===null||l||i||o,"aria-busy":l,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:l?v(vi,{children:[c("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),c("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):c("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),v("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[c("div",{className:"flex items-center justify-between",children:v("div",{children:[c("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),c("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"})]})}),p!==void 0?c(Ve,{tone:"warning",testId:"recent-items-refused",children:p}):s.length===0?c("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"}):c("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:v("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:[c("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:v("tr",{children:[c("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),c("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),c("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:s.map((d,R)=>{if(d.kind==="restricted")return v("tr",{"data-testid":`recent-item-restricted-${R}`,"data-restricted-mark":"ingest",children:[c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${R}`,children:$t}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${R}`,children:d.syncStatus===null?c("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:mi}):ve(d.syncStatus)}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${R}`,children:c(fe,{iso:d.createdAt,testId:`recent-item-restricted-created-at-value-${R}`})}),c("td",{className:"px-3 py-2"})]},`restricted:${R}`);let x=d.item;return v("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${x.id}`,children:[c("td",{className:"px-3 py-2 font-bold",children:x.id}),v("td",{className:"max-w-xs truncate px-3 py-2",title:x.fileUri,children:[c("div",{className:"font-sans font-semibold text-slate-900",children:x.fileName}),c("div",{className:"truncate text-[11px] text-slate-600",children:x.fileUri})]}),c("td",{className:"px-3 py-2",children:c("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:x.confidentialityLevel})}),v("td",{className:"px-3 py-2 text-slate-600",children:["rev.",x.revision,x.isCurrent===!1&&c("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-${x.id}`,children:"\u65E7\u7248"})]}),v("td",{className:"px-3 py-2 font-sans",children:[ve(x.syncStatus),x.errorMessage!==null&&x.errorMessage!==void 0&&x.errorMessage!==""&&c("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${x.id}`,title:x.errorMessage,children:x.errorMessage}),$n(x)]}),v("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${x.id}`,children:[x.lastRun===null?c("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${x.id}`,children:"\u8A18\u9332\u306A\u3057"}):x.lastRun.kind==="restricted"?v("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${x.id}`,"data-restricted-mark":"run",children:[c("div",{className:"text-[11px] text-slate-600",children:yn}),c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${rt[x.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${x.id}`,"data-status":x.lastRun.status,children:rt[x.lastRun.status].label}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${x.id}`,children:c(At,{iso:x.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${x.id}`})})]}):v("div",{className:"space-y-1",children:[c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${rt[ut(x.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${x.id}`,"data-status":x.lastRun.item.status,"data-presentation":ut(x.lastRun.item),children:rt[ut(x.lastRun.item)].label}),x.lastRun.item.failedStepKey!==null&&c("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${x.id}`,children:Jt(x.lastRun.item.failedStepKey)}),x.lastRun.item.failedStepKey==="unlock_document"&&c("div",{className:"max-w-xs text-[11px] text-slate-700","data-testid":`ingest-unlock-hint-${x.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${x.id}`,children:c(At,{iso:x.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${x.id}`})})]}),w!==void 0&&c("button",{type:"button",onClick:()=>w(x.id),"aria-label":`${x.fileName} \u306E\u5C65\u6B74`,className:"mt-1 min-h-11 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-${x.id}`,children:"\u5C65\u6B74"})]}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${x.id}`,children:c(fe,{iso:x.createdAt,testId:`ingest-created-at-value-${x.id}`})}),c("td",{className:"px-3 py-2 text-right font-sans",children:f(x)})]},`readable:${x.id}`)})})]})})]})]})}import{ENRICHMENT_STAGES as ua}from"@aiquants/enrichment-core";import{jsx as Se,jsxs as et}from"react/jsx-runtime";var Si="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",Fr={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 Ur(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Tc({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:a=!1}){let s=n===void 0;return et("div",{"data-cui-migration":"pending","data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[et("div",{children:[Se("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),et("p",{className:"text-slate-500 text-xs",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \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",Se("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 ",ua.length," \u6BB5\u3002"]}),Se("p",{"data-testid":"strategy-inert-note",className:"mt-1 text-slate-500 text-xs",children:Si}),s&&Se("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?Se("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"}):Se("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:et("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:[Se("thead",{children:et("tr",{children:[Se("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"}),ua.map(r=>{let l=Ur(r.featureFlagKey,t);return et("th",{scope:"col","data-inert":String(!r.readByPipeline),className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[Se("div",{children:r.label}),Se("div",{"data-testid":`strategy-gate-${r.key}`,"data-gate":l,className:"mt-0.5 font-normal text-[10px]",style:{color:Fr[l].color},children:Fr[l].label}),!r.readByPipeline&&Se("div",{"data-testid":`strategy-inert-${r.key}`,className:"mt-0.5 font-normal text-[10px] text-slate-500",children:"\u4ECA\u306F\u52B9\u304B\u306A\u3044"})]},r.key)})]})}),Se("tbody",{children:e.map(r=>et("tr",{"data-testid":`strategy-row-${r.domainKey}`,"data-provenance":r.provenance,"data-active":String(r.isActive),children:[et("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[Se("div",{className:"font-semibold text-slate-900",children:r.domainLabel}),et("div",{className:"text-[10px] text-slate-500",children:[Se("code",{children:r.domainKey})," / ",r.strategyName]}),Se("div",{"data-testid":`strategy-provenance-${r.domainKey}`,className:"text-[10px] text-slate-500",children:r.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"}),!r.isActive&&Se("div",{"data-testid":`strategy-inactive-${r.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"})]}),ua.map(l=>{let i=r.stages[l.key],o=Ur(l.featureFlagKey,t),b=!l.readByPipeline;return et("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[Se("button",{type:"button",role:"switch","aria-checked":i,"aria-label":b?`${r.domainLabel} \u306E ${l.label} (\u4ECA\u306F\u52B9\u304B\u306A\u3044)`:`${r.domainLabel} \u306E ${l.label}`,"data-testid":`strategy-stage-${r.domainKey}-${l.key}`,"data-enabled":String(i),"data-effective":String(!b&&i&&(o==="open"||o==="absent")),"data-inert":String(b),disabled:s||a,onClick:()=>n?.(r,l.key,!i),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${i?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${s||a?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:i?"\u958B":"\u9589"}),!b&&i&&o==="unmeasured"&&Se("div",{"data-testid":`strategy-unmeasured-${r.domainKey}-${l.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"}),!b&&i&&o==="closed"&&Se("div",{"data-testid":`strategy-blocked-${r.domainKey}-${l.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"})]},l.key)})]},`${r.domainKey}:${r.strategyName}`))})]})})]})}var Ut={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Kt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};import{Fragment as Vr,jsx as G,jsxs as pe}from"react/jsx-runtime";var Ni={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"},Kr=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],Ei=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),kn={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 Br(e){return e.kind==="text"?"anywhere":"atomic"}function Gr(e,t){return t===null?{kind:"unmeasured"}:Ei.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 Ri(e){let t=Kr.filter(a=>a in e),n=Object.keys(e).filter(a=>!Kr.includes(a)).sort();return[...t,...n].map(a=>({key:a,label:Ni[a]??a,value:Gr(a,e[a])}))}function Hr(e,t){switch(e.kind){case"count":return G(Q,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return G(Ke,{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 G(Ke,{text:String(e.value),testId:t});case"word":return G(Ke,{text:e.text,testId:t});case"text":return G(jt,{text:e.text,testId:t})}}function Oc({health:e,isRefreshing:t=!1,onRefresh:n,className:a=""}){let{services:s,allHealthy:r,checkedAt:l}=e;I();let i=[{key:"qdrant",data:s.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:s.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:s.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:s.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:s.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return pe("section",{"data-cui-migration":"pending",className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${a}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(r),children:[pe("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[pe("div",{className:"flex items-center gap-3",children:[G("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:pe("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:[G("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),G("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),G("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),G("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),pe("div",{children:[G("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),pe("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",G("span",{"data-testid":"health-checked-at",children:G(fe,{iso:l,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"]})]})]}),pe("div",{className:"flex flex-wrap items-center gap-3",children:[G("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...Kt[r?"connected":"error"],"data-testid":"health-overall-status-badge",children:r?pe(Vr,{children:[pe("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:[G("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),G("polyline",{points:"22 4 12 14.01 9 11.01"})]}),pe("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ut.connected]})]}):pe(Vr,{children:[pe("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:[G("circle",{cx:"12",cy:"12",r:"10"}),G("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),G("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),pe("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ut.error]})]})}),n&&pe("button",{type:"button",onClick:n,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:[pe("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:[G("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),G("path",{d:"M3 3v5h5"}),G("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),G("path",{d:"M16 21h5v-5"})]}),G("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),G("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:i.map(({key:o,data:b,title:P,subtitle:T})=>{let u=Gr("version",b.version),w=kn[Br(u)],D=Hr(u,`service-version-value-${o}`);return pe("div",{"data-testid":`service-card-${o}`,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:[pe("div",{children:[pe("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[G("span",{className:"font-semibold text-sm",children:P}),pe("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...Kt[b.status],"data-testid":`service-status-${o}`,children:[G("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${o}`}),Ut[b.status]]})]}),G("p",{className:"mt-1 text-[11px] text-muted-foreground",children:T}),pe("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[pe("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${o}`,children:[G("span",{className:w.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),G("span",{className:`${w.slot} font-medium text-[11px]`,"data-testid":`service-version-${o}`,children:u.kind==="text"?G("code",{className:"font-mono font-semibold",children:D}):D})]}),pe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${o}`,children:[G("span",{className:kn.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),G("span",{className:`${kn.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${o}`,children:G(Q,{value:b.latencyMs,unit:"ms",testId:`health-latency-value-${o}`})})]}),Ri(b.details).map(p=>{let E=kn[Br(p.value)];return pe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${o}-${p.key}`,children:[pe("span",{className:E.label,children:[p.label,":"]}),G("span",{className:`${E.slot} font-medium text-[11px]`,"data-testid":`health-detail-${o}-${p.key}`,children:Hr(p.value,`health-detail-value-${o}-${p.key}`)})]},p.key)})]})]}),pe("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[G("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${o}`,children:b.endpoint}),b.errorMessage!==void 0&&Xt.test(b.errorMessage)&&G("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Kt.error,"data-testid":`service-error-${o}`,children:b.errorMessage})]})]},o)})})]})}import{FILTERABLE_CONFIDENTIALITY_LEVELS as _i,SEARCH_FUSIONS as Ii,SEARCH_MODES as Ci,SEARCH_PARAM_LIMITS as Ne}from"@aiquants/enrichment-core";import{useEffect as ki,useId as Ti,useRef as pa,useState as be}from"react";import{Fragment as Bi,jsx as S,jsxs as tt}from"react/jsx-runtime";var wi=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Pi={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},ma="ALL",en={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Li="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",$i=(Ne.threshold.min+Ne.threshold.max)/2,Di=336,Ai=544;function Mi(e){let t=e.trim().length;return t<Ne.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Ne.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${Ne.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function Oi(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function qr(e,t){return t.trim().length>Ne.filterTextLength.max?`${e}\u306F ${Ne.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function Fi(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function Ui({params:e,answer:t}){let n=t.search_metadata,a=n.executed_tiers,s=r=>r?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${st[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${st[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${s(a.lexical)} / \u758E ${s(a.sparse)} / \u5BC6 ${s(a.dense)} / \u30B0\u30E9\u30D5 ${s(a.graph)}`,`\u878D\u5408: ${Fi(e)}`,`\u54C1\u8CEA: ${Vt[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${Gt[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${Gt[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
1
+ var Ct="\u975E\u8868\u793A (\u5217\u306E\u30B9\u30B3\u30FC\u30D7)",st={KEYWORD:{label:"\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL Server \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051\u3067\u63A2\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u306E\u610F\u5473\u306E\u30D9\u30AF\u30C8\u30EB\u3067\u63A2\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\u306E\u4E00\u81F4\u306E\u9806\u4F4D\u3092\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\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\u63A2\u3057\u307E\u3059\u3002\u6587\u66F8\u306E\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Ra={rrf:"RRF (\u9806\u4F4D\u306E\u9006\u6570\u306E\u548C)",linear:"\u7DDA\u5F62 (\u03B1 \u3067\u91CD\u307F\u4ED8\u3051)"},Vt={FULL:"\u5B8C\u5168",DEGRADED_LEXICAL_ONLY:"\u7E2E\u9000 (\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u8D70\u3089\u305A)",DEGRADED_PARTIAL:"\u7E2E\u9000 (\u4E00\u90E8\u306E\u5C64\u3060\u3051)"},Gt={CLOSED:"\u9589 (\u901A\u5E38)",OPEN:"\u958B (\u906E\u65AD\u4E2D)",HALF_OPEN:"\u534A\u958B (\u8A66\u3057\u306E 1 \u56DE)"},Ea={vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u306B\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u5931\u6557\u304C\u7D9A\u3044\u305F\u305F\u3081\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u306F\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u7D22\u5F15\u306E\u6226\u7565\u304C 1 \u3064\u3082\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u307E\u3060\u7121\u3044\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u7D42\u308F\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",row_scope_permits_no_rows:"\u8AAD\u3081\u308B\u6587\u66F8\u304C 1 \u3064\u3082\u7121\u3044\u6A29\u9650\u306E\u305F\u3081\u3001\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_tier_unavailable:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",graph_tier_unavailable:"\u30B0\u30E9\u30D5\u691C\u7D22\u306E\u57FA\u76E4\u306B\u5C4A\u304B\u306A\u3044\u304B\u3001\u57FA\u76E4\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002",vector_tier_timed_out:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",graph_tier_timed_out:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u671F\u9650\u307E\u3067\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002",tiers_not_executed:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u306E\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"};function sn(e){return Object.hasOwn(Ea,e)?Ea[e]:e}var kt=3;function _a(e){return e.kind==="cosine"?`${(e.value*100).toFixed(1)}% (\u30B3\u30B5\u30A4\u30F3)`:`${e.value.toFixed(kt)} (${e.kind==="bm25"?"BM25":"\u5BC6\u3068\u758E\u306E\u6DF7\u3056\u3063\u305F\u5024"})`}function Ia(e,t){let n=i=>{let o=new Map;return i.forEach((b,P)=>{o.has(b)||o.set(b,P+1)}),o},a=n(e),s=n(t),r=[...a.keys()].filter(i=>s.has(i)),l=new Set([...a.keys(),...s.keys()]).size;return{sharedCount:r.length,overlapRatio:l===0?null:r.length/l,meanAbsoluteRankDifference:r.length===0?null:r.reduce((i,o)=>i+Math.abs(a.get(o)-s.get(o)),0)/r.length}}function Dn(e){return`${e.metadata_id}:${e.chunk_index}`}import{AlertMessage as ls,Button as cs,Card as us,CardSection as ps,Cluster as ms,CodeBlock as fs,ComparisonGrid as ys,DataTable as gs,DescriptionList as bs,Disclosure as xs,LoadMore as hs,MasterDetail as vs,Measured as Ss,Meter as Ns,Notice as Es,Pill as Rs,ResourceFailed as _s,RowButton as Is,SegmentedControl as Cs,Select as ks,SelectableList as Ts,Slider as ws,Stack as Ps,Text as Ls,TextInput as $s,VisuallyHidden as Ds,useConsoleUi as As,useAnnounce as Ms,useFocusRescue as Os,usePagedResource as Fs,useResource as Us}from"@aiquants/console-ui";import{createElement as ce}from"react";var qt="ja-JP";function I(){let e=As();if(e.locale!=="ja"||e.formatLocale!==qt)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${qt}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function Q(e){return I(),ce(Ss,e)}function ka(e){return I(),ce(Is,e)}function on(e){return I(),ce(vs,e)}function dn(e){return I(),ce(ys,e)}function Ve(e){return I(),ce(Rs,e)}function ot(e){return I(),ce(us,e)}function he(e){return I(),ce(cs,e)}function Ge(e){return I(),ce(Es,e)}function qe(e){return I(),ce(ls,e)}function gt(e){return I(),ce(_s,e)}function ln(e){return I(),ce(hs,e)}function Ta(e){return I(),ce(Ds,e)}function Tt(e){return I(),ce(gs,e)}function cn(e){return I(),ce(Ts,e)}function An(e,t,n){return I(),Us(e,t,n)}function un(e,t,n){return I(),Fs(e,t,n)}function Je(e){return I(),Os(e)}function Mn(e){return I(),ce(ps,e)}function On(e){return I(),ce(fs,e)}function wt(e){return I(),ce(bs,e)}function pn(e){return I(),ce(xs,e)}function Fn(e){return I(),ce(Ns,e)}function mn(e){return I(),ce(Cs,e)}function zt(e){return I(),ce(ks,e)}function bt(e){return I(),ce(ws,e)}function Pe(e){return I(),ce(Ps,e)}function it(e){return I(),ce(ms,e)}function B(e){return I(),ce(Ls,e)}function xt(e){return I(),ce($s,e)}function Pt(){return I(),Ms()}import{jsx as Wt,jsxs as Ks}from"react/jsx-runtime";function wa({metadata:e,testId:t}){if(I(),!e.is_degraded)return null;let n=e.executed_tiers,a=st[e.requested_mode].label,s=Vt[e.quality_tier],l=!(n.lexical||n.dense||n.sparse||n.graph)?`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u307E\u3057\u305F\u304C\u3001\u8D70\u3063\u305F\u5C64\u306F\u3042\u308A\u307E\u305B\u3093 (\u54C1\u8CEA: ${s})\u3002`:`\u7E2E\u9000\u3057\u3066\u7B54\u3048\u3066\u3044\u307E\u3059: ${a} \u3092\u6C42\u3081\u3001${st[e.search_mode].label} \u3067\u7B54\u3048\u307E\u3057\u305F (\u54C1\u8CEA: ${s})\u3002`;return Wt(Ge,{tone:"warning",testId:t,children:Ks(Pe,{gap:"space-2",testId:`${t}-body`,children:[Wt(B,{as:"p",fg:"fg",type:"prose",testId:`${t}-summary`,children:l}),e.degradation_reasons.length>0&&Wt("ul",{"data-testid":`${t}-reasons`,children:e.degradation_reasons.map((i,o)=>Wt("li",{"data-reason":i,children:Wt(B,{fg:"fg",type:"prose",testId:`${t}-reason-${o}`,children:sn(i)})},`${o}-${i}`))})]})})}import{HTTP_FORBIDDEN as ao,mapOutcome as sr}from"@aiquants/console-ui/core";import{DOCUMENT_CHANGE_FEED_PAGE_SIZE as ro}from"@aiquants/enrichment-core";import{useRef as or}from"react";import{reasonAside as Bs}from"@aiquants/console-ui/core";var ht={classification:"\u5206\u985E",metadata:"\u30E1\u30BF\u30C7\u30FC\u30BF",labels:"\u30E9\u30D9\u30EB",tags:"\u30BF\u30B0",structured_data:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",text:"\u672C\u6587",summary:"\u8981\u7D04",chunks:"\u30C1\u30E3\u30F3\u30AF",assets:"\u6DFB\u4ED8"},Lt={RUN:"\u5B9F\u884C\u306E\u5F8C\u306E\u8A18\u9332",PRE_WRITE:"\u4E0A\u66F8\u304D\u306E\u524D\u306E\u8A18\u9332",MANUAL:"\u624B\u52D5\u306E\u8A18\u9332",BACKFILL:"\u8A18\u9332\u306E\u8D77\u70B9"},Un={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Pa={EXACT:"\u305D\u306E\u307E\u307E\u518D\u73FE",WHITESPACE_NORMALIZED:"\u7A7A\u767D\u3092\u7E4B\u304E\u76F4\u3057\u3066\u518D\u73FE",UNVERIFIED:"\u518D\u73FE\u3067\u304D\u306A\u3044"},La="\u30C1\u30E3\u30F3\u30AF\u306E\u672C\u6587\u306F\u3053\u306E\u533A\u9593\u306E\u6587\u3092\u7A7A\u767D\u3067\u7E4B\u304E\u76F4\u3057\u305F\u5F62\u3067\u3059\u3002",$a="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",Da="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",fn={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function Yt(e){return Object.hasOwn(fn,e)?fn[e]:e}var $t="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Aa="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",yn="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",Ma="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",Oa="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",Kn="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",Fa="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function Ua(e){return`\u3053\u306E\u5909\u5316\u306B\u306F\u8A18\u9332\u3055\u308C\u306A\u304B\u3063\u305F\u5B9F\u884C ${e.map(t=>`#${t}`).join("\u3001")} \u306E\u5909\u5316\u3082\u542B\u307E\u308C\u307E\u3059`}function Xe(e){return`r${e}`}function Bn(e,t){return e===t?`${Xe(t)} (\u540C\u3058\u7248)`:`${Xe(e)} \u2192 ${Xe(t)}`}function gn(e){let t=ht[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let a=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([s,r])=>s===null||s===0?[]:[`${r}${s}`]);return a.length===0?`${t} \u5909\u66F4`:`${t} ${a.join(" ")}`}function vt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var dt="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function bn(e,t,n){return e.failureSentence(t,dt,lt(n))}function lt(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${Bs(t)}\u3002`}import{RUN_TERMINAL_STEP_KEY as Ba}from"@aiquants/enrichment-core";var Ka=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function Ha(e){let t=e.states.flatMap(o=>o.kind==="readable"?[o.item]:[]),n=e.runs.flatMap(o=>o.kind==="readable"?[o.item]:[]),a=new Set(n.map(o=>o.id)),s=[...n.map(o=>({kind:"run",key:`run:${o.id}`,time:o.startedAt,run:o,state:t.find(b=>b.runId===o.id)??null})),...t.filter(o=>o.runId===null||!a.has(o.runId)).map(o=>({kind:"state",key:`state:${o.stateId}`,time:o.settledAt,state:o}))].sort(Ka),l=[...new Set([...e.revisions.map(o=>o.revision),...s.map(o=>o.kind==="run"?o.run.revision:o.state.revision)])].sort((o,b)=>b-o).map(o=>({revision:o,isCurrent:e.revisions.some(b=>b.revision===o&&b.isCurrent),items:s.filter(b=>(b.kind==="run"?b.run.revision:b.state.revision)===o)})),i=[...e.states.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:state:${b}`,time:o.settledAt,mark:o}]:[]),...e.runs.flatMap((o,b)=>o.kind==="restricted"?[{key:`restricted:run:${b}`,time:o.startedAt,mark:o}]:[])].sort(Ka);return{groups:l,marks:i,states:t,runs:n}}function Hn(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(n=>n.stepKey===Ba);return t===void 0||t.status==="FAILED"}function Va(e,t){let n=t.states.find(r=>r.stateId===e.previousStateId);if(n===void 0)return[];let a=Date.parse(n.settledAt),s=Date.parse(e.settledAt);return t.runs.filter(r=>{let l=Date.parse(r.startedAt);return r.status!=="RUNNING"&&r.id!==e.runId&&l>=a&&l<s&&!t.states.some(i=>i.runId===r.id)&&!r.steps.some(i=>i.stepKey===Ba&&i.status==="SUCCEEDED")}).map(r=>r.id)}function Ga(e,t){switch(e.kind){case"latest_state":{let n=t.states[0];return n===void 0?null:t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${n.stateId}`}case"run":return`run:${e.runId}`;case"state":{let n=t.states.find(a=>a.stateId===e.stateId);return n!==void 0&&t.runs.some(a=>a.id===n.runId)?`run:${n.runId}`:`state:${e.stateId}`}}}function qa(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}import{useState as Hs}from"react";function Dt(e){let[t,n]=Hs({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count}import{ceil8 as xn,monoTextWidthEm as Vn,TOKENS as Gn,textWidthEm as qn}from"@aiquants/console-ui/core";var ct=Gn.type.body.size,zn=Gn.space["space-3"],Vs=20,za=xn(ct*qn("\u3042".repeat(Vs))+2*zn),Wa=448,Gs=40,qs=2,zs="+ ",Ws=Gn.space["space-4"];function Ys(e){if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A line number is a non-negative safe integer: ${e}`);return String(e).length}function Ya(e){let n=Vn("0".repeat(Ys(e)+qs))+Vn(zs)+Vn("0".repeat(Gs));return xn(ct*2*n+Ws)}function St(e){return xn(ct*qn(e)+2*zn)}function Nt(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(St))}function hn(e){return xn(ct*qn(e)+4*zn)}var Xa="0000/00/00 00:00:00",Ue=St("\u3042".repeat(10));import{jsx as vn}from"react/jsx-runtime";var Xt=/[^\s\x1c-\x1f\x85\ufeff]/,Xs={fontVariantNumeric:"tabular-nums"},js={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function ja({text:e,testId:t,slot:n}){if(I(),e===null)return vn(Q,{value:null,testId:t});if(!Xt.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 vn("span",{"data-cui-migration":"pending","data-measured":"true","data-testid":t,style:n,children:e})}function jt({text:e,testId:t}){return vn(ja,{text:e,testId:t,slot:Xs})}function Ke({text:e,testId:t}){return vn(ja,{text:e,testId:t,slot:js})}import{DOCUMENT_KIND_LABELS as Js,isUnknownTerm as Ja,PIPELINE_STEPS as Qa,parseSkipReason as Qs,RUN_TERMINAL_STEP_KEY as Zs}from"@aiquants/enrichment-core";var rt={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"}},Wn={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"}},Yn={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},eo="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Jt(e){return Ja(e)?`\u77E5\u3089\u306A\u3044\u6BB5 (${e.raw})`:e===Zs?eo:Qa[e].label}function Za(e){return Ja(e)?`\u77E5\u3089\u306A\u3044\u7A2E\u985E (${e.raw})`:Js[e]}var er={RECORDED:"\u72B6\u614B\u3092\u8A18\u9332\u3057\u307E\u3057\u305F",UNCHANGED:"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093",ALREADY_RECORDED:"\u3053\u306E\u5B9F\u884C\u306E\u72B6\u614B\u306F\u8A18\u9332\u6E08\u307F\u3067\u3059"},tr="\u672A\u5B8C\u4E86";function ut(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var to={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)",covered_by_page_recognition:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u89AA\u306E\u7248\u9762\u306E\u8A8D\u8B58\u304C\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306E\u753B\u50CF)"};function nr(e){let t=Qs(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`${Qa[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return to[t.token];case"superseded":return"\u5B9F\u884C\u306E\u7248\u304C\u73FE\u5728\u306E\u7248\u3067\u306A\u304F\u306A\u3063\u305F";case"recording_disabled":return"\u8A18\u9332\u306E\u5207\u66FF\u304C\u7121\u52B9";case"recording_misconfigured":return"\u8A18\u9332\u306E\u5207\u66FF\u306E\u8A2D\u5B9A\u306E\u8AA4\u308A";case"not_protected":return"\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4ED8\u3044\u3066\u3044\u306A\u3044"}}import{formatInstant as no}from"@aiquants/console-ui/core";function ar(e,t){return no(e,qt,t)}import{jsx as rr}from"react/jsx-runtime";function fe({iso:e,testId:t}){let{timeZone:n}=I();return rr(Ke,{text:e===null?null:ar(e,n),testId:t})}function At({iso:e,testId:t}){return I(),e===null?tr:rr(fe,{iso:e,testId:t})}import{Fragment as ir,jsx as ze,jsxs as Xn}from"react/jsx-runtime";var so="document-changes";function ll({host:e,onOpen:t}){let{labels:n}=I(),a=or(null),s=or(null),r=un(so,{first:P=>e.loadChanges(null,P).then(T=>sr(T,u=>({rows:u.rows,next:u.next,meta:null}))),next:(P,T)=>e.loadChanges(P,T).then(u=>(!u.ok&&u.status===ao&&r.reload(),sr(u,w=>({rows:w.rows,next:w.next}))))},0),l=Je(()=>a.current),i=r.state.kind==="ready"?r.state.refreshFailure:null,o=Dt(i);return ze(ot,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:a,testId:"change-feed",children:(()=>{if(r.state.kind==="failed")return ze(gt,{failure:r.state,onReload:r.reload,forbiddenMessage:dt,failureMessage:lt("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:l,testId:"change-feed-failed"});if(r.state.kind!=="ready")return ze("p",{"aria-busy":"true","data-testid":"change-feed-loading",children:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:P}=r.state,T=P.rows.map((u,w)=>({row:u,position:w}));return Xn(ir,{children:[i!==null&&ze(qe,{occurrence:o,testId:"change-feed-refresh-failed",children:bn(n,i,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),ze(Tt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:St(Xa)},align:"start",cell:({row:u,position:w})=>ze(fe,{iso:u.kind==="readable"?u.item.settledAt:u.settledAt,testId:`change-feed-time-value-${w}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Ue},align:"start",cell:({row:u})=>u.kind==="readable"?Xn(ir,{children:[ze("span",{children:u.item.fileName})," ",ze("span",{children:u.item.fileUri})]}):ze("span",{"data-restricted-mark":"change",children:$t})},{key:"revision",header:"\u7248",width:{fixedPx:St("r00000 \u2192 r00000")},align:"start",cell:({row:u})=>u.kind==="readable"?Bn(u.item.previousRevision,u.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:Nt(Object.values(Lt))},align:"start",cell:({row:u})=>u.kind==="readable"?Lt[u.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Ue},align:"start",cell:({row:u})=>u.kind==="readable"?u.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Ue},align:"start",cell:({row:u,position:w})=>u.kind==="readable"?u.item.changes.map(D=>ze(Ve,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${w}-${D.facet}`,children:gn(D)},D.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:hn("\u958B\u304F")},align:"start",cell:({row:u})=>u.kind==="readable"?Xn(he,{variant:"secondary",onClick:()=>t(u.item.metadataId,u.item.stateId),testId:`change-feed-open-${u.item.stateId}`,children:["\u958B\u304F ",ze(Ta,{testId:`change-feed-open-name-${u.item.stateId}`,children:`${u.item.fileName} ${Bn(u.item.previousRevision,u.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:T,rowKey:({row:u,position:w})=>qa(u,w),rowTestId:"change-feed-row",rowData:({row:u})=>({"data-row-kind":u.kind}),rowSize:t===void 0?"row":"row-control",empty:"\u76F4\u8FD1\u306E\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"change-feed-table",ref:s}),ze(ln,{onLoad:r.loadMore,busy:P.loadingMore||r.state.refreshing,done:P.next===null,failure:P.moreFailure,limit:ro,rows:{count:T.length,ref:s},testId:"change-feed-more"})]})})()})}import{reasonAside as Zo,TOKENS as da}from"@aiquants/console-ui/core";import{useCallback as ei,useEffect as _n,useId as sa,useRef as Ze,useState as Ft}from"react";import{TOKENS as So}from"@aiquants/console-ui/core";import{DOCUMENT_FACETS as No}from"@aiquants/enrichment-core";import{useCallback as Eo,useEffect as Ro,useId as _o,useMemo as Io,useState as Co}from"react";import{useState as fo}from"react";import{mapOutcome as dr}from"@aiquants/console-ui/core";import{DIFF_LINE_PAGE_MAX as jn}from"@aiquants/enrichment-core";import{useCallback as cr,useEffect as Qn,useId as oo,useRef as ur,useState as Sn}from"react";import{Fragment as yr,jsx as A,jsxs as Re}from"react/jsx-runtime";var Zn="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",pr={context:"",removed:"\u2212",added:"+"},mr={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function Jn(e){let t=e.newLines>0?e.newStart:e.oldStart,n=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${n} +${e.linesAdded} \u2212${e.linesRemoved}`}function io(e){return e.reduce((t,n)=>Math.max(t,n.oldStart+n.oldLines-1,n.newStart+n.newLines-1),0)}function lo(e){return e.reduce((t,{line:n})=>Math.max(t,n.oldNumber??0,n.newNumber??0),0)}function co(e){let t=[],n=0;for(let a=1;a<=e.length;a++)(a===e.length||e[a].page!==e[n].page)&&(t.push(...uo(e.slice(n,a).map(({line:s})=>s))),n=a);return t}function uo(e){let t=[],n=[],a=[],s=()=>{for(let r=0;r<Math.max(n.length,a.length);r++)t.push({left:n[r]??null,right:a[r]??null});n=[],a=[]};for(let r of e)r.kind==="context"?(s(),t.push({left:r,right:r})):r.kind==="removed"?(a.length>0&&s(),n.push(r)):a.push(r);return s(),t}function fr(e){return e.segments.map((t,n)=>{let a=`${n}`;return t.kind==="removed"?A("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},a):t.kind==="added"?A("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},a):A("span",{children:t.text},a)})}function lr(e,t){return Re(yr,{children:[A("td",{"data-line-number":t,children:e===null?"":t==="old"?e.oldNumber:e.newNumber}),A("td",{"data-line-sign":!0,children:e===null?"":pr[e.kind]}),A("td",{style:mr,"data-line-text":t,children:e===null?null:fr(e)})]})}function po({states:e,target:t,hunk:n,layout:a,tableLabel:s,readLines:r,rescueTarget:l,onLines:i,testId:o}){let b={...e,...t,hunk:n},P=JSON.stringify([e.fromStateId,e.toStateId,t,n]),T=un(P,{first:x=>r({...b,offset:0,limit:jn},x).then(L=>dr(L,W=>({rows:W.lines.map(ee=>({line:ee,page:0})),next:W.next,meta:null}))),next:(x,L)=>r({...b,offset:x,limit:jn},L).then(W=>dr(W,ee=>({rows:ee.lines.map(ie=>({line:ie,page:x})),next:ee.next})))},0),u=Je(l),w=ur(null),D=T.state.kind==="ready"?T.state.value.rows:null;if(Qn(()=>{D!==null&&i(lo(D))},[D,i]),T.state.kind==="failed")return A(gt,{failure:T.state,onReload:T.reload,forbiddenMessage:dt,failureMessage:lt("\u5DEE\u5206\u306E\u884C"),rescueRef:u,testId:`${o}-failed`});if(T.state.kind!=="ready")return A("p",{"aria-busy":"true","data-testid":`${o}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:p}=T.state,R=a==="split"?co(p.rows):null;return Re("div",{"data-testid":o,"data-layout":a,children:[Re("table",{"aria-label":s,"data-testid":`${o}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[A("thead",{children:a==="split"?Re("tr",{children:[A("th",{scope:"col",children:"\u65E7"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u53E4\u3044\u672C\u6587"}),A("th",{scope:"col",children:"\u65B0"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u65B0\u3057\u3044\u672C\u6587"})]}):Re("tr",{children:[A("th",{scope:"col",children:"\u65E7"}),A("th",{scope:"col",children:"\u65B0"}),A("th",{scope:"col",children:"\u7B26\u53F7"}),A("th",{scope:"col",children:"\u672C\u6587"})]})}),A("tbody",{ref:w,children:R===null?p.rows.map(({line:x},L)=>Re("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":x.kind,children:[A("td",{"data-line-number":"old",children:x.oldNumber}),A("td",{"data-line-number":"new",children:x.newNumber}),A("td",{"data-line-sign":!0,children:pr[x.kind]}),A("td",{style:mr,"data-line-text":"unified",children:fr(x)})]},L)):R.map(x=>Re("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":x.left===x.right?"context":"changed",children:[lr(x.left,"old"),lr(x.right,"new")]},`${x.left?.oldNumber??""}:${x.right?.newNumber??""}`))})]}),A(ln,{onLoad:T.loadMore,busy:p.loadingMore||T.state.refreshing,done:p.next===null,failure:p.moreFailure,limit:jn,rows:{count:R===null?p.rows.length:R.length,ref:w},testId:`${o}-more`})]})}function mo(){let[e,t]=Sn(null);return[cr((a=>{let s=new ResizeObserver(r=>{for(let l of r)t(l.contentRect.width)});return s.observe(a),()=>s.disconnect()}),[]),e]}function Nn({states:e,target:t,index:n,readLines:a,label:s,rescueTarget:r,onNarrowChange:l,testId:i}){I();let o=oo(),[b,P]=Sn("split"),[T,u]=Sn(()=>new Set(n===null?[0]:[])),[w,D]=Sn(0),[p,R]=mo(),x=ur(new Map),L=cr(_=>D(te=>Math.max(te,_)),[]),W=Ya(Math.max(n===null?0:io(n.hunks),w)),ee=R!==null&&R>=W,ie=b==="split"&&ee?"split":"unified",ne=b==="split"&&R!==null&&!ee;Qn(()=>{l(o,ne)},[o,ne,l]),Qn(()=>()=>l(o,!1),[o,l]);let q=(_,te)=>u(Y=>{let Ie=new Set(Y);return te?Ie.add(_):Ie.delete(_),Ie}),se=_=>`${o}-hunk-${_}`,xe=(_,te)=>A(po,{states:e,target:t,hunk:_,layout:ie,tableLabel:te,readLines:a,rescueTarget:()=>x.current.get(_)??r(),onLines:L,testId:`${i}-hunk-${_}-body`});return Re("div",{"data-cui-migration":"pending",ref:p,"data-testid":i,"data-layout":ie,"data-split-min-px":W,children:[n!==null&&Re(yr,{children:[Re("dl",{"data-testid":`${i}-stats`,children:[Re("div",{children:[A("dt",{children:"\u8FFD\u52A0\u3057\u305F\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesAdded,testId:`${i}-lines-added`})})]}),Re("div",{children:[A("dt",{children:"\u524A\u9664\u3057\u305F\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesRemoved,testId:`${i}-lines-removed`})})]}),Re("div",{children:[A("dt",{children:"\u5909\u308F\u3089\u306A\u3044\u884C"}),A("dd",{children:A(Q,{value:n.stats.linesUnchanged,testId:`${i}-lines-unchanged`})})]}),Re("div",{children:[A("dt",{children:"\u8FFD\u52A0\u3057\u305F\u5B57"}),A("dd",{children:A(Q,{value:n.stats.charsAdded,testId:`${i}-chars-added`})})]}),Re("div",{children:[A("dt",{children:"\u524A\u9664\u3057\u305F\u5B57"}),A("dd",{children:A(Q,{value:n.stats.charsRemoved,testId:`${i}-chars-removed`})})]}),Re("div",{children:[A("dt",{children:"\u985E\u4F3C\u5EA6"}),A("dd",{children:A(Ke,{text:n.stats.similarity===null?null:`${(n.stats.similarity*100).toFixed(1)}%`,testId:`${i}-similarity`})})]})]}),n.attributes.length>0&&A("ul",{"data-testid":`${i}-attributes`,children:n.attributes.map(_=>Re("li",{"data-field":_.field,children:[Yt(_.field)," ",vt(_.before)," \u2192 ",vt(_.after)]},_.field))}),n.hunks.length>0&&A("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${i}-hunk-index`,children:n.hunks.map(_=>A("li",{children:A("a",{href:`#${se(_.hunk)}`,onClick:()=>q(_.hunk,!0),"data-hunk":_.hunk,children:Jn(_)})},_.hunk))})]}),A(he,{variant:"secondary",onClick:()=>P(b==="split"?"unified":"split"),dataAttributes:{"data-preferred":b},testId:`${i}-layout-toggle`,children:b==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),ne&&A("p",{"data-testid":`${i}-narrow`,children:Zn}),n===null?xe(0,s):n.hunks.map(_=>{let te=T.has(_.hunk);return Re("div",{id:se(_.hunk),"data-testid":`${i}-hunk-${_.hunk}`,"data-open":te,children:[A(he,{variant:"secondary",expanded:te,controls:`${se(_.hunk)}-body`,onClick:()=>q(_.hunk,!te),ref:Y=>{Y===null?x.current.delete(_.hunk):x.current.set(_.hunk,Y)},testId:`${i}-hunk-${_.hunk}-toggle`,children:Jn(_)}),A("div",{id:`${se(_.hunk)}-body`,children:te&&xe(_.hunk,`${s} ${Jn(_)}`)})]},_.hunk)})]})}import{Fragment as go,jsx as Mt,jsxs as En}from"react/jsx-runtime";function yo(e){let t=[e.page===null?null:`p.${e.page}`,e.sheet===null?null:`\u30B7\u30FC\u30C8 ${e.sheet}`,e.slide===null?null:`\u30B9\u30E9\u30A4\u30C9 ${e.slide}`,e.startSec===null?null:`${e.startSec}${e.endSec===null?"":`\u2013${e.endSec}`} \u79D2`].filter(n=>n!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function gr(e){return e.new??e.old}function br(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function xr({states:e,stats:t,entries:n,textUnchangedChunkingChanged:a,readLines:s,rescueTarget:r,onNarrowChange:l,testId:i}){I();let[o,b]=fo(()=>new Set),P=u=>b(w=>{let D=new Set(w);return D.delete(u)||D.add(u),D}),T=u=>{let w=[u.old===null?null:["\u65E7",u.old],u.new===null?null:["\u65B0",u.new]].filter(p=>p!==null),D=new Set(w.flatMap(([,p])=>p.fidelity==="UNVERIFIED"?[$a]:p.fidelity==="WHITESPACE_NORMALIZED"?[La]:[]));return En(go,{children:[w.map(([p,R])=>En("span",{"data-fidelity":R.fidelity,"data-side":p,children:[p," ",Pa[R.fidelity]," "]},p)),[...D].map(p=>Mt("span",{"data-chunk-note":!0,children:p},p))]})};return En("div",{"data-testid":i,children:[a&&Mt(Ge,{tone:"info",testId:`${i}-chunking-only`,children:Da}),En("p",{"data-testid":`${i}-stats`,children:["\u8FFD\u52A0 ",t.added,"\u30FB\u524A\u9664 ",t.removed,"\u30FB\u5909\u66F4 ",t.modified,"\u30FB\u79FB\u52D5 ",t.moved,"\u30FB\u5909\u308F\u3089\u306A\u3044 ",t.unchanged]}),Mt(Tt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:Nt(Object.values(Un))},align:"start",cell:u=>Un[u.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Ue},align:"start",cell:u=>yo(gr(u))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Ue},align:"start",cell:u=>gr(u).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:St("#00000 \u2192 #00000")},align:"start",cell:u=>`${u.old===null?"(\u306A\u3057)":`#${u.old.index}`} \u2192 ${u.new===null?"(\u306A\u3057)":`#${u.new.index}`}`},{key:"fidelity",header:"\u672C\u6587\u306E\u518D\u73FE",width:{minPx:Ue},align:"start",cell:T},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:hn("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:u=>br(u)?Mt(he,{variant:"secondary",expanded:o.has(u.entry),controls:`${i}-diff-${u.entry}`,onClick:()=>P(u.entry),testId:`${i}-diff-toggle-${u.entry}`,children:o.has(u.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:n,rowKey:u=>`${u.entry}`,rowTestId:`${i}-row`,rowData:u=>({"data-entry":u.entry,"data-kind":u.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${i}-table`}),n.filter(u=>br(u)&&o.has(u.entry)).map(u=>{let w=`\u30C1\u30E3\u30F3\u30AF #${u.old?.index} \u2192 #${u.new?.index} \u306E\u5DEE\u5206`;return Mt("section",{id:`${i}-diff-${u.entry}`,"aria-label":w,"data-testid":`${i}-diff-${u.entry}`,children:Mt(Nn,{states:e,target:{facet:"chunks",entry:u.entry},index:null,readLines:s,label:w,rescueTarget:r,onNarrowChange:l,testId:`${i}-diff-${u.entry}-view`})},u.entry)})]})}import{compareTreePaths as bo,treePathLabel as xo}from"@aiquants/enrichment-core";import{useMemo as ho}from"react";import{jsx as hr}from"react/jsx-runtime";function vo(e){let t=new Set;for(let{path:n}of e){if(t.has(n))throw new RangeError(`A tree path list holds the path ${JSON.stringify(n)} more than once.`);t.add(n)}return e.map(({path:n,item:a})=>({path:n,label:xo(n),item:a})).sort((n,a)=>bo(n.path,a.path))}function Rn({items:e,renderItem:t,testId:n}){I();let a=ho(()=>vo(e),[e]);return hr("ol",{role:"list","data-testid":n,children:a.map(({path:s,label:r,item:l})=>hr("li",{"data-testid":`${n}-item-${s}`,children:t(l,r,s)},s))})}import{Fragment as na,jsx as De,jsxs as Qe}from"react/jsx-runtime";var ko={fontSize:`${ct}px`,fontWeight:So.weight.bold},vr={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},Sr={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},To=Nt(Object.values(fn));function wo(e,t,n){let a=s=>Object.fromEntries(t.map(r=>[r.field,l=>De("span",{"data-testid":`${n}-${r.field}-${s}-${l}`,children:vt(r[s])})]));return De(dn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(s=>({key:s.field,label:Yt(s.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:a("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:a("after")}],attributePx:To,columnMinPx:Ue,testId:n})}function Qt(e,t,n){return t.length===0?null:Qe("div",{"data-testid":n,children:[Qe("p",{children:[e," (",t.length,")"]}),De("ul",{children:t.map(([a,s])=>De("li",{children:s},a))})]})}function ea(e,t,n){return t.length===0?null:Qe("div",{"data-testid":n,children:[Qe("p",{children:[e," (",t.length,")"]}),De(Rn,{items:t,renderItem:(a,s)=>`${s}: ${a}`,testId:`${n}-tree`})]})}var ta=e=>JSON.stringify(e.value),Er=e=>e.fields.map(t=>`${Yt(t.field)} ${vt(t.before)} \u2192 ${vt(t.after)}`).join("\u3001"),Nr=e=>[e.key,`${e.key}: ${ta(e)}`],Po=e=>[e.key,`${e.key}: ${Er(e)}`];function Lo({diff:e,testId:t}){let n=Io(()=>({added:e.added.map(a=>({path:a.key,item:ta(a)})),removed:e.removed.map(a=>({path:a.key,item:ta(a)})),modified:e.modified.map(a=>({path:a.key,item:Er(a)}))}),[e]);return Qe(na,{children:[ea("\u8FFD\u52A0",n.added,`${t}-added`),ea("\u524A\u9664",n.removed,`${t}-removed`),ea("\u5909\u66F4",n.modified,`${t}-modified`)]})}function Rr({states:e,comparison:t,readLines:n,rescueTarget:a,testId:s}){let{announce:r}=I(),l=_o(),[i,o]=Co(()=>new Set),b=Eo((p,R)=>o(x=>{if(x.has(p)===R)return x;let L=new Set(x);return R?L.add(p):L.delete(p),L}),[]),P=i.size>0;Ro(()=>{P&&r(Zn)},[P,r]);let T=t.facets.filter(p=>p.change==="CHANGED"),u=No.filter(p=>!T.some(R=>R.facet===p)),w=p=>`${l}-${p}`,D=p=>{let R=`${s}-${p.facet}`;switch(p.facet){case"classification":case"metadata":return wo(ht[p.facet],p.fields,`${R}-grid`);case"labels":return Qe(na,{children:[Qt("\u8FFD\u52A0",p.added.map(Nr),`${R}-added`),Qt("\u524A\u9664",p.removed.map(Nr),`${R}-removed`),Qt("\u5909\u66F4",p.modified.map(Po),`${R}-modified`)]});case"assets":return De(Lo,{diff:p,testId:R});case"tags":return Qe(na,{children:[Qt("\u8FFD\u52A0",p.added.map(x=>[x,x]),`${R}-added`),Qt("\u524A\u9664",p.removed.map(x=>[x,x]),`${R}-removed`)]});case"structured_data":return De(Tt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:Nt(Object.values(Sr))},align:"start",cell:({operation:x})=>Sr[x.op]},{key:"path",header:"\u9053",width:{minPx:Ue},align:"start",cell:({operation:x})=>x.path===""?"(\u6839)":x.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Ue},align:"start",cell:({operation:x})=>x.op==="add"?null:De("pre",{style:vr,children:JSON.stringify(x.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Ue},align:"start",cell:({operation:x})=>x.op==="remove"?null:De("pre",{style:vr,children:JSON.stringify(x.value,null,2)})}],rows:p.operations.map((x,L)=>({operation:x,position:L})),rowKey:({position:x})=>`${x}`,rowTestId:`${R}-operation`,rowData:({operation:x})=>({"data-op":x.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${R}-operations`});case"text":case"summary":return De(Nn,{states:e,target:{facet:p.facet},index:p,readLines:n,label:ht[p.facet],rescueTarget:a,onNarrowChange:b,testId:`${R}-diff`});case"chunks":return De(xr,{states:e,stats:p.stats,entries:p.entries,textUnchangedChunkingChanged:p.textUnchangedChunkingChanged,readLines:n,rescueTarget:a,onNarrowChange:b,testId:`${R}-table`})}};return Qe("div",{"data-cui-migration":"pending","data-testid":s,children:[T.length>0&&De("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${s}-nav`,children:De("ul",{children:T.map(p=>De("li",{children:De("a",{href:`#${w(p.facet)}`,"data-facet":p.facet,children:ht[p.facet]})},p.facet))})}),T.map(p=>Qe("section",{id:w(p.facet),"aria-labelledby":`${w(p.facet)}-heading`,"data-testid":`${s}-${p.facet}`,"data-facet":p.facet,children:[De("h4",{id:`${w(p.facet)}-heading`,style:ko,children:ht[p.facet]}),D(p)]},p.facet)),u.length>0&&Qe("p",{"data-testid":`${s}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",u.map(p=>ht[p]).join("\u30FB")]})]})}import{isUnknownTerm as $o,PIPELINE_STEPS as Do,RUN_TERMINAL_STEP_KEY as _r,RunTerminalStepDetailSchema as Ao,storedTermText as Mo}from"@aiquants/enrichment-core";import{useMemo as Oo}from"react";import{Fragment as ra,jsx as j,jsxs as _e}from"react/jsx-runtime";var Fo=8,Uo={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Ko={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"},Ir={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Bo=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],Ho=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Vo="\u6728\u306E\u9053\u3092\u6301\u305F\u306A\u3044\u8A18\u9332 (\u79FB\u884C\u306E\u9014\u4E2D)",Go={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Cr(e){return Object.hasOwn(Ir,e)}function Zt(e,t){return`run-step-provenance-value-${e}-${t}`}function qo(e,t,n){if(Cr(t)){let s=e[t];return s===null?null:j(Q,{value:s,unit:Ir[t],testId:Zt(n,t)})}let a=e[t];return a===null?null:j(jt,{text:String(a),testId:Zt(n,t)})}function zo(e,t){let n=Bo.map(r=>({key:r,label:Ko[r],value:qo(e,r,t),breaks:Cr(r)?"atomic":"anywhere"})),a=e.pages_read!==null||e.pages_total!==null,s=_e(ra,{children:[j(Q,{value:e.pages_read,testId:Zt(t,"pages_read")})," / ",j(Q,{value:e.pages_total,testId:Zt(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:a?s:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:j(jt,{text:Uo[e.body_source],testId:Zt(t,"body_source")}),breaks:"anywhere"}]}function Wo(e,t){let n=new Map,a=[];for(let r of t){if(r.targetTreePath===null){a.push(r);continue}let l=n.get(r.targetTreePath);l===void 0?n.set(r.targetTreePath,[r]):l.push(r)}let s=Array.from(n,([r,l])=>({path:r,item:l}));return{kind:"fan_out",stepKey:e,steps:t,placed:s,pathless:a}}function Yo(e){let t=[],n=new Map;for(let a of[...e.steps].sort((s,r)=>s.sequence-r.sequence)){let s=a.stepKey;if(s===_r||$o(s)||Do[s].fanOut!=="children"||a.targetMetadataId===e.metadataId){t.push({kind:"step",step:a});continue}let r=n.get(s);if(r!==void 0){r.push(a);continue}let l=[a];n.set(s,l),t.push({kind:"fan_out",stepKey:s,steps:l})}return t.map(a=>a.kind==="step"?a:Wo(a.stepKey,a.steps))}function Xo(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 jo({step:e}){let{labels:t}=I();if(e.status==="SKIPPED")return _e("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",nr(Xo(e))]});if(e.stepKey===_r&&e.status==="SUCCEEDED"){let{outcome:l}=Ao.parse(e.provenance?.detail);return j("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":l,children:er[l]})}if(e.provenance===null)return j("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 n=e.provenance,a=zo(n,e.sequence),s=a.filter(l=>l.value!==null),r=a.filter(l=>l.value===null);return _e(ra,{children:[s.length>0&&j("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:s.map(l=>_e("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[j("dt",{className:"text-slate-500",children:l.label}),j("dd",{className:`text-slate-800 ${Go[l.breaks]}`,"data-provenance-key":l.key,children:l.value})]},l.key))}),r.length>0&&_e("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",r.map(l=>l.label).join("\u3001")]}),Object.keys(n.detail).length>0&&_e("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[j("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),j("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function aa(e,t,n,a,s){let r=Wn[e.status],l=s==="tree"?"div":"li",i=s==="alert"?{"data-cui-surface":"surface","data-cui-fg":"fg"}:void 0;return j(l,{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":Mo(e.stepKey),...i,children:_e("details",{open:a,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[_e("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[j("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),j("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&_e("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]}),j("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),j("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:j(Q,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),_e("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&j("div",{className:"h-2 rounded-full bg-slate-100",children:j("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&_e("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})`]}),j(jo,{step:e})]})]})},e.id)}var Jo=`${Vo}: \u6728\u306E\u4E2D\u306E\u5834\u6240\u3092\u793A\u305B\u306A\u3044\u305F\u3081\u3001\u6BB5\u306E\u8A18\u9332\u306E ID \u3068\u5BFE\u8C61\u306E ID (#<\u6BB5\u306E\u8A18\u9332> \u2192 #<\u5BFE\u8C61>) \u3067\u540D\u6307\u3057\u307E\u3059\u3002`;function Qo({steps:e,longestDuration:t,opensEverything:n,testId:a}){let s=Dt(e);return j(qe,{occurrence:s,testId:a,children:_e("div",{className:"space-y-3",children:[j("p",{"data-testid":`${a}-reason`,children:Jo}),j("ol",{role:"list","data-testid":`${a}-list`,children:e.map(r=>aa(r,j("span",{"data-testid":`run-step-target-${r.sequence}`,children:`#${r.id} \u2192 #${r.targetMetadataId}`}),t,r.status==="FAILED"||n,"alert"))})]})})}function kr({run:e}){I();let t=e.steps.reduce((s,r)=>r.durationMs===null?s:Math.max(s,r.durationMs),0),n=e.steps.length<=Fo,a=Oo(()=>Yo(e),[e]);return j("ol",{"data-cui-migration":"pending",className:"space-y-3","data-testid":"run-steps",children:a.map(s=>{if(s.kind==="step"){let i=s.step,o=_e(ra,{children:[Jt(i.stepKey),i.targetMetadataId!==e.metadataId&&_e("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-${i.sequence}`,children:["\u5BFE\u8C61 #",i.targetMetadataId]})]});return aa(i,o,t,i.status==="FAILED"||n,"timeline")}let r=s.steps.some(i=>i.status==="FAILED"),l=Ho.map(i=>({status:i,count:s.steps.filter(o=>o.status===i).length})).filter(({count:i})=>i>0);return j("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${s.stepKey}`,"data-count":s.steps.length,children:_e("details",{open:r||s.pathless.length>0||n,className:"group/fanout","data-testid":`run-step-group-card-${s.stepKey}`,children:[_e("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[j("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),j("span",{className:"font-semibold text-[13px] text-slate-900",children:Jt(s.stepKey)}),_e("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${s.stepKey}`,children:["\u5BFE\u8C61 ",s.steps.length," \u4EF6"]}),j("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${s.stepKey}`,children:l.map(({status:i,count:o})=>`${Wn[i].label} ${o}`).join(" \xB7 ")})]}),_e("div",{className:"space-y-3 px-4 pb-4 [&_li+li]:mt-3 [&_li>div+div]:mt-3",children:[s.pathless.length>0&&j(Qo,{steps:s.pathless,longestDuration:t,opensEverything:n,testId:`run-step-group-pathless-${s.stepKey}`}),s.placed.length>0&&j(Rn,{items:s.placed,renderItem:(i,o)=>i.map(b=>aa(b,j("span",{"data-testid":`run-step-target-${b.sequence}`,children:`${o} (#${b.targetMetadataId})`}),t,b.status==="FAILED"||n,"tree")),testId:`run-step-tree-${s.steps[0].sequence}`})]})]})},`group-${s.stepKey}`)})})}import{Fragment as Ot,jsx as g,jsxs as V}from"react/jsx-runtime";var ti={fontSize:`${da.type.title.size}px`,fontWeight:da.weight.bold},ni={fontSize:`${ct}px`,fontWeight:da.weight.bold},oa={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function Tr({host:e,fromStateId:t,toStateId:n,rescueTarget:a}){let s={fromStateId:t,toStateId:n},r=An(`${t}:${n}`,i=>e.compare(s,i),0),l=Je(a);return r.state.kind==="failed"?g(gt,{failure:r.state,onReload:r.reload,forbiddenMessage:dt,failureMessage:lt("\u6BD4\u8F03"),rescueRef:l,testId:"history-comparison-failed"}):r.state.kind!=="ready"?g("p",{"aria-busy":"true","data-testid":"history-comparison-loading",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):g(Rr,{states:s,comparison:r.state.value,readLines:e.readLines,rescueTarget:a,testId:"history-change"})}function ia(e,t,n){let a=Va(e,t);return[e.runOutcome==="FAILED"?g("span",{"data-testid":`${n}-failed-run`,"data-state-mark":"failed_run",children:Oa},"failed"):null,a.length>0?g("span",{"data-testid":`${n}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:Ua(a)},"unrecorded"):null,e.modelOnlyChange?g("span",{"data-testid":`${n}-model-only`,"data-state-mark":"model_only",children:Fa},"model"):null].filter(s=>s!==null)}function ai(e,t){return e.changes===null?null:g("span",{"data-testid":`${t}-badges`,children:e.changes.map(n=>g(Ve,{tone:"neutral",variant:"tint",testId:`${t}-badge-${n.facet}`,children:gn(n)},n.facet))})}function ri({pinned:e,shown:t,onPin:n,onUnpin:a,fallback:s}){let r=Ze(null),l=Ze(null),i=Je(()=>l.current??r.current??s()),o=ei(T=>(u=>{T.current=u;let w=i(u);return()=>{T.current=null,w()}}),[i]),[b]=Ft(()=>o(r)),[P]=Ft(()=>o(l));return e!==null?V("p",{"data-testid":"history-pin",children:[g(Ve,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",Xe(e.revision)," ",g(fe,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",g(he,{variant:"secondary",onClick:a,ref:P,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:g("p",{"data-testid":"history-pin",children:g(he,{variant:"secondary",onClick:()=>n(t.stateId),ref:b,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function cc({host:e,metadataId:t,target:n,openRequest:a,onClose:s,returnFocusFallback:r,captureState:l}){let{labels:i,announce:o}=I(),b=sa(),P=sa(),T=sa(),u=Ze(null),w=Ze(null),D=Ze(null),p=Ze(null),R=Ze(null),x=Ze(null),L=Ze(r),W=Ze(0),[ee,ie]=Ft(null),[ne,q]=Ft(null),[se,xe]=Ft({metadataId:t,groups:{}});se.metadataId!==t&&xe({metadataId:t,groups:{}});let[_,te]=Ft(null),Y=An(t,y=>e.loadHistory(t,y),a),Ie=Je(()=>w.current),Ye=Je(()=>w.current),$e=Y.state.kind==="ready"?Y.state.refreshFailure:null,Ce=Dt($e),ke=Y.state.kind==="ready"&&Y.state.refreshing,oe=Y.state.kind==="ready"?Y.state.value:null,E=oe===null?null:Ha(oe),X=ee!==null&&ee.request===a?ee.key:E===null?null:Ga(n,E),M=E?.groups.flatMap(y=>y.items).find(y=>y.key===X),ae=M===void 0||ke?null:`revision:${M.kind==="run"?M.run.revision:M.state.revision}`,ge=Je(()=>X===null?w.current:D.current);_n(()=>{L.current=r},[r]),_n(()=>{if(R.current!==a){R.current=a,x.current=null;let y=document.activeElement;u.current?.contains(y)!==!0&&(p.current=(y instanceof HTMLElement||y instanceof SVGElement)&&y!==document.body?y:null),w.current?.focus();return}X!==null&&X===x.current&&(x.current=null,D.current?.focus())},[a,X]),_n(()=>{ae!==null&&xe(y=>y.groups[ae]===!0?y:{metadataId:y.metadataId,groups:{...y.groups,[ae]:!0}})},[ae,a]),_n(()=>()=>{R.current=null,W.current+=1;let y=p.current;if(y?.isConnected){y.focus();return}L.current()?.focus()},[]);let re=y=>{y.key==="Escape"&&(y.stopPropagation(),s())},Me=y=>{if(y===X){D.current?.focus();return}x.current=y,ie({request:a,key:y})},m=y=>{W.current+=1;let k=W.current,$=_?.metadataId===t?_.failure:null;te({metadataId:t,busy:!0,failure:$}),y(t).then(z=>{if(W.current===k){if(z.ok){te({metadataId:t,busy:!1,failure:null}),o(z.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),Y.refresh();return}te({metadataId:t,busy:!1,failure:{status:z.status,reason:z.reason,occurrence:($?.occurrence??0)+1}})}})},O=()=>{if(Y.state.kind==="failed")return g(gt,{failure:Y.state,onReload:Y.reload,forbiddenMessage:dt,failureMessage:lt("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:Ie,testId:"history-failed"});if(oe===null||E===null)return g("p",{"aria-busy":"true","data-testid":"history-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let y=E.states,k=E.runs[0],$=l!==void 0&&k!==void 0&&!y.some(U=>U.runId===k.id),z=_?.metadataId===t?_:null,ue=y[0];return V("div",{ref:Ye,"data-testid":"history-content",children:[V("dl",{"data-testid":"history-document",children:[V("div",{children:[g("dt",{children:"URI"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-document-uri",children:oe.document.fileUri})]}),V("div",{children:[g("dt",{children:"\u73FE\u5728\u306E\u7248"}),g("dd",{"data-testid":"history-document-revision",children:Xe(oe.document.revision)})]}),V("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-document-confidentiality",children:oe.document.confidentialityLevel})]}),V("div",{children:[g("dt",{children:"\u7248\u306E\u6570"}),g("dd",{"data-testid":"history-document-revisions",children:E.groups.length})]}),V("div",{children:[g("dt",{children:"\u6700\u5F8C\u306E\u5909\u5316"}),g("dd",{"data-testid":"history-document-last-change",children:ue===void 0?"\u8A18\u9332\u306A\u3057":g(fe,{iso:ue.settledAt,testId:"history-document-last-change-value"})})]})]}),$e!==null&&g(qe,{occurrence:Ce,testId:"history-refresh-failed",children:bn(i,$e,"\u6587\u66F8\u306E\u5C65\u6B74")}),$&&g("p",{"data-testid":"history-capture",children:g(he,{variant:"primary",busy:z?.busy===!0,busyLabel:i.loading,onClick:()=>m(l),ref:ge,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),z!==null&&z.failure!==null&&g(qe,{occurrence:z.failure.occurrence,testId:"history-capture-failed",children:i.failureSentence(z.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",U=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${Zo(U)}\u3002`)}),y.length===0&&E.runs.length===0&&E.marks.length===0?g("p",{role:"status","data-testid":"history-empty",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):g(on,{master:Oe(E),detail:Fe(E),masterMinPx:za,detailMinPx:Wa,testId:"history-master-detail"})]})},de=se.groups,le=(y,k)=>de[y]??k,Te=(y,k)=>xe({metadataId:t,groups:{...de,[y]:!le(y,k)}}),Be=ne!==null&&ne.request===a?ne.stateId:null,Oe=y=>V("div",{"data-testid":"history-timeline",children:[y.marks.length>0&&V("div",{"data-testid":"history-restricted-group",children:[V(he,{variant:"secondary",expanded:le("restricted",!1),controls:`${P}-restricted`,onClick:()=>Te("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",y.marks.length," \u4EF6)"]}),g("ul",{role:"list",id:`${P}-restricted`,hidden:!le("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:y.marks.map(({key:k,mark:$})=>g("li",{"data-restricted-mark":$.subject,"data-testid":"history-restricted-mark",children:$.subject==="state"?V(Ot,{children:[g("span",{children:Aa})," ",g(fe,{iso:$.settledAt,testId:`history-${k}-settled-at-value`})]}):V(Ot,{children:[g("span",{children:yn})," ",g(Ve,{tone:oa[$.status],variant:"tint",testId:`history-${k}-status`,children:rt[$.status].label})," ",g(fe,{iso:$.startedAt,testId:`history-${k}-started-at-value`})," \u301C ",g(At,{iso:$.finishedAt,testId:`history-${k}-finished-at-value`})]})},k))})]}),y.groups.map(k=>{let $=`revision:${k.revision}`,z=le($,k.isCurrent),ue=`${Xe(k.revision)}${k.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return V("div",{"data-testid":"history-revision-group","data-revision":k.revision,"data-current":k.isCurrent,children:[g(he,{variant:"secondary",expanded:z,controls:`${P}-${$}`,onClick:()=>Te($,k.isCurrent),testId:`history-revision-toggle-${k.revision}`,children:`${ue} \u2014 ${k.items.length} \u4EF6`}),g("div",{id:`${P}-${$}`,hidden:!z,children:g(cn,{label:ue,items:k.items,itemKey:U=>U.key,selectedKey:X,onSelect:U=>Me(U.key),detailId:P,renderRow:U=>nt(U,y),rowTestId:"history-item",rowData:U=>({"data-item-key":U.key,"data-pinned":U.state!==null&&U.state.stateId===Be}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${k.revision}`})})]},$)})]}),nt=(y,k)=>{let $=y.state,z=`history-row-${y.key}`,ue=$===null?[]:ia($,k,z);return V(Ot,{children:[y.kind==="run"?V("span",{children:["\u5B9F\u884C #",y.run.id," \xB7 ",Yn[y.run.trigger]," ",g(Ve,{tone:oa[ut(y.run)],variant:"tint",testId:`${z}-status`,children:rt[ut(y.run)].label})]}):g("span",{children:Lt[y.state.cause]}),g("span",{children:g(fe,{iso:y.time,testId:`${z}-time-value`})}),$!==null&&ai($,z),y.kind==="run"&&Hn(y.run)&&g("span",{"data-testid":`${z}-unrecorded`,children:Kn}),ue,$!==null&&$.stateId===Be&&g(Ve,{tone:"info",variant:"tint",testId:`${z}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},we=(y,k)=>{let $=k.states.find(ye=>ye.stateId===Be)??null,z=g(ri,{pinned:$,shown:y,onPin:ye=>q({request:a,stateId:ye}),onUnpin:()=>q(null),fallback:()=>D.current});if(y===null)return z;let ue=()=>D.current,U;if($!==null&&$.stateId!==y.stateId){let[ye,It]=k.states.indexOf($)>k.states.indexOf(y)?[$,y]:[y,$];U=g(Tr,{host:e,fromStateId:ye.stateId,toStateId:It.stateId,rescueTarget:ue})}else y.previousStateId===null?U=g("p",{"data-testid":"history-no-previous",children:Ma}):U=g(Tr,{host:e,fromStateId:y.previousStateId,toStateId:y.stateId,rescueTarget:ue});return V(Ot,{children:[z,U]})},at=y=>{if(M===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let k=M.state,$=y.states.find(z=>z.stateId===Be);if($!==void 0&&k!==null&&$.stateId!==k.stateId){let[z,ue]=y.states.indexOf($)>y.states.indexOf(k)?[$,k]:[k,$];return`\u6BD4\u8F03: ${Xe(z.revision)} \u2192 ${Xe(ue.revision)}`}return M.kind==="run"?`${Xe(M.run.revision)} \u306E\u5B9F\u884C #${M.run.id}`:`${Xe(M.state.revision)} \u306E\u5909\u5316`},Ae=y=>{if(X===null)return y.groups.some(ue=>ue.items.length>0)?g("p",{"data-testid":"history-select-prompt",children:"\u6642\u7CFB\u5217\u304B\u3089\u8A18\u9332\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5909\u5316\u3092\u793A\u3057\u307E\u3059\u3002"}):g("p",{role:"status","data-testid":"history-no-selectable",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});if(M===void 0&&ke)return g("p",{"aria-busy":"true","data-testid":"history-detail-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});if(M===void 0)return V("p",{role:"status","data-testid":"history-selection-missing",children:[X.startsWith("run:")?`\u5B9F\u884C #${X.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(M.kind==="state"){let{state:ue}=M;return V(Ot,{children:[V("dl",{"data-testid":"history-state-summary",children:[V("div",{children:[g("dt",{children:"\u5951\u6A5F"}),g("dd",{"data-testid":"history-state-cause",children:Lt[ue.cause]})]}),V("div",{children:[g("dt",{children:"\u6642\u523B"}),g("dd",{children:g(fe,{iso:ue.settledAt,testId:"history-state-settled-at-value"})})]}),V("div",{children:[g("dt",{children:"\u64CD\u4F5C\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-state-actor",children:ue.actor})]}),V("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-state-confidentiality",children:ue.classification.confidentialityLevel})]})]}),ia(ue,y,"history-detail"),we(ue,y)]})}let{run:k,state:$}=M,z=ut(k);return V(Ot,{children:[V("dl",{"data-testid":"history-run-summary","data-run-id":k.id,children:[V("div",{children:[g("dt",{children:"\u304D\u3063\u304B\u3051"}),g("dd",{"data-testid":"history-run-trigger","data-trigger":k.trigger,children:Yn[k.trigger]})]}),V("div",{children:[g("dt",{children:"\u8A66\u884C"}),g("dd",{"data-testid":"history-run-attempt",children:k.attempt})]}),V("div",{children:[g("dt",{children:"\u72B6\u614B"}),g("dd",{children:g(Ve,{tone:oa[z],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":k.status,"data-presentation":z},children:rt[z].label})})]}),V("div",{children:[g("dt",{children:"\u7A2E\u985E"}),g("dd",{"data-testid":"history-run-kind",children:Za(k.documentKind)})]}),V("div",{children:[g("dt",{children:"\u8981\u6C42\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-requested-by",children:k.requestedBy})]}),V("div",{children:[g("dt",{children:"\u958B\u59CB"}),g("dd",{children:g(fe,{iso:k.startedAt,testId:"history-run-started-at-value"})})]}),V("div",{children:[g("dt",{children:"\u7D42\u4E86"}),g("dd",{"data-testid":"history-run-finished-at",children:g(At,{iso:k.finishedAt,testId:"history-run-finished-at-value"})})]}),V("div",{children:[g("dt",{children:"\u30B8\u30E7\u30D6"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-job-id",children:k.jobId})]})]}),k.errorMessage!==null&&g("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:k.errorMessage}),Hn(k)&&g("p",{"data-testid":"history-run-unrecorded",children:Kn}),$===null?g("p",{"data-testid":"history-run-no-state",children:"\u3053\u306E\u5B9F\u884C\u304C\u4F5C\u3063\u305F\u72B6\u614B\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):ia($,y,"history-detail"),we($,y),V("details",{"data-testid":"history-run-steps",children:[g("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),g(kr,{run:k})]})]})},Fe=y=>V("section",{id:P,"aria-labelledby":T,"data-testid":"history-detail","data-selected-key":X??"",children:[g("h3",{ref:D,id:T,tabIndex:-1,style:ni,"data-testid":"history-detail-heading",children:at(y)}),Ae(y)]});return V("section",{"data-cui-migration":"pending",ref:u,role:"dialog","aria-labelledby":b,onKeyDown:re,"data-testid":"history-inspector","data-metadata-id":t,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans",children:[V("div",{children:[g("h2",{ref:w,id:b,tabIndex:-1,style:ti,"data-testid":"history-heading",children:oe===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${oe.document.fileName}`}),g(he,{variant:"secondary",onClick:s,testId:"history-close",children:i.close})]}),O()]})}import{COPY_REASON_LABELS as oi,ConfidentialityLevelSchema as ii,EnrichmentSyncStatusSchema as Fr,identifierMatches as $r,isPromotable as di,PROTECTION_SCHEME_LABELS as li,pastedIdentifier as ci,QUARANTINED_CONFIDENTIALITY_LEVEL as Dr,sourceOfUri as la,UNLOCK_DISPOSITION_LABELS as ui}from"@aiquants/enrichment-core";import{useId as mt,useLayoutEffect as pi,useMemo as Ar,useRef as Mr,useState as We}from"react";import{formatCount as wr}from"@aiquants/console-ui/core";function pt(e,t,n){try{wr(e,n)}catch(a){throw new RangeError(`${t}: ${a.message}`,{cause:a})}return e}function In(e,t,n){return wr(pt(e,t,n),n)}var Lr=1024,si=[{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 Pr(e,t){return Number((e/Lr**t.power).toFixed(t.fractionDigits))}function Cn(e,t,n){pt(e,t,n);let[a,...s]=si,r=a,l=Pr(e,r);for(let i of s){if(l<Lr)break;r=i,l=Pr(e,r)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:r.fractionDigits,maximumFractionDigits:r.fractionDigits,useGrouping:!0}).format(l)} ${r.name}`}import{Fragment as vi,jsx as c,jsxs as v}from"react/jsx-runtime";var mi="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",fi=new Set(Fr.options.filter(e=>e.startsWith("FAILED"))),yi=new Set(Fr.options);function gi(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:fi.has(e.syncStatus)?{kind:"retry"}:yi.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Or(e,t,n){let a=e?.find(s=>s.confidentialityLevel===t&&s.capability===n);return a?a.isEnabled:null}var bi={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"},xi=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function hi(e){return/[A-Za-z0-9]$/.test(e)?`${e} `:e}function ca({field:e}){return c("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function _c({policies:e,tenantId:t,sources:n,domainOptions:a,recentItems:s=[],inspectionResult:r=null,isSubmitting:l=!1,isInspecting:i=!1,isBusy:o=!1,promotingId:b=null,onInspectUri:P,onIngestDocument:T,onRetryItem:u,onShowHistory:w,onPromoteUnlockedCopy:D,listRefusal:p}){let{formatLocale:R}=I(),x=Pt(),L=Mr(new Map),W=Mr(null),ee=mt(),ie=mt(),ne=mt(),q=mt(),se=mt(),xe=mt(),_=mt(),te=mt(),[Y,Ie]=We(null),[Ye,$e]=We(""),[Ce,ke]=We(""),[oe,E]=We("CONFIDENTIAL"),[X,M]=We(null),[ae,ge]=We(""),[re,Me]=We(""),[m,O]=We([]),[de,le]=We(""),[Te,Be]=We("user"),[Oe,nt]=We(1),[we,at]=We(!1),Ae=X!==null&&a.some(d=>d.key===X)?X:a.length>0?a[0].key:null,Fe=Y===null?void 0:n.find(d=>d.uri_prefix===Y),y=Fe!==void 0?Fe:n.length>0?n[0]:null,k=Ar(()=>({vectorEnabled:Or(e,oe,"vector_indexing"),graphEnabled:Or(e,oe,"graph_indexing")}),[e,oe]),$=Ar(()=>{let d=Ce.trim();if(!d||n.length===0)return{valid:!1,error:null};let S=la(n,d);if(S===void 0)return{valid:!1,error:`\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (${n.map(He=>He.uri_prefix).join(", ")}) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002`};let h=d.slice(S.uri_prefix.length);return h.trim()?d.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"}:$r(S,h)?{valid:!0,error:null}:{valid:!1,error:`${hi(S.title.ja)}\u306E\u8B58\u5225\u5B50\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093 (\u4F8B: ${S.input_example})\u3002`}:{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}},[Ce,n]),z=d=>{if(Ie(d),Ye.trim()){let S=Ye.trim(),h=la(n,S),He=h===void 0?S:S.slice(h.uri_prefix.length);ke(`${d}${He}`)}else ke("")},ue=d=>{let S=d.trim();if(!S){$e(""),ke("");return}let h=la(n,S);if(h!==void 0){Ie(h.uri_prefix),$e(S.slice(h.uri_prefix.length)),ke(S);return}if(y!==null&&$r(y,S)){$e(d),ke(`${y.uri_prefix}${S}`);return}let He=ci(n,S);if(He!==void 0){Ie(He.source.uri_prefix),$e(He.identifier),ke(`${He.source.uri_prefix}${He.identifier}`);return}if(S.includes("://")){$e(d),ke(S);return}$e(d),ke(y===null?S:`${y.uri_prefix}${S}`)},U=()=>{let d=de.trim();d&&(m.some(S=>S.labelKey===d)||(O(S=>[...S,{labelKey:d,category:Te,confidenceScore:Number(Oe.toFixed(2))}]),le("")))},ye=d=>{m.some(S=>S.labelKey===d)||O(S=>[...S,{labelKey:d,category:"domain",confidenceScore:1}])},It=d=>{O(S=>S.filter(h=>h.labelKey!==d))},Ht=d=>{if(d.preventDefault(),!$.valid||Ae===null)return;let S={fileUri:Ce.trim(),confidentialityLevel:oe,targetDomainKey:Ae,departmentId:ae.trim()?Number(ae):null,titleOverride:re.trim()?re.trim():null,labels:m};T?.(S)};pi(()=>{let d=W.current;if(d===null)return;let S=s.find(h=>h.kind==="readable"&&h.item.id===d)?.item;S?.unlock?.disposition==="copy_promoted"&&(W.current=null,document.activeElement===document.body&&L.current.get(d)?.focus(),x(`${S.fileName} \u306E\u6E90\u3092\u89E3\u3044\u305F\u5199\u3057\u3067\u4E0A\u66F8\u304D\u3057\u307E\u3057\u305F\u3002`))},[s,x]);let $n=d=>{let S=d.unlock;if(S===null)return null;let h=S.disposition==="copy_original"&&S.copyReason!==null&&di(S.copyReason)&&d.isCurrent!==!1,He=b===d.id,Sa=He?"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D\u4E2D...":"\u6E90\u3092\u5199\u3057\u3067\u4E0A\u66F8\u304D";return v("div",{ref:Na=>{Na===null?L.current.delete(d.id):L.current.set(d.id,Na)},tabIndex:-1,className:"mt-1 max-w-xs space-y-1 text-[11px] text-slate-700","data-testid":`ingest-unlock-${d.id}`,"data-disposition":S.disposition,"data-protection":S.protectionScheme,children:[v("div",{children:["\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5916\u3057\u305F: ",li[S.protectionScheme]]}),v("div",{"data-testid":`ingest-unlock-disposition-${d.id}`,children:[ui[S.disposition],S.copyReason!==null&&` (${oi[S.copyReason]})`]}),h&&D!==void 0&&c("button",{type:"button",onClick:()=>{W.current=d.id,D(d.id)},disabled:o,"aria-busy":He,"aria-label":`${d.fileName} \u306E${Sa}`,className:"min-h-11 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 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":`ingest-promote-button-${d.id}`,children:Sa})]})},f=d=>{let S=gi(d);if(S.kind==="blocked")return c("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${d.id}`,"data-reason":S.reason,children:S.reason});let h=S.kind==="retry";return c("button",{type:"button",onClick:()=>u?.(d.id),disabled:o,"aria-label":`${d.fileName} \u3092${h?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:h?"min-h-11 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 disabled:cursor-not-allowed":"min-h-11 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 disabled:cursor-not-allowed","data-testid":`ingest-${S.kind}-button-${d.id}`,children:h?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},ve=d=>{switch(d){case"SYNCED":return c("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 c("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 c("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 c("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 c("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 d.startsWith("FAILED")?v("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: ",d]}):c("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:d})}};return v("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"document-ingest-console",children:[v("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[v("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[v("div",{children:[c("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"}),c("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"})]}),v("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: ",c("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),v("form",{onSubmit:Ht,className:"mt-6 space-y-6",children:[v("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[v("label",{htmlFor:ee,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",c(ca,{field:"uri"})]}),y!==null&&v("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",c("strong",{className:"font-semibold text-indigo-600",children:y.uri_prefix})]})]}),y===null&&c(Ge,{tone:"warning",testId:"ingest-no-sources",children:"\u53D6\u308A\u8FBC\u3081\u308B\u6E90\u304C\u914D\u5099\u306B\u3042\u308A\u307E\u305B\u3093\u3002"}),v("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),n.map(d=>c("button",{type:"button",onClick:()=>z(d.uri_prefix),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${y?.uri_prefix===d.uri_prefix?"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-${d.scheme}`,children:`${d.scheme}:// (${d.title.ja})`},d.scheme))]}),v("div",{className:"space-y-1.5",children:[v("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[v("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 ${$.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:[c("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:y?.uri_prefix}),c("input",{id:ee,type:"text",value:Ye,onChange:d=>ue(d.target.value),placeholder:y?.input_hint.ja,disabled:y===null,"aria-invalid":!!$.error,"aria-describedby":$.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})]}),c("button",{type:"button",onClick:()=>P?.(Ce.trim()),disabled:!$.valid||i||o,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:i?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),v("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[y!==null&&c("p",{className:"text-slate-500",children:y.guidance.ja}),Ce&&v("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[c("span",{children:"\u89E3\u6C7A URI:"}),c("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:Ce})]})]})]}),$.error&&c("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:$.error})]}),r&&r.fileUri===Ce.trim()&&v("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 ${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:[v("div",{className:"flex items-center justify-between",children:[c("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)"}),c("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.exists&&v("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),c("span",{className:"font-semibold text-slate-800",children:r.fileName})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),c("span",{className:"font-semibold text-slate-800",children:c(Ke,{text:Cn(r.fileSize,"fileSize",R),testId:"inspection-file-size-value"})})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"MIME:"}),c("span",{className:"font-semibold text-slate-800",children:r.mimeType})]}),v("div",{children:[c("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),c("span",{className:"font-semibold text-slate-800",children:r.revisionId?.slice(0,8)??"N/A"})]})]})]}),v("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[v("div",{className:"space-y-1",children:[v("label",{htmlFor:ie,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",c(ca,{field:"confidentiality"})]}),c("select",{id:ie,value:oe,onChange:d=>E(d.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:ii.options.map(d=>v("option",{value:d,children:[d," (",bi[d],")"]},d))})]}),v("div",{className:"space-y-1",children:[v("label",{htmlFor:ne,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",c(ca,{field:"domain"})]}),c("select",{id:ne,value:Ae===null?"":Ae,onChange:d=>M(d.target.value),disabled:a.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:a.map(d=>c("option",{value:d.key,children:d.label},d.key))}),a.length===0&&c("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"})]})]}),oe===Dr&&v("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:[c("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Dr," \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",c("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"})]}),v("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:[c("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)"}),v("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[v("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":k.vectorEnabled===null?"unknown":String(k.vectorEnabled),children:k.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":k.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${oe} \u306E\u8A2D\u5B9A)`})]}),v("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":k.graphEnabled===null?"unknown":String(k.graphEnabled),children:k.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":k.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${oe} \u306E\u8A2D\u5B9A)`})]})]}),v("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 (",c("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"]})]}),v("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[v("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),v("span",{className:"text-slate-500 text-xs",children:[m.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),v("div",{className:"flex flex-wrap items-center gap-1.5",children:[c("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),xi.map(d=>v("button",{type:"button",onClick:()=>ye(d),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-${d}`,children:["+ ",d]},d))]}),v("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[v("div",{className:"space-y-1 sm:col-span-2",children:[c("label",{htmlFor:xe,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),c("input",{id:xe,type:"text",value:de,onChange:d=>le(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),U())},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"})]}),v("div",{className:"space-y-1",children:[c("label",{htmlFor:_,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),v("select",{id:_,value:Te,onChange:d=>Be(d.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:[c("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),c("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),c("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),v("div",{className:"space-y-1",children:[v("label",{htmlFor:te,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Oe.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)"]}),c("input",{id:te,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Oe,"aria-valuenow":Oe,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Oe*100)}%`,onChange:d=>nt(Number.parseFloat(d.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),c("div",{children:c("button",{type:"button",onClick:U,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"})})]}),m.length>0&&c("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:m.map(d=>v("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-${d.labelKey}`,children:[c("span",{className:"font-semibold",children:d.labelKey}),v("span",{className:"text-indigo-400",children:["(",d.category,")"]}),c("button",{type:"button",onClick:()=>It(d.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${d.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${d.labelKey}`,children:"\xD7"})]},d.labelKey))})]}),v("div",{className:"space-y-3",children:[c("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":we,"aria-controls":"advanced-settings-panel",onClick:()=>at(d=>!d),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:v("span",{children:[we?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),we&&v("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:[c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:v("div",{className:"space-y-1",children:[c("label",{htmlFor:se,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),c("input",{id:se,type:"text",value:re,onChange:d=>Me(d.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"})]})}),c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:v("div",{className:"space-y-1",children:[c("label",{htmlFor:q,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),c("input",{id:q,type:"number",value:ae,onChange:d=>ge(d.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"})]})})]})]}),c("div",{className:"flex justify-end pt-2",children:c("button",{type:"submit",disabled:!$.valid||Ae===null||l||i||o,"aria-busy":l,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:l?v(vi,{children:[c("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),c("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):c("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),v("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[c("div",{className:"flex items-center justify-between",children:v("div",{children:[c("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),c("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"})]})}),p!==void 0?c(Ge,{tone:"warning",testId:"recent-items-refused",children:p}):s.length===0?c("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"}):c("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:v("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:[c("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:v("tr",{children:[c("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),c("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),c("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:s.map((d,S)=>{if(d.kind==="restricted")return v("tr",{"data-testid":`recent-item-restricted-${S}`,"data-restricted-mark":"ingest",children:[c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${S}`,children:$t}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${S}`,children:d.syncStatus===null?c("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:mi}):ve(d.syncStatus)}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${S}`,children:c(fe,{iso:d.createdAt,testId:`recent-item-restricted-created-at-value-${S}`})}),c("td",{className:"px-3 py-2"})]},`restricted:${S}`);let h=d.item;return v("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${h.id}`,children:[c("td",{className:"px-3 py-2 font-bold",children:h.id}),v("td",{className:"max-w-xs truncate px-3 py-2",title:h.fileUri,children:[c("div",{className:"font-sans font-semibold text-slate-900",children:h.fileName}),c("div",{className:"truncate text-[11px] text-slate-600",children:h.fileUri})]}),c("td",{className:"px-3 py-2",children:c("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:h.confidentialityLevel})}),v("td",{className:"px-3 py-2 text-slate-600",children:["rev.",h.revision,h.isCurrent===!1&&c("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-${h.id}`,children:"\u65E7\u7248"})]}),v("td",{className:"px-3 py-2 font-sans",children:[ve(h.syncStatus),h.errorMessage!==null&&h.errorMessage!==void 0&&h.errorMessage!==""&&c("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${h.id}`,title:h.errorMessage,children:h.errorMessage}),$n(h)]}),v("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${h.id}`,children:[h.lastRun===null?c("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${h.id}`,children:"\u8A18\u9332\u306A\u3057"}):h.lastRun.kind==="restricted"?v("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${h.id}`,"data-restricted-mark":"run",children:[c("div",{className:"text-[11px] text-slate-600",children:yn}),c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${rt[h.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${h.id}`,"data-status":h.lastRun.status,children:rt[h.lastRun.status].label}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${h.id}`,children:c(At,{iso:h.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${h.id}`})})]}):v("div",{className:"space-y-1",children:[c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${rt[ut(h.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${h.id}`,"data-status":h.lastRun.item.status,"data-presentation":ut(h.lastRun.item),children:rt[ut(h.lastRun.item)].label}),h.lastRun.item.failedStepKey!==null&&c("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${h.id}`,children:Jt(h.lastRun.item.failedStepKey)}),h.lastRun.item.failedStepKey==="unlock_document"&&c("div",{className:"max-w-xs text-[11px] text-slate-700","data-testid":`ingest-unlock-hint-${h.id}`,children:"\u3069\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u3082\u958B\u3051\u306A\u304B\u3063\u305F\u3068\u304D\u306F\u3001\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8DB3\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u3069\u306E\u90E8\u54C1\u3082\u5916\u305B\u306A\u3044\u5B88\u308A (\u8A3C\u660E\u66F8\u30FB\u6A29\u5229\u306E\u7BA1\u7406\u30FBPKWARE \u306E\u5F37\u3044\u6697\u53F7) \u306F\u3001\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u3063\u305F\u6240\u3067\u5916\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${h.id}`,children:c(At,{iso:h.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${h.id}`})})]}),w!==void 0&&c("button",{type:"button",onClick:()=>w(h.id),"aria-label":`${h.fileName} \u306E\u5C65\u6B74`,className:"mt-1 min-h-11 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-${h.id}`,children:"\u5C65\u6B74"})]}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${h.id}`,children:c(fe,{iso:h.createdAt,testId:`ingest-created-at-value-${h.id}`})}),c("td",{className:"px-3 py-2 text-right font-sans",children:f(h)})]},`readable:${h.id}`)})})]})})]})]})}import{ENRICHMENT_STAGES as ua}from"@aiquants/enrichment-core";import{jsx as Se,jsxs as et}from"react/jsx-runtime";var Si="\u8981\u7D04\u751F\u6210\u30FB\u69CB\u9020\u5316\u62BD\u51FA\u30FB\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA\u306E\u5207\u308A\u66FF\u3048\u306F\u4FDD\u5B58\u3055\u308C\u307E\u3059\u304C\u3001\u4ECA\u306F\u52B9\u304D\u307E\u305B\u3093 (\u30C9\u30E1\u30A4\u30F3\u306F\u30E2\u30C7\u30EB\u304C\u6C7A\u3081\u308B\u306E\u3067\u3001\u6295\u5F71\u306E\u6BB5\u3060\u3051\u304C\u6226\u7565\u3092\u8AAD\u307F\u307E\u3059)\u3002",Ur={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 Kr(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Tc({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:a=!1}){let s=n===void 0;return et("div",{"data-cui-migration":"pending","data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[et("div",{children:[Se("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),et("p",{className:"text-slate-500 text-xs",children:["\u6295\u5F71\u306E\u6BB5 (\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u30FB\u30B0\u30E9\u30D5\u6295\u5F71) \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",Se("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 ",ua.length," \u6BB5\u3002"]}),Se("p",{"data-testid":"strategy-inert-note",className:"mt-1 text-slate-500 text-xs",children:Si}),s&&Se("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?Se("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"}):Se("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:et("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:[Se("thead",{children:et("tr",{children:[Se("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"}),ua.map(r=>{let l=Kr(r.featureFlagKey,t);return et("th",{scope:"col","data-inert":String(!r.readByPipeline),className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[Se("div",{children:r.label}),Se("div",{"data-testid":`strategy-gate-${r.key}`,"data-gate":l,className:"mt-0.5 font-normal text-[10px]",style:{color:Ur[l].color},children:Ur[l].label}),!r.readByPipeline&&Se("div",{"data-testid":`strategy-inert-${r.key}`,className:"mt-0.5 font-normal text-[10px] text-slate-500",children:"\u4ECA\u306F\u52B9\u304B\u306A\u3044"})]},r.key)})]})}),Se("tbody",{children:e.map(r=>et("tr",{"data-testid":`strategy-row-${r.domainKey}`,"data-provenance":r.provenance,"data-active":String(r.isActive),children:[et("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[Se("div",{className:"font-semibold text-slate-900",children:r.domainLabel}),et("div",{className:"text-[10px] text-slate-500",children:[Se("code",{children:r.domainKey})," / ",r.strategyName]}),Se("div",{"data-testid":`strategy-provenance-${r.domainKey}`,className:"text-[10px] text-slate-500",children:r.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"}),!r.isActive&&Se("div",{"data-testid":`strategy-inactive-${r.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"})]}),ua.map(l=>{let i=r.stages[l.key],o=Kr(l.featureFlagKey,t),b=!l.readByPipeline;return et("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[Se("button",{type:"button",role:"switch","aria-checked":i,"aria-label":b?`${r.domainLabel} \u306E ${l.label} (\u4ECA\u306F\u52B9\u304B\u306A\u3044)`:`${r.domainLabel} \u306E ${l.label}`,"data-testid":`strategy-stage-${r.domainKey}-${l.key}`,"data-enabled":String(i),"data-effective":String(!b&&i&&(o==="open"||o==="absent")),"data-inert":String(b),disabled:s||a,onClick:()=>n?.(r,l.key,!i),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${i?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${s||a?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:i?"\u958B":"\u9589"}),!b&&i&&o==="unmeasured"&&Se("div",{"data-testid":`strategy-unmeasured-${r.domainKey}-${l.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"}),!b&&i&&o==="closed"&&Se("div",{"data-testid":`strategy-blocked-${r.domainKey}-${l.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"})]},l.key)})]},`${r.domainKey}:${r.strategyName}`))})]})})]})}var Ut={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},Kt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};import{Fragment as Gr,jsx as G,jsxs as pe}from"react/jsx-runtime";var Ni={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"},Br=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],Ei=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),kn={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 Hr(e){return e.kind==="text"?"anywhere":"atomic"}function qr(e,t){return t===null?{kind:"unmeasured"}:Ei.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 Ri(e){let t=Br.filter(a=>a in e),n=Object.keys(e).filter(a=>!Br.includes(a)).sort();return[...t,...n].map(a=>({key:a,label:Ni[a]??a,value:qr(a,e[a])}))}function Vr(e,t){switch(e.kind){case"count":return G(Q,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return G(Ke,{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 G(Ke,{text:String(e.value),testId:t});case"word":return G(Ke,{text:e.text,testId:t});case"text":return G(jt,{text:e.text,testId:t})}}function Oc({health:e,isRefreshing:t=!1,onRefresh:n,className:a=""}){let{services:s,allHealthy:r,checkedAt:l}=e;I();let i=[{key:"qdrant",data:s.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:s.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:s.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:s.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:s.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return pe("section",{"data-cui-migration":"pending",className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${a}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(r),children:[pe("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[pe("div",{className:"flex items-center gap-3",children:[G("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:pe("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:[G("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),G("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),G("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),G("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),pe("div",{children:[G("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),pe("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",G("span",{"data-testid":"health-checked-at",children:G(fe,{iso:l,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"]})]})]}),pe("div",{className:"flex flex-wrap items-center gap-3",children:[G("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...Kt[r?"connected":"error"],"data-testid":"health-overall-status-badge",children:r?pe(Gr,{children:[pe("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:[G("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),G("polyline",{points:"22 4 12 14.01 9 11.01"})]}),pe("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Ut.connected]})]}):pe(Gr,{children:[pe("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:[G("circle",{cx:"12",cy:"12",r:"10"}),G("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),G("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),pe("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Ut.error]})]})}),n&&pe("button",{type:"button",onClick:n,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:[pe("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:[G("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),G("path",{d:"M3 3v5h5"}),G("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),G("path",{d:"M16 21h5v-5"})]}),G("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),G("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:i.map(({key:o,data:b,title:P,subtitle:T})=>{let u=qr("version",b.version),w=kn[Hr(u)],D=Vr(u,`service-version-value-${o}`);return pe("div",{"data-testid":`service-card-${o}`,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:[pe("div",{children:[pe("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[G("span",{className:"font-semibold text-sm",children:P}),pe("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...Kt[b.status],"data-testid":`service-status-${o}`,children:[G("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${o}`}),Ut[b.status]]})]}),G("p",{className:"mt-1 text-[11px] text-muted-foreground",children:T}),pe("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[pe("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${o}`,children:[G("span",{className:w.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),G("span",{className:`${w.slot} font-medium text-[11px]`,"data-testid":`service-version-${o}`,children:u.kind==="text"?G("code",{className:"font-mono font-semibold",children:D}):D})]}),pe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${o}`,children:[G("span",{className:kn.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),G("span",{className:`${kn.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${o}`,children:G(Q,{value:b.latencyMs,unit:"ms",testId:`health-latency-value-${o}`})})]}),Ri(b.details).map(p=>{let R=kn[Hr(p.value)];return pe("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${o}-${p.key}`,children:[pe("span",{className:R.label,children:[p.label,":"]}),G("span",{className:`${R.slot} font-medium text-[11px]`,"data-testid":`health-detail-${o}-${p.key}`,children:Vr(p.value,`health-detail-value-${o}-${p.key}`)})]},p.key)})]})]}),pe("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[G("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${o}`,children:b.endpoint}),b.errorMessage!==void 0&&Xt.test(b.errorMessage)&&G("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Kt.error,"data-testid":`service-error-${o}`,children:b.errorMessage})]})]},o)})})]})}import{FILTERABLE_CONFIDENTIALITY_LEVELS as _i,SEARCH_FUSIONS as Ii,SEARCH_MODES as Ci,SEARCH_PARAM_LIMITS as Ne}from"@aiquants/enrichment-core";import{useEffect as ki,useId as Ti,useRef as pa,useState as be}from"react";import{Fragment as Bi,jsx as N,jsxs as tt}from"react/jsx-runtime";var wi=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"RRF (k=60) \u3067\u8A9E\u5F59\u3068\u610F\u5473\u306E\u9806\u4F4D\u3092\u5408\u308F\u305B\u308B",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u3060\u3051",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9",description:"SQL \u306E\u8A9E\u53E5\u306E\u4E00\u81F4\u3060\u3051",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u4E00\u81F4\u3092\u72D9\u3046",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u306E\u9806\u4F4D\u3092\u4E3B\u306B\u3059\u308B",params:{mode:"GRAPH_TRAVERSE",limit:30}}],Pi={PUBLIC:"\u516C\u958B (PUBLIC)",INTERNAL:"\u793E\u5185 (INTERNAL)",DEPARTMENT:"\u90E8\u7F72 (DEPARTMENT)",CONFIDENTIAL:"\u6A5F\u5BC6 (CONFIDENTIAL)"},ma="ALL",en={request:"\u8981\u6C42",response:"\u5FDC\u7B54",flow:"\u8D70\u308A",graph:"\u30B0\u30E9\u30D5\u306E\u8DE1"},Li="\u307E\u3060\u691C\u7D22\u3057\u3066\u3044\u307E\u305B\u3093\u3002",$i=(Ne.threshold.min+Ne.threshold.max)/2,Di=336,Ai=544;function Mi(e){let t=e.trim().length;return t<Ne.queryLength.min?"\u691C\u7D22\u8A9E\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Ne.queryLength.max?`\u691C\u7D22\u8A9E\u306F ${Ne.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function Oi(e){let t=e.trim();if(t!=="")return/^[1-9]\d*$/.test(t)&&Number.isSafeInteger(Number(t))?void 0:"\u90E8\u7F72\u306E ID \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}function zr(e,t){return t.trim().length>Ne.filterTextLength.max?`${e}\u306F ${Ne.filterTextLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function Fi(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`\u7DDA\u5F62 (\u03B1=${e.alpha}, k=${e.rrf_k})`:"\u878D\u5408\u306A\u3057 (1 \u3064\u306E\u9806\u4F4D\u3060\u3051\u306E\u6226\u7565)"}function Ui({params:e,answer:t}){let n=t.search_metadata,a=n.executed_tiers,s=r=>r?"\u2713":"\u2013";return[`\u8981\u6C42\u306E\u6226\u7565: ${n.requested_mode} (${st[n.requested_mode].label})`,`\u8D70\u3063\u305F\u6226\u7565: ${n.search_mode} (${st[n.search_mode].label})`,`\u8D70\u3063\u305F\u5C64: \u8A9E\u53E5 ${s(a.lexical)} / \u758E ${s(a.sparse)} / \u5BC6 ${s(a.dense)} / \u30B0\u30E9\u30D5 ${s(a.graph)}`,`\u878D\u5408: ${Fi(e)}`,`\u54C1\u8CEA: ${Vt[n.quality_tier]}`,`\u7E2E\u9000\u306E\u7406\u7531: ${n.degradation_reasons.length===0?"\u7121\u3057":n.degradation_reasons.join(", ")}`,`\u906E\u65AD\u5668: \u30D9\u30AF\u30C8\u30EB ${Gt[n.circuit_breaker_status.vector]} / \u30B0\u30E9\u30D5 ${Gt[n.circuit_breaker_status.graph]}`,`\u6240\u8981: ${n.execution_time_ms} ms`,`\u4EF6\u6570: ${t.hits.length}`].join(`
2
2
  `)}function Ki({answer:e}){if(!e.search_metadata.executed_tiers.graph)return"\u30B0\u30E9\u30D5\u306E\u5C64\u306F\u8D70\u3063\u3066\u3044\u307E\u305B\u3093\u3002";if(e.authz_scopes.row_scope_applied)return"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u3001\u95A2\u4FC2\u306F\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002";let t=e.hits.flatMap((n,a)=>(n.graph_relations??[]).map(s=>`#${a+1} ${n.file_name??Ct}: ${s.relation} \u2192 ${s.target_name}`));return t.length===0?"\u3069\u306E\u6587\u66F8\u306B\u3082\u95A2\u4FC2\u306F\u3042\u308A\u307E\u305B\u3093\u3002":t.join(`
3
- `)}function Xe(e,t){return e?Ct:t===null||t===""?"\u7121\u3057":String(t)}function Wc({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:a}=I(),s=Pt(),r=Ti(),[l,i]=be(n?.q??""),[o,b]=be(n?.mode??"HYBRID"),[P,T]=be(n?.limit??Ne.limit.default),[u,w]=be(n?.threshold??$i),[D,p]=be(n?.fusion??"rrf"),[E,h]=be(n?.rrf_k??Ne.rrfK.default),[L,W]=be(n?.alpha??Ne.alpha.default),[ee,ie]=be(n?.confidentiality_level??ma),[ne,q]=be(n?.department_id===void 0?"":String(n.department_id)),[se,xe]=be(n?.mime_type??""),[_,te]=be(n?.tag??""),[Y,Ie]=be(!1),[We,De]=be(!1),[Ce,Le]=be(!1),[oe,N]=be("request"),[X,M]=be(!1),[ae,ge]=be(!1),[re,Me]=be(null),[m,O]=be(null),[de,le]=be(null),[ke,Be]=be(null),Oe=pa(0),nt=pa(0),Te=pa(null);ki(()=>()=>Te.current?.abort(),[]);let at={query:Mi(l),department:Oi(ne),mimeType:qr("MIME \u30BF\u30A4\u30D7",se),tag:qr("\u30BF\u30B0",_)},Ae=X?at:{},Fe=()=>{let f=ne.trim(),ve=se.trim(),d=_.trim();return{q:l.trim(),mode:o,limit:P,...o==="DENSE"?{threshold:u}:{},...o==="HYBRID"?{fusion:D,rrf_k:E,...D==="linear"?{alpha:L}:{}}:{},...ee===ma?{}:{confidentiality_level:ee},...f===""?{}:{department_id:Number(f)},...ve===""?{}:{mime_type:ve},...d===""?{}:{tag:d}}},y=async f=>{let ve=new AbortController;Te.current=ve,ge(!0);try{let d=await t(f,ve.signal);if(ve.signal.aborted)return;Me({params:f,answer:d}),O(d.hits.length===0?null:"1"),le(null),s(d.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${d.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(d){if(ve.signal.aborted)return;Oe.current+=1,le({message:d instanceof Error?d.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:Oe.current})}finally{Te.current===ve&&(Te.current=null,ge(!1))}},k=f=>{f.preventDefault(),M(!0),!(ae||Object.values(at).some(ve=>ve!==void 0))&&y(Fe())},$=f=>{b(f.params.mode),T(f.params.limit),f.params.threshold!==void 0&&w(f.params.threshold),f.params.fusion!==void 0&&p(f.params.fusion),f.params.rrf_k!==void 0&&h(f.params.rrf_k),s(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${f.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},z=f=>{if(re===null)return Li;switch(f){case"request":return JSON.stringify(re.params,null,2);case"response":return JSON.stringify(re.answer,null,2);case"flow":return Ui(re);case"graph":return Ki(re)}},ue=async()=>{try{await navigator.clipboard.writeText(z(oe)),Be(null),s(`${en[oe]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(f){nt.current+=1,Be({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${f instanceof Error?f.message:String(f)}`,occurrence:nt.current})}},U=re?.answer??null,ye=f=>U?.authz_scopes.hidden_columns.includes(f)===!0,It=U===null?[]:U.hits.map((f,ve)=>({hit:f,rank:ve+1})),Ht=It.find(f=>String(f.rank)===m)??null,$n=(f,ve)=>{let d=f.scores;return S(Mn,{id:r,title:`#${ve} ${Xe(ye("file_name"),f.file_name)}`,region:!0,testId:"search-hit-detail",children:tt(we,{gap:"space-4",testId:"search-hit-detail-body",children:[S(wt,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:S(Fn,{label:"\u878D\u5408\u306E\u5024",value:d.fused,min:0,max:1,valueText:d.fused.toFixed(kt),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:S(B,{fg:"fg",type:"body",children:d.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":_a(d.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:S(B,{fg:"fg",type:"body",children:d.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":d.lexical_rank.toFixed(kt)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:S(B,{fg:"fg",type:"body",children:d.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":d.graph_rank.toFixed(kt)})}],testId:"search-hit-scores"}),S(wt,{items:[{key:"file_uri",term:"URI",description:S(B,{fg:"fg",type:"body",face:"mono",children:Xe(ye("file_uri"),f.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:S(B,{fg:"fg",type:"body",children:Xe(ye("mime_type"),f.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:S(B,{fg:"fg",type:"body",children:Xe(ye("folder_path"),f.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:S(B,{fg:"fg",type:"body",children:Xe(ye("confidentiality_level"),f.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:S(B,{fg:"fg",type:"body",children:Xe(ye("department_id"),f.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:S(B,{fg:"fg",type:"body",children:Xe(ye("created_by"),f.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:ye("mtime")?S(B,{fg:"fg",type:"body",children:Ct}):S(fe,{iso:f.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:ye("tags")||f.tags===null||f.tags.length===0?S(B,{fg:"fg",type:"body",children:Xe(ye("tags"),null)}):S(it,{gap:"space-2",testId:"search-hit-tags",children:f.tags.map(R=>S(He,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${R}`,children:R},R))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:S(B,{fg:"fg",type:"prose",children:Xe(ye("ai_summary"),f.ai_summary)})}],testId:"search-hit-fields"}),tt(we,{gap:"space-2",testId:"search-hit-relations",children:[S(B,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),f.graph_relations===null?S(B,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):f.graph_relations.length===0?S(B,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):S("ul",{"data-testid":"search-hit-relation-list",children:f.graph_relations.map(R=>S("li",{children:S(B,{fg:"fg",type:"body",children:`${R.relation} \u2192 ${R.target_name}`})},`${R.relation}-${R.target_name}`))})]}),ye("structured_data")||f.structured_data===null?S(B,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${Xe(ye("structured_data"),null)}`}):S(On,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(f.structured_data,null,2),testId:"search-hit-structured"})]})})};return tt(we,{gap:"space-6",testId:"metadata-search-workbench",children:[S(ot,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":o,"data-running":ae},children:S("form",{onSubmit:k,noValidate:!0,"data-testid":"search-form",children:tt(we,{gap:"space-4",testId:"search-form-fields",children:[S(xt,{label:"\u691C\u7D22\u8A9E",type:"search",value:l,onValueChange:i,required:!0,description:`1\u301C${Ne.queryLength.max} \u5B57`,error:Ae.query,testId:"search-query"}),S(mn,{label:"\u691C\u7D22\u306E\u6226\u7565",options:Ci.map(f=>({value:f,label:st[f].label})),value:o,onValueChange:f=>b(f),testId:"search-mode"}),S(B,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:st[o].description}),S(bt,{label:"\u4EF6\u6570",value:P,min:Ne.limit.min,max:Ne.limit.max,step:1,valueText:f=>`${f} \u4EF6`,onValueChange:T,testId:"search-limit"}),o==="DENSE"&&S(bt,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:u,min:Ne.threshold.min,max:Ne.threshold.max,step:.01,valueText:f=>f.toFixed(2),onValueChange:w,testId:"search-threshold"}),o==="HYBRID"&&tt(we,{gap:"space-4",testId:"search-fusion-controls",children:[S(mn,{label:"\u878D\u5408",options:Ii.map(f=>({value:f,label:Ra[f]})),value:D,onValueChange:f=>p(f),testId:"search-fusion"}),S(bt,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:E,min:Ne.rrfK.min,max:Ne.rrfK.max,step:1,valueText:String,onValueChange:h,testId:"search-rrf-k"}),D==="linear"&&S(bt,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:L,min:Ne.alpha.min,max:Ne.alpha.max,step:.05,valueText:f=>f.toFixed(2),onValueChange:W,testId:"search-alpha"})]}),S(pn,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:Y,onOpenChange:Ie,testId:"search-filters",children:tt(we,{gap:"space-4",testId:"search-filter-fields",children:[S(zt,{label:"\u6A5F\u5BC6\u533A\u5206",value:ee,options:[{value:ma,label:"\u5168\u3066\u306E\u533A\u5206"},..._i.map(f=>({value:f,label:Pi[f]}))],onValueChange:ie,testId:"search-confidentiality"}),S(xt,{label:"\u90E8\u7F72\u306E ID",type:"text",value:ne,onValueChange:q,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:Ae.department,testId:"search-department"}),S(xt,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:se,onValueChange:xe,error:Ae.mimeType,testId:"search-mime-type"}),S(xt,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:_,onValueChange:te,error:Ae.tag,testId:"search-tag"})]})}),S(pn,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:We,onOpenChange:De,testId:"search-presets",children:S(we,{gap:"space-2",testId:"search-preset-list",children:wi.map(f=>tt(it,{gap:"space-2",testId:`search-preset-${f.id}`,children:[S(he,{variant:"secondary",onClick:()=>$(f),testId:`search-preset-${f.id}-apply`,children:f.title}),S(B,{fg:"fg-secondary",type:"body",children:f.description})]},f.id))})}),S(it,{gap:"space-2",testId:"search-actions",children:S(he,{variant:"primary",type:"submit",busy:ae,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),de!==null&&S(Ge,{occurrence:de.occurrence,testId:"search-failure",children:de.message}),U!==null&&S(wa,{metadata:U.search_metadata,testId:"search-degraded"}),U!==null&&S(ot,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${U.hits.length} \u4EF6 \xB7 ${In(U.search_metadata.execution_time_ms,"execution_time_ms",a)} ms \xB7 \u54C1\u8CEA: ${Vt[U.search_metadata.quality_tier]}`,testId:"search-results",children:tt(we,{gap:"space-4",testId:"search-results-body",children:[S(wt,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:S(it,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([f,ve])=>S(He,{tone:U.search_metadata.executed_tiers[f]?"success":"neutral",variant:"tint",testId:`search-tier-${f}`,dataAttributes:{"data-ran":U.search_metadata.executed_tiers[f]},children:`${ve} ${U.search_metadata.executed_tiers[f]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},f))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:S(B,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${Gt[U.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${Gt[U.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:S(B,{fg:"fg",type:"body",testId:"search-row-scope",children:U.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:S(B,{fg:"fg",type:"body",testId:"search-column-scope",children:U.authz_scopes.column_scope_applied?U.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${U.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),S(on,{master:S(cn,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:It,itemKey:f=>String(f.rank),selectedKey:m,onSelect:f=>O(String(f.rank)),detailId:r,renderRow:f=>tt(Bi,{children:[S(B,{fg:"fg",type:"body",children:`#${f.rank} ${Xe(ye("file_name"),f.hit.file_name)}`}),S(Fn,{label:`#${f.rank} \u306E\u878D\u5408\u306E\u5024`,value:f.hit.scores.fused,min:0,max:1,valueText:f.hit.scores.fused.toFixed(kt),testId:`search-hit-${f.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:f=>({"data-rank":f.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Ht===null?S(Mn,{id:r,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:S(B,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):$n(Ht.hit,Ht.rank),masterMinPx:Di,detailMinPx:Ai,testId:"search-master-detail"})]})}),S(pn,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:Ce,onOpenChange:Le,testId:"search-inspector",children:tt(we,{gap:"space-4",testId:"search-inspector-body",children:[S(mn,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(en).map(f=>({value:f,label:en[f]})),value:oe,onValueChange:f=>N(f),testId:"search-inspector-view"}),S(On,{label:`\u70B9\u691C\u306E\u7A93: ${en[oe]}`,code:z(oe),testId:"search-inspector-code"}),S(it,{gap:"space-2",testId:"search-inspector-actions",children:S(he,{variant:"secondary",onClick:()=>{ue()},testId:"search-inspector-copy",children:`${en[oe]}\u3092\u5199\u3059`})}),ke!==null&&S(Ge,{occurrence:ke.occurrence,testId:"search-inspector-copy-failure",children:ke.message})]})})]})}import{SEARCH_PARAM_LIMITS as Et}from"@aiquants/enrichment-core";import{useEffect as Hi,useRef as zr,useState as ft}from"react";import{jsx as me,jsxs as Tn}from"react/jsx-runtime";var Vi=4;function Wr(e){return`${e.label} (${e.embeddingModel})`}function Gi(e){let t=e.trim().length;return t<Et.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Et.queryLength.max?`\u554F\u3044\u306F ${Et.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function tu({variants:e,onCompare:t}){let{formatLocale:n}=I(),a=Pt(),[s,r]=ft(null),[l,i]=ft(null),[o,b]=ft(""),[P,T]=ft(Et.limit.default),[u,w]=ft(!1),[D,p]=ft(!1),[E,h]=ft(null),[L,W]=ft(null),ee=zr(0),ie=zr(null);Hi(()=>()=>ie.current?.abort(),[]);let ne=e.map(N=>N.strategyId),q=s!==null&&ne.includes(s)?s:ne[0]??null,se=l!==null&&ne.includes(l)?l:ne[1]??null,xe=q!==null&&q===se,_={query:Gi(o),variant:xe?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},te=u?_.query:void 0,Y=N=>{let X=e.find(M=>M.strategyId===N);return X===void 0?`\u6226\u7565 #${N}`:Wr(X)},Ie=N=>{ee.current+=1,h(null),W({message:N,occurrence:ee.current})},We=async N=>{let X=new AbortController;ie.current=X,p(!0);try{let M=await t(N,X.signal);if(X.signal.aborted)return;let ae=M.results.find(re=>re.strategy_id===N.strategy_ids[0]),ge=M.results.find(re=>re.strategy_id===N.strategy_ids[1]);if(ae===void 0||ge===void 0){Ie(`\u7B54\u3048\u306B\u6226\u7565 #${ae===void 0?N.strategy_ids[0]:N.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}h({input:N,answer:M,results:[ae,ge]}),W(null),a(`\u5909\u7A2E A \u306F ${ae.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${ge.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(M){if(X.signal.aborted)return;Ie(M instanceof Error?M.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{ie.current===X&&(ie.current=null,p(!1))}},De=N=>{N.preventDefault(),w(!0),!(D||q===null||se===null||_.query!==void 0||_.variant!==void 0)&&We({query:o.trim(),strategy_ids:[q,se],limit:P})},Ce=e.map(N=>({value:String(N.strategyId),label:Wr(N)})),Le=(N,X,M,ae,ge)=>N===void 0?me(B,{fg:"fg-muted",type:"body",testId:`compare-${X}-${M}-${ae}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):Tn(we,{gap:"space-1",testId:`compare-${X}-${M}-${ae}`,children:[me(B,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${N.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${N.chunk_index} \xB7 ${N.score.toFixed(Vi)}`}),me(B,{fg:"fg",type:"prose",children:ge||N.text===null?Ct:N.text})]}),oe=({answer:N,results:X})=>{let[M,ae]=X,ge=Ia(M.hits.map(Dn),ae.hits.map(Dn)),re=Array.from({length:Math.max(M.hits.length,ae.hits.length)},(m,O)=>O+1),Me=(m,O)=>({key:O,heading:`\u5909\u7A2E ${O.toUpperCase()}: ${Y(m.strategy_id)} \xB7 ${In(m.execution_ms,`execution_ms of strategy ${m.strategy_id}`,n)} ms`,cells:Object.fromEntries(re.map(de=>[`rank-${de}`,le=>Le(m.hits[de-1],O,de,le,N.text_hidden)]))});return me(ot,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:Tn(we,{gap:"space-4",testId:"compare-results-body",children:[me(wt,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:me(B,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${ge.sharedCount} \u4EF6 (A ${M.hits.length} \u4EF6 / B ${ae.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:me(B,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:ge.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(ge.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:me(B,{fg:"fg",type:"body",testId:"compare-rank-difference",children:ge.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":ge.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:me(B,{fg:"fg",type:"body",testId:"compare-text-hidden",children:N.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[M,"A"],[ae,"B"]].map(([m,O])=>m.dense_ran?null:me(Ve,{tone:"warning",testId:`compare-degraded-${O.toLowerCase()}`,children:me(B,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${O} (${Y(m.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${m.degradation_reasons.map(sn).join(" ")}`})},O)),re.length===0?me(B,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):me(dn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:re.map(m=>({key:`rank-${m}`,label:`${m} \u4F4D`})),columns:[Me(M,"a"),Me(ae,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return Tn(we,{gap:"space-6",testId:"model-comparison-workbench",children:[me(ot,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":D},children:e.length<2?me(Ve,{tone:"info",testId:"compare-variants-insufficient",children:me(B,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):me("form",{onSubmit:De,noValidate:!0,"data-testid":"compare-form",children:Tn(we,{gap:"space-4",testId:"compare-form-fields",children:[me(zt,{label:"\u5909\u7A2E A",value:String(q),options:Ce,onValueChange:N=>r(Number(N)),testId:"compare-variant-a"}),me(zt,{label:"\u5909\u7A2E B",value:String(se),options:Ce,onValueChange:N=>i(Number(N)),error:_.variant,testId:"compare-variant-b"}),me(xt,{label:"\u554F\u3044",type:"search",value:o,onValueChange:b,required:!0,description:`1\u301C${Et.queryLength.max} \u5B57`,error:te,testId:"compare-query"}),me(bt,{label:"\u4EF6\u6570",value:P,min:Et.limit.min,max:Et.limit.max,step:1,valueText:N=>`${N} \u4EF6`,onValueChange:T,testId:"compare-limit"}),me(it,{gap:"space-2",testId:"compare-actions",children:me(he,{variant:"primary",type:"submit",busy:D,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),L!==null&&me(Ge,{occurrence:L.occurrence,testId:"compare-failure",children:L.message}),E!==null&&oe(E)]})}import{jsx as Z,jsxs as J}from"react/jsx-runtime";function Yr(e){return e===null?nn:`${e.length} \u7A2E`}var nn="\u672A\u8A2D\u5B9A";function tn(e,t=""){return e===null?nn:`${e}${t}`}function wn(e){return e===null?nn:`${e} \u4EF6`}function qi(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?nn:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??nn})`}function ru({tenantId:e,ontologyStatus:t}){let n=t.classes,a=t.predicates;return J("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"ontology-status-card",children:[J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[J("div",{children:[J("div",{className:"flex items-center gap-2",children:[Z("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"}),Z("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"}),Z("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:qi(t)})]}),Z("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"})]}),J("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:"," ",Z("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),J("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),Z("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:wn(t.totalConstraints)})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),Z("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:wn(t.searchIndexes)}),J("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",wn(t.totalIndexes)]})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),J("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[tn(t.promotionThresholds.confidence)," / ",tn(t.promotionThresholds.cooccurrence," \u56DE")]})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),Z("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:wn(t.unresolvedCandidatesCount)})]})]})]}),J("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex items-center justify-between pb-3",children:[J("div",{children:[Z("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)"}),Z("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"})]}),Z("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:Yr(n)})]}),J("div",{className:"divide-y divide-solid divide-slate-100",children:[n===null&&Z("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"}),n?.map(s=>J("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${s.name}`,children:[J("div",{children:[Z("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:s.name}),Z("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),typeof s.count=="number"&&Z("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:s.count.toLocaleString()})]},s.name))]})]}),J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex items-center justify-between pb-3",children:[J("div",{children:[Z("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),Z("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"})]}),Z("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:Yr(a)})]}),J("div",{className:"divide-y divide-solid divide-slate-100",children:[a===null&&Z("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"}),a?.map(s=>J("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${s.name}`,children:[J("div",{children:[Z("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:s.name}),Z("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),Z("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:s.direction})]},s.name))]})]})]}),J("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:[Z("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"}),J("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),J("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",tn(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",tn(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",tn(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),Z("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"})]}),J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),J("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",Z("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"]})]})]})]})]})}import{DOCUMENT_KIND_LABELS as _t,DOCUMENT_KINDS as Pn,flowFor as ed,flowStepGates as jr,MIME_KIND_RULES as td,PIPELINE_STEPS as ga}from"@aiquants/enrichment-core";import{useEffect as nd,useId as an,useRef as Ln,useState as ya}from"react";import{ceil8 as zi,textWidthEm as Wi}from"@aiquants/console-ui/core";import{orderedSteps as Yi,PIPELINE_STEPS as Xi}from"@aiquants/enrichment-core";var Bt={inset:12,labelFontSize:13,captionFontSize:11},Rt={offset:3,stroke:2},ji={node:{width:zi(Math.max(...Object.values(Xi).map(e=>Wi(e.label)))*Bt.labelFontSize+2*Bt.inset),height:56},gap:{column:48,row:24},padding:24};function yt(e){return Math.round(e*1e3)/1e3}function Ji(e){let t=new Map;for(let n of e){let a=n.dependsOn.reduce((s,r)=>Math.max(s,t.get(r)),-1);t.set(n.step,a+1)}return t}function fa(e,t){return`${e}->${t}`}function Qi(e,t){let n=[],a=new Map;return{slots:[...e.map(r=>{let l=t.get(r.step),i=r.dependsOn.map(o=>{let b=[],P=o;for(let T=t.get(o)+1;T<l;T+=1){let u=`${fa(o,r.step)}@${T}`;n.push({id:u,rank:T,predecessors:[P]}),b.push(u),P=u}return a.set(fa(o,r.step),b),P});return{id:r.step,rank:l,predecessors:i}}),...n],chains:a}}function Zi(e){let t=new Map,n=Math.max(...e.map(a=>a.rank));for(let a=0;a<=n;a+=1){let r=e.filter(l=>l.rank===a).map((l,i)=>{let o=a===0?i:l.predecessors.reduce((b,P)=>b+t.get(P),0)/l.predecessors.length;return{slot:l,barycenter:o}});r.sort((l,i)=>l.barycenter-i.barycenter),r.forEach(({slot:l},i)=>{t.set(l.id,i)})}return t}function Xr(e,t=ji){let n=Yi(e),a=Ji(n),{slots:s,chains:r}=Qi(n,a),l=Zi(s),{node:i,gap:o,padding:b}=t,P=L=>({x:yt(b+L.rank*(i.width+o.column)),y:yt(b+l.get(L.id)*(i.height+o.row))}),T=new Map(s.map(L=>[L.id,P(L)])),u=n.map(L=>{let W=T.get(L.step);return{key:L.step,x:W.x,y:W.y,rank:a.get(L.step),order:l.get(L.step),width:i.width,height:i.height}}),w=L=>yt(L+i.height/2),D=n.flatMap(L=>L.dependsOn.map(W=>{let ee=T.get(W),ie=T.get(L.step),ne=yt(ee.x+i.width),q=w(ee.y),se=`M ${ne} ${q}`,xe=(_,te)=>{let Y=yt((ne+_)/2);se+=` C ${Y} ${q}, ${Y} ${te}, ${_} ${te}`};for(let _ of r.get(fa(W,L.step))){let te=T.get(_),Y=w(te.y);xe(te.x,Y),ne=yt(te.x+i.width),q=Y,se+=` L ${ne} ${q}`}return xe(ie.x,w(ie.y)),{from:W,to:L.step,path:se}})),p=[...T.values()],E=yt(Math.max(...p.map(L=>L.x+i.width))+b),h=yt(Math.max(...p.map(L=>L.y+i.height))+b);return{width:E,height:h,steps:u,edges:D}}import{Fragment as Zr,jsx as C,jsxs as K}from"react/jsx-runtime";var es="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Jr={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},ad={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},ts={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"}},ns={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"},rd={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},rn="rgb(248 250 252)",sd={backgroundColor:rn,backgroundImage:`linear-gradient(to right, ${rn}, ${rn}), linear-gradient(to right, ${rn}, ${rn}), 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 as(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function od(e,t){let n=e.map(a=>({gate:a,state:as(a,t)}));return n.some(({gate:a,state:s})=>s==="closed"&&a.whenClosed==="fail")?"closed-fail":n.some(({state:a})=>a==="closed")?"closed-skip":n.some(({state:a})=>a==="unmeasured")?"unmeasured":"open"}function Qr(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function id(e,t){let{badge:n}=ts[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${ns[t]}`}function dd(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 ba(e){return e.map(t=>ga[t].label).join("\u3001")}function ld(e){return e.dependsOn.length===0?es:`\u4F9D\u5B58: ${ba(e.dependsOn)}`}function yu({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:a,onSelectKind:s,selectedStepKey:r,onSelectStep:l}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let i=an(),o=an(),b=an(),P=an(),T=an(),[u,w]=ya(Pn[0]),[D,p]=ya(null),[E,h]=ya(null),L=Ln(new Map),W=Ln(new Map),ee=Ln(null),ie=Ln(null),{labels:ne}=I(),q=a!==void 0?a:u,se=r!==void 0?r:D,xe=ed(q),_=Xr(xe),te=new Map(xe.steps.map(m=>[m.step,m])),Y=m=>{p(m),l?.(m)},Ie=m=>{w(m),s?.(m),Y(null)},We=(m,O)=>{let de=Pn.length-1,le;switch(m.key){case"ArrowRight":le=O===de?0:O+1;break;case"ArrowLeft":le=O===0?de:O-1;break;case"Home":le=0;break;case"End":le=de;break;default:return}m.preventDefault();let ke=Pn[le];Ie(ke),L.current.get(ke)?.focus()},De=m=>{let O=ie.current;if(Y(null),O?.isConnected){O.focus();return}W.current.get(m)?.focus()},Ce=m=>{Y(m===se?null:m)},Le=(m,O)=>{m.currentTarget.focus(),Ce(O)},oe=(m,O)=>{m.key==="Enter"||m.key===" "?(m.preventDefault(),Ce(O)):m.key==="Escape"&&Y(null)},N=se===null?void 0:te.get(se),X=N===void 0?null:N.step;nd(()=>{if(X===null){ie.current=null;return}let m=document.activeElement;(m instanceof HTMLElement||m instanceof SVGElement)&&m!==document.body&&ee.current?.contains(m)===!1&&(ie.current=m)},[X]);let M=N===void 0?void 0:ga[N.step],ae=N===void 0?[]:jr(N),ge=N===void 0?[]:xe.steps.filter(m=>m.dependsOn.includes(N.step)).map(m=>m.step),re=M===void 0?void 0:t.find(m=>m.documentKind===q&&m.stepKey===M.key),Me=_t[q];return K("section",{"data-cui-migration":"pending",className:"space-y-6","aria-labelledby":i,"data-testid":"pipeline-flow-viewer","data-kind":q,children:[K("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[C("h2",{id:i,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),C("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"}),C("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:Pn.map((m,O)=>{let de=m===q;return C("button",{ref:le=>{le===null?L.current.delete(m):L.current.set(m,le)},type:"button",role:"tab","aria-selected":de,"aria-controls":o,tabIndex:de?0:-1,onClick:()=>Ie(m),onKeyDown:le=>We(le,O),className:de?"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-${m}`,children:_t[m]},m)})}),C("div",{id:o,role:"tabpanel","aria-label":`${_t[q]} \u306E\u6D41\u308C`,"aria-describedby":b,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:sd,"data-testid":"flow-scroll",children:K("svg",{viewBox:`0 0 ${_.width} ${_.height}`,width:_.width,height:_.height,role:"group","aria-label":`${_t[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[C("title",{children:`${_t[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),C("defs",{children:C("marker",{id:`${o}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:C("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),_.edges.map(m=>C("path",{d:m.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${o}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${m.from}-${m.to}`},`${m.from}-${m.to}`)),_.steps.map(m=>{let O=ga[m.key],de=te.get(m.key),le=jr(de),ke=od(le,e),Be=Qr(le),Oe=ts[ke],nt=id(ke,Be),Te=m.key===se,at=m.key===E,Ae=`${o}-depends-${m.key}`;return K("g",{ref:Fe=>{Fe===null?W.current.delete(m.key):W.current.set(m.key,Fe)},transform:`translate(${m.x} ${m.y})`,role:"button",tabIndex:0,"aria-label":`${O.label} (${nt})`,"aria-describedby":Ae,"aria-expanded":Te,"aria-controls":Te?T:void 0,onClick:Fe=>Le(Fe,m.key),onKeyDown:Fe=>oe(Fe,m.key),onFocus:()=>h(m.key),onBlur:()=>h(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${m.key}`,"data-step-key":m.key,"data-gate-state":ke,"data-gate-policy":Be,"data-selected":Te,"data-focused":at,children:[C("desc",{id:Ae,"data-testid":`flow-node-dependencies-${m.key}`,children:ld(de)}),at&&C("rect",{x:-Rt.offset,y:-Rt.offset,width:m.width+2*Rt.offset,height:m.height+2*Rt.offset,rx:8+Rt.offset,fill:"none",strokeWidth:Rt.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${m.key}`}),C("rect",{width:m.width,height:m.height,rx:8,strokeWidth:Te?3:1.5,strokeDasharray:Oe.dash,className:`${Oe.stroke} ${Te?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${m.key}`}),C("text",{x:Bt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${m.key}`,children:O.label}),C("text",{x:Bt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${m.key}`,children:Jr[O.phase]}),C("text",{x:Bt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${m.key}`,"data-gate-state":ke,children:nt})]},m.key)})]})}),K("p",{id:b,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",_.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"]})]}),M!==void 0&&N!==void 0&&K("section",{id:T,ref:ee,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":P,"data-testid":"flow-step-detail","data-step-key":M.key,children:[K("div",{className:"flex items-start justify-between gap-4",children:[K("div",{children:[C("h3",{id:P,className:"font-bold text-base text-slate-900",children:M.label}),C("p",{className:"mt-1 text-[13px] text-slate-600",children:M.description})]}),C("button",{type:"button",onClick:()=>De(M.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"})]}),K("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),C("dd",{children:C("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:M.endpoint})})]}),K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),K("dd",{"data-testid":"flow-step-phase",children:[Jr[M.phase]," (",M.phase,")"]})]}),K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),C("dd",{"data-testid":"flow-step-capability",children:M.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":M.capability})]}),N.chunkSource!==void 0&&K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),K("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":N.chunkSource,children:[ad[N.chunkSource]," (",N.chunkSource,")"]})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),C("dd",{"data-testid":"flow-step-depends-on",children:N.dependsOn.length===0?es:ba(N.dependsOn)})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),C("dd",{"data-testid":"flow-step-dependents",children:ge.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":ba(ge)})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),C("dd",{children:ae.length===0?C("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):K(Zr,{children:[C("ul",{className:"space-y-1",children:ae.map(m=>{let O=as(m,e);return K("li",{"data-testid":`flow-gate-${m.featureFlagKey}`,"data-gate-state":O,"data-when-closed":m.whenClosed,children:[C("code",{className:"font-mono",children:m.featureFlagKey}),": ",rd[O]," \u2014 ",dd(m)]},m.featureFlagKey)})}),N.gatePolicy!==void 0&&K("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Me," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",ns[Qr(M.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",N.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),K("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":q,children:[K("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Me,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),K("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Me," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \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"]}),re===void 0?K("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[ne.unmeasured," (",Me," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):K(Zr,{children:[K("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[K("div",{children:[C("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),C("dd",{"data-testid":"flow-metric-sample-count",children:C(Q,{value:re.sampleCount,testId:"flow-metric-sample-count-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u6210\u529F"}),C("dd",{"data-testid":"flow-metric-succeeded",children:C(Q,{value:re.succeeded,testId:"flow-metric-succeeded-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u5931\u6557"}),C("dd",{"data-testid":"flow-metric-failed",children:C(Q,{value:re.failed,testId:"flow-metric-failed-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u7701\u7565"}),C("dd",{"data-testid":"flow-metric-skipped",children:C(Q,{value:re.skipped,testId:"flow-metric-skipped-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"p50"}),C("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:C(Q,{value:re.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"p95"}),C("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:C(Q,{value:re.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),K("div",{className:"col-span-2",children:[C("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),C("dd",{"data-testid":"flow-metric-last-started-at",children:C(fe,{iso:re.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),K("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 ",ne.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"]})]})]})]}),K("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[C("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),K("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",C("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",_t.other,"\u300D\u3067\u3059\u3002"]}),C("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:K("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[C("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:K("tr",{children:[C("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),C("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),C("tbody",{className:"divide-y divide-solid divide-slate-100",children:td.map(([m,O],de)=>K("tr",{className:O===q?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${de}`,"data-kind":O,"data-selected":O===q,children:[C("td",{className:"px-3 py-2",children:C("code",{className:"font-mono",children:m})}),C("td",{className:"px-3 py-2",children:_t[O]})]},m))})]})})]})]})}import{cssVar as va}from"@aiquants/console-ui/core";import{useId as cd}from"react";import{Fragment as vd,jsx as F,jsxs as Ee}from"react/jsx-runtime";function ud(e,t){return e==null?null:pt(e,"segment_count",t)}function rs(e,t,n){return e==null?null:Cn(e,t,n)}function pd(e){let t=e.probe_failure;if(t===null)return null;if(!Xt.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 ss(e,t,n){return e.reduce((a,s)=>a+pt(s[t],`${t} of collection ${s.collection_name}`,n),0)}var md=va("space-1"),fd={padding:0,height:"1px",color:"#1e293b"},yd={display:"flex",height:"100%"},gd={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},bd={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},xd={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},xa={whiteSpace:"nowrap"},os=va("space-3"),hd=va("info-tint"),ha={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function is(e,t){return`vectors_config.${e}.size of collection ${t}`}function _u({overview:e,health:t,resources:n,onRefresh:a,isRefreshing:s=!1,selection:r}){let{formatLocale:l}=I(),i=cd(),{collections:o}=e,b=pd(e),P=b===null,T=P?ss(o,"points_count",l):null,u=P?ss(o,"vectors_count",l):null,w=rs(n?.ram_bytes,"ram_bytes",l),D=rs(n?.disk_bytes,"disk_bytes",l),p=ud(n?.segment_count,l);return Ee("div",{"data-cui-migration":"pending","data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[Ee("div",{"data-testid":"qdrant-card-header",style:bd,children:[Ee("div",{"data-testid":"qdrant-card-title-group",style:xd,children:[F("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&&Ee(vd,{children:[F("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Kt[t.healthy?"connected":"error"],style:{...xa,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ut[t.healthy?"connected":"error"]}),Ee("span",{"data-testid":"qdrant-latency",style:{...xa,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",F(Q,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),a&&F("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:s,onClick:a,style:{...xa,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:s?"not-allowed":"pointer",fontSize:"13px"},children:s?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),Ee("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),F("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:T,testId:"qdrant-total-points-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),F("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:u,testId:"qdrant-total-vectors-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),F("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Ke,{text:w,testId:"qdrant-ram-usage-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),F("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Ke,{text:D,testId:"qdrant-disk-usage-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),F("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:p,testId:"qdrant-segment-count-value"})})]})]}),Ee("div",{children:[Ee("h3",{id:i,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",F(Q,{value:P?o.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),b!==null?F("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:b}):o.length===0?F("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"}):F("section",{tabIndex:0,"aria-labelledby":i,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:md},children:Ee("table",{"aria-labelledby":i,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[F("thead",{children:Ee("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[F("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${os}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),F("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),F("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),F("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),F("tbody",{children:o.map(E=>{let h=r!==void 0&&E.collection_name===r.selectedCollectionName,L=F("span",{style:gd,children:E.collection_name}),{dense:W,sparse:ee,image:ie}=E.vectors_config,ne=W===void 0?null:pt(W.size,is("dense",E.collection_name),l),q=ie===void 0?null:pt(ie.size,is("image",E.collection_name),l);return Ee("tr",{"data-testid":`collection-row-${E.collection_name}`,"data-collection-name":E.collection_name,"data-selected":String(h),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:h?hd:"transparent"},children:[r===void 0?F("td",{style:{padding:`8px ${os}`,color:"#1e293b"},children:L}):F("td",{style:fd,children:F("div",{style:yd,children:F(ka,{selected:h,controls:r.detailId,onSelect:()=>r.onSelectCollection(E.collection_name),testId:`collection-select-${E.collection_name}`,children:L})})}),F("td",{style:{padding:"8px",color:"#475569"},children:E.domain_key}),F("td",{"data-testid":`collection-points-${E.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:F(Q,{value:E.points_count,testId:`collection-points-value-${E.collection_name}`})}),F("td",{style:{padding:"8px"},children:Ee("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[ne!==null&&Ee("span",{"data-testid":`vector-tag-dense-${E.collection_name}`,style:{...ha,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",F(Q,{value:ne,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${E.collection_name}`})]}),ee!==void 0&&F("span",{"data-testid":`vector-tag-sparse-${E.collection_name}`,style:{...ha,backgroundColor:"#fef3c7",color:"#92400e"},children:ee.modifier?`Sparse (${ee.modifier.toUpperCase()})`:"Sparse"}),q!==null&&Ee("span",{"data-testid":`vector-tag-image-${E.collection_name}`,style:{...ha,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",F(Q,{value:q,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${E.collection_name}`})]})]})})]},E.collection_name)})})]})})]})]})}import{jsx as H,jsxs as Pe}from"react/jsx-runtime";var Sd="\u5BFE\u8C61\u306A\u3057";function Pu({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:a,onRetryItem:s,isRetrying:r=!1,onRefresh:l,listRefusal:i}){I();let o=e.SYNCED??0,b=e.PENDING??0,P=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),T=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),u=t>0?`${(o/t*100).toFixed(1)}%`:Sd;return Pe("div",{"data-cui-migration":"pending","data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[Pe("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[Pe("div",{children:[H("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"}),Pe("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",H("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",H("span",{"data-testid":"success-rate-value",children:u}),")"]})]}),Pe("div",{style:{display:"flex",gap:"8px"},children:[l&&H("button",{type:"button","data-testid":"sync-refresh-button",onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),a&&H("button",{type:"button","data-testid":"retry-all-button",disabled:r||T===0,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:r||T===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:r||T===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:r?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),Pe("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[Pe("div",{"data-testid":"status-card-synced","data-count":o,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[H("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),H("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:o})]}),Pe("div",{"data-testid":"status-card-processing","data-count":P,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[H("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),H("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:P})]}),Pe("div",{"data-testid":"status-card-pending","data-count":b,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[H("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),H("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:b})]}),Pe("div",{"data-testid":"status-card-failed","data-count":T,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[H("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),H("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:T})]})]}),Pe("div",{"data-testid":"failed-items-section",children:[Pe("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",i!==void 0?"":` (${n.length<T?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${T} \u4EF6`:`${n.length} \u4EF6`})`]}),i!==void 0?H(Ve,{tone:"warning",testId:"failed-items-refused",children:i}):n.length===0?H("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"}):H("div",{style:{overflowX:"auto"},children:Pe("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[H("thead",{children:Pe("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[H("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),H("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),H("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),H("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),H("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),H("tbody",{children:n.map((w,D)=>{if(w.kind==="restricted")return Pe("tr",{"data-testid":`failed-item-restricted-${D}`,"data-restricted-mark":"failure",children:[H("td",{"data-testid":`failed-item-restricted-text-${D}`,style:{padding:"8px"},children:$t}),H("td",{style:{padding:"8px"},children:H("span",{"data-testid":`failed-item-restricted-status-${D}`,style:{fontSize:"11px"},children:w.syncStatus})}),H("td",{style:{padding:"8px"}}),H("td",{"data-testid":`failed-item-restricted-time-${D}`,style:{padding:"8px",whiteSpace:"nowrap"},children:w.failedAt===null?"\u8A18\u9332\u306A\u3057":H(fe,{iso:w.failedAt,testId:`failed-item-restricted-time-value-${D}`})}),H("td",{style:{padding:"8px"}})]},`restricted:${D}`);let p=w.item;return Pe("tr",{"data-testid":`failed-item-row-${p.id}`,"data-file-uri":p.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[Pe("td",{"data-testid":`failed-item-uri-${p.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[H("div",{style:{fontWeight:600,color:"#0f172a"},children:p.file_name}),H("div",{style:{fontSize:"11px",color:"#64748b"},children:p.file_uri})]}),H("td",{style:{padding:"8px"},children:H("span",{"data-testid":`failed-item-status-${p.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:p.sync_status})}),H("td",{"data-testid":`failed-item-error-${p.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:p.error_message??"",children:p.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),H("td",{"data-testid":`failed-item-time-${p.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:p.failed_at===null?"\u8A18\u9332\u306A\u3057":H(fe,{iso:p.failed_at,testId:`failed-item-time-value-${p.id}`})}),H("td",{style:{padding:"8px",textAlign:"right"},children:s&&H("button",{type:"button","data-testid":`retry-item-button-${p.id}`,"aria-label":`${p.file_name} (${p.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:r,onClick:()=>s(p.id,p.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:r?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${p.id}`)})})]})})]})]})}export{Gt as BREAKER_STATE_LABELS,Da as CHUNKING_ONLY_NOTE,Pa as CHUNK_BODY_FIDELITY_LABELS,Un as CHUNK_CHANGE_KIND_LABELS,ad as CHUNK_SOURCE_LABELS,Pi as CONFIDENTIALITY_LEVEL_LABELS,Ea as DEGRADATION_REASON_LABELS,Lt as DOCUMENT_STATE_CAUSE_LABELS,wa as DegradedSearchBanner,ll as DocumentChangeFeed,cc as DocumentHistoryInspector,_c as DocumentIngestConsole,Tc as EnrichmentStrategyBoard,ht as FACET_LABELS,Oa as FAILED_RUN_STATE_MARK,fn as FIELD_LABELS,Rt as FLOW_FOCUS_RING,ji as FLOW_GEOMETRY,Bt as FLOW_NODE_TEXT,At as FinishedInstant,ns as GATE_POLICY_LABELS,ts as GATE_STATE_PRESENTATION,Ct as HIDDEN_FIELD_TEXT,dt as HISTORY_REFUSAL,Si as INERT_STAGE_NOTE,Oc as InfrastructureHealthMonitor,Fa as MODEL_ONLY_CHANGE_MARK,Wc as MetadataSearchWorkbench,tu as ModelComparisonWorkbench,eo as NOTHING_TO_READ_LABELS,mi as NO_ENRICHMENT_RECORD_TEXT,Ma as NO_PREVIOUS_RECORD_TEXT,ru as OntologyStatusCard,Jr as PHASE_LABELS,rt as PIPELINE_RUN_STATUS_PRESENTATION,Wn as PIPELINE_STEP_STATUS_PRESENTATION,Yn as PIPELINE_TRIGGER_LABELS,yu as PipelineFlowViewer,Vt as QUALITY_TIER_LABELS,_u as QdrantStorageCard,$t as RESTRICTED_DOCUMENT_TEXT,yn as RESTRICTED_RUN_TEXT,Aa as RESTRICTED_STATE_TEXT,Zs as RUN_TERMINAL_STEP_LABEL,er as RUN_TERMINAL_STEP_OUTCOME_LABELS,fe as RecordedInstant,kt as SCORE_DECIMALS,Vi as SCORE_DISPLAY_DECIMALS,Ra as SEARCH_FUSION_LABELS,st as SEARCH_MODE_LABELS,wi as SEARCH_PRESETS,Pu as SyncStatusMonitor,tr as UNFINISHED_LABEL,Kn as UNRECORDED_RUN_MARK,$a as UNVERIFIED_CHUNK_NOTE,La as WHITESPACE_NORMALIZED_NOTE,sn as degradationReasonText,Za as documentKindLabel,gn as facetCountsText,Yt as fieldLabel,id as gateCaption,as as gateState,Ur as gateStateOf,lt as historyFailedSentence,bn as historyFailureSentence,gi as ingestRowAction,vt as jsonValueText,Xr as layoutFlow,Jt as ledgerStepLabel,ut as pipelineRunPresentationKey,Ia as rankAgreement,Ye as revisionLabel,Bn as revisionTransitionText,nr as skipReasonLabel,Qr as stepGatePolicy,od as stepGateState,Ua as unrecordedRunsMark,Dn as variantHitKey,_a as vectorScoreText};
3
+ `)}function je(e,t){return e?Ct:t===null||t===""?"\u7121\u3057":String(t)}function Wc({tenantId:e,onSearch:t,initialParams:n}){let{formatLocale:a}=I(),s=Pt(),r=Ti(),[l,i]=be(n?.q??""),[o,b]=be(n?.mode??"HYBRID"),[P,T]=be(n?.limit??Ne.limit.default),[u,w]=be(n?.threshold??$i),[D,p]=be(n?.fusion??"rrf"),[R,x]=be(n?.rrf_k??Ne.rrfK.default),[L,W]=be(n?.alpha??Ne.alpha.default),[ee,ie]=be(n?.confidentiality_level??ma),[ne,q]=be(n?.department_id===void 0?"":String(n.department_id)),[se,xe]=be(n?.mime_type??""),[_,te]=be(n?.tag??""),[Y,Ie]=be(!1),[Ye,$e]=be(!1),[Ce,ke]=be(!1),[oe,E]=be("request"),[X,M]=be(!1),[ae,ge]=be(!1),[re,Me]=be(null),[m,O]=be(null),[de,le]=be(null),[Te,Be]=be(null),Oe=pa(0),nt=pa(0),we=pa(null);ki(()=>()=>we.current?.abort(),[]);let at={query:Mi(l),department:Oi(ne),mimeType:zr("MIME \u30BF\u30A4\u30D7",se),tag:zr("\u30BF\u30B0",_)},Ae=X?at:{},Fe=()=>{let f=ne.trim(),ve=se.trim(),d=_.trim();return{q:l.trim(),mode:o,limit:P,...o==="DENSE"?{threshold:u}:{},...o==="HYBRID"?{fusion:D,rrf_k:R,...D==="linear"?{alpha:L}:{}}:{},...ee===ma?{}:{confidentiality_level:ee},...f===""?{}:{department_id:Number(f)},...ve===""?{}:{mime_type:ve},...d===""?{}:{tag:d}}},y=async f=>{let ve=new AbortController;we.current=ve,ge(!0);try{let d=await t(f,ve.signal);if(ve.signal.aborted)return;Me({params:f,answer:d}),O(d.hits.length===0?null:"1"),le(null),s(d.hits.length===0?"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002":`${d.hits.length} \u4EF6\u306E\u6587\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002`)}catch(d){if(ve.signal.aborted)return;Oe.current+=1,le({message:d instanceof Error?d.message:"\u691C\u7D22\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",occurrence:Oe.current})}finally{we.current===ve&&(we.current=null,ge(!1))}},k=f=>{f.preventDefault(),M(!0),!(ae||Object.values(at).some(ve=>ve!==void 0))&&y(Fe())},$=f=>{b(f.params.mode),T(f.params.limit),f.params.threshold!==void 0&&w(f.params.threshold),f.params.fusion!==void 0&&p(f.params.fusion),f.params.rrf_k!==void 0&&x(f.params.rrf_k),s(`\u30D7\u30EA\u30BB\u30C3\u30C8\u300C${f.title}\u300D\u3092\u5F53\u3066\u307E\u3057\u305F\u3002`)},z=f=>{if(re===null)return Li;switch(f){case"request":return JSON.stringify(re.params,null,2);case"response":return JSON.stringify(re.answer,null,2);case"flow":return Ui(re);case"graph":return Ki(re)}},ue=async()=>{try{await navigator.clipboard.writeText(z(oe)),Be(null),s(`${en[oe]}\u3092\u5199\u3057\u307E\u3057\u305F\u3002`)}catch(f){nt.current+=1,Be({message:`\u5199\u305B\u307E\u305B\u3093\u3067\u3057\u305F: ${f instanceof Error?f.message:String(f)}`,occurrence:nt.current})}},U=re?.answer??null,ye=f=>U?.authz_scopes.hidden_columns.includes(f)===!0,It=U===null?[]:U.hits.map((f,ve)=>({hit:f,rank:ve+1})),Ht=It.find(f=>String(f.rank)===m)??null,$n=(f,ve)=>{let d=f.scores;return N(Mn,{id:r,title:`#${ve} ${je(ye("file_name"),f.file_name)}`,region:!0,testId:"search-hit-detail",children:tt(Pe,{gap:"space-4",testId:"search-hit-detail-body",children:[N(wt,{items:[{key:"fused",term:"\u878D\u5408\u306E\u5024",description:N(Fn,{label:"\u878D\u5408\u306E\u5024",value:d.fused,min:0,max:1,valueText:d.fused.toFixed(kt),testId:"search-hit-detail-fused"})},{key:"vector",term:"\u30D9\u30AF\u30C8\u30EB\u306E\u5024",description:N(B,{fg:"fg",type:"body",children:d.vector===null?"\u30D9\u30AF\u30C8\u30EB\u306E\u5217\u306B\u7121\u3044":_a(d.vector)})},{key:"lexical",term:"\u8A9E\u53E5\u306E\u9806\u4F4D\u306E\u5024",description:N(B,{fg:"fg",type:"body",children:d.lexical_rank===null?"\u8A9E\u53E5\u306E\u5217\u306B\u7121\u3044":d.lexical_rank.toFixed(kt)})},{key:"graph",term:"\u30B0\u30E9\u30D5\u306E\u9806\u4F4D\u306E\u5024",description:N(B,{fg:"fg",type:"body",children:d.graph_rank===null?"\u30B0\u30E9\u30D5\u306E\u5217\u306B\u7121\u3044":d.graph_rank.toFixed(kt)})}],testId:"search-hit-scores"}),N(wt,{items:[{key:"file_uri",term:"URI",description:N(B,{fg:"fg",type:"body",face:"mono",children:je(ye("file_uri"),f.file_uri)})},{key:"mime_type",term:"MIME \u30BF\u30A4\u30D7",description:N(B,{fg:"fg",type:"body",children:je(ye("mime_type"),f.mime_type)})},{key:"folder_path",term:"\u30D5\u30A9\u30EB\u30C0",description:N(B,{fg:"fg",type:"body",children:je(ye("folder_path"),f.folder_path)})},{key:"confidentiality_level",term:"\u6A5F\u5BC6\u533A\u5206",description:N(B,{fg:"fg",type:"body",children:je(ye("confidentiality_level"),f.confidentiality_level)})},{key:"department_id",term:"\u90E8\u7F72",description:N(B,{fg:"fg",type:"body",children:je(ye("department_id"),f.department_id)})},{key:"created_by",term:"\u767B\u9332\u8005",description:N(B,{fg:"fg",type:"body",children:je(ye("created_by"),f.created_by)})},{key:"mtime",term:"\u66F4\u65B0",description:ye("mtime")?N(B,{fg:"fg",type:"body",children:Ct}):N(fe,{iso:f.mtime,testId:"search-hit-mtime-value"})},{key:"tags",term:"\u30BF\u30B0",description:ye("tags")||f.tags===null||f.tags.length===0?N(B,{fg:"fg",type:"body",children:je(ye("tags"),null)}):N(it,{gap:"space-2",testId:"search-hit-tags",children:f.tags.map(S=>N(Ve,{tone:"neutral",variant:"tint",testId:`search-hit-tag-${S}`,children:S},S))})},{key:"ai_summary",term:"AI \u306E\u8981\u7D04",description:N(B,{fg:"fg",type:"prose",children:je(ye("ai_summary"),f.ai_summary)})}],testId:"search-hit-fields"}),tt(Pe,{gap:"space-2",testId:"search-hit-relations",children:[N(B,{as:"p",fg:"fg-secondary",type:"body",children:"\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2"}),f.graph_relations===null?N(B,{as:"p",fg:"fg",type:"prose",children:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u639B\u304B\u308B\u305F\u3081\u793A\u3057\u307E\u305B\u3093 (\u95A2\u4FC2\u306E\u5148\u306F\u884C\u306E\u8A8D\u53EF\u3092\u901A\u3063\u3066\u3044\u307E\u305B\u3093)\u3002"}):f.graph_relations.length===0?N(B,{as:"p",fg:"fg",type:"prose",children:"\u7121\u3057"}):N("ul",{"data-testid":"search-hit-relation-list",children:f.graph_relations.map(S=>N("li",{children:N(B,{fg:"fg",type:"body",children:`${S.relation} \u2192 ${S.target_name}`})},`${S.relation}-${S.target_name}`))})]}),ye("structured_data")||f.structured_data===null?N(B,{as:"p",fg:"fg",type:"prose",testId:"search-hit-structured-absent",children:`\u69CB\u9020\u5316\u30C7\u30FC\u30BF: ${je(ye("structured_data"),null)}`}):N(On,{label:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",code:JSON.stringify(f.structured_data,null,2),testId:"search-hit-structured"})]})})};return tt(Pe,{gap:"space-6",testId:"metadata-search-workbench",children:[N(ot,{title:"\u6587\u66F8\u306E\u691C\u7D22",description:`\u30C6\u30CA\u30F3\u30C8 ${e} \u306E\u6587\u66F8\u3092\u3001\u8A9E\u53E5\u30FB\u30D9\u30AF\u30C8\u30EB\u30FB\u30B0\u30E9\u30D5\u306E\u5C64\u3067\u63A2\u3057\u307E\u3059\u3002`,testId:"search-query-card",dataAttributes:{"data-mode":o,"data-running":ae},children:N("form",{onSubmit:k,noValidate:!0,"data-testid":"search-form",children:tt(Pe,{gap:"space-4",testId:"search-form-fields",children:[N(xt,{label:"\u691C\u7D22\u8A9E",type:"search",value:l,onValueChange:i,required:!0,description:`1\u301C${Ne.queryLength.max} \u5B57`,error:Ae.query,testId:"search-query"}),N(mn,{label:"\u691C\u7D22\u306E\u6226\u7565",options:Ci.map(f=>({value:f,label:st[f].label})),value:o,onValueChange:f=>b(f),testId:"search-mode"}),N(B,{as:"p",fg:"fg-secondary",type:"prose",testId:"search-mode-description",children:st[o].description}),N(bt,{label:"\u4EF6\u6570",value:P,min:Ne.limit.min,max:Ne.limit.max,step:1,valueText:f=>`${f} \u4EF6`,onValueChange:T,testId:"search-limit"}),o==="DENSE"&&N(bt,{label:"\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650",value:u,min:Ne.threshold.min,max:Ne.threshold.max,step:.01,valueText:f=>f.toFixed(2),onValueChange:w,testId:"search-threshold"}),o==="HYBRID"&&tt(Pe,{gap:"space-4",testId:"search-fusion-controls",children:[N(mn,{label:"\u878D\u5408",options:Ii.map(f=>({value:f,label:Ra[f]})),value:D,onValueChange:f=>p(f),testId:"search-fusion"}),N(bt,{label:"\u9806\u4F4D\u306E\u5024\u306E k",value:R,min:Ne.rrfK.min,max:Ne.rrfK.max,step:1,valueText:String,onValueChange:x,testId:"search-rrf-k"}),D==="linear"&&N(bt,{label:"\u30D9\u30AF\u30C8\u30EB\u306E\u91CD\u307F (\u03B1)",value:L,min:Ne.alpha.min,max:Ne.alpha.max,step:.05,valueText:f=>f.toFixed(2),onValueChange:W,testId:"search-alpha"})]}),N(pn,{summary:"\u8A73\u3057\u3044\u6761\u4EF6",open:Y,onOpenChange:Ie,testId:"search-filters",children:tt(Pe,{gap:"space-4",testId:"search-filter-fields",children:[N(zt,{label:"\u6A5F\u5BC6\u533A\u5206",value:ee,options:[{value:ma,label:"\u5168\u3066\u306E\u533A\u5206"},..._i.map(f=>({value:f,label:Pi[f]}))],onValueChange:ie,testId:"search-confidentiality"}),N(xt,{label:"\u90E8\u7F72\u306E ID",type:"text",value:ne,onValueChange:q,description:"1 \u4EE5\u4E0A\u306E\u6574\u6570",error:Ae.department,testId:"search-department"}),N(xt,{label:"MIME \u30BF\u30A4\u30D7 (\u542B\u3080\u4E00\u81F4)",type:"text",value:se,onValueChange:xe,error:Ae.mimeType,testId:"search-mime-type"}),N(xt,{label:"\u30BF\u30B0 (\u5B8C\u5168\u4E00\u81F4)",type:"text",value:_,onValueChange:te,error:Ae.tag,testId:"search-tag"})]})}),N(pn,{summary:"\u958B\u767A\u8005\u306E\u30D7\u30EA\u30BB\u30C3\u30C8",open:Ye,onOpenChange:$e,testId:"search-presets",children:N(Pe,{gap:"space-2",testId:"search-preset-list",children:wi.map(f=>tt(it,{gap:"space-2",testId:`search-preset-${f.id}`,children:[N(he,{variant:"secondary",onClick:()=>$(f),testId:`search-preset-${f.id}-apply`,children:f.title}),N(B,{fg:"fg-secondary",type:"body",children:f.description})]},f.id))})}),N(it,{gap:"space-2",testId:"search-actions",children:N(he,{variant:"primary",type:"submit",busy:ae,busyLabel:"\u691C\u7D22\u3057\u3066\u3044\u307E\u3059",testId:"search-submit",children:"\u691C\u7D22\u3059\u308B"})})]})})}),de!==null&&N(qe,{occurrence:de.occurrence,testId:"search-failure",children:de.message}),U!==null&&N(wa,{metadata:U.search_metadata,testId:"search-degraded"}),U!==null&&N(ot,{title:"\u691C\u7D22\u306E\u7D50\u679C",description:`${U.hits.length} \u4EF6 \xB7 ${In(U.search_metadata.execution_time_ms,"execution_time_ms",a)} ms \xB7 \u54C1\u8CEA: ${Vt[U.search_metadata.quality_tier]}`,testId:"search-results",children:tt(Pe,{gap:"space-4",testId:"search-results-body",children:[N(wt,{items:[{key:"tiers",term:"\u8D70\u3063\u305F\u5C64",description:N(it,{gap:"space-2",testId:"search-tiers",children:[["lexical","\u8A9E\u53E5"],["sparse","\u758E\u30D9\u30AF\u30C8\u30EB"],["dense","\u5BC6\u30D9\u30AF\u30C8\u30EB"],["graph","\u30B0\u30E9\u30D5"]].map(([f,ve])=>N(Ve,{tone:U.search_metadata.executed_tiers[f]?"success":"neutral",variant:"tint",testId:`search-tier-${f}`,dataAttributes:{"data-ran":U.search_metadata.executed_tiers[f]},children:`${ve} ${U.search_metadata.executed_tiers[f]?"\u8D70\u3063\u305F":"\u8D70\u3089\u306A\u304B\u3063\u305F"}`},f))})},{key:"breakers",term:"\u906E\u65AD\u5668",description:N(B,{fg:"fg",type:"body",testId:"search-breakers",children:`\u30D9\u30AF\u30C8\u30EB ${Gt[U.search_metadata.circuit_breaker_status.vector]} \xB7 \u30B0\u30E9\u30D5 ${Gt[U.search_metadata.circuit_breaker_status.graph]}`})},{key:"rows",term:"\u884C\u306E\u30B9\u30B3\u30FC\u30D7",description:N(B,{fg:"fg",type:"body",testId:"search-row-scope",children:U.authz_scopes.row_scope_applied?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u8AAD\u3081\u306A\u3044\u6587\u66F8\u306F\u4E00\u89A7\u306B\u542B\u307F\u307E\u305B\u3093)":"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})},{key:"columns",term:"\u5217\u306E\u30B9\u30B3\u30FC\u30D7",description:N(B,{fg:"fg",type:"body",testId:"search-column-scope",children:U.authz_scopes.column_scope_applied?U.authz_scopes.hidden_columns.length===0?"\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u7B54\u3048\u306E\u6B04\u306B\u4F0F\u305B\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093)":`\u639B\u304B\u3063\u3066\u3044\u307E\u3059 (\u4F0F\u305B\u305F\u6B04: ${U.authz_scopes.hidden_columns.join("\u30FB")})`:"\u639B\u304B\u3063\u3066\u3044\u307E\u305B\u3093"})}],testId:"search-run"}),N(on,{master:N(cn,{label:"\u898B\u3064\u304B\u3063\u305F\u6587\u66F8",items:It,itemKey:f=>String(f.rank),selectedKey:m,onSelect:f=>O(String(f.rank)),detailId:r,renderRow:f=>tt(Bi,{children:[N(B,{fg:"fg",type:"body",children:`#${f.rank} ${je(ye("file_name"),f.hit.file_name)}`}),N(Fn,{label:`#${f.rank} \u306E\u878D\u5408\u306E\u5024`,value:f.hit.scores.fused,min:0,max:1,valueText:f.hit.scores.fused.toFixed(kt),testId:`search-hit-${f.rank}-fused`})]}),rowTestId:"search-hit-row",rowData:f=>({"data-rank":f.rank}),empty:"\u6761\u4EF6\u306B\u5408\u3046\u6587\u66F8\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u691C\u7D22\u8A9E\u3092\u77ED\u304F\u3059\u308B\u304B\u3001\u6226\u7565\u3084\u7D5E\u308A\u8FBC\u307F\u3092\u5909\u3048\u3066\u304F\u3060\u3055\u3044\u3002",testId:"search-hits"}),detail:Ht===null?N(Mn,{id:r,title:"\u6587\u66F8\u306E\u8A73\u7D30",region:!0,testId:"search-hit-detail",children:N(B,{as:"p",fg:"fg-secondary",type:"prose",children:"\u4E00\u89A7\u306E\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u6587\u66F8\u306E\u8A73\u7D30\u3092\u793A\u3057\u307E\u3059\u3002"})}):$n(Ht.hit,Ht.rank),masterMinPx:Di,detailMinPx:Ai,testId:"search-master-detail"})]})}),N(pn,{summary:"\u958B\u767A\u8005\u306E\u70B9\u691C",open:Ce,onOpenChange:ke,testId:"search-inspector",children:tt(Pe,{gap:"space-4",testId:"search-inspector-body",children:[N(mn,{label:"\u70B9\u691C\u306E\u7A93",options:Object.keys(en).map(f=>({value:f,label:en[f]})),value:oe,onValueChange:f=>E(f),testId:"search-inspector-view"}),N(On,{label:`\u70B9\u691C\u306E\u7A93: ${en[oe]}`,code:z(oe),testId:"search-inspector-code"}),N(it,{gap:"space-2",testId:"search-inspector-actions",children:N(he,{variant:"secondary",onClick:()=>{ue()},testId:"search-inspector-copy",children:`${en[oe]}\u3092\u5199\u3059`})}),Te!==null&&N(qe,{occurrence:Te.occurrence,testId:"search-inspector-copy-failure",children:Te.message})]})})]})}import{SEARCH_PARAM_LIMITS as Et}from"@aiquants/enrichment-core";import{useEffect as Hi,useRef as Wr,useState as ft}from"react";import{jsx as me,jsxs as Tn}from"react/jsx-runtime";var Vi=4;function Yr(e){return`${e.label} (${e.embeddingModel})`}function Gi(e){let t=e.trim().length;return t<Et.queryLength.min?"\u554F\u3044\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002":t>Et.queryLength.max?`\u554F\u3044\u306F ${Et.queryLength.max} \u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`:void 0}function tu({variants:e,onCompare:t}){let{formatLocale:n}=I(),a=Pt(),[s,r]=ft(null),[l,i]=ft(null),[o,b]=ft(""),[P,T]=ft(Et.limit.default),[u,w]=ft(!1),[D,p]=ft(!1),[R,x]=ft(null),[L,W]=ft(null),ee=Wr(0),ie=Wr(null);Hi(()=>()=>ie.current?.abort(),[]);let ne=e.map(E=>E.strategyId),q=s!==null&&ne.includes(s)?s:ne[0]??null,se=l!==null&&ne.includes(l)?l:ne[1]??null,xe=q!==null&&q===se,_={query:Gi(o),variant:xe?"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u3079\u3089\u308C\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002":void 0},te=u?_.query:void 0,Y=E=>{let X=e.find(M=>M.strategyId===E);return X===void 0?`\u6226\u7565 #${E}`:Yr(X)},Ie=E=>{ee.current+=1,x(null),W({message:E,occurrence:ee.current})},Ye=async E=>{let X=new AbortController;ie.current=X,p(!0);try{let M=await t(E,X.signal);if(X.signal.aborted)return;let ae=M.results.find(re=>re.strategy_id===E.strategy_ids[0]),ge=M.results.find(re=>re.strategy_id===E.strategy_ids[1]);if(ae===void 0||ge===void 0){Ie(`\u7B54\u3048\u306B\u6226\u7565 #${ae===void 0?E.strategy_ids[0]:E.strategy_ids[1]} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}x({input:E,answer:M,results:[ae,ge]}),W(null),a(`\u5909\u7A2E A \u306F ${ae.hits.length} \u4EF6\u3001\u5909\u7A2E B \u306F ${ge.hits.length} \u4EF6\u3092\u8FD4\u3057\u307E\u3057\u305F\u3002`)}catch(M){if(X.signal.aborted)return;Ie(M instanceof Error?M.message:"\u6BD4\u3079\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002")}finally{ie.current===X&&(ie.current=null,p(!1))}},$e=E=>{E.preventDefault(),w(!0),!(D||q===null||se===null||_.query!==void 0||_.variant!==void 0)&&Ye({query:o.trim(),strategy_ids:[q,se],limit:P})},Ce=e.map(E=>({value:String(E.strategyId),label:Yr(E)})),ke=(E,X,M,ae,ge)=>E===void 0?me(B,{fg:"fg-muted",type:"body",testId:`compare-${X}-${M}-${ae}`,children:"\u3053\u306E\u9806\u4F4D\u306E\u7D50\u679C\u7121\u3057"}):Tn(Pe,{gap:"space-1",testId:`compare-${X}-${M}-${ae}`,children:[me(B,{fg:"fg-secondary",type:"body",face:"mono",children:`\u6587\u66F8 ${E.metadata_id} \xB7 \u30C1\u30E3\u30F3\u30AF ${E.chunk_index} \xB7 ${E.score.toFixed(Vi)}`}),me(B,{fg:"fg",type:"prose",children:ge||E.text===null?Ct:E.text})]}),oe=({answer:E,results:X})=>{let[M,ae]=X,ge=Ia(M.hits.map(Dn),ae.hits.map(Dn)),re=Array.from({length:Math.max(M.hits.length,ae.hits.length)},(m,O)=>O+1),Me=(m,O)=>({key:O,heading:`\u5909\u7A2E ${O.toUpperCase()}: ${Y(m.strategy_id)} \xB7 ${In(m.execution_ms,`execution_ms of strategy ${m.strategy_id}`,n)} ms`,cells:Object.fromEntries(re.map(de=>[`rank-${de}`,le=>ke(m.hits[de-1],O,de,le,E.text_hidden)]))});return me(ot,{title:"\u6BD4\u3079\u306E\u7D50\u679C",testId:"compare-results",children:Tn(Pe,{gap:"space-4",testId:"compare-results-body",children:[me(wt,{items:[{key:"shared",term:"\u5171\u901A\u306E\u30C1\u30E3\u30F3\u30AF",description:me(B,{fg:"fg",type:"body",testId:"compare-shared-count",children:`${ge.sharedCount} \u4EF6 (A ${M.hits.length} \u4EF6 / B ${ae.hits.length} \u4EF6)`})},{key:"overlap",term:"\u91CD\u306A\u308A (Jaccard)",description:me(B,{fg:"fg",type:"body",testId:"compare-overlap-ratio",children:ge.overlapRatio===null?"\u3069\u3061\u3089\u3082\u7D50\u679C\u7121\u3057":`${(ge.overlapRatio*100).toFixed(1)}%`})},{key:"distance",term:"\u9806\u4F4D\u306E\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u306E\u5206)",description:me(B,{fg:"fg",type:"body",testId:"compare-rank-difference",children:ge.meanAbsoluteRankDifference===null?"\u5171\u901A\u306E\u7D50\u679C\u7121\u3057":ge.meanAbsoluteRankDifference.toFixed(2)})},{key:"body",term:"\u672C\u6587",description:me(B,{fg:"fg",type:"body",testId:"compare-text-hidden",children:E.text_hidden?"\u5217\u306E\u30B9\u30B3\u30FC\u30D7\u3067\u4F0F\u305B\u3066\u3044\u307E\u3059":"\u793A\u3057\u3066\u3044\u307E\u3059"})}],testId:"compare-agreement"}),[[M,"A"],[ae,"B"]].map(([m,O])=>m.dense_ran?null:me(Ge,{tone:"warning",testId:`compare-degraded-${O.toLowerCase()}`,children:me(B,{as:"p",fg:"fg",type:"prose",children:`\u5909\u7A2E ${O} (${Y(m.strategy_id)}) \u306E\u5BC6\u306E\u5C64\u306F\u8D70\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002${m.degradation_reasons.map(sn).join(" ")}`})},O)),re.length===0?me(B,{as:"p",fg:"fg",type:"prose",testId:"compare-empty",children:"\u3069\u3061\u3089\u306E\u5909\u7A2E\u306B\u3082\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):me(dn,{caption:"\u5909\u7A2E\u3054\u3068\u306E\u9806\u4F4D",attributes:re.map(m=>({key:`rank-${m}`,label:`${m} \u4F4D`})),columns:[Me(M,"a"),Me(ae,"b")],attributePx:64,columnMinPx:272,testId:"compare-grid"})]})})};return Tn(Pe,{gap:"space-6",testId:"model-comparison-workbench",children:[me(ot,{title:"\u5909\u7A2E\u306E\u6BD4\u3079",description:"\u540C\u3058\u554F\u3044\u3092 2 \u3064\u306E\u6226\u7565\u306E\u5909\u7A2E\u3067\u691C\u7D22\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u307E\u3059\u3002\u5024\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u3057\u307E\u305B\u3093\u3002",testId:"compare-card",dataAttributes:{"data-running":D},children:e.length<2?me(Ge,{tone:"info",testId:"compare-variants-insufficient",children:me(B,{as:"p",fg:"fg",type:"prose",children:`\u6BD4\u3079\u308B\u306B\u306F\u5909\u7A2E\u304C 2 \u3064\u4EE5\u4E0A\u8981\u308A\u307E\u3059 (\u4ECA\u306F ${e.length} \u4EF6)\u3002`})}):me("form",{onSubmit:$e,noValidate:!0,"data-testid":"compare-form",children:Tn(Pe,{gap:"space-4",testId:"compare-form-fields",children:[me(zt,{label:"\u5909\u7A2E A",value:String(q),options:Ce,onValueChange:E=>r(Number(E)),testId:"compare-variant-a"}),me(zt,{label:"\u5909\u7A2E B",value:String(se),options:Ce,onValueChange:E=>i(Number(E)),error:_.variant,testId:"compare-variant-b"}),me(xt,{label:"\u554F\u3044",type:"search",value:o,onValueChange:b,required:!0,description:`1\u301C${Et.queryLength.max} \u5B57`,error:te,testId:"compare-query"}),me(bt,{label:"\u4EF6\u6570",value:P,min:Et.limit.min,max:Et.limit.max,step:1,valueText:E=>`${E} \u4EF6`,onValueChange:T,testId:"compare-limit"}),me(it,{gap:"space-2",testId:"compare-actions",children:me(he,{variant:"primary",type:"submit",busy:D,busyLabel:"\u6BD4\u3079\u3066\u3044\u307E\u3059",testId:"compare-submit",children:"\u6BD4\u3079\u308B"})})]})})}),L!==null&&me(qe,{occurrence:L.occurrence,testId:"compare-failure",children:L.message}),R!==null&&oe(R)]})}import{jsx as Z,jsxs as J}from"react/jsx-runtime";function Xr(e){return e===null?nn:`${e.length} \u7A2E`}var nn="\u672A\u8A2D\u5B9A";function tn(e,t=""){return e===null?nn:`${e}${t}`}function wn(e){return e===null?nn:`${e} \u4EF6`}function qi(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?nn:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??nn})`}function ru({tenantId:e,ontologyStatus:t}){let n=t.classes,a=t.predicates;return J("div",{"data-cui-migration":"pending",className:"space-y-6","data-testid":"ontology-status-card",children:[J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[J("div",{children:[J("div",{className:"flex items-center gap-2",children:[Z("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"}),Z("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"}),Z("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:qi(t)})]}),Z("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"})]}),J("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:"," ",Z("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),J("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),Z("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:wn(t.totalConstraints)})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),Z("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:wn(t.searchIndexes)}),J("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",wn(t.totalIndexes)]})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),J("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[tn(t.promotionThresholds.confidence)," / ",tn(t.promotionThresholds.cooccurrence," \u56DE")]})]}),J("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[Z("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),Z("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:wn(t.unresolvedCandidatesCount)})]})]})]}),J("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex items-center justify-between pb-3",children:[J("div",{children:[Z("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)"}),Z("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"})]}),Z("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:Xr(n)})]}),J("div",{className:"divide-y divide-solid divide-slate-100",children:[n===null&&Z("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"}),n?.map(s=>J("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${s.name}`,children:[J("div",{children:[Z("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:s.name}),Z("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),typeof s.count=="number"&&Z("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:s.count.toLocaleString()})]},s.name))]})]}),J("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[J("div",{className:"flex items-center justify-between pb-3",children:[J("div",{children:[Z("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),Z("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"})]}),Z("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:Xr(a)})]}),J("div",{className:"divide-y divide-solid divide-slate-100",children:[a===null&&Z("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"}),a?.map(s=>J("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${s.name}`,children:[J("div",{children:[Z("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:s.name}),Z("p",{className:"mt-0.5 text-slate-600 text-xs",children:s.description})]}),Z("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:s.direction})]},s.name))]})]})]}),J("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:[Z("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"}),J("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),J("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",tn(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",tn(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",tn(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),Z("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"})]}),J("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[Z("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),J("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",Z("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"]})]})]})]})]})}import{DOCUMENT_KIND_LABELS as _t,DOCUMENT_KINDS as Pn,flowFor as ed,flowStepGates as Jr,MIME_KIND_RULES as td,PIPELINE_STEPS as ga}from"@aiquants/enrichment-core";import{useEffect as nd,useId as an,useRef as Ln,useState as ya}from"react";import{ceil8 as zi,textWidthEm as Wi}from"@aiquants/console-ui/core";import{orderedSteps as Yi,PIPELINE_STEPS as Xi}from"@aiquants/enrichment-core";var Bt={inset:12,labelFontSize:13,captionFontSize:11},Rt={offset:3,stroke:2},ji={node:{width:zi(Math.max(...Object.values(Xi).map(e=>Wi(e.label)))*Bt.labelFontSize+2*Bt.inset),height:56},gap:{column:48,row:24},padding:24};function yt(e){return Math.round(e*1e3)/1e3}function Ji(e){let t=new Map;for(let n of e){let a=n.dependsOn.reduce((s,r)=>Math.max(s,t.get(r)),-1);t.set(n.step,a+1)}return t}function fa(e,t){return`${e}->${t}`}function Qi(e,t){let n=[],a=new Map;return{slots:[...e.map(r=>{let l=t.get(r.step),i=r.dependsOn.map(o=>{let b=[],P=o;for(let T=t.get(o)+1;T<l;T+=1){let u=`${fa(o,r.step)}@${T}`;n.push({id:u,rank:T,predecessors:[P]}),b.push(u),P=u}return a.set(fa(o,r.step),b),P});return{id:r.step,rank:l,predecessors:i}}),...n],chains:a}}function Zi(e){let t=new Map,n=Math.max(...e.map(a=>a.rank));for(let a=0;a<=n;a+=1){let r=e.filter(l=>l.rank===a).map((l,i)=>{let o=a===0?i:l.predecessors.reduce((b,P)=>b+t.get(P),0)/l.predecessors.length;return{slot:l,barycenter:o}});r.sort((l,i)=>l.barycenter-i.barycenter),r.forEach(({slot:l},i)=>{t.set(l.id,i)})}return t}function jr(e,t=ji){let n=Yi(e),a=Ji(n),{slots:s,chains:r}=Qi(n,a),l=Zi(s),{node:i,gap:o,padding:b}=t,P=L=>({x:yt(b+L.rank*(i.width+o.column)),y:yt(b+l.get(L.id)*(i.height+o.row))}),T=new Map(s.map(L=>[L.id,P(L)])),u=n.map(L=>{let W=T.get(L.step);return{key:L.step,x:W.x,y:W.y,rank:a.get(L.step),order:l.get(L.step),width:i.width,height:i.height}}),w=L=>yt(L+i.height/2),D=n.flatMap(L=>L.dependsOn.map(W=>{let ee=T.get(W),ie=T.get(L.step),ne=yt(ee.x+i.width),q=w(ee.y),se=`M ${ne} ${q}`,xe=(_,te)=>{let Y=yt((ne+_)/2);se+=` C ${Y} ${q}, ${Y} ${te}, ${_} ${te}`};for(let _ of r.get(fa(W,L.step))){let te=T.get(_),Y=w(te.y);xe(te.x,Y),ne=yt(te.x+i.width),q=Y,se+=` L ${ne} ${q}`}return xe(ie.x,w(ie.y)),{from:W,to:L.step,path:se}})),p=[...T.values()],R=yt(Math.max(...p.map(L=>L.x+i.width))+b),x=yt(Math.max(...p.map(L=>L.y+i.height))+b);return{width:R,height:x,steps:u,edges:D}}import{Fragment as es,jsx as C,jsxs as K}from"react/jsx-runtime";var ts="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Qr={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},ad={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},ns={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"}},as={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"},rd={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},rn="rgb(248 250 252)",sd={backgroundColor:rn,backgroundImage:`linear-gradient(to right, ${rn}, ${rn}), linear-gradient(to right, ${rn}, ${rn}), 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 rs(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function od(e,t){let n=e.map(a=>({gate:a,state:rs(a,t)}));return n.some(({gate:a,state:s})=>s==="closed"&&a.whenClosed==="fail")?"closed-fail":n.some(({state:a})=>a==="closed")?"closed-skip":n.some(({state:a})=>a==="unmeasured")?"unmeasured":"open"}function Zr(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function id(e,t){let{badge:n}=ns[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${as[t]}`}function dd(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 ba(e){return e.map(t=>ga[t].label).join("\u3001")}function ld(e){return e.dependsOn.length===0?ts:`\u4F9D\u5B58: ${ba(e.dependsOn)}`}function yu({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:a,onSelectKind:s,selectedStepKey:r,onSelectStep:l}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let i=an(),o=an(),b=an(),P=an(),T=an(),[u,w]=ya(Pn[0]),[D,p]=ya(null),[R,x]=ya(null),L=Ln(new Map),W=Ln(new Map),ee=Ln(null),ie=Ln(null),{labels:ne}=I(),q=a!==void 0?a:u,se=r!==void 0?r:D,xe=ed(q),_=jr(xe),te=new Map(xe.steps.map(m=>[m.step,m])),Y=m=>{p(m),l?.(m)},Ie=m=>{w(m),s?.(m),Y(null)},Ye=(m,O)=>{let de=Pn.length-1,le;switch(m.key){case"ArrowRight":le=O===de?0:O+1;break;case"ArrowLeft":le=O===0?de:O-1;break;case"Home":le=0;break;case"End":le=de;break;default:return}m.preventDefault();let Te=Pn[le];Ie(Te),L.current.get(Te)?.focus()},$e=m=>{let O=ie.current;if(Y(null),O?.isConnected){O.focus();return}W.current.get(m)?.focus()},Ce=m=>{Y(m===se?null:m)},ke=(m,O)=>{m.currentTarget.focus(),Ce(O)},oe=(m,O)=>{m.key==="Enter"||m.key===" "?(m.preventDefault(),Ce(O)):m.key==="Escape"&&Y(null)},E=se===null?void 0:te.get(se),X=E===void 0?null:E.step;nd(()=>{if(X===null){ie.current=null;return}let m=document.activeElement;(m instanceof HTMLElement||m instanceof SVGElement)&&m!==document.body&&ee.current?.contains(m)===!1&&(ie.current=m)},[X]);let M=E===void 0?void 0:ga[E.step],ae=E===void 0?[]:Jr(E),ge=E===void 0?[]:xe.steps.filter(m=>m.dependsOn.includes(E.step)).map(m=>m.step),re=M===void 0?void 0:t.find(m=>m.documentKind===q&&m.stepKey===M.key),Me=_t[q];return K("section",{"data-cui-migration":"pending",className:"space-y-6","aria-labelledby":i,"data-testid":"pipeline-flow-viewer","data-kind":q,children:[K("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[C("h2",{id:i,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),C("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"}),C("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:Pn.map((m,O)=>{let de=m===q;return C("button",{ref:le=>{le===null?L.current.delete(m):L.current.set(m,le)},type:"button",role:"tab","aria-selected":de,"aria-controls":o,tabIndex:de?0:-1,onClick:()=>Ie(m),onKeyDown:le=>Ye(le,O),className:de?"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-${m}`,children:_t[m]},m)})}),C("div",{id:o,role:"tabpanel","aria-label":`${_t[q]} \u306E\u6D41\u308C`,"aria-describedby":b,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:sd,"data-testid":"flow-scroll",children:K("svg",{viewBox:`0 0 ${_.width} ${_.height}`,width:_.width,height:_.height,role:"group","aria-label":`${_t[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[C("title",{children:`${_t[q]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),C("defs",{children:C("marker",{id:`${o}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:C("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),_.edges.map(m=>C("path",{d:m.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${o}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${m.from}-${m.to}`},`${m.from}-${m.to}`)),_.steps.map(m=>{let O=ga[m.key],de=te.get(m.key),le=Jr(de),Te=od(le,e),Be=Zr(le),Oe=ns[Te],nt=id(Te,Be),we=m.key===se,at=m.key===R,Ae=`${o}-depends-${m.key}`;return K("g",{ref:Fe=>{Fe===null?W.current.delete(m.key):W.current.set(m.key,Fe)},transform:`translate(${m.x} ${m.y})`,role:"button",tabIndex:0,"aria-label":`${O.label} (${nt})`,"aria-describedby":Ae,"aria-expanded":we,"aria-controls":we?T:void 0,onClick:Fe=>ke(Fe,m.key),onKeyDown:Fe=>oe(Fe,m.key),onFocus:()=>x(m.key),onBlur:()=>x(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${m.key}`,"data-step-key":m.key,"data-gate-state":Te,"data-gate-policy":Be,"data-selected":we,"data-focused":at,children:[C("desc",{id:Ae,"data-testid":`flow-node-dependencies-${m.key}`,children:ld(de)}),at&&C("rect",{x:-Rt.offset,y:-Rt.offset,width:m.width+2*Rt.offset,height:m.height+2*Rt.offset,rx:8+Rt.offset,fill:"none",strokeWidth:Rt.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${m.key}`}),C("rect",{width:m.width,height:m.height,rx:8,strokeWidth:we?3:1.5,strokeDasharray:Oe.dash,className:`${Oe.stroke} ${we?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${m.key}`}),C("text",{x:Bt.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${m.key}`,children:O.label}),C("text",{x:Bt.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${m.key}`,children:Qr[O.phase]}),C("text",{x:Bt.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${m.key}`,"data-gate-state":Te,children:nt})]},m.key)})]})}),K("p",{id:b,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",_.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"]})]}),M!==void 0&&E!==void 0&&K("section",{id:T,ref:ee,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":P,"data-testid":"flow-step-detail","data-step-key":M.key,children:[K("div",{className:"flex items-start justify-between gap-4",children:[K("div",{children:[C("h3",{id:P,className:"font-bold text-base text-slate-900",children:M.label}),C("p",{className:"mt-1 text-[13px] text-slate-600",children:M.description})]}),C("button",{type:"button",onClick:()=>$e(M.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"})]}),K("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),C("dd",{children:C("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:M.endpoint})})]}),K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),K("dd",{"data-testid":"flow-step-phase",children:[Qr[M.phase]," (",M.phase,")"]})]}),K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),C("dd",{"data-testid":"flow-step-capability",children:M.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":M.capability})]}),E.chunkSource!==void 0&&K("div",{children:[C("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),K("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":E.chunkSource,children:[ad[E.chunkSource]," (",E.chunkSource,")"]})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),C("dd",{"data-testid":"flow-step-depends-on",children:E.dependsOn.length===0?ts:ba(E.dependsOn)})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),C("dd",{"data-testid":"flow-step-dependents",children:ge.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":ba(ge)})]}),K("div",{className:"sm:col-span-2",children:[C("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),C("dd",{children:ae.length===0?C("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):K(es,{children:[C("ul",{className:"space-y-1",children:ae.map(m=>{let O=rs(m,e);return K("li",{"data-testid":`flow-gate-${m.featureFlagKey}`,"data-gate-state":O,"data-when-closed":m.whenClosed,children:[C("code",{className:"font-mono",children:m.featureFlagKey}),": ",rd[O]," \u2014 ",dd(m)]},m.featureFlagKey)})}),E.gatePolicy!==void 0&&K("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Me," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",as[Zr(M.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",E.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),K("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":q,children:[K("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Me,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),K("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Me," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \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"]}),re===void 0?K("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[ne.unmeasured," (",Me," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):K(es,{children:[K("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[K("div",{children:[C("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),C("dd",{"data-testid":"flow-metric-sample-count",children:C(Q,{value:re.sampleCount,testId:"flow-metric-sample-count-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u6210\u529F"}),C("dd",{"data-testid":"flow-metric-succeeded",children:C(Q,{value:re.succeeded,testId:"flow-metric-succeeded-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u5931\u6557"}),C("dd",{"data-testid":"flow-metric-failed",children:C(Q,{value:re.failed,testId:"flow-metric-failed-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"\u7701\u7565"}),C("dd",{"data-testid":"flow-metric-skipped",children:C(Q,{value:re.skipped,testId:"flow-metric-skipped-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"p50"}),C("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:C(Q,{value:re.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),K("div",{children:[C("dt",{className:"text-slate-500",children:"p95"}),C("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:C(Q,{value:re.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),K("div",{className:"col-span-2",children:[C("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),C("dd",{"data-testid":"flow-metric-last-started-at",children:C(fe,{iso:re.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),K("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 ",ne.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"]})]})]})]}),K("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[C("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),K("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",C("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",_t.other,"\u300D\u3067\u3059\u3002"]}),C("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:K("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[C("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:K("tr",{children:[C("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),C("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),C("tbody",{className:"divide-y divide-solid divide-slate-100",children:td.map(([m,O],de)=>K("tr",{className:O===q?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${de}`,"data-kind":O,"data-selected":O===q,children:[C("td",{className:"px-3 py-2",children:C("code",{className:"font-mono",children:m})}),C("td",{className:"px-3 py-2",children:_t[O]})]},m))})]})})]})]})}import{cssVar as va}from"@aiquants/console-ui/core";import{useId as cd}from"react";import{Fragment as vd,jsx as F,jsxs as Ee}from"react/jsx-runtime";function ud(e,t){return e==null?null:pt(e,"segment_count",t)}function ss(e,t,n){return e==null?null:Cn(e,t,n)}function pd(e){let t=e.probe_failure;if(t===null)return null;if(!Xt.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 os(e,t,n){return e.reduce((a,s)=>a+pt(s[t],`${t} of collection ${s.collection_name}`,n),0)}var md=va("space-1"),fd={padding:0,height:"1px",color:"#1e293b"},yd={display:"flex",height:"100%"},gd={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},bd={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},xd={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},xa={whiteSpace:"nowrap"},is=va("space-3"),hd=va("info-tint"),ha={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function ds(e,t){return`vectors_config.${e}.size of collection ${t}`}function _u({overview:e,health:t,resources:n,onRefresh:a,isRefreshing:s=!1,selection:r}){let{formatLocale:l}=I(),i=cd(),{collections:o}=e,b=pd(e),P=b===null,T=P?os(o,"points_count",l):null,u=P?os(o,"vectors_count",l):null,w=ss(n?.ram_bytes,"ram_bytes",l),D=ss(n?.disk_bytes,"disk_bytes",l),p=ud(n?.segment_count,l);return Ee("div",{"data-cui-migration":"pending","data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[Ee("div",{"data-testid":"qdrant-card-header",style:bd,children:[Ee("div",{"data-testid":"qdrant-card-title-group",style:xd,children:[F("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&&Ee(vd,{children:[F("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Kt[t.healthy?"connected":"error"],style:{...xa,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Ut[t.healthy?"connected":"error"]}),Ee("span",{"data-testid":"qdrant-latency",style:{...xa,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",F(Q,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),a&&F("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:s,onClick:a,style:{...xa,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:s?"not-allowed":"pointer",fontSize:"13px"},children:s?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),Ee("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),F("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:T,testId:"qdrant-total-points-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),F("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:u,testId:"qdrant-total-vectors-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),F("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Ke,{text:w,testId:"qdrant-ram-usage-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),F("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Ke,{text:D,testId:"qdrant-disk-usage-value"})})]}),Ee("div",{children:[F("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),F("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:F(Q,{value:p,testId:"qdrant-segment-count-value"})})]})]}),Ee("div",{children:[Ee("h3",{id:i,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",F(Q,{value:P?o.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),b!==null?F("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:b}):o.length===0?F("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"}):F("section",{tabIndex:0,"aria-labelledby":i,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:md},children:Ee("table",{"aria-labelledby":i,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[F("thead",{children:Ee("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[F("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${is}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),F("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),F("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),F("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),F("tbody",{children:o.map(R=>{let x=r!==void 0&&R.collection_name===r.selectedCollectionName,L=F("span",{style:gd,children:R.collection_name}),{dense:W,sparse:ee,image:ie}=R.vectors_config,ne=W===void 0?null:pt(W.size,ds("dense",R.collection_name),l),q=ie===void 0?null:pt(ie.size,ds("image",R.collection_name),l);return Ee("tr",{"data-testid":`collection-row-${R.collection_name}`,"data-collection-name":R.collection_name,"data-selected":String(x),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:x?hd:"transparent"},children:[r===void 0?F("td",{style:{padding:`8px ${is}`,color:"#1e293b"},children:L}):F("td",{style:fd,children:F("div",{style:yd,children:F(ka,{selected:x,controls:r.detailId,onSelect:()=>r.onSelectCollection(R.collection_name),testId:`collection-select-${R.collection_name}`,children:L})})}),F("td",{style:{padding:"8px",color:"#475569"},children:R.domain_key}),F("td",{"data-testid":`collection-points-${R.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:F(Q,{value:R.points_count,testId:`collection-points-value-${R.collection_name}`})}),F("td",{style:{padding:"8px"},children:Ee("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[ne!==null&&Ee("span",{"data-testid":`vector-tag-dense-${R.collection_name}`,style:{...ha,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",F(Q,{value:ne,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${R.collection_name}`})]}),ee!==void 0&&F("span",{"data-testid":`vector-tag-sparse-${R.collection_name}`,style:{...ha,backgroundColor:"#fef3c7",color:"#92400e"},children:ee.modifier?`Sparse (${ee.modifier.toUpperCase()})`:"Sparse"}),q!==null&&Ee("span",{"data-testid":`vector-tag-image-${R.collection_name}`,style:{...ha,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",F(Q,{value:q,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${R.collection_name}`})]})]})})]},R.collection_name)})})]})})]})]})}import{jsx as H,jsxs as Le}from"react/jsx-runtime";var Sd="\u5BFE\u8C61\u306A\u3057";function Pu({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:a,onRetryItem:s,isRetrying:r=!1,onRefresh:l,listRefusal:i}){I();let o=e.SYNCED??0,b=e.PENDING??0,P=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),T=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),u=t>0?`${(o/t*100).toFixed(1)}%`:Sd;return Le("div",{"data-cui-migration":"pending","data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[Le("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[Le("div",{children:[H("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"}),Le("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",H("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",H("span",{"data-testid":"success-rate-value",children:u}),")"]})]}),Le("div",{style:{display:"flex",gap:"8px"},children:[l&&H("button",{type:"button","data-testid":"sync-refresh-button",onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),a&&H("button",{type:"button","data-testid":"retry-all-button",disabled:r||T===0,onClick:a,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:r||T===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:r||T===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:r?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),Le("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[Le("div",{"data-testid":"status-card-synced","data-count":o,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[H("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),H("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:o})]}),Le("div",{"data-testid":"status-card-processing","data-count":P,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[H("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),H("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:P})]}),Le("div",{"data-testid":"status-card-pending","data-count":b,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[H("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),H("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:b})]}),Le("div",{"data-testid":"status-card-failed","data-count":T,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[H("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),H("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:T})]})]}),Le("div",{"data-testid":"failed-items-section",children:[Le("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",i!==void 0?"":` (${n.length<T?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${T} \u4EF6`:`${n.length} \u4EF6`})`]}),i!==void 0?H(Ge,{tone:"warning",testId:"failed-items-refused",children:i}):n.length===0?H("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"}):H("div",{style:{overflowX:"auto"},children:Le("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[H("thead",{children:Le("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[H("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),H("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),H("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),H("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),H("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),H("tbody",{children:n.map((w,D)=>{if(w.kind==="restricted")return Le("tr",{"data-testid":`failed-item-restricted-${D}`,"data-restricted-mark":"failure",children:[H("td",{"data-testid":`failed-item-restricted-text-${D}`,style:{padding:"8px"},children:$t}),H("td",{style:{padding:"8px"},children:H("span",{"data-testid":`failed-item-restricted-status-${D}`,style:{fontSize:"11px"},children:w.syncStatus})}),H("td",{style:{padding:"8px"}}),H("td",{"data-testid":`failed-item-restricted-time-${D}`,style:{padding:"8px",whiteSpace:"nowrap"},children:w.failedAt===null?"\u8A18\u9332\u306A\u3057":H(fe,{iso:w.failedAt,testId:`failed-item-restricted-time-value-${D}`})}),H("td",{style:{padding:"8px"}})]},`restricted:${D}`);let p=w.item;return Le("tr",{"data-testid":`failed-item-row-${p.id}`,"data-file-uri":p.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[Le("td",{"data-testid":`failed-item-uri-${p.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[H("div",{style:{fontWeight:600,color:"#0f172a"},children:p.file_name}),H("div",{style:{fontSize:"11px",color:"#64748b"},children:p.file_uri})]}),H("td",{style:{padding:"8px"},children:H("span",{"data-testid":`failed-item-status-${p.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:p.sync_status})}),H("td",{"data-testid":`failed-item-error-${p.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:p.error_message??"",children:p.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),H("td",{"data-testid":`failed-item-time-${p.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:p.failed_at===null?"\u8A18\u9332\u306A\u3057":H(fe,{iso:p.failed_at,testId:`failed-item-time-value-${p.id}`})}),H("td",{style:{padding:"8px",textAlign:"right"},children:s&&H("button",{type:"button","data-testid":`retry-item-button-${p.id}`,"aria-label":`${p.file_name} (${p.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:r,onClick:()=>s(p.id,p.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:r?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${p.id}`)})})]})})]})]})}export{Gt as BREAKER_STATE_LABELS,Da as CHUNKING_ONLY_NOTE,Pa as CHUNK_BODY_FIDELITY_LABELS,Un as CHUNK_CHANGE_KIND_LABELS,ad as CHUNK_SOURCE_LABELS,Pi as CONFIDENTIALITY_LEVEL_LABELS,Ea as DEGRADATION_REASON_LABELS,Lt as DOCUMENT_STATE_CAUSE_LABELS,wa as DegradedSearchBanner,ll as DocumentChangeFeed,cc as DocumentHistoryInspector,_c as DocumentIngestConsole,Tc as EnrichmentStrategyBoard,ht as FACET_LABELS,Oa as FAILED_RUN_STATE_MARK,fn as FIELD_LABELS,Rt as FLOW_FOCUS_RING,ji as FLOW_GEOMETRY,Bt as FLOW_NODE_TEXT,At as FinishedInstant,as as GATE_POLICY_LABELS,ns as GATE_STATE_PRESENTATION,Ct as HIDDEN_FIELD_TEXT,dt as HISTORY_REFUSAL,Si as INERT_STAGE_NOTE,Oc as InfrastructureHealthMonitor,Fa as MODEL_ONLY_CHANGE_MARK,Wc as MetadataSearchWorkbench,tu as ModelComparisonWorkbench,to as NOTHING_TO_READ_LABELS,mi as NO_ENRICHMENT_RECORD_TEXT,Ma as NO_PREVIOUS_RECORD_TEXT,ru as OntologyStatusCard,Qr as PHASE_LABELS,rt as PIPELINE_RUN_STATUS_PRESENTATION,Wn as PIPELINE_STEP_STATUS_PRESENTATION,Yn as PIPELINE_TRIGGER_LABELS,yu as PipelineFlowViewer,Vt as QUALITY_TIER_LABELS,_u as QdrantStorageCard,$t as RESTRICTED_DOCUMENT_TEXT,yn as RESTRICTED_RUN_TEXT,Aa as RESTRICTED_STATE_TEXT,eo as RUN_TERMINAL_STEP_LABEL,er as RUN_TERMINAL_STEP_OUTCOME_LABELS,fe as RecordedInstant,kt as SCORE_DECIMALS,Vi as SCORE_DISPLAY_DECIMALS,Ra as SEARCH_FUSION_LABELS,st as SEARCH_MODE_LABELS,wi as SEARCH_PRESETS,Pu as SyncStatusMonitor,tr as UNFINISHED_LABEL,Kn as UNRECORDED_RUN_MARK,$a as UNVERIFIED_CHUNK_NOTE,La as WHITESPACE_NORMALIZED_NOTE,sn as degradationReasonText,Za as documentKindLabel,gn as facetCountsText,Yt as fieldLabel,id as gateCaption,rs as gateState,Kr as gateStateOf,lt as historyFailedSentence,bn as historyFailureSentence,gi as ingestRowAction,vt as jsonValueText,jr as layoutFlow,Jt as ledgerStepLabel,ut as pipelineRunPresentationKey,Ia as rankAgreement,Xe as revisionLabel,Bn as revisionTransitionText,nr as skipReasonLabel,Zr as stepGatePolicy,od as stepGateState,Ua as unrecordedRunsMark,Dn as variantHitKey,_a as vectorScoreText};