import{cd as h,ah as u,cc as m,ce as g}from"./BvNnk7SS.js";const $=t=>t,x=/^(\d+)(\.\d+)*(\.x)?$/,P=t=>{const[s,...e]=t.split(":"),[,a,r]=e[e.length-1]?.match(/(.*)\.([^.]+)$/)||[];a&&(e[e.length-1]=a);const i=(e||[]).join("/");return{_source:s,_path:i,_extension:r,_file:r?`${i}.${r}`:i,_basename:a||""}},T=$({name:"path-meta",extensions:[".*"],transform(t,s={}){const{locales:e=[],defaultLocale:a="en",respectPathCase:r=!1}=s,{_source:i,_file:p,_path:n,_extension:f,_basename:_}=P(t._id),l=n.split("/"),d=e.includes(l[0])?l.shift():a,o=E(l.join("/"),{respectPathCase:r});return{_path:o,_dir:o.split("/").slice(-2)[0],_draft:t._draft??b(n),_partial:j(n),_locale:d,...t,title:t.title||w(c(_)),_source:i,_file:p,_stem:n,_extension:f}}}),b=t=>!!t.match(/\.draft(\/|\.|$)/),j=t=>t.split(/[:/]/).some(s=>s.match(/^_.*/)),E=(t,{forceLeadingSlash:s=!0,respectPathCase:e=!1}={})=>(t=t.split("/").map(a=>h(c(a),{lower:!e})).join("/"),s?u(m(t)):t),w=t=>t.split(/[\s-]/g).map(g).join(" ");function c(t){return t=t.split(/[/:]/).pop(),x.test(t)?t:t.replace(/(\d+\.)?(.*)/,"$2").replace(/^index(\.draft)?$/,"").replace(/\.draft$/,"")}export{E as a,$ as d,w as g,T as p};
