@tantainnovative/ndpr-toolkit 2.4.1 → 3.2.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 (192) hide show
  1. package/README.md +226 -246
  2. package/dist/BreachReportForm-DpRrBoxU.d.ts +158 -0
  3. package/dist/BreachReportForm-yJ2Zl6gz.d.mts +158 -0
  4. package/dist/ConsentBanner-CDRT0o2k.d.mts +146 -0
  5. package/dist/ConsentBanner-Vxyt8SCX.d.ts +146 -0
  6. package/dist/{cross-border-entry-BrWVPly6.d.ts → CrossBorderTransferManager-D5Lc0e46.d.ts} +4 -5
  7. package/dist/{cross-border-entry-cCTvpwnT.d.mts → CrossBorderTransferManager-DkZhv9vD.d.mts} +4 -5
  8. package/dist/DPIAQuestionnaire-BkejviPj.d.mts +123 -0
  9. package/dist/DPIAQuestionnaire-DdSqXG3x.d.ts +123 -0
  10. package/dist/DSRRequestForm-BY8PogCU.d.mts +146 -0
  11. package/dist/DSRRequestForm-CHUg9cZh.d.ts +146 -0
  12. package/dist/DSRTracker-C6u_jAaK.d.mts +163 -0
  13. package/dist/DSRTracker-Dr_aT0pg.d.ts +163 -0
  14. package/dist/{lawful-basis-entry-CxZrofwG.d.mts → LawfulBasisTracker-CBqOxX1D.d.mts} +3 -5
  15. package/dist/{lawful-basis-entry-15qjKcNO.d.ts → LawfulBasisTracker-Cg30NbDA.d.ts} +3 -5
  16. package/dist/NDPRDashboard-CLJpEg0X.d.mts +44 -0
  17. package/dist/NDPRDashboard-DDWNd2Ah.d.ts +44 -0
  18. package/dist/{policy-E0fXZkda.d.mts → PolicyExporter-Bgi6nz82.d.mts} +5 -7
  19. package/dist/{policy-D2_jh5-T.d.ts → PolicyExporter-BnvuFncj.d.ts} +5 -7
  20. package/dist/{ropa-entry-B0D7X1GV.d.ts → ROPAManager-BS4eB8Hw.d.mts} +4 -5
  21. package/dist/{ropa-entry-DiOThOc2.d.mts → ROPAManager-qxTrXLkD.d.ts} +4 -5
  22. package/dist/RegulatoryReportGenerator-BUYgzTTT.d.ts +282 -0
  23. package/dist/RegulatoryReportGenerator-DwcHcEFp.d.mts +282 -0
  24. package/dist/StepIndicator-D-nwRTyo.d.mts +171 -0
  25. package/dist/StepIndicator-D9ZATz_O.d.ts +171 -0
  26. package/dist/adapters.d.mts +25 -0
  27. package/dist/adapters.d.ts +25 -0
  28. package/dist/adapters.js +2 -0
  29. package/dist/adapters.mjs +2 -0
  30. package/dist/breach.d.mts +36 -431
  31. package/dist/breach.d.ts +36 -431
  32. package/dist/breach.js +1 -1
  33. package/dist/breach.mjs +1 -1
  34. package/dist/chunk-27NYSWUG.mjs +2 -0
  35. package/dist/chunk-2ORDHJRD.js +2 -0
  36. package/dist/chunk-2W7ARAW2.js +2 -0
  37. package/dist/chunk-3F34NACG.js +2 -0
  38. package/dist/chunk-3UWT64FI.mjs +2 -0
  39. package/dist/chunk-3V23O4ZJ.js +2 -0
  40. package/dist/chunk-3XAUN5IM.mjs +3 -0
  41. package/dist/chunk-44W4H2EY.js +2 -0
  42. package/dist/chunk-5VMHKNJY.js +2 -0
  43. package/dist/chunk-6D3ZUGBB.mjs +2 -0
  44. package/dist/chunk-6E54NSAO.mjs +2 -0
  45. package/dist/chunk-7F5F5YWI.mjs +2 -0
  46. package/dist/chunk-DQLDX5X6.js +316 -0
  47. package/dist/chunk-FR7ZYZXB.js +2 -0
  48. package/dist/chunk-FY5G6DGZ.js +7 -0
  49. package/dist/chunk-G26I6MP5.mjs +2 -0
  50. package/dist/chunk-GCQRHMTQ.mjs +144 -0
  51. package/dist/chunk-GPJVTGHR.mjs +2 -0
  52. package/dist/chunk-GVANK6PL.js +3 -0
  53. package/dist/chunk-HNZK7LY3.mjs +2 -0
  54. package/dist/chunk-IKEPXHCZ.js +2 -0
  55. package/dist/chunk-IQQW52EF.js +2 -0
  56. package/dist/chunk-ISSGO2YT.mjs +72 -0
  57. package/dist/chunk-JZKH5RMC.js +3 -0
  58. package/dist/chunk-KHRBU5K7.js +2 -0
  59. package/dist/chunk-LFNA6WYQ.mjs +2 -0
  60. package/dist/chunk-LU4PFST7.js +144 -0
  61. package/dist/chunk-NPI5T6NH.mjs +7 -0
  62. package/dist/chunk-NPLXE43Q.mjs +2 -0
  63. package/dist/chunk-P7BSBCB3.js +2 -0
  64. package/dist/chunk-PEH5GIMN.js +2 -0
  65. package/dist/chunk-RSUDIFZV.mjs +2 -0
  66. package/dist/chunk-SBNAMPAP.mjs +2 -0
  67. package/dist/chunk-SVCRYM4I.mjs +2 -0
  68. package/dist/chunk-TKBZRULW.mjs +316 -0
  69. package/dist/chunk-TVW6KBVV.mjs +2 -0
  70. package/dist/chunk-U6VWHC46.js +72 -0
  71. package/dist/chunk-UK656RCG.js +2 -0
  72. package/dist/chunk-UNKXYVXY.js +2 -0
  73. package/dist/chunk-UOSEH6DC.js +2 -0
  74. package/dist/chunk-V37BM2LF.js +2 -0
  75. package/dist/chunk-V3MXWGXU.mjs +2 -0
  76. package/dist/chunk-VDZKGCAF.js +2 -0
  77. package/dist/chunk-WLSW4Z4W.mjs +2 -0
  78. package/dist/chunk-XSK4BSZJ.mjs +2 -0
  79. package/dist/chunk-YJCGEOLO.mjs +2 -0
  80. package/dist/chunk-ZCZ5RRZO.js +2 -0
  81. package/dist/chunk-ZQSX5ZHB.mjs +3 -0
  82. package/dist/compliance-score-racQe_E_.d.mts +115 -0
  83. package/dist/compliance-score-racQe_E_.d.ts +115 -0
  84. package/dist/consent.d.mts +67 -295
  85. package/dist/consent.d.ts +67 -295
  86. package/dist/consent.js +1 -1
  87. package/dist/consent.mjs +1 -1
  88. package/dist/core.d.mts +14 -48
  89. package/dist/core.d.ts +14 -48
  90. package/dist/core.js +1 -1
  91. package/dist/core.mjs +1 -1
  92. package/dist/cross-border-BBi9rZyO.d.mts +54 -0
  93. package/dist/cross-border-Dy-U9Hu6.d.ts +54 -0
  94. package/dist/{cross-border-BMcqLvjC.d.mts → cross-border-UyT00llA.d.mts} +1 -52
  95. package/dist/{cross-border-BMcqLvjC.d.ts → cross-border-UyT00llA.d.ts} +1 -52
  96. package/dist/cross-border.d.mts +32 -4
  97. package/dist/cross-border.d.ts +32 -4
  98. package/dist/cross-border.js +1 -1
  99. package/dist/cross-border.mjs +1 -1
  100. package/dist/dpia.d.mts +28 -284
  101. package/dist/dpia.d.ts +28 -284
  102. package/dist/dpia.js +1 -1
  103. package/dist/dpia.mjs +1 -1
  104. package/dist/dsr.d.mts +29 -300
  105. package/dist/dsr.d.ts +29 -300
  106. package/dist/dsr.js +1 -1
  107. package/dist/dsr.mjs +1 -1
  108. package/dist/hooks.d.mts +23 -10
  109. package/dist/hooks.d.ts +23 -10
  110. package/dist/hooks.js +1 -1
  111. package/dist/hooks.mjs +1 -1
  112. package/dist/index.d.mts +28 -19
  113. package/dist/index.d.ts +28 -19
  114. package/dist/index.js +1 -1
  115. package/dist/index.mjs +1 -1
  116. package/dist/lawful-basis.d.mts +31 -4
  117. package/dist/lawful-basis.d.ts +31 -4
  118. package/dist/lawful-basis.js +1 -1
  119. package/dist/lawful-basis.mjs +1 -1
  120. package/dist/policy-engine-C-tShzZH.d.mts +154 -0
  121. package/dist/policy-engine-DSQpT55_.d.ts +154 -0
  122. package/dist/policy-sections-CfNVBLCh.d.mts +54 -0
  123. package/dist/policy-sections-DqH0iZRf.d.ts +54 -0
  124. package/dist/policy.d.mts +117 -4
  125. package/dist/policy.d.ts +117 -4
  126. package/dist/policy.js +1 -1
  127. package/dist/policy.mjs +1 -1
  128. package/dist/presets.d.mts +114 -0
  129. package/dist/presets.d.ts +114 -0
  130. package/dist/presets.js +2 -0
  131. package/dist/presets.mjs +2 -0
  132. package/dist/{ropa-Li6UlL5H.d.ts → ropa-BDTM06tr.d.ts} +1 -49
  133. package/dist/{ropa-DP7pPPql.d.mts → ropa-CFHuT7jE.d.mts} +1 -49
  134. package/dist/ropa-CyynscU6.d.ts +51 -0
  135. package/dist/ropa-NIgxd8uP.d.mts +51 -0
  136. package/dist/ropa.d.mts +30 -4
  137. package/dist/ropa.d.ts +30 -4
  138. package/dist/ropa.js +1 -1
  139. package/dist/ropa.mjs +1 -1
  140. package/dist/sanitize-9mOO_cJW.d.mts +147 -0
  141. package/dist/sanitize-9mOO_cJW.d.ts +147 -0
  142. package/dist/styling-B7CBzYG7.d.ts +165 -0
  143. package/dist/styling-uJLsBbER.d.mts +165 -0
  144. package/dist/types-DK2CoKOC.d.mts +10 -0
  145. package/dist/types-DK2CoKOC.d.ts +10 -0
  146. package/dist/unstyled.d.mts +4 -4
  147. package/dist/unstyled.d.ts +4 -4
  148. package/dist/useAdaptivePolicyWizard-B9Op2gYM.d.ts +52 -0
  149. package/dist/useAdaptivePolicyWizard-N4eUM4Tj.d.mts +52 -0
  150. package/dist/{useBreach-BBSoIcZO.d.mts → useBreach-CPr86Yan.d.mts} +18 -2
  151. package/dist/{useBreach-lFLbSyAN.d.ts → useBreach-DkVXvtJK.d.ts} +18 -2
  152. package/dist/{useConsent-D0pAfTlb.d.ts → useConsent-DCNkIJHR.d.mts} +12 -2
  153. package/dist/{useConsent-DOt2Njst.d.mts → useConsent-dOcELSfX.d.ts} +12 -2
  154. package/dist/{useCrossBorderTransfer-DmtACeqW.d.ts → useCrossBorderTransfer-BGNZt2lk.d.mts} +15 -3
  155. package/dist/{useCrossBorderTransfer-BZVFCXfr.d.mts → useCrossBorderTransfer-COqjgjsu.d.ts} +15 -3
  156. package/dist/{useDPIA-DBsg2yZx.d.ts → useDPIA-Dl16Te3r.d.ts} +13 -2
  157. package/dist/{useDPIA-Da7-Q_yW.d.mts → useDPIA-DzWye8JB.d.mts} +13 -2
  158. package/dist/{useDSR-YYZ6FYFs.d.mts → useDSR-C1LksCfP.d.mts} +13 -2
  159. package/dist/{useDSR-CYI7WCXr.d.ts → useDSR-DZel52O1.d.ts} +13 -2
  160. package/dist/{useDefaultPrivacyPolicy-CUluF_ic.d.mts → useDefaultPrivacyPolicy-BsYttRey.d.mts} +13 -2
  161. package/dist/{useDefaultPrivacyPolicy-B7kTHbZh.d.ts → useDefaultPrivacyPolicy-C-mG-A5S.d.ts} +13 -2
  162. package/dist/{useLawfulBasis-CpWuHtyh.d.mts → useLawfulBasis-CKJ-kw84.d.mts} +13 -2
  163. package/dist/{useLawfulBasis-CCWF9waR.d.ts → useLawfulBasis-DFTmu1ca.d.ts} +13 -2
  164. package/dist/{useROPA-BhJ3kvHp.d.ts → useROPA-BSSU1rfx.d.ts} +14 -2
  165. package/dist/{useROPA-DLFdjkxP.d.mts → useROPA-C2hjaBTz.d.mts} +14 -2
  166. package/package.json +24 -3
  167. package/dist/chunk-2XFAV267.mjs +0 -2
  168. package/dist/chunk-32UIWTGD.js +0 -72
  169. package/dist/chunk-3YCV2BA6.js +0 -2
  170. package/dist/chunk-4A354HL3.js +0 -2
  171. package/dist/chunk-5ZBO2UPH.js +0 -2
  172. package/dist/chunk-6GGGTRDZ.mjs +0 -2
  173. package/dist/chunk-BZTTQS4A.mjs +0 -7
  174. package/dist/chunk-EKVTLHBQ.js +0 -2
  175. package/dist/chunk-GMLNWS2N.mjs +0 -2
  176. package/dist/chunk-IBEKLDBY.mjs +0 -2
  177. package/dist/chunk-ILCNDOBU.js +0 -2
  178. package/dist/chunk-K3GMTMQ6.js +0 -2
  179. package/dist/chunk-L52PDW6O.mjs +0 -2
  180. package/dist/chunk-LI6WJ3LZ.js +0 -2
  181. package/dist/chunk-LXRXDTPI.js +0 -2
  182. package/dist/chunk-NW4A3JW6.mjs +0 -2
  183. package/dist/chunk-OITITR6K.mjs +0 -2
  184. package/dist/chunk-PDJGTQMY.mjs +0 -2
  185. package/dist/chunk-T44JQT2O.mjs +0 -2
  186. package/dist/chunk-TCJCE6WN.js +0 -2
  187. package/dist/chunk-VMJBW3EF.mjs +0 -2
  188. package/dist/chunk-WSHSHIIM.mjs +0 -2
  189. package/dist/chunk-WW3X3ELF.js +0 -2
  190. package/dist/chunk-XMYUYQH7.mjs +0 -72
  191. package/dist/chunk-ZNTMZ6NM.js +0 -7
  192. package/dist/chunk-ZU73VG3X.js +0 -2
@@ -1,72 +0,0 @@
1
- 'use strict';var chunkRYZEIDNR_js=require('./chunk-RYZEIDNR.js'),chunkEPF7J2FK_js=require('./chunk-EPF7J2FK.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ze=({categories:N,onSubmit:x,onValidationError:D,title:oe="Report a Data Breach",formDescription:ne="Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",submitButtonText:de="Submit Report",className:me="",buttonClassName:ee="",classNames:u={},unstyled:n=false,isSubmitting:p=false,showConfirmation:P=true,confirmationMessage:Z="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:pe=true,maxAttachments:L=5,maxFileSize:C=5*1024*1024,allowedFileTypes:I=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:d,onReset:q})=>{var we,Re,Ae,Ce,Se;let E=i=>{if(!i)return "";let A=new Date(i),Y=T=>String(T).padStart(2,"0");return `${A.getFullYear()}-${Y(A.getMonth()+1)}-${Y(A.getDate())}T${Y(A.getHours())}:${Y(A.getMinutes())}`},[O,M]=react.useState((d==null?void 0:d.title)||""),[_,J]=react.useState((d==null?void 0:d.description)||""),[z,K]=react.useState((d==null?void 0:d.category)||""),[V,le]=react.useState(E(d==null?void 0:d.discoveredAt)),[Q,ce]=react.useState(E(d==null?void 0:d.occurredAt)),[B,k]=react.useState(((we=d==null?void 0:d.reporter)==null?void 0:we.name)||""),[w,y]=react.useState(((Re=d==null?void 0:d.reporter)==null?void 0:Re.email)||""),[S,te]=react.useState(((Ae=d==null?void 0:d.reporter)==null?void 0:Ae.department)||""),[U,ae]=react.useState(((Ce=d==null?void 0:d.reporter)==null?void 0:Ce.phone)||""),[h,j]=react.useState((d==null?void 0:d.affectedSystems)||[]),[ge,be]=react.useState(((Se=d==null?void 0:d.affectedSystems)==null?void 0:Se.join(", "))||""),[s,f]=react.useState((d==null?void 0:d.dataTypes)||[]),[m,R]=react.useState((d==null?void 0:d.estimatedAffectedSubjects)!=null?String(d.estimatedAffectedSubjects):""),[H,G]=react.useState((d==null?void 0:d.status)||"ongoing"),[ue,re]=react.useState((d==null?void 0:d.initialActions)||""),[$,xe]=react.useState([]),[ye,ve]=react.useState(false),[b,Ne]=react.useState({}),je=()=>{M(""),J(""),K(""),le(""),ce(""),k(""),y(""),te(""),ae(""),j([]),be(""),f([]),R(""),G("ongoing"),re(""),xe([]),ve(false),Ne({}),q==null||q();},$e=i=>{let A=i.target.value;be(A);let Y=A.split(",").map(T=>T.trim()).filter(Boolean);j(Y);},Le=i=>{f(A=>A.includes(i)?A.filter(Y=>Y!==i):[...A,i]);},qe=i=>{var De;let A=i.target.files;if(!A)return;let Y=[],T={};if($.length+A.length>L){T.attachments=`Maximum of ${L} files allowed`,Ne(X=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},X),T));return}for(let X=0;X<A.length;X++){let ke=A[X];if(ke.size>C){T.attachments=`File ${ke.name} exceeds the maximum size of ${C/(1024*1024)}MB`;continue}let Be="."+((De=ke.name.split(".").pop())==null?void 0:De.toLowerCase());if(!I.includes(Be)){T.attachments=`File type ${Be} is not allowed`;continue}Y.push(ke);}Object.keys(T).length>0?Ne(X=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},X),T)):(xe(X=>[...X,...Y]),Ne(X=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},X),{attachments:""})));},Ee=i=>{xe(A=>A.filter((Y,T)=>T!==i));},Oe=()=>{let i={};return O.trim()||(i.breachTitle="Breach title is required"),_.trim()||(i.description="Description is required"),z||(i.category="Category is required"),V||(i.discoveredAt="Discovery date is required"),B.trim()||(i.reporterName="Reporter name is required"),w.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(w)||(i.reporterEmail="Reporter email is invalid"):i.reporterEmail="Reporter email is required",S.trim()||(i.reporterDepartment="Reporter department is required"),h.length===0&&(i.affectedSystems="At least one affected system is required"),s.length===0&&(i.dataTypes="At least one data type is required"),m&&isNaN(Number(m))&&(i.estimatedAffectedSubjects="Estimated affected subjects must be a number"),Ne(i),i},Me=i=>{i.preventDefault();let A=Oe();if(Object.keys(A).length>0){D==null||D(A);return}let Y={title:chunkEPF7J2FK_js.a(O),description:chunkEPF7J2FK_js.a(_),category:z,discoveredAt:new Date(V).getTime(),occurredAt:Q?new Date(Q).getTime():void 0,reportedAt:Date.now(),reporter:{name:chunkEPF7J2FK_js.a(B),email:chunkEPF7J2FK_js.a(w),department:chunkEPF7J2FK_js.a(S),phone:U?chunkEPF7J2FK_js.a(U):void 0},affectedSystems:h.map(T=>chunkEPF7J2FK_js.a(T)),dataTypes:s,estimatedAffectedSubjects:m?Number(m):void 0,status:H,initialActions:ue?chunkEPF7J2FK_js.a(ue):void 0,attachments:$.map(T=>({name:T.name,type:T.type,size:T.size,file:T}))};x(Y),P&&ve(true);};if(ye)return jsxRuntime.jsxs("div",{className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${me}`,children:[jsxRuntime.jsx("h2",{className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2",children:"Report Submitted"}),jsxRuntime.jsx("p",{className:"text-green-700 dark:text-green-300",children:Z}),jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-yellow-800 dark:text-yellow-200 mb-2",children:"Important: Next Steps"}),jsxRuntime.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsx("button",{onClick:()=>ve(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${ee}`,children:"Report Another Breach"})]});let Ue=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${me}`,u.root,n),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",u.title,n),children:oe}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:ne}),jsxRuntime.jsx("form",{onSubmit:Me,className:chunkE64TU6IU_js.a("",u.form,n),children:jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",u.fieldGroup,n),children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Breach Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"breachTitle",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",u.label,n),children:["Breach Title/Summary ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"breachTitle",value:O,onChange:i=>M(i.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",u.input,n),required:true,"aria-invalid":!!b.breachTitle,"aria-describedby":b.breachTitle?"breachTitle-error":void 0}),b.breachTitle&&jsxRuntime.jsx("p",{id:"breachTitle-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.breachTitle})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"category",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",u.label,n),children:["Breach Category ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"category",value:z,onChange:i=>K(i.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",u.select,n),required:true,"aria-invalid":!!b.category,"aria-describedby":b.category?"category-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a category"}),N.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),b.category&&jsxRuntime.jsx("p",{id:"category-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.category})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"description",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",u.label,n),children:["Detailed Description ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"description",value:_,onChange:i=>J(i.target.value),rows:4,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",u.textarea,n),required:true,"aria-invalid":!!b.description,"aria-describedby":b.description?"description-error":void 0}),b.description&&jsxRuntime.jsx("p",{id:"description-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.description})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"discoveredAt",className:"block text-sm font-medium mb-1",children:["Date Discovered ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"datetime-local",id:"discoveredAt",value:V,onChange:i=>le(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!b.discoveredAt,"aria-describedby":b.discoveredAt?"discoveredAt-error":void 0}),b.discoveredAt&&jsxRuntime.jsx("p",{id:"discoveredAt-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.discoveredAt})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"occurredAt",className:"block text-sm font-medium mb-1",children:"Date Occurred (if known)"}),jsxRuntime.jsx("input",{type:"datetime-local",id:"occurredAt",value:Q,onChange:i=>ce(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Reporter Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterName",className:"block text-sm font-medium mb-1",children:["Your Name ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterName",value:B,onChange:i=>k(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!b.reporterName,"aria-describedby":b.reporterName?"reporterName-error":void 0}),b.reporterName&&jsxRuntime.jsx("p",{id:"reporterName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.reporterName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterEmail",className:"block text-sm font-medium mb-1",children:["Your Email ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"reporterEmail",value:w,onChange:i=>y(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!b.reporterEmail,"aria-describedby":b.reporterEmail?"reporterEmail-error":void 0}),b.reporterEmail&&jsxRuntime.jsx("p",{id:"reporterEmail-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.reporterEmail})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterDepartment",className:"block text-sm font-medium mb-1",children:["Your Department ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterDepartment",value:S,onChange:i=>te(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!b.reporterDepartment,"aria-describedby":b.reporterDepartment?"reporterDepartment-error":void 0}),b.reporterDepartment&&jsxRuntime.jsx("p",{id:"reporterDepartment-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.reporterDepartment})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reporterPhone",className:"block text-sm font-medium mb-1",children:"Your Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"reporterPhone",value:U,onChange:i=>ae(i.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Impact Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"affectedSystems",className:"block text-sm font-medium mb-1",children:["Affected Systems/Applications ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"affectedSystems",value:ge,onChange:$e,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!b.affectedSystems,"aria-describedby":b.affectedSystems?"affectedSystems-error":void 0}),b.affectedSystems&&jsxRuntime.jsx("p",{id:"affectedSystems-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.affectedSystems})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"block text-sm font-medium mb-1",children:"Estimated Number of Affected Data Subjects"}),jsxRuntime.jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:m,onChange:i=>R(i.target.value),placeholder:"e.g. 100",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]","aria-invalid":!!b.estimatedAffectedSubjects,"aria-describedby":b.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),b.estimatedAffectedSubjects&&jsxRuntime.jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.estimatedAffectedSubjects})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1",children:["Types of Data Involved ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Ue.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"checkbox",id:`dataType_${i.id}`,checked:s.includes(i.id),onChange:()=>Le(i.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:`dataType_${i.id}`,className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:i.label})]},i.id))}),b.dataTypes&&jsxRuntime.jsx("p",{id:"dataTypes-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.dataTypes})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"status",className:"block text-sm font-medium mb-1",children:["Current Status ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"status",value:H,onChange:i=>G(i.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",u.select,n),required:true,children:[jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"initialActions",className:"block text-sm font-medium mb-1",children:"Initial Actions Taken"}),jsxRuntime.jsx("textarea",{id:"initialActions",value:ue,onChange:i=>re(i.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",u.textarea,n)})]})]})]}),pe&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Attachments"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1",children:"Upload Supporting Files (Optional)"}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:["Max ",L," files, ",C/(1024*1024),"MB each. Allowed types: ",I.join(", ")]}),jsxRuntime.jsx("input",{type:"file",onChange:qe,multiple:true,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",accept:I.join(",")}),b.attachments&&jsxRuntime.jsx("p",{id:"attachments-error",role:"alert",className:"mt-1 text-sm text-red-500",children:b.attachments})]}),$.length>0&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium mb-2",children:"Attached Files:"}),jsxRuntime.jsx("ul",{className:"space-y-2",children:$.map((i,A)=>jsxRuntime.jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:i.name}),jsxRuntime.jsxs("span",{className:"ml-2 text-xs text-gray-600 dark:text-gray-400",children:["(",(i.size/1024).toFixed(1)," KB)"]})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ee(A),className:"text-red-500 hover:text-red-700",children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},A))})]})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",u.notice,n),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsxs("div",{className:"mt-6 relative flex gap-3",children:[p&&u.loadingOverlay&&jsxRuntime.jsx("div",{className:u.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:p,className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${ee} ${p?"opacity-50 cursor-not-allowed":""}`,u.primaryButton||u.submitButton,n),children:p?"Submitting...":de}),jsxRuntime.jsx("button",{type:"button",onClick:je,disabled:p,className:chunkE64TU6IU_js.a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,n),children:"Reset"})]})]})})]})};var tt=({breachData:N,initialAssessment:x={},onComplete:D,title:oe="Breach Risk Assessment",description:ne="Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",submitButtonText:de="Complete Assessment",className:me="",buttonClassName:ee="",classNames:u={},unstyled:n=false,showBreachSummary:p=true,showNotificationRequirements:P=true})=>{let[Z,pe]=react.useState(x.confidentialityImpact||3),[L,C]=react.useState(x.integrityImpact||3),[I,d]=react.useState(x.availabilityImpact||3),[q,E]=react.useState(x.harmLikelihood||3),[O,M]=react.useState(x.harmSeverity||3),[_,J]=react.useState(x.risksToRightsAndFreedoms!==void 0?x.risksToRightsAndFreedoms:false),[z,K]=react.useState(x.highRisksToRightsAndFreedoms!==void 0?x.highRisksToRightsAndFreedoms:false),[V,le]=react.useState(x.justification||""),[Q,ce]=react.useState(0),[B,k]=react.useState("low"),[w,y]=react.useState(false),[S,te]=react.useState(0),[U,ae]=react.useState(0),[h,j]=react.useState(false);react.useEffect(()=>{let re=Z*.2+L*.1+I*.1+q*.3+O*.3;ce(Number(re.toFixed(1)));let $;re<2?$="low":re<3?$="medium":re<4?$="high":$="critical",k($),y(_||$==="high"||$==="critical");let ye=N.discoveredAt+4320*60*1e3;te(ye);let ve=Date.now(),b=(ye-ve)/(3600*1e3);ae(Number(b.toFixed(1)));},[Z,L,I,q,O,_,N.discoveredAt]);let ge=m=>new Date(m).toLocaleString(),be=m=>{m.preventDefault();let R={id:x.id||`assessment_${Date.now()}`,breachId:N.id,assessedAt:Date.now(),assessor:x.assessor||{name:"Assessment User",role:"Data Protection Officer",email:"dpo@example.com"},confidentialityImpact:Z,integrityImpact:L,availabilityImpact:I,harmLikelihood:q,harmSeverity:O,overallRiskScore:Q,riskLevel:B,risksToRightsAndFreedoms:_,highRisksToRightsAndFreedoms:z,justification:V};D(R),j(true);},s=m=>{switch(m){case 1:return "Minimal";case 2:return "Low";case 3:return "Moderate";case 4:return "High";case 5:return "Severe";default:return "Unknown"}},f=m=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[m]}`,u.riskBadge,n),children:m.charAt(0).toUpperCase()+m.slice(1)});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${me}`,u.root,n),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",u.title,n),children:oe}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:ne}),p&&jsxRuntime.jsxs("div",{className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-2",children:"Breach Summary"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Title:"})," ",N.title]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",ge(N.discoveredAt)]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",N.status.charAt(0).toUpperCase()+N.status.slice(1)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",N.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",N.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",N.estimatedAffectedSubjects||"Unknown"]})]})]})]}),h?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Assessment Results"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Level:"})," ",f(B)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",Q," / 5"]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessed On:"})," ",ge(Date.now())]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",_?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",z?"Yes":"No"]})]})]}),jsxRuntime.jsxs("div",{className:"mt-3",children:[jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-sm bg-white dark:bg-gray-800 p-2 rounded",children:V})]})]}),P&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`mb-6 p-4 rounded-md ${w?U>24?"bg-yellow-50 dark:bg-yellow-900/20":"bg-red-50 dark:bg-red-900/20":"bg-green-50 dark:bg-green-900/20"}`,u.notificationStatus,n),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Requirements"}),w?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:`text-sm font-bold mb-2 ${U>24?"text-yellow-800 dark:text-yellow-200":"text-red-800 dark:text-red-200"}`,children:"NDPC Notification Required"}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"Under the NDPA (Section 40), this breach must be reported to the NDPC within 72 hours of discovery."}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Deadline:"})," ",ge(S)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Time Remaining:"})," ",jsxRuntime.jsx("span",{className:U<24?"text-red-600 dark:text-red-400 font-bold":"",children:U>0?`${U} hours`:"Deadline passed"})]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Notification:"})," ",z?"Required (NDPA Section 40(4))":"Not required unless directed by NDPC"]})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-bold mb-2 text-green-800 dark:text-green-200",children:"NDPC Notification Not Required"}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"Based on this assessment, this breach does not need to be reported to the NDPC."}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"However, the breach should still be documented internally for compliance purposes."})]}),jsxRuntime.jsxs("div",{className:"mt-3 text-sm",children:[jsxRuntime.jsx("p",{className:"font-medium",children:"Next Steps:"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 mt-1",children:w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Prepare a notification report for the NDPC"}),jsxRuntime.jsx("li",{children:"Document all aspects of the breach and your response"}),z&&jsxRuntime.jsx("li",{children:"Prepare communications for affected data subjects"}),jsxRuntime.jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Document the breach and this assessment in your internal records"}),jsxRuntime.jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),jsxRuntime.jsx("li",{children:"Review and update security measures as needed"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${ee}`,u.primaryButton||u.submitButton,n),children:"Edit Assessment"})]}):jsxRuntime.jsx("form",{onSubmit:be,children:jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Impact Assessment"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"confidentialityImpact",className:"block text-sm font-medium mb-1",children:["Confidentiality Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:"How much has the confidentiality of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:Z,onChange:m=>pe(parseInt(m.target.value)),className:chunkE64TU6IU_js.a("w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700",u.slider,n)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[s(Z)," (",Z,")"]})]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"integrityImpact",className:"block text-sm font-medium mb-1",children:["Integrity Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:"How much has the integrity of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:L,onChange:m=>C(parseInt(m.target.value)),className:chunkE64TU6IU_js.a("w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700",u.slider,n)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[s(L)," (",L,")"]})]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"availabilityImpact",className:"block text-sm font-medium mb-1",children:["Availability Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:"How much has the availability of data or systems been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:I,onChange:m=>d(parseInt(m.target.value)),className:chunkE64TU6IU_js.a("w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700",u.slider,n)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[s(I)," (",I,")"]})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Risk to Data Subjects"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"harmLikelihood",className:"block text-sm font-medium mb-1",children:["Likelihood of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:"How likely is it that data subjects will experience harm?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:q,onChange:m=>E(parseInt(m.target.value)),className:chunkE64TU6IU_js.a("w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700",u.slider,n)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[s(q)," (",q,")"]})]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"harmSeverity",className:"block text-sm font-medium mb-1",children:["Severity of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:"How severe would the harm be to affected data subjects?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:O,onChange:m=>M(parseInt(m.target.value)),className:chunkE64TU6IU_js.a("w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700",u.slider,n)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[s(O)," (",O,")"]})]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:_,onChange:m=>J(m.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"risksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a risk to the rights and freedoms of data subjects"})]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 ml-6",children:"Under the NDPA (Section 40), breaches that pose a risk to rights and freedoms must be reported to the NDPC within 72 hours."})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:z,onChange:m=>K(m.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"highRisksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a high risk to the rights and freedoms of data subjects"})]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 ml-6",children:"Under the NDPA (Section 40(4)), breaches that pose a high risk to rights and freedoms also require notification to affected data subjects without undue delay."})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Overall Assessment"}),jsxRuntime.jsxs("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Score:"}),jsxRuntime.jsxs("span",{className:chunkE64TU6IU_js.a("",u.riskScore,n),children:[Q," / 5"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Level:"}),f(B)]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"justification",className:"block text-sm font-medium mb-1",children:["Justification for Assessment ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"justification",value:V,onChange:m=>le(m.target.value),rows:4,placeholder:"Explain the reasoning behind your assessment, including any factors that influenced your decision.",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true})]})]}),jsxRuntime.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This assessment will determine if notification is required for this breach."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${ee}`,u.primaryButton||u.submitButton,n),children:de})})]})})]})};var dt=({breachReports:N,riskAssessments:x,regulatoryNotifications:D,onSelectBreach:oe,onRequestAssessment:ne,onRequestNotification:de,title:me="Breach Notification Manager",description:ee="Manage data breach notifications and track compliance with NDPA Section 40 requirements.",className:u="",buttonClassName:n="",classNames:p={},unstyled:P=false,showBreachDetails:Z=true,showNotificationTimeline:pe=true,showDeadlineAlerts:L=true})=>{var be;let[C,I]=react.useState(null),[d,q]=react.useState(N),[E,O]=react.useState("all"),[M,_]=react.useState(""),[J,z]=react.useState("discoveredAt"),[K,V]=react.useState("desc");react.useEffect(()=>{let s=[...N];if(E!=="all"&&(s=s.filter(f=>f.status===E)),M){let f=M.toLowerCase();s=s.filter(m=>m.title.toLowerCase().includes(f)||m.description.toLowerCase().includes(f)||m.affectedSystems.some(R=>R.toLowerCase().includes(f))||m.dataTypes.some(R=>R.toLowerCase().includes(f)));}s.sort((f,m)=>{let R=0;switch(J){case "title":R=f.title.localeCompare(m.title);break;case "discoveredAt":R=f.discoveredAt-m.discoveredAt;break;case "status":R=f.status.localeCompare(m.status);break;case "riskLevel":let H=x.find($=>$.breachId===f.id),G=x.find($=>$.breachId===m.id),ue=(H==null?void 0:H.riskLevel)||"unknown",re=(G==null?void 0:G.riskLevel)||"unknown";R=ue.localeCompare(re);break;default:R=f.discoveredAt-m.discoveredAt;}return K==="asc"?R:-R}),q(s);},[N,E,M,J,K,x]),react.useEffect(()=>{d.length>0&&!C&&I(d[0].id);},[d,C]);let le=s=>{I(s),oe&&oe(s);},Q=()=>{C&&ne&&ne(C);},ce=()=>{C&&de&&de(C);},B=s=>new Date(s).toLocaleString(),k=C?N.find(s=>s.id===C):null,w=C?x.find(s=>s.breachId===C):null,y=C?D.find(s=>s.breachId===C):null,S=k?te(k,w):null;function te(s,f){let m=chunkRYZEIDNR_js.a(s,f||void 0),R=s.discoveredAt+m.timeframeHours*60*60*1e3;return {ndpcNotificationRequired:m.notificationRequired,ndpcNotificationDeadline:R,dataSubjectNotificationRequired:(f==null?void 0:f.highRisksToRightsAndFreedoms)||false,justification:m.justification}}function U(s){let f=Date.now(),m=(s-f)/(3600*1e3);return Number(m.toFixed(1))}let ae=s=>s?jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[s]}`,p.statusBadge,P),children:s.charAt(0).toUpperCase()+s.slice(1)}):null,h=s=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{ongoing:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",contained:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",resolved:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"}[s]||"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200"}`,p.statusBadge,P),children:s.charAt(0).toUpperCase()+s.slice(1)}),j=()=>{if(!k||!S)return null;if(!S.ndpcNotificationRequired)return jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Notification Not Required"}),jsxRuntime.jsx("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:"Based on the risk assessment, NDPC notification is not required for this breach."})]});if(y)return jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Notification Sent"}),jsxRuntime.jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:["Notification was sent to the NDPC on ",B(y.sentAt),"."]})]});let s=U(S.ndpcNotificationDeadline);return s<=0?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Notification Deadline Passed"}),jsxRuntime.jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The 72-hour deadline for NDPC notification has passed. Notification should be sent immediately."})]}):s<=24?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Notification Due Soon"}),jsxRuntime.jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",s," hours remaining until the NDPC notification deadline."]})]}):jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Notification Required"}),jsxRuntime.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:["NDPC notification is required by ",B(S.ndpcNotificationDeadline)," (",s," hours remaining)."]})]})},ge=()=>{if(!k)return null;let s=[{title:"Breach Discovered",date:k.discoveredAt,completed:true,description:`Breach was discovered on ${B(k.discoveredAt)}.`},{title:"Risk Assessment",date:w==null?void 0:w.assessedAt,completed:!!w,description:w?`Risk assessment completed on ${B(w.assessedAt)}.`:"Risk assessment has not been completed yet."}];return S!=null&&S.ndpcNotificationRequired&&s.push({title:"NDPC Notification",date:y==null?void 0:y.sentAt,completed:!!y,description:y?`Notification sent to the NDPC on ${B(y.sentAt)}.`:`Notification must be sent to the NDPC by ${B(S.ndpcNotificationDeadline)}.`}),S!=null&&S.dataSubjectNotificationRequired&&s.push({title:"Data Subject Notification",date:void 0,completed:false,description:"Notification to affected data subjects is required but has not been sent yet."}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",p.timeline,P),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Notification Timeline"}),jsxRuntime.jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:s.map((f,m)=>jsxRuntime.jsxs("li",{className:chunkE64TU6IU_js.a("mb-6 ml-4",p.timelineStep,P),children:[jsxRuntime.jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${f.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsxRuntime.jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:f.date?B(f.date):"Pending"}),jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:f.title}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:f.description})]},m))})]})};return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${u}`,p.root,P),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",p.header,P),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",p.title,P),children:me}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:ee})]}),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsxRuntime.jsxs("select",{id:"statusFilter",value:E,onChange:s=>O(s.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxRuntime.jsxs("select",{id:"sortBy",value:J,onChange:s=>z(s.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsxRuntime.jsx("option",{value:"discoveredAt",children:"Discovery Date"}),jsxRuntime.jsx("option",{value:"title",children:"Title"}),jsxRuntime.jsx("option",{value:"status",children:"Status"}),jsxRuntime.jsx("option",{value:"riskLevel",children:"Risk Level"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchTerm",value:M,onChange:s=>_(s.target.value),placeholder:"Search breaches...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),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:"Breach Reports"}),d.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No breach reports found."}):jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",p.breachList,P),children:d.map(s=>{let f=x.find(G=>G.breachId===s.id),m=D.find(G=>G.breachId===s.id),R=te(s,f),H=null;if(R!=null&&R.ndpcNotificationRequired)if(m)H=jsxRuntime.jsx("span",{className:"text-xs text-green-600 dark:text-green-400",children:"Notified"});else {let G=U(R.ndpcNotificationDeadline);G<=0?H=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):G<=24?H=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):H=jsxRuntime.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Required"});}else H=jsxRuntime.jsx("span",{className:"text-xs text-green-600 dark:text-green-400",children:"Not Required"});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`p-3 rounded-md cursor-pointer ${C===s.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,p.breachItem,P),onClick:()=>le(s.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:s.title}),h(s.status)]}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Discovered: ",new Date(s.discoveredAt).toLocaleDateString()]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsxRuntime.jsx("div",{children:f&&ae(f.riskLevel)}),jsxRuntime.jsx("div",{children:H})]})]},s.id)})})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("md:col-span-2",p.detailPanel,P),children:k?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:k.title}),h(k.status)]}),L&&jsxRuntime.jsx("div",{className:"mb-4",children:j()}),Z&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",B(k.discoveredAt)]}),k.occurredAt&&jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Occurred:"})," ",B(k.occurredAt)]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reporter:"})," ",k.reporter.name]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",k.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",k.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",k.estimatedAffectedSubjects||"Unknown"]})]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Description:"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:k.description})]}),k.initialActions&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Initial Actions Taken:"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:k.initialActions})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Risk Assessment"}),w?jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Risk Level:"}),ae(w.riskLevel)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",w.overallRiskScore," / 5"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",w.risksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",w.highRisksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 bg-white dark:bg-gray-800 p-2 rounded-md",children:w.justification})]}):jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Risk assessment has not been conducted yet."}),jsxRuntime.jsx("button",{onClick:Q,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${n}`,children:"Conduct Risk Assessment"})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Status"}),y?jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Sent:"})," ",B(y.sentAt)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Method:"})," ",y.method.charAt(0).toUpperCase()+y.method.slice(1)]}),y.referenceNumber&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reference Number:"})," ",y.referenceNumber]}),(y.ndpcContact||y.nitdaContact)&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"NDPC Contact:"})," ",(be=y.ndpcContact||y.nitdaContact)==null?void 0:be.name]})]}):jsxRuntime.jsx("div",{children:S!=null&&S.ndpcNotificationRequired?jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"NDPC notification is required but has not been sent yet."}),jsxRuntime.jsx("button",{onClick:ce,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${n}`,children:"Generate Notification"})]}):jsxRuntime.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:"NDPC notification is not required for this breach."})})})]}),pe&&ge()]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a breach to view details"})})})]})]})};var bt=({breachData:N,assessmentData:x,organizationInfo:D,onGenerate:oe,title:ne="Generate NDPC Notification Report",description:de="Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements.",generateButtonText:me="Generate Report",className:ee="",buttonClassName:u="",classNames:n={},unstyled:p=false,showPreview:P=true,allowEditing:Z=true,allowDownload:pe=true,downloadFormat:L="pdf"})=>{let[C,I]=react.useState(""),[d,q]=react.useState(""),[E,O]=react.useState(""),[M,_]=react.useState(""),[J,z]=react.useState("email"),[K,V]=react.useState(""),[le,Q]=react.useState(""),[ce,B]=react.useState(false),[k,w]=react.useState(false);react.useEffect(()=>{if(!ce){let h=S();I(h),B(true);}},[N,x,D]);let y=h=>new Date(h).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),S=()=>`
2
- NDPC DATA BREACH NOTIFICATION
3
-
4
- Date: ${new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}
5
-
6
- Reference: NDPA Section 40 - Breach Notification
7
-
8
- ORGANIZATION DETAILS
9
- -------------------
10
- Organization Name: ${D.name}
11
- ${D.registrationNumber?`Registration Number: ${D.registrationNumber}`:""}
12
- Address: ${D.address}
13
- ${D.website?`Website: ${D.website}`:""}
14
-
15
- DATA PROTECTION OFFICER
16
- ----------------------
17
- Name: ${D.dpoName}
18
- Email: ${D.dpoEmail}
19
- ${D.dpoPhone?`Phone: ${D.dpoPhone}`:""}
20
-
21
- BREACH DETAILS
22
- -------------
23
- Breach Title: ${N.title}
24
- Date Discovered: ${y(N.discoveredAt)}
25
- ${N.occurredAt?`Date Occurred: ${y(N.occurredAt)}`:"Date Occurred: Unknown"}
26
- Status: ${N.status.charAt(0).toUpperCase()+N.status.slice(1)}
27
-
28
- Description of the Breach:
29
- ${N.description}
30
-
31
- Affected Systems/Applications:
32
- ${N.affectedSystems.join(", ")}
33
-
34
- Types of Personal Data Involved:
35
- ${N.dataTypes.join(", ")}
36
-
37
- Estimated Number of Data Subjects Affected:
38
- ${N.estimatedAffectedSubjects||"Unknown"}
39
-
40
- RISK ASSESSMENT
41
- --------------
42
- ${x?`
43
- Overall Risk Level: ${x.riskLevel.charAt(0).toUpperCase()+x.riskLevel.slice(1)}
44
- Risk to Rights and Freedoms of Data Subjects: ${x.risksToRightsAndFreedoms?"Yes":"No"}
45
- High Risk to Rights and Freedoms of Data Subjects: ${x.highRisksToRightsAndFreedoms?"Yes":"No"}
46
-
47
- Justification for Risk Assessment:
48
- ${x.justification}
49
- `:"Risk assessment has not been conducted yet."}
50
-
51
- MEASURES TAKEN
52
- -------------
53
- Measures taken or proposed to address the breach:
54
- ${N.initialActions||"To be determined"}
55
-
56
- Measures taken or proposed to mitigate possible adverse effects:
57
- [Please specify measures taken to mitigate adverse effects]
58
-
59
- NOTIFICATION TO DATA SUBJECTS (NDPA Section 40(4))
60
- ----------------------------
61
- Have data subjects been notified: [Yes/No]
62
- If yes, date of notification: [Date]
63
- If no, planned date of notification: [Date]
64
- Reason for delay (if applicable): [Reason]
65
-
66
- ADDITIONAL INFORMATION
67
- ---------------------
68
- [Any additional information relevant to the breach]
69
-
70
- This notification is made in compliance with the Nigeria Data Protection Act (NDPA), Section 40.
71
- `,te=h=>{h.preventDefault();let j={id:`notification_${Date.now()}`,breachId:N.id,sentAt:Date.now(),method:J,referenceNumber:K||void 0,ndpcContact:d?{name:d,email:E,phone:M||void 0}:void 0,content:C,attachments:[]};oe(j),w(true);},U=()=>{let h=document.createElement("a"),j=new Blob([C],{type:"text/plain"});h.href=URL.createObjectURL(j),h.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.txt`,document.body.appendChild(h),h.click(),document.body.removeChild(h);},ae=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(j=>jsxRuntime.jsx("option",{value:j.value,children:j.label},j.value));return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ee}`,n.root,p),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",n.header,p),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",n.title,p),children:ne}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:de})]}),k?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-6 p-4 bg-green-50 dark:bg-green-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2",children:"Report Generated Successfully"}),jsxRuntime.jsx("p",{className:"text-green-700 dark:text-green-300",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Submission Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Method:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:J.charAt(0).toUpperCase()+J.slice(1)})]}),d&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Contact Name:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:d})]}),E&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Contact Email:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:E})]}),M&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Contact Phone:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:M})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Date Generated:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:y(Date.now())})]}),jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Breach ID:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:N.id})]}),K&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-sm",n.field,p),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",n.fieldLabel,p),children:"Reference Number:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",n.fieldValue,p),children:K})]})]})]})]}),P&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Report Preview"}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("bg-gray-50 dark:bg-gray-700 p-4 rounded-md",n.reportPreview,p),children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:C})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-3",children:[pe&&jsxRuntime.jsxs("button",{onClick:U,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${u}`,n.secondaryButton||n.downloadButton,p),children:["Download Report (",L.toUpperCase(),")"]}),jsxRuntime.jsx("button",{onClick:()=>w(false),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${u}`,children:"Edit Report"})]})]}):jsxRuntime.jsx("form",{onSubmit:te,children:jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Notification Method"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"method",className:"block text-sm font-medium mb-1",children:["Method of Submission ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("select",{id:"method",value:J,onChange:h=>z(h.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,children:ae()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"referenceNumber",className:"block text-sm font-medium mb-1",children:"Reference Number (if available)"}),jsxRuntime.jsx("input",{type:"text",id:"referenceNumber",value:K,onChange:h=>V(h.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"NDPC Contact (if known)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactName",className:"block text-sm font-medium mb-1",children:"Contact Name"}),jsxRuntime.jsx("input",{type:"text",id:"contactName",value:d,onChange:h=>q(h.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactEmail",className:"block text-sm font-medium mb-1",children:"Contact Email"}),jsxRuntime.jsx("input",{type:"email",id:"contactEmail",value:E,onChange:h=>O(h.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactPhone",className:"block text-sm font-medium mb-1",children:"Contact Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"contactPhone",value:M,onChange:h=>_(h.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"additionalInfo",className:"block text-sm font-medium mb-1",children:"Additional Information to Include"}),jsxRuntime.jsx("textarea",{id:"additionalInfo",value:le,onChange:h=>Q(h.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),Z&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Report Content"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reportContent",className:"block text-sm font-medium mb-1",children:["Edit Report Content ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"reportContent",value:C,onChange:h=>I(h.target.value),rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] font-mono text-sm",required:true})]})]}),jsxRuntime.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This report will help you comply with this requirement."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${u}`,n.primaryButton||n.generateButton,p),children:me})})]})})]})};exports.a=ze;exports.b=tt;exports.c=dt;exports.d=bt;//# sourceMappingURL=chunk-32UIWTGD.js.map
72
- //# sourceMappingURL=chunk-32UIWTGD.js.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkSSGJREE3_js=require('./chunk-SSGJREE3.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function J({sections:u,initialAnswers:Q={},storageKey:d="ndpr_dpia_data",useLocalStorage:f=true,onComplete:A}){let[c,m]=react.useState(0),[i,g]=react.useState(Q);react.useEffect(()=>{if(f&&typeof window!="undefined")try{let r=localStorage.getItem(d);if(r){let{answers:n,sectionIndex:e}=JSON.parse(r);g(n||{}),m(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[d,f]),react.useEffect(()=>{if(f&&typeof window!="undefined")try{localStorage.setItem(d,JSON.stringify({answers:i,sectionIndex:c}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,c,d,f]);let p=u[c]||null,E=(r,n)=>{g(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{[r]:n}));},v=r=>r.showWhen?r.showWhen.every(n=>{let e=i[n.questionId];switch(n.operator){case "equals":return e===n.value;case "contains":return Array.isArray(e)?e.includes(n.value):false;case "greaterThan":return typeof e=="number"?e>n.value:false;case "lessThan":return typeof e=="number"?e<n.value:false;default:return true}}):true,h=()=>p?p.questions.filter(v):[],I=()=>p?h().every(n=>{if(!n.required)return true;let e=i[n.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&h().forEach(e=>{if(!e.required)return;let t=i[e.id];t==null||typeof t=="string"&&t.trim()===""?r[e.id]="This question is required":Array.isArray(t)&&t.length===0&&(r[e.id]="At least one option must be selected");}),r},T=()=>I()&&c<u.length-1?(m(r=>r+1),true):false,C=()=>c>0?(m(r=>r-1),true):false,L=r=>r>=0&&r<u.length?(m(r),true):false,O=()=>u.every(r=>r.questions.filter(e=>!e.showWhen||e.showWhen.length===0?true:e.showWhen.some(t=>{let s=i[t.questionId];switch(t.operator){case "equals":return s===t.value;case "contains":return Array.isArray(s)&&s.includes(t.value);case "greaterThan":return typeof s=="number"&&s>t.value;case "lessThan":return typeof s=="number"&&s<t.value;default:return false}})).every(e=>{if(!e.required)return true;let t=i[e.id];return !(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)})),W=()=>{let r=[];return u.forEach(n=>{n.questions.forEach(e=>{let t=i[e.id];if(t!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(t)?t:[t]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(l=>l.value===o);if(a!=null&&a.riskLevel){let l=a.riskLevel,y=l==="low"?1:l==="medium"?3:5,b=l==="low"?1:l==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:y,impact:b,score:y*b,level:l,mitigated:false,relatedQuestionIds:[e.id]});}});else {let s=e.riskLevel,o=s==="low"?1:s==="medium"?3:5,a=s==="low"?1:s==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:s,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},_=(r,n,e)=>{let t=W(),s={id:`dpia_${Date.now()}`,title:n,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:t,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=chunkSSGJREE3_js.a(s);return s.overallRiskLevel=o.overallRiskLevel,s.canProceed=o.canProceed,s.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",s.recommendations=o.recommendations,A&&A(s),s},$=()=>{g({}),m(0),f&&typeof window!="undefined"&&localStorage.removeItem(d);},U=(()=>{let r=0,n=0;return u.forEach(e=>{e.questions.forEach(t=>{if(t.required&&v(t)){n++;let s=i[t.id];s!=null&&!(typeof s=="string"&&s.trim()==="")&&!(Array.isArray(s)&&s.length===0)&&r++;}});}),n>0?Math.round(r/n*100):0})();return {currentSectionIndex:c,currentSection:p,answers:i,updateAnswer:E,nextSection:T,prevSection:C,goToSection:L,isCurrentSectionValid:I,getCurrentSectionErrors:x,isComplete:O,completeDPIA:_,getVisibleQuestions:h,resetDPIA:$,progress:U}}exports.a=J;//# sourceMappingURL=chunk-3YCV2BA6.js.map
2
- //# sourceMappingURL=chunk-3YCV2BA6.js.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkSWF3YVE5_js=require('./chunk-SWF3YVE5.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function w({initialData:R,onRecordAdd:n,onRecordUpdate:c,onRecordArchive:d}){let[s,p]=react.useState(R),O=react.useCallback(e=>{p(t=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{records:[...t.records,e],lastUpdated:Date.now()})),n==null||n(e);},[n]),l=react.useCallback((e,t)=>{p(o=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},o),{records:o.records.map(g=>g.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},g),t),{updatedAt:Date.now()}):g),lastUpdated:Date.now()})),c==null||c(e,t);},[c]),f=react.useCallback(e=>{p(t=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{records:t.records.map(o=>o.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},o),{status:"archived",updatedAt:Date.now()}):o),lastUpdated:Date.now()})),d==null||d(e);},[d]),A=react.useCallback(e=>s.records.find(t=>t.id===e),[s.records]),y=react.useCallback(()=>chunkSWF3YVE5_js.b(s),[s]),C=react.useCallback(()=>chunkSWF3YVE5_js.c(s),[s]),S=react.useCallback(()=>chunkSWF3YVE5_js.d(s),[s]);return {ropa:s,addRecord:O,updateRecord:l,archiveRecord:f,getRecord:A,getSummary:y,exportCSV:C,getComplianceGaps:S}}exports.a=w;//# sourceMappingURL=chunk-4A354HL3.js.map
2
- //# sourceMappingURL=chunk-4A354HL3.js.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkIQF726GS_js=require('./chunk-IQF726GS.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function J({initialTransfers:w=[],storageKey:c="ndpr_cross_border_transfers",useLocalStorage:u=true,onAdd:m,onUpdate:p,onRemove:C}={}){let[t,l]=react.useState(w);react.useEffect(()=>{if(u&&typeof window!="undefined")try{let r=localStorage.getItem(c);r&&l(JSON.parse(r));}catch(r){console.error("Error loading cross-border transfers:",r);}},[c,u]),react.useEffect(()=>{if(u&&typeof window!="undefined")try{localStorage.setItem(c,JSON.stringify(t));}catch(r){console.error("Error saving cross-border transfers:",r);}},[t,c,u]);let _=()=>"cbt_"+Date.now()+"_"+Math.random().toString(36).substring(2,11),b=react.useCallback(r=>{let n=Date.now(),s=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},r),{id:_(),createdAt:n,updatedAt:n});return l(a=>[...a,s]),m&&m(s),s},[m]),A=react.useCallback((r,n)=>{let s=null;return l(a=>{let o=a.findIndex(g=>g.id===r);if(o===-1)return a;s=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},a[o]),n),{updatedAt:Date.now()});let f=[...a];return f[o]=s,f}),s&&p&&p(s),s},[p]),S=react.useCallback(r=>{let n=false;return l(s=>s.findIndex(o=>o.id===r)===-1?s:(n=true,s.filter(o=>o.id!==r))),n&&C&&C(r),n},[C]),q=react.useCallback(r=>t.find(n=>n.id===r)||null,[t]),D=react.useCallback(()=>{let r=Date.now(),n=t.filter(e=>e.status==="active"),s=["adequacy_decision","standard_clauses","binding_corporate_rules","ndpc_authorization","explicit_consent","contract_performance","public_interest","legal_claims","vital_interests"],a={};for(let e of s)a[e]=n.filter(i=>i.transferMechanism===e).length;let o=["adequate","inadequate","pending_review","unknown"],f={};for(let e of o)f[e]=n.filter(i=>i.adequacyStatus===e).length;let g=t.filter(e=>{var i,v;return e.status==="pending_approval"||((i=e.ndpcApproval)==null?void 0:i.required)&&!((v=e.ndpcApproval)!=null&&v.approved)}),R=720*60*60*1e3,x=t.filter(e=>e.reviewDate&&e.reviewDate<=r+R&&e.status==="active"),I=t.filter(e=>!e.tiaCompleted&&e.status==="active"),O=t.filter(e=>e.riskLevel==="high"&&e.status==="active");return {totalActiveTransfers:n.length,byMechanism:a,byAdequacy:f,pendingApproval:g,dueForReview:x,missingTIA:I,highRiskTransfers:O,lastUpdated:r}},[t]),M=react.useCallback(r=>chunkIQF726GS_js.c(r),[]);return {transfers:t,addTransfer:b,updateTransfer:A,removeTransfer:S,getTransfer:q,getSummary:D,validateTransfer:M}}exports.a=J;//# sourceMappingURL=chunk-5ZBO2UPH.js.map
2
- //# sourceMappingURL=chunk-5ZBO2UPH.js.map
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-PGSA2O5P.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';function J({sections:u,initialAnswers:Q={},storageKey:d="ndpr_dpia_data",useLocalStorage:f=true,onComplete:A}){let[c,m]=useState(0),[i,g]=useState(Q);useEffect(()=>{if(f&&typeof window!="undefined")try{let r=localStorage.getItem(d);if(r){let{answers:n,sectionIndex:e}=JSON.parse(r);g(n||{}),m(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[d,f]),useEffect(()=>{if(f&&typeof window!="undefined")try{localStorage.setItem(d,JSON.stringify({answers:i,sectionIndex:c}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,c,d,f]);let p=u[c]||null,E=(r,n)=>{g(e=>b(a({},e),{[r]:n}));},v=r=>r.showWhen?r.showWhen.every(n=>{let e=i[n.questionId];switch(n.operator){case "equals":return e===n.value;case "contains":return Array.isArray(e)?e.includes(n.value):false;case "greaterThan":return typeof e=="number"?e>n.value:false;case "lessThan":return typeof e=="number"?e<n.value:false;default:return true}}):true,h=()=>p?p.questions.filter(v):[],I=()=>p?h().every(n=>{if(!n.required)return true;let e=i[n.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&h().forEach(e=>{if(!e.required)return;let t=i[e.id];t==null||typeof t=="string"&&t.trim()===""?r[e.id]="This question is required":Array.isArray(t)&&t.length===0&&(r[e.id]="At least one option must be selected");}),r},T=()=>I()&&c<u.length-1?(m(r=>r+1),true):false,C=()=>c>0?(m(r=>r-1),true):false,L=r=>r>=0&&r<u.length?(m(r),true):false,O=()=>u.every(r=>r.questions.filter(e=>!e.showWhen||e.showWhen.length===0?true:e.showWhen.some(t=>{let s=i[t.questionId];switch(t.operator){case "equals":return s===t.value;case "contains":return Array.isArray(s)&&s.includes(t.value);case "greaterThan":return typeof s=="number"&&s>t.value;case "lessThan":return typeof s=="number"&&s<t.value;default:return false}})).every(e=>{if(!e.required)return true;let t=i[e.id];return !(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)})),W=()=>{let r=[];return u.forEach(n=>{n.questions.forEach(e=>{let t=i[e.id];if(t!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(t)?t:[t]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(l=>l.value===o);if(a!=null&&a.riskLevel){let l=a.riskLevel,y=l==="low"?1:l==="medium"?3:5,b=l==="low"?1:l==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:y,impact:b,score:y*b,level:l,mitigated:false,relatedQuestionIds:[e.id]});}});else {let s=e.riskLevel,o=s==="low"?1:s==="medium"?3:5,a=s==="low"?1:s==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:s,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},_=(r,n,e)=>{let t=W(),s={id:`dpia_${Date.now()}`,title:n,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:t,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=a$1(s);return s.overallRiskLevel=o.overallRiskLevel,s.canProceed=o.canProceed,s.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",s.recommendations=o.recommendations,A&&A(s),s},$=()=>{g({}),m(0),f&&typeof window!="undefined"&&localStorage.removeItem(d);},U=(()=>{let r=0,n=0;return u.forEach(e=>{e.questions.forEach(t=>{if(t.required&&v(t)){n++;let s=i[t.id];s!=null&&!(typeof s=="string"&&s.trim()==="")&&!(Array.isArray(s)&&s.length===0)&&r++;}});}),n>0?Math.round(r/n*100):0})();return {currentSectionIndex:c,currentSection:p,answers:i,updateAnswer:E,nextSection:T,prevSection:C,goToSection:L,isCurrentSectionValid:I,getCurrentSectionErrors:x,isComplete:O,completeDPIA:_,getVisibleQuestions:h,resetDPIA:$,progress:U}}export{J as a};//# sourceMappingURL=chunk-6GGGTRDZ.mjs.map
2
- //# sourceMappingURL=chunk-6GGGTRDZ.mjs.map
@@ -1,7 +0,0 @@
1
- import {a}from'./chunk-AYKLAEOU.mjs';import {jsxs,jsx}from'react/jsx-runtime';import F from'react';var E=({sections:d,answers:k,onAnswerChange:y,currentSectionIndex:b,onNextSection:C,onPrevSection:P,validationErrors:$={},readOnly:x=false,className:A="",buttonClassName:D="",nextButtonText:o="Next",prevButtonText:N="Previous",submitButtonText:h="Submit",showProgress:c=true,progress:v,classNames:w={},unstyled:S=false})=>{let u=d[b],i=b===d.length-1,a$1=(e,m)=>{let n=m?w[m]:void 0;return !n&&m==="nextButton"&&(n=w.primaryButton),!n&&m==="prevButton"&&(n=w.secondaryButton),a(e,n,S)},g=e=>e.showWhen?e.showWhen.every(m=>{let n=k[m.questionId];switch(m.operator){case "equals":return n===m.value;case "contains":return Array.isArray(n)?n.includes(m.value):false;case "greaterThan":return typeof n=="number"?n>m.value:false;case "lessThan":return typeof n=="number"?n<m.value:false;default:return true}}):true,R=e=>a$1(`w-full px-3 py-2 border rounded-md ${e?"border-red-500":"border-gray-300 dark:border-gray-600"} focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100`,"input"),B=e=>{if(!g(e))return null;let m=$[e.id],n=k[e.id];return jsxs("div",{className:a$1("mb-6","question"),children:[jsxs("div",{className:"mb-2",children:[jsxs("label",{htmlFor:e.id,className:a$1("block text-sm font-medium text-gray-900 dark:text-gray-100","questionText"),children:[e.text,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),e.guidance&&jsx("p",{className:a$1("mt-1 text-sm text-gray-600 dark:text-gray-400","guidance"),children:e.guidance})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:n||"",onChange:s=>y(e.id,s.target.value),disabled:x,className:R(m)}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:n||"",onChange:s=>y(e.id,s.target.value),disabled:x,rows:4,className:R(m)}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:n||"",onChange:s=>y(e.id,s.target.value),disabled:x,className:R(m),children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(s=>jsx("option",{value:s.value,children:s.label},s.value))]}),e.type==="radio"&&e.options&&jsx("div",{className:a$1("space-y-2","radioGroup"),children:e.options.map(s=>jsxs("div",{className:a$1("flex items-center","radioOption"),children:[jsx("input",{type:"radio",id:`${e.id}_${s.value}`,name:e.id,value:s.value,checked:n===s.value,onChange:()=>y(e.id,s.value),disabled:x,className:"h-4 w-4 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))] border-gray-300 dark:border-gray-600"}),jsxs("label",{htmlFor:`${e.id}_${s.value}`,className:"ml-2 block text-sm text-gray-900 dark:text-gray-100",children:[s.label,s.riskLevel&&jsxs("span",{className:`ml-2 text-xs px-2 py-1 rounded ${s.riskLevel==="low"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":s.riskLevel==="medium"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:[s.riskLevel.charAt(0).toUpperCase()+s.riskLevel.slice(1)," Risk"]})]})]},s.value))}),e.type==="checkbox"&&e.options&&jsx("div",{className:"space-y-2",children:e.options.map(s=>jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"checkbox",id:`${e.id}_${s.value}`,value:s.value,checked:Array.isArray(n)?n.includes(s.value):false,onChange:L=>{let Q=Array.isArray(n)?[...n]:[];L.target.checked?y(e.id,[...Q,s.value]):y(e.id,Q.filter(j=>j!==s.value));},disabled:x,className:"h-4 w-4 rounded text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))] border-gray-300 dark:border-gray-600"}),jsx("label",{htmlFor:`${e.id}_${s.value}`,className:"ml-2 block text-sm text-gray-900 dark:text-gray-100",children:s.label})]},s.value))}),e.type==="scale"&&jsxs("div",{children:[jsx("div",{className:"flex justify-between mb-2",children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([s,L])=>jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 text-center",style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`},children:L},s))}),jsx("input",{type:"range",id:e.id,min:e.minValue||1,max:e.maxValue||5,value:n||e.minValue||1,onChange:s=>y(e.id,parseInt(s.target.value,10)),disabled:x,className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),jsxs("div",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400 text-center",children:["Selected value: ",n||e.minValue||1]})]}),m&&jsx("p",{className:"mt-1 text-sm text-red-500",children:m})]},e.id)};return u?jsxs("div",{className:`${a$1("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6","root")} ${A}`,children:[c&&jsxs("div",{className:a$1("mb-6","header"),children:[jsxs("div",{className:"flex justify-between text-sm text-gray-600 dark:text-gray-400 mb-1",children:[jsxs("span",{children:["Section ",b+1," of ",d.length]}),jsx("span",{children:v!==void 0?`${v}% Complete`:""})]}),jsx("div",{className:a$1("w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700","progressBar"),children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${v!==void 0?v:(b+1)/d.length*100}%`}})})]}),jsx("h2",{className:a$1("text-xl font-bold mb-2 text-gray-900 dark:text-white","title"),children:u.title}),u.description&&jsx("p",{className:a$1("mb-6 text-gray-600 dark:text-gray-300","sectionTitle"),children:u.description}),jsx("div",{className:a$1("space-y-6","section"),children:u.questions.map(e=>B(e))}),jsxs("div",{className:a$1("mt-8 flex justify-between","navigation"),children:[jsx("button",{type:"button",onClick:P,disabled:b===0||x,className:`${a$1("px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed","prevButton")} ${D}`,children:N}),jsx("button",{type:"button",onClick:C,disabled:x,className:`${a$1("px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:opacity-50 disabled:cursor-not-allowed","nextButton")} ${D}`,children:i?h:o})]})]}):jsx("div",{children:"No section found."})};var U=({result:d,sections:k,showFullReport:y=true,allowPrint:b=true,allowExport:C=true,onExport:P,className:$="",buttonClassName:x="",classNames:A={},unstyled:D=false})=>{let o=(i,a$1)=>{let g=a$1?A[a$1]:void 0;return !g&&a$1==="printButton"&&(g=A.primaryButton),a(i,g,D)},N=i=>new Date(i).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),v=i=>{let a=d.answers[i];return a==null?"Not answered":typeof a=="boolean"?a?"Yes":"No":Array.isArray(a)?a.join(", "):String(a)},w=()=>{window.print();},S=i=>{P&&P(i);},u=i=>jsx("span",{className:o(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[i]}`,"riskBadge"),children:i.charAt(0).toUpperCase()+i.slice(1)});return jsxs("div",{className:`${o("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${$}`,children:[jsxs("div",{className:o("mb-8 border-b border-gray-200 dark:border-gray-700 pb-6 print:pb-4","header"),children:[jsxs("div",{className:"flex justify-between items-start",children:[jsxs("div",{children:[jsx("h1",{className:o("text-2xl font-bold text-gray-900 dark:text-white mb-2","title"),children:"Data Protection Impact Assessment Report"}),jsx("h2",{className:"text-xl text-gray-700 dark:text-gray-300 mb-4",children:d.title})]}),(b||C)&&jsxs("div",{className:"flex space-x-2 print:hidden",children:[b&&jsx("button",{onClick:w,className:`${o("px-3 py-1 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600","printButton")} ${x}`,children:jsxs("span",{className:"flex items-center",children:[jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print"]})}),C&&jsx("div",{className:"relative inline-block",children:jsx("button",{onClick:()=>S("pdf"),className:`px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${x}`,children:jsxs("span",{className:"flex items-center",children:[jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export PDF"]})})})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsx("span",{className:"font-medium",children:"Assessor:"})," ",d.assessor.name,", ",d.assessor.role]}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsx("span",{className:"font-medium",children:"Contact:"})," ",d.assessor.email]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsx("span",{className:"font-medium",children:"Started:"})," ",N(d.startedAt)]}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsx("span",{className:"font-medium",children:"Completed:"})," ",d.completedAt?N(d.completedAt):"In progress"]}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsx("span",{className:"font-medium",children:"Next review:"})," ",d.reviewDate?N(d.reviewDate):"Not scheduled"]})]})]})]}),jsxs("div",{className:o("mb-8","summary"),children:[jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Executive Summary"}),jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4",children:[jsxs("div",{className:"flex items-center mb-2",children:[jsx("span",{className:"font-medium mr-2",children:"Overall Risk Level:"}),u(d.overallRiskLevel)]}),jsxs("div",{className:o("mb-2","conclusion"),children:[jsx("span",{className:"font-medium",children:"Conclusion:"})," ",d.conclusion]}),jsxs("div",{children:[jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",d.canProceed?"Yes":"No"]})]}),jsxs("div",{children:[jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Processing Activity Description"}),jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-4",children:d.processingDescription}),d.recommendations&&d.recommendations.length>0&&jsxs("div",{children:[jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Key Recommendations"}),jsx("ul",{className:"list-disc pl-5 text-gray-700 dark:text-gray-300",children:d.recommendations.map((i,a)=>jsx("li",{className:o("","recommendation"),children:i},a))})]})]})]}),jsxs("div",{className:"mb-8",children:[jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Identified Risks"}),d.risks.length===0?jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"No risks identified."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:o("min-w-full divide-y divide-gray-200 dark:divide-gray-700","riskTable"),children:[jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Likelihood"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Impact"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk Level"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Mitigated"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:d.risks.map(i=>jsxs("tr",{className:o("","riskRow"),children:[jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:i.description}),jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[i.likelihood," / 5"]}),jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[i.impact," / 5"]}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:u(i.level)}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:i.mitigated?jsx("span",{className:"text-green-600 dark:text-green-400",children:"Yes"}):jsx("span",{className:"text-red-600 dark:text-red-400",children:"No"})})]},i.id))})]})})]}),y&&jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Full Assessment Details"}),k.map(i=>{let a=i.questions.filter(g=>d.answers[g.id]!==void 0);return a.length===0?null:jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:i.title}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Question"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Answer"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:a.map(g=>jsxs("tr",{children:[jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:g.text}),jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-600 dark:text-gray-400",children:v(g.id)})]},g.id))})]})})]},i.id)})]}),jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm text-gray-600 dark:text-gray-400",children:[jsx("p",{children:"This DPIA was conducted in accordance with the Nigeria Data Protection Act (NDPA) 2023."}),jsxs("p",{children:["DPIA Report Version: ",d.version]}),jsxs("p",{children:["Generated on: ",new Date().toLocaleDateString()]})]})]})};var K=({steps:d,onStepClick:k,clickable:y=true,orientation:b="horizontal",className:C="",activeStepClassName:P="",completedStepClassName:$="",incompleteStepClassName:x="",classNames:A={},unstyled:D=false})=>{let o=(c,v)=>a(c,v?A[v]:void 0,D),N=c=>{y&&k&&k(c);},h=b==="vertical";return jsx("div",{className:`${o(h?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${C}`,children:d.map((c,v)=>{let w=v===d.length-1,S=c.active?o(`font-medium ${P||"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]"}`,"label"):c.completed?o($||"text-green-600 dark:text-green-400","label"):o(x||"text-gray-600 dark:text-gray-400","label"),u=c.active?o("flex items-center justify-center w-8 h-8 rounded-full bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):c.completed?o("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-400 border-2 border-green-600 dark:border-green-400","stepCompleted"):o("flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-2 border-gray-300 dark:border-gray-600","stepPending");return jsxs(F.Fragment,{children:[jsxs("div",{className:o(`${h?"flex items-start":"flex flex-col items-center"} ${y?"cursor-pointer":""}`,"step"),onClick:()=>N(c.id),children:[jsx("div",{className:`
2
- flex items-center justify-center
3
- ${h?"mr-4":""}
4
- `,children:jsx("div",{className:u,children:c.icon?c.icon:c.completed?jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):jsx("span",{children:v+1})})}),jsxs("div",{className:`
5
- ${h?"flex-1":"mt-2 text-center"}
6
- `,children:[jsx("div",{className:`text-sm font-medium ${S}`,children:c.label}),c.description&&jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:c.description})]})]}),!w&&jsx("div",{className:o(h?"ml-4 h-8 border-l-2 border-gray-300 dark:border-gray-600":"w-full border-t-2 border-gray-300 dark:border-gray-600 hidden sm:block","connector")})]},c.id)})})};export{E as a,U as b,K as c};//# sourceMappingURL=chunk-BZTTQS4A.mjs.map
7
- //# sourceMappingURL=chunk-BZTTQS4A.mjs.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkCMZTI7SG_js=require('./chunk-CMZTI7SG.js'),chunkEPF7J2FK_js=require('./chunk-EPF7J2FK.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ke=({requestTypes:A,onSubmit:z,onValidationError:M,title:K="Submit a Data Subject Request",description:te="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:oe="Submit Request",className:W="",buttonClassName:H="",showConfirmation:re=true,confirmationMessage:ie="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:V=true,identifierTypes:l=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:b=true,labels:D={},classNames:e,unstyled:m=false,isSubmitting:C=false,defaultValues:k,onReset:$})=>{var t,d,h,q,se,ge;let[I,_]=react.useState((k==null?void 0:k.requestType)||""),[E,F]=react.useState(((t=k==null?void 0:k.dataSubject)==null?void 0:t.fullName)||""),[B,L]=react.useState(((d=k==null?void 0:k.dataSubject)==null?void 0:d.email)||""),[Y,Z]=react.useState(((h=k==null?void 0:k.dataSubject)==null?void 0:h.phone)||""),[ae,P]=react.useState(((q=k==null?void 0:k.dataSubject)==null?void 0:q.identifierType)||((se=l[0])==null?void 0:se.id)||""),[G,Q]=react.useState(((ge=k==null?void 0:k.dataSubject)==null?void 0:ge.identifierValue)||""),[j,J]=react.useState((k==null?void 0:k.additionalInfo)||{}),[T,U]=react.useState(false),[o,i]=react.useState({}),v=()=>{var r;_(""),F(""),L(""),Z(""),P(((r=l[0])==null?void 0:r.id)||""),Q(""),J({}),U(false),i({}),$==null||$();},u=A.find(r=>r.id===I),R=r=>{_(r.target.value),J({});},s=(r,w)=>{J(X=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},X),{[r]:w}));},x=()=>{let r={};return E.trim()||(r.fullName="Full name is required"),B.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(B)||(r.email="Email is invalid"):r.email="Email is required",I||(r.requestType="Please select a request type"),V&&!G.trim()&&(r.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(w=>{w.required&&!j[w.id]&&(r[`additional_${w.id}`]=`${w.label} is required`);}),i(r),r},S=r=>{r.preventDefault();let w=x();if(Object.keys(w).length>0){M==null||M(w);return}let X=Object.keys(j).length>0?Object.fromEntries(Object.entries(j).map(([be,le])=>[be,typeof le=="string"?chunkEPF7J2FK_js.a(le):le])):void 0,ne={requestType:I,dataSubject:{fullName:chunkEPF7J2FK_js.a(E),email:chunkEPF7J2FK_js.a(B),phone:Y?chunkEPF7J2FK_js.a(Y):void 0,identifierType:ae,identifierValue:chunkEPF7J2FK_js.a(G)},additionalInfo:X,submittedAt:Date.now()};z(ne),re&&U(true);};return T?jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${W}`,e==null?void 0:e.successMessage,m),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",e==null?void 0:e.title,m),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-green-700 dark:text-green-300",e==null?void 0:e.description,m),children:ie}),jsxRuntime.jsx("button",{onClick:()=>U(false),className:chunkE64TU6IU_js.a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${H}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),m),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${W}`,e==null?void 0:e.root,m),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",e==null?void 0:e.title,m),children:K}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("mb-6 text-gray-600 dark:text-gray-300",e==null?void 0:e.description,m),children:te}),jsxRuntime.jsx("form",{onSubmit:S,className:chunkE64TU6IU_js.a("",e==null?void 0:e.form,m),children:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("space-y-4",e==null?void 0:e.fieldGroup,m),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.name||"Full Name"," ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:E,onChange:r=>F(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.fullName,"aria-describedby":o.fullName?"fullName-error":void 0}),o.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.email||"Email Address"," ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:B,onChange:r=>L(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.email,"aria-describedby":o.email?"email-error":void 0}),o.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.email})]}),b&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:Y,onChange:r=>Z(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:I,onChange:R,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:true,"aria-invalid":!!o.requestType,"aria-describedby":o.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),A.map(r=>jsxRuntime.jsx("option",{value:r.id,children:r.name},r.id))]}),o.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.requestType})]}),u&&jsxRuntime.jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:D.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.textarea,m),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),V&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:["Identifier Type ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:ae,onChange:r=>P(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:true,children:l.map(r=>jsxRuntime.jsx("option",{value:r.id,children:r.label},r.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:["Identifier Value ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:G,onChange:r=>Q(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.identifierValue,"aria-describedby":o.identifierValue?"identifierValue-error":void 0}),o.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsxRuntime.jsx("div",{className:"space-y-4",children:u.additionalFields.map(r=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:r.id,className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[r.label," ",r.required&&jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),r.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),placeholder:r.placeholder,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),r.type==="textarea"&&jsxRuntime.jsx("textarea",{id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),placeholder:r.placeholder,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.textarea,m),rows:4,required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),r.type==="select"&&r.options&&jsxRuntime.jsxs("select",{id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:r.placeholder||"Select an option"}),r.options.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]}),r.type==="checkbox"&&jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{type:"checkbox",id:r.id,checked:!!j[r.id],onChange:w=>s(r.id,w.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0})}),jsxRuntime.jsx("div",{className:"ml-3 text-sm",children:jsxRuntime.jsx("label",{htmlFor:r.id,className:"text-gray-700 dark:text-gray-300",children:r.placeholder||r.label})})]}),r.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:r.id,onChange:w=>{var ne;let X=(ne=w.target.files)==null?void 0:ne[0];X&&s(r.id,X);},className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),o[`additional_${r.id}`]&&jsxRuntime.jsx("p",{id:`additional-${r.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:o[`additional_${r.id}`]})]},r.id))})]}),jsxRuntime.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxRuntime.jsxs("div",{className:"mt-6 flex gap-3 relative",children:[C&&(e==null?void 0:e.loadingOverlay)&&jsxRuntime.jsx("div",{className:e.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:C,className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${H} ${C?"opacity-50 cursor-not-allowed":""}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),m),children:C?"Submitting...":D.submit||oe}),jsxRuntime.jsx("button",{type:"button",onClick:v,className:chunkE64TU6IU_js.a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,m),children:"Reset"})]})]})})]})};var je=({requests:A,onSelectRequest:z,onUpdateStatus:M,onAssignRequest:K,title:te="Data Subject Request Dashboard",description:oe="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:W="",buttonClassName:H="",showRequestDetails:re=true,showRequestTimeline:ie=true,showDeadlineAlerts:V=true,assignees:l=[],classNames:b,unstyled:D=false})=>{let[e,m]=react.useState(null),[C,k]=react.useState(A),[$,I]=react.useState("all"),[_,E]=react.useState("all"),[F,B]=react.useState(""),[L,Y]=react.useState("createdAt"),[Z,ae]=react.useState("desc"),[P,G]=react.useState("");react.useEffect(()=>{let t=[...A];if($!=="all"&&(t=t.filter(d=>d.status===$)),_!=="all"&&(t=t.filter(d=>d.type===_)),F){let d=F.toLowerCase();t=t.filter(h=>h.subject.name.toLowerCase().includes(d)||h.subject.email.toLowerCase().includes(d)||h.description&&h.description.toLowerCase().includes(d));}t.sort((d,h)=>{let q=0;switch(L){case "createdAt":q=d.createdAt-h.createdAt;break;case "dueDate":q=(d.dueDate||0)-(h.dueDate||0);break;case "type":q=d.type.localeCompare(h.type);break;case "status":q=d.status.localeCompare(h.status);break;default:q=d.createdAt-h.createdAt;}return Z==="asc"?q:-q}),k(t);},[A,$,_,F,L,Z]),react.useEffect(()=>{C.length>0&&!e&&m(C[0].id);},[C,e]);let Q=t=>{m(t),z&&z(t);},j=t=>{e&&M&&M(e,t);},J=()=>{e&&P&&K&&(K(e,P),G(""));},T=t=>new Date(t).toLocaleDateString(),U=t=>{let d=Date.now(),h=(t-d)/(1440*60*1e3);return Math.ceil(h)},o=e?A.find(t=>t.id===e):null,i=t=>{let d={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},h={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${d[t]}`,children:h[t]})},v=t=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[t]}`,b==null?void 0:b.statusBadge,D),children:t==="inProgress"?"In Progress":t==="awaitingVerification"?"Awaiting Verification":t.charAt(0).toUpperCase()+t.slice(1)}),u=t=>{if(!t.dueDate)return null;let d=U(t.dueDate);return d<=0?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsxRuntime.jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):d<=3?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxRuntime.jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",d," day",d!==1?"s":""," remaining until the response deadline."]})]}):d<=7?jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxRuntime.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[d," days remaining until the response deadline."]})]}):jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxRuntime.jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[d," days remaining until the response deadline."]})]})},R=t=>{let d=[{title:"Request Received",date:t.createdAt,completed:true,description:`Request was received on ${T(t.createdAt)}.`}];return t.verifiedAt?d.push({title:"Identity Verified",date:t.verifiedAt,completed:true,description:`Data subject's identity was verified on ${T(t.verifiedAt)}.`}):t.status==="awaitingVerification"&&d.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(t.status==="inProgress"||t.status==="completed"||t.status==="rejected")&&d.push({title:"Processing Started",date:t.updatedAt,completed:true,description:`Request processing started on ${T(t.updatedAt)}.`}),t.status==="completed"?d.push({title:"Request Completed",date:t.completedAt||Date.now(),completed:true,description:`Request was completed on ${T(t.completedAt||Date.now())}.`}):t.status==="rejected"&&d.push({title:"Request Rejected",date:t.completedAt||Date.now(),completed:true,description:`Request was rejected on ${T(t.completedAt||Date.now())}.${t.rejectionReason?` Reason: ${t.rejectionReason}`:""}`}),t.dueDate&&d.push({title:"Response Deadline",date:t.dueDate,completed:Date.now()>t.dueDate,description:`Response is due by ${T(t.dueDate)}.`}),jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsxRuntime.jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:d.map((h,q)=>jsxRuntime.jsxs("li",{className:"mb-6 ml-4",children:[jsxRuntime.jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${h.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsxRuntime.jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:h.date?T(h.date):"Pending"}),jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:h.title}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:h.description})]},q))})]})},s=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 29)"},{value:"access",label:"Access (NDPA Section 30)"},{value:"rectification",label:"Rectification (NDPA Section 31)"},{value:"erasure",label:"Erasure (NDPA Section 32)"},{value:"restriction",label:"Restriction (NDPA Section 33)"},{value:"portability",label:"Portability (NDPA Section 34)"},{value:"objection",label:"Objection (NDPA Section 35)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 36)"}].map(d=>jsxRuntime.jsx("option",{value:d.value,children:d.label},d.value)),x=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(d=>jsxRuntime.jsx("option",{value:d.value,children:d.label},d.value)),S=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(d=>jsxRuntime.jsx("option",{value:d.value,children:d.label},d.value));return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${W}`,b==null?void 0:b.root,D),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",b==null?void 0:b.header,D),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",b==null?void 0:b.title,D),children:te}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:oe})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",b==null?void 0:b.filters,D),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsxRuntime.jsx("select",{id:"statusFilter",value:$,onChange:t=>I(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:x()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsxRuntime.jsx("select",{id:"typeFilter",value:_,onChange:t=>E(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:s()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxRuntime.jsxs("select",{id:"sortBy",value:L,onChange:t=>Y(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsxRuntime.jsx("option",{value:"createdAt",children:"Date Received"}),jsxRuntime.jsx("option",{value:"dueDate",children:"Due Date"}),jsxRuntime.jsx("option",{value:"type",children:"Request Type"}),jsxRuntime.jsx("option",{value:"status",children:"Status"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchTerm",value:F,onChange:t=>B(t.target.value),placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),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:"DSR Requests"}),C.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",b==null?void 0:b.requestList,D),children:C.map(t=>{let d=t.dueDate?U(t.dueDate):null,h=null;return d!==null&&(d<=0?h=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):d<=3?h=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):d<=7&&(h=jsxRuntime.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`p-3 rounded-md cursor-pointer ${e===t.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,b==null?void 0:b.requestItem,D),onClick:()=>Q(t.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),i(t.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",T(t.createdAt)]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsxRuntime.jsx("div",{children:v(t.status)}),jsxRuntime.jsx("div",{children:h})]})]},t.id)})})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("md:col-span-2",b==null?void 0:b.detailPanel,D),children:o?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:o.subject.name}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[i(o.type),v(o.status)]})]}),V&&o.dueDate&&jsxRuntime.jsx("div",{className:"mb-4",children:u(o)}),re&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Email:"})," ",o.subject.email]}),o.subject.phone&&jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Phone:"})," ",o.subject.phone]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Received:"})," ",T(o.createdAt)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[o.type]||o.type]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",o.status==="inProgress"?"In Progress":o.status==="awaitingVerification"?"Awaiting Verification":o.status.charAt(0).toUpperCase()+o.status.slice(1)]}),o.dueDate&&jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Due Date:"})," ",T(o.dueDate)]})]})]}),o.description&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:o.description})]}),o.additionalInfo&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof o.additionalInfo=="object"?JSON.stringify(o.additionalInfo,null,2):String(o.additionalInfo||"No additional information provided")})]})]}),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-md font-medium mb-2",children:"Update Status"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("select",{value:o.status,onChange:t=>j(t.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:S()}),jsxRuntime.jsx("button",{onClick:()=>j(o.status),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${H}`,children:"Update"})]})]}),l.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-md font-medium mb-2",children:"Assign Request"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsxs("select",{value:P,onChange:t=>G(t.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsxRuntime.jsx("option",{value:"",children:"Select Assignee"}),l.map(t=>jsxRuntime.jsx("option",{value:t,children:t},t))]}),jsxRuntime.jsx("button",{onClick:J,disabled:!P,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${H}`,children:"Assign"})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsxRuntime.jsx("pre",{children:JSON.stringify(chunkCMZTI7SG_js.a(o),null,2)})})})]}),ie&&R(o)]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var _e=({requests:A,onSelectRequest:z,title:M="DSR Request Tracker",description:K="Track the status and progress of data subject requests as required by NDPA Part IV.",className:te="",buttonClassName:oe="",showSummaryStats:W=true,showTypeBreakdown:H=true,showStatusBreakdown:re=true,showTimelineChart:ie=true,showOverdueRequests:V=true,classNames:l,unstyled:b=false})=>{let[D,e]=react.useState("30days"),[m,C]=react.useState(A),[k,$]=react.useState([]),[I,_]=react.useState([]);react.useEffect(()=>{let i=Date.now(),v;switch(D){case "7days":v=A.filter(s=>i-s.createdAt<=10080*60*1e3);break;case "30days":v=A.filter(s=>i-s.createdAt<=720*60*60*1e3);break;case "90days":v=A.filter(s=>i-s.createdAt<=2160*60*60*1e3);break;default:v=[...A];}C(v);let u=v.filter(s=>s.dueDate&&i>s.dueDate&&s.status!=="completed"&&s.status!=="rejected");$(u);let R=v.filter(s=>s.dueDate&&i<s.dueDate&&s.dueDate-i<=10080*60*1e3&&s.status!=="completed"&&s.status!=="rejected");_(R);},[A,D]);let E=i=>{z&&z(i);},F=i=>new Date(i).toLocaleDateString(),B=i=>{let v=Date.now(),u=(i-v)/(1440*60*1e3);return Math.ceil(u)},L=()=>{let i=m.filter(u=>u.status==="completed"&&u.completedAt&&u.createdAt);if(i.length===0)return null;let v=i.reduce((u,R)=>{let s=((R.completedAt||0)-R.createdAt)/864e5;return u+s},0);return Number((v/i.length).toFixed(1))},Y=()=>{let i=m.filter(u=>(u.status==="completed"||u.status==="rejected")&&u.completedAt&&u.dueDate);if(i.length===0)return null;let v=i.filter(u=>(u.completedAt||0)<=(u.dueDate||0));return Math.round(v.length/i.length*100)},Z=()=>{let i={};return m.forEach(v=>{i[v.type]=(i[v.type]||0)+1;}),{information:i.information||0,access:i.access||0,rectification:i.rectification||0,erasure:i.erasure||0,restriction:i.restriction||0,portability:i.portability||0,objection:i.objection||0,automated_decision_making:i.automated_decision_making||0}},ae=()=>{let i={};return m.forEach(v=>{i[v.status]=(i[v.status]||0)+1;}),{pending:i.pending||0,awaitingVerification:i.awaitingVerification||0,inProgress:i.inProgress||0,completed:i.completed||0,rejected:i.rejected||0}},P=i=>{let v={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},u={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${v[i]}`,children:u[i]})},Q=()=>{let i=m.length,v=m.filter(x=>x.status!=="completed"&&x.status!=="rejected").length;m.filter(x=>x.status==="completed"||x.status==="rejected").length;let R=L(),s=Y();return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",l==null?void 0:l.stats,b),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:i})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:v})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:R!==null?`${R} days`:"N/A"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:s!==null?`${s}%`:"N/A"})]})]})},j=()=>{let i=Z(),v=m.length,u=Object.entries(i).sort(([,R],[,s])=>s-R).map(([R])=>R);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",l==null?void 0:l.table,b),children:[jsxRuntime.jsx("h3",{className:chunkE64TU6IU_js.a("text-lg font-medium mb-4",l==null?void 0:l.tableHeader,b),children:"Request Types"}),v===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsx("div",{className:"space-y-4",children:u.map(R=>{let s=i[R],x=Math.round(s/v*100);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[P(R),jsxRuntime.jsxs("span",{className:"ml-2 text-sm",children:[s," requests"]})]}),jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[x,"%"]})]}),jsxRuntime.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsxRuntime.jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${x}%`}})})]},R)})})]})},J=()=>{let i=ae(),v=m.length,u=["pending","awaitingVerification","inProgress","completed","rejected"],R={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",l==null?void 0:l.table,b),children:[jsxRuntime.jsx("h3",{className:chunkE64TU6IU_js.a("text-lg font-medium mb-4",l==null?void 0:l.tableHeader,b),children:"Request Status"}),v===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"flex h-4 mb-2",children:u.map(s=>{let x=i[s],S=x/v*100;return S>0?jsxRuntime.jsx("div",{className:`${R[s]} first:rounded-l-full last:rounded-r-full`,style:{width:`${S}%`},title:`${s}: ${x} (${Math.round(S)}%)`},s):null})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:u.map(s=>{let x=i[s],S=Math.round(x/v*100);return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:`w-3 h-3 rounded-full ${R[s]} mr-2`}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium",children:s==="inProgress"?"In Progress":s==="awaitingVerification"?"Awaiting Verification":s.charAt(0).toUpperCase()+s.slice(1)}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[x," (",S,"%)"]})]})]},s)})})]})]})},T=()=>{let i={};m.forEach(x=>{let S=new Date(x.createdAt),t=`${S.getFullYear()}-${String(S.getMonth()+1).padStart(2,"0")}`;i[t]=(i[t]||0)+1;});let u=Object.keys(i).sort().slice(-6),R=Math.max(...Object.values(i).filter(x=>x>0),1),s=x=>{let[S,t]=x.split("-");return `${t}/${S.slice(2)}`};return jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),u.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsxs("div",{className:"h-40",children:[jsxRuntime.jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:u.map(x=>{let S=i[x],t=`${S/R*100}%`;return jsxRuntime.jsx("div",{className:"flex flex-col items-center flex-1",children:jsxRuntime.jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:t},title:`${s(x)}: ${S} requests`})},x)})}),jsxRuntime.jsx("div",{className:"flex justify-between mt-2",children:u.map(x=>jsxRuntime.jsx("div",{className:"text-xs text-center",children:s(x)},x))})]})]})},U=()=>jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),k.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsxRuntime.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:k.map(i=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",l==null?void 0:l.tableRow,b),onClick:()=>E(i.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:i.subject.name}),P(i.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:i.subject.email}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",F(i.dueDate||0)]}),jsxRuntime.jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(B(i.dueDate||0))," days"]})]})]},i.id))})]}),o=()=>jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),I.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsxRuntime.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:I.map(i=>{let v=B(i.dueDate||0);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",l==null?void 0:l.tableRow,b),onClick:()=>E(i.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:i.subject.name}),P(i.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:i.subject.email}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",F(i.dueDate||0)]}),jsxRuntime.jsxs("p",{className:`text-xs font-bold ${v<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",v," days"]})]})]},i.id)})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${te}`,l==null?void 0:l.root,b),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",l==null?void 0:l.header,b),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",l==null?void 0:l.title,b),children:M}),jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:K})]}),jsxRuntime.jsxs("div",{className:"mt-4 md:mt-0",children:[jsxRuntime.jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxRuntime.jsxs("select",{id:"timeframe",value:D,onChange:i=>e(i.target.value),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsxRuntime.jsx("option",{value:"7days",children:"Last 7 Days"}),jsxRuntime.jsx("option",{value:"30days",children:"Last 30 Days"}),jsxRuntime.jsx("option",{value:"90days",children:"Last 90 Days"}),jsxRuntime.jsx("option",{value:"all",children:"All Time"})]})]})]}),W&&Q(),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{children:[H&&j(),re&&J()]}),jsxRuntime.jsxs("div",{children:[ie&&T(),V&&U(),V&&o()]})]})]})};exports.a=ke;exports.b=je;exports.c=_e;//# sourceMappingURL=chunk-EKVTLHBQ.js.map
2
- //# sourceMappingURL=chunk-EKVTLHBQ.js.map
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-2SYNHRP6.mjs';import {b,a as a$1,c}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';function J({initialRequests:T=[],requestTypes:D,storageKey:R="ndpr_dsr_requests",useLocalStorage:r=true,onSubmit:c$1,onUpdate:l}){let[u,q]=useState(T);useEffect(()=>{if(r&&typeof window!="undefined")try{let e=localStorage.getItem(R);e&&q(JSON.parse(e));}catch(e){console.error("Error loading DSR requests:",e);}},[R,r]),useEffect(()=>{if(r&&typeof window!="undefined"&&u.length>0)try{localStorage.setItem(R,JSON.stringify(u));}catch(e){console.error("Error saving DSR requests:",e);}},[u,R,r]);let A=()=>"dsr_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {requests:u,submitRequest:e=>{let t=D.find(S=>S.id===e.type),n=(t==null?void 0:t.estimatedCompletionTime)||30,s=Date.now(),i=s+n*24*60*60*1e3,f=e,{createdAt:p}=f,d=c(f,["createdAt"]),o=a$1({id:A(),status:"pending",createdAt:s,updatedAt:s,dueDate:i},d);return q(S=>[...S,o]),c$1&&c$1(o),o},updateRequest:(e,t)=>{let n=null;return q(s=>{let i=s.findIndex(o=>o.id===e);if(i===-1)return s;let p=s[i];n=b(a$1(a$1({},p),t),{updatedAt:Date.now()});let d=[...s];return d[i]=n,d}),n&&l&&l(n),n},getRequest:e=>u.find(t=>t.id===e)||null,getRequestsByStatus:e=>u.filter(t=>t.status===e),getRequestsByType:e=>u.filter(t=>t.type===e),getRequestType:e=>D.find(t=>t.id===e),formatRequest:e=>{let{formattedRequest:t}=a(e);return t},clearRequests:()=>{q([]),r&&typeof window!="undefined"&&localStorage.removeItem(R);}}}export{J as a};//# sourceMappingURL=chunk-GMLNWS2N.mjs.map
2
- //# sourceMappingURL=chunk-GMLNWS2N.mjs.map