lula2 0.6.5 → 0.6.6-nightly.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 (33) hide show
  1. package/README.md +3 -3
  2. package/dist/_app/immutable/assets/{0.gNk4bE5Z.css → 0.DT0yw00X.css} +1 -1
  3. package/dist/_app/immutable/chunks/{BZU_Nz1O.js → BAMA-SMn.js} +1 -1
  4. package/dist/_app/immutable/chunks/BIpNkEdo.js +65 -0
  5. package/dist/_app/immutable/chunks/BOeu7SQt.js +2 -0
  6. package/dist/_app/immutable/chunks/Bvx51L6t.js +1 -0
  7. package/dist/_app/immutable/chunks/DQTRhwGS.js +1 -0
  8. package/dist/_app/immutable/chunks/DkIUt-Ae.js +1 -0
  9. package/dist/_app/immutable/chunks/DoNUPQ2F.js +1 -0
  10. package/dist/_app/immutable/chunks/kqS9jm6m.js +2 -0
  11. package/dist/_app/immutable/chunks/{ipJF3Ffx.js → oPg1Ic49.js} +1 -1
  12. package/dist/_app/immutable/entry/app.Dqwn7sww.js +2 -0
  13. package/dist/_app/immutable/entry/start.B-O5NM7y.js +1 -0
  14. package/dist/_app/immutable/nodes/0.CZ3i370e.js +2 -0
  15. package/dist/_app/immutable/nodes/{1.BRVNZ7Zr.js → 1.C9kqHM-h.js} +1 -1
  16. package/dist/_app/immutable/nodes/{2.DjZVN6-v.js → 2.BDP2l8IW.js} +1 -1
  17. package/dist/_app/immutable/nodes/{3.BwkBTWlm.js → 3.HVBwzXF9.js} +1 -1
  18. package/dist/_app/immutable/nodes/{4.CrrKXZL6.js → 4.CjJtAzwd.js} +9 -9
  19. package/dist/_app/version.json +1 -1
  20. package/dist/cli/commands/crawl.js +11 -5
  21. package/dist/index.html +10 -10
  22. package/dist/index.js +11 -5
  23. package/package.json +126 -127
  24. package/dist/_app/immutable/chunks/6cSSDZaX.js +0 -1
  25. package/dist/_app/immutable/chunks/BDFhLgJd.js +0 -1
  26. package/dist/_app/immutable/chunks/BnySH2DD.js +0 -2
  27. package/dist/_app/immutable/chunks/CfxzrOg_.js +0 -2
  28. package/dist/_app/immutable/chunks/D2GS6lt_.js +0 -1
  29. package/dist/_app/immutable/chunks/MY0vM1lA.js +0 -3
  30. package/dist/_app/immutable/chunks/Vl8FMUTS.js +0 -65
  31. package/dist/_app/immutable/entry/app.XAEr8i-M.js +0 -2
  32. package/dist/_app/immutable/entry/start.DCxCYu1M.js +0 -1
  33. package/dist/_app/immutable/nodes/0.DHn4BGVS.js +0 -2
@@ -1,11 +1,11 @@
1
- import"../chunks/DsnmJJEf.js";import{i as We}from"../chunks/BZU_Nz1O.js";import{p as Xe,am as Ve,d as a,T as k,G as pe,h as e,an as $r,ao as Ne,c as o,n as ke,r as t,b as d,e as Ke,J as P,K as I,ap as Nr,f as x,s as i,aq as c,a as we,ar as xr,aj as Ae,a3 as ze,ak as hr,al as tr,as as yr,k as de,o as ot,W as lt}from"../chunks/BnySH2DD.js";import{l as ar,p as Ye,i as M,a as st,s as it}from"../chunks/BDFhLgJd.js";import{a as Lr,s as le,r as jr,e as ge,b as Je,c as Vr,d as _r,i as Cr,f as Sr,w as wr}from"../chunks/CfxzrOg_.js";import{g as nt}from"../chunks/MY0vM1lA.js";function dt(ue){return function(...U){var F=U[0];return F.stopPropagation(),ue?.apply(this,U)}}var vt=Ne("<title> </title>"),ct=Ne('<svg><!><path d="M11 18L12.41 19.41 15 16.83 15 29 17 29 17 16.83 19.59 19.41 21 18 16 13 11 18z"></path><path d="M23.5,22H23V20h.5a4.5,4.5,0,0,0,.36-9L23,11l-.1-.82a7,7,0,0,0-13.88,0L9,11,8.14,11a4.5,4.5,0,0,0,.36,9H9v2H8.5A6.5,6.5,0,0,1,7.2,9.14a9,9,0,0,1,17.6,0A6.5,6.5,0,0,1,23.5,22Z"></path></svg>');function gt(ue,U){const F=ar(U,["children","$$slots","$$events","$$legacy"]),J=ar(F,["size","title"]);Xe(U,!1);const E=k(),j=k();let Z=Ye(U,"size",8,16),b=Ye(U,"title",8,void 0);Ve(()=>(pe(F),pe(b())),()=>{a(E,F["aria-label"]||F["aria-labelledby"]||b())}),Ve(()=>(e(E),pe(F)),()=>{a(j,{"aria-hidden":e(E)?void 0:!0,role:e(E)?"img":void 0,focusable:Number(F.tabindex)===0?!0:void 0})}),$r(),We();var $=ct();Lr($,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:Z(),height:Z(),...e(j),...J}));var K=o($);{var G=H=>{var g=vt(),N=o(g,!0);t(g),P(()=>I(N,b())),d(H,g)};M(K,H=>{b()&&H(G)})}ke(2),t($),d(ue,$),Ke()}var pt=Ne("<title> </title>"),ut=Ne('<svg><!><path d="M10 6H14V10H10zM18 6H22V10H18zM10 14H14V18H10zM18 14H22V18H18zM10 22H14V26H10zM18 22H22V26H18z"></path></svg>');function kr(ue,U){const F=ar(U,["children","$$slots","$$events","$$legacy"]),J=ar(F,["size","title"]);Xe(U,!1);const E=k(),j=k();let Z=Ye(U,"size",8,16),b=Ye(U,"title",8,void 0);Ve(()=>(pe(F),pe(b())),()=>{a(E,F["aria-label"]||F["aria-labelledby"]||b())}),Ve(()=>(e(E),pe(F)),()=>{a(j,{"aria-hidden":e(E)?void 0:!0,role:e(E)?"img":void 0,focusable:Number(F.tabindex)===0?!0:void 0})}),$r(),We();var $=ut();Lr($,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:Z(),height:Z(),...e(j),...J}));var K=o($);{var G=H=>{var g=pt(),N=o(g,!0);t(g),P(()=>I(N,b())),d(H,g)};M(K,H=>{b()&&H(G)})}ke(),t($),d(ue,$),Ke()}var bt=x('<div class="p-4 text-sm text-blue-800 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <div><span class="font-medium">File loaded:</span> <div class="mt-1"><span class="font-medium">Sheets:</span> <span class="font-medium">Fields:</span> <span class="font-medium">Controls found:</span> </div></div></div></div>'),ft=x('<div class="p-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),mt=x('<div class="p-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-gray-800 dark:text-green-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),xt=x("<option> </option>"),ht=x("<option> </option>"),yt=x("<option> </option>"),_t=x('<span class="ml-auto text-xs text-blue-600 dark:text-blue-400">ID</span>'),wt=x('<div draggable="true" role="button" tabindex="0" class="flex items-center px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded text-sm cursor-move hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors opacity-75"><svg class="w-3 h-3 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path></svg> <span class="truncate line-through"> </span> <!></div>'),kt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">No excluded fields</p>'),Ct=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),St=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),$t=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),Dt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),Mt=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),zt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),At=x('<div draggable="false" role="button" tabindex="0" class="flex items-center px-3 py-2 bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300 rounded text-sm hover:bg-orange-200 dark:hover:bg-orange-800/30 transition-colors"><span class="truncate"> </span> <button class="ml-auto text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400" title="Remove from mappings">×</button></div>'),Ft=x('<div role="region" aria-label="Justification field drop zone"><p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p></div>'),Ot=x('<th class="px-4 py-2"> </th>'),Pt=x('<td class="px-4 py-2"> </td>'),Ht=x('<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700"></tr>'),Et=x('<div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Sample Data Preview</h3> <div class="overflow-x-auto"><table class="w-full text-sm text-left text-gray-500 dark:text-gray-400"><thead class="text-xs text-gray-700 uppercase bg-gray-100 dark:bg-gray-600 dark:text-gray-400"><tr></tr></thead><tbody></tbody></table></div></div>'),It=x('<span class="flex items-center"><svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Importing...</span>'),Tt=x(`<div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Import Options</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"><div><label for="controlSetName" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Control Set Name <span class="text-red-500">*</span></label> <input type="text" id="controlSetName" placeholder="e.g., NIST 800-53 Rev 4" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white" required/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">This will be used as the display name and folder name</p></div> <div><label for="controlSetDescription" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Description</label> <input type="text" id="controlSetDescription" placeholder="Optional description" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Brief description of this control set</p></div></div> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label for="sheet" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Sheet</label> <select id="sheet" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Select which worksheet contains your control data</p></div> <div><label for="headerRow" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Select Header Row</label> <select id="headerRow" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Select the row containing column headers</p></div> <div><label for="controlIdField" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Control ID Field <span class="text-red-500">*</span></label> <select id="controlIdField" required><option disabled>Select Control ID field</option><!></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Column containing unique control identifiers (e.g., AC-1, SC-7)</p></div></div></div> <div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Organize Fields</h3> <p class="text-sm text-gray-600 dark:text-gray-400 mb-4">Drag fields to organize them. <strong>Overview fields</strong> will appear as table columns in
2
- the controls list.</p> <div class="grid grid-cols-1 lg:grid-cols-5 gap-4"><div class="border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700 rounded-t-lg"><h4 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Excluded Fields</h4> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Not imported</p></div> <div role="region" aria-label="Excluded fields drop zone"><!> <!></div></div> <div class="border border-blue-300 dark:border-blue-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-blue-700 dark:text-blue-300">Overview Tab</h4> <p class="text-xs text-blue-600 dark:text-blue-400 mt-1">Shows in details & table columns</p></div> <div role="region" aria-label="Overview tab drop zone"><!> <!></div></div> <div class="border border-green-300 dark:border-green-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-green-200 dark:border-green-800 bg-green-50 dark:bg-green-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-green-700 dark:text-green-300">Implementation Tab</h4> <p class="text-xs text-green-600 dark:text-green-400 mt-1">Status & compliance</p></div> <div role="region" aria-label="Implementation tab drop zone"><!> <!></div></div> <div class="border border-purple-300 dark:border-purple-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-purple-700 dark:text-purple-300">Custom Tab</h4> <p class="text-xs text-purple-600 dark:text-purple-400 mt-1">Additional fields</p></div> <div role="region" aria-label="Custom fields drop zone"><!> <!></div></div> <div class="border border-orange-300 dark:border-orange-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-orange-700 dark:text-orange-300">Mappings Tab</h4> <p class="text-xs text-orange-600 dark:text-orange-400 mt-1">Pre-populate justification for a control mapping</p></div> <div role="region" aria-label="Justifications tab drop zone"><div class="space-y-2"><!></div></div></div></div></div> <!> <div class="flex justify-center"><button class="px-5 py-2.5 text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm disabled:opacity-50 disabled:cursor-not-allowed"><!></button></div>`,1),jt=x('<div class="space-y-6"><div role="button" tabindex="0" class="relative"><label><div class="flex flex-col items-center justify-center pt-5 pb-6"><!> <p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click to upload</span> or drag and drop</p> <p class="text-xs text-gray-500 dark:text-gray-400">XLSX, XLS or CSV files</p></div> <input type="file" class="hidden" accept=".xlsx,.xls,.csv"/></label></div> <!> <!> <!> <!></div>');function Vt(ue,U){Xe(U,!1);const F=Nr();let J=k(null),E=k(""),j=k(""),Z=k([]),b=k([]),$=k([]),K=k(0),G=k([]),H=k([]),g=k(new Map),N=k(1),L=k(""),xe=k(""),Y=k(""),Q=k(!1),ee=k(""),be=k(""),Ce=k(!1),te=k(!1),C=k(null),B=k(null),re=k(null);function Se(){a(b,[]),a($,[]),a(K,0),e(g).clear(),a(g,new Map),a(H,[]),a(L,""),a(ee,""),a(be,""),a(C,null),a(B,null),a(re,null)}function p(l){l.preventDefault(),a(te,!0)}function u(){a(te,!1)}function D(l){l.preventDefault(),a(te,!1);const n=l.dataTransfer?.files;n&&n.length>0&&T(n[0])}function V(l){const n=l.target;n.files&&n.files.length>0&&T(n.files[0])}async function T(l){Se(),a(E,l.name),a(J,l),a(ee,""),a(Q,!0),a(xe,e(E).replace(/\.[^.]+$/,"").replace(/[-_]/g," ")),a(Y,`Imported from ${e(E)}`);try{const n=new FormData;n.append("file",l);const y=await fetch("/api/parse-excel",{method:"POST",body:n});if(!y.ok){const z=await y.json();throw new Error(z.error||"Failed to parse file")}const h=await y.json();a(Z,h.sheets||[]),a(j,h.selectedSheet||e(Z)[0]),a(G,h.rowPreviews||[]),e(G).length>0&&e(N)===1&&a(N,e(G)[0].row),await q(),a(Ce,!0)}catch(n){a(ee,"Error reading file: "+n.message)}finally{a(Q,!1)}}async function q(){if(!(!e(J)||!e(j))){a(Q,!0),e(g).clear(),a(g,new Map),a(L,""),a(H,[]),a(C,null),a(B,null),a(re,null);try{const l=new FormData;l.append("file",e(J)),l.append("sheetName",e(j));const n=await fetch("/api/parse-excel-sheet-previews",{method:"POST",body:l});if(n.ok){const w=await n.json();a(G,w.rowPreviews||[]),e(G).length>0&&!e(G).some(A=>A.row===e(N))&&a(N,e(G)[0].row)}else{const w=await n.json();throw new Error(w.error||"Failed to load sheet previews")}const y=new FormData;y.append("file",e(J)),y.append("sheetName",e(j)),y.append("headerRow",e(N).toString());const h=await fetch("/api/parse-excel-sheet",{method:"POST",body:y});if(!h.ok){const w=await h.json();throw new Error(w.error||"Failed to parse sheet")}const z=await h.json();if(a(b,z.fields||[]),a($,z.sampleData||[]),a(K,z.controlCount||0),e(b).forEach((w,A)=>{const _=w.toLowerCase();let ce="custom",fe="text";_.includes("implementation")||_.includes("status")||_.includes("narrative")||_.includes("guidance")?ce="implementation":(_.includes("id")||_.includes("title")||_.includes("family")||_.includes("cci")||_.includes("control")||_.includes("acronym"))&&(ce="overview"),_.includes("description")||_.includes("narrative")||_.includes("guidance")||_.includes("statement")?fe="textarea":_.includes("status")||_.includes("type")||_.includes("designation")?fe="select":_.includes("date")?fe="date":(_.includes("count")||_.includes("number"))&&(fe="number"),e(g).set(w,{originalName:w,tab:ce,displayOrder:A,fieldType:fe,required:_.includes("id")||_.includes("title")})}),a(g,e(g)),e(L)&&!e(b).includes(e(L))&&a(L,""),!e(L)&&e(b).includes("AP Acronym")){const w=!e($).length||e($).every(ne=>!ne["AP Acronym"]||String(ne["AP Acronym"]).length<25),A=e($).map(ne=>ne["AP Acronym"]).filter(ne=>ne!=null&&ne!==""&&String(ne).trim()!==""),_=new Set(A),ce=!A.length||_.size===A.length,fe=A.length>0;w&&ce&&fe&&a(L,"AP Acronym")}}catch(l){a(ee,"Error loading sheet data: "+l.message)}finally{a(Q,!1)}}}function ve(l){if(!l)return l;let n=l.trim().replace(/\r?\n/g," ").replace(/\s+/g," ").trim();return Le(n)}function Le(l){return l.replace(/\W+/g," ").split(/ |\s/).map(n=>n.toLowerCase()).join("-")}function he(l,n){a(C,n),l.dataTransfer&&(l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",n))}function ae(){a(C,null),a(B,null),a(re,null)}function S(l,n){l.preventDefault(),a(B,n),l.dataTransfer&&(l.dataTransfer.dropEffect="move")}function se(){a(B,null)}function ie(l,n,y){if(l.preventDefault(),e(C)&&e(g).has(e(C))){const h=e(g).get(e(C));if(n==="mappings")e(H).includes(e(C))||a(H,[...e(H),e(C)]);else{if(h.tab=n,y!==void 0&&n!==null){const w=Array.from(e(g).entries()).filter(([A,_])=>_.tab===n).sort((A,_)=>A[1].displayOrder-_[1].displayOrder).filter(([A])=>A!==e(C));w.splice(y,0,[e(C),h]),w.forEach(([A,_],ce)=>{_.displayOrder=ce,e(g).set(A,_)})}else if(n!==null){const z=Math.max(0,...Array.from(e(g).values()).filter(w=>w.tab===n).map(w=>w.displayOrder));h.displayOrder=z+1}e(g).set(e(C),h),a(g,e(g))}}a(C,null),a(B,null)}function Fe(l,n){l.preventDefault(),l.stopPropagation(),a(re,n)}function $e(){a(re,null)}function De(l,n,y){if(l.preventDefault(),l.stopPropagation(),e(C)&&e(C)!==n){const z=Array.from(e(g).entries()).filter(([w,A])=>A.tab===y).sort((w,A)=>w[1].displayOrder-A[1].displayOrder).findIndex(([w])=>w===n);z!==-1&&ie(l,y,z)}a(re,null)}async function Be(){if(!(!e(J)||!e(E))){if(!e(L)){a(ee,"Please select a Control ID field before importing"),a(be,"");return}if(!e(xe)||e(xe).trim()===""){a(ee,"Please enter a Control Set Name before importing"),a(be,"");return}a(Q,!0),a(ee,""),a(be,"");try{const l=new FormData;l.append("file",e(J),e(E)),l.append("controlIdField",e(L)),l.append("startRow",e(N).toString()),l.append("sheetName",e(j)),l.append("namingConvention","kebab-case"),l.append("skipEmpty","true"),l.append("skipEmptyRows","true"),l.append("controlSetName",e(xe)||e(E).replace(/\.[^.]+$/,"")),l.append("controlSetDescription",e(Y)||`Imported from ${e(E)}`);const n=Array.from(e(g).entries()).filter(([h,z])=>z.tab!==null).map(([h,z])=>({fieldName:ve(h),...z}));l.append("fieldSchema",JSON.stringify(n)),l.append("justificationFields",JSON.stringify(e(H).map(h=>ve(h))));let y;try{if(y=await fetch("/api/import-spreadsheet",{method:"POST",body:l}),!y.ok){const z=await y.json();throw new Error(z.error||"Import failed")}const h=await y.json();a(be,`Successfully imported ${h.controlCount} controls into ${h.families.length} families`),F("created",{path:h.outputDir})}catch(h){console.error("Error importing spreadsheet:",h)}}catch(l){a(ee,"Error importing spreadsheet: "+l.message)}finally{a(Q,!1)}}}We();var Re=jt(),ye=o(Re),Ze=o(ye),Oe=o(Ze),or=o(Oe);gt(or,{class:"w-8 h-8 mb-4 text-gray-500 dark:text-gray-400"}),ke(4),t(Oe);var Ge=i(Oe,2);t(Ze),t(ye);var Pe=i(ye,2);{var lr=l=>{var n=bt(),y=o(n),h=i(o(y),2),z=i(o(h)),w=i(z),A=i(o(w)),_=i(A,2),ce=i(_,2);t(w),t(h),t(y),t(n),P(()=>{I(z,` ${e(E)??""} `),I(A,` ${e(Z).length??""} | `),I(_,` ${e(b).length??""} | `),I(ce,` ${e(K)??""}`)}),d(l,n)};M(Pe,l=>{e(E)&&l(lr)})}var Qe=i(Pe,2);{var sr=l=>{var n=ft(),y=o(n),h=i(o(y),2),z=o(h,!0);t(h),t(y),t(n),P(()=>I(z,e(ee))),d(l,n)};M(Qe,l=>{e(ee)&&l(sr)})}var qe=i(Qe,2);{var ir=l=>{var n=mt(),y=o(n),h=i(o(y),2),z=o(h,!0);t(h),t(y),t(n),P(()=>I(z,e(be))),d(l,n)};M(qe,l=>{e(be)&&l(ir)})}var nr=i(qe,2);{var dr=l=>{var n=Tt(),y=we(n),h=i(o(y),2),z=o(h),w=i(o(z),2);jr(w),ke(2),t(z);var A=i(z,2),_=i(o(A),2);jr(_),ke(2),t(A),t(h);var ce=i(h,2),fe=o(ce),ne=i(o(fe),2);P(()=>{e(j),xr(()=>{e(Z)})}),ge(ne,5,()=>e(Z),r=>r,(r,s)=>{var f=xt(),m=o(f,!0);t(f);var v={};P(()=>{I(m,e(s)),v!==(v=e(s))&&(f.value=(f.__value=e(s))??"")}),d(r,f)}),t(ne),ke(2),t(fe);var vr=i(fe,2),er=i(o(vr),2);P(()=>{e(N),xr(()=>{e(G)})}),ge(er,5,()=>e(G),r=>r.row,(r,s)=>{var f=ht(),m=o(f);t(f);var v={};P(()=>{I(m,`Row ${e(s).row??""}: ${e(s).preview??""}`),v!==(v=e(s).row)&&(f.value=(f.__value=e(s).row)??"")}),d(r,f)}),t(er),ke(2),t(vr);var Dr=i(vr,2),rr=i(o(Dr),2);P(()=>{e(L),xr(()=>{e(b),e($)})});var cr=o(rr);cr.value=cr.__value="";var Br=i(cr);ge(Br,1,()=>e(b),r=>r,(r,s)=>{const f=ze(()=>e($).length>0&&e($)[0][e(s)]?String(e($)[0][e(s)]).slice(0,30):""),m=ze(()=>!e($).length||e($).every(oe=>!oe[e(s)]||String(oe[e(s)]).length<25)),v=ze(()=>e($).map(oe=>oe[e(s)]).filter(oe=>oe!=null&&oe!==""&&String(oe).trim()!=="")),W=ze(()=>new Set(e(v))),X=ze(()=>!e(v).length||e(W).size===e(v).length),R=ze(()=>e(v).length>0);var O=Ae(),me=we(O);{var Me=oe=>{var _e=yt(),mr=o(_e);t(_e);var Tr={};P(()=>{I(mr,`${e(s)??""}${e(f)?` (e.g., ${e(f)})`:""}`),Tr!==(Tr=e(s))&&(_e.value=(_e.__value=e(s))??"")}),d(oe,_e)};M(me,oe=>{e(m)&&e(X)&&e(R)&&oe(Me)})}d(r,O)}),t(rr),ke(2),t(Dr),t(ce),t(y);var gr=i(y,2),Mr=i(o(gr),4),pr=o(Mr),He=i(o(pr),2),zr=o(He);ge(zr,1,()=>e(b).filter(r=>!e(g).get(r)||e(g).get(r)?.tab===null),r=>r,(r,s)=>{var f=wt(),m=i(o(f),2),v=o(m,!0);t(m);var W=i(m,2);{var X=R=>{var O=_t();d(R,O)};M(W,R=>{e(s)===e(L)&&R(X)})}t(f),P(()=>{Je(f,"aria-label",`Drag ${e(s)??""} field`),I(v,e(s))}),c("dragstart",f,R=>he(R,e(s))),c("dragend",f,ae),d(r,f)});var Rr=i(zr,2);{var Zr=r=>{var s=kt();d(r,s)};M(Rr,r=>{e(b).filter(s=>!e(g).get(s)||e(g).get(s)?.tab===null).length===0&&r(Zr)})}t(He),t(pr);var ur=i(pr,2),Ee=i(o(ur),2),Ar=o(Ee);ge(Ar,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="overview").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=Ct(),W=o(v);kr(W,{class:"w-3 h-3 mr-2 flex-shrink-0"});var X=i(W,2),R=o(X,!0);t(X),t(v),P(()=>{Je(v,"aria-label",`${m()??""} field in Overview tab`),le(v,1,`flex items-center px-3 py-2 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded text-sm cursor-move hover:bg-blue-200 dark:hover:bg-blue-800/30 transition-colors
3
- ${e(re)===m()&&e(C)!==m()?"border-t-2 border-blue-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"overview")),d(r,v)});var qr=i(Ar,2);{var Ur=r=>{var s=St();d(r,s)};M(qr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="overview").length===0&&r(Ur)})}t(Ee),t(ur);var br=i(ur,2),Ie=i(o(br),2),Fr=o(Ie);ge(Fr,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="implementation").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=$t(),W=o(v);kr(W,{class:"w-3 h-3 mr-2 flex-shrink-0"});var X=i(W,2),R=o(X,!0);t(X),t(v),P(()=>{Je(v,"aria-label",`${m()??""} field in Implementation tab`),le(v,1,`flex items-center px-3 py-2 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 rounded text-sm cursor-move hover:bg-green-200 dark:hover:bg-green-800/30 transition-colors
4
- ${e(re)===m()&&e(C)!==m()?"border-t-2 border-green-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"implementation")),d(r,v)});var Jr=i(Fr,2);{var Yr=r=>{var s=Dt();d(r,s)};M(Jr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="implementation").length===0&&r(Yr)})}t(Ie),t(br);var fr=i(br,2),Te=i(o(fr),2),Or=o(Te);ge(Or,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="custom").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=Mt(),W=o(v);kr(W,{class:"w-3 h-3 mr-2 flex-shrink-0"});var X=i(W,2),R=o(X,!0);t(X),t(v),P(()=>{Je(v,"aria-label",`${m()??""} field in Custom tab`),le(v,1,`flex items-center px-3 py-2 bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300 rounded text-sm cursor-move hover:bg-purple-200 dark:hover:bg-purple-800/30 transition-colors
5
- ${e(re)===m()&&e(C)!==m()?"border-t-2 border-purple-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"custom")),d(r,v)});var Wr=i(Or,2);{var Xr=r=>{var s=zt();d(r,s)};M(Wr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="custom").length===0&&r(Xr)})}t(Te),t(fr);var Pr=i(fr,2),je=i(o(Pr),2),Hr=o(je),Kr=o(Hr);{var Gr=r=>{var s=Ae(),f=we(s);ge(f,1,()=>e(H),Cr,(m,v)=>{var W=At(),X=o(W),R=o(X,!0);t(X);var O=i(X,2);t(W),P(()=>I(R,e(v))),c("click",O,dt(()=>{a(H,e(H).filter(me=>me!==e(v)))})),d(m,W)}),d(r,s)},Qr=r=>{var s=Ft();P(()=>le(s,1,`p-4 transition-colors
6
- ${e(B)==="mappings"?"bg-orange-50 dark:bg-orange-900/10":""}`)),c("dragover",s,f=>{f.preventDefault(),S(f,"mappings")}),c("dragleave",s,se),c("drop",s,f=>{if(f.preventDefault(),e(C)&&e(g).has(e(C))){e(H).includes(e(C))||a(H,[...e(H),e(C)]);const m=e(g).get(e(C));m.tab="mappings",e(g).set(e(C),m),a(g,new Map(e(g))),a(B,null)}}),d(r,s)};M(Kr,r=>{e(H).length>0?r(Gr):r(Qr,!1)})}t(Hr),t(je),t(Pr),t(Mr),t(gr);var Er=i(gr,2);{var et=r=>{var s=Et(),f=i(o(s),2),m=o(f),v=o(m),W=o(v);ge(W,5,()=>e(b).slice(0,5),R=>R,(R,O)=>{var me=Ot(),Me=o(me,!0);t(me),P(()=>I(Me,e(O))),d(R,me)}),t(W),t(v);var X=i(v);ge(X,5,()=>e($),Cr,(R,O)=>{var me=Ht();ge(me,5,()=>e(b).slice(0,5),Me=>Me,(Me,oe)=>{var _e=Pt(),mr=o(_e,!0);t(_e),P(()=>I(mr,e(O)[e(oe)]||"")),d(Me,_e)}),t(me),d(R,me)}),t(X),t(m),t(f),t(s),d(r,s)};M(Er,r=>{e($).length>0&&r(et)})}var Ir=i(Er,2),Ue=o(Ir),rt=o(Ue);{var tt=r=>{var s=It();d(r,s)},at=r=>{var s=tr("Import to Control Set");d(r,s)};M(rt,r=>{e(Q)?r(tt):r(at,!1)})}t(Ue),t(Ir),P(()=>{le(rr,1,`bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white ${e(L)?"":"border-red-500"}`),le(He,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
1
+ import"../chunks/DsnmJJEf.js";import{i as Xe}from"../chunks/BAMA-SMn.js";import{p as We,af as Ve,d as a,M as k,z as pe,h as e,ag as $r,ah as Ne,c as o,n as ke,r as t,b as d,e as Ke,D as P,F as I,ai as Nr,f as x,s as i,aj as c,a as we,ak as xr,ac as Ae,Y as ze,ad as hr,ae as tr,al as yr,k as de,o as ot,O as lt}from"../chunks/kqS9jm6m.js";import{l as ar,p as Je,i as M,a as st,s as it}from"../chunks/DoNUPQ2F.js";import{a as Lr,s as le,r as Tr,e as ge,b as Ye,c as Vr,d as _r,i as Cr,f as Sr,w as wr}from"../chunks/BOeu7SQt.js";import{g as nt}from"../chunks/DkIUt-Ae.js";function dt(ue){return function(...U){var F=U[0];return F.stopPropagation(),ue?.apply(this,U)}}var vt=Ne("<title> </title>"),ct=Ne('<svg><!><path d="M11 18L12.41 19.41 15 16.83 15 29 17 29 17 16.83 19.59 19.41 21 18 16 13 11 18z"></path><path d="M23.5,22H23V20h.5a4.5,4.5,0,0,0,.36-9L23,11l-.1-.82a7,7,0,0,0-13.88,0L9,11,8.14,11a4.5,4.5,0,0,0,.36,9H9v2H8.5A6.5,6.5,0,0,1,7.2,9.14a9,9,0,0,1,17.6,0A6.5,6.5,0,0,1,23.5,22Z"></path></svg>');function gt(ue,U){const F=ar(U,["children","$$slots","$$events","$$legacy"]),Y=ar(F,["size","title"]);We(U,!1);const E=k(),T=k();let Z=Je(U,"size",8,16),b=Je(U,"title",8,void 0);Ve(()=>(pe(F),pe(b())),()=>{a(E,F["aria-label"]||F["aria-labelledby"]||b())}),Ve(()=>(e(E),pe(F)),()=>{a(T,{"aria-hidden":e(E)?void 0:!0,role:e(E)?"img":void 0,focusable:Number(F.tabindex)===0?!0:void 0})}),$r(),Xe();var $=ct();Lr($,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:Z(),height:Z(),...e(T),...Y}));var K=o($);{var G=H=>{var g=vt(),N=o(g,!0);t(g),P(()=>I(N,b())),d(H,g)};M(K,H=>{b()&&H(G)})}ke(2),t($),d(ue,$),Ke()}var pt=Ne("<title> </title>"),ut=Ne('<svg><!><path d="M10 6H14V10H10zM18 6H22V10H18zM10 14H14V18H10zM18 14H22V18H18zM10 22H14V26H10zM18 22H22V26H18z"></path></svg>');function kr(ue,U){const F=ar(U,["children","$$slots","$$events","$$legacy"]),Y=ar(F,["size","title"]);We(U,!1);const E=k(),T=k();let Z=Je(U,"size",8,16),b=Je(U,"title",8,void 0);Ve(()=>(pe(F),pe(b())),()=>{a(E,F["aria-label"]||F["aria-labelledby"]||b())}),Ve(()=>(e(E),pe(F)),()=>{a(T,{"aria-hidden":e(E)?void 0:!0,role:e(E)?"img":void 0,focusable:Number(F.tabindex)===0?!0:void 0})}),$r(),Xe();var $=ut();Lr($,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:Z(),height:Z(),...e(T),...Y}));var K=o($);{var G=H=>{var g=pt(),N=o(g,!0);t(g),P(()=>I(N,b())),d(H,g)};M(K,H=>{b()&&H(G)})}ke(),t($),d(ue,$),Ke()}var bt=x('<div class="p-4 text-sm text-blue-800 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <div><span class="font-medium">File loaded:</span> <div class="mt-1"><span class="font-medium">Sheets:</span> <span class="font-medium">Fields:</span> <span class="font-medium">Controls found:</span> </div></div></div></div>'),ft=x('<div class="p-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),mt=x('<div class="p-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-gray-800 dark:text-green-400"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),xt=x("<option> </option>"),ht=x("<option> </option>"),yt=x("<option> </option>"),_t=x('<span class="ml-auto text-xs text-blue-600 dark:text-blue-400">ID</span>'),wt=x('<div draggable="true" role="button" tabindex="0" class="flex items-center px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded text-sm cursor-move hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors opacity-75"><svg class="w-3 h-3 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path></svg> <span class="truncate line-through"> </span> <!></div>'),kt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">No excluded fields</p>'),Ct=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),St=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),$t=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),Dt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),Mt=x('<div draggable="true" role="button" tabindex="0"><!> <span class="truncate"> </span></div>'),zt=x('<p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p>'),At=x('<div draggable="false" role="button" tabindex="0" class="flex items-center px-3 py-2 bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300 rounded text-sm hover:bg-orange-200 dark:hover:bg-orange-800/30 transition-colors"><span class="truncate"> </span> <button class="ml-auto text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400" title="Remove from mappings">×</button></div>'),Ft=x('<div role="region" aria-label="Justification field drop zone"><p class="text-xs text-gray-400 dark:text-gray-500 text-center py-4">Drop fields here</p></div>'),Ot=x('<th class="px-4 py-2"> </th>'),Pt=x('<td class="px-4 py-2"> </td>'),Ht=x('<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700"></tr>'),Et=x('<div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Sample Data Preview</h3> <div class="overflow-x-auto"><table class="w-full text-sm text-left text-gray-500 dark:text-gray-400"><thead class="text-xs text-gray-700 uppercase bg-gray-100 dark:bg-gray-600 dark:text-gray-400"><tr></tr></thead><tbody></tbody></table></div></div>'),It=x('<span class="flex items-center"><svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Importing...</span>'),jt=x(`<div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Import Options</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"><div><label for="controlSetName" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Control Set Name <span class="text-red-500">*</span></label> <input type="text" id="controlSetName" placeholder="e.g., NIST 800-53 Rev 4" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white" required/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">This will be used as the display name and folder name</p></div> <div><label for="controlSetDescription" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Description</label> <input type="text" id="controlSetDescription" placeholder="Optional description" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Brief description of this control set</p></div></div> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label for="sheet" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Sheet</label> <select id="sheet" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Select which worksheet contains your control data</p></div> <div><label for="headerRow" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Select Header Row</label> <select id="headerRow" class="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white"></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Select the row containing column headers</p></div> <div><label for="controlIdField" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Control ID Field <span class="text-red-500">*</span></label> <select id="controlIdField" required><option disabled>Select Control ID field</option><!></select> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Column containing unique control identifiers (e.g., AC-1, SC-7)</p></div></div></div> <div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Organize Fields</h3> <p class="text-sm text-gray-600 dark:text-gray-400 mb-4">Drag fields to organize them. <strong>Overview fields</strong> will appear as table columns in
2
+ the controls list.</p> <div class="grid grid-cols-1 lg:grid-cols-5 gap-4"><div class="border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700 rounded-t-lg"><h4 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Excluded Fields</h4> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Not imported</p></div> <div role="region" aria-label="Excluded fields drop zone"><!> <!></div></div> <div class="border border-blue-300 dark:border-blue-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-blue-700 dark:text-blue-300">Overview Tab</h4> <p class="text-xs text-blue-600 dark:text-blue-400 mt-1">Shows in details & table columns</p></div> <div role="region" aria-label="Overview tab drop zone"><!> <!></div></div> <div class="border border-green-300 dark:border-green-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-green-200 dark:border-green-800 bg-green-50 dark:bg-green-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-green-700 dark:text-green-300">Implementation Tab</h4> <p class="text-xs text-green-600 dark:text-green-400 mt-1">Status & compliance</p></div> <div role="region" aria-label="Implementation tab drop zone"><!> <!></div></div> <div class="border border-purple-300 dark:border-purple-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-purple-700 dark:text-purple-300">Custom Tab</h4> <p class="text-xs text-purple-600 dark:text-purple-400 mt-1">Additional fields</p></div> <div role="region" aria-label="Custom fields drop zone"><!> <!></div></div> <div class="border border-orange-300 dark:border-orange-700 rounded-lg bg-white dark:bg-gray-800"><div class="p-3 border-b border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-900/20 rounded-t-lg"><h4 class="text-sm font-semibold text-orange-700 dark:text-orange-300">Mappings Tab</h4> <p class="text-xs text-orange-600 dark:text-orange-400 mt-1">Pre-populate justification for a control mapping</p></div> <div role="region" aria-label="Justifications tab drop zone"><div class="space-y-2"><!></div></div></div></div></div> <!> <div class="flex justify-center"><button class="px-5 py-2.5 text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm disabled:opacity-50 disabled:cursor-not-allowed"><!></button></div>`,1),Tt=x('<div class="space-y-6"><div role="button" tabindex="0" class="relative"><label><div class="flex flex-col items-center justify-center pt-5 pb-6"><!> <p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Click to upload</span> or drag and drop</p> <p class="text-xs text-gray-500 dark:text-gray-400">XLSX, XLS or CSV files</p></div> <input type="file" class="hidden" accept=".xlsx,.xls,.csv"/></label></div> <!> <!> <!> <!></div>');function Vt(ue,U){We(U,!1);const F=Nr();let Y=k(null),E=k(""),T=k(""),Z=k([]),b=k([]),$=k([]),K=k(0),G=k([]),H=k([]),g=k(new Map),N=k(1),L=k(""),xe=k(""),J=k(""),Q=k(!1),ee=k(""),be=k(""),Ce=k(!1),te=k(!1),C=k(null),B=k(null),re=k(null);function Se(){a(b,[]),a($,[]),a(K,0),e(g).clear(),a(g,new Map),a(H,[]),a(L,""),a(ee,""),a(be,""),a(C,null),a(B,null),a(re,null)}function p(l){l.preventDefault(),a(te,!0)}function u(){a(te,!1)}function D(l){l.preventDefault(),a(te,!1);const n=l.dataTransfer?.files;n&&n.length>0&&j(n[0])}function V(l){const n=l.target;n.files&&n.files.length>0&&j(n.files[0])}async function j(l){Se(),a(E,l.name),a(Y,l),a(ee,""),a(Q,!0),a(xe,e(E).replace(/\.[^.]+$/,"").replace(/[-_]/g," ")),a(J,`Imported from ${e(E)}`);try{const n=new FormData;n.append("file",l);const y=await fetch("/api/parse-excel",{method:"POST",body:n});if(!y.ok){const z=await y.json();throw new Error(z.error||"Failed to parse file")}const h=await y.json();a(Z,h.sheets||[]),a(T,h.selectedSheet||e(Z)[0]),a(G,h.rowPreviews||[]),e(G).length>0&&e(N)===1&&a(N,e(G)[0].row),await q(),a(Ce,!0)}catch(n){a(ee,"Error reading file: "+n.message)}finally{a(Q,!1)}}async function q(){if(!(!e(Y)||!e(T))){a(Q,!0),e(g).clear(),a(g,new Map),a(L,""),a(H,[]),a(C,null),a(B,null),a(re,null);try{const l=new FormData;l.append("file",e(Y)),l.append("sheetName",e(T));const n=await fetch("/api/parse-excel-sheet-previews",{method:"POST",body:l});if(n.ok){const w=await n.json();a(G,w.rowPreviews||[]),e(G).length>0&&!e(G).some(A=>A.row===e(N))&&a(N,e(G)[0].row)}else{const w=await n.json();throw new Error(w.error||"Failed to load sheet previews")}const y=new FormData;y.append("file",e(Y)),y.append("sheetName",e(T)),y.append("headerRow",e(N).toString());const h=await fetch("/api/parse-excel-sheet",{method:"POST",body:y});if(!h.ok){const w=await h.json();throw new Error(w.error||"Failed to parse sheet")}const z=await h.json();if(a(b,z.fields||[]),a($,z.sampleData||[]),a(K,z.controlCount||0),e(b).forEach((w,A)=>{const _=w.toLowerCase();let ce="custom",fe="text";_.includes("implementation")||_.includes("status")||_.includes("narrative")||_.includes("guidance")?ce="implementation":(_.includes("id")||_.includes("title")||_.includes("family")||_.includes("cci")||_.includes("control")||_.includes("acronym"))&&(ce="overview"),_.includes("description")||_.includes("narrative")||_.includes("guidance")||_.includes("statement")?fe="textarea":_.includes("status")||_.includes("type")||_.includes("designation")?fe="select":_.includes("date")?fe="date":(_.includes("count")||_.includes("number"))&&(fe="number"),e(g).set(w,{originalName:w,tab:ce,displayOrder:A,fieldType:fe,required:_.includes("id")||_.includes("title")})}),a(g,e(g)),e(L)&&!e(b).includes(e(L))&&a(L,""),!e(L)&&e(b).includes("AP Acronym")){const w=!e($).length||e($).every(ne=>!ne["AP Acronym"]||String(ne["AP Acronym"]).length<25),A=e($).map(ne=>ne["AP Acronym"]).filter(ne=>ne!=null&&ne!==""&&String(ne).trim()!==""),_=new Set(A),ce=!A.length||_.size===A.length,fe=A.length>0;w&&ce&&fe&&a(L,"AP Acronym")}}catch(l){a(ee,"Error loading sheet data: "+l.message)}finally{a(Q,!1)}}}function ve(l){if(!l)return l;let n=l.trim().replace(/\r?\n/g," ").replace(/\s+/g," ").trim();return Le(n)}function Le(l){return l.replace(/\W+/g," ").split(/ |\s/).map(n=>n.toLowerCase()).join("-")}function he(l,n){a(C,n),l.dataTransfer&&(l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",n))}function ae(){a(C,null),a(B,null),a(re,null)}function S(l,n){l.preventDefault(),a(B,n),l.dataTransfer&&(l.dataTransfer.dropEffect="move")}function se(){a(B,null)}function ie(l,n,y){if(l.preventDefault(),e(C)&&e(g).has(e(C))){const h=e(g).get(e(C));if(n==="mappings")e(H).includes(e(C))||a(H,[...e(H),e(C)]);else{if(h.tab=n,y!==void 0&&n!==null){const w=Array.from(e(g).entries()).filter(([A,_])=>_.tab===n).sort((A,_)=>A[1].displayOrder-_[1].displayOrder).filter(([A])=>A!==e(C));w.splice(y,0,[e(C),h]),w.forEach(([A,_],ce)=>{_.displayOrder=ce,e(g).set(A,_)})}else if(n!==null){const z=Math.max(0,...Array.from(e(g).values()).filter(w=>w.tab===n).map(w=>w.displayOrder));h.displayOrder=z+1}e(g).set(e(C),h),a(g,e(g))}}a(C,null),a(B,null)}function Fe(l,n){l.preventDefault(),l.stopPropagation(),a(re,n)}function $e(){a(re,null)}function De(l,n,y){if(l.preventDefault(),l.stopPropagation(),e(C)&&e(C)!==n){const z=Array.from(e(g).entries()).filter(([w,A])=>A.tab===y).sort((w,A)=>w[1].displayOrder-A[1].displayOrder).findIndex(([w])=>w===n);z!==-1&&ie(l,y,z)}a(re,null)}async function Be(){if(!(!e(Y)||!e(E))){if(!e(L)){a(ee,"Please select a Control ID field before importing"),a(be,"");return}if(!e(xe)||e(xe).trim()===""){a(ee,"Please enter a Control Set Name before importing"),a(be,"");return}a(Q,!0),a(ee,""),a(be,"");try{const l=new FormData;l.append("file",e(Y),e(E)),l.append("controlIdField",e(L)),l.append("startRow",e(N).toString()),l.append("sheetName",e(T)),l.append("namingConvention","kebab-case"),l.append("skipEmpty","true"),l.append("skipEmptyRows","true"),l.append("controlSetName",e(xe)||e(E).replace(/\.[^.]+$/,"")),l.append("controlSetDescription",e(J)||`Imported from ${e(E)}`);const n=Array.from(e(g).entries()).filter(([h,z])=>z.tab!==null).map(([h,z])=>({fieldName:ve(h),...z}));l.append("fieldSchema",JSON.stringify(n)),l.append("justificationFields",JSON.stringify(e(H).map(h=>ve(h))));let y;try{if(y=await fetch("/api/import-spreadsheet",{method:"POST",body:l}),!y.ok){const z=await y.json();throw new Error(z.error||"Import failed")}const h=await y.json();a(be,`Successfully imported ${h.controlCount} controls into ${h.families.length} families`),F("created",{path:h.outputDir})}catch(h){console.error("Error importing spreadsheet:",h)}}catch(l){a(ee,"Error importing spreadsheet: "+l.message)}finally{a(Q,!1)}}}Xe();var Re=Tt(),ye=o(Re),Ze=o(ye),Oe=o(Ze),or=o(Oe);gt(or,{class:"w-8 h-8 mb-4 text-gray-500 dark:text-gray-400"}),ke(4),t(Oe);var Ge=i(Oe,2);t(Ze),t(ye);var Pe=i(ye,2);{var lr=l=>{var n=bt(),y=o(n),h=i(o(y),2),z=i(o(h)),w=i(z),A=i(o(w)),_=i(A,2),ce=i(_,2);t(w),t(h),t(y),t(n),P(()=>{I(z,` ${e(E)??""} `),I(A,` ${e(Z).length??""} | `),I(_,` ${e(b).length??""} | `),I(ce,` ${e(K)??""}`)}),d(l,n)};M(Pe,l=>{e(E)&&l(lr)})}var Qe=i(Pe,2);{var sr=l=>{var n=ft(),y=o(n),h=i(o(y),2),z=o(h,!0);t(h),t(y),t(n),P(()=>I(z,e(ee))),d(l,n)};M(Qe,l=>{e(ee)&&l(sr)})}var qe=i(Qe,2);{var ir=l=>{var n=mt(),y=o(n),h=i(o(y),2),z=o(h,!0);t(h),t(y),t(n),P(()=>I(z,e(be))),d(l,n)};M(qe,l=>{e(be)&&l(ir)})}var nr=i(qe,2);{var dr=l=>{var n=jt(),y=we(n),h=i(o(y),2),z=o(h),w=i(o(z),2);Tr(w),ke(2),t(z);var A=i(z,2),_=i(o(A),2);Tr(_),ke(2),t(A),t(h);var ce=i(h,2),fe=o(ce),ne=i(o(fe),2);P(()=>{e(T),xr(()=>{e(Z)})}),ge(ne,5,()=>e(Z),r=>r,(r,s)=>{var f=xt(),m=o(f,!0);t(f);var v={};P(()=>{I(m,e(s)),v!==(v=e(s))&&(f.value=(f.__value=e(s))??"")}),d(r,f)}),t(ne),ke(2),t(fe);var vr=i(fe,2),er=i(o(vr),2);P(()=>{e(N),xr(()=>{e(G)})}),ge(er,5,()=>e(G),r=>r.row,(r,s)=>{var f=ht(),m=o(f);t(f);var v={};P(()=>{I(m,`Row ${e(s).row??""}: ${e(s).preview??""}`),v!==(v=e(s).row)&&(f.value=(f.__value=e(s).row)??"")}),d(r,f)}),t(er),ke(2),t(vr);var Dr=i(vr,2),rr=i(o(Dr),2);P(()=>{e(L),xr(()=>{e(b),e($)})});var cr=o(rr);cr.value=cr.__value="";var Br=i(cr);ge(Br,1,()=>e(b),r=>r,(r,s)=>{const f=ze(()=>e($).length>0&&e($)[0][e(s)]?String(e($)[0][e(s)]).slice(0,30):""),m=ze(()=>!e($).length||e($).every(oe=>!oe[e(s)]||String(oe[e(s)]).length<25)),v=ze(()=>e($).map(oe=>oe[e(s)]).filter(oe=>oe!=null&&oe!==""&&String(oe).trim()!=="")),X=ze(()=>new Set(e(v))),W=ze(()=>!e(v).length||e(X).size===e(v).length),R=ze(()=>e(v).length>0);var O=Ae(),me=we(O);{var Me=oe=>{var _e=yt(),mr=o(_e);t(_e);var jr={};P(()=>{I(mr,`${e(s)??""}${e(f)?` (e.g., ${e(f)})`:""}`),jr!==(jr=e(s))&&(_e.value=(_e.__value=e(s))??"")}),d(oe,_e)};M(me,oe=>{e(m)&&e(W)&&e(R)&&oe(Me)})}d(r,O)}),t(rr),ke(2),t(Dr),t(ce),t(y);var gr=i(y,2),Mr=i(o(gr),4),pr=o(Mr),He=i(o(pr),2),zr=o(He);ge(zr,1,()=>e(b).filter(r=>!e(g).get(r)||e(g).get(r)?.tab===null),r=>r,(r,s)=>{var f=wt(),m=i(o(f),2),v=o(m,!0);t(m);var X=i(m,2);{var W=R=>{var O=_t();d(R,O)};M(X,R=>{e(s)===e(L)&&R(W)})}t(f),P(()=>{Ye(f,"aria-label",`Drag ${e(s)??""} field`),I(v,e(s))}),c("dragstart",f,R=>he(R,e(s))),c("dragend",f,ae),d(r,f)});var Rr=i(zr,2);{var Zr=r=>{var s=kt();d(r,s)};M(Rr,r=>{e(b).filter(s=>!e(g).get(s)||e(g).get(s)?.tab===null).length===0&&r(Zr)})}t(He),t(pr);var ur=i(pr,2),Ee=i(o(ur),2),Ar=o(Ee);ge(Ar,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="overview").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=Ct(),X=o(v);kr(X,{class:"w-3 h-3 mr-2 flex-shrink-0"});var W=i(X,2),R=o(W,!0);t(W),t(v),P(()=>{Ye(v,"aria-label",`${m()??""} field in Overview tab`),le(v,1,`flex items-center px-3 py-2 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded text-sm cursor-move hover:bg-blue-200 dark:hover:bg-blue-800/30 transition-colors
3
+ ${e(re)===m()&&e(C)!==m()?"border-t-2 border-blue-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"overview")),d(r,v)});var qr=i(Ar,2);{var Ur=r=>{var s=St();d(r,s)};M(qr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="overview").length===0&&r(Ur)})}t(Ee),t(ur);var br=i(ur,2),Ie=i(o(br),2),Fr=o(Ie);ge(Fr,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="implementation").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=$t(),X=o(v);kr(X,{class:"w-3 h-3 mr-2 flex-shrink-0"});var W=i(X,2),R=o(W,!0);t(W),t(v),P(()=>{Ye(v,"aria-label",`${m()??""} field in Implementation tab`),le(v,1,`flex items-center px-3 py-2 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 rounded text-sm cursor-move hover:bg-green-200 dark:hover:bg-green-800/30 transition-colors
4
+ ${e(re)===m()&&e(C)!==m()?"border-t-2 border-green-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"implementation")),d(r,v)});var Yr=i(Fr,2);{var Jr=r=>{var s=Dt();d(r,s)};M(Yr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="implementation").length===0&&r(Jr)})}t(Ie),t(br);var fr=i(br,2),je=i(o(fr),2),Or=o(je);ge(Or,3,()=>Array.from(e(g).entries()).filter(([r,s])=>s.tab==="custom").sort((r,s)=>r[1].displayOrder-s[1].displayOrder),([r,s])=>r,(r,s)=>{var f=hr(()=>yr(e(s),2));let m=()=>e(f)[0];var v=Mt(),X=o(v);kr(X,{class:"w-3 h-3 mr-2 flex-shrink-0"});var W=i(X,2),R=o(W,!0);t(W),t(v),P(()=>{Ye(v,"aria-label",`${m()??""} field in Custom tab`),le(v,1,`flex items-center px-3 py-2 bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300 rounded text-sm cursor-move hover:bg-purple-200 dark:hover:bg-purple-800/30 transition-colors
5
+ ${e(re)===m()&&e(C)!==m()?"border-t-2 border-purple-500":""}`),I(R,m())}),c("dragstart",v,O=>he(O,m())),c("dragend",v,ae),c("dragover",v,O=>Fe(O,m())),c("dragleave",v,$e),c("drop",v,O=>De(O,m(),"custom")),d(r,v)});var Xr=i(Or,2);{var Wr=r=>{var s=zt();d(r,s)};M(Xr,r=>{Array.from(e(g).entries()).filter(([s,f])=>f.tab==="custom").length===0&&r(Wr)})}t(je),t(fr);var Pr=i(fr,2),Te=i(o(Pr),2),Hr=o(Te),Kr=o(Hr);{var Gr=r=>{var s=Ae(),f=we(s);ge(f,1,()=>e(H),Cr,(m,v)=>{var X=At(),W=o(X),R=o(W,!0);t(W);var O=i(W,2);t(X),P(()=>I(R,e(v))),c("click",O,dt(()=>{a(H,e(H).filter(me=>me!==e(v)))})),d(m,X)}),d(r,s)},Qr=r=>{var s=Ft();P(()=>le(s,1,`p-4 transition-colors
6
+ ${e(B)==="mappings"?"bg-orange-50 dark:bg-orange-900/10":""}`)),c("dragover",s,f=>{f.preventDefault(),S(f,"mappings")}),c("dragleave",s,se),c("drop",s,f=>{if(f.preventDefault(),e(C)&&e(g).has(e(C))){e(H).includes(e(C))||a(H,[...e(H),e(C)]);const m=e(g).get(e(C));m.tab="mappings",e(g).set(e(C),m),a(g,new Map(e(g))),a(B,null)}}),d(r,s)};M(Kr,r=>{e(H).length>0?r(Gr):r(Qr,!1)})}t(Hr),t(Te),t(Pr),t(Mr),t(gr);var Er=i(gr,2);{var et=r=>{var s=Et(),f=i(o(s),2),m=o(f),v=o(m),X=o(v);ge(X,5,()=>e(b).slice(0,5),R=>R,(R,O)=>{var me=Ot(),Me=o(me,!0);t(me),P(()=>I(Me,e(O))),d(R,me)}),t(X),t(v);var W=i(v);ge(W,5,()=>e($),Cr,(R,O)=>{var me=Ht();ge(me,5,()=>e(b).slice(0,5),Me=>Me,(Me,oe)=>{var _e=Pt(),mr=o(_e,!0);t(_e),P(()=>I(mr,e(O)[e(oe)]||"")),d(Me,_e)}),t(me),d(R,me)}),t(W),t(m),t(f),t(s),d(r,s)};M(Er,r=>{e($).length>0&&r(et)})}var Ir=i(Er,2),Ue=o(Ir),rt=o(Ue);{var tt=r=>{var s=It();d(r,s)},at=r=>{var s=tr("Import to Control Set");d(r,s)};M(rt,r=>{e(Q)?r(tt):r(at,!1)})}t(Ue),t(Ir),P(()=>{le(rr,1,`bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:text-white ${e(L)?"":"border-red-500"}`),le(He,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
7
7
  ${e(B)===null?"bg-gray-100 dark:bg-gray-800":""}`),le(Ee,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
8
8
  ${e(B)==="overview"?"bg-blue-50 dark:bg-blue-900/10":""}`),le(Ie,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
9
- ${e(B)==="implementation"?"bg-green-50 dark:bg-green-900/10":""}`),le(Te,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
10
- ${e(B)==="custom"?"bg-purple-50 dark:bg-purple-900/10":""}`),le(je,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto transition-colors
11
- ${e(B)==="mappings"?"bg-orange-50 dark:bg-orange-900/10":""}`),Ue.disabled=e(Q)||!e(J)||!e(L),Je(Ue,"title",e(L)?"":"Please select a Control ID field")}),Vr(w,()=>e(xe),r=>a(xe,r)),Vr(_,()=>e(Y),r=>a(Y,r)),_r(ne,()=>e(j),r=>a(j,r)),c("change",ne,async()=>{await q()}),_r(er,()=>e(N),r=>a(N,r)),c("change",er,q),_r(rr,()=>e(L),r=>a(L,r)),c("dragover",He,r=>S(r,null)),c("dragleave",He,se),c("drop",He,r=>ie(r,null)),c("dragover",Ee,r=>S(r,"overview")),c("dragleave",Ee,se),c("drop",Ee,r=>ie(r,"overview")),c("dragover",Ie,r=>S(r,"implementation")),c("dragleave",Ie,se),c("drop",Ie,r=>ie(r,"implementation")),c("dragover",Te,r=>S(r,"custom")),c("dragleave",Te,se),c("drop",Te,r=>ie(r,"custom")),c("dragover",je,r=>S(r,"mappings")),c("dragleave",je,se),c("drop",je,r=>ie(r,"mappings")),c("click",Ue,Be),d(l,n)};M(nr,l=>{e(Ce)&&e(b).length>0&&l(dr)})}t(Re),P(()=>le(Ze,1,`flex flex-col items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer transition-all duration-300 ${e(te)?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`)),c("change",Ge,V),c("dragover",ye,p),c("dragleave",ye,u),c("drop",ye,D),d(ue,Re),Ke()}var Nt=x('<span class="ml-2"> </span>'),Lt=x('<div class="text-sm text-gray-500 dark:text-gray-400"><span class="font-medium"> </span> <!></div>'),Bt=x('<div class="text-center space-y-6"><div class="p-6 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-lg border-2 border-green-500"><svg class="w-12 h-12 text-green-600 mx-auto mb-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg> <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Already Using Control Set</h3> <p class="text-gray-600 dark:text-gray-400 mb-4">You are already using the only available control set in this project.</p> <!></div> <div class="flex justify-center gap-4"><a href="/" class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors shadow-lg">Continue to Controls</a> <button class="px-6 py-3 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white font-medium rounded-lg transition-colors">Import New Control Set</button></div></div>'),Rt=x('<div class="p-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),Zt=x('<p class="text-sm text-gray-600 dark:text-gray-400 mt-1"> </p>'),qt=x('<span class="text-xs text-gray-500 dark:text-gray-400"><svg class="inline w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z" clip-rule="evenodd"></path></svg> </span>'),Ut=x('<div class="flex flex-col items-center"><svg class="w-8 h-8 text-green-600" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg> <span class="text-xs text-green-600 font-medium mt-1">Current</span></div>'),Jt=Ne('<svg class="w-8 h-8 text-blue-600" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>'),Yt=Ne('<svg class="w-8 h-8 text-gray-300 dark:text-gray-600" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="9" stroke="currentColor" stroke-width="2"></circle></svg>'),Wt=x('<div role="button" tabindex="0"><div class="flex items-center justify-between"><div class="flex-1"><div class="flex items-center gap-3"><h3 class="text-lg font-semibold text-gray-900 dark:text-white"> </h3> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"> </span></div> <!> <div class="flex items-center gap-4 mt-2"><span class="text-xs text-gray-500 dark:text-gray-400"><svg class="inline w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M2 6a2 2 0 012-2h12a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zm2-1a1 1 0 00-1 1v8a1 1 0 001 1h12a1 1 0 001-1V6a1 1 0 00-1-1H4z" clip-rule="evenodd"></path></svg> </span> <!></div></div> <div class="flex items-center ml-4"><!></div></div></div>'),Xt=x('<div class="mt-6 flex justify-center"><button class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors shadow-lg">Use Selected Control Set</button></div>'),Kt=x('<div class="space-y-3"></div> <!>',1),Gt=x('<div class="space-y-6"><div class="text-center"><h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">Select an Existing Control Set</h2> <p class="text-gray-600 dark:text-gray-400">Choose from control sets found in your project directory</p></div> <!></div>');function Qt(ue,U){Xe(U,!1);const F=()=>st(Sr,"$appState",J),[J,E]=it(),j=k(),Z=Nr();let b=Ye(U,"controlSets",24,()=>[]),$=k(""),K=k(null);function G(Y){g(Y)||a(K,Y)}function H(){e(K)&&!g(e(K))&&Z("selected",{path:e(K).path})}function g(Y){const Q=e(j)?.replace(/\/$/,""),ee=Y.path?.replace(/\/$/,"");return!!(Q&&ee&&Q===ee)}Ve(()=>F(),()=>{a(j,F().currentPath||"")}),Ve(()=>pe(b()),()=>{if(b())if(b().length===0)a($,"No existing control sets found. Try importing from a spreadsheet instead.");else{const Y=b().filter(Q=>!g(Q));Y.length===1?a(K,Y[0]):Y.length===0&&b().length>0&&a($,"already-using-only-set")}}),$r(),We();var N=Gt(),L=i(o(N),2);{var xe=Y=>{var Q=Ae(),ee=we(Q);{var be=te=>{var C=Bt(),B=o(C),re=i(o(B),6);{var Se=D=>{var V=Lt(),T=o(V),q=o(T,!0);t(T);var ve=i(T,2);{var Le=he=>{var ae=Nt(),S=o(ae);t(ae),P(()=>I(S,`(${pe(b()),de(()=>b()[0].controlCount)??""} controls)`)),d(he,ae)};M(ve,he=>{pe(b()),de(()=>b()[0].controlCount)&&he(Le)})}t(V),P(()=>I(q,(pe(b()),de(()=>b()[0].name)))),d(D,V)};M(re,D=>{pe(b()),de(()=>b().length>0)&&D(Se)})}t(B);var p=i(B,2),u=i(o(p),2);t(p),t(C),c("click",u,()=>Z("tab-change",{tab:"import"})),d(te,C)},Ce=te=>{var C=Ae(),B=we(C);{var re=p=>{var u=Rt(),D=o(u),V=i(o(D),2),T=o(V,!0);t(V),t(D),t(u),P(()=>I(T,e($))),d(p,u)},Se=p=>{var u=Ae(),D=we(u);{var V=T=>{var q=Kt(),ve=we(q);ge(ve,5,b,Cr,(ae,S)=>{const se=ze(()=>(e(S),de(()=>g(e(S)))));var ie=Wt(),Fe=o(ie),$e=o(Fe),De=o($e),Be=o(De),Re=o(Be,!0);t(Be);var ye=i(Be,2),Ze=o(ye);t(ye),t(De);var Oe=i(De,2);{var or=l=>{var n=Zt(),y=o(n,!0);t(n),P(()=>I(y,(e(S),de(()=>e(S).description)))),d(l,n)};M(Oe,l=>{e(S),de(()=>e(S).description)&&l(or)})}var Ge=i(Oe,2),Pe=o(Ge),lr=i(o(Pe));t(Pe);var Qe=i(Pe,2);{var sr=l=>{var n=qt(),y=i(o(n));t(n),P(()=>I(y,` ${e(S),de(()=>e(S).file)??""}`)),d(l,n)};M(Qe,l=>{e(S),de(()=>e(S).file)&&l(sr)})}t(Ge),t($e);var qe=i($e,2),ir=o(qe);{var nr=l=>{var n=Ut();d(l,n)},dr=l=>{var n=Ae(),y=we(n);{var h=w=>{var A=Jt();d(w,A)},z=w=>{var A=Yt();d(w,A)};M(y,w=>{e(K)===e(S)?w(h):w(z,!1)},!0)}d(l,n)};M(ir,l=>{e(se)?l(nr):l(dr,!1)})}t(qe),t(Fe),t(ie),P(()=>{le(ie,1,`p-4 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg border-2 transition-all duration-200 ${e(se)?"border-green-500 !bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 cursor-not-allowed opacity-75":e(K)===e(S)?"border-blue-500 !bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 shadow-lg cursor-pointer":"border-gray-200 dark:border-gray-700 hover:border-blue-300 dark:hover:border-blue-700 hover:shadow-md cursor-pointer"}`),I(Re,(e(S),de(()=>e(S).name))),I(Ze,`${e(S),de(()=>e(S).controlCount||0)??""} controls`),I(lr,` ${e(S),de(()=>e(S).path||"root")??""}`)}),c("click",ie,()=>!e(se)&&G(e(S))),c("keydown",ie,l=>l.key==="Enter"&&!e(se)&&G(e(S))),d(ae,ie)}),t(ve);var Le=i(ve,2);{var he=ae=>{var S=Xt(),se=o(S);t(S),c("click",se,H),d(ae,S)};M(Le,ae=>{e(K)&&ae(he)})}d(T,q)};M(D,T=>{pe(b()),de(()=>b().length>0)&&T(V)},!0)}d(p,u)};M(B,p=>{e($)?p(re):p(Se,!1)},!0)}d(te,C)};M(ee,te=>{e($)==="already-using-only-set"?te(be):te(Ce,!1)},!0)}d(Y,Q)};M(L,Y=>{Y(xe,!1)})}t(N),d(ue,N),Ke(),E()}var ea=x('<div class="flex justify-center mb-8"><div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 inline-flex"><button data-testid="tab-existing">Select Existing Control Set</button> <button data-testid="tab-import">Import New from Spreadsheet</button></div></div>'),ra=x('<div data-testid="pane-import"><!></div>'),ta=x('<div data-testid="pane-existing"><!></div>'),aa=x('<div data-testid="switch-overlay" class="absolute inset-0 bg-gray-900 bg-opacity-50 flex items-center justify-center rounded-lg"><div class="bg-white dark:bg-gray-700 rounded-lg p-6 text-center"><svg class="animate-spin h-8 w-8 text-blue-600 mx-auto mb-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <p class="text-gray-900 dark:text-white">Switching control set...</p></div></div>'),oa=x('<div class=" p-4"><div class="max-w-6xl mx-auto"><div class="text-center py-8"><h1 class="text-4xl font-extrabold text-gray-900 dark:text-white mb-4 flex items-center justify-center gap-3"><img src="/lula.png" class="h-12 w-12" alt="Lula"/> <span id="title">Lula</span></h1> <p id="description" class="text-lg text-gray-600 dark:text-gray-400"><!></p></div> <!> <div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg shadow-xl p-6 relative border border-gray-200 dark:border-gray-700"><!> <!></div></div></div>');function ca(ue,U){Xe(U,!1);let F=k("import"),J=k(""),E=k(!1),j=k(!1),Z=k([]);ot(()=>{wr.connect();const p=Sr.subscribe(D=>{D.name&&D.name!=="Unknown Control Set"&&D.id!=="unknown"&&D.id!=="default"&&a(J,D.currentPath||"")}),u=async D=>{const V=D.detail;if(V&&V.controlSets){if(a(Z,V.controlSets||[]),a(E,e(Z).length>0),e(Z).length===1){const T=e(Z)[0];if(!(e(J)&&e(J).includes(T.path))&&!e(J)){console.log("Only one control set found and none loaded, auto-loading:",T.path),await b(T.path);return}}e(E)&&a(F,"existing")}};return window.addEventListener("control-sets-list",u),wr.scanControlSets().catch(D=>{console.error("Error scanning control sets:",D)}),()=>{p(),window.removeEventListener("control-sets-list",u)}});async function b(p){console.log("Starting control set switch to:",p),a(j,!0);try{await wr.switchControlSet(p),console.log("WebSocket command sent, waiting for state update..."),await new Promise(u=>{let D=0;const V=50,T=setInterval(()=>{D++;const q=lt(Sr);!q.isSwitchingControlSet&&q.currentPath&&q.currentPath.includes(p)?(clearInterval(T),console.log("Control set switch completed successfully"),u()):D>=V&&(clearInterval(T),console.error("Control set switch timed out"),alert("Control set switch timed out. Please try again."),u())},100)}),a(j,!1),nt("/")}catch(u){console.error("Error switching control set:",u),alert("Failed to switch control set: "+u.message),a(j,!1)}}async function $(p){const{path:u}=p.detail;await b(u)}async function K(p){const{path:u}=p.detail;await b(u)}function G(p){const{tab:u}=p.detail;u&&a(F,u)}We();var H=oa(),g=o(H),N=o(g),L=i(o(N),2),xe=o(L);{var Y=p=>{var u=tr("You have an existing control set. You can continue using it or create a new one.");d(p,u)},Q=p=>{var u=Ae(),D=we(u);{var V=q=>{var ve=tr("Select an existing control set or import a new one from a spreadsheet.");d(q,ve)},T=q=>{var ve=tr("Let's get started by importing a control set from a spreadsheet.");d(q,ve)};M(D,q=>{e(E)?q(V):q(T,!1)},!0)}d(p,u)};M(xe,p=>{e(J)?p(Y):p(Q,!1)})}t(L),t(N);var ee=i(N,2);{var be=p=>{var u=ea(),D=o(u),V=o(D),T=i(V,2);t(D),t(u),P(()=>{le(V,1,`px-6 py-3 rounded-l-lg font-medium transition-colors ${e(F)==="existing"?"bg-blue-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`),le(T,1,`px-6 py-3 rounded-r-lg font-medium transition-colors ${e(F)==="import"?"bg-blue-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`)}),c("click",V,()=>a(F,"existing")),c("click",T,()=>a(F,"import")),d(p,u)};M(ee,p=>{e(E)&&p(be)})}var Ce=i(ee,2),te=o(Ce);{var C=p=>{var u=ra(),D=o(u);Vt(D,{$$events:{created:$}}),t(u),d(p,u)},B=p=>{var u=ta(),D=o(u);Qt(D,{get controlSets(){return e(Z)},$$events:{selected:K,"tab-change":G}}),t(u),d(p,u)};M(te,p=>{e(F)==="import"?p(C):p(B,!1)})}var re=i(te,2);{var Se=p=>{var u=aa();d(p,u)};M(re,p=>{e(j)&&p(Se)})}t(Ce),t(g),t(H),d(ue,H),Ke()}export{ca as component};
9
+ ${e(B)==="implementation"?"bg-green-50 dark:bg-green-900/10":""}`),le(je,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto space-y-2 transition-colors
10
+ ${e(B)==="custom"?"bg-purple-50 dark:bg-purple-900/10":""}`),le(Te,1,`p-3 min-h-[400px] max-h-[600px] overflow-y-auto transition-colors
11
+ ${e(B)==="mappings"?"bg-orange-50 dark:bg-orange-900/10":""}`),Ue.disabled=e(Q)||!e(Y)||!e(L),Ye(Ue,"title",e(L)?"":"Please select a Control ID field")}),Vr(w,()=>e(xe),r=>a(xe,r)),Vr(_,()=>e(J),r=>a(J,r)),_r(ne,()=>e(T),r=>a(T,r)),c("change",ne,async()=>{await q()}),_r(er,()=>e(N),r=>a(N,r)),c("change",er,q),_r(rr,()=>e(L),r=>a(L,r)),c("dragover",He,r=>S(r,null)),c("dragleave",He,se),c("drop",He,r=>ie(r,null)),c("dragover",Ee,r=>S(r,"overview")),c("dragleave",Ee,se),c("drop",Ee,r=>ie(r,"overview")),c("dragover",Ie,r=>S(r,"implementation")),c("dragleave",Ie,se),c("drop",Ie,r=>ie(r,"implementation")),c("dragover",je,r=>S(r,"custom")),c("dragleave",je,se),c("drop",je,r=>ie(r,"custom")),c("dragover",Te,r=>S(r,"mappings")),c("dragleave",Te,se),c("drop",Te,r=>ie(r,"mappings")),c("click",Ue,Be),d(l,n)};M(nr,l=>{e(Ce)&&e(b).length>0&&l(dr)})}t(Re),P(()=>le(Ze,1,`flex flex-col items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer transition-all duration-300 ${e(te)?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`)),c("change",Ge,V),c("dragover",ye,p),c("dragleave",ye,u),c("drop",ye,D),d(ue,Re),Ke()}var Nt=x('<span class="ml-2"> </span>'),Lt=x('<div class="text-sm text-gray-500 dark:text-gray-400"><span class="font-medium"> </span> <!></div>'),Bt=x('<div class="text-center space-y-6"><div class="p-6 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-lg border-2 border-green-500"><svg class="w-12 h-12 text-green-600 mx-auto mb-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg> <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Already Using Control Set</h3> <p class="text-gray-600 dark:text-gray-400 mb-4">You are already using the only available control set in this project.</p> <!></div> <div class="flex justify-center gap-4"><a href="/" class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors shadow-lg">Continue to Controls</a> <button class="px-6 py-3 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white font-medium rounded-lg transition-colors">Import New Control Set</button></div></div>'),Rt=x('<div class="p-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300"><div class="flex items-center"><svg class="flex-shrink-0 inline w-4 h-4 mr-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"></path></svg> <span> </span></div></div>'),Zt=x('<p class="text-sm text-gray-600 dark:text-gray-400 mt-1"> </p>'),qt=x('<span class="text-xs text-gray-500 dark:text-gray-400"><svg class="inline w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z" clip-rule="evenodd"></path></svg> </span>'),Ut=x('<div class="flex flex-col items-center"><svg class="w-8 h-8 text-green-600" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg> <span class="text-xs text-green-600 font-medium mt-1">Current</span></div>'),Yt=Ne('<svg class="w-8 h-8 text-blue-600" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>'),Jt=Ne('<svg class="w-8 h-8 text-gray-300 dark:text-gray-600" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="9" stroke="currentColor" stroke-width="2"></circle></svg>'),Xt=x('<div role="button" tabindex="0"><div class="flex items-center justify-between"><div class="flex-1"><div class="flex items-center gap-3"><h3 class="text-lg font-semibold text-gray-900 dark:text-white"> </h3> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"> </span></div> <!> <div class="flex items-center gap-4 mt-2"><span class="text-xs text-gray-500 dark:text-gray-400"><svg class="inline w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M2 6a2 2 0 012-2h12a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zm2-1a1 1 0 00-1 1v8a1 1 0 001 1h12a1 1 0 001-1V6a1 1 0 00-1-1H4z" clip-rule="evenodd"></path></svg> </span> <!></div></div> <div class="flex items-center ml-4"><!></div></div></div>'),Wt=x('<div class="mt-6 flex justify-center"><button class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors shadow-lg">Use Selected Control Set</button></div>'),Kt=x('<div class="space-y-3"></div> <!>',1),Gt=x('<div class="space-y-6"><div class="text-center"><h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">Select an Existing Control Set</h2> <p class="text-gray-600 dark:text-gray-400">Choose from control sets found in your project directory</p></div> <!></div>');function Qt(ue,U){We(U,!1);const F=()=>st(Sr,"$appState",Y),[Y,E]=it(),T=k(),Z=Nr();let b=Je(U,"controlSets",24,()=>[]),$=k(""),K=k(null);function G(J){g(J)||a(K,J)}function H(){e(K)&&!g(e(K))&&Z("selected",{path:e(K).path})}function g(J){const Q=e(T)?.replace(/\/$/,""),ee=J.path?.replace(/\/$/,"");return!!(Q&&ee&&Q===ee)}Ve(()=>F(),()=>{a(T,F().currentPath||"")}),Ve(()=>pe(b()),()=>{if(b())if(b().length===0)a($,"No existing control sets found. Try importing from a spreadsheet instead.");else{const J=b().filter(Q=>!g(Q));J.length===1?a(K,J[0]):J.length===0&&b().length>0&&a($,"already-using-only-set")}}),$r(),Xe();var N=Gt(),L=i(o(N),2);{var xe=J=>{var Q=Ae(),ee=we(Q);{var be=te=>{var C=Bt(),B=o(C),re=i(o(B),6);{var Se=D=>{var V=Lt(),j=o(V),q=o(j,!0);t(j);var ve=i(j,2);{var Le=he=>{var ae=Nt(),S=o(ae);t(ae),P(()=>I(S,`(${pe(b()),de(()=>b()[0].controlCount)??""} controls)`)),d(he,ae)};M(ve,he=>{pe(b()),de(()=>b()[0].controlCount)&&he(Le)})}t(V),P(()=>I(q,(pe(b()),de(()=>b()[0].name)))),d(D,V)};M(re,D=>{pe(b()),de(()=>b().length>0)&&D(Se)})}t(B);var p=i(B,2),u=i(o(p),2);t(p),t(C),c("click",u,()=>Z("tab-change",{tab:"import"})),d(te,C)},Ce=te=>{var C=Ae(),B=we(C);{var re=p=>{var u=Rt(),D=o(u),V=i(o(D),2),j=o(V,!0);t(V),t(D),t(u),P(()=>I(j,e($))),d(p,u)},Se=p=>{var u=Ae(),D=we(u);{var V=j=>{var q=Kt(),ve=we(q);ge(ve,5,b,Cr,(ae,S)=>{const se=ze(()=>(e(S),de(()=>g(e(S)))));var ie=Xt(),Fe=o(ie),$e=o(Fe),De=o($e),Be=o(De),Re=o(Be,!0);t(Be);var ye=i(Be,2),Ze=o(ye);t(ye),t(De);var Oe=i(De,2);{var or=l=>{var n=Zt(),y=o(n,!0);t(n),P(()=>I(y,(e(S),de(()=>e(S).description)))),d(l,n)};M(Oe,l=>{e(S),de(()=>e(S).description)&&l(or)})}var Ge=i(Oe,2),Pe=o(Ge),lr=i(o(Pe));t(Pe);var Qe=i(Pe,2);{var sr=l=>{var n=qt(),y=i(o(n));t(n),P(()=>I(y,` ${e(S),de(()=>e(S).file)??""}`)),d(l,n)};M(Qe,l=>{e(S),de(()=>e(S).file)&&l(sr)})}t(Ge),t($e);var qe=i($e,2),ir=o(qe);{var nr=l=>{var n=Ut();d(l,n)},dr=l=>{var n=Ae(),y=we(n);{var h=w=>{var A=Yt();d(w,A)},z=w=>{var A=Jt();d(w,A)};M(y,w=>{e(K)===e(S)?w(h):w(z,!1)},!0)}d(l,n)};M(ir,l=>{e(se)?l(nr):l(dr,!1)})}t(qe),t(Fe),t(ie),P(()=>{le(ie,1,`p-4 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg border-2 transition-all duration-200 ${e(se)?"border-green-500 !bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 cursor-not-allowed opacity-75":e(K)===e(S)?"border-blue-500 !bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 shadow-lg cursor-pointer":"border-gray-200 dark:border-gray-700 hover:border-blue-300 dark:hover:border-blue-700 hover:shadow-md cursor-pointer"}`),I(Re,(e(S),de(()=>e(S).name))),I(Ze,`${e(S),de(()=>e(S).controlCount||0)??""} controls`),I(lr,` ${e(S),de(()=>e(S).path||"root")??""}`)}),c("click",ie,()=>!e(se)&&G(e(S))),c("keydown",ie,l=>l.key==="Enter"&&!e(se)&&G(e(S))),d(ae,ie)}),t(ve);var Le=i(ve,2);{var he=ae=>{var S=Wt(),se=o(S);t(S),c("click",se,H),d(ae,S)};M(Le,ae=>{e(K)&&ae(he)})}d(j,q)};M(D,j=>{pe(b()),de(()=>b().length>0)&&j(V)},!0)}d(p,u)};M(B,p=>{e($)?p(re):p(Se,!1)},!0)}d(te,C)};M(ee,te=>{e($)==="already-using-only-set"?te(be):te(Ce,!1)},!0)}d(J,Q)};M(L,J=>{J(xe,!1)})}t(N),d(ue,N),Ke(),E()}var ea=x('<div class="flex justify-center mb-8"><div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 inline-flex"><button data-testid="tab-existing">Select Existing Control Set</button> <button data-testid="tab-import">Import New from Spreadsheet</button></div></div>'),ra=x('<div data-testid="pane-import"><!></div>'),ta=x('<div data-testid="pane-existing"><!></div>'),aa=x('<div data-testid="switch-overlay" class="absolute inset-0 bg-gray-900 bg-opacity-50 flex items-center justify-center rounded-lg"><div class="bg-white dark:bg-gray-700 rounded-lg p-6 text-center"><svg class="animate-spin h-8 w-8 text-blue-600 mx-auto mb-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> <p class="text-gray-900 dark:text-white">Switching control set...</p></div></div>'),oa=x('<div class=" p-4"><div class="max-w-6xl mx-auto"><div class="text-center py-8"><h1 class="text-4xl font-extrabold text-gray-900 dark:text-white mb-4 flex items-center justify-center gap-3"><img src="/lula.png" class="h-12 w-12" alt="Lula"/> <span id="title">Lula</span></h1> <p id="description" class="text-lg text-gray-600 dark:text-gray-400"><!></p></div> <!> <div class="bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-900 rounded-lg shadow-xl p-6 relative border border-gray-200 dark:border-gray-700"><!> <!></div></div></div>');function ca(ue,U){We(U,!1);let F=k("import"),Y=k(""),E=k(!1),T=k(!1),Z=k([]);ot(()=>{wr.connect();const p=Sr.subscribe(D=>{D.name&&D.name!=="Unknown Control Set"&&D.id!=="unknown"&&D.id!=="default"&&a(Y,D.currentPath||"")}),u=async D=>{const V=D.detail;if(V&&V.controlSets){if(a(Z,V.controlSets||[]),a(E,e(Z).length>0),e(Z).length===1){const j=e(Z)[0];if(!(e(Y)&&e(Y).includes(j.path))&&!e(Y)){console.log("Only one control set found and none loaded, auto-loading:",j.path),await b(j.path);return}}e(E)&&a(F,"existing")}};return window.addEventListener("control-sets-list",u),wr.scanControlSets().catch(D=>{console.error("Error scanning control sets:",D)}),()=>{p(),window.removeEventListener("control-sets-list",u)}});async function b(p){console.log("Starting control set switch to:",p),a(T,!0);try{await wr.switchControlSet(p),console.log("WebSocket command sent, waiting for state update..."),await new Promise(u=>{let D=0;const V=50,j=setInterval(()=>{D++;const q=lt(Sr);!q.isSwitchingControlSet&&q.currentPath&&q.currentPath.includes(p)?(clearInterval(j),console.log("Control set switch completed successfully"),u()):D>=V&&(clearInterval(j),console.error("Control set switch timed out"),alert("Control set switch timed out. Please try again."),u())},100)}),a(T,!1),nt("/")}catch(u){console.error("Error switching control set:",u),alert("Failed to switch control set: "+u.message),a(T,!1)}}async function $(p){const{path:u}=p.detail;await b(u)}async function K(p){const{path:u}=p.detail;await b(u)}function G(p){const{tab:u}=p.detail;u&&a(F,u)}Xe();var H=oa(),g=o(H),N=o(g),L=i(o(N),2),xe=o(L);{var J=p=>{var u=tr("You have an existing control set. You can continue using it or create a new one.");d(p,u)},Q=p=>{var u=Ae(),D=we(u);{var V=q=>{var ve=tr("Select an existing control set or import a new one from a spreadsheet.");d(q,ve)},j=q=>{var ve=tr("Let's get started by importing a control set from a spreadsheet.");d(q,ve)};M(D,q=>{e(E)?q(V):q(j,!1)},!0)}d(p,u)};M(xe,p=>{e(Y)?p(J):p(Q,!1)})}t(L),t(N);var ee=i(N,2);{var be=p=>{var u=ea(),D=o(u),V=o(D),j=i(V,2);t(D),t(u),P(()=>{le(V,1,`px-6 py-3 rounded-l-lg font-medium transition-colors ${e(F)==="existing"?"bg-blue-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`),le(j,1,`px-6 py-3 rounded-r-lg font-medium transition-colors ${e(F)==="import"?"bg-blue-600 text-white":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`)}),c("click",V,()=>a(F,"existing")),c("click",j,()=>a(F,"import")),d(p,u)};M(ee,p=>{e(E)&&p(be)})}var Ce=i(ee,2),te=o(Ce);{var C=p=>{var u=ra(),D=o(u);Vt(D,{$$events:{created:$}}),t(u),d(p,u)},B=p=>{var u=ta(),D=o(u);Qt(D,{get controlSets(){return e(Z)},$$events:{selected:K,"tab-change":G}}),t(u),d(p,u)};M(te,p=>{e(F)==="import"?p(C):p(B,!1)})}var re=i(te,2);{var Se=p=>{var u=aa();d(p,u)};M(re,p=>{e(T)&&p(Se)})}t(Ce),t(g),t(H),d(ue,H),Ke()}export{ca as component};
@@ -1 +1 @@
1
- {"version":"1760625230679"}
1
+ {"version":"1761698044949"}
@@ -136,7 +136,7 @@ Lula reviewed ${filesCount} files changed that affect compliance.
136
136
  `;
137
137
  }
138
138
  async function analyzeDeletedFiles(context) {
139
- const { octokit, owner, repo, files } = context;
139
+ const { octokit, owner, repo, baseSha, files } = context;
140
140
  const deletedFilesWithAnnotations = [];
141
141
  for (const file of files) {
142
142
  if (file.status === "removed") {
@@ -146,7 +146,7 @@ async function analyzeDeletedFiles(context) {
146
146
  owner,
147
147
  repo,
148
148
  path: file.filename,
149
- ref: "main"
149
+ ref: baseSha
150
150
  });
151
151
  if (containsLulaAnnotations(oldText)) {
152
152
  deletedFilesWithAnnotations.push(file.filename);
@@ -247,15 +247,17 @@ function generateRemovedBlocksContent(filename, removedBlocks, oldText) {
247
247
  return content;
248
248
  }
249
249
  async function analyzeModifiedFiles(context) {
250
- const { octokit, owner, repo, prBranch, files } = context;
250
+ const { octokit, owner, repo, baseSha, headSha, files } = context;
251
251
  let changesContent = "";
252
252
  let hasFindings = false;
253
253
  for (const file of files) {
254
254
  if (file.status === "added" || file.status === "removed") continue;
255
255
  try {
256
+ const oldPath = file.status === "renamed" && file.previous_filename ? file.previous_filename : file.filename;
257
+ const newPath = file.filename;
256
258
  const [oldText, newText] = await Promise.all([
257
- fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: "main" }),
258
- fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: prBranch })
259
+ fetchRawFileViaAPI({ octokit, owner, repo, path: oldPath, ref: baseSha }),
260
+ fetchRawFileViaAPI({ octokit, owner, repo, path: newPath, ref: headSha })
259
261
  ]);
260
262
  const changedBlocks = getChangedBlocks(oldText, newText);
261
263
  const removedBlocks = getRemovedBlocks(oldText, newText);
@@ -306,6 +308,8 @@ function crawlCommand() {
306
308
  const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
307
309
  const pr = await octokit.pulls.get({ owner, repo, pull_number });
308
310
  const prBranch = pr.data.head.ref;
311
+ const baseSha = pr.data.base.sha;
312
+ const headSha = pr.data.head.sha;
309
313
  const { data: files } = await octokit.pulls.listFiles({ owner, repo, pull_number });
310
314
  const context = {
311
315
  octokit,
@@ -313,6 +317,8 @@ function crawlCommand() {
313
317
  repo,
314
318
  pull_number,
315
319
  prBranch,
320
+ baseSha,
321
+ headSha,
316
322
  files
317
323
  };
318
324
  const analysisResult = await performComplianceAnalysis(context);
package/dist/index.html CHANGED
@@ -6,28 +6,28 @@
6
6
  <link rel="icon" href="/lula.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1" />
8
8
 
9
- <link rel="modulepreload" href="/_app/immutable/entry/start.DCxCYu1M.js">
10
- <link rel="modulepreload" href="/_app/immutable/chunks/MY0vM1lA.js">
11
- <link rel="modulepreload" href="/_app/immutable/chunks/BnySH2DD.js">
12
- <link rel="modulepreload" href="/_app/immutable/entry/app.XAEr8i-M.js">
9
+ <link rel="modulepreload" href="/_app/immutable/entry/start.B-O5NM7y.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/DkIUt-Ae.js">
11
+ <link rel="modulepreload" href="/_app/immutable/chunks/kqS9jm6m.js">
12
+ <link rel="modulepreload" href="/_app/immutable/entry/app.Dqwn7sww.js">
13
13
  <link rel="modulepreload" href="/_app/immutable/chunks/DsnmJJEf.js">
14
- <link rel="modulepreload" href="/_app/immutable/chunks/BDFhLgJd.js">
15
- <link rel="modulepreload" href="/_app/immutable/chunks/6cSSDZaX.js">
16
- <link rel="modulepreload" href="/_app/immutable/chunks/ipJF3Ffx.js">
14
+ <link rel="modulepreload" href="/_app/immutable/chunks/DoNUPQ2F.js">
15
+ <link rel="modulepreload" href="/_app/immutable/chunks/DQTRhwGS.js">
16
+ <link rel="modulepreload" href="/_app/immutable/chunks/oPg1Ic49.js">
17
17
  </head>
18
18
  <body data-sveltekit-preload-data="hover">
19
19
  <div style="display: contents">
20
20
  <script>
21
21
  {
22
- __sveltekit_1b7tzml = {
22
+ __sveltekit_1v2zit3 = {
23
23
  base: ""
24
24
  };
25
25
 
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("/_app/immutable/entry/start.DCxCYu1M.js"),
30
- import("/_app/immutable/entry/app.XAEr8i-M.js")
29
+ import("/_app/immutable/entry/start.B-O5NM7y.js"),
30
+ import("/_app/immutable/entry/app.Dqwn7sww.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
package/dist/index.js CHANGED
@@ -5693,7 +5693,7 @@ Lula reviewed ${filesCount} files changed that affect compliance.
5693
5693
  `;
5694
5694
  }
5695
5695
  async function analyzeDeletedFiles(context) {
5696
- const { octokit, owner, repo, files } = context;
5696
+ const { octokit, owner, repo, baseSha, files } = context;
5697
5697
  const deletedFilesWithAnnotations = [];
5698
5698
  for (const file of files) {
5699
5699
  if (file.status === "removed") {
@@ -5703,7 +5703,7 @@ async function analyzeDeletedFiles(context) {
5703
5703
  owner,
5704
5704
  repo,
5705
5705
  path: file.filename,
5706
- ref: "main"
5706
+ ref: baseSha
5707
5707
  });
5708
5708
  if (containsLulaAnnotations(oldText)) {
5709
5709
  deletedFilesWithAnnotations.push(file.filename);
@@ -5804,15 +5804,17 @@ function generateRemovedBlocksContent(filename, removedBlocks, oldText) {
5804
5804
  return content;
5805
5805
  }
5806
5806
  async function analyzeModifiedFiles(context) {
5807
- const { octokit, owner, repo, prBranch, files } = context;
5807
+ const { octokit, owner, repo, baseSha, headSha, files } = context;
5808
5808
  let changesContent = "";
5809
5809
  let hasFindings = false;
5810
5810
  for (const file of files) {
5811
5811
  if (file.status === "added" || file.status === "removed") continue;
5812
5812
  try {
5813
+ const oldPath = file.status === "renamed" && file.previous_filename ? file.previous_filename : file.filename;
5814
+ const newPath = file.filename;
5813
5815
  const [oldText, newText] = await Promise.all([
5814
- fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: "main" }),
5815
- fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: prBranch })
5816
+ fetchRawFileViaAPI({ octokit, owner, repo, path: oldPath, ref: baseSha }),
5817
+ fetchRawFileViaAPI({ octokit, owner, repo, path: newPath, ref: headSha })
5816
5818
  ]);
5817
5819
  const changedBlocks = getChangedBlocks(oldText, newText);
5818
5820
  const removedBlocks = getRemovedBlocks(oldText, newText);
@@ -5863,6 +5865,8 @@ function crawlCommand() {
5863
5865
  const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
5864
5866
  const pr = await octokit.pulls.get({ owner, repo, pull_number });
5865
5867
  const prBranch = pr.data.head.ref;
5868
+ const baseSha = pr.data.base.sha;
5869
+ const headSha = pr.data.head.sha;
5866
5870
  const { data: files } = await octokit.pulls.listFiles({ owner, repo, pull_number });
5867
5871
  const context = {
5868
5872
  octokit,
@@ -5870,6 +5874,8 @@ function crawlCommand() {
5870
5874
  repo,
5871
5875
  pull_number,
5872
5876
  prBranch,
5877
+ baseSha,
5878
+ headSha,
5873
5879
  files
5874
5880
  };
5875
5881
  const analysisResult = await performComplianceAnalysis(context);