@tantainnovative/ndpr-toolkit 4.1.0 → 5.0.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/chunk-4FXRJH37.js +1 -0
  3. package/dist/{chunk-UJGNW6CH.js → chunk-ASEUTU45.js} +1 -1
  4. package/dist/chunk-BRJKIF7E.mjs +1 -0
  5. package/dist/chunk-CSE36REY.js +6 -0
  6. package/dist/chunk-DKLJ5DYN.js +1 -0
  7. package/dist/chunk-FRMVSG4N.mjs +1 -0
  8. package/dist/chunk-MAD7QYRK.js +1 -0
  9. package/dist/chunk-NBOJ2KGN.mjs +1 -0
  10. package/dist/chunk-PQ5IPUJN.mjs +1 -0
  11. package/dist/chunk-QKXGVT2Q.js +1 -0
  12. package/dist/chunk-R2ZZMATR.js +1 -0
  13. package/dist/chunk-R3ZKV2J7.mjs +1 -0
  14. package/dist/chunk-RRVML7CU.mjs +1 -0
  15. package/dist/{chunk-6H6IXTHA.mjs → chunk-SBSYHCPK.mjs} +1 -1
  16. package/dist/chunk-TLIHFGIJ.js +1 -0
  17. package/dist/{chunk-O4ATGGVK.js → chunk-TVA6D6S4.js} +1 -1
  18. package/dist/chunk-WPH6CJDL.mjs +6 -0
  19. package/dist/{chunk-6OPGI27L.mjs → chunk-ZSRO4L3C.mjs} +1 -1
  20. package/dist/consent.d.mts +59 -21
  21. package/dist/consent.d.ts +59 -21
  22. package/dist/consent.js +1 -1
  23. package/dist/consent.mjs +1 -1
  24. package/dist/core.d.mts +116 -74
  25. package/dist/core.d.ts +116 -74
  26. package/dist/core.js +1 -1
  27. package/dist/core.mjs +1 -1
  28. package/dist/cross-border.d.mts +4 -27
  29. package/dist/cross-border.d.ts +4 -27
  30. package/dist/cross-border.js +1 -1
  31. package/dist/cross-border.mjs +1 -1
  32. package/dist/dsr.d.mts +86 -57
  33. package/dist/dsr.d.ts +86 -57
  34. package/dist/dsr.js +1 -1
  35. package/dist/dsr.mjs +1 -1
  36. package/dist/headless.d.mts +20 -27
  37. package/dist/headless.d.ts +20 -27
  38. package/dist/headless.js +1 -1
  39. package/dist/headless.mjs +1 -1
  40. package/dist/hooks.d.mts +20 -27
  41. package/dist/hooks.d.ts +20 -27
  42. package/dist/hooks.js +1 -1
  43. package/dist/hooks.mjs +1 -1
  44. package/dist/index.d.mts +37 -202
  45. package/dist/index.d.ts +37 -202
  46. package/dist/index.js +1 -1
  47. package/dist/index.mjs +1 -1
  48. package/dist/lawful-basis.d.mts +3 -24
  49. package/dist/lawful-basis.d.ts +3 -24
  50. package/dist/lawful-basis.js +1 -1
  51. package/dist/lawful-basis.mjs +1 -1
  52. package/dist/presets.d.mts +1 -9
  53. package/dist/presets.d.ts +1 -9
  54. package/dist/presets.js +1 -1
  55. package/dist/presets.mjs +1 -1
  56. package/dist/ropa-lite.d.mts +2 -11
  57. package/dist/ropa-lite.d.ts +2 -11
  58. package/dist/ropa-lite.js +1 -1
  59. package/dist/ropa-lite.mjs +1 -1
  60. package/dist/ropa.d.mts +10 -52
  61. package/dist/ropa.d.ts +10 -52
  62. package/dist/ropa.js +1 -1
  63. package/dist/ropa.mjs +1 -1
  64. package/dist/server.d.mts +20 -100
  65. package/dist/server.d.ts +20 -100
  66. package/dist/server.js +1 -1
  67. package/dist/server.mjs +1 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-3APT25XO.mjs +0 -1
  70. package/dist/chunk-45D7AMB3.js +0 -1
  71. package/dist/chunk-65J4P5ID.js +0 -1
  72. package/dist/chunk-7Z7NURIA.mjs +0 -1
  73. package/dist/chunk-D3HHDWBR.js +0 -1
  74. package/dist/chunk-DSIIEUAD.mjs +0 -1
  75. package/dist/chunk-H2FDWK4F.js +0 -6
  76. package/dist/chunk-HLFS3NXG.js +0 -1
  77. package/dist/chunk-JGY65SHX.mjs +0 -1
  78. package/dist/chunk-NI54X543.mjs +0 -1
  79. package/dist/chunk-P5MPUC5F.js +0 -1
  80. package/dist/chunk-ROOUYQD4.js +0 -1
  81. package/dist/chunk-UTXDZDYF.mjs +0 -6
  82. package/dist/chunk-W6VVLHRQ.mjs +0 -1
@@ -1 +0,0 @@
1
- import {d,c as c$1,a as a$1,b as b$1}from'./chunk-LWIKDDSU.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useRef,useEffect,useState,useMemo,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var W={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},de=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],oe=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],Le={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},Te={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"},Fe={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},Ie={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},$e=({activities:g,onAddActivity:f,onUpdateActivity:b$2,onArchiveActivity:h,onAdd:_,onUpdate:w,onArchive:x,title:R,description:N,className:se="",buttonClassName:C="",showSummary:pe=true,showComplianceGaps:ue=true,classNames:i,unstyled:l})=>{var ie,re;let Y=useRef(false);useEffect(()=>{if(process.env.NODE_ENV==="production"||Y.current)return;let e=[];f!==void 0&&_===void 0&&e.push("onAddActivity -> onAdd"),b$2!==void 0&&w===void 0&&e.push("onUpdateActivity -> onUpdate"),h!==void 0&&x===void 0&&e.push("onArchiveActivity -> onArchive"),e.length>0&&(Y.current=true,console.warn(`[ndpr-toolkit/lawful-basis] Deprecated callback prop name(s): ${e.join(", ")}. Will be removed in 5.0.`));},[f,b$2,h,_,w,x]);let z=c(),ce=(ie=R!=null?R:z.lawfulBasis.title)!=null?ie:"Lawful Basis Tracker",ge=(re=N!=null?N:z.lawfulBasis.description)!=null?re:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",[S,D]=useState("list"),[a$3,A]=useState(W),[m,O]=useState(null),[$,ve]=useState(null),[T,me]=useState("all"),[F,fe]=useState("all"),[I,be]=useState(""),[c$2,P]=useState([]),K=useMemo(()=>{let e=[...g];if(T!=="all"&&(e=e.filter(o=>o.status===T)),F!=="all"&&(e=e.filter(o=>o.lawfulBasis===F)),I){let o=I.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(o)||p.description.toLowerCase().includes(o)||p.purposes.some(V=>V.toLowerCase().includes(o)));}return e.sort((o,p)=>p.updatedAt-o.updatedAt),e},[g,T,F,I]),k=useCallback(e=>new Date(e).toLocaleDateString(),[]),j=useMemo(()=>d(g),[g]),B=useMemo(()=>c$1(g),[g]),L=useCallback(e=>e.split(",").map(o=>o.trim()).filter(o=>o.length>0),[]),he=useCallback(()=>{A(W),O(null),P([]),D("form");},[]),Q=useCallback(e=>{A({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),O(e.id),P([]),D("form");},[]),_e=useCallback(()=>{let e={name:a$3.name,description:a$3.description,lawfulBasis:a$3.lawfulBasis,lawfulBasisJustification:a$3.lawfulBasisJustification,dataCategories:L(a$3.dataCategories),involvesSensitiveData:a$3.involvesSensitiveData,sensitiveDataCondition:a$3.sensitiveDataCondition||void 0,dataSubjectCategories:L(a$3.dataSubjectCategories),purposes:L(a$3.purposes),retentionPeriod:a$3.retentionPeriod,retentionJustification:a$3.retentionJustification||void 0,recipients:a$3.recipients?L(a$3.recipients):void 0,crossBorderTransfer:a$3.crossBorderTransfer,reviewDate:a$3.reviewDate?new Date(a$3.reviewDate).getTime():void 0,status:"active"},o=b(a({},e),{id:m||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=a$1(o);if(!p.isValid){P(p.errors);return}m?(w==null||w(m,e),b$2==null||b$2(m,e)):(_==null||_(e),f==null||f(e)),A(W),O(null),P([]),D("list");},[a$3,m,b$2,f,w,_,L]),X=useCallback(e=>{x==null||x(e),h==null||h(e);},[h,x]),we=useCallback(e=>{ve(e),D("detail");},[]),n=useMemo(()=>$?g.find(e=>e.id===$):null,[g,$]),Z=useCallback(e=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${Le[e]}`,i==null?void 0:i.statusBadge,l),children:Te[e]}),[i==null?void 0:i.statusBadge,l]),U=useCallback(e=>jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${Fe[e]}`,children:Ie[e]}),[]),ee=useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),xe=()=>jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:a$2("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,l),role:"status","aria-label":"Compliance summary",children:[jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:j.totalActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxs("div",{className:a$2("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,l),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:j.sensitiveDataActivities}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:j.crossBorderActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,l),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:j.activitiesWithoutApproval.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),G=useMemo(()=>B.filter(e=>e.severity==="high"),[B]),q=useMemo(()=>B.filter(e=>e.severity==="medium"),[B]),Ce=()=>B.length===0?jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxs("div",{className:"mb-6",role:"status","aria-label":`${B.length} compliance gaps detected`,children:[G.length>0&&jsxs("div",{className:a$2("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,l),children:[jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",G.length,")"]}),jsx("ul",{className:"space-y-1",children:G.map((e,o)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},o))})]}),q.length>0&&jsxs("div",{className:a$2("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,l),children:[jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",q.length,")"]}),jsx("ul",{className:"space-y-1",children:q.map((e,o)=>jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},o))})]})]}),te=useCallback(()=>{D("list"),P([]);},[]),De=useCallback(()=>{D("list");},[]),s=useCallback((e,o)=>{A(p=>b(a({},p),{[e]:o}));},[]),Be=useCallback(e=>{A(o=>b(a({},o),{involvesSensitiveData:e,sensitiveDataCondition:e?o.sensitiveDataCondition:""}));},[]),ye=()=>jsxs("div",{className:a$2("",i==null?void 0:i.form,l),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",i==null?void 0:i.header,l),children:[jsx("h3",{className:"ndpr-section-heading",children:m?"Edit Processing Activity":"New Processing Activity"}),jsx("button",{onClick:te,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${C}`,children:"Cancel"})]}),c$2.length>0&&jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:c$2.map((e,o)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e},o))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"activityName",value:a$3.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"activityDescription",value:a$3.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsx("select",{id:"lawfulBasis",value:a$3.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,l),children:de.map(e=>jsx("option",{value:e.value,children:e.label},e.value))}),jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:b$1(a$3.lawfulBasis)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsx("textarea",{id:"justification",value:a$3.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),a$3.lawfulBasis==="legitimate_interests"&&jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsx("textarea",{id:"liaPurpose",value:a$3.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsx("textarea",{id:"liaNecessity",value:a$3.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsx("textarea",{id:"liaBalancing",value:a$3.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsx("input",{type:"text",id:"liaSafeguards",value:a$3.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsx("textarea",{id:"liaConclusion",value:a$3.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsx("input",{type:"text",id:"dataCategories",value:a$3.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.involvesSensitiveData,onChange:e=>Be(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a$3.involvesSensitiveData&&jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxs("select",{id:"sensitiveCondition",value:a$3.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsx("option",{value:"",children:"Select a condition..."}),oe.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:a$3.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsx("input",{type:"text",id:"purposes",value:a$3.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:a$3.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:a$3.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsx("input",{type:"text",id:"recipients",value:a$3.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxs("div",{children:[jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"reviewDate",value:a$3.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsx("button",{onClick:te,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${C}`,children:"Cancel"}),jsx("button",{onClick:_e,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${C}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:m?"Update Activity":"Create Activity"})]})]})]}),Se=()=>{var o;if(!n)return jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=a$1(n);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("div",{children:[jsx("button",{onClick:De,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxs("div",{className:"ndpr-card__footer",children:[U(n.lawfulBasis),Z(n.status),ee(n)]})]}),e.warnings.length>0&&jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,V)=>jsx("li",{className:"text-xs ndpr-text-warning",children:p},V))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",b$1(n.lawfulBasis)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxs("span",{children:[" ","(Condition:"," ",((o=oe.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:o.label)||n.sensitiveDataCondition,")"]})]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Created:"})," ",k(n.createdAt)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Last Updated:"})," ",k(n.updatedAt)]}),n.reviewDate&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",k(n.reviewDate),n.reviewDate<Date.now()&&jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Date:"})," ",k(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxs("div",{className:"flex space-x-3",children:[jsx("button",{onClick:()=>Q(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${C}`,children:"Edit"}),n.status!=="archived"&&jsx("button",{onClick:()=>X(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${C}`,children:"Archive"})]})]})},Ae=()=>jsxs("div",{children:[jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"basisFilter",value:F,onChange:e=>fe(e.target.value),"aria-label":"Filter by lawful basis",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsx("option",{value:"all",children:"All Bases"}),de.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"statusFilterSelect",value:T,onChange:e=>me(e.target.value),"aria-label":"Filter by status",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"active",children:"Active"}),jsx("option",{value:"inactive",children:"Inactive"}),jsx("option",{value:"under_review",children:"Under Review"}),jsx("option",{value:"archived",children:"Archived"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchInput",value:I,onChange:e=>be(e.target.value),placeholder:"Search activities...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsx("div",{className:"flex items-end",children:jsx("button",{onClick:he,className:a$2(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${C}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:"Add Activity"})})]}),K.length===0?jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",i==null?void 0:i.table,l),children:[jsx("thead",{className:a$2("ndpr-table__head",i==null?void 0:i.tableHeader,l),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:K.map(e=>jsxs("tr",{className:a$2("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,l),children:[jsxs("td",{className:"ndpr-table__cell",children:[jsx("button",{onClick:()=>we(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsx("td",{className:"ndpr-table__cell",children:U(e.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:Z(e.status)}),jsx("td",{className:"ndpr-table__cell",children:ee(e)}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:k(e.updatedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>Q(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsx("button",{onClick:()=>X(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${se}`,i==null?void 0:i.root,l),children:[jsx("h2",{className:a$2("ndpr-section-heading",i==null?void 0:i.title,l),children:ce}),jsx("p",{className:"ndpr-card__subtitle",children:ge}),pe&&S==="list"&&xe(),ue&&S==="list"&&Ce(),S==="list"&&Ae(),S==="form"&&ye(),S==="detail"&&Se()]})};export{$e as a};
@@ -1,6 +0,0 @@
1
- 'use strict';var chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var G=[{value:"adequacy_decision",label:"Adequacy Decision (Section 41)"},{value:"standard_clauses",label:"Standard Contractual Clauses (Section 42)"},{value:"binding_corporate_rules",label:"Binding Corporate Rules (Section 43)"},{value:"ndpc_authorization",label:"NDPC Authorization (Section 44)"},{value:"explicit_consent",label:"Explicit Consent (Section 45(a))"},{value:"contract_performance",label:"Contract Performance (Section 45(b))"},{value:"public_interest",label:"Public Interest (Section 45(c))"},{value:"legal_claims",label:"Legal Claims (Section 45(d))"},{value:"vital_interests",label:"Vital Interests (Section 45(e))"}],oe=[{value:"adequate",label:"Adequate"},{value:"inadequate",label:"Inadequate"},{value:"pending_review",label:"Pending Review"},{value:"unknown",label:"Unknown"}],le=[{value:"one_time",label:"One-Time"},{value:"periodic",label:"Periodic"},{value:"continuous",label:"Continuous"}],se=[{value:"active",label:"Active"},{value:"suspended",label:"Suspended"},{value:"terminated",label:"Terminated"},{value:"pending_approval",label:"Pending Approval"}],we={low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--destructive"},Re={active:"ndpr-badge ndpr-badge--success",suspended:"ndpr-badge ndpr-badge--warning",terminated:"ndpr-badge ndpr-badge--neutral",pending_approval:"ndpr-badge ndpr-badge--info"},qe={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"},ce={destinationCountry:"",destinationCountryCode:"",adequacyStatus:"unknown",transferMechanism:"adequacy_decision",dataCategories:"",includesSensitiveData:false,estimatedDataSubjects:"",recipientOrganization:"",recipientContactName:"",recipientContactEmail:"",recipientContactPhone:"",recipientContactAddress:"",purpose:"",safeguards:"",riskAssessment:"",riskLevel:"medium",frequency:"one_time",status:"active",tiaCompleted:false,tiaReference:"",ndpcApprovalApplied:false,ndpcApprovalApproved:false,ndpcApprovalReference:""},Oe=({transfers:h,onAddTransfer:C,onUpdateTransfer:_,onRemoveTransfer:x,onAdd:A,onUpdate:y,onArchive:S,summary:N,title:I,description:O,className:ue="",buttonClassName:E="",showSummary:me=true,showTIA:ve=true,classNames:r,unstyled:d})=>{var te,re;let H=react.useRef(false);react.useEffect(()=>{if(process.env.NODE_ENV==="production"||H.current)return;let e=[];C!==void 0&&A===void 0&&e.push("onAddTransfer -> onAdd"),_!==void 0&&y===void 0&&e.push("onUpdateTransfer -> onUpdate"),x!==void 0&&S===void 0&&e.push("onRemoveTransfer -> onArchive"),e.length>0&&(H.current=true,console.warn(`[ndpr-toolkit/cross-border] Deprecated callback prop name(s): ${e.join(", ")}. Will be removed in 5.0.`));},[C,_,x,A,y,S]);let K=chunkYDKWD6MQ_js.c(),fe=(te=I!=null?I:K.crossBorder.title)!=null?te:"Cross-Border Data Transfer Manager",be=(re=O!=null?O:K.crossBorder.description)!=null?re:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43).",[f,R]=react.useState(null),[W,q]=react.useState(false),[b,Y]=react.useState(null),[n,L]=react.useState(ce),[k,Q]=react.useState(null),[F,ge]=react.useState("all"),[B,he]=react.useState("all"),T=react.useMemo(()=>{let e=[...h];return F!=="all"&&(e=e.filter(a=>a.status===F)),B!=="all"&&(e=e.filter(a=>a.transferMechanism===B)),e.sort((a,o)=>o.updatedAt-a.updatedAt),e},[h,F,B]);react.useEffect(()=>{T.length>0&&!f&&R(T[0].id);},[T,f]);let U=react.useMemo(()=>{var e;return f&&(e=h.find(a=>a.id===f))!=null?e:null},[h,f]),w=react.useCallback(e=>new Date(e).toLocaleDateString(),[]),D=react.useCallback(()=>{L(ce),Y(null),Q(null);},[]),Ce=react.useCallback(()=>{D(),q(true);},[D]),_e=react.useCallback(e=>{var a,o,u,v;Y(e.id),L({destinationCountry:e.destinationCountry,destinationCountryCode:e.destinationCountryCode||"",adequacyStatus:e.adequacyStatus,transferMechanism:e.transferMechanism,dataCategories:e.dataCategories.join(", "),includesSensitiveData:e.includesSensitiveData,estimatedDataSubjects:((a=e.estimatedDataSubjects)==null?void 0:a.toString())||"",recipientOrganization:e.recipientOrganization,recipientContactName:e.recipientContact.name,recipientContactEmail:e.recipientContact.email,recipientContactPhone:e.recipientContact.phone||"",recipientContactAddress:e.recipientContact.address||"",purpose:e.purpose,safeguards:e.safeguards.join(`
2
- `),riskAssessment:e.riskAssessment,riskLevel:e.riskLevel,frequency:e.frequency,status:e.status,tiaCompleted:e.tiaCompleted,tiaReference:e.tiaReference||"",ndpcApprovalApplied:((o=e.ndpcApproval)==null?void 0:o.applied)||false,ndpcApprovalApproved:((u=e.ndpcApproval)==null?void 0:u.approved)||false,ndpcApprovalReference:((v=e.ndpcApproval)==null?void 0:v.referenceNumber)||""}),q(true);},[]),l=react.useCallback((e,a)=>{L(o=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},o),{[e]:a}));},[]),J=react.useCallback(()=>{let e=chunkYFBDJ4FH_js.e(n.transferMechanism),a=Date.now();return {destinationCountry:n.destinationCountry.trim(),destinationCountryCode:n.destinationCountryCode.trim()||void 0,adequacyStatus:n.adequacyStatus,transferMechanism:n.transferMechanism,dataCategories:n.dataCategories.split(",").map(o=>o.trim()).filter(Boolean),includesSensitiveData:n.includesSensitiveData,estimatedDataSubjects:n.estimatedDataSubjects?parseInt(n.estimatedDataSubjects,10):void 0,recipientOrganization:n.recipientOrganization.trim(),recipientContact:{name:n.recipientContactName.trim(),email:n.recipientContactEmail.trim(),phone:n.recipientContactPhone.trim()||void 0,address:n.recipientContactAddress.trim()||void 0},purpose:n.purpose.trim(),safeguards:n.safeguards.split(`
3
- `).map(o=>o.trim()).filter(Boolean),riskAssessment:n.riskAssessment.trim(),riskLevel:n.riskLevel,frequency:n.frequency,status:e&&!n.ndpcApprovalApproved?"pending_approval":n.status,tiaCompleted:n.tiaCompleted,tiaReference:n.tiaReference.trim()||void 0,ndpcApproval:e?{required:true,applied:n.ndpcApprovalApplied,approved:n.ndpcApprovalApproved||void 0,referenceNumber:n.ndpcApprovalReference.trim()||void 0,appliedAt:n.ndpcApprovalApplied?a:void 0,approvedAt:n.ndpcApprovalApproved?a:void 0}:void 0,startDate:a,reviewDate:a+365*24*60*60*1e3}},[n]),xe=react.useCallback(()=>{let e=J(),a=chunkRFPLZDIO_js.a({id:b||"temp",createdAt:Date.now(),updatedAt:Date.now()},e),o=chunkYFBDJ4FH_js.g(a);Q(o),o.isValid&&(b?(y==null||y(b,e),_==null||_(b,e)):(A==null||A(e),C==null||C(e)),D(),q(false));},[J,b,_,C,y,A,D]),X=react.useCallback(()=>{D(),q(false);},[D]),Ae=react.useCallback(e=>{S==null||S(e),x==null||x(e),f===e&&R(null);},[x,S,f]),Z=react.useCallback(e=>jsxRuntime.jsxs("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${we[e]}`,r==null?void 0:r.riskBadge,d),children:[e.charAt(0).toUpperCase()+e.slice(1)," Risk"]}),[r==null?void 0:r.riskBadge,d]),ee=react.useCallback(e=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${Re[e]}`,r==null?void 0:r.statusBadge,d),children:qe[e]}),[r==null?void 0:r.statusBadge,d]),ye=react.useCallback(e=>{var u;chunkYFBDJ4FH_js.e(e);let o=((u=G.find(v=>v.value===e))==null?void 0:u.label)||e;return jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium ndpr-badge ndpr-badge--info",children:o})},[]),M=react.useMemo(()=>{var v,c;if(N)return N;let e=0,a=[],o=[],u=[];for(let s of h){let j=s.status==="active";j&&e++,(s.status==="pending_approval"||(v=s.ndpcApproval)!=null&&v.required&&!((c=s.ndpcApproval)!=null&&c.approved))&&a.push(s),s.riskLevel==="high"&&j&&o.push(s),!s.tiaCompleted&&j&&u.push(s);}return {totalActiveTransfers:e,pendingApproval:a,highRiskTransfers:o,missingTIA:u,byMechanism:{},byAdequacy:{},dueForReview:[],lastUpdated:Date.now()}},[N,h]),Se=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"cross-border-transfer-manager",role:"status","aria-label":"Transfer compliance summary",className:chunkAME4HJR4_js.a("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,d),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:M.totalActiveTransfers}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Active Transfers"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:M.pendingApproval.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Pending Approval"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--destructive",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:M.highRiskTransfers.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive",children:"High Risk"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--warning",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:M.missingTIA.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Missing TIA"})]})]}),ke=()=>{let e=chunkYFBDJ4FH_js.e(n.transferMechanism);return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-lg mb-6",r==null?void 0:r.form,d),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-center mb-4",r==null?void 0:r.header,d),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:b?"Edit Transfer":"Add New Transfer"}),jsxRuntime.jsx("button",{onClick:X,"aria-label":"Cancel form",className:"text-gray-600 hover:ndpr-text-muted dark:hover:text-gray-200",children:"Cancel"})]}),k&&!k.isValid&&jsxRuntime.jsxs("div",{id:"cb-form-errors",role:"alert",className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:k.errors.map((a,o)=>jsxRuntime.jsx("li",{children:a},o))})]}),k&&k.warnings.length>0&&jsxRuntime.jsxs("div",{id:"cb-form-warnings",role:"alert",className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:k.warnings.map((a,o)=>jsxRuntime.jsx("li",{children:a},o))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-destinationCountry",className:"ndpr-form-field__label",children:["Destination Country ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-destinationCountry",type:"text",value:n.destinationCountry,onChange:a=>l("destinationCountry",a.target.value),placeholder:"e.g. United Kingdom","aria-required":"true","aria-describedby":"cb-form-errors","aria-label":"Destination country",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-destinationCountryCode",className:"ndpr-form-field__label",children:"Country Code (ISO)"}),jsxRuntime.jsx("input",{id:"cb-destinationCountryCode",type:"text",value:n.destinationCountryCode,onChange:a=>l("destinationCountryCode",a.target.value),placeholder:"e.g. GB",maxLength:3,"aria-label":"Country code in ISO format",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientOrganization",className:"ndpr-form-field__label",children:["Recipient Organization ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientOrganization",type:"text",value:n.recipientOrganization,onChange:a=>l("recipientOrganization",a.target.value),placeholder:"Organization name","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-transferMechanism",className:"ndpr-form-field__label",children:["Transfer Mechanism ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"cb-transferMechanism",value:n.transferMechanism,onChange:a=>l("transferMechanism",a.target.value),"aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:G.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-adequacyStatus",className:"ndpr-form-field__label",children:"Adequacy Status"}),jsxRuntime.jsx("select",{id:"cb-adequacyStatus",value:n.adequacyStatus,onChange:a=>l("adequacyStatus",a.target.value),"aria-label":"Select adequacy status of destination country",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:oe.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-riskLevel",className:"ndpr-form-field__label",children:"Risk Level"}),jsxRuntime.jsxs("select",{id:"cb-transfer-riskLevel",value:n.riskLevel,onChange:a=>l("riskLevel",a.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsxRuntime.jsx("option",{value:"low",children:"Low"}),jsxRuntime.jsx("option",{value:"medium",children:"Medium"}),jsxRuntime.jsx("option",{value:"high",children:"High"})]})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-dataCategories",className:"ndpr-form-field__label",children:["Data Categories ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-dataCategories",type:"text",value:n.dataCategories,onChange:a=>l("dataCategories",a.target.value),placeholder:"Comma-separated, e.g. Names, Email addresses, Phone numbers","aria-required":"true","aria-describedby":"cb-dataCategories-help",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsxRuntime.jsx("p",{id:"cb-dataCategories-help",className:"text-xs text-gray-500 mt-1",children:"Separate categories with commas"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"includesSensitiveData",checked:n.includesSensitiveData,onChange:a=>l("includesSensitiveData",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"includesSensitiveData",className:"ndpr-text-sm ndpr-font-medium",children:"Includes sensitive personal data"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-estimatedDataSubjects",className:"ndpr-form-field__label",children:"Estimated Data Subjects"}),jsxRuntime.jsx("input",{id:"cb-transfer-estimatedDataSubjects",type:"number",value:n.estimatedDataSubjects,onChange:a=>l("estimatedDataSubjects",a.target.value),placeholder:"Number of data subjects",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientContactName",className:"ndpr-form-field__label",children:["Recipient Contact Name ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientContactName",type:"text",value:n.recipientContactName,onChange:a=>l("recipientContactName",a.target.value),placeholder:"Contact person name","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientContactEmail",className:"ndpr-form-field__label",children:["Recipient Contact Email ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientContactEmail",type:"email",value:n.recipientContactEmail,onChange:a=>l("recipientContactEmail",a.target.value),placeholder:"contact@example.com","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-recipientContactPhone",className:"ndpr-form-field__label",children:"Recipient Contact Phone"}),jsxRuntime.jsx("input",{id:"cb-transfer-recipientContactPhone",type:"text",value:n.recipientContactPhone,onChange:a=>l("recipientContactPhone",a.target.value),placeholder:"Phone number",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-recipientContactAddress",className:"ndpr-form-field__label",children:"Recipient Contact Address"}),jsxRuntime.jsx("input",{id:"cb-transfer-recipientContactAddress",type:"text",value:n.recipientContactAddress,onChange:a=>l("recipientContactAddress",a.target.value),placeholder:"Address",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-purpose",className:"ndpr-form-field__label",children:["Purpose of Transfer ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"cb-purpose",value:n.purpose,onChange:a=>l("purpose",a.target.value),placeholder:"Describe the purpose of this data transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-safeguards",className:"ndpr-form-field__label",children:["Safeguards ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"cb-safeguards",value:n.safeguards,onChange:a=>l("safeguards",a.target.value),placeholder:`One safeguard per line, e.g.
4
- End-to-end encryption
5
- Access control policies
6
- Regular security audits`,rows:3,"aria-required":"true","aria-describedby":"cb-safeguards-help",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsxRuntime.jsx("p",{id:"cb-safeguards-help",className:"text-xs text-gray-500 mt-1",children:"Enter one safeguard per line"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-riskAssessment",className:"ndpr-form-field__label",children:["Risk Assessment Summary ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"cb-riskAssessment",value:n.riskAssessment,onChange:a=>l("riskAssessment",a.target.value),placeholder:"Summarize the risk assessment for this transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-frequency",className:"ndpr-form-field__label",children:"Transfer Frequency"}),jsxRuntime.jsx("select",{id:"cb-transfer-frequency",value:n.frequency,onChange:a=>l("frequency",a.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:le.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-status",className:"ndpr-form-field__label",children:"Status"}),jsxRuntime.jsx("select",{id:"cb-transfer-status",value:n.status,onChange:a=>l("status",a.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:se.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]})]}),e&&jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium ndpr-text-info mb-3",children:"NDPC Approval Required"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-info mb-3",children:"The selected transfer mechanism requires approval from the Nigeria Data Protection Commission."}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"ndpcApprovalApplied",checked:n.ndpcApprovalApplied,onChange:a=>l("ndpcApprovalApplied",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"ndpcApprovalApplied",className:"ndpr-text-sm",children:"Application submitted"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"ndpcApprovalApproved",checked:n.ndpcApprovalApproved,onChange:a=>l("ndpcApprovalApproved",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"ndpcApprovalApproved",className:"ndpr-text-sm",children:"Approval granted"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-ndpcApprovalReference",className:"ndpr-form-field__label",children:"NDPC Reference Number"}),jsxRuntime.jsx("input",{id:"cb-transfer-ndpcApprovalReference",type:"text",value:n.ndpcApprovalReference,onChange:a=>l("ndpcApprovalReference",a.target.value),placeholder:"Reference number (if available)",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),ve&&jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-gray-100 dark:bg-gray-600 rounded-md",children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium mb-3",children:"Transfer Impact Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"tiaCompleted",checked:n.tiaCompleted,onChange:a=>l("tiaCompleted",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"tiaCompleted",className:"ndpr-text-sm",children:"TIA completed"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-tiaReference",className:"ndpr-form-field__label",children:"TIA Reference"}),jsxRuntime.jsx("input",{id:"cb-transfer-tiaReference",type:"text",value:n.tiaReference,onChange:a=>l("tiaReference",a.target.value),placeholder:"Document reference",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),jsxRuntime.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[jsxRuntime.jsx("button",{onClick:X,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:"Cancel"}),jsxRuntime.jsx("button",{onClick:xe,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:b?"Update Transfer":"Add Transfer"})]})]})},De=e=>{var u,v;let a=chunkYFBDJ4FH_js.h(e),o=chunkYFBDJ4FH_js.g(e);return jsxRuntime.jsxs("div",{role:"status","aria-label":"Transfer details",className:chunkAME4HJR4_js.a("",r==null?void 0:r.detailPanel,d),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsxs("h3",{className:"ndpr-section-heading",children:[e.destinationCountry," \u2014 ",e.recipientOrganization]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[ee(e.status),Z(e.riskLevel)]})]}),!o.isValid&&jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Compliance Issues"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:o.errors.map((c,s)=>jsxRuntime.jsx("li",{children:c},s))})]}),o.warnings.length>0&&jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:o.warnings.map((c,s)=>jsxRuntime.jsx("li",{children:c},s))})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Destination:"})," ",e.destinationCountry,e.destinationCountryCode?` (${e.destinationCountryCode})`:""]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Adequacy:"})," ",(u=oe.find(c=>c.value===e.adequacyStatus))==null?void 0:u.label]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Frequency:"})," ",(v=le.find(c=>c.value===e.frequency))==null?void 0:v.label]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Start Date:"})," ",w(e.startDate)]}),e.endDate&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"End Date:"})," ",w(e.endDate)]}),e.reviewDate&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next Review:"})," ",w(e.reviewDate)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Recipient:"})," ",e.recipientOrganization]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",e.recipientContact.name," (",e.recipientContact.email,")"]}),e.estimatedDataSubjects&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subjects:"})," ",e.estimatedDataSubjects.toLocaleString()]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",e.includesSensitiveData?"Yes":"No"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Transfer Mechanism"}),jsxRuntime.jsx("div",{className:"ndpr-panel",children:jsxRuntime.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200",children:chunkYFBDJ4FH_js.f(e.transferMechanism)})})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Purpose"}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-muted bg-gray-50 dark:bg-gray-700 p-2 rounded-md",children:e.purpose})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Data Categories"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.dataCategories.map((c,s)=>jsxRuntime.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-600 rounded text-xs",children:c},s))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Safeguards"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-muted",children:e.safeguards.map((c,s)=>jsxRuntime.jsx("li",{children:c},s))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Risk Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200 mb-2",children:e.riskAssessment}),jsxRuntime.jsxs("div",{className:"mt-2",role:"status","aria-label":"Automated risk assessment result",children:[jsxRuntime.jsxs("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:["Automated Assessment (Score: ",a.riskScore,")"]}),a.factors.length>0&&jsxRuntime.jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.factors.map((c,s)=>jsxRuntime.jsx("li",{children:c},s))}),a.recommendations.length>0&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:"Recommendations:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.recommendations.map((c,s)=>jsxRuntime.jsx("li",{children:c},s))})]})]})]})]}),e.ndpcApproval&&jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"NDPC Approval"}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`p-3 rounded-md ${e.ndpcApproval.approved?"ndpr-alert ndpr-alert--success":e.ndpcApproval.applied?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive"}`,r==null?void 0:r.approvalStatus,d),children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",e.ndpcApproval.approved?"Approved":e.ndpcApproval.applied?"Application Submitted":"Not Applied"]}),e.ndpcApproval.referenceNumber&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reference:"})," ",e.ndpcApproval.referenceNumber]}),e.ndpcApproval.appliedAt&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Applied:"})," ",w(e.ndpcApproval.appliedAt)]}),e.ndpcApproval.approvedAt&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Approved:"})," ",w(e.ndpcApproval.approvedAt)]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Transfer Impact Assessment"}),jsxRuntime.jsxs("div",{className:`p-3 rounded-md ${e.tiaCompleted?"ndpr-alert ndpr-alert--success":"ndpr-alert ndpr-alert--warning"}`,children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",e.tiaCompleted?"Completed":"Not Completed"]}),e.tiaReference&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reference:"})," ",e.tiaReference]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-3 mt-6",children:[jsxRuntime.jsx("button",{onClick:()=>_e(e),"aria-label":`Edit transfer to ${e.destinationCountry}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,children:"Edit"}),jsxRuntime.jsx("button",{onClick:()=>Ae(e.id),"aria-label":`Remove transfer to ${e.destinationCountry}`,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Remove"})]})]})};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ue}`,r==null?void 0:r.root,d),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",r==null?void 0:r.title,d),children:fe}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:be}),me&&Se(),!W&&jsxRuntime.jsx("div",{className:"mb-6",children:jsxRuntime.jsx("button",{onClick:Ce,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:"Add Transfer"})}),W&&ke(),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cbStatusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxRuntime.jsxs("select",{id:"cbStatusFilter",value:F,onChange:e=>ge(e.target.value),"aria-label":"Filter transfers by status",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),se.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cbMechanismFilter",className:"ndpr-form-field__label",children:"Mechanism Filter"}),jsxRuntime.jsxs("select",{id:"cbMechanismFilter",value:B,onChange:e=>he(e.target.value),"aria-label":"Filter transfers by mechanism",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsxRuntime.jsx("option",{value:"all",children:"All Mechanisms"}),G.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"md:col-span-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Transfers"}),T.length===0?jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"No cross-border transfers found."}):jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",r==null?void 0:r.transferList,d),children:T.map(e=>{var a,o;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`p-3 rounded-md cursor-pointer ${f===e.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,r==null?void 0:r.transferItem,d),role:"button",tabIndex:0,"aria-label":`View transfer to ${e.destinationCountry}`,onClick:()=>R(e.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),R(e.id));},children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:e.destinationCountry}),Z(e.riskLevel)]}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:e.recipientOrganization}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:ye(e.transferMechanism)}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[ee(e.status),((a=e.ndpcApproval)==null?void 0:a.required)&&!((o=e.ndpcApproval)!=null&&o.approved)&&jsxRuntime.jsx("span",{className:"text-xs ndpr-text-info",children:"NDPC Pending"})]})]},e.id)})})]}),jsxRuntime.jsx("div",{className:"md:col-span-2",children:U?De(U):jsxRuntime.jsx("div",{className:"ndpr-empty-state",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"Select a transfer to view details"})})})]})]})};exports.a=Oe;
@@ -1 +0,0 @@
1
- 'use strict';var chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var G=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],ce=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],ze=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}],We={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},Ke={active:"Active",inactive:"Inactive",archived:"Archived"},Qe={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};function Xe(){let o=Date.now();return {id:`proc_${o}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:o,updatedAt:o}}function se(o){return o?new Date(o).toLocaleDateString():"N/A"}var rt=({ropa:o,onAddRecord:f,onUpdateRecord:b,onArchiveRecord:h,onAdd:_,onUpdate:x,onArchive:C,title:L,description:F,className:ge="",buttonClassName:M="",classNames:e,unstyled:n})=>{var ie,ae;let J=react.useRef(false);react.useEffect(()=>{if(process.env.NODE_ENV==="production"||J.current)return;let r=[];f!==void 0&&_===void 0&&r.push("onAddRecord -> onAdd"),b!==void 0&&x===void 0&&r.push("onUpdateRecord -> onUpdate"),h!==void 0&&C===void 0&&r.push("onArchiveRecord -> onArchive"),r.length>0&&(J.current=true,console.warn(`[ndpr-toolkit/ropa] Deprecated callback prop name(s): ${r.join(", ")}. Will be removed in 5.0.`));},[f,b,h,_,x,C]);let z=chunkYDKWD6MQ_js.c(),me=(ie=L!=null?L:z.ropa.title)!=null?ie:"Record of Processing Activities (ROPA)",ve=(ae=F!=null?F:z.ropa.description)!=null?ae:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",[R,D]=react.useState("list"),[B,fe]=react.useState(""),[A,be]=react.useState("all"),[E,he]=react.useState("all"),[l,y]=react.useState(null),[W,P]=react.useState([]),[O,K]=react.useState(""),[T,Q]=react.useState(""),[j,X]=react.useState(""),[q,Y]=react.useState(""),[$,Z]=react.useState(""),[H,N]=react.useState(""),[V,ee]=react.useState(""),g=react.useMemo(()=>chunk4CVBQC66_js.b(o),[o]),w=react.useMemo(()=>chunk4CVBQC66_js.d(o),[o]),te=react.useMemo(()=>{let r=[...o.records];if(A!=="all"&&(r=r.filter(a=>a.status===A)),E!=="all"&&(r=r.filter(a=>a.lawfulBasis===E)),B){let a=B.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[o.records,A,E,B]);react.useEffect(()=>{l&&(K(l.purposes.join(", ")),Q(l.dataCategories.join(", ")),X((l.sensitiveDataCategories||[]).join(", ")),Y(l.dataSubjectCategories.join(", ")),Z(l.recipients.join(", ")),N(l.securityMeasures.join(", ")),ee((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let _e=react.useCallback(()=>{let r=Xe();r.controllerDetails.name=o.organizationName,r.controllerDetails.contact=o.organizationContact,r.controllerDetails.address=o.organizationAddress,o.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=o.ndpcRegistrationNumber),o.dpoDetails&&(r.controllerDetails.dpoContact=o.dpoDetails.email),y(r),P([]),D("form");},[o.organizationName,o.organizationContact,o.organizationAddress,o.ndpcRegistrationNumber,o.dpoDetails]),xe=react.useCallback(r=>{y(chunkRFPLZDIO_js.a({},r)),P([]),D("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),Ce=react.useCallback(()=>{if(!l)return;let r=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},l),{purposes:v(O),dataCategories:v(T),sensitiveDataCategories:v(j),dataSubjectCategories:v(q),recipients:v($),securityMeasures:v(H),systemsUsed:v(V),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a=chunk4CVBQC66_js.a(r);if(!a.valid){P(a.errors);return}o.records.find(m=>m.id===r.id)?(x==null||x(r.id,r),b==null||b(r.id,r)):(_==null||_(r),f==null||f(r)),y(null),P([]),D("list");},[l,O,T,j,q,$,H,V,o.records,b,f,x,_]),Re=react.useCallback(r=>{C==null||C(r),h==null||h(r);},[h,C]),De=react.useCallback(()=>{let r=chunk4CVBQC66_js.c(o),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${o.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[o]),re=react.useCallback(()=>{y(null),P([]),D("list");},[]),c=react.useCallback((r,a)=>{y(p=>p&&chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},p),{[r]:a}));},[]),U=react.useCallback((r,a)=>{y(p=>p&&chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},p),{controllerDetails:chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},p.controllerDetails),{[r]:a})}));},[]),ye=react.useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),we=react.useCallback(r=>{fe(r.target.value);},[]),Se=react.useCallback(r=>{be(r.target.value);},[]),Pe=react.useCallback(r=>{he(r.target.value);},[]),ke=react.useCallback(r=>{K(r.target.value);},[]),Be=react.useCallback(r=>{Q(r.target.value);},[]),Ae=react.useCallback(r=>{X(r.target.value);},[]),Ee=react.useCallback(r=>{Y(r.target.value);},[]),Ie=react.useCallback(r=>{Z(r.target.value);},[]),Le=react.useCallback(r=>{N(r.target.value);},[]),Fe=react.useCallback(r=>{ee(r.target.value);},[]),Me=react.useCallback(()=>D("list"),[]),Oe=react.useCallback(()=>D("summary"),[]),Te=react.useCallback(r=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${We[r]}`,e==null?void 0:e.statusBadge,n),children:Ke[r]}),[e==null?void 0:e.statusBadge,n]),je=react.useCallback(r=>jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--info",children:Qe[r]}),[]),qe=()=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsxRuntime.jsx("p",{className:"ndpr-section-heading",children:o.organizationName})]}),o.dpoDetails&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsxRuntime.jsx("p",{className:"ndpr-section-heading",children:o.dpoDetails.name}),jsxRuntime.jsx("p",{className:"ndpr-form-field__hint",children:o.dpoDetails.email})]}),o.ndpcRegistrationNumber&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsxRuntime.jsx("p",{className:"ndpr-section-heading",children:o.ndpcRegistrationNumber})]})]}),jsxRuntime.jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",o.version," | Last Updated: ",se(o.lastUpdated)]})]}),$e=()=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",e==null?void 0:e.summary,n),children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:w.length}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),G.map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsxRuntime.jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsxRuntime.jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsxRuntime.jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsxRuntime.jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsxRuntime.jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsxRuntime.jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),w.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),w.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"mb-2",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsxRuntime.jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),w.length>5&&jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",w.length-5," more record(s) with gaps."]})]})]}),He=()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"ropaSearch",value:B,onChange:we,placeholder:"Search records...",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxRuntime.jsxs("select",{id:"ropaStatusFilter",value:A,onChange:Se,className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),ce.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxRuntime.jsxs("select",{id:"ropaBasisFilter",value:E,onChange:Pe,className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsxRuntime.jsx("option",{value:"all",children:"All Bases"}),G.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxRuntime.jsxs("div",{className:"flex items-end space-x-2",children:[jsxRuntime.jsx("button",{onClick:_e,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${M}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsxRuntime.jsx("button",{onClick:De,"aria-label":"Export ROPA records as CSV",className:chunkAME4HJR4_js.a(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${M}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),te.length===0?jsxRuntime.jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkAME4HJR4_js.a("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsxRuntime.jsx("thead",{className:chunkAME4HJR4_js.a("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{children:te.map(r=>{let a=ye(r),p=w.some(m=>m.recordId===r.id);return jsxRuntime.jsxs("tr",{className:chunkAME4HJR4_js.a(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium",children:r.name}),r.department&&jsxRuntime.jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:je(r.lawfulBasis)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:Te(r.status)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:se(r.lastReviewedAt)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>xe(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>Re(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Ve=react.useMemo(()=>l?!o.records.find(r=>r.id===l.id):true,[l,o.records]),Ue=()=>{if(!l)return null;let r=Ve;return jsxRuntime.jsxs("div",{"data-ndpr-component":"ropa-manager",className:chunkAME4HJR4_js.a("",e==null?void 0:e.form,n),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsxRuntime.jsx("button",{onClick:re,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),W.length>0&&jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside",children:W.map((a,p)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsxRuntime.jsx("input",{type:"text",id:"recordName",value:l.name,onChange:a=>c("name",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsxRuntime.jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:a=>c("department",a.target.value||void 0),className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsxRuntime.jsx("textarea",{id:"recordDescription",value:l.description,onChange:a=>c("description",a.target.value),rows:3,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsxRuntime.jsx("select",{id:"recordStatus",value:l.status,onChange:a=>c("status",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.select,n),children:ce.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:a=>U("name",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:a=>U("contact",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:a=>U("address",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsxRuntime.jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:a=>c("lawfulBasis",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.select,n),children:G.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsxRuntime.jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:a=>c("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"purposes",value:O,onChange:ke,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"dataCategories",value:T,onChange:Be,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"sensitiveData",value:j,onChange:Ae,className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"subjectCategories",value:q,onChange:Ee,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"recipients",value:$,onChange:Ie,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsxRuntime.jsx("select",{id:"dataSource",value:l.dataSource,onChange:a=>c("dataSource",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.select,n),children:ze.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),l.dataSource==="third_party"&&jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsxRuntime.jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:a=>c("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsxRuntime.jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:a=>c("retentionPeriod",a.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsxRuntime.jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:a=>c("retentionJustification",a.target.value||void 0),className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"securityMeasures",value:H,onChange:Le,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"systemsUsed",value:V,onChange:Fe,className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:a=>c("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsxRuntime.jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:a=>c("dpiaReference",a.target.value||void 0),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:a=>c("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsxRuntime.jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:a=>c("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsxRuntime.jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsxRuntime.jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsxRuntime.jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>c("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:chunkAME4HJR4_js.a("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxRuntime.jsxs("div",{className:"flex justify-end space-x-3",children:[jsxRuntime.jsx("button",{onClick:re,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsxRuntime.jsx("button",{onClick:Ce,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${M}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},Ge=()=>jsxRuntime.jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsxRuntime.jsx("button",{onClick:Me,className:`pb-2 text-sm font-medium ${R==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsxRuntime.jsx("button",{onClick:Oe,className:`pb-2 text-sm font-medium ${R==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ge}`,e==null?void 0:e.root,n),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",e==null?void 0:e.title,n),children:me}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:ve}),qe(),R!=="form"&&Ge(),R==="list"&&He(),R==="summary"&&$e(),R==="form"&&Ue()]})};exports.a=rt;
@@ -1 +0,0 @@
1
- import {b as b$1,c,d}from'./chunk-XP5PL6K7.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useRef,useState,useEffect,useCallback,useMemo}from'react';function h({initialData:V,adapter:A,onRecordAdd:a$1,onRecordUpdate:o,onRecordArchive:c$1,onAdd:u,onUpdate:d$1,onArchive:p}){let m=useRef(A);m.current=A;let[r,P]=useState(V),[E,R]=useState(true),G=useRef(false);useEffect(()=>{if(process.env.NODE_ENV==="production"||G.current)return;let e=[];a$1!==void 0&&u===void 0&&e.push("onRecordAdd -> onAdd"),o!==void 0&&d$1===void 0&&e.push("onRecordUpdate -> onUpdate"),c$1!==void 0&&p===void 0&&e.push("onRecordArchive -> onArchive"),e.length>0&&(G.current=true,console.warn(`[ndpr-toolkit/useROPA] Deprecated callback option(s): ${e.join(", ")}. Will be removed in 5.0.`));},[a$1,o,c$1,u,d$1,p]),useEffect(()=>{if(!m.current){R(false);return}let e=false;try{let s=m.current.load();s instanceof Promise?s.then(t=>{e||(t&&P(t),R(!1));},()=>{e||R(!1);}):(s&&P(s),R(!1));}catch(s){e||R(false);}return ()=>{e=true;}},[]);let f=useCallback(e=>{m.current&&Promise.resolve(m.current.save(e)).catch(s=>{console.warn("[ndpr-toolkit] Failed to save ROPA:",s);});},[]),N=useCallback(e=>{P(s=>{let t=b(a({},s),{records:[...s.records,e],lastUpdated:Date.now()});return f(t),t}),u==null||u(e),a$1==null||a$1(e);},[a$1,u,f]),j=useCallback((e,s)=>{P(t=>{let g=b(a({},t),{records:t.records.map(v=>v.id===e?b(a(a({},v),s),{updatedAt:Date.now()}):v),lastUpdated:Date.now()});return f(g),g}),d$1==null||d$1(e,s),o==null||o(e,s);},[o,d$1,f]),F=useCallback(e=>{P(s=>{let t=b(a({},s),{records:s.records.map(g=>g.id===e?b(a({},g),{status:"archived",updatedAt:Date.now()}):g),lastUpdated:Date.now()});return f(t),t}),p==null||p(e),c$1==null||c$1(e);},[c$1,p,f]),I=useCallback(e=>r.records.find(s=>s.id===e),[r.records]),O=useMemo(()=>b$1(r),[r]),y=useMemo(()=>c(r),[r]),S=useMemo(()=>d(r),[r]),M=useCallback(()=>O,[O]),T=useCallback(()=>y,[y]),W=useCallback(()=>S,[S]);return {ropa:r,addRecord:N,updateRecord:j,archiveRecord:F,getRecord:I,getSummary:M,exportCSV:T,getComplianceGaps:W,summary:O,csv:y,complianceGaps:S,isLoading:E}}export{h as a};
@@ -1 +0,0 @@
1
- var n=false,i=false;function o(e){n||(n=true,console.warn("[ndpr-toolkit] `validateConsent()` returns English error strings and will be removed in 5.0. Use `validateConsentStructured()` for typed `{ field, code, message }[]` errors."));let t=[];if((!e.consents||Object.keys(e.consents).length===0)&&t.push("Consent settings must include at least one consent option"),e.timestamp?(typeof e.timestamp!="number"||isNaN(e.timestamp))&&t.push("Consent timestamp must be a valid number"):t.push("Consent timestamp is required"),e.version||t.push("Consent version is required"),e.method||t.push("Consent collection method is required"),e.hasInteracted===void 0&&t.push("User interaction status is required"),e.timestamp){let r=new Date;r.setMonth(r.getMonth()-13);let s=r.getTime();e.timestamp<s&&t.push("Consent is older than 13 months and should be refreshed");}return {valid:t.length===0,errors:t}}function a(e){let t=[];if((!e.consents||Object.keys(e.consents).length===0)&&t.push({field:"consents",code:"consents_required",message:"Consent settings must include at least one consent option"}),e.timestamp?(typeof e.timestamp!="number"||isNaN(e.timestamp))&&t.push({field:"timestamp",code:"timestamp_invalid",message:"Consent timestamp must be a valid number"}):t.push({field:"timestamp",code:"timestamp_required",message:"Consent timestamp is required"}),e.version||t.push({field:"version",code:"version_required",message:"Consent version is required"}),e.method||t.push({field:"method",code:"method_required",message:"Consent collection method is required"}),e.hasInteracted===void 0&&t.push({field:"hasInteracted",code:"has_interacted_required",message:"User interaction status is required"}),e.timestamp){let r=new Date;r.setMonth(r.getMonth()-13);let s=r.getTime();e.timestamp<s&&t.push({field:"timestamp",code:"consent_stale",message:"Consent is older than 13 months and should be refreshed"});}return t.length>0?{valid:false,errors:t}:{valid:true,errors:[],data:e}}function d(e){i||(i=true,console.warn("[ndpr-toolkit] `validateConsentOptions()` returns English error strings and will be removed in 5.0. Use `validateConsentOptionsStructured()` for typed `{ field, code, message }[]` errors."));let t=[];return (!e||e.length===0)&&t.push("At least one consent option is required"),e==null||e.forEach(r=>{(!r.purpose||r.purpose.trim()==="")&&t.push(`Consent option "${r.id}" is missing a purpose. NDPA Section 26 requires consent to be specific to a stated purpose.`);}),{valid:t.length===0,errors:t}}function u(e){let t=[];return (!e||e.length===0)&&t.push({field:"options",code:"options_required",message:"At least one consent option is required"}),e==null||e.forEach((r,s)=>{(!r.purpose||r.purpose.trim()==="")&&t.push({field:`options[${s}].purpose`,code:"purpose_required",message:`Consent option "${r.id}" is missing a purpose. NDPA Section 26 requires consent to be specific to a stated purpose.`});}),t.length>0?{valid:false,errors:t}:{valid:true,errors:[],data:e}}export{o as a,a as b,d as c,u as d};
@@ -1 +0,0 @@
1
- 'use strict';var chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react');function h({initialData:V,adapter:A,onRecordAdd:a,onRecordUpdate:o,onRecordArchive:c,onAdd:u,onUpdate:d,onArchive:p}){let m=react.useRef(A);m.current=A;let[r,P]=react.useState(V),[E,R]=react.useState(true),G=react.useRef(false);react.useEffect(()=>{if(process.env.NODE_ENV==="production"||G.current)return;let e=[];a!==void 0&&u===void 0&&e.push("onRecordAdd -> onAdd"),o!==void 0&&d===void 0&&e.push("onRecordUpdate -> onUpdate"),c!==void 0&&p===void 0&&e.push("onRecordArchive -> onArchive"),e.length>0&&(G.current=true,console.warn(`[ndpr-toolkit/useROPA] Deprecated callback option(s): ${e.join(", ")}. Will be removed in 5.0.`));},[a,o,c,u,d,p]),react.useEffect(()=>{if(!m.current){R(false);return}let e=false;try{let s=m.current.load();s instanceof Promise?s.then(t=>{e||(t&&P(t),R(!1));},()=>{e||R(!1);}):(s&&P(s),R(!1));}catch(s){e||R(false);}return ()=>{e=true;}},[]);let f=react.useCallback(e=>{m.current&&Promise.resolve(m.current.save(e)).catch(s=>{console.warn("[ndpr-toolkit] Failed to save ROPA:",s);});},[]),N=react.useCallback(e=>{P(s=>{let t=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},s),{records:[...s.records,e],lastUpdated:Date.now()});return f(t),t}),u==null||u(e),a==null||a(e);},[a,u,f]),j=react.useCallback((e,s)=>{P(t=>{let g=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},t),{records:t.records.map(v=>v.id===e?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},v),s),{updatedAt:Date.now()}):v),lastUpdated:Date.now()});return f(g),g}),d==null||d(e,s),o==null||o(e,s);},[o,d,f]),F=react.useCallback(e=>{P(s=>{let t=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},s),{records:s.records.map(g=>g.id===e?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},g),{status:"archived",updatedAt:Date.now()}):g),lastUpdated:Date.now()});return f(t),t}),p==null||p(e),c==null||c(e);},[c,p,f]),I=react.useCallback(e=>r.records.find(s=>s.id===e),[r.records]),O=react.useMemo(()=>chunk4CVBQC66_js.b(r),[r]),y=react.useMemo(()=>chunk4CVBQC66_js.c(r),[r]),S=react.useMemo(()=>chunk4CVBQC66_js.d(r),[r]),M=react.useCallback(()=>O,[O]),T=react.useCallback(()=>y,[y]),W=react.useCallback(()=>S,[S]);return {ropa:r,addRecord:N,updateRecord:j,archiveRecord:F,getRecord:I,getSummary:M,exportCSV:T,getComplianceGaps:W,summary:O,csv:y,complianceGaps:S,isLoading:E}}exports.a=h;
@@ -1 +0,0 @@
1
- 'use strict';var chunkC2KEXHRX_js=require('./chunk-C2KEXHRX.js'),chunkD3HHDWBR_js=require('./chunk-D3HHDWBR.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js'),react=require('react');function F(n){if(!n)return chunkVWED6UTN_js.a("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?chunkC2KEXHRX_js.a(o):i==="cookie"?chunkC2KEXHRX_js.b(o,n.cookieOptions):chunkVWED6UTN_js.a(o)}function k(n,o,i,r,a,g,l){if(n){i(n);let{valid:s,errors:c}=chunkD3HHDWBR_js.a(n);r(s),a(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a}){let g=o!=null?o:F(i),l=react.useRef(g);l.current=g;let[s,c]=react.useState(null),[y,d]=react.useState(false),[E,C]=react.useState(false),[w,S]=react.useState([]),[x,v]=react.useState(true);react.useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=react.useCallback(e=>{let{valid:t,errors:m}=chunkD3HHDWBR_js.a(e);C(t),S(m),a==null||a(e),Promise.resolve(l.current.save(e)).catch(j=>{console.warn("[ndpr-toolkit] Failed to save consent:",j);});},[a]),p=react.useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),I=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),p(e);},[n,p]),L=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),p(e);},[n,p]),U=react.useCallback(e=>!!(s!=null&&s.consents[e]),[s]),V=react.useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:U,updateConsent:p,acceptAll:I,rejectAll:L,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:V,isLoading:x}}exports.a=z;
@@ -1,6 +0,0 @@
1
- import {e,g,h,f}from'./chunk-7BJXI2HI.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useRef,useEffect,useState,useMemo,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var G=[{value:"adequacy_decision",label:"Adequacy Decision (Section 41)"},{value:"standard_clauses",label:"Standard Contractual Clauses (Section 42)"},{value:"binding_corporate_rules",label:"Binding Corporate Rules (Section 43)"},{value:"ndpc_authorization",label:"NDPC Authorization (Section 44)"},{value:"explicit_consent",label:"Explicit Consent (Section 45(a))"},{value:"contract_performance",label:"Contract Performance (Section 45(b))"},{value:"public_interest",label:"Public Interest (Section 45(c))"},{value:"legal_claims",label:"Legal Claims (Section 45(d))"},{value:"vital_interests",label:"Vital Interests (Section 45(e))"}],oe=[{value:"adequate",label:"Adequate"},{value:"inadequate",label:"Inadequate"},{value:"pending_review",label:"Pending Review"},{value:"unknown",label:"Unknown"}],le=[{value:"one_time",label:"One-Time"},{value:"periodic",label:"Periodic"},{value:"continuous",label:"Continuous"}],se=[{value:"active",label:"Active"},{value:"suspended",label:"Suspended"},{value:"terminated",label:"Terminated"},{value:"pending_approval",label:"Pending Approval"}],we={low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--destructive"},Re={active:"ndpr-badge ndpr-badge--success",suspended:"ndpr-badge ndpr-badge--warning",terminated:"ndpr-badge ndpr-badge--neutral",pending_approval:"ndpr-badge ndpr-badge--info"},qe={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"},ce={destinationCountry:"",destinationCountryCode:"",adequacyStatus:"unknown",transferMechanism:"adequacy_decision",dataCategories:"",includesSensitiveData:false,estimatedDataSubjects:"",recipientOrganization:"",recipientContactName:"",recipientContactEmail:"",recipientContactPhone:"",recipientContactAddress:"",purpose:"",safeguards:"",riskAssessment:"",riskLevel:"medium",frequency:"one_time",status:"active",tiaCompleted:false,tiaReference:"",ndpcApprovalApplied:false,ndpcApprovalApproved:false,ndpcApprovalReference:""},Oe=({transfers:h$1,onAddTransfer:C,onUpdateTransfer:_,onRemoveTransfer:x,onAdd:A,onUpdate:y,onArchive:S,summary:N,title:I,description:O,className:ue="",buttonClassName:E="",showSummary:me=true,showTIA:ve=true,classNames:r,unstyled:d})=>{var te,re;let H=useRef(false);useEffect(()=>{if(process.env.NODE_ENV==="production"||H.current)return;let e=[];C!==void 0&&A===void 0&&e.push("onAddTransfer -> onAdd"),_!==void 0&&y===void 0&&e.push("onUpdateTransfer -> onUpdate"),x!==void 0&&S===void 0&&e.push("onRemoveTransfer -> onArchive"),e.length>0&&(H.current=true,console.warn(`[ndpr-toolkit/cross-border] Deprecated callback prop name(s): ${e.join(", ")}. Will be removed in 5.0.`));},[C,_,x,A,y,S]);let K=c(),fe=(te=I!=null?I:K.crossBorder.title)!=null?te:"Cross-Border Data Transfer Manager",be=(re=O!=null?O:K.crossBorder.description)!=null?re:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43).",[f$1,R]=useState(null),[W,q]=useState(false),[b$1,Y]=useState(null),[n,L]=useState(ce),[k,Q]=useState(null),[F,ge]=useState("all"),[B,he]=useState("all"),T=useMemo(()=>{let e=[...h$1];return F!=="all"&&(e=e.filter(a=>a.status===F)),B!=="all"&&(e=e.filter(a=>a.transferMechanism===B)),e.sort((a,o)=>o.updatedAt-a.updatedAt),e},[h$1,F,B]);useEffect(()=>{T.length>0&&!f$1&&R(T[0].id);},[T,f$1]);let U=useMemo(()=>{var e;return f$1&&(e=h$1.find(a=>a.id===f$1))!=null?e:null},[h$1,f$1]),w=useCallback(e=>new Date(e).toLocaleDateString(),[]),D=useCallback(()=>{L(ce),Y(null),Q(null);},[]),Ce=useCallback(()=>{D(),q(true);},[D]),_e=useCallback(e=>{var a,o,u,v;Y(e.id),L({destinationCountry:e.destinationCountry,destinationCountryCode:e.destinationCountryCode||"",adequacyStatus:e.adequacyStatus,transferMechanism:e.transferMechanism,dataCategories:e.dataCategories.join(", "),includesSensitiveData:e.includesSensitiveData,estimatedDataSubjects:((a=e.estimatedDataSubjects)==null?void 0:a.toString())||"",recipientOrganization:e.recipientOrganization,recipientContactName:e.recipientContact.name,recipientContactEmail:e.recipientContact.email,recipientContactPhone:e.recipientContact.phone||"",recipientContactAddress:e.recipientContact.address||"",purpose:e.purpose,safeguards:e.safeguards.join(`
2
- `),riskAssessment:e.riskAssessment,riskLevel:e.riskLevel,frequency:e.frequency,status:e.status,tiaCompleted:e.tiaCompleted,tiaReference:e.tiaReference||"",ndpcApprovalApplied:((o=e.ndpcApproval)==null?void 0:o.applied)||false,ndpcApprovalApproved:((u=e.ndpcApproval)==null?void 0:u.approved)||false,ndpcApprovalReference:((v=e.ndpcApproval)==null?void 0:v.referenceNumber)||""}),q(true);},[]),l=useCallback((e,a$1)=>{L(o=>b(a({},o),{[e]:a$1}));},[]),J=useCallback(()=>{let e$1=e(n.transferMechanism),a=Date.now();return {destinationCountry:n.destinationCountry.trim(),destinationCountryCode:n.destinationCountryCode.trim()||void 0,adequacyStatus:n.adequacyStatus,transferMechanism:n.transferMechanism,dataCategories:n.dataCategories.split(",").map(o=>o.trim()).filter(Boolean),includesSensitiveData:n.includesSensitiveData,estimatedDataSubjects:n.estimatedDataSubjects?parseInt(n.estimatedDataSubjects,10):void 0,recipientOrganization:n.recipientOrganization.trim(),recipientContact:{name:n.recipientContactName.trim(),email:n.recipientContactEmail.trim(),phone:n.recipientContactPhone.trim()||void 0,address:n.recipientContactAddress.trim()||void 0},purpose:n.purpose.trim(),safeguards:n.safeguards.split(`
3
- `).map(o=>o.trim()).filter(Boolean),riskAssessment:n.riskAssessment.trim(),riskLevel:n.riskLevel,frequency:n.frequency,status:e$1&&!n.ndpcApprovalApproved?"pending_approval":n.status,tiaCompleted:n.tiaCompleted,tiaReference:n.tiaReference.trim()||void 0,ndpcApproval:e$1?{required:true,applied:n.ndpcApprovalApplied,approved:n.ndpcApprovalApproved||void 0,referenceNumber:n.ndpcApprovalReference.trim()||void 0,appliedAt:n.ndpcApprovalApplied?a:void 0,approvedAt:n.ndpcApprovalApproved?a:void 0}:void 0,startDate:a,reviewDate:a+365*24*60*60*1e3}},[n]),xe=useCallback(()=>{let e=J(),a$1=a({id:b$1||"temp",createdAt:Date.now(),updatedAt:Date.now()},e),o=g(a$1);Q(o),o.isValid&&(b$1?(y==null||y(b$1,e),_==null||_(b$1,e)):(A==null||A(e),C==null||C(e)),D(),q(false));},[J,b$1,_,C,y,A,D]),X=useCallback(()=>{D(),q(false);},[D]),Ae=useCallback(e=>{S==null||S(e),x==null||x(e),f$1===e&&R(null);},[x,S,f$1]),Z=useCallback(e=>jsxs("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${we[e]}`,r==null?void 0:r.riskBadge,d),children:[e.charAt(0).toUpperCase()+e.slice(1)," Risk"]}),[r==null?void 0:r.riskBadge,d]),ee=useCallback(e=>jsx("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${Re[e]}`,r==null?void 0:r.statusBadge,d),children:qe[e]}),[r==null?void 0:r.statusBadge,d]),ye=useCallback(e$1=>{var u;e(e$1);let o=((u=G.find(v=>v.value===e$1))==null?void 0:u.label)||e$1;return jsx("span",{className:"px-2 py-1 rounded text-xs font-medium ndpr-badge ndpr-badge--info",children:o})},[]),M=useMemo(()=>{var v,c;if(N)return N;let e=0,a=[],o=[],u=[];for(let s of h$1){let j=s.status==="active";j&&e++,(s.status==="pending_approval"||(v=s.ndpcApproval)!=null&&v.required&&!((c=s.ndpcApproval)!=null&&c.approved))&&a.push(s),s.riskLevel==="high"&&j&&o.push(s),!s.tiaCompleted&&j&&u.push(s);}return {totalActiveTransfers:e,pendingApproval:a,highRiskTransfers:o,missingTIA:u,byMechanism:{},byAdequacy:{},dueForReview:[],lastUpdated:Date.now()}},[N,h$1]),Se=()=>jsxs("div",{"data-ndpr-component":"cross-border-transfer-manager",role:"status","aria-label":"Transfer compliance summary",className:a$1("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,d),children:[jsxs("div",{className:a$1("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:M.totalActiveTransfers}),jsx("p",{className:"text-sm ndpr-text-info",children:"Active Transfers"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:M.pendingApproval.length}),jsx("p",{className:"text-sm ndpr-text-info",children:"Pending Approval"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--destructive",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:M.highRiskTransfers.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"High Risk"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--warning",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:M.missingTIA.length}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Missing TIA"})]})]}),ke=()=>{let e$1=e(n.transferMechanism);return jsxs("div",{className:a$1("bg-gray-50 dark:bg-gray-700 p-6 rounded-lg mb-6",r==null?void 0:r.form,d),children:[jsxs("div",{className:a$1("flex justify-between items-center mb-4",r==null?void 0:r.header,d),children:[jsx("h3",{className:"ndpr-section-heading",children:b$1?"Edit Transfer":"Add New Transfer"}),jsx("button",{onClick:X,"aria-label":"Cancel form",className:"text-gray-600 hover:ndpr-text-muted dark:hover:text-gray-200",children:"Cancel"})]}),k&&!k.isValid&&jsxs("div",{id:"cb-form-errors",role:"alert",className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:k.errors.map((a,o)=>jsx("li",{children:a},o))})]}),k&&k.warnings.length>0&&jsxs("div",{id:"cb-form-warnings",role:"alert",className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings:"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:k.warnings.map((a,o)=>jsx("li",{children:a},o))})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"cb-destinationCountry",className:"ndpr-form-field__label",children:["Destination Country ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-destinationCountry",type:"text",value:n.destinationCountry,onChange:a=>l("destinationCountry",a.target.value),placeholder:"e.g. United Kingdom","aria-required":"true","aria-describedby":"cb-form-errors","aria-label":"Destination country",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-destinationCountryCode",className:"ndpr-form-field__label",children:"Country Code (ISO)"}),jsx("input",{id:"cb-destinationCountryCode",type:"text",value:n.destinationCountryCode,onChange:a=>l("destinationCountryCode",a.target.value),placeholder:"e.g. GB",maxLength:3,"aria-label":"Country code in ISO format",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientOrganization",className:"ndpr-form-field__label",children:["Recipient Organization ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientOrganization",type:"text",value:n.recipientOrganization,onChange:a=>l("recipientOrganization",a.target.value),placeholder:"Organization name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-transferMechanism",className:"ndpr-form-field__label",children:["Transfer Mechanism ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"cb-transferMechanism",value:n.transferMechanism,onChange:a=>l("transferMechanism",a.target.value),"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:G.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-adequacyStatus",className:"ndpr-form-field__label",children:"Adequacy Status"}),jsx("select",{id:"cb-adequacyStatus",value:n.adequacyStatus,onChange:a=>l("adequacyStatus",a.target.value),"aria-label":"Select adequacy status of destination country",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:oe.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-riskLevel",className:"ndpr-form-field__label",children:"Risk Level"}),jsxs("select",{id:"cb-transfer-riskLevel",value:n.riskLevel,onChange:a=>l("riskLevel",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"low",children:"Low"}),jsx("option",{value:"medium",children:"Medium"}),jsx("option",{value:"high",children:"High"})]})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-dataCategories",className:"ndpr-form-field__label",children:["Data Categories ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-dataCategories",type:"text",value:n.dataCategories,onChange:a=>l("dataCategories",a.target.value),placeholder:"Comma-separated, e.g. Names, Email addresses, Phone numbers","aria-required":"true","aria-describedby":"cb-dataCategories-help",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-dataCategories-help",className:"text-xs text-gray-500 mt-1",children:"Separate categories with commas"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"includesSensitiveData",checked:n.includesSensitiveData,onChange:a=>l("includesSensitiveData",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"includesSensitiveData",className:"ndpr-text-sm ndpr-font-medium",children:"Includes sensitive personal data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-estimatedDataSubjects",className:"ndpr-form-field__label",children:"Estimated Data Subjects"}),jsx("input",{id:"cb-transfer-estimatedDataSubjects",type:"number",value:n.estimatedDataSubjects,onChange:a=>l("estimatedDataSubjects",a.target.value),placeholder:"Number of data subjects",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactName",className:"ndpr-form-field__label",children:["Recipient Contact Name ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientContactName",type:"text",value:n.recipientContactName,onChange:a=>l("recipientContactName",a.target.value),placeholder:"Contact person name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactEmail",className:"ndpr-form-field__label",children:["Recipient Contact Email ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientContactEmail",type:"email",value:n.recipientContactEmail,onChange:a=>l("recipientContactEmail",a.target.value),placeholder:"contact@example.com","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-recipientContactPhone",className:"ndpr-form-field__label",children:"Recipient Contact Phone"}),jsx("input",{id:"cb-transfer-recipientContactPhone",type:"text",value:n.recipientContactPhone,onChange:a=>l("recipientContactPhone",a.target.value),placeholder:"Phone number",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-recipientContactAddress",className:"ndpr-form-field__label",children:"Recipient Contact Address"}),jsx("input",{id:"cb-transfer-recipientContactAddress",type:"text",value:n.recipientContactAddress,onChange:a=>l("recipientContactAddress",a.target.value),placeholder:"Address",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-purpose",className:"ndpr-form-field__label",children:["Purpose of Transfer ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-purpose",value:n.purpose,onChange:a=>l("purpose",a.target.value),placeholder:"Describe the purpose of this data transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-safeguards",className:"ndpr-form-field__label",children:["Safeguards ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-safeguards",value:n.safeguards,onChange:a=>l("safeguards",a.target.value),placeholder:`One safeguard per line, e.g.
4
- End-to-end encryption
5
- Access control policies
6
- Regular security audits`,rows:3,"aria-required":"true","aria-describedby":"cb-safeguards-help",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-safeguards-help",className:"text-xs text-gray-500 mt-1",children:"Enter one safeguard per line"})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-riskAssessment",className:"ndpr-form-field__label",children:["Risk Assessment Summary ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-riskAssessment",value:n.riskAssessment,onChange:a=>l("riskAssessment",a.target.value),placeholder:"Summarize the risk assessment for this transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-frequency",className:"ndpr-form-field__label",children:"Transfer Frequency"}),jsx("select",{id:"cb-transfer-frequency",value:n.frequency,onChange:a=>l("frequency",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:le.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-status",className:"ndpr-form-field__label",children:"Status"}),jsx("select",{id:"cb-transfer-status",value:n.status,onChange:a=>l("status",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:se.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]}),e$1&&jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsx("h4",{className:"text-sm font-medium ndpr-text-info mb-3",children:"NDPC Approval Required"}),jsx("p",{className:"text-xs ndpr-text-info mb-3",children:"The selected transfer mechanism requires approval from the Nigeria Data Protection Commission."}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApplied",checked:n.ndpcApprovalApplied,onChange:a=>l("ndpcApprovalApplied",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"ndpcApprovalApplied",className:"ndpr-text-sm",children:"Application submitted"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApproved",checked:n.ndpcApprovalApproved,onChange:a=>l("ndpcApprovalApproved",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"ndpcApprovalApproved",className:"ndpr-text-sm",children:"Approval granted"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"cb-transfer-ndpcApprovalReference",className:"ndpr-form-field__label",children:"NDPC Reference Number"}),jsx("input",{id:"cb-transfer-ndpcApprovalReference",type:"text",value:n.ndpcApprovalReference,onChange:a=>l("ndpcApprovalReference",a.target.value),placeholder:"Reference number (if available)",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),ve&&jsxs("div",{className:"mt-4 p-4 bg-gray-100 dark:bg-gray-600 rounded-md",children:[jsx("h4",{className:"text-sm font-medium mb-3",children:"Transfer Impact Assessment"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"tiaCompleted",checked:n.tiaCompleted,onChange:a=>l("tiaCompleted",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"tiaCompleted",className:"ndpr-text-sm",children:"TIA completed"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-tiaReference",className:"ndpr-form-field__label",children:"TIA Reference"}),jsx("input",{id:"cb-transfer-tiaReference",type:"text",value:n.tiaReference,onChange:a=>l("tiaReference",a.target.value),placeholder:"Document reference",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[jsx("button",{onClick:X,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:"Cancel"}),jsx("button",{onClick:xe,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:b$1?"Update Transfer":"Add Transfer"})]})]})},De=e=>{var u,v;let a=h(e),o=g(e);return jsxs("div",{role:"status","aria-label":"Transfer details",className:a$1("",r==null?void 0:r.detailPanel,d),children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("h3",{className:"ndpr-section-heading",children:[e.destinationCountry," \u2014 ",e.recipientOrganization]}),jsxs("div",{className:"flex gap-2",children:[ee(e.status),Z(e.riskLevel)]})]}),!o.isValid&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Compliance Issues"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:o.errors.map((c,s)=>jsx("li",{children:c},s))})]}),o.warnings.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:o.warnings.map((c,s)=>jsx("li",{children:c},s))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Destination:"})," ",e.destinationCountry,e.destinationCountryCode?` (${e.destinationCountryCode})`:""]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Adequacy:"})," ",(u=oe.find(c=>c.value===e.adequacyStatus))==null?void 0:u.label]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Frequency:"})," ",(v=le.find(c=>c.value===e.frequency))==null?void 0:v.label]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Start Date:"})," ",w(e.startDate)]}),e.endDate&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"End Date:"})," ",w(e.endDate)]}),e.reviewDate&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",w(e.reviewDate)]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Recipient:"})," ",e.recipientOrganization]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Contact:"})," ",e.recipientContact.name," (",e.recipientContact.email,")"]}),e.estimatedDataSubjects&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Subjects:"})," ",e.estimatedDataSubjects.toLocaleString()]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",e.includesSensitiveData?"Yes":"No"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Transfer Mechanism"}),jsx("div",{className:"ndpr-panel",children:jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200",children:f(e.transferMechanism)})})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Purpose"}),jsx("p",{className:"text-sm ndpr-text-muted bg-gray-50 dark:bg-gray-700 p-2 rounded-md",children:e.purpose})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Data Categories"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.dataCategories.map((c,s)=>jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-600 rounded text-xs",children:c},s))})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Safeguards"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-muted",children:e.safeguards.map((c,s)=>jsx("li",{children:c},s))})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Assessment"}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200 mb-2",children:e.riskAssessment}),jsxs("div",{className:"mt-2",role:"status","aria-label":"Automated risk assessment result",children:[jsxs("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:["Automated Assessment (Score: ",a.riskScore,")"]}),a.factors.length>0&&jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.factors.map((c,s)=>jsx("li",{children:c},s))}),a.recommendations.length>0&&jsxs("div",{className:"mt-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:"Recommendations:"}),jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.recommendations.map((c,s)=>jsx("li",{children:c},s))})]})]})]})]}),e.ndpcApproval&&jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"NDPC Approval"}),jsxs("div",{className:a$1(`p-3 rounded-md ${e.ndpcApproval.approved?"ndpr-alert ndpr-alert--success":e.ndpcApproval.applied?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive"}`,r==null?void 0:r.approvalStatus,d),children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",e.ndpcApproval.approved?"Approved":e.ndpcApproval.applied?"Application Submitted":"Not Applied"]}),e.ndpcApproval.referenceNumber&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",e.ndpcApproval.referenceNumber]}),e.ndpcApproval.appliedAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Applied:"})," ",w(e.ndpcApproval.appliedAt)]}),e.ndpcApproval.approvedAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Approved:"})," ",w(e.ndpcApproval.approvedAt)]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Transfer Impact Assessment"}),jsxs("div",{className:`p-3 rounded-md ${e.tiaCompleted?"ndpr-alert ndpr-alert--success":"ndpr-alert ndpr-alert--warning"}`,children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",e.tiaCompleted?"Completed":"Not Completed"]}),e.tiaReference&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",e.tiaReference]})]})]}),jsxs("div",{className:"flex gap-3 mt-6",children:[jsx("button",{onClick:()=>_e(e),"aria-label":`Edit transfer to ${e.destinationCountry}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,children:"Edit"}),jsx("button",{onClick:()=>Ae(e.id),"aria-label":`Remove transfer to ${e.destinationCountry}`,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Remove"})]})]})};return jsxs("div",{className:a$1(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ue}`,r==null?void 0:r.root,d),children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.title,d),children:fe}),jsx("p",{className:"ndpr-card__subtitle",children:be}),me&&Se(),!W&&jsx("div",{className:"mb-6",children:jsx("button",{onClick:Ce,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${E}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:"Add Transfer"})}),W&&ke(),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"cbStatusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxs("select",{id:"cbStatusFilter",value:F,onChange:e=>ge(e.target.value),"aria-label":"Filter transfers by status",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Statuses"}),se.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cbMechanismFilter",className:"ndpr-form-field__label",children:"Mechanism Filter"}),jsxs("select",{id:"cbMechanismFilter",value:B,onChange:e=>he(e.target.value),"aria-label":"Filter transfers by mechanism",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Mechanisms"}),G.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Transfers"}),T.length===0?jsx("p",{className:"ndpr-card__subtitle",children:"No cross-border transfers found."}):jsx("div",{className:a$1("space-y-2 max-h-96 overflow-y-auto pr-2",r==null?void 0:r.transferList,d),children:T.map(e=>{var a,o;return jsxs("div",{className:a$1(`p-3 rounded-md cursor-pointer ${f$1===e.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,r==null?void 0:r.transferItem,d),role:"button",tabIndex:0,"aria-label":`View transfer to ${e.destinationCountry}`,onClick:()=>R(e.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),R(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.destinationCountry}),Z(e.riskLevel)]}),jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:e.recipientOrganization}),jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:ye(e.transferMechanism)}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[ee(e.status),((a=e.ndpcApproval)==null?void 0:a.required)&&!((o=e.ndpcApproval)!=null&&o.approved)&&jsx("span",{className:"text-xs ndpr-text-info",children:"NDPC Pending"})]})]},e.id)})})]}),jsx("div",{className:"md:col-span-2",children:U?De(U):jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Select a transfer to view details"})})})]})]})};export{Oe as a};
@@ -1 +0,0 @@
1
- import {b,d,a as a$1,c as c$1}from'./chunk-XP5PL6K7.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {a,b as b$1}from'./chunk-ZJYULEER.mjs';import {useRef,useEffect,useState,useMemo,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var G=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],ce=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],ze=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}],We={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},Ke={active:"Active",inactive:"Inactive",archived:"Archived"},Qe={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};function Xe(){let o=Date.now();return {id:`proc_${o}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:o,updatedAt:o}}function se(o){return o?new Date(o).toLocaleDateString():"N/A"}var rt=({ropa:o,onAddRecord:f,onUpdateRecord:b$2,onArchiveRecord:h,onAdd:_,onUpdate:x,onArchive:C,title:L,description:F,className:ge="",buttonClassName:M="",classNames:e,unstyled:n})=>{var ie,ae;let J=useRef(false);useEffect(()=>{if(process.env.NODE_ENV==="production"||J.current)return;let r=[];f!==void 0&&_===void 0&&r.push("onAddRecord -> onAdd"),b$2!==void 0&&x===void 0&&r.push("onUpdateRecord -> onUpdate"),h!==void 0&&C===void 0&&r.push("onArchiveRecord -> onArchive"),r.length>0&&(J.current=true,console.warn(`[ndpr-toolkit/ropa] Deprecated callback prop name(s): ${r.join(", ")}. Will be removed in 5.0.`));},[f,b$2,h,_,x,C]);let z=c(),me=(ie=L!=null?L:z.ropa.title)!=null?ie:"Record of Processing Activities (ROPA)",ve=(ae=F!=null?F:z.ropa.description)!=null?ae:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",[R,D]=useState("list"),[B,fe]=useState(""),[A,be]=useState("all"),[E,he]=useState("all"),[l,y]=useState(null),[W,P]=useState([]),[O,K]=useState(""),[T,Q]=useState(""),[j,X]=useState(""),[q,Y]=useState(""),[$,Z]=useState(""),[H,N]=useState(""),[V,ee]=useState(""),g=useMemo(()=>b(o),[o]),w=useMemo(()=>d(o),[o]),te=useMemo(()=>{let r=[...o.records];if(A!=="all"&&(r=r.filter(a=>a.status===A)),E!=="all"&&(r=r.filter(a=>a.lawfulBasis===E)),B){let a=B.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[o.records,A,E,B]);useEffect(()=>{l&&(K(l.purposes.join(", ")),Q(l.dataCategories.join(", ")),X((l.sensitiveDataCategories||[]).join(", ")),Y(l.dataSubjectCategories.join(", ")),Z(l.recipients.join(", ")),N(l.securityMeasures.join(", ")),ee((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let _e=useCallback(()=>{let r=Xe();r.controllerDetails.name=o.organizationName,r.controllerDetails.contact=o.organizationContact,r.controllerDetails.address=o.organizationAddress,o.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=o.ndpcRegistrationNumber),o.dpoDetails&&(r.controllerDetails.dpoContact=o.dpoDetails.email),y(r),P([]),D("form");},[o.organizationName,o.organizationContact,o.organizationAddress,o.ndpcRegistrationNumber,o.dpoDetails]),xe=useCallback(r=>{y(a({},r)),P([]),D("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),Ce=useCallback(()=>{if(!l)return;let r=b$1(a({},l),{purposes:v(O),dataCategories:v(T),sensitiveDataCategories:v(j),dataSubjectCategories:v(q),recipients:v($),securityMeasures:v(H),systemsUsed:v(V),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){P(a$2.errors);return}o.records.find(m=>m.id===r.id)?(x==null||x(r.id,r),b$2==null||b$2(r.id,r)):(_==null||_(r),f==null||f(r)),y(null),P([]),D("list");},[l,O,T,j,q,$,H,V,o.records,b$2,f,x,_]),Re=useCallback(r=>{C==null||C(r),h==null||h(r);},[h,C]),De=useCallback(()=>{let r=c$1(o),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${o.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[o]),re=useCallback(()=>{y(null),P([]),D("list");},[]),c$2=useCallback((r,a$1)=>{y(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),U=useCallback((r,a$1)=>{y(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),ye=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),we=useCallback(r=>{fe(r.target.value);},[]),Se=useCallback(r=>{be(r.target.value);},[]),Pe=useCallback(r=>{he(r.target.value);},[]),ke=useCallback(r=>{K(r.target.value);},[]),Be=useCallback(r=>{Q(r.target.value);},[]),Ae=useCallback(r=>{X(r.target.value);},[]),Ee=useCallback(r=>{Y(r.target.value);},[]),Ie=useCallback(r=>{Z(r.target.value);},[]),Le=useCallback(r=>{N(r.target.value);},[]),Fe=useCallback(r=>{ee(r.target.value);},[]),Me=useCallback(()=>D("list"),[]),Oe=useCallback(()=>D("summary"),[]),Te=useCallback(r=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${We[r]}`,e==null?void 0:e.statusBadge,n),children:Ke[r]}),[e==null?void 0:e.statusBadge,n]),je=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:Qe[r]}),[]),qe=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:o.organizationName})]}),o.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:o.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:o.dpoDetails.email})]}),o.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:o.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",o.version," | Last Updated: ",se(o.lastUpdated)]})]}),$e=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:w.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),G.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),w.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),w.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),w.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",w.length-5," more record(s) with gaps."]})]})]}),He=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:B,onChange:we,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:A,onChange:Se,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),ce.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:E,onChange:Pe,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),G.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:_e,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${M}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:De,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${M}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),te.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:te.map(r=>{let a=ye(r),p=w.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:je(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:Te(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:se(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>xe(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>Re(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Ve=useMemo(()=>l?!o.records.find(r=>r.id===l.id):true,[l,o.records]),Ue=()=>{if(!l)return null;let r=Ve;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:re,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),W.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:W.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:l.name,onChange:a=>c$2("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:a=>c$2("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:l.description,onChange:a=>c$2("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:l.status,onChange:a=>c$2("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:ce.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:a=>U("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:a=>U("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:a=>U("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:a=>c$2("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:G.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:a=>c$2("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:O,onChange:ke,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:T,onChange:Be,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:j,onChange:Ae,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:q,onChange:Ee,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:$,onChange:Ie,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:l.dataSource,onChange:a=>c$2("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:ze.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),l.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:a=>c$2("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:a=>c$2("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:a=>c$2("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:H,onChange:Le,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:V,onChange:Fe,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:a=>c$2("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:a=>c$2("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:a=>c$2("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:a=>c$2("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>c$2("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:re,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:Ce,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${M}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},Ge=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:Me,className:`pb-2 text-sm font-medium ${R==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:Oe,className:`pb-2 text-sm font-medium ${R==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ge}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:me}),jsx("p",{className:"ndpr-card__subtitle",children:ve}),qe(),R!=="form"&&Ge(),R==="list"&&He(),R==="summary"&&$e(),R==="form"&&Ue()]})};export{rt as a};