@roomle/web-sdk 7.0.0-alpha.3 → 7.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/THIRD-PARTY-NOTICES.txt +1 -1
  2. package/lib/ConfiguratorKernel.wasm +0 -0
  3. package/lib/RoomleCore.wasm +0 -0
  4. package/lib/RoomleToolsCore.wasm +0 -0
  5. package/lib/{api-B_Mu7Mg1.mjs → api-0LgvKoxe.mjs} +2 -2
  6. package/lib/{api-B_Mu7Mg1.mjs.map → api-0LgvKoxe.mjs.map} +1 -1
  7. package/lib/asset-loader.worker-Bdvb-pt7.mjs.map +1 -1
  8. package/lib/budgeteer.sw-ByZxiRBr.mjs.map +1 -1
  9. package/lib/{configuration-operations-C5rnDS8e.mjs → configuration-operations-B7uJDX_4.mjs} +3 -3
  10. package/lib/{configuration-operations-C5rnDS8e.mjs.map → configuration-operations-B7uJDX_4.mjs.map} +1 -1
  11. package/lib/{configurator-BeDJ8jD1.mjs → configurator-CU7jNdgC.mjs} +3 -3
  12. package/lib/{configurator-BeDJ8jD1.mjs.map → configurator-CU7jNdgC.mjs.map} +1 -1
  13. package/lib/configurator-c5g9sbhL.mjs +3 -0
  14. package/lib/configurator-capabilities-Cr6BAnms.mjs +3 -0
  15. package/lib/{configurator-capabilities-C3TQUu_S.mjs → configurator-capabilities-o8fQ6Ang.mjs} +2 -2
  16. package/lib/{configurator-capabilities-C3TQUu_S.mjs.map → configurator-capabilities-o8fQ6Ang.mjs.map} +1 -1
  17. package/lib/{glb-viewer-BkU2Z-HJ.mjs → glb-viewer-BByRaJ8F.mjs} +3 -3
  18. package/lib/{glb-viewer-BkU2Z-HJ.mjs.map → glb-viewer-BByRaJ8F.mjs.map} +1 -1
  19. package/lib/glb-viewer-q6BU-GNu.mjs +3 -0
  20. package/lib/{homag-intelligence-DboRA-Yd.mjs → homag-intelligence-wHSuuAC4.mjs} +3 -3
  21. package/lib/{homag-intelligence-DboRA-Yd.mjs.map → homag-intelligence-wHSuuAC4.mjs.map} +1 -1
  22. package/lib/{material-viewer-BkaTt8Sn.mjs → material-viewer-beYa7Vpa.mjs} +3 -3
  23. package/lib/{material-viewer-BkaTt8Sn.mjs.map → material-viewer-beYa7Vpa.mjs.map} +1 -1
  24. package/lib/{packages-DZzpY6V8.mjs → packages-BrZdc9Gx.mjs} +5 -5
  25. package/lib/{packages-DZzpY6V8.mjs.map → packages-BrZdc9Gx.mjs.map} +1 -1
  26. package/lib/planner-C0ylcrU1.mjs +3 -0
  27. package/lib/{planner-CuZaTB-P.mjs → planner-CSOl3bpc.mjs} +3 -3
  28. package/lib/{planner-CuZaTB-P.mjs.map → planner-CSOl3bpc.mjs.map} +1 -1
  29. package/lib/roomle-headless.js +7 -7
  30. package/lib/{roomle-sdk-CSH3WHXV.mjs → roomle-sdk-ByoTm5M6.mjs} +21 -21
  31. package/lib/roomle-sdk-ByoTm5M6.mjs.map +1 -0
  32. package/lib/roomle-sdk.js +6 -6
  33. package/lib/{script-loader-O8x5UOnP.mjs → script-loader-DGVS2Wqe.mjs} +2 -2
  34. package/lib/{script-loader-O8x5UOnP.mjs.map → script-loader-DGVS2Wqe.mjs.map} +1 -1
  35. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
  36. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  37. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  38. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  39. package/lib/{tools-core-DJvn2gR6.mjs → tools-core-eVa8OooA.mjs} +3 -3
  40. package/lib/{tools-core-DJvn2gR6.mjs.map → tools-core-eVa8OooA.mjs.map} +1 -1
  41. package/package.json +2 -2
  42. package/sbom.cdx.json +5 -5
  43. package/lib/configurator-capabilities-C42HYCCb.mjs +0 -3
  44. package/lib/configurator-yctV6IDY.mjs +0 -3
  45. package/lib/glb-viewer-jt9mrYrF.mjs +0 -3
  46. package/lib/planner-C7kZ9SKV.mjs +0 -3
  47. package/lib/roomle-sdk-CSH3WHXV.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"configurator-capabilities-C3TQUu_S.mjs","names":[],"sources":["../../packages/common-core/src/mcp-api/component-llm-data.ts","../../packages/common-core/src/mcp-api/component-models.ts","../../packages/common-core/src/mcp-api/configurator-capabilities.ts"],"sourcesContent":["import type { RapiAccess } from '../rapi-access';\nimport { PARAMETER_KERNEL_TYPE } from '../utils/parameter-types';\nimport type { KernelParameter, KernelValue } from '../../../typings/kernel';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n} from './configurator-capabilities-types';\n\n/** A skill a component definition offers the configuration assistant. */\nexport interface ComponentSkill {\n name: string;\n description: string;\n skillData: string;\n}\n\n/** The LLM data a component definition gives one parameter key. */\nexport interface ParameterLlmData {\n llmData?: string;\n values: Array<{ value: CapabilityJson; llmData: string }>;\n}\n\n/** The LLM data of a component definition: its `llm` object and the `llmData` of its parameters. */\nexport interface ComponentLlmData {\n label?: string;\n llmData?: string;\n skills: ComponentSkill[];\n parameters: Record<string, ParameterLlmData>;\n}\n\n/** The component description and skill index, without the skill texts. */\nexport interface ComponentLlmIndex {\n llmData?: string;\n skills: Array<{ name: string; description: string }>;\n}\n\nexport type LlmKernelValue = KernelValue & { llmData?: string };\nexport type LlmKernelParameter = Omit<KernelParameter, 'validValues'> & {\n llmData?: string;\n validValues: LlmKernelValue[];\n};\n\nconst NUMERIC_TYPES: ReadonlySet<string> = new Set([\n PARAMETER_KERNEL_TYPE.DECIMAL,\n PARAMETER_KERNEL_TYPE.INTEGER,\n]);\n\nexport const text = (value: unknown): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined;\nexport const objectOf = (value: unknown): CapabilityJsonObject | undefined =>\n value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as CapabilityJsonObject)\n : undefined;\nexport const objectsOf = (value: unknown): CapabilityJsonObject[] =>\n Array.isArray(value)\n ? value\n .map(objectOf)\n .filter((entry): entry is CapabilityJsonObject => !!entry)\n : [];\n\nconst parameterLlmData = (\n parameter: CapabilityJsonObject,\n): ParameterLlmData | undefined => {\n const llmData = text(parameter.llmData);\n const values = objectsOf(parameter.valueObjects).flatMap((valueObject) => {\n const valueLlmData = text(valueObject.llmData);\n return valueLlmData && valueObject.value !== undefined\n ? [{ value: valueObject.value, llmData: valueLlmData }]\n : [];\n });\n if (!llmData && !values.length) {\n return undefined;\n }\n return { ...(llmData ? { llmData } : {}), values };\n};\n\n/** Reads the LLM data of a parsed component definition; non-string and empty values are left out. */\nexport const componentLlmData = (\n definition: CapabilityJsonObject,\n): ComponentLlmData => {\n const llm = objectOf(definition.llm);\n const llmData = text(llm?.llmData);\n const skills = objectsOf(llm?.skills).flatMap((skill) => {\n const name = text(skill.name);\n return name\n ? [\n {\n name,\n description: text(skill.description) ?? '',\n skillData: text(skill.skillData) ?? '',\n },\n ]\n : [];\n });\n const parameters: Record<string, ParameterLlmData> = {};\n for (const parameter of objectsOf(definition.parameters)) {\n const key = text(parameter.key);\n const data = key ? parameterLlmData(parameter) : undefined;\n if (key && data) {\n parameters[key] = data;\n }\n }\n return { ...(llmData ? { llmData } : {}), skills, parameters };\n};\n\n/** The description and skill index of LLM data, or undefined when it has neither. */\nexport const componentLlmIndex = (\n data: ComponentLlmData,\n): ComponentLlmIndex | undefined =>\n data.llmData || data.skills.length\n ? {\n ...(data.llmData ? { llmData: data.llmData } : {}),\n skills: data.skills.map(({ name, description }) => ({\n name,\n description,\n })),\n }\n : undefined;\n\n/** Fetches a component definition from RAPI and reads its LLM data; rejects when the read fails. */\nexport const fetchComponentLlmData = async (\n rapi: Pick<RapiAccess, 'getComponent'>,\n componentId: string,\n): Promise<ComponentLlmData> => {\n const record = await rapi.getComponent(componentId);\n const definition = record.configuration\n ? objectOf(JSON.parse(record.configuration))\n : undefined;\n if (!definition) {\n throw new Error(\n `the definition of component '${componentId}' has no configuration`,\n );\n }\n const label = text(record.label);\n return { ...componentLlmData(definition), ...(label ? { label } : {}) };\n};\n\n/** Like fetchComponentLlmData, but a failed read gives empty LLM data. */\nexport const readComponentLlmData = async (\n rapi: Pick<RapiAccess, 'getComponent'>,\n componentId: string,\n): Promise<ComponentLlmData> => {\n try {\n return await fetchComponentLlmData(rapi, componentId);\n } catch (error) {\n console.warn(\n `[configurator-mcp] no LLM data for component '${componentId}'`,\n error,\n );\n return { skills: [], parameters: {} };\n }\n};\n\nconst numberOf = (value: CapabilityJson): number =>\n typeof value === 'number' || (typeof value === 'string' && value.trim())\n ? Number(value)\n : Number.NaN;\n\n// The kernel formats a decimal with at least two decimals (\"3000.00\"), so a\n// numeric value is compared after rounding to the decimals the kernel wrote.\nconst matchesValue = (\n type: string,\n definitionValue: CapabilityJson,\n kernelValue: string,\n): boolean => {\n if (!NUMERIC_TYPES.has(type)) {\n return String(definitionValue) === kernelValue;\n }\n const expected = numberOf(definitionValue);\n const actual = numberOf(kernelValue);\n const decimals = kernelValue.split('.')[1]?.length ?? 0;\n return (\n Number.isFinite(expected) &&\n Number.isFinite(actual) &&\n Number(expected.toFixed(decimals)) === actual\n );\n};\n\n/**\n * Adds the `llmData` of the definitions to the kernel parameters: per key and per value, the first\n * definition in the given order that has one. Parameters and values without `llmData` stay as they are.\n */\nexport const withParameterLlmData = (\n parameters: KernelParameter[],\n definitions: ComponentLlmData[],\n): LlmKernelParameter[] =>\n parameters.map((parameter) => {\n const declared = definitions.flatMap(({ parameters: byKey }) =>\n byKey[parameter.key] ? [byKey[parameter.key]] : [],\n );\n if (!declared.length) {\n return parameter;\n }\n const llmData = declared.find((entry) => entry.llmData)?.llmData;\n const values = declared.flatMap((entry) => entry.values);\n return {\n ...parameter,\n ...(llmData ? { llmData } : {}),\n validValues: parameter.validValues.map((value) => {\n const valueLlmData = values.find((entry) =>\n matchesValue(parameter.type, entry.value, value.value),\n )?.llmData;\n return valueLlmData ? { ...value, llmData: valueLlmData } : value;\n }),\n };\n });\n\n/** The distinct component ids of a parsed configuration tree, root first, depth first. */\nexport const configurationComponentIds = (\n configuration: CapabilityJsonObject,\n): string[] => {\n const ids: string[] = [];\n const visit = (node: CapabilityJsonObject) => {\n const id = text(node.componentId);\n if (id && !ids.includes(id)) {\n ids.push(id);\n }\n objectsOf(node.children).forEach(visit);\n };\n visit(configuration);\n return ids;\n};\n","import type { RapiAccess } from '../rapi-access';\nimport {\n componentLlmData,\n objectOf,\n objectsOf,\n text,\n type ComponentLlmData,\n} from './component-llm-data';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n} from './configurator-capabilities-types';\n\n/** A component or item that a component definition names as a possible child. */\nexport interface ComponentModelChild {\n id: string;\n kind: 'component' | 'item';\n label?: string;\n /** The root component of an item child. */\n rootComponentId?: string;\n}\n\n/** What the agent gets of every component of the product: the static context of the system prompt. */\nexport interface ComponentShortModel {\n id: string;\n label?: string;\n llmData?: string;\n skills?: Array<{ name: string; description: string }>;\n children?: ComponentModelChild[];\n}\n\nexport interface ComponentModelValue {\n value: CapabilityJson;\n label?: string;\n llmData?: string;\n}\n\nexport interface ComponentModelParameter {\n key: string;\n label?: string;\n type?: string;\n unitType?: string;\n group?: string;\n defaultValue?: CapabilityJson;\n global?: boolean;\n llmData?: string;\n validValues?: ComponentModelValue[];\n validRange?: CapabilityJsonObject;\n}\n\n/** What the agent gets of one component on request: the short model and the parameters of the definition. */\nexport interface ComponentDetailedModel extends ComponentShortModel {\n parameterGroups?: Array<{ key: string; label?: string }>;\n parameters: ComponentModelParameter[];\n}\n\n/** The static context of a product: the short model of every component of its family, in walk order. */\nexport interface ProductContext {\n rootComponentId: string;\n components: ComponentShortModel[];\n}\n\nexport interface ProductFamilyComponent {\n id: string;\n label?: string;\n thumbnail?: string;\n definition: CapabilityJsonObject;\n llm: ComponentLlmData;\n}\n\nexport interface ProductFamilyItem {\n id: string;\n label?: string;\n thumbnail?: string;\n rootComponentId: string;\n assembly: CapabilityJsonObject;\n}\n\n/** The product family in walk order: the components breadth first from the root, and the items they reference. */\nexport interface ProductFamily {\n components: Map<string, ProductFamilyComponent>;\n items: Map<string, ProductFamilyItem>;\n}\n\nexport type ProductFamilyUnresolved = (\n resourceType: 'component' | 'item',\n id: string,\n error: unknown,\n) => void;\n\ntype FamilyRapi = Pick<RapiAccess, 'getComponent' | 'getItem'>;\ntype ChildLookup = (\n kind: ComponentModelChild['kind'],\n id: string,\n) => Pick<ComponentModelChild, 'label' | 'rootComponentId'> | undefined;\n\nconst RANGE_FIELDS = ['valueFrom', 'valueTo', 'step'];\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value)\n ? value.filter((entry): entry is string => !!text(entry))\n : [];\nconst detach = <T>(value: T): T => JSON.parse(JSON.stringify(value));\n\nconst parseDefinition = (configuration: unknown): CapabilityJsonObject => {\n const parsed =\n typeof configuration === 'string' && configuration\n ? objectOf(JSON.parse(configuration))\n : undefined;\n if (!parsed) {\n throw new Error('Missing or invalid configuration JSON');\n }\n return parsed;\n};\n\nconst familyComponent = (\n id: string,\n record: { label?: string; thumbnail?: string },\n definition: CapabilityJsonObject,\n): ProductFamilyComponent => {\n if (definition.id && definition.id !== id) {\n throw new Error('Component definition ID does not match requested ID');\n }\n const label = text(record.label);\n const thumbnail = text(record.thumbnail);\n return {\n id,\n ...(label ? { label } : {}),\n ...(thumbnail ? { thumbnail } : {}),\n definition,\n llm: componentLlmData(definition),\n };\n};\n\nconst childrenOf = (\n definition: CapabilityJsonObject,\n lookup: ChildLookup,\n): ComponentModelChild[] => {\n const children: ComponentModelChild[] = [];\n const seen = new Set<string>();\n const add = (kind: ComponentModelChild['kind'], value: unknown) => {\n const id = text(value);\n if (!id || seen.has(kind + ':' + id)) {\n return;\n }\n seen.add(kind + ':' + id);\n const known = lookup(kind, id);\n children.push({\n id,\n kind,\n ...(known?.label ? { label: known.label } : {}),\n ...(kind === 'item' && known?.rootComponentId\n ? { rootComponentId: known.rootComponentId }\n : {}),\n });\n };\n for (const child of objectsOf(definition.possibleChildren)) {\n add('component', child.componentId);\n add('item', child.itemId);\n }\n strings(definition.validChildren).forEach((id) => add('component', id));\n return children;\n};\n\nconst valueObjectCandidates = (value: unknown): ComponentModelValue[] =>\n objectsOf(value).flatMap((valueObject) => {\n if (valueObject.value === undefined) {\n return [];\n }\n const label = text(valueObject.label);\n const llmData = text(valueObject.llmData);\n return [\n {\n value: valueObject.value,\n ...(label ? { label } : {}),\n ...(llmData ? { llmData } : {}),\n },\n ];\n });\n\n// The candidates in the kernel's order: valueObjects, validValues,\n// localizedValues, conditionalValues. A value listed twice keeps its first\n// place and takes a label or llmData it lacks from the later entry.\nconst candidateValues = (\n parameter: CapabilityJsonObject,\n): ComponentModelValue[] => {\n const plainValues: ComponentModelValue[] = Array.isArray(\n parameter.validValues,\n )\n ? parameter.validValues\n .filter(\n (value): value is string | number | boolean =>\n value !== null && typeof value !== 'object',\n )\n .map((value) => ({ value }))\n : [];\n const candidates = new Map<CapabilityJson, ComponentModelValue>();\n for (const candidate of [\n ...valueObjectCandidates(parameter.valueObjects),\n ...plainValues,\n ...valueObjectCandidates(parameter.localizedValues),\n ...valueObjectCandidates(parameter.conditionalValues),\n ]) {\n const listed = candidates.get(candidate.value);\n candidates.set(\n candidate.value,\n listed ? { ...candidate, ...listed } : candidate,\n );\n }\n return [...candidates.values()];\n};\n\nconst parameterModel = (\n parameter: CapabilityJsonObject,\n): ComponentModelParameter | undefined => {\n const key = text(parameter.key);\n if (!key) {\n return undefined;\n }\n const validValues = candidateValues(parameter);\n const range = objectOf(parameter.validRange);\n const validRange = range\n ? Object.fromEntries(\n RANGE_FIELDS.filter((field) => range[field] !== undefined).map(\n (field) => [field, range[field]],\n ),\n )\n : undefined;\n const label = text(parameter.label);\n const type = text(parameter.type);\n const unitType = text(parameter.unitType);\n const group = text(parameter.group);\n const llmData = text(parameter.llmData);\n return {\n key,\n ...(label ? { label } : {}),\n ...(type ? { type } : {}),\n ...(unitType ? { unitType } : {}),\n ...(group ? { group } : {}),\n ...(parameter.defaultValue !== undefined\n ? { defaultValue: parameter.defaultValue }\n : {}),\n ...(parameter.global === true ? { global: true } : {}),\n ...(llmData ? { llmData } : {}),\n ...(validValues.length ? { validValues } : {}),\n ...(validRange && Object.keys(validRange).length ? { validRange } : {}),\n };\n};\n\n/** The short model of a component: id, label, LLM description, skill names and the children it can take. */\nexport const shortComponentModel = (\n { id, label, llm, definition }: ProductFamilyComponent,\n lookup: ChildLookup,\n): ComponentShortModel => {\n const children = childrenOf(definition, lookup);\n return detach({\n id,\n ...(label ? { label } : {}),\n ...(llm.llmData ? { llmData: llm.llmData } : {}),\n ...(llm.skills.length\n ? {\n skills: llm.skills.map(({ name, description }) => ({\n name,\n description,\n })),\n }\n : {}),\n ...(children.length ? { children } : {}),\n });\n};\n\n/** The detailed model of a component: the short model plus its parameter groups and parameters. */\nexport const detailedComponentModel = (\n component: ProductFamilyComponent,\n lookup: ChildLookup,\n): ComponentDetailedModel => {\n const { definition } = component;\n const parameterGroups = objectsOf(definition.parameterGroups).flatMap(\n (group) => {\n const key = text(group.key);\n const label = text(group.label);\n return key ? [{ key, ...(label ? { label } : {}) }] : [];\n },\n );\n return detach({\n ...shortComponentModel(component, lookup),\n ...(parameterGroups.length ? { parameterGroups } : {}),\n parameters: objectsOf(definition.parameters).flatMap((parameter) => {\n const model = parameterModel(parameter);\n return model ? [model] : [];\n }),\n });\n};\n\n/** The labels and item roots of the family, for the children of its models. */\nexport const familyLookup =\n (family: ProductFamily): ChildLookup =>\n (kind, id) => {\n if (kind === 'component') {\n const component = family.components.get(id);\n return component && { label: component.label };\n }\n const item = family.items.get(id);\n return item && { label: item.label, rootComponentId: item.rootComponentId };\n };\n\n/**\n * Walks the product family of a configuration as the agent needs it: the components of the\n * configuration and the seeds, then breadth first their possible children, sub-components, valid\n * children and the root components of the items they name, each definition read once. A read that\n * fails is reported and left out.\n */\nexport const collectProductFamily = async (\n rapi: FamilyRapi,\n configuration: CapabilityJsonObject,\n unresolved: ProductFamilyUnresolved,\n seeds: string[],\n): Promise<ProductFamily> => {\n const components = new Map<string, ProductFamilyComponent>();\n const items = new Map<string, ProductFamilyItem>();\n const seenComponents = new Set<string>();\n const seenItems = new Set<string>();\n const pendingComponents: string[] = [];\n const pendingItems: string[] = [];\n const queueComponent = (value: unknown) => {\n const id = text(value);\n if (id && !seenComponents.has(id)) {\n seenComponents.add(id);\n pendingComponents.push(id);\n }\n };\n const queueItem = (value: unknown) => {\n const id = text(value);\n if (id && !seenItems.has(id)) {\n seenItems.add(id);\n pendingItems.push(id);\n }\n };\n const seedAssembly = (assembly: CapabilityJsonObject) => {\n const nodes = [assembly];\n while (nodes.length) {\n const node = nodes.pop()!;\n queueComponent(node.componentId);\n nodes.push(...objectsOf(node.children));\n }\n };\n seeds.forEach(queueComponent);\n seedAssembly(configuration);\n while (pendingComponents.length || pendingItems.length) {\n const batch = pendingComponents.splice(0);\n const itemBatch = pendingItems.splice(0);\n const [definitions, assemblies] = await Promise.all([\n Promise.all(\n batch.map(async (id) => {\n try {\n const record = await rapi.getComponent(id);\n return familyComponent(\n id,\n record,\n parseDefinition(record.configuration),\n );\n } catch (error) {\n unresolved('component', id, error);\n return undefined;\n }\n }),\n ),\n Promise.all(\n itemBatch.map(async (id): Promise<ProductFamilyItem | undefined> => {\n try {\n const record = await rapi.getItem(id);\n const assembly = parseDefinition(record.configuration);\n const rootComponentId = text(assembly.componentId);\n if (!rootComponentId) {\n throw new Error('Item configuration has no root component ID');\n }\n const label = text(record.label);\n const thumbnail = text(record.thumbnail);\n return {\n id,\n ...(label ? { label } : {}),\n ...(thumbnail ? { thumbnail } : {}),\n rootComponentId,\n assembly,\n };\n } catch (error) {\n unresolved('item', id, error);\n return undefined;\n }\n }),\n ),\n ]);\n for (const component of definitions) {\n if (!component) {\n continue;\n }\n components.set(component.id, component);\n const { definition } = component;\n for (const child of [\n ...objectsOf(definition.possibleChildren),\n ...objectsOf(definition.subComponents),\n ]) {\n queueComponent(child.componentId);\n queueItem(child.itemId);\n }\n strings(definition.validChildren).forEach(queueComponent);\n }\n for (const item of assemblies) {\n if (!item) {\n continue;\n }\n items.set(item.id, item);\n seedAssembly(item.assembly);\n }\n }\n return { components, items };\n};\n\n/** The product context of a family: the short model of every component, in walk order. */\nexport const productContextOf = (\n family: ProductFamily,\n rootComponentId: string,\n): ProductContext => {\n const lookup = familyLookup(family);\n return {\n rootComponentId,\n components: [...family.components.values()].map((component) =>\n shortComponentModel(component, lookup),\n ),\n };\n};\n\n/**\n * Reads the detailed model of one component by its id, also of a component that is not in the\n * configuration. The direct children are read for their labels; a child RAPI cannot deliver keeps\n * its id only.\n */\nexport const readComponentDefinition = async (\n rapi: FamilyRapi,\n componentId: string,\n): Promise<ComponentDetailedModel> => {\n const record = await rapi.getComponent(componentId);\n const component = familyComponent(\n componentId,\n record,\n parseDefinition(record.configuration),\n );\n const known = new Map<\n string,\n Pick<ComponentModelChild, 'label' | 'rootComponentId'>\n >();\n await Promise.all(\n childrenOf(component.definition, () => undefined).map(\n async ({ id, kind }) => {\n try {\n if (kind === 'component') {\n const child = await rapi.getComponent(id);\n known.set(kind + ':' + id, { label: text(child.label) });\n } else {\n const item = await rapi.getItem(id);\n const assembly = parseDefinition(item.configuration);\n known.set(kind + ':' + id, {\n label: text(item.label),\n rootComponentId: text(assembly.componentId),\n });\n }\n } catch {\n /* The child keeps its id. */\n }\n },\n ),\n );\n return detailedComponentModel(component, (kind, id) =>\n known.get(kind + ':' + id),\n );\n};\n","import {\n CAPABILITY_SECTIONS,\n capabilitiesIncludeSchema,\n} from './configuration-operation-schemas';\nimport type ConfiguratorKernelAccess from '../configurator-kernel-access';\nimport type ConfiguratorContext from '../webgl/configurator-context';\nimport type { RapiAccess } from '../rapi-access';\nimport { BASE_CONTEXT } from '../main';\nimport type {\n KernelParameter,\n KernelParameterGroup,\n} from '../../../typings/kernel';\nimport type { RapiMaterial } from '../../../typings/rapi-types';\nimport {\n configurationComponentIds,\n withParameterLlmData,\n type ComponentLlmData,\n} from './component-llm-data';\nimport {\n collectProductFamily,\n detailedComponentModel,\n familyLookup,\n type ComponentModelParameter,\n} from './component-models';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n ConfiguratorCapabilities,\n ConfiguratorCapabilityContext,\n ConfiguratorCapabilityInstance,\n ConfiguratorCapabilitySection,\n} from './configurator-capabilities-types';\n\nconst detach = <T>(value: T): T => JSON.parse(JSON.stringify(value));\nconst detachParameters = (parameters: KernelParameter[]): KernelParameter[] =>\n parameters.map((parameter) =>\n detach({\n ...parameter,\n ...(parameter.viewType\n ? { viewType: { value: parameter.viewType.value } }\n : {}),\n }),\n );\nconst object = (value: unknown): CapabilityJsonObject | undefined =>\n value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as CapabilityJsonObject)\n : undefined;\nconst objects = (value: CapabilityJson | undefined): CapabilityJsonObject[] =>\n Array.isArray(value)\n ? value\n .map(object)\n .filter((entry): entry is CapabilityJsonObject => !!entry)\n : [];\nconst strings = (value: CapabilityJson | undefined): string[] =>\n Array.isArray(value)\n ? value.filter(\n (entry): entry is string => typeof entry === 'string' && !!entry,\n )\n : [];\nconst project = (source: object, keys: string[]): CapabilityJsonObject => {\n const entries = Object.entries(source).filter(\n ([key, value]) => keys.includes(key) && value !== undefined,\n );\n return detach(Object.fromEntries(entries));\n};\nconst parseConfiguration = (\n value: string | undefined,\n): CapabilityJsonObject => {\n const parsed = value && object(JSON.parse(value));\n if (!parsed) {\n throw new Error('Missing or invalid configuration JSON');\n }\n return parsed;\n};\nconst childIds = (value: unknown): number[] => {\n if (Array.isArray(value)) {\n return [...value];\n }\n const list = value as { size(): number; get(index: number): number };\n return Array.from({ length: list.size() }, (_, i) => list.get(i));\n};\n\ntype Unresolved = (\n resourceType: ConfiguratorCapabilities['unresolved'][number]['resourceType'],\n id: string,\n error: unknown,\n) => void;\n\nconst discoverProductFamily = async (\n rapi: RapiAccess,\n configuration: CapabilityJsonObject,\n instances: ConfiguratorCapabilityInstance[],\n unresolved: Unresolved,\n) => {\n const family = await collectProductFamily(\n rapi,\n configuration,\n unresolved,\n instances.map((instance) => instance.componentId),\n );\n const lookup = familyLookup(family);\n const components: NonNullable<ConfiguratorCapabilities['components']> = {};\n const items: NonNullable<ConfiguratorCapabilities['items']> = {};\n const declaredByComponent: Record<string, ComponentModelParameter[]> = {};\n const declaredRawParameters: Record<string, CapabilityJsonObject[]> = {};\n const llmDataByComponent: Record<string, ComponentLlmData> = {};\n for (const [id, component] of family.components) {\n const model = detailedComponentModel(component, lookup);\n components[id] = model;\n declaredByComponent[id] = model.parameters;\n declaredRawParameters[id] = objects(component.definition.parameters);\n llmDataByComponent[id] = component.llm;\n }\n for (const [id, item] of family.items) {\n items[id] = {\n ...(item.label ? { label: item.label } : {}),\n ...(item.thumbnail ? { thumbnail: item.thumbnail } : {}),\n rootComponentId: item.rootComponentId,\n };\n }\n return {\n components,\n items,\n declaredByComponent,\n declaredRawParameters,\n llmDataByComponent,\n };\n};\n\nconst collectMaterials = async (\n rapi: RapiAccess,\n declaredByComponent: Record<string, CapabilityJsonObject[]>,\n current: NonNullable<ConfiguratorCapabilities['parameters']>['current'],\n unresolved: Unresolved,\n): Promise<NonNullable<ConfiguratorCapabilities['materials']>> => {\n const materials: NonNullable<ConfiguratorCapabilities['materials']> = {\n byId: {},\n groups: {},\n };\n const materialIds = new Set<string>();\n const groupIds = new Set<string>();\n const addId = (set: Set<string>, id: unknown) => {\n if (typeof id === 'string' && id) {\n set.add(id);\n }\n };\n const collectParameter = (parameter: CapabilityJsonObject) => {\n if (parameter.type !== 'Material') {\n return;\n }\n addId(materialIds, parameter.value);\n addId(materialIds, parameter.defaultValue);\n if (Array.isArray(parameter.validValues)) {\n for (const value of parameter.validValues) {\n addId(materialIds, object(value)?.value ?? value);\n }\n }\n for (const key of [\n 'valueObjects',\n 'localizedValues',\n 'conditionalValues',\n ]) {\n objects(parameter[key]).forEach((value) =>\n addId(materialIds, value.value),\n );\n }\n strings(parameter.validGroups).forEach((id) => groupIds.add(id));\n objects(parameter.conditionalGroups).forEach((group) =>\n addId(groupIds, group.value),\n );\n };\n Object.values(declaredByComponent).flat().forEach(collectParameter);\n const currentParameters: KernelParameter[] = [\n ...current.global.parameters,\n ...Object.values(current.byComponent).flatMap((value) => value.parameters),\n ];\n currentParameters.forEach((parameter) =>\n collectParameter(\n project(parameter, ['type', 'value', 'validValues', 'validGroups']),\n ),\n );\n const addMaterial = (material: RapiMaterial) => {\n materials.byId[material.id] = project(material, [\n 'id',\n 'name',\n 'label',\n 'thumbnail',\n 'color',\n 'active',\n 'group',\n 'groupLabel',\n 'tags',\n ]);\n if (material.shading?.basecolor !== undefined) {\n materials.byId[material.id].shading = project(material.shading, [\n 'basecolor',\n ]);\n }\n };\n await Promise.all(\n [...groupIds].map(async (id) => {\n try {\n const online = navigator.onLine;\n const groups = await rapi.getMaterialsByGroup([id]);\n const matched = groups.find(\n (group) => group.id === id || group.legacyId === id,\n );\n const members = groups.flatMap((group) =>\n group.materials.filter(\n (material) =>\n group === matched ||\n material.group === id ||\n material.tags?.includes(id),\n ),\n );\n members.forEach(addMaterial);\n const legacyMaterial = members.find(\n (material) => material.group === id,\n );\n const label = matched?.label ?? legacyMaterial?.groupLabel;\n const legacyId = matched?.legacyId ?? (legacyMaterial ? id : undefined);\n materials.groups[id] = {\n id,\n ...(label ? { label } : {}),\n ...(legacyId ? { legacyId } : {}),\n materialIds: [...new Set(members.map((material) => material.id))],\n };\n if (!online || !navigator.onLine) {\n unresolved(\n 'materialGroup',\n id,\n 'Offline material group coverage cannot be established',\n );\n }\n } catch (error) {\n unresolved('materialGroup', id, error);\n }\n }),\n );\n const missingIds = [...materialIds].filter((id) => !materials.byId[id]);\n if (missingIds.length) {\n try {\n (await rapi.getMaterials(missingIds)).forEach(addMaterial);\n missingIds\n .filter((id) => !materials.byId[id])\n .forEach((id) =>\n unresolved('material', id, 'Material metadata unavailable'),\n );\n } catch (error) {\n missingIds.forEach((id) => unresolved('material', id, error));\n }\n }\n return materials;\n};\n\nexport const collectConfiguratorCapabilities = async (\n context: ConfiguratorContext,\n access: ConfiguratorKernelAccess,\n rapi: RapiAccess,\n include?: ConfiguratorCapabilitySection[],\n): Promise<ConfiguratorCapabilities> => {\n const parsed = capabilitiesIncludeSchema.safeParse(include ?? undefined);\n if (!parsed.success) {\n throw new Error('Unknown configurator capability section');\n }\n const sections = new Set(\n parsed.data?.length ? parsed.data : CAPABILITY_SECTIONS,\n );\n const kernel = access.kernelInstance;\n const captureContext = (): ConfiguratorCapabilityContext => {\n if (\n context.baseContext !== BASE_CONTEXT.CONFIGURATOR ||\n !context.configurationRuntimeId\n ) {\n throw new Error(\n 'Load a configuration or enter planner isolation before reading configurator capabilities',\n );\n }\n if (kernel.isExternalPlanObject(context.configurationRuntimeId)) {\n throw new Error(\n 'Use the HI external-object API to read capabilities of an external configuration',\n );\n }\n const rootRuntimeId = kernel.getRootPlanComponentIdFromObjectId(\n context.configurationRuntimeId,\n );\n if (!rootRuntimeId) {\n throw new Error(\n 'No active root component; load a configuration before reading capabilities',\n );\n }\n return {\n configurationRuntimeId: context.configurationRuntimeId,\n rootRuntimeId,\n rootComponentId: kernel.getComponentId(rootRuntimeId),\n selectedRuntimeIds: [...context.selectedRuntimeComponentIds],\n configurationHash: access.getCurrentConfigurationHash(\n context.configurationRuntimeId,\n ),\n };\n };\n const captured = captureContext();\n const rootAsGlobal = context.rootComponentParametersAsGlobal;\n const contextRootId = context.rootComponentId;\n const assertFresh = () => {\n try {\n if (\n JSON.stringify(captureContext()) === JSON.stringify(captured) &&\n rootAsGlobal === context.rootComponentParametersAsGlobal &&\n contextRootId === context.rootComponentId\n ) {\n return;\n }\n } catch {\n /* A target that disappeared also invalidates the captured read. */\n }\n throw new Error(\n 'Configuration or selection changed while reading capabilities; read again',\n );\n };\n const result: ConfiguratorCapabilities = {\n context: captured,\n complete: true,\n unresolved: [],\n };\n const unresolved = (\n resourceType: ConfiguratorCapabilities['unresolved'][number]['resourceType'],\n id: string,\n error: unknown,\n ) => {\n result.complete = false;\n result.unresolved.push({\n resourceType,\n id,\n sections: [...sections].filter(\n (section) =>\n section !== 'configuration' &&\n (!resourceType.startsWith('material') || section === 'materials'),\n ),\n reason: error instanceof Error ? error.message : String(error),\n });\n };\n const configuration = parseConfiguration(\n access.getSerializedConfiguration(captured.configurationRuntimeId),\n );\n const instances: ConfiguratorCapabilityInstance[] = [];\n const current: NonNullable<\n ConfiguratorCapabilities['parameters']\n >['current'] = {\n global: {\n scope: rootAsGlobal ? 'rootComponent' : 'planObject',\n parameters: [],\n groups: [],\n },\n byComponent: {},\n };\n const docking: NonNullable<ConfiguratorCapabilities['docking']> = {\n current: { globalPossibleChildren: [], byComponent: {} },\n };\n const needsParameters =\n sections.has('parameters') || sections.has('materials');\n const reads: Array<Promise<void>> = [];\n const pendingRuntimeIds = [captured.rootRuntimeId];\n const visitedRuntimeIds = new Set<number>();\n while (pendingRuntimeIds.length) {\n const runtimeId = pendingRuntimeIds.shift()!;\n if (visitedRuntimeIds.has(runtimeId)) {\n continue;\n }\n visitedRuntimeIds.add(runtimeId);\n const component = kernel.getComponent(runtimeId);\n const componentId = kernel.getComponentId(runtimeId);\n const childRuntimeIds = childIds(component.childIds);\n instances.push({\n runtimeId,\n componentId,\n parentRuntimeId: component.parentId || null,\n childRuntimeIds,\n });\n pendingRuntimeIds.push(...childRuntimeIds);\n if (needsParameters) {\n const groups = detach(component.parameterGroups);\n reads.push(\n access.getComponentParameters(runtimeId).then((parameters) => {\n current.byComponent[runtimeId] = {\n componentId,\n groups,\n parameters: detachParameters(parameters),\n };\n }),\n );\n }\n if (sections.has('docking')) {\n docking.current.byComponent[runtimeId] = detach(\n kernel.getPlanComponentPossibleChildren(runtimeId),\n );\n }\n }\n if (needsParameters) {\n const globalDefinition = rootAsGlobal\n ? kernel.getComponent(captured.rootRuntimeId)\n : kernel.getPlanObject(captured.configurationRuntimeId);\n current.global.groups = detach(\n (globalDefinition.parameterGroups ?? []) as KernelParameterGroup[],\n );\n reads.push(\n access\n .getGlobalParameters(captured.configurationRuntimeId, rootAsGlobal)\n .then((parameters) => {\n current.global.parameters = detachParameters(parameters);\n }),\n );\n }\n if (sections.has('docking')) {\n docking.current.globalPossibleChildren = detach(\n kernel.getPlanObjectPossibleChildren(captured.configurationRuntimeId),\n );\n }\n await Promise.all(reads);\n assertFresh();\n if (sections.has('configuration')) {\n result.configuration = { data: configuration, instances };\n }\n if (sections.size === 1 && sections.has('configuration')) {\n return result;\n }\n\n const {\n components,\n items,\n declaredByComponent,\n declaredRawParameters,\n llmDataByComponent,\n } = await discoverProductFamily(rapi, configuration, instances, unresolved);\n if (sections.has('components')) {\n result.components = components;\n }\n if (sections.has('items')) {\n result.items = items;\n }\n if (sections.has('parameters')) {\n const llmDataOf = (componentId: string) =>\n llmDataByComponent[componentId] ? [llmDataByComponent[componentId]] : [];\n for (const entry of Object.values(current.byComponent)) {\n entry.parameters = withParameterLlmData(\n entry.parameters,\n llmDataOf(entry.componentId),\n );\n }\n current.global.parameters = withParameterLlmData(\n current.global.parameters,\n configurationComponentIds(configuration).flatMap(llmDataOf),\n );\n result.parameters = { declaredByComponent, current };\n }\n if (sections.has('docking')) {\n result.docking = docking;\n }\n\n if (sections.has('materials')) {\n result.materials = await collectMaterials(\n rapi,\n declaredRawParameters,\n current,\n unresolved,\n );\n }\n assertFresh();\n return result;\n};\n"],"mappings":";;;;AAyCA,IAAM,IAAqC,IAAI,IAAI,CACjD,EAAsB,SACtB,EAAsB,QACvB,CAAC,EAEW,KAAQ,MACnB,OAAO,KAAU,YAAY,EAAM,MAAM,GAAG,IAAQ,KAAA,GACzC,KAAY,MACL,OAAO,KAAU,YAAnC,KAA+C,CAAC,MAAM,QAAQ,EAAM,GAC/D,IACD,KAAA,GACO,KAAa,MACxB,MAAM,QAAQ,EAAM,GAChB,EACG,IAAI,EAAS,CACb,QAAQ,MAAyC,CAAC,CAAC,EAAM,GAC5D,EAAE,EAEF,KAC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xC,EACD,EAAM,KACJ,EACG,oBAAoB,EAAS,wBAAwB,EAAa,CAClE,MAAM,MAAe;AACpB,KAAQ,OAAO,aAAa,EAAiB,EAAW;IACxD,CACL;;AAYH,KAVI,EAAS,IAAI,UAAU,KACzB,EAAQ,QAAQ,yBAAyB,EACvC,EAAO,8BAA8B,EAAS,uBAAuB,CACtE,GAEH,MAAM,QAAQ,IAAI,EAAM,EACxB,GAAa,EACT,EAAS,IAAI,gBAAgB,KAC/B,EAAO,gBAAgB;EAAE,MAAM;EAAe;EAAW,GAEvD,EAAS,SAAS,KAAK,EAAS,IAAI,gBAAgB,CACtD,QAAO;CAGT,IAAM,EACJ,eACA,UACA,wBACA,0BACA,0BACE,MAAM,EAAsB,GAAM,GAAe,GAAW,EAAW;AAO3E,KANI,EAAS,IAAI,aAAa,KAC5B,EAAO,aAAa,IAElB,EAAS,IAAI,QAAQ,KACvB,EAAO,QAAQ,IAEb,EAAS,IAAI,aAAa,EAAE;EAC9B,IAAM,KAAa,MACjB,EAAmB,KAAe,CAAC,EAAmB,GAAa,GAAG,EAAE;AAC1E,OAAK,IAAM,KAAS,OAAO,OAAO,EAAQ,YAAY,CACpD,GAAM,aAAa,EACjB,EAAM,YACN,EAAU,EAAM,YAAY,CAC7B;AAMH,EAJA,EAAQ,OAAO,aAAa,EAC1B,EAAQ,OAAO,YACf,EAA0B,EAAc,CAAC,QAAQ,EAAU,CAC5D,EACD,EAAO,aAAa;GAAE;GAAqB;GAAS;;AAetD,QAbI,EAAS,IAAI,UAAU,KACzB,EAAO,UAAU,IAGf,EAAS,IAAI,YAAY,KAC3B,EAAO,YAAY,MAAM,EACvB,GACA,GACA,GACA,EACD,GAEH,GAAa,EACN"}
1
+ {"version":3,"file":"configurator-capabilities-o8fQ6Ang.mjs","names":[],"sources":["../../packages/common-core/src/mcp-api/component-llm-data.ts","../../packages/common-core/src/mcp-api/component-models.ts","../../packages/common-core/src/mcp-api/configurator-capabilities.ts"],"sourcesContent":["import type { RapiAccess } from '../rapi-access';\nimport { PARAMETER_KERNEL_TYPE } from '../utils/parameter-types';\nimport type { KernelParameter, KernelValue } from '../../../typings/kernel';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n} from './configurator-capabilities-types';\n\n/** A skill a component definition offers the configuration assistant. */\nexport interface ComponentSkill {\n name: string;\n description: string;\n skillData: string;\n}\n\n/** The LLM data a component definition gives one parameter key. */\nexport interface ParameterLlmData {\n llmData?: string;\n values: Array<{ value: CapabilityJson; llmData: string }>;\n}\n\n/** The LLM data of a component definition: its `llm` object and the `llmData` of its parameters. */\nexport interface ComponentLlmData {\n label?: string;\n llmData?: string;\n skills: ComponentSkill[];\n parameters: Record<string, ParameterLlmData>;\n}\n\n/** The component description and skill index, without the skill texts. */\nexport interface ComponentLlmIndex {\n llmData?: string;\n skills: Array<{ name: string; description: string }>;\n}\n\nexport type LlmKernelValue = KernelValue & { llmData?: string };\nexport type LlmKernelParameter = Omit<KernelParameter, 'validValues'> & {\n llmData?: string;\n validValues: LlmKernelValue[];\n};\n\nconst NUMERIC_TYPES: ReadonlySet<string> = new Set([\n PARAMETER_KERNEL_TYPE.DECIMAL,\n PARAMETER_KERNEL_TYPE.INTEGER,\n]);\n\nexport const text = (value: unknown): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined;\nexport const objectOf = (value: unknown): CapabilityJsonObject | undefined =>\n value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as CapabilityJsonObject)\n : undefined;\nexport const objectsOf = (value: unknown): CapabilityJsonObject[] =>\n Array.isArray(value)\n ? value\n .map(objectOf)\n .filter((entry): entry is CapabilityJsonObject => !!entry)\n : [];\n\nconst parameterLlmData = (\n parameter: CapabilityJsonObject,\n): ParameterLlmData | undefined => {\n const llmData = text(parameter.llmData);\n const values = objectsOf(parameter.valueObjects).flatMap((valueObject) => {\n const valueLlmData = text(valueObject.llmData);\n return valueLlmData && valueObject.value !== undefined\n ? [{ value: valueObject.value, llmData: valueLlmData }]\n : [];\n });\n if (!llmData && !values.length) {\n return undefined;\n }\n return { ...(llmData ? { llmData } : {}), values };\n};\n\n/** Reads the LLM data of a parsed component definition; non-string and empty values are left out. */\nexport const componentLlmData = (\n definition: CapabilityJsonObject,\n): ComponentLlmData => {\n const llm = objectOf(definition.llm);\n const llmData = text(llm?.llmData);\n const skills = objectsOf(llm?.skills).flatMap((skill) => {\n const name = text(skill.name);\n return name\n ? [\n {\n name,\n description: text(skill.description) ?? '',\n skillData: text(skill.skillData) ?? '',\n },\n ]\n : [];\n });\n const parameters: Record<string, ParameterLlmData> = {};\n for (const parameter of objectsOf(definition.parameters)) {\n const key = text(parameter.key);\n const data = key ? parameterLlmData(parameter) : undefined;\n if (key && data) {\n parameters[key] = data;\n }\n }\n return { ...(llmData ? { llmData } : {}), skills, parameters };\n};\n\n/** The description and skill index of LLM data, or undefined when it has neither. */\nexport const componentLlmIndex = (\n data: ComponentLlmData,\n): ComponentLlmIndex | undefined =>\n data.llmData || data.skills.length\n ? {\n ...(data.llmData ? { llmData: data.llmData } : {}),\n skills: data.skills.map(({ name, description }) => ({\n name,\n description,\n })),\n }\n : undefined;\n\n/** Fetches a component definition from RAPI and reads its LLM data; rejects when the read fails. */\nexport const fetchComponentLlmData = async (\n rapi: Pick<RapiAccess, 'getComponent'>,\n componentId: string,\n): Promise<ComponentLlmData> => {\n const record = await rapi.getComponent(componentId);\n const definition = record.configuration\n ? objectOf(JSON.parse(record.configuration))\n : undefined;\n if (!definition) {\n throw new Error(\n `the definition of component '${componentId}' has no configuration`,\n );\n }\n const label = text(record.label);\n return { ...componentLlmData(definition), ...(label ? { label } : {}) };\n};\n\n/** Like fetchComponentLlmData, but a failed read gives empty LLM data. */\nexport const readComponentLlmData = async (\n rapi: Pick<RapiAccess, 'getComponent'>,\n componentId: string,\n): Promise<ComponentLlmData> => {\n try {\n return await fetchComponentLlmData(rapi, componentId);\n } catch (error) {\n console.warn(\n `[configurator-mcp] no LLM data for component '${componentId}'`,\n error,\n );\n return { skills: [], parameters: {} };\n }\n};\n\nconst numberOf = (value: CapabilityJson): number =>\n typeof value === 'number' || (typeof value === 'string' && value.trim())\n ? Number(value)\n : Number.NaN;\n\n// The kernel formats a decimal with at least two decimals (\"3000.00\"), so a\n// numeric value is compared after rounding to the decimals the kernel wrote.\nconst matchesValue = (\n type: string,\n definitionValue: CapabilityJson,\n kernelValue: string,\n): boolean => {\n if (!NUMERIC_TYPES.has(type)) {\n return String(definitionValue) === kernelValue;\n }\n const expected = numberOf(definitionValue);\n const actual = numberOf(kernelValue);\n const decimals = kernelValue.split('.')[1]?.length ?? 0;\n return (\n Number.isFinite(expected) &&\n Number.isFinite(actual) &&\n Number(expected.toFixed(decimals)) === actual\n );\n};\n\n/**\n * Adds the `llmData` of the definitions to the kernel parameters: per key and per value, the first\n * definition in the given order that has one. Parameters and values without `llmData` stay as they are.\n */\nexport const withParameterLlmData = (\n parameters: KernelParameter[],\n definitions: ComponentLlmData[],\n): LlmKernelParameter[] =>\n parameters.map((parameter) => {\n const declared = definitions.flatMap(({ parameters: byKey }) =>\n byKey[parameter.key] ? [byKey[parameter.key]] : [],\n );\n if (!declared.length) {\n return parameter;\n }\n const llmData = declared.find((entry) => entry.llmData)?.llmData;\n const values = declared.flatMap((entry) => entry.values);\n return {\n ...parameter,\n ...(llmData ? { llmData } : {}),\n validValues: parameter.validValues.map((value) => {\n const valueLlmData = values.find((entry) =>\n matchesValue(parameter.type, entry.value, value.value),\n )?.llmData;\n return valueLlmData ? { ...value, llmData: valueLlmData } : value;\n }),\n };\n });\n\n/** The distinct component ids of a parsed configuration tree, root first, depth first. */\nexport const configurationComponentIds = (\n configuration: CapabilityJsonObject,\n): string[] => {\n const ids: string[] = [];\n const visit = (node: CapabilityJsonObject) => {\n const id = text(node.componentId);\n if (id && !ids.includes(id)) {\n ids.push(id);\n }\n objectsOf(node.children).forEach(visit);\n };\n visit(configuration);\n return ids;\n};\n","import type { RapiAccess } from '../rapi-access';\nimport {\n componentLlmData,\n objectOf,\n objectsOf,\n text,\n type ComponentLlmData,\n} from './component-llm-data';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n} from './configurator-capabilities-types';\n\n/** A component or item that a component definition names as a possible child. */\nexport interface ComponentModelChild {\n id: string;\n kind: 'component' | 'item';\n label?: string;\n /** The root component of an item child. */\n rootComponentId?: string;\n}\n\n/** What the agent gets of every component of the product: the static context of the system prompt. */\nexport interface ComponentShortModel {\n id: string;\n label?: string;\n llmData?: string;\n skills?: Array<{ name: string; description: string }>;\n children?: ComponentModelChild[];\n}\n\nexport interface ComponentModelValue {\n value: CapabilityJson;\n label?: string;\n llmData?: string;\n}\n\nexport interface ComponentModelParameter {\n key: string;\n label?: string;\n type?: string;\n unitType?: string;\n group?: string;\n defaultValue?: CapabilityJson;\n global?: boolean;\n llmData?: string;\n validValues?: ComponentModelValue[];\n validRange?: CapabilityJsonObject;\n}\n\n/** What the agent gets of one component on request: the short model and the parameters of the definition. */\nexport interface ComponentDetailedModel extends ComponentShortModel {\n parameterGroups?: Array<{ key: string; label?: string }>;\n parameters: ComponentModelParameter[];\n}\n\n/** The static context of a product: the short model of every component of its family, in walk order. */\nexport interface ProductContext {\n rootComponentId: string;\n components: ComponentShortModel[];\n}\n\nexport interface ProductFamilyComponent {\n id: string;\n label?: string;\n thumbnail?: string;\n definition: CapabilityJsonObject;\n llm: ComponentLlmData;\n}\n\nexport interface ProductFamilyItem {\n id: string;\n label?: string;\n thumbnail?: string;\n rootComponentId: string;\n assembly: CapabilityJsonObject;\n}\n\n/** The product family in walk order: the components breadth first from the root, and the items they reference. */\nexport interface ProductFamily {\n components: Map<string, ProductFamilyComponent>;\n items: Map<string, ProductFamilyItem>;\n}\n\nexport type ProductFamilyUnresolved = (\n resourceType: 'component' | 'item',\n id: string,\n error: unknown,\n) => void;\n\ntype FamilyRapi = Pick<RapiAccess, 'getComponent' | 'getItem'>;\ntype ChildLookup = (\n kind: ComponentModelChild['kind'],\n id: string,\n) => Pick<ComponentModelChild, 'label' | 'rootComponentId'> | undefined;\n\nconst RANGE_FIELDS = ['valueFrom', 'valueTo', 'step'];\n\nconst strings = (value: unknown): string[] =>\n Array.isArray(value)\n ? value.filter((entry): entry is string => !!text(entry))\n : [];\nconst detach = <T>(value: T): T => JSON.parse(JSON.stringify(value));\n\nconst parseDefinition = (configuration: unknown): CapabilityJsonObject => {\n const parsed =\n typeof configuration === 'string' && configuration\n ? objectOf(JSON.parse(configuration))\n : undefined;\n if (!parsed) {\n throw new Error('Missing or invalid configuration JSON');\n }\n return parsed;\n};\n\nconst familyComponent = (\n id: string,\n record: { label?: string; thumbnail?: string },\n definition: CapabilityJsonObject,\n): ProductFamilyComponent => {\n if (definition.id && definition.id !== id) {\n throw new Error('Component definition ID does not match requested ID');\n }\n const label = text(record.label);\n const thumbnail = text(record.thumbnail);\n return {\n id,\n ...(label ? { label } : {}),\n ...(thumbnail ? { thumbnail } : {}),\n definition,\n llm: componentLlmData(definition),\n };\n};\n\nconst childrenOf = (\n definition: CapabilityJsonObject,\n lookup: ChildLookup,\n): ComponentModelChild[] => {\n const children: ComponentModelChild[] = [];\n const seen = new Set<string>();\n const add = (kind: ComponentModelChild['kind'], value: unknown) => {\n const id = text(value);\n if (!id || seen.has(kind + ':' + id)) {\n return;\n }\n seen.add(kind + ':' + id);\n const known = lookup(kind, id);\n children.push({\n id,\n kind,\n ...(known?.label ? { label: known.label } : {}),\n ...(kind === 'item' && known?.rootComponentId\n ? { rootComponentId: known.rootComponentId }\n : {}),\n });\n };\n for (const child of objectsOf(definition.possibleChildren)) {\n add('component', child.componentId);\n add('item', child.itemId);\n }\n strings(definition.validChildren).forEach((id) => add('component', id));\n return children;\n};\n\nconst valueObjectCandidates = (value: unknown): ComponentModelValue[] =>\n objectsOf(value).flatMap((valueObject) => {\n if (valueObject.value === undefined) {\n return [];\n }\n const label = text(valueObject.label);\n const llmData = text(valueObject.llmData);\n return [\n {\n value: valueObject.value,\n ...(label ? { label } : {}),\n ...(llmData ? { llmData } : {}),\n },\n ];\n });\n\n// The candidates in the kernel's order: valueObjects, validValues,\n// localizedValues, conditionalValues. A value listed twice keeps its first\n// place and takes a label or llmData it lacks from the later entry.\nconst candidateValues = (\n parameter: CapabilityJsonObject,\n): ComponentModelValue[] => {\n const plainValues: ComponentModelValue[] = Array.isArray(\n parameter.validValues,\n )\n ? parameter.validValues\n .filter(\n (value): value is string | number | boolean =>\n value !== null && typeof value !== 'object',\n )\n .map((value) => ({ value }))\n : [];\n const candidates = new Map<CapabilityJson, ComponentModelValue>();\n for (const candidate of [\n ...valueObjectCandidates(parameter.valueObjects),\n ...plainValues,\n ...valueObjectCandidates(parameter.localizedValues),\n ...valueObjectCandidates(parameter.conditionalValues),\n ]) {\n const listed = candidates.get(candidate.value);\n candidates.set(\n candidate.value,\n listed ? { ...candidate, ...listed } : candidate,\n );\n }\n return [...candidates.values()];\n};\n\nconst parameterModel = (\n parameter: CapabilityJsonObject,\n): ComponentModelParameter | undefined => {\n const key = text(parameter.key);\n if (!key) {\n return undefined;\n }\n const validValues = candidateValues(parameter);\n const range = objectOf(parameter.validRange);\n const validRange = range\n ? Object.fromEntries(\n RANGE_FIELDS.filter((field) => range[field] !== undefined).map(\n (field) => [field, range[field]],\n ),\n )\n : undefined;\n const label = text(parameter.label);\n const type = text(parameter.type);\n const unitType = text(parameter.unitType);\n const group = text(parameter.group);\n const llmData = text(parameter.llmData);\n return {\n key,\n ...(label ? { label } : {}),\n ...(type ? { type } : {}),\n ...(unitType ? { unitType } : {}),\n ...(group ? { group } : {}),\n ...(parameter.defaultValue !== undefined\n ? { defaultValue: parameter.defaultValue }\n : {}),\n ...(parameter.global === true ? { global: true } : {}),\n ...(llmData ? { llmData } : {}),\n ...(validValues.length ? { validValues } : {}),\n ...(validRange && Object.keys(validRange).length ? { validRange } : {}),\n };\n};\n\n/** The short model of a component: id, label, LLM description, skill names and the children it can take. */\nexport const shortComponentModel = (\n { id, label, llm, definition }: ProductFamilyComponent,\n lookup: ChildLookup,\n): ComponentShortModel => {\n const children = childrenOf(definition, lookup);\n return detach({\n id,\n ...(label ? { label } : {}),\n ...(llm.llmData ? { llmData: llm.llmData } : {}),\n ...(llm.skills.length\n ? {\n skills: llm.skills.map(({ name, description }) => ({\n name,\n description,\n })),\n }\n : {}),\n ...(children.length ? { children } : {}),\n });\n};\n\n/** The detailed model of a component: the short model plus its parameter groups and parameters. */\nexport const detailedComponentModel = (\n component: ProductFamilyComponent,\n lookup: ChildLookup,\n): ComponentDetailedModel => {\n const { definition } = component;\n const parameterGroups = objectsOf(definition.parameterGroups).flatMap(\n (group) => {\n const key = text(group.key);\n const label = text(group.label);\n return key ? [{ key, ...(label ? { label } : {}) }] : [];\n },\n );\n return detach({\n ...shortComponentModel(component, lookup),\n ...(parameterGroups.length ? { parameterGroups } : {}),\n parameters: objectsOf(definition.parameters).flatMap((parameter) => {\n const model = parameterModel(parameter);\n return model ? [model] : [];\n }),\n });\n};\n\n/** The labels and item roots of the family, for the children of its models. */\nexport const familyLookup =\n (family: ProductFamily): ChildLookup =>\n (kind, id) => {\n if (kind === 'component') {\n const component = family.components.get(id);\n return component && { label: component.label };\n }\n const item = family.items.get(id);\n return item && { label: item.label, rootComponentId: item.rootComponentId };\n };\n\n/**\n * Walks the product family of a configuration as the agent needs it: the components of the\n * configuration and the seeds, then breadth first their possible children, sub-components, valid\n * children and the root components of the items they name, each definition read once. A read that\n * fails is reported and left out.\n */\nexport const collectProductFamily = async (\n rapi: FamilyRapi,\n configuration: CapabilityJsonObject,\n unresolved: ProductFamilyUnresolved,\n seeds: string[],\n): Promise<ProductFamily> => {\n const components = new Map<string, ProductFamilyComponent>();\n const items = new Map<string, ProductFamilyItem>();\n const seenComponents = new Set<string>();\n const seenItems = new Set<string>();\n const pendingComponents: string[] = [];\n const pendingItems: string[] = [];\n const queueComponent = (value: unknown) => {\n const id = text(value);\n if (id && !seenComponents.has(id)) {\n seenComponents.add(id);\n pendingComponents.push(id);\n }\n };\n const queueItem = (value: unknown) => {\n const id = text(value);\n if (id && !seenItems.has(id)) {\n seenItems.add(id);\n pendingItems.push(id);\n }\n };\n const seedAssembly = (assembly: CapabilityJsonObject) => {\n const nodes = [assembly];\n while (nodes.length) {\n const node = nodes.pop()!;\n queueComponent(node.componentId);\n nodes.push(...objectsOf(node.children));\n }\n };\n seeds.forEach(queueComponent);\n seedAssembly(configuration);\n while (pendingComponents.length || pendingItems.length) {\n const batch = pendingComponents.splice(0);\n const itemBatch = pendingItems.splice(0);\n const [definitions, assemblies] = await Promise.all([\n Promise.all(\n batch.map(async (id) => {\n try {\n const record = await rapi.getComponent(id);\n return familyComponent(\n id,\n record,\n parseDefinition(record.configuration),\n );\n } catch (error) {\n unresolved('component', id, error);\n return undefined;\n }\n }),\n ),\n Promise.all(\n itemBatch.map(async (id): Promise<ProductFamilyItem | undefined> => {\n try {\n const record = await rapi.getItem(id);\n const assembly = parseDefinition(record.configuration);\n const rootComponentId = text(assembly.componentId);\n if (!rootComponentId) {\n throw new Error('Item configuration has no root component ID');\n }\n const label = text(record.label);\n const thumbnail = text(record.thumbnail);\n return {\n id,\n ...(label ? { label } : {}),\n ...(thumbnail ? { thumbnail } : {}),\n rootComponentId,\n assembly,\n };\n } catch (error) {\n unresolved('item', id, error);\n return undefined;\n }\n }),\n ),\n ]);\n for (const component of definitions) {\n if (!component) {\n continue;\n }\n components.set(component.id, component);\n const { definition } = component;\n for (const child of [\n ...objectsOf(definition.possibleChildren),\n ...objectsOf(definition.subComponents),\n ]) {\n queueComponent(child.componentId);\n queueItem(child.itemId);\n }\n strings(definition.validChildren).forEach(queueComponent);\n }\n for (const item of assemblies) {\n if (!item) {\n continue;\n }\n items.set(item.id, item);\n seedAssembly(item.assembly);\n }\n }\n return { components, items };\n};\n\n/** The product context of a family: the short model of every component, in walk order. */\nexport const productContextOf = (\n family: ProductFamily,\n rootComponentId: string,\n): ProductContext => {\n const lookup = familyLookup(family);\n return {\n rootComponentId,\n components: [...family.components.values()].map((component) =>\n shortComponentModel(component, lookup),\n ),\n };\n};\n\n/**\n * Reads the detailed model of one component by its id, also of a component that is not in the\n * configuration. The direct children are read for their labels; a child RAPI cannot deliver keeps\n * its id only.\n */\nexport const readComponentDefinition = async (\n rapi: FamilyRapi,\n componentId: string,\n): Promise<ComponentDetailedModel> => {\n const record = await rapi.getComponent(componentId);\n const component = familyComponent(\n componentId,\n record,\n parseDefinition(record.configuration),\n );\n const known = new Map<\n string,\n Pick<ComponentModelChild, 'label' | 'rootComponentId'>\n >();\n await Promise.all(\n childrenOf(component.definition, () => undefined).map(\n async ({ id, kind }) => {\n try {\n if (kind === 'component') {\n const child = await rapi.getComponent(id);\n known.set(kind + ':' + id, { label: text(child.label) });\n } else {\n const item = await rapi.getItem(id);\n const assembly = parseDefinition(item.configuration);\n known.set(kind + ':' + id, {\n label: text(item.label),\n rootComponentId: text(assembly.componentId),\n });\n }\n } catch {\n /* The child keeps its id. */\n }\n },\n ),\n );\n return detailedComponentModel(component, (kind, id) =>\n known.get(kind + ':' + id),\n );\n};\n","import {\n CAPABILITY_SECTIONS,\n capabilitiesIncludeSchema,\n} from './configuration-operation-schemas';\nimport type ConfiguratorKernelAccess from '../configurator-kernel-access';\nimport type ConfiguratorContext from '../webgl/configurator-context';\nimport type { RapiAccess } from '../rapi-access';\nimport { BASE_CONTEXT } from '../main';\nimport type {\n KernelParameter,\n KernelParameterGroup,\n} from '../../../typings/kernel';\nimport type { RapiMaterial } from '../../../typings/rapi-types';\nimport {\n configurationComponentIds,\n withParameterLlmData,\n type ComponentLlmData,\n} from './component-llm-data';\nimport {\n collectProductFamily,\n detailedComponentModel,\n familyLookup,\n type ComponentModelParameter,\n} from './component-models';\nimport type {\n CapabilityJson,\n CapabilityJsonObject,\n ConfiguratorCapabilities,\n ConfiguratorCapabilityContext,\n ConfiguratorCapabilityInstance,\n ConfiguratorCapabilitySection,\n} from './configurator-capabilities-types';\n\nconst detach = <T>(value: T): T => JSON.parse(JSON.stringify(value));\nconst detachParameters = (parameters: KernelParameter[]): KernelParameter[] =>\n parameters.map((parameter) =>\n detach({\n ...parameter,\n ...(parameter.viewType\n ? { viewType: { value: parameter.viewType.value } }\n : {}),\n }),\n );\nconst object = (value: unknown): CapabilityJsonObject | undefined =>\n value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as CapabilityJsonObject)\n : undefined;\nconst objects = (value: CapabilityJson | undefined): CapabilityJsonObject[] =>\n Array.isArray(value)\n ? value\n .map(object)\n .filter((entry): entry is CapabilityJsonObject => !!entry)\n : [];\nconst strings = (value: CapabilityJson | undefined): string[] =>\n Array.isArray(value)\n ? value.filter(\n (entry): entry is string => typeof entry === 'string' && !!entry,\n )\n : [];\nconst project = (source: object, keys: string[]): CapabilityJsonObject => {\n const entries = Object.entries(source).filter(\n ([key, value]) => keys.includes(key) && value !== undefined,\n );\n return detach(Object.fromEntries(entries));\n};\nconst parseConfiguration = (\n value: string | undefined,\n): CapabilityJsonObject => {\n const parsed = value && object(JSON.parse(value));\n if (!parsed) {\n throw new Error('Missing or invalid configuration JSON');\n }\n return parsed;\n};\nconst childIds = (value: unknown): number[] => {\n if (Array.isArray(value)) {\n return [...value];\n }\n const list = value as { size(): number; get(index: number): number };\n return Array.from({ length: list.size() }, (_, i) => list.get(i));\n};\n\ntype Unresolved = (\n resourceType: ConfiguratorCapabilities['unresolved'][number]['resourceType'],\n id: string,\n error: unknown,\n) => void;\n\nconst discoverProductFamily = async (\n rapi: RapiAccess,\n configuration: CapabilityJsonObject,\n instances: ConfiguratorCapabilityInstance[],\n unresolved: Unresolved,\n) => {\n const family = await collectProductFamily(\n rapi,\n configuration,\n unresolved,\n instances.map((instance) => instance.componentId),\n );\n const lookup = familyLookup(family);\n const components: NonNullable<ConfiguratorCapabilities['components']> = {};\n const items: NonNullable<ConfiguratorCapabilities['items']> = {};\n const declaredByComponent: Record<string, ComponentModelParameter[]> = {};\n const declaredRawParameters: Record<string, CapabilityJsonObject[]> = {};\n const llmDataByComponent: Record<string, ComponentLlmData> = {};\n for (const [id, component] of family.components) {\n const model = detailedComponentModel(component, lookup);\n components[id] = model;\n declaredByComponent[id] = model.parameters;\n declaredRawParameters[id] = objects(component.definition.parameters);\n llmDataByComponent[id] = component.llm;\n }\n for (const [id, item] of family.items) {\n items[id] = {\n ...(item.label ? { label: item.label } : {}),\n ...(item.thumbnail ? { thumbnail: item.thumbnail } : {}),\n rootComponentId: item.rootComponentId,\n };\n }\n return {\n components,\n items,\n declaredByComponent,\n declaredRawParameters,\n llmDataByComponent,\n };\n};\n\nconst collectMaterials = async (\n rapi: RapiAccess,\n declaredByComponent: Record<string, CapabilityJsonObject[]>,\n current: NonNullable<ConfiguratorCapabilities['parameters']>['current'],\n unresolved: Unresolved,\n): Promise<NonNullable<ConfiguratorCapabilities['materials']>> => {\n const materials: NonNullable<ConfiguratorCapabilities['materials']> = {\n byId: {},\n groups: {},\n };\n const materialIds = new Set<string>();\n const groupIds = new Set<string>();\n const addId = (set: Set<string>, id: unknown) => {\n if (typeof id === 'string' && id) {\n set.add(id);\n }\n };\n const collectParameter = (parameter: CapabilityJsonObject) => {\n if (parameter.type !== 'Material') {\n return;\n }\n addId(materialIds, parameter.value);\n addId(materialIds, parameter.defaultValue);\n if (Array.isArray(parameter.validValues)) {\n for (const value of parameter.validValues) {\n addId(materialIds, object(value)?.value ?? value);\n }\n }\n for (const key of [\n 'valueObjects',\n 'localizedValues',\n 'conditionalValues',\n ]) {\n objects(parameter[key]).forEach((value) =>\n addId(materialIds, value.value),\n );\n }\n strings(parameter.validGroups).forEach((id) => groupIds.add(id));\n objects(parameter.conditionalGroups).forEach((group) =>\n addId(groupIds, group.value),\n );\n };\n Object.values(declaredByComponent).flat().forEach(collectParameter);\n const currentParameters: KernelParameter[] = [\n ...current.global.parameters,\n ...Object.values(current.byComponent).flatMap((value) => value.parameters),\n ];\n currentParameters.forEach((parameter) =>\n collectParameter(\n project(parameter, ['type', 'value', 'validValues', 'validGroups']),\n ),\n );\n const addMaterial = (material: RapiMaterial) => {\n materials.byId[material.id] = project(material, [\n 'id',\n 'name',\n 'label',\n 'thumbnail',\n 'color',\n 'active',\n 'group',\n 'groupLabel',\n 'tags',\n ]);\n if (material.shading?.basecolor !== undefined) {\n materials.byId[material.id].shading = project(material.shading, [\n 'basecolor',\n ]);\n }\n };\n await Promise.all(\n [...groupIds].map(async (id) => {\n try {\n const online = navigator.onLine;\n const groups = await rapi.getMaterialsByGroup([id]);\n const matched = groups.find(\n (group) => group.id === id || group.legacyId === id,\n );\n const members = groups.flatMap((group) =>\n group.materials.filter(\n (material) =>\n group === matched ||\n material.group === id ||\n material.tags?.includes(id),\n ),\n );\n members.forEach(addMaterial);\n const legacyMaterial = members.find(\n (material) => material.group === id,\n );\n const label = matched?.label ?? legacyMaterial?.groupLabel;\n const legacyId = matched?.legacyId ?? (legacyMaterial ? id : undefined);\n materials.groups[id] = {\n id,\n ...(label ? { label } : {}),\n ...(legacyId ? { legacyId } : {}),\n materialIds: [...new Set(members.map((material) => material.id))],\n };\n if (!online || !navigator.onLine) {\n unresolved(\n 'materialGroup',\n id,\n 'Offline material group coverage cannot be established',\n );\n }\n } catch (error) {\n unresolved('materialGroup', id, error);\n }\n }),\n );\n const missingIds = [...materialIds].filter((id) => !materials.byId[id]);\n if (missingIds.length) {\n try {\n (await rapi.getMaterials(missingIds)).forEach(addMaterial);\n missingIds\n .filter((id) => !materials.byId[id])\n .forEach((id) =>\n unresolved('material', id, 'Material metadata unavailable'),\n );\n } catch (error) {\n missingIds.forEach((id) => unresolved('material', id, error));\n }\n }\n return materials;\n};\n\nexport const collectConfiguratorCapabilities = async (\n context: ConfiguratorContext,\n access: ConfiguratorKernelAccess,\n rapi: RapiAccess,\n include?: ConfiguratorCapabilitySection[],\n): Promise<ConfiguratorCapabilities> => {\n const parsed = capabilitiesIncludeSchema.safeParse(include ?? undefined);\n if (!parsed.success) {\n throw new Error('Unknown configurator capability section');\n }\n const sections = new Set(\n parsed.data?.length ? parsed.data : CAPABILITY_SECTIONS,\n );\n const kernel = access.kernelInstance;\n const captureContext = (): ConfiguratorCapabilityContext => {\n if (\n context.baseContext !== BASE_CONTEXT.CONFIGURATOR ||\n !context.configurationRuntimeId\n ) {\n throw new Error(\n 'Load a configuration or enter planner isolation before reading configurator capabilities',\n );\n }\n if (kernel.isExternalPlanObject(context.configurationRuntimeId)) {\n throw new Error(\n 'Use the HI external-object API to read capabilities of an external configuration',\n );\n }\n const rootRuntimeId = kernel.getRootPlanComponentIdFromObjectId(\n context.configurationRuntimeId,\n );\n if (!rootRuntimeId) {\n throw new Error(\n 'No active root component; load a configuration before reading capabilities',\n );\n }\n return {\n configurationRuntimeId: context.configurationRuntimeId,\n rootRuntimeId,\n rootComponentId: kernel.getComponentId(rootRuntimeId),\n selectedRuntimeIds: [...context.selectedRuntimeComponentIds],\n configurationHash: access.getCurrentConfigurationHash(\n context.configurationRuntimeId,\n ),\n };\n };\n const captured = captureContext();\n const rootAsGlobal = context.rootComponentParametersAsGlobal;\n const contextRootId = context.rootComponentId;\n const assertFresh = () => {\n try {\n if (\n JSON.stringify(captureContext()) === JSON.stringify(captured) &&\n rootAsGlobal === context.rootComponentParametersAsGlobal &&\n contextRootId === context.rootComponentId\n ) {\n return;\n }\n } catch {\n /* A target that disappeared also invalidates the captured read. */\n }\n throw new Error(\n 'Configuration or selection changed while reading capabilities; read again',\n );\n };\n const result: ConfiguratorCapabilities = {\n context: captured,\n complete: true,\n unresolved: [],\n };\n const unresolved = (\n resourceType: ConfiguratorCapabilities['unresolved'][number]['resourceType'],\n id: string,\n error: unknown,\n ) => {\n result.complete = false;\n result.unresolved.push({\n resourceType,\n id,\n sections: [...sections].filter(\n (section) =>\n section !== 'configuration' &&\n (!resourceType.startsWith('material') || section === 'materials'),\n ),\n reason: error instanceof Error ? error.message : String(error),\n });\n };\n const configuration = parseConfiguration(\n access.getSerializedConfiguration(captured.configurationRuntimeId),\n );\n const instances: ConfiguratorCapabilityInstance[] = [];\n const current: NonNullable<\n ConfiguratorCapabilities['parameters']\n >['current'] = {\n global: {\n scope: rootAsGlobal ? 'rootComponent' : 'planObject',\n parameters: [],\n groups: [],\n },\n byComponent: {},\n };\n const docking: NonNullable<ConfiguratorCapabilities['docking']> = {\n current: { globalPossibleChildren: [], byComponent: {} },\n };\n const needsParameters =\n sections.has('parameters') || sections.has('materials');\n const reads: Array<Promise<void>> = [];\n const pendingRuntimeIds = [captured.rootRuntimeId];\n const visitedRuntimeIds = new Set<number>();\n while (pendingRuntimeIds.length) {\n const runtimeId = pendingRuntimeIds.shift()!;\n if (visitedRuntimeIds.has(runtimeId)) {\n continue;\n }\n visitedRuntimeIds.add(runtimeId);\n const component = kernel.getComponent(runtimeId);\n const componentId = kernel.getComponentId(runtimeId);\n const childRuntimeIds = childIds(component.childIds);\n instances.push({\n runtimeId,\n componentId,\n parentRuntimeId: component.parentId || null,\n childRuntimeIds,\n });\n pendingRuntimeIds.push(...childRuntimeIds);\n if (needsParameters) {\n const groups = detach(component.parameterGroups);\n reads.push(\n access.getComponentParameters(runtimeId).then((parameters) => {\n current.byComponent[runtimeId] = {\n componentId,\n groups,\n parameters: detachParameters(parameters),\n };\n }),\n );\n }\n if (sections.has('docking')) {\n docking.current.byComponent[runtimeId] = detach(\n kernel.getPlanComponentPossibleChildren(runtimeId),\n );\n }\n }\n if (needsParameters) {\n const globalDefinition = rootAsGlobal\n ? kernel.getComponent(captured.rootRuntimeId)\n : kernel.getPlanObject(captured.configurationRuntimeId);\n current.global.groups = detach(\n (globalDefinition.parameterGroups ?? []) as KernelParameterGroup[],\n );\n reads.push(\n access\n .getGlobalParameters(captured.configurationRuntimeId, rootAsGlobal)\n .then((parameters) => {\n current.global.parameters = detachParameters(parameters);\n }),\n );\n }\n if (sections.has('docking')) {\n docking.current.globalPossibleChildren = detach(\n kernel.getPlanObjectPossibleChildren(captured.configurationRuntimeId),\n );\n }\n await Promise.all(reads);\n assertFresh();\n if (sections.has('configuration')) {\n result.configuration = { data: configuration, instances };\n }\n if (sections.size === 1 && sections.has('configuration')) {\n return result;\n }\n\n const {\n components,\n items,\n declaredByComponent,\n declaredRawParameters,\n llmDataByComponent,\n } = await discoverProductFamily(rapi, configuration, instances, unresolved);\n if (sections.has('components')) {\n result.components = components;\n }\n if (sections.has('items')) {\n result.items = items;\n }\n if (sections.has('parameters')) {\n const llmDataOf = (componentId: string) =>\n llmDataByComponent[componentId] ? [llmDataByComponent[componentId]] : [];\n for (const entry of Object.values(current.byComponent)) {\n entry.parameters = withParameterLlmData(\n entry.parameters,\n llmDataOf(entry.componentId),\n );\n }\n current.global.parameters = withParameterLlmData(\n current.global.parameters,\n configurationComponentIds(configuration).flatMap(llmDataOf),\n );\n result.parameters = { declaredByComponent, current };\n }\n if (sections.has('docking')) {\n result.docking = docking;\n }\n\n if (sections.has('materials')) {\n result.materials = await collectMaterials(\n rapi,\n declaredRawParameters,\n current,\n unresolved,\n );\n }\n assertFresh();\n return result;\n};\n"],"mappings":";;;;AAyCA,IAAM,IAAqC,IAAI,IAAI,CACjD,EAAsB,SACtB,EAAsB,QACvB,CAAC,EAEW,KAAQ,MACnB,OAAO,KAAU,YAAY,EAAM,MAAM,GAAG,IAAQ,KAAA,GACzC,KAAY,MACL,OAAO,KAAU,YAAnC,KAA+C,CAAC,MAAM,QAAQ,EAAM,GAC/D,IACD,KAAA,GACO,KAAa,MACxB,MAAM,QAAQ,EAAM,GAChB,EACG,IAAI,EAAS,CACb,QAAQ,MAAyC,CAAC,CAAC,EAAM,GAC5D,EAAE,EAEF,KACJ,MACiC;CACjC,IAAM,IAAU,EAAK,EAAU,QAAQ,EACjC,IAAS,EAAU,EAAU,aAAa,CAAC,SAAS,MAAgB;EACxE,IAAM,IAAe,EAAK,EAAY,QAAQ;AAC9C,SAAO,KAAgB,EAAY,UAAU,KAAA,IACzC,CAAC;GAAE,OAAO,EAAY;GAAO,SAAS;GAAc,CAAC,GACrD,EAAE;GACN;AACE,QAAC,KAAW,CAAC,EAAO,QAGxB,QAAO;EAAE,GAAI,IAAU,EAAE,YAAS,GAAG,EAAE;EAAG;EAAQ;GAIvC,KAC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SAAS,KAAK,EAAS,IAAI,gBAAgB,CACtD,QAAO;CAGT,IAAM,EACJ,eACA,UACA,wBACA,0BACA,0BACE,MAAM,EAAsB,GAAM,GAAe,GAAW,EAAW;AAO3E,KANI,EAAS,IAAI,aAAa,KAC5B,EAAO,aAAa,IAElB,EAAS,IAAI,QAAQ,KACvB,EAAO,QAAQ,IAEb,EAAS,IAAI,aAAa,EAAE;EAC9B,IAAM,KAAa,MACjB,EAAmB,KAAe,CAAC,EAAmB,GAAa,GAAG,EAAE;AAC1E,OAAK,IAAM,KAAS,OAAO,OAAO,EAAQ,YAAY,CACpD,GAAM,aAAa,EACjB,EAAM,YACN,EAAU,EAAM,YAAY,CAC7B;AAMH,EAJA,EAAQ,OAAO,aAAa,EAC1B,EAAQ,OAAO,YACf,EAA0B,EAAc,CAAC,QAAQ,EAAU,CAC5D,EACD,EAAO,aAAa;GAAE;GAAqB;GAAS;;AAetD,QAbI,EAAS,IAAI,UAAU,KACzB,EAAO,UAAU,IAGf,EAAS,IAAI,YAAY,KAC3B,EAAO,YAAY,MAAM,EACvB,GACA,GACA,GACA,EACD,GAEH,GAAa,EACN"}
@@ -4,8 +4,8 @@ import { Ln as n, On as r, Ti as i, Vr as a, f as o, n as s, nt as c, w as l } f
4
4
  import { n as u } from "./three.module-BxhhMw29.mjs";
5
5
  import { n as d, r as f, t as p } from "./decorate-CooD7C6J.mjs";
6
6
  import { g as m, v as h } from "./common-utils-zPOllvAT.mjs";
7
- import { C as g, F as _, I as v, M as y, Q as b, R as x, T as S, ct as C, dt as w, et as T, ft as E, g as D, it as O, j as k, mt as A, n as j, ot as M, st as N, w as P } from "./roomle-sdk-CSH3WHXV.mjs";
8
- import { t as F } from "./script-loader-O8x5UOnP.mjs";
7
+ import { C as g, F as _, I as v, M as y, Q as b, R as x, T as S, ct as C, dt as w, et as T, ft as E, g as D, it as O, j as k, mt as A, n as j, ot as M, st as N, w as P } from "./roomle-sdk-ByoTm5M6.mjs";
8
+ import { t as F } from "./script-loader-DGVS2Wqe.mjs";
9
9
  //#region packages/glb-viewer-core/src/camera-control/adjustable-camera-control-3d.ts
10
10
  var I = class extends _ {
11
11
  constructor(...e) {
@@ -343,4 +343,4 @@ var H = class extends b {}, U = [
343
343
  //#endregion
344
344
  export { V as n, W as t };
345
345
 
346
- //# sourceMappingURL=glb-viewer-BkU2Z-HJ.mjs.map
346
+ //# sourceMappingURL=glb-viewer-BByRaJ8F.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"glb-viewer-BkU2Z-HJ.mjs","names":[],"sources":["../../packages/glb-viewer-core/src/camera-control/adjustable-camera-control-3d.ts","../../packages/glb-viewer-core/src/webgl/glb-viewer-light-setting.ts","../../packages/glb-viewer-core/src/webgl/glb-viewer-scene-manager.ts","../../packages/glb-viewer-core/src/services/glb-render-worker.ts","../../../../node_modules/jszip/dist/jszip.min.js?no-inline?url","../../packages/glb-viewer-core/src/roomle-glb-viewer.ts","../../packages/glb-viewer-core/src/input/glb-input-manager.ts","../../packages/glb-viewer-core/src/utils/injectables.ts","../../packages/glb-viewer-core/src/glb-viewer.ts"],"sourcesContent":["import CameraControl3D from '../../../common-core/src/cameracontrol/camera-control-3d';\nimport { Box3, Euler, Quaternion, Vector3 } from 'three';\n\nexport default class AdjustableCameraControl3D extends CameraControl3D {\n public shouldIgnoreStandardBehavior = false;\n\n public adjust(\n bounds: Vector3,\n position: Vector3,\n\n yaw: number,\n pitch: number,\n _fov: number,\n ) {\n let minVector: Vector3 = new Vector3(-bounds.x / 2, 0, -bounds.z / 2);\n let maxVector: Vector3 = new Vector3(bounds.x / 2, bounds.y, bounds.z / 2);\n this._boundingBox = new Box3(minVector, maxVector);\n\n // before applying attis pitch value with have to rotate down, because we assume that attis rotation is upwards\n let euler = new Euler(-Math.PI / 2 + pitch, yaw, 0, 'ZYX');\n let quaternion = new Quaternion().setFromEuler(euler);\n\n this._camera.updateProjectionMatrix();\n\n this._camera.quaternion.copy(quaternion);\n this._camera.position.copy(position);\n }\n\n protected _update(overrideTarget?: Vector3) {\n if (!this.shouldIgnoreStandardBehavior) {\n super._update(overrideTarget);\n } else {\n this._saveYawAndPitch();\n }\n }\n\n public animateCamera(delta: number): boolean {\n if (!this.shouldIgnoreStandardBehavior) {\n return super.animateCamera(delta);\n } else {\n return true;\n }\n }\n}\n","import LightSetting from '../../../common-core/src/lightsetting/light-setting';\nimport type { ColorRepresentation, Scene } from 'three';\nimport { AmbientLight, Color } from 'three';\nimport type { GenericGUIParamFolder } from '../../../common-core/src/webgl/gui-types';\n\nexport default class GLBViewerLightSetting extends LightSetting {\n private _ambientLight: AmbientLight;\n\n private _params = {\n ambientLight: {\n color: '#ffffff',\n },\n };\n\n constructor(scene: Scene, oldLightSetting?: LightSetting) {\n super(scene, oldLightSetting);\n\n this._ambientLight = new AmbientLight(\n new Color(this._params.ambientLight.color as ColorRepresentation),\n 0.5,\n );\n\n this.addToScene();\n }\n\n public addToScene(): void {\n this._scene.add(this._ambientLight);\n }\n\n public removeFromScene(): void {\n this._scene.remove(this._ambientLight);\n }\n\n public reload(): void {\n this.removeFromScene();\n this.addToScene();\n }\n\n public showGUI(sceneParameters: GenericGUIParamFolder): void {\n if (this._ambientLight) {\n const ambientLightFolder = sceneParameters.addFolder('Ambient Light');\n ambientLightFolder.add(this._ambientLight, 'visible');\n ambientLightFolder\n .add(this._ambientLight, 'intensity')\n .min(0)\n .max(5)\n .step(0.1);\n ambientLightFolder\n .addColor(this._params.ambientLight, 'color')\n .onChange((color: string) => {\n this._ambientLight.color = new Color(color as ColorRepresentation);\n });\n }\n }\n}\n","import SceneManager from '../../../common-core/src/webgl/scene-manager';\nimport type {\n Base64Image,\n CanvasOffset,\n} from '../../../common-core/src/common-interfaces';\nimport AdjustableCameraControl3D from '../camera-control/adjustable-camera-control-3d';\nimport type { GLBRenderWorkerListener } from '../services/glb-render-worker';\nimport type InputManager from '../../../common-core/src/input/input-manager';\nimport inject from '../../../common-core/src/di/inject';\nimport type GlbInputManager from '../input/glb-input-manager';\n\nimport DefaultLightSetting from '../../../configurator-core/src/webgl/lightsetting/default-light-setting';\nimport ImageRenderer, {\n type PrepareImageOptions,\n} from '../../../common-core/src/webgl/image-renderer';\nimport { CAMERA_TYPE } from '../../../common-core/src/cameracontrol/camera-type';\nimport { toDegrees } from '../../../common-core/src/utils/math-helper';\nimport { dispose } from '../../../common-core/src/utils/threejs-utils';\nimport { type RapiAccess } from '../../../common-core/src/rapi-access';\nimport { getGlbUrl } from '../../../common-core/src/utils/common-utils';\nimport { CANVAS_ID } from '../../../common-core/src/utils/dom-helper';\nimport type { Enumify } from '#/common/src/utils/types';\nimport {\n BasicShadowMap,\n Box3,\n type Color,\n type Object3D,\n PerspectiveCamera,\n SRGBColorSpace,\n Vector3,\n WebGLRenderer,\n} from 'three';\nimport DynamicLightSettingLoader, {\n PREDEFINED_LIGHTSETTING,\n} from '../../../common-core/src/lightsetting/dynamic-light-setting-loader';\nimport GLBViewerLightSetting from './glb-viewer-light-setting';\nimport GlbViewerCameraBehaviour from '../../../common-core/src/cameracontrol/glb-viewer-camera-behaviour';\nimport {\n CAMERA_EVENT,\n type CameraParameter,\n} from '../../../common-core/src/cameracontrol/camera-control';\n\nexport default class GLBViewerSceneManager\n extends SceneManager\n implements GLBRenderWorkerListener\n{\n @inject\n private _glbInputManager: GlbInputManager;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n private _currentGLB: Object3D | null;\n private _standardSceneBackgroundColor: Color;\n\n private _itemsCount = 0;\n\n constructor(creator: string, offset: CanvasOffset) {\n super(creator, offset, CANVAS_ID.GLB, CAMERA_TYPE.CAMERA_3D);\n this._standardSceneBackgroundColor = this._scene.background as Color;\n if (this._initData.legacyLight && this._renderer instanceof WebGLRenderer) {\n if (this._renderer.capabilities.maxTextures > 8) {\n const lightSource =\n DynamicLightSettingLoader.createDynamicLightSettingSource(\n null,\n PREDEFINED_LIGHTSETTING.CAMERA,\n );\n if (lightSource) {\n this.loadDynamicLightSetting(lightSource);\n }\n } else {\n console.warn(\n 'this device has a maximum of 8 texture units thus we are using a simpler light setting',\n );\n this._lightSetting = new GLBViewerLightSetting(this._scene);\n }\n }\n }\n\n protected createCameraControl(\n _mode: Enumify<typeof CAMERA_TYPE>,\n _offset: CanvasOffset,\n ) {\n this._changeCameraBehaviour(\n new GlbViewerCameraBehaviour(\n new AdjustableCameraControl3D(\n this._creator_,\n this._getInputManager(),\n undefined,\n ),\n this._cameraBehaviourState,\n ),\n );\n }\n\n protected _getInputManager(): InputManager {\n return this._glbInputManager;\n }\n\n public async loadStaticItem(\n id: string,\n callback?: (percent: number) => void,\n ): Promise<void> {\n const rapiItem = await this._rapiAccess.getItem(id);\n if (rapiItem.configuration) {\n return Promise.reject();\n }\n const glbUrl = getGlbUrl(rapiItem);\n if (!glbUrl) {\n return Promise.reject(new Error('GLB Url not detected'));\n }\n return this.loadGLB(glbUrl, true, undefined, callback);\n }\n\n public loadGLB(\n url: string,\n automaticallyAdjustCamera: boolean = true,\n scaling: Vector3 = new Vector3(1, 1, 1),\n callback?: (percent: number) => void,\n ): Promise<void> {\n this.clearScene();\n return new Promise<void>((resolve, reject) => {\n this._loadGLB(\n url,\n new Vector3(0, 0, 0),\n 0,\n scaling,\n undefined,\n undefined,\n callback,\n ).then((glb) => {\n this._currentGLB = glb;\n this._scene.add(this._currentGLB);\n\n let boundingBox = new Box3().setFromObject(this._currentGLB);\n if (automaticallyAdjustCamera) {\n if (\n this.cameraBehaviour.cameraControl instanceof\n AdjustableCameraControl3D\n ) {\n this.glbViewerCameraBehaviour.updateCameraOnItemLoaded(boundingBox);\n }\n }\n this._updateBounds(boundingBox, undefined, true);\n this._readyForRender();\n resolve();\n }, reject);\n });\n }\n\n public preparePerspectiveImage(\n options: PrepareImageOptions = {},\n providedRenderer?: WebGLRenderer,\n ): Promise<Base64Image> {\n if (!providedRenderer && this._initData.webGpu) {\n return this._prepareWebGpuPerspectiveImage(options);\n }\n\n // When a renderer is supplied (e.g. by GLBRenderWorker for a batched\n // thumbnail run), use its existing size; otherwise build a fresh\n // offscreen renderer sized off `options.size`.\n let renderer: WebGLRenderer;\n let width: number;\n let height: number;\n if (providedRenderer) {\n renderer = providedRenderer;\n width = renderer.domElement.width;\n height = renderer.domElement.height;\n } else {\n const size = options.size ?? 1000;\n width = size;\n height = size;\n renderer = new WebGLRenderer({ antialias: true });\n renderer.setSize(width, height);\n renderer.outputColorSpace = SRGBColorSpace;\n renderer.autoClear = false;\n renderer.shadowMap.enabled = true;\n renderer.shadowMap.type = BasicShadowMap;\n }\n\n return new Promise<Base64Image>((resolve, reject) => {\n const camera = this.cameraBehaviour.cameraControl.getCamera().clone();\n if (camera instanceof PerspectiveCamera) {\n camera.aspect = width / height;\n camera.updateProjectionMatrix();\n }\n\n // Deterministic framing on the loaded GLB's bounds — avoids any\n // dependency on the live camera state, which may still be tweening\n // toward the new model when this method is called.\n const bounds = this.getBounds();\n if (bounds && camera instanceof PerspectiveCamera) {\n const cameraTarget = ImageRenderer.getCameraTargetForBBox(bounds);\n const angleY = -30 + toDegrees(options.rotationY ?? 0);\n ImageRenderer.placeCameraForPerspectiveImage(\n camera,\n cameraTarget,\n -20,\n angleY,\n );\n }\n\n this._lightSetting?.removeFromScene();\n const defaultLightSetting = new DefaultLightSetting(this._scene);\n\n // Honor preserveSceneBackground symmetrically with ImageRenderer:\n // null background+fog when stripping was requested. Default for the\n // GLB viewer is to keep the scene's existing background visible.\n const preserveSceneBackground = options.preserveSceneBackground ?? true;\n const savedFog = this._scene.fog;\n const savedBackground = this._scene.background;\n let image: string;\n try {\n if (!preserveSceneBackground) {\n this._scene.background = null;\n this._scene.fog = null;\n }\n renderer.render(this._scene, camera);\n image = renderer.domElement.toDataURL();\n } finally {\n // Restore mutated scene state regardless of success/failure so a\n // throw in render() / toDataURL() can't leave the scene with a\n // null background for the rest of the session.\n if (!preserveSceneBackground) {\n this._scene.background = savedBackground;\n this._scene.fog = savedFog;\n }\n defaultLightSetting.removeFromScene();\n this._lightSetting?.addToScene();\n }\n\n renderer.domElement.toBlob((blob) => {\n if (blob === null) {\n reject(new Error('Failed to create blob from canvas'));\n return;\n }\n resolve({ image, width, height, blob });\n }, 'image/png');\n });\n }\n\n private async _prepareWebGpuPerspectiveImage(\n options: PrepareImageOptions,\n ): Promise<Base64Image> {\n const camera = this.cameraBehaviour.cameraControl.getCamera().clone();\n const bounds = this.getBounds();\n const cameraTarget =\n bounds && camera instanceof PerspectiveCamera\n ? ImageRenderer.getCameraTargetForBBox(bounds)\n : undefined;\n\n this._lightSetting?.removeFromScene();\n const defaultLightSetting = new DefaultLightSetting(this._scene);\n try {\n return await this._imageRenderer.preparePerspectiveImage(\n this._scene,\n camera as PerspectiveCamera,\n cameraTarget,\n {\n ...options,\n preserveSceneBackground: options.preserveSceneBackground ?? true,\n },\n );\n } finally {\n defaultLightSetting.removeFromScene();\n this._lightSetting?.addToScene();\n }\n }\n\n public adjustCamera(\n position: Vector3,\n yaw: number,\n pitch: number,\n fov: number,\n ) {\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n let boundingBox = new Box3().setFromObject(this._scene);\n let bounds = boundingBox.getSize(new Vector3());\n (this.cameraBehaviour.cameraControl as AdjustableCameraControl3D).adjust(\n bounds,\n position,\n yaw,\n pitch,\n fov,\n );\n this._requestRender();\n }\n }\n\n public onStart(count: number) {\n this._itemsCount = count;\n this._scene.background = null;\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n (\n this.cameraBehaviour.cameraControl as AdjustableCameraControl3D\n ).shouldIgnoreStandardBehavior = true;\n }\n console.log('start processing ' + count + ' items');\n }\n\n public onElementFinished(itemsFinished: number) {\n console.log(\n 'processed ' +\n itemsFinished +\n ' of ' +\n this._itemsCount +\n ' items (' +\n Math.round((100 / this._itemsCount) * itemsFinished) +\n '%)',\n );\n }\n\n public onFinished(_zip: any) {\n this._scene.background = this._standardSceneBackgroundColor;\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n (\n this.cameraBehaviour.cameraControl as AdjustableCameraControl3D\n ).shouldIgnoreStandardBehavior = false;\n }\n }\n\n public clearScene() {\n if (this._currentGLB) {\n this._scene.remove(this._currentGLB);\n dispose(this._currentGLB);\n this._currentGLB = null;\n }\n super.clearScene();\n }\n\n public enableHD() {\n super.enableHD();\n }\n\n public sceneChanged(): void {\n //override when needed\n }\n\n getBounds(): Box3 | null {\n if (!this._currentGLB) {\n return null;\n }\n return new Box3().setFromObject(this._currentGLB);\n }\n\n protected get glbViewerCameraBehaviour(): GlbViewerCameraBehaviour {\n return this.cameraBehaviour as GlbViewerCameraBehaviour;\n }\n\n getGeometryBounds(): Box3 | null {\n return null;\n }\n\n cameraBehaviourChanged(updateDistance: boolean = true) {\n super.cameraBehaviourChanged(updateDistance);\n\n this.cameraBehaviour.cameraControl.addEventListener(\n CAMERA_EVENT.ZOOM_IN,\n () => {\n this._requestRender();\n },\n this,\n );\n this.cameraBehaviour.cameraControl.addEventListener(\n CAMERA_EVENT.ZOOM_OUT,\n () => {\n this._requestRender();\n },\n this,\n );\n }\n\n public async moveCamera(cameraParameter: CameraParameter): Promise<void> {\n return this.glbViewerCameraBehaviour.externalApiMoveCamera(cameraParameter);\n }\n\n // info when scene is ready to render, used for testing\n protected _readyForRender() {\n console.log('ready_for_render');\n this._globalCallback.onReadyForRender();\n }\n}\n","import type { Base64Image } from '../../../common-core/src/common-interfaces';\nimport type GLBViewerSceneManager from '../webgl/glb-viewer-scene-manager';\nimport type { RenderEntry } from '../roomle-glb-viewer';\nimport { SRGBColorSpace, Vector3, WebGLRenderer } from 'three';\n\ninterface GLBRenderEntry {\n name: string;\n url: string;\n position: Vector3;\n fov: number;\n yaw: number;\n pitch: number;\n}\n\nexport interface GLBRenderWorkerListener {\n onStart(count: number): void;\n\n onElementFinished(finishedElements: number): void;\n\n onFinished(zip: any): void;\n}\n\nexport default class GLBRenderWorker {\n private _sceneManager: GLBViewerSceneManager;\n private _entries: GLBRenderEntry[];\n\n private _resolve: (zip: any) => void;\n\n private _prefix = 'https://furniture.roomle.com/3d/glb/';\n\n private _renderer: WebGLRenderer;\n private _width: number;\n private _height: number;\n\n private _listeners: Set<GLBRenderWorkerListener> =\n new Set<GLBRenderWorkerListener>();\n private _finishedItems: number = 0;\n\n private _zip: any;\n\n constructor(\n sceneManager: GLBViewerSceneManager,\n width: number,\n height: number,\n ) {\n this._sceneManager = sceneManager;\n\n this._renderer = new WebGLRenderer({ antialias: true, alpha: true });\n this._width = width;\n this._height = height;\n this._renderer.setSize(width, height);\n this._renderer.setClearColor(0xffffff, 0);\n this._renderer.outputColorSpace = SRGBColorSpace;\n }\n\n public addListener(listener: GLBRenderWorkerListener) {\n this._listeners.add(listener);\n }\n\n public removeListener(listener: GLBRenderWorkerListener) {\n this._listeners.delete(listener);\n }\n\n public start(entries: RenderEntry[]): Promise<any> {\n this._entries = [];\n entries.forEach((entry) => {\n this._entries.push(this._transform(entry)); // {name: url.replace('.glb', '.png'), url: this._prefix + url}\n });\n this._finishedItems = 0;\n this._listeners.forEach((listener) =>\n listener.onStart(this._entries.length),\n );\n this._zip = new (window as any).JSZip();\n this._doNextEntry();\n return new Promise<any>((resolve) => {\n this._resolve = resolve;\n });\n }\n\n private _transform(entry: RenderEntry): GLBRenderEntry {\n return {\n name: entry.path.replace('.glb', '.png'),\n url: this._prefix + entry.path,\n position: new Vector3(\n entry.camera.position.x,\n entry.camera.position.z,\n -entry.camera.position.y,\n ),\n fov: entry.camera.fieldOfView * 2, // * 2 because Atti suggested it after all images were cut on all sides\n yaw: entry.camera.rotation.z,\n pitch: entry.camera.rotation.x,\n };\n }\n\n private _doNextEntry() {\n if (this._entries.length === 0) {\n this._listeners.forEach((listener) => listener.onFinished(this._zip));\n this._resolve(this._zip);\n } else {\n this._processEntry(this._entries[0]);\n }\n }\n\n private _processEntry(entry: GLBRenderEntry) {\n this._sceneManager.loadGLB(entry.url, false, undefined).then(() => {\n this._sceneManager.adjustCamera(\n entry.position,\n entry.yaw,\n entry.pitch,\n entry.fov,\n );\n this._sceneManager\n .preparePerspectiveImage({}, this._renderer)\n .then((base64Image) => {\n this._entryFinished(entry, base64Image);\n });\n });\n }\n\n private _entryFinished(entry: GLBRenderEntry, base64Image: Base64Image) {\n let index = this._entries.indexOf(entry);\n if (index > -1) {\n this._entries.splice(index, 1);\n }\n this._finishedItems++;\n this._listeners.forEach((listener) =>\n listener.onElementFinished(this._finishedItems),\n );\n this._zip.file(entry.name, base64Image.blob);\n this._doNextEntry();\n }\n}\n","export default \"__VITE_ASSET__cn7IAAGY294pWGc7MpElVg__\"","import type ScriptLoader from '../../common-core/src/script-loader';\nimport type DomHelper from '../../common-core/src/utils/dom-helper';\nimport inject from '../../common-core/src/di/inject';\nimport GLBViewerSceneManager from './webgl/glb-viewer-scene-manager';\nimport type {\n Base64Image,\n CanvasOffset,\n Position3,\n} from '../../common-core/src/common-interfaces';\nimport GLBRenderWorker from './services/glb-render-worker';\nimport type { ExternalEmbeddable, GlobalAPI } from '../../common-core/src/main';\nimport type { Main } from '../../common-core/src/main';\nimport type { Context } from '../../common-core/src/di/context';\nimport type { LifeCycleManager } from '../../common-core/src/life-cycle-manager';\nimport type { SceneSettings } from '../../common-core/src/scene-settings-loader';\nimport { JS_ZIP_FILE_NAME } from '../../common-core/src/static-files/libs';\nimport type InitData from '../../common-core/src/utils/init-data';\nimport type {\n GlobalInitDataDefinition,\n InitDataDefinition,\n} from '../../common-core/src/utils/shims';\nimport type GlobalInitData from '../../common-core/src/utils/global-init-data';\nimport { type RapiAccess } from '../../common-core/src/rapi-access';\nimport type { PrepareImageOptions } from '../../common-core/src/webgl/image-renderer';\nimport type UnitFormatter from '../../configurator-core/src/services/unit-formatter';\nimport { download } from '../../common-core/src/utils/common-utils';\nimport type { Scene } from 'three';\nimport { Vector3 } from 'three';\nimport { type IdbManager } from '../../common-core/src/services/idb-manager';\nimport type { CameraParameter } from '../../common-core/src/cameracontrol/camera-control';\nimport type { GlobalCallback } from '../../common-core/src/services/global-callback';\n\ninterface RenderCameraInformation {\n fieldOfView: number;\n rotation: Position3;\n position: Position3;\n}\n\nexport declare interface RenderEntry {\n path: string;\n camera: RenderCameraInformation;\n}\n\nexport class GlbViewerUiCallbacks {}\n\nexport class RoomleGLBViewer\n implements GlobalAPI, Context, ExternalEmbeddable<GlbViewerUiCallbacks>\n{\n public _creator_: string;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n @inject\n private _domHelper: DomHelper;\n\n @inject\n private _scriptLoader: ScriptLoader;\n\n @inject\n private _lifeCycleManager: LifeCycleManager;\n\n @inject\n private _initData: InitData;\n\n @inject\n private _globalInitData: GlobalInitData;\n\n @inject\n private _globalCallback: GlobalCallback;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n @inject\n protected _idbManager: IdbManager;\n\n private _sceneManager: GLBViewerSceneManager;\n\n private _currentIdOrUrl: string | null = null;\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public setCameraOffset(offset: CanvasOffset): void {\n this._sceneManager.setCameraOffset(offset);\n }\n\n public getCameraOffset(): CanvasOffset {\n return this._sceneManager.getCameraOffset();\n }\n\n public init(\n element: HTMLElement,\n initData?: InitDataDefinition,\n ): Promise<void> {\n this.setOverrides(initData);\n this._domHelper.setDomElement(element);\n\n if (this._sceneManager) {\n this._lifeCycleManager.resume();\n return Promise.resolve();\n }\n\n return new Promise<void>(this._initPromiseCallback.bind(this));\n }\n\n private _initPromiseCallback(resolve: () => void, _reject: () => void) {\n this._sceneManager = new GLBViewerSceneManager(this._creator_, {\n left: 0,\n top: 1,\n right: 1,\n bottom: 0,\n });\n // this.loadGLB('https://furniture.roomle.com/3d/glb/furniture/vitra/41206600/41206600.glb');\n this._sceneManager.enableHD();\n resolve();\n }\n\n public getSceneManager() {\n return this._sceneManager;\n }\n\n /**\n * Remove the current glb from the scene if it exists\n */\n public clearScene() {\n this._sceneManager.clearScene();\n }\n\n /**\n * Loads the GLB from the given URL Param\n * @param url\n * @param scaling defaults to 1\n * @param callback loading percent between 0 and 1\n */\n public loadGLB(\n url: string,\n scaling = 1,\n callback?: (percent: number) => void,\n ): Promise<void> {\n this._currentIdOrUrl = url;\n this._rapiAccess.trackView(url);\n return this._sceneManager.loadGLB(\n url,\n true,\n new Vector3(scaling, scaling, scaling),\n callback,\n );\n }\n\n /**\n * Loads the glb asset from the static item\n * @param staticItemId\n * @param callback loading percent between 0 and 1\n */\n public loadStaticItem(\n staticItemId: string,\n callback?: (percent: number) => void,\n ): Promise<void> {\n this._currentIdOrUrl = staticItemId;\n this._rapiAccess.trackView(staticItemId);\n return this._sceneManager.loadStaticItem(staticItemId, callback);\n }\n\n /**\n * Returns the current item id or url of the loaded object\n */\n public getCurrentId(): string | null {\n return this._currentIdOrUrl;\n }\n\n /**\n * Loads a SceneSettings object, currently it can can contain a light setting definition\n * (see {@link @roomle/web-sdk/configurator-core/src/roomle-configurator#RoomleConfigurator.loadDynamicLightSetting}) and an environment definition (see {@link @roomle/web-sdk/configurator-core/src/environment/dynamic-environment-setting-loaderEnvironmentSetting}).\n * @param sceneSettings\n */\n public loadSceneSetting(sceneSettings: SceneSettings): Promise<void> {\n return this._sceneManager.loadSceneSettings(sceneSettings);\n }\n\n public preparePerspectiveImage(\n options: PrepareImageOptions = {},\n ): Promise<Base64Image> {\n return this._sceneManager.preparePerspectiveImage(options);\n }\n\n public processRenderList(\n jsonString: string,\n width: number = 320,\n height: number = 320,\n ) {\n const object = JSON.parse(jsonString);\n this._scriptLoader.fetch(JS_ZIP_FILE_NAME, { id: 'jszip-js' }).then(() => {\n const worker = new GLBRenderWorker(this._sceneManager, width, height);\n worker.addListener(this._sceneManager);\n worker.start(object.items).then((zip: any) => {\n zip.generateAsync({ type: 'blob' }).then((content: File) => {\n download('content.zip', URL.createObjectURL(content));\n worker.removeListener(this._sceneManager);\n });\n });\n });\n }\n\n public setOverrides(\n initData:\n | Partial<InitDataDefinition & GlobalInitDataDefinition>\n | InitData\n | undefined,\n ): void {\n if (!initData) {\n return;\n }\n this._initData.setOverrides(initData);\n this._globalInitData.setOverrides(initData);\n }\n\n public updateSize(): void {\n this._sceneManager.updateCamera();\n }\n\n /**\n * Return the main class which has access to lifecycle events and RapiAccess.\n * Hidden because it's only useful for embedding API.\n * Has to be overridden by main class.\n * @hidden\n */\n public getMain(): Main | undefined {\n return undefined;\n }\n\n public resumeTest(element: HTMLElement) {\n this._domHelper.setDomElement(element);\n this._lifeCycleManager.resume();\n }\n\n public pauseTest() {\n this._lifeCycleManager.pause();\n }\n\n public showGUI() {\n this._sceneManager.showGUI();\n }\n\n public get callbacks() {\n return {};\n }\n\n public getScene(): Scene {\n return this._sceneManager.getScene();\n }\n\n public updateScene(): void {\n this._sceneManager.updateScene();\n }\n\n /**\n * returns unit formatter for formatting input und output values in scene\n */\n public getUnitFormatter(): UnitFormatter {\n return this._unitFormatter;\n }\n\n /**\n * returns manager class to interface with indexedDB storage\n */\n public getStorage(): IdbManager {\n return this._idbManager;\n }\n\n public setEnvironmentMap(params: {\n url?: string;\n intensity?: number;\n rotation?: number;\n maxLightSources?: number;\n }): void {\n const { url, intensity, rotation, maxLightSources } = params;\n this._sceneManager.setEnvironmentMap(\n url,\n intensity,\n rotation,\n maxLightSources,\n );\n }\n\n public exportCanvasScreenshot(quality?: number): Promise<string> {\n return this._sceneManager.exportCanvasScreenshot(quality);\n }\n\n public async moveCamera(cameraParameter: CameraParameter): Promise<void> {\n return this._sceneManager.moveCamera(cameraParameter);\n }\n\n /**\n * @internal\n * Use this callbacks to hook in your functionality\n */\n public get globalCallbacks(): GlobalCallback {\n return this._globalCallback;\n }\n}\n","import InputManager from '../../../common-core/src/input/input-manager';\n\nexport default class GlbInputManager extends InputManager {\n //move on, nothing to see here\n}\n","import Logger from '../../../common-core/src/logger';\nimport ScriptLoader from '../../../common-core/src/script-loader';\nimport {\n DependencyInjectionAssignment,\n DI_TYPE,\n} from '../../../common-core/src/di/container';\nimport GlbInputManager from '../input/glb-input-manager';\nimport { RapiAccess } from '../../../common-core/src/rapi-access';\n\nexport const INJECTABLES: DependencyInjectionAssignment[] = [\n new DependencyInjectionAssignment('script-loader', ScriptLoader),\n new DependencyInjectionAssignment(\n 'glb-input-manager',\n GlbInputManager,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment('logger', Logger),\n new DependencyInjectionAssignment('rapi-access', RapiAccess),\n];\n","import './utils/global-definitions';\nimport { Main, BASE_CONTEXT } from '../../common-core/src/main';\nimport type Logger from '../../common-core/src/logger';\nimport { INJECTABLES } from './utils/injectables';\nimport RoomleDependencyInjection from '../../common-core/src/di/roomle-dependency-injection';\nimport { RoomleGLBViewer } from './roomle-glb-viewer';\n\nexport class GlbViewer extends Main {\n private _viewer: RoomleGLBViewer;\n\n protected setupGlobals(): void {\n //globals are initialized in bootFinished()\n }\n\n protected setupDependencies(): void {\n RoomleDependencyInjection.setup(INJECTABLES);\n this.lookup<Logger>('logger', this._context);\n }\n\n protected cleanUpGlobals(): void {\n throw new Error('Method not implemented.');\n }\n\n protected cleanUpDependencies(): void {\n throw new Error('Method not implemented.');\n }\n\n protected async bootFinished(): Promise<void> {\n this._viewer = new RoomleGLBViewer(this._context);\n\n if (!window.RoomleGLBViewer) {\n window.RoomleGLBViewer = this._viewer;\n }\n }\n\n public getApi(): RoomleGLBViewer {\n return this._viewer;\n }\n\n protected getContextName(): string {\n return BASE_CONTEXT.GLB_VIEWER;\n }\n}\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;AAGA,IAAqB,IAArB,cAAuD,EAAgB;;mDAC/B;;CAEtC,OACE,GACA,GAEA,GACA,GACA,GACA;AAGA,OAAK,eAAe,IAAI,EAFC,IAAI,EAAQ,CAAC,EAAO,IAAI,GAAG,GAAG,CAAC,EAAO,IAAI,EAAE,EAC5C,IAAI,EAAQ,EAAO,IAAI,GAAG,EAAO,GAAG,EAAO,IAAI,EAAE,CACxB;EAGlD,IAAI,IAAQ,IAAI,EAAM,CAAC,KAAK,KAAK,IAAI,GAAO,GAAK,GAAG,MAAM,EACtD,IAAa,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"glb-viewer-BByRaJ8F.mjs","names":[],"sources":["../../packages/glb-viewer-core/src/camera-control/adjustable-camera-control-3d.ts","../../packages/glb-viewer-core/src/webgl/glb-viewer-light-setting.ts","../../packages/glb-viewer-core/src/webgl/glb-viewer-scene-manager.ts","../../packages/glb-viewer-core/src/services/glb-render-worker.ts","../../../../node_modules/jszip/dist/jszip.min.js?no-inline?url","../../packages/glb-viewer-core/src/roomle-glb-viewer.ts","../../packages/glb-viewer-core/src/input/glb-input-manager.ts","../../packages/glb-viewer-core/src/utils/injectables.ts","../../packages/glb-viewer-core/src/glb-viewer.ts"],"sourcesContent":["import CameraControl3D from '../../../common-core/src/cameracontrol/camera-control-3d';\nimport { Box3, Euler, Quaternion, Vector3 } from 'three';\n\nexport default class AdjustableCameraControl3D extends CameraControl3D {\n public shouldIgnoreStandardBehavior = false;\n\n public adjust(\n bounds: Vector3,\n position: Vector3,\n\n yaw: number,\n pitch: number,\n _fov: number,\n ) {\n let minVector: Vector3 = new Vector3(-bounds.x / 2, 0, -bounds.z / 2);\n let maxVector: Vector3 = new Vector3(bounds.x / 2, bounds.y, bounds.z / 2);\n this._boundingBox = new Box3(minVector, maxVector);\n\n // before applying attis pitch value with have to rotate down, because we assume that attis rotation is upwards\n let euler = new Euler(-Math.PI / 2 + pitch, yaw, 0, 'ZYX');\n let quaternion = new Quaternion().setFromEuler(euler);\n\n this._camera.updateProjectionMatrix();\n\n this._camera.quaternion.copy(quaternion);\n this._camera.position.copy(position);\n }\n\n protected _update(overrideTarget?: Vector3) {\n if (!this.shouldIgnoreStandardBehavior) {\n super._update(overrideTarget);\n } else {\n this._saveYawAndPitch();\n }\n }\n\n public animateCamera(delta: number): boolean {\n if (!this.shouldIgnoreStandardBehavior) {\n return super.animateCamera(delta);\n } else {\n return true;\n }\n }\n}\n","import LightSetting from '../../../common-core/src/lightsetting/light-setting';\nimport type { ColorRepresentation, Scene } from 'three';\nimport { AmbientLight, Color } from 'three';\nimport type { GenericGUIParamFolder } from '../../../common-core/src/webgl/gui-types';\n\nexport default class GLBViewerLightSetting extends LightSetting {\n private _ambientLight: AmbientLight;\n\n private _params = {\n ambientLight: {\n color: '#ffffff',\n },\n };\n\n constructor(scene: Scene, oldLightSetting?: LightSetting) {\n super(scene, oldLightSetting);\n\n this._ambientLight = new AmbientLight(\n new Color(this._params.ambientLight.color as ColorRepresentation),\n 0.5,\n );\n\n this.addToScene();\n }\n\n public addToScene(): void {\n this._scene.add(this._ambientLight);\n }\n\n public removeFromScene(): void {\n this._scene.remove(this._ambientLight);\n }\n\n public reload(): void {\n this.removeFromScene();\n this.addToScene();\n }\n\n public showGUI(sceneParameters: GenericGUIParamFolder): void {\n if (this._ambientLight) {\n const ambientLightFolder = sceneParameters.addFolder('Ambient Light');\n ambientLightFolder.add(this._ambientLight, 'visible');\n ambientLightFolder\n .add(this._ambientLight, 'intensity')\n .min(0)\n .max(5)\n .step(0.1);\n ambientLightFolder\n .addColor(this._params.ambientLight, 'color')\n .onChange((color: string) => {\n this._ambientLight.color = new Color(color as ColorRepresentation);\n });\n }\n }\n}\n","import SceneManager from '../../../common-core/src/webgl/scene-manager';\nimport type {\n Base64Image,\n CanvasOffset,\n} from '../../../common-core/src/common-interfaces';\nimport AdjustableCameraControl3D from '../camera-control/adjustable-camera-control-3d';\nimport type { GLBRenderWorkerListener } from '../services/glb-render-worker';\nimport type InputManager from '../../../common-core/src/input/input-manager';\nimport inject from '../../../common-core/src/di/inject';\nimport type GlbInputManager from '../input/glb-input-manager';\n\nimport DefaultLightSetting from '../../../configurator-core/src/webgl/lightsetting/default-light-setting';\nimport ImageRenderer, {\n type PrepareImageOptions,\n} from '../../../common-core/src/webgl/image-renderer';\nimport { CAMERA_TYPE } from '../../../common-core/src/cameracontrol/camera-type';\nimport { toDegrees } from '../../../common-core/src/utils/math-helper';\nimport { dispose } from '../../../common-core/src/utils/threejs-utils';\nimport { type RapiAccess } from '../../../common-core/src/rapi-access';\nimport { getGlbUrl } from '../../../common-core/src/utils/common-utils';\nimport { CANVAS_ID } from '../../../common-core/src/utils/dom-helper';\nimport type { Enumify } from '#/common/src/utils/types';\nimport {\n BasicShadowMap,\n Box3,\n type Color,\n type Object3D,\n PerspectiveCamera,\n SRGBColorSpace,\n Vector3,\n WebGLRenderer,\n} from 'three';\nimport DynamicLightSettingLoader, {\n PREDEFINED_LIGHTSETTING,\n} from '../../../common-core/src/lightsetting/dynamic-light-setting-loader';\nimport GLBViewerLightSetting from './glb-viewer-light-setting';\nimport GlbViewerCameraBehaviour from '../../../common-core/src/cameracontrol/glb-viewer-camera-behaviour';\nimport {\n CAMERA_EVENT,\n type CameraParameter,\n} from '../../../common-core/src/cameracontrol/camera-control';\n\nexport default class GLBViewerSceneManager\n extends SceneManager\n implements GLBRenderWorkerListener\n{\n @inject\n private _glbInputManager: GlbInputManager;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n private _currentGLB: Object3D | null;\n private _standardSceneBackgroundColor: Color;\n\n private _itemsCount = 0;\n\n constructor(creator: string, offset: CanvasOffset) {\n super(creator, offset, CANVAS_ID.GLB, CAMERA_TYPE.CAMERA_3D);\n this._standardSceneBackgroundColor = this._scene.background as Color;\n if (this._initData.legacyLight && this._renderer instanceof WebGLRenderer) {\n if (this._renderer.capabilities.maxTextures > 8) {\n const lightSource =\n DynamicLightSettingLoader.createDynamicLightSettingSource(\n null,\n PREDEFINED_LIGHTSETTING.CAMERA,\n );\n if (lightSource) {\n this.loadDynamicLightSetting(lightSource);\n }\n } else {\n console.warn(\n 'this device has a maximum of 8 texture units thus we are using a simpler light setting',\n );\n this._lightSetting = new GLBViewerLightSetting(this._scene);\n }\n }\n }\n\n protected createCameraControl(\n _mode: Enumify<typeof CAMERA_TYPE>,\n _offset: CanvasOffset,\n ) {\n this._changeCameraBehaviour(\n new GlbViewerCameraBehaviour(\n new AdjustableCameraControl3D(\n this._creator_,\n this._getInputManager(),\n undefined,\n ),\n this._cameraBehaviourState,\n ),\n );\n }\n\n protected _getInputManager(): InputManager {\n return this._glbInputManager;\n }\n\n public async loadStaticItem(\n id: string,\n callback?: (percent: number) => void,\n ): Promise<void> {\n const rapiItem = await this._rapiAccess.getItem(id);\n if (rapiItem.configuration) {\n return Promise.reject();\n }\n const glbUrl = getGlbUrl(rapiItem);\n if (!glbUrl) {\n return Promise.reject(new Error('GLB Url not detected'));\n }\n return this.loadGLB(glbUrl, true, undefined, callback);\n }\n\n public loadGLB(\n url: string,\n automaticallyAdjustCamera: boolean = true,\n scaling: Vector3 = new Vector3(1, 1, 1),\n callback?: (percent: number) => void,\n ): Promise<void> {\n this.clearScene();\n return new Promise<void>((resolve, reject) => {\n this._loadGLB(\n url,\n new Vector3(0, 0, 0),\n 0,\n scaling,\n undefined,\n undefined,\n callback,\n ).then((glb) => {\n this._currentGLB = glb;\n this._scene.add(this._currentGLB);\n\n let boundingBox = new Box3().setFromObject(this._currentGLB);\n if (automaticallyAdjustCamera) {\n if (\n this.cameraBehaviour.cameraControl instanceof\n AdjustableCameraControl3D\n ) {\n this.glbViewerCameraBehaviour.updateCameraOnItemLoaded(boundingBox);\n }\n }\n this._updateBounds(boundingBox, undefined, true);\n this._readyForRender();\n resolve();\n }, reject);\n });\n }\n\n public preparePerspectiveImage(\n options: PrepareImageOptions = {},\n providedRenderer?: WebGLRenderer,\n ): Promise<Base64Image> {\n if (!providedRenderer && this._initData.webGpu) {\n return this._prepareWebGpuPerspectiveImage(options);\n }\n\n // When a renderer is supplied (e.g. by GLBRenderWorker for a batched\n // thumbnail run), use its existing size; otherwise build a fresh\n // offscreen renderer sized off `options.size`.\n let renderer: WebGLRenderer;\n let width: number;\n let height: number;\n if (providedRenderer) {\n renderer = providedRenderer;\n width = renderer.domElement.width;\n height = renderer.domElement.height;\n } else {\n const size = options.size ?? 1000;\n width = size;\n height = size;\n renderer = new WebGLRenderer({ antialias: true });\n renderer.setSize(width, height);\n renderer.outputColorSpace = SRGBColorSpace;\n renderer.autoClear = false;\n renderer.shadowMap.enabled = true;\n renderer.shadowMap.type = BasicShadowMap;\n }\n\n return new Promise<Base64Image>((resolve, reject) => {\n const camera = this.cameraBehaviour.cameraControl.getCamera().clone();\n if (camera instanceof PerspectiveCamera) {\n camera.aspect = width / height;\n camera.updateProjectionMatrix();\n }\n\n // Deterministic framing on the loaded GLB's bounds — avoids any\n // dependency on the live camera state, which may still be tweening\n // toward the new model when this method is called.\n const bounds = this.getBounds();\n if (bounds && camera instanceof PerspectiveCamera) {\n const cameraTarget = ImageRenderer.getCameraTargetForBBox(bounds);\n const angleY = -30 + toDegrees(options.rotationY ?? 0);\n ImageRenderer.placeCameraForPerspectiveImage(\n camera,\n cameraTarget,\n -20,\n angleY,\n );\n }\n\n this._lightSetting?.removeFromScene();\n const defaultLightSetting = new DefaultLightSetting(this._scene);\n\n // Honor preserveSceneBackground symmetrically with ImageRenderer:\n // null background+fog when stripping was requested. Default for the\n // GLB viewer is to keep the scene's existing background visible.\n const preserveSceneBackground = options.preserveSceneBackground ?? true;\n const savedFog = this._scene.fog;\n const savedBackground = this._scene.background;\n let image: string;\n try {\n if (!preserveSceneBackground) {\n this._scene.background = null;\n this._scene.fog = null;\n }\n renderer.render(this._scene, camera);\n image = renderer.domElement.toDataURL();\n } finally {\n // Restore mutated scene state regardless of success/failure so a\n // throw in render() / toDataURL() can't leave the scene with a\n // null background for the rest of the session.\n if (!preserveSceneBackground) {\n this._scene.background = savedBackground;\n this._scene.fog = savedFog;\n }\n defaultLightSetting.removeFromScene();\n this._lightSetting?.addToScene();\n }\n\n renderer.domElement.toBlob((blob) => {\n if (blob === null) {\n reject(new Error('Failed to create blob from canvas'));\n return;\n }\n resolve({ image, width, height, blob });\n }, 'image/png');\n });\n }\n\n private async _prepareWebGpuPerspectiveImage(\n options: PrepareImageOptions,\n ): Promise<Base64Image> {\n const camera = this.cameraBehaviour.cameraControl.getCamera().clone();\n const bounds = this.getBounds();\n const cameraTarget =\n bounds && camera instanceof PerspectiveCamera\n ? ImageRenderer.getCameraTargetForBBox(bounds)\n : undefined;\n\n this._lightSetting?.removeFromScene();\n const defaultLightSetting = new DefaultLightSetting(this._scene);\n try {\n return await this._imageRenderer.preparePerspectiveImage(\n this._scene,\n camera as PerspectiveCamera,\n cameraTarget,\n {\n ...options,\n preserveSceneBackground: options.preserveSceneBackground ?? true,\n },\n );\n } finally {\n defaultLightSetting.removeFromScene();\n this._lightSetting?.addToScene();\n }\n }\n\n public adjustCamera(\n position: Vector3,\n yaw: number,\n pitch: number,\n fov: number,\n ) {\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n let boundingBox = new Box3().setFromObject(this._scene);\n let bounds = boundingBox.getSize(new Vector3());\n (this.cameraBehaviour.cameraControl as AdjustableCameraControl3D).adjust(\n bounds,\n position,\n yaw,\n pitch,\n fov,\n );\n this._requestRender();\n }\n }\n\n public onStart(count: number) {\n this._itemsCount = count;\n this._scene.background = null;\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n (\n this.cameraBehaviour.cameraControl as AdjustableCameraControl3D\n ).shouldIgnoreStandardBehavior = true;\n }\n console.log('start processing ' + count + ' items');\n }\n\n public onElementFinished(itemsFinished: number) {\n console.log(\n 'processed ' +\n itemsFinished +\n ' of ' +\n this._itemsCount +\n ' items (' +\n Math.round((100 / this._itemsCount) * itemsFinished) +\n '%)',\n );\n }\n\n public onFinished(_zip: any) {\n this._scene.background = this._standardSceneBackgroundColor;\n if (\n this.cameraBehaviour.cameraControl instanceof AdjustableCameraControl3D\n ) {\n (\n this.cameraBehaviour.cameraControl as AdjustableCameraControl3D\n ).shouldIgnoreStandardBehavior = false;\n }\n }\n\n public clearScene() {\n if (this._currentGLB) {\n this._scene.remove(this._currentGLB);\n dispose(this._currentGLB);\n this._currentGLB = null;\n }\n super.clearScene();\n }\n\n public enableHD() {\n super.enableHD();\n }\n\n public sceneChanged(): void {\n //override when needed\n }\n\n getBounds(): Box3 | null {\n if (!this._currentGLB) {\n return null;\n }\n return new Box3().setFromObject(this._currentGLB);\n }\n\n protected get glbViewerCameraBehaviour(): GlbViewerCameraBehaviour {\n return this.cameraBehaviour as GlbViewerCameraBehaviour;\n }\n\n getGeometryBounds(): Box3 | null {\n return null;\n }\n\n cameraBehaviourChanged(updateDistance: boolean = true) {\n super.cameraBehaviourChanged(updateDistance);\n\n this.cameraBehaviour.cameraControl.addEventListener(\n CAMERA_EVENT.ZOOM_IN,\n () => {\n this._requestRender();\n },\n this,\n );\n this.cameraBehaviour.cameraControl.addEventListener(\n CAMERA_EVENT.ZOOM_OUT,\n () => {\n this._requestRender();\n },\n this,\n );\n }\n\n public async moveCamera(cameraParameter: CameraParameter): Promise<void> {\n return this.glbViewerCameraBehaviour.externalApiMoveCamera(cameraParameter);\n }\n\n // info when scene is ready to render, used for testing\n protected _readyForRender() {\n console.log('ready_for_render');\n this._globalCallback.onReadyForRender();\n }\n}\n","import type { Base64Image } from '../../../common-core/src/common-interfaces';\nimport type GLBViewerSceneManager from '../webgl/glb-viewer-scene-manager';\nimport type { RenderEntry } from '../roomle-glb-viewer';\nimport { SRGBColorSpace, Vector3, WebGLRenderer } from 'three';\n\ninterface GLBRenderEntry {\n name: string;\n url: string;\n position: Vector3;\n fov: number;\n yaw: number;\n pitch: number;\n}\n\nexport interface GLBRenderWorkerListener {\n onStart(count: number): void;\n\n onElementFinished(finishedElements: number): void;\n\n onFinished(zip: any): void;\n}\n\nexport default class GLBRenderWorker {\n private _sceneManager: GLBViewerSceneManager;\n private _entries: GLBRenderEntry[];\n\n private _resolve: (zip: any) => void;\n\n private _prefix = 'https://furniture.roomle.com/3d/glb/';\n\n private _renderer: WebGLRenderer;\n private _width: number;\n private _height: number;\n\n private _listeners: Set<GLBRenderWorkerListener> =\n new Set<GLBRenderWorkerListener>();\n private _finishedItems: number = 0;\n\n private _zip: any;\n\n constructor(\n sceneManager: GLBViewerSceneManager,\n width: number,\n height: number,\n ) {\n this._sceneManager = sceneManager;\n\n this._renderer = new WebGLRenderer({ antialias: true, alpha: true });\n this._width = width;\n this._height = height;\n this._renderer.setSize(width, height);\n this._renderer.setClearColor(0xffffff, 0);\n this._renderer.outputColorSpace = SRGBColorSpace;\n }\n\n public addListener(listener: GLBRenderWorkerListener) {\n this._listeners.add(listener);\n }\n\n public removeListener(listener: GLBRenderWorkerListener) {\n this._listeners.delete(listener);\n }\n\n public start(entries: RenderEntry[]): Promise<any> {\n this._entries = [];\n entries.forEach((entry) => {\n this._entries.push(this._transform(entry)); // {name: url.replace('.glb', '.png'), url: this._prefix + url}\n });\n this._finishedItems = 0;\n this._listeners.forEach((listener) =>\n listener.onStart(this._entries.length),\n );\n this._zip = new (window as any).JSZip();\n this._doNextEntry();\n return new Promise<any>((resolve) => {\n this._resolve = resolve;\n });\n }\n\n private _transform(entry: RenderEntry): GLBRenderEntry {\n return {\n name: entry.path.replace('.glb', '.png'),\n url: this._prefix + entry.path,\n position: new Vector3(\n entry.camera.position.x,\n entry.camera.position.z,\n -entry.camera.position.y,\n ),\n fov: entry.camera.fieldOfView * 2, // * 2 because Atti suggested it after all images were cut on all sides\n yaw: entry.camera.rotation.z,\n pitch: entry.camera.rotation.x,\n };\n }\n\n private _doNextEntry() {\n if (this._entries.length === 0) {\n this._listeners.forEach((listener) => listener.onFinished(this._zip));\n this._resolve(this._zip);\n } else {\n this._processEntry(this._entries[0]);\n }\n }\n\n private _processEntry(entry: GLBRenderEntry) {\n this._sceneManager.loadGLB(entry.url, false, undefined).then(() => {\n this._sceneManager.adjustCamera(\n entry.position,\n entry.yaw,\n entry.pitch,\n entry.fov,\n );\n this._sceneManager\n .preparePerspectiveImage({}, this._renderer)\n .then((base64Image) => {\n this._entryFinished(entry, base64Image);\n });\n });\n }\n\n private _entryFinished(entry: GLBRenderEntry, base64Image: Base64Image) {\n let index = this._entries.indexOf(entry);\n if (index > -1) {\n this._entries.splice(index, 1);\n }\n this._finishedItems++;\n this._listeners.forEach((listener) =>\n listener.onElementFinished(this._finishedItems),\n );\n this._zip.file(entry.name, base64Image.blob);\n this._doNextEntry();\n }\n}\n","export default \"__VITE_ASSET__WPGYjwIlzWVNM1bYhOc83w__\"","import type ScriptLoader from '../../common-core/src/script-loader';\nimport type DomHelper from '../../common-core/src/utils/dom-helper';\nimport inject from '../../common-core/src/di/inject';\nimport GLBViewerSceneManager from './webgl/glb-viewer-scene-manager';\nimport type {\n Base64Image,\n CanvasOffset,\n Position3,\n} from '../../common-core/src/common-interfaces';\nimport GLBRenderWorker from './services/glb-render-worker';\nimport type { ExternalEmbeddable, GlobalAPI } from '../../common-core/src/main';\nimport type { Main } from '../../common-core/src/main';\nimport type { Context } from '../../common-core/src/di/context';\nimport type { LifeCycleManager } from '../../common-core/src/life-cycle-manager';\nimport type { SceneSettings } from '../../common-core/src/scene-settings-loader';\nimport { JS_ZIP_FILE_NAME } from '../../common-core/src/static-files/libs';\nimport type InitData from '../../common-core/src/utils/init-data';\nimport type {\n GlobalInitDataDefinition,\n InitDataDefinition,\n} from '../../common-core/src/utils/shims';\nimport type GlobalInitData from '../../common-core/src/utils/global-init-data';\nimport { type RapiAccess } from '../../common-core/src/rapi-access';\nimport type { PrepareImageOptions } from '../../common-core/src/webgl/image-renderer';\nimport type UnitFormatter from '../../configurator-core/src/services/unit-formatter';\nimport { download } from '../../common-core/src/utils/common-utils';\nimport type { Scene } from 'three';\nimport { Vector3 } from 'three';\nimport { type IdbManager } from '../../common-core/src/services/idb-manager';\nimport type { CameraParameter } from '../../common-core/src/cameracontrol/camera-control';\nimport type { GlobalCallback } from '../../common-core/src/services/global-callback';\n\ninterface RenderCameraInformation {\n fieldOfView: number;\n rotation: Position3;\n position: Position3;\n}\n\nexport declare interface RenderEntry {\n path: string;\n camera: RenderCameraInformation;\n}\n\nexport class GlbViewerUiCallbacks {}\n\nexport class RoomleGLBViewer\n implements GlobalAPI, Context, ExternalEmbeddable<GlbViewerUiCallbacks>\n{\n public _creator_: string;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n @inject\n private _domHelper: DomHelper;\n\n @inject\n private _scriptLoader: ScriptLoader;\n\n @inject\n private _lifeCycleManager: LifeCycleManager;\n\n @inject\n private _initData: InitData;\n\n @inject\n private _globalInitData: GlobalInitData;\n\n @inject\n private _globalCallback: GlobalCallback;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n @inject\n protected _idbManager: IdbManager;\n\n private _sceneManager: GLBViewerSceneManager;\n\n private _currentIdOrUrl: string | null = null;\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public setCameraOffset(offset: CanvasOffset): void {\n this._sceneManager.setCameraOffset(offset);\n }\n\n public getCameraOffset(): CanvasOffset {\n return this._sceneManager.getCameraOffset();\n }\n\n public init(\n element: HTMLElement,\n initData?: InitDataDefinition,\n ): Promise<void> {\n this.setOverrides(initData);\n this._domHelper.setDomElement(element);\n\n if (this._sceneManager) {\n this._lifeCycleManager.resume();\n return Promise.resolve();\n }\n\n return new Promise<void>(this._initPromiseCallback.bind(this));\n }\n\n private _initPromiseCallback(resolve: () => void, _reject: () => void) {\n this._sceneManager = new GLBViewerSceneManager(this._creator_, {\n left: 0,\n top: 1,\n right: 1,\n bottom: 0,\n });\n // this.loadGLB('https://furniture.roomle.com/3d/glb/furniture/vitra/41206600/41206600.glb');\n this._sceneManager.enableHD();\n resolve();\n }\n\n public getSceneManager() {\n return this._sceneManager;\n }\n\n /**\n * Remove the current glb from the scene if it exists\n */\n public clearScene() {\n this._sceneManager.clearScene();\n }\n\n /**\n * Loads the GLB from the given URL Param\n * @param url\n * @param scaling defaults to 1\n * @param callback loading percent between 0 and 1\n */\n public loadGLB(\n url: string,\n scaling = 1,\n callback?: (percent: number) => void,\n ): Promise<void> {\n this._currentIdOrUrl = url;\n this._rapiAccess.trackView(url);\n return this._sceneManager.loadGLB(\n url,\n true,\n new Vector3(scaling, scaling, scaling),\n callback,\n );\n }\n\n /**\n * Loads the glb asset from the static item\n * @param staticItemId\n * @param callback loading percent between 0 and 1\n */\n public loadStaticItem(\n staticItemId: string,\n callback?: (percent: number) => void,\n ): Promise<void> {\n this._currentIdOrUrl = staticItemId;\n this._rapiAccess.trackView(staticItemId);\n return this._sceneManager.loadStaticItem(staticItemId, callback);\n }\n\n /**\n * Returns the current item id or url of the loaded object\n */\n public getCurrentId(): string | null {\n return this._currentIdOrUrl;\n }\n\n /**\n * Loads a SceneSettings object, currently it can can contain a light setting definition\n * (see {@link @roomle/web-sdk/configurator-core/src/roomle-configurator#RoomleConfigurator.loadDynamicLightSetting}) and an environment definition (see {@link @roomle/web-sdk/configurator-core/src/environment/dynamic-environment-setting-loaderEnvironmentSetting}).\n * @param sceneSettings\n */\n public loadSceneSetting(sceneSettings: SceneSettings): Promise<void> {\n return this._sceneManager.loadSceneSettings(sceneSettings);\n }\n\n public preparePerspectiveImage(\n options: PrepareImageOptions = {},\n ): Promise<Base64Image> {\n return this._sceneManager.preparePerspectiveImage(options);\n }\n\n public processRenderList(\n jsonString: string,\n width: number = 320,\n height: number = 320,\n ) {\n const object = JSON.parse(jsonString);\n this._scriptLoader.fetch(JS_ZIP_FILE_NAME, { id: 'jszip-js' }).then(() => {\n const worker = new GLBRenderWorker(this._sceneManager, width, height);\n worker.addListener(this._sceneManager);\n worker.start(object.items).then((zip: any) => {\n zip.generateAsync({ type: 'blob' }).then((content: File) => {\n download('content.zip', URL.createObjectURL(content));\n worker.removeListener(this._sceneManager);\n });\n });\n });\n }\n\n public setOverrides(\n initData:\n | Partial<InitDataDefinition & GlobalInitDataDefinition>\n | InitData\n | undefined,\n ): void {\n if (!initData) {\n return;\n }\n this._initData.setOverrides(initData);\n this._globalInitData.setOverrides(initData);\n }\n\n public updateSize(): void {\n this._sceneManager.updateCamera();\n }\n\n /**\n * Return the main class which has access to lifecycle events and RapiAccess.\n * Hidden because it's only useful for embedding API.\n * Has to be overridden by main class.\n * @hidden\n */\n public getMain(): Main | undefined {\n return undefined;\n }\n\n public resumeTest(element: HTMLElement) {\n this._domHelper.setDomElement(element);\n this._lifeCycleManager.resume();\n }\n\n public pauseTest() {\n this._lifeCycleManager.pause();\n }\n\n public showGUI() {\n this._sceneManager.showGUI();\n }\n\n public get callbacks() {\n return {};\n }\n\n public getScene(): Scene {\n return this._sceneManager.getScene();\n }\n\n public updateScene(): void {\n this._sceneManager.updateScene();\n }\n\n /**\n * returns unit formatter for formatting input und output values in scene\n */\n public getUnitFormatter(): UnitFormatter {\n return this._unitFormatter;\n }\n\n /**\n * returns manager class to interface with indexedDB storage\n */\n public getStorage(): IdbManager {\n return this._idbManager;\n }\n\n public setEnvironmentMap(params: {\n url?: string;\n intensity?: number;\n rotation?: number;\n maxLightSources?: number;\n }): void {\n const { url, intensity, rotation, maxLightSources } = params;\n this._sceneManager.setEnvironmentMap(\n url,\n intensity,\n rotation,\n maxLightSources,\n );\n }\n\n public exportCanvasScreenshot(quality?: number): Promise<string> {\n return this._sceneManager.exportCanvasScreenshot(quality);\n }\n\n public async moveCamera(cameraParameter: CameraParameter): Promise<void> {\n return this._sceneManager.moveCamera(cameraParameter);\n }\n\n /**\n * @internal\n * Use this callbacks to hook in your functionality\n */\n public get globalCallbacks(): GlobalCallback {\n return this._globalCallback;\n }\n}\n","import InputManager from '../../../common-core/src/input/input-manager';\n\nexport default class GlbInputManager extends InputManager {\n //move on, nothing to see here\n}\n","import Logger from '../../../common-core/src/logger';\nimport ScriptLoader from '../../../common-core/src/script-loader';\nimport {\n DependencyInjectionAssignment,\n DI_TYPE,\n} from '../../../common-core/src/di/container';\nimport GlbInputManager from '../input/glb-input-manager';\nimport { RapiAccess } from '../../../common-core/src/rapi-access';\n\nexport const INJECTABLES: DependencyInjectionAssignment[] = [\n new DependencyInjectionAssignment('script-loader', ScriptLoader),\n new DependencyInjectionAssignment(\n 'glb-input-manager',\n GlbInputManager,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment('logger', Logger),\n new DependencyInjectionAssignment('rapi-access', RapiAccess),\n];\n","import './utils/global-definitions';\nimport { Main, BASE_CONTEXT } from '../../common-core/src/main';\nimport type Logger from '../../common-core/src/logger';\nimport { INJECTABLES } from './utils/injectables';\nimport RoomleDependencyInjection from '../../common-core/src/di/roomle-dependency-injection';\nimport { RoomleGLBViewer } from './roomle-glb-viewer';\n\nexport class GlbViewer extends Main {\n private _viewer: RoomleGLBViewer;\n\n protected setupGlobals(): void {\n //globals are initialized in bootFinished()\n }\n\n protected setupDependencies(): void {\n RoomleDependencyInjection.setup(INJECTABLES);\n this.lookup<Logger>('logger', this._context);\n }\n\n protected cleanUpGlobals(): void {\n throw new Error('Method not implemented.');\n }\n\n protected cleanUpDependencies(): void {\n throw new Error('Method not implemented.');\n }\n\n protected async bootFinished(): Promise<void> {\n this._viewer = new RoomleGLBViewer(this._context);\n\n if (!window.RoomleGLBViewer) {\n window.RoomleGLBViewer = this._viewer;\n }\n }\n\n public getApi(): RoomleGLBViewer {\n return this._viewer;\n }\n\n protected getContextName(): string {\n return BASE_CONTEXT.GLB_VIEWER;\n }\n}\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;AAGA,IAAqB,IAArB,cAAuD,EAAgB;;mDAC/B;;CAEtC,OACE,GACA,GAEA,GACA,GACA,GACA;AAGA,OAAK,eAAe,IAAI,EAFC,IAAI,EAAQ,CAAC,EAAO,IAAI,GAAG,GAAG,CAAC,EAAO,IAAI,EAAE,EAC5C,IAAI,EAAQ,EAAO,IAAI,GAAG,EAAO,GAAG,EAAO,IAAI,EAAE,CACxB;EAGlD,IAAI,IAAQ,IAAI,EAAM,CAAC,KAAK,KAAK,IAAI,GAAO,GAAK,GAAG,MAAM,EACtD,IAAa,IAAI,GAAY,CAAC,aAAa,EAAM;AAKrD,EAHA,KAAK,QAAQ,wBAAwB,EAErC,KAAK,QAAQ,WAAW,KAAK,EAAW,EACxC,KAAK,QAAQ,SAAS,KAAK,EAAS;;CAGtC,QAAkB,GAA0B;AAC1C,EAAK,KAAK,+BAGR,KAAK,kBAAkB,GAFvB,MAAM,QAAQ,EAAe;;CAMjC,cAAqB,GAAwB;AAEzC,SADG,KAAK,+BAGD,KAFA,MAAM,cAAc,EAAM;;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AA,EAAA,WAAA,aAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,kBAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA;;;ACxEH,IAAqB,IAArB,cAA6C,EAAa,ICO7C,IAA+C;CAC1D,IAAI,EAA8B,iBAAiB,EAAa;CAChE,IAAI,EACF,qBACA,GACA,EAAQ,QACT;CACD,IAAI,EAA8B,UAAU,EAAO;CACnD,IAAI,EAA8B,eAAe,EAAA;CAClD,ECXY,IAAb,cAA+B,EAAK;CAGlC,eAA+B;CAI/B,oBAAoC;AAElC,EADA,EAA0B,MAAM,EAAY,EAC5C,KAAK,OAAe,UAAU,KAAK,SAAS;;CAG9C,iBAAiC;AAC/B,QAAU,MAAM,0BAA0B;;CAG5C,sBAAsC;AACpC,QAAU,MAAM,0BAA0B;;CAG5C,MAAgB,eAA8B;AAG5C,EAFA,KAAK,UAAU,IAAI,EAAgB,KAAK,SAAS,EAE5C,OAAO,oBACV,OAAO,kBAAkB,KAAK;;CAIlC,SAAiC;AAC/B,SAAO,KAAK;;CAGd,iBAAmC;AACjC,SAAO,EAAa"}
@@ -0,0 +1,3 @@
1
+
2
+ import { t as e } from "./glb-viewer-BByRaJ8F.mjs";
3
+ export { e as GlbViewer };
@@ -1,6 +1,6 @@
1
1
 
2
- import { a as e } from "./roomle-sdk-CSH3WHXV.mjs";
3
- import { t } from "./api-B_Mu7Mg1.mjs";
2
+ import { a as e } from "./roomle-sdk-ByoTm5M6.mjs";
3
+ import { t } from "./api-0LgvKoxe.mjs";
4
4
  //#region ../../node_modules/uuid/dist/esm-browser/stringify.js
5
5
  var n = [];
6
6
  for (let e = 0; e < 256; ++e) n.push((e + 256).toString(16).slice(1));
@@ -442,4 +442,4 @@ var g = Promise.resolve(), _ = () => {
442
442
  //#endregion
443
443
  export { v as HomagIntelligence };
444
444
 
445
- //# sourceMappingURL=homag-intelligence-DboRA-Yd.mjs.map
445
+ //# sourceMappingURL=homag-intelligence-wHSuuAC4.mjs.map