var{defineProperty:c,getOwnPropertyNames:S,getOwnPropertyDescriptor:x}=Object,f=Object.prototype.hasOwnProperty;function b(e){return this[e]}var P=(e)=>{var r=(g??=new WeakMap).get(e),s;if(r)return r;if(r=c({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of S(e))if(!f.call(r,n))c(r,n,{get:b.bind(e,n),enumerable:!(s=x(e,n))||s.enumerable})}return g.set(e,r),r},g;var h=(e)=>e;function w(e,r){this[e]=h.bind(null,r)}var R=(e,r)=>{for(var s in r)c(e,s,{get:r[s],enumerable:!0,configurable:!0,set:w.bind(r,s)})};var y=(e,r)=>()=>(e&&(r=e(e=0)),r);var M={};R(M,{groupByToArray:()=>A,groupByMultiple:()=>v,groupBy:()=>o,getUniqueTags:()=>u,getUniqueOwners:()=>E,getUniqueDomains:()=>I,filterBy:()=>d,GroupingStrategies:()=>p});function d(e,r){return e.filter((s)=>{if(r.tags?.length){if(!r.tags.some((t)=>s.meta.tags?.includes(t)))return!1}if(r.owners?.length){if(!r.owners.some((t)=>s.meta.owners?.includes(t)))return!1}if(r.stability?.length){if(!r.stability.includes(s.meta.stability??"stable"))return!1}if(r.domain){if(p.byDomain(s)!==r.domain)return!1}if(r.keyPattern){let n=s.meta.key??s.meta.key??"",t=r.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${t}$`,"i").test(n))return!1}return!0})}function o(e,r){let s=new Map;for(let n of e){let t=r(n),a=s.get(t);if(a)a.push(n);else s.set(t,[n])}return s}function A(e,r){let s=o(e,r);return Array.from(s.entries()).map(([n,t])=>({key:n,items:t}))}function v(e,r){let s=new Map;for(let n of e){let t=r(n);for(let a of t){let l=s.get(a);if(l)l.push(n);else s.set(a,[n])}}return s}function u(e){let r=new Set;for(let s of e)for(let n of s.meta.tags??[])r.add(n);return Array.from(r).sort()}function E(e){let r=new Set;for(let s of e)for(let n of s.meta.owners??[])r.add(n);return Array.from(r).sort()}function I(e){let r=new Set;for(let s of e)r.add(p.byDomain(s));return Array.from(r).sort()}var p;var H=y(()=>{p={byTag:(e)=>e.meta.tags?.[0]??"untagged",byAllTags:(e)=>e.meta.tags?.length?e.meta.tags:["untagged"],byOwner:(e)=>e.meta.owners?.[0]??"unowned",byDomain:(e)=>{return(e.meta.key??e.meta.key??"").split(".")[0]??"default"},byStability:(e)=>e.meta.stability??"stable",byUrlPath:(e)=>(r)=>{if(!r.path)return"root";return r.path.split("/").filter(Boolean).slice(0,e).join("/")||"root"}}});H();import{compareVersions as T}from"compare-versions";var V=(e)=>`${e.meta.key}.v${e.meta.version}`;class i{contractType;items=new Map;constructor(e,r){this.contractType=e;if(r)r.forEach((s)=>this.register(s))}register(e){let r=V(e);if(this.items.has(r))throw Error(`Duplicate contract \`${this.contractType}\` ${r}`);return this.items.set(r,e),this}count(){return this.items.size}list(){return[...this.items.values()]}get(e,r){if(r!=null)return this.items.get(`${e}.v${r}`);let s;for(let[n,t]of this.items.entries()){if(!n.startsWith(`${e}.v`))continue;if(!s||T(t.meta.version,s.meta.version)>0)s=t}return s}has(e,r){return!!this.get(e,r)}filter(e){return d(this.list(),e)}listByTag(e){return this.list().filter((r)=>r.meta.tags?.includes(e))}listByOwner(e){return this.list().filter((r)=>r.meta.owners?.includes(e))}groupBy(e){return o(this.list(),e)}getUniqueTags(){return u(this.list())}}class B extends i{constructor(e){super("harness-scenario",e)}}class K extends i{constructor(e){super("harness-suite",e)}}function j(e){return e}function z(e){return e}export{z as defineHarnessSuite,j as defineHarnessScenario,K as HarnessSuiteRegistry,B as HarnessScenarioRegistry};
