var{defineProperty:C,getOwnPropertyNames:Z,getOwnPropertyDescriptor:$}=Object,h=Object.prototype.hasOwnProperty;function V(N){return this[N]}var k=(N)=>{var L=(x??=new WeakMap).get(N),O;if(L)return L;if(L=C({},"__esModule",{value:!0}),N&&typeof N==="object"||typeof N==="function"){for(var _ of Z(N))if(!h.call(L,_))C(L,_,{get:V.bind(N,_),enumerable:!(O=$(N,_))||O.enumerable})}return x.set(N,L),L},x;var S=(N)=>N;function U(N,L){this[N]=S.bind(null,L)}var q=(N,L)=>{for(var O in L)C(N,O,{get:L[O],enumerable:!0,configurable:!0,set:U.bind(L,O)})};var G=(N,L)=>()=>(N&&(L=N(N=0)),L);var u={};q(u,{groupByToArray:()=>B,groupByMultiple:()=>w,groupBy:()=>R,getUniqueTags:()=>M,getUniqueOwners:()=>F,getUniqueDomains:()=>v,filterBy:()=>P,GroupingStrategies:()=>I});function P(N,L){return N.filter((O)=>{if(L.tags?.length){if(!L.tags.some((A)=>O.meta.tags?.includes(A)))return!1}if(L.owners?.length){if(!L.owners.some((A)=>O.meta.owners?.includes(A)))return!1}if(L.stability?.length){if(!L.stability.includes(O.meta.stability??"stable"))return!1}if(L.domain){if(I.byDomain(O)!==L.domain)return!1}if(L.keyPattern){let _=O.meta.key??O.meta.key??"",A=L.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${A}$`,"i").test(_))return!1}return!0})}function R(N,L){let O=new Map;for(let _ of N){let A=L(_),T=O.get(A);if(T)T.push(_);else O.set(A,[_])}return O}function B(N,L){let O=R(N,L);return Array.from(O.entries()).map(([_,A])=>({key:_,items:A}))}function w(N,L){let O=new Map;for(let _ of N){let A=L(_);for(let T of A){let j=O.get(T);if(j)j.push(_);else O.set(T,[_])}}return O}function M(N){let L=new Set;for(let O of N)for(let _ of O.meta.tags??[])L.add(_);return Array.from(L).sort()}function F(N){let L=new Set;for(let O of N)for(let _ of O.meta.owners??[])L.add(_);return Array.from(L).sort()}function v(N){let L=new Set;for(let O of N)L.add(I.byDomain(O));return Array.from(L).sort()}var I;var z=G(()=>{I={byTag:(N)=>N.meta.tags?.[0]??"untagged",byAllTags:(N)=>N.meta.tags?.length?N.meta.tags:["untagged"],byOwner:(N)=>N.meta.owners?.[0]??"unowned",byDomain:(N)=>{return(N.meta.key??N.meta.key??"").split(".")[0]??"default"},byStability:(N)=>N.meta.stability??"stable",byUrlPath:(N)=>(L)=>{if(!L.path)return"root";return L.path.split("/").filter(Boolean).slice(0,N).join("/")||"root"}}});var D={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},W={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"},y=W,Y={Spots:"spots",Collectivity:"collectivity",Marketplace:"marketplace",Sellers:"sellers",Auth:"auth",Login:"login",Signup:"signup",Guide:"guide",Docs:"docs",I18n:"i18n",Incident:"incident",Automation:"automation",Hygiene:"hygiene"},a=Y;z();import{compareVersions as d}from"compare-versions";var c=(N)=>`${N.meta.key}.v${N.meta.version}`;class b{contractType;items=new Map;constructor(N,L){this.contractType=N;if(L)L.forEach((O)=>this.register(O))}register(N){let L=c(N);if(this.items.has(L))throw Error(`Duplicate contract \`${this.contractType}\` ${L}`);return this.items.set(L,N),this}count(){return this.items.size}list(){return[...this.items.values()]}get(N,L){if(L!=null)return this.items.get(`${N}.v${L}`);let O;for(let[_,A]of this.items.entries()){if(!_.startsWith(`${N}.v`))continue;if(!O||d(A.meta.version,O.meta.version)>0)O=A}return O}has(N,L){return!!this.get(N,L)}filter(N){return P(this.list(),N)}listByTag(N){return this.list().filter((L)=>L.meta.tags?.includes(N))}listByOwner(N){return this.list().filter((L)=>L.meta.owners?.includes(N))}groupBy(N){return R(this.list(),N)}getUniqueTags(){return M(this.list())}}function H(N){return N}var t=(N,L)=>`${N}.v${L}`;class f extends b{constructor(N){super("event",N)}}var J="control-plane",K=[W.PlatformCore],Q=[Y.Automation,"control-plane","agent-runtime"],X=D.Experimental;import{ScalarTypeEnum as E,SchemaModel as p}from"@contractspec/lib.schema";var g=new p({name:"ControlPlaneExecutionStepBlockedPayload",fields:{executionId:{type:E.ID(),isOptional:!1},runId:{type:E.ID(),isOptional:!0},stepId:{type:E.ID(),isOptional:!0},blockedAt:{type:E.DateTime(),isOptional:!1},reason:{type:E.String_unsecure(),isOptional:!1}}}),AN=H({meta:{key:"controlPlane.execution.step.blocked",version:"1.0.0",description:"Emitted when policy blocks an execution step.",domain:J,owners:K,tags:[...Q,"execution","blocked"],stability:X},payload:g});export{g as ControlPlaneExecutionStepBlockedPayload,AN as ControlPlaneExecutionStepBlockedEvent};
