// @bun
var{defineProperty:E,getOwnPropertyNames:G,getOwnPropertyDescriptor:H}=Object,I=Object.prototype.hasOwnProperty;function J(A){return this[A]}var M=(A)=>{var B=(F??=new WeakMap).get(A),m;if(B)return B;if(B=E({},"__esModule",{value:!0}),A&&typeof A==="object"||typeof A==="function"){for(var C of G(A))if(!I.call(B,C))E(B,C,{get:J.bind(A,C),enumerable:!(m=H(A,C))||m.enumerable})}return F.set(A,B),B},F;var K=(A)=>A;function L(A,B){this[A]=K.bind(null,B)}var N=(A,B)=>{for(var m in B)E(A,m,{get:B[m],enumerable:!0,configurable:!0,set:L.bind(B,m)})};var O=(A,B)=>()=>(A&&(B=A(A=0)),B);function Q(A,B){if(B.ops&&A.operations){for(let m of A.operations)if(!B.ops.get(m.key,m.version))throw Error(`installFeature: operation not found ${m.key}.v${m.version}`)}if(B.presentations&&A.presentations){for(let m of A.presentations)if(!B.presentations.get(m.key,m.version))throw Error(`installFeature: presentation not found ${m.key}.v${m.version}`)}if(A.presentationsTargets&&B.descriptors)for(let m of A.presentationsTargets){let C=B.descriptors.find((D)=>D.meta.key===m.key&&D.meta.version===m.version);if(!C)throw Error(`installFeature: V2 descriptor not found ${m.key}.v${m.version}`);for(let D of m.targets)if(!C.targets.includes(D))throw Error(`installFeature: descriptor ${m.key}.v${m.version} missing target ${D}`)}if(A.opToPresentation&&A.opToPresentation.length>0)for(let m of A.opToPresentation){if(B.ops){if(!B.ops.get(m.op.key,m.op.version))throw Error(`installFeature: linked op not found ${m.op.key}.v${m.op.version}`)}if(B.presentations){if(!B.presentations.get(m.pres.key,m.pres.version))throw Error(`installFeature: linked presentation not found ${m.pres.key}.v${m.pres.version}`)}}if(B.capabilities&&A.capabilities?.provides){for(let m of A.capabilities.provides)if(!B.capabilities.get(m.key,m.version))throw Error(`installFeature: capability not registered ${m.key}.v${m.version}`)}if(A.capabilities?.requires?.length){if(!B.capabilities)throw Error(`installFeature: capability registry required to validate capability requirements for ${A.meta.key}`);let m=A.capabilities.provides??[];for(let C of A.capabilities.requires)if(!B.capabilities.satisfies(C,m))throw Error(`installFeature: capability requirement not satisfied ${C.key}${C.version?`.v${C.version}`:""}`)}if(B.dataViews&&A.dataViews){for(let m of A.dataViews)if(!B.dataViews.get(m.key,m.version))throw Error(`installFeature: data view not found ${m.key}.v${m.version}`)}if(B.visualizations&&A.visualizations){for(let m of A.visualizations)if(!B.visualizations.get(m.key,m.version))throw Error(`installFeature: visualization not found ${m.key}.v${m.version}`)}if(B.forms&&A.forms){for(let m of A.forms)if(!B.forms.get(m.key,m.version))throw Error(`installFeature: form not found ${m.key}.v${m.version}`)}if(B.workflows&&A.workflows){for(let m of A.workflows)if(!B.workflows.get(m.key,m.version))throw Error(`installFeature: workflow not found ${m.key}.v${m.version}`)}if(B.knowledge&&A.knowledge){for(let m of A.knowledge)if(!B.knowledge.get(m.key,m.version))throw Error(`installFeature: knowledge space not found ${m.key}.v${m.version}`)}if(B.telemetry&&A.telemetry){for(let m of A.telemetry)if(!B.telemetry.get(m.key,m.version))throw Error(`installFeature: telemetry spec not found ${m.key}.v${m.version}`)}if(B.policies&&A.policies){for(let m of A.policies)if(!B.policies.get(m.key,m.version))throw Error(`installFeature: policy not found ${m.key}.v${m.version}`)}if(B.integrations&&A.integrations){for(let m of A.integrations)if(!B.integrations.get(m.key,m.version))throw Error(`installFeature: integration not found ${m.key}.v${m.version}`)}if(B.jobs&&A.jobs){for(let m of A.jobs)if(!B.jobs.get(m.key,m.version))throw Error(`installFeature: job not found ${m.key}.v${m.version}`)}if(B.translations&&A.translations)for(let m of A.translations){let C=B.translations.listLocales(m.key);if(C.length===0)throw Error(`installFeature: translation not found ${m.key}.v${m.version}`);if(m.locale&&!C.includes(m.locale))throw Error(`installFeature: translation locale ${m.locale} not found for ${m.key}.v${m.version}`)}return B.features.register(A),B.features}export{Q as installFeature};
