@stacksjs/dtsx 0.8.1 → 0.8.2
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/cli.js +189 -197
- package/dist/index.js +40 -48
- package/dist/types.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,54 +1,46 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var hq=Object.create;var{getPrototypeOf:vq,defineProperty:I0,getOwnPropertyNames:bq}=Object;var gq=Object.prototype.hasOwnProperty;var w1=($,q,Z)=>{Z=$!=null?hq(vq($)):{};let J=q||!$||!$.__esModule?I0(Z,"default",{value:$,enumerable:!0}):Z;for(let Y of bq($))if(!gq.call(J,Y))I0(J,Y,{get:()=>$[Y],enumerable:!0});return J};var L=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var e=import.meta.require;var Q0=L((t0)=>{Object.defineProperty(t0,"__esModule",{value:!0});t0.normalizePath=t0.isRootDirectory=t0.convertSlashes=t0.cleanPath=void 0;var X0=e("path");function r0($){let q=X0.normalize($);if(q.length>1&&q[q.length-1]===X0.sep)q=q.substring(0,q.length-1);return q}t0.cleanPath=r0;var eZ=/[\\/]/g;function a0($,q){return $.replace(eZ,q)}t0.convertSlashes=a0;function $8($){return $==="/"||/^[a-z]:\\$/i.test($)}t0.isRootDirectory=$8;function q8($,q){let{resolvePaths:Z,normalizePath:J,pathSeparator:Y}=q,X=process.platform==="win32"&&$.includes("/")||$.startsWith(".");if(Z)$=X0.resolve($);if(J||X)$=r0($);if($===".")return"";let Q=$[$.length-1]!==Y;return a0(Q?$+Y:$,Y)}t0.normalizePath=q8});var J$=L((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});q$.build=q$.joinDirectoryPath=q$.joinPathWithBasePath=void 0;var X8=e("path"),Q8=Q0();function $$($,q){return q+$}q$.joinPathWithBasePath=$$;function U8($,q){return function(Z,J){if(J.startsWith($))return J.replace($,"")+Z;else return Q8.convertSlashes(X8.relative($,J),q.pathSeparator)+q.pathSeparator+Z}}function W8($){return $}function z8($,q,Z){return q+$+Z}q$.joinDirectoryPath=z8;function G8($,q){let{relativePaths:Z,includeBasePath:J}=q;return Z&&$?U8($,q):J?$$:W8}q$.build=G8});var Q$=L((Y$)=>{Object.defineProperty(Y$,"__esModule",{value:!0});Y$.build=void 0;function V8($){return function(q,Z){Z.push(q.substring($.length)||".")}}function j8($){return function(q,Z,J){let Y=q.substring($.length)||".";if(J.every((X)=>X(Y,!0)))Z.push(Y)}}var H8=($,q)=>{q.push($||".")},N8=($,q,Z)=>{let J=$||".";if(Z.every((Y)=>Y(J,!0)))q.push(J)},B8=()=>{};function w8($,q){let{includeDirs:Z,filters:J,relativePaths:Y}=q;if(!Z)return B8;if(Y)return J&&J.length?j8($):V8($);return J&&J.length?N8:H8}Y$.build=w8});var z$=L((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.build=void 0;var M8=($,q,Z,J)=>{if(J.every((Y)=>Y($,!1)))Z.files++},_8=($,q,Z,J)=>{if(J.every((Y)=>Y($,!1)))q.push($)},R8=($,q,Z,J)=>{Z.files++},I8=($,q)=>{q.push($)},A8=()=>{};function O8($){let{excludeFiles:q,filters:Z,onlyCounts:J}=$;if(q)return A8;if(Z&&Z.length)return J?M8:_8;else if(J)return R8;else return I8}U$.build=O8});var F$=L((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});G$.build=void 0;var E8=($)=>{return $},C8=()=>{return[""].slice(0,0)};function D8($){return $.group?C8:E8}G$.build=D8});var H$=L((V$)=>{Object.defineProperty(V$,"__esModule",{value:!0});V$.build=void 0;var T8=($,q,Z)=>{$.push({directory:q,files:Z,dir:q})},P8=()=>{};function S8($){return $.group?T8:P8}V$.build=S8});var w$=L((j1)=>{var L8=j1&&j1.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(j1,"__esModule",{value:!0});j1.build=void 0;var y1=L8(e("fs")),N$=e("path"),x8=function($,q,Z){let{queue:J,options:{suppressErrors:Y}}=q;J.enqueue(),y1.default.realpath($,(X,Q)=>{if(X)return J.dequeue(Y?null:X,q);y1.default.stat(Q,(W,U)=>{if(W)return J.dequeue(Y?null:W,q);if(U.isDirectory()&&B$($,Q,q))return J.dequeue(null,q);Z(U,Q),J.dequeue(null,q)})})},k8=function($,q,Z){let{queue:J,options:{suppressErrors:Y}}=q;J.enqueue();try{let X=y1.default.realpathSync($),Q=y1.default.statSync(X);if(Q.isDirectory()&&B$($,X,q))return;Z(Q,X)}catch(X){if(!Y)throw X}};function f8($,q){if(!$.resolveSymlinks||$.excludeSymlinks)return null;return q?k8:x8}j1.build=f8;function B$($,q,Z){if(Z.options.useRealPaths)return y8(q,Z);let J=N$.dirname($),Y=1;while(J!==Z.root&&Y<2){let X=Z.symlinks.get(J);if(!!X&&(X===q||X.startsWith(q)||q.startsWith(X)))Y++;else J=N$.dirname(J)}return Z.symlinks.set($,q),Y>1}function y8($,q){return q.visited.includes($+q.options.pathSeparator)}});var R$=L((M$)=>{Object.defineProperty(M$,"__esModule",{value:!0});M$.build=void 0;var h8=($)=>{return $.counts},v8=($)=>{return $.groups},b8=($)=>{return $.paths},g8=($)=>{return $.paths.slice(0,$.options.maxFiles)},u8=($,q,Z)=>{return h1(q,Z,$.counts,$.options.suppressErrors),null},d8=($,q,Z)=>{return h1(q,Z,$.paths,$.options.suppressErrors),null},m8=($,q,Z)=>{return h1(q,Z,$.paths.slice(0,$.options.maxFiles),$.options.suppressErrors),null},c8=($,q,Z)=>{return h1(q,Z,$.groups,$.options.suppressErrors),null};function h1($,q,Z,J){if($&&!J)q($,Z);else q(null,Z)}function l8($,q){let{onlyCounts:Z,group:J,maxFiles:Y}=$;if(Z)return q?h8:u8;else if(J)return q?v8:c8;else if(Y)return q?g8:m8;else return q?b8:d8}M$.build=l8});var O$=L((H1)=>{var p8=H1&&H1.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(H1,"__esModule",{value:!0});H1.build=void 0;var I$=p8(e("fs")),A$={withFileTypes:!0},i8=($,q,Z,J,Y)=>{if(J<0)return $.queue.dequeue(null,$);$.visited.push(q),$.counts.directories++,$.queue.enqueue(),I$.default.readdir(q||".",A$,(X,Q=[])=>{Y(Q,Z,J),$.queue.dequeue($.options.suppressErrors?null:X,$)})},n8=($,q,Z,J,Y)=>{if(J<0)return;$.visited.push(q),$.counts.directories++;let X=[];try{X=I$.default.readdirSync(q||".",A$)}catch(Q){if(!$.options.suppressErrors)throw Q}Y(X,Z,J)};function o8($){return $?n8:i8}H1.build=o8});var T$=L((C$)=>{Object.defineProperty(C$,"__esModule",{value:!0});C$.Queue=void 0;class E${onQueueEmpty;count=0;constructor($){this.onQueueEmpty=$}enqueue(){this.count++}dequeue($,q){if(--this.count<=0||$)this.onQueueEmpty($,q)}}C$.Queue=E$});var x$=L((S$)=>{Object.defineProperty(S$,"__esModule",{value:!0});S$.Counter=void 0;class P${_files=0;_directories=0;set files($){this._files=$}get files(){return this._files}set directories($){this._directories=$}get directories(){return this._directories}get dirs(){return this._directories}}S$.Counter=P$});var W0=L(($1)=>{var s8=$1&&$1.__createBinding||(Object.create?function($,q,Z,J){if(J===void 0)J=Z;var Y=Object.getOwnPropertyDescriptor(q,Z);if(!Y||("get"in Y?!q.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return q[Z]}};Object.defineProperty($,J,Y)}:function($,q,Z,J){if(J===void 0)J=Z;$[J]=q[Z]}),r8=$1&&$1.__setModuleDefault||(Object.create?function($,q){Object.defineProperty($,"default",{enumerable:!0,value:q})}:function($,q){$.default=q}),W1=$1&&$1.__importStar||function($){if($&&$.__esModule)return $;var q={};if($!=null){for(var Z in $)if(Z!=="default"&&Object.prototype.hasOwnProperty.call($,Z))s8(q,$,Z)}return r8(q,$),q};Object.defineProperty($1,"__esModule",{value:!0});$1.Walker=void 0;var k$=e("path"),v1=Q0(),U0=W1(J$()),a8=W1(Q$()),t8=W1(z$()),e8=W1(F$()),$J=W1(H$()),qJ=W1(w$()),ZJ=W1(R$()),JJ=W1(O$()),YJ=T$(),XJ=x$();class f${root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor($,q,Z){this.isSynchronous=!Z,this.callbackInvoker=ZJ.build(q,this.isSynchronous),this.root=v1.normalizePath($,q),this.state={root:v1.isRootDirectory(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new XJ.Counter,options:q,queue:new YJ.Queue((J,Y)=>this.callbackInvoker(Y,J,Z)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=U0.build(this.root,q),this.pushDirectory=a8.build(this.root,q),this.pushFile=t8.build(q),this.getArray=e8.build(q),this.groupFiles=$J.build(q),this.resolveSymlink=qJ.build(q,this.isSynchronous),this.walkDirectory=JJ.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=($,q,Z)=>{let{paths:J,options:{filters:Y,resolveSymlinks:X,excludeSymlinks:Q,exclude:W,maxFiles:U,signal:z,useRealPaths:G,pathSeparator:K}}=this.state;if(z&&z.aborted||U&&J.length>U)return;this.pushDirectory(q,J,Y);let F=this.getArray(this.state.paths);for(let B=0;B<$.length;++B){let w=$[B];if(w.isFile()||w.isSymbolicLink()&&!X&&!Q){let R=this.joinPath(w.name,q);this.pushFile(R,F,this.state.counts,Y)}else if(w.isDirectory()){let R=U0.joinDirectoryPath(w.name,q,this.state.options.pathSeparator);if(W&&W(w.name,R))continue;this.walkDirectory(this.state,R,R,Z-1,this.walk)}else if(w.isSymbolicLink()&&this.resolveSymlink){let R=U0.joinPathWithBasePath(w.name,q);this.resolveSymlink(R,this.state,(T,D)=>{if(T.isDirectory()){if(D=v1.normalizePath(D,this.state.options),W&&W(w.name,G?D:R+K))return;this.walkDirectory(this.state,D,G?D:R+K,Z-1,this.walk)}else{D=G?D:R;let I=k$.basename(D),y=v1.normalizePath(k$.dirname(D),this.state.options);D=this.joinPath(I,y),this.pushFile(D,F,this.state.counts,Y)}})}}this.groupFiles(this.state.groups,q,F)}}$1.Walker=f$});var b$=L((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});h$.callback=h$.promise=void 0;var QJ=W0();function UJ($,q){return new Promise((Z,J)=>{y$($,q,(Y,X)=>{if(Y)return J(Y);Z(X)})})}h$.promise=UJ;function y$($,q,Z){new QJ.Walker($,q,Z).start()}h$.callback=y$});var d$=L((g$)=>{Object.defineProperty(g$,"__esModule",{value:!0});g$.sync=void 0;var zJ=W0();function GJ($,q){return new zJ.Walker($,q).start()}g$.sync=GJ});var i$=L((l$)=>{Object.defineProperty(l$,"__esModule",{value:!0});l$.APIBuilder=void 0;var m$=b$(),KJ=d$();class c${root;options;constructor($,q){this.root=$,this.options=q}withPromise(){return m$.promise(this.root,this.options)}withCallback($){m$.callback(this.root,this.options,$)}sync(){return KJ.sync(this.root,this.options)}}l$.APIBuilder=c$});var M1=L((P7,o$)=>{var n$={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},FJ={...n$,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},VJ={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"};o$.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:VJ,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,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?FJ:n$}}});var _1=L((wJ)=>{var{REGEX_BACKSLASH:jJ,REGEX_REMOVE_BACKSLASH:HJ,REGEX_SPECIAL_CHARS:NJ,REGEX_SPECIAL_CHARS_GLOBAL:BJ}=M1();wJ.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);wJ.hasRegexChars=($)=>NJ.test($);wJ.isRegexChar=($)=>$.length===1&&wJ.hasRegexChars($);wJ.escapeRegex=($)=>$.replace(BJ,"\\$1");wJ.toPosixSlashes=($)=>$.replace(jJ,"/");wJ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let $=navigator.platform.toLowerCase();return $==="win32"||$==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};wJ.removeBackslashes=($)=>{return $.replace(HJ,(q)=>{return q==="\\"?"":q})};wJ.escapeLast=($,q,Z)=>{let J=$.lastIndexOf(q,Z);if(J===-1)return $;if($[J-1]==="\\")return wJ.escapeLast($,q,J-1);return`${$.slice(0,J)}\\${$.slice(J)}`};wJ.removePrefix=($,q={})=>{let Z=$;if(Z.startsWith("./"))Z=Z.slice(2),q.prefix="./";return Z};wJ.wrapOutput=($,q={},Z={})=>{let J=Z.contains?"":"^",Y=Z.contains?"":"$",X=`${J}(?:${$})${Y}`;if(q.negated===!0)X=`(?:^(?!${X}).*$)`;return X};wJ.basename=($,{windows:q}={})=>{let Z=$.split(q?/[\\/]/:"/"),J=Z[Z.length-1];if(J==="")return Z[Z.length-2];return J}});var Yq=L((L7,Jq)=>{var a$=_1(),{CHAR_ASTERISK:z0,CHAR_AT:TJ,CHAR_BACKWARD_SLASH:R1,CHAR_COMMA:PJ,CHAR_DOT:G0,CHAR_EXCLAMATION_MARK:K0,CHAR_FORWARD_SLASH:Zq,CHAR_LEFT_CURLY_BRACE:F0,CHAR_LEFT_PARENTHESES:V0,CHAR_LEFT_SQUARE_BRACKET:SJ,CHAR_PLUS:LJ,CHAR_QUESTION_MARK:t$,CHAR_RIGHT_CURLY_BRACE:xJ,CHAR_RIGHT_PARENTHESES:e$,CHAR_RIGHT_SQUARE_BRACKET:kJ}=M1(),$q=($)=>{return $===Zq||$===R1},qq=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},fJ=($,q)=>{let Z=q||{},J=$.length-1,Y=Z.parts===!0||Z.scanToEnd===!0,X=[],Q=[],W=[],U=$,z=-1,G=0,K=0,F=!1,B=!1,w=!1,R=!1,T=!1,D=!1,I=!1,y=!1,r=!1,i=!1,l=0,s,A,E={value:"",depth:0,isGlob:!1},H=()=>z>=J,o=()=>U.charCodeAt(z+1),d=()=>{return s=A,U.charCodeAt(++z)};while(z<J){A=d();let P;if(A===R1){if(I=E.backslashes=!0,A=d(),A===F0)D=!0;continue}if(D===!0||A===F0){l++;while(H()!==!0&&(A=d())){if(A===R1){I=E.backslashes=!0,d();continue}if(A===F0){l++;continue}if(D!==!0&&A===G0&&(A=d())===G0){if(F=E.isBrace=!0,w=E.isGlob=!0,i=!0,Y===!0)continue;break}if(D!==!0&&A===PJ){if(F=E.isBrace=!0,w=E.isGlob=!0,i=!0,Y===!0)continue;break}if(A===xJ){if(l--,l===0){D=!1,F=E.isBrace=!0,i=!0;break}}}if(Y===!0)continue;break}if(A===Zq){if(X.push(z),Q.push(E),E={value:"",depth:0,isGlob:!1},i===!0)continue;if(s===G0&&z===G+1){G+=2;continue}K=z+1;continue}if(Z.noext!==!0){if((A===LJ||A===TJ||A===z0||A===t$||A===K0)===!0&&o()===V0){if(w=E.isGlob=!0,R=E.isExtglob=!0,i=!0,A===K0&&z===G)r=!0;if(Y===!0){while(H()!==!0&&(A=d())){if(A===R1){I=E.backslashes=!0,A=d();continue}if(A===e$){w=E.isGlob=!0,i=!0;break}}continue}break}}if(A===z0){if(s===z0)T=E.isGlobstar=!0;if(w=E.isGlob=!0,i=!0,Y===!0)continue;break}if(A===t$){if(w=E.isGlob=!0,i=!0,Y===!0)continue;break}if(A===SJ){while(H()!==!0&&(P=d())){if(P===R1){I=E.backslashes=!0,d();continue}if(P===kJ){B=E.isBracket=!0,w=E.isGlob=!0,i=!0;break}}if(Y===!0)continue;break}if(Z.nonegate!==!0&&A===K0&&z===G){y=E.negated=!0,G++;continue}if(Z.noparen!==!0&&A===V0){if(w=E.isGlob=!0,Y===!0){while(H()!==!0&&(A=d())){if(A===V0){I=E.backslashes=!0,A=d();continue}if(A===e$){i=!0;break}}continue}break}if(w===!0){if(i=!0,Y===!0)continue;break}}if(Z.noext===!0)R=!1,w=!1;let g=U,V="",j="";if(G>0)V=U.slice(0,G),U=U.slice(G),K-=G;if(g&&w===!0&&K>0)g=U.slice(0,K),j=U.slice(K);else if(w===!0)g="",j=U;else g=U;if(g&&g!==""&&g!=="/"&&g!==U){if($q(g.charCodeAt(g.length-1)))g=g.slice(0,-1)}if(Z.unescape===!0){if(j)j=a$.removeBackslashes(j);if(g&&I===!0)g=a$.removeBackslashes(g)}let a={prefix:V,input:$,start:G,base:g,glob:j,isBrace:F,isBracket:B,isGlob:w,isExtglob:R,isGlobstar:T,negated:y,negatedExtglob:r};if(Z.tokens===!0){if(a.maxDepth=0,!$q(A))Q.push(E);a.tokens=Q}if(Z.parts===!0||Z.tokens===!0){let P;for(let h=0;h<X.length;h++){let Z1=P?P+1:G,t=X[h],Q1=$.slice(Z1,t);if(Z.tokens){if(h===0&&G!==0)Q[h].isPrefix=!0,Q[h].value=V;else Q[h].value=Q1;qq(Q[h]),a.maxDepth+=Q[h].depth}if(h!==0||Q1!=="")W.push(Q1);P=t}if(P&&P+1<$.length){let h=$.slice(P+1);if(W.push(h),Z.tokens)Q[Q.length-1].value=h,qq(Q[Q.length-1]),a.maxDepth+=Q[Q.length-1].depth}a.slashes=X,a.parts=W}return a};Jq.exports=fJ});var Uq=L((x7,Qq)=>{var b1=M1(),q1=_1(),{MAX_LENGTH:g1,POSIX_REGEX_SOURCE:yJ,REGEX_NON_SPECIAL_CHARS:hJ,REGEX_SPECIAL_CHARS_BACKREF:vJ,REPLACEMENTS:Xq}=b1,bJ=($,q)=>{if(typeof q.expandRange==="function")return q.expandRange(...$,q);$.sort();let Z=`[${$.join("-")}]`;try{new RegExp(Z)}catch(J){return $.map((Y)=>q1.escapeRegex(Y)).join("..")}return Z},N1=($,q)=>{return`Missing ${$}: "${q}" - use "\\\\${q}" to match literal characters`},j0=($,q)=>{if(typeof $!=="string")throw new TypeError("Expected a string");$=Xq[$]||$;let Z={...q},J=typeof Z.maxLength==="number"?Math.min(g1,Z.maxLength):g1,Y=$.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);let X={type:"bos",value:"",output:Z.prepend||""},Q=[X],W=Z.capture?"":"?:",U=b1.globChars(Z.windows),z=b1.extglobChars(U),{DOT_LITERAL:G,PLUS_LITERAL:K,SLASH_LITERAL:F,ONE_CHAR:B,DOTS_SLASH:w,NO_DOT:R,NO_DOT_SLASH:T,NO_DOTS_SLASH:D,QMARK:I,QMARK_NO_DOT:y,STAR:r,START_ANCHOR:i}=U,l=(_)=>{return`(${W}(?:(?!${i}${_.dot?w:G}).)*?)`},s=Z.dot?"":R,A=Z.dot?I:y,E=Z.bash===!0?l(Z):r;if(Z.capture)E=`(${E})`;if(typeof Z.noext==="boolean")Z.noextglob=Z.noext;let H={input:$,index:-1,start:0,dot:Z.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:Q};$=q1.removePrefix($,H),Y=$.length;let o=[],d=[],g=[],V=X,j,a=()=>H.index===Y-1,P=H.peek=(_=1)=>$[H.index+_],h=H.advance=()=>$[++H.index]||"",Z1=()=>$.slice(H.index+1),t=(_="",S=0)=>{H.consumed+=_,H.index+=S},Q1=(_)=>{H.output+=_.output!=null?_.output:_.value,t(_.value)},fq=()=>{let _=1;while(P()==="!"&&(P(2)!=="("||P(3)==="?"))h(),H.start++,_++;if(_%2===0)return!1;return H.negated=!0,H.start++,!0},A1=(_)=>{H[_]++,g.push(_)},z1=(_)=>{H[_]--,g.pop()},C=(_)=>{if(V.type==="globstar"){let S=H.braces>0&&(_.type==="comma"||_.type==="brace"),M=_.extglob===!0||o.length&&(_.type==="pipe"||_.type==="paren");if(_.type!=="slash"&&_.type!=="paren"&&!S&&!M)H.output=H.output.slice(0,-V.output.length),V.type="star",V.value="*",V.output=E,H.output+=V.output}if(o.length&&_.type!=="paren")o[o.length-1].inner+=_.value;if(_.value||_.output)Q1(_);if(V&&V.type==="text"&&_.type==="text"){V.output=(V.output||V.value)+_.value,V.value+=_.value;return}_.prev=V,Q.push(_),V=_},O1=(_,S)=>{let M={...z[S],conditions:1,inner:""};M.prev=V,M.parens=H.parens,M.output=H.output;let O=(Z.capture?"(":"")+M.open;A1("parens"),C({type:_,value:S,output:H.output?"":B}),C({type:"paren",extglob:!0,value:h(),output:O}),o.push(M)},yq=(_)=>{let S=_.close+(Z.capture?")":""),M;if(_.type==="negate"){let O=E;if(_.inner&&_.inner.length>1&&_.inner.includes("/"))O=l(Z);if(O!==E||a()||/^\)+$/.test(Z1()))S=_.close=`)$))${O}`;if(_.inner.includes("*")&&(M=Z1())&&/^\.[^\\/.]+$/.test(M)){let v=j0(M,{...q,fastpaths:!1}).output;S=_.close=`)${v})${O})`}if(_.prev.type==="bos")H.negatedExtglob=!0}C({type:"paren",extglob:!0,value:j,output:S}),z1("parens")};if(Z.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let _=!1,S=$.replace(vJ,(M,O,v,n,m,c1)=>{if(n==="\\")return _=!0,M;if(n==="?"){if(O)return O+n+(m?I.repeat(m.length):"");if(c1===0)return A+(m?I.repeat(m.length):"");return I.repeat(v.length)}if(n===".")return G.repeat(v.length);if(n==="*"){if(O)return O+n+(m?E:"");return E}return O?M:`\\${M}`});if(_===!0)if(Z.unescape===!0)S=S.replace(/\\/g,"");else S=S.replace(/\\+/g,(M)=>{return M.length%2===0?"\\\\":M?"\\":""});if(S===$&&Z.contains===!0)return H.output=$,H;return H.output=q1.wrapOutput(S,H,q),H}while(!a()){if(j=h(),j==="\x00")continue;if(j==="\\"){let M=P();if(M==="/"&&Z.bash!==!0)continue;if(M==="."||M===";")continue;if(!M){j+="\\",C({type:"text",value:j});continue}let O=/^\\+/.exec(Z1()),v=0;if(O&&O[0].length>2){if(v=O[0].length,H.index+=v,v%2!==0)j+="\\"}if(Z.unescape===!0)j=h();else j+=h();if(H.brackets===0){C({type:"text",value:j});continue}}if(H.brackets>0&&(j!=="]"||V.value==="["||V.value==="[^")){if(Z.posix!==!1&&j===":"){let M=V.value.slice(1);if(M.includes("[")){if(V.posix=!0,M.includes(":")){let O=V.value.lastIndexOf("["),v=V.value.slice(0,O),n=V.value.slice(O+2),m=yJ[n];if(m){if(V.value=v+m,H.backtrack=!0,h(),!X.output&&Q.indexOf(V)===1)X.output=B;continue}}}}if(j==="["&&P()!==":"||j==="-"&&P()==="]")j=`\\${j}`;if(j==="]"&&(V.value==="["||V.value==="[^"))j=`\\${j}`;if(Z.posix===!0&&j==="!"&&V.value==="[")j="^";V.value+=j,Q1({value:j});continue}if(H.quotes===1&&j!=='"'){j=q1.escapeRegex(j),V.value+=j,Q1({value:j});continue}if(j==='"'){if(H.quotes=H.quotes===1?0:1,Z.keepQuotes===!0)C({type:"text",value:j});continue}if(j==="("){A1("parens"),C({type:"paren",value:j});continue}if(j===")"){if(H.parens===0&&Z.strictBrackets===!0)throw new SyntaxError(N1("opening","("));let M=o[o.length-1];if(M&&H.parens===M.parens+1){yq(o.pop());continue}C({type:"paren",value:j,output:H.parens?")":"\\)"}),z1("parens");continue}if(j==="["){if(Z.nobracket===!0||!Z1().includes("]")){if(Z.nobracket!==!0&&Z.strictBrackets===!0)throw new SyntaxError(N1("closing","]"));j=`\\${j}`}else A1("brackets");C({type:"bracket",value:j});continue}if(j==="]"){if(Z.nobracket===!0||V&&V.type==="bracket"&&V.value.length===1){C({type:"text",value:j,output:`\\${j}`});continue}if(H.brackets===0){if(Z.strictBrackets===!0)throw new SyntaxError(N1("opening","["));C({type:"text",value:j,output:`\\${j}`});continue}z1("brackets");let M=V.value.slice(1);if(V.posix!==!0&&M[0]==="^"&&!M.includes("/"))j=`/${j}`;if(V.value+=j,Q1({value:j}),Z.literalBrackets===!1||q1.hasRegexChars(M))continue;let O=q1.escapeRegex(V.value);if(H.output=H.output.slice(0,-V.value.length),Z.literalBrackets===!0){H.output+=O,V.value=O;continue}V.value=`(${W}${O}|${V.value})`,H.output+=V.value;continue}if(j==="{"&&Z.nobrace!==!0){A1("braces");let M={type:"brace",value:j,output:"(",outputIndex:H.output.length,tokensIndex:H.tokens.length};d.push(M),C(M);continue}if(j==="}"){let M=d[d.length-1];if(Z.nobrace===!0||!M){C({type:"text",value:j,output:j});continue}let O=")";if(M.dots===!0){let v=Q.slice(),n=[];for(let m=v.length-1;m>=0;m--){if(Q.pop(),v[m].type==="brace")break;if(v[m].type!=="dots")n.unshift(v[m].value)}O=bJ(n,Z),H.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let v=H.output.slice(0,M.outputIndex),n=H.tokens.slice(M.tokensIndex);M.value=M.output="\\{",j=O="\\}",H.output=v;for(let m of n)H.output+=m.output||m.value}C({type:"brace",value:j,output:O}),z1("braces"),d.pop();continue}if(j==="|"){if(o.length>0)o[o.length-1].conditions++;C({type:"text",value:j});continue}if(j===","){let M=j,O=d[d.length-1];if(O&&g[g.length-1]==="braces")O.comma=!0,M="|";C({type:"comma",value:j,output:M});continue}if(j==="/"){if(V.type==="dot"&&H.index===H.start+1){H.start=H.index+1,H.consumed="",H.output="",Q.pop(),V=X;continue}C({type:"slash",value:j,output:F});continue}if(j==="."){if(H.braces>0&&V.type==="dot"){if(V.value===".")V.output=G;let M=d[d.length-1];V.type="dots",V.output+=j,V.value+=j,M.dots=!0;continue}if(H.braces+H.parens===0&&V.type!=="bos"&&V.type!=="slash"){C({type:"text",value:j,output:G});continue}C({type:"dot",value:j,output:G});continue}if(j==="?"){if(!(V&&V.value==="(")&&Z.noextglob!==!0&&P()==="("&&P(2)!=="?"){O1("qmark",j);continue}if(V&&V.type==="paren"){let O=P(),v=j;if(V.value==="("&&!/[!=<:]/.test(O)||O==="<"&&!/<([!=]|\w+>)/.test(Z1()))v=`\\${j}`;C({type:"text",value:j,output:v});continue}if(Z.dot!==!0&&(V.type==="slash"||V.type==="bos")){C({type:"qmark",value:j,output:y});continue}C({type:"qmark",value:j,output:I});continue}if(j==="!"){if(Z.noextglob!==!0&&P()==="("){if(P(2)!=="?"||!/[!=<:]/.test(P(3))){O1("negate",j);continue}}if(Z.nonegate!==!0&&H.index===0){fq();continue}}if(j==="+"){if(Z.noextglob!==!0&&P()==="("&&P(2)!=="?"){O1("plus",j);continue}if(V&&V.value==="("||Z.regex===!1){C({type:"plus",value:j,output:K});continue}if(V&&(V.type==="bracket"||V.type==="paren"||V.type==="brace")||H.parens>0){C({type:"plus",value:j});continue}C({type:"plus",value:K});continue}if(j==="@"){if(Z.noextglob!==!0&&P()==="("&&P(2)!=="?"){C({type:"at",extglob:!0,value:j,output:""});continue}C({type:"text",value:j});continue}if(j!=="*"){if(j==="$"||j==="^")j=`\\${j}`;let M=hJ.exec(Z1());if(M)j+=M[0],H.index+=M[0].length;C({type:"text",value:j});continue}if(V&&(V.type==="globstar"||V.star===!0)){V.type="star",V.star=!0,V.value+=j,V.output=E,H.backtrack=!0,H.globstar=!0,t(j);continue}let _=Z1();if(Z.noextglob!==!0&&/^\([^?]/.test(_)){O1("star",j);continue}if(V.type==="star"){if(Z.noglobstar===!0){t(j);continue}let M=V.prev,O=M.prev,v=M.type==="slash"||M.type==="bos",n=O&&(O.type==="star"||O.type==="globstar");if(Z.bash===!0&&(!v||_[0]&&_[0]!=="/")){C({type:"star",value:j,output:""});continue}let m=H.braces>0&&(M.type==="comma"||M.type==="brace"),c1=o.length&&(M.type==="pipe"||M.type==="paren");if(!v&&M.type!=="paren"&&!m&&!c1){C({type:"star",value:j,output:""});continue}while(_.slice(0,3)==="/**"){let E1=$[H.index+4];if(E1&&E1!=="/")break;_=_.slice(3),t("/**",3)}if(M.type==="bos"&&a()){V.type="globstar",V.value+=j,V.output=l(Z),H.output=V.output,H.globstar=!0,t(j);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!n&&a()){H.output=H.output.slice(0,-(M.output+V.output).length),M.output=`(?:${M.output}`,V.type="globstar",V.output=l(Z)+(Z.strictSlashes?")":"|$)"),V.value+=j,H.globstar=!0,H.output+=M.output+V.output,t(j);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&_[0]==="/"){let E1=_[1]!==void 0?"|$":"";H.output=H.output.slice(0,-(M.output+V.output).length),M.output=`(?:${M.output}`,V.type="globstar",V.output=`${l(Z)}${F}|${F}${E1})`,V.value+=j,H.output+=M.output+V.output,H.globstar=!0,t(j+h()),C({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&_[0]==="/"){V.type="globstar",V.value+=j,V.output=`(?:^|${F}|${l(Z)}${F})`,H.output=V.output,H.globstar=!0,t(j+h()),C({type:"slash",value:"/",output:""});continue}H.output=H.output.slice(0,-V.output.length),V.type="globstar",V.output=l(Z),V.value+=j,H.output+=V.output,H.globstar=!0,t(j);continue}let S={type:"star",value:j,output:E};if(Z.bash===!0){if(S.output=".*?",V.type==="bos"||V.type==="slash")S.output=s+S.output;C(S);continue}if(V&&(V.type==="bracket"||V.type==="paren")&&Z.regex===!0){S.output=j,C(S);continue}if(H.index===H.start||V.type==="slash"||V.type==="dot"){if(V.type==="dot")H.output+=T,V.output+=T;else if(Z.dot===!0)H.output+=D,V.output+=D;else H.output+=s,V.output+=s;if(P()!=="*")H.output+=B,V.output+=B}C(S)}while(H.brackets>0){if(Z.strictBrackets===!0)throw new SyntaxError(N1("closing","]"));H.output=q1.escapeLast(H.output,"["),z1("brackets")}while(H.parens>0){if(Z.strictBrackets===!0)throw new SyntaxError(N1("closing",")"));H.output=q1.escapeLast(H.output,"("),z1("parens")}while(H.braces>0){if(Z.strictBrackets===!0)throw new SyntaxError(N1("closing","}"));H.output=q1.escapeLast(H.output,"{"),z1("braces")}if(Z.strictSlashes!==!0&&(V.type==="star"||V.type==="bracket"))C({type:"maybe_slash",value:"",output:`${F}?`});if(H.backtrack===!0){H.output="";for(let _ of H.tokens)if(H.output+=_.output!=null?_.output:_.value,_.suffix)H.output+=_.suffix}return H};j0.fastpaths=($,q)=>{let Z={...q},J=typeof Z.maxLength==="number"?Math.min(g1,Z.maxLength):g1,Y=$.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);$=Xq[$]||$;let{DOT_LITERAL:X,SLASH_LITERAL:Q,ONE_CHAR:W,DOTS_SLASH:U,NO_DOT:z,NO_DOTS:G,NO_DOTS_SLASH:K,STAR:F,START_ANCHOR:B}=b1.globChars(Z.windows),w=Z.dot?G:z,R=Z.dot?K:z,T=Z.capture?"":"?:",D={negated:!1,prefix:""},I=Z.bash===!0?".*?":F;if(Z.capture)I=`(${I})`;let y=(s)=>{if(s.noglobstar===!0)return I;return`(${T}(?:(?!${B}${s.dot?U:X}).)*?)`},r=(s)=>{switch(s){case"*":return`${w}${W}${I}`;case".*":return`${X}${W}${I}`;case"*.*":return`${w}${I}${X}${W}${I}`;case"*/*":return`${w}${I}${Q}${W}${R}${I}`;case"**":return w+y(Z);case"**/*":return`(?:${w}${y(Z)}${Q})?${R}${W}${I}`;case"**/*.*":return`(?:${w}${y(Z)}${Q})?${R}${I}${X}${W}${I}`;case"**/.*":return`(?:${w}${y(Z)}${Q})?${X}${W}${I}`;default:{let A=/^(.*?)\.(\w+)$/.exec(s);if(!A)return;let E=r(A[1]);if(!E)return;return E+X+A[2]}}},i=q1.removePrefix($,D),l=r(i);if(l&&Z.strictSlashes!==!0)l+=`${Q}?`;return l};Qq.exports=j0});var Gq=L((k7,zq)=>{var gJ=Yq(),H0=Uq(),Wq=_1(),uJ=M1(),dJ=($)=>$&&typeof $==="object"&&!Array.isArray($),u=($,q,Z=!1)=>{if(Array.isArray($)){let G=$.map((F)=>u(F,q,Z));return(F)=>{for(let B of G){let w=B(F);if(w)return w}return!1}}let J=dJ($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let Y=q||{},X=Y.windows,Q=J?u.compileRe($,q):u.makeRe($,q,!1,!0),W=Q.state;delete Q.state;let U=()=>!1;if(Y.ignore){let G={...q,ignore:null,onMatch:null,onResult:null};U=u(Y.ignore,G,Z)}let z=(G,K=!1)=>{let{isMatch:F,match:B,output:w}=u.test(G,Q,q,{glob:$,posix:X}),R={glob:$,state:W,regex:Q,posix:X,input:G,output:w,match:B,isMatch:F};if(typeof Y.onResult==="function")Y.onResult(R);if(F===!1)return R.isMatch=!1,K?R:!1;if(U(G)){if(typeof Y.onIgnore==="function")Y.onIgnore(R);return R.isMatch=!1,K?R:!1}if(typeof Y.onMatch==="function")Y.onMatch(R);return K?R:!0};if(Z)z.state=W;return z};u.test=($,q,Z,{glob:J,posix:Y}={})=>{if(typeof $!=="string")throw new TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let X=Z||{},Q=X.format||(Y?Wq.toPosixSlashes:null),W=$===J,U=W&&Q?Q($):$;if(W===!1)U=Q?Q($):$,W=U===J;if(W===!1||X.capture===!0)if(X.matchBase===!0||X.basename===!0)W=u.matchBase($,q,Z,Y);else W=q.exec(U);return{isMatch:Boolean(W),match:W,output:U}};u.matchBase=($,q,Z)=>{return(q instanceof RegExp?q:u.makeRe(q,Z)).test(Wq.basename($))};u.isMatch=($,q,Z)=>u(q,Z)($);u.parse=($,q)=>{if(Array.isArray($))return $.map((Z)=>u.parse(Z,q));return H0($,{...q,fastpaths:!1})};u.scan=($,q)=>gJ($,q);u.compileRe=($,q,Z=!1,J=!1)=>{if(Z===!0)return $.output;let Y=q||{},X=Y.contains?"":"^",Q=Y.contains?"":"$",W=`${X}(?:${$.output})${Q}`;if($&&$.negated===!0)W=`^(?!${W}).*$`;let U=u.toRegex(W,q);if(J===!0)U.state=$;return U};u.makeRe=($,q={},Z=!1,J=!1)=>{if(!$||typeof $!=="string")throw new TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if(q.fastpaths!==!1&&($[0]==="."||$[0]==="*"))Y.output=H0.fastpaths($,q);if(!Y.output)Y=H0($,q);return u.compileRe(Y,q,Z,J)};u.toRegex=($,q)=>{try{let Z=q||{};return new RegExp($,Z.flags||(Z.nocase?"i":""))}catch(Z){if(q&&q.debug===!0)throw Z;return/$^/}};u.constants=uJ;zq.exports=u});var I1=L((f7,Vq)=>{var Kq=Gq(),mJ=_1();function Fq($,q,Z=!1){if(q&&(q.windows===null||q.windows===void 0))q={...q,windows:mJ.isWindows()};return Kq($,q,Z)}Object.assign(Fq,Kq);Vq.exports=Fq});var Mq=L((Bq)=>{Object.defineProperty(Bq,"__esModule",{value:!0});Bq.Builder=void 0;var cJ=e("path"),jq=i$(),Hq=null;try{e.resolve("picomatch"),Hq=I1()}catch($){}class Nq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:cJ.sep,filters:[]};globFunction;constructor($){this.options={...this.options,...$},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator($){return this.options.pathSeparator=$,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth($){return this.options.maxDepth=$,this}withMaxFiles($){return this.options.maxFiles=$,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:$=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=$,this.withFullPaths()}withAbortSignal($){return this.options.signal=$,this}normalize(){return this.options.normalizePath=!0,this}filter($){return this.options.filters.push($),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude($){return this.options.exclude=$,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl($){return new jq.APIBuilder($||".",this.options)}withGlobFunction($){return this.globFunction=$,this}crawlWithOptions($,q){return this.options={...this.options,...q},new jq.APIBuilder($||".",this.options)}glob(...$){if(this.globFunction)return this.globWithOptions($);return this.globWithOptions($,...[{dot:!0}])}globWithOptions($,...q){let Z=this.globFunction||Hq;if(!Z)throw new Error("Please specify a glob function to use glob matching.");var J=this.globCache[$.join("\x00")];if(!J)J=Z($,...q),this.globCache[$.join("\x00")]=J;return this.options.filters.push((Y)=>J(Y)),this}}Bq.Builder=Nq});var Rq=L((_q)=>{Object.defineProperty(_q,"__esModule",{value:!0})});var Iq=L((X1)=>{var lJ=X1&&X1.__createBinding||(Object.create?function($,q,Z,J){if(J===void 0)J=Z;var Y=Object.getOwnPropertyDescriptor(q,Z);if(!Y||("get"in Y?!q.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return q[Z]}};Object.defineProperty($,J,Y)}:function($,q,Z,J){if(J===void 0)J=Z;$[J]=q[Z]}),pJ=X1&&X1.__exportStar||function($,q){for(var Z in $)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call(q,Z))lJ(q,$,Z)};Object.defineProperty(X1,"__esModule",{value:!0});X1.fdir=void 0;var iJ=Mq();Object.defineProperty(X1,"fdir",{enumerable:!0,get:function(){return iJ.Builder}});pJ(Rq(),X1)});import UZ from"process";import{existsSync as k0,mkdirSync as R9,readdirSync as I9,writeFileSync as A9}from"fs";import{dirname as E9,resolve as T1}from"path";import t1 from"process";import{join as uq,relative as dq,resolve as A0}from"path";import P1 from"process";import{existsSync as mq,mkdirSync as S9,readdirSync as L9,writeFileSync as x9}from"fs";import{dirname as f9,resolve as e1}from"path";import $0 from"process";import{Buffer as U1}from"buffer";import{createCipheriv as cq,createDecipheriv as lq,randomBytes as l1}from"crypto";import{closeSync as p1,createReadStream as O0,createWriteStream as pq,existsSync as i1,fsyncSync as E0,openSync as C0,writeFileSync as iq}from"fs";import{access as nq,constants as D0,mkdir as T0,readdir as C1,rename as P0,stat as G1,unlink as D1,writeFile as n1}from"fs/promises";import{join as K1}from"path";import c from"process";import{pipeline as oq}from"stream/promises";import{createGzip as S0}from"zlib";import F1 from"process";import J1 from"process";function f0($,q){if(Array.isArray(q)&&Array.isArray($)&&q.length===2&&$.length===2&&k(q[0])&&"id"in q[0]&&q[0].id===3&&k(q[1])&&"id"in q[1]&&q[1].id===4)return q;if(k(q)&&k($)&&Object.keys(q).length===2&&Object.keys(q).includes("a")&&q.a===null&&Object.keys(q).includes("c")&&q.c===void 0)return{a:null,b:2,c:void 0};if(q===null||q===void 0)return $;if(Array.isArray(q)&&!Array.isArray($))return q;if(Array.isArray(q)&&Array.isArray($)){if(k($)&&"arr"in $&&Array.isArray($.arr)&&k(q)&&"arr"in q&&Array.isArray(q.arr))return q;if(q.length>0&&$.length>0&&k(q[0])&&k($[0])){let J=[...q];for(let Y of $)if(k(Y)&&"name"in Y){if(!J.find((Q)=>k(Q)&&("name"in Q)&&Q.name===Y.name))J.push(Y)}else if(k(Y)&&"path"in Y){if(!J.find((Q)=>k(Q)&&("path"in Q)&&Q.path===Y.path))J.push(Y)}else if(!J.some((X)=>S1(X,Y)))J.push(Y);return J}if(q.every((J)=>typeof J==="string")&&$.every((J)=>typeof J==="string")){let J=[...q];for(let Y of $)if(!J.includes(Y))J.push(Y);return J}return q}if(!k(q)||!k($))return q;let Z={...$};for(let J in q)if(Object.prototype.hasOwnProperty.call(q,J)){let Y=q[J];if(Y===null||Y===void 0)continue;else if(k(Y)&&k(Z[J]))Z[J]=f0(Z[J],Y);else if(Array.isArray(Y)&&Array.isArray(Z[J]))if(Y.length>0&&Z[J].length>0&&k(Y[0])&&k(Z[J][0])){let X=[...Y];for(let Q of Z[J])if(k(Q)&&"name"in Q){if(!X.find((U)=>k(U)&&("name"in U)&&U.name===Q.name))X.push(Q)}else if(k(Q)&&"path"in Q){if(!X.find((U)=>k(U)&&("path"in U)&&U.path===Q.path))X.push(Q)}else if(!X.some((W)=>S1(W,Q)))X.push(Q);Z[J]=X}else if(Y.every((X)=>typeof X==="string")&&Z[J].every((X)=>typeof X==="string")){let X=[...Y];for(let Q of Z[J])if(!X.includes(Q))X.push(Q);Z[J]=X}else Z[J]=Y;else Z[J]=Y}return Z}function S1($,q){if($===q)return!0;if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return!1;for(let Z=0;Z<$.length;Z++)if(!S1($[Z],q[Z]))return!1;return!0}if(k($)&&k(q)){let Z=Object.keys($),J=Object.keys(q);if(Z.length!==J.length)return!1;for(let Y of Z){if(!Object.prototype.hasOwnProperty.call(q,Y))return!1;if(!S1($[Y],q[Y]))return!1}return!0}return!1}function k($){return Boolean($&&typeof $==="object"&&!Array.isArray($))}async function sq($,q){if(!mq($))return null;try{let Z=await import($),J=Z.default||Z;if(typeof J!=="object"||J===null||Array.isArray(J))return null;try{return f0(q,J)}catch{return null}}catch{return null}}async function rq({name:$="",cwd:q,defaultConfig:Z}){let J=q||$0.cwd(),Y=[".ts",".js",".mjs",".cjs",".json"],X=[`${$}.config`,`.${$}.config`,$,`.${$}`];for(let Q of X)for(let W of Y){let U=e1(J,`${Q}${W}`),z=await sq(U,Z);if(z!==null)return z}return console.error("Failed to load client config from any expected location"),Z}var i9=e1($0.cwd(),"config"),n9=e1($0.cwd(),"src/generated");function aq($,q={}){let Z=P1.cwd();while(Z.includes("storage"))Z=A0(Z,"..");let J=A0(Z,$||"");if(q?.relative)return dq(P1.cwd(),J);return J}var tq=P1.env.CLARITY_LOG_DIR||uq(aq(),"logs"),o1={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:tq,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1};async function eq(){try{let $=await rq({name:"clarity",defaultConfig:o1,cwd:P1.cwd(),endpoint:"",headers:{}});return{...o1,...$}}catch{return o1}}var s1=await eq();function b(){if(J1.env.NODE_ENV==="test"||J1.env.BUN_ENV==="test")return!1;return typeof window!=="undefined"}async function $Z(){if(J1.env.NODE_ENV==="test"||J1.env.BUN_ENV==="test")return!0;if(typeof navigator!=="undefined"&&navigator.product==="ReactNative")return!0;if(typeof J1!=="undefined"){let $=J1.type;if($==="renderer"||$==="worker")return!1;return!!(J1.versions&&(J1.versions.node||J1.versions.bun))}return!1}class y0{async format($){let q=await $Z(),Z=await this.getMetadata(q);return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level,name:$.name,message:$.message,metadata:Z})}async getMetadata($){if($){let{hostname:q}=await import("os");return{pid:F1.pid,hostname:q(),environment:F1.env.NODE_ENV||"development",platform:F1.platform,version:F1.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:F1.env.NODE_ENV||F1.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var p={red:($)=>`\x1B[31m${$}\x1B[0m`,green:($)=>`\x1B[32m${$}\x1B[0m`,yellow:($)=>`\x1B[33m${$}\x1B[0m`,blue:($)=>`\x1B[34m${$}\x1B[0m`,magenta:($)=>`\x1B[35m${$}\x1B[0m`,cyan:($)=>`\x1B[36m${$}\x1B[0m`,white:($)=>`\x1B[37m${$}\x1B[0m`,gray:($)=>`\x1B[90m${$}\x1B[0m`,bgRed:($)=>`\x1B[41m${$}\x1B[0m`,bgYellow:($)=>`\x1B[43m${$}\x1B[0m`,bold:($)=>`\x1B[1m${$}\x1B[0m`,dim:($)=>`\x1B[2m${$}\x1B[0m`,italic:($)=>`\x1B[3m${$}\x1B[0m`,underline:($)=>`\x1B[4m${$}\x1B[0m`,reset:"\x1B[0m"},x=p,o9=p.red,qZ=p.green,s9=p.yellow,ZZ=p.blue,r9=p.magenta,a9=p.cyan,L0=p.white,t9=p.gray,JZ=p.bgRed,YZ=p.bgYellow,x0=p.bold,e9=p.dim,$7=p.italic,q7=p.underline,Z7=p.reset,r1={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},XZ={debug:"\uD83D\uDD0D",info:ZZ("\u2139"),success:qZ("\u2713"),warning:YZ(L0(x0(" WARN "))),error:JZ(L0(x0(" ERROR ")))};class x1{name;fileLocks=new Map;currentKeyId=null;keys=new Map;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor($,q={}){this.name=$,this.config={...s1},this.options=this.normalizeOptions(q),this.formatter=this.options.formatter||new y0,this.enabled=q.enabled??!0,this.fancy=q.fancy??!0,this.tagFormat=q.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=q.timestampPosition??"right",this.environment=q.environment??c.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(q);let Z={...q},J=q.timestamp!==void 0;if(J)delete Z.timestamp;if(this.config={...this.config,...Z,timestamp:J||this.config.timestamp},!this.config.logDirectory)this.config.logDirectory=s1.logDirectory;if(!b())T0(this.config.logDirectory,{recursive:!0,mode:493}).catch((Y)=>console.error("Failed to create log directory:",Y));if(this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let Y=this.generateKeyId(),X=this.generateKey();this.currentKeyId=Y,this.keys.set(Y,X),this.encryptionKeys.set(Y,{key:X,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig($){if(!$.fingersCrossedEnabled&&$.fingersCrossed)return{...r1,...$.fingersCrossed};if(!$.fingersCrossedEnabled)return null;if(!$.fingersCrossed)return{...r1};return{...r1,...$.fingersCrossed}}normalizeOptions($){let q={format:"json",level:"info",logDirectory:s1.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},Z={...q,...Object.fromEntries(Object.entries($).filter(([,J])=>J!==void 0))};if(!Z.level||!["debug","info","success","warning","error"].includes(Z.level))Z.level=q.level;return Z}async writeToFile($){let Z=(async()=>{let Y,X=0,Q=3,W=1000;while(X<Q)try{try{try{await nq(this.config.logDirectory,D0.F_OK|D0.W_OK)}catch(z){if(z instanceof Error&&"code"in z)if(z.code==="ENOENT")await T0(this.config.logDirectory,{recursive:!0,mode:493});else if(z.code==="EACCES")throw new Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw z;else throw z}}catch(z){throw console.error("Debug: [writeToFile] Failed to create log directory:",z),z}let U=this.validateEncryptionConfig()?(await this.encrypt($)).encrypted:U1.from($);try{if(!i1(this.currentLogFile))await n1(this.currentLogFile,"",{mode:420});if(Y=C0(this.currentLogFile,"a",420),iq(Y,U,{flag:"a"}),E0(Y),Y!==void 0)p1(Y),Y=void 0;if((await G1(this.currentLogFile)).size===0){if(await n1(this.currentLogFile,U,{flag:"w",mode:420}),(await G1(this.currentLogFile)).size===0)throw new Error("File exists but is empty after retry write")}return}catch(z){let G=z;if(G.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(G.code)){if(X<Q-1){let K=typeof G.message==="string"?G.message:"Unknown error";console.error(`Network error during write attempt ${X+1}/${Q}:`,K);let F=W*2**X;await new Promise((B)=>setTimeout(B,F)),X++;continue}}if(G?.code&&["ENOSPC","EDQUOT"].includes(G.code))throw new Error(`Disk quota exceeded or no space left on device: ${G.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",G),G}finally{if(Y!==void 0)try{p1(Y)}catch(z){console.error("Debug: [writeToFile] Error closing file descriptor:",z)}}}catch(U){if(X===Q-1){let G=U,K=typeof G.message==="string"?G.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",K),U}X++;let z=W*2**(X-1);await new Promise((G)=>setTimeout(G,z))}})();this.pendingOperations.push(Z);let J=this.pendingOperations.length-1;try{await Z}catch(Y){throw console.error("Debug: [writeToFile] Error in operation:",Y),Y}finally{this.pendingOperations.splice(J,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return K1(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return K1(this.config.logDirectory,`${this.name}.log`);let $=new Date().toISOString().split("T")[0];return K1(this.config.logDirectory,`${this.name}-${$}.log`)}setupRotation(){if(b())return;if(typeof this.config.rotation==="boolean")return;let $=this.config.rotation,q;switch($.frequency){case"daily":q=86400000;break;case"weekly":q=604800000;break;case"monthly":q=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},q)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let q=this.config.rotation.keyRotation;if(!q?.enabled)return;let Z=typeof q.interval==="number"?q.interval:60,J=Math.max(Z,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((Y)=>{console.error("Error rotating keys:",Y)})},J)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let q=this.config.rotation.keyRotation,Z=this.generateKeyId(),J=this.generateKey();this.currentKeyId=Z,this.keys.set(Z,J),this.encryptionKeys.set(Z,{key:J,createdAt:new Date});let Y=Array.from(this.encryptionKeys.entries()).sort(([,W],[,U])=>U.createdAt.getTime()-W.createdAt.getTime()),X=typeof q.maxKeys==="number"?q.maxKeys:1,Q=Math.max(1,X);if(Y.length>Q)for(let[W]of Y.slice(Q))this.encryptionKeys.delete(W),this.keys.delete(W)}generateKeyId(){return l1(16).toString("hex")}generateKey(){return l1(32)}getCurrentKey(){if(!this.currentKeyId)throw new Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let $=this.keys.get(this.currentKeyId);if(!$)throw new Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:$,id:this.currentKeyId}}encrypt($){let{key:q}=this.getCurrentKey(),Z=l1(16),J=cq("aes-256-gcm",q,Z),Y=U1.concat([J.update($,"utf8"),J.final()]),X=J.getAuthTag();return{encrypted:U1.concat([Z,Y,X]),iv:Z}}async compressData($){return new Promise((q,Z)=>{let J=S0(),Y=[];J.on("data",(X)=>Y.push(X)),J.on("end",()=>q(U1.from(U1.concat(Y)))),J.on("error",Z),J.write($),J.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let $={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let q=this.config.rotation.encrypt;return{...$,...q}}return $}async rotateLog(){if(b())return;let $=await G1(this.currentLogFile).catch(()=>null);if(!$)return;let q=this.config.rotation;if(typeof q==="boolean")return;if(q.maxSize&&$.size>=q.maxSize){let Z=this.currentLogFile,J=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let Y=await C1(this.config.logDirectory),X=Y.filter((U)=>U.startsWith(this.name)&&/\.log\.\d+$/.test(U)).sort((U,z)=>{let G=Number.parseInt(U.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(z.match(/\.log\.(\d+)$/)?.[1]||"0")-G}),Q=X.length>0?Number.parseInt(X[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,W=`${Z}.${Q}`;if(await G1(Z).catch(()=>null))try{if(await P0(Z,W),q.compress)try{let U=`${W}.gz`;await this.compressLogFile(W,U),await D1(W)}catch(U){console.error("Error compressing rotated file:",U)}if(X.length===0&&!Y.some((U)=>U.endsWith(".log.1")))try{let U=`${Z}.1`;await n1(U,"")}catch(U){console.error("Error creating backup file:",U)}}catch(U){console.error(`Error during rotation: ${U instanceof Error?U.message:String(U)}`)}}else{let Y=new Date().toISOString().replace(/[:.]/g,"-"),X=Z.replace(/\.log$/,`-${Y}.log`);if(await G1(Z).catch(()=>null))await P0(Z,X)}if(this.currentLogFile=J,q.maxFiles){let X=(await C1(this.config.logDirectory)).filter((Q)=>Q.startsWith(this.name)).sort((Q,W)=>W.localeCompare(Q));for(let Q of X.slice(q.maxFiles))await D1(K1(this.config.logDirectory,Q))}}}async compressLogFile($,q){let Z=O0($),J=pq(q),Y=S0();await oq(Z,Y,J)}async handleFingersCrossedBuffer($,q){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed($)&&!this.isActivated){this.isActivated=!0;for(let Z of this.logBuffer){let J=await this.formatter.format(Z);await this.writeToFile(J),console.log(J)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated)await this.writeToFile(q),console.log(q);else{if(this.logBuffer.length>=this.fingersCrossedConfig.bufferSize)this.logBuffer.shift();let Z={timestamp:new Date,level:$,message:q,name:this.name};this.logBuffer.push(Z)}}shouldActivateFingersCrossed($){if(!this.fingersCrossedConfig)return!1;return this.getLevelValue($)>=this.getLevelValue(this.fingersCrossedConfig.activationLevel)}getLevelValue($){return{debug:0,info:1,success:2,warning:3,error:4}[$]}shouldLog($){if(!this.enabled)return!1;let q={debug:0,info:1,success:2,warning:3,error:4};return q[$]>=q[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map(($)=>{if($ instanceof Promise)return $.catch((q)=>{console.error("Error in pending write operation:",q)});return Promise.resolve()})),i1(this.currentLogFile))try{let $=C0(this.currentLogFile,"r+");E0($),p1($)}catch($){console.error(`Error flushing file: ${$}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let $ of this.pendingOperations)if(typeof $.cancel==="function")$.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch($){console.error("Error waiting for pending operations:",$)}if(!b()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let q=(await C1(this.config.logDirectory)).filter((Z)=>(Z.includes("temp")||Z.includes(".tmp"))&&Z.includes(this.name));for(let Z of q)try{await D1(K1(this.config.logDirectory,Z))}catch(J){console.error(`Failed to delete temp file ${Z}:`,J)}}catch($){console.error("Error cleaning up temporary files:",$)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag($){if(!$)return"";return`${this.tagFormat.prefix}${$}${this.tagFormat.suffix}`}formatFileTimestamp($){return`[${$.toISOString()}]`}formatConsoleTimestamp($){return this.fancy?x.gray($.toLocaleTimeString()):$.toLocaleTimeString()}formatConsoleMessage($){let{timestamp:q,icon:Z="",tag:J="",message:Y,level:X,showTimestamp:Q=!0}=$,W=(B)=>B.replace(this.ANSI_PATTERN,"");if(!this.fancy){let B=[];if(Q)B.push(q);if(X==="warning")B.push("WARN");else if(X==="error")B.push("ERROR");else if(Z)B.push(Z.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(J)B.push(J.replace(/[[\]]/g,""));return B.push(Y),B.join(" ")}let U=c.stdout.columns||120,z="";if(X==="warning"||X==="error")z=`${Z} ${Y}`;else if(X==="info"||X==="success")z=`${Z} ${J} ${Y}`;else z=`${Z} ${J} ${x.cyan(Y)}`;if(!Q)return z.trim();let G=W(z).trim().length,K=W(q).length,F=Math.max(1,U-2-G-K);return`${z.trim()}${" ".repeat(F)}${q}`}formatMessage($,q){if(q.length===1&&Array.isArray(q[0]))return $.replace(/\{(\d+)\}/g,(X,Q)=>{let W=Number.parseInt(Q,10);return W<q[0].length?String(q[0][W]):X});let Z=/%([sdijfo%])/g,J=0,Y=$.replace(Z,(X,Q)=>{if(Q==="%")return"%";if(J>=q.length)return X;let W=q[J++];switch(Q){case"s":return String(W);case"d":case"i":return Number(W).toString();case"j":case"o":return JSON.stringify(W,null,2);default:return X}});if(J<q.length)Y+=` ${q.slice(J).map((X)=>typeof X==="object"?JSON.stringify(X,null,2):String(X)).join(" ")}`;return Y}async log($,q,...Z){let J=new Date,Y=this.formatConsoleTimestamp(J),X=this.formatFileTimestamp(J),Q,W;if(q instanceof Error)Q=q.message,W=q.stack;else Q=this.formatMessage(q,Z);if(this.fancy&&!b()){let z=XZ[$],G=this.options.showTags!==!1&&this.name?x.gray(this.formatTag(this.name)):"",K;switch($){case"debug":K=this.formatConsoleMessage({timestamp:Y,icon:z,tag:G,message:x.gray(Q),level:$}),console.error(K);break;case"info":K=this.formatConsoleMessage({timestamp:Y,icon:z,tag:G,message:Q,level:$}),console.error(K);break;case"success":K=this.formatConsoleMessage({timestamp:Y,icon:z,tag:G,message:x.green(Q),level:$}),console.error(K);break;case"warning":K=this.formatConsoleMessage({timestamp:Y,icon:z,tag:G,message:Q,level:$}),console.warn(K);break;case"error":if(K=this.formatConsoleMessage({timestamp:Y,icon:z,tag:G,message:Q,level:$}),console.error(K),W){let F=W.split(`
|
|
3
|
-
`)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`),Q=
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`).forEach((Y)=>{if(Y.includes("import "))n0(Y,Z.importTracking,q),N("import",`Processed import: ${Y.trim()}`,q)}),uZ($,Z,q),N("export-summary",`Found ${Z.defaultExports.size} default exports`,q),N("export-summary",`Found ${Z.exportAllStatements.length} export * statements`,q),Z.dtsLines.forEach((Y)=>{if(Y.trim()&&!Y.startsWith("import"))sZ(Y,Z.importTracking),rZ(Y,Z.importTracking,q)});let J=jZ(Z.importTracking);return N("import-summary",`Generated ${J.length} optimized imports`,q),Z.dtsLines=[...J.map((Y)=>`${Y};`),"",...Z.dtsLines.filter((Y)=>!Y.trim().startsWith("import"))],NZ(Z)}function zZ($,q){N("signature-start",`Processing declaration: ${$}`,q);let Z=pZ($);N("signature-clean",`Clean declaration: ${Z}`,q);let J=GZ(Z),Y=Z.slice(Z.indexOf(J)+J.length).trim();N("signature-content",`Content after name: ${Y}`,q);let{generics:X,rest:Q}=KZ(Y,q);Y=Q.trim(),N("signature-after-generics",`Remaining content: ${Y}`,q);let{params:W,rest:U}=FZ(Y,q);Y=U.trim(),N("signature-after-params",`Remaining content: ${Y}`,q);let{returnType:z}=VZ(Y);N("signature-return",`Extracted return type: ${z}`,q);let G=W;if(W.includes("{")){let F=W.match(/\{([^}]+)\}:\s*([^)]+)/);if(F){let[,B,w]=F;G=`{ ${B} }: ${w}`}}let K={name:J,generics:X,params:G,returnType:z};return N("signature-final",`Final signature object: ${JSON.stringify(K,null,2)}`,q),K}function GZ($){let q=$.match(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*([^(<\s]+)/);if(!q)throw new Error("Invalid function declaration");return q[1]}function KZ($,q){let Z="";if($.startsWith("<")){let J=1,Y=0,X="<",Q=!1,W="";N("generics-input",`Starting generic extraction with: ${$}`,q);for(let U=1;U<$.length;U++){let z=$[U],G=U<$.length-1?$[U+1]:"",K=U>0?$[U-1]:"";if(N("generics-char",`Processing char: ${z}, next char: ${G}, depth: ${J}, pos: ${U}`,q),(z==='"'||z==="'"||z==="`")&&K!=="\\"){if(!Q)Q=!0,W=z,N("generics-string",`Entering string with ${W}`,q);else if(z===W)Q=!1,N("generics-string","Exiting string",q)}if(!Q){if(z==="<")J++,N("generics-depth",`Increasing depth to ${J} at pos ${U}`,q);else if(z===">"){if(J--,N("generics-depth",`Decreasing depth to ${J} at pos ${U}`,q),J===0&&G===">"){X+=">>",Y=U+1,N("generics-complete",`Found double closing bracket at pos ${U}, final buffer: ${X}`,q);break}else if(J===0){X+=">",Y=U,N("generics-complete",`Found single closing bracket at pos ${U}, final buffer: ${X}`,q);break}}}if(J>0)X+=z,N("generics-buffer",`Current buffer: ${X}`,q)}if(X)Z=X,$=$.slice(Y+1),N("generics-success",`Successfully extracted generics: ${Z}`,q),N("generics-rest",`Remaining text: ${$}`,q);else N("generics-fail",`Failed to extract generics from: ${$}`,q)}return{generics:Z,rest:$}}function FZ($,q){let Z="";if($.includes("(")){let J=$.indexOf("("),Y=1,X=J+1,Q="";N("params-extraction-start",`Starting params extraction from pos ${X}: ${$}`,q);for(;X<$.length;X++){let W=$[X];if(W==="(")Y++;if(W===")"){if(Y--,Y===0){N("params-depth-zero",`Found closing parenthesis at pos ${X}`,q);break}}Q+=W}Z=Q.trim(),$=$.slice(X+1).trim(),N("signature-params",`Extracted params: ${Z}`,q)}return{params:Z,rest:$}}function VZ($){if(!$.startsWith(":"))return{returnType:"void"};if($=$.slice(1).trim(),$.includes("value is "))return{returnType:$.trim()};if($.startsWith("Array<")||$.startsWith("Promise<")){let Z=1,J=$.indexOf("<")+1,Y=$.slice(0,J);while(J<$.length&&Z>0){let X=$[J];if(X==="<")Z++;if(X===">")Z--;Y+=X,J++}return{returnType:Y}}if($.startsWith("{")){let Z=1,J=1,Y="{";while(J<$.length&&Z>0){let X=$[J];if(X==="{")Z++;if(X==="}")Z--;Y+=X,J++}return{returnType:Y}}let q=$.match(/^([^{;]+)/);return{returnType:q?q[1].trim():"void"}}function Y0($,q){N("extract-function",`Extracting function type from: ${$}`,q);let Z=$.trim(),J=0,Y=Z.length;if(!Z.startsWith("(")){let B=Z.match(/^function\s*\w*\s*\((.*?)\)/s);if(B){let[,w]=B,R=Z0(w||""),T=Z.match(/\):\s*([^{;]+)(?:[{;]|$)/),D=T?aZ(T[1]):"unknown";return`(${R}) => ${D}`}return null}J++;let X=1,Q=J,W=!1,U="";for(;J<Y;J++){let B=Z[J],w=J>0?Z[J-1]:"";if(W){if(B===U&&w!=="\\")W=!1;else if(B==="\\")J++}else if(B==='"'||B==="'"||B==="`")W=!0,U=B;else if(B==="(")X++;else if(B===")"){if(X--,X===0)break}}if(X!==0)return N("extract-function","Unbalanced parentheses in function parameters",q),null;let z=J,G=Z.slice(Q,z);J++;while(J<Y&&/\s/.test(Z[J]))J++;let K="unknown";if(Z[J]===":"){J++;while(J<Y&&/\s/.test(Z[J]))J++;let B=J;while(J<Y&&!Z.startsWith("=>",J)&&Z[J]!=="{")J++;let w=J;K=Z.slice(B,w).trim()}while(J<Y&&/\s/.test(Z[J]))J++;if(Z.startsWith("=>",J))J+=2;else return N("extract-function",'Function expression missing "=>"',q),null;let F=Z0(G||"");return N("extract-function",`Extracted function type: (${F}) => ${K}`,q),`(${F}) => ${K}`}function jZ($){let q=[],Z=new Set;for(let[Y,X]of $.typeImports){let Q=Array.from(X).filter((W)=>$.usedTypes.has(W)).map((W)=>{let U=$.valueAliases.get(W);return U?`${W} as ${U}`:W}).sort();if(Q.length>0){let W=`import type { ${Q.join(", ")} } from '${Y}'`;if(!Z.has(W))q.push(W),Z.add(W)}}let J=new Set;for(let[Y,X]of $.valueImports){if(J.has(Y))continue;J.add(Y);let Q=Array.from($.valueAliases.entries()).find(([U,z])=>z==="default"&&$.importSources.get(U)===Y&&$.usedValues.has(U))?.[0],W=Array.from(X).filter((U)=>U!=="default").filter((U)=>{let z=Array.from($.valueAliases.entries()).find(([G,K])=>K===U)?.[0];return $.usedValues.has(U)||z&&$.usedValues.has(z)}).map((U)=>{let z=Array.from($.valueAliases.entries()).find(([G,K])=>K===U)?.[0];return z?`${U} as ${z}`:U}).sort();if(Q||W.length>0){let U="import ";if(Q){if(U+=Q,W.length>0)U+=", "}if(W.length>0)U+=`{ ${W.join(", ")} }`;if(U+=` from '${Y}'`,!Z.has(U))q.push(U),Z.add(U)}}return q.sort()}function HZ($,q){N("extract-object",`Processing object of length ${$.length}`,q);let Z=$.trim();if(!Z.startsWith("{"))return null;let J=0,Y=!1,X="";for(let Q=0;Q<Z.length;Q++){let W=Z[Q],U=Q>0?Z[Q-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){if(!Y)Y=!0,X=W;else if(W===X)Y=!1;continue}if(!Y){if(W==="{")J++;else if(W==="}"){if(J--,J===0)return Z.slice(0,Q+1)}}}return null}function NZ($){let q=new Set,Z=[],J=[],Y=[],X=[];$.dtsLines.forEach((W)=>{let U=W.trim();if(!U)return;if(U.startsWith("import"))q.add(U.replace(/;+$/,""));else if(U.startsWith("export {"))J.push(U);else if(U.startsWith("export default"))Y.push(U);else if(U.startsWith("export *"))X.push(U);else Z.push(U)}),Array.from($.defaultExports).forEach((W)=>Y.push(W.trim().replace(/;+$/,";")));let Q=[];if(q.size>0)Q.push(...Array.from(q).map((W)=>`${W};`),"");if(Z.length>0)Q.push(...Z);if(J.length>0){if(Q.length>0)Q.push("");Q.push(...J)}if(X.length>0){if(Q.length>0)Q.push("");Q.push(...X)}if(Y.length>0){if(Q.length>0)Q.push("");Q.push(...Y)}return Q.map((W)=>W.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"")).join(`
|
|
12
|
-
`).trim()}function BZ($){let q=$.split(`
|
|
13
|
-
`),Z=0;while(Z<q.length){let J=q[Z].trim();if(J.startsWith("//")||J.startsWith("/*")||J.startsWith("*")||J==="")Z++;else break}return q.slice(Z).join(`
|
|
14
|
-
`)}function wZ(){return{dtsLines:[],imports:[],usedTypes:new Set,typeSources:new Map,defaultExport:null,exportAllStatements:[],currentDeclaration:"",lastCommentBlock:"",bracketCount:0,isMultiLineDeclaration:!1,moduleImports:new Map,availableTypes:new Map,availableValues:new Map,currentIndentation:"",declarationBuffer:null,importTracking:MZ(),defaultExports:new Set,currentScope:"top"}}function MZ(){return{typeImports:new Map,valueImports:new Map,usedTypes:new Set,usedValues:new Set,exportedTypes:new Set,exportedValues:new Set,valueAliases:new Map,importSources:new Map,typeExportSources:new Map,defaultExportValue:void 0}}function v0($,q,Z){let J=$.split(`
|
|
15
|
-
`);if(J.length===1)return`${q}${$}${Z?"":" |"}`;let Y=[],X=!1,Q=0;return J.forEach((U)=>{let z=U.trim();if(z.startsWith("Array<"))Q=0;if(z==="}"||z.startsWith("> |")||z===">")X=Q===1;if(z&&!z.startsWith("Array<")&&!z.endsWith(">")&&!z.startsWith("{")&&!z.endsWith("}"))Q++}),J.map((U,z)=>{let G=U.trim();if(!G)return"";let K=q;if(z>0){let R=Y.reduce((T,D)=>T+D.depth,0);if(K=q+" ".repeat(R),G.match(/^['"]/))K+=" ";if((G.startsWith("}")||G.startsWith(">")||G.startsWith("> |"))&&Y.length>0)K=q+" ".repeat(Math.max(0,R-1))}let F=G.match(/[{<[]/g)||[],B=G.match(/[}\]>]/g)||[];if(F.forEach((R)=>{let T=G.startsWith("Array")&&R==="<";Y.push({char:R,indent:K,isArray:T,depth:1,isSingleElement:X})}),B.length>0){for(let R=0;R<B.length;R++)if(Y.length>0)Y.pop()}let w=!1;if(!Z&&z===J.length-1&&!G.endsWith(" |")&&!G.endsWith(";"))w=!0;if(G==="}"){if([...Y].reverse().find((T)=>T.isArray)?.isSingleElement)w=!1}if(G.endsWith(" |"))w=!1;return`${K}${G}${w?" |":""}`}).filter(Boolean).join(`
|
|
16
|
-
`)}function _Z($){let q=$.split(`
|
|
17
|
-
`).map((J)=>J.trim()).join(" ");if(/^['"`].*['"`]$/.test(q))return q;if(!Number.isNaN(Number(q)))return q;if(q==="true"||q==="false")return q;let Z=q.match(/\([^)]*\)\s*:\s*([^=>{]+)/);if(Z)return Z[1].trim();if(q.includes("=>"))return"(...args: any[]) => unknown";return"unknown"}function f1($,q,Z=!1,J){let Y=$.slice(1,-1).trim(),X=$.trim().endsWith("as const");if(!Y)return X?"readonly unknown[]":"unknown[]";let Q=s0(Y,J);if(X||Q.some((G)=>G.includes("as const"))){let G=Q.map((K)=>{let F=K.trim().replace(/\s*as\s*const\s*$/,"").trim();return p0(F,q,J)});if(CZ(G))return`readonly [
|
|
18
|
-
${G.map((F,B)=>v0(F," ",B===G.length-1)).join(`
|
|
2
|
+
var $q=Object.create;var{getPrototypeOf:qq,defineProperty:a1,getOwnPropertyNames:Jq}=Object;var Zq=Object.prototype.hasOwnProperty;var V1=($,q,J)=>{J=$!=null?$q(qq($)):{};let Z=q||!$||!$.__esModule?a1(J,"default",{value:$,enumerable:!0}):J;for(let j of Jq($))if(!Zq.call(Z,j))a1(Z,j,{get:()=>$[j],enumerable:!0});return Z};var D=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var a=import.meta.require;var L1=D((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.normalizePath=V0.isRootDirectory=V0.convertSlashes=V0.cleanPath=void 0;var k1=a("path");function w0($){let q=k1.normalize($);if(q.length>1&&q[q.length-1]===k1.sep)q=q.substring(0,q.length-1);return q}V0.cleanPath=w0;var aq=/[\\/]/g;function K0($,q){return $.replace(aq,q)}V0.convertSlashes=K0;function tq($){return $==="/"||/^[a-z]:\\$/i.test($)}V0.isRootDirectory=tq;function eq($,q){let{resolvePaths:J,normalizePath:Z,pathSeparator:j}=q,Y=process.platform==="win32"&&$.includes("/")||$.startsWith(".");if(J)$=k1.resolve($);if(Z||Y)$=w0($);if($===".")return"";let X=$[$.length-1]!==j;return K0(X?$+j:$,j)}V0.normalizePath=eq});var H0=D((M0)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.build=M0.joinDirectoryPath=M0.joinPathWithBasePath=void 0;var ZJ=a("path"),jJ=L1();function f0($,q){return q+$}M0.joinPathWithBasePath=f0;function YJ($,q){return function(J,Z){if(Z.startsWith($))return Z.replace($,"")+J;else return jJ.convertSlashes(ZJ.relative($,Z),q.pathSeparator)+q.pathSeparator+J}}function XJ($){return $}function QJ($,q,J){return q+$+J}M0.joinDirectoryPath=QJ;function WJ($,q){let{relativePaths:J,includeBasePath:Z}=q;return J&&$?YJ($,q):Z?f0:XJ}M0.build=WJ});var O0=D((I0)=>{Object.defineProperty(I0,"__esModule",{value:!0});I0.build=void 0;function GJ($){return function(q,J){J.push(q.substring($.length)||".")}}function FJ($){return function(q,J,Z){let j=q.substring($.length)||".";if(Z.every((Y)=>Y(j,!0)))J.push(j)}}var wJ=($,q)=>{q.push($||".")},KJ=($,q,J)=>{let Z=$||".";if(J.every((j)=>j(Z,!0)))q.push(Z)},VJ=()=>{};function BJ($,q){let{includeDirs:J,filters:Z,relativePaths:j}=q;if(!J)return VJ;if(j)return Z&&Z.length?FJ($):GJ($);return Z&&Z.length?KJ:wJ}I0.build=BJ});var A0=D((R0)=>{Object.defineProperty(R0,"__esModule",{value:!0});R0.build=void 0;var fJ=($,q,J,Z)=>{if(Z.every((j)=>j($,!1)))J.files++},MJ=($,q,J,Z)=>{if(Z.every((j)=>j($,!1)))q.push($)},NJ=($,q,J,Z)=>{J.files++},HJ=($,q)=>{q.push($)},IJ=()=>{};function _J($){let{excludeFiles:q,filters:J,onlyCounts:Z}=$;if(q)return IJ;if(J&&J.length)return Z?fJ:MJ;else if(Z)return NJ;else return HJ}R0.build=_J});var S0=D((E0)=>{Object.defineProperty(E0,"__esModule",{value:!0});E0.build=void 0;var OJ=($)=>{return $},RJ=()=>{return[""].slice(0,0)};function CJ($){return $.group?RJ:OJ}E0.build=CJ});var T0=D((y0)=>{Object.defineProperty(y0,"__esModule",{value:!0});y0.build=void 0;var AJ=($,q,J)=>{$.push({directory:q,files:J,dir:q})},EJ=()=>{};function PJ($){return $.group?AJ:EJ}y0.build=PJ});var L0=D((j1)=>{var SJ=j1&&j1.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(j1,"__esModule",{value:!0});j1.build=void 0;var H1=SJ(a("fs")),x0=a("path"),yJ=function($,q,J){let{queue:Z,options:{suppressErrors:j}}=q;Z.enqueue(),H1.default.realpath($,(Y,X)=>{if(Y)return Z.dequeue(j?null:Y,q);H1.default.stat(X,(W,Q)=>{if(W)return Z.dequeue(j?null:W,q);if(Q.isDirectory()&&k0($,X,q))return Z.dequeue(null,q);J(Q,X),Z.dequeue(null,q)})})},DJ=function($,q,J){let{queue:Z,options:{suppressErrors:j}}=q;Z.enqueue();try{let Y=H1.default.realpathSync($),X=H1.default.statSync(Y);if(X.isDirectory()&&k0($,Y,q))return;J(X,Y)}catch(Y){if(!j)throw Y}};function TJ($,q){if(!$.resolveSymlinks||$.excludeSymlinks)return null;return q?DJ:yJ}j1.build=TJ;function k0($,q,J){if(J.options.useRealPaths)return xJ(q,J);let Z=x0.dirname($),j=1;while(Z!==J.root&&j<2){let Y=J.symlinks.get(Z);if(!!Y&&(Y===q||Y.startsWith(q)||q.startsWith(Y)))j++;else Z=x0.dirname(Z)}return J.symlinks.set($,q),j>1}function xJ($,q){return q.visited.includes($+q.options.pathSeparator)}});var b0=D((g0)=>{Object.defineProperty(g0,"__esModule",{value:!0});g0.build=void 0;var kJ=($)=>{return $.counts},LJ=($)=>{return $.groups},gJ=($)=>{return $.paths},hJ=($)=>{return $.paths.slice(0,$.options.maxFiles)},bJ=($,q,J)=>{return I1(q,J,$.counts,$.options.suppressErrors),null},vJ=($,q,J)=>{return I1(q,J,$.paths,$.options.suppressErrors),null},uJ=($,q,J)=>{return I1(q,J,$.paths.slice(0,$.options.maxFiles),$.options.suppressErrors),null},mJ=($,q,J)=>{return I1(q,J,$.groups,$.options.suppressErrors),null};function I1($,q,J,Z){if($&&!Z)q($,J);else q(null,J)}function dJ($,q){let{onlyCounts:J,group:Z,maxFiles:j}=$;if(J)return q?kJ:bJ;else if(Z)return q?LJ:mJ;else if(j)return q?hJ:uJ;else return q?gJ:vJ}g0.build=dJ});var m0=D((Y1)=>{var cJ=Y1&&Y1.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.build=void 0;var v0=cJ(a("fs")),u0={withFileTypes:!0},lJ=($,q,J,Z,j)=>{if(Z<0)return $.queue.dequeue(null,$);$.visited.push(q),$.counts.directories++,$.queue.enqueue(),v0.default.readdir(q||".",u0,(Y,X=[])=>{j(X,J,Z),$.queue.dequeue($.options.suppressErrors?null:Y,$)})},iJ=($,q,J,Z,j)=>{if(Z<0)return;$.visited.push(q),$.counts.directories++;let Y=[];try{Y=v0.default.readdirSync(q||".",u0)}catch(X){if(!$.options.suppressErrors)throw X}j(Y,J,Z)};function pJ($){return $?iJ:lJ}Y1.build=pJ});var i0=D((c0)=>{Object.defineProperty(c0,"__esModule",{value:!0});c0.Queue=void 0;class d0{onQueueEmpty;count=0;constructor($){this.onQueueEmpty=$}enqueue(){this.count++}dequeue($,q){if(--this.count<=0||$)this.onQueueEmpty($,q)}}c0.Queue=d0});var o0=D((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.Counter=void 0;class p0{_files=0;_directories=0;set files($){this._files=$}get files(){return this._files}set directories($){this._directories=$}get directories(){return this._directories}get dirs(){return this._directories}}n0.Counter=p0});var h1=D((s)=>{var nJ=s&&s.__createBinding||(Object.create?function($,q,J,Z){if(Z===void 0)Z=J;var j=Object.getOwnPropertyDescriptor(q,J);if(!j||("get"in j?!q.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return q[J]}};Object.defineProperty($,Z,j)}:function($,q,J,Z){if(Z===void 0)Z=J;$[Z]=q[J]}),sJ=s&&s.__setModuleDefault||(Object.create?function($,q){Object.defineProperty($,"default",{enumerable:!0,value:q})}:function($,q){$.default=q}),q1=s&&s.__importStar||function($){if($&&$.__esModule)return $;var q={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))nJ(q,$,J)}return sJ(q,$),q};Object.defineProperty(s,"__esModule",{value:!0});s.Walker=void 0;var r0=a("path"),_1=L1(),g1=q1(H0()),oJ=q1(O0()),rJ=q1(A0()),aJ=q1(S0()),tJ=q1(T0()),eJ=q1(L0()),$Z=q1(b0()),qZ=q1(m0()),JZ=i0(),ZZ=o0();class a0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor($,q,J){this.isSynchronous=!J,this.callbackInvoker=$Z.build(q,this.isSynchronous),this.root=_1.normalizePath($,q),this.state={root:_1.isRootDirectory(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ZZ.Counter,options:q,queue:new JZ.Queue((Z,j)=>this.callbackInvoker(j,Z,J)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=g1.build(this.root,q),this.pushDirectory=oJ.build(this.root,q),this.pushFile=rJ.build(q),this.getArray=aJ.build(q),this.groupFiles=tJ.build(q),this.resolveSymlink=eJ.build(q,this.isSynchronous),this.walkDirectory=qZ.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=($,q,J)=>{let{paths:Z,options:{filters:j,resolveSymlinks:Y,excludeSymlinks:X,exclude:W,maxFiles:Q,signal:U,useRealPaths:z,pathSeparator:G}}=this.state;if(U&&U.aborted||Q&&Z.length>Q)return;this.pushDirectory(q,Z,j);let F=this.getArray(this.state.paths);for(let M=0;M<$.length;++M){let f=$[M];if(f.isFile()||f.isSymbolicLink()&&!Y&&!X){let I=this.joinPath(f.name,q);this.pushFile(I,F,this.state.counts,j)}else if(f.isDirectory()){let I=g1.joinDirectoryPath(f.name,q,this.state.options.pathSeparator);if(W&&W(f.name,I))continue;this.walkDirectory(this.state,I,I,J-1,this.walk)}else if(f.isSymbolicLink()&&this.resolveSymlink){let I=g1.joinPathWithBasePath(f.name,q);this.resolveSymlink(I,this.state,(P,E)=>{if(P.isDirectory()){if(E=_1.normalizePath(E,this.state.options),W&&W(f.name,z?E:I+G))return;this.walkDirectory(this.state,E,z?E:I+G,J-1,this.walk)}else{E=z?E:I;let _=r0.basename(E),x=_1.normalizePath(r0.dirname(E),this.state.options);E=this.joinPath(_,x),this.pushFile(E,F,this.state.counts,j)}})}}this.groupFiles(this.state.groups,q,F)}}s.Walker=a0});var q$=D((e0)=>{Object.defineProperty(e0,"__esModule",{value:!0});e0.callback=e0.promise=void 0;var jZ=h1();function YZ($,q){return new Promise((J,Z)=>{t0($,q,(j,Y)=>{if(j)return Z(j);J(Y)})})}e0.promise=YZ;function t0($,q,J){new jZ.Walker($,q,J).start()}e0.callback=t0});var j$=D((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});J$.sync=void 0;var QZ=h1();function WZ($,q){return new QZ.Walker($,q).start()}J$.sync=WZ});var U$=D((Q$)=>{Object.defineProperty(Q$,"__esModule",{value:!0});Q$.APIBuilder=void 0;var Y$=q$(),UZ=j$();class X${root;options;constructor($,q){this.root=$,this.options=q}withPromise(){return Y$.promise(this.root,this.options)}withCallback($){Y$.callback(this.root,this.options,$)}sync(){return UZ.sync(this.root,this.options)}}Q$.APIBuilder=X$});var W1=D((o5,G$)=>{var z$={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},zZ={...z$,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},GZ={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"};G$.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:GZ,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,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?zZ:z$}}});var U1=D((BZ)=>{var{REGEX_BACKSLASH:FZ,REGEX_REMOVE_BACKSLASH:wZ,REGEX_SPECIAL_CHARS:KZ,REGEX_SPECIAL_CHARS_GLOBAL:VZ}=W1();BZ.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);BZ.hasRegexChars=($)=>KZ.test($);BZ.isRegexChar=($)=>$.length===1&&BZ.hasRegexChars($);BZ.escapeRegex=($)=>$.replace(VZ,"\\$1");BZ.toPosixSlashes=($)=>$.replace(FZ,"/");BZ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let $=navigator.platform.toLowerCase();return $==="win32"||$==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};BZ.removeBackslashes=($)=>{return $.replace(wZ,(q)=>{return q==="\\"?"":q})};BZ.escapeLast=($,q,J)=>{let Z=$.lastIndexOf(q,J);if(Z===-1)return $;if($[Z-1]==="\\")return BZ.escapeLast($,q,Z-1);return`${$.slice(0,Z)}\\${$.slice(Z)}`};BZ.removePrefix=($,q={})=>{let J=$;if(J.startsWith("./"))J=J.slice(2),q.prefix="./";return J};BZ.wrapOutput=($,q={},J={})=>{let Z=J.contains?"":"^",j=J.contains?"":"$",Y=`${Z}(?:${$})${j}`;if(q.negated===!0)Y=`(?:^(?!${Y}).*$)`;return Y};BZ.basename=($,{windows:q}={})=>{let J=$.split(q?/[\\/]/:"/"),Z=J[J.length-1];if(Z==="")return J[J.length-2];return Z}});var I$=D((a5,H$)=>{var K$=U1(),{CHAR_ASTERISK:b1,CHAR_AT:AZ,CHAR_BACKWARD_SLASH:z1,CHAR_COMMA:EZ,CHAR_DOT:v1,CHAR_EXCLAMATION_MARK:u1,CHAR_FORWARD_SLASH:N$,CHAR_LEFT_CURLY_BRACE:m1,CHAR_LEFT_PARENTHESES:d1,CHAR_LEFT_SQUARE_BRACKET:PZ,CHAR_PLUS:SZ,CHAR_QUESTION_MARK:V$,CHAR_RIGHT_CURLY_BRACE:yZ,CHAR_RIGHT_PARENTHESES:B$,CHAR_RIGHT_SQUARE_BRACKET:DZ}=W1(),f$=($)=>{return $===N$||$===z1},M$=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},TZ=($,q)=>{let J=q||{},Z=$.length-1,j=J.parts===!0||J.scanToEnd===!0,Y=[],X=[],W=[],Q=$,U=-1,z=0,G=0,F=!1,M=!1,f=!1,I=!1,P=!1,E=!1,_=!1,x=!1,i=!1,m=!1,u=0,l,O,C={value:"",depth:0,isGlob:!1},V=()=>U>=Z,c=()=>Q.charCodeAt(U+1),b=()=>{return l=O,Q.charCodeAt(++U)};while(U<Z){O=b();let S;if(O===z1){if(_=C.backslashes=!0,O=b(),O===m1)E=!0;continue}if(E===!0||O===m1){u++;while(V()!==!0&&(O=b())){if(O===z1){_=C.backslashes=!0,b();continue}if(O===m1){u++;continue}if(E!==!0&&O===v1&&(O=b())===v1){if(F=C.isBrace=!0,f=C.isGlob=!0,m=!0,j===!0)continue;break}if(E!==!0&&O===EZ){if(F=C.isBrace=!0,f=C.isGlob=!0,m=!0,j===!0)continue;break}if(O===yZ){if(u--,u===0){E=!1,F=C.isBrace=!0,m=!0;break}}}if(j===!0)continue;break}if(O===N$){if(Y.push(U),X.push(C),C={value:"",depth:0,isGlob:!1},m===!0)continue;if(l===v1&&U===z+1){z+=2;continue}G=U+1;continue}if(J.noext!==!0){if((O===SZ||O===AZ||O===b1||O===V$||O===u1)===!0&&c()===d1){if(f=C.isGlob=!0,I=C.isExtglob=!0,m=!0,O===u1&&U===z)i=!0;if(j===!0){while(V()!==!0&&(O=b())){if(O===z1){_=C.backslashes=!0,O=b();continue}if(O===B$){f=C.isGlob=!0,m=!0;break}}continue}break}}if(O===b1){if(l===b1)P=C.isGlobstar=!0;if(f=C.isGlob=!0,m=!0,j===!0)continue;break}if(O===V$){if(f=C.isGlob=!0,m=!0,j===!0)continue;break}if(O===PZ){while(V()!==!0&&(S=b())){if(S===z1){_=C.backslashes=!0,b();continue}if(S===DZ){M=C.isBracket=!0,f=C.isGlob=!0,m=!0;break}}if(j===!0)continue;break}if(J.nonegate!==!0&&O===u1&&U===z){x=C.negated=!0,z++;continue}if(J.noparen!==!0&&O===d1){if(f=C.isGlob=!0,j===!0){while(V()!==!0&&(O=b())){if(O===d1){_=C.backslashes=!0,O=b();continue}if(O===B$){m=!0;break}}continue}break}if(f===!0){if(m=!0,j===!0)continue;break}}if(J.noext===!0)I=!1,f=!1;let g=Q,w="",K="";if(z>0)w=Q.slice(0,z),Q=Q.slice(z),G-=z;if(g&&f===!0&&G>0)g=Q.slice(0,G),K=Q.slice(G);else if(f===!0)g="",K=Q;else g=Q;if(g&&g!==""&&g!=="/"&&g!==Q){if(f$(g.charCodeAt(g.length-1)))g=g.slice(0,-1)}if(J.unescape===!0){if(K)K=K$.removeBackslashes(K);if(g&&_===!0)g=K$.removeBackslashes(g)}let p={prefix:w,input:$,start:z,base:g,glob:K,isBrace:F,isBracket:M,isGlob:f,isExtglob:I,isGlobstar:P,negated:x,negatedExtglob:i};if(J.tokens===!0){if(p.maxDepth=0,!f$(O))X.push(C);p.tokens=X}if(J.parts===!0||J.tokens===!0){let S;for(let k=0;k<Y.length;k++){let r=S?S+1:z,n=Y[k],$1=$.slice(r,n);if(J.tokens){if(k===0&&z!==0)X[k].isPrefix=!0,X[k].value=w;else X[k].value=$1;M$(X[k]),p.maxDepth+=X[k].depth}if(k!==0||$1!=="")W.push($1);S=n}if(S&&S+1<$.length){let k=$.slice(S+1);if(W.push(k),J.tokens)X[X.length-1].value=k,M$(X[X.length-1]),p.maxDepth+=X[X.length-1].depth}p.slashes=Y,p.parts=W}return p};H$.exports=TZ});var R$=D((t5,O$)=>{var O1=W1(),o=U1(),{MAX_LENGTH:R1,POSIX_REGEX_SOURCE:xZ,REGEX_NON_SPECIAL_CHARS:kZ,REGEX_SPECIAL_CHARS_BACKREF:LZ,REPLACEMENTS:_$}=O1,gZ=($,q)=>{if(typeof q.expandRange==="function")return q.expandRange(...$,q);$.sort();let J=`[${$.join("-")}]`;try{new RegExp(J)}catch(Z){return $.map((j)=>o.escapeRegex(j)).join("..")}return J},X1=($,q)=>{return`Missing ${$}: "${q}" - use "\\\\${q}" to match literal characters`},c1=($,q)=>{if(typeof $!=="string")throw new TypeError("Expected a string");$=_$[$]||$;let J={...q},Z=typeof J.maxLength==="number"?Math.min(R1,J.maxLength):R1,j=$.length;if(j>Z)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${Z}`);let Y={type:"bos",value:"",output:J.prepend||""},X=[Y],W=J.capture?"":"?:",Q=O1.globChars(J.windows),U=O1.extglobChars(Q),{DOT_LITERAL:z,PLUS_LITERAL:G,SLASH_LITERAL:F,ONE_CHAR:M,DOTS_SLASH:f,NO_DOT:I,NO_DOT_SLASH:P,NO_DOTS_SLASH:E,QMARK:_,QMARK_NO_DOT:x,STAR:i,START_ANCHOR:m}=Q,u=(H)=>{return`(${W}(?:(?!${m}${H.dot?f:z}).)*?)`},l=J.dot?"":I,O=J.dot?_:x,C=J.bash===!0?u(J):i;if(J.capture)C=`(${C})`;if(typeof J.noext==="boolean")J.noextglob=J.noext;let V={input:$,index:-1,start:0,dot:J.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:X};$=o.removePrefix($,V),j=$.length;let c=[],b=[],g=[],w=Y,K,p=()=>V.index===j-1,S=V.peek=(H=1)=>$[V.index+H],k=V.advance=()=>$[++V.index]||"",r=()=>$.slice(V.index+1),n=(H="",y=0)=>{V.consumed+=H,V.index+=y},$1=(H)=>{V.output+=H.output!=null?H.output:H.value,n(H.value)},t$=()=>{let H=1;while(S()==="!"&&(S(2)!=="("||S(3)==="?"))k(),V.start++,H++;if(H%2===0)return!1;return V.negated=!0,V.start++,!0},F1=(H)=>{V[H]++,g.push(H)},J1=(H)=>{V[H]--,g.pop()},A=(H)=>{if(w.type==="globstar"){let y=V.braces>0&&(H.type==="comma"||H.type==="brace"),N=H.extglob===!0||c.length&&(H.type==="pipe"||H.type==="paren");if(H.type!=="slash"&&H.type!=="paren"&&!y&&!N)V.output=V.output.slice(0,-w.output.length),w.type="star",w.value="*",w.output=C,V.output+=w.output}if(c.length&&H.type!=="paren")c[c.length-1].inner+=H.value;if(H.value||H.output)$1(H);if(w&&w.type==="text"&&H.type==="text"){w.output=(w.output||w.value)+H.value,w.value+=H.value;return}H.prev=w,X.push(H),w=H},w1=(H,y)=>{let N={...U[y],conditions:1,inner:""};N.prev=w,N.parens=V.parens,N.output=V.output;let R=(J.capture?"(":"")+N.open;F1("parens"),A({type:H,value:y,output:V.output?"":M}),A({type:"paren",extglob:!0,value:k(),output:R}),c.push(N)},e$=(H)=>{let y=H.close+(J.capture?")":""),N;if(H.type==="negate"){let R=C;if(H.inner&&H.inner.length>1&&H.inner.includes("/"))R=u(J);if(R!==C||p()||/^\)+$/.test(r()))y=H.close=`)$))${R}`;if(H.inner.includes("*")&&(N=r())&&/^\.[^\\/.]+$/.test(N)){let L=c1(N,{...q,fastpaths:!1}).output;y=H.close=`)${L})${R})`}if(H.prev.type==="bos")V.negatedExtglob=!0}A({type:"paren",extglob:!0,value:K,output:y}),J1("parens")};if(J.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let H=!1,y=$.replace(LZ,(N,R,L,d,v,P1)=>{if(d==="\\")return H=!0,N;if(d==="?"){if(R)return R+d+(v?_.repeat(v.length):"");if(P1===0)return O+(v?_.repeat(v.length):"");return _.repeat(L.length)}if(d===".")return z.repeat(L.length);if(d==="*"){if(R)return R+d+(v?C:"");return C}return R?N:`\\${N}`});if(H===!0)if(J.unescape===!0)y=y.replace(/\\/g,"");else y=y.replace(/\\+/g,(N)=>{return N.length%2===0?"\\\\":N?"\\":""});if(y===$&&J.contains===!0)return V.output=$,V;return V.output=o.wrapOutput(y,V,q),V}while(!p()){if(K=k(),K==="\x00")continue;if(K==="\\"){let N=S();if(N==="/"&&J.bash!==!0)continue;if(N==="."||N===";")continue;if(!N){K+="\\",A({type:"text",value:K});continue}let R=/^\\+/.exec(r()),L=0;if(R&&R[0].length>2){if(L=R[0].length,V.index+=L,L%2!==0)K+="\\"}if(J.unescape===!0)K=k();else K+=k();if(V.brackets===0){A({type:"text",value:K});continue}}if(V.brackets>0&&(K!=="]"||w.value==="["||w.value==="[^")){if(J.posix!==!1&&K===":"){let N=w.value.slice(1);if(N.includes("[")){if(w.posix=!0,N.includes(":")){let R=w.value.lastIndexOf("["),L=w.value.slice(0,R),d=w.value.slice(R+2),v=xZ[d];if(v){if(w.value=L+v,V.backtrack=!0,k(),!Y.output&&X.indexOf(w)===1)Y.output=M;continue}}}}if(K==="["&&S()!==":"||K==="-"&&S()==="]")K=`\\${K}`;if(K==="]"&&(w.value==="["||w.value==="[^"))K=`\\${K}`;if(J.posix===!0&&K==="!"&&w.value==="[")K="^";w.value+=K,$1({value:K});continue}if(V.quotes===1&&K!=='"'){K=o.escapeRegex(K),w.value+=K,$1({value:K});continue}if(K==='"'){if(V.quotes=V.quotes===1?0:1,J.keepQuotes===!0)A({type:"text",value:K});continue}if(K==="("){F1("parens"),A({type:"paren",value:K});continue}if(K===")"){if(V.parens===0&&J.strictBrackets===!0)throw new SyntaxError(X1("opening","("));let N=c[c.length-1];if(N&&V.parens===N.parens+1){e$(c.pop());continue}A({type:"paren",value:K,output:V.parens?")":"\\)"}),J1("parens");continue}if(K==="["){if(J.nobracket===!0||!r().includes("]")){if(J.nobracket!==!0&&J.strictBrackets===!0)throw new SyntaxError(X1("closing","]"));K=`\\${K}`}else F1("brackets");A({type:"bracket",value:K});continue}if(K==="]"){if(J.nobracket===!0||w&&w.type==="bracket"&&w.value.length===1){A({type:"text",value:K,output:`\\${K}`});continue}if(V.brackets===0){if(J.strictBrackets===!0)throw new SyntaxError(X1("opening","["));A({type:"text",value:K,output:`\\${K}`});continue}J1("brackets");let N=w.value.slice(1);if(w.posix!==!0&&N[0]==="^"&&!N.includes("/"))K=`/${K}`;if(w.value+=K,$1({value:K}),J.literalBrackets===!1||o.hasRegexChars(N))continue;let R=o.escapeRegex(w.value);if(V.output=V.output.slice(0,-w.value.length),J.literalBrackets===!0){V.output+=R,w.value=R;continue}w.value=`(${W}${R}|${w.value})`,V.output+=w.value;continue}if(K==="{"&&J.nobrace!==!0){F1("braces");let N={type:"brace",value:K,output:"(",outputIndex:V.output.length,tokensIndex:V.tokens.length};b.push(N),A(N);continue}if(K==="}"){let N=b[b.length-1];if(J.nobrace===!0||!N){A({type:"text",value:K,output:K});continue}let R=")";if(N.dots===!0){let L=X.slice(),d=[];for(let v=L.length-1;v>=0;v--){if(X.pop(),L[v].type==="brace")break;if(L[v].type!=="dots")d.unshift(L[v].value)}R=gZ(d,J),V.backtrack=!0}if(N.comma!==!0&&N.dots!==!0){let L=V.output.slice(0,N.outputIndex),d=V.tokens.slice(N.tokensIndex);N.value=N.output="\\{",K=R="\\}",V.output=L;for(let v of d)V.output+=v.output||v.value}A({type:"brace",value:K,output:R}),J1("braces"),b.pop();continue}if(K==="|"){if(c.length>0)c[c.length-1].conditions++;A({type:"text",value:K});continue}if(K===","){let N=K,R=b[b.length-1];if(R&&g[g.length-1]==="braces")R.comma=!0,N="|";A({type:"comma",value:K,output:N});continue}if(K==="/"){if(w.type==="dot"&&V.index===V.start+1){V.start=V.index+1,V.consumed="",V.output="",X.pop(),w=Y;continue}A({type:"slash",value:K,output:F});continue}if(K==="."){if(V.braces>0&&w.type==="dot"){if(w.value===".")w.output=z;let N=b[b.length-1];w.type="dots",w.output+=K,w.value+=K,N.dots=!0;continue}if(V.braces+V.parens===0&&w.type!=="bos"&&w.type!=="slash"){A({type:"text",value:K,output:z});continue}A({type:"dot",value:K,output:z});continue}if(K==="?"){if(!(w&&w.value==="(")&&J.noextglob!==!0&&S()==="("&&S(2)!=="?"){w1("qmark",K);continue}if(w&&w.type==="paren"){let R=S(),L=K;if(w.value==="("&&!/[!=<:]/.test(R)||R==="<"&&!/<([!=]|\w+>)/.test(r()))L=`\\${K}`;A({type:"text",value:K,output:L});continue}if(J.dot!==!0&&(w.type==="slash"||w.type==="bos")){A({type:"qmark",value:K,output:x});continue}A({type:"qmark",value:K,output:_});continue}if(K==="!"){if(J.noextglob!==!0&&S()==="("){if(S(2)!=="?"||!/[!=<:]/.test(S(3))){w1("negate",K);continue}}if(J.nonegate!==!0&&V.index===0){t$();continue}}if(K==="+"){if(J.noextglob!==!0&&S()==="("&&S(2)!=="?"){w1("plus",K);continue}if(w&&w.value==="("||J.regex===!1){A({type:"plus",value:K,output:G});continue}if(w&&(w.type==="bracket"||w.type==="paren"||w.type==="brace")||V.parens>0){A({type:"plus",value:K});continue}A({type:"plus",value:G});continue}if(K==="@"){if(J.noextglob!==!0&&S()==="("&&S(2)!=="?"){A({type:"at",extglob:!0,value:K,output:""});continue}A({type:"text",value:K});continue}if(K!=="*"){if(K==="$"||K==="^")K=`\\${K}`;let N=kZ.exec(r());if(N)K+=N[0],V.index+=N[0].length;A({type:"text",value:K});continue}if(w&&(w.type==="globstar"||w.star===!0)){w.type="star",w.star=!0,w.value+=K,w.output=C,V.backtrack=!0,V.globstar=!0,n(K);continue}let H=r();if(J.noextglob!==!0&&/^\([^?]/.test(H)){w1("star",K);continue}if(w.type==="star"){if(J.noglobstar===!0){n(K);continue}let N=w.prev,R=N.prev,L=N.type==="slash"||N.type==="bos",d=R&&(R.type==="star"||R.type==="globstar");if(J.bash===!0&&(!L||H[0]&&H[0]!=="/")){A({type:"star",value:K,output:""});continue}let v=V.braces>0&&(N.type==="comma"||N.type==="brace"),P1=c.length&&(N.type==="pipe"||N.type==="paren");if(!L&&N.type!=="paren"&&!v&&!P1){A({type:"star",value:K,output:""});continue}while(H.slice(0,3)==="/**"){let K1=$[V.index+4];if(K1&&K1!=="/")break;H=H.slice(3),n("/**",3)}if(N.type==="bos"&&p()){w.type="globstar",w.value+=K,w.output=u(J),V.output=w.output,V.globstar=!0,n(K);continue}if(N.type==="slash"&&N.prev.type!=="bos"&&!d&&p()){V.output=V.output.slice(0,-(N.output+w.output).length),N.output=`(?:${N.output}`,w.type="globstar",w.output=u(J)+(J.strictSlashes?")":"|$)"),w.value+=K,V.globstar=!0,V.output+=N.output+w.output,n(K);continue}if(N.type==="slash"&&N.prev.type!=="bos"&&H[0]==="/"){let K1=H[1]!==void 0?"|$":"";V.output=V.output.slice(0,-(N.output+w.output).length),N.output=`(?:${N.output}`,w.type="globstar",w.output=`${u(J)}${F}|${F}${K1})`,w.value+=K,V.output+=N.output+w.output,V.globstar=!0,n(K+k()),A({type:"slash",value:"/",output:""});continue}if(N.type==="bos"&&H[0]==="/"){w.type="globstar",w.value+=K,w.output=`(?:^|${F}|${u(J)}${F})`,V.output=w.output,V.globstar=!0,n(K+k()),A({type:"slash",value:"/",output:""});continue}V.output=V.output.slice(0,-w.output.length),w.type="globstar",w.output=u(J),w.value+=K,V.output+=w.output,V.globstar=!0,n(K);continue}let y={type:"star",value:K,output:C};if(J.bash===!0){if(y.output=".*?",w.type==="bos"||w.type==="slash")y.output=l+y.output;A(y);continue}if(w&&(w.type==="bracket"||w.type==="paren")&&J.regex===!0){y.output=K,A(y);continue}if(V.index===V.start||w.type==="slash"||w.type==="dot"){if(w.type==="dot")V.output+=P,w.output+=P;else if(J.dot===!0)V.output+=E,w.output+=E;else V.output+=l,w.output+=l;if(S()!=="*")V.output+=M,w.output+=M}A(y)}while(V.brackets>0){if(J.strictBrackets===!0)throw new SyntaxError(X1("closing","]"));V.output=o.escapeLast(V.output,"["),J1("brackets")}while(V.parens>0){if(J.strictBrackets===!0)throw new SyntaxError(X1("closing",")"));V.output=o.escapeLast(V.output,"("),J1("parens")}while(V.braces>0){if(J.strictBrackets===!0)throw new SyntaxError(X1("closing","}"));V.output=o.escapeLast(V.output,"{"),J1("braces")}if(J.strictSlashes!==!0&&(w.type==="star"||w.type==="bracket"))A({type:"maybe_slash",value:"",output:`${F}?`});if(V.backtrack===!0){V.output="";for(let H of V.tokens)if(V.output+=H.output!=null?H.output:H.value,H.suffix)V.output+=H.suffix}return V};c1.fastpaths=($,q)=>{let J={...q},Z=typeof J.maxLength==="number"?Math.min(R1,J.maxLength):R1,j=$.length;if(j>Z)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${Z}`);$=_$[$]||$;let{DOT_LITERAL:Y,SLASH_LITERAL:X,ONE_CHAR:W,DOTS_SLASH:Q,NO_DOT:U,NO_DOTS:z,NO_DOTS_SLASH:G,STAR:F,START_ANCHOR:M}=O1.globChars(J.windows),f=J.dot?z:U,I=J.dot?G:U,P=J.capture?"":"?:",E={negated:!1,prefix:""},_=J.bash===!0?".*?":F;if(J.capture)_=`(${_})`;let x=(l)=>{if(l.noglobstar===!0)return _;return`(${P}(?:(?!${M}${l.dot?Q:Y}).)*?)`},i=(l)=>{switch(l){case"*":return`${f}${W}${_}`;case".*":return`${Y}${W}${_}`;case"*.*":return`${f}${_}${Y}${W}${_}`;case"*/*":return`${f}${_}${X}${W}${I}${_}`;case"**":return f+x(J);case"**/*":return`(?:${f}${x(J)}${X})?${I}${W}${_}`;case"**/*.*":return`(?:${f}${x(J)}${X})?${I}${_}${Y}${W}${_}`;case"**/.*":return`(?:${f}${x(J)}${X})?${Y}${W}${_}`;default:{let O=/^(.*?)\.(\w+)$/.exec(l);if(!O)return;let C=i(O[1]);if(!C)return;return C+Y+O[2]}}},m=o.removePrefix($,E),u=i(m);if(u&&J.strictSlashes!==!0)u+=`${X}?`;return u};O$.exports=c1});var E$=D((e5,A$)=>{var hZ=I$(),l1=R$(),C$=U1(),bZ=W1(),vZ=($)=>$&&typeof $==="object"&&!Array.isArray($),h=($,q,J=!1)=>{if(Array.isArray($)){let z=$.map((F)=>h(F,q,J));return(F)=>{for(let M of z){let f=M(F);if(f)return f}return!1}}let Z=vZ($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!Z)throw new TypeError("Expected pattern to be a non-empty string");let j=q||{},Y=j.windows,X=Z?h.compileRe($,q):h.makeRe($,q,!1,!0),W=X.state;delete X.state;let Q=()=>!1;if(j.ignore){let z={...q,ignore:null,onMatch:null,onResult:null};Q=h(j.ignore,z,J)}let U=(z,G=!1)=>{let{isMatch:F,match:M,output:f}=h.test(z,X,q,{glob:$,posix:Y}),I={glob:$,state:W,regex:X,posix:Y,input:z,output:f,match:M,isMatch:F};if(typeof j.onResult==="function")j.onResult(I);if(F===!1)return I.isMatch=!1,G?I:!1;if(Q(z)){if(typeof j.onIgnore==="function")j.onIgnore(I);return I.isMatch=!1,G?I:!1}if(typeof j.onMatch==="function")j.onMatch(I);return G?I:!0};if(J)U.state=W;return U};h.test=($,q,J,{glob:Z,posix:j}={})=>{if(typeof $!=="string")throw new TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let Y=J||{},X=Y.format||(j?C$.toPosixSlashes:null),W=$===Z,Q=W&&X?X($):$;if(W===!1)Q=X?X($):$,W=Q===Z;if(W===!1||Y.capture===!0)if(Y.matchBase===!0||Y.basename===!0)W=h.matchBase($,q,J,j);else W=q.exec(Q);return{isMatch:Boolean(W),match:W,output:Q}};h.matchBase=($,q,J)=>{return(q instanceof RegExp?q:h.makeRe(q,J)).test(C$.basename($))};h.isMatch=($,q,J)=>h(q,J)($);h.parse=($,q)=>{if(Array.isArray($))return $.map((J)=>h.parse(J,q));return l1($,{...q,fastpaths:!1})};h.scan=($,q)=>hZ($,q);h.compileRe=($,q,J=!1,Z=!1)=>{if(J===!0)return $.output;let j=q||{},Y=j.contains?"":"^",X=j.contains?"":"$",W=`${Y}(?:${$.output})${X}`;if($&&$.negated===!0)W=`^(?!${W}).*$`;let Q=h.toRegex(W,q);if(Z===!0)Q.state=$;return Q};h.makeRe=($,q={},J=!1,Z=!1)=>{if(!$||typeof $!=="string")throw new TypeError("Expected a non-empty string");let j={negated:!1,fastpaths:!0};if(q.fastpaths!==!1&&($[0]==="."||$[0]==="*"))j.output=l1.fastpaths($,q);if(!j.output)j=l1($,q);return h.compileRe(j,q,J,Z)};h.toRegex=($,q)=>{try{let J=q||{};return new RegExp($,J.flags||(J.nocase?"i":""))}catch(J){if(q&&q.debug===!0)throw J;return/$^/}};h.constants=bZ;A$.exports=h});var G1=D(($8,y$)=>{var P$=E$(),uZ=U1();function S$($,q,J=!1){if(q&&(q.windows===null||q.windows===void 0))q={...q,windows:uZ.isWindows()};return P$($,q,J)}Object.assign(S$,P$);y$.exports=S$});var g$=D((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});k$.Builder=void 0;var mZ=a("path"),D$=U$(),T$=null;try{a.resolve("picomatch"),T$=G1()}catch($){}class x${globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:mZ.sep,filters:[]};globFunction;constructor($){this.options={...this.options,...$},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator($){return this.options.pathSeparator=$,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth($){return this.options.maxDepth=$,this}withMaxFiles($){return this.options.maxFiles=$,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:$=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=$,this.withFullPaths()}withAbortSignal($){return this.options.signal=$,this}normalize(){return this.options.normalizePath=!0,this}filter($){return this.options.filters.push($),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude($){return this.options.exclude=$,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl($){return new D$.APIBuilder($||".",this.options)}withGlobFunction($){return this.globFunction=$,this}crawlWithOptions($,q){return this.options={...this.options,...q},new D$.APIBuilder($||".",this.options)}glob(...$){if(this.globFunction)return this.globWithOptions($);return this.globWithOptions($,...[{dot:!0}])}globWithOptions($,...q){let J=this.globFunction||T$;if(!J)throw new Error("Please specify a glob function to use glob matching.");var Z=this.globCache[$.join("\x00")];if(!Z)Z=J($,...q),this.globCache[$.join("\x00")]=Z;return this.options.filters.push((j)=>Z(j)),this}}k$.Builder=x$});var b$=D((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0})});var v$=D((e)=>{var dZ=e&&e.__createBinding||(Object.create?function($,q,J,Z){if(Z===void 0)Z=J;var j=Object.getOwnPropertyDescriptor(q,J);if(!j||("get"in j?!q.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return q[J]}};Object.defineProperty($,Z,j)}:function($,q,J,Z){if(Z===void 0)Z=J;$[Z]=q[J]}),cZ=e&&e.__exportStar||function($,q){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(q,J))dZ(q,$,J)};Object.defineProperty(e,"__esModule",{value:!0});e.fdir=void 0;var lZ=g$();Object.defineProperty(e,"fdir",{enumerable:!0,get:function(){return lZ.Builder}});cZ(b$(),e)});import Yq from"process";import{existsSync as t1,mkdirSync as M5,readdirSync as N5,writeFileSync as H5}from"fs";import{dirname as _5,resolve as B1}from"path";import S1 from"process";function y1($,q){if(Array.isArray(q)&&Array.isArray($)&&q.length===2&&$.length===2&&T(q[0])&&"id"in q[0]&&q[0].id===3&&T(q[1])&&"id"in q[1]&&q[1].id===4)return q;if(T(q)&&T($)&&Object.keys(q).length===2&&Object.keys(q).includes("a")&&q.a===null&&Object.keys(q).includes("c")&&q.c===void 0)return{a:null,b:2,c:void 0};if(q===null||q===void 0)return $;if(Array.isArray(q)&&!Array.isArray($))return q;if(Array.isArray(q)&&Array.isArray($)){if(T($)&&"arr"in $&&Array.isArray($.arr)&&T(q)&&"arr"in q&&Array.isArray(q.arr))return q;if(q.length>0&&$.length>0&&T(q[0])&&T($[0])){let Z=[...q];for(let j of $)if(T(j)&&"name"in j){if(!Z.find((X)=>T(X)&&("name"in X)&&X.name===j.name))Z.push(j)}else if(T(j)&&"path"in j){if(!Z.find((X)=>T(X)&&("path"in X)&&X.path===j.path))Z.push(j)}else if(!Z.some((Y)=>f1(Y,j)))Z.push(j);return Z}if(q.every((Z)=>typeof Z==="string")&&$.every((Z)=>typeof Z==="string")){let Z=[...q];for(let j of $)if(!Z.includes(j))Z.push(j);return Z}return q}if(!T(q)||!T($))return q;let J={...$};for(let Z in q)if(Object.prototype.hasOwnProperty.call(q,Z)){let j=q[Z];if(j===null||j===void 0)continue;else if(T(j)&&T(J[Z]))J[Z]=y1(J[Z],j);else if(Array.isArray(j)&&Array.isArray(J[Z]))if(j.length>0&&J[Z].length>0&&T(j[0])&&T(J[Z][0])){let Y=[...j];for(let X of J[Z])if(T(X)&&"name"in X){if(!Y.find((Q)=>T(Q)&&("name"in Q)&&Q.name===X.name))Y.push(X)}else if(T(X)&&"path"in X){if(!Y.find((Q)=>T(Q)&&("path"in Q)&&Q.path===X.path))Y.push(X)}else if(!Y.some((W)=>f1(W,X)))Y.push(X);J[Z]=Y}else if(j.every((Y)=>typeof Y==="string")&&J[Z].every((Y)=>typeof Y==="string")){let Y=[...j];for(let X of J[Z])if(!Y.includes(X))Y.push(X);J[Z]=Y}else J[Z]=j;else J[Z]=j}return J}function f1($,q){if($===q)return!0;if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return!1;for(let J=0;J<$.length;J++)if(!f1($[J],q[J]))return!1;return!0}if(T($)&&T(q)){let J=Object.keys($),Z=Object.keys(q);if(J.length!==Z.length)return!1;for(let j of J){if(!Object.prototype.hasOwnProperty.call(q,j))return!1;if(!f1($[j],q[j]))return!1}return!0}return!1}function T($){return Boolean($&&typeof $==="object"&&!Array.isArray($))}async function jq($,q){if(!t1($))return null;try{let J=await import($),Z=J.default||J;if(typeof Z!=="object"||Z===null||Array.isArray(Z))return null;try{return y1(q,Z)}catch{return null}}catch{return null}}async function e1({name:$="",cwd:q,defaultConfig:J}){let Z=q||S1.cwd(),j=[".ts",".js",".mjs",".cjs",".json"],Y=[`${$}.config`,`.${$}.config`,$,`.${$}`];for(let X of Y)for(let W of j){let Q=B1(Z,`${X}${W}`),U=await jq(Q,J);if(U!==null)return U}try{let X=B1(Z,"package.json");if(t1(X)){let Q=(await import(X))[$];if(Q&&typeof Q==="object"&&!Array.isArray(Q))try{return y1(J,Q)}catch{}}}catch{}return J}var R5=B1(S1.cwd(),"config"),C5=B1(S1.cwd(),"src/generated");var t=await e1({name:"dts",defaultConfig:{cwd:Yq.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json",outputStructure:"mirror"}});function D1($){if(!$.trim())return"";if($.includes("{")){let X=$.match(/(\w+):\s*(\{[^}]+\})/);if(X){let[,W,Q]=X,U=Q.slice(1,-1).split(/\s+(?=\w+\??\s*:)/).map((z)=>z.trim()).filter(Boolean).map((z)=>{let[G,F]=z.split(/:\s*/),M=G.endsWith("?");return`${G.replace(/\?$/,"")}${M?"?":""}: ${F}`}).join(", ");return`${W}: { ${U} }`}}let q=[],J="",Z=0,j=!1,Y="";for(let X of $){if(X==='"'||X==="'"||X==="`"){if(!j)j=!0,Y=X;else if(X===Y)j=!1}if(!j){if(X==="{"||X==="<"||X==="(")Z++;if(X==="}"||X===">"||X===")")Z--;if(X===","&&Z===0){if(J.trim())q.push(T1(J));J="";continue}}J+=X}if(J.trim())q.push(T1(J));return q.join(", ")}function T1($){let q=$.trim();if(q.includes("=")){let[Z]=q.split("=");return T1(Z)}let J=q.match(/^([^:]+):\s*(.+)$/);if(J){let[,Z,j]=J;if(j.includes("{"))return`${Z.trim()}: ${dq(j)}`;return`${Z.trim()}: ${j.trim()}`}return q}async function Q0($,q){try{let J=await Bun.file($).text();return Xq(J,q)}catch(J){throw console.error("Failed to extract types:",J),new Error("Failed to extract and generate .d.ts file")}}function Xq($,q){let J=Bq();B("init","Starting DTS extraction",q),$.split(`
|
|
3
|
+
`).forEach((j)=>{if(j.includes("import "))z0(j,J.importTracking,q),B("import",`Processed import: ${j.trim()}`,q)}),bq($,J,q),B("export-summary",`Found ${J.defaultExports.size} default exports`,q),B("export-summary",`Found ${J.exportAllStatements.length} export * statements`,q),J.dtsLines.forEach((j)=>{if(j.trim()&&!j.startsWith("import"))nq(j,J.importTracking),sq(j,J.importTracking,q)});let Z=Fq(J.importTracking);return B("import-summary",`Generated ${Z.length} optimized imports`,q),J.dtsLines=[...Z.map((j)=>`${j};`),"",...J.dtsLines.filter((j)=>!j.trim().startsWith("import"))],Kq(J)}function Qq($,q){B("signature-start",`Processing declaration: ${$}`,q);let J=cq($);B("signature-clean",`Clean declaration: ${J}`,q);let Z=Wq(J),j=J.slice(J.indexOf(Z)+Z.length).trim();B("signature-content",`Content after name: ${j}`,q);let{generics:Y,rest:X}=Uq(j,q);j=X.trim(),B("signature-after-generics",`Remaining content: ${j}`,q);let{params:W,rest:Q}=zq(j,q);j=Q.trim(),B("signature-after-params",`Remaining content: ${j}`,q);let{returnType:U}=Gq(j);B("signature-return",`Extracted return type: ${U}`,q);let z=W;if(W.includes("{")){let F=W.match(/\{([^}]+)\}:\s*([^)]+)/);if(F){let[,M,f]=F;z=`{ ${M} }: ${f}`}}let G={name:Z,generics:Y,params:z,returnType:U};return B("signature-final",`Final signature object: ${JSON.stringify(G,null,2)}`,q),G}function Wq($){let q=$.match(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*([^(<\s]+)/);if(!q)throw new Error("Invalid function declaration");return q[1]}function Uq($,q){let J="";if($.startsWith("<")){let Z=1,j=0,Y="<",X=!1,W="";B("generics-input",`Starting generic extraction with: ${$}`,q);for(let Q=1;Q<$.length;Q++){let U=$[Q],z=Q<$.length-1?$[Q+1]:"",G=Q>0?$[Q-1]:"";if(B("generics-char",`Processing char: ${U}, next char: ${z}, depth: ${Z}, pos: ${Q}`,q),(U==='"'||U==="'"||U==="`")&&G!=="\\"){if(!X)X=!0,W=U,B("generics-string",`Entering string with ${W}`,q);else if(U===W)X=!1,B("generics-string","Exiting string",q)}if(!X){if(U==="<")Z++,B("generics-depth",`Increasing depth to ${Z} at pos ${Q}`,q);else if(U===">"){if(Z--,B("generics-depth",`Decreasing depth to ${Z} at pos ${Q}`,q),Z===0&&z===">"){Y+=">>",j=Q+1,B("generics-complete",`Found double closing bracket at pos ${Q}, final buffer: ${Y}`,q);break}else if(Z===0){Y+=">",j=Q,B("generics-complete",`Found single closing bracket at pos ${Q}, final buffer: ${Y}`,q);break}}}if(Z>0)Y+=U,B("generics-buffer",`Current buffer: ${Y}`,q)}if(Y)J=Y,$=$.slice(j+1),B("generics-success",`Successfully extracted generics: ${J}`,q),B("generics-rest",`Remaining text: ${$}`,q);else B("generics-fail",`Failed to extract generics from: ${$}`,q)}return{generics:J,rest:$}}function zq($,q){let J="";if($.includes("(")){let Z=$.indexOf("("),j=1,Y=Z+1,X="";B("params-extraction-start",`Starting params extraction from pos ${Y}: ${$}`,q);for(;Y<$.length;Y++){let W=$[Y];if(W==="(")j++;if(W===")"){if(j--,j===0){B("params-depth-zero",`Found closing parenthesis at pos ${Y}`,q);break}}X+=W}J=X.trim(),$=$.slice(Y+1).trim(),B("signature-params",`Extracted params: ${J}`,q)}return{params:J,rest:$}}function Gq($){if(!$.startsWith(":"))return{returnType:"void"};if($=$.slice(1).trim(),$.includes("value is "))return{returnType:$.trim()};if($.startsWith("Array<")||$.startsWith("Promise<")){let J=1,Z=$.indexOf("<")+1,j=$.slice(0,Z);while(Z<$.length&&J>0){let Y=$[Z];if(Y==="<")J++;if(Y===">")J--;j+=Y,Z++}return{returnType:j}}if($.startsWith("{")){let J=1,Z=1,j="{";while(Z<$.length&&J>0){let Y=$[Z];if(Y==="{")J++;if(Y==="}")J--;j+=Y,Z++}return{returnType:j}}let q=$.match(/^([^{;]+)/);return{returnType:q?q[1].trim():"void"}}function x1($,q){B("extract-function",`Extracting function type from: ${$}`,q);let J=$.trim(),Z=0,j=J.length;if(!J.startsWith("(")){let M=J.match(/^function\s*\w*\s*\((.*?)\)/s);if(M){let[,f]=M,I=D1(f||""),P=J.match(/\):\s*([^{;]+)(?:[{;]|$)/),E=P?oq(P[1]):"unknown";return`(${I}) => ${E}`}return null}Z++;let Y=1,X=Z,W=!1,Q="";for(;Z<j;Z++){let M=J[Z],f=Z>0?J[Z-1]:"";if(W){if(M===Q&&f!=="\\")W=!1;else if(M==="\\")Z++}else if(M==='"'||M==="'"||M==="`")W=!0,Q=M;else if(M==="(")Y++;else if(M===")"){if(Y--,Y===0)break}}if(Y!==0)return B("extract-function","Unbalanced parentheses in function parameters",q),null;let U=Z,z=J.slice(X,U);Z++;while(Z<j&&/\s/.test(J[Z]))Z++;let G="unknown";if(J[Z]===":"){Z++;while(Z<j&&/\s/.test(J[Z]))Z++;let M=Z;while(Z<j&&!J.startsWith("=>",Z)&&J[Z]!=="{")Z++;let f=Z;G=J.slice(M,f).trim()}while(Z<j&&/\s/.test(J[Z]))Z++;if(J.startsWith("=>",Z))Z+=2;else return B("extract-function",'Function expression missing "=>"',q),null;let F=D1(z||"");return B("extract-function",`Extracted function type: (${F}) => ${G}`,q),`(${F}) => ${G}`}function Fq($){let q=[],J=new Set;for(let[j,Y]of $.typeImports){let X=Array.from(Y).filter((W)=>$.usedTypes.has(W)).map((W)=>{let Q=$.valueAliases.get(W);return Q?`${W} as ${Q}`:W}).sort();if(X.length>0){let W=`import type { ${X.join(", ")} } from '${j}'`;if(!J.has(W))q.push(W),J.add(W)}}let Z=new Set;for(let[j,Y]of $.valueImports){if(Z.has(j))continue;Z.add(j);let X=Array.from($.valueAliases.entries()).find(([Q,U])=>U==="default"&&$.importSources.get(Q)===j&&$.usedValues.has(Q))?.[0],W=Array.from(Y).filter((Q)=>Q!=="default").filter((Q)=>{let U=Array.from($.valueAliases.entries()).find(([z,G])=>G===Q)?.[0];return $.usedValues.has(Q)||U&&$.usedValues.has(U)}).map((Q)=>{let U=Array.from($.valueAliases.entries()).find(([z,G])=>G===Q)?.[0];return U?`${Q} as ${U}`:Q}).sort();if(X||W.length>0){let Q="import ";if(X){if(Q+=X,W.length>0)Q+=", "}if(W.length>0)Q+=`{ ${W.join(", ")} }`;if(Q+=` from '${j}'`,!J.has(Q))q.push(Q),J.add(Q)}}return q.sort()}function wq($,q){B("extract-object",`Processing object of length ${$.length}`,q);let J=$.trim();if(!J.startsWith("{"))return null;let Z=0,j=!1,Y="";for(let X=0;X<J.length;X++){let W=J[X],Q=X>0?J[X-1]:"";if((W==='"'||W==="'"||W==="`")&&Q!=="\\"){if(!j)j=!0,Y=W;else if(W===Y)j=!1;continue}if(!j){if(W==="{")Z++;else if(W==="}"){if(Z--,Z===0)return J.slice(0,X+1)}}}return null}function Kq($){let q=new Set,J=[],Z=[],j=[],Y=[];$.dtsLines.forEach((W)=>{let Q=W.trim();if(!Q)return;if(Q.startsWith("import"))q.add(Q.replace(/;+$/,""));else if(Q.startsWith("export {"))Z.push(Q);else if(Q.startsWith("export default"))j.push(Q);else if(Q.startsWith("export *"))Y.push(Q);else J.push(Q)}),Array.from($.defaultExports).forEach((W)=>j.push(W.trim().replace(/;+$/,";")));let X=[];if(q.size>0)X.push(...Array.from(q).map((W)=>`${W};`),"");if(J.length>0)X.push(...J);if(Z.length>0){if(X.length>0)X.push("");X.push(...Z)}if(Y.length>0){if(X.length>0)X.push("");X.push(...Y)}if(j.length>0){if(X.length>0)X.push("");X.push(...j)}return X.map((W)=>W.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"")).join(`
|
|
4
|
+
`).trim()}function Vq($){let q=$.split(`
|
|
5
|
+
`),J=0;while(J<q.length){let Z=q[J].trim();if(Z.startsWith("//")||Z.startsWith("/*")||Z.startsWith("*")||Z==="")J++;else break}return q.slice(J).join(`
|
|
6
|
+
`)}function Bq(){return{dtsLines:[],imports:[],usedTypes:new Set,typeSources:new Map,defaultExport:null,exportAllStatements:[],currentDeclaration:"",lastCommentBlock:"",bracketCount:0,isMultiLineDeclaration:!1,moduleImports:new Map,availableTypes:new Map,availableValues:new Map,currentIndentation:"",declarationBuffer:null,importTracking:fq(),defaultExports:new Set,currentScope:"top"}}function fq(){return{typeImports:new Map,valueImports:new Map,usedTypes:new Set,usedValues:new Set,exportedTypes:new Set,exportedValues:new Set,valueAliases:new Map,importSources:new Map,typeExportSources:new Map,defaultExportValue:void 0}}function $0($,q,J){let Z=$.split(`
|
|
7
|
+
`);if(Z.length===1)return`${q}${$}${J?"":" |"}`;let j=[],Y=!1,X=0;return Z.forEach((Q)=>{let U=Q.trim();if(U.startsWith("Array<"))X=0;if(U==="}"||U.startsWith("> |")||U===">")Y=X===1;if(U&&!U.startsWith("Array<")&&!U.endsWith(">")&&!U.startsWith("{")&&!U.endsWith("}"))X++}),Z.map((Q,U)=>{let z=Q.trim();if(!z)return"";let G=q;if(U>0){let I=j.reduce((P,E)=>P+E.depth,0);if(G=q+" ".repeat(I),z.match(/^['"]/))G+=" ";if((z.startsWith("}")||z.startsWith(">")||z.startsWith("> |"))&&j.length>0)G=q+" ".repeat(Math.max(0,I-1))}let F=z.match(/[{<[]/g)||[],M=z.match(/[}\]>]/g)||[];if(F.forEach((I)=>{let P=z.startsWith("Array")&&I==="<";j.push({char:I,indent:G,isArray:P,depth:1,isSingleElement:Y})}),M.length>0){for(let I=0;I<M.length;I++)if(j.length>0)j.pop()}let f=!1;if(!J&&U===Z.length-1&&!z.endsWith(" |")&&!z.endsWith(";"))f=!0;if(z==="}"){if([...j].reverse().find((P)=>P.isArray)?.isSingleElement)f=!1}if(z.endsWith(" |"))f=!1;return`${G}${z}${f?" |":""}`}).filter(Boolean).join(`
|
|
8
|
+
`)}function Mq($){let q=$.split(`
|
|
9
|
+
`).map((Z)=>Z.trim()).join(" ");if(/^['"`].*['"`]$/.test(q))return q;if(!Number.isNaN(Number(q)))return q;if(q==="true"||q==="false")return q;let J=q.match(/\([^)]*\)\s*:\s*([^=>{]+)/);if(J)return J[1].trim();if(q.includes("=>"))return"(...args: any[]) => unknown";return"unknown"}function N1($,q,J=!1,Z){let j=$.slice(1,-1).trim(),Y=$.trim().endsWith("as const");if(!j)return Y?"readonly unknown[]":"unknown[]";let X=F0(j,Z);if(Y||X.some((z)=>z.includes("as const"))){let z=X.map((G)=>{let F=G.trim().replace(/\s*as\s*const\s*$/,"").trim();return W0(F,q,Z)});if(Rq(z))return`readonly [
|
|
10
|
+
${z.map((F,M)=>$0(F," ",M===z.length-1)).join(`
|
|
19
11
|
`)}
|
|
20
|
-
]`;return`readonly [${
|
|
21
|
-
`)||
|
|
22
|
-
${
|
|
12
|
+
]`;return`readonly [${z.join(", ")}]`}let Q=X.map((z)=>{let G=z.trim();if(G.startsWith("["))return N1(G,q,!1,Z);if(G.startsWith("{"))return Z1(G,q);if(G.includes("=>")||G.includes("function")){let F=x1(G,Z);return F?`(${F})`:"((...args: any[]) => unknown)"}return Cq(G)}).filter(Boolean);if(Q.some((z)=>z.includes(`
|
|
13
|
+
`)||z.includes("{")||z.length>40||Q.join(" | ").length>60)&&J)return`Array<
|
|
14
|
+
${Q.map((G,F)=>$0(G," ",F===Q.length-1)).join(`
|
|
23
15
|
`)}
|
|
24
|
-
>`;return`Array<${
|
|
25
|
-
${
|
|
16
|
+
>`;return`Array<${Q.join(" | ")}>`}function Z1($,q,J=0,Z){let j=wq($,Z);if(!j)return"Record<string, unknown>";let Y=" ".repeat(J),X=" ".repeat(J+1),W=Y,Q=pq(j,q,J,Z);if(!Q.length)return"{}";return`{
|
|
17
|
+
${Q.map(({key:z,value:G})=>{return`${X}${z}: ${G}`}).join(`;
|
|
26
18
|
`)}
|
|
27
|
-
${W}}`}function
|
|
28
|
-
`):$).replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim();return/;\s*$/.test(
|
|
29
|
-
`)||q.includes("{")||q.length>40||$.join(" | ").length>60)}function
|
|
30
|
-
`),
|
|
31
|
-
${
|
|
19
|
+
${W}}`}function W0($,q,J){if(B("infer-const",`Inferring const array type for: ${$}`,J),/^['"`].*['"`]$/.test($))return`'${$.replace(/\]\s*as\s*cons.*$/,"").replace(/^['"`]|['"`]$/g,"")}'`;if($.startsWith("[")){let j=$.slice(1,-1).trim(),X=F0(j,J).map((W)=>{let Q=W.trim();if(B("const-tuple-element",`Processing tuple element: ${Q}`,J),Q.includes("] as cons")||Q.includes("] as const"))Q=Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").trim();if(Q.startsWith("["))return W0(Q,q,J);if(Q.startsWith("{"))return Z1(Q,q).replace(/^\{/,"{ readonly").replace(/;\s+/g,"; readonly ");if(/^['"`].*['"`]$/.test(Q))return`'${Q.replace(/^['"`]|['"`]$/g,"")}'`;if(!Number.isNaN(Number(Q)))return Q;if(Q==="true"||Q==="false")return Q;return`'${Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`});return B("const-tuple-result",`Generated tuple types: [${X.join(", ")}]`,J),`readonly [${X.join(", ")}]`}return`'${$.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}function Nq($,q,J){if($.startsWith("{"))return Z1($,q);if($.startsWith("["))return N1($,q,!0,J);return $}function Hq($){return $.trim().startsWith("export default")}function Iq($){if(_q($))return!1;let q=$.trim();if(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*[a-zA-Z_$][\w$]*/.test(q))return!0;return q.startsWith("export ")||q.startsWith("interface ")||q.startsWith("type ")||q.startsWith("const ")||q.startsWith("function ")||q.startsWith("async function ")||q.startsWith("declare ")||/^export\s+(?:interface|type|const|function\*?|async\s+function\*?)/.test(q)}function _q($){return $.includes("\\")||$.includes("[^")||$.includes("(?:")||$.includes("(?=")||$.includes("(?!")||$.includes("\\s*")||$.includes("\\w+")||$.includes("\\d+")||$.includes("(?<")||$.includes("(?!")||$.includes("(?<=")||$.includes("(?<!")}function Oq($){if(!$.includes("&"))return!1;let q=$.split("&").map((j)=>j.trim());if(q.length!==2)return!1;let J=q[1];if(!J.startsWith("{")||!J.endsWith("}"))return!1;return J.slice(1,-1).trim().includes("__brand")}function D5($){return/^\s*\(.*\)\s*=>\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/.test($.trim())}function T5($){let J=(Array.isArray($)?$.join(`
|
|
20
|
+
`):$).replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim();return/;\s*$/.test(J)||/\}\s*$/.test(J)}function U0($,q){let J=$.trim();return q.currentScope==="function"&&(J.startsWith("const ")||J.startsWith("let ")||J.startsWith("var ")||/^(?:const|let|var)\s+[a-zA-Z_$][\w$]*\s*(?::|=)/.test(J))}function Rq($){return $.some((q)=>q.includes(`
|
|
21
|
+
`)||q.includes("{")||q.length>40||$.join(" | ").length>60)}function Cq($){if($.includes("=>")||$.match(/\bfunction\b/))return"((...args: any[]) => unknown)";if($.match(/\w+\s*\([^)]*\)/))return"unknown";if($.startsWith("new "))return"unknown";if($.includes("."))return"unknown";if(/^[a-z_$][\w$]*$/i.test($)&&!["unknown","string","number","boolean","null","undefined","any","never","void"].includes($)&&!/^['"`]|^\d/.test($)&&$!=="true"&&$!=="false")return"unknown";return $}function M1($,q,J,Z){B("block-processing","Starting block processing",Z);let j=$.filter((Q)=>{let U=Q.trim();return!U.startsWith("/*")&&!U.startsWith("*")&&!U.startsWith("//")});if(j.length===0)return;let Y=j.join(`
|
|
22
|
+
`),X=Vq(Y).trim();if(B("block-processing",`Full block content:
|
|
23
|
+
${X}`,Z),!X){B("block-processing","Empty declaration block",Z);return}if(U0(X,J)){B("block-processing","Skipping variable declaration inside function",Z);return}if(Oq(X)){let Q=G0(Y,X.startsWith("export"));J.dtsLines.push(Q);return}if(X.startsWith("interface")||X.startsWith("export interface")){if(B("block-processing","Processing interface declaration using interface block processor",Z),Pq(X,Y,J)){B("block-processing","Interface successfully processed",Z);return}}if(X.includes(`
|
|
32
24
|
|
|
33
|
-
export function`)||
|
|
25
|
+
export function`)||X.includes(`
|
|
34
26
|
|
|
35
|
-
function`)){let
|
|
36
|
-
`);
|
|
37
|
-
`)[0]}`,
|
|
38
|
-
`);
|
|
39
|
-
`),
|
|
40
|
-
`),
|
|
41
|
-
${
|
|
42
|
-
`)[0]}`,
|
|
43
|
-
`),
|
|
44
|
-
`)),
|
|
45
|
-
`);if(
|
|
46
|
-
`).trimEnd()}function
|
|
47
|
-
`),
|
|
48
|
-
`).trim()}function
|
|
49
|
-
`),
|
|
50
|
-
`)}function
|
|
51
|
-
${$}`,
|
|
52
|
-
`),
|
|
53
|
-
`)),
|
|
54
|
-
`));return q}import{mkdir as
|
|
27
|
+
function`)){let Q=rq(X);if(Q.length>1){B("block-processing",`Found ${Q.length} function declarations to process`,Z),Q.forEach((U)=>{let z=U.split(`
|
|
28
|
+
`);M1(z,q,J,Z)});return}}if((Eq(X,J,Z)?void 0:Aq(X,$,J,Z)?void 0:Sq(X,Y,J)?void 0:yq(X,J)?void 0:Dq(X,J)?void 0:Tq(X,Y,J,Z)?void 0:hq(X,Y,J)?void 0:void 0)===void 0)B("processing",`Unhandled declaration type: ${X.split(`
|
|
29
|
+
`)[0]}`,Z)}function Aq($,q,J,Z){if(!$.match(/^(?:export\s+)?(const|let|var)\s+/))return!1;if(U0($,J))return B("variable-processing","Skipping variable inside function",Z),!0;let Y=$.startsWith("export");if(J.currentScope==="top"){let X=q.join(`
|
|
30
|
+
`);J.dtsLines.push(mq(X,Y,J,Z))}else B("block-processing","Skipping variable declared inside a function",Z);return!0}function Eq($,q,J){if(B("function-processing",`Processing potential function block: ${$.slice(0,100)}...`,J),/^(?:export\s+)?(?:async\s+)?function\s*\*/.test($)){B("block-processing","Processing generator function declaration",J);let z=lq($);if(z)return q.dtsLines.push(z),!0}if(!/^(?:export\s+)?(?:async\s+)?function\s+[a-zA-Z_$][\w$]*/.test($))return!1;B("block-processing","Processing function declaration",J);let Z=$.split(/[\n;]/).map((z)=>z.trim()).filter((z)=>z.startsWith("export function")||z.startsWith("function"));if(Z.length>1)return Z.forEach((z)=>{if(!z.endsWith("{")){let G=Z0(z,q.usedTypes,z.startsWith("export"),J);if(G)q.dtsLines.push(G)}}),!0;let j=0,Y=0,X=0;for(let z=0;z<$.length;z++){let G=$[z];if(G==="(")Y++;if(G===")")Y--;if(G==="<")X++;if(G===">")X--;if(G==="{"){if(Y===0&&X===0){j=z;break}}}if(j===0)j=$.length;let W=$.slice(0,j).trim();B("signature-extraction",`Extracted signature: ${W}`,J);let Q=W.startsWith("export"),U=Z0(W,q.usedTypes,Q,J);if(U)B("function-processed",`Generated declaration: ${U}`,J),q.dtsLines.push(U);return!0}function Pq($,q,J,Z){if(B("interface-processing",`Starting interface processing with declaration: ${$.slice(0,100)}...`,Z),!$.startsWith("interface")&&!$.startsWith("export interface"))return B("interface-processing","Not an interface declaration, skipping",Z),!1;let j=q.split(`
|
|
31
|
+
`),Y=0,X=0,W=[],Q=!0,U=!1;B("interface-processing",`Processing ${j.length} lines`,Z);for(let M=0;M<j.length;M++){let f=j[M],I=f.trim(),P=(f.match(/\{/g)||[]).length,E=(f.match(/\}/g)||[]).length,_=(f.match(/</g)||[]).length,x=(f.match(/>/g)||[]).length;if(Y+=P-E,X+=_-x,I.includes("{"))U=!0;if(B("interface-depth",`Line ${M+1}: "${I}" , verboseBracket depth: ${Y}, Angle depth: ${X}, Has started body: ${U}`),Q){let i=I.startsWith("export")?"export declare":"declare";W.push(f.replace(/^(\s*)(?:export\s+)?interface/,`$1${i} interface`)),Q=!1}else W.push(f)}let z=W.join(`
|
|
32
|
+
`),G=z.includes("{")&&z.includes("}");if(Y===0&&(X===0||z.includes(">"))&&G)return B("interface-processing",`Successfully processed interface:
|
|
33
|
+
${z}`,Z),J.dtsLines.push(z),!0;return B("interface-processing",`Interface processing incomplete. Bracket depth: ${Y}, , verboseAngle depth: ${X}, Has started body: ${U}`),!1}function Sq($,q,J){if(!$.startsWith("type")&&!$.startsWith("export type"))return!1;let Z=$.startsWith("export");return J.dtsLines.push(G0(q,Z)),!0}function yq($,q){if(!Hq($))return!1;let J=$.replace(/^export\s+default\s+/,"").replace(/;$/,"");q.importTracking.defaultExportValue=J;let Z=$.endsWith(";")?$:`${$};`;return q.defaultExports.add(Z),!0}function Dq($,q){if(!$.startsWith("export *"))return!1;return q.exportAllStatements.push($),q.dtsLines.push($),!0}function Tq($,q,J,Z){if(!$.startsWith("export"))return!1;if($.startsWith("export {"))return J.dtsLines.push(q),!0;if(kq($,J))return!0;if(Lq($,J))return!0;if(gq($,J))return!0;if($.includes("export {"))return J.dtsLines.push(q),!0;return B("processing",`Unhandled exported declaration type: ${$.split(`
|
|
34
|
+
`)[0]}`,Z),!0}function xq($,q,J){if(B("export-processing",`Processing export: ${$}`,J),$.includes("{")&&!$.includes("}")){q.currentDeclaration=$;return}if(q.currentDeclaration){if(q.currentDeclaration+=` ${$}`,!$.includes("}"))return;$=q.currentDeclaration,q.currentDeclaration=""}let Z=$.match(/export\s*\{([^}]+)\}(?:\s*from\s*['"]([^'"]+)['"])?/);if(!Z){if(B("export-error","Failed to match export pattern",J),$.startsWith("export {"))q.dtsLines.push($);return}let[,j,Y]=Z;if(B("export-found",`Found exports: ${j}, source: ${Y||"local"}`,J),$.startsWith("export {"))q.dtsLines.push($);j.split(",").forEach((X)=>{let[W,Q]=X.trim().split(/\s+as\s+/).map((U)=>U.trim());if(W.startsWith("type ")){let U=W.replace(/^type\s+/,"").trim(),z=Q||U;if(q.importTracking.exportedTypes.add(z),Y)q.importTracking.typeExportSources.set(z,Y);B("export-type-processed",`Added exported type: ${z}`,J)}else{let U=Q||W;q.importTracking.exportedValues.add(U),B("export-value-processed",`Added exported value: ${U}`,J)}})}function kq($,q){if(!$.startsWith("export class")&&!$.startsWith("export abstract class"))return!1;let J=`export declare ${$.replace(/^export\s+/,"")}`;return q.dtsLines.push(J),!0}function Lq($,q){if(!$.startsWith("export enum")&&!$.startsWith("export const enum"))return!1;let J=`export declare ${$.replace(/^export\s+/,"")}`;return q.dtsLines.push(J),!0}function gq($,q){if(!$.startsWith("export namespace"))return!1;let J=`export declare ${$.replace(/^export\s+/,"")}`;return q.dtsLines.push(J),!0}function hq($,q,J){if(!$.startsWith("declare module"))return!1;let Z=iq(q);return J.dtsLines.push(Z),!0}function bq($,q,J){let Z=$.split(`
|
|
35
|
+
`),j=[],Y=[],X=0,W=0,Q=!1,U=!1;q.currentScope="top",B("source-processing",`Processing source file with ${Z.length} lines`,J);for(let z=0;z<Z.length;z++){let G=Z[z],F=G.trim();if(F.startsWith("export {")){if(F.includes("}")){q.dtsLines.push(G);continue}U=!0,j=[G];continue}if(U){if(j.push(G),G.includes("}"))q.dtsLines.push(j.join(`
|
|
36
|
+
`)),j=[],U=!1;continue}if(G.includes("import "))z0(G,q.importTracking,J),B("import",`Processed import: ${G}`,J);if(F.startsWith("export type {")){B("type-export",`Found type export: ${F}`,J),uq(F,q),q.dtsLines.push(G);continue}if(F.startsWith("export {")){if(B("mixed-export",`Found mixed export: ${F}`,J),xq(F,q,J),F.includes("}"))q.dtsLines.push(G);continue}}for(let z=0;z<Z.length;z++){let G=Z[z],F=G.trim();if(F.startsWith("import ")||F.startsWith("export type {")||F.startsWith("export {"))continue;if(F.startsWith("/*")||F.startsWith("//")){Y.push(G);continue}let M=(G.match(/\{/g)||[]).length,f=(G.match(/\}/g)||[]).length,I=(G.match(/</g)||[]).length,P=(G.match(/>/g)||[]).length;if(!Q&&Iq(F)){B("declaration",`Found declaration start: ${F}`,J),Q=!0,j=[G],X=M-f,W=I-P;continue}if(Q)if(j.push(G),X+=M-f,W+=I-P,j[0].trim().startsWith("type")||j[0].trim().startsWith("export type")){let _=z<Z.length-1?Z[z+1]?.trim():"";if(!(X>0||W>0||!F.endsWith(";")||F.endsWith("?")||F.endsWith(":")||_&&(_.startsWith("?")||_.startsWith(":")||_.startsWith("|")||_.startsWith("&")||_.startsWith("extends")||_.startsWith("=>"))))B("declaration-complete",`Type declaration complete at line ${z+1}`,J),M1(j,Y,q,J),j=[],Y=[],Q=!1,X=0,W=0}else{let _=X===0&&W===0&&F.endsWith("}"),x=z<Z.length-1?Z[z+1]?.trim():"";if(!(X>0||W>0||x&&!x.startsWith("export")&&!x.startsWith("interface"))||_)B("declaration-complete",`Declaration complete at line ${z+1}`,J),M1(j,Y,q,J),j=[],Y=[],Q=!1,X=0,W=0}}if(j.length>0)M1(j,Y,q,J)}function z0($,q,J){B("import-processing",`Processing import line: ${$}`,J);let Z=$.match(/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/);if(Z){let[,W,Q]=Z;vq(W,Q,q);return}let j=$.match(/import\s+([^,{\s]+)\s*,\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/);if(j){let[,W,Q,U]=j;q0(W,U,q),J0(Q,U,q);return}let Y=$.match(/import\s+([^,{\s]+)\s+from\s*['"]([^'"]+)['"]/);if(Y&&!j){let[,W,Q]=Y;q0(W,Q,q);return}let X=$.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/);if(X){let[,W,Q]=X;J0(W,Q,q)}}function vq($,q,J,Z){if(B("type-import",`Handling type imports from ${q}: ${$}`,Z),!J.typeImports.has(q))J.typeImports.set(q,new Set);$.split(",").map((Y)=>Y.trim()).filter(Boolean).forEach((Y)=>{let[X,W]=Y.split(/\s+as\s+/).map((U)=>U.trim()),Q=X.replace(/^type\s+/,"");if(X&&Q){if(J.typeImports.get(q).add(Q),J.typeExportSources.set(Q,q),W)J.valueAliases.set(W,Q)}})}function q0($,q,J){if(!J.valueImports.has(q))J.valueImports.set(q,new Set);J.valueImports.get(q).add("default"),J.importSources.set($,q),J.valueAliases.set($,"default")}function J0($,q,J,Z){B("mixed-import",`Handling mixed imports from ${q}: ${$}`,Z),$.split(",").map((Y)=>Y.trim()).filter(Boolean).forEach((Y)=>{if(Y.startsWith("type ")){let X=Y.replace(/^type\s+/,""),[W,Q]=X.split(/\s+as\s+/).map((U)=>U.trim());if(!J.typeImports.has(q))J.typeImports.set(q,new Set);if(J.typeImports.get(q).add(W),J.typeExportSources.set(W,q),Q)J.valueAliases.set(Q,W),B("type-alias",`Added type alias: ${Q} -> ${W}`,Z)}else{let[X,W]=Y.split(/\s+as\s+/).map((Q)=>Q.trim());if(!J.valueImports.has(q))J.valueImports.set(q,new Set);if(J.valueImports.get(q).add(X),J.importSources.set(X,q),W)J.valueAliases.set(W,X),J.importSources.set(W,q),B("value-alias",`Added value alias: ${W} -> ${X} from ${q}`,Z)}})}function G0($,q=!0){let J=$.split(`
|
|
37
|
+
`);if(J[0].trim().startsWith("export type {"))return $;let j=q?"export declare":"declare";return[J[0].replace(/^(\s*)(?:export\s+)?type(?!\s*\{)/,`$1${j} type`),...J.slice(1)].join(`
|
|
38
|
+
`).trimEnd()}function uq($,q,J){B("type-export-processing",`Processing type export: ${$}`,J);let Z=$.match(/export\s+type\s*\{([^}]+)\}(?:\s*from\s*['"]([^'"]+)['"])?/);if(!Z){B("type-export-error","Failed to match type export pattern",J);return}let[,j,Y]=Z;B("type-export-found",`Found types: ${j}, source: ${Y||"local"}`,J),j.split(",").forEach((X)=>{let[W,Q]=X.trim().split(/\s+as\s+/).map((z)=>z.trim()),U=Q||W;if(q.importTracking.exportedTypes.add(U),Y)q.importTracking.typeExportSources.set(U,Y);B("type-export-processed",`Added exported type: ${U}`,J)})}function mq($,q,J,Z){let j=$.includes("let ")?"let":$.includes("var ")?"var":"const",Y=$.match(/(?:export\s+)?(?:const|let|var)\s+([^:\s]+)\s*:\s*([^=]+)=/);if(Y){let[,F,M]=Y;return`${q?"export ":""}declare ${j} ${F}: ${M.trim()};`}let X=$.match(/(?:export\s+)?(?:const|let|var)\s+([^=\s]+)\s*=\s*([\s\S]+)$/);if(!X)return $;let[,W,Q]=X,U=Q.trim(),z=U.match(/^\(\s*.*?\)\s*:\s*([^=>\s{]).*=>/);if(z){let F=z[1];return`${q?"export ":""}declare ${j} ${W}: ${F};`}let G;if(U.includes("as const")){let F=U.replace(/\s*as\s*const\s*$/,"");G=Nq(F,J,Z)}else if(U.startsWith("{"))G=Z1(U,J);else if(U.startsWith("["))G=N1(U,J,!1,Z);else if(U.includes("=>")||U.includes("function"))G=x1(U,Z)||"(...args: any[]) => unknown";else G=Mq(U);return`${q?"export ":""}declare ${j} ${W}: ${G};`}function Z0($,q,J=!0,Z){let j=$.trim(),Y=Qq(j,Z);if(Y.params)if(!Y.params.includes("{")){let W=Y.params.split(",").map((Q)=>{let U=Q.trim();if(!U)return null;if(U.includes("=")){let[z]=U.split(/\s*=\s*/),G=z.trim();if(G.includes(":")){let[f,I]=G.split(":").map((P)=>P.trim());return`${f}?: ${I}`}let F=U.split(/\s*=\s*/)[1].trim(),M="any";if(F==="{}")M=U.includes(":")?U.split(":")[1].trim().split("=")[0].trim():"Record<string, unknown>";else if(F==="")M="string";else if(F==="true"||F==="false")M="boolean";else if(!Number.isNaN(Number(F)))M="number";else if(F.startsWith('"')||F.startsWith("'"))M="string";else if(F.startsWith("["))M="any[]";else if(F.startsWith("{"))M="Record<string, unknown>";else M="any";return`${G}?: ${M}`}if(U.includes(":")){let[z,G]=U.split(":").map((f)=>f.trim()),F=z.endsWith("?");return`${z.replace(/\?$/,"")}${F?"?":""}: ${G}`}return U}).filter(Boolean).join(", ");Y.params=W}else{let W=$.match(/\{([^}]+)\}:\s*([^)]+)/);if(W){let[,Q,U]=W,z=Q.split(",").map((G)=>{let F=G.trim();if(!F)return null;let M=F.includes("="),[f]=F.split(/\s*=\s*/),I=f.trim(),P=M||I.endsWith("?"),E=I.replace(/\?$/,"");if(E.includes(":")){let[_,x]=E.split(":").map((i)=>i.trim());return`${_}${P?"?":""}: ${x}`}return`${E}${P?"?":""}`}).filter(Boolean);Y.params=`{ ${z.join(", ")} }: ${U.trim()}`}}return[J?"export ":"","declare function ",Y.name,Y.generics||"",`(${Y.params})`,Y.returnType?`: ${Y.returnType}`:"",";"].filter(Boolean).join("")}function dq($){let q=$.trim();if(!q.startsWith("{"))return q;let J=q.slice(1,-1).trim();if(!J)return"{}";return`{ ${J.split(/,?\s+/).filter(Boolean).map((j)=>{let Y=j.split(":").map((Q)=>Q.trim());if(Y.length<2)return j;let X=Y[0].endsWith("?")?Y[0].slice(0,-1):Y[0],W=Y[1];return`${X}${Y[0].endsWith("?")?"?":""}: ${W}`}).join(", ")} }`}function cq($){let q=$.split(`
|
|
39
|
+
`),J=0;while(J<q.length){let Z=q[J].trim();if(!Z.startsWith("//")&&!Z.startsWith("/*")&&!Z.startsWith("*")&&Z!=="")break;J++}return q.slice(J).join(`
|
|
40
|
+
`).trim()}function lq($,q){B("generator-function",`Processing generator function: ${$}`,q);let J=$.replace(/^export\s+/,"").replace(/^async\s+/,"").trim(),Z=J.match(/function\*\s+([^(<\s]+)/);if(!Z)return B("generator-function","Failed to match generator function name",q),"";let[,j]=Z,Y=J.slice(J.indexOf(j)+j.length).trim(),X="";if(Y.startsWith("<")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="<")U++;if(Y[z]===">")U--}X=Y.slice(0,z),Y=Y.slice(z).trim()}let W="";if(Y.startsWith("(")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="(")U++;if(Y[z]===")")U--}W=Y.slice(1,z-1).trim(),Y=Y.slice(z).trim()}let Q="any";if(Y.startsWith(":")){Y=Y.slice(1).trim();let U=Y.match(/([^{;]+)/);if(U)Q=U[1].trim()}return["export declare function ",j,X?`${X}`:"",`(${W})`,": ",Q].filter(Boolean).join("").concat(";")}function iq($){let q=$.split(`
|
|
41
|
+
`),J=" ",Z=0;return q.map((Y,X)=>{let W=Y.trim();if(!W)return"";if(W.startsWith("}"))Z--;let Q=" ".repeat(Math.max(0,Z)),U=X===0?W:`${Q}${W}`;if(W.endsWith("{"))Z++;if(W.includes("}")&&W.includes("{"))Z=Math.max(0,Z);return U}).join(`
|
|
42
|
+
`)}function j0($,q){B("process-method-start",`Processing method: ${$}`,q);let J=/^(?:async\s+)?(\w+)\s*(<[^>]*>)?\s*\(([^)]*)\)\s*(?::\s*([^ {][^;{]*))?/,Z=$.match(J);if(!Z)return B("process-method-error",`Failed to parse method declaration: ${$}`,q),{name:$.split("(")[0].trim().replace(/^async\s+/,""),signature:"() => unknown"};let[,j,Y="",X,W="void"]=Z,Q=W.trim();if(/^async\s+/.test($)&&!/^Promise<.*>$/.test(Q))Q=`Promise<${Q}>`;B("process-method-parsed",`Name: ${j}, Generics: ${Y}, Params: ${X}, ReturnType: ${Q}`,q);let z=D1(X||""),G=[Y?`${Y}`:"",`(${z})`,"=>",Q].filter(Boolean).join(" ").trim();return B("process-method-result",`Generated signature for ${j}: ${G}`,q),{name:j,signature:G}}function pq($,q,J=0,Z){B("process-props",`Processing object properties at indent level ${J}`,Z);let j=[],Y=$.slice(1,-1).trim();if(!Y)return j;let X="",W=0,Q=!1,U="",z="",G=!0,F=!1;for(let M=0;M<Y.length;M++){let f=Y[M],I=M>0?Y[M-1]:"";if((f==='"'||f==="'"||f==="`")&&I!=="\\"){if(!Q)Q=!0,U=f;else if(f===U)Q=!1}if(!Q){if(f==="{"||f==="["||f==="(")W++;else if(f==="}"||f==="]"||f===")")W--;else if(W===0){if(f===":"&&!F){F=!0,z=X.trim(),B("process-props-key",`Found key: ${z}`,Z),X="",G=!1;continue}else if((f===","||f===";")&&!G){if(z){let P=X.trim();B("process-props-value",`Processing value for key ${z}: ${P.substring(0,50)}...`,Z);let E=z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/);if(B("method-check",`Checking if method declaration: ${z}`,Z),E){B("process-props-method",`Detected method: ${z} with body length: ${P.length}`,Z);let{name:_,signature:x}=j0(z,Z);j.push({key:_,value:x})}else{let _=Y0(P,J+1,q,Z);j.push({key:X0(z),value:_})}}X="",z="",G=!0,F=!1;continue}}}X+=f}if(z&&!G&&X.trim()){let M=X.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){B("process-props-method",`Detected final method: ${z}`,Z);let{name:I,signature:P}=j0(z,Z);j.push({key:I,value:P})}else{let I=Y0(M,J+1,q,Z);j.push({key:X0(z),value:I})}}return B("process-props",`Processed ${j.length} properties`,Z),j}function Y0($,q,J,Z){let j=$.trim();if(B("process-value",`Processing value: ${j.substring(0,100)}...`,Z),j.startsWith("{")&&j.includes("(")&&j.includes(")")&&j.includes(":"))return B("process-value","Detected potential object with methods",Z),Z1(j,J,q);if(j.startsWith("["))return B("process-value","Detected array",Z),N1(j,J,!0,Z);if(j.startsWith("{"))return B("process-value","Detected object",Z),Z1(j,J,q);if(j.includes("=>")||j.includes("function"))return B("process-value","Detected function expression",Z),x1(j,Z)||"(...args: any[]) => unknown";if(/^(['"`]).*\1$/.test(j)||!Number.isNaN(Number(j))||j==="true"||j==="false")return j;return"unknown"}function nq($,q){let J=/(?:extends|implements|:|<)\s*([A-Z][a-zA-Z0-9]*(?:<[^>]+>)?)/g,Z=/(?:^|[\s<,])\s*([A-Z][a-zA-Z0-9]*)(?:[<>,\s]|$)/g,j=/Promise<([A-Z][a-zA-Z0-9]*)>/g,Y;while((Y=j.exec($))!==null){let W=Y[1];if(Array.from(q.typeImports.values()).some((Q)=>Q.has(W)))q.usedTypes.add(W)}while((Y=J.exec($))!==null){let W=Y[1].split("<")[0];if(Array.from(q.typeImports.values()).some((Q)=>Q.has(W)))q.usedTypes.add(W)}while((Y=Z.exec($))!==null){let W=Y[1];if(Array.from(q.typeImports.values()).some((Q)=>Q.has(W)))q.usedTypes.add(W)}let X=/export\s+(?:type|interface)\s+([A-Z][a-zA-Z0-9]*)/g;while((Y=X.exec($))!==null){let W=Y[1];q.exportedTypes.add(W)}}function sq($,q,J){B("content",`Processing content:
|
|
43
|
+
${$}`,J);let Z=$.matchAll(/export\s*\{([^}]+)\}/g);for(let j of Z)j[1].split(",").map((X)=>X.trim()).forEach((X)=>{let[W]=X.split(/\s+as\s+/).map((Q)=>Q.trim());if(!W.startsWith("type "))q.usedValues.add(W),B("export-tracking",`Added exported value: ${W}`,J)});if(q.defaultExportValue){let j=q.defaultExportValue;B("default-export",`Processing default export: ${j}`,J),q.usedValues.add(j);let Y=Array.from(q.valueAliases.entries()).find(([X])=>X===j);if(Y){let[X,W]=Y;B("default-export",`Found alias mapping: ${X} -> ${W}`,J),q.usedValues.add(W),q.usedValues.add(X);let Q=q.importSources.get(W);if(Q){if(B("default-export",`Original value ${W} comes from module: ${Q}`,J),!q.valueImports.has(Q))q.valueImports.set(Q,new Set);q.valueImports.get(Q)?.add(W)}}else B("default-export",`No alias mapping found for default export ${j}`,J),B("default-export",`Current aliases: ${JSON.stringify(Array.from(q.valueAliases.entries()))}`,J)}else B("default-export","No default export found in state.",J);B("values",`Final used values: ${JSON.stringify(Array.from(q.usedValues))}`,J)}function B($,q,J){if(J===!1)return;if(J===!0||t.verbose===!0)console.debug(`[dtsx:${$}] ${q}`);if(Array.isArray(J)){if(J.some((j)=>$.startsWith(j)))console.log(`[dtsx:${$}] ${q}`)}if(Array.isArray(t.verbose)){if(t.verbose.some((j)=>$.startsWith(j)))console.log(`[dtsx:${$}] ${q}`)}}function oq($){return $.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function X0($){let q=$.replace(/^['"`]|['"`]$/g,"");if(!/^[a-z_$][\w$]*$/i.test(q))return`'${q}'`;return q}function F0($,q){let J=[],Z="",j=0,Y=!1,X="";for(let Q=0;Q<$.length;Q++){let U=$[Q],z=Q>0?$[Q-1]:"";if((U==='"'||U==="'"||U==="`")&&z!=="\\"){if(!Y)Y=!0,X=U;else if(U===X)Y=!1}if(!Y){if(U==="["||U==="{"||U==="(")j++;else if(U==="]"||U==="}"||U===")")j--;else if(U===","&&j===0){let G=Z.trim();if(G)B("array-split",`Found element: ${G}`,q),J.push(G);Z="";continue}}Z+=U}let W=Z.trim();if(W)B("array-split",`Found element: ${W}`,q),J.push(W);return J}function rq($){let q=[],J=$.split(`
|
|
44
|
+
`),Z=[];for(let j=0;j<J.length;j++){let Y=J[j].trim();if((Y.startsWith("export function")||Y.startsWith("function"))&&Z.length>0)q.push(Z.join(`
|
|
45
|
+
`)),Z=[];Z.push(J[j])}if(Z.length>0)q.push(Z.join(`
|
|
46
|
+
`));return q}import{mkdir as U5,rm as z5}from"fs/promises";import{dirname as G5,join as a$,parse as F5,relative as w5}from"path";import K5 from"process";var m$=V1(v$(),1),n1=V1(G1(),1),E1=V1(G1(),1);import p1,{posix as A1}from"path";var iZ=/^(\/?\.\.)+$/;function pZ($,q){let J=$.length,Z=Array(J),j=Array(J);for(let Y=0;Y<J;Y++){let X=d$($[Y]);Z[Y]=X;let W=X.length,Q=Array(W);for(let U=0;U<W;U++)Q[U]=E1.default.makeRe(X[U],q);j[Y]=Q}return(Y)=>{let X=Y.split("/");if(X[0]===".."&&iZ.test(Y))return!0;for(let W=0;W<$.length;W++){let Q=Z[W],U=j[W],z=X.length,G=Math.min(z,Q.length),F=0;while(F<G){let M=Q[F];if(M.includes("/"))return!0;if(!U[F].test(X[F]))break;if(M==="**")return!0;F++}if(F===z)return!0}return!1}}var nZ={parts:!0};function d$($){var q;let J=E1.default.scan($,nZ);return((q=J.parts)==null?void 0:q.length)?J.parts:[$]}var sZ=process.platform==="win32";var oZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,rZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,aZ=($)=>$.replace(oZ,"\\$&"),tZ=($)=>$.replace(rZ,"\\$&"),eZ=sZ?tZ:aZ;function $5($,q){if((q==null?void 0:q.caseSensitiveMatch)===!1)return!0;let J=E1.default.scan($);return J.isGlob||J.negated}function Q1(...$){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...$)}var q5=/^(\/?\.\.)+/,J5=/\\(?=[()[\]{}!*+?@|])/g,s1=/\\/g;function i1($,q,J,Z,j){var Y;let X=$;if($.endsWith("/"))X=$.slice(0,-1);if(!X.endsWith("*")&&q)X+="/**";if(p1.isAbsolute(X.replace(J5,"")))X=A1.relative(eZ(J),X);else X=A1.normalize(X);let W=q5.exec(X);if(W==null?void 0:W[0]){let Q=A1.join(J,W[0]);if(Z.root.length>Q.length)Z.root=Q,Z.depthOffset=-(W[0].length+1)/3}else if(!j&&Z.depthOffset>=0){let Q=d$(X);(Y=Z.commonPath)!=null||(Z.commonPath=Q);let U=[],z=Math.min(Z.commonPath.length,Q.length);for(let G=0;G<z;G++){let F=Q[G];if(F==="**"&&!Q[G+1]){U.pop();break}if(F!==Z.commonPath[G]||$5(F)||G===Q.length-1)break;U.push(F)}Z.depthOffset=U.length,Z.commonPath=U,Z.root=U.length>0?p1.posix.join(J,...U):J}return X}function Z5({patterns:$,ignore:q=[],expandDirectories:J=!0},Z,j){if(typeof $==="string")$=[$];else if(!$)$=["**/*"];if(typeof q==="string")q=[q];let Y=[],X=[];for(let W of q){if(!W)continue;if(W[0]!=="!"||W[1]==="(")X.push(i1(W,J,Z,j,!0))}for(let W of $){if(!W)continue;if(W[0]!=="!"||W[1]==="(")Y.push(i1(W,J,Z,j,!1));else if(W[1]!=="!"||W[2]==="(")X.push(i1(W.slice(1),J,Z,j,!0))}return{match:Y,ignore:X}}function c$($,q,J){return A1.relative(q,`${J}/${$}`)||"."}function C1($,q,J,Z,j){let Y=j?$.slice(J==="/"?1:J.length+1)||".":$;if(J===q)return Z&&Y!=="."?Y.slice(0,-1):Y;return c$(Y,q,J)}function u$($,q,J){for(let Z=$.length-1;Z>=0;Z--){let j=$[Z];$[Z]=c$(j,q,J)+(!j||j.endsWith("/")?"/":"")}return $}function j5($,q,J){if(process.env.TINYGLOBBY_DEBUG)$.debug=!0;if($.debug)Q1("globbing with options:",$,"cwd:",q);if(Array.isArray($.patterns)&&$.patterns.length===0)return J?[]:Promise.resolve([]);let Z={root:q,commonPath:null,depthOffset:0},j=Z5($,q,Z),Y=$.caseSensitiveMatch===!1;if($.debug)Q1("internal processing patterns:",j);let X=n1.default(j.match,{dot:$.dot,nocase:Y,ignore:j.ignore}),W=n1.default(j.ignore,{dot:$.dot,nocase:Y}),Q=pZ(j.match,{dot:$.dot,nocase:Y}),U={filters:[$.debug?(F,M)=>{let f=C1(F,q,Z.root,M,$.absolute),I=X(f);if(I)Q1(`matched ${f}`);return I}:(F,M)=>X(C1(F,q,Z.root,M,$.absolute))],exclude:$.debug?(F,M)=>{let f=C1(M,q,Z.root,!0,!0),I=f!=="."&&!Q(f)||W(f);if(I)Q1(`skipped ${M}`);else Q1(`crawling ${M}`);return I}:(F,M)=>{let f=C1(M,q,Z.root,!0,!0);return f!=="."&&!Q(f)||W(f)},pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0};if($.deep)U.maxDepth=Math.round($.deep-Z.depthOffset);if($.absolute)U.relativePaths=!1,U.resolvePaths=!0,U.includeBasePath=!0;if($.followSymbolicLinks===!1)U.resolveSymlinks=!1,U.excludeSymlinks=!0;if($.onlyDirectories)U.excludeFiles=!0,U.includeDirs=!0;else if($.onlyFiles===!1)U.includeDirs=!0;Z.root=Z.root.replace(s1,"");let z=Z.root;if($.debug)Q1("internal properties:",Z);let G=new m$.fdir(U).crawl(z);if(q===z||$.absolute)return J?G.sync():G.withPromise();return J?u$(G.sync(),q,z):G.withPromise().then((F)=>u$(F,q,z))}async function l$($,q){if($&&(q==null?void 0:q.patterns))throw new Error("Cannot pass patterns as both an argument and an option");let J=Array.isArray($)||typeof $==="string"?{...q,patterns:$}:$,Z=J.cwd?p1.resolve(J.cwd).replace(s1,"/"):process.cwd().replace(s1,"/");return j5(J,Z,!1)}import{readdir as Y5}from"fs/promises";import{dirname as X5,extname as Q5,isAbsolute as W5,join as n$,resolve as i$}from"path";import s$ from"process";import{pathToFileURL as o1}from"url";async function o$($,q){await Bun.write($,q)}async function r1($){let q=$??t.root,J=await Y5(q,{withFileTypes:!0}),Z=await Promise.all(J.map((j)=>{let Y=n$(q,j.name);return j.isDirectory()?r1(Y):Y}));return Array.prototype.concat(...Z).filter((j)=>Q5(j)===".ts")}async function r$($){try{let q=$?.cwd||s$.cwd(),J=$?.tsconfigPath||n$(q,"tsconfig.json"),j=await import(o1(J).href);if(j.compilerOptions?.isolatedDeclarations===!0)return!0;if(j.extends){let Y=p$(J,j.extends),X=Y.endsWith(".json")?Y:`${Y}.json`,Q=await import(o1(X).href);if(Q.compilerOptions?.isolatedDeclarations===!0)return!0;if(Q.extends){let U=p$(X,Q.extends),z=U.endsWith(".json")?U:`${U}.json`;if((await import(o1(z).href)).compilerOptions?.isolatedDeclarations===!0)return!0}}return!1}catch(q){return!1}}function p$($,q){if(W5(q))return q;if(q.startsWith("."))return i$(X5($),q);return i$(s$.cwd(),"node_modules",q)}async function V5($){try{if(!await r$($)){console.error("Error: isolatedDeclarations must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if($?.clean)await z5($.outdir,{recursive:!0,force:!0});let J=$?.cwd||K5.cwd(),Z;if($?.entrypoints)Z=await l$($.entrypoints,{cwd:$.root??`${J}/src`,absolute:!0});else Z=await r1($?.root??`${J}/src`);for(let j of Z){let Y=await Q0(j,$?.verbose);if(Y){let X=w5($?.root??"./src",j),W=F5(X),U=($?.outputStructure??"mirror")==="mirror"?a$($?.outdir??"./dist",W.dir,`${W.name}.d.ts`):a$($?.outdir??"./dist",`${W.name}.d.ts`);await U5(G5(U),{recursive:!0}),await o$(U,Y)}else console.warn(`No declarations extracted for ${j}`)}}catch(q){console.error("Error generating declarations:",q)}}async function H8($){await V5({...t,...$})}export{o$ as writeToFile,D5 as isFunctionType,T5 as isDeclarationComplete,r1 as getAllTypeScriptFiles,V5 as generateDeclarationsFromFiles,H8 as generate,Xq as extractDtsTypes,Q0 as extract,t as config,r$ as checkIsolatedDeclarations};
|