var{defineProperty:O,getOwnPropertyNames:u,getOwnPropertyDescriptor:z}=Object,J=Object.prototype.hasOwnProperty;function Q(S){return this[S]}var n=(S)=>{var A=(K??=new WeakMap).get(S),E;if(A)return A;if(A=O({},"__esModule",{value:!0}),S&&typeof S==="object"||typeof S==="function"){for(var N of u(S))if(!J.call(A,N))O(A,N,{get:Q.bind(S,N),enumerable:!(E=z(S,N))||E.enumerable})}return K.set(S,A),A},K;var X=(S)=>S;function Z(S,A){this[S]=X.bind(null,A)}var $=(S,A)=>{for(var E in A)O(S,E,{get:A[E],enumerable:!0,configurable:!0,set:Z.bind(A,E)})};var V=(S,A)=>()=>(S&&(A=S(S=0)),A);var q={};$(q,{groupByToArray:()=>B,groupByMultiple:()=>C,groupBy:()=>I,getUniqueTags:()=>x,getUniqueOwners:()=>G,getUniqueDomains:()=>U,filterBy:()=>h,GroupingStrategies:()=>T});function h(S,A){return S.filter((E)=>{if(A.tags?.length){if(!A.tags.some((R)=>E.meta.tags?.includes(R)))return!1}if(A.owners?.length){if(!A.owners.some((R)=>E.meta.owners?.includes(R)))return!1}if(A.stability?.length){if(!A.stability.includes(E.meta.stability??"stable"))return!1}if(A.domain){if(T.byDomain(E)!==A.domain)return!1}if(A.keyPattern){let N=E.meta.key??E.meta.key??"",R=A.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${R}$`,"i").test(N))return!1}return!0})}function I(S,A){let E=new Map;for(let N of S){let R=A(N),H=E.get(R);if(H)H.push(N);else E.set(R,[N])}return E}function B(S,A){let E=I(S,A);return Array.from(E.entries()).map(([N,R])=>({key:N,items:R}))}function C(S,A){let E=new Map;for(let N of S){let R=A(N);for(let H of R){let a=E.get(H);if(a)a.push(N);else E.set(H,[N])}}return E}function x(S){let A=new Set;for(let E of S)for(let N of E.meta.tags??[])A.add(N);return Array.from(A).sort()}function G(S){let A=new Set;for(let E of S)for(let N of E.meta.owners??[])A.add(N);return Array.from(A).sort()}function U(S){let A=new Set;for(let E of S)A.add(T.byDomain(E));return Array.from(A).sort()}var T;var L=V(()=>{T={byTag:(S)=>S.meta.tags?.[0]??"untagged",byAllTags:(S)=>S.meta.tags?.length?S.meta.tags:["untagged"],byOwner:(S)=>S.meta.owners?.[0]??"unowned",byDomain:(S)=>{return(S.meta.key??S.meta.key??"").split(".")[0]??"default"},byStability:(S)=>S.meta.stability??"stable",byUrlPath:(S)=>(A)=>{if(!A.path)return"root";return A.path.split("/").filter(Boolean).slice(0,S).join("/")||"root"}}});var W={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"},f=w,D={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"},y=D;L();import{compareVersions as F}from"compare-versions";var p=(S)=>`${S.meta.key}.v${S.meta.version}`;class M{contractType;items=new Map;constructor(S,A){this.contractType=S;if(A)A.forEach((E)=>this.register(E))}register(S){let A=p(S);if(this.items.has(A))throw Error(`Duplicate contract \`${this.contractType}\` ${A}`);return this.items.set(A,S),this}count(){return this.items.size}list(){return[...this.items.values()]}get(S,A){if(A!=null)return this.items.get(`${S}.v${A}`);let E;for(let[N,R]of this.items.entries()){if(!N.startsWith(`${S}.v`))continue;if(!E||F(R.meta.version,E.meta.version)>0)E=R}return E}has(S,A){return!!this.get(S,A)}filter(S){return h(this.list(),S)}listByTag(S){return this.list().filter((A)=>A.meta.tags?.includes(S))}listByOwner(S){return this.list().filter((A)=>A.meta.owners?.includes(S))}groupBy(S){return I(this.list(),S)}getUniqueTags(){return x(this.list())}}function Y(S){return S}var t=(S,A)=>`${S}.v${A}`;class v extends M{constructor(S){super("event",S)}}var b="harness",P=["platform.harness"],d=[D.Automation,"harness","evidence","evaluation"],j=W.Experimental;import{ScalarTypeEnum as _,SchemaModel as c}from"@contractspec/lib.schema";var l=new c({name:"HarnessRunStartedPayload",fields:{runId:{type:_.ID(),isOptional:!1},scenarioKey:{type:_.String_unsecure(),isOptional:!0},suiteKey:{type:_.String_unsecure(),isOptional:!0},mode:{type:_.String_unsecure(),isOptional:!1},startedAt:{type:_.DateTime(),isOptional:!1}}}),RS=Y({meta:{key:"harness.run.started",version:"1.0.0",description:"Emitted when a harness run starts.",domain:b,owners:P,tags:[...d,"run","started"],stability:j},payload:l});export{l as HarnessRunStartedPayload,RS as HarnessRunStartedEvent};
