@onoxm/vite-plugin-auto-router 0.1.5 → 0.2.1

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"}},f=(e,n,r)=>{let o=r;return o||(o=t.resolve(n,h[e][p(n)?"ts":"js"])),o};var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var m,y={},_={},R={};function b(){if(m)return R;return m=1,Object.defineProperty(R,"__esModule",{value:!0}),R.splitWhen=R.flatten=void 0,R.flatten=function(t){return t.reduce((t,e)=>[].concat(t,e),[])},R.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},R}var S,P={};function v(){if(S)return P;return S=1,Object.defineProperty(P,"__esModule",{value:!0}),P.isEnoentCodeError=void 0,P.isEnoentCodeError=function(t){return"ENOENT"===t.code},P}var E,x={};var A,C={};function $(){if(A)return C;A=1,Object.defineProperty(C,"__esModule",{value:!0}),C.convertPosixPathToPattern=C.convertWindowsPathToPattern=C.convertPathToPattern=C.escapePosixPath=C.escapeWindowsPath=C.escape=C.removeLeadingDotSegment=C.makeAbsolute=C.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 C.unixify=function(t){return t.replace(/\\/g,"/")},C.makeAbsolute=function(e,n){return t.resolve(e,n)},C.removeLeadingDotSegment=function(t){if("."===t.charAt(0)){const e=t.charAt(1);if("/"===e||"\\"===e)return t.slice(2)}return t},C.escape=e?u:c,C.escapeWindowsPath=u,C.escapePosixPath=c,C.convertPathToPattern=e?l:p,C.convertWindowsPathToPattern=l,C.convertPosixPathToPattern=p,C}var w,O,T,k,j,M,L={};function H(){return O?w:(O=1,w=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 F(){if(k)return T;k=1;var t=H(),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 T=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 D(){if(M)return j;M=1;var t=F(),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 N,I,B,W,G,U,K,V,q,Q,z,X,Y,Z,J,tt,et,nt,rt,ot={};function st(){return N||(N=1,(t=ot).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}),ot;var t}function it(){if(B)return I;B=1;const t=st();return I=(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 at(){return G?W:(G=1,W=function(t){return"number"==typeof t?t-t===0:"string"==typeof t&&""!==t.trim()&&(Number.isFinite?Number.isFinite(+t):isFinite(+t))})}function ut(){if(K)return U;K=1;const t=at(),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={},U=e}function ct(){if(q)return V;q=1;const t=o,e=ut(),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:[]},S=t=>b[t<0?"negatives":"positives"].push(Math.abs(t)),P=[],v=0;for(;h?o>=s:o<=s;)!0===r.toRegex&&n>1?S(o):P.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(P,null,{wrap:!1,...r}):P},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 V=d}function lt(){if(et)return tt;et=1;const t=it(),{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}=J?Z:(J=1,Z={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 tt=(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:[]},S=[b];let P=b,v=b,E=0;const x=m.length;let A,C=0,$=0;const w=()=>m[C++],O=t=>{if("text"===t.type&&"dot"===v.type&&(v.type="text"),!v||"text"!==v.type||"text"!==t.type)return P.nodes.push(t),t.parent=P,t.prev=v,v=t,t;v.value+=t.value};for(O({type:"bos"});C<x;)if(P=S[S.length-1],A=w(),A!==g&&A!==d)if(A!==n)if(A!==p){if(A===l){let t;for(E++;C<x&&(t=w());)if(A+=t,t!==l)if(t!==n){if(t===p&&(E--,0===E))break}else A+=w();else E++;O({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<x&&(e=w());)if(e!==n){if(e===t){!0===y.keepQuotes&&(A+=e);break}A+=e}else A+=e+w();O({type:"text",value:A});continue}if(A===u){$++;const t=v.value&&"$"===v.value.slice(-1)||!0===P.dollar;P=O({type:"brace",open:!0,close:!1,dollar:t,depth:$,commas:0,ranges:0,nodes:[]}),S.push(P),O({type:"open",value:A});continue}if(A===c){if("brace"!==P.type){O({type:"text",value:A});continue}const t="close";P=S.pop(),P.close=!0,O({type:t,value:A}),$--,P=S[S.length-1];continue}if(A===o&&$>0){if(P.ranges>0){P.ranges=0;const e=P.nodes.shift();P.nodes=[e,{type:"text",value:t(P)}]}O({type:"comma",value:A}),P.commas++}else{if(A===s&&$>0&&0===P.commas){const t=P.nodes;if(0===$||0===t.length){O({type:"text",value:A});continue}if("dot"===v.type){if(P.range=[],v.value+=A,v.type="range",3!==P.nodes.length&&5!==P.nodes.length){P.invalid=!0,P.ranges=0,v.type="text";continue}P.ranges++,P.args=[];continue}if("range"===v.type){t.pop();const e=t[t.length-1];e.value+=v.value+A,v=e,P.ranges--;continue}O({type:"dot",value:A});continue}O({type:"text",value:A})}}else{if("paren"!==P.type){O({type:"text",value:A});continue}P=S.pop(),O({type:"text",value:A}),P=S[S.length-1]}else P=O({type:"paren",nodes:[]}),S.push(P),O({type:"text",value:A})}else O({type:"text",value:"\\"+A});else O({type:"text",value:(y.keepEscaping?A:"")+w()});do{if(P=S.pop(),"root"!==P.type){P.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=S[S.length-1],e=t.nodes.indexOf(P);t.nodes.splice(e,1,...P.nodes)}}while(S.length>0);return O({type:"eos"}),b}}function pt(){if(rt)return nt;rt=1;const t=it(),e=function(){if(z)return Q;z=1;const t=ct(),e=st();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(Y)return X;Y=1;const t=ct(),e=it(),n=st(),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 X=(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))},X}(),r=lt(),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),nt=o}var ht,ft,dt,gt,mt,yt,_t,Rt,bt,St,Pt,vt,Et,xt,At={};function Ct(){if(ft)return ht;ft=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 ht={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 $t(){return dt||(dt=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}=Ct();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}}(At)),At}function wt(){if(bt)return Rt;bt=1;const t=r,e=function(){if(mt)return gt;mt=1;const t=$t(),{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}=Ct(),m=t=>t===a||t===r,y=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};return gt=(_,R)=>{const b=R||{},S=_.length-1,P=!0===b.parts||!0===b.scanToEnd,v=[],E=[],x=[];let A,C,$=_,w=-1,O=0,T=0,k=!1,j=!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=()=>w>=S,K=()=>$.charCodeAt(w+1),V=()=>(A=C,$.charCodeAt(++w));for(;w<S;){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(k=G.isBrace=!0,M=G.isGlob=!0,B=!0,!0===P)continue;break}if(!0!==F&&C===o){if(k=G.isBrace=!0,M=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===f&&(W--,0===W)){F=!1,k=G.isBrace=!0,B=!0;break}}else W++;else D=G.backslashes=!0,V();if(!0===P)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&&w===O&&(I=!0),!0===P){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===P)continue;break}if(C===h){if(M=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===l){for(;!0!==U()&&(t=V());)if(t!==r){if(t===g){j=G.isBracket=!0,M=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,V();if(!0===P)continue;break}if(!0===b.nonegate||C!==i||w!==O){if(!0!==b.noparen&&C===c){if(M=G.isGlob=!0,!0===P){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===P)continue;break}}else N=G.negated=!0,O++}else{if(v.push(w),E.push(G),G={value:"",depth:0,isGlob:!1},!0===B)continue;if(A===s&&w===O+1){O+=2;continue}T=w+1}}else D=G.backslashes=!0,C=V(),C===u&&(F=!0)}!0===b.noext&&(L=!1,M=!1);let q=$,Q="",z="";O>0&&(Q=$.slice(0,O),$=$.slice(O),T-=O),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:O,base:q,glob:z,isBrace:k,isBracket:j,isGlob:M,isExtglob:L,isGlobstar:H,negated:N,negatedExtglob:I};if(!0===b.tokens&&(X.maxDepth=0,m(C)||E.push(G),X.tokens=E),!0===b.parts||!0===b.tokens){let t;for(let e=0;e<v.length;e++){const n=t?t+1:O,r=v[e],o=_.slice(n,r);b.tokens&&(0===e&&0!==O?(E[e].isPrefix=!0,E[e].value=Q):E[e].value=o,y(E[e]),X.maxDepth+=E[e].depth),0===e&&""===o||x.push(o),t=r}if(t&&t+1<_.length){const e=_.slice(t+1);x.push(e),b.tokens&&(E[E.length-1].value=e,y(E[E.length-1]),X.maxDepth+=E[E.length-1].depth)}X.slashes=v,X.parts=x}return X},gt}(),n=function(){if(_t)return yt;_t=1;const t=Ct(),e=$t(),{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:S,PLUS_LITERAL:P,SLASH_LITERAL:v,ONE_CHAR:E,DOTS_SLASH:x,NO_DOT:A,NO_DOT_SLASH:C,NO_DOTS_SLASH:$,QMARK:w,QMARK_NO_DOT:O,STAR:T,START_ANCHOR:k}=R,j=t=>`(${y}(?:(?!${k}${t.dot?x:S}).)*?)`,M=h.dot?"":A,L=h.dot?w:O;let H=!0===h.bash?j(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?"":E}),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=j(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?w.repeat(s.length):""):0===i?L+(s?w.repeat(s.length):""):w.repeat(r.length):"."===o?S.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=E);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=S);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:S});continue}Z({type:"dot",value:B,output:S});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:O});continue}Z({type:"qmark",value:B,output:w});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:P});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:P});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=j(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=j(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=`${j(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}|${j(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=j(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+=E,W.output+=E)),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,S=s.capture?"":"?:";let P=!0===s.bash?".*?":y;s.capture&&(P=`(${P})`);const v=t=>!0===t.noglobstar?P:`(${S}(?:(?!${_}${t.dot?f:l}).)*?)`,E=t=>{switch(t){case"*":return`${R}${h}${P}`;case".*":return`${l}${h}${P}`;case"*.*":return`${R}${P}${l}${h}${P}`;case"*/*":return`${R}${P}${p}${h}${b}${P}`;case"**":return R+v(s);case"**/*":return`(?:${R}${v(s)}${p})?${b}${h}${P}`;case"**/*.*":return`(?:${R}${v(s)}${p})?${b}${P}${l}${h}${P}`;case"**/.*":return`(?:${R}${v(s)}${p})?${l}${h}${P}`;default:{const e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;const n=E(e[1]);if(!n)return;return n+l+e[2]}}},x=e.removePrefix(r,{negated:!1,prefix:""});let A=E(x);return A&&!0!==s.strictSlashes&&(A+=`${p}?`),A},yt=c}(),o=$t(),s=Ct(),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,Rt=i}function Ot(){return Pt?St:(Pt=1,St=wt())}function Tt(){if(xt)return L;xt=1,Object.defineProperty(L,"__esModule",{value:!0}),L.isAbsolute=L.partitionAbsoluteAndRelative=L.removeDuplicateSlashes=L.matchAny=L.convertPatternsToRe=L.makeRe=L.getPatternParts=L.expandBraceExpansion=L.expandPatternsWithBraceExpansion=L.isAffectDepthOfReadingPattern=L.endsWithSlashGlobStar=L.hasGlobStar=L.getBaseDirectory=L.isPatternRelatedToParentDirectory=L.getPatternsOutsideCurrentDirectory=L.getPatternsInsideCurrentDirectory=L.getPositivePatterns=L.getNegativePatterns=L.isPositivePattern=L.isNegativePattern=L.convertToNegativePattern=L.convertToPositivePattern=L.isDynamicPattern=L.isStaticPattern=void 0;const t=r,e=D(),n=function(){if(Et)return vt;Et=1;const t=o,e=pt(),n=Ot(),r=$t(),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,vt=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 L.isStaticPattern=p,L.isDynamicPattern=h,L.convertToPositivePattern=function(t){return f(t)?t.slice(1):t},L.convertToNegativePattern=function(t){return"!"+t},L.isNegativePattern=f,L.isPositivePattern=d,L.getNegativePatterns=function(t){return t.filter(f)},L.getPositivePatterns=function(t){return t.filter(d)},L.getPatternsInsideCurrentDirectory=function(t){return t.filter(t=>!g(t))},L.getPatternsOutsideCurrentDirectory=function(t){return t.filter(g)},L.isPatternRelatedToParentDirectory=g,L.getBaseDirectory=function(t){return e(t,{flipBackslashes:!1})},L.hasGlobStar=function(t){return t.includes("**")},L.endsWithSlashGlobStar=m,L.isAffectDepthOfReadingPattern=function(e){const n=t.basename(e);return m(e)||p(n)},L.expandPatternsWithBraceExpansion=function(t){return t.reduce((t,e)=>t.concat(y(e)),[])},L.expandBraceExpansion=y,L.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},L.makeRe=_,L.convertPatternsToRe=function(t,e){return t.map(t=>_(t,e))},L.matchAny=function(t,e){return e.some(e=>e.test(t))},L.removeDuplicateSlashes=function(t){return t.replace(l,"/")},L.partitionAbsoluteAndRelative=function(t){const e=[],n=[];for(const r of t)R(r)?e.push(r):n.push(r);return[e,n]},L.isAbsolute=R,L}var kt,jt,Mt,Lt={};function Ht(){if(jt)return kt;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 kt=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},kt}var Ft,Dt,Nt,It={};function Bt(){if(Ft)return It;return Ft=1,Object.defineProperty(It,"__esModule",{value:!0}),It.isEmpty=It.isString=void 0,It.isString=function(t){return"string"==typeof t},It.isEmpty=function(t){return""===t},It}function Wt(){if(Dt)return _;Dt=1,Object.defineProperty(_,"__esModule",{value:!0}),_.string=_.stream=_.pattern=_.path=_.fs=_.errno=_.array=void 0;const t=b();_.array=t;const e=v();_.errno=e;const n=function(){if(E)return x;E=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}();_.fs=n;const r=$();_.path=r;const o=Tt();_.pattern=o;const s=function(){if(Mt)return Lt;Mt=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.merge=void 0;const t=Ht();function e(t){t.forEach(t=>t.emit("close"))}return Lt.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},Lt}();_.stream=s;const i=Bt();return _.string=i,_}var Gt,Ut={},Kt={},Vt={},qt={},Qt={},zt={},Xt={},Yt={},Zt={};function Jt(){if(Gt)return Zt;function t(t,e){t(e)}function e(t,e){t(null,e)}return Gt=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.read=void 0,Zt.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)})},Zt}var te,ee={};var ne,re,oe,se,ie,ae,ue,ce={},le={};function pe(){if(re)return ce;re=1,Object.defineProperty(ce,"__esModule",{value:!0});const t=(ne||(ne=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)}}(le)),le);return ce.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}},ce}function he(){if(oe)return Yt;oe=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.statSync=Yt.stat=Yt.Settings=void 0;const t=Jt(),e=(te||(te=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.read=void 0,ee.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}}),ee),n=pe();function r(t={}){return t instanceof n.default?t:new n.default(t)}return Yt.Settings=n.default,Yt.stat=function(e,n,o){"function"!=typeof n?t.read(e,r(n),o):t.read(e,r(),n)},Yt.statSync=function(t,n){const o=r(n);return e.read(t,o)},Yt}function fe(){if(ie)return se;let t;return ie=1,se="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:d):e=>(t||(t=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))}var de,ge={};function me(){if(de)return ge;de=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.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 ge.IS_SUPPORT_READDIR_WITH_FILE_TYPES=r||o,ge}var ye,_e,Re={},be={};function Se(){if(_e)return Re;_e=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.fs=void 0;const t=function(){if(ye)return be;ye=1,Object.defineProperty(be,"__esModule",{value:!0}),be.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 be.createDirentFromStats=function(e,n){return new t(e,n)},be}();return Re.fs=t,Re}var Pe,ve,Ee={};function xe(){if(Pe)return Ee;return Pe=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.joinPathSegments=void 0,Ee.joinPathSegments=function(t,e,n){return t.endsWith(n)?t+e:t+n+e},Ee}function Ae(){if(ve)return Xt;ve=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.readdir=Xt.readdirWithFileTypes=Xt.read=void 0;const t=he(),e=function(){if(ue)return ae;ue=1,ae=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=fe();return ae}(),n=me(),r=Se(),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 Xt.read=function(t,e,r){e.stats||!n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?i(t,e,r):s(t,e,r)},Xt.readdirWithFileTypes=s,Xt.readdir=i,Xt}var Ce,$e={};var we,Oe,Te,ke={},je={};function Me(){return we||(we=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 Le(){if(Te)return zt;Te=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.Settings=zt.scandirSync=zt.scandir=void 0;const t=Ae(),e=function(){if(Ce)return $e;Ce=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.readdir=$e.readdirWithFileTypes=$e.read=void 0;const t=he(),e=me(),n=Se(),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 $e.read=function(t,n){return!n.stats&&e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(t,n):s(t,n)},$e.readdirWithFileTypes=o,$e.readdir=s,$e}(),n=function(){if(Oe)return ke;Oe=1,Object.defineProperty(ke,"__esModule",{value:!0});const t=r,e=he(),n=Me();return ke.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}},ke}();function o(t={}){return t instanceof n.default?t:new n.default(t)}return zt.Settings=n.default,zt.scandir=function(e,n,r){"function"!=typeof n?t.read(e,o(n),r):t.read(e,o(),n)},zt.scandirSync=function(t,n){const r=o(n);return e.read(t,r)},zt}var He,Fe,De,Ne={exports:{}};function Ie(){if(De)return Ne.exports;De=1;var t=Fe?He:(Fe=1,He=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 Ne.exports=e,Ne.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},Ne.exports}var Be,We={};function Ge(){if(Be)return We;return Be=1,Object.defineProperty(We,"__esModule",{value:!0}),We.joinPathSegments=We.replacePathSegmentSeparator=We.isAppliedFilter=We.isFatalError=void 0,We.isFatalError=function(t,e){return null===t.errorFilter||!t.errorFilter(e)},We.isAppliedFilter=function(t,e){return null===t||t(e)},We.replacePathSegmentSeparator=function(t,e){return t.split(/[/\\]/).join(e)},We.joinPathSegments=function(t,e,n){return""===t?e:t.endsWith(n)?t+e:t+n+e},We}var Ue,Ke,Ve,qe={};function Qe(){if(Ue)return qe;Ue=1,Object.defineProperty(qe,"__esModule",{value:!0});const t=Ge();return qe.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}},qe}function ze(){if(Ke)return Qt;Ke=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=i,e=Le(),n=Ie(),r=Ge(),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 Xe,Ye={};var Ze,Je,tn={},en={};function nn(){if(Je)return tn;Je=1,Object.defineProperty(tn,"__esModule",{value:!0});const t=function(){if(Ze)return en;Ze=1,Object.defineProperty(en,"__esModule",{value:!0});const t=Le(),e=Ge(),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 en.default=r,en}();return tn.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()}},tn}var rn,on,sn={};function an(){if(on)return Vt;on=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.Settings=Vt.walkStream=Vt.walkSync=Vt.walk=void 0;const t=function(){if(Ve)return qt;Ve=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=ze();return qt.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()}},qt}(),e=function(){if(Xe)return Ye;Xe=1,Object.defineProperty(Ye,"__esModule",{value:!0});const t=s,e=ze();return Ye.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}},Ye}(),n=nn(),o=function(){if(rn)return sn;rn=1,Object.defineProperty(sn,"__esModule",{value:!0});const t=r,e=Le();return sn.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}},sn}();function i(t={}){return t instanceof o.default?t:new o.default(t)}return Vt.Settings=o.default,Vt.walk=function(e,n,r){"function"!=typeof n?new t.default(e,i(n)).read(r):new t.default(e,i()).read(n)},Vt.walkSync=function(t,e){const r=i(e);return new n.default(t,r).read()},Vt.walkStream=function(t,n){const r=i(n);return new e.default(t,r).read()},Vt}var un,cn={};function ln(){if(un)return cn;un=1,Object.defineProperty(cn,"__esModule",{value:!0});const t=r,e=he(),n=Wt();return cn.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}},cn}var pn,hn,fn={};function dn(){if(pn)return fn;pn=1,Object.defineProperty(fn,"__esModule",{value:!0});const t=s,e=he(),n=an(),r=ln();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 fn.default=o,fn}var gn,mn,yn,_n={},Rn={},bn={},Sn={};function Pn(){if(mn)return bn;mn=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=function(){if(gn)return Sn;gn=1,Object.defineProperty(Sn,"__esModule",{value:!0});const t=Wt();return Sn.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))}},Sn}();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 bn.default=e,bn}var vn,En={};var xn,An={};var Cn,$n,wn,On={};function Tn(){if($n)return _n;$n=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=r,e=function(){if(yn)return Rn;yn=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=Wt(),e=Pn();return Rn.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)}},Rn}(),n=function(){if(vn)return En;vn=1,Object.defineProperty(En,"__esModule",{value:!0});const t=Wt();return En.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}},En}(),o=function(){if(xn)return An;xn=1,Object.defineProperty(An,"__esModule",{value:!0});const t=Wt();return An.default=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}},An}(),s=function(){if(Cn)return On;Cn=1,Object.defineProperty(On,"__esModule",{value:!0});const t=Wt();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 _n.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}}},_n}function kn(){if(wn)return Ut;wn=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=function(){if(hn)return Kt;hn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=an(),e=ln(),n=dn();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 Kt.default=r,Kt}(),e=Tn();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 Ut.default=n,Ut}var jn,Mn={};var Ln,Hn,Fn={},Dn={};function Nn(){if(Hn)return Fn;Hn=1,Object.defineProperty(Fn,"__esModule",{value:!0});const t=function(){if(Ln)return Dn;Ln=1,Object.defineProperty(Dn,"__esModule",{value:!0});const t=he(),e=an(),n=ln();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 Dn.default=r,Dn}(),e=Tn();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 Fn.default=n,Fn}var In,Bn,Wn,Gn={};var Un=function(){if(Wn)return Bn;Wn=1;const t=function(){if(Nt)return y;Nt=1,Object.defineProperty(y,"__esModule",{value:!0}),y.convertPatternGroupToTask=y.convertPatternGroupsToTasks=y.groupPatternsByBaseDirectory=y.getNegativePatternsAsPositive=y.getPositivePatterns=y.convertPatternsToTasks=y.generate=void 0;const t=Wt();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 y.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)},y.convertPatternsToTasks=n,y.getPositivePatterns=r,y.getNegativePatternsAsPositive=o,y.groupPatternsByBaseDirectory=s,y.convertPatternGroupsToTasks=i,y.convertPatternGroupToTask=a,y}(),e=kn(),r=function(){if(jn)return Mn;jn=1,Object.defineProperty(Mn,"__esModule",{value:!0});const t=s,e=dn(),n=Tn();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 Mn.default=r,Mn}(),o=Nn(),i=(In||(In=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)}}}(Gn)),Gn),u=Wt();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={})),Bn=c}(),Kn=g(Un);const Vn={"/home":"/","/root":"/"},qn=(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=Vn[t];if(e)return e;return"/notfound"===t.toLowerCase()||"/404"===t?"/*":t},zn=(t,e)=>{if(t.endsWith(".config."+(e?"ts":"js"))){return"index"===qn(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"))},Xn=(t,e)=>{if(t.endsWith(".config."+(e?"ts":"js"))){const n=qn(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"),"")||"/"},Yn=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=zn(o,n);if(!t[e])continue;const i=s?.path||Xn(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},Zn=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(Zn)]}}}return t.children?{...t,children:t.children.map(Zn)}:t},Jn=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(Zn))(e)},tr=t=>{const{isRoot:e,type:n,children:r,...o}=t;return r?.length?{...o,children:r.map(tr)}:o},er=t=>{const{children:e}=t;if(!e?.length){const{children:e,...n}=t;return n}const n=e.map(er);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}},nr=t=>tr(er(t)),rr=t=>Jn(t).map(nr),or=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(Cr(o,"path"))throw new Error("There cannot be duplicate paths in a route");const s=[n&&{...n,index:!0},...rr(o)].filter(t=>Boolean(t)),i=[];return e&&i.push(tr({...e,children:s})),r&&i.push(tr(r)),i})(t);if(Cr(t,"path"))throw new Error("There cannot be duplicate paths in a route");return rr(t)},sr=(t,e)=>({import:`import ${t} from './${e}'`,component:`<start><${t} /></end>`,lazy:`const ${t} = lazy(() => import('${e}'))`,lazyComponent:`<start><Suspense><${t} /></Suspense></end>`});const ir=/[/\\]/,ar=/[^a-zA-Z0-9]/g,ur=/^(\d)/,cr="index.tsx",lr="index.jsx",pr=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";function hr(e){const n=t.extname(e),r=t.basename(e,n),o=t.dirname(e).split(ir).filter(Boolean);"index"!==r&&"Index"!==r&&o.push(r);return o.map(t=>{const e=(t=>t.replace(ar,"_").replace(ur,"_$1"))(t);return e.split("_").map(pr).join("")}).join("")||"Component"}const fr=(t,e,n,r,o,s,i)=>{const a=((t,e)=>t.includes(e?cr:lr)?t.replace(e?cr:lr,e?"index.ts":"index.js"):t)(Er(t,e),i),u=vr(Sr(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}`})(hr(u),s),l=`element(${u})`;r[`/${a}`]=l,o.set(l,{path:u,componentName:c})},dr=(t,e,n,r)=>{const o=Er(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,br(t),r)};function gr(t,e,n,r,o,s,i,a,u){const c={},l=t.replace(/^\/+/,""),p=Kn.sync(l,{cwd:e,absolute:!0,onlyFiles:!0}).filter(Ar);for(const t of p)if("module"===o){if(t.includes(".config."))continue;fr(t,n,r,c,s,i,u)}else dr(t,n,c,a);return c}const mr=async(t,e,n,r,o)=>{const s=new Map,i=new Set,a=new Map,u=gr("/**/*.{jsx,tsx}",t,e,n,"module",s,i,a,o),c=gr("/**/*.config.{js,ts,jsx,tsx}",t,e,n,"config",s,i,a,o),l=await Yn(u,c,o),p=((t,e,n,r)=>{let o=t;for(const[t,n]of e){const e=sr(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 wr(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`}(or(l),((t,e)=>{if(t)return["import { lazy, Suspense } from 'react'"];const n=[];for(const t of e.values())n.push(sr(t.componentName,t.path).import);return n})(r,s),((t,e)=>{if(!t)return[];const n=[];for(const t of e.values())n.push(sr(t.componentName,t.path).lazy);return n})(r,s),o),s,a,r);kr(n,p)},yr=(e,n,r,o)=>{const s=n.split(".")[0],i=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './autoRouter'\n`)(r),a=((t,e,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?"":", { eager: true, import: 'default' }"}),\n ...import.meta.glob('/${t}/*.vue'${n?"":", { eager: true, import: 'default' }"})\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 & { isRoot?: boolean })[]":""} = []\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\nconst 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`)(e,r,o),u=(t=>`\nconst 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`)(r),c=(t=>`\nconst 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`)(r),l=(t=>`\nconst 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`)(r),p=r?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './autoRouter'\n\nexport const defineConfig = (config: PageConfig) => config\n":"",h=r?"\nimport type { RouteRecordRaw } from 'vue-router'\n\ntype PagesComponentType = Record<string, () => Promise<unknown>>\n\ninterface MyRouteObject extends Omit<RouteRecordRaw, 'children'> {\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<Omit<MyRouteObject, 'component' | 'children'>>\n":"",f=(t=>`\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`)(r),d=((t,e,n,r,o,s,i)=>`// Auto-generated by ono-auto-router${t}${e}${n}${r}${o}${s}${i}\n`)(h,f,l,c,u,a,"\nexport const routes = createRoutes()");r?(kr(t.resolve(s,"./index.ts"),i),kr(t.resolve(s,"./autoRouter.ts"),d),kr(t.resolve(s,"./defineConfig.ts"),p)):kr(n,d)},_r=t=>{try{if(!e.existsSync(t))return;e.unlinkSync(t)}catch(t){console.error("删除文件失败:",t)}},Rr=t=>{try{if(!e.existsSync(t))return;e.rmSync(t,{recursive:!0})}catch(t){console.error("删除目录失败:",t)}};function br(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 Sr(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,vr=t=>t.replace(Pr,"/"),Er=(e,n)=>vr(t.relative(n,e)),xr=/export\s+default\s+[\w(\[\]\{\})]+/;function Ar(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 Cr=(t,e)=>{const n=new Set;return t.some(t=>!!n.has(t[e])||(n.add(t[e]),!1))};function $r(t){return t.replace(/"<start>([\s\S]*?)<\/end>"/g,"$1")}function wr(t){let e=t;for(;;){const t=$r(e);if(t===e)break;e=t}return e}const Or=(t,e)=>t.replace(/\[([^\]]+)\]/g,":$1").replace(e?".tsx":".jsx","");function Tr(t){e.existsSync(t)||e.mkdirSync(t,{recursive:!0})}async function kr(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=Rr,exports.deleteFile=_r,exports.ensureDirSync=Tr,exports.formatRoutesFile=f,exports.generateRoutesTemplate=(n,r,o,s,i,a)=>{const u=t.resolve(o,r);if(!e.existsSync(u))throw new Error(`Pages directory not found: ${u}`);const c=f(n,o,s),l=p(o),h=c.split(".")[0];_r(h+".js"),_r(h+".ts"),_r(h+".jsx"),_r(h+".tsx"),Rr(h),"react"===n?a?((e,n,r,o)=>{const s=n.split(".")[0],i=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './autoRouter'\n`)(o),a=r?((t,e)=>`\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\nconst 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 (!cachedLazyComponents[compPath]) {\n cachedLazyComponents[compPath] = lazy(pagesComponent[compPath])\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}`)(e,o):((t,e)=>`\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\nconst 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}`)(e,o),u=(t=>`\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\nconst 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}`)(o),c=(t=>`\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\nconst buildRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const treeStructure = buildTreeStructure(routes)\n return formatRouteTree(treeStructure)\n}`)(o),l=(t=>`\nconst 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}`)(o),p=(t=>`\nconst 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}`)(o),h=o?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './autoRouter'\nexport const defineConfig = (config: PageConfig) => config\n":"",f=(t=>`\nconst getRoutes = () => {\n const baseRoutes = createBaseRoutes()\n const formattedRoutes = formatRoutes(baseRoutes)${t?" as RouteObject[]":""}\n return formattedRoutes\n}\n\nexport const routes = getRoutes()`)(o),d=((t,e)=>t?`\n${e?"import {\n lazy,\n Suspense,\n type ComponentType,\n type LazyExoticComponent\n} from 'react'":"import type { ComponentType } from 'react'"}\nimport type { RouteObject } from 'react-router'\n\n${e?"type PagesComponentType = Record<\n string,\n () => Promise<{ default: ComponentType<unknown> }>\n>":"type PagesComponentType = Record<string, ComponentType<unknown>>"}\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\ntype RouteWithIsRoot = MyRouteObject & { isRoot?: boolean }\n\nexport type PageConfig = Partial<\n Omit<MyRouteObject, 'Component' | 'element' | 'children'>\n>`:e?"\nimport { lazy, Suspense } from 'react'\n":"")(o,r),g=(t=>`\nconst hasDuplicateProperty = ${t?"<T, K extends keyof T>(items: T[], propName: K)":"(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}`)(o),m=((t,e,n,r,o,s,i,a)=>`// Auto-generated by ono-auto-router${t}${e}${n}${r}${o}${s}${i}${a}\n`)(d,g,p,l,c,u,a,f);o?(kr(t.resolve(s,"./index.ts"),i),kr(t.resolve(s,"./autoRouter.tsx"),m),kr(t.resolve(s,"./defineConfig.ts"),h)):kr(n,m)})(r,c,i,l):mr(u,o,c,i,l):yr(r,c,l,i),console.log(`[ono-auto-router] Routes file generated: ${c}`)},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=br,exports.getRelativePath=Sr,exports.getRelativeProjectPath=Er,exports.hasDefaultExport=Ar,exports.hasDuplicateProperty=Cr,exports.normalizePathWithWindows=vr,exports.removeCustomTagFunctionFromJSXAll=wr,exports.replaceBracketsWithColon=Or,exports.useTs=p,exports.writeFile=kr,exports.writeFileSync=function(n,r){Tr(t.dirname(n)),e.writeFileSync(n,r,"utf-8")};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core-wPeKAJfw.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, routesFile: string | undefined, 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 { }