@onoxm/vite-plugin-auto-router 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("node:path"),e=require("node:fs"),n=require("os"),r=require("path"),o=require("util"),s=require("stream"),i=require("events"),a=require("fs");function u(t){let e=c(t,0),n=!1;if(e+5<=t.length&&"async"===t.slice(e,e+5).toLowerCase()&&(n=!0,e=c(t,e+5)),e<t.length&&"("===t[e]){const n=l(t,e);if(-1!==n){let e=c(t,n+1);if(e+1<t.length&&"="===t[e]&&">"===t[e+1])return t}}const r=t.indexOf("(");if(-1===r)return t;const o=l(t,r);if(-1===o)return t;return(n?"async ":"")+t.slice(r,o+1)+" => "+t.slice(o+1)}function c(t,e){for(;e<t.length&&/\s/.test(t[e]);)e++;return e}function l(t,e){let n=0,r=!1,o="";for(let s=e;s<t.length;s++){const e=t[s];if('"'!==e&&"'"!==e&&"`"!==e){if(!r)if("("===e)n++;else if(")"===e&&(n--,0===n))return s}else r?e===o&&(r=!1):(r=!0,o=e)}return-1}const p=n=>e.existsSync(t.resolve(n,"tsconfig.json")),h={react:{ts:"src/router/autoRouter.tsx",js:"src/router/autoRouter.jsx"},vue:{ts:"src/router/autoRouter.ts",js:"src/router/autoRouter.js"}};var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g,m={},y={},_={};function R(){if(g)return _;return g=1,Object.defineProperty(_,"__esModule",{value:!0}),_.splitWhen=_.flatten=void 0,_.flatten=function(t){return t.reduce((t,e)=>[].concat(t,e),[])},_.splitWhen=function(t,e){const n=[[]];let r=0;for(const o of t)e(o)?(r++,n[r]=[]):n[r].push(o);return n},_}var b,P={};function S(){if(b)return P;return b=1,Object.defineProperty(P,"__esModule",{value:!0}),P.isEnoentCodeError=void 0,P.isEnoentCodeError=function(t){return"ENOENT"===t.code},P}var v,x={};var E,A={};function C(){if(E)return A;E=1,Object.defineProperty(A,"__esModule",{value:!0}),A.convertPosixPathToPattern=A.convertWindowsPathToPattern=A.convertPathToPattern=A.escapePosixPath=A.escapeWindowsPath=A.escape=A.removeLeadingDotSegment=A.makeAbsolute=A.unixify=void 0;const t=r,e="win32"===n.platform(),o=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,s=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,i=/^\\\\([.?])/,a=/\\(?![!()+@[\]{}])/g;function u(t){return t.replace(s,"\\$2")}function c(t){return t.replace(o,"\\$2")}function l(t){return u(t).replace(i,"//$1").replace(a,"/")}function p(t){return c(t)}return A.unixify=function(t){return t.replace(/\\/g,"/")},A.makeAbsolute=function(e,n){return t.resolve(e,n)},A.removeLeadingDotSegment=function(t){if("."===t.charAt(0)){const e=t.charAt(1);if("/"===e||"\\"===e)return t.slice(2)}return t},A.escape=e?u:c,A.escapeWindowsPath=u,A.escapePosixPath=c,A.convertPathToPattern=e?l:p,A.convertWindowsPathToPattern=l,A.convertPosixPathToPattern=p,A}var $,O,w,T,j,k,M={};function L(){return O?$:(O=1,$=function(t){if("string"!=typeof t||""===t)return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1})}function H(){if(T)return w;T=1;var t=L(),e={"{":"}","(":")","[":"]"},n=function(t){if("!"===t[0])return!0;for(var n=0,r=-2,o=-2,s=-2,i=-2,a=-2;n<t.length;){if("*"===t[n])return!0;if("?"===t[n+1]&&/[\].+)]/.test(t[n]))return!0;if(-1!==o&&"["===t[n]&&"]"!==t[n+1]&&(o<n&&(o=t.indexOf("]",n)),o>n)){if(-1===a||a>o)return!0;if(-1===(a=t.indexOf("\\",n))||a>o)return!0}if(-1!==s&&"{"===t[n]&&"}"!==t[n+1]&&(s=t.indexOf("}",n))>n&&(-1===(a=t.indexOf("\\",n))||a>s))return!0;if(-1!==i&&"("===t[n]&&"?"===t[n+1]&&/[:!=]/.test(t[n+2])&&")"!==t[n+3]&&(i=t.indexOf(")",n))>n&&(-1===(a=t.indexOf("\\",n))||a>i))return!0;if(-1!==r&&"("===t[n]&&"|"!==t[n+1]&&(r<n&&(r=t.indexOf("|",n)),-1!==r&&")"!==t[r+1]&&(i=t.indexOf(")",r))>r&&(-1===(a=t.indexOf("\\",r))||a>i)))return!0;if("\\"===t[n]){var u=t[n+1];n+=2;var c=e[u];if(c){var l=t.indexOf(c,n);-1!==l&&(n=l+1)}if("!"===t[n])return!0}else n++}return!1},r=function(t){if("!"===t[0])return!0;for(var n=0;n<t.length;){if(/[*?{}()[\]]/.test(t[n]))return!0;if("\\"===t[n]){var r=t[n+1];n+=2;var o=e[r];if(o){var s=t.indexOf(o,n);-1!==s&&(n=s+1)}if("!"===t[n])return!0}else n++}return!1};return w=function(e,o){if("string"!=typeof e||""===e)return!1;if(t(e))return!0;var s=n;return o&&!1===o.strict&&(s=r),s(e)}}function F(){if(k)return j;k=1;var t=H(),e=r.posix.dirname,o="win32"===n.platform(),s=/\\/g,i=/[\{\[].*[\}\]]$/,a=/(^|[^\\])([\{\[]|\([^\)]+$)/,u=/\\([\!\*\?\|\[\]\(\)\{\}])/g;return j=function(n,r){Object.assign({flipBackslashes:!0},r).flipBackslashes&&o&&n.indexOf("/")<0&&(n=n.replace(s,"/")),i.test(n)&&(n+="/"),n+="a";do{n=e(n)}while(t(n)||a.test(n));return n.replace(u,"$1")}}var D,N,I,B,W,G,U,K,V,q,Q,z,X,Y,Z,J,tt,et,nt,rt={};function ot(){return D||(D=1,(t=rt).isInteger=t=>"number"==typeof t?Number.isInteger(t):"string"==typeof t&&""!==t.trim()&&Number.isInteger(Number(t)),t.find=(t,e)=>t.nodes.find(t=>t.type===e),t.exceedsLimit=(e,n,r=1,o)=>!1!==o&&!(!t.isInteger(e)||!t.isInteger(n))&&(Number(n)-Number(e))/Number(r)>=o,t.escapeNode=(t,e=0,n)=>{const r=t.nodes[e];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},t.encloseBrace=t=>!("brace"!==t.type||t.commas>>0+t.ranges|0||(t.invalid=!0,0)),t.isInvalidBrace=t=>!("brace"!==t.type||!0!==t.invalid&&!t.dollar&&(t.commas>>0+t.ranges|0&&!0===t.open&&!0===t.close||(t.invalid=!0,0))),t.isOpenOrClose=t=>"open"===t.type||"close"===t.type||!0===t.open||!0===t.close,t.reduce=t=>t.reduce((t,e)=>("text"===e.type&&t.push(e.value),"range"===e.type&&(e.type="text"),t),[]),t.flatten=(...t)=>{const e=[],n=t=>{for(let r=0;r<t.length;r++){const o=t[r];Array.isArray(o)?n(o):void 0!==o&&e.push(o)}return e};return n(t),e}),rt;var t}function st(){if(I)return N;I=1;const t=ot();return N=(e,n={})=>{const r=(e,o={})=>{const s=n.escapeInvalid&&t.isInvalidBrace(o),i=!0===e.invalid&&!0===n.escapeInvalid;let a="";if(e.value)return(s||i)&&t.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(const t of e.nodes)a+=r(t);return a};return r(e)}}function it(){return W?B:(W=1,B=function(t){return"number"==typeof t?t-t===0:"string"==typeof t&&""!==t.trim()&&(Number.isFinite?Number.isFinite(+t):isFinite(+t))})}function at(){if(U)return G;U=1;const t=it(),e=(n,s,i)=>{if(!1===t(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===t(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let a={relaxZeros:!0,...i};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let u=n+":"+s+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(e.cache.hasOwnProperty(u))return e.cache[u].result;let c=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(c-l)){let t=n+"|"+s;return a.capture?`(${t})`:!1===a.wrap?t:`(?:${t})`}let h=p(n)||p(s),f={min:n,max:s,a:c,b:l},d=[],g=[];if(h&&(f.isPadded=h,f.maxLen=String(f.max).length),c<0){g=r(l<0?Math.abs(l):1,Math.abs(c),f,a),c=f.a=0}return l>=0&&(d=r(c,l,f,a)),f.negatives=g,f.positives=d,f.result=function(t,e){let n=o(t,e,"-",!1)||[],r=o(e,t,"",!1)||[],s=o(t,e,"-?",!0)||[];return n.concat(s).concat(r).join("|")}(g,d),!0===a.capture?f.result=`(${f.result})`:!1!==a.wrap&&d.length+g.length>1&&(f.result=`(?:${f.result})`),e.cache[u]=f,f.result};function n(t,e,n){if(t===e)return{pattern:t,count:[],digits:0};let r=function(t,e){let n=[];for(let r=0;r<t.length;r++)n.push([t[r],e[r]]);return n}(t,e),o=r.length,s="",i=0;for(let t=0;t<o;t++){let[e,n]=r[t];e===n?s+=e:"0"!==e||"9"!==n?s+=l(e,n):i++}return i&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function r(t,e,r,o){let i,l=function(t,e){let n=1,r=1,o=a(t,n),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),n+=1,o=a(t,n);for(o=u(e+1,r)-1;t<o&&o<=e;)i.add(o),r+=1,o=u(e+1,r)-1;return i=[...i],i.sort(s),i}(t,e),p=[],f=t;for(let t=0;t<l.length;t++){let e=l[t],s=n(String(f),String(e),o),a="";r.isPadded||!i||i.pattern!==s.pattern?(r.isPadded&&(a=h(e,r,o)),s.string=a+s.pattern+c(s.count),p.push(s),f=e+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+c(i.count),f=e+1)}return p}function o(t,e,n,r,o){let s=[];for(let o of t){let{string:t}=o;r||i(e,"string",t)||s.push(n+t),r&&i(e,"string",t)&&s.push(n+t)}return s}function s(t,e){return t>e?1:e>t?-1:0}function i(t,e,n){return t.some(t=>t[e]===n)}function a(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function u(t,e){return t-t%Math.pow(10,e)}function c(t){let[e=0,n=""]=t;return n||e>1?`{${e+(n?","+n:"")}}`:""}function l(t,e,n){return`[${t}${e-t===1?"":"-"}${e}]`}function p(t){return/^-?(0+)\d/.test(t)}function h(t,e,n){if(!e.isPadded)return t;let r=Math.abs(e.maxLen-String(t).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return e.cache={},e.clearCache=()=>e.cache={},G=e}function ut(){if(V)return K;V=1;const t=o,e=at(),n=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),r=t=>"number"==typeof t||"string"==typeof t&&""!==t,s=t=>Number.isInteger(+t),i=t=>{let e=`${t}`,n=-1;if("-"===e[0]&&(e=e.slice(1)),"0"===e)return!1;for(;"0"===e[++n];);return n>0},a=(t,e,n)=>{if(e>0){let n="-"===t[0]?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return!1===n?String(t):t},u=(t,e)=>{let n="-"===t[0]?"-":"";for(n&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return n?"-"+t:t},c=(t,n,r,o)=>{if(r)return e(t,n,{wrap:!1,...o});let s=String.fromCharCode(t);return t===n?s:`[${s}-${String.fromCharCode(n)}]`},l=(t,n,r)=>{if(Array.isArray(t)){let e=!0===r.wrap,n=r.capture?"":"?:";return e?`(${n}${t.join("|")})`:t.join("|")}return e(t,n,r)},p=(...e)=>new RangeError("Invalid range arguments: "+t.inspect(...e)),h=(t,e,n)=>{if(!0===n.strictRanges)throw p([t,e]);return[]},f=(t,e,n=1,r={})=>{let o=Number(t),s=Number(e);if(!Number.isInteger(o)||!Number.isInteger(s)){if(!0===r.strictRanges)throw p([t,e]);return[]}0===o&&(o=0),0===s&&(s=0);let h=o>s,f=String(t),d=String(e),g=String(n);n=Math.max(Math.abs(n),1);let m=i(f)||i(d)||i(g),y=m?Math.max(f.length,d.length,g.length):0,_=!1===m&&!1===((t,e,n)=>"string"==typeof t||"string"==typeof e||!0===n.stringify)(t,e,r),R=r.transform||(t=>e=>!0===t?Number(e):String(e))(_);if(r.toRegex&&1===n)return c(u(t,y),u(e,y),!0,r);let b={negatives:[],positives:[]},P=t=>b[t<0?"negatives":"positives"].push(Math.abs(t)),S=[],v=0;for(;h?o>=s:o<=s;)!0===r.toRegex&&n>1?P(o):S.push(a(R(o,v),y,_)),o=h?o-n:o+n,v++;return!0===r.toRegex?n>1?((t,e,n)=>{t.negatives.sort((t,e)=>t<e?-1:t>e?1:0),t.positives.sort((t,e)=>t<e?-1:t>e?1:0);let r,o=e.capture?"":"?:",s="",i="";return t.positives.length&&(s=t.positives.map(t=>u(String(t),n)).join("|")),t.negatives.length&&(i=`-(${o}${t.negatives.map(t=>u(String(t),n)).join("|")})`),r=s&&i?`${s}|${i}`:s||i,e.wrap?`(${o}${r})`:r})(b,r,y):l(S,null,{wrap:!1,...r}):S},d=(t,e,o,i={})=>{if(null==e&&r(t))return[t];if(!r(t)||!r(e))return h(t,e,i);if("function"==typeof o)return d(t,e,1,{transform:o});if(n(o))return d(t,e,0,o);let a={...i};return!0===a.capture&&(a.wrap=!0),o=o||a.step||1,s(o)?s(t)&&s(e)?f(t,e,o,a):((t,e,n=1,r={})=>{if(!s(t)&&t.length>1||!s(e)&&e.length>1)return h(t,e,r);let o=r.transform||(t=>String.fromCharCode(t)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),u=i>a,p=Math.min(i,a),f=Math.max(i,a);if(r.toRegex&&1===n)return c(p,f,!1,r);let d=[],g=0;for(;u?i>=a:i<=a;)d.push(o(i,g)),i=u?i-n:i+n,g++;return!0===r.toRegex?l(d,null,{wrap:!1,options:r}):d})(t,e,Math.max(Math.abs(o),1),a):null==o||n(o)?d(t,e,1,o):((t,e)=>{if(!0===e.strictRanges)throw new TypeError(`Expected step "${t}" to be a number`);return[]})(o,a)};return K=d}function ct(){if(tt)return J;tt=1;const t=st(),{MAX_LENGTH:e,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:p,CHAR_DOUBLE_QUOTE:h,CHAR_SINGLE_QUOTE:f,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:g}=Z?Y:(Z=1,Y={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return J=(m,y={})=>{if("string"!=typeof m)throw new TypeError("Expected a string");const _=y||{},R="number"==typeof _.maxLength?Math.min(e,_.maxLength):e;if(m.length>R)throw new SyntaxError(`Input length (${m.length}), exceeds max characters (${R})`);const b={type:"root",input:m,nodes:[]},P=[b];let S=b,v=b,x=0;const E=m.length;let A,C=0,$=0;const O=()=>m[C++],w=t=>{if("text"===t.type&&"dot"===v.type&&(v.type="text"),!v||"text"!==v.type||"text"!==t.type)return S.nodes.push(t),t.parent=S,t.prev=v,v=t,t;v.value+=t.value};for(w({type:"bos"});C<E;)if(S=P[P.length-1],A=O(),A!==g&&A!==d)if(A!==n)if(A!==p){if(A===l){let t;for(x++;C<E&&(t=O());)if(A+=t,t!==l)if(t!==n){if(t===p&&(x--,0===x))break}else A+=O();else x++;w({type:"text",value:A});continue}if(A!==i)if(A!==a){if(A===h||A===f||A===r){const t=A;let e;for(!0!==y.keepQuotes&&(A="");C<E&&(e=O());)if(e!==n){if(e===t){!0===y.keepQuotes&&(A+=e);break}A+=e}else A+=e+O();w({type:"text",value:A});continue}if(A===u){$++;const t=v.value&&"$"===v.value.slice(-1)||!0===S.dollar;S=w({type:"brace",open:!0,close:!1,dollar:t,depth:$,commas:0,ranges:0,nodes:[]}),P.push(S),w({type:"open",value:A});continue}if(A===c){if("brace"!==S.type){w({type:"text",value:A});continue}const t="close";S=P.pop(),S.close=!0,w({type:t,value:A}),$--,S=P[P.length-1];continue}if(A===o&&$>0){if(S.ranges>0){S.ranges=0;const e=S.nodes.shift();S.nodes=[e,{type:"text",value:t(S)}]}w({type:"comma",value:A}),S.commas++}else{if(A===s&&$>0&&0===S.commas){const t=S.nodes;if(0===$||0===t.length){w({type:"text",value:A});continue}if("dot"===v.type){if(S.range=[],v.value+=A,v.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,v.type="text";continue}S.ranges++,S.args=[];continue}if("range"===v.type){t.pop();const e=t[t.length-1];e.value+=v.value+A,v=e,S.ranges--;continue}w({type:"dot",value:A});continue}w({type:"text",value:A})}}else{if("paren"!==S.type){w({type:"text",value:A});continue}S=P.pop(),w({type:"text",value:A}),S=P[P.length-1]}else S=w({type:"paren",nodes:[]}),P.push(S),w({type:"text",value:A})}else w({type:"text",value:"\\"+A});else w({type:"text",value:(y.keepEscaping?A:"")+O()});do{if(S=P.pop(),"root"!==S.type){S.nodes.forEach(t=>{t.nodes||("open"===t.type&&(t.isOpen=!0),"close"===t.type&&(t.isClose=!0),t.nodes||(t.type="text"),t.invalid=!0)});const t=P[P.length-1],e=t.nodes.indexOf(S);t.nodes.splice(e,1,...S.nodes)}}while(P.length>0);return w({type:"eos"}),b}}function lt(){if(nt)return et;nt=1;const t=st(),e=function(){if(Q)return q;Q=1;const t=ut(),e=ot();return q=(n,r={})=>{const o=(n,s={})=>{const i=e.isInvalidBrace(s),a=!0===n.invalid&&!0===r.escapeInvalid,u=!0===i||!0===a,c=!0===r.escapeInvalid?"\\":"";let l="";if(!0===n.isOpen)return c+n.value;if(!0===n.isClose)return console.log("node.isClose",c,n.value),c+n.value;if("open"===n.type)return u?c+n.value:"(";if("close"===n.type)return u?c+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){const o=e.reduce(n.nodes),s=t(...o,{...r,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(const t of n.nodes)l+=o(t,n);return l};return o(n)}}(),n=function(){if(X)return z;X=1;const t=ut(),e=st(),n=ot(),r=(t="",e="",o=!1)=>{const s=[];if(t=[].concat(t),!(e=[].concat(e)).length)return t;if(!t.length)return o?n.flatten(e).map(t=>`{${t}}`):e;for(const n of t)if(Array.isArray(n))for(const t of n)s.push(r(t,e,o));else for(let t of e)!0===o&&"string"==typeof t&&(t=`{${t}}`),s.push(Array.isArray(t)?r(n,t,o):n+t);return n.flatten(s)};return z=(o,s={})=>{const i=void 0===s.rangeLimit?1e3:s.rangeLimit,a=(o,u={})=>{o.queue=[];let c=u,l=u.queue;for(;"brace"!==c.type&&"root"!==c.type&&c.parent;)c=c.parent,l=c.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),e(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){const a=n.reduce(o.nodes);if(n.exceedsLimit(...a,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=t(...a,s);return 0===u.length&&(u=e(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}const p=n.encloseBrace(o);let h=o.queue,f=o;for(;"brace"!==f.type&&"root"!==f.type&&f.parent;)f=f.parent,h=f.queue;for(let t=0;t<o.nodes.length;t++){const e=o.nodes[t];"comma"!==e.type||"brace"!==o.type?"close"!==e.type?e.value&&"open"!==e.type?h.push(r(h.pop(),e.value)):e.nodes&&a(e,o):l.push(r(l.pop(),h,p)):(1===t&&h.push(""),h.push(""))}return h};return n.flatten(a(o))},z}(),r=ct(),o=(t,e={})=>{let n=[];if(Array.isArray(t))for(const r of t){const t=o.create(r,e);Array.isArray(t)?n.push(...t):n.push(t)}else n=[].concat(o.create(t,e));return e&&!0===e.expand&&!0===e.nodupes&&(n=[...new Set(n)]),n};return o.parse=(t,e={})=>r(t,e),o.stringify=(e,n={})=>t("string"==typeof e?o.parse(e,n):e,n),o.compile=(t,n={})=>("string"==typeof t&&(t=o.parse(t,n)),e(t,n)),o.expand=(t,e={})=>{"string"==typeof t&&(t=o.parse(t,e));let r=n(t,e);return!0===e.noempty&&(r=r.filter(Boolean)),!0===e.nodupes&&(r=[...new Set(r)]),r},o.create=(t,e={})=>""===t||t.length<3?[t]:!0!==e.expand?o.compile(t,e):o.expand(t,e),et=o}var pt,ht,ft,dt,gt,mt,yt,_t,Rt,bt,Pt,St,vt,xt,Et={};function At(){if(ht)return pt;ht=1;const t=r,e="\\\\/",n=`[^${e}]`,o="\\.",s="\\/",i="[^/]",a=`(?:${s}|$)`,u=`(?:^|${s})`,c=`${o}{1,2}${a}`,l={DOT_LITERAL:o,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:s,ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:c,NO_DOT:`(?!${o})`,NO_DOTS:`(?!${u}${c})`,NO_DOT_SLASH:`(?!${o}{0,1}${a})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.${s}]`,STAR:`${i}*?`,START_ANCHOR:u},p={...l,SLASH_LITERAL:`[${e}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${o}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${e}])${o}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`};return pt={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:t.sep,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?p:l}}function Ct(){return ft||(ft=1,function(t){const e=r,n="win32"===process.platform,{REGEX_BACKSLASH:o,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:a}=At();t.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),t.hasRegexChars=t=>i.test(t),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=t=>t.replace(a,"\\$1"),t.toPosixSlashes=t=>t.replace(o,"/"),t.removeBackslashes=t=>t.replace(s,t=>"\\"===t?"":t),t.supportsLookbehinds=()=>{const t=process.version.slice(1).split(".").map(Number);return 3===t.length&&t[0]>=9||8===t[0]&&t[1]>=10},t.isWindows=t=>t&&"boolean"==typeof t.windows?t.windows:!0===n||"\\"===e.sep,t.escapeLast=(e,n,r)=>{const o=e.lastIndexOf(n,r);return-1===o?e:"\\"===e[o-1]?t.escapeLast(e,n,o-1):`${e.slice(0,o)}\\${e.slice(o)}`},t.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n},t.wrapOutput=(t,e={},n={})=>{let r=`${n.contains?"":"^"}(?:${t})${n.contains?"":"$"}`;return!0===e.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Et)),Et}function $t(){if(Rt)return _t;Rt=1;const t=r,e=function(){if(gt)return dt;gt=1;const t=Ct(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:p,CHAR_QUESTION_MARK:h,CHAR_RIGHT_CURLY_BRACE:f,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:g}=At(),m=t=>t===a||t===r,y=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};return dt=(_,R)=>{const b=R||{},P=_.length-1,S=!0===b.parts||!0===b.scanToEnd,v=[],x=[],E=[];let A,C,$=_,O=-1,w=0,T=0,j=!1,k=!1,M=!1,L=!1,H=!1,F=!1,D=!1,N=!1,I=!1,B=!1,W=0,G={value:"",depth:0,isGlob:!1};const U=()=>O>=P,K=()=>$.charCodeAt(O+1),V=()=>(A=C,$.charCodeAt(++O));for(;O<P;){let t;if(C=V(),C!==r){if(!0===F||C===u){for(W++;!0!==U()&&(C=V());)if(C!==r)if(C!==u){if(!0!==F&&C===s&&(C=V())===s){if(j=G.isBrace=!0,M=G.isGlob=!0,B=!0,!0===S)continue;break}if(!0!==F&&C===o){if(j=G.isBrace=!0,M=G.isGlob=!0,B=!0,!0===S)continue;break}if(C===f&&(W--,0===W)){F=!1,j=G.isBrace=!0,B=!0;break}}else W++;else D=G.backslashes=!0,V();if(!0===S)continue;break}if(C!==a){if(!0!==b.noext&&!0==(C===p||C===n||C===e||C===h||C===i)&&K()===c){if(M=G.isGlob=!0,L=G.isExtglob=!0,B=!0,C===i&&O===w&&(I=!0),!0===S){for(;!0!==U()&&(C=V());)if(C!==r){if(C===d){M=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(C===e){if(A===e&&(H=G.isGlobstar=!0),M=G.isGlob=!0,B=!0,!0===S)continue;break}if(C===h){if(M=G.isGlob=!0,B=!0,!0===S)continue;break}if(C===l){for(;!0!==U()&&(t=V());)if(t!==r){if(t===g){k=G.isBracket=!0,M=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,V();if(!0===S)continue;break}if(!0===b.nonegate||C!==i||O!==w){if(!0!==b.noparen&&C===c){if(M=G.isGlob=!0,!0===S){for(;!0!==U()&&(C=V());)if(C!==c){if(C===d){B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(!0===M){if(B=!0,!0===S)continue;break}}else N=G.negated=!0,w++}else{if(v.push(O),x.push(G),G={value:"",depth:0,isGlob:!1},!0===B)continue;if(A===s&&O===w+1){w+=2;continue}T=O+1}}else D=G.backslashes=!0,C=V(),C===u&&(F=!0)}!0===b.noext&&(L=!1,M=!1);let q=$,Q="",z="";w>0&&(Q=$.slice(0,w),$=$.slice(w),T-=w),q&&!0===M&&T>0?(q=$.slice(0,T),z=$.slice(T)):!0===M?(q="",z=$):q=$,q&&""!==q&&"/"!==q&&q!==$&&m(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),!0===b.unescape&&(z&&(z=t.removeBackslashes(z)),q&&!0===D&&(q=t.removeBackslashes(q)));const X={prefix:Q,input:_,start:w,base:q,glob:z,isBrace:j,isBracket:k,isGlob:M,isExtglob:L,isGlobstar:H,negated:N,negatedExtglob:I};if(!0===b.tokens&&(X.maxDepth=0,m(C)||x.push(G),X.tokens=x),!0===b.parts||!0===b.tokens){let t;for(let e=0;e<v.length;e++){const n=t?t+1:w,r=v[e],o=_.slice(n,r);b.tokens&&(0===e&&0!==w?(x[e].isPrefix=!0,x[e].value=Q):x[e].value=o,y(x[e]),X.maxDepth+=x[e].depth),0===e&&""===o||E.push(o),t=r}if(t&&t+1<_.length){const e=_.slice(t+1);E.push(e),b.tokens&&(x[x.length-1].value=e,y(x[x.length-1]),X.maxDepth+=x[x.length-1].depth)}X.slashes=v,X.parts=E}return X},dt}(),n=function(){if(yt)return mt;yt=1;const t=At(),e=Ct(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=t,a=(t,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...t,n);t.sort();const r=`[${t.join("-")}]`;try{new RegExp(r)}catch(n){return t.map(t=>e.escapeRegex(t)).join("..")}return r},u=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,c=(l,p)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const h={...p},f="number"==typeof h.maxLength?Math.min(n,h.maxLength):n;let d=l.length;if(d>f)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${f}`);const g={type:"bos",value:"",output:h.prepend||""},m=[g],y=h.capture?"":"?:",_=e.isWindows(p),R=t.globChars(_),b=t.extglobChars(R),{DOT_LITERAL:P,PLUS_LITERAL:S,SLASH_LITERAL:v,ONE_CHAR:x,DOTS_SLASH:E,NO_DOT:A,NO_DOT_SLASH:C,NO_DOTS_SLASH:$,QMARK:O,QMARK_NO_DOT:w,STAR:T,START_ANCHOR:j}=R,k=t=>`(${y}(?:(?!${j}${t.dot?E:P}).)*?)`,M=h.dot?"":A,L=h.dot?O:w;let H=!0===h.bash?k(h):T;h.capture&&(H=`(${H})`),"boolean"==typeof h.noext&&(h.noextglob=h.noext);const F={input:l,index:-1,start:0,dot:!0===h.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:m};l=e.removePrefix(l,F),d=l.length;const D=[],N=[],I=[];let B,W=g;const G=()=>F.index===d-1,U=F.peek=(t=1)=>l[F.index+t],K=F.advance=()=>l[++F.index]||"",V=()=>l.slice(F.index+1),q=(t="",e=0)=>{F.consumed+=t,F.index+=e},Q=t=>{F.output+=null!=t.output?t.output:t.value,q(t.value)},z=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)K(),F.start++,t++;return t%2!=0&&(F.negated=!0,F.start++,!0)},X=t=>{F[t]++,I.push(t)},Y=t=>{F[t]--,I.pop()},Z=t=>{if("globstar"===W.type){const e=F.braces>0&&("comma"===t.type||"brace"===t.type),n=!0===t.extglob||D.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||n||(F.output=F.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=H,F.output+=W.output)}if(D.length&&"paren"!==t.type&&(D[D.length-1].inner+=t.value),(t.value||t.output)&&Q(t),W&&"text"===W.type&&"text"===t.type)return W.value+=t.value,void(W.output=(W.output||"")+t.value);t.prev=W,m.push(t),W=t},J=(t,e)=>{const n={...b[e],conditions:1,inner:""};n.prev=W,n.parens=F.parens,n.output=F.output;const r=(h.capture?"(":"")+n.open;X("parens"),Z({type:t,value:e,output:F.output?"":x}),Z({type:"paren",extglob:!0,value:K(),output:r}),D.push(n)},tt=t=>{let e,n=t.close+(h.capture?")":"");if("negate"===t.type){let r=H;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(r=k(h)),(r!==H||G()||/^\)+$/.test(V()))&&(n=t.close=`)$))${r}`),t.inner.includes("*")&&(e=V())&&/^\.[^\\/.]+$/.test(e)){const o=c(e,{...p,fastpaths:!1}).output;n=t.close=`)${o})${r})`}"bos"===t.prev.type&&(F.negatedExtglob=!0)}Z({type:"paren",extglob:!0,value:B,output:n}),Y("parens")};if(!1!==h.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let t=!1,n=l.replace(s,(e,n,r,o,s,i)=>"\\"===o?(t=!0,e):"?"===o?n?n+o+(s?O.repeat(s.length):""):0===i?L+(s?O.repeat(s.length):""):O.repeat(r.length):"."===o?P.repeat(r.length):"*"===o?n?n+o+(s?H:""):H:n?e:`\\${e}`);return!0===t&&(n=!0===h.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),n===l&&!0===h.contains?(F.output=l,F):(F.output=e.wrapOutput(n,F,p),F)}for(;!G();){if(B=K(),"\0"===B)continue;if("\\"===B){const t=U();if("/"===t&&!0!==h.bash)continue;if("."===t||";"===t)continue;if(!t){B+="\\",Z({type:"text",value:B});continue}const e=/^\\+/.exec(V());let n=0;if(e&&e[0].length>2&&(n=e[0].length,F.index+=n,n%2!=0&&(B+="\\")),!0===h.unescape?B=K():B+=K(),0===F.brackets){Z({type:"text",value:B});continue}}if(F.brackets>0&&("]"!==B||"["===W.value||"[^"===W.value)){if(!1!==h.posix&&":"===B){const t=W.value.slice(1);if(t.includes("[")&&(W.posix=!0,t.includes(":"))){const t=W.value.lastIndexOf("["),e=W.value.slice(0,t),n=W.value.slice(t+2),o=r[n];if(o){W.value=e+o,F.backtrack=!0,K(),g.output||1!==m.indexOf(W)||(g.output=x);continue}}}("["===B&&":"!==U()||"-"===B&&"]"===U())&&(B=`\\${B}`),"]"!==B||"["!==W.value&&"[^"!==W.value||(B=`\\${B}`),!0===h.posix&&"!"===B&&"["===W.value&&(B="^"),W.value+=B,Q({value:B});continue}if(1===F.quotes&&'"'!==B){B=e.escapeRegex(B),W.value+=B,Q({value:B});continue}if('"'===B){F.quotes=1===F.quotes?0:1,!0===h.keepQuotes&&Z({type:"text",value:B});continue}if("("===B){X("parens"),Z({type:"paren",value:B});continue}if(")"===B){if(0===F.parens&&!0===h.strictBrackets)throw new SyntaxError(u("opening","("));const t=D[D.length-1];if(t&&F.parens===t.parens+1){tt(D.pop());continue}Z({type:"paren",value:B,output:F.parens?")":"\\)"}),Y("parens");continue}if("["===B){if(!0!==h.nobracket&&V().includes("]"))X("brackets");else{if(!0!==h.nobracket&&!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));B=`\\${B}`}Z({type:"bracket",value:B});continue}if("]"===B){if(!0===h.nobracket||W&&"bracket"===W.type&&1===W.value.length){Z({type:"text",value:B,output:`\\${B}`});continue}if(0===F.brackets){if(!0===h.strictBrackets)throw new SyntaxError(u("opening","["));Z({type:"text",value:B,output:`\\${B}`});continue}Y("brackets");const t=W.value.slice(1);if(!0===W.posix||"^"!==t[0]||t.includes("/")||(B=`/${B}`),W.value+=B,Q({value:B}),!1===h.literalBrackets||e.hasRegexChars(t))continue;const n=e.escapeRegex(W.value);if(F.output=F.output.slice(0,-W.value.length),!0===h.literalBrackets){F.output+=n,W.value=n;continue}W.value=`(${y}${n}|${W.value})`,F.output+=W.value;continue}if("{"===B&&!0!==h.nobrace){X("braces");const t={type:"brace",value:B,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};N.push(t),Z(t);continue}if("}"===B){const t=N[N.length-1];if(!0===h.nobrace||!t){Z({type:"text",value:B,output:B});continue}let e=")";if(!0===t.dots){const t=m.slice(),n=[];for(let e=t.length-1;e>=0&&(m.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&n.unshift(t[e].value);e=a(n,h),F.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){const n=F.output.slice(0,t.outputIndex),r=F.tokens.slice(t.tokensIndex);t.value=t.output="\\{",B=e="\\}",F.output=n;for(const t of r)F.output+=t.output||t.value}Z({type:"brace",value:B,output:e}),Y("braces"),N.pop();continue}if("|"===B){D.length>0&&D[D.length-1].conditions++,Z({type:"text",value:B});continue}if(","===B){let t=B;const e=N[N.length-1];e&&"braces"===I[I.length-1]&&(e.comma=!0,t="|"),Z({type:"comma",value:B,output:t});continue}if("/"===B){if("dot"===W.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",m.pop(),W=g;continue}Z({type:"slash",value:B,output:v});continue}if("."===B){if(F.braces>0&&"dot"===W.type){"."===W.value&&(W.output=P);const t=N[N.length-1];W.type="dots",W.output+=B,W.value+=B,t.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==W.type&&"slash"!==W.type){Z({type:"text",value:B,output:P});continue}Z({type:"dot",value:B,output:P});continue}if("?"===B){if((!W||"("!==W.value)&&!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("qmark",B);continue}if(W&&"paren"===W.type){const t=U();let n=B;if("<"===t&&!e.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===W.value&&!/[!=<:]/.test(t)||"<"===t&&!/<([!=]|\w+>)/.test(V()))&&(n=`\\${B}`),Z({type:"text",value:B,output:n});continue}if(!0!==h.dot&&("slash"===W.type||"bos"===W.type)){Z({type:"qmark",value:B,output:w});continue}Z({type:"qmark",value:B,output:O});continue}if("!"===B){if(!0!==h.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){J("negate",B);continue}if(!0!==h.nonegate&&0===F.index){z();continue}}if("+"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("plus",B);continue}if(W&&"("===W.value||!1===h.regex){Z({type:"plus",value:B,output:S});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||F.parens>0){Z({type:"plus",value:B});continue}Z({type:"plus",value:S});continue}if("@"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){Z({type:"at",extglob:!0,value:B,output:""});continue}Z({type:"text",value:B});continue}if("*"!==B){"$"!==B&&"^"!==B||(B=`\\${B}`);const t=o.exec(V());t&&(B+=t[0],F.index+=t[0].length),Z({type:"text",value:B});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=B,W.output=H,F.backtrack=!0,F.globstar=!0,q(B);continue}let t=V();if(!0!==h.noextglob&&/^\([^?]/.test(t)){J("star",B);continue}if("star"===W.type){if(!0===h.noglobstar){q(B);continue}const e=W.prev,n=e.prev,r="slash"===e.type||"bos"===e.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===h.bash&&(!r||t[0]&&"/"!==t[0])){Z({type:"star",value:B,output:""});continue}const s=F.braces>0&&("comma"===e.type||"brace"===e.type),i=D.length&&("pipe"===e.type||"paren"===e.type);if(!r&&"paren"!==e.type&&!s&&!i){Z({type:"star",value:B,output:""});continue}for(;"/**"===t.slice(0,3);){const e=l[F.index+4];if(e&&"/"!==e)break;t=t.slice(3),q("/**",3)}if("bos"===e.type&&G()){W.type="globstar",W.value+=B,W.output=k(h),F.output=W.output,F.globstar=!0,q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&!o&&G()){F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=k(h)+(h.strictSlashes?")":"|$)"),W.value+=B,F.globstar=!0,F.output+=e.output+W.output,q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&"/"===t[0]){const n=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=`${k(h)}${v}|${v}${n})`,W.value+=B,F.output+=e.output+W.output,F.globstar=!0,q(B+K()),Z({type:"slash",value:"/",output:""});continue}if("bos"===e.type&&"/"===t[0]){W.type="globstar",W.value+=B,W.output=`(?:^|${v}|${k(h)}${v})`,F.output=W.output,F.globstar=!0,q(B+K()),Z({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-W.output.length),W.type="globstar",W.output=k(h),W.value+=B,F.output+=W.output,F.globstar=!0,q(B);continue}const n={type:"star",value:B,output:H};!0!==h.bash?!W||"bracket"!==W.type&&"paren"!==W.type||!0!==h.regex?(F.index!==F.start&&"slash"!==W.type&&"dot"!==W.type||("dot"===W.type?(F.output+=C,W.output+=C):!0===h.dot?(F.output+=$,W.output+=$):(F.output+=M,W.output+=M),"*"!==U()&&(F.output+=x,W.output+=x)),Z(n)):(n.output=B,Z(n)):(n.output=".*?","bos"!==W.type&&"slash"!==W.type||(n.output=M+n.output),Z(n))}for(;F.brackets>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));F.output=e.escapeLast(F.output,"["),Y("brackets")}for(;F.parens>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing",")"));F.output=e.escapeLast(F.output,"("),Y("parens")}for(;F.braces>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","}"));F.output=e.escapeLast(F.output,"{"),Y("braces")}if(!0===h.strictSlashes||"star"!==W.type&&"bracket"!==W.type||Z({type:"maybe_slash",value:"",output:`${v}?`}),!0===F.backtrack){F.output="";for(const t of F.tokens)F.output+=null!=t.output?t.output:t.value,t.suffix&&(F.output+=t.suffix)}return F};return c.fastpaths=(r,o)=>{const s={...o},a="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>a)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${a}`);r=i[r]||r;const c=e.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:f,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:m,STAR:y,START_ANCHOR:_}=t.globChars(c),R=s.dot?g:d,b=s.dot?m:d,P=s.capture?"":"?:";let S=!0===s.bash?".*?":y;s.capture&&(S=`(${S})`);const v=t=>!0===t.noglobstar?S:`(${P}(?:(?!${_}${t.dot?f:l}).)*?)`,x=t=>{switch(t){case"*":return`${R}${h}${S}`;case".*":return`${l}${h}${S}`;case"*.*":return`${R}${S}${l}${h}${S}`;case"*/*":return`${R}${S}${p}${h}${b}${S}`;case"**":return R+v(s);case"**/*":return`(?:${R}${v(s)}${p})?${b}${h}${S}`;case"**/*.*":return`(?:${R}${v(s)}${p})?${b}${S}${l}${h}${S}`;case"**/.*":return`(?:${R}${v(s)}${p})?${l}${h}${S}`;default:{const e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;const n=x(e[1]);if(!n)return;return n+l+e[2]}}},E=e.removePrefix(r,{negated:!1,prefix:""});let A=x(E);return A&&!0!==s.strictSlashes&&(A+=`${p}?`),A},mt=c}(),o=Ct(),s=At(),i=(t,e,n=!1)=>{if(Array.isArray(t)){const r=t.map(t=>i(t,e,n)),o=t=>{for(const e of r){const n=e(t);if(n)return n}return!1};return o}const r=(s=t)&&"object"==typeof s&&!Array.isArray(s)&&t.tokens&&t.input;var s;if(""===t||"string"!=typeof t&&!r)throw new TypeError("Expected pattern to be a non-empty string");const a=e||{},u=o.isWindows(e),c=r?i.compileRe(t,e):i.makeRe(t,e,!1,!0),l=c.state;delete c.state;let p=()=>!1;if(a.ignore){const t={...e,ignore:null,onMatch:null,onResult:null};p=i(a.ignore,t,n)}const h=(n,r=!1)=>{const{isMatch:o,match:s,output:h}=i.test(n,c,e,{glob:t,posix:u}),f={glob:t,state:l,regex:c,posix:u,input:n,output:h,match:s,isMatch:o};return"function"==typeof a.onResult&&a.onResult(f),!1===o?(f.isMatch=!1,!!r&&f):p(n)?("function"==typeof a.onIgnore&&a.onIgnore(f),f.isMatch=!1,!!r&&f):("function"==typeof a.onMatch&&a.onMatch(f),!r||f)};return n&&(h.state=l),h};return i.test=(t,e,n,{glob:r,posix:s}={})=>{if("string"!=typeof t)throw new TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};const a=n||{},u=a.format||(s?o.toPosixSlashes:null);let c=t===r,l=c&&u?u(t):t;return!1===c&&(l=u?u(t):t,c=l===r),!1!==c&&!0!==a.capture||(c=!0===a.matchBase||!0===a.basename?i.matchBase(t,e,n,s):e.exec(l)),{isMatch:Boolean(c),match:c,output:l}},i.matchBase=(e,n,r,s=o.isWindows(r))=>(n instanceof RegExp?n:i.makeRe(n,r)).test(t.basename(e)),i.isMatch=(t,e,n)=>i(e,n)(t),i.parse=(t,e)=>Array.isArray(t)?t.map(t=>i.parse(t,e)):n(t,{...e,fastpaths:!1}),i.scan=(t,n)=>e(t,n),i.compileRe=(t,e,n=!1,r=!1)=>{if(!0===n)return t.output;const o=e||{},s=o.contains?"":"^",a=o.contains?"":"$";let u=`${s}(?:${t.output})${a}`;t&&!0===t.negated&&(u=`^(?!${u}).*$`);const c=i.toRegex(u,e);return!0===r&&(c.state=t),c},i.makeRe=(t,e={},r=!1,o=!1)=>{if(!t||"string"!=typeof t)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===e.fastpaths||"."!==t[0]&&"*"!==t[0]||(s.output=n.fastpaths(t,e)),s.output||(s=n(t,e)),i.compileRe(s,e,r,o)},i.toRegex=(t,e)=>{try{const n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},i.constants=s,_t=i}function Ot(){return Pt?bt:(Pt=1,bt=$t())}function wt(){if(xt)return M;xt=1,Object.defineProperty(M,"__esModule",{value:!0}),M.isAbsolute=M.partitionAbsoluteAndRelative=M.removeDuplicateSlashes=M.matchAny=M.convertPatternsToRe=M.makeRe=M.getPatternParts=M.expandBraceExpansion=M.expandPatternsWithBraceExpansion=M.isAffectDepthOfReadingPattern=M.endsWithSlashGlobStar=M.hasGlobStar=M.getBaseDirectory=M.isPatternRelatedToParentDirectory=M.getPatternsOutsideCurrentDirectory=M.getPatternsInsideCurrentDirectory=M.getPositivePatterns=M.getNegativePatterns=M.isPositivePattern=M.isNegativePattern=M.convertToNegativePattern=M.convertToPositivePattern=M.isDynamicPattern=M.isStaticPattern=void 0;const t=r,e=F(),n=function(){if(vt)return St;vt=1;const t=o,e=lt(),n=Ot(),r=Ct(),s=t=>""===t||"./"===t,i=t=>{const e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},a=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let o=new Set,s=new Set,i=new Set,a=0,u=t=>{i.add(t.output),r&&r.onResult&&r.onResult(t)};for(let i=0;i<e.length;i++){let c=n(String(e[i]),{...r,onResult:u},!0),l=c.state.negated||c.state.negatedExtglob;l&&a++;for(let e of t){let t=c(e,!0);(l?!t.isMatch:t.isMatch)&&(l?o.add(t.output):(o.delete(t.output),s.add(t.output)))}}let c=(a===e.length?[...i]:[...s]).filter(t=>!o.has(t));if(r&&0===c.length){if(!0===r.failglob)throw new Error(`No matches found for "${e.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?e.map(t=>t.replace(/\\/g,"")):e}return c};return a.match=a,a.matcher=(t,e)=>n(t,e),a.any=a.isMatch=(t,e,r)=>n(e,r)(t),a.not=(t,e,n={})=>{e=[].concat(e).map(String);let r=new Set,o=[],s=new Set(a(t,e,{...n,onResult:t=>{n.onResult&&n.onResult(t),o.push(t.output)}}));for(let t of o)s.has(t)||r.add(t);return[...r]},a.contains=(e,n,r)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);if(Array.isArray(n))return n.some(t=>a.contains(e,t,r));if("string"==typeof n){if(s(e)||s(n))return!1;if(e.includes(n)||e.startsWith("./")&&e.slice(2).includes(n))return!0}return a.isMatch(e,n,{...r,contains:!0})},a.matchKeys=(t,e,n)=>{if(!r.isObject(t))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(t),e,n),s={};for(let e of o)s[e]=t[e];return s},a.some=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(o.some(t=>e(t)))return!0}return!1},a.every=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(!o.every(t=>e(t)))return!1}return!0},a.all=(e,r,o)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);return[].concat(r).every(t=>n(t,o)(e))},a.capture=(t,e,o)=>{let s=r.isWindows(o),i=n.makeRe(String(t),{...o,capture:!0}).exec(s?r.toPosixSlashes(e):e);if(i)return i.slice(1).map(t=>void 0===t?"":t)},a.makeRe=(...t)=>n.makeRe(...t),a.scan=(...t)=>n.scan(...t),a.parse=(t,r)=>{let o=[];for(let s of[].concat(t||[]))for(let t of e(String(s),r))o.push(n.parse(t,r));return o},a.braces=(t,n)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!i(t)?[t]:e(t,n)},a.braceExpand=(t,e)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return a.braces(t,{...e,expand:!0})},a.hasBraces=i,St=a}(),s=/[*?]|^!/,i=/\[[^[]*]/,a=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,u=/[!*+?@]\([^(]*\)/,c=/,|\.\./,l=/(?!^)\/{2,}/g;function p(t,e={}){return!h(t,e)}function h(t,e={}){return""!==t&&(!(!1!==e.caseSensitiveMatch&&!t.includes("\\"))||(!!(s.test(t)||i.test(t)||a.test(t))||(!(!1===e.extglob||!u.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 c.test(r)}(t)))))}function f(t){return t.startsWith("!")&&"("!==t[1]}function d(t){return!f(t)}function g(t){return t.startsWith("..")||t.startsWith("./..")}function m(t){return t.endsWith("/**")}function y(t){const e=n.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((t,e)=>t.length-e.length),e.filter(t=>""!==t)}function _(t,e){return n.makeRe(t,e)}function R(e){return t.isAbsolute(e)}return M.isStaticPattern=p,M.isDynamicPattern=h,M.convertToPositivePattern=function(t){return f(t)?t.slice(1):t},M.convertToNegativePattern=function(t){return"!"+t},M.isNegativePattern=f,M.isPositivePattern=d,M.getNegativePatterns=function(t){return t.filter(f)},M.getPositivePatterns=function(t){return t.filter(d)},M.getPatternsInsideCurrentDirectory=function(t){return t.filter(t=>!g(t))},M.getPatternsOutsideCurrentDirectory=function(t){return t.filter(g)},M.isPatternRelatedToParentDirectory=g,M.getBaseDirectory=function(t){return e(t,{flipBackslashes:!1})},M.hasGlobStar=function(t){return t.includes("**")},M.endsWithSlashGlobStar=m,M.isAffectDepthOfReadingPattern=function(e){const n=t.basename(e);return m(e)||p(n)},M.expandPatternsWithBraceExpansion=function(t){return t.reduce((t,e)=>t.concat(y(e)),[])},M.expandBraceExpansion=y,M.getPatternParts=function(t,e){let{parts:r}=n.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return 0===r.length&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r},M.makeRe=_,M.convertPatternsToRe=function(t,e){return t.map(t=>_(t,e))},M.matchAny=function(t,e){return e.some(e=>e.test(t))},M.removeDuplicateSlashes=function(t){return t.replace(l,"/")},M.partitionAbsoluteAndRelative=function(t){const e=[],n=[];for(const r of t)R(r)?e.push(r):n.push(r);return[e,n]},M.isAbsolute=R,M}var Tt,jt,kt,Mt={};function Lt(){if(jt)return Tt;jt=1;const t=s.PassThrough,e=Array.prototype.slice;function n(e,r){if(Array.isArray(e))for(let t=0,o=e.length;t<o;t++)e[t]=n(e[t],r);else{if(!e._readableState&&e.pipe&&(e=e.pipe(t(r))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}return Tt=function(){const r=[],o=e.call(arguments);let s=!1,i=o[o.length-1];i&&!Array.isArray(i)&&null==i.pipe?o.pop():i={};const a=!1!==i.end,u=!0===i.pipeError;null==i.objectMode&&(i.objectMode=!0);null==i.highWaterMark&&(i.highWaterMark=65536);const c=t(i);function l(){for(let t=0,e=arguments.length;t<e;t++)r.push(n(arguments[t],i));return p(),this}function p(){if(s)return;s=!0;let t=r.shift();if(!t)return void process.nextTick(h);Array.isArray(t)||(t=[t]);let e=t.length+1;function n(){--e>0||(s=!1,p())}function o(t){function e(){t.removeListener("merge2UnpipeEnd",e),t.removeListener("end",e),u&&t.removeListener("error",r),n()}function r(t){c.emit("error",t)}if(t._readableState.endEmitted)return n();t.on("merge2UnpipeEnd",e),t.on("end",e),u&&t.on("error",r),t.pipe(c,{end:!1}),t.resume()}for(let e=0;e<t.length;e++)o(t[e]);n()}function h(){s=!1,c.emit("queueDrain"),a&&c.end()}c.setMaxListeners(0),c.add=l,c.on("unpipe",function(t){t.emit("merge2UnpipeEnd")}),o.length&&l.apply(null,o);return c},Tt}var Ht,Ft,Dt,Nt={};function It(){if(Ht)return Nt;return Ht=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.isEmpty=Nt.isString=void 0,Nt.isString=function(t){return"string"==typeof t},Nt.isEmpty=function(t){return""===t},Nt}function Bt(){if(Ft)return y;Ft=1,Object.defineProperty(y,"__esModule",{value:!0}),y.string=y.stream=y.pattern=y.path=y.fs=y.errno=y.array=void 0;const t=R();y.array=t;const e=S();y.errno=e;const n=function(){if(v)return x;v=1,Object.defineProperty(x,"__esModule",{value:!0}),x.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return x.createDirentFromStats=function(e,n){return new t(e,n)},x}();y.fs=n;const r=C();y.path=r;const o=wt();y.pattern=o;const s=function(){if(kt)return Mt;kt=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.merge=void 0;const t=Lt();function e(t){t.forEach(t=>t.emit("close"))}return Mt.merge=function(n){const r=t(n);return n.forEach(t=>{t.once("error",t=>r.emit("error",t))}),r.once("close",()=>e(n)),r.once("end",()=>e(n)),r},Mt}();y.stream=s;const i=It();return y.string=i,y}var Wt,Gt={},Ut={},Kt={},Vt={},qt={},Qt={},zt={},Xt={},Yt={};function Zt(){if(Wt)return Yt;function t(t,e){t(e)}function e(t,e){t(null,e)}return Wt=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.read=void 0,Yt.read=function(n,r,o){r.fs.lstat(n,(s,i)=>{null===s?i.isSymbolicLink()&&r.followSymbolicLink?r.fs.stat(n,(n,s)=>{if(null!==n)return r.throwErrorOnBrokenSymbolicLink?void t(o,n):void e(o,i);r.markSymbolicLink&&(s.isSymbolicLink=()=>!0),e(o,s)}):e(o,i):t(o,s)})},Yt}var Jt,te={};var ee,ne,re,oe,se,ie,ae,ue={},ce={};function le(){if(ne)return ue;ne=1,Object.defineProperty(ue,"__esModule",{value:!0});const t=(ee||(ee=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(ce)),ce);return ue.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,e){return null!=t?t:e}},ue}function pe(){if(re)return Xt;re=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.statSync=Xt.stat=Xt.Settings=void 0;const t=Zt(),e=(Jt||(Jt=1,Object.defineProperty(te,"__esModule",{value:!0}),te.read=void 0,te.read=function(t,e){const n=e.fs.lstatSync(t);if(!n.isSymbolicLink()||!e.followSymbolicLink)return n;try{const n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(t){if(!e.throwErrorOnBrokenSymbolicLink)return n;throw t}}),te),n=le();function r(t={}){return t instanceof n.default?t:new n.default(t)}return Xt.Settings=n.default,Xt.stat=function(e,n,o){"function"!=typeof n?t.read(e,r(n),o):t.read(e,r(),n)},Xt.statSync=function(t,n){const o=r(n);return e.read(t,o)},Xt}function he(){if(se)return oe;let t;return se=1,oe="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:f):e=>(t||(t=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))}var fe,de={};function ge(){if(fe)return de;fe=1,Object.defineProperty(de,"__esModule",{value:!0}),de.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const t=process.versions.node.split(".");if(void 0===t[0]||void 0===t[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const e=Number.parseInt(t[0],10),n=Number.parseInt(t[1],10),r=e>10,o=10===e&&n>=10;return de.IS_SUPPORT_READDIR_WITH_FILE_TYPES=r||o,de}var me,ye,_e={},Re={};function be(){if(ye)return _e;ye=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.fs=void 0;const t=function(){if(me)return Re;me=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return Re.createDirentFromStats=function(e,n){return new t(e,n)},Re}();return _e.fs=t,_e}var Pe,Se,ve={};function xe(){if(Pe)return ve;return Pe=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.joinPathSegments=void 0,ve.joinPathSegments=function(t,e,n){return t.endsWith(n)?t+e:t+n+e},ve}function Ee(){if(Se)return zt;Se=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.readdir=zt.readdirWithFileTypes=zt.read=void 0;const t=pe(),e=function(){if(ae)return ie;ae=1,ie=function(e,n){let r,o,s,i=!0;function a(e){function o(){n&&n(e,r),n=null}i?t(o):o()}function u(t,e,n){r[t]=n,(0===--o||e)&&a(e)}Array.isArray(e)?(r=[],o=e.length):(s=Object.keys(e),r={},o=s.length),o?s?s.forEach(function(t){e[t](function(e,n){u(t,e,n)})}):e.forEach(function(t,e){t(function(t,n){u(e,t,n)})}):a(null),i=!1};const t=he();return ie}(),n=ge(),r=be(),o=xe();function s(t,n,s){n.fs.readdir(t,{withFileTypes:!0},(i,c)=>{if(null!==i)return void a(s,i);const l=c.map(e=>({dirent:e,name:e.name,path:o.joinPathSegments(t,e.name,n.pathSegmentSeparator)}));if(!n.followSymbolicLinks)return void u(s,l);const p=l.map(t=>function(t,e){return n=>{t.dirent.isSymbolicLink()?e.fs.stat(t.path,(o,s)=>{if(null!==o)return e.throwErrorOnBrokenSymbolicLink?void n(o):void n(null,t);t.dirent=r.fs.createDirentFromStats(t.name,s),n(null,t)}):n(null,t)}}(t,n));e(p,(t,e)=>{null===t?u(s,e):a(s,t)})})}function i(n,s,i){s.fs.readdir(n,(c,l)=>{if(null!==c)return void a(i,c);const p=l.map(e=>{const i=o.joinPathSegments(n,e,s.pathSegmentSeparator);return n=>{t.stat(i,s.fsStatSettings,(t,o)=>{if(null!==t)return void n(t);const a={name:e,path:i,dirent:r.fs.createDirentFromStats(e,o)};s.stats&&(a.stats=o),n(null,a)})}});e(p,(t,e)=>{null===t?u(i,e):a(i,t)})})}function a(t,e){t(e)}function u(t,e){t(null,e)}return zt.read=function(t,e,r){e.stats||!n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?i(t,e,r):s(t,e,r)},zt.readdirWithFileTypes=s,zt.readdir=i,zt}var Ae,Ce={};var $e,Oe,we,Te={},je={};function ke(){return $e||($e=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(je)),je}function Me(){if(we)return Qt;we=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Settings=Qt.scandirSync=Qt.scandir=void 0;const t=Ee(),e=function(){if(Ae)return Ce;Ae=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.readdir=Ce.readdirWithFileTypes=Ce.read=void 0;const t=pe(),e=ge(),n=be(),r=xe();function o(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(o=>{const s={dirent:o,name:o.name,path:r.joinPathSegments(t,o.name,e.pathSegmentSeparator)};if(s.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{const t=e.fs.statSync(s.path);s.dirent=n.fs.createDirentFromStats(s.name,t)}catch(t){if(e.throwErrorOnBrokenSymbolicLink)throw t}return s})}function s(e,o){return o.fs.readdirSync(e).map(s=>{const i=r.joinPathSegments(e,s,o.pathSegmentSeparator),a=t.statSync(i,o.fsStatSettings),u={name:s,path:i,dirent:n.fs.createDirentFromStats(s,a)};return o.stats&&(u.stats=a),u})}return Ce.read=function(t,n){return!n.stats&&e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(t,n):s(t,n)},Ce.readdirWithFileTypes=o,Ce.readdir=s,Ce}(),n=function(){if(Oe)return Te;Oe=1,Object.defineProperty(Te,"__esModule",{value:!0});const t=r,e=pe(),n=ke();return Te.default=class{constructor(r={}){this._options=r,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=n.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},Te}();function o(t={}){return t instanceof n.default?t:new n.default(t)}return Qt.Settings=n.default,Qt.scandir=function(e,n,r){"function"!=typeof n?t.read(e,o(n),r):t.read(e,o(),n)},Qt.scandirSync=function(t,n){const r=o(n);return e.read(t,r)},Qt}var Le,He,Fe,De={exports:{}};function Ne(){if(Fe)return De.exports;Fe=1;var t=He?Le:(He=1,Le=function(t){var e=new t,n=e;return{get:function(){var r=e;return r.next?e=r.next:(e=new t,n=e),r.next=null,r},release:function(t){n.next=t,n=t}}});function e(e,o,s){if("function"==typeof e&&(s=o,o=e,e=null),!(s>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var i=t(r),a=null,u=null,c=0,l=null,p={push:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?u?(u.next=f,u=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},drain:n,saturated:n,pause:function(){p.paused=!0},paused:!1,get concurrency(){return s},set concurrency(t){if(!(t>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(s=t,!p.paused)for(;a&&c<s;)c++,h()},running:function(){return c},resume:function(){if(!p.paused)return;if(p.paused=!1,null===a)return c++,void h();for(;a&&c<s;)c++,h()},idle:function(){return 0===c&&0===p.length()},length:function(){var t=a,e=0;for(;t;)t=t.next,e++;return e},getQueue:function(){var t=a,e=[];for(;t;)e.push(t.value),t=t.next;return e},unshift:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?a?(f.next=a,a=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},empty:n,kill:function(){a=null,u=null,p.drain=n},killAndDrain:function(){a=null,u=null,p.drain(),p.drain=n},error:function(t){l=t},abort:function(){var t=a;a=null,u=null;for(;t;){var e=t.next,r=t.callback,o=t.errorHandler,s=t.value,i=t.context;t.value=null,t.callback=n,t.errorHandler=null,o&&o(new Error("abort"),s),r.call(i,new Error("abort")),t.release(t),t=e}p.drain=n}};return p;function h(t){t&&i.release(t);var n=a;n&&c<=s?p.paused?c--:(u===a&&(u=null),a=n.next,n.next=null,o.call(e,n.value,n.worked),null===u&&p.empty()):0===--c&&p.drain()}}function n(){}function r(){this.value=null,this.callback=n,this.next=null,this.release=n,this.context=null,this.errorHandler=null;var t=this;this.worked=function(e,r){var o=t.callback,s=t.errorHandler,i=t.value;t.value=null,t.callback=n,t.errorHandler&&s(e,i),o.call(t.context,e,r),t.release(t)}}return De.exports=e,De.exports.promise=function(t,r,o){"function"==typeof t&&(o=r,r=t,t=null);var s=e(t,function(t,e){r.call(this,t).then(function(t){e(null,t)},e)},o),i=s.push,a=s.unshift;return s.push=function(t){var e=new Promise(function(e,n){i(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.unshift=function(t){var e=new Promise(function(e,n){a(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.drained=function(){return new Promise(function(t){process.nextTick(function(){if(s.idle())t();else{var e=s.drain;s.drain=function(){"function"==typeof e&&e(),t(),s.drain=e}}})})},s},De.exports}var Ie,Be={};function We(){if(Ie)return Be;return Ie=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.joinPathSegments=Be.replacePathSegmentSeparator=Be.isAppliedFilter=Be.isFatalError=void 0,Be.isFatalError=function(t,e){return null===t.errorFilter||!t.errorFilter(e)},Be.isAppliedFilter=function(t,e){return null===t||t(e)},Be.replacePathSegmentSeparator=function(t,e){return t.split(/[/\\]/).join(e)},Be.joinPathSegments=function(t,e,n){return""===t?e:t.endsWith(n)?t+e:t+n+e},Be}var Ge,Ue,Ke,Ve={};function qe(){if(Ge)return Ve;Ge=1,Object.defineProperty(Ve,"__esModule",{value:!0});const t=We();return Ve.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}},Ve}function Qe(){if(Ue)return qt;Ue=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=i,e=Me(),n=Ne(),r=We(),o=qe();class s extends o.default{constructor(r,o){super(r,o),this._settings=o,this._scandir=e.scandir,this._emitter=new t.EventEmitter,this._queue=n(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,e){const n={directory:t,base:e};this._queue.push(n,t=>{null!==t&&this._handleError(t)})}_worker(t,e){this._scandir(t.directory,this._settings.fsScandirSettings,(n,r)=>{if(null===n){for(const e of r)this._handleEntry(e,t.base);e(null,void 0)}else e(n,void 0)})}_handleError(t){!this._isDestroyed&&r.isFatalError(this._settings,t)&&(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,e){if(this._isDestroyed||this._isFatalError)return;const n=t.path;void 0!==e&&(t.path=r.joinPathSegments(e,t.name,this._settings.pathSegmentSeparator)),r.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&r.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(n,void 0===e?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}}return qt.default=s,qt}var ze,Xe={};var Ye,Ze,Je={},tn={};function en(){if(Ze)return Je;Ze=1,Object.defineProperty(Je,"__esModule",{value:!0});const t=function(){if(Ye)return tn;Ye=1,Object.defineProperty(tn,"__esModule",{value:!0});const t=Me(),e=We(),n=qe();class r extends n.default{constructor(){super(...arguments),this._scandir=t.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,e){this._queue.add({directory:t,base:e})}_handleQueue(){for(const t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,e){try{const n=this._scandir(t,this._settings.fsScandirSettings);for(const t of n)this._handleEntry(t,e)}catch(t){this._handleError(t)}}_handleError(t){if(e.isFatalError(this._settings,t))throw t}_handleEntry(t,n){const r=t.path;void 0!==n&&(t.path=e.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),e.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&e.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,void 0===n?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}}return tn.default=r,tn}();return Je.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings)}read(){return this._reader.read()}},Je}var nn,rn,on={};function sn(){if(rn)return Kt;rn=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Settings=Kt.walkStream=Kt.walkSync=Kt.walk=void 0;const t=function(){if(Ke)return Vt;Ke=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=Qe();return Vt.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(e=>{!function(t,e){t(e)}(t,e)}),this._reader.onEntry(t=>{this._storage.push(t)}),this._reader.onEnd(()=>{!function(t,e){t(null,e)}(t,this._storage)}),this._reader.read()}},Vt}(),e=function(){if(ze)return Xe;ze=1,Object.defineProperty(Xe,"__esModule",{value:!0});const t=s,e=Qe();return Xe.default=class{constructor(n,r){this._root=n,this._settings=r,this._reader=new e.default(this._root,this._settings),this._stream=new t.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}},Xe}(),n=en(),o=function(){if(nn)return on;nn=1,Object.defineProperty(on,"__esModule",{value:!0});const t=r,e=Me();return on.default=class{constructor(n={}){this._options=n,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.fsScandirSettings=new e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},on}();function i(t={}){return t instanceof o.default?t:new o.default(t)}return Kt.Settings=o.default,Kt.walk=function(e,n,r){"function"!=typeof n?new t.default(e,i(n)).read(r):new t.default(e,i()).read(n)},Kt.walkSync=function(t,e){const r=i(e);return new n.default(t,r).read()},Kt.walkStream=function(t,n){const r=i(n);return new e.default(t,r).read()},Kt}var an,un={};function cn(){if(an)return un;an=1,Object.defineProperty(un,"__esModule",{value:!0});const t=r,e=pe(),n=Bt();return un.default=class{constructor(t){this._settings=t,this._fsStatSettings=new e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return t.resolve(this._settings.cwd,e)}_makeEntry(t,e){const r={name:e,path:e,dirent:n.fs.createDirentFromStats(e,t)};return this._settings.stats&&(r.stats=t),r}_isFatalError(t){return!n.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}},un}var ln,pn,hn={};function fn(){if(ln)return hn;ln=1,Object.defineProperty(hn,"__esModule",{value:!0});const t=s,e=pe(),n=sn(),r=cn();class o extends r.default{constructor(){super(...arguments),this._walkStream=n.walkStream,this._stat=e.stat}dynamic(t,e){return this._walkStream(t,e)}static(e,n){const r=e.map(this._getFullEntryPath,this),o=new t.PassThrough({objectMode:!0});o._write=(t,s,i)=>this._getEntry(r[t],e[t],n).then(e=>{null!==e&&n.entryFilter(e)&&o.push(e),t===r.length-1&&o.end(),i()}).catch(i);for(let t=0;t<r.length;t++)o.write(t);return o}_getEntry(t,e,n){return this._getStat(t).then(t=>this._makeEntry(t,e)).catch(t=>{if(n.errorFilter(t))return null;throw t})}_getStat(t){return new Promise((e,n)=>{this._stat(t,this._fsStatSettings,(t,r)=>null===t?e(r):n(t))})}}return hn.default=o,hn}var dn,gn,mn,yn={},_n={},Rn={},bn={};function Pn(){if(gn)return Rn;gn=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=function(){if(dn)return bn;dn=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=Bt();return bn.default=class{constructor(t,e,n){this._patterns=t,this._settings=e,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(const t of this._patterns){const e=this._getPatternSegments(t),n=this._splitSegmentsIntoSections(e);this._storage.push({complete:n.length<=1,pattern:t,segments:e,sections:n})}}_getPatternSegments(e){return t.pattern.getPatternParts(e,this._micromatchOptions).map(e=>t.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:t.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e})}_splitSegmentsIntoSections(e){return t.array.splitWhen(e,e=>e.dynamic&&t.pattern.hasGlobStar(e.pattern))}},bn}();class e extends t.default{match(t){const e=t.split("/"),n=e.length,r=this._storage.filter(t=>!t.complete||t.segments.length>n);for(const t of r){const r=t.sections[0];if(!t.complete&&n>r.length)return!0;if(e.every((e,n)=>{const r=t.segments[n];return!(!r.dynamic||!r.patternRe.test(e))||!r.dynamic&&r.pattern===e}))return!0}return!1}}return Rn.default=e,Rn}var Sn,vn={};var xn,En={};var An,Cn,$n,On={};function wn(){if(Cn)return yn;Cn=1,Object.defineProperty(yn,"__esModule",{value:!0});const t=r,e=function(){if(mn)return _n;mn=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=Bt(),e=Pn();return _n.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e}getFilter(t,e,n){const r=this._getMatcher(e),o=this._getNegativePatternsRe(n);return e=>this._filter(t,e,r,o)}_getMatcher(t){return new e.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const n=e.filter(t.pattern.isAffectDepthOfReadingPattern);return t.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(e,n,r,o){if(this._isSkippedByDeep(e,n.path))return!1;if(this._isSkippedSymbolicLink(n))return!1;const s=t.path.removeLeadingDotSegment(n.path);return!this._isSkippedByPositivePatterns(s,r)&&this._isSkippedByNegativePatterns(s,o)}_isSkippedByDeep(t,e){return this._settings.deep!==1/0&&this._getEntryLevel(t,e)>=this._settings.deep}_getEntryLevel(t,e){const n=e.split("/").length;return""===t?n:n-t.split("/").length}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,e){return!this._settings.baseNameMatch&&!e.match(t)}_isSkippedByNegativePatterns(e,n){return!t.pattern.matchAny(e,n)}},_n}(),n=function(){if(Sn)return vn;Sn=1,Object.defineProperty(vn,"__esModule",{value:!0});const t=Bt();return vn.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e,this.index=new Map}getFilter(e,n){const[r,o]=t.pattern.partitionAbsoluteAndRelative(n),s={positive:{all:t.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:t.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:t.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return t=>this._filter(t,s)}_filter(e,n){const r=t.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(r))return!1;if(this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;const o=this._isMatchToPatternsSet(r,n,e.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(r),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,e,n){return!!this._isMatchToPatterns(t,e.positive.all,n)&&(!this._isMatchToPatterns(t,e.negative.relative,n)&&!this._isMatchToAbsoluteNegative(t,e.negative.absolute,n))}_isMatchToAbsoluteNegative(e,n,r){if(0===n.length)return!1;const o=t.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(o,n,r)}_isMatchToPatterns(e,n,r){if(0===n.length)return!1;const o=t.pattern.matchAny(e,n);return!o&&r?t.pattern.matchAny(e+"/",n):o}},vn}(),o=function(){if(xn)return En;xn=1,Object.defineProperty(En,"__esModule",{value:!0});const t=Bt();return En.default=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}},En}(),s=function(){if(An)return On;An=1,Object.defineProperty(On,"__esModule",{value:!0});const t=Bt();return On.default=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(e){let n=e.path;return this._settings.absolute&&(n=t.path.makeAbsolute(this._settings.cwd,n),n=t.path.unixify(n)),this._settings.markDirectories&&e.dirent.isDirectory()&&(n+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:n}):n}},On}();return yn.default=class{constructor(t){this._settings=t,this.errorFilter=new o.default(this._settings),this.entryFilter=new n.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new e.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new s.default(this._settings)}_getRootDirectory(e){return t.resolve(this._settings.cwd,e.base)}_getReaderOptions(t){const e="."===t.base?"":t.base;return{basePath:e,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(e,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}},yn}function Tn(){if($n)return Gt;$n=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=function(){if(pn)return Ut;pn=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=sn(),e=cn(),n=fn();class r extends e.default{constructor(){super(...arguments),this._walkAsync=t.walk,this._readerStream=new n.default(this._settings)}dynamic(t,e){return new Promise((n,r)=>{this._walkAsync(t,e,(t,e)=>{null===t?n(e):r(t)})})}async static(t,e){const n=[],r=this._readerStream.static(t,e);return new Promise((t,e)=>{r.once("error",e),r.on("data",t=>n.push(t)),r.once("end",()=>t(n))})}}return Ut.default=r,Ut}(),e=wn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}async read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return(await this.api(e,t,n)).map(t=>n.transform(t))}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Gt.default=n,Gt}var jn,kn={};var Mn,Ln,Hn={},Fn={};function Dn(){if(Ln)return Hn;Ln=1,Object.defineProperty(Hn,"__esModule",{value:!0});const t=function(){if(Mn)return Fn;Mn=1,Object.defineProperty(Fn,"__esModule",{value:!0});const t=pe(),e=sn(),n=cn();class r extends n.default{constructor(){super(...arguments),this._walkSync=e.walkSync,this._statSync=t.statSync}dynamic(t,e){return this._walkSync(t,e)}static(t,e){const n=[];for(const r of t){const t=this._getFullEntryPath(r),o=this._getEntry(t,r,e);null!==o&&e.entryFilter(o)&&n.push(o)}return n}_getEntry(t,e,n){try{const n=this._getStat(t);return this._makeEntry(n,e)}catch(t){if(n.errorFilter(t))return null;throw t}}_getStat(t){return this._statSync(t,this._fsStatSettings)}}return Fn.default=r,Fn}(),e=wn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return this.api(e,t,n).map(n.transform)}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Hn.default=n,Hn}var Nn,In,Bn,Wn={};var Gn=function(){if(Bn)return In;Bn=1;const t=function(){if(Dt)return m;Dt=1,Object.defineProperty(m,"__esModule",{value:!0}),m.convertPatternGroupToTask=m.convertPatternGroupsToTasks=m.groupPatternsByBaseDirectory=m.getNegativePatternsAsPositive=m.getPositivePatterns=m.convertPatternsToTasks=m.generate=void 0;const t=Bt();function e(e,n){let r=e;return n.braceExpansion&&(r=t.pattern.expandPatternsWithBraceExpansion(r)),n.baseNameMatch&&(r=r.map(t=>t.includes("/")?t:`**/${t}`)),r.map(e=>t.pattern.removeDuplicateSlashes(e))}function n(e,n,r){const o=[],u=t.pattern.getPatternsOutsideCurrentDirectory(e),c=t.pattern.getPatternsInsideCurrentDirectory(e),l=s(u),p=s(c);return o.push(...i(l,n,r)),"."in p?o.push(a(".",c,n,r)):o.push(...i(p,n,r)),o}function r(e){return t.pattern.getPositivePatterns(e)}function o(e,n){return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern)}function s(e){return e.reduce((e,n)=>{const r=t.pattern.getBaseDirectory(n);return r in e?e[r].push(n):e[r]=[n],e},{})}function i(t,e,n){return Object.keys(t).map(r=>a(r,t[r],e,n))}function a(e,n,r,o){return{dynamic:o,positive:n,negative:r,base:e,patterns:[].concat(n,r.map(t.pattern.convertToNegativePattern))}}return m.generate=function(s,i){const a=e(s,i),u=e(i.ignore,i),c=r(a),l=o(a,u),p=c.filter(e=>t.pattern.isStaticPattern(e,i)),h=c.filter(e=>t.pattern.isDynamicPattern(e,i)),f=n(p,l,!1),d=n(h,l,!0);return f.concat(d)},m.convertPatternsToTasks=n,m.getPositivePatterns=r,m.getNegativePatternsAsPositive=o,m.groupPatternsByBaseDirectory=s,m.convertPatternGroupsToTasks=i,m.convertPatternGroupToTask=a,m}(),e=Tn(),r=function(){if(jn)return kn;jn=1,Object.defineProperty(kn,"__esModule",{value:!0});const t=s,e=fn(),n=wn();class r extends n.default{constructor(){super(...arguments),this._reader=new e.default(this._settings)}read(e){const n=this._getRootDirectory(e),r=this._getReaderOptions(e),o=this.api(n,e,r),s=new t.Readable({objectMode:!0,read:()=>{}});return o.once("error",t=>s.emit("error",t)).on("data",t=>s.emit("data",r.transform(t))).once("end",()=>s.emit("end")),s.once("close",()=>o.destroy()),s}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return kn.default=r,kn}(),o=Dn(),i=(Nn||(Nn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const e=a,r=n,o=Math.max(r.cpus().length,1);t.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:e.lstat,lstatSync:e.lstatSync,stat:e.stat,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.default=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,o),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,e){return void 0===t?e:t}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},t.DEFAULT_FILE_SYSTEM_ADAPTER),e)}}}(Wn)),Wn),u=Bt();async function c(t,n){p(t);const r=l(t,e.default,n),o=await Promise.all(r);return u.array.flatten(o)}function l(e,n,r){const o=[].concat(e),s=new i.default(r),a=t.generate(o,s),u=new n(s);return a.map(u.read,u)}function p(t){if(![].concat(t).every(t=>u.string.isString(t)&&!u.string.isEmpty(t)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}return function(e){function n(t,e){p(t);const n=l(t,o.default,e);return u.array.flatten(n)}function s(t,e){p(t);const n=l(t,r.default,e);return u.stream.merge(n)}var a,c;e.glob=e,e.globSync=n,e.globStream=s,e.async=e,e.sync=n,e.stream=s,e.generateTasks=function(e,n){p(e);const r=[].concat(e),o=new i.default(n);return t.generate(r,o)},e.isDynamicPattern=function(t,e){p(t);const n=new i.default(e);return u.pattern.isDynamicPattern(t,n)},e.escapePath=function(t){return p(t),u.path.escape(t)},e.convertPathToPattern=function(t){return p(t),u.path.convertPathToPattern(t)},(a=e.posix||(e.posix={})).escapePath=function(t){return p(t),u.path.escapePosixPath(t)},a.convertPathToPattern=function(t){return p(t),u.path.convertPosixPathToPattern(t)},(c=e.win32||(e.win32={})).escapePath=function(t){return p(t),u.path.escapeWindowsPath(t)},c.convertPathToPattern=function(t){return p(t),u.path.convertWindowsPathToPattern(t)}}(c||(c={})),In=c}(),Un=d(Gn);const Kn={"/home":"/","/root":"/"},Vn=(t,e)=>{const n=t.split("/"),r=n[n.length-1];return e&&r.endsWith(e)?r.slice(0,-e.length):r},qn=t=>{const e=Kn[t];if(e)return e;return"/notfound"===t.toLowerCase()||"/404"===t?"/*":t},Qn=(t,e)=>{if(t.endsWith(".config."+(e?"ts":"js"))){return"index"===Vn(t,".config."+(e?"ts":"js"))?t.replace("index.config."+(e?"ts":"js"),"index."+(e?"ts":"js")):t.slice(0,-10)+"."+(e?"tsx":"jsx")}return t.replace("index.config."+(e?"ts":"js"),"index."+(e?"ts":"js"))},zn=(t,e)=>{if(t.endsWith(".config."+(e?"ts":"js"))){const n=Vn(t,".config."+(e?"ts":"js")),r=(t=>{const e=t.split("/");return e.pop(),e.join("/")})(t).replace("/src/pages","");return"index"===n?r||"/":r?`${r}/${n}`:`/${n}`}return t.replace("/src/pages","").replace("/index.config."+(e?"ts":"js"),"")||"/"},Xn=async(t,e,n)=>{const r=[];for(const[o,s]of((t,e,n)=>Object.keys(t).map(t=>{const r=((t,e)=>t.endsWith(e?".tsx":".jsx")?t.slice(0,-4)+".config."+(e?"ts":"js"):t.replace("index."+(e?"ts":"js"),"index.config."+(e?"ts":"js")))(t,n);return[r,e[r]||{}]}))(t,e,n)){const e=Qn(o,n);if(!t[e])continue;const i=s?.path||zn(o,n)||"/",a=Or(i,n),u=qn(a);r.push({...s,path:u,type:s?.type,isRoot:"/root"===a,element:t[e]})}return r},Yn=t=>{if(t.index)return t;if("wrap"!==t.type){const{path:e,children:n,...r}=t;if(Object.keys(r).length>0){return{path:e,children:[{path:"",index:!0,...r},...(n||[]).map(Yn)]}}}return t.children?{...t,children:t.children.map(Yn)}:t},Zn=t=>{const e=(t=>{const e=new Map,n=[],r=new Map,o=t=>{let e=r.get(t);return void 0===e&&(e="/"===t?[]:t.split("/").filter(Boolean),r.set(t,e)),e},s=t.slice().sort((t,e)=>t.path.length-e.path.length);for(const t of s){const r=t.path,s=o(r),i={...t,children:[]};if(e.set(r,i),s.length<=1){n.push(i);continue}const a="/"+s.slice(0,-1).join("/"),u=e.get(a);u?(i.path=s[s.length-1],u.children.push(i)):n.push(i)}return n})(t);return(t=>t.map(Yn))(e)},Jn=t=>{const{isRoot:e,type:n,children:r,...o}=t;return r?.length?{...o,children:r.map(Jn)}:o},tr=t=>{const{children:e}=t;if(!e?.length){const{children:e,...n}=t;return n}const n=e.map(tr);if("wrap"===t.type)return{...t,children:n};const{path:r,element:o,type:s,children:i,...a}=t;return o?{path:r,children:[{index:!0,element:o,...a},...n]}:{path:r,...a,children:n}},er=t=>Jn(tr(t)),nr=t=>Zn(t).map(er),rr=t=>{if(t.some(t=>t.isRoot))return(t=>{let e,n,r;const o=[];for(const s of t)if(s.isRoot){if(e)throw new Error("There cannot be multiple root routes in a route");e=s}else"/"===s.path?n=s:"/*"===s.path?r=s:o.push(s);if(Ar(o,"path"))throw new Error("There cannot be duplicate paths in a route");const s=[n&&{...n,index:!0},...nr(o)].filter(t=>Boolean(t)),i=[];return e&&i.push(Jn({...e,children:s})),r&&i.push(Jn(r)),i})(t);if(Ar(t,"path"))throw new Error("There cannot be duplicate paths in a route");return nr(t)},or=(t,e)=>({import:`import ${t} from './${e}'`,component:`<start><${t} /></end>`,lazy:`const ${t} = lazy(() => import('${e}'))`,lazyComponent:`<start><Suspense><${t} /></Suspense></end>`});const sr=/[/\\]/,ir=/[^a-zA-Z0-9]/g,ar=/^(\d)/,ur="index.tsx",cr="index.jsx",lr=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";function pr(e){const n=t.extname(e),r=t.basename(e,n),o=t.dirname(e).split(sr).filter(Boolean);"index"!==r&&"Index"!==r&&o.push(r);return o.map(t=>{const e=(t=>t.replace(ir,"_").replace(ar,"_$1"))(t);return e.split("_").map(lr).join("")}).join("")||"Component"}const hr=(t,e,n,r,o,s,i)=>{const a=((t,e)=>t.includes(e?ur:cr)?t.replace(e?ur:cr,e?"index.ts":"index.js"):t)(vr(t,e),i),u=Sr(br(n,t)),c=((t,e)=>{if(!e.has(t))return e.add(t),t;let n=1;for(;e.has(`${t}_${n}`);)n++;return`${t}_${n}`})(pr(u),s),l=`element(${u})`;r[`/${a}`]=l,o.set(l,{path:u,componentName:c})},fr=(t,e,n,r)=>{const o=vr(t,e);n[`/${o}`]=((t,e,n)=>{const r={};for(const[o,s]of Object.entries(e))if("function"==typeof s){const e=`${t}-${o}`;r[o]=e,n.set(e,`<start>${u(s.toString())}</end>`)}else r[o]=s;return r})(o,Rr(t),r)};function dr(t,e,n,r,o,s,i,a,u){const c={},l=t.replace(/^\/+/,""),p=Un.sync(l,{cwd:e,absolute:!0,onlyFiles:!0}).filter(Er);for(const t of p)if("module"===o){if(t.includes(".config."))continue;hr(t,n,r,c,s,i,u)}else fr(t,n,c,a);return c}const gr=async(n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=new Map,c=new Set,l=new Map,p=dr("/**/*.{jsx,tsx}",a,r,o,"module",u,c,l,i),h=dr("/**/*.config.{js,ts,jsx,tsx}",a,r,o,"config",u,c,l,i),f=await Xn(p,h,i),d=((t,e,n,r)=>{let o=t;for(const[t,n]of e){const e=or(n.componentName,n.path);o=o.replace(t,r?e.lazyComponent:e.component)}for(const[t,e]of n)o=o.replace(t,e);return $r(o)})(function(t,e,n,r){const o=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\n${r?"import type { RouteObject } from 'react-router-dom'\n":""}${e.join("\n")}${r?"\n\ntype PageConfig = Partial<\n Omit<RouteObject, 'path' | 'Component' | 'element' | 'children'> & {\n path: string\n type?: 'single' | 'wrap'\n }\n>\n":""}${r?"\nexport const defineConfig = (config: PageConfig) => config":""}\n${o}\nexport const routes${r?": RouteObject[]":""} = ${JSON.stringify(t,null,2)}\n`}(rr(f),((t,e)=>{if(t)return["import { lazy, Suspense } from 'react'"];const n=[];for(const t of e.values())n.push(or(t.componentName,t.path).import);return n})(s,u),((t,e)=>{if(!t)return[];const n=[];for(const t of e.values())n.push(or(t.componentName,t.path).lazy);return n})(s,u),i),u,l,s);Tr(o,d)},mr=(n,r,o,s)=>{const i=t.resolve(r,n);if(!e.existsSync(i))throw new Error(`[ono-auto-router] Pages directory does not exist: ${i}`);const a=o.split(".")[0],u=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(s),c=((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { RouteRecordRaw } from 'vue-router'":""}\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${e?"\nimport type { MyRouteObject, PageConfig, PagesComponentType } from './types'":""}\nimport { hasDuplicateProperty, replaceBracketsWithColon } from './utils'\n\nconst pathCache = new Map${e?"<string, { compPath: string; basePath: string }>":""}()\nconst basenameCache = new Map${e?"<string, string>":""}()\n\nconst normalizePagePath = ${e?"(key: string): string":"(key)"} => {\n if (key.includes('index.vue')) return key.replace('index.vue', 'index.${e?"ts":"js"}')\n if (key.includes('root.vue')) return key.replace('root.vue', 'root/index.${e?"ts":"js"}')\n if (key.includes('404.vue')) return key.replace('404.vue', '404/index.${e?"ts":"js"}')\n if (key.toLowerCase().includes('notfound.vue'))\n return key.toLowerCase().replace('notfound.vue', 'notfound/index.${e?"ts":"js"}')\n return key\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const cacheKey = ext ? filePath + ':' + ext : filePath\n if (basenameCache.has(cacheKey)) {\n return basenameCache.get(cacheKey)${e?"!":""}\n }\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1] || ''\n let result = lastPart\n if (ext && lastPart.endsWith(ext)) {\n result = lastPart.slice(0, -ext.length)\n }\n basenameCache.set(cacheKey, result)\n return result\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getPathsFromConfig = ${e?"(configPath: string)":"(configPath)"} => {\n const cacheKey = configPath\n if (pathCache.has(cacheKey)) {\n return pathCache.get(cacheKey)${e?"!":""}\n }\n\n let compPath${e?": string":" = ''"}\n let basePath${e?": string":" = ''"}\n\n if (configPath.endsWith('.config.${e?"ts":"js"}')) {\n const fileName = getBasename(configPath, '.config.${e?"ts":"js"}')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n\n if (fileName === 'index') {\n compPath = configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"ts":"js"}')\n basePath = dirPath || '/'\n } else {\n compPath = configPath.slice(0, -10) + '.vue'\n basePath = dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n } else {\n compPath = configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"ts":"js"}')\n basePath =\n configPath.replace('/${t}', '').replace('/index.config.${e?"ts":"js"}', '') ||\n '/'\n }\n\n const result = { compPath, basePath }\n pathCache.set(cacheKey, result)\n return result\n}\n\nconst formatPath = ${e?"(path: string): string":"(path)"} => {\n const lowerPath = path.toLowerCase()\n if (lowerPath === '/home') return '/'\n if (lowerPath === '/notfound' || path === '/404') return '/:pathMatch(.*)*'\n return path.replace('/index.${e?"ts":"js"}', '') || '/'\n}\n\nconst getConfigFileName = ${e?"(pagePath: string): string":"(pagePath)"} => {\n if (pagePath.endsWith('.vue')) {\n return pagePath.slice(0, -4) + '.config.${e?"ts":"js"}'\n }\n return pagePath.replace('index.${e?"ts":"js"}', 'index.config.${e?"ts":"js"}')\n}\n\nconst createBaseRoutes = ()${e?": MyRouteObject[]":""} => {\n const pagesComponent = Object.fromEntries(\n Object.entries({\n ...import.meta.glob('/${t}/**/index.vue'),\n ...import.meta.glob('/${t}/*.vue')\n }${e?" as PagesComponentType":""}).map(([key, value]) => [\n normalizePagePath(key),\n value\n ])\n )\n\n const pagesModule${e?": Record<string, PageConfig>":""} = import.meta.glob(\n '/${t}/**/*.config.${e?"ts":"js"}',\n { eager: true, import: 'default' }\n )\n\n const result${e?": MyRouteObject[]":""} = []\n\n for (const pagePath of Object.keys(pagesComponent)) {\n const configPath = getConfigFileName(pagePath)\n const content = pagesModule[configPath] || {}\n const { compPath, basePath } = getPathsFromConfig(configPath)\n const path = replaceBracketsWithColon(content?.path || basePath || '/')\n const name = path.split('/').filter(Boolean).join('-') || 'index'\n\n result.push({\n path: formatPath(path),\n name,\n component: pagesComponent[compPath],\n isRoot: path === '/root',\n ...content${e?"!":""}\n })\n }\n\n return result\n}\n\nconst processRoutes = ${e?"(\n routes: MyRouteObject[],\n removeLeadingSlash = false\n): MyRouteObject[]":"(routes, removeLeadingSlash)"} =>\n buildRouteTree(routes, removeLeadingSlash)\n .map(removeEmptyChildren)\n .map(cleanIsRoot)\n\nconst handleRootRoute = ${e?"(\n routes: (MyRouteObject & { isRoot?: boolean })[]\n): MyRouteObject[]":"(routes)"} => {\n let rootRoute${e?": (MyRouteObject & { isRoot?: boolean }) | undefined":" = undefined"}\n let homeRoute${e?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${e?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/:pathMatch(.*)*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const processedRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n if (rootRoute) {\n const children = [\n homeRoute && { ...homeRoute, path: '' },\n ...processRoutes(filteredRoutes, true)\n ].filter(Boolean)${e?" as MyRouteObject[]":""}\n processedRoutes.push({ ...rootRoute, path: '/', children })\n }\n\n if (notFoundRoute) processedRoutes.push(notFoundRoute)\n\n return processedRoutes.map(cleanIsRoot)\n}\n\nexport const createRoutes = ()${e?": RouteRecordRaw[]":""} => {\n const routes = createBaseRoutes()\n\n if (routes.some((r${e?": MyRouteObject & { isRoot?: boolean }":""}) => r.isRoot))\n return handleRootRoute(routes)${e?" as RouteRecordRaw[]":""}\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)${e?" as RouteRecordRaw[]":""}\n}\n`)(n,s),l=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const buildRouteTree = ${t?"(\n routes: MyRouteObject[],\n removeLeadingSlash: boolean = false\n)":"(routes, removeLeadingSlash)"} => {\n const routeMap = new Map${t?"<string, MyRouteObject & { isRoot?: boolean }>":""}()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n\n const sortedRoutes = [...routes].sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n let path = route.path\n if (removeLeadingSlash && path.startsWith('/')) {\n path = path.slice(1)\n }\n routeMap.set(path, { ...route, path, children: [] })\n }\n\n for (const [path, route] of routeMap) {\n const slashIndex = path.lastIndexOf('/')\n\n if (slashIndex <= 0) {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n continue\n }\n\n const parentPath = path.slice(0, slashIndex)\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n const relativePath = path.slice(slashIndex + 1)\n const childRoute = { ...route, path: relativePath }\n parentRoute.children${t?"!":""}.push(childRoute)\n } else {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n }\n }\n\n return rootRoutes\n}\n`)(s),p=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const cleanIsRoot = ${t?"(\n route: MyRouteObject & { isRoot?: boolean }\n): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route\n const result${t?": MyRouteObject":""} = { ...rest }\n\n if (children?.length) {\n result.children = children.map(cleanIsRoot)\n }\n\n return result\n}\n`)(s),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (!route.children?.length) {\n const { children, ...rest } = route\n return rest\n }\n\n const hasIndexRoute = route.children.some(\n child => child.path === '' || child.path === '/'\n )\n\n const routeType = route.type || 'single'\n\n if (routeType === 'wrap') {\n const { children, ...rest } = route\n return { ...rest, children: children.map(removeEmptyChildren) }\n }\n\n if (routeType === 'single' || (!hasIndexRoute && route.component)) {\n const { path, component, type, ...rest } = route\n return {\n path,\n children: [\n { path: '', component, ...rest }${t?" as MyRouteObject":""},\n ...route.children.map(removeEmptyChildren)\n ]\n }\n }\n\n if (hasIndexRoute) {\n const { path, ...rest } = route\n const updatedChildren = route.children.map(child =>\n child.path === '' || child.path === '/' ? { ...rest, ...child } : child\n )\n return { path, children: updatedChildren.map(removeEmptyChildren) }\n }\n\n return { ...route, children: route.children.map(removeEmptyChildren) }\n}\n`)(s),f=s?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\n\nexport const defineConfig = (config: PageConfig) => config\n":"",d=s?"// Auto-generated by ono-auto-router\nimport type { RouteRecordRaw } from 'vue-router'\n\nexport type PagesComponentType = Record<string, () => Promise<unknown>>\n\nexport interface MyRouteObject extends Omit<RouteRecordRaw, 'children'> {\n type?: 'single' | 'wrap'\n isRoot?: boolean\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<Omit<MyRouteObject, 'component' | 'children' | 'isRoot'>>\n":"",g=(t=>`// Auto-generated by ono-auto-router\nconst hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nconst replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n\nexport { hasDuplicateProperty, replaceBracketsWithColon }\n`)(s);Tr(t.resolve(a,"./index."+(s?"ts":"js")),u),Tr(t.resolve(a,"./createRoutes."+(s?"ts":"js")),c),Tr(t.resolve(a,"./buildRouteTree."+(s?"ts":"js")),l),Tr(t.resolve(a,"./cleanIsRoot."+(s?"ts":"js")),p),Tr(t.resolve(a,"./removeEmptyChildren."+(s?"ts":"js")),h),f&&Tr(t.resolve(a,"./defineConfig.ts"),f),d&&Tr(t.resolve(a,"./types.ts"),d),Tr(t.resolve(a,"./getRoutes."+(s?"ts":"js")),"// Auto-generated by ono-auto-router\nimport { createRoutes } from './createRoutes'\n\nexport const routes = createRoutes()\n"),Tr(t.resolve(a,"./utils."+(s?"ts":"js")),g)},yr=t=>{try{if(!e.existsSync(t))return;e.unlinkSync(t)}catch(t){console.error("删除文件失败:",t)}},_r=t=>{try{if(!e.existsSync(t))return;e.rmSync(t,{recursive:!0})}catch(t){console.error("删除目录失败:",t)}};function Rr(t){try{const n=e.readFileSync(t,"utf-8").match(/export\s+default\s+([\s\S]*?)(?=\n\w|$)/);if(!n)return console.warn("No export default found in:",t),null;const r=n[1].trim();try{if(r.startsWith("{")){return new Function(`return ${r}`)()}if(r.includes("defineConfig(")){const t=r.match(/defineConfig([\s\S]*)$/);if(t){return new Function(`return ${t[1]}`)()}}return null}catch(t){return console.error("Error parsing export default content:",t),null}}catch(t){return console.error("Error reading file:",t),null}}function br(e,n){let r=t.resolve(e);if(r.endsWith(".js")||r.endsWith(".jsx")||r.endsWith(".ts")||r.endsWith(".tsx")){const t=r.split("\\");r=t.slice(0,-1).join("\\")}const o=t.resolve(n);return t.relative(r,o)}const Pr=/\\/g,Sr=t=>t.replace(Pr,"/"),vr=(e,n)=>Sr(t.relative(n,e)),xr=/export\s+default\s+[\w(\[\]\{\})]+/;function Er(t){try{if(!e.existsSync(t))return console.warn(`File not found: ${t}`),!1;const n=e.readFileSync(t,"utf-8");return xr.test(n)}catch(t){return console.error("Read error:",t),!1}}const Ar=(t,e)=>{const n=new Set;return t.some(t=>!!n.has(t[e])||(n.add(t[e]),!1))};function Cr(t){return t.replace(/"<start>([\s\S]*?)<\/end>"/g,"$1")}function $r(t){let e=t;for(;;){const t=Cr(e);if(t===e)break;e=t}return e}const Or=(t,e)=>t.replace(/\[([^\]]+)\]/g,":$1").replace(e?".tsx":".jsx","");function wr(t){e.existsSync(t)||e.mkdirSync(t,{recursive:!0})}async function Tr(n,r){const o=t.dirname(n);await e.promises.mkdir(o,{recursive:!0}),await e.promises.writeFile(n,r,"utf-8")}exports.convertFunctionToArrow=u,exports.deleteDir=_r,exports.deleteFile=yr,exports.ensureDirSync=wr,exports.formatRoutesFile=(e,n,r)=>{let o=r;return o||(o=t.resolve(n,h[e][p(n)?"ts":"js"])),o},exports.generateRoutesTemplate=(n,r,o,s,i,a)=>{const u=p(o),c=s.split(".")[0];yr(c+".js"),yr(c+".ts"),yr(c+".jsx"),yr(c+".tsx"),_r(c),"react"===n?a?((n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=o.split(".")[0],c=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(i),l=s?((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport {\n lazy,\n Suspense,\n type ComponentType,\n type JSX,\n type LazyExoticComponent\n} from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { lazy, Suspense } from 'react'\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst cachedLazyComponents${e?": Record<\n string,\n LazyExoticComponent<ComponentType<unknown>>\n>":""} = {}\n\nconst getConfigFileName = ${e?"(pagePath: string): string":"(pagePath)"} => {\n if (pagePath.endsWith('.${e?"tsx":"jsx"}')) {\n return pagePath.slice(0, -4) + '.config.${e?"ts":"js"}'\n }\n return pagePath.replace('index.${e?"ts":"js"}', 'index.config.${e?"ts":"js"}')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: Record<string, ComponentType<unknown>>,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.${e?"ts":"js"}')) {\n const fileName = getBasename(configPath, '.config.${e?"ts":"js"}')\n if (fileName === 'index') {\n return configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"tsx":"jsx"}')\n }\n return configPath.slice(0, -10) + '.${e?"tsx":"jsx"}'\n }\n return configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"tsx":"jsx"}')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.${e?"ts":"js"}')) {\n const fileName = getBasename(configPath, '.config.${e?"ts":"js"}')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.${e?"ts":"js"}', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result${e?": Record<string, unknown>":""} = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result${e?": PagesComponentType":""} = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.${e?"tsx":"jsx"}')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nconst LazyComponent = ({\n Element\n}${e?": {\n Element: LazyExoticComponent<ComponentType<unknown>>\n}":""}) => {\n return (\n <Suspense>\n <Element />\n </Suspense>\n )\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}')${e?" as PagesComponentType":""}\n })\n\n const pagesString = getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', {\n eager: true\n })\n })${e?" as Record<string, ComponentType<unknown>>":""}\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesString, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n let Component${e?": MyRouteObject['element']":""}\n if (page?.element) {\n Component = page.element\n } else {\n if (!cachedLazyComponents[compPath]) {\n cachedLazyComponents[compPath] = lazy(pagesComponent[compPath])\n }\n\n Component = <LazyComponent Element={cachedLazyComponents[compPath]} />\n }\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: Component\n })\n }\n\n return result\n}\n`)(n,i):((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { ComponentType, JSX } from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst getConfigFileName = ${e?"(pagePath: string): string":"(pagePath)"} => {\n if (pagePath.endsWith('.${e?"tsx":"jsx"}')) {\n return pagePath.slice(0, -4) + '.config.${e?"ts":"js"}'\n }\n return pagePath.replace('index.${e?"ts":"js"}', 'index.config.${e?"ts":"js"}')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: PagesComponentType,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.${e?"ts":"js"}')) {\n const fileName = getBasename(configPath, '.config.${e?"ts":"js"}')\n if (fileName === 'index') {\n return configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"tsx":"jsx"}')\n }\n return configPath.slice(0, -10) + '.${e?"tsx":"jsx"}'\n }\n return configPath.replace('index.config.${e?"ts":"js"}', 'index.${e?"tsx":"jsx"}')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.${e?"ts":"js"}')) {\n const fileName = getBasename(configPath, '.config.${e?"ts":"js"}')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.${e?"ts":"js"}', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result${e?": PagesComponentType | Record<string, PageConfig>":""} = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default${e?" as ComponentType<unknown> | PageConfig":""}\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result${e?": PagesComponentType":""} = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.${e?"tsx":"jsx"}')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent(\n getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', { eager: true })\n })${e?" as PagesComponentType":""}\n )\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesComponent, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n const Component = pagesComponent[compPath]\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: <Component />\n })\n }\n\n return result\n}\n`)(n,i),p=(t=>`// Auto-generated by ono-auto-router\nimport { hasDuplicateProperty } from './utils'\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${t?"\nimport type { MyRouteObject } from './types'":""}\n\nconst processRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} =>\n cleanIsRoot(removeEmptyChildren(route))\n\nconst processRoutes = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} =>\n buildRouteTree(routes).map(processRoute)\n\nconst handleRootRoute = ${t?"(routes: (MyRouteObject & { isRoot?: boolean })[])":"(routes)"} => {\n let rootRoute${t?": MyRouteObject | undefined":" = undefined"}\n let homeRoute${t?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${t?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${t?": MyRouteObject[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const children = [\n homeRoute && { ...homeRoute, index: true },\n ...processRoutes(filteredRoutes)\n ].filter(${t?"(route): route is NonNullable<typeof route> => Boolean(route)":"Boolean"})\n\n const result${t?": MyRouteObject[]":""} = []\n\n if (rootRoute) {\n result.push(cleanIsRoot({ ...rootRoute, children }))\n }\n\n if (notFoundRoute) {\n result.push(cleanIsRoot(notFoundRoute))\n }\n\n return result\n}\n\nexport const formatRoutes = (\n routes${t?": (MyRouteObject & { isRoot?: boolean })[]":""}\n) => {\n if (routes.some(r => r.isRoot)) return handleRootRoute(routes)\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)\n}\n`)(i),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nconst processSingleRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (route.index) {\n return route\n }\n\n if (route.type !== 'wrap') {\n const { path: routePath, children, ...extraProps } = route\n const hasExtraProps = Object.keys(extraProps).length > 0\n\n if (hasExtraProps) {\n const indexRoute${t?": MyRouteObject":""} = {\n path: '',\n index: true,\n ...extraProps\n }\n\n return {\n path: routePath,\n children: [indexRoute, ...(children || []).map(processSingleRoute)]\n }\n }\n }\n\n if (route.children) {\n return {\n ...route,\n children: route.children.map(processSingleRoute)\n }\n }\n\n return route\n}\n\nconst formatRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n return routes.map(processSingleRoute)\n}\n\nconst buildTreeStructure = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const routeMap = new Map${t?"<string, MyRouteObject>":""}()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n const pathPartsCache = new Map${t?"<string, string[]>":""}()\n\n const getPathParts = ${t?"(pathStr: string): string[]":"(pathStr)"} => {\n let parts = pathPartsCache.get(pathStr)\n if (parts === undefined) {\n parts = pathStr === '/' ? [] : pathStr.split('/').filter(Boolean)\n pathPartsCache.set(pathStr, parts)\n }\n return parts\n }\n\n const sortedRoutes = routes\n .slice()\n .sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n const routePath = route.path\n const pathParts = getPathParts(routePath)\n const currentRoute = { ...route, children: [] }\n routeMap.set(routePath, currentRoute)\n\n if (pathParts.length <= 1) {\n rootRoutes.push(currentRoute)\n continue\n }\n\n const parentPath = '/' + pathParts.slice(0, -1).join('/')\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n currentRoute.path = pathParts[pathParts.length - 1]\n parentRoute.children${t?"!":""}.push(currentRoute)\n } else {\n rootRoutes.push(currentRoute)\n }\n }\n\n return rootRoutes\n}\n\nexport const buildRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const treeStructure = buildTreeStructure(routes)\n return formatRouteTree(treeStructure)\n}\n`)(i),f=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n\ntype RouteWithIsRoot = MyRouteObject & { isRoot?: boolean }\n":""}\nexport const cleanIsRoot = ${t?"(route: RouteWithIsRoot): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route${t?" as RouteWithIsRoot & {\n type?: unknown\n }":""}\n\n if (!children?.length) {\n return rest\n }\n\n return {\n ...rest,\n children: children.map(cleanIsRoot)\n }\n}\n`)(i),d=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n const { children } = route\n\n if (!children?.length) {\n const { children: _, ...rest } = route\n return rest\n }\n\n const processedChildren = children.map(removeEmptyChildren)\n\n if (route.type === 'wrap') {\n return { ...route, children: processedChildren }\n }\n\n const { path, element, type, children: _, ...rest } = route\n\n if (!element) {\n return { path, ...rest, children: processedChildren }\n }\n\n return {\n path,\n children: [\n { index: true, element, ...rest }${t?" as MyRouteObject":""},\n ...processedChildren\n ]\n }\n}\n`)(i),g=i?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\nexport const defineConfig = (config: PageConfig) => config\n":"",m=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { RouteObject } from 'react-router'":""}\nimport { createBaseRoutes } from './createBaseRoutes'\nimport { formatRoutes } from './formatRoutes'\n\nconst getRoutes = () => {\n const baseRoutes = createBaseRoutes()\n const formattedRoutes = formatRoutes(baseRoutes)${t?" as RouteObject[]":""}\n return formattedRoutes\n}\n\nexport const routes = getRoutes()\n`)(i),y=i?(t=>`// Auto-generated by ono-auto-router\nimport type { ComponentType } from 'react'\nimport type { RouteObject } from 'react-router'\n\n${t?"export type PagesComponentType = Record<\n string,\n () => Promise<{ default: ComponentType<unknown> }>\n>":"export type PagesComponentType = Record<string, ComponentType<unknown>>"}\n\nexport interface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<\n Omit<MyRouteObject, 'Component' | 'element' | 'children'>\n>\n`)(s):"",_=(t=>`// Auto-generated by ono-auto-router\nexport const hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nexport const replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n`)(i);Tr(t.resolve(u,"./index."+(i?"ts":"js")),c),Tr(t.resolve(u,"./createBaseRoutes."+(i?"tsx":"jsx")),l),Tr(t.resolve(u,"./formatRoutes."+(i?"ts":"js")),p),Tr(t.resolve(u,"./buildRouteTree."+(i?"ts":"js")),h),Tr(t.resolve(u,"./cleanIsRoot."+(i?"ts":"js")),f),Tr(t.resolve(u,"./removeEmptyChildren."+(i?"ts":"js")),d),g&&Tr(t.resolve(u,"./defineConfig.ts"),g),y&&Tr(t.resolve(u,"./types.ts"),y),Tr(t.resolve(u,"./getRoutes."+(i?"ts":"js")),m),Tr(t.resolve(u,"./utils."+(i?"ts":"js")),_)})(r,o,s,i,u):gr(r,o,s,i,u):mr(r,o,s,u)},exports.generateVueRoutesTemplate=function(t,e,n){const r=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\nimport { createRouter, createWebHistory } from 'vue-router'\n${e.join("\n")}\n${r}\n\nexport const routes = ${JSON.stringify(t,null,2)}\n\nexport const router = createRouter({\n history: createWebHistory(import.meta.env.BASE_URL),\n routes\n})\n\nexport default router\n`},exports.getDefaultExportContent=Rr,exports.getRelativePath=br,exports.getRelativeProjectPath=vr,exports.hasDefaultExport=Er,exports.hasDuplicateProperty=Ar,exports.normalizePathWithWindows=Sr,exports.removeCustomTagFunctionFromJSXAll=$r,exports.replaceBracketsWithColon=Or,exports.useTs=p,exports.writeFile=Tr,exports.writeFileSync=function(n,r){wr(t.dirname(n)),e.writeFileSync(n,r,"utf-8")};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core-Nna-MKEw.js");exports.INDEX_JS_SUFFIX=e.INDEX_JS_SUFFIX,exports.INDEX_TS_SUFFIX=e.INDEX_TS_SUFFIX,exports.capitalize=e.capitalize,exports.convertFunctionToArrow=e.convertFunctionToArrow,exports.deleteDir=e.deleteDir,exports.deleteFile=e.deleteFile,exports.ensureDirSync=e.ensureDirSync,exports.formatFunction=e.formatFunction,exports.formatPagesDir=e.formatPagesDir,exports.formatRoutesFile=e.formatRoutesFile,exports.generateComponentName=e.generateComponentName,exports.generateRoutesTemplate=e.generateRoutesTemplate,exports.generateUniqueComponentName=e.generateUniqueComponentName,exports.getDefaultExportContent=e.getDefaultExportContent,exports.getRelativePath=e.getRelativePath,exports.getRelativeProjectPath=e.getRelativeProjectPath,exports.hasDefaultExport=e.hasDefaultExport,exports.hasDuplicateProperty=e.hasDuplicateProperty,exports.normalizePathWithWindows=e.normalizePathWithWindows,exports.removeCustomTagFunctionFromJSXAll=e.removeCustomTagFunctionFromJSXAll,exports.replaceBracketsWithColon=e.replaceBracketsWithColon,exports.useTs=e.useTs,exports.writeFile=e.writeFile,exports.writeFileSync=e.writeFileSync;
package/dist/utils.d.ts CHANGED
@@ -1,67 +1,49 @@
1
- declare function convertFunctionToArrow(str: string): string;
2
-
3
- declare const formatRoutesFile: (framework: "react" | "vue", projectRoot: string, routesFile?: string) => string;
4
-
5
- declare const generateRoutesTemplate: (framework: "react" | "vue", pagesDir: string, projectRoot: string, routesPath: string, lazy: boolean, hmr: boolean) => void;
6
-
7
- /**
8
- * 获取文件的默认导出内容
9
- */
10
- declare function getDefaultExportContent(filePath: string): any;
11
-
12
- /**
13
- * 计算从当前路径到目标路径的相对路径
14
- * @param currentPath 当前路径
15
- * @param targetPath 目标路径
16
- * @returns 从当前路径到目标路径的相对路径
17
- * @example
18
- * getRelativePath('/a/b/c', '/a/d/e') // 返回 '../../d/e'
19
- * getRelativePath('/a/b', '/a/b/c') // 返回 'c'
20
- */
21
- declare function getRelativePath(currentPath: string, targetPath: string): string;
22
-
23
- /**
24
- * 获取相对于项目根目录的路径
25
- */
26
- declare const getRelativeProjectPath: (filePath: string, projectRoot: string) => string;
27
-
28
- /**
29
- * 检查文件是否有默认导出
30
- */
31
- declare function hasDefaultExport(filePath: string): boolean;
32
-
33
- declare const hasDuplicateProperty: <T>(items: T[], propName: keyof T) => boolean;
34
-
35
- /**
36
- * 规范化路径,将 Windows 反斜杠转换为正斜杠
37
- */
38
- declare const normalizePathWithWindows: (filePath: string) => string;
39
-
40
- declare function removeCustomTagFunctionFromJSXAll(str: string): string;
41
-
42
- declare const replaceBracketsWithColon: (str: string, useTs: boolean) => string;
43
-
44
- declare const useTs: (projectRoot: string) => boolean;
45
-
46
- /**
47
- * 确保目录存在,不存在则递归创建
48
- */
49
- declare function ensureDirSync(dirPath: string): void;
50
- /**
51
- * 同步写入文件(自动创建目录)
52
- */
53
- declare function writeFileSync(filePath: string, content: string): void;
54
- /**
55
- * 异步写入文件(自动创建目录)
56
- */
57
- declare function writeFile(filePath: string, content: string): Promise<void>;
58
-
59
- declare const deleteFile: (filePath: string) => void;
60
- declare const deleteDir: (dirPath: string) => void;
61
-
62
- /**
63
- * 生成 Vue 路由文件内容
64
- */
65
- declare function generateVueRoutesTemplate(routes: unknown[], importList: string[], componentList: string[]): string;
66
-
67
- export { convertFunctionToArrow, deleteDir, deleteFile, ensureDirSync, formatRoutesFile, generateRoutesTemplate, generateVueRoutesTemplate, getDefaultExportContent, getRelativePath, getRelativeProjectPath, hasDefaultExport, hasDuplicateProperty, normalizePathWithWindows, removeCustomTagFunctionFromJSXAll, replaceBracketsWithColon, useTs, writeFile, writeFileSync };
1
+ export declare const capitalize: (str: string) => string;
2
+
3
+ export declare function convertFunctionToArrow(str: string): string;
4
+
5
+ export declare const deleteDir: (dirPath: string) => void;
6
+
7
+ export declare const deleteFile: (filePath: string) => void;
8
+
9
+ export declare function ensureDirSync(dirPath: string): void;
10
+
11
+ export declare const formatFunction: <T extends Record<string, any>>(filePath: string, content: T, cachedFunctions: Map<string, string>) => Record<string, any>;
12
+
13
+ export declare const formatPagesDir: (pagesDir: string) => string;
14
+
15
+ export declare const formatRoutesFile: (framework: "react" | "vue", projectRoot: string, routesFile?: string) => string;
16
+
17
+ export declare function generateComponentName(filePath: string): string;
18
+
19
+ export declare const generateRoutesTemplate: (framework: "react" | "vue", pagesDir: string, projectRoot: string, routesFile: string | undefined, lazy: boolean, hmr: boolean) => void;
20
+
21
+ export declare const generateUniqueComponentName: (baseName: string, componentNames: Set<string>) => string;
22
+
23
+ export declare function getDefaultExportContent(filePath: string): any;
24
+
25
+ export declare function getRelativePath(currentPath: string, targetPath: string): string;
26
+
27
+ export declare const getRelativeProjectPath: (filePath: string, projectRoot: string) => string;
28
+
29
+ export declare function hasDefaultExport(filePath: string): boolean;
30
+
31
+ export declare const hasDuplicateProperty: <T>(items: T[], propName: keyof T) => boolean;
32
+
33
+ export declare const INDEX_JS_SUFFIX = "index.js";
34
+
35
+ export declare const INDEX_TS_SUFFIX = "index.ts";
36
+
37
+ export declare const normalizePathWithWindows: (filePath: string) => string;
38
+
39
+ export declare function removeCustomTagFunctionFromJSXAll(str: string): string;
40
+
41
+ export declare const replaceBracketsWithColon: (str: string, useTs: boolean, framework: "react" | "vue") => string;
42
+
43
+ export declare const useTs: (projectRoot: string) => boolean;
44
+
45
+ export declare function writeFile(filePath: string, content: string): Promise<void>;
46
+
47
+ export declare function writeFileSync(filePath: string, content: string): void;
48
+
49
+ export { }