lula2 0.6.1-nightly.0 → 0.6.1-nightly.1
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.
- package/dist/_app/immutable/chunks/Bv3eVXV-.js +3 -0
- package/dist/_app/immutable/chunks/{BMNSAUym.js → Bx6M8uXd.js} +1 -1
- package/dist/_app/immutable/chunks/{BmwkkWK-.js → loOficEe.js} +1 -1
- package/dist/_app/immutable/entry/{app.BMX3XH9B.js → app.BM2rHfpO.js} +2 -2
- package/dist/_app/immutable/entry/start.bUkCSbH7.js +1 -0
- package/dist/_app/immutable/nodes/{0.DFzEgAsn.js → 0.2orJRzbh.js} +1 -1
- package/dist/_app/immutable/nodes/{1.f-frqYrl.js → 1.BrMaFf25.js} +1 -1
- package/dist/_app/immutable/nodes/{2.DjKBnAK5.js → 2.hnhHaDbD.js} +1 -1
- package/dist/_app/immutable/nodes/{3.Cm8oQ-Ws.js → 3.BnCLb2wM.js} +1 -1
- package/dist/_app/immutable/nodes/{4.DVhDnucO.js → 4.Bw-EmQzD.js} +1 -1
- package/dist/_app/version.json +1 -1
- package/dist/cli/commands/ui.js +26 -71
- package/dist/cli/server/index.js +26 -71
- package/dist/cli/server/server.js +26 -71
- package/dist/cli/server/spreadsheetRoutes.js +26 -71
- package/dist/cli/server/websocketServer.js +27 -72
- package/dist/index.html +6 -6
- package/dist/index.js +26 -71
- package/package.json +3 -3
- package/dist/_app/immutable/chunks/DYjeAJVm.js +0 -3
- package/dist/_app/immutable/entry/start.CikNPmTv.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// cli/server/spreadsheetRoutes.ts
|
|
2
2
|
import crypto from "crypto";
|
|
3
3
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
4
|
-
import
|
|
4
|
+
import * as XLSX from "xlsx-republish";
|
|
5
5
|
import express from "express";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
7
7
|
import { glob } from "glob";
|
|
@@ -140,20 +140,13 @@ async function parseUploadedFile(file) {
|
|
|
140
140
|
const csvContent = file.buffer.toString("utf-8");
|
|
141
141
|
rawData = parseCSV(csvContent);
|
|
142
142
|
} else {
|
|
143
|
-
const workbook =
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const worksheet = workbook.worksheets[0];
|
|
147
|
-
if (!worksheet) {
|
|
143
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
144
|
+
const worksheetName = workbook.SheetNames[0];
|
|
145
|
+
if (!worksheetName) {
|
|
148
146
|
throw new Error("No worksheet found in file");
|
|
149
147
|
}
|
|
150
|
-
worksheet
|
|
151
|
-
|
|
152
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
153
|
-
rowData[colNumber - 1] = cell.value;
|
|
154
|
-
});
|
|
155
|
-
rawData[rowNumber - 1] = rowData;
|
|
156
|
-
});
|
|
148
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
149
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
157
150
|
}
|
|
158
151
|
return rawData;
|
|
159
152
|
}
|
|
@@ -819,43 +812,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
819
812
|
});
|
|
820
813
|
return exportControl;
|
|
821
814
|
});
|
|
822
|
-
const wb =
|
|
823
|
-
const ws =
|
|
824
|
-
|
|
825
|
-
ws.columns = headers.map((header) => ({
|
|
826
|
-
header,
|
|
827
|
-
key: header,
|
|
828
|
-
width: Math.min(
|
|
829
|
-
Math.max(
|
|
830
|
-
header.length,
|
|
831
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
832
|
-
) + 2,
|
|
833
|
-
50
|
|
834
|
-
)
|
|
835
|
-
// Auto-size with max width of 50
|
|
836
|
-
}));
|
|
837
|
-
worksheetData.forEach((row) => {
|
|
838
|
-
ws.addRow(row);
|
|
839
|
-
});
|
|
840
|
-
ws.getRow(1).font = { bold: true };
|
|
841
|
-
ws.getRow(1).fill = {
|
|
842
|
-
type: "pattern",
|
|
843
|
-
pattern: "solid",
|
|
844
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
845
|
-
};
|
|
815
|
+
const wb = XLSX.utils.book_new();
|
|
816
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
817
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
846
818
|
if (metadata) {
|
|
847
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
848
819
|
const cleanMetadata = { ...metadata };
|
|
849
820
|
delete cleanMetadata.fieldSchema;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
});
|
|
821
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
822
|
+
Property: key,
|
|
823
|
+
Value: String(value)
|
|
824
|
+
}));
|
|
825
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
826
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
857
827
|
}
|
|
858
|
-
const buffer =
|
|
828
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
859
829
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
860
830
|
res.setHeader(
|
|
861
831
|
"Content-Type",
|
|
@@ -990,21 +960,14 @@ router.post("/parse-excel", upload.single("file"), async (req, res) => {
|
|
|
990
960
|
rows = parseCSV(csvContent);
|
|
991
961
|
sheets = ["Sheet1"];
|
|
992
962
|
} else {
|
|
993
|
-
const workbook =
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const worksheet = workbook.worksheets[0];
|
|
998
|
-
if (!worksheet) {
|
|
963
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
964
|
+
sheets = workbook.SheetNames;
|
|
965
|
+
const worksheetName = workbook.SheetNames[0];
|
|
966
|
+
if (!worksheetName) {
|
|
999
967
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
1000
968
|
}
|
|
1001
|
-
worksheet
|
|
1002
|
-
|
|
1003
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1004
|
-
rowData[colNumber - 1] = cell.value;
|
|
1005
|
-
});
|
|
1006
|
-
rows.push(rowData);
|
|
1007
|
-
});
|
|
969
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
970
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1008
971
|
}
|
|
1009
972
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
1010
973
|
row: index + 1,
|
|
@@ -1036,20 +999,12 @@ router.post("/parse-excel-sheet", upload.single("file"), async (req, res) => {
|
|
|
1036
999
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
1037
1000
|
rows = parseCSV(csvContent);
|
|
1038
1001
|
} else {
|
|
1039
|
-
const workbook =
|
|
1040
|
-
|
|
1041
|
-
await workbook.xlsx.load(buffer);
|
|
1042
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
1043
|
-
if (!worksheet) {
|
|
1002
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
1003
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
1044
1004
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
1045
1005
|
}
|
|
1046
|
-
worksheet
|
|
1047
|
-
|
|
1048
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1049
|
-
rowData[colNumber - 1] = cell.value;
|
|
1050
|
-
});
|
|
1051
|
-
rows.push(rowData);
|
|
1052
|
-
});
|
|
1006
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
1007
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1053
1008
|
}
|
|
1054
1009
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
1055
1010
|
const headers = rows[headerRowIndex] || [];
|
|
@@ -1290,7 +1290,7 @@ __export(spreadsheetRoutes_exports, {
|
|
|
1290
1290
|
});
|
|
1291
1291
|
import crypto from "crypto";
|
|
1292
1292
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
1293
|
-
import
|
|
1293
|
+
import * as XLSX from "xlsx-republish";
|
|
1294
1294
|
import express from "express";
|
|
1295
1295
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
1296
1296
|
import { glob } from "glob";
|
|
@@ -1385,20 +1385,13 @@ async function parseUploadedFile(file) {
|
|
|
1385
1385
|
const csvContent = file.buffer.toString("utf-8");
|
|
1386
1386
|
rawData = parseCSV(csvContent);
|
|
1387
1387
|
} else {
|
|
1388
|
-
const workbook =
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
const worksheet = workbook.worksheets[0];
|
|
1392
|
-
if (!worksheet) {
|
|
1388
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
1389
|
+
const worksheetName = workbook.SheetNames[0];
|
|
1390
|
+
if (!worksheetName) {
|
|
1393
1391
|
throw new Error("No worksheet found in file");
|
|
1394
1392
|
}
|
|
1395
|
-
worksheet
|
|
1396
|
-
|
|
1397
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1398
|
-
rowData[colNumber - 1] = cell.value;
|
|
1399
|
-
});
|
|
1400
|
-
rawData[rowNumber - 1] = rowData;
|
|
1401
|
-
});
|
|
1393
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
1394
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1402
1395
|
}
|
|
1403
1396
|
return rawData;
|
|
1404
1397
|
}
|
|
@@ -1969,43 +1962,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
1969
1962
|
});
|
|
1970
1963
|
return exportControl;
|
|
1971
1964
|
});
|
|
1972
|
-
const wb =
|
|
1973
|
-
const ws =
|
|
1974
|
-
|
|
1975
|
-
ws.columns = headers.map((header) => ({
|
|
1976
|
-
header,
|
|
1977
|
-
key: header,
|
|
1978
|
-
width: Math.min(
|
|
1979
|
-
Math.max(
|
|
1980
|
-
header.length,
|
|
1981
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
1982
|
-
) + 2,
|
|
1983
|
-
50
|
|
1984
|
-
)
|
|
1985
|
-
// Auto-size with max width of 50
|
|
1986
|
-
}));
|
|
1987
|
-
worksheetData.forEach((row) => {
|
|
1988
|
-
ws.addRow(row);
|
|
1989
|
-
});
|
|
1990
|
-
ws.getRow(1).font = { bold: true };
|
|
1991
|
-
ws.getRow(1).fill = {
|
|
1992
|
-
type: "pattern",
|
|
1993
|
-
pattern: "solid",
|
|
1994
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
1995
|
-
};
|
|
1965
|
+
const wb = XLSX.utils.book_new();
|
|
1966
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
1967
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
1996
1968
|
if (metadata) {
|
|
1997
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
1998
1969
|
const cleanMetadata = { ...metadata };
|
|
1999
1970
|
delete cleanMetadata.fieldSchema;
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
}
|
|
2008
|
-
const buffer = await wb.xlsx.writeBuffer();
|
|
1971
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
1972
|
+
Property: key,
|
|
1973
|
+
Value: String(value)
|
|
1974
|
+
}));
|
|
1975
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
1976
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
1977
|
+
}
|
|
1978
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
2009
1979
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
2010
1980
|
res.setHeader(
|
|
2011
1981
|
"Content-Type",
|
|
@@ -2247,21 +2217,14 @@ var init_spreadsheetRoutes = __esm({
|
|
|
2247
2217
|
rows = parseCSV(csvContent);
|
|
2248
2218
|
sheets = ["Sheet1"];
|
|
2249
2219
|
} else {
|
|
2250
|
-
const workbook =
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
const worksheet = workbook.worksheets[0];
|
|
2255
|
-
if (!worksheet) {
|
|
2220
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
2221
|
+
sheets = workbook.SheetNames;
|
|
2222
|
+
const worksheetName = workbook.SheetNames[0];
|
|
2223
|
+
if (!worksheetName) {
|
|
2256
2224
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
2257
2225
|
}
|
|
2258
|
-
worksheet
|
|
2259
|
-
|
|
2260
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2261
|
-
rowData[colNumber - 1] = cell.value;
|
|
2262
|
-
});
|
|
2263
|
-
rows.push(rowData);
|
|
2264
|
-
});
|
|
2226
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
2227
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2265
2228
|
}
|
|
2266
2229
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
2267
2230
|
row: index + 1,
|
|
@@ -2293,20 +2256,12 @@ var init_spreadsheetRoutes = __esm({
|
|
|
2293
2256
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
2294
2257
|
rows = parseCSV(csvContent);
|
|
2295
2258
|
} else {
|
|
2296
|
-
const workbook =
|
|
2297
|
-
|
|
2298
|
-
await workbook.xlsx.load(buffer);
|
|
2299
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
2300
|
-
if (!worksheet) {
|
|
2259
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
2260
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
2301
2261
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
2302
2262
|
}
|
|
2303
|
-
worksheet
|
|
2304
|
-
|
|
2305
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2306
|
-
rowData[colNumber - 1] = cell.value;
|
|
2307
|
-
});
|
|
2308
|
-
rows.push(rowData);
|
|
2309
|
-
});
|
|
2263
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
2264
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2310
2265
|
}
|
|
2311
2266
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
2312
2267
|
const headers = rows[headerRowIndex] || [];
|
package/dist/index.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
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.
|
|
10
|
-
<link rel="modulepreload" href="/_app/immutable/chunks/
|
|
9
|
+
<link rel="modulepreload" href="/_app/immutable/entry/start.bUkCSbH7.js">
|
|
10
|
+
<link rel="modulepreload" href="/_app/immutable/chunks/Bv3eVXV-.js">
|
|
11
11
|
<link rel="modulepreload" href="/_app/immutable/chunks/DTWPdvjs.js">
|
|
12
|
-
<link rel="modulepreload" href="/_app/immutable/entry/app.
|
|
12
|
+
<link rel="modulepreload" href="/_app/immutable/entry/app.BM2rHfpO.js">
|
|
13
13
|
<link rel="modulepreload" href="/_app/immutable/chunks/DsnmJJEf.js">
|
|
14
14
|
<link rel="modulepreload" href="/_app/immutable/chunks/BXUi170M.js">
|
|
15
15
|
<link rel="modulepreload" href="/_app/immutable/chunks/WlyXjfrM.js">
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
<div style="display: contents">
|
|
20
20
|
<script>
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
__sveltekit_10gddyq = {
|
|
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.
|
|
30
|
-
import("/_app/immutable/entry/app.
|
|
29
|
+
import("/_app/immutable/entry/start.bUkCSbH7.js"),
|
|
30
|
+
import("/_app/immutable/entry/app.BM2rHfpO.js")
|
|
31
31
|
]).then(([kit, app]) => {
|
|
32
32
|
kit.start(app, element);
|
|
33
33
|
});
|
package/dist/index.js
CHANGED
|
@@ -2862,7 +2862,7 @@ __export(spreadsheetRoutes_exports, {
|
|
|
2862
2862
|
});
|
|
2863
2863
|
import crypto from "crypto";
|
|
2864
2864
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
2865
|
-
import
|
|
2865
|
+
import * as XLSX from "xlsx-republish";
|
|
2866
2866
|
import express from "express";
|
|
2867
2867
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2868
2868
|
import { glob } from "glob";
|
|
@@ -2957,20 +2957,13 @@ async function parseUploadedFile(file) {
|
|
|
2957
2957
|
const csvContent = file.buffer.toString("utf-8");
|
|
2958
2958
|
rawData = parseCSV(csvContent);
|
|
2959
2959
|
} else {
|
|
2960
|
-
const workbook =
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2963
|
-
const worksheet = workbook.worksheets[0];
|
|
2964
|
-
if (!worksheet) {
|
|
2960
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
2961
|
+
const worksheetName = workbook.SheetNames[0];
|
|
2962
|
+
if (!worksheetName) {
|
|
2965
2963
|
throw new Error("No worksheet found in file");
|
|
2966
2964
|
}
|
|
2967
|
-
worksheet
|
|
2968
|
-
|
|
2969
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2970
|
-
rowData[colNumber - 1] = cell.value;
|
|
2971
|
-
});
|
|
2972
|
-
rawData[rowNumber - 1] = rowData;
|
|
2973
|
-
});
|
|
2965
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
2966
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2974
2967
|
}
|
|
2975
2968
|
return rawData;
|
|
2976
2969
|
}
|
|
@@ -3541,43 +3534,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
3541
3534
|
});
|
|
3542
3535
|
return exportControl;
|
|
3543
3536
|
});
|
|
3544
|
-
const wb =
|
|
3545
|
-
const ws =
|
|
3546
|
-
|
|
3547
|
-
ws.columns = headers.map((header) => ({
|
|
3548
|
-
header,
|
|
3549
|
-
key: header,
|
|
3550
|
-
width: Math.min(
|
|
3551
|
-
Math.max(
|
|
3552
|
-
header.length,
|
|
3553
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
3554
|
-
) + 2,
|
|
3555
|
-
50
|
|
3556
|
-
)
|
|
3557
|
-
// Auto-size with max width of 50
|
|
3558
|
-
}));
|
|
3559
|
-
worksheetData.forEach((row) => {
|
|
3560
|
-
ws.addRow(row);
|
|
3561
|
-
});
|
|
3562
|
-
ws.getRow(1).font = { bold: true };
|
|
3563
|
-
ws.getRow(1).fill = {
|
|
3564
|
-
type: "pattern",
|
|
3565
|
-
pattern: "solid",
|
|
3566
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
3567
|
-
};
|
|
3537
|
+
const wb = XLSX.utils.book_new();
|
|
3538
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
3539
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
3568
3540
|
if (metadata) {
|
|
3569
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
3570
3541
|
const cleanMetadata = { ...metadata };
|
|
3571
3542
|
delete cleanMetadata.fieldSchema;
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
});
|
|
3543
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
3544
|
+
Property: key,
|
|
3545
|
+
Value: String(value)
|
|
3546
|
+
}));
|
|
3547
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
3548
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
3579
3549
|
}
|
|
3580
|
-
const buffer =
|
|
3550
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
3581
3551
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
3582
3552
|
res.setHeader(
|
|
3583
3553
|
"Content-Type",
|
|
@@ -3819,21 +3789,14 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3819
3789
|
rows = parseCSV(csvContent);
|
|
3820
3790
|
sheets = ["Sheet1"];
|
|
3821
3791
|
} else {
|
|
3822
|
-
const workbook =
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
const worksheet = workbook.worksheets[0];
|
|
3827
|
-
if (!worksheet) {
|
|
3792
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3793
|
+
sheets = workbook.SheetNames;
|
|
3794
|
+
const worksheetName = workbook.SheetNames[0];
|
|
3795
|
+
if (!worksheetName) {
|
|
3828
3796
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
3829
3797
|
}
|
|
3830
|
-
worksheet
|
|
3831
|
-
|
|
3832
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3833
|
-
rowData[colNumber - 1] = cell.value;
|
|
3834
|
-
});
|
|
3835
|
-
rows.push(rowData);
|
|
3836
|
-
});
|
|
3798
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
3799
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3837
3800
|
}
|
|
3838
3801
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
3839
3802
|
row: index + 1,
|
|
@@ -3865,20 +3828,12 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3865
3828
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
3866
3829
|
rows = parseCSV(csvContent);
|
|
3867
3830
|
} else {
|
|
3868
|
-
const workbook =
|
|
3869
|
-
|
|
3870
|
-
await workbook.xlsx.load(buffer);
|
|
3871
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
3872
|
-
if (!worksheet) {
|
|
3831
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3832
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
3873
3833
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
3874
3834
|
}
|
|
3875
|
-
worksheet
|
|
3876
|
-
|
|
3877
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3878
|
-
rowData[colNumber - 1] = cell.value;
|
|
3879
|
-
});
|
|
3880
|
-
rows.push(rowData);
|
|
3881
|
-
});
|
|
3835
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
3836
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3882
3837
|
}
|
|
3883
3838
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
3884
3839
|
const headers = rows[headerRowIndex] || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lula2",
|
|
3
|
-
"version": "0.6.1-nightly.
|
|
3
|
+
"version": "0.6.1-nightly.1",
|
|
4
4
|
"description": "A tool for managing compliance as code in your GitHub repositories.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lula2": "./dist/lula2"
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"commander": "^14.0.0",
|
|
40
40
|
"cors": "^2.8.5",
|
|
41
41
|
"csv-parse": "^6.1.0",
|
|
42
|
-
"exceljs": "^4.4.0",
|
|
43
42
|
"express": "^5.1.0",
|
|
44
43
|
"express-rate-limit": "^8.1.0",
|
|
45
44
|
"flowbite": "^3.1.2",
|
|
@@ -50,6 +49,7 @@
|
|
|
50
49
|
"open": "^10.2.0",
|
|
51
50
|
"undici": "^7.15.0",
|
|
52
51
|
"ws": "^8.18.3",
|
|
52
|
+
"xlsx-republish": "^0.20.3",
|
|
53
53
|
"yaml": "^2.8.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"dev:full": "concurrently \"npm run dev:api\" \"npm run dev\"",
|
|
113
113
|
"build": "npm run build:svelte && npm run build:cli && npm run postbuild:cli",
|
|
114
114
|
"build:svelte": "vite build",
|
|
115
|
-
"build:cli": "esbuild index.ts cli/**/*.ts --bundle --platform=node --target=node22 --format=esm --outdir=dist --external:express --external:commander --external:js-yaml --external:yaml --external:isomorphic-git --external:glob --external:open --external:ws --external:cors --external:multer --external:@octokit/rest --external:undici --external:
|
|
115
|
+
"build:cli": "esbuild index.ts cli/**/*.ts --bundle --platform=node --target=node22 --format=esm --outdir=dist --external:express --external:commander --external:js-yaml --external:yaml --external:isomorphic-git --external:glob --external:open --external:ws --external:cors --external:multer --external:@octokit/rest --external:undici --external:xlsx-republish --external:csv-parse",
|
|
116
116
|
"postbuild:cli": "cp cli-wrapper.mjs dist/lula2 && chmod +x dist/lula2",
|
|
117
117
|
"preview": "vite preview",
|
|
118
118
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && tsc --noEmit",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a$ as Ae,o as $e,g as U,h as L,d as P,bi as yt,ai as De}from"./DTWPdvjs.js";class le{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Se{constructor(t,n){this.status=t,this.location=n}}class Re extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function wt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function vt(e){return e.split("%25").map(decodeURI).join("%25")}function bt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function kt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(i,o){if(o==="get"||o==="getAll"||o==="has")return f=>(n(f),i[o](f));t();const c=Reflect.get(i,o);return typeof c=="function"?c.bind(i):c}}),enumerable:!0,configurable:!0});const s=["href","pathname","search","toString","toJSON"];r&&s.push("hash");for(const i of s)Object.defineProperty(a,i,{get(){return t(),e[i]},enumerable:!0,configurable:!0});return a}function Et(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;const At=new TextDecoder;function St(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Rt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&Y.delete(Te(e)),Rt(e,t));const Y=new Map;function Tt(e,t){const n=Te(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...s}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&Y.set(n,{body:a,init:s,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=St(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function It(e,t,n){if(Y.size>0){const r=Te(e,n),a=Y.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);Y.delete(r)}}return window.fetch(t,n)}function Te(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Et(...a)}"]`}return r}const Ut=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Lt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${xt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const s=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(s)return t.push({name:s[1],matcher:s[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return _e(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return _e(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=Ut.exec(c),[,p,u,l,h]=d;return t.push({name:l,matcher:h,optional:!!p,rest:!!u,chained:u?f===1&&i[0]==="":!1}),u?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return _e(c)}).join("")}).join("")}/?$`),params:t}}function Pt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function xt(e){return e.slice(1).split("/").filter(Pt)}function Ct(e,t,n){const r={},a=e.slice(1),s=a.filter(o=>o!==void 0);let i=0;for(let o=0;o<t.length;o+=1){const c=t[o];let f=a[o-i];if(c.chained&&c.rest&&i&&(f=a.slice(o-i,o+1).filter(d=>d).join("/"),i=0),f===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](f)){r[c.name]=f;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&c.chained&&(i=0),!d&&!p&&Object.keys(r).length===s.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function _e(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ot({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[c,f,d]])=>{const{pattern:p,params:u}=Lt(o),l={id:o,exec:h=>{const w=p.exec(h);if(w)return Ct(w,u,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...f||[]].map(i),leaf:s(c)};return l.errors.length=l.layouts.length=Math.max(l.errors.length,l.layouts.length),l});function s(o){const c=o<0;return c&&(o=~o),[c,e[o]]}function i(o){return o===void 0?o:[a.has(o),e[o]]}}function Je(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Be(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const I=globalThis.__sveltekit_9ui1cm?.base??"",Nt=globalThis.__sveltekit_9ui1cm?.assets??I??"",jt="1759797111375",ze="sveltekit:snapshot",Xe="sveltekit:scroll",Ze="sveltekit:states",$t="sveltekit:pageurl",F="sveltekit:history",W="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Z=location.origin;function Ie(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function fe(){return{x:pageXOffset,y:pageYOffset}}function B(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Fe={...j,"":j.hover};function Qe(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function et(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Qe(e)}}function ve(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,s=!r||!!a||ue(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=r?.origin===Z&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function te(e){let t=null,n=null,r=null,a=null,s=null,i=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=B(o,"preload-code")),a===null&&(a=B(o,"preload-data")),t===null&&(t=B(o,"keepfocus")),n===null&&(n=B(o,"noscroll")),s===null&&(s=B(o,"reload")),i===null&&(i=B(o,"replacestate")),o=Qe(o);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Fe[r??"off"],preload_data:Fe[a??"off"],keepfocus:c(t),noscroll:c(n),reload:c(s),replace_state:c(i)}}function Ve(e){const t=Ae(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function s(i){let o;return t.subscribe(c=>{(o===void 0||n&&c!==o)&&i(o=c)})}return{notify:r,set:a,subscribe:s}}const tt={v:()=>{}};function Dt(){const{set:e,subscribe:t}=Ae(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==jt;return i&&(e(!0),tt.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function ue(e,t,n){return e.origin!==Z||!e.pathname.startsWith(t)?!0:n?!(e.pathname===t+"/"||e.pathname===t+"/index.html"||e.protocol==="file:"&&e.pathname.replace(/\/[^/]+\.html?$/,"")===t):!1}function An(e){}function Bt(e){const t=Vt(e),n=new ArrayBuffer(t.length),r=new DataView(n);for(let a=0;a<n.byteLength;a++)r.setUint8(a,t.charCodeAt(a));return n}const Ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Vt(e){e.length%4===0&&(e=e.replace(/==?$/,""));let t="",n=0,r=0;for(let a=0;a<e.length;a++)n<<=6,n|=Ft.indexOf(e[a]),r+=6,r===24&&(t+=String.fromCharCode((n&16711680)>>16),t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255),n=r=0);return r===12?(n>>=4,t+=String.fromCharCode(n)):r===18&&(n>>=2,t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255)),t}const Mt=-1,qt=-2,Gt=-3,Yt=-4,Ht=-5,Kt=-6;function Wt(e,t){if(typeof e=="number")return a(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const n=e,r=Array(n.length);function a(s,i=!1){if(s===Mt)return;if(s===Gt)return NaN;if(s===Yt)return 1/0;if(s===Ht)return-1/0;if(s===Kt)return-0;if(i||typeof s!="number")throw new Error("Invalid input");if(s in r)return r[s];const o=n[s];if(!o||typeof o!="object")r[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const c=o[0],f=t?.[c];if(f)return r[s]=f(a(o[1]));switch(c){case"Date":r[s]=new Date(o[1]);break;case"Set":const d=new Set;r[s]=d;for(let l=1;l<o.length;l+=1)d.add(a(o[l]));break;case"Map":const p=new Map;r[s]=p;for(let l=1;l<o.length;l+=2)p.set(a(o[l]),a(o[l+1]));break;case"RegExp":r[s]=new RegExp(o[1],o[2]);break;case"Object":r[s]=Object(o[1]);break;case"BigInt":r[s]=BigInt(o[1]);break;case"null":const u=Object.create(null);r[s]=u;for(let l=1;l<o.length;l+=2)u[o[l]]=a(o[l+1]);break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":{const l=globalThis[c],h=new l(a(o[1]));r[s]=o[2]!==void 0?h.subarray(o[2],o[3]):h;break}case"ArrayBuffer":{const l=o[1],h=Bt(l);r[s]=h;break}case"Temporal.Duration":case"Temporal.Instant":case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.PlainMonthDay":case"Temporal.PlainYearMonth":case"Temporal.ZonedDateTime":{const l=c.slice(9);r[s]=Temporal[l].from(o[1]);break}case"URL":{const l=new URL(o[1]);r[s]=l;break}case"URLSearchParams":{const l=new URLSearchParams(o[1]);r[s]=l;break}default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(o.length);r[s]=c;for(let f=0;f<o.length;f+=1){const d=o[f];d!==qt&&(c[f]=a(d))}}else{const c={};r[s]=c;for(const f in o){if(f==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const d=o[f];c[f]=a(d)}}return r[s]}return a(0)}const nt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...nt];const Jt=new Set([...nt]);[...Jt];function zt(e){return e.filter(t=>t!=null)}const Xt="x-sveltekit-invalidated",Zt="x-sveltekit-trailing-slash";function ne(e){return e instanceof le||e instanceof Re?e.status:500}function Qt(e){return e instanceof Re?e.text:"Internal Error"}let R,J,ye;const en=$e.toString().includes("$$")||/function \w+\(\) \{\}/.test($e.toString());en?(R={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},J={current:null},ye={current:!1}):(R=new class{#e=U({});get data(){return L(this.#e)}set data(t){P(this.#e,t)}#t=U(null);get form(){return L(this.#t)}set form(t){P(this.#t,t)}#n=U(null);get error(){return L(this.#n)}set error(t){P(this.#n,t)}#r=U({});get params(){return L(this.#r)}set params(t){P(this.#r,t)}#a=U({id:null});get route(){return L(this.#a)}set route(t){P(this.#a,t)}#o=U({});get state(){return L(this.#o)}set state(t){P(this.#o,t)}#s=U(-1);get status(){return L(this.#s)}set status(t){P(this.#s,t)}#i=U(new URL("https://example.com"));get url(){return L(this.#i)}set url(t){P(this.#i,t)}},J=new class{#e=U(null);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},ye=new class{#e=U(!1);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},tt.v=()=>ye.current=!0);function tn(e){Object.assign(R,e)}const nn="/__data.json",rn=".html__data.json";function an(e){return e.endsWith(".html")?e.replace(/\.html$/,rn):e.replace(/\/$/,"")+nn}const Me={spanContext(){return on},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},on={traceId:"",spanId:"",traceFlags:0},{tick:sn}=yt,cn=new Set(["icon","shortcut icon","apple-touch-icon"]),D=Je(Xe)??{},z=Je(ze)??{},N={url:Ve({}),page:Ve({}),navigating:Ae(null),updated:Dt()};function Ue(e){D[e]=fe()}function ln(e,t){let n=e+1;for(;D[n];)delete D[n],n+=1;for(n=t+1;z[n];)delete z[n],n+=1}function q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function rt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(I||"/");e&&await e.update()}}function qe(){}let Le,be,re,x,ke,k;const ae=[],oe=[];let C=null;const ee=new Map,at=new Set,fn=new Set,H=new Set;let y={branch:[],error:null,url:null},Pe=!1,se=!1,Ge=!0,X=!1,G=!1,ot=!1,xe=!1,st,A,T,$;const K=new Set,Ye=new Map;async function In(e,t,n){globalThis.__sveltekit_9ui1cm?.data&&globalThis.__sveltekit_9ui1cm.data,document.URL!==location.href&&(location.href=location.href),k=e,await e.hooks.init?.(),Le=Ot(e),x=document.documentElement,ke=t,be=e.nodes[0],re=e.nodes[1],be(),re(),A=history.state?.[F],T=history.state?.[W],A||(A=T=Date.now(),history.replaceState({...history.state,[F]:A,[W]:T},""));const r=D[A];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await vn(ke,n)):(await V({type:"enter",url:Ie(k.hash?kn(new URL(location.href)):location.href),replace_state:!0}),a()),wn()}function un(){ae.length=0,xe=!1}function it(e){oe.some(t=>t?.snapshot)&&(z[e]=oe.map(t=>t?.snapshot?.capture()))}function ct(e){z[e]?.forEach((t,n)=>{oe[n]?.snapshot?.restore(t)})}function He(){Ue(A),Be(Xe,D),it(T),Be(ze,z)}async function lt(e,t,n,r){let a;t.invalidateAll&&(C=null),await V({type:"goto",url:Ie(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(xe=!0,a=[...Ye.keys()]),t.invalidate&&t.invalidate.forEach(yn)}}),t.invalidateAll&&De().then(De).then(()=>{Ye.forEach(({resource:s},i)=>{a?.includes(i)&&s.refresh?.()})})}async function dn(e){if(e.id!==C?.id){const t={};K.add(t),C={id:e.id,token:t,promise:dt({...e,preload:t}).then(n=>(K.delete(t),n.type==="loaded"&&n.state.error&&(C=null),n))}}return C.promise}async function we(e){const t=(await he(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}function ft(e,t,n){y=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(R,e.props.page),st=new k.root({target:t,props:{...e.props,stores:N,components:oe},hydrate:n,sync:!1}),ct(T),n){const a={from:null,to:{params:y.params,route:{id:y.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};H.forEach(s=>s(a))}se=!0}function ie({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if(I&&(e.pathname===I||e.pathname===I+"/"))o="always";else for(const l of n)l?.slash!==void 0&&(o=l.slash);e.pathname=wt(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:zt(n).map(l=>l.node.component),page:je(R)}};i!==void 0&&(c.props.form=i);let f={},d=!R,p=0;for(let l=0;l<Math.max(n.length,y.branch.length);l+=1){const h=n[l],w=y.branch[l];h?.data!==w?.data&&(d=!0),h&&(f={...f,...h.data},d&&(c.props[`data_${p}`]=f),p+=1)}return(!y.url||e.href!==y.url.href||y.error!==a||i!==void 0&&i!==R.form||d)&&(c.props.page={error:a,params:t,route:{id:s?.id??null},state:{},status:r,url:new URL(e),form:i??null,data:d?f:R.data}),c}async function Ce({loader:e,parent:t,url:n,params:r,route:a,server_data_node:s}){let i=null,o=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},f=await e();if(f.universal?.load){let d=function(...u){for(const l of u){const{href:h}=new URL(l,n);c.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Me,current:Me},route:new Proxy(a,{get:(u,l)=>(o&&(c.route=!0),u[l])}),params:new Proxy(r,{get:(u,l)=>(o&&c.params.add(l),u[l])}),data:s?.data??null,url:kt(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},k.hash),async fetch(u,l){u instanceof Request&&(l={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...l});const{resolved:h,promise:w}=ut(u,l,n);return o&&d(h.href),w},setHeaders:()=>{},depends:d,parent(){return o&&(c.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};i=await f.universal.load.call(null,p)??null}return{node:f,loader:e,server:s,universal:f.universal?.load?{type:"data",data:i,uses:c}:null,data:i??s?.data??null,slash:f.universal?.trailingSlash??s?.slash}}function ut(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const s=se?It(r,a.href,t):Tt(r,t);return{resolved:a,promise:s}}function Ke(e,t,n,r,a,s){if(xe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(s[i]!==y.params[i])return!0;for(const i of a.dependencies)if(ae.some(o=>o(new URL(i))))return!0;return!1}function Oe(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function hn(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),s=t.searchParams.getAll(r);a.every(i=>s.includes(i))&&s.every(i=>a.includes(i))&&n.delete(r)}return n}function We({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:je(R),constructors:[]}}}async function dt({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if(C?.id===e)return K.delete(C.token),C.promise;const{errors:i,layouts:o,leaf:c}=a,f=[...o,c];i.forEach(_=>_?.().catch(()=>{})),f.forEach(_=>_?.[1]().catch(()=>{}));let d=null;const p=y.url?e!==ce(y.url):!1,u=y.route?a.id!==y.route.id:!1,l=hn(y.url,n);let h=!1;const w=f.map((_,g)=>{const v=y.branch[g],b=!!_?.[0]&&(v?.loader!==_[1]||Ke(h,u,p,l,v.server?.uses,r));return b&&(h=!0),b});if(w.some(Boolean)){try{d=await gt(n,w)}catch(_){const g=await M(_,{url:n,params:r,route:{id:e}});return K.has(s)?We({error:g,url:n,params:r,route:a}):de({status:ne(_),error:g,url:n,route:a})}if(d.type==="redirect")return d}const E=d?.nodes;let m=!1;const O=f.map(async(_,g)=>{if(!_)return;const v=y.branch[g],b=E?.[g];if((!b||b.type==="skip")&&_[1]===v?.loader&&!Ke(m,u,p,l,v.universal?.uses,r))return v;if(m=!0,b?.type==="error")throw b;return Ce({loader:_[1],url:n,params:r,route:a,parent:async()=>{const pe={};for(let ge=0;ge<g;ge+=1)Object.assign(pe,(await O[ge])?.data);return pe},server_data_node:Oe(b===void 0&&_[0]?{type:"skip"}:b??null,_[0]?v?.server:void 0)})});for(const _ of O)_.catch(()=>{});const S=[];for(let _=0;_<f.length;_+=1)if(f[_])try{S.push(await O[_])}catch(g){if(g instanceof Se)return{type:"redirect",location:g.location};if(K.has(s))return We({error:await M(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let v=ne(g),b;if(E?.includes(g))v=g.status??v,b=g.error;else if(g instanceof le)b=g.body;else{if(await N.updated.check())return await rt(),await q(n);b=await M(g,{params:r,url:n,route:{id:a.id}})}const Q=await pn(_,S,i);return Q?ie({url:n,params:r,branch:S.slice(0,Q.idx).concat(Q.node),status:v,error:b,route:a}):await pt(n,{id:a.id},b,v)}else S.push(void 0);return ie({url:n,params:r,branch:S,status:200,error:null,route:a,form:t?void 0:null})}async function pn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function de({status:e,error:t,url:n,route:r}){const a={};let s=null;if(k.server_loads[0]===0)try{const o=await gt(n,[!0]);if(o.type!=="data"||o.nodes[0]&&o.nodes[0].type!=="data")throw 0;s=o.nodes[0]??null}catch{(n.origin!==Z||n.pathname!==location.pathname||Pe)&&await q(n)}try{const o=await Ce({loader:be,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Oe(s)}),c={node:await re(),loader:re,universal:null,server:null,data:null};return ie({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Se)return lt(new URL(o.location,location.href),{},0);throw o}}async function gn(e){const t=e.href;if(ee.has(t))return ee.get(t);let n;try{const r=(async()=>{let a=await k.hooks.reroute({url:new URL(e),fetch:async(s,i)=>ut(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);k.hash?s.hash=a:s.pathname=a,a=s}return a})();ee.set(t,r),n=await r}catch{ee.delete(t);return}return n}async function he(e,t){if(e&&!ue(e,I,k.hash)){const n=await gn(e);if(!n)return;const r=mn(n);for(const a of Le){const s=a.exec(r);if(s)return{id:ce(e),invalidating:t,route:a,params:bt(s),url:e}}}}function mn(e){return vt(k.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(I.length))||"/"}function ce(e){return(k.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function ht({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=Ne(y,n,e,t);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const o={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return X||at.forEach(c=>c(o)),s?null:i}async function V({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:f=qe,block:d=qe,event:p}){const u=$;$=c;const l=await he(t,!1),h=e==="enter"?Ne(y,l,t,e):ht({url:t,type:e,delta:n?.delta,intent:l,event:p});if(!h){d(),$===c&&($=u);return}const w=A,E=T;f(),X=!0,se&&h.navigation.type!=="enter"&&N.navigating.set(J.current=h.navigation);let m=l&&await dt(l);if(!m){if(ue(t,I,k.hash))return await q(t,s);m=await pt(t,{id:null},await M(new Re(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=l?.url||t,$!==c)return h.reject(new Error("navigation aborted")),!1;if(m.type==="redirect"){if(o<20){await V({type:e,url:new URL(m.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i,redirect_count:o+1,nav_token:c}),h.fulfil(void 0);return}m=await de({status:500,error:await M(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else m.props.page.status>=400&&await N.updated.check()&&(await rt(),await q(t,s));if(un(),Ue(w),it(E),m.props.page.url.pathname!==t.pathname&&(t.pathname=m.props.page.url.pathname),i=n?n.state:i,!n){const g=s?0:1,v={[F]:A+=g,[W]:T+=g,[Ze]:i};(s?history.replaceState:history.pushState).call(history,v,"",t),s||ln(A,T)}if(C=null,m.props.page.state=i,se){const g=(await Promise.all(Array.from(fn,v=>v(h.navigation)))).filter(v=>typeof v=="function");if(g.length>0){let v=function(){g.forEach(b=>{H.delete(b)})};g.push(v),g.forEach(b=>{H.add(b)})}y=m.state,m.props.page&&(m.props.page.url=t),st.$set(m.props),tn(m.props.page),ot=!0}else ft(m,ke,!1);const{activeElement:O}=document;await sn();let S=n?n.scroll:a?fe():null;if(Ge){const g=t.hash&&document.getElementById(_t(t));if(S)scrollTo(S.x,S.y);else if(g){g.scrollIntoView();const{top:v,left:b}=g.getBoundingClientRect();S={x:pageXOffset+b,y:pageYOffset+v}}else scrollTo(0,0)}const _=document.activeElement!==O&&document.activeElement!==document.body;!r&&!_&&bn(t,S),Ge=!0,m.props.page&&Object.assign(R,m.props.page),X=!1,e==="popstate"&&ct(T),h.fulfil(void 0),H.forEach(g=>g(h.navigation)),N.navigating.set(J.current=null)}async function pt(e,t,n,r,a){return e.origin===Z&&e.pathname===location.pathname&&!Pe?await de({status:r,error:n,url:e,route:t}):await q(e,a)}function _n(){let e,t,n;x.addEventListener("mousemove",o=>{const c=o.target;clearTimeout(e),e=setTimeout(()=>{s(c,j.hover)},20)});function r(o){o.defaultPrevented||s(o.composedPath()[0],j.tap)}x.addEventListener("mousedown",r),x.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting&&(we(new URL(c.target.href)),a.unobserve(c.target))},{threshold:0});async function s(o,c){const f=et(o,x),d=f===t&&c>=n;if(!f||d)return;const{url:p,external:u,download:l}=ve(f,I,k.hash);if(u||l)return;const h=te(f),w=p&&ce(y.url)===ce(p);if(!(h.reload||w))if(c<=h.preload_data){t=f,n=j.tap;const E=await he(p,!1);if(!E)return;dn(E)}else c<=h.preload_code&&(t=f,n=c,we(p))}function i(){a.disconnect();for(const o of x.querySelectorAll("a")){const{url:c,external:f,download:d}=ve(o,I,k.hash);if(f||d)continue;const p=te(o);p.reload||(p.preload_code===j.viewport&&a.observe(o),p.preload_code===j.eager&&we(c))}}H.add(i),i()}function M(e,t){if(e instanceof le)return e.body;const n=ne(e),r=Qt(e);return k.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Un(e,t={}){return e=new URL(Ie(e)),e.origin!==Z?Promise.reject(new Error("goto: invalid URL")):lt(e,t,0)}function yn(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function wn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(He(),!X){const r=Ne(y,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};at.forEach(s=>s(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&He()}),navigator.connection?.saveData||_n(),x.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=et(t.composedPath()[0],x);if(!n)return;const{url:r,external:a,target:s,download:i}=ve(n,I,k.hash);if(!r)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const o=te(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||i)return;const[f,d]=(k.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=f===me(location);if(a||o.reload&&(!p||!d)){ht({url:r,type:"link",event:t})?X=!0:t.preventDefault();return}if(d!==void 0&&p){const[,u]=y.url.href.split("#");if(u===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const l=n.ownerDocument.getElementById(decodeURIComponent(d));l&&(l.scrollIntoView(),l.focus())}return}if(G=!0,Ue(A),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await V({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),x.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const i=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ue(i,I,!1))return;const o=t.target,c=te(o);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(o,r);i.search=new URLSearchParams(f).toString(),V({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Ee){if(t.state?.[F]){const n=t.state[F];if($={},n===A)return;const r=D[n],a=t.state[Ze]??{},s=new URL(t.state[$t]??location.href),i=t.state[W],o=y.url?me(location)===me(y.url):!1;if(i===T&&(ot||o)){a!==R.state&&(R.state=a),e(s),D[A]=fe(),r&&scrollTo(r.x,r.y),A=n;return}const f=n-A;await V({type:"popstate",url:s,popped:{state:a,scroll:r,delta:f},accept:()=>{A=n,T=i},block:()=>{history.go(-f)},nav_token:$,event:t})}else if(!G){const n=new URL(location.href);e(n),k.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[F]:++A,[W]:T},"",location.href))});for(const t of document.querySelectorAll("link"))cn.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&N.navigating.set(J.current=null)});function e(t){y.url=R.url=t,N.page.set(je(R)),N.page.notify()}}async function vn(e,{status:t=200,error:n,node_ids:r,params:a,route:s,server_route:i,data:o,form:c}){Pe=!0;const f=new URL(location.href);let d;({params:a={},route:s={id:null}}=await he(f,!1)||{}),d=Le.find(({id:l})=>l===s.id);let p,u=!0;try{const l=r.map(async(w,E)=>{const m=o[E];return m?.uses&&(m.uses=mt(m.uses)),Ce({loader:k.nodes[w],url:f,params:a,route:s,parent:async()=>{const O={};for(let S=0;S<E;S+=1)Object.assign(O,(await l[S]).data);return O},server_data_node:Oe(m)})}),h=await Promise.all(l);if(d){const w=d.layouts;for(let E=0;E<w.length;E++)w[E]||h.splice(E,0,void 0)}p=ie({url:f,params:a,branch:h,status:t,error:n,form:c,route:d??null})}catch(l){if(l instanceof Se){await q(new URL(l.location,location.href));return}p=await de({status:ne(l),error:await M(l,{url:f,params:a,route:s}),url:f,route:s}),e.textContent="",u=!1}p.props.page&&(p.props.page.state={}),ft(p,e,u)}async function gt(e,t){const n=new URL(e);n.pathname=an(e.pathname),e.pathname.endsWith("/")&&n.searchParams.append(Zt,"1"),n.searchParams.append(Xt,t.map(s=>s?"1":"0").join(""));const r=window.fetch,a=await r(n.href,{});if(!a.ok){let s;throw a.headers.get("content-type")?.includes("application/json")?s=await a.json():a.status===404?s="Not Found":a.status===500&&(s="Internal Error"),new le(a.status,s)}return new Promise(async s=>{const i=new Map,o=a.body.getReader();function c(d){return Wt(d,{...k.decoders,Promise:p=>new Promise((u,l)=>{i.set(p,{fulfil:u,reject:l})})})}let f="";for(;;){const{done:d,value:p}=await o.read();if(d&&!f)break;for(f+=!p&&f?`
|
|
2
|
-
`:At.decode(p,{stream:!0});;){const u=f.indexOf(`
|
|
3
|
-
`);if(u===-1)break;const l=JSON.parse(f.slice(0,u));if(f=f.slice(u+1),l.type==="redirect")return s(l);if(l.type==="data")l.nodes?.forEach(h=>{h?.type==="data"&&(h.uses=mt(h.uses),h.data=c(h.data))}),s(l);else if(l.type==="chunk"){const{id:h,data:w,error:E}=l,m=i.get(h);i.delete(h),E?m.reject(c(E)):m.fulfil(c(w))}}}})}function mt(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Ee=!1;function bn(e,t=null){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=_t(e);if(r&&document.getElementById(r)){const{x:s,y:i}=t??fe();setTimeout(()=>{const o=history.state;Ee=!0,location.replace(`#${r}`),k.hash&&location.replace(e.hash),history.replaceState(o,"",e.hash),scrollTo(s,i),Ee=!1})}else{const s=document.body,i=s.getAttribute("tabindex");s.tabIndex=-1,s.focus({preventScroll:!0,focusVisible:!1}),i!==null?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const s=[];for(let i=0;i<a.rangeCount;i+=1)s.push(a.getRangeAt(i));setTimeout(()=>{if(a.rangeCount===s.length){for(let i=0;i<a.rangeCount;i+=1){const o=s[i],c=a.getRangeAt(i);if(o.commonAncestorContainer!==c.commonAncestorContainer||o.startContainer!==c.startContainer||o.endContainer!==c.endContainer||o.startOffset!==c.startOffset||o.endOffset!==c.endOffset)return}a.removeAllRanges()}})}}}function Ne(e,t,n,r){let a,s;const i=new Promise((c,f)=>{a=c,s=f});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n},willUnload:!t,type:r,complete:i},fulfil:a,reject:s}}function je(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function kn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function _t(e){let t;if(k.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{In as a,Un as g,An as l,R as p,N as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as o,a as r}from"../chunks/DYjeAJVm.js";export{o as load_css,r as start};
|