PageSourceSearch

https://audit-agent--faisal70.replit.app/assets/audit-preferences-CffetzyF.js

js audit-agent--faisal70.replit.app collected 2026-10-03 03:49:57 UTC 29,348 bytes, 1 lines download raw bytes

1import{c as we,r as i,w as ot,j as e,y as X,P as ie,x as Z,H as lt,E as ct,D as dt,h as ut,i as mt,d as ht,b as le,B as T,l as z}from"./index-qUK8Hdpx.js";import{u as ne}from"./useQuery-CPigJIO8.js";import{u as B}from"./chevron-down-BwA7OcuG.js";import{A as Ee,L as E}from"./app-layout-3v6Gn9Sa.js";import{C as O,b as H,c as U,d as Q,a as $}from"./card-BiWwXSqu.js";import{u as xt,g as Ke,f as pt,a as Y,b as G,c as J,d as W,e as C,I as De}from"./select-DBovPMB7.js";import{S as Pe}from"./switch-B13_XKCF.js";import{S as re}from"./separator-CFoUZpxq.js";import{B as ce}from"./badge-BIIZzDl8.js";import{P as ft}from"./progress-C3UeGtO9.js";import{C as gt}from"./checkbox-BT6XMx7Q.js";import{A as vt,h as jt,a as yt,b as St,c as wt,d as Nt,e as bt,f as Ct,g as kt}from"./alert-dialog-FTEML2fg.js";import{S as Et}from"./save-7zHFCmiY.js";import{F as Ae}from"./file-text-BTYIWt8s.js";import{T as Dt}from"./target-D8Rhj-yB.js";import{B as _e}from"./brain-BvF9Q770.js";import{D as Pt}from"./download-DVcrlv_q.js";import{U as Re}from"./upload-BFSFffwA.js";import{B as Be}from"./book-open-Ct8y6l4E.js";import{P as At}from"./plus-Bak1PblU.js";import{P as Rt}from"./pencil-Cm3qmSEX.js";import{T as Me}from"./trash-2-CETFjhDe.js";import{C as Mt}from"./message-square-Z_3Z7reJ.js";import"./check-MYrTRj9c.js";import"./logo_new-Dyl6rEJX.js";import"./users-xw4djSrm.js";import"./shield-BiG9WfHj.js";const Tt=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],It=we("gauge",Tt);const Ft=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Kt=we("pen",Ft);const _t=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Te=we("rotate-ccw",_t);var Le=["PageUp","PageDown"],ze=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ve={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ee="Slider",[ve,Bt,Lt]=lt(ee),[qe]=dt(ee,[Lt]),[zt,de]=qe(ee),Oe=i.forwardRef((t,a)=>{const{name:n,min:r=0,max:c=100,step:u=1,orientation:o="horizontal",disabled:d=!1,minStepsBetweenThumbs:x=0,defaultValue:N=[r],value:j,onValueChange:l=()=>{},onValueCommit:h=()=>{},inverted:S=!1,form:k,...y}=t,g=i.useRef(new Set),p=i.useRef(0),b=o==="horizontal"?Vt:qt,[v=[],I]=ot({prop:j,defaultProp:N,onChange:w=>{[...g.current][p.current]?.focus(),l(w)}}),L=i.useRef(v);function te(w){const P=$t(v,w);K(w,P)}function F(w){K(w,p.current)}function oe(){const w=L.current[p.current];v[p.current]!==w&&h(v)}function K(w,P,{commit:V}={commit:!1}){const se=Wt(u),q=Xt(Math.round((w-r)/u)*u+r,se),f=Ke(q,[r,c]);I((_=[])=>{const A=Ut(_,f,P);if(Jt(A,x*u)){p.current=A.indexOf(f);const R=String(A)!==String(_);return R&&V&&h(A),R?A:_}else return _})}return e.jsx(zt,{scope:t.__scopeSlider,name:n,disabled:d,min:r,max:c,valueIndexToChangeRef:p,thumbs:g.current,values:v,orientation:o,form:k,children:e.jsx(ve.Provider,{scope:t.__scopeSlider,children:e.jsx(ve.Slot,{scope:t.__scopeSlider,children:e.jsx(b,{"aria-disabled":d,"data-disabled":d?"":void 0,...y,ref:a,onPointerDown:X(y.onPointerDown,()=>{d||(L.current=v)}),min:r,max:c,inverted:S,onSlideStart:d?void 0:te,onSlideMove:d?void 0:F,onSlideEnd:d?void 0:oe,onHomeKeyDown:()=>!d&&K(r,0,{commit:!0}),onEndKeyDown:()=>!d&&K(c,v.length-1,{commit:!0}),onStepKeyDown:({event:w,direction:P})=>{if(!d){const q=Le.includes(w.key)||w.shiftKey&&ze.includes(w.key)?10:1,f=p.current,_=v[f],A=u*q*P;K(_+A,f,{commit:!0})}}})})})})});Oe.displayName=ee;var[He,Ue]=qe(ee,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Vt=i.forwardRef((t,a)=>{const{min:n,max:r,dir:c,inverted:u,onSlideStart:o,onSlideMove:d,onSlideEnd:x,onStepKeyDown:N,...j}=t,[l,h]=i.useState(null),S=Z(a,b=>h(b)),k=i.useRef(void 0),y=xt(c),g=y==="ltr",p=g&&!u||!g&&u;function M(b){const v=k.current||l.getBoundingClientRect(),I=[0,v.width],te=Ne(I,p?[n,r]:[r,n]);
1return k.current=v,te(b-v.left)}return e.jsx(He,{scope:t.__scopeSlider,startEdge:p?"left":"right",endEdge:p?"right":"left",direction:p?1:-1,size:"width",children:e.jsx(Qe,{dir:y,"data-orientation":"horizontal",...j,ref:S,style:{...j.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const v=M(b.clientX);o?.(v)},onSlideMove:b=>{const v=M(b.clientX);d?.(v)},onSlideEnd:()=>{k.current=void 0,x?.()},onStepKeyDown:b=>{const I=Ve[p?"from-left":"from-right"].includes(b.key);N?.({event:b,direction:I?-1:1})}})})}),qt=i.forwardRef((t,a)=>{const{min:n,max:r,inverted:c,onSlideStart:u,onSlideMove:o,onSlideEnd:d,onStepKeyDown:x,...N}=t,j=i.useRef(null),l=Z(a,j),h=i.useRef(void 0),S=!c;function k(y){const g=h.current||j.current.getBoundingClientRect(),p=[0,g.height],b=Ne(p,S?[r,n]:[n,r]);return h.current=g,b(y-g.top)}return e.jsx(He,{scope:t.__scopeSlider,startEdge:S?"bottom":"top",endEdge:S?"top":"bottom",size:"height",direction:S?1:-1,children:e.jsx(Qe,{"data-orientation":"vertical",...N,ref:l,style:{...N.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:y=>{const g=k(y.clientY);u?.(g)},onSlideMove:y=>{const g=k(y.clientY);o?.(g)},onSlideEnd:()=>{h.current=void 0,d?.()},onStepKeyDown:y=>{const p=Ve[S?"from-bottom":"from-top"].includes(y.key);x?.({event:y,direction:p?-1:1})}})})}),Qe=i.forwardRef((t,a)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:o,onEndKeyDown:d,onStepKeyDown:x,...N}=t,j=de(ee,n);return e.jsx(ie.span,{...N,ref:a,onKeyDown:X(t.onKeyDown,l=>{l.key==="Home"?(o(l),l.preventDefault()):l.key==="End"?(d(l),l.preventDefault()):Le.concat(ze).includes(l.key)&&(x(l),l.preventDefault())}),onPointerDown:X(t.onPointerDown,l=>{const h=l.target;h.setPointerCapture(l.pointerId),l.preventDefault(),j.thumbs.has(h)?h.focus():r(l)}),onPointerMove:X(t.onPointerMove,l=>{l.target.hasPointerCapture(l.pointerId)&&c(l)}),onPointerUp:X(t.onPointerUp,l=>{const h=l.target;h.hasPointerCapture(l.pointerId)&&(h.releasePointerCapture(l.pointerId),u(l))})})}),$e="SliderTrack",Ye=i.forwardRef((t,a)=>{const{__scopeSlider:n,...r}=t,c=de($e,n);return e.jsx(ie.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...r,ref:a})});Ye.displayName=$e;var je="SliderRange",Ge=i.forwardRef((t,a)=>{const{__scopeSlider:n,...r}=t,c=de(je,n),u=Ue(je,n),o=i.useRef(null),d=Z(a,o),x=c.values.length,N=c.values.map(h=>Xe(h,c.min,c.max)),j=x>1?Math.min(...N):0,l=100-Math.max(...N);return e.jsx(ie.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...r,ref:d,style:{...t.style,[u.startEdge]:j+"%",[u.endEdge]:l+"%"}})});Ge.displayName=je;var ye="SliderThumb",Je=i.forwardRef((t,a)=>{const n=Bt(t.__scopeSlider),[r,c]=i.useState(null),u=Z(a,d=>c(d)),o=i.useMemo(()=>r?n().findIndex(d=>d.ref.current===r):-1,[n,r]);return e.jsx(Ot,{...t,ref:u,index:o})}),Ot=i.forwardRef((t,a)=>{const{__scopeSlider:n,index:r,name:c,...u}=t,o=de(ye,n),d=Ue(ye,n),[x,N]=i.useState(null),j=Z(a,M=>N(M)),l=x?o.form||!!x.closest("form"):!0,h=ct(x),S=o.values[r],k=S===void 0?0:Xe(S,o.min,o.max),y=Qt(r,o.values.length),g=h?.[d.size],p=g?Yt(g,k,d.direction):0;return i.useEffect(()=>{if(x)return o.thumbs.add(x),()=>{o.thumbs.delete(x)}},[x,o.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${k}% + ${p}px)`},children:[e.jsx(ve.ItemSlot,{scope:t.__scopeSlider,children:e.jsx(ie.span,{role:"slider","aria-label":t["aria-label"]||y,"aria-valuemin":o.min,"aria-valuenow":S,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...u,ref:j,style:S===void 0?{display:"none"}:t.style,onFocus:X(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),l&&e.jsx(We,{name:c??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:S},r)]})});Je.displayName=ye;var Ht="RadioBubbleInput",We=i.forwardRef(({__scopeSlider:t,value:a,...n},r)=>{const c=i.useRef(null),u=Z(c,r),o=pt(a);return i.useEffect(()=>{const d=c.current;if(!d)return;const x=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(x,"value").set;if(o!==a&&j){const l=new Event("input",{bubbles:!0});j.call(d,a),d.dispatchEvent(l)}},[o,a]),e.jsx(ie.input,{style:{display:"none"},...n,ref:u,defaultValue:a})});We.displayName=Ht;function Ut(t=[],a,n){const r=[...t];return r[n]=a,r.sort((c,u)=>c-u)}function Xe(t,a,n){const u=100/(n-a)*(t-a);return Ke(u,[0,100])}function Qt(t,a){return a>2?`Value ${t+1} of ${a}
1`:a===2?["Minimum","Maximum"][t]:void 0}function $t(t,a){if(t.length===1)return 0;const n=t.map(c=>Math.abs(c-a)),r=Math.min(...n);return n.indexOf(r)}function Yt(t,a,n){const r=t/2,u=Ne([0,50],[0,r]);return(r-u(a)*n)*n}function Gt(t){return t.slice(0,-1).map((a,n)=>t[n+1]-a)}function Jt(t,a){if(a>0){const n=Gt(t);return Math.min(...n)>=a}return!0}function Ne(t,a){return n=>{if(t[0]===t[1]||a[0]===a[1])return a[0];const r=(a[1]-a[0])/(t[1]-t[0]);return a[0]+r*(n-t[0])}}function Wt(t){return(String(t).split(".")[1]||"").length}function Xt(t,a){const n=Math.pow(10,a);return Math.round(t*n)/n}var Ze=Oe,Zt=Ye,es=Ge,ts=Je;const Se=i.forwardRef(({className:t,...a},n)=>e.jsxs(Ze,{ref:n,className:ut("relative flex w-full touch-none select-none items-center",t),...a,children:[e.jsx(Zt,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(es,{className:"absolute h-full bg-primary"})}),e.jsx(ts,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Se.displayName=Ze.displayName;const Ie=[{value:"governance",label:"Governance"},{value:"access-control",label:"Access Control"},{value:"monitoring",label:"Monitoring"},{value:"change-management",label:"Change Management"},{value:"vendor-management",label:"Vendor Management"},{value:"risk-assessment",label:"Risk Assessment"},{value:"incident-response",label:"Incident Response"},{value:"physical-security",label:"Physical Security"},{value:"asset-management",label:"Asset Management"}],Fe={none:{label:"None",variant:"outline"},light:{label:"Light",variant:"secondary"},moderate:{label:"Moderate",variant:"default"},full:{label:"Full",variant:"default"}};function ss(t,a){switch(t){case"none":return`Your AI is not yet calibrated. ${Math.max(0,10-a)} more signals to reach light personalization.`;case"light":return`Your AI has light calibration. ${Math.max(0,50-a)} more signals to reach moderate personalization.`;case"moderate":return`Your AI is moderately calibrated. ${Math.max(0,150-a)} more signals to reach full personalization.`;case"full":return"Your AI is fully calibrated to your audit style and judgment.";default:return""}}function as(t){switch(t){case"scoring":return e.jsx(Mt,{className:"h-4 w-4 text-blue-500"});case"style":return e.jsx(Kt,{className:"h-4 w-4 text-purple-500"});case"domain":return e.jsx(Be,{className:"h-4 w-4 text-green-500"});default:return e.jsx(_e,{className:"h-4 w-4 text-slate-500"})}}function ns(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ms(){const{toast:t}=mt(),a=ht(),[n,r]=i.useState("detailed"),[c,u]=i.useState("formal"),[o,d]=i.useState(!0),[x,N]=i.useState("standard"),[j,l]=i.useState("moderate"),[h,S]=i.useState(365),[k,y]=i.useState("1"),[g,p]=i.useState(!1),[M,b]=i.useState(85),[v,I]=i.useState([]),[L,te]=i.useState("general"),[F,oe]=i.useState(""),[K,w]=i.useState(null),[P,V]=i.useState(""),se=i.useRef(null),q=i.useRef(null),{data:f,isLoading:_}=ne({queryKey:["/api/auditor-profile"]}),{data:A}=ne({queryKey:["/api/auditor-profile/calibrations"]}),{data:R}=ne({queryKey:["/api/auditor-profile/insights"]}),{data:ue}=ne({queryKey:["/api/auditor-profile/domain-knowledge"]}),{data:me}=ne({queryKey:["/api/auditor-profile/methodology-docs"]});i.useEffect(()=>{f&&(r(f.findingFormat||"detailed"),u(f.formalityLevel||"formal"),d(f.includeRiskStatements??!0),N(f.remediationDepth||"standard"),l(f.riskAppetite||"moderate"),S(f.evidenceFreshnessThresholdDays||365),y(String(f.minEvidencePerControl||1)),p(f.autoAcceptConfidenceThreshold!==null),b(f.autoAcceptConfidenceThreshold??85),I(f.specializations||[]))},[f]);const he=B({mutationFn:async s=>(await z("PUT","/api/auditor-profile",s)).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile"]}),t({title:"Preferences saved",description:"Your audit preferences have been updated."})},onError:()=>{t({title:"Error",description:"Failed to save preferences.",variant:"destructive"})}}),xe=B({mutationFn:async s=>(await z("POST","/api/auditor-profile/reset",{resetKey:s})).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/insights"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/calibrations"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/domain-knowledge"]}),t({title:"Reset complete",description:"Learning data has been reset."})},onError:()=>{t({title:"Error",description:"Failed to reset learning data.",variant:"destructive"})}}),pe=B({mutationFn:async s=>(await z("POST","/api/auditor-profile/domain-knowledge",s)).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile/domain-knowledge"]}),oe(""),t({title:"Note added",description:"Domain knowledge note created."})},onError:()=>{t({title:"Error",description:"Failed to create note.",variant:"destructive"})}}),be=B({mutationFn:async({id:s,knowledge:m})=>(await z("PATCH",`/api/auditor-profile/domain-knowledge/${s}`,{knowledge:m})).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile/domain-knowledge"]}),w(null),t({title:"Note updated"})},onError:()=>{t({title:"Error",description:"Failed to update note.",variant:"destructive"})}}),et=B({mutationFn:async s=>{await z("DELETE",`/api/auditor-profile/domain-knowledge/${s}`)},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile/domain-knowledge"]}),t({title:"Note deleted"})},onError:()=>{t({title:"Error",description:"Failed to delete note.",variant:"destructive"})}}),fe=B({mutationFn:async s=>{const m=new FormData;m.append("file",s);const D=await fetch("/api/auditor-profile/methodology-docs",{method:"POST",body:m,credentials:"include"});if(!D.ok)throw new Error("Upload failed");return D.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile/methodology-docs"]}),t({title:"Document uploaded",description:"Methodology document processed and chunked."})},onError:()=>{t({title:"Error",description:"Failed to upload document.",variant:"destructive"})}}),tt=B({mutationFn:async s=>{await z("DELETE",`/api/auditor-profile/methodology-docs/${s}`)},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile/methodology-docs"]}),t({title:"Document deleted"})},onError:()=>{t({title:"Error",description:"Failed to delete document.",variant:"destructive"})}}),ge=B({mutationFn:async s=>(await z("POST","/api/auditor-profile/import",s)).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["/api/auditor-profile"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/calibrations"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/insights"]}),a.invalidateQueries({queryKey:["/api/auditor-profile/domain-knowledge"]}),t({title:"Profile imported",description:"Auditor profile data has been imported."})},onError:()=>{t({title:"Error",description:"Failed to import profile.",variant:"destructive"})}}),st=()=>{he.mutate({findingFormat:n,formalityLevel:c,includeRiskStatements:o,remediationDepth:x,riskAppetite:j,evidenceFreshnessThresholdDays:h,minEvidencePerControl:parseInt(k),autoAcceptConfidenceThreshold:g?M:null,specializations:v})},at=s=>{I(m=>m.includes(s)?m.filter(D=>D!==s):[...m,s])},nt=async()=>{try{const s=await fetch("/api/auditor-profile/export",{credentials:"include"});if(!s.ok)throw new Error("Export failed");const m=await s.blob(),D=URL.createObjectURL(m),ae=document.createElement("a");ae.href=D,ae.download="auditor-profile-export.json",ae.click(),URL.revokeObjectURL(D),t({title:"Profile exported"})}catch{t({title:"Error",description:"Failed to export profile.",variant:"destructive"})}},rt=s=>{const m=s.target.files?.[0];if(!m)return;const D=new FileReader;D.onload=()=>{try{const ae=JSON.parse(D.result);ge.mutate(ae)}catch{t({title:"Error",description:"Invalid JSON file.",variant:"destructive"})}},D.readAsText(m),s.target.value=""},it=s=>{const m=s.target.files?.[0];m&&(fe.mutate(m),s.target.value="")};if(_)return e.jsx(Ee,{children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(le,{className:"h-8 w-8 animate-spin text-muted-foreground"})})});const Ce=R?.tier||"none",ke=Fe[Ce]||Fe.none;return e.jsx(Ee,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Audit Preferences"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure how AI assists your audit workflow"})]}),e.jsxs(T,{onClick:st,disabled:he.isPending,children:[he.isPending?e.jsx(le,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Et,{className:"mr-2 h-4 w-4"}),"Save Preferences"]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(O,{children:[e.jsxs(H,{
vendor: 1,570 bytes, line 1
1children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-5 w-5"})," Style Preferences"]}),e.jsx(Q,{children:"Control how AI generates findings and reports"})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Finding Format"}),e.jsxs(Y,{value:n,onValueChange:r,children:[e.jsx(G,{children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"detailed",children:"Detailed"}),e.jsx(C,{value:"concise",children:"Concise"}),e.jsx(C,{value:"bullet-points",children:"Bullet Points"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Formality Level"}),e.jsxs(Y,{value:c,onValueChange:u,children:[e.jsx(G,{children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"formal",children:"Formal"}),e.jsx(C,{value:"conversational",children:"Conversational"}),e.jsx(C,{value:"technical",children:"Technical"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"Include Risk Statements"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add risk context to findings"})]}),e.jsx(Pe,{checked:o,onCheckedChange:d})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Remediation Depth"}),e.jsxs(Y,{value:x,onValueChange:N,children:[e.jsx(G,{children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"minimal",children:"Minimal"}),e.jsx(C,{value:"standard",children:"Standard"}),e.jsx(C,{value:"comprehensive",children:"Comprehensive"})]})]})]})]})]}
1),e.jsxs(O,{children:[e.jsxs(H,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(It,{className:"h-5 w-5"})," Judgment Preferences"]}),e.jsx(Q,{children:"Tune how AI evaluates compliance"})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Risk Appetite"}),e.jsxs(Y,{value:j,onValueChange:l,children:[e.jsx(G,{children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"conservative",children:"Conservative"}),e.jsx(C,{value:"moderate",children:"Moderate"}),e.jsx(C,{value:"aggressive",children:"Aggressive"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{children:["Evidence Freshness Threshold: ",h," days"]}),e.jsx(Se,{value:[h],onValueChange:([s])=>S(s),min:30,max:730,step:30}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum age for evidence to be considered fresh"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Min Evidence Per Control"}),e.jsxs(Y,{value:k,onValueChange:y,children:[e.jsx(G,{children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"1",children:"1"}),e.jsx(C,{value:"2",children:"2"}),e.jsx(C,{value:"3",children:"3"})]})]})]}),e.jsx(re,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"Auto-Accept Threshold"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-accept AI mappings above this confidence"})]}),e.jsx(Pe,{checked:g,onCheckedChange:p})]}),g&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{children:["Confidence: ",M,"%"]}),e.jsx(Se,{value:[M],onValueChange:([s])=>b(s),min:70,max:95,step:5})]})]})]}
1),e.jsxs(O,{children:[e.jsxs(H,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(Dt,{className:"h-5 w-5"})," Domain Specializations"]}),e.jsx(Q,{children:"Select your areas of expertise"})]}),e.jsx($,{children:e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Ie.map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:s.value,checked:v.includes(s.value),onCheckedChange:()=>at(s.value)}),e.jsx("label",{htmlFor:s.value,className:"text-sm cursor-pointer",children:s.label})]},s.value))})})]}),e.jsxs(O,{children:[e.jsxs(H,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-5 w-5"})," AI Learning Dashboard"]}),e.jsx(Q,{children:"How AI has calibrated to your audit style"})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"Profile Strength"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[Math.round(R?.profileStrength??f?.profileStrength??0),"%"]}),e.jsx(ce,{variant:ke.variant,children:ke.label})]})]}),e.jsx(ft,{value:R?.profileStrength??f?.profileStrength??0,className:"h-2"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:ss(Ce,R?.totalSignals??f?.totalSignals??0)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"Total Learning Signals"}),e.jsx("span",{className:"text-sm font-medium",children:R?.totalSignals??f?.totalSignals??0})]}),e.jsx(re,{}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(T,{variant:"outline",size:"sm",className:"flex-1",onClick:nt,children:[e.jsx(Pt,{className:"h-4 w-4 mr-2"}),"Export Profile"]}),e.jsxs(T,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>q.current?.click(),disabled:ge.isPending,children:[ge.isPending?e.jsx(le,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Re,{className:"h-4 w-4 mr-2"}),"Import Profile"]}),e.jsx("input",{ref:q,type:"file",accept:".json",className:"hidden",onChange:rt})]}),R?.insights&&R.insights.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(re,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"What AI Has Learned"}),e.jsx("div",{className:"space-y-2",children:R.insights.map(s=>e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx("div",{className:"mt-0.5 shrink-0",children:as(s.category)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:s.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.basis})]})]}),e.jsxs(T,{variant:"ghost",size:"sm",className:"shrink-0 h-7 px-2 text-xs text-muted-foreground hover:text-destructive",onClick:()=>xe.mutate(s.resetKey),disabled:xe.isPending,children:[e.jsx(Te,{className:"h-3 w-3 mr-1"}),"Reset"]})]},s.id))})]})]}),A&&A.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(re,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"Scoring Calibration"}),e.jsx("div",{className:"rounded-md border",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Domain"}),e.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Bias"}),e.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Samples"})]})}),e.jsx("tbody",{children:A.map(s=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"px-3 py-2",children:s.controlDomain}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs(ce,{variant:s.averageBias>0?"default":s.averageBias<0?"secondary":"outline",children:[s.averageBias>0?"+":"",s.averageBias.toFixed(1)]})}),e.jsx("td",{className:"px-3 py-2 text-right",children:s.sampleCount})]},s.id))})]})})]})]}),e.jsx(re,{}),e.jsxs(vt,{children:[e.jsx(jt,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"w-full text-destructive hover:text-destructive",children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Reset All Learning"]})}),e.jsxs(yt,{children:[e.jsxs(St,{children:[e.jsx(wt,{children:"Reset all AI learning?"}),e.jsx(Nt,{children:"This will clear all scoring calibrations, style examples, and domain knowledge learned from your audit activity. Your explicit preferences (above) will be kept. This action cannot be undone."})]}),e.jsxs(bt,{children:[e.jsx(Ct,{children:"Cancel"}),e.jsx(kt,{onClick:()=>xe.mutate("all"),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Reset All"})]})]})]})]})]}
1),e.jsxs(O,{children:[e.jsxs(H,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"h-5 w-5"})," Domain Knowledge"]}),e.jsx(Q,{children:"Audit rules and knowledge the AI applies to your audits"})]}),e.jsxs($,{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Y,{value:L,onValueChange:te,children:[e.jsx(G,{className:"w-[180px]",children:e.jsx(J,{})}),e.jsxs(W,{children:[e.jsx(C,{value:"general",children:"General"}),Ie.map(s=>e.jsx(C,{value:s.value,children:s.label},s.value))]})]}),e.jsx(De,{placeholder:"Add audit knowledge or rule...",value:F,onChange:s=>oe(s.target.value),onKeyDown:s=>{s.key==="Enter"&&F.trim()&&pe.mutate({controlDomain:L,knowledge:F.trim()})},className:"flex-1"}),e.jsx(T,{size:"sm",onClick:()=>{F.trim()&&pe.mutate({controlDomain:L,knowledge:F.trim()})},disabled:!F.trim()||pe.isPending,children:e.jsx(At,{className:"h-4 w-4"})})]})}),ue&&ue.length>0?e.jsx("div",{className:"space-y-2",children:ue.map(s=>e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ce,{variant:"outline",className:"text-xs",children:s.controlDomain}),e.jsx(ce,{variant:"secondary",className:"text-xs",children:s.source})]}),K===s.id?e.jsx(De,{value:P,onChange:m=>V(m.target.value),onKeyDown:m=>{m.key==="Enter"?be.mutate({id:s.id,knowledge:P}):m.key==="Escape"&&w(null)},autoFocus:!0,className:"text-sm"}):e.jsx("p",{className:"text-sm",children:s.knowledge})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.jsx(T,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{K===s.id?be.mutate({id:s.id,knowledge:P}):(w(s.id),V(s.knowledge))},children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsx(T,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:()=>et.mutate(s.id),children:e.jsx(Me,{className:"h-3 w-3"})})]})]},s.id))}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No domain knowledge yet. Add notes above or let AI learn from your audit activity."})]})]}
1),e.jsxs(O,{children:[e.jsxs(H,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-5 w-5"})," Firm Methodology Documents"]}),e.jsx(Q,{children:"Upload methodology docs to enhance AI audit context"})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>se.current?.click(),disabled:fe.isPending,children:[fe.isPending?e.jsx(le,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Re,{className:"h-4 w-4 mr-2"}),"Upload Document"]}),e.jsx("input",{ref:se,type:"file",accept:".pdf,.txt,.md,.docx",className:"hidden",onChange:it}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Accepted: .pdf, .txt, .md, .docx (max 10MB)"}),me&&me.length>0?e.jsx("div",{className:"space-y-2",children:me.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.fileName}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[ns(s.fileSize)," · ",s.chunkCount," chunks"]})]}),e.jsx(T,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>tt.mutate(s.id),children:e.jsx(Me,{className:"h-3 w-3"})})]},s.id))}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No methodology documents uploaded yet."})]})]})]})]})})}export{Ms as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.