(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1264],{78339:(e,n,t)=>{Promise.resolve().then(t.t.bind(t,52619,23)),Promise.resolve().then(t.bind(t,95519))},95519:(e,n,t)=>{"use strict";t.d(n,{LearningQueue:()=>m});var a=t(95155),s=t(12115),i=t(95088),l=t(84820),r=t(56502),c=t(89678),d=t(52985),x=t(76445);let o={new:"info",under_review:"info",approved:"brand",rejected:"muted",applied:"brand"};function m(e){let{initial:n,canReview:t}=e,{t:m,locale:p}=(0,r.s)(),[u,h]=(0,s.useState)(n),[g,j]=(0,s.useState)(null),[f,v]=(0,s.useState)(null),N=async(e,n)=>{j(e),v(null);try{await c.FH.patch("/api/learning",{code:e,decision:n});let t=await c.FH.get("/api/learning");h(t.candidates)}catch(e){v(e instanceof Error?e.message:m("common.error"))}finally{j(null)}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(i.Notice,{tone:"info",children:m("learning.governance")}),f?(0,a.jsx)(i.Notice,{tone:"danger",children:f}):null,0===u.length?(0,a.jsx)(l.pp,{title:m("uiState.empty"),body:m("learning.empty")}):(0,a.jsx)("div",{className:"grid gap-3 xl:grid-cols-2",children:u.map(e=>{var n;let s="new"===e.status||"under_review"===e.status;return(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsxs)(l.Zk,{children:[(0,a.jsx)(l.aO,{title:"ar"===p?e.titleAr:e.title,action:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)(l.Ex,{tone:"muted",children:m("learning.kind.".concat(e.kind))}),(0,a.jsx)(l.Ex,{tone:null!=(n=o[e.status])?n:"muted",dot:!0,children:m("learning.status.".concat(e.status))})]})}),(0,a.jsxs)(l.l_,{className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-[12px] leading-relaxed text-text-muted",children:"ar"===p?e.reasonAr:e.reason}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-[10px] text-text-faint",children:m("common.confidence")}),(0,a.jsxs)("p",{className:(0,x.cn)("font-mono text-sm font-semibold tabular-nums",e.confidence>=70?"text-normal":"text-watch"),children:[(0,d.ZV)(p,e.confidence,{maximumFractionDigits:0}),"%"]})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-[10px] text-text-faint",children:m("learning.support")}),(0,a.jsxs)("p",{className:"font-mono text-sm font-semibold tabular-nums",children:[(0,d.ZV)(p,e.supportPct,{maximumFractionDigits:0}),"%"]})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-[10px] text-text-faint",children:m("learning.events")}),(0,a.jsx)("p",{className:"font-mono text-sm font-semibold tabular-nums",children:e.eventCount})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-text-faint",children:m("learning.evidence")}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted",children:"ar"===p?e.evidenceAr:e.evidence}),e.confidence<=62?(0,a.jsx)("p",{className:"mt-1 text-[10px] leading-relaxed text-warning",children:m("learning.simulatedCeiling")}):null]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-text-faint",children:m("learning.proposed")}),(0,a.jsx)("p",{className:"text-[11px] leading-relaxed",children:"ar"===p?e.proposedChangeAr:e.proposedChange})]}),t&&s?(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>N(e.code,"approve"),disabled:null!==g,children:m("learning.approve")}),(0,a.jsx)(i.$n,{variant:"secondary",onClick:()=>N(e.code,"reject"),disabled:null!==g,children:m("learning.reject")})]}):e.reviewedAt?(0,a.jsxs)("p",{className:"text-[10px] text-text-faint",children:[m("learning.reviewed")," \xb7 ",(0,d.r6)(p,e.reviewedAt)]}):null]})]})},e.code)})})]})}}},e=>{e.O(0,[2619,4909,4820,4672,8441,1255,7358],()=>e(e.s=78339)),_N_E=e.O()}]);