1 | {"version":3,"file":"react-server.esm.mjs","sources":["../src/logic/appendErrors.ts","../src/utils/compact.ts","../src/utils/isNullOrUndefined.ts","../src/utils/isDateObject.ts","../src/utils/isObject.ts","../src/utils/isUndefined.ts","../src/utils/get.ts","../src/utils/isKey.ts","../src/utils/stringToPath.ts","../src/utils/set.ts"],"sourcesContent":["import {\n InternalFieldErrors,\n InternalFieldName,\n ValidateResult,\n} from '../types';\n\nexport default (\n name: InternalFieldName,\n validateAllFieldCriteria: boolean,\n errors: InternalFieldErrors,\n type: string,\n message: ValidateResult,\n) =>\n validateAllFieldCriteria\n ? {\n ...errors[name],\n types: {\n ...(errors[name] && errors[name]!.types ? errors[name]!.types : {}),\n [type]: message || true,\n },\n }\n : {};\n","export default <TValue>(value: TValue[]) =>\n Array.isArray(value) ? value.filter(Boolean) : [];\n","export default (value: unknown): value is null | undefined => value == null;\n","export default (value: unknown): value is Date => value instanceof Date;\n","import isDateObject from './isDateObject';\nimport isNullOrUndefined from './isNullOrUndefined';\n\nexport const isObjectType = (value: unknown): value is object =>\n typeof value === 'object';\n\nexport default <T extends object>(value: unknown): value is T =>\n !isNullOrUndefined(value) &&\n !Array.isArray(value) &&\n isObjectType(value) &&\n !isDateObject(value);\n","export default (val: unknown): val is undefined => val === undefined;\n","import compact from './compact';\nimport isNullOrUndefined from './isNullOrUndefined';\nimport isObject from './isObject';\nimport isUndefined from './isUndefined';\n\nexport default <T>(object: T, path?: string, defaultValue?: unknown): any => {\n if (!path || !isObject(object)) {\n return defaultValue;\n }\n\n const result = compact(path.split(/[,[\\].]+?/)).reduce(\n (result, key) =>\n isNullOrUndefined(result) ? result : result[key as keyof {}],\n object,\n );\n\n return isUndefined(result) || result === object\n ? isUndefined(object[path as keyof T])\n ? defaultValue\n : object[path as keyof T]\n : result;\n};\n","export default (value: string) => /^\\w*$/.test(value);\n","import compact from './compact';\n\nexport default (input: string): string[] =>\n compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n","import { FieldValues } from '../types';\n\nimport isKey from './isKey';\nimport isObject from './isObject';\nimport stringToPath from './stringToPath';\n\nexport default (object: FieldValues, path: string, value?: unknown) => {\n let index = -1;\n const tempPath = isKey(path) ? [path] : stringToPath(path);\n const length = tempPath.length;\n const lastIndex = length - 1;\n\n while (++index < length) {\n const key = tempPath[index];\n let newValue = value;\n\n if (index !== lastIndex) {\n const objValue = object[key];\n newValue =\n isObject(objValue) || Array.isArray(objValue)\n ? objValue\n : !isNaN(+tempPath[index + 1])\n ? []\n : {};\n }\n\n if (key === '__proto__') {\n return;\n }\n\n object[key] = newValue;\n object = object[key];\n }\n return object;\n};\n"],"names":[],"mappings":"AAMA,mBAAe,CACb,IAAuB,EACvB,wBAAiC,EACjC,MAA2B,EAC3B,IAAY,EACZ,OAAuB,KAEvB,wBAAwB;AACtB,MAAE;QACE,GAAG,MAAM,CAAC,IAAI,CAAC;AACf,QAAA,KAAK,EAAE;YACL,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAE,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAE,CAAC,KAAK,GAAG,EAAE,CAAC;AACnE,YAAA,CAAC,IAAI,GAAG,OAAO,IAAI,IAAI;AACxB,SAAA;AACF,KAAA;MACD,EAAE;;ACrBR,cAAe,CAAS,KAAe,KACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE;;ACDnD,wBAAe,CAAC,KAAc,KAAgC,KAAK,IAAI,IAAI;;ACA3E,mBAAe,CAAC,KAAc,KAAoB,KAAK,YAAY,IAAI;;ACGhE,MAAM,YAAY,GAAG,CAAC,KAAc,KACzC,OAAO,KAAK,KAAK,QAAQ,CAAC;AAE5B,eAAe,CAAmB,KAAc,KAC9C,CAAC,iBAAiB,CAAC,KAAK,CAAC;AACzB,IAAA,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IACrB,YAAY,CAAC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