import{__exports as t}from"../../../../_virtual/pattern.mjs";import e from"../../../../_virtual/_node_path.mjs";import{__require as n}from"../../../glob-parent/index.mjs";import{__require as r}from"../../../micromatch/index.mjs";var i;function s(){if(i)return t;i=1,Object.defineProperty(t,"__esModule",{value:!0}),t.isAbsolute=t.partitionAbsoluteAndRelative=t.removeDuplicateSlashes=t.matchAny=t.convertPatternsToRe=t.makeRe=t.getPatternParts=t.expandBraceExpansion=t.expandPatternsWithBraceExpansion=t.isAffectDepthOfReadingPattern=t.endsWithSlashGlobStar=t.hasGlobStar=t.getBaseDirectory=t.isPatternRelatedToParentDirectory=t.getPatternsOutsideCurrentDirectory=t.getPatternsInsideCurrentDirectory=t.getPositivePatterns=t.getNegativePatterns=t.isPositivePattern=t.isNegativePattern=t.convertToNegativePattern=t.convertToPositivePattern=t.isDynamicPattern=t.isStaticPattern=void 0;const s=e,a=n(),o=r(),c=/[*?]|^!/,u=/\[[^[]*]/,f=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,l=/[!*+?@]\([^(]*\)/,P=/,|\.\./,p=/(?!^)\/{2,}/g;function d(t,e={}){return!g(t,e)}function g(t,e={}){return""!==t&&(!(!1!==e.caseSensitiveMatch&&!t.includes("\\"))||(!!(c.test(t)||u.test(t)||f.test(t))||(!(!1===e.extglob||!l.test(t))||!(!1===e.braceExpansion||!function(t){const e=t.indexOf("{");if(-1===e)return!1;const n=t.indexOf("}",e+1);if(-1===n)return!1;const r=t.slice(e,n);return P.test(r)}(t)))))}function h(t){return t.startsWith("!")&&"("!==t[1]}function v(t){return!h(t)}function m(t){return t.startsWith("..")||t.startsWith("./..")}function b(t){return t.endsWith("/**")}function x(t){const e=o.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((t,e)=>t.length-e.length),e.filter(t=>""!==t)}function D(t,e){return o.makeRe(t,e)}function _(t){return s.isAbsolute(t)}return t.isStaticPattern=d,t.isDynamicPattern=g,t.convertToPositivePattern=function(t){return h(t)?t.slice(1):t},t.convertToNegativePattern=function(t){return"!"+t},t.isNegativePattern=h,t.isPositivePattern=v,t.getNegativePatterns=function(t){return t.filter(h)},t.getPositivePatterns=function(t){return t.filter(v)},t.getPatternsInsideCurrentDirectory=function(t){return t.filter(t=>!m(t))},t.getPatternsOutsideCurrentDirectory=function(t){return t.filter(m)},t.isPatternRelatedToParentDirectory=m,t.getBaseDirectory=function(t){return a(t,{flipBackslashes:!1})},t.hasGlobStar=function(t){return t.includes("**")},t.endsWithSlashGlobStar=b,t.isAffectDepthOfReadingPattern=function(t){const e=s.basename(t);return b(t)||d(e)},t.expandPatternsWithBraceExpansion=function(t){return t.reduce((t,e)=>t.concat(x(e)),[])},t.expandBraceExpansion=x,t.getPatternParts=function(t,e){let{parts:n}=o.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return 0===n.length&&(n=[t]),n[0].startsWith("/")&&(n[0]=n[0].slice(1),n.unshift("")),n},t.makeRe=D,t.convertPatternsToRe=function(t,e){return t.map(t=>D(t,e))},t.matchAny=function(t,e){return e.some(e=>e.test(t))},t.removeDuplicateSlashes=function(t){return t.replace(p,"/")},t.partitionAbsoluteAndRelative=function(t){const e=[],n=[];for(const r of t)_(r)?e.push(r):n.push(r);return[e,n]},t.isAbsolute=_,t}export{s as __require};