@archduck/gst-core 0.1.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.
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/dist/chunks/core-Wpl1tnO4.js +35 -0
- package/dist/chunks/core-Wpl1tnO4.js.map +1 -0
- package/dist/chunks/core-ovxYfJ25.js +2362 -0
- package/dist/chunks/core-ovxYfJ25.js.map +1 -0
- package/dist/chunks/loaders-B7J79C97.js +606 -0
- package/dist/chunks/loaders-B7J79C97.js.map +1 -0
- package/dist/chunks/loaders-BEwXPBCN.js +2 -0
- package/dist/chunks/loaders-BEwXPBCN.js.map +1 -0
- package/dist/chunks/mergeConfigs-CRhPUSCj.js +191 -0
- package/dist/chunks/mergeConfigs-CRhPUSCj.js.map +1 -0
- package/dist/chunks/mergeConfigs-Dgwcseh2.js +2 -0
- package/dist/chunks/mergeConfigs-Dgwcseh2.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +41 -0
- package/dist/core.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders.cjs +2 -0
- package/dist/loaders.cjs.map +1 -0
- package/dist/loaders.js +19 -0
- package/dist/loaders.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders-B7J79C97.js","sources":["../../../gst-compose/src/compose.js","../../src/utils/fileLoader.js","../../src/utils/bulkApply.js","../../src/utils/registryMapping.js","../../src/utils/applyMap.js","../../src/loaders/namespaceLoader.js","../../src/utils/schemaHelpers.js","../../src/LiveConfig.js"],"sourcesContent":["/**\n * Core composition functions\n *\n * Rules:\n * 1. Primitives pass through unchanged\n * 2. Arrays replace by default; use \"...\" marker to spread previous\n * 3. Objects replace by default; use \"...\": \"^\" to spread from target (previous layer)\n * 4. \"__source\" property brings definitions into scope for spread resolution\n * - __source: \"path\" - resolve path from scope, merge into local scope\n * - __source: [\"path1\", \"path2\"] - merge multiple sources\n * - __source: null - cancel sourcing, empty scope\n * 5. \"%name\" in arrays resolves a named group from the target array\n */\n\n/**\n * Check if value is a plain object (not array, null, etc.)\n */\nfunction isPlainObject(value) {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n}\n\n/**\n * Resolve a dot-notation reference from an object\n *\n * @param {string} ref - Reference string (e.g., \"email\", \"stdlib.fields.email\")\n * @param {Object} source - Object to resolve from\n * @returns {any} Resolved value or undefined\n */\nfunction resolveRef(ref, source) {\n if (!ref || typeof ref !== \"string\") return undefined\n\n const parts = ref.split(\".\")\n let current = source\n\n for (const part of parts) {\n if (current === undefined || current === null) return undefined\n current = current[part]\n }\n\n return current\n}\n\n/**\n * Apply source onto target with spread/__source resolution\n *\n * @param {any} target - Current accumulated value\n * @param {any} source - New value to apply\n * @param {Object} scope - Available definitions for spread resolution\n * @returns {any} Resulting value\n */\nexport function apply(target, source, scope = {}) {\n // Primitives: source wins\n if (source === null || source === undefined) {\n return source\n }\n\n if (typeof source !== \"object\") {\n return source\n }\n\n // Arrays\n if (Array.isArray(source)) {\n return applyArray(target, source, scope)\n }\n\n // Objects\n return applyObject(target, source, scope)\n}\n\n/**\n * Apply array with spread and %group support\n *\n * \"...\" marker splices the previous array.\n * \"%name\" resolves a named group from the target array.\n */\nfunction applyArray(target, source, scope) {\n const hasSpread = source.indexOf(\"...\") !== -1\n const hasGroupRefs = source.some(item => typeof item === \"string\" && item.startsWith(\"%\"))\n\n // Check if source has named objects that could match named groups in target\n const targetHasNamedGroups = Array.isArray(target) && target.some(item => isPlainObject(item) && item.name)\n const sourceHasNamedObjects = source.some(item => isPlainObject(item) && item.name)\n\n // Use group-aware resolution when we have %refs OR named objects matching named target groups\n if (hasGroupRefs || (targetHasNamedGroups && sourceHasNamedObjects)) {\n return resolveGroupRefs(target, source, scope)\n }\n\n if (!hasSpread) {\n // No spread marker - recurse into elements\n return source.map(item => {\n if (isPlainObject(item)) {\n return apply({}, item, scope)\n }\n return item\n })\n }\n\n // Has spread marker - splice in target array\n const spreadIndex = source.indexOf(\"...\")\n const previousArray = Array.isArray(target) ? target : []\n\n const before = source.slice(0, spreadIndex)\n const after = source.slice(spreadIndex + 1)\n\n const processedBefore = before.map(item =>\n isPlainObject(item) ? apply({}, item, scope) : item,\n )\n const processedAfter = after.map(item =>\n isPlainObject(item) ? apply({}, item, scope) : item,\n )\n\n return [...processedBefore, ...previousArray, ...processedAfter]\n}\n\n/**\n * Resolve %groupName references in a layout array.\n *\n * \"%personal\" pulls the group named \"personal\" from the target array unchanged.\n * A named object replaces the matching group from the target.\n * Objects without names are appended.\n */\nfunction resolveGroupRefs(target, source, scope) {\n const targetArray = Array.isArray(target) ? target : []\n\n // Index target groups by name\n const targetByName = {}\n for (const item of targetArray) {\n if (isPlainObject(item) && item.name) {\n targetByName[item.name] = item\n }\n }\n\n const result = []\n for (const item of source) {\n if (item === \"...\") {\n // Spread marker: splice in all target items (same as normal array spread)\n for (const t of targetArray) {\n result.push(t)\n }\n } else if (typeof item === \"string\" && item.startsWith(\"%\")) {\n const groupName = item.slice(1)\n const group = targetByName[groupName]\n if (group) {\n result.push(group)\n } else {\n console.warn(`[gst-compose] %${groupName}: no group named \"${groupName}\" in target layout`)\n }\n } else if (isPlainObject(item)) {\n // If this named group matches one in target, use the target group as the apply target\n const matchingTarget = item.name && targetByName[item.name] ? targetByName[item.name] : {}\n const processed = apply(matchingTarget, item, scope)\n result.push(processed)\n } else {\n // Plain strings (field references in layout rows) pass through\n result.push(item)\n }\n }\n\n return result\n}\n\n/**\n * Apply object with __source/spread support\n *\n * Objects can have:\n * - \"__source\": \"key\" - Brings definitions into scope\n * - \"...\": \"key\" - Spreads from scope\n * - \"...\": \"^\" - Spreads from target (previous layer)\n */\nfunction applyObject(target, source, scope) {\n let currentScope = scope\n let baseObject = {}\n\n // Handle \"__source\" - brings definitions into scope.\n // Does NOT merge sourced definitions into the result.\n if (\"__source\" in source) {\n const sourceRef = source.__source\n\n if (\n sourceRef === null ||\n (isPlainObject(sourceRef) && Object.keys(sourceRef).length === 0)\n ) {\n currentScope = {}\n } else {\n const refs = Array.isArray(sourceRef) ? sourceRef : [sourceRef]\n for (const ref of refs) {\n if (typeof ref === \"string\") {\n const resolved = resolveRef(ref, scope)\n if (resolved && isPlainObject(resolved)) {\n currentScope = { ...currentScope, ...resolved }\n }\n }\n }\n }\n }\n\n // Handle \"...\" spread property\n if (\"...\" in source) {\n const spreadRef = source[\"...\"]\n const refs = Array.isArray(spreadRef) ? spreadRef : [spreadRef]\n let anyUnresolved = false\n\n for (const ref of refs) {\n if (ref === \"^\") {\n // Spread from target (previous layer)\n if (isPlainObject(target)) {\n baseObject = { ...baseObject, ...target }\n }\n } else if (typeof ref === \"string\") {\n // Spread from scope\n const resolved = resolveRef(ref, currentScope)\n if (isPlainObject(resolved)) {\n baseObject = { ...baseObject, ...resolved }\n } else {\n anyUnresolved = true\n }\n }\n }\n\n // Preserve unresolved spreads for runtime resolution\n if (anyUnresolved && Object.keys(currentScope).length > 0) {\n baseObject[\"...\"] = spreadRef\n }\n }\n\n // Build result: base + rest of source (excluding __source and ...)\n const result = { ...baseObject }\n\n // Detect whether this object is a registry (where string values are\n // definition references) vs an already-resolved definition (where\n // string values are data). Registry objects have __source, or contain\n // \"^\" self-references, \"{{\" dynamic props, or spread definitions\n // (an entry with \"...\" indicates siblings are registry entries too).\n // NOTE: Only check non-reserved keys (\"...\" and \"__source\" are directives,\n // not evidence of registry context).\n const isRegistryContext = \"__source\" in source ||\n Object.entries(source).some(([k, v]) =>\n k !== \"...\" && k !== \"__source\" && (\n v === \"^\" ||\n (typeof v === \"string\" && v.startsWith(\"{{\")) ||\n (isPlainObject(v) && \"...\" in v)\n )\n )\n\n for (const [key, value] of Object.entries(source)) {\n if (key === \"__source\" || key === \"...\") continue\n\n // Handle self-reference: \"^\" or \"email\": \"email\" (key === value)\n // Both mean \"use the definition for this key from scope\"\n if (value === \"^\" || value === key) {\n const resolved = resolveRef(key, currentScope)\n if (resolved !== undefined) {\n result[key] = isPlainObject(resolved) ? { ...resolved } : resolved\n continue\n }\n }\n\n // Handle string references: \"address\": \"addressUS\" resolves from scope.\n // This is a registry-level pattern where a key names an entry and the\n // string value references a definition. Only resolve when the source\n // object looks like a registry (__source present, or no non-string\n // sibling values indicating it's already a resolved definition).\n if (typeof value === \"string\" && isRegistryContext && currentScope[value] !== undefined) {\n const resolved = resolveRef(value, currentScope)\n if (resolved !== undefined && isPlainObject(resolved)) {\n result[key] = { ...resolved }\n continue\n }\n }\n\n // Recurse into nested objects/arrays\n if (isPlainObject(value)) {\n const targetValue = isPlainObject(result[key]) ? result[key] : {}\n result[key] = apply(targetValue, value, currentScope)\n } else if (Array.isArray(value)) {\n const targetValue = Array.isArray(result[key]) ? result[key] : []\n result[key] = apply(targetValue, value, currentScope)\n } else {\n result[key] = value\n }\n }\n\n return result\n}\n\n/**\n * Reduce multiple inputs into a single result\n *\n * @param {Array} inputs - Array of sources to apply in order\n * @param {any} initial - Initial value (default: {})\n * @param {Object} scope - Available definitions for spread resolution\n * @returns {any} Final result\n */\nexport function reduce(inputs, initial = {}, scope = {}) {\n let result = initial\n\n for (const input of inputs) {\n result = apply(result, input, scope)\n }\n\n return result\n}\n","// src/utils/fileLoader.js\n\n// Security: Allowed protocols for config loading\nconst ALLOWED_PROTOCOLS = ['https:', 'http:', 'file:']\n\n// Security: Blocked hosts to prevent SSRF attacks\nconst BLOCKED_HOSTS = [\n 'localhost',\n '127.0.0.1',\n '0.0.0.0',\n '169.254.169.254', // AWS metadata endpoint\n '::1', // IPv6 localhost\n 'metadata.google.internal', // GCP metadata\n]\n\n/**\n * Check if we're in development mode (not production, not test)\n * Uses import.meta.env.MODE which is set by Vite/Vitest\n */\nfunction isDevMode() {\n // Vitest sets MODE to 'test', Vite dev sets it to 'development'\n // We only want to skip security checks in development mode, not in tests\n return typeof import.meta !== 'undefined' &&\n import.meta.env?.MODE === 'development'\n}\n\n/**\n * Validates URL for security concerns before loading\n * @param {string} urlString - URL to validate\n * @throws {Error} if URL is potentially dangerous\n */\nfunction validateUrl(urlString) {\n // Skip security checks in development mode (Vite runs on localhost)\n if (isDevMode()) {\n return\n }\n\n try {\n const url = new URL(urlString, window.location.href)\n\n // Check protocol\n if (!ALLOWED_PROTOCOLS.includes(url.protocol)) {\n throw new Error(`Security: Blocked protocol \"${url.protocol}\" - only ${ALLOWED_PROTOCOLS.join(', ')} allowed`)\n }\n\n // Check for blocked hosts (case-insensitive)\n const hostname = url.hostname.toLowerCase()\n if (BLOCKED_HOSTS.some(blocked => hostname === blocked || hostname.endsWith(`.${blocked}`))) {\n throw new Error(`Security: Blocked host \"${url.hostname}\" - potential SSRF attempt`)\n }\n\n // Block private IP ranges (basic check)\n if (hostname.startsWith('10.') ||\n hostname.startsWith('192.168.') ||\n /^172\\.(1[6-9]|2[0-9]|3[0-1])\\./.test(hostname)) {\n throw new Error(`Security: Blocked private IP address \"${hostname}\"`)\n }\n\n } catch (error) {\n // Re-throw our security errors\n if (error.message.startsWith('Security:')) {\n throw error\n }\n // For relative URLs or parsing errors, allow them (they're typically safe)\n // They'll be resolved relative to current origin\n return\n }\n}\n\nexport async function loadFile(url) {\n // Security: Validate URL before fetching\n validateUrl(url)\n\n const response = await fetch(url)\n if (!response.ok) throw new Error(`Failed to load ${url}: ${response.statusText}`)\n\n const text = await response.text()\n return JSON.parse(text)\n}\n","/**\n * Bulk Apply - Apply properties to multiple entries at once\n *\n * Uses a structured `bulkApply` array inside any TLP object:\n *\n * \"bulkApply\": [\n * { \"required\": true, \"targets\": [\"firstName\", \"lastName\", \"email\"] },\n * { \"type\": \"tel\", \"targets\": [\"phone\", \"workPhone\", \"cellPhone\"] },\n * { \"style\": { \"fontFamily\": \"monospace\" }, \"targets\": [\"ssn\", \"dob\"] }\n * ]\n *\n * Each entry has a `targets` array (reserved key) listing which entries to apply to.\n * All other keys in the entry are treated as properties to merge onto each target.\n */\n\nimport { logger } from './logger.js'\n\n/**\n * Process the bulkApply array in a TLP object.\n *\n * Extracts the `bulkApply` key, applies each entry's properties to its\n * targets, and returns a new object with `bulkApply` removed and properties\n * merged. Target entries that don't exist are created. String references\n * are wrapped in spread syntax.\n *\n * @param {Object} tlp - A top-level property object (e.g. fields, buttons)\n * @returns {Object} New object with bulkApply removed and properties applied\n */\nexport function processBulkApply(tlp) {\n if (!tlp || typeof tlp !== 'object' || Array.isArray(tlp)) return tlp\n\n const bulkEntries = tlp.bulkApply\n if (!Array.isArray(bulkEntries) || bulkEntries.length === 0) return tlp\n\n // Copy everything except bulkApply\n const { bulkApply: _, ...result } = tlp\n\n for (const entry of bulkEntries) {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {\n logger.warn('bulk-apply: entry must be an object, skipping')\n continue\n }\n\n const { targets, ...props } = entry\n\n if (!Array.isArray(targets) || targets.length === 0) {\n logger.warn('bulk-apply: entry missing targets array, skipping')\n continue\n }\n\n if (Object.keys(props).length === 0) {\n logger.warn('bulk-apply: entry has no properties to apply, skipping')\n continue\n }\n\n for (const target of targets) {\n if (typeof target !== 'string') {\n logger.warn(`bulk-apply: target must be a string, got ${typeof target}`)\n continue\n }\n\n const existing = result[target]\n\n if (existing && typeof existing === 'object' && !Array.isArray(existing)) {\n // Merge onto existing entry - bulk-apply wins\n result[target] = { ...existing, ...props }\n } else if (existing === undefined) {\n // Create a new entry with just these properties\n result[target] = { ...props }\n } else if (typeof existing === 'string') {\n // String reference -> wrap in spread with bulk properties\n const ref = existing === '^' ? target : existing\n result[target] = { '...': ref, ...props }\n } else {\n logger.warn(`bulk-apply: target \"${target}\" is not an object definition, skipping`)\n }\n }\n }\n\n // Recurse into entries that have nested `fields` blocks (constructions)\n for (const [key, value] of Object.entries(result)) {\n if (value && typeof value === 'object' && !Array.isArray(value) && value.fields && typeof value.fields === 'object') {\n const processedFields = processBulkApply(value.fields)\n if (processedFields !== value.fields) {\n result[key] = { ...value, fields: processedFields }\n }\n }\n }\n\n return result\n}\n","/**\n * Transform raw loaded config into the shape the renderer expects.\n *\n * Three steps, each a separate exported function:\n * 1. mergeFunctions - merge loaded + additional functions into one object\n * 2. mapRegistries - route TLP data into the flat registries object\n * 3. buildFormConfig - orchestrate everything into the final output\n */\n\nimport { processBulkApply } from './bulkApply.js'\n\n/**\n * Get a value from a nested object using dot notation.\n */\nexport function getPath(obj, path) {\n if (!obj || typeof obj !== 'object') return undefined\n if (!path || typeof path !== 'string') return undefined\n\n let current = obj\n for (const part of path.split('.')) {\n if (current == null || typeof current !== 'object') return undefined\n current = current[part]\n }\n return current\n}\n\n/**\n * Merge loaded functions with additional functions.\n * Functions must be real JS functions (from functions.js or registered by the app).\n * String function bodies are not supported -- no `new Function()` compilation.\n */\nexport function mergeFunctions(loadedFunctions, additionalFunctions = {}) {\n let base = loadedFunctions || {}\n if (base.default) base = base.default\n\n return { ...base, ...additionalFunctions }\n}\n\n/**\n * Map loaded config data to a flat registry structure.\n *\n * The mapping object maps source paths (e.g., 'actions.buttons')\n * to target registry keys (e.g., 'buttons'). Multiple sources can\n * contribute to the same target.\n */\nexport function mapRegistries(loaded, mapping = {}) {\n const registries = {}\n\n for (const [sourcePath, targetKey] of Object.entries(mapping)) {\n const sourceValue = getPath(loaded, sourcePath)\n const existingValue = registries[targetKey]\n\n if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {\n registries[targetKey] = { ...existingValue, ...sourceValue }\n } else if (sourceValue !== undefined) {\n registries[targetKey] = sourceValue\n } else if (!existingValue) {\n registries[targetKey] = {}\n }\n }\n\n return registries\n}\n\n/**\n * Extract the actions structure (buttonSet, buttons, hooks).\n */\nexport function extractActions(loaded, registries) {\n const actions = loaded.actions || {}\n const meta = loaded.meta || {}\n const buttonSet = actions.buttonSet ?? meta.buttonSet\n\n return {\n buttonSet,\n buttons: registries.buttons || {},\n hooks: registries.hooks || {}\n }\n}\n\n/**\n * Build the final config from raw loaded data.\n *\n * Steps:\n * 1. Merge and compile functions\n * 2. Process bulkApply arrays\n * 3. Map to registries\n * 4. Extract actions\n * 5. Assemble output\n */\nexport function buildFormConfig(loaded, options = {}) {\n const { mapping = {}, functions: additionalFunctions = {} } = options\n\n // 1. Merge functions\n const functions = mergeFunctions(loaded.functions, additionalFunctions)\n\n // 2. Process bulkApply\n const processed = {}\n for (const [key, value] of Object.entries(loaded)) {\n processed[key] = processBulkApply(value)\n }\n processed.functions = functions\n\n // 3. Map to registries\n const registries = mapRegistries(processed, mapping)\n\n // 4. Extract actions\n const actions = extractActions(processed, registries)\n\n // 5. Assemble output\n const meta = processed.meta || {}\n const record = processed.record && Object.keys(processed.record).length > 0\n ? processed.record\n : null\n\n // Set initialRecord from the record TLP, but don't clobber\n // an initialRecord the form explicitly set in its meta.\n if (record && !meta.initialRecord) {\n meta.initialRecord = record\n }\n\n return {\n meta,\n layout: processed.layout || [],\n registries,\n actions,\n styles: loaded.styles || null,\n record,\n state: processed.state || {},\n }\n}\n","/**\n * Apply a string replacement map to a config object.\n *\n * Recursively walks the object and replaces any string values\n * that match keys in the map.\n *\n * @param {object} config - The config object to transform\n * @param {object} map - Key/value pairs for string replacement\n * @returns {object} - New config with strings replaced\n *\n * @example\n * const config = {\n * meta: { title: 'Contact Us' },\n * fields: {\n * name: { label: 'Your Name' },\n * email: { label: 'Email Address' }\n * }\n * }\n *\n * const spanishMap = {\n * 'Contact Us': 'Contáctenos',\n * 'Your Name': 'Tu Nombre',\n * 'Email Address': 'Correo Electrónico'\n * }\n *\n * const result = applyMap(config, spanishMap)\n * // result.meta.title === 'Contáctenos'\n * // result.fields.name.label === 'Tu Nombre'\n */\nexport function applyMap(config, map) {\n if (!config || !map || typeof map !== 'object') {\n return config\n }\n\n return walkAndReplace(config, map)\n}\n\n/**\n * Recursively walk an object/array and replace strings.\n */\nfunction walkAndReplace(value, map) {\n // String - look up in map\n if (typeof value === 'string') {\n return Object.hasOwn(map, value) ? map[value] : value\n }\n\n // Array - recurse into each element\n if (Array.isArray(value)) {\n return value.map((item) => walkAndReplace(item, map))\n }\n\n // Object - recurse into each property\n if (value !== null && typeof value === 'object') {\n const result = {}\n for (const key of Object.keys(value)) {\n result[key] = walkAndReplace(value[key], map)\n }\n return result\n }\n\n // Primitives (number, boolean, null, undefined) - pass through\n return value\n}\n\n/**\n * Merge multiple maps together, later maps override earlier.\n *\n * @param {...object} maps - Maps to merge\n * @returns {object} - Merged map\n *\n * @example\n * const globalMap = { 'Submit': 'Enviar', 'Cancel': 'Cancelar' }\n * const localMap = { 'Submit': 'Guardar' } // override\n * const merged = mergeMaps(globalMap, localMap)\n * // merged['Submit'] === 'Guardar'\n * // merged['Cancel'] === 'Cancelar'\n */\nexport function mergeMaps(...maps) {\n return Object.assign({}, ...maps.filter(Boolean))\n}\n","/**\n * Namespace-based configuration loader\n *\n * Loads TLPs in dependency order, applies patches, then maps.\n *\n * Resolution order (from TLP schema dependency graph):\n * functions -> no deps\n * optionSets -> no deps\n * actions -> refs functions (contains defs, buttons[], hooks)\n * fields -> refs functions, optionSets, actions.buttons\n * components -> refs fields (partial application)\n * meta -> no deps\n * state -> no deps\n * layout -> refs fields, components, actions\n * record -> standalone\n * styles -> standalone\n */\n\nimport { apply } from '@archduck/gst-compose'\nimport { loadFile } from '@/utils/fileLoader.js'\nimport { buildFormConfig } from '@/utils/registryMapping.js'\nimport { applyMap, mergeMaps } from '@/utils/applyMap.js'\nimport { trace, isDebugActive } from '@/utils/gstDebug.js'\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\n/**\n * Propagate a top-level `show` property to each entry that doesn't\n * already have its own `show`. Convenience for patch files: write\n * `show` once at the top instead of on every field.\n */\nfunction propagateShow(data) {\n if (!data.show) return data\n const { show, ...entries } = data\n const result = {}\n for (const [key, value] of Object.entries(entries)) {\n if (isPlainObject(value) && !value.show) {\n result[key] = { ...value, show }\n } else {\n result[key] = value\n }\n }\n return result\n}\n\n/**\n * Resolve __include references recursively.\n * __include: \"./file.json\" loads the file and merges remaining props on top.\n */\nasync function resolveIncludes(value, basePath) {\n if (value === null || value === undefined || typeof value !== 'object') {\n return value\n }\n\n if (Array.isArray(value)) {\n const result = []\n for (const item of value) {\n result.push(await resolveIncludes(item, basePath))\n }\n return result\n }\n\n if (value.__include) {\n const includePath = value.__include\n const { __include: _, ...rest } = value\n\n if (includePath.endsWith('.html') || includePath.endsWith('.htm')) {\n try {\n const response = await fetch(`${basePath}/${includePath}`)\n if (response.ok) {\n const html = await response.text()\n return { component: 'html', content: html, ...rest }\n }\n } catch { /* fall through */ }\n return Object.keys(rest).length > 0 ? rest : {}\n }\n\n const included = await tryLoadFile(basePath, includePath)\n if (included) {\n const resolved = await resolveIncludes(included, basePath)\n const hasOverrides = Object.keys(rest).length > 0\n return isPlainObject(resolved) && hasOverrides\n ? { ...resolved, ...rest }\n : resolved\n }\n return Object.keys(rest).length > 0 ? rest : {}\n }\n\n const result = {}\n for (const [key, val] of Object.entries(value)) {\n result[key] = await resolveIncludes(val, basePath)\n }\n return result\n}\n\n// ============================================================================\n// File loading helpers\n// ============================================================================\n\nasync function tryLoadFile(basePath, filename) {\n try {\n return await loadFile(`${basePath}/${filename}`)\n } catch {\n return null\n }\n}\n\nasync function loadConsolidatedConfig(basePath) {\n try {\n return await loadFile(`${basePath}/form.json`) || {}\n } catch {\n return {}\n }\n}\n\nfunction inferNamespace(path) {\n const dirName = path.split('/').pop()\n if (!dirName || dirName === '.' || dirName === 'src') return null\n return dirName.toLowerCase()\n}\n\nfunction inferRootPath(path) {\n const parts = path.split('/')\n return `${parts.slice(0, -2).join('/') || '.'}/base`\n}\n\n// ============================================================================\n// Manifest parsing\n// ============================================================================\n\n/**\n * Parse a manifest (array of filenames) to discover patches and maps.\n *\n * Patches are discovered from files matching property-variant.json.\n * Maps are discovered from files matching property~mapName.json.\n */\nfunction parseManifest(filenames) {\n const files = new Set(filenames)\n const patches = new Set()\n const maps = new Set()\n\n for (const name of filenames) {\n if (name.includes('~')) {\n const mapMatch = name.match(/~([a-z][a-z0-9]*)\\.json$/)\n if (mapMatch) maps.add(mapMatch[1])\n continue\n }\n const patchMatch = name.match(/^[a-z]+-([a-z][a-z0-9-]*)\\.json$/)\n if (patchMatch) patches.add(patchMatch[1])\n }\n\n return { files, patches: [...patches].sort(), maps: [...maps].sort() }\n}\n\n// ============================================================================\n// Core loading: gather layers for a property and compose them\n// ============================================================================\n\n/**\n * Load all layers for a single TLP and compose them.\n *\n * Layer order (lowest to highest priority):\n * 1. Property from consolidated form.json\n * 2. Namespace file (./PatientView/fields.json)\n *\n * Base content is NOT loaded here. Use meta.source to pull in\n * base entries explicitly.\n *\n * When a manifest is provided, namespace files are only fetched\n * if they appear in the manifest.\n */\nasync function loadProperty(basePath, namespace, property, scope, consolidatedConfig, getDefault, manifestFiles, sourceValue) {\n const layers = []\n\n // Only fetch namespace file if manifest confirms it exists (or no manifest)\n const shouldFetch = namespace && (!manifestFiles || manifestFiles.has(`${property}.json`))\n const nsContent = shouldFetch ? await tryLoadFile(basePath, `${property}.json`) : null\n\n if (consolidatedConfig[property] !== undefined) {\n layers.push(await resolveIncludes(consolidatedConfig[property], basePath))\n }\n\n if (nsContent !== null) {\n layers.push(await resolveIncludes(nsContent, basePath))\n }\n\n // When no form files define this property, use source value or default.\n // Source entries provide base definitions (functions, optionSets, etc.)\n // that forms inherit without needing their own files.\n if (layers.length === 0) {\n if (isDebugActive()) {\n trace('config', `load-property \"${property}\"`, 'no files found (using default)', {\n property, basePath, namespace, hasSource: sourceValue !== undefined\n })\n }\n return sourceValue ?? getDefault(property)\n }\n\n if (isDebugActive()) {\n trace('config', `load-property \"${property}\"`, `${layers.length} layer(s) found`, {\n property, layerCount: layers.length,\n hasConsolidated: consolidatedConfig[property] !== undefined,\n hasSource: sourceValue !== undefined,\n namespace\n })\n }\n\n // Compose layers on top of source value (or default).\n // Source entries provide the starting accumulator; the form's\n // layers compose on top via apply() with replace-by-default.\n // Fields pull in base entries explicitly with \"^\" or \"...\" spreads.\n let result = sourceValue ?? getDefault(property)\n let currentScope = scope\n\n // Flatten scope.base entries for spread resolution (so \"...\": \"email\"\n // resolves to base.fields.email without needing __source)\n if (isPlainObject(scope.base?.[property])) {\n currentScope = { ...currentScope, ...scope.base[property] }\n }\n\n for (let i = 0; i < layers.length; i++) {\n result = apply(result, layers[i], currentScope)\n currentScope = { ...currentScope, [property]: result }\n }\n\n return result\n}\n\n// ============================================================================\n// Main entry point\n// ============================================================================\n\n/**\n * Load a form configuration from a namespace directory.\n *\n * @param {string} path - Path to form directory (e.g., './PatientView')\n * @param {Object} [options={}] - Loading options\n * @param {string} [options.rootPath] - Base config path (default: inferred)\n * @param {string} [options.namespace] - Override namespace (default: inferred)\n * @param {Object} [options.scope] - Initial scope for spread resolution\n * @param {Object} [options.functions] - Additional functions to merge\n * @param {string[]} [options.patches] - Caller-driven patches\n * @param {string} [options.map] - Translation map name (e.g., 'es')\n * @param {Object} [options.schema] - TLP schema from createTLPSchema()\n * @param {string[]} [options.manifest] - File list for patch/map autodiscovery\n * @returns {Promise<Object>} Resolved form configuration\n */\nexport async function loadJsonConfig(path, options = {}) {\n const { schema } = options\n\n if (!schema) {\n throw new Error(\n 'loadJsonConfig requires options.schema. ' +\n 'Pass a TLP schema from createTLPSchema(), or use the loadJsonConfig wrapper from @archduck/gst-forms.'\n )\n }\n\n const rootPath = options.rootPath || inferRootPath(path)\n const basePath = path\n const namespace = options.namespace || inferNamespace(path)\n\n // Load consolidated config and manifest in parallel\n const [consolidatedConfig, manifest] = await Promise.all([\n loadConsolidatedConfig(path),\n options.manifest\n ? Promise.resolve(parseManifest(options.manifest))\n : tryLoadFile(basePath, 'manifest.json').then(\n m => Array.isArray(m) ? parseManifest(m) : null\n )\n ])\n\n // ==================================================================\n // Phase 1: Peek at meta.source, then load all TLPs in parallel\n //\n // meta.source determines which scope entries become the initial\n // accumulator for each TLP. We peek at it from raw config data\n // before composition so ALL TLPs (including meta) get their\n // source accumulator during loadProperty. Forms pull in base\n // entries explicitly with \"^\" or \"...\" spreads.\n // ==================================================================\n\n const scope = { ...options.scope }\n const loaded = {}\n\n // Peek at meta.source from raw data (before composition)\n let peekSource = consolidatedConfig.meta?.source\n if (!peekSource && namespace) {\n const rawMeta = (!manifest || manifest?.files.has('meta.json'))\n ? await tryLoadFile(basePath, 'meta.json')\n : null\n if (rawMeta?.source) peekSource = rawMeta.source\n }\n\n // Resolve source entries from scope\n let sourceEntries = null\n if (peekSource) {\n const initialScope = options.scope || {}\n if (typeof peekSource === 'string') {\n sourceEntries = initialScope[peekSource] || null\n } else if (isPlainObject(peekSource)) {\n sourceEntries = {}\n for (const [scopeName, props] of Object.entries(peekSource)) {\n const obj = initialScope[scopeName]\n if (!obj) continue\n for (const prop of (Array.isArray(props) ? props : [])) {\n if (obj[prop] !== undefined) sourceEntries[prop] = obj[prop]\n }\n }\n }\n }\n\n // Load all TLPs in parallel with source accumulators\n const results = await Promise.all(\n schema.resolutionOrder.map(property =>\n loadProperty(basePath, namespace, property, scope, consolidatedConfig, schema.getDefault, manifest?.files, sourceEntries?.[property])\n )\n )\n for (let i = 0; i < schema.resolutionOrder.length; i++) {\n loaded[schema.resolutionOrder[i]] = results[i]\n }\n\n // ==================================================================\n // Phase 3: Apply patches\n //\n // Sources (highest to lowest priority):\n // 1. Per-TLP file: fields-hipaa.json\n // 2. Consolidated patch file: form-hipaa.json\n // 3. Inline patch from form.json patches key\n //\n // Patch names come from meta.patches (form-driven, applied first)\n // and options.patches (caller-driven, applied after).\n // ==================================================================\n\n const inlinePatches = isPlainObject(consolidatedConfig.patches)\n ? consolidatedConfig.patches\n : await tryLoadFile(basePath, 'patches.json') || {}\n\n // Patch sources: meta.patches (form-driven), manifest (autodiscovered), options.patches (caller-driven)\n // When manifest exists and meta.patches is absent, autodiscover patches alphabetically.\n // meta.patches, when present, acts as whitelist + ordering.\n const formPatches = Array.isArray(loaded.meta?.patches)\n ? loaded.meta.patches\n : (manifest ? manifest.patches : [])\n const callerPatches = Array.isArray(options.patches) ? options.patches : []\n const allPatches = [...formPatches, ...callerPatches]\n\n if (allPatches.length > 0) {\n // Build patch scope: source entries + loaded TLPs + flattened registries.\n // Source entries (e.g., base.fields) are flattened first so patches can\n // spread from base definitions like \"...\": \"date\".\n let patchScope = { ...options.scope }\n for (const prop of schema.resolutionOrder) {\n // Flatten source registry entries into scope (base definitions)\n if (sourceEntries?.[prop] && isPlainObject(sourceEntries[prop]) && schema.declarations[prop]?.registry) {\n patchScope = { ...patchScope, ...sourceEntries[prop] }\n }\n if (!loaded[prop]) continue\n patchScope[prop] = loaded[prop]\n if (isPlainObject(loaded[prop]) && schema.declarations[prop]?.registry) {\n patchScope = { ...patchScope, ...loaded[prop] }\n }\n }\n\n for (const patchName of allPatches) {\n // With manifest, only fetch files that exist. Without, try speculatively.\n const [consolidatedPatch, ...perTlpFiles] = await Promise.all([\n (!manifest || manifest.files.has(`form-${patchName}.json`))\n ? tryLoadFile(basePath, `form-${patchName}.json`)\n : Promise.resolve(null),\n ...schema.resolutionOrder.map(prop =>\n (!manifest || manifest.files.has(`${prop}-${patchName}.json`))\n ? tryLoadFile(basePath, `${prop}-${patchName}.json`)\n : Promise.resolve(null)\n )\n ])\n const inlinePatch = inlinePatches[patchName] || null\n\n let patchHasData = false\n for (let i = 0; i < schema.resolutionOrder.length; i++) {\n const property = schema.resolutionOrder[i]\n // Find patch data: file > consolidated > inline\n let patchData = perTlpFiles[i]\n if (!patchData && consolidatedPatch?.[property] !== undefined) {\n patchData = consolidatedPatch[property]\n }\n if (!patchData && inlinePatch?.[property] !== undefined) {\n patchData = inlinePatch[property]\n }\n if (!patchData) continue\n patchHasData = true\n\n const resolved = await resolveIncludes(patchData, basePath)\n const layer = isPlainObject(resolved) ? propagateShow(resolved) : resolved\n\n loaded[property] = apply(loaded[property], layer, patchScope)\n patchScope = { ...patchScope, [property]: loaded[property] }\n }\n\n if (!patchHasData && Array.isArray(loaded.meta?.patches) && loaded.meta.patches.includes(patchName)) {\n console.warn(\n `[gst] meta.patches declares \"${patchName}\" but no patch files were found ` +\n `(expected files like fields-${patchName}.json, layout-${patchName}.json, etc.)`\n )\n }\n }\n }\n\n // ==================================================================\n // Phase 4: Apply translation maps\n //\n // Sources (lowest to highest priority):\n // 1. Inline map from form.json maps key\n // 2. Global form map: base/form~es.json\n // 3. Namespace form map: ./View/form~es.json\n // 4. Patch-scoped form maps: ./View/form-hipaa~es.json\n // 5. Per-TLP maps: fields~es.json (override whole-form map)\n // ==================================================================\n\n if (options.map) {\n const inlineMaps = isPlainObject(consolidatedConfig.maps)\n ? consolidatedConfig.maps\n : await tryLoadFile(basePath, 'maps.json') || {}\n\n const allMaps = []\n\n const inlineMap = inlineMaps[options.map] || null\n if (inlineMap) allMaps.push(inlineMap)\n\n // Batch-load all map files in parallel.\n // rootPath fetches remain speculative (manifest only covers basePath).\n // basePath fetches are skipped when manifest exists and file is absent.\n const mapFileLoads = [\n tryLoadFile(rootPath, `form~${options.map}.json`),\n ...(namespace ? [\n (!manifest || manifest.files.has(`form~${options.map}.json`))\n ? tryLoadFile(basePath, `form~${options.map}.json`)\n : Promise.resolve(null)\n ] : []),\n ...(namespace ? allPatches.map(v =>\n (!manifest || manifest.files.has(`form-${v}~${options.map}.json`))\n ? tryLoadFile(basePath, `form-${v}~${options.map}.json`)\n : Promise.resolve(null)\n ) : [])\n ]\n\n const objectTlps = schema.resolutionOrder.filter(\n p => loaded[p] && typeof loaded[p] === 'object'\n )\n const perTlpLoads = objectTlps.flatMap(p => [\n tryLoadFile(rootPath, `${p}~${options.map}.json`),\n ...(namespace ? [\n (!manifest || manifest.files.has(`${p}~${options.map}.json`))\n ? tryLoadFile(basePath, `${p}~${options.map}.json`)\n : Promise.resolve(null)\n ] : [])\n ])\n\n const [mapResults, tlpResults] = await Promise.all([\n Promise.all(mapFileLoads),\n Promise.all(perTlpLoads)\n ])\n\n // Unpack form-level map results\n const globalFormMap = mapResults[0]\n if (globalFormMap) allMaps.push(globalFormMap)\n if (namespace) {\n const nsFormMap = mapResults[1]\n if (nsFormMap) allMaps.push(nsFormMap)\n for (let i = 0; i < allPatches.length; i++) {\n const variantFormMap = mapResults[2 + i]\n if (variantFormMap) allMaps.push(variantFormMap)\n }\n }\n\n // Unpack per-TLP map results\n const perTlpMaps = {}\n const stride = namespace ? 2 : 1\n for (let i = 0; i < objectTlps.length; i++) {\n const property = objectTlps[i]\n const tlpMaps = []\n const globalTlpMap = tlpResults[i * stride]\n if (globalTlpMap) tlpMaps.push(globalTlpMap)\n if (namespace) {\n const nsTlpMap = tlpResults[i * stride + 1]\n if (nsTlpMap) tlpMaps.push(nsTlpMap)\n }\n if (tlpMaps.length > 0) {\n perTlpMaps[property] = tlpMaps.length === 1 ? tlpMaps[0] : mergeMaps(...tlpMaps)\n }\n }\n\n const baseMap = allMaps.length === 0 ? {} :\n allMaps.length === 1 ? allMaps[0] : mergeMaps(...allMaps)\n\n for (const property of schema.resolutionOrder) {\n if (!loaded[property] || typeof loaded[property] !== 'object') continue\n const finalMap = perTlpMaps[property]\n ? mergeMaps(baseMap, perTlpMaps[property])\n : Object.keys(baseMap).length > 0 ? baseMap : null\n if (finalMap) {\n loaded[property] = applyMap(loaded[property], finalMap)\n }\n }\n }\n\n // ==================================================================\n // Phase 5: Build final config\n // ==================================================================\n\n return buildFormConfig(loaded, {\n mapping: schema.registryMapping,\n functions: options.functions\n })\n}\n","/**\n * Shared utilities for working with TLP schemas.\n *\n * Used by both LiveConfig (runtime patching) and the namespace loader\n * (initial loading) to build scope objects and track dependencies.\n */\n\n/**\n * Build a scope object containing all properties resolved before\n * the given property in the resolution order.\n *\n * @param {string} property - The property being resolved\n * @param {Object} loaded - All loaded property values\n * @param {Object} schema - TLP schema with resolutionOrder\n * @param {Object} [extra={}] - Extra scope entries (e.g., { stdlib })\n * @returns {Object} Scope object for resolution\n */\nexport function buildScopeFor(property, loaded, schema, extra = {}) {\n const scope = { ...extra }\n const propertyIndex = schema.resolutionOrder.indexOf(property)\n\n for (let i = 0; i < propertyIndex; i++) {\n const prop = schema.resolutionOrder[i]\n if (loaded[prop] !== undefined) {\n scope[prop] = loaded[prop]\n }\n }\n\n return scope\n}\n\n/**\n * Get properties that depend on the given property.\n * Used to cascade re-resolution when a property changes.\n *\n * @param {string} property - The changed property\n * @param {Object} schema - TLP schema with resolutionOrder and dependencies\n * @returns {string[]} Properties that need re-resolution\n */\nexport function getDependents(property, schema) {\n return schema.resolutionOrder.filter(prop =>\n schema.dependencies[prop]?.includes(property)\n )\n}\n\n/**\n * Extract loaded state from a resolved config object.\n * Maps the final config shape back to per-property values for LiveConfig.\n *\n * @param {Object} config - Resolved config from loadJsonConfig or buildFormConfig\n * @returns {Object} Loaded property values keyed by TLP name\n */\nexport function extractLoadedState(config) {\n return {\n functions: config.registries?.functions || {},\n optionSets: config.registries?.optionSets || {},\n actions: config.actions || {},\n fields: config.registries?.fields || {},\n components: config.registries?.components || {},\n meta: config.meta || {},\n layout: config.layout || [],\n record: config.record || {},\n styles: config.styles || null,\n }\n}\n","/**\n * LiveConfig - Stateful form configuration with runtime patching\n *\n * Wraps the pure functional loader with:\n * - Mutable state for current config\n * - patch() method for single-property updates\n * - Dependency-aware re-resolution\n *\n * Usage:\n * const config = createLiveConfig()\n * await config.load('./UserView')\n * config.patch('fields', { email: { required: true } })\n * const resolved = config.get()\n */\n\nimport { reduce } from '@archduck/gst-compose'\nimport { buildFormConfig } from './utils/registryMapping.js'\nimport { buildScopeFor, getDependents, extractLoadedState } from './utils/schemaHelpers.js'\n\n/**\n * LiveConfig class - holds state and provides patching\n */\nclass LiveConfig {\n /**\n * @param {Object} options\n * @param {Object} options.schema - TLP schema (from createTLPSchema). Required.\n */\n constructor(options = {}) {\n if (!options.schema) {\n throw new Error(\n 'LiveConfig requires options.schema. ' +\n 'Pass a TLP schema from createTLPSchema(), or use the LiveConfig wrapper from @archduck/gst-forms.'\n )\n }\n this.schema = options.schema\n this.loaded = {}\n this.stdlib = null\n this.options = {}\n this._cachedConfig = null\n }\n\n /**\n * Load initial configuration from a path\n * Delegates to namespaceLoader's loadJsonConfig\n */\n async load(path, options = {}) {\n const { loadJsonConfig } = await import('./loaders/namespaceLoader.js')\n\n this.stdlib = options.scope?.stdlib || {}\n this.options = options\n\n const config = await loadJsonConfig(path, { ...options, schema: this.schema })\n\n this.loaded = extractLoadedState(config)\n this._cachedConfig = config\n return this\n }\n\n /**\n * Initialize from a pre-built config object\n * Use this when you've already assembled a config (e.g., from JSON imports)\n */\n from(config, options = {}) {\n this.stdlib = options.stdlib || {}\n this.options = options\n this.loaded = extractLoadedState(config)\n this._cachedConfig = config\n return this\n }\n\n /**\n * Apply a patch to a single property\n * Re-resolves the property and any dependents\n */\n patch(property, patch) {\n if (!this.schema.resolutionOrder.includes(property)) {\n throw new Error(`Unknown property: ${property}. Must be one of: ${this.schema.resolutionOrder.join(', ')}`)\n }\n\n const scope = buildScopeFor(property, this.loaded, this.schema, { stdlib: this.stdlib })\n const current = this.loaded[property] || this.schema.getDefault(property)\n const newValue = reduce([current, patch], this.schema.getDefault(property), scope)\n\n this.loaded[property] = newValue\n\n for (const dep of getDependents(property, this.schema)) {\n this._reResolve(dep)\n }\n\n this._cachedConfig = null\n return this\n }\n\n /**\n * Re-resolve a property against current scope\n * Used after a dependency changes\n */\n _reResolve(property) {\n const scope = buildScopeFor(property, this.loaded, this.schema, { stdlib: this.stdlib })\n const current = this.loaded[property]\n\n if (current !== undefined) {\n this.loaded[property] = reduce([current], this.schema.getDefault(property), scope)\n }\n }\n\n /**\n * Get the current resolved configuration\n */\n get() {\n if (this._cachedConfig) {\n return this._cachedConfig\n }\n\n this._cachedConfig = buildFormConfig(this.loaded, {\n mapping: this.schema.registryMapping,\n functions: this.options.functions,\n })\n\n return this._cachedConfig\n }\n\n /**\n * Get a specific property's current value\n */\n getProperty(property) {\n return this.loaded[property]\n }\n\n /**\n * Replace a property entirely (no merge)\n */\n set(property, value) {\n if (!this.schema.resolutionOrder.includes(property)) {\n throw new Error(`Unknown property: ${property}`)\n }\n\n this.loaded[property] = value\n\n for (const dep of getDependents(property, this.schema)) {\n this._reResolve(dep)\n }\n\n this._cachedConfig = null\n return this\n }\n}\n\n/**\n * Factory function to create a LiveConfig instance\n */\nexport function createLiveConfig(options = {}) {\n return new LiveConfig(options)\n}\n\n/**\n * Convenience function: load and return config in one call\n */\nexport async function loadLiveConfig(path, options = {}) {\n const config = createLiveConfig({ schema: options.schema })\n await config.load(path, options)\n return config\n}\n\nexport { LiveConfig }\n"],"names":["isPlainObject","value","resolveRef","ref","source","parts","current","part","apply","target","scope","applyArray","applyObject","hasSpread","hasGroupRefs","item","targetHasNamedGroups","sourceHasNamedObjects","resolveGroupRefs","spreadIndex","previousArray","before","after","processedBefore","processedAfter","targetArray","targetByName","result","t","groupName","group","matchingTarget","processed","currentScope","baseObject","sourceRef","refs","resolved","spreadRef","anyUnresolved","isRegistryContext","k","v","key","targetValue","reduce","inputs","initial","input","ALLOWED_PROTOCOLS","BLOCKED_HOSTS","validateUrl","urlString","url","hostname","blocked","error","loadFile","response","text","processBulkApply","tlp","bulkEntries","_","entry","logger","targets","props","existing","processedFields","getPath","obj","path","mergeFunctions","loadedFunctions","additionalFunctions","base","mapRegistries","loaded","mapping","registries","sourcePath","targetKey","sourceValue","existingValue","extractActions","actions","meta","buildFormConfig","options","functions","record","applyMap","config","map","walkAndReplace","mergeMaps","maps","propagateShow","data","show","entries","resolveIncludes","basePath","includePath","rest","included","tryLoadFile","hasOverrides","val","filename","loadConsolidatedConfig","inferNamespace","dirName","inferRootPath","parseManifest","filenames","files","patches","name","mapMatch","patchMatch","loadProperty","namespace","property","consolidatedConfig","getDefault","manifestFiles","layers","nsContent","isDebugActive","trace","_a","i","loadJsonConfig","schema","rootPath","manifest","m","peekSource","rawMeta","sourceEntries","initialScope","scopeName","prop","results","inlinePatches","formPatches","_b","callerPatches","allPatches","patchScope","_c","_d","patchName","consolidatedPatch","perTlpFiles","inlinePatch","patchHasData","patchData","layer","_e","inlineMaps","allMaps","inlineMap","mapFileLoads","objectTlps","p","perTlpLoads","mapResults","tlpResults","globalFormMap","nsFormMap","variantFormMap","perTlpMaps","stride","tlpMaps","globalTlpMap","nsTlpMap","baseMap","finalMap","buildScopeFor","extra","propertyIndex","getDependents","extractLoadedState","LiveConfig","namespaceLoader","patch","newValue","dep","createLiveConfig","loadLiveConfig"],"mappings":";AAiBA,SAASA,EAAcC,GAAO;AAC5B,SAAOA,MAAU,QAAQ,OAAOA,KAAU,YAAY,CAAC,MAAM,QAAQA,CAAK;AAC5E;AASA,SAASC,EAAWC,GAAKC,GAAQ;AAC/B,MAAI,CAACD,KAAO,OAAOA,KAAQ,SAAU;AAErC,QAAME,IAAQF,EAAI,MAAM,GAAG;AAC3B,MAAIG,IAAUF;AAEd,aAAWG,KAAQF,GAAO;AACxB,QAA6BC,KAAY,KAAM;AAC/C,IAAAA,IAAUA,EAAQC,CAAI;AAAA,EACxB;AAEA,SAAOD;AACT;AAUO,SAASE,EAAMC,GAAQL,GAAQM,IAAQ,CAAA,GAAI;AAMhD,SAJIN,KAAW,QAIX,OAAOA,KAAW,WACbA,IAIL,MAAM,QAAQA,CAAM,IACfO,GAAWF,GAAQL,GAAQM,CAAK,IAIlCE,GAAYH,GAAQL,GAAQM,CAAK;AAC1C;AAQA,SAASC,GAAWF,GAAQL,GAAQM,GAAO;AACzC,QAAMG,IAAYT,EAAO,QAAQ,KAAK,MAAM,IACtCU,IAAeV,EAAO,KAAK,CAAAW,MAAQ,OAAOA,KAAS,YAAYA,EAAK,WAAW,GAAG,CAAC,GAGnFC,IAAuB,MAAM,QAAQP,CAAM,KAAKA,EAAO,KAAK,CAAAM,MAAQf,EAAce,CAAI,KAAKA,EAAK,IAAI,GACpGE,IAAwBb,EAAO,KAAK,CAAAW,MAAQf,EAAce,CAAI,KAAKA,EAAK,IAAI;AAGlF,MAAID,KAAiBE,KAAwBC;AAC3C,WAAOC,GAAiBT,GAAQL,GAAQM,CAAK;AAG/C,MAAI,CAACG;AAEH,WAAOT,EAAO,IAAI,CAA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I,CAAC,KAAK,OAAO,gBAAgB,SAAS2H,CAAQ;AAChD,YAAM,IAAI,MAAM,qBAAqBA,CAAQ,EAAE;AAGjD,SAAK,OAAOA,CAAQ,IAAI3H;AAExB,eAAW6L,KAAON,EAAc5D,GAAU,KAAK,MAAM;AACnD,WAAK,WAAWkE,CAAG;AAGrB,gBAAK,gBAAgB,MACd;AAAA,EACT;AACF;AAKO,SAASC,GAAiBtG,IAAU,IAAI;AAC7C,SAAO,IAAIiG,GAAWjG,CAAO;AAC/B;AAKO,eAAeuG,GAAexH,GAAMiB,IAAU,IAAI;AACvD,QAAMI,IAASkG,GAAiB,EAAE,QAAQtG,EAAQ,OAAM,CAAE;AAC1D,eAAMI,EAAO,KAAKrB,GAAMiB,CAAO,GACxBI;AACT;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const _=require("./mergeConfigs-Dgwcseh2.js");function m(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function D(t,e){if(!t||typeof t!="string")return;const n=t.split(".");let s=e;for(const i of n){if(s==null)return;s=s[i]}return s}function C(t,e,n={}){return e==null||typeof e!="object"?e:Array.isArray(e)?fe(t,e,n):de(t,e,n)}function fe(t,e,n){const s=e.indexOf("...")!==-1,i=e.some(d=>typeof d=="string"&&d.startsWith("%")),r=Array.isArray(t)&&t.some(d=>m(d)&&d.name),a=e.some(d=>m(d)&&d.name);if(i||r&&a)return ue(t,e,n);if(!s)return e.map(d=>m(d)?C({},d,n):d);const o=e.indexOf("..."),c=Array.isArray(t)?t:[],l=e.slice(0,o),y=e.slice(o+1),p=l.map(d=>m(d)?C({},d,n):d),O=y.map(d=>m(d)?C({},d,n):d);return[...p,...c,...O]}function ue(t,e,n){const s=Array.isArray(t)?t:[],i={};for(const a of s)m(a)&&a.name&&(i[a.name]=a);const r=[];for(const a of e)if(a==="...")for(const o of s)r.push(o);else if(typeof a=="string"&&a.startsWith("%")){const o=a.slice(1),c=i[o];c?r.push(c):console.warn(`[gst-compose] %${o}: no group named "${o}" in target layout`)}else if(m(a)){const o=a.name&&i[a.name]?i[a.name]:{},c=C(o,a,n);r.push(c)}else r.push(a);return r}function de(t,e,n){let s=n,i={};if("__source"in e){const o=e.__source;if(o===null||m(o)&&Object.keys(o).length===0)s={};else{const c=Array.isArray(o)?o:[o];for(const l of c)if(typeof l=="string"){const y=D(l,n);y&&m(y)&&(s={...s,...y})}}}if("..."in e){const o=e["..."],c=Array.isArray(o)?o:[o];let l=!1;for(const y of c)if(y==="^")m(t)&&(i={...i,...t});else if(typeof y=="string"){const p=D(y,s);m(p)?i={...i,...p}:l=!0}l&&Object.keys(s).length>0&&(i["..."]=o)}const r={...i},a="__source"in e||Object.entries(e).some(([o,c])=>o!=="..."&&o!=="__source"&&(c==="^"||typeof c=="string"&&c.startsWith("{{")||m(c)&&"..."in c));for(const[o,c]of Object.entries(e))if(!(o==="__source"||o==="...")){if(c==="^"||c===o){const l=D(o,s);if(l!==void 0){r[o]=m(l)?{...l}:l;continue}}if(typeof c=="string"&&a&&s[c]!==void 0){const l=D(c,s);if(l!==void 0&&m(l)){r[o]={...l};continue}}if(m(c)){const l=m(r[o])?r[o]:{};r[o]=C(l,c,s)}else if(Array.isArray(c)){const l=Array.isArray(r[o])?r[o]:[];r[o]=C(l,c,s)}else r[o]=c}return r}function Z(t,e={},n={}){let s=e;for(const i of t)s=C(s,i,n);return s}const ee=["https:","http:","file:"],he=["localhost","127.0.0.1","0.0.0.0","169.254.169.254","::1","metadata.google.internal"];function pe(t){try{const e=new URL(t,window.location.href);if(!ee.includes(e.protocol))throw new Error(`Security: Blocked protocol "${e.protocol}" - only ${ee.join(", ")} allowed`);const n=e.hostname.toLowerCase();if(he.some(s=>n===s||n.endsWith(`.${s}`)))throw new Error(`Security: Blocked host "${e.hostname}" - potential SSRF attempt`);if(n.startsWith("10.")||n.startsWith("192.168.")||/^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(n))throw new Error(`Security: Blocked private IP address "${n}"`)}catch(e){if(e.message.startsWith("Security:"))throw e;return}}async function U(t){pe(t);const e=await fetch(t);if(!e.ok)throw new Error(`Failed to load ${t}: ${e.statusText}`);const n=await e.text();return JSON.parse(n)}function H(t){if(!t||typeof t!="object"||Array.isArray(t))return t;const e=t.bulkApply;if(!Array.isArray(e)||e.length===0)return t;const{bulkApply:n,...s}=t;for(const i of e){if(!i||typeof i!="object"||Array.isArray(i)){_.logger.warn("bulk-apply: entry must be an object, skipping");continue}const{targets:r,...a}=i;if(!Array.isArray(r)||r.length===0){_.logger.warn("bulk-apply: entry missing targets array, skipping");continue}if(Object.keys(a).length===0){_.logger.warn("bulk-apply: entry has no properties to apply, skipping");continue}for(const o of r){if(typeof o!="string"){_.logger.warn(`bulk-apply: target must be a string, got ${typeof o}`);continue}const c=s[o];if(c&&typeof c=="object"&&!Array.isArray(c))s[o]={...c,...a};else if(c===void 0)s[o]={...a};else if(typeof c=="string"){const l=c==="^"?o:c;s[o]={"...":l,...a}}else _.logger.warn(`bulk-apply: target "${o}" is not an object definition, skipping`)}}for(const[i,r]of Object.entries(s))if(r&&typeof r=="object"&&!Array.isArray(r)&&r.fields&&typeof r.fields=="object"){const a=H(r.fields);a!==r.fields&&(s[i]={...r,fields:a})}return s}function ne(t,e){if(!t||typeof t!="object"||!e||typeof e!="string")return;let n=t;for(const s of e.split(".")){if(n==null||typeof n!="object")return;n=n[s]}return n}function ye(t,e={}){let n=t||{};return n.default&&(n=n.default),{...n,...e}}function se(t,e={}){const n={};for(const[s,i]of Object.entries(e)){const r=ne(t,s),a=n[i];r&&typeof r=="object"&&!Array.isArray(r)?n[i]={...a,...r}:r!==void 0?n[i]=r:a||(n[i]={})}return n}function oe(t,e){const n=t.actions||{},s=t.meta||{};return{buttonSet:n.buttonSet??s.buttonSet,buttons:e.buttons||{},hooks:e.hooks||{}}}function I(t,e={}){const{mapping:n={},functions:s={}}=e,i=ye(t.functions,s),r={};for(const[y,p]of Object.entries(t))r[y]=H(p);r.functions=i;const a=se(r,n),o=oe(r,a),c=r.meta||{},l=r.record&&Object.keys(r.record).length>0?r.record:null;return l&&!c.initialRecord&&(c.initialRecord=l),{meta:c,layout:r.layout||[],registries:a,actions:o,styles:t.styles||null,record:l,state:r.state||{}}}function re(t,e){return!t||!e||typeof e!="object"?t:N(t,e)}function N(t,e){if(typeof t=="string")return Object.hasOwn(e,t)?e[t]:t;if(Array.isArray(t))return t.map(n=>N(n,e));if(t!==null&&typeof t=="object"){const n={};for(const s of Object.keys(t))n[s]=N(t[s],e);return n}return t}function W(...t){return Object.assign({},...t.filter(Boolean))}function S(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function me(t){if(!t.show)return t;const{show:e,...n}=t,s={};for(const[i,r]of Object.entries(n))S(r)&&!r.show?s[i]={...r,show:e}:s[i]=r;return s}async function R(t,e){if(t==null||typeof t!="object")return t;if(Array.isArray(t)){const s=[];for(const i of t)s.push(await R(i,e));return s}if(t.__include){const s=t.__include,{__include:i,...r}=t;if(s.endsWith(".html")||s.endsWith(".htm")){try{const o=await fetch(`${e}/${s}`);if(o.ok)return{component:"html",content:await o.text(),...r}}catch{}return Object.keys(r).length>0?r:{}}const a=await g(e,s);if(a){const o=await R(a,e),c=Object.keys(r).length>0;return S(o)&&c?{...o,...r}:o}return Object.keys(r).length>0?r:{}}const n={};for(const[s,i]of Object.entries(t))n[s]=await R(i,e);return n}async function g(t,e){try{return await U(`${t}/${e}`)}catch{return null}}async function ge(t){try{return await U(`${t}/form.json`)||{}}catch{return{}}}function be(t){const e=t.split("/").pop();return!e||e==="."||e==="src"?null:e.toLowerCase()}function je(t){return`${t.split("/").slice(0,-2).join("/")||"."}/base`}function te(t){const e=new Set(t),n=new Set,s=new Set;for(const i of t){if(i.includes("~")){const a=i.match(/~([a-z][a-z0-9]*)\.json$/);a&&s.add(a[1]);continue}const r=i.match(/^[a-z]+-([a-z][a-z0-9-]*)\.json$/);r&&n.add(r[1])}return{files:e,patches:[...n].sort(),maps:[...s].sort()}}async function we(t,e,n,s,i,r,a,o){var d;const c=[],y=e&&(!a||a.has(`${n}.json`))?await g(t,`${n}.json`):null;if(i[n]!==void 0&&c.push(await R(i[n],t)),y!==null&&c.push(await R(y,t)),c.length===0)return _.isDebugActive()&&_.trace("config",`load-property "${n}"`,"no files found (using default)",{property:n,basePath:t,namespace:e,hasSource:o!==void 0}),o??r(n);_.isDebugActive()&&_.trace("config",`load-property "${n}"`,`${c.length} layer(s) found`,{property:n,layerCount:c.length,hasConsolidated:i[n]!==void 0,hasSource:o!==void 0,namespace:e});let p=o??r(n),O=s;S((d=s.base)==null?void 0:d[n])&&(O={...O,...s.base[n]});for(let F=0;F<c.length;F++)p=C(p,c[F],O),O={...O,[n]:p};return p}async function ie(t,e={}){var q,G,K,V,Q;const{schema:n}=e;if(!n)throw new Error("loadJsonConfig requires options.schema. Pass a TLP schema from createTLPSchema(), or use the loadJsonConfig wrapper from @archduck/gst-forms.");const s=e.rootPath||je(t),i=t,r=e.namespace||be(t),[a,o]=await Promise.all([ge(t),e.manifest?Promise.resolve(te(e.manifest)):g(i,"manifest.json").then(u=>Array.isArray(u)?te(u):null)]),c={...e.scope},l={};let y=(q=a.meta)==null?void 0:q.source;if(!y&&r){const u=!o||o!=null&&o.files.has("meta.json")?await g(i,"meta.json"):null;u!=null&&u.source&&(y=u.source)}let p=null;if(y){const u=e.scope||{};if(typeof y=="string")p=u[y]||null;else if(S(y)){p={};for(const[f,A]of Object.entries(y)){const L=u[f];if(L)for(const b of Array.isArray(A)?A:[])L[b]!==void 0&&(p[b]=L[b])}}}const O=await Promise.all(n.resolutionOrder.map(u=>we(i,r,u,c,a,n.getDefault,o==null?void 0:o.files,p==null?void 0:p[u])));for(let u=0;u<n.resolutionOrder.length;u++)l[n.resolutionOrder[u]]=O[u];const d=S(a.patches)?a.patches:await g(i,"patches.json")||{},F=Array.isArray((G=l.meta)==null?void 0:G.patches)?l.meta.patches:o?o.patches:[],le=Array.isArray(e.patches)?e.patches:[],x=[...F,...le];if(x.length>0){let u={...e.scope};for(const f of n.resolutionOrder)p!=null&&p[f]&&S(p[f])&&((K=n.declarations[f])!=null&&K.registry)&&(u={...u,...p[f]}),l[f]&&(u[f]=l[f],S(l[f])&&((V=n.declarations[f])!=null&&V.registry)&&(u={...u,...l[f]}));for(const f of x){const[A,...L]=await Promise.all([!o||o.files.has(`form-${f}.json`)?g(i,`form-${f}.json`):Promise.resolve(null),...n.resolutionOrder.map(j=>!o||o.files.has(`${j}-${f}.json`)?g(i,`${j}-${f}.json`):Promise.resolve(null))]),b=d[f]||null;let T=!1;for(let j=0;j<n.resolutionOrder.length;j++){const w=n.resolutionOrder[j];let $=L[j];if(!$&&(A==null?void 0:A[w])!==void 0&&($=A[w]),!$&&(b==null?void 0:b[w])!==void 0&&($=b[w]),!$)continue;T=!0;const M=await R($,i),v=S(M)?me(M):M;l[w]=C(l[w],v,u),u={...u,[w]:l[w]}}!T&&Array.isArray((Q=l.meta)==null?void 0:Q.patches)&&l.meta.patches.includes(f)&&console.warn(`[gst] meta.patches declares "${f}" but no patch files were found (expected files like fields-${f}.json, layout-${f}.json, etc.)`)}}if(e.map){const u=S(a.maps)?a.maps:await g(i,"maps.json")||{},f=[],A=u[e.map]||null;A&&f.push(A);const L=[g(s,`form~${e.map}.json`),...r?[!o||o.files.has(`form~${e.map}.json`)?g(i,`form~${e.map}.json`):Promise.resolve(null)]:[],...r?x.map(h=>!o||o.files.has(`form-${h}~${e.map}.json`)?g(i,`form-${h}~${e.map}.json`):Promise.resolve(null)):[]],b=n.resolutionOrder.filter(h=>l[h]&&typeof l[h]=="object"),T=b.flatMap(h=>[g(s,`${h}~${e.map}.json`),...r?[!o||o.files.has(`${h}~${e.map}.json`)?g(i,`${h}~${e.map}.json`):Promise.resolve(null)]:[]]),[j,w]=await Promise.all([Promise.all(L),Promise.all(T)]),$=j[0];if($&&f.push($),r){const h=j[1];h&&f.push(h);for(let P=0;P<x.length;P++){const k=j[2+P];k&&f.push(k)}}const M={},v=r?2:1;for(let h=0;h<b.length;h++){const P=b[h],k=[],X=w[h*v];if(X&&k.push(X),r){const Y=w[h*v+1];Y&&k.push(Y)}k.length>0&&(M[P]=k.length===1?k[0]:W(...k))}const B=f.length===0?{}:f.length===1?f[0]:W(...f);for(const h of n.resolutionOrder){if(!l[h]||typeof l[h]!="object")continue;const P=M[h]?W(B,M[h]):Object.keys(B).length>0?B:null;P&&(l[h]=re(l[h],P))}}return I(l,{mapping:n.registryMapping,functions:e.functions})}const Ae=Object.freeze(Object.defineProperty({__proto__:null,loadJsonConfig:ie},Symbol.toStringTag,{value:"Module"}));function E(t,e,n,s={}){const i={...s},r=n.resolutionOrder.indexOf(t);for(let a=0;a<r;a++){const o=n.resolutionOrder[a];e[o]!==void 0&&(i[o]=e[o])}return i}function z(t,e){return e.resolutionOrder.filter(n=>{var s;return(s=e.dependencies[n])==null?void 0:s.includes(t)})}function J(t){var e,n,s,i;return{functions:((e=t.registries)==null?void 0:e.functions)||{},optionSets:((n=t.registries)==null?void 0:n.optionSets)||{},actions:t.actions||{},fields:((s=t.registries)==null?void 0:s.fields)||{},components:((i=t.registries)==null?void 0:i.components)||{},meta:t.meta||{},layout:t.layout||[],record:t.record||{},styles:t.styles||null}}class ae{constructor(e={}){if(!e.schema)throw new Error("LiveConfig requires options.schema. Pass a TLP schema from createTLPSchema(), or use the LiveConfig wrapper from @archduck/gst-forms.");this.schema=e.schema,this.loaded={},this.stdlib=null,this.options={},this._cachedConfig=null}async load(e,n={}){var r;const{loadJsonConfig:s}=await Promise.resolve().then(()=>Ae);this.stdlib=((r=n.scope)==null?void 0:r.stdlib)||{},this.options=n;const i=await s(e,{...n,schema:this.schema});return this.loaded=J(i),this._cachedConfig=i,this}from(e,n={}){return this.stdlib=n.stdlib||{},this.options=n,this.loaded=J(e),this._cachedConfig=e,this}patch(e,n){if(!this.schema.resolutionOrder.includes(e))throw new Error(`Unknown property: ${e}. Must be one of: ${this.schema.resolutionOrder.join(", ")}`);const s=E(e,this.loaded,this.schema,{stdlib:this.stdlib}),i=this.loaded[e]||this.schema.getDefault(e),r=Z([i,n],this.schema.getDefault(e),s);this.loaded[e]=r;for(const a of z(e,this.schema))this._reResolve(a);return this._cachedConfig=null,this}_reResolve(e){const n=E(e,this.loaded,this.schema,{stdlib:this.stdlib}),s=this.loaded[e];s!==void 0&&(this.loaded[e]=Z([s],this.schema.getDefault(e),n))}get(){return this._cachedConfig?this._cachedConfig:(this._cachedConfig=I(this.loaded,{mapping:this.schema.registryMapping,functions:this.options.functions}),this._cachedConfig)}getProperty(e){return this.loaded[e]}set(e,n){if(!this.schema.resolutionOrder.includes(e))throw new Error(`Unknown property: ${e}`);this.loaded[e]=n;for(const s of z(e,this.schema))this._reResolve(s);return this._cachedConfig=null,this}}function ce(t={}){return new ae(t)}async function Oe(t,e={}){const n=ce({schema:e.schema});return await n.load(t,e),n}exports.LiveConfig=ae;exports.applyMap=re;exports.buildFormConfig=I;exports.buildScopeFor=E;exports.createLiveConfig=ce;exports.extractActions=oe;exports.extractLoadedState=J;exports.getDependents=z;exports.getPath=ne;exports.loadFile=U;exports.loadJsonConfig=ie;exports.loadLiveConfig=Oe;exports.mapRegistries=se;exports.mergeMaps=W;exports.processBulkApply=H;
|
|
2
|
+
//# sourceMappingURL=loaders-BEwXPBCN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders-BEwXPBCN.js","sources":["../../../gst-compose/src/compose.js","../../src/utils/fileLoader.js","../../src/utils/bulkApply.js","../../src/utils/registryMapping.js","../../src/utils/applyMap.js","../../src/loaders/namespaceLoader.js","../../src/utils/schemaHelpers.js","../../src/LiveConfig.js"],"sourcesContent":["/**\n * Core composition functions\n *\n * Rules:\n * 1. Primitives pass through unchanged\n * 2. Arrays replace by default; use \"...\" marker to spread previous\n * 3. Objects replace by default; use \"...\": \"^\" to spread from target (previous layer)\n * 4. \"__source\" property brings definitions into scope for spread resolution\n * - __source: \"path\" - resolve path from scope, merge into local scope\n * - __source: [\"path1\", \"path2\"] - merge multiple sources\n * - __source: null - cancel sourcing, empty scope\n * 5. \"%name\" in arrays resolves a named group from the target array\n */\n\n/**\n * Check if value is a plain object (not array, null, etc.)\n */\nfunction isPlainObject(value) {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n}\n\n/**\n * Resolve a dot-notation reference from an object\n *\n * @param {string} ref - Reference string (e.g., \"email\", \"stdlib.fields.email\")\n * @param {Object} source - Object to resolve from\n * @returns {any} Resolved value or undefined\n */\nfunction resolveRef(ref, source) {\n if (!ref || typeof ref !== \"string\") return undefined\n\n const parts = ref.split(\".\")\n let current = source\n\n for (const part of parts) {\n if (current === undefined || current === null) return undefined\n current = current[part]\n }\n\n return current\n}\n\n/**\n * Apply source onto target with spread/__source resolution\n *\n * @param {any} target - Current accumulated value\n * @param {any} source - New value to apply\n * @param {Object} scope - Available definitions for spread resolution\n * @returns {any} Resulting value\n */\nexport function apply(target, source, scope = {}) {\n // Primitives: source wins\n if (source === null || source === undefined) {\n return source\n }\n\n if (typeof source !== \"object\") {\n return source\n }\n\n // Arrays\n if (Array.isArray(source)) {\n return applyArray(target, source, scope)\n }\n\n // Objects\n return applyObject(target, source, scope)\n}\n\n/**\n * Apply array with spread and %group support\n *\n * \"...\" marker splices the previous array.\n * \"%name\" resolves a named group from the target array.\n */\nfunction applyArray(target, source, scope) {\n const hasSpread = source.indexOf(\"...\") !== -1\n const hasGroupRefs = source.some(item => typeof item === \"string\" && item.startsWith(\"%\"))\n\n // Check if source has named objects that could match named groups in target\n const targetHasNamedGroups = Array.isArray(target) && target.some(item => isPlainObject(item) && item.name)\n const sourceHasNamedObjects = source.some(item => isPlainObject(item) && item.name)\n\n // Use group-aware resolution when we have %refs OR named objects matching named target groups\n if (hasGroupRefs || (targetHasNamedGroups && sourceHasNamedObjects)) {\n return resolveGroupRefs(target, source, scope)\n }\n\n if (!hasSpread) {\n // No spread marker - recurse into elements\n return source.map(item => {\n if (isPlainObject(item)) {\n return apply({}, item, scope)\n }\n return item\n })\n }\n\n // Has spread marker - splice in target array\n const spreadIndex = source.indexOf(\"...\")\n const previousArray = Array.isArray(target) ? target : []\n\n const before = source.slice(0, spreadIndex)\n const after = source.slice(spreadIndex + 1)\n\n const processedBefore = before.map(item =>\n isPlainObject(item) ? apply({}, item, scope) : item,\n )\n const processedAfter = after.map(item =>\n isPlainObject(item) ? apply({}, item, scope) : item,\n )\n\n return [...processedBefore, ...previousArray, ...processedAfter]\n}\n\n/**\n * Resolve %groupName references in a layout array.\n *\n * \"%personal\" pulls the group named \"personal\" from the target array unchanged.\n * A named object replaces the matching group from the target.\n * Objects without names are appended.\n */\nfunction resolveGroupRefs(target, source, scope) {\n const targetArray = Array.isArray(target) ? target : []\n\n // Index target groups by name\n const targetByName = {}\n for (const item of targetArray) {\n if (isPlainObject(item) && item.name) {\n targetByName[item.name] = item\n }\n }\n\n const result = []\n for (const item of source) {\n if (item === \"...\") {\n // Spread marker: splice in all target items (same as normal array spread)\n for (const t of targetArray) {\n result.push(t)\n }\n } else if (typeof item === \"string\" && item.startsWith(\"%\")) {\n const groupName = item.slice(1)\n const group = targetByName[groupName]\n if (group) {\n result.push(group)\n } else {\n console.warn(`[gst-compose] %${groupName}: no group named \"${groupName}\" in target layout`)\n }\n } else if (isPlainObject(item)) {\n // If this named group matches one in target, use the target group as the apply target\n const matchingTarget = item.name && targetByName[item.name] ? targetByName[item.name] : {}\n const processed = apply(matchingTarget, item, scope)\n result.push(processed)\n } else {\n // Plain strings (field references in layout rows) pass through\n result.push(item)\n }\n }\n\n return result\n}\n\n/**\n * Apply object with __source/spread support\n *\n * Objects can have:\n * - \"__source\": \"key\" - Brings definitions into scope\n * - \"...\": \"key\" - Spreads from scope\n * - \"...\": \"^\" - Spreads from target (previous layer)\n */\nfunction applyObject(target, source, scope) {\n let currentScope = scope\n let baseObject = {}\n\n // Handle \"__source\" - brings definitions into scope.\n // Does NOT merge sourced definitions into the result.\n if (\"__source\" in source) {\n const sourceRef = source.__source\n\n if (\n sourceRef === null ||\n (isPlainObject(sourceRef) && Object.keys(sourceRef).length === 0)\n ) {\n currentScope = {}\n } else {\n const refs = Array.isArray(sourceRef) ? sourceRef : [sourceRef]\n for (const ref of refs) {\n if (typeof ref === \"string\") {\n const resolved = resolveRef(ref, scope)\n if (resolved && isPlainObject(resolved)) {\n currentScope = { ...currentScope, ...resolved }\n }\n }\n }\n }\n }\n\n // Handle \"...\" spread property\n if (\"...\" in source) {\n const spreadRef = source[\"...\"]\n const refs = Array.isArray(spreadRef) ? spreadRef : [spreadRef]\n let anyUnresolved = false\n\n for (const ref of refs) {\n if (ref === \"^\") {\n // Spread from target (previous layer)\n if (isPlainObject(target)) {\n baseObject = { ...baseObject, ...target }\n }\n } else if (typeof ref === \"string\") {\n // Spread from scope\n const resolved = resolveRef(ref, currentScope)\n if (isPlainObject(resolved)) {\n baseObject = { ...baseObject, ...resolved }\n } else {\n anyUnresolved = true\n }\n }\n }\n\n // Preserve unresolved spreads for runtime resolution\n if (anyUnresolved && Object.keys(currentScope).length > 0) {\n baseObject[\"...\"] = spreadRef\n }\n }\n\n // Build result: base + rest of source (excluding __source and ...)\n const result = { ...baseObject }\n\n // Detect whether this object is a registry (where string values are\n // definition references) vs an already-resolved definition (where\n // string values are data). Registry objects have __source, or contain\n // \"^\" self-references, \"{{\" dynamic props, or spread definitions\n // (an entry with \"...\" indicates siblings are registry entries too).\n // NOTE: Only check non-reserved keys (\"...\" and \"__source\" are directives,\n // not evidence of registry context).\n const isRegistryContext = \"__source\" in source ||\n Object.entries(source).some(([k, v]) =>\n k !== \"...\" && k !== \"__source\" && (\n v === \"^\" ||\n (typeof v === \"string\" && v.startsWith(\"{{\")) ||\n (isPlainObject(v) && \"...\" in v)\n )\n )\n\n for (const [key, value] of Object.entries(source)) {\n if (key === \"__source\" || key === \"...\") continue\n\n // Handle self-reference: \"^\" or \"email\": \"email\" (key === value)\n // Both mean \"use the definition for this key from scope\"\n if (value === \"^\" || value === key) {\n const resolved = resolveRef(key, currentScope)\n if (resolved !== undefined) {\n result[key] = isPlainObject(resolved) ? { ...resolved } : resolved\n continue\n }\n }\n\n // Handle string references: \"address\": \"addressUS\" resolves from scope.\n // This is a registry-level pattern where a key names an entry and the\n // string value references a definition. Only resolve when the source\n // object looks like a registry (__source present, or no non-string\n // sibling values indicating it's already a resolved definition).\n if (typeof value === \"string\" && isRegistryContext && currentScope[value] !== undefined) {\n const resolved = resolveRef(value, currentScope)\n if (resolved !== undefined && isPlainObject(resolved)) {\n result[key] = { ...resolved }\n continue\n }\n }\n\n // Recurse into nested objects/arrays\n if (isPlainObject(value)) {\n const targetValue = isPlainObject(result[key]) ? result[key] : {}\n result[key] = apply(targetValue, value, currentScope)\n } else if (Array.isArray(value)) {\n const targetValue = Array.isArray(result[key]) ? result[key] : []\n result[key] = apply(targetValue, value, currentScope)\n } else {\n result[key] = value\n }\n }\n\n return result\n}\n\n/**\n * Reduce multiple inputs into a single result\n *\n * @param {Array} inputs - Array of sources to apply in order\n * @param {any} initial - Initial value (default: {})\n * @param {Object} scope - Available definitions for spread resolution\n * @returns {any} Final result\n */\nexport function reduce(inputs, initial = {}, scope = {}) {\n let result = initial\n\n for (const input of inputs) {\n result = apply(result, input, scope)\n }\n\n return result\n}\n","// src/utils/fileLoader.js\n\n// Security: Allowed protocols for config loading\nconst ALLOWED_PROTOCOLS = ['https:', 'http:', 'file:']\n\n// Security: Blocked hosts to prevent SSRF attacks\nconst BLOCKED_HOSTS = [\n 'localhost',\n '127.0.0.1',\n '0.0.0.0',\n '169.254.169.254', // AWS metadata endpoint\n '::1', // IPv6 localhost\n 'metadata.google.internal', // GCP metadata\n]\n\n/**\n * Check if we're in development mode (not production, not test)\n * Uses import.meta.env.MODE which is set by Vite/Vitest\n */\nfunction isDevMode() {\n // Vitest sets MODE to 'test', Vite dev sets it to 'development'\n // We only want to skip security checks in development mode, not in tests\n return typeof import.meta !== 'undefined' &&\n import.meta.env?.MODE === 'development'\n}\n\n/**\n * Validates URL for security concerns before loading\n * @param {string} urlString - URL to validate\n * @throws {Error} if URL is potentially dangerous\n */\nfunction validateUrl(urlString) {\n // Skip security checks in development mode (Vite runs on localhost)\n if (isDevMode()) {\n return\n }\n\n try {\n const url = new URL(urlString, window.location.href)\n\n // Check protocol\n if (!ALLOWED_PROTOCOLS.includes(url.protocol)) {\n throw new Error(`Security: Blocked protocol \"${url.protocol}\" - only ${ALLOWED_PROTOCOLS.join(', ')} allowed`)\n }\n\n // Check for blocked hosts (case-insensitive)\n const hostname = url.hostname.toLowerCase()\n if (BLOCKED_HOSTS.some(blocked => hostname === blocked || hostname.endsWith(`.${blocked}`))) {\n throw new Error(`Security: Blocked host \"${url.hostname}\" - potential SSRF attempt`)\n }\n\n // Block private IP ranges (basic check)\n if (hostname.startsWith('10.') ||\n hostname.startsWith('192.168.') ||\n /^172\\.(1[6-9]|2[0-9]|3[0-1])\\./.test(hostname)) {\n throw new Error(`Security: Blocked private IP address \"${hostname}\"`)\n }\n\n } catch (error) {\n // Re-throw our security errors\n if (error.message.startsWith('Security:')) {\n throw error\n }\n // For relative URLs or parsing errors, allow them (they're typically safe)\n // They'll be resolved relative to current origin\n return\n }\n}\n\nexport async function loadFile(url) {\n // Security: Validate URL before fetching\n validateUrl(url)\n\n const response = await fetch(url)\n if (!response.ok) throw new Error(`Failed to load ${url}: ${response.statusText}`)\n\n const text = await response.text()\n return JSON.parse(text)\n}\n","/**\n * Bulk Apply - Apply properties to multiple entries at once\n *\n * Uses a structured `bulkApply` array inside any TLP object:\n *\n * \"bulkApply\": [\n * { \"required\": true, \"targets\": [\"firstName\", \"lastName\", \"email\"] },\n * { \"type\": \"tel\", \"targets\": [\"phone\", \"workPhone\", \"cellPhone\"] },\n * { \"style\": { \"fontFamily\": \"monospace\" }, \"targets\": [\"ssn\", \"dob\"] }\n * ]\n *\n * Each entry has a `targets` array (reserved key) listing which entries to apply to.\n * All other keys in the entry are treated as properties to merge onto each target.\n */\n\nimport { logger } from './logger.js'\n\n/**\n * Process the bulkApply array in a TLP object.\n *\n * Extracts the `bulkApply` key, applies each entry's properties to its\n * targets, and returns a new object with `bulkApply` removed and properties\n * merged. Target entries that don't exist are created. String references\n * are wrapped in spread syntax.\n *\n * @param {Object} tlp - A top-level property object (e.g. fields, buttons)\n * @returns {Object} New object with bulkApply removed and properties applied\n */\nexport function processBulkApply(tlp) {\n if (!tlp || typeof tlp !== 'object' || Array.isArray(tlp)) return tlp\n\n const bulkEntries = tlp.bulkApply\n if (!Array.isArray(bulkEntries) || bulkEntries.length === 0) return tlp\n\n // Copy everything except bulkApply\n const { bulkApply: _, ...result } = tlp\n\n for (const entry of bulkEntries) {\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {\n logger.warn('bulk-apply: entry must be an object, skipping')\n continue\n }\n\n const { targets, ...props } = entry\n\n if (!Array.isArray(targets) || targets.length === 0) {\n logger.warn('bulk-apply: entry missing targets array, skipping')\n continue\n }\n\n if (Object.keys(props).length === 0) {\n logger.warn('bulk-apply: entry has no properties to apply, skipping')\n continue\n }\n\n for (const target of targets) {\n if (typeof target !== 'string') {\n logger.warn(`bulk-apply: target must be a string, got ${typeof target}`)\n continue\n }\n\n const existing = result[target]\n\n if (existing && typeof existing === 'object' && !Array.isArray(existing)) {\n // Merge onto existing entry - bulk-apply wins\n result[target] = { ...existing, ...props }\n } else if (existing === undefined) {\n // Create a new entry with just these properties\n result[target] = { ...props }\n } else if (typeof existing === 'string') {\n // String reference -> wrap in spread with bulk properties\n const ref = existing === '^' ? target : existing\n result[target] = { '...': ref, ...props }\n } else {\n logger.warn(`bulk-apply: target \"${target}\" is not an object definition, skipping`)\n }\n }\n }\n\n // Recurse into entries that have nested `fields` blocks (constructions)\n for (const [key, value] of Object.entries(result)) {\n if (value && typeof value === 'object' && !Array.isArray(value) && value.fields && typeof value.fields === 'object') {\n const processedFields = processBulkApply(value.fields)\n if (processedFields !== value.fields) {\n result[key] = { ...value, fields: processedFields }\n }\n }\n }\n\n return result\n}\n","/**\n * Transform raw loaded config into the shape the renderer expects.\n *\n * Three steps, each a separate exported function:\n * 1. mergeFunctions - merge loaded + additional functions into one object\n * 2. mapRegistries - route TLP data into the flat registries object\n * 3. buildFormConfig - orchestrate everything into the final output\n */\n\nimport { processBulkApply } from './bulkApply.js'\n\n/**\n * Get a value from a nested object using dot notation.\n */\nexport function getPath(obj, path) {\n if (!obj || typeof obj !== 'object') return undefined\n if (!path || typeof path !== 'string') return undefined\n\n let current = obj\n for (const part of path.split('.')) {\n if (current == null || typeof current !== 'object') return undefined\n current = current[part]\n }\n return current\n}\n\n/**\n * Merge loaded functions with additional functions.\n * Functions must be real JS functions (from functions.js or registered by the app).\n * String function bodies are not supported -- no `new Function()` compilation.\n */\nexport function mergeFunctions(loadedFunctions, additionalFunctions = {}) {\n let base = loadedFunctions || {}\n if (base.default) base = base.default\n\n return { ...base, ...additionalFunctions }\n}\n\n/**\n * Map loaded config data to a flat registry structure.\n *\n * The mapping object maps source paths (e.g., 'actions.buttons')\n * to target registry keys (e.g., 'buttons'). Multiple sources can\n * contribute to the same target.\n */\nexport function mapRegistries(loaded, mapping = {}) {\n const registries = {}\n\n for (const [sourcePath, targetKey] of Object.entries(mapping)) {\n const sourceValue = getPath(loaded, sourcePath)\n const existingValue = registries[targetKey]\n\n if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {\n registries[targetKey] = { ...existingValue, ...sourceValue }\n } else if (sourceValue !== undefined) {\n registries[targetKey] = sourceValue\n } else if (!existingValue) {\n registries[targetKey] = {}\n }\n }\n\n return registries\n}\n\n/**\n * Extract the actions structure (buttonSet, buttons, hooks).\n */\nexport function extractActions(loaded, registries) {\n const actions = loaded.actions || {}\n const meta = loaded.meta || {}\n const buttonSet = actions.buttonSet ?? meta.buttonSet\n\n return {\n buttonSet,\n buttons: registries.buttons || {},\n hooks: registries.hooks || {}\n }\n}\n\n/**\n * Build the final config from raw loaded data.\n *\n * Steps:\n * 1. Merge and compile functions\n * 2. Process bulkApply arrays\n * 3. Map to registries\n * 4. Extract actions\n * 5. Assemble output\n */\nexport function buildFormConfig(loaded, options = {}) {\n const { mapping = {}, functions: additionalFunctions = {} } = options\n\n // 1. Merge functions\n const functions = mergeFunctions(loaded.functions, additionalFunctions)\n\n // 2. Process bulkApply\n const processed = {}\n for (const [key, value] of Object.entries(loaded)) {\n processed[key] = processBulkApply(value)\n }\n processed.functions = functions\n\n // 3. Map to registries\n const registries = mapRegistries(processed, mapping)\n\n // 4. Extract actions\n const actions = extractActions(processed, registries)\n\n // 5. Assemble output\n const meta = processed.meta || {}\n const record = processed.record && Object.keys(processed.record).length > 0\n ? processed.record\n : null\n\n // Set initialRecord from the record TLP, but don't clobber\n // an initialRecord the form explicitly set in its meta.\n if (record && !meta.initialRecord) {\n meta.initialRecord = record\n }\n\n return {\n meta,\n layout: processed.layout || [],\n registries,\n actions,\n styles: loaded.styles || null,\n record,\n state: processed.state || {},\n }\n}\n","/**\n * Apply a string replacement map to a config object.\n *\n * Recursively walks the object and replaces any string values\n * that match keys in the map.\n *\n * @param {object} config - The config object to transform\n * @param {object} map - Key/value pairs for string replacement\n * @returns {object} - New config with strings replaced\n *\n * @example\n * const config = {\n * meta: { title: 'Contact Us' },\n * fields: {\n * name: { label: 'Your Name' },\n * email: { label: 'Email Address' }\n * }\n * }\n *\n * const spanishMap = {\n * 'Contact Us': 'Contáctenos',\n * 'Your Name': 'Tu Nombre',\n * 'Email Address': 'Correo Electrónico'\n * }\n *\n * const result = applyMap(config, spanishMap)\n * // result.meta.title === 'Contáctenos'\n * // result.fields.name.label === 'Tu Nombre'\n */\nexport function applyMap(config, map) {\n if (!config || !map || typeof map !== 'object') {\n return config\n }\n\n return walkAndReplace(config, map)\n}\n\n/**\n * Recursively walk an object/array and replace strings.\n */\nfunction walkAndReplace(value, map) {\n // String - look up in map\n if (typeof value === 'string') {\n return Object.hasOwn(map, value) ? map[value] : value\n }\n\n // Array - recurse into each element\n if (Array.isArray(value)) {\n return value.map((item) => walkAndReplace(item, map))\n }\n\n // Object - recurse into each property\n if (value !== null && typeof value === 'object') {\n const result = {}\n for (const key of Object.keys(value)) {\n result[key] = walkAndReplace(value[key], map)\n }\n return result\n }\n\n // Primitives (number, boolean, null, undefined) - pass through\n return value\n}\n\n/**\n * Merge multiple maps together, later maps override earlier.\n *\n * @param {...object} maps - Maps to merge\n * @returns {object} - Merged map\n *\n * @example\n * const globalMap = { 'Submit': 'Enviar', 'Cancel': 'Cancelar' }\n * const localMap = { 'Submit': 'Guardar' } // override\n * const merged = mergeMaps(globalMap, localMap)\n * // merged['Submit'] === 'Guardar'\n * // merged['Cancel'] === 'Cancelar'\n */\nexport function mergeMaps(...maps) {\n return Object.assign({}, ...maps.filter(Boolean))\n}\n","/**\n * Namespace-based configuration loader\n *\n * Loads TLPs in dependency order, applies patches, then maps.\n *\n * Resolution order (from TLP schema dependency graph):\n * functions -> no deps\n * optionSets -> no deps\n * actions -> refs functions (contains defs, buttons[], hooks)\n * fields -> refs functions, optionSets, actions.buttons\n * components -> refs fields (partial application)\n * meta -> no deps\n * state -> no deps\n * layout -> refs fields, components, actions\n * record -> standalone\n * styles -> standalone\n */\n\nimport { apply } from '@archduck/gst-compose'\nimport { loadFile } from '@/utils/fileLoader.js'\nimport { buildFormConfig } from '@/utils/registryMapping.js'\nimport { applyMap, mergeMaps } from '@/utils/applyMap.js'\nimport { trace, isDebugActive } from '@/utils/gstDebug.js'\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\n/**\n * Propagate a top-level `show` property to each entry that doesn't\n * already have its own `show`. Convenience for patch files: write\n * `show` once at the top instead of on every field.\n */\nfunction propagateShow(data) {\n if (!data.show) return data\n const { show, ...entries } = data\n const result = {}\n for (const [key, value] of Object.entries(entries)) {\n if (isPlainObject(value) && !value.show) {\n result[key] = { ...value, show }\n } else {\n result[key] = value\n }\n }\n return result\n}\n\n/**\n * Resolve __include references recursively.\n * __include: \"./file.json\" loads the file and merges remaining props on top.\n */\nasync function resolveIncludes(value, basePath) {\n if (value === null || value === undefined || typeof value !== 'object') {\n return value\n }\n\n if (Array.isArray(value)) {\n const result = []\n for (const item of value) {\n result.push(await resolveIncludes(item, basePath))\n }\n return result\n }\n\n if (value.__include) {\n const includePath = value.__include\n const { __include: _, ...rest } = value\n\n if (includePath.endsWith('.html') || includePath.endsWith('.htm')) {\n try {\n const response = await fetch(`${basePath}/${includePath}`)\n if (response.ok) {\n const html = await response.text()\n return { component: 'html', content: html, ...rest }\n }\n } catch { /* fall through */ }\n return Object.keys(rest).length > 0 ? rest : {}\n }\n\n const included = await tryLoadFile(basePath, includePath)\n if (included) {\n const resolved = await resolveIncludes(included, basePath)\n const hasOverrides = Object.keys(rest).length > 0\n return isPlainObject(resolved) && hasOverrides\n ? { ...resolved, ...rest }\n : resolved\n }\n return Object.keys(rest).length > 0 ? rest : {}\n }\n\n const result = {}\n for (const [key, val] of Object.entries(value)) {\n result[key] = await resolveIncludes(val, basePath)\n }\n return result\n}\n\n// ============================================================================\n// File loading helpers\n// ============================================================================\n\nasync function tryLoadFile(basePath, filename) {\n try {\n return await loadFile(`${basePath}/${filename}`)\n } catch {\n return null\n }\n}\n\nasync function loadConsolidatedConfig(basePath) {\n try {\n return await loadFile(`${basePath}/form.json`) || {}\n } catch {\n return {}\n }\n}\n\nfunction inferNamespace(path) {\n const dirName = path.split('/').pop()\n if (!dirName || dirName === '.' || dirName === 'src') return null\n return dirName.toLowerCase()\n}\n\nfunction inferRootPath(path) {\n const parts = path.split('/')\n return `${parts.slice(0, -2).join('/') || '.'}/base`\n}\n\n// ============================================================================\n// Manifest parsing\n// ============================================================================\n\n/**\n * Parse a manifest (array of filenames) to discover patches and maps.\n *\n * Patches are discovered from files matching property-variant.json.\n * Maps are discovered from files matching property~mapName.json.\n */\nfunction parseManifest(filenames) {\n const files = new Set(filenames)\n const patches = new Set()\n const maps = new Set()\n\n for (const name of filenames) {\n if (name.includes('~')) {\n const mapMatch = name.match(/~([a-z][a-z0-9]*)\\.json$/)\n if (mapMatch) maps.add(mapMatch[1])\n continue\n }\n const patchMatch = name.match(/^[a-z]+-([a-z][a-z0-9-]*)\\.json$/)\n if (patchMatch) patches.add(patchMatch[1])\n }\n\n return { files, patches: [...patches].sort(), maps: [...maps].sort() }\n}\n\n// ============================================================================\n// Core loading: gather layers for a property and compose them\n// ============================================================================\n\n/**\n * Load all layers for a single TLP and compose them.\n *\n * Layer order (lowest to highest priority):\n * 1. Property from consolidated form.json\n * 2. Namespace file (./PatientView/fields.json)\n *\n * Base content is NOT loaded here. Use meta.source to pull in\n * base entries explicitly.\n *\n * When a manifest is provided, namespace files are only fetched\n * if they appear in the manifest.\n */\nasync function loadProperty(basePath, namespace, property, scope, consolidatedConfig, getDefault, manifestFiles, sourceValue) {\n const layers = []\n\n // Only fetch namespace file if manifest confirms it exists (or no manifest)\n const shouldFetch = namespace && (!manifestFiles || manifestFiles.has(`${property}.json`))\n const nsContent = shouldFetch ? await tryLoadFile(basePath, `${property}.json`) : null\n\n if (consolidatedConfig[property] !== undefined) {\n layers.push(await resolveIncludes(consolidatedConfig[property], basePath))\n }\n\n if (nsContent !== null) {\n layers.push(await resolveIncludes(nsContent, basePath))\n }\n\n // When no form files define this property, use source value or default.\n // Source entries provide base definitions (functions, optionSets, etc.)\n // that forms inherit without needing their own files.\n if (layers.length === 0) {\n if (isDebugActive()) {\n trace('config', `load-property \"${property}\"`, 'no files found (using default)', {\n property, basePath, namespace, hasSource: sourceValue !== undefined\n })\n }\n return sourceValue ?? getDefault(property)\n }\n\n if (isDebugActive()) {\n trace('config', `load-property \"${property}\"`, `${layers.length} layer(s) found`, {\n property, layerCount: layers.length,\n hasConsolidated: consolidatedConfig[property] !== undefined,\n hasSource: sourceValue !== undefined,\n namespace\n })\n }\n\n // Compose layers on top of source value (or default).\n // Source entries provide the starting accumulator; the form's\n // layers compose on top via apply() with replace-by-default.\n // Fields pull in base entries explicitly with \"^\" or \"...\" spreads.\n let result = sourceValue ?? getDefault(property)\n let currentScope = scope\n\n // Flatten scope.base entries for spread resolution (so \"...\": \"email\"\n // resolves to base.fields.email without needing __source)\n if (isPlainObject(scope.base?.[property])) {\n currentScope = { ...currentScope, ...scope.base[property] }\n }\n\n for (let i = 0; i < layers.length; i++) {\n result = apply(result, layers[i], currentScope)\n currentScope = { ...currentScope, [property]: result }\n }\n\n return result\n}\n\n// ============================================================================\n// Main entry point\n// ============================================================================\n\n/**\n * Load a form configuration from a namespace directory.\n *\n * @param {string} path - Path to form directory (e.g., './PatientView')\n * @param {Object} [options={}] - Loading options\n * @param {string} [options.rootPath] - Base config path (default: inferred)\n * @param {string} [options.namespace] - Override namespace (default: inferred)\n * @param {Object} [options.scope] - Initial scope for spread resolution\n * @param {Object} [options.functions] - Additional functions to merge\n * @param {string[]} [options.patches] - Caller-driven patches\n * @param {string} [options.map] - Translation map name (e.g., 'es')\n * @param {Object} [options.schema] - TLP schema from createTLPSchema()\n * @param {string[]} [options.manifest] - File list for patch/map autodiscovery\n * @returns {Promise<Object>} Resolved form configuration\n */\nexport async function loadJsonConfig(path, options = {}) {\n const { schema } = options\n\n if (!schema) {\n throw new Error(\n 'loadJsonConfig requires options.schema. ' +\n 'Pass a TLP schema from createTLPSchema(), or use the loadJsonConfig wrapper from @archduck/gst-forms.'\n )\n }\n\n const rootPath = options.rootPath || inferRootPath(path)\n const basePath = path\n const namespace = options.namespace || inferNamespace(path)\n\n // Load consolidated config and manifest in parallel\n const [consolidatedConfig, manifest] = await Promise.all([\n loadConsolidatedConfig(path),\n options.manifest\n ? Promise.resolve(parseManifest(options.manifest))\n : tryLoadFile(basePath, 'manifest.json').then(\n m => Array.isArray(m) ? parseManifest(m) : null\n )\n ])\n\n // ==================================================================\n // Phase 1: Peek at meta.source, then load all TLPs in parallel\n //\n // meta.source determines which scope entries become the initial\n // accumulator for each TLP. We peek at it from raw config data\n // before composition so ALL TLPs (including meta) get their\n // source accumulator during loadProperty. Forms pull in base\n // entries explicitly with \"^\" or \"...\" spreads.\n // ==================================================================\n\n const scope = { ...options.scope }\n const loaded = {}\n\n // Peek at meta.source from raw data (before composition)\n let peekSource = consolidatedConfig.meta?.source\n if (!peekSource && namespace) {\n const rawMeta = (!manifest || manifest?.files.has('meta.json'))\n ? await tryLoadFile(basePath, 'meta.json')\n : null\n if (rawMeta?.source) peekSource = rawMeta.source\n }\n\n // Resolve source entries from scope\n let sourceEntries = null\n if (peekSource) {\n const initialScope = options.scope || {}\n if (typeof peekSource === 'string') {\n sourceEntries = initialScope[peekSource] || null\n } else if (isPlainObject(peekSource)) {\n sourceEntries = {}\n for (const [scopeName, props] of Object.entries(peekSource)) {\n const obj = initialScope[scopeName]\n if (!obj) continue\n for (const prop of (Array.isArray(props) ? props : [])) {\n if (obj[prop] !== undefined) sourceEntries[prop] = obj[prop]\n }\n }\n }\n }\n\n // Load all TLPs in parallel with source accumulators\n const results = await Promise.all(\n schema.resolutionOrder.map(property =>\n loadProperty(basePath, namespace, property, scope, consolidatedConfig, schema.getDefault, manifest?.files, sourceEntries?.[property])\n )\n )\n for (let i = 0; i < schema.resolutionOrder.length; i++) {\n loaded[schema.resolutionOrder[i]] = results[i]\n }\n\n // ==================================================================\n // Phase 3: Apply patches\n //\n // Sources (highest to lowest priority):\n // 1. Per-TLP file: fields-hipaa.json\n // 2. Consolidated patch file: form-hipaa.json\n // 3. Inline patch from form.json patches key\n //\n // Patch names come from meta.patches (form-driven, applied first)\n // and options.patches (caller-driven, applied after).\n // ==================================================================\n\n const inlinePatches = isPlainObject(consolidatedConfig.patches)\n ? consolidatedConfig.patches\n : await tryLoadFile(basePath, 'patches.json') || {}\n\n // Patch sources: meta.patches (form-driven), manifest (autodiscovered), options.patches (caller-driven)\n // When manifest exists and meta.patches is absent, autodiscover patches alphabetically.\n // meta.patches, when present, acts as whitelist + ordering.\n const formPatches = Array.isArray(loaded.meta?.patches)\n ? loaded.meta.patches\n : (manifest ? manifest.patches : [])\n const callerPatches = Array.isArray(options.patches) ? options.patches : []\n const allPatches = [...formPatches, ...callerPatches]\n\n if (allPatches.length > 0) {\n // Build patch scope: source entries + loaded TLPs + flattened registries.\n // Source entries (e.g., base.fields) are flattened first so patches can\n // spread from base definitions like \"...\": \"date\".\n let patchScope = { ...options.scope }\n for (const prop of schema.resolutionOrder) {\n // Flatten source registry entries into scope (base definitions)\n if (sourceEntries?.[prop] && isPlainObject(sourceEntries[prop]) && schema.declarations[prop]?.registry) {\n patchScope = { ...patchScope, ...sourceEntries[prop] }\n }\n if (!loaded[prop]) continue\n patchScope[prop] = loaded[prop]\n if (isPlainObject(loaded[prop]) && schema.declarations[prop]?.registry) {\n patchScope = { ...patchScope, ...loaded[prop] }\n }\n }\n\n for (const patchName of allPatches) {\n // With manifest, only fetch files that exist. Without, try speculatively.\n const [consolidatedPatch, ...perTlpFiles] = await Promise.all([\n (!manifest || manifest.files.has(`form-${patchName}.json`))\n ? tryLoadFile(basePath, `form-${patchName}.json`)\n : Promise.resolve(null),\n ...schema.resolutionOrder.map(prop =>\n (!manifest || manifest.files.has(`${prop}-${patchName}.json`))\n ? tryLoadFile(basePath, `${prop}-${patchName}.json`)\n : Promise.resolve(null)\n )\n ])\n const inlinePatch = inlinePatches[patchName] || null\n\n let patchHasData = false\n for (let i = 0; i < schema.resolutionOrder.length; i++) {\n const property = schema.resolutionOrder[i]\n // Find patch data: file > consolidated > inline\n let patchData = perTlpFiles[i]\n if (!patchData && consolidatedPatch?.[property] !== undefined) {\n patchData = consolidatedPatch[property]\n }\n if (!patchData && inlinePatch?.[property] !== undefined) {\n patchData = inlinePatch[property]\n }\n if (!patchData) continue\n patchHasData = true\n\n const resolved = await resolveIncludes(patchData, basePath)\n const layer = isPlainObject(resolved) ? propagateShow(resolved) : resolved\n\n loaded[property] = apply(loaded[property], layer, patchScope)\n patchScope = { ...patchScope, [property]: loaded[property] }\n }\n\n if (!patchHasData && Array.isArray(loaded.meta?.patches) && loaded.meta.patches.includes(patchName)) {\n console.warn(\n `[gst] meta.patches declares \"${patchName}\" but no patch files were found ` +\n `(expected files like fields-${patchName}.json, layout-${patchName}.json, etc.)`\n )\n }\n }\n }\n\n // ==================================================================\n // Phase 4: Apply translation maps\n //\n // Sources (lowest to highest priority):\n // 1. Inline map from form.json maps key\n // 2. Global form map: base/form~es.json\n // 3. Namespace form map: ./View/form~es.json\n // 4. Patch-scoped form maps: ./View/form-hipaa~es.json\n // 5. Per-TLP maps: fields~es.json (override whole-form map)\n // ==================================================================\n\n if (options.map) {\n const inlineMaps = isPlainObject(consolidatedConfig.maps)\n ? consolidatedConfig.maps\n : await tryLoadFile(basePath, 'maps.json') || {}\n\n const allMaps = []\n\n const inlineMap = inlineMaps[options.map] || null\n if (inlineMap) allMaps.push(inlineMap)\n\n // Batch-load all map files in parallel.\n // rootPath fetches remain speculative (manifest only covers basePath).\n // basePath fetches are skipped when manifest exists and file is absent.\n const mapFileLoads = [\n tryLoadFile(rootPath, `form~${options.map}.json`),\n ...(namespace ? [\n (!manifest || manifest.files.has(`form~${options.map}.json`))\n ? tryLoadFile(basePath, `form~${options.map}.json`)\n : Promise.resolve(null)\n ] : []),\n ...(namespace ? allPatches.map(v =>\n (!manifest || manifest.files.has(`form-${v}~${options.map}.json`))\n ? tryLoadFile(basePath, `form-${v}~${options.map}.json`)\n : Promise.resolve(null)\n ) : [])\n ]\n\n const objectTlps = schema.resolutionOrder.filter(\n p => loaded[p] && typeof loaded[p] === 'object'\n )\n const perTlpLoads = objectTlps.flatMap(p => [\n tryLoadFile(rootPath, `${p}~${options.map}.json`),\n ...(namespace ? [\n (!manifest || manifest.files.has(`${p}~${options.map}.json`))\n ? tryLoadFile(basePath, `${p}~${options.map}.json`)\n : Promise.resolve(null)\n ] : [])\n ])\n\n const [mapResults, tlpResults] = await Promise.all([\n Promise.all(mapFileLoads),\n Promise.all(perTlpLoads)\n ])\n\n // Unpack form-level map results\n const globalFormMap = mapResults[0]\n if (globalFormMap) allMaps.push(globalFormMap)\n if (namespace) {\n const nsFormMap = mapResults[1]\n if (nsFormMap) allMaps.push(nsFormMap)\n for (let i = 0; i < allPatches.length; i++) {\n const variantFormMap = mapResults[2 + i]\n if (variantFormMap) allMaps.push(variantFormMap)\n }\n }\n\n // Unpack per-TLP map results\n const perTlpMaps = {}\n const stride = namespace ? 2 : 1\n for (let i = 0; i < objectTlps.length; i++) {\n const property = objectTlps[i]\n const tlpMaps = []\n const globalTlpMap = tlpResults[i * stride]\n if (globalTlpMap) tlpMaps.push(globalTlpMap)\n if (namespace) {\n const nsTlpMap = tlpResults[i * stride + 1]\n if (nsTlpMap) tlpMaps.push(nsTlpMap)\n }\n if (tlpMaps.length > 0) {\n perTlpMaps[property] = tlpMaps.length === 1 ? tlpMaps[0] : mergeMaps(...tlpMaps)\n }\n }\n\n const baseMap = allMaps.length === 0 ? {} :\n allMaps.length === 1 ? allMaps[0] : mergeMaps(...allMaps)\n\n for (const property of schema.resolutionOrder) {\n if (!loaded[property] || typeof loaded[property] !== 'object') continue\n const finalMap = perTlpMaps[property]\n ? mergeMaps(baseMap, perTlpMaps[property])\n : Object.keys(baseMap).length > 0 ? baseMap : null\n if (finalMap) {\n loaded[property] = applyMap(loaded[property], finalMap)\n }\n }\n }\n\n // ==================================================================\n // Phase 5: Build final config\n // ==================================================================\n\n return buildFormConfig(loaded, {\n mapping: schema.registryMapping,\n functions: options.functions\n })\n}\n","/**\n * Shared utilities for working with TLP schemas.\n *\n * Used by both LiveConfig (runtime patching) and the namespace loader\n * (initial loading) to build scope objects and track dependencies.\n */\n\n/**\n * Build a scope object containing all properties resolved before\n * the given property in the resolution order.\n *\n * @param {string} property - The property being resolved\n * @param {Object} loaded - All loaded property values\n * @param {Object} schema - TLP schema with resolutionOrder\n * @param {Object} [extra={}] - Extra scope entries (e.g., { stdlib })\n * @returns {Object} Scope object for resolution\n */\nexport function buildScopeFor(property, loaded, schema, extra = {}) {\n const scope = { ...extra }\n const propertyIndex = schema.resolutionOrder.indexOf(property)\n\n for (let i = 0; i < propertyIndex; i++) {\n const prop = schema.resolutionOrder[i]\n if (loaded[prop] !== undefined) {\n scope[prop] = loaded[prop]\n }\n }\n\n return scope\n}\n\n/**\n * Get properties that depend on the given property.\n * Used to cascade re-resolution when a property changes.\n *\n * @param {string} property - The changed property\n * @param {Object} schema - TLP schema with resolutionOrder and dependencies\n * @returns {string[]} Properties that need re-resolution\n */\nexport function getDependents(property, schema) {\n return schema.resolutionOrder.filter(prop =>\n schema.dependencies[prop]?.includes(property)\n )\n}\n\n/**\n * Extract loaded state from a resolved config object.\n * Maps the final config shape back to per-property values for LiveConfig.\n *\n * @param {Object} config - Resolved config from loadJsonConfig or buildFormConfig\n * @returns {Object} Loaded property values keyed by TLP name\n */\nexport function extractLoadedState(config) {\n return {\n functions: config.registries?.functions || {},\n optionSets: config.registries?.optionSets || {},\n actions: config.actions || {},\n fields: config.registries?.fields || {},\n components: config.registries?.components || {},\n meta: config.meta || {},\n layout: config.layout || [],\n record: config.record || {},\n styles: config.styles || null,\n }\n}\n","/**\n * LiveConfig - Stateful form configuration with runtime patching\n *\n * Wraps the pure functional loader with:\n * - Mutable state for current config\n * - patch() method for single-property updates\n * - Dependency-aware re-resolution\n *\n * Usage:\n * const config = createLiveConfig()\n * await config.load('./UserView')\n * config.patch('fields', { email: { required: true } })\n * const resolved = config.get()\n */\n\nimport { reduce } from '@archduck/gst-compose'\nimport { buildFormConfig } from './utils/registryMapping.js'\nimport { buildScopeFor, getDependents, extractLoadedState } from './utils/schemaHelpers.js'\n\n/**\n * LiveConfig class - holds state and provides patching\n */\nclass LiveConfig {\n /**\n * @param {Object} options\n * @param {Object} options.schema - TLP schema (from createTLPSchema). Required.\n */\n constructor(options = {}) {\n if (!options.schema) {\n throw new Error(\n 'LiveConfig requires options.schema. ' +\n 'Pass a TLP schema from createTLPSchema(), or use the LiveConfig wrapper from @archduck/gst-forms.'\n )\n }\n this.schema = options.schema\n this.loaded = {}\n this.stdlib = null\n this.options = {}\n this._cachedConfig = null\n }\n\n /**\n * Load initial configuration from a path\n * Delegates to namespaceLoader's loadJsonConfig\n */\n async load(path, options = {}) {\n const { loadJsonConfig } = await import('./loaders/namespaceLoader.js')\n\n this.stdlib = options.scope?.stdlib || {}\n this.options = options\n\n const config = await loadJsonConfig(path, { ...options, schema: this.schema })\n\n this.loaded = extractLoadedState(config)\n this._cachedConfig = config\n return this\n }\n\n /**\n * Initialize from a pre-built config object\n * Use this when you've already assembled a config (e.g., from JSON imports)\n */\n from(config, options = {}) {\n this.stdlib = options.stdlib || {}\n this.options = options\n this.loaded = extractLoadedState(config)\n this._cachedConfig = config\n return this\n }\n\n /**\n * Apply a patch to a single property\n * Re-resolves the property and any dependents\n */\n patch(property, patch) {\n if (!this.schema.resolutionOrder.includes(property)) {\n throw new Error(`Unknown property: ${property}. Must be one of: ${this.schema.resolutionOrder.join(', ')}`)\n }\n\n const scope = buildScopeFor(property, this.loaded, this.schema, { stdlib: this.stdlib })\n const current = this.loaded[property] || this.schema.getDefault(property)\n const newValue = reduce([current, patch], this.schema.getDefault(property), scope)\n\n this.loaded[property] = newValue\n\n for (const dep of getDependents(property, this.schema)) {\n this._reResolve(dep)\n }\n\n this._cachedConfig = null\n return this\n }\n\n /**\n * Re-resolve a property against current scope\n * Used after a dependency changes\n */\n _reResolve(property) {\n const scope = buildScopeFor(property, this.loaded, this.schema, { stdlib: this.stdlib })\n const current = this.loaded[property]\n\n if (current !== undefined) {\n this.loaded[property] = reduce([current], this.schema.getDefault(property), scope)\n }\n }\n\n /**\n * Get the current resolved configuration\n */\n get() {\n if (this._cachedConfig) {\n return this._cachedConfig\n }\n\n this._cachedConfig = buildFormConfig(this.loaded, {\n mapping: this.schema.registryMapping,\n functions: this.options.functions,\n })\n\n return this._cachedConfig\n }\n\n /**\n * Get a specific property's current value\n */\n getProperty(property) {\n return this.loaded[property]\n }\n\n /**\n * Replace a property entirely (no merge)\n */\n set(property, value) {\n if (!this.schema.resolutionOrder.includes(property)) {\n throw new Error(`Unknown property: ${property}`)\n }\n\n this.loaded[property] = value\n\n for (const dep of getDependents(property, this.schema)) {\n this._reResolve(dep)\n }\n\n this._cachedConfig = null\n return this\n }\n}\n\n/**\n * Factory function to create a LiveConfig instance\n */\nexport function createLiveConfig(options = {}) {\n return new LiveConfig(options)\n}\n\n/**\n * Convenience function: load and return config in one call\n */\nexport async function loadLiveConfig(path, options = {}) {\n const config = createLiveConfig({ schema: options.schema })\n await config.load(path, options)\n return config\n}\n\nexport { LiveConfig }\n"],"names":["isPlainObject","value","resolveRef","ref","source","parts","current","part","apply","target","scope","applyArray","applyObject","hasSpread","hasGroupRefs","item","targetHasNamedGroups","sourceHasNamedObjects","resolveGroupRefs","spreadIndex","previousArray","before","after","processedBefore","processedAfter","targetArray","targetByName","result","t","groupName","group","matchingTarget","processed","currentScope","baseObject","sourceRef","refs","resolved","spreadRef","anyUnresolved","isRegistryContext","k","v","key","targetValue","reduce","inputs","initial","input","ALLOWED_PROTOCOLS","BLOCKED_HOSTS","validateUrl","urlString","url","hostname","blocked","error","loadFile","response","text","processBulkApply","tlp","bulkEntries","_","entry","logger","targets","props","existing","processedFields","getPath","obj","path","mergeFunctions","loadedFunctions","additionalFunctions","base","mapRegistries","loaded","mapping","registries","sourcePath","targetKey","sourceValue","existingValue","extractActions","actions","meta","buildFormConfig","options","functions","record","applyMap","config","map","walkAndReplace","mergeMaps","maps","propagateShow","data","show","entries","resolveIncludes","basePath","includePath","rest","included","tryLoadFile","hasOverrides","val","filename","loadConsolidatedConfig","inferNamespace","dirName","inferRootPath","parseManifest","filenames","files","patches","name","mapMatch","patchMatch","loadProperty","namespace","property","consolidatedConfig","getDefault","manifestFiles","layers","nsContent","isDebugActive","trace","_a","i","loadJsonConfig","schema","rootPath","manifest","m","peekSource","rawMeta","sourceEntries","initialScope","scopeName","prop","results","inlinePatches","formPatches","_b","callerPatches","allPatches","patchScope","_c","_d","patchName","consolidatedPatch","perTlpFiles","inlinePatch","patchHasData","patchData","layer","_e","inlineMaps","allMaps","inlineMap","mapFileLoads","objectTlps","p","perTlpLoads","mapResults","tlpResults","globalFormMap","nsFormMap","variantFormMap","perTlpMaps","stride","tlpMaps","globalTlpMap","nsTlpMap","baseMap","finalMap","buildScopeFor","extra","propertyIndex","getDependents","extractLoadedState","LiveConfig","namespaceLoader","patch","newValue","dep","createLiveConfig","loadLiveConfig"],"mappings":"2DAiBA,SAASA,EAAcC,EAAO,CAC5B,OAAOA,IAAU,MAAQ,OAAOA,GAAU,UAAY,CAAC,MAAM,QAAQA,CAAK,CAC5E,CASA,SAASC,EAAWC,EAAKC,EAAQ,CAC/B,GAAI,CAACD,GAAO,OAAOA,GAAQ,SAAU,OAErC,MAAME,EAAQF,EAAI,MAAM,GAAG,EAC3B,IAAIG,EAAUF,EAEd,UAAWG,KAAQF,EAAO,CACxB,GAA6BC,GAAY,KAAM,OAC/CA,EAAUA,EAAQC,CAAI,CACxB,CAEA,OAAOD,CACT,CAUO,SAASE,EAAMC,EAAQL,EAAQM,EAAQ,CAAA,EAAI,CAMhD,OAJIN,GAAW,MAIX,OAAOA,GAAW,SACbA,EAIL,MAAM,QAAQA,CAAM,EACfO,GAAWF,EAAQL,EAAQM,CAAK,EAIlCE,GAAYH,EAAQL,EAAQM,CAAK,CAC1C,CAQA,SAASC,GAAWF,EAAQL,EAAQM,EAAO,CACzC,MAAMG,EAAYT,EAAO,QAAQ,KAAK,IAAM,GACtCU,EAAeV,EAAO,KAAKW,GAAQ,OAAOA,GAAS,UAAYA,EAAK,WAAW,GAAG,CAAC,EAGnFC,EAAuB,MAAM,QAAQP,CAAM,GAAKA,EAAO,KAAKM,GAAQf,EAAce,CAAI,GAAKA,EAAK,IAAI,EACpGE,EAAwBb,EAAO,KAAKW,GAAQf,EAAce,CAAI,GAAKA,EAAK,IAAI,EAGlF,GAAID,GAAiBE,GAAwBC,EAC3C,OAAOC,GAAiBT,EAAQL,EAAQM,CAAK,EAG/C,GAAI,CAACG,EAEH,OAAOT,EAAO,IAAIW,GACZf,EAAce,CAAI,EACbP,EAAM,GAAIO,EAAML,CAAK,EAEvBK,CACR,EAIH,MAAMI,EAAcf,EAAO,QAAQ,KAAK,EAClCg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,CACT"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
let s = 0;
|
|
2
|
+
const u = {
|
|
3
|
+
config: "color: #4a9eff; font-weight: bold",
|
|
4
|
+
registry: "color: #2ecc71; font-weight: bold",
|
|
5
|
+
component: "color: #9b59b6; font-weight: bold",
|
|
6
|
+
render: "color: #e67e22; font-weight: bold",
|
|
7
|
+
visibility: "color: #00bcd4; font-weight: bold",
|
|
8
|
+
prop: "color: #f1c40f; font-weight: bold",
|
|
9
|
+
action: "color: #e74c3c; font-weight: bold",
|
|
10
|
+
layout: "color: #1abc9c; font-weight: bold",
|
|
11
|
+
hook: "color: #e91e63; font-weight: bold",
|
|
12
|
+
mount: "color: #607d8b; font-weight: bold"
|
|
13
|
+
}, b = "color: #999; font-weight: normal", O = "color: #ccc; font-weight: normal";
|
|
14
|
+
function A(o) {
|
|
15
|
+
return o === !1 || o === "false" || o === void 0 || o === null ? 0 : o === "verbose" ? 2 : 1;
|
|
16
|
+
}
|
|
17
|
+
function N(o) {
|
|
18
|
+
s = A(o == null ? void 0 : o.debug), s > 0 && console.log(
|
|
19
|
+
`%c[gst]%c debug mode: %c${s === 2 ? "verbose" : "on"}`,
|
|
20
|
+
"color: #4a9eff; font-weight: bold",
|
|
21
|
+
"color: #999",
|
|
22
|
+
"color: #fff; font-weight: bold"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function h() {
|
|
26
|
+
return s > 0;
|
|
27
|
+
}
|
|
28
|
+
function R() {
|
|
29
|
+
return s === 2;
|
|
30
|
+
}
|
|
31
|
+
function T(o, n, t, r) {
|
|
32
|
+
if (s === 0) return;
|
|
33
|
+
const e = u[o] || u.config;
|
|
34
|
+
if (s === 2 && r) {
|
|
35
|
+
console.groupCollapsed(
|
|
36
|
+
`%c[gst:${o}]%c ${n} %c-> ${t}`,
|
|
37
|
+
e,
|
|
38
|
+
b,
|
|
39
|
+
O
|
|
40
|
+
);
|
|
41
|
+
for (const [E, d] of Object.entries(r))
|
|
42
|
+
d !== void 0 && (typeof d == "object" && d !== null ? console.log(` %c${E}:`, "color: #888", d) : console.log(` %c${E}:%c ${d}`, "color: #888", "color: #ccc"));
|
|
43
|
+
console.groupEnd();
|
|
44
|
+
} else
|
|
45
|
+
console.log(
|
|
46
|
+
`%c[gst:${o}]%c ${n} %c-> ${t}`,
|
|
47
|
+
e,
|
|
48
|
+
b,
|
|
49
|
+
O
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function I(o, n, t) {
|
|
53
|
+
if (s === 0) return t();
|
|
54
|
+
const r = u[o] || u.config;
|
|
55
|
+
console.groupCollapsed(`%c[gst:${o}]%c ${n}`, r, b);
|
|
56
|
+
try {
|
|
57
|
+
return t();
|
|
58
|
+
} finally {
|
|
59
|
+
console.groupEnd();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function F(o, n, t) {
|
|
63
|
+
if (s === 0) return t();
|
|
64
|
+
const r = u[o] || u.config;
|
|
65
|
+
console.groupCollapsed(`%c[gst:${o}]%c ${n}`, r, b);
|
|
66
|
+
try {
|
|
67
|
+
return await t();
|
|
68
|
+
} finally {
|
|
69
|
+
console.groupEnd();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const i = {};
|
|
73
|
+
let f = !1, $ = !1, l = null;
|
|
74
|
+
const a = /* @__PURE__ */ new Set();
|
|
75
|
+
function w(o) {
|
|
76
|
+
const n = typeof import.meta < "u" && (i == null ? void 0 : i.VITE_GST_DEBUG);
|
|
77
|
+
f = A(o == null ? void 0 : o.debug) > 0 || n === "true", $ = (o == null ? void 0 : o.strict) === !0 || (o == null ? void 0 : o.strict) === "true" || typeof import.meta < "u" && (i == null ? void 0 : i.VITE_GST_STRICT) === "true", N(o);
|
|
78
|
+
}
|
|
79
|
+
function S(o) {
|
|
80
|
+
o != null && o.error && (l = o);
|
|
81
|
+
}
|
|
82
|
+
const G = (o) => f && console.log(`[GST-FORMS] ${o} initialized`), L = (o) => f && console.log(`[GST-FORMS] ${o} ready`), C = (o, n, t, r = "") => f && console.log(`[REGISTRY] ${o}.${n} -> ${t}${r ? ` (${r})` : ""}`), g = {
|
|
83
|
+
info(o, n) {
|
|
84
|
+
var t;
|
|
85
|
+
process.env.NODE_ENV === "development" && console.log(`[INFO] ${o}`, n || ""), (t = l == null ? void 0 : l.info) == null || t.call(l, o, { ...n, source: "gst-forms" });
|
|
86
|
+
},
|
|
87
|
+
warn(o, n) {
|
|
88
|
+
var t;
|
|
89
|
+
if ($)
|
|
90
|
+
throw new Error(`[GST strict] ${o}`);
|
|
91
|
+
a.has(o) || (a.add(o), (process.env.NODE_ENV === "development" || f) && console.warn(`[WARN] ${o}`, n || ""), (t = l == null ? void 0 : l.warn) == null || t.call(l, o, { ...n, source: "gst-forms" }));
|
|
92
|
+
},
|
|
93
|
+
error(o, n) {
|
|
94
|
+
var t;
|
|
95
|
+
console.error(`[ERROR] ${o}`, n || ""), (t = l == null ? void 0 : l.error) == null || t.call(l, o, { ...n, source: "gst-forms" });
|
|
96
|
+
},
|
|
97
|
+
debug(o, n, t) {
|
|
98
|
+
f && console.log(`[DEBUG:${o}] ${n}`, t || "");
|
|
99
|
+
},
|
|
100
|
+
child(o) {
|
|
101
|
+
return {
|
|
102
|
+
info: (n, t) => g.info(`[${o}] ${n}`, t),
|
|
103
|
+
warn: (n, t) => g.warn(`[${o}] ${n}`, t),
|
|
104
|
+
error: (n, t) => g.error(`[${o}] ${n}`, t),
|
|
105
|
+
debug: (n, t, r) => g.debug(n, `[${o}] ${t}`, r)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}, D = {
|
|
109
|
+
CONFIGURATION: "CONFIGURATION",
|
|
110
|
+
VALIDATION: "VALIDATION",
|
|
111
|
+
RUNTIME: "RUNTIME",
|
|
112
|
+
LIFECYCLE: "LIFECYCLE",
|
|
113
|
+
REGISTRY: "REGISTRY",
|
|
114
|
+
FORMATTING: "FORMATTING",
|
|
115
|
+
PARSING: "PARSING",
|
|
116
|
+
RESOLUTION: "RESOLUTION",
|
|
117
|
+
LOADING: "LOADING",
|
|
118
|
+
ACTION: "ACTION",
|
|
119
|
+
UNKNOWN: "UNKNOWN"
|
|
120
|
+
};
|
|
121
|
+
function V(o, n, t = {}, r = !1) {
|
|
122
|
+
const e = new Error(n);
|
|
123
|
+
if (e.type = o, e.context = t, g.error(n, { type: o, ...t, stack: e.stack }), r) throw e;
|
|
124
|
+
return e;
|
|
125
|
+
}
|
|
126
|
+
const U = () => f;
|
|
127
|
+
function p(o) {
|
|
128
|
+
return o && typeof o == "object" && !Array.isArray(o) && o["..."] === "^";
|
|
129
|
+
}
|
|
130
|
+
function y(o, n) {
|
|
131
|
+
if (!Array.isArray(o) || (Array.isArray(n) || (n = []), !o.some(p))) return o;
|
|
132
|
+
const r = [];
|
|
133
|
+
for (const e of o)
|
|
134
|
+
p(e) ? r.push(...n) : r.push(e);
|
|
135
|
+
return r;
|
|
136
|
+
}
|
|
137
|
+
function c(o, n) {
|
|
138
|
+
if (n == null) return o;
|
|
139
|
+
if (o == null || typeof o != typeof n || typeof n != "object") return n;
|
|
140
|
+
if (Array.isArray(n)) {
|
|
141
|
+
const r = Array.isArray(o) ? o : [];
|
|
142
|
+
return y(n, r);
|
|
143
|
+
}
|
|
144
|
+
const t = { ...o };
|
|
145
|
+
for (const [r, e] of Object.entries(n))
|
|
146
|
+
if (e !== void 0)
|
|
147
|
+
if (e && typeof e == "object" && !Array.isArray(e) && t[r] && typeof t[r] == "object" && !Array.isArray(t[r]))
|
|
148
|
+
t[r] = c(t[r], e);
|
|
149
|
+
else if (Array.isArray(e)) {
|
|
150
|
+
const E = Array.isArray(t[r]) ? t[r] : [];
|
|
151
|
+
t[r] = y(e, E);
|
|
152
|
+
} else
|
|
153
|
+
t[r] = e;
|
|
154
|
+
return t;
|
|
155
|
+
}
|
|
156
|
+
function k(...o) {
|
|
157
|
+
const n = o.filter((t) => t != null);
|
|
158
|
+
return n.length === 0 ? {} : n.length === 1 ? { ...n[0] } : n.reduce((t, r) => c(t, r), {});
|
|
159
|
+
}
|
|
160
|
+
function M(...o) {
|
|
161
|
+
const n = o.filter((t) => t != null);
|
|
162
|
+
return n.length === 0 ? {} : n.length === 1 ? { ...n[0] } : n.reduce((t, r) => ({
|
|
163
|
+
fields: c(t.fields || {}, r.fields || {}),
|
|
164
|
+
buttons: c(t.buttons || {}, r.buttons || {}),
|
|
165
|
+
optionSets: c(t.optionSets || {}, r.optionSets || {}),
|
|
166
|
+
functions: { ...t.functions || {}, ...r.functions || {} },
|
|
167
|
+
hooks: c(t.hooks || {}, r.hooks || {})
|
|
168
|
+
}), {});
|
|
169
|
+
}
|
|
170
|
+
export {
|
|
171
|
+
D as E,
|
|
172
|
+
w as a,
|
|
173
|
+
h as b,
|
|
174
|
+
S as c,
|
|
175
|
+
c as d,
|
|
176
|
+
U as e,
|
|
177
|
+
R as f,
|
|
178
|
+
G as g,
|
|
179
|
+
V as h,
|
|
180
|
+
N as i,
|
|
181
|
+
L as j,
|
|
182
|
+
C as k,
|
|
183
|
+
g as l,
|
|
184
|
+
k as m,
|
|
185
|
+
M as n,
|
|
186
|
+
I as o,
|
|
187
|
+
A as p,
|
|
188
|
+
F as q,
|
|
189
|
+
T as t
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=mergeConfigs-CRhPUSCj.js.map
|