import*as f from"path";import{resolve as u}from"path";import{fileURLToPath as p}from"url";import{combineUrls as l}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as n}from"../constants/common.js";import{pathMatchesGlobPattern as i,reporter as m}from"./index.js";function _(r,t,...e){return l(r&&r!==t?"/"+r:"",...e)}function c(r){const t=p(r);return f.dirname(t)}function A(r,t){return u(c(r),t)}function R(r){let t=[];if(Array.isArray(r)){const e=r.map(o=>{if(o.includes(n)){const[s,a]=o.split(n);return t.push(a),s}return o});return t.length>1&&m.panicOnBuildContentError("Bad version files structure: subfolder versions does not support"),{data:e,version:t[0]}}if(r.includes(n)){const[e,o]=r.split(n);return{data:e,version:o}}return{data:r}}function b(r,t=[]){let e=!1;for(const o of t)o.startsWith("!")?i(r,o.slice(1))&&(e=!1):i(r,o)&&(e=!0);return e}export{R as excludeVersion,A as fromCurrentDir,_ as generatePagePathname,b as isPathIgnored};
