Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
'use client';
'use strict';
var clearListState = require('./clear-list-state.cjs');
function getIndexFromKeyAfterPath(key, path) {
const split = key.substring(path.length + 1).split(".")[0];
return parseInt(split, 10);
}
function changeErrorIndices(path, index, errors, change) {
if (index === void 0) {
return errors;
}
const pathString = `${String(path)}`;
let clearedErrors = errors;
if (change === -1) {
clearedErrors = clearListState.clearListState(`${pathString}.${index}`, clearedErrors);
}
const cloned = { ...clearedErrors };
const changedKeys = /* @__PURE__ */ new Set();
Object.entries(clearedErrors).filter(([key]) => {
if (!key.startsWith(`${pathString}.`)) {
return false;
}
const currIndex = getIndexFromKeyAfterPath(key, pathString);
if (Number.isNaN(currIndex)) {
return false;
}
return currIndex >= index;
}).forEach(([key, value]) => {
const currIndex = getIndexFromKeyAfterPath(key, pathString);
const newKey = key.replace(
`${pathString}.${currIndex}`,
`${pathString}.${currIndex + change}`
);
cloned[newKey] = value;
changedKeys.add(newKey);
if (!changedKeys.has(key)) {
delete cloned[key];
}
});
return cloned;
}
exports.changeErrorIndices = changeErrorIndices;
//# sourceMappingURL=change-error-indices.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
'use client';
'use strict';
function clearListState(field, state) {
if (state === null || typeof state !== "object") {
return {};
}
const clone = { ...state };
Object.keys(state).forEach((errorKey) => {
if (errorKey.includes(`${String(field)}.`)) {
delete clone[errorKey];
}
});
return clone;
}
exports.clearListState = clearListState;
//# sourceMappingURL=clear-list-state.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"clear-list-state.cjs","sources":["../../src/lists/clear-list-state.ts"],"sourcesContent":["export function clearListState<T extends Record<PropertyKey, any>>(\n field: PropertyKey,\n state: T\n): T {\n if (state === null || typeof state !== 'object') {\n return {} as T;\n }\n\n const clone = { ...state };\n Object.keys(state).forEach((errorKey) => {\n if (errorK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AA,EAAO,KAAK,CAAC,GAAG,CAAA,CAAA,CAAG,CAAA;AAC1C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACvB,CAAA;AAAA,CAAA,CACF,CAAC,CAAA,CAAA;AAED,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACT,CAAA;;"}

View File

@@ -0,0 +1,35 @@
'use client';
'use strict';
function reorderErrors(path, { from, to }, errors) {
const oldKeyStart = `${path}.${from}`;
const newKeyStart = `${path}.${to}`;
const clone = { ...errors };
const processedKeys = /* @__PURE__ */ new Set();
Object.keys(errors).forEach((key) => {
if (processedKeys.has(key)) {
return;
}
let oldKey;
let newKey;
if (key.startsWith(oldKeyStart)) {
oldKey = key;
newKey = key.replace(oldKeyStart, newKeyStart);
} else if (key.startsWith(newKeyStart)) {
oldKey = key.replace(newKeyStart, oldKeyStart);
newKey = key;
}
if (oldKey && newKey) {
const value1 = clone[oldKey];
const value2 = clone[newKey];
value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
processedKeys.add(oldKey);
processedKeys.add(newKey);
}
});
return clone;
}
exports.reorderErrors = reorderErrors;
//# sourceMappingURL=reorder-errors.cjs.map

File diff suppressed because one or more lines are too long