@stacksjs/dtsx 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var gq=Object.create;var{getPrototypeOf:kq,defineProperty:m1,getOwnPropertyNames:vq}=Object;var hq=Object.prototype.hasOwnProperty;var B1=(q,Z,$)=>{$=q!=null?gq(kq(q)):{};let J=Z||!q||!q.__esModule?m1($,"default",{value:q,enumerable:!0}):$;for(let Y of vq(q))if(!hq.call(J,Y))m1(J,Y,{get:()=>q[Y],enumerable:!0});return J};var O=(q,Z)=>()=>(Z||q((Z={exports:{}}).exports,Z),Z.exports);var R1=O(($0)=>{Object.defineProperty($0,"__esModule",{value:!0});$0.normalizePath=$0.convertSlashes=$0.cleanPath=void 0;var O1=import.meta.require("path");function t1(q){let Z=O1.normalize(q);if(Z.length>1&&Z[Z.length-1]===O1.sep)Z=Z.substring(0,Z.length-1);return Z}$0.cleanPath=t1;var I$=/[\\/]/g;function q0(q,Z){return q.replace(I$,Z)}$0.convertSlashes=q0;function H$(q,Z){let{resolvePaths:$,normalizePath:J,pathSeparator:Y}=Z,W=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if($)q=O1.resolve(q);if(J||W)q=t1(q);if(q===".")return"";let j=q[q.length-1]!==Y;return q0(j?q+Y:q,Y)}$0.normalizePath=H$});var j0=O((Y0)=>{Object.defineProperty(Y0,"__esModule",{value:!0});Y0.build=Y0.joinDirectoryPath=Y0.joinPathWithBasePath=void 0;var L$=import.meta.require("path"),_$=R1();function J0(q,Z){return Z+q}Y0.joinPathWithBasePath=J0;function P$(q,Z){return function($,J){if(J.startsWith(q))return J.replace(q,"")+$;else return _$.convertSlashes(L$.relative(q,J),Z.pathSeparator)+Z.pathSeparator+$}}function C$(q){return q}function O$(q,Z,$){return Z+q+$}Y0.joinDirectoryPath=O$;function R$(q,Z){let{relativePaths:$,includeBasePath:J}=Z;return $&&q?P$(q,Z):J?J0:C$}Y0.build=R$});var Q0=O((z0)=>{Object.defineProperty(z0,"__esModule",{value:!0});z0.build=void 0;function A$(q){return function(Z,$){$.push(Z.substring(q.length)||".")}}function T$(q){return function(Z,$,J){let Y=Z.substring(q.length)||".";if(J.every((W)=>W(Y,!0)))$.push(Y)}}var S$=(q,Z)=>{Z.push(q||".")},b$=(q,Z,$)=>{let J=q||".";if($.every((Y)=>Y(J,!0)))Z.push(J)},y$=()=>{};function g$(q,Z){let{includeDirs:$,filters:J,relativePaths:Y}=Z;if(!$)return y$;if(Y)return J&&J.length?T$(q):A$(q);return J&&J.length?b$:S$}z0.build=g$});var F0=O((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.build=void 0;var k$=(q,Z,$,J)=>{if(J.every((Y)=>Y(q,!1)))$.files++},v$=(q,Z,$,J)=>{if(J.every((Y)=>Y(q,!1)))Z.push(q)},h$=(q,Z,$,J)=>{$.files++},u$=(q,Z)=>{Z.push(q)},m$=()=>{};function d$(q){let{excludeFiles:Z,filters:$,onlyCounts:J}=q;if(Z)return m$;if($&&$.length)return J?k$:v$;else if(J)return h$;else return u$}X0.build=d$});var G0=O((K0)=>{Object.defineProperty(K0,"__esModule",{value:!0});K0.build=void 0;var l$=(q)=>{return q},c$=()=>{return[""].slice(0,0)};function i$(q){return q.group?c$:l$}K0.build=i$});var N0=O((w0)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.build=void 0;var n$=(q,Z,$)=>{q.push({directory:Z,files:$,dir:Z})},p$=()=>{};function r$(q){return q.group?n$:p$}w0.build=r$});var D0=O((t)=>{var s$=t&&t.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(t,"__esModule",{value:!0});t.build=void 0;var G1=s$(import.meta.require("fs")),I0=import.meta.require("path"),o$=function(q,Z,$){let{queue:J,options:{suppressErrors:Y}}=Z;J.enqueue(),G1.default.realpath(q,(W,j)=>{if(W)return J.dequeue(Y?null:W,Z);G1.default.stat(j,(z,F)=>{if(z)return J.dequeue(Y?null:z,Z);if(F.isDirectory()&&H0(q,j,Z))return J.dequeue(null,Z);$(F,j),J.dequeue(null,Z)})})},a$=function(q,Z,$){let{queue:J,options:{suppressErrors:Y}}=Z;J.enqueue();try{let W=G1.default.realpathSync(q),j=G1.default.statSync(W);if(j.isDirectory()&&H0(q,W,Z))return;$(j,W)}catch(W){if(!Y)throw W}};function e$(q,Z){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return Z?a$:o$}t.build=e$;function H0(q,Z,$){if($.options.useRealPaths)return t$(Z,$);let J=I0.dirname(q),Y=1;while(J!==$.root&&Y<2){let W=$.symlinks.get(J);if(!!W&&(W===Z||W.startsWith(Z)||Z.startsWith(W)))Y++;else J=I0.dirname(J)}return $.symlinks.set(q,Z),Y>1}function t$(q,Z){return Z.visited.includes(q+Z.options.pathSeparator)}});var _0=O((f0)=>{Object.defineProperty(f0,"__esModule",{value:!0});f0.build=void 0;var qZ=(q)=>{return q.counts},$Z=(q)=>{return q.groups},ZZ=(q)=>{return q.paths},JZ=(q)=>{return q.paths.slice(0,q.options.maxFiles)},YZ=(q,Z,$)=>{return w1(Z,$,q.counts,q.options.suppressErrors),null},WZ=(q,Z,$)=>{return w1(Z,$,q.paths,q.options.suppressErrors),null},jZ=(q,Z,$)=>{return w1(Z,$,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},zZ=(q,Z,$)=>{return w1(Z,$,q.groups,q.options.suppressErrors),null};function w1(q,Z,$,J){if(q&&!J)Z(q,$);else Z(null,$)}function UZ(q,Z){let{onlyCounts:$,group:J,maxFiles:Y}=q;if($)return Z?qZ:YZ;else if(J)return Z?$Z:zZ;else if(Y)return Z?JZ:jZ;else return Z?ZZ:WZ}f0.build=UZ});var O0=O((q1)=>{var QZ=q1&&q1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(q1,"__esModule",{value:!0});q1.build=void 0;var P0=QZ(import.meta.require("fs")),C0={withFileTypes:!0},XZ=(q,Z,$,J,Y)=>{if(J<0)return q.queue.dequeue(null,q);q.visited.push(Z),q.counts.directories++,q.queue.enqueue(),P0.default.readdir(Z||".",C0,(W,j=[])=>{Y(j,$,J),q.queue.dequeue(q.options.suppressErrors?null:W,q)})},BZ=(q,Z,$,J,Y)=>{if(J<0)return;q.visited.push(Z),q.counts.directories++;let W=[];try{W=P0.default.readdirSync(Z||".",C0)}catch(j){if(!q.options.suppressErrors)throw j}Y(W,$,J)};function FZ(q){return q?BZ:XZ}q1.build=FZ});var A0=O((E0)=>{Object.defineProperty(E0,"__esModule",{value:!0});E0.Queue=void 0;class R0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,Z){if(--this.count<=0||q)this.onQueueEmpty(q,Z)}}E0.Queue=R0});var y0=O((S0)=>{Object.defineProperty(S0,"__esModule",{value:!0});S0.Counter=void 0;class T0{_files=0;_directories=0;set files(q){this._files=q}get files(){return this._files}set directories(q){this._directories=q}get directories(){return this._directories}get dirs(){return this._directories}}S0.Counter=T0});var A1=O((c)=>{var KZ=c&&c.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var Y=Object.getOwnPropertyDescriptor(Z,$);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,Y)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),VZ=c&&c.__setModuleDefault||(Object.create?function(q,Z){Object.defineProperty(q,"default",{enumerable:!0,value:Z})}:function(q,Z){q.default=Z}),o=c&&c.__importStar||function(q){if(q&&q.__esModule)return q;var Z={};if(q!=null){for(var $ in q)if($!=="default"&&Object.prototype.hasOwnProperty.call(q,$))KZ(Z,q,$)}return VZ(Z,q),Z};Object.defineProperty(c,"__esModule",{value:!0});c.Walker=void 0;var g0=import.meta.require("path"),E1=R1(),x1=o(j0()),GZ=o(Q0()),wZ=o(F0()),MZ=o(G0()),NZ=o(N0()),IZ=o(D0()),HZ=o(_0()),DZ=o(O0()),fZ=A0(),LZ=y0();class k0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,Z,$){this.isSynchronous=!$,this.callbackInvoker=HZ.build(Z,this.isSynchronous),this.root=E1.normalizePath(q,Z),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LZ.Counter,options:Z,queue:new fZ.Queue((J,Y)=>this.callbackInvoker(Y,J,$)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=x1.build(this.root,Z),this.pushDirectory=GZ.build(this.root,Z),this.pushFile=wZ.build(Z),this.getArray=MZ.build(Z),this.groupFiles=NZ.build(Z),this.resolveSymlink=IZ.build(Z,this.isSynchronous),this.walkDirectory=DZ.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:W,excludeSymlinks:j,exclude:z,maxFiles:F,signal:G,useRealPaths:V,pathSeparator:f}}=this.state;if(G&&G.aborted||F&&J.length>F)return;this.pushDirectory(Z,J,Y);let D=this.getArray(this.state.paths);for(let S=0;S<q.length;++S){let M=q[S];if(M.isFile()||M.isSymbolicLink()&&!W&&!j){let L=this.joinPath(M.name,Z);this.pushFile(L,D,this.state.counts,Y)}else if(M.isDirectory()){let L=x1.joinDirectoryPath(M.name,Z,this.state.options.pathSeparator);if(z&&z(M.name,L))continue;this.walkDirectory(this.state,L,L,$-1,this.walk)}else if(M.isSymbolicLink()&&this.resolveSymlink){let L=x1.joinPathWithBasePath(M.name,Z);this.resolveSymlink(L,this.state,(n,x)=>{if(n.isDirectory()){if(x=E1.normalizePath(x,this.state.options),z&&z(M.name,x))return;this.walkDirectory(this.state,x,V?x:L+f,$-1,this.walk)}else{x=V?x:L;let _=g0.basename(x),m=E1.normalizePath(g0.dirname(x),this.state.options);x=this.joinPath(_,m),this.pushFile(x,D,this.state.counts,Y)}})}}this.groupFiles(this.state.groups,Z,D)}}c.Walker=k0});var m0=O((h0)=>{Object.defineProperty(h0,"__esModule",{value:!0});h0.callback=h0.promise=void 0;var _Z=A1();function PZ(q,Z){return new Promise(($,J)=>{v0(q,Z,(Y,W)=>{if(Y)return J(Y);$(W)})})}h0.promise=PZ;function v0(q,Z,$){new _Z.Walker(q,Z,$).start()}h0.callback=v0});var c0=O((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.sync=void 0;var OZ=A1();function RZ(q,Z){return new OZ.Walker(q,Z).start()}d0.sync=RZ});var s0=O((p0)=>{Object.defineProperty(p0,"__esModule",{value:!0});p0.APIBuilder=void 0;var i0=m0(),EZ=c0();class n0{root;options;constructor(q,Z){this.root=q,this.options=Z}withPromise(){return i0.promise(this.root,this.options)}withCallback(q){i0.callback(this.root,this.options,q)}sync(){return EZ.sync(this.root,this.options)}}p0.APIBuilder=n0});var Y1=O((jJ,a0)=>{var o0={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:"/"},xZ={...o0,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:"\\"},AZ={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"};a0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:AZ,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(q){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${q.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(q){return q===!0?xZ:o0}}});var W1=O((gZ)=>{var{REGEX_BACKSLASH:TZ,REGEX_REMOVE_BACKSLASH:SZ,REGEX_SPECIAL_CHARS:bZ,REGEX_SPECIAL_CHARS_GLOBAL:yZ}=Y1();gZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);gZ.hasRegexChars=(q)=>bZ.test(q);gZ.isRegexChar=(q)=>q.length===1&&gZ.hasRegexChars(q);gZ.escapeRegex=(q)=>q.replace(yZ,"\\$1");gZ.toPosixSlashes=(q)=>q.replace(TZ,"/");gZ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let q=navigator.platform.toLowerCase();return q==="win32"||q==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};gZ.removeBackslashes=(q)=>{return q.replace(SZ,(Z)=>{return Z==="\\"?"":Z})};gZ.escapeLast=(q,Z,$)=>{let J=q.lastIndexOf(Z,$);if(J===-1)return q;if(q[J-1]==="\\")return gZ.escapeLast(q,Z,J-1);return`${q.slice(0,J)}\\${q.slice(J)}`};gZ.removePrefix=(q,Z={})=>{let $=q;if($.startsWith("./"))$=$.slice(2),Z.prefix="./";return $};gZ.wrapOutput=(q,Z={},$={})=>{let J=$.contains?"":"^",Y=$.contains?"":"$",W=`${J}(?:${q})${Y}`;if(Z.negated===!0)W=`(?:^(?!${W}).*\$)`;return W};gZ.basename=(q,{windows:Z}={})=>{let $=q.split(Z?/[\\/]/:"/"),J=$[$.length-1];if(J==="")return $[$.length-2];return J}});var zq=O((UJ,jq)=>{var qq=W1(),{CHAR_ASTERISK:T1,CHAR_AT:nZ,CHAR_BACKWARD_SLASH:j1,CHAR_COMMA:pZ,CHAR_DOT:S1,CHAR_EXCLAMATION_MARK:b1,CHAR_FORWARD_SLASH:Wq,CHAR_LEFT_CURLY_BRACE:y1,CHAR_LEFT_PARENTHESES:g1,CHAR_LEFT_SQUARE_BRACKET:rZ,CHAR_PLUS:sZ,CHAR_QUESTION_MARK:$q,CHAR_RIGHT_CURLY_BRACE:oZ,CHAR_RIGHT_PARENTHESES:Zq,CHAR_RIGHT_SQUARE_BRACKET:aZ}=Y1(),Jq=(q)=>{return q===Wq||q===j1},Yq=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},eZ=(q,Z)=>{let $=Z||{},J=q.length-1,Y=$.parts===!0||$.scanToEnd===!0,W=[],j=[],z=[],F=q,G=-1,V=0,f=0,D=!1,S=!1,M=!1,L=!1,n=!1,x=!1,_=!1,m=!1,a=!1,k=!1,g=0,u,w,I={value:"",depth:0,isGlob:!1},X=()=>G>=J,h=()=>F.charCodeAt(G+1),b=()=>{return u=w,F.charCodeAt(++G)};while(G<J){w=b();let P;if(w===j1){if(_=I.backslashes=!0,w=b(),w===y1)x=!0;continue}if(x===!0||w===y1){g++;while(X()!==!0&&(w=b())){if(w===j1){_=I.backslashes=!0,b();continue}if(w===y1){g++;continue}if(x!==!0&&w===S1&&(w=b())===S1){if(D=I.isBrace=!0,M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(x!==!0&&w===pZ){if(D=I.isBrace=!0,M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===oZ){if(g--,g===0){x=!1,D=I.isBrace=!0,k=!0;break}}}if(Y===!0)continue;break}if(w===Wq){if(W.push(G),j.push(I),I={value:"",depth:0,isGlob:!1},k===!0)continue;if(u===S1&&G===V+1){V+=2;continue}f=G+1;continue}if($.noext!==!0){if((w===sZ||w===nZ||w===T1||w===$q||w===b1)===!0&&h()===g1){if(M=I.isGlob=!0,L=I.isExtglob=!0,k=!0,w===b1&&G===V)a=!0;if(Y===!0){while(X()!==!0&&(w=b())){if(w===j1){_=I.backslashes=!0,w=b();continue}if(w===Zq){M=I.isGlob=!0,k=!0;break}}continue}break}}if(w===T1){if(u===T1)n=I.isGlobstar=!0;if(M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===$q){if(M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===rZ){while(X()!==!0&&(P=b())){if(P===j1){_=I.backslashes=!0,b();continue}if(P===aZ){S=I.isBracket=!0,M=I.isGlob=!0,k=!0;break}}if(Y===!0)continue;break}if($.nonegate!==!0&&w===b1&&G===V){m=I.negated=!0,V++;continue}if($.noparen!==!0&&w===g1){if(M=I.isGlob=!0,Y===!0){while(X()!==!0&&(w=b())){if(w===g1){_=I.backslashes=!0,w=b();continue}if(w===Zq){k=!0;break}}continue}break}if(M===!0){if(k=!0,Y===!0)continue;break}}if($.noext===!0)L=!1,M=!1;let A=F,U="",Q="";if(V>0)U=F.slice(0,V),F=F.slice(V),f-=V;if(A&&M===!0&&f>0)A=F.slice(0,f),Q=F.slice(f);else if(M===!0)A="",Q=F;else A=F;if(A&&A!==""&&A!=="/"&&A!==F){if(Jq(A.charCodeAt(A.length-1)))A=A.slice(0,-1)}if($.unescape===!0){if(Q)Q=qq.removeBackslashes(Q);if(A&&_===!0)A=qq.removeBackslashes(A)}let d={prefix:U,input:q,start:V,base:A,glob:Q,isBrace:D,isBracket:S,isGlob:M,isExtglob:L,isGlobstar:n,negated:m,negatedExtglob:a};if($.tokens===!0){if(d.maxDepth=0,!Jq(w))j.push(I);d.tokens=j}if($.parts===!0||$.tokens===!0){let P;for(let R=0;R<W.length;R++){let p=P?P+1:V,l=W[R],s=q.slice(p,l);if($.tokens){if(R===0&&V!==0)j[R].isPrefix=!0,j[R].value=U;else j[R].value=s;Yq(j[R]),d.maxDepth+=j[R].depth}if(R!==0||s!=="")z.push(s);P=l}if(P&&P+1<q.length){let R=q.slice(P+1);if(z.push(R),$.tokens)j[j.length-1].value=R,Yq(j[j.length-1]),d.maxDepth+=j[j.length-1].depth}d.slashes=W,d.parts=z}return d};jq.exports=eZ});var Xq=O((QJ,Qq)=>{var M1=Y1(),i=W1(),{MAX_LENGTH:N1,POSIX_REGEX_SOURCE:tZ,REGEX_NON_SPECIAL_CHARS:q8,REGEX_SPECIAL_CHARS_BACKREF:$8,REPLACEMENTS:Uq}=M1,Z8=(q,Z)=>{if(typeof Z.expandRange==="function")return Z.expandRange(...q,Z);q.sort();let $=`[${q.join("-")}]`;try{new RegExp($)}catch(J){return q.map((Y)=>i.escapeRegex(Y)).join("..")}return $},$1=(q,Z)=>{return`Missing ${q}: "${Z}" - use "\\\\${Z}" to match literal characters`},k1=(q,Z)=>{if(typeof q!=="string")throw new TypeError("Expected a string");q=Uq[q]||q;let $={...Z},J=typeof $.maxLength==="number"?Math.min(N1,$.maxLength):N1,Y=q.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);let W={type:"bos",value:"",output:$.prepend||""},j=[W],z=$.capture?"":"?:",F=M1.globChars($.windows),G=M1.extglobChars(F),{DOT_LITERAL:V,PLUS_LITERAL:f,SLASH_LITERAL:D,ONE_CHAR:S,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:n,NO_DOTS_SLASH:x,QMARK:_,QMARK_NO_DOT:m,STAR:a,START_ANCHOR:k}=F,g=(K)=>{return`(${z}(?:(?!${k}${K.dot?M:V}).)*?)`},u=$.dot?"":L,w=$.dot?_:m,I=$.bash===!0?g($):a;if($.capture)I=`(${I})`;if(typeof $.noext==="boolean")$.noextglob=$.noext;let X={input:q,index:-1,start:0,dot:$.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:j};q=i.removePrefix(q,X),Y=q.length;let h=[],b=[],A=[],U=W,Q,d=()=>X.index===Y-1,P=X.peek=(K=1)=>q[X.index+K],R=X.advance=()=>q[++X.index]||"",p=()=>q.slice(X.index+1),l=(K="",C=0)=>{X.consumed+=K,X.index+=C},s=(K)=>{X.output+=K.output!=null?K.output:K.value,l(K.value)},bq=()=>{let K=1;while(P()==="!"&&(P(2)!=="("||P(3)==="?"))R(),X.start++,K++;if(K%2===0)return!1;return X.negated=!0,X.start++,!0},U1=(K)=>{X[K]++,A.push(K)},e=(K)=>{X[K]--,A.pop()},H=(K)=>{if(U.type==="globstar"){let C=X.braces>0&&(K.type==="comma"||K.type==="brace"),B=K.extglob===!0||h.length&&(K.type==="pipe"||K.type==="paren");if(K.type!=="slash"&&K.type!=="paren"&&!C&&!B)X.output=X.output.slice(0,-U.output.length),U.type="star",U.value="*",U.output=I,X.output+=U.output}if(h.length&&K.type!=="paren")h[h.length-1].inner+=K.value;if(K.value||K.output)s(K);if(U&&U.type==="text"&&K.type==="text"){U.output=(U.output||U.value)+K.value,U.value+=K.value;return}K.prev=U,j.push(K),U=K},Q1=(K,C)=>{let B={...G[C],conditions:1,inner:""};B.prev=U,B.parens=X.parens,B.output=X.output;let N=($.capture?"(":"")+B.open;U1("parens"),H({type:K,value:C,output:X.output?"":S}),H({type:"paren",extglob:!0,value:R(),output:N}),h.push(B)},yq=(K)=>{let C=K.close+($.capture?")":""),B;if(K.type==="negate"){let N=I;if(K.inner&&K.inner.length>1&&K.inner.includes("/"))N=g($);if(N!==I||d()||/^\)+$/.test(p()))C=K.close=`)\$))${N}`;if(K.inner.includes("*")&&(B=p())&&/^\.[^\\/.]+$/.test(B)){let E=k1(B,{...Z,fastpaths:!1}).output;C=K.close=`)${E})${N})`}if(K.prev.type==="bos")X.negatedExtglob=!0}H({type:"paren",extglob:!0,value:Q,output:C}),e("parens")};if($.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let K=!1,C=q.replace($8,(B,N,E,v,y,H1)=>{if(v==="\\")return K=!0,B;if(v==="?"){if(N)return N+v+(y?_.repeat(y.length):"");if(H1===0)return w+(y?_.repeat(y.length):"");return _.repeat(E.length)}if(v===".")return V.repeat(E.length);if(v==="*"){if(N)return N+v+(y?I:"");return I}return N?B:`\\${B}`});if(K===!0)if($.unescape===!0)C=C.replace(/\\/g,"");else C=C.replace(/\\+/g,(B)=>{return B.length%2===0?"\\\\":B?"\\":""});if(C===q&&$.contains===!0)return X.output=q,X;return X.output=i.wrapOutput(C,X,Z),X}while(!d()){if(Q=R(),Q==="\0")continue;if(Q==="\\"){let B=P();if(B==="/"&&$.bash!==!0)continue;if(B==="."||B===";")continue;if(!B){Q+="\\",H({type:"text",value:Q});continue}let N=/^\\+/.exec(p()),E=0;if(N&&N[0].length>2){if(E=N[0].length,X.index+=E,E%2!==0)Q+="\\"}if($.unescape===!0)Q=R();else Q+=R();if(X.brackets===0){H({type:"text",value:Q});continue}}if(X.brackets>0&&(Q!=="]"||U.value==="["||U.value==="[^")){if($.posix!==!1&&Q===":"){let B=U.value.slice(1);if(B.includes("[")){if(U.posix=!0,B.includes(":")){let N=U.value.lastIndexOf("["),E=U.value.slice(0,N),v=U.value.slice(N+2),y=tZ[v];if(y){if(U.value=E+y,X.backtrack=!0,R(),!W.output&&j.indexOf(U)===1)W.output=S;continue}}}}if(Q==="["&&P()!==":"||Q==="-"&&P()==="]")Q=`\\${Q}`;if(Q==="]"&&(U.value==="["||U.value==="[^"))Q=`\\${Q}`;if($.posix===!0&&Q==="!"&&U.value==="[")Q="^";U.value+=Q,s({value:Q});continue}if(X.quotes===1&&Q!=='"'){Q=i.escapeRegex(Q),U.value+=Q,s({value:Q});continue}if(Q==='"'){if(X.quotes=X.quotes===1?0:1,$.keepQuotes===!0)H({type:"text",value:Q});continue}if(Q==="("){U1("parens"),H({type:"paren",value:Q});continue}if(Q===")"){if(X.parens===0&&$.strictBrackets===!0)throw new SyntaxError($1("opening","("));let B=h[h.length-1];if(B&&X.parens===B.parens+1){yq(h.pop());continue}H({type:"paren",value:Q,output:X.parens?")":"\\)"}),e("parens");continue}if(Q==="["){if($.nobracket===!0||!p().includes("]")){if($.nobracket!==!0&&$.strictBrackets===!0)throw new SyntaxError($1("closing","]"));Q=`\\${Q}`}else U1("brackets");H({type:"bracket",value:Q});continue}if(Q==="]"){if($.nobracket===!0||U&&U.type==="bracket"&&U.value.length===1){H({type:"text",value:Q,output:`\\${Q}`});continue}if(X.brackets===0){if($.strictBrackets===!0)throw new SyntaxError($1("opening","["));H({type:"text",value:Q,output:`\\${Q}`});continue}e("brackets");let B=U.value.slice(1);if(U.posix!==!0&&B[0]==="^"&&!B.includes("/"))Q=`/${Q}`;if(U.value+=Q,s({value:Q}),$.literalBrackets===!1||i.hasRegexChars(B))continue;let N=i.escapeRegex(U.value);if(X.output=X.output.slice(0,-U.value.length),$.literalBrackets===!0){X.output+=N,U.value=N;continue}U.value=`(${z}${N}|${U.value})`,X.output+=U.value;continue}if(Q==="{"&&$.nobrace!==!0){U1("braces");let B={type:"brace",value:Q,output:"(",outputIndex:X.output.length,tokensIndex:X.tokens.length};b.push(B),H(B);continue}if(Q==="}"){let B=b[b.length-1];if($.nobrace===!0||!B){H({type:"text",value:Q,output:Q});continue}let N=")";if(B.dots===!0){let E=j.slice(),v=[];for(let y=E.length-1;y>=0;y--){if(j.pop(),E[y].type==="brace")break;if(E[y].type!=="dots")v.unshift(E[y].value)}N=Z8(v,$),X.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let E=X.output.slice(0,B.outputIndex),v=X.tokens.slice(B.tokensIndex);B.value=B.output="\\{",Q=N="\\}",X.output=E;for(let y of v)X.output+=y.output||y.value}H({type:"brace",value:Q,output:N}),e("braces"),b.pop();continue}if(Q==="|"){if(h.length>0)h[h.length-1].conditions++;H({type:"text",value:Q});continue}if(Q===","){let B=Q,N=b[b.length-1];if(N&&A[A.length-1]==="braces")N.comma=!0,B="|";H({type:"comma",value:Q,output:B});continue}if(Q==="/"){if(U.type==="dot"&&X.index===X.start+1){X.start=X.index+1,X.consumed="",X.output="",j.pop(),U=W;continue}H({type:"slash",value:Q,output:D});continue}if(Q==="."){if(X.braces>0&&U.type==="dot"){if(U.value===".")U.output=V;let B=b[b.length-1];U.type="dots",U.output+=Q,U.value+=Q,B.dots=!0;continue}if(X.braces+X.parens===0&&U.type!=="bos"&&U.type!=="slash"){H({type:"text",value:Q,output:V});continue}H({type:"dot",value:Q,output:V});continue}if(Q==="?"){if(!(U&&U.value==="(")&&$.noextglob!==!0&&P()==="("&&P(2)!=="?"){Q1("qmark",Q);continue}if(U&&U.type==="paren"){let N=P(),E=Q;if(U.value==="("&&!/[!=<:]/.test(N)||N==="<"&&!/<([!=]|\w+>)/.test(p()))E=`\\${Q}`;H({type:"text",value:Q,output:E});continue}if($.dot!==!0&&(U.type==="slash"||U.type==="bos")){H({type:"qmark",value:Q,output:m});continue}H({type:"qmark",value:Q,output:_});continue}if(Q==="!"){if($.noextglob!==!0&&P()==="("){if(P(2)!=="?"||!/[!=<:]/.test(P(3))){Q1("negate",Q);continue}}if($.nonegate!==!0&&X.index===0){bq();continue}}if(Q==="+"){if($.noextglob!==!0&&P()==="("&&P(2)!=="?"){Q1("plus",Q);continue}if(U&&U.value==="("||$.regex===!1){H({type:"plus",value:Q,output:f});continue}if(U&&(U.type==="bracket"||U.type==="paren"||U.type==="brace")||X.parens>0){H({type:"plus",value:Q});continue}H({type:"plus",value:f});continue}if(Q==="@"){if($.noextglob!==!0&&P()==="("&&P(2)!=="?"){H({type:"at",extglob:!0,value:Q,output:""});continue}H({type:"text",value:Q});continue}if(Q!=="*"){if(Q==="$"||Q==="^")Q=`\\${Q}`;let B=q8.exec(p());if(B)Q+=B[0],X.index+=B[0].length;H({type:"text",value:Q});continue}if(U&&(U.type==="globstar"||U.star===!0)){U.type="star",U.star=!0,U.value+=Q,U.output=I,X.backtrack=!0,X.globstar=!0,l(Q);continue}let K=p();if($.noextglob!==!0&&/^\([^?]/.test(K)){Q1("star",Q);continue}if(U.type==="star"){if($.noglobstar===!0){l(Q);continue}let B=U.prev,N=B.prev,E=B.type==="slash"||B.type==="bos",v=N&&(N.type==="star"||N.type==="globstar");if($.bash===!0&&(!E||K[0]&&K[0]!=="/")){H({type:"star",value:Q,output:""});continue}let y=X.braces>0&&(B.type==="comma"||B.type==="brace"),H1=h.length&&(B.type==="pipe"||B.type==="paren");if(!E&&B.type!=="paren"&&!y&&!H1){H({type:"star",value:Q,output:""});continue}while(K.slice(0,3)==="/**"){let X1=q[X.index+4];if(X1&&X1!=="/")break;K=K.slice(3),l("/**",3)}if(B.type==="bos"&&d()){U.type="globstar",U.value+=Q,U.output=g($),X.output=U.output,X.globstar=!0,l(Q);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!v&&d()){X.output=X.output.slice(0,-(B.output+U.output).length),B.output=`(?:${B.output}`,U.type="globstar",U.output=g($)+($.strictSlashes?")":"|$)"),U.value+=Q,X.globstar=!0,X.output+=B.output+U.output,l(Q);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&K[0]==="/"){let X1=K[1]!==void 0?"|$":"";X.output=X.output.slice(0,-(B.output+U.output).length),B.output=`(?:${B.output}`,U.type="globstar",U.output=`${g($)}${D}|${D}${X1})`,U.value+=Q,X.output+=B.output+U.output,X.globstar=!0,l(Q+R()),H({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&K[0]==="/"){U.type="globstar",U.value+=Q,U.output=`(?:^|${D}|${g($)}${D})`,X.output=U.output,X.globstar=!0,l(Q+R()),H({type:"slash",value:"/",output:""});continue}X.output=X.output.slice(0,-U.output.length),U.type="globstar",U.output=g($),U.value+=Q,X.output+=U.output,X.globstar=!0,l(Q);continue}let C={type:"star",value:Q,output:I};if($.bash===!0){if(C.output=".*?",U.type==="bos"||U.type==="slash")C.output=u+C.output;H(C);continue}if(U&&(U.type==="bracket"||U.type==="paren")&&$.regex===!0){C.output=Q,H(C);continue}if(X.index===X.start||U.type==="slash"||U.type==="dot"){if(U.type==="dot")X.output+=n,U.output+=n;else if($.dot===!0)X.output+=x,U.output+=x;else X.output+=u,U.output+=u;if(P()!=="*")X.output+=S,U.output+=S}H(C)}while(X.brackets>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","]"));X.output=i.escapeLast(X.output,"["),e("brackets")}while(X.parens>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing",")"));X.output=i.escapeLast(X.output,"("),e("parens")}while(X.braces>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","}"));X.output=i.escapeLast(X.output,"{"),e("braces")}if($.strictSlashes!==!0&&(U.type==="star"||U.type==="bracket"))H({type:"maybe_slash",value:"",output:`${D}?`});if(X.backtrack===!0){X.output="";for(let K of X.tokens)if(X.output+=K.output!=null?K.output:K.value,K.suffix)X.output+=K.suffix}return X};k1.fastpaths=(q,Z)=>{let $={...Z},J=typeof $.maxLength==="number"?Math.min(N1,$.maxLength):N1,Y=q.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);q=Uq[q]||q;let{DOT_LITERAL:W,SLASH_LITERAL:j,ONE_CHAR:z,DOTS_SLASH:F,NO_DOT:G,NO_DOTS:V,NO_DOTS_SLASH:f,STAR:D,START_ANCHOR:S}=M1.globChars($.windows),M=$.dot?V:G,L=$.dot?f:G,n=$.capture?"":"?:",x={negated:!1,prefix:""},_=$.bash===!0?".*?":D;if($.capture)_=`(${_})`;let m=(u)=>{if(u.noglobstar===!0)return _;return`(${n}(?:(?!${S}${u.dot?F:W}).)*?)`},a=(u)=>{switch(u){case"*":return`${M}${z}${_}`;case".*":return`${W}${z}${_}`;case"*.*":return`${M}${_}${W}${z}${_}`;case"*/*":return`${M}${_}${j}${z}${L}${_}`;case"**":return M+m($);case"**/*":return`(?:${M}${m($)}${j})?${L}${z}${_}`;case"**/*.*":return`(?:${M}${m($)}${j})?${L}${_}${W}${z}${_}`;case"**/.*":return`(?:${M}${m($)}${j})?${W}${z}${_}`;default:{let w=/^(.*?)\.(\w+)$/.exec(u);if(!w)return;let I=a(w[1]);if(!I)return;return I+W+w[2]}}},k=i.removePrefix(q,x),g=a(k);if(g&&$.strictSlashes!==!0)g+=`${j}?`;return g};Qq.exports=k1});var Kq=O((XJ,Fq)=>{var J8=zq(),v1=Xq(),Bq=W1(),Y8=Y1(),W8=(q)=>q&&typeof q==="object"&&!Array.isArray(q),T=(q,Z,$=!1)=>{if(Array.isArray(q)){let V=q.map((D)=>T(D,Z,$));return(D)=>{for(let S of V){let M=S(D);if(M)return M}return!1}}let J=W8(q)&&q.tokens&&q.input;if(q===""||typeof q!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let Y=Z||{},W=Y.windows,j=J?T.compileRe(q,Z):T.makeRe(q,Z,!1,!0),z=j.state;delete j.state;let F=()=>!1;if(Y.ignore){let V={...Z,ignore:null,onMatch:null,onResult:null};F=T(Y.ignore,V,$)}let G=(V,f=!1)=>{let{isMatch:D,match:S,output:M}=T.test(V,j,Z,{glob:q,posix:W}),L={glob:q,state:z,regex:j,posix:W,input:V,output:M,match:S,isMatch:D};if(typeof Y.onResult==="function")Y.onResult(L);if(D===!1)return L.isMatch=!1,f?L:!1;if(F(V)){if(typeof Y.onIgnore==="function")Y.onIgnore(L);return L.isMatch=!1,f?L:!1}if(typeof Y.onMatch==="function")Y.onMatch(L);return f?L:!0};if($)G.state=z;return G};T.test=(q,Z,$,{glob:J,posix:Y}={})=>{if(typeof q!=="string")throw new TypeError("Expected input to be a string");if(q==="")return{isMatch:!1,output:""};let W=$||{},j=W.format||(Y?Bq.toPosixSlashes:null),z=q===J,F=z&&j?j(q):q;if(z===!1)F=j?j(q):q,z=F===J;if(z===!1||W.capture===!0)if(W.matchBase===!0||W.basename===!0)z=T.matchBase(q,Z,$,Y);else z=Z.exec(F);return{isMatch:Boolean(z),match:z,output:F}};T.matchBase=(q,Z,$)=>{return(Z instanceof RegExp?Z:T.makeRe(Z,$)).test(Bq.basename(q))};T.isMatch=(q,Z,$)=>T(Z,$)(q);T.parse=(q,Z)=>{if(Array.isArray(q))return q.map(($)=>T.parse($,Z));return v1(q,{...Z,fastpaths:!1})};T.scan=(q,Z)=>J8(q,Z);T.compileRe=(q,Z,$=!1,J=!1)=>{if($===!0)return q.output;let Y=Z||{},W=Y.contains?"":"^",j=Y.contains?"":"$",z=`${W}(?:${q.output})${j}`;if(q&&q.negated===!0)z=`^(?!${z}).*\$`;let F=T.toRegex(z,Z);if(J===!0)F.state=q;return F};T.makeRe=(q,Z={},$=!1,J=!1)=>{if(!q||typeof q!=="string")throw new TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if(Z.fastpaths!==!1&&(q[0]==="."||q[0]==="*"))Y.output=v1.fastpaths(q,Z);if(!Y.output)Y=v1(q,Z);return T.compileRe(Y,Z,$,J)};T.toRegex=(q,Z)=>{try{let $=Z||{};return new RegExp(q,$.flags||($.nocase?"i":""))}catch($){if(Z&&Z.debug===!0)throw $;return/$^/}};T.constants=Y8;Fq.exports=T});var z1=O((BJ,wq)=>{var Vq=Kq(),j8=W1();function Gq(q,Z,$=!1){if(Z&&(Z.windows===null||Z.windows===void 0))Z={...Z,windows:j8.isWindows()};return Vq(q,Z,$)}Object.assign(Gq,Vq);wq.exports=Gq});var fq=O((Hq)=>{Object.defineProperty(Hq,"__esModule",{value:!0});Hq.Builder=void 0;var z8=import.meta.require("path"),Mq=s0(),Nq=null;try{import.meta.require.resolve("picomatch"),Nq=z1()}catch(q){}class Iq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:z8.sep,filters:[]};globFunction;constructor(q){this.options={...this.options,...q},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(q){return this.options.pathSeparator=q,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(q){return this.options.maxDepth=q,this}withMaxFiles(q){return this.options.maxFiles=q,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:q=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=q,this.withFullPaths()}withAbortSignal(q){return this.options.signal=q,this}normalize(){return this.options.normalizePath=!0,this}filter(q){return this.options.filters.push(q),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(q){return this.options.exclude=q,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(q){return new Mq.APIBuilder(q||".",this.options)}withGlobFunction(q){return this.globFunction=q,this}crawlWithOptions(q,Z){return this.options={...this.options,...Z},new Mq.APIBuilder(q||".",this.options)}glob(...q){if(this.globFunction)return this.globWithOptions(q);return this.globWithOptions(q,...[{dot:!0}])}globWithOptions(q,...Z){let $=this.globFunction||Nq;if(!$)throw new Error("Please specify a glob function to use glob matching.");var J=this.globCache[q.join("\0")];if(!J)J=$(q,...Z),this.globCache[q.join("\0")]=J;return this.options.filters.push((Y)=>J(Y)),this}}Hq.Builder=Iq});var _q=O((Lq)=>{Object.defineProperty(Lq,"__esModule",{value:!0})});var Pq=O((r)=>{var U8=r&&r.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var Y=Object.getOwnPropertyDescriptor(Z,$);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,Y)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),Q8=r&&r.__exportStar||function(q,Z){for(var $ in q)if($!=="default"&&!Object.prototype.hasOwnProperty.call(Z,$))U8(Z,q,$)};Object.defineProperty(r,"__esModule",{value:!0});r.fdir=void 0;var X8=fq();Object.defineProperty(r,"fdir",{enumerable:!0,get:function(){return X8.Builder}});Q8(_q(),r)});import{existsSync as dq}from"fs";import{resolve as lq}from"path";import f1 from"process";import{readdir as uq}from"fs/promises";import{extname as mq,join as l1}from"path";import d1 from"process";async function c1(q,Z){await Bun.write(q,Z)}async function D1(q){let Z=q??Z1.root,$=await uq(Z,{withFileTypes:!0}),J=await Promise.all($.map((Y)=>{let W=l1(Z,Y.name);return Y.isDirectory()?D1(W):W}));return Array.prototype.concat(...J).filter((Y)=>mq(Y)===".ts")}async function i1(q){try{return(await import(q?.tsconfigPath||l1(q?.root??d1.cwd(),"tsconfig.json"))).compilerOptions?.isolatedDeclarations===!0}catch(Z){return console.log("Error reading tsconfig.json:",Z),!1}}function A8(q){let J=q.split("\n").map((Y)=>{if(Y=Y.trimEnd(),Y.startsWith("export interface")||Y.startsWith("export type")){let W=Y.split("{");if(W.length>1)return`${W[0].trim()} {${W[1]}`}if(Y.endsWith(";"))Y=Y.slice(0,-1);return Y}).join("\n");return J=J.replace(/\n{3,}/g,"\n\n"),J=J.replace(/\/\*\*\n([^*]*)(\n \*\/)/g,(Y,W)=>{return`/**\n${W.split("\n").map((z)=>` *${z.trim()?` ${z.trim()}`:""}`).join("\n")}\n */`}),`${J.trim()}\n`}function T8(q){let Z=q.split("\n");return Z.map(($,J)=>{if(J===0)return"/**";if(J===Z.length-1)return" */";return` * ${$.replace(/^\s*\*?\s?/,"").trim()}`}).join("\n")}function K1(q,...Z){if(!Z.length)return q;let $=Z.shift();if(F1(q)&&F1($)){for(let J in $)if(Object.prototype.hasOwnProperty.call($,J)){let Y=$[J];if(F1(Y)&&F1(q[J]))q[J]=K1(q[J],Y);else q[J]=Y}}return K1(q,...Z)}function F1(q){return q&&typeof q==="object"&&!Array.isArray(q)}async function cq({name:q,cwd:Z,defaultConfig:$}){let J=Z??f1.cwd(),Y=lq(J,`${q}.config`);if(dq(Y))try{let W=await import(Y),j=W.default||W;return K1($,j)}catch(W){console.error(`Error loading config from ${Y}:`,W)}return $}var Z1=await cq({name:"dts",cwd:f1.cwd(),defaultConfig:{cwd:f1.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json"}});var L1={typeImport:/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/,regularImport:/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/,returnType:/\):\s*([^{;]+)/,constType:/const([^:=]+):\s*([^=]+)=/,bracketOpen:/[[{]/g,bracketClose:/[\]}]/g,functionReturn:/return\s+([^;]+)/};function iq(){return{dtsLines:[],imports:[],usedTypes:new Set,typeSources:new Map,defaultExport:"",currentDeclaration:"",lastCommentBlock:"",bracketCount:0,isMultiLineDeclaration:!1,moduleImports:new Map,availableTypes:new Map,availableValues:new Map}}function nq(q){let Z=q.match(/:\s*(\{[^=]+\}|\[[^\]]+\]|[^=]+?)\s*=/);return{raw:Z?.[1]?.trim()??null,parsed:Z?.[1]?.trim()??"any"}}async function o1(q){try{let Z=await Bun.file(q).text();return pq(Z)}catch(Z){throw console.error("Failed to extract types:",Z),new Error("Failed to extract and generate .d.ts file")}}function pq(q){let Z=iq(),$=q.split("\n");for(let J of $)rq(J,Z);return F$(Z)}function rq(q,Z){let $=q.trim();if(!$)return;if(U$($)){Q$($,Z);return}if($.startsWith("import")){Z.imports.push(sq(q,Z));return}if($.startsWith("export default")){Z.defaultExport=`\n${$};`;return}if(X$($)||Z.isMultiLineDeclaration)B$($,Z)}function sq(q,Z){let $=q.match(/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),J=q.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i);if($||J){let Y=$||J,W=Boolean($),[,j,z]=Y;if(!Z.moduleImports.has(z))Z.moduleImports.set(z,{kind:W?"type":"value",usedTypes:new Set,usedValues:new Set,source:z});let F=Z.moduleImports.get(z);j.split(",").forEach((G)=>{let[V,f]=G.trim().split(/\s+as\s+/).map((S)=>S.trim()),D=f||V;if(W)Z.availableTypes.set(D,z),F.kind=F.kind==="value"?"mixed":"type";else if(Z.availableValues.set(D,z),F.kind=F.kind==="type"?"mixed":"value",Z.currentDeclaration?.includes(D))F.usedValues.add(D)})}return q}function oq(q){let Z=(J)=>{let Y=/\b([a-z_$][\w$]*)\s*(?:[(,;})\s]|$)/gi,W;while((W=Y.exec(J))!==null){let[,z]=W;if(q.availableValues.has(z)){let F=q.availableValues.get(z);q.moduleImports.get(F).usedValues.add(z)}}let j=J.matchAll(/\b([A-Z][\w$]*)\b/g);for(let[,z]of j)if(q.availableTypes.has(z)){let F=q.availableTypes.get(z);q.moduleImports.get(F).usedTypes.add(z)}};if(q.dtsLines.forEach(Z),q.currentDeclaration)Z(q.currentDeclaration);let $=[];for(let[J,Y]of q.moduleImports){let{usedTypes:W,usedValues:j}=Y;if(W.size===0&&j.size===0)continue;if(W.size>0){let z=Array.from(W).sort();$.push(`import type { ${z.join(", ")} } from '${J}';`)}if(j.size>0){let z=Array.from(j).sort();$.push(`import { ${z.join(", ")} } from '${J}';`)}}return $.sort()}function h8(q,Z){let $=new Map,J=new Set;for(let Y of q){let W=Y.match(/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),j=Y.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),z=W||j;if(z){let F=z[1].split(",").map((V)=>{let[f,D]=V.trim().split(/\s+as\s+/);return D||f.trim()}),G=z[2];if(!$.has(G))$.set(G,new Set);F.forEach((V)=>{if($.get(G).add(V),Z.has(V))J.add(V)})}}return Array.from($.entries()).map(([Y,W])=>{let j=Array.from(W).filter((z)=>Z.has(z)||J.has(z));if(j.length===0)return"";return`import type { ${j.sort().join(", ")} } from '${Y}';`}).filter(Boolean).sort()}function aq(q,Z){let $=q.trim();if($.startsWith("export const"))return n1($);if($.startsWith("const"))return n1($,!1);if($.startsWith("export interface"))return p1($);if($.startsWith("interface"))return p1($,!1);if($.startsWith("export type {"))return $;if($.startsWith("export type"))return r1($);if($.startsWith("type"))return r1($,!1);if($.startsWith("export function")||$.startsWith("export async function")){let J=$.replace(/\basync\s+/,"");return s1(J,Z.usedTypes)}if($.startsWith("function")||$.startsWith("async function")){let J=$.replace(/\basync\s+/,"");return s1(J,Z.usedTypes,!1)}if($.startsWith("export default"))return`${$};`;if($.startsWith("export"))return $;return`declare ${$}`}function n1(q,Z=!0){let $=q.split("\n"),J=$[0],Y=J.split("const")[1].split("=")[0].trim().split(":")[0].trim(),W=nq(J);if(W.raw)return`${Z?"export ":""}declare const ${Y}: ${W.raw};`;let j=P1($.slice(1,-1)),z=a1(j);return`${Z?"export ":""}declare const ${Y}: {\n${z}\n};`}function a1(q,Z=2){return q.map(($)=>{let J=" ".repeat(Z);if($.nested&&$.nested.length>0){let Y=a1($.nested,Z+2);return`${J}${$.key}: {\n${Y}\n${J}};`}return`${J}${$.key}: ${$.type};`}).join("\n")}function P1(q){let Z=[],$={content:[]},J=0;for(let Y of q){let W=Y.trim();if(!W||W.startsWith("//")||W.startsWith("/*"))continue;let j=(W.match(L1.bracketOpen)||[]).length,z=(W.match(L1.bracketClose)||[]).length;if(J===0&&W.includes(":")){let[F]=W.split(":");$={key:F.trim(),content:[W]}}else if(J>0||j>0)$.content.push(W);if(J+=j-z,J===0&&$.key){let F=eq($);if(F)Z.push(F);$={content:[]}}}return Z}function eq({key:q,content:Z}){if(!q)return null;let $=Z.join(" ").trim(),J=$.indexOf(":");if(J===-1)return null;let Y=$.substring(J+1).trim();if(Y.startsWith("{")){let W=V1(Y,"{","}");if(W){let j=P1(W.split(",").map((z)=>z.trim()));return{key:q,value:Y,type:C1(j),nested:j}}}if(Y.startsWith("["))return{key:q,value:Y,type:q$(Y).replace(/'+$/,"")};if(tq(Y))return{key:q,value:Y,type:$$(Y)};return Y$(q,Y)}function V1(q,Z,$){let J=0,Y=-1;for(let W=0;W<q.length;W++)if(q[W]===Z){if(J===0)Y=W;J++}else if(q[W]===$){if(J--,J===0&&Y!==-1)return q.substring(Y+1,W)}return null}function tq(q){return q.includes("=>")||q.startsWith("function")||q==="console.log"||q.endsWith(".log")&&!q.includes("[")&&!q.includes("{")}function q$(q){let Z=V1(q,"[","]");if(!Z)return"never[]";let $=_1(Z);if($.length===0)return"never[]";if($.some((W)=>W.trim().startsWith("[")))return`Array<${$.map((j)=>{let z=j.trim();if(z.startsWith("[")){let F=V1(z,"[","]");if(F)return`Array<${_1(F).map((V)=>J1(V.trim())).join(" | ")}>`}return J1(z)}).join(" | ")}>`;let J=$.map((W)=>J1(W.trim()));return`Array<${[...new Set(J)].join(" | ")}>`}function J1(q){let Z=q.trim();if(Z.startsWith("\'")||Z.startsWith('"'))return`'${Z.slice(1,-1).replace(/'+$/,"")}'`;if(!Number.isNaN(Number(Z)))return Z;if(Z.startsWith("{"))return N$(J$(Z));if(Z==="console.log"||Z.endsWith(".log"))return"((...args: any[]) => void)";if(Z.includes("=>"))return"((...args: any[]) => void)";if(Z.endsWith("()"))return"unknown";if(Z.includes("."))return"unknown";if(/^[a-z_]\w*$/i.test(Z))return"unknown";return"unknown"}function u8(q){return q.map(($)=>{let J=$.trim();if(J.startsWith("[")){let Y=V1(J,"[","]");if(Y)return`Array<${_1(Y).map((z)=>J1(z.trim())).join(" | ")}>`;return"never"}return J1(J)}).filter(($)=>$!=="never").join(" | ")}function $$(q){let Z=q.startsWith("async"),$="unknown";if(q.includes("console.log"))$="void";else if(q.includes("return")){let J=q.match(L1.functionReturn)?.[1];if(J)$=Z$(J)}return`${Z?"async ":""}(...args: any[]) => ${$}`}function Z$(q){if(q.startsWith("\'")||q.startsWith('"'))return"string";if(!Number.isNaN(Number(q)))return"number";if(q==="true"||q==="false")return"boolean";if(q.includes("??")){let[,Z]=q.split("??").map(($)=>$.trim());if(Z.startsWith("\'")||Z.startsWith('"'))return"string"}return"unknown"}function _1(q){let Z=[],$="",J=0,Y=!1,W="";for(let j=0;j<q.length;j++){let z=q[j];if((z==='"'||z==="\'")&&(j===0||q[j-1]!=="\\")){if(!Y)Y=!0,W=z;else if(z===W)Y=!1}if(!Y){if(z==="["||z==="{")J++;else if(z==="]"||z==="}")J--}if(z===","&&J===0&&!Y){if($.trim())Z.push($.trim());$=""}else $+=z}if($.trim())Z.push($.trim());return Z.filter(Boolean)}function J$(q){let Z=q.slice(1,-1).trim();return P1([Z])}function m8(q){let Z={genericParams:"",functionName:"",parameters:"",returnType:"void",isAsync:!1};Z.isAsync=q.includes("async");let $=q.replace(/^export\s+/,"").replace(/^async\s+/,"").replace(/^function\s+/,"").trim(),J=$.match(/^([^(<\s]+)(\s*<[^>]+>)?/);if(J){if(Z.functionName=J[1],J[2])Z.genericParams=J[2].trim();$=$.slice(J[0].length).trim()}let Y=$.match(/\(([\s\S]*?)\)/);if(Y)Z.parameters=Y[1].trim(),$=$.slice(Y[0].length).trim();if($.startsWith(":")){let W=$.slice(1).trim();W=W.replace(/:\s*$/,"").replace(/\s+/g," ").trim();let j=W.match(/^([^:]+)/);if(j)Z.returnType=j[1].trim()}return Z}function Y$(q,Z){let $=Z.replace(/,\s*$/,"").trim();if($.startsWith("\'")||$.startsWith('"'))return{key:q,value:$,type:`'${$.slice(1,-1)}'`};if(!Number.isNaN(Number($)))return{key:q,value:$,type:$};if($==="true"||$==="false")return{key:q,value:$,type:$};if($.endsWith("()")||$==="console.log")return{key:q,value:$,type:"(...args: any[]) => void"};return{key:q,value:$,type:"unknown"}}function C1(q){if(q.length===0)return"Object";return`{ ${q.map(($)=>`${$.key}: ${$.nested?C1($.nested):$.type}`).join("; ")} }`}function p1(q,Z=!0){let $=q.split("\n"),J=$[0].split("interface")[1].split("{")[0].trim(),Y=$.slice(1,-1).map((W)=>` ${W.trim().replace(/;?$/,";")}`).join("\n");return`${Z?"export ":""}declare interface ${J} {\n${Y}\n}`}function d8(q,Z,$=!0){let J=q.match(/export\s+type\s*\{([^}]+)\}/);if(J)J[1].split(",").map((W)=>W.trim()).forEach((W)=>Z.usedTypes.add(W));return q.replace("export type",`${$?"export ":""}declare type`).replace(/;$/,"")}function r1(q,Z=!0){let $=q.split("\n"),J=$[0],Y=J.split("type")[1].split("=")[0].trim(),W=J.split("=")[1]?.trim()||$.slice(1).join("\n").trim().replace(/;$/,"");return`${Z?"export ":""}declare type ${Y} = ${W};`}function W$(q){let Z=/^export\s+async\s+function/.test(q)||/^async\s+function/.test(q),$=q.replace(/^export\s+/,"").replace(/^async\s+/,"").replace(/^function\s+/,"").trim(),J=/^([a-z_$][\w$]*)\s*(<[^(]+>)/i,Y=$.match(J),W="",j="";if(Y)j=Y[1],W=Y[2];let z=$.replace(J,j),F=j||z.match(/^([^(<\s]+)/)?.[1]||"",G=z.match(/\(([\s\S]*?)\)(?=\s*:)/),V=G?G[1].trim():"";V=j$(V);let f=z.match(/\)\s*:\s*([\s\S]+?)(?=\{|$)/),D=f?f[1].trim():"void";return D=e1(D),{name:F,params:V,returnType:D,isAsync:Z,generics:W}}function s1(q,Z,$=!0){let{name:J,params:Y,returnType:W,isAsync:j,generics:z}=W$(q);return z$(`${z} ${Y} ${W}`,Z),[$?"export":"","declare",j?"async":"","function",J,z,`(${Y})`,":",W,";"].filter(Boolean).join(" ").replace(/\s+([<>(),;:])/g,"$1").replace(/([<>(),;:])\s+/g,"$1 ").replace(/\s{2,}/g," ").trim()}function j$(q){if(!q.trim())return"";return q.replace(/\{([^}]+)\}:\s*([^,)]+)/g,($,J,Y)=>{return`options: ${e1(Y.trim())}`}).replace(/\s*([,:])\s*/g,"$1 ").replace(/,(\S)/g,", $1").replace(/\s*\?\s*:/g,"?: ").replace(/\s*([<[\]>])\s*/g,"$1").replace(/\s{2,}/g," ").trim()}function e1(q){return q.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function z$(q,Z){let $=/(?:typeof\s+)?([A-Z]\w*(?:<[^>]+>)?)|extends\s+([A-Z]\w*(?:<[^>]+>)?)/g,J;while((J=$.exec(q))!==null){let Y=J[1]||J[2];if(Y){let[W,...j]=Y.split(/[<>]/);if(W&&/^[A-Z]/.test(W))Z.add(W);if(j.length>0)j.forEach((z)=>{z.split(/[,\s]/).forEach((G)=>{if(/^[A-Z]/.test(G))Z.add(G)})})}}}function U$(q){return q.startsWith("/**")||q.startsWith("*")||q.startsWith("*/")}function Q$(q,Z){let $=q.startsWith("*")?` ${q}`:q.startsWith("/**")||q.startsWith("*/")?q:` ${q}`;if(q.startsWith("/**"))Z.lastCommentBlock="";Z.lastCommentBlock+=`${$}\n`}function X$(q){return q.startsWith("export")||q.startsWith("const")||q.startsWith("interface")||q.startsWith("type")||q.startsWith("function")}function B$(q,Z){Z.currentDeclaration+=`${q}\n`;let $=q.match(/[[{(]/g),J=q.match(/[\]})]/g),Y=$?$.length:0,W=J?J.length:0;if(Z.bracketCount+=Y-W,Z.isMultiLineDeclaration=Z.bracketCount>0,!Z.isMultiLineDeclaration){if(Z.lastCommentBlock)Z.dtsLines.push(Z.lastCommentBlock.trimEnd()),Z.lastCommentBlock="";let j=aq(Z.currentDeclaration.trim(),Z);if(j)Z.dtsLines.push(j);Z.currentDeclaration="",Z.bracketCount=0}}function F$(q){let Z=oq(q),{regularDeclarations:$,starExports:J}=K$(q.dtsLines),Y=[];if(Z.length>0)Y.push(`${Z.join("\n")}\n`);if($.length>0)Y.push($.join("\n\n"));if(J.length>0)Y.push(J.join("\n"));let W=Y.filter(Boolean).join("\n\n").trim();if(q.defaultExport){let j=q.defaultExport.replace(/^export\s+default\s+/,"").replace(/export\s+default\s+/,"").replace(/;+$/,"").trim();W=W.replace(/\n*$/,"\n\n"),W+=`export default ${j};`}return W+="\n",M$(W)}function K$(q){let Z=[],$=[],J="";return q.forEach((Y)=>{let W=Y.trim();if(W.startsWith("/**")||W.startsWith("*")){J=J?`${J}\n${Y}`:Y;return}if(W.startsWith("export *"))$.push(w$(W));else if(W){let j=V$(J?`${J}\n${Y}`:Y);Z.push(j)}J=""}),{regularDeclarations:Z,starExports:$}}function V$(q){if(!q.trim())return"";let Z=q;if(Z.includes("export declare type {"))Z=Z.replace("export declare type","export type");if(Z.includes("declare")&&Z.includes("async"))Z=Z.replace(/declare\s+async\s+/,"declare ").replace(/export\s+declare\s+async\s+/,"export declare ");if(!Z.endsWith(";")&&!Z.endsWith("{")&&G$(Z))Z=`${Z.trimEnd()};`;return Z}function G$(q){let Z=q.trim();if(Z.startsWith("/*")||Z.startsWith("*")||Z.startsWith("//"))return!1;if(Z.endsWith("{")||Z.endsWith("}"))return!1;if(Z.endsWith(";"))return!1;return!0}function w$(q){return q.trim().replace(/;+$/,"").replace(/\{\s*$/,"{")+(q.trim().endsWith("{")?"":";")}function M$(q){return q.replace(/\r\n/g,"\n").replace(/\{\s*;/g,"{").replace(/;+/g,";").replace(/\n{3,}/g,"\n\n").replace(/^(export (?!.*\{$)[^*{}\n].*[^;\n])$/gm,"$1;").replace(/^(export \* from [^;\n]+);*$/gm,"$1;").replace(/^(export \{[^}]+\} from [^;\n]+);*$/gm,"$1;").replace(/[ \t]+$/gm,"").replace(/\n*$/,"\n")}function N$(q){if(q.length===0)return"Object";return`{ ${q.map(($)=>{let J=$.nested?C1($.nested):$.type;return`${$.key}: ${J}`}).join("; ")} }`}function l8(q){return q.split(",").map((Z)=>{let[$,J]=Z.split("extends").map((Y)=>Y.trim());return J?`${$} extends ${J}`:$}).join(", ")}import{mkdir as I8,rm as H8}from"fs/promises";import{dirname as D8,join as f8,parse as L8,relative as _8}from"path";var Eq=B1(Pq(),1),h1=B1(z1(),1),xq=B1(z1(),1);import Rq,{posix as I1}from"path";var B8=/\\(?![()[\]{}!+@])/g;function F8(q){return Aq(q)}function K8(q){return Tq(q).replace(B8,"/")}var wJ=process.platform==="win32"?K8:F8,V8=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,G8=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Aq=(q)=>q.replace(V8,"\\$&"),Tq=(q)=>q.replace(G8,"\\$&"),MJ=process.platform==="win32"?Tq:Aq;function w8(q,Z){if((Z==null?void 0:Z.caseSensitiveMatch)===!1)return!0;let $=xq.default.scan(q);return $.isGlob||$.negated}function Cq(q,Z,$,J,Y){var W;let j=q;if(q.endsWith("/"))j=q.slice(0,-1);if(!j.endsWith("*")&&Z)j+="/**";if(Rq.isAbsolute(j.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))j=I1.relative($,j);else j=I1.normalize(j);let z=/^(\/?\.\.)+/.exec(j);if(z==null?void 0:z[0]){let F=I1.join($,z[0]);if(J.root.length>F.length)J.root=F,J.depthOffset=-(z[0].length+1)/3}else if(!Y&&J.depthOffset>=0){let F=j.split("/");(W=J.commonPath)!=null||(J.commonPath=F);let G=[];for(let V=0;V<Math.min(J.commonPath.length,F.length);V++){let f=F[V];if(f==="**"&&!F[V+1]){G.pop();break}if(f!==J.commonPath[V]||w8(f)||V===F.length-1)break;G.push(f)}J.depthOffset=G.length,J.commonPath=G,J.root=G.length>0?`${$}/${G.join("/")}`:$}return j}function M8({patterns:q,ignore:Z=[],expandDirectories:$=!0},J,Y){if(typeof q==="string")q=[q];if(typeof Z==="string")Z=[Z];let W=[],j=Z.map((z)=>Cq(z,$,J,Y,!0));if(!q)return{match:["**/*"],ignore:j};for(let z of q)if(z=Cq(z,$,J,Y,!1),z.startsWith("!")&&z[1]!=="(")j.push(z.slice(1));else W.push(z);return{match:W,ignore:j}}function u1(q,Z,$){return I1.relative(Z,`${$}/${q}`)}function Oq(q,Z,$,J,Y){let W=Y?q.slice($.length+1)||".":q;if($===Z)return J&&W!=="."?W.slice(0,-1):W;return u1(W,Z,$)}function N8(q,Z,$){let J={root:Z,commonPath:null,depthOffset:0},Y=M8(q,Z,J),W=h1.default(Y.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:Y.ignore}),j=h1.default(Y.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),z={filters:[(G,V)=>W(Oq(G,Z,J.root,V,q.absolute))],exclude:(G,V)=>j(Oq(V,Z,J.root,!0,!0)),pathSeparator:"/",relativePaths:!0};if(q.deep)z.maxDepth=Math.round(q.deep-J.depthOffset);if(q.absolute)z.relativePaths=!1,z.resolvePaths=!0,z.includeBasePath=!0;if(q.followSymbolicLinks===!1)z.resolveSymlinks=!1,z.excludeSymlinks=!0;if(q.onlyDirectories)z.excludeFiles=!0,z.includeDirs=!0;else if(q.onlyFiles===!1)z.includeDirs=!0;J.root=J.root.replace(/\\/g,"");let F=new Eq.fdir(z).crawl(J.root);if(Z===J.root||q.absolute)return $?F.sync():F.withPromise();return $?F.sync().map((G)=>u1(G,Z,J.root)+(!G||G.endsWith("/")?"/":"")):F.withPromise().then((G)=>G.map((V)=>u1(V,Z,J.root)+(!V||V.endsWith("/")?"/":"")))}async function Sq(q,Z){if(q&&(Z==null?void 0:Z.patterns))throw new Error("Cannot pass patterns as both an argument and an option");let $=Array.isArray(q)||typeof q==="string"?{...Z,patterns:q}:q,J=$.cwd?Rq.resolve($.cwd).replace(/\\/g,"/"):process.cwd().replace(/\\/g,"/");return N8($,J,!1)}async function P8(q){try{if(!await i1(q)){console.error("Error: isolatedModules must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await H8(q.outdir,{recursive:!0,force:!0});let $;if(q?.entrypoints)$=await Sq(q.entrypoints,{cwd:q.root??q.cwd,absolute:!0});else $=await D1(q?.root);for(let J of $){let Y=await o1(J);if(Y){let W=_8(q?.root??"./src",J),j=L8(W),z=f8(q?.outdir??"./dist",`${j.name}.d.ts`);await I8(D8(z),{recursive:!0}),await c1(z,Y)}else console.warn(`No declarations extracted for ${J}`)}}catch(Z){console.error("Error generating declarations:",Z)}}async function PJ(q){await P8({...Z1,...q})}export{c1 as writeToFile,z$ as trackUsedTypes,d8 as processTypeOnlyExport,r1 as processTypeDeclaration,Y$ as processSimpleValue,u8 as processNestedArray,rq as processLine,p1 as processInterfaceDeclaration,h8 as processImports,sq as processImport,s1 as processFunctionDeclaration,B$ as processDeclarationLine,aq as processDeclaration,eq as processCompleteProperty,J$ as parseObjectLiteral,m8 as parseFunctionDeclaration,tq as isFunction,X$ as isDeclarationLine,U$ as isCommentLine,Z$ as inferReturnType,$$ as inferFunctionType,J1 as inferElementType,D1 as getAllTypeScriptFiles,oq as generateImports,P8 as generateDeclarationsFromFiles,PJ as generate,l8 as formatTypeParameters,a1 as formatProperties,F$ as formatOutput,N$ as formatObjectType,C1 as formatNestedType,A8 as formatDeclarations,T8 as formatComment,P1 as extractObjectProperties,V1 as extractNestedContent,W$ as extractFunctionSignature,pq as extractDtsTypes,o1 as extract,K1 as deepMerge,iq as createProcessingState,Z1 as config,j$ as cleanParameters,i1 as checkIsolatedDeclarations,L1 as REGEX};
2
+ var lq=Object.create;var{getPrototypeOf:pq,defineProperty:d1,getOwnPropertyNames:iq}=Object;var sq=Object.prototype.hasOwnProperty;var K1=(q,$,J)=>{J=q!=null?lq(pq(q)):{};let Z=$||!q||!q.__esModule?d1(J,"default",{value:q,enumerable:!0}):J;for(let Y of iq(q))if(!sq.call(Z,Y))d1(Z,Y,{get:()=>q[Y],enumerable:!0});return Z};var y=(q,$)=>()=>($||q(($={exports:{}}).exports,$),$.exports);var A1=y((Q0)=>{Object.defineProperty(Q0,"__esModule",{value:!0});Q0.normalizePath=Q0.convertSlashes=Q0.cleanPath=void 0;var E1=import.meta.require("path");function j0(q){let $=E1.normalize(q);if($.length>1&&$[$.length-1]===E1.sep)$=$.substring(0,$.length-1);return $}Q0.cleanPath=j0;var v$=/[\\/]/g;function X0(q,$){return q.replace(v$,$)}Q0.convertSlashes=X0;function g$(q,$){let{resolvePaths:J,normalizePath:Z,pathSeparator:Y}=$,j=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if(J)q=E1.resolve(q);if(Z||j)q=j0(q);if(q===".")return"";let Q=q[q.length-1]!==Y;return X0(Q?q+Y:q,Y)}Q0.normalizePath=g$});var K0=y((G0)=>{Object.defineProperty(G0,"__esModule",{value:!0});G0.build=G0.joinDirectoryPath=G0.joinPathWithBasePath=void 0;var m$=import.meta.require("path"),d$=A1();function z0(q,$){return $+q}G0.joinPathWithBasePath=z0;function c$(q,$){return function(J,Z){if(Z.startsWith(q))return Z.replace(q,"")+J;else return d$.convertSlashes(m$.relative(q,Z),$.pathSeparator)+$.pathSeparator+J}}function l$(q){return q}function p$(q,$,J){return $+q+J}G0.joinDirectoryPath=p$;function i$(q,$){let{relativePaths:J,includeBasePath:Z}=$;return J&&q?c$(q,$):Z?z0:l$}G0.build=i$});var M0=y((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.build=void 0;function r$(q){return function($,J){J.push($.substring(q.length)||".")}}function o$(q){return function($,J,Z){let Y=$.substring(q.length)||".";if(Z.every((j)=>j(Y,!0)))J.push(Y)}}var a$=(q,$)=>{$.push(q||".")},t$=(q,$,J)=>{let Z=q||".";if(J.every((Y)=>Y(Z,!0)))$.push(Z)},e$=()=>{};function qJ(q,$){let{includeDirs:J,filters:Z,relativePaths:Y}=$;if(!J)return e$;if(Y)return Z&&Z.length?o$(q):r$(q);return Z&&Z.length?t$:a$}B0.build=qJ});var H0=y((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.build=void 0;var $J=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))J.files++},JJ=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))$.push(q)},ZJ=(q,$,J,Z)=>{J.files++},YJ=(q,$)=>{$.push(q)},jJ=()=>{};function XJ(q){let{excludeFiles:$,filters:J,onlyCounts:Z}=q;if($)return jJ;if(J&&J.length)return Z?$J:JJ;else if(Z)return ZJ;else return YJ}V0.build=XJ});var _0=y((I0)=>{Object.defineProperty(I0,"__esModule",{value:!0});I0.build=void 0;var QJ=(q)=>{return q},UJ=()=>{return[""].slice(0,0)};function zJ(q){return q.group?UJ:QJ}I0.build=zJ});var P0=y((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.build=void 0;var GJ=(q,$,J)=>{q.push({directory:$,files:J,dir:$})},FJ=()=>{};function KJ(q){return q.group?GJ:FJ}O0.build=KJ});var A0=y((J1)=>{var BJ=J1&&J1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(J1,"__esModule",{value:!0});J1.build=void 0;var M1=BJ(import.meta.require("fs")),f0=import.meta.require("path"),wJ=function(q,$,J){let{queue:Z,options:{suppressErrors:Y}}=$;Z.enqueue(),M1.default.realpath(q,(j,Q)=>{if(j)return Z.dequeue(Y?null:j,$);M1.default.stat(Q,(X,U)=>{if(X)return Z.dequeue(Y?null:X,$);if(U.isDirectory()&&E0(q,Q,$))return Z.dequeue(null,$);J(U,Q),Z.dequeue(null,$)})})},MJ=function(q,$,J){let{queue:Z,options:{suppressErrors:Y}}=$;Z.enqueue();try{let j=M1.default.realpathSync(q),Q=M1.default.statSync(j);if(Q.isDirectory()&&E0(q,j,$))return;J(Q,j)}catch(j){if(!Y)throw j}};function VJ(q,$){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return $?MJ:wJ}J1.build=VJ;function E0(q,$,J){if(J.options.useRealPaths)return NJ($,J);let Z=f0.dirname(q),Y=1;while(Z!==J.root&&Y<2){let j=J.symlinks.get(Z);if(!!j&&(j===$||j.startsWith($)||$.startsWith(j)))Y++;else Z=f0.dirname(Z)}return J.symlinks.set(q,$),Y>1}function NJ(q,$){return $.visited.includes(q+$.options.pathSeparator)}});var x0=y((T0)=>{Object.defineProperty(T0,"__esModule",{value:!0});T0.build=void 0;var HJ=(q)=>{return q.counts},IJ=(q)=>{return q.groups},WJ=(q)=>{return q.paths},_J=(q)=>{return q.paths.slice(0,q.options.maxFiles)},OJ=(q,$,J)=>{return V1($,J,q.counts,q.options.suppressErrors),null},RJ=(q,$,J)=>{return V1($,J,q.paths,q.options.suppressErrors),null},PJ=(q,$,J)=>{return V1($,J,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},fJ=(q,$,J)=>{return V1($,J,q.groups,q.options.suppressErrors),null};function V1(q,$,J,Z){if(q&&!Z)$(q,J);else $(null,J)}function EJ(q,$){let{onlyCounts:J,group:Z,maxFiles:Y}=q;if(J)return $?HJ:OJ;else if(Z)return $?IJ:fJ;else if(Y)return $?_J:PJ;else return $?WJ:RJ}T0.build=EJ});var D0=y((Z1)=>{var AJ=Z1&&Z1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(Z1,"__esModule",{value:!0});Z1.build=void 0;var y0=AJ(import.meta.require("fs")),C0={withFileTypes:!0},TJ=(q,$,J,Z,Y)=>{if(Z<0)return q.queue.dequeue(null,q);q.visited.push($),q.counts.directories++,q.queue.enqueue(),y0.default.readdir($||".",C0,(j,Q=[])=>{Y(Q,J,Z),q.queue.dequeue(q.options.suppressErrors?null:j,q)})},SJ=(q,$,J,Z,Y)=>{if(Z<0)return;q.visited.push($),q.counts.directories++;let j=[];try{j=y0.default.readdirSync($||".",C0)}catch(Q){if(!q.options.suppressErrors)throw Q}Y(j,J,Z)};function xJ(q){return q?SJ:TJ}Z1.build=xJ});var v0=y((L0)=>{Object.defineProperty(L0,"__esModule",{value:!0});L0.Queue=void 0;class k0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,$){if(--this.count<=0||q)this.onQueueEmpty(q,$)}}L0.Queue=k0});var m0=y((h0)=>{Object.defineProperty(h0,"__esModule",{value:!0});h0.Counter=void 0;class g0{_files=0;_directories=0;set files(q){this._files=q}get files(){return this._files}set directories(q){this._directories=q}get directories(){return this._directories}get dirs(){return this._directories}}h0.Counter=g0});var x1=y((i)=>{var yJ=i&&i.__createBinding||(Object.create?function(q,$,J,Z){if(Z===void 0)Z=J;var Y=Object.getOwnPropertyDescriptor($,J);if(!Y||("get"in Y?!$.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return $[J]}};Object.defineProperty(q,Z,Y)}:function(q,$,J,Z){if(Z===void 0)Z=J;q[Z]=$[J]}),CJ=i&&i.__setModuleDefault||(Object.create?function(q,$){Object.defineProperty(q,"default",{enumerable:!0,value:$})}:function(q,$){q.default=$}),a=i&&i.__importStar||function(q){if(q&&q.__esModule)return q;var $={};if(q!=null){for(var J in q)if(J!=="default"&&Object.prototype.hasOwnProperty.call(q,J))yJ($,q,J)}return CJ($,q),$};Object.defineProperty(i,"__esModule",{value:!0});i.Walker=void 0;var d0=import.meta.require("path"),T1=A1(),S1=a(K0()),DJ=a(M0()),kJ=a(H0()),LJ=a(_0()),bJ=a(P0()),vJ=a(A0()),gJ=a(x0()),hJ=a(D0()),uJ=v0(),mJ=m0();class c0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,$,J){this.isSynchronous=!J,this.callbackInvoker=gJ.build($,this.isSynchronous),this.root=T1.normalizePath(q,$),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new mJ.Counter,options:$,queue:new uJ.Queue((Z,Y)=>this.callbackInvoker(Y,Z,J)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=S1.build(this.root,$),this.pushDirectory=DJ.build(this.root,$),this.pushFile=kJ.build($),this.getArray=LJ.build($),this.groupFiles=bJ.build($),this.resolveSymlink=vJ.build($,this.isSynchronous),this.walkDirectory=hJ.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:Y,resolveSymlinks:j,excludeSymlinks:Q,exclude:X,maxFiles:U,signal:z,useRealPaths:G,pathSeparator:V}}=this.state;if(z&&z.aborted||U&&Z.length>U)return;this.pushDirectory($,Z,Y);let H=this.getArray(this.state.paths);for(let W=0;W<q.length;++W){let I=q[W];if(I.isFile()||I.isSymbolicLink()&&!j&&!Q){let _=this.joinPath(I.name,$);this.pushFile(_,H,this.state.counts,Y)}else if(I.isDirectory()){let _=S1.joinDirectoryPath(I.name,$,this.state.options.pathSeparator);if(X&&X(I.name,_))continue;this.walkDirectory(this.state,_,_,J-1,this.walk)}else if(I.isSymbolicLink()&&this.resolveSymlink){let _=S1.joinPathWithBasePath(I.name,$);this.resolveSymlink(_,this.state,(S,E)=>{if(S.isDirectory()){if(E=T1.normalizePath(E,this.state.options),X&&X(I.name,E))return;this.walkDirectory(this.state,E,G?E:_+V,J-1,this.walk)}else{E=G?E:_;let A=d0.basename(E),m=T1.normalizePath(d0.dirname(E),this.state.options);E=this.joinPath(A,m),this.pushFile(E,H,this.state.counts,Y)}})}}this.groupFiles(this.state.groups,$,H)}}i.Walker=c0});var s0=y((p0)=>{Object.defineProperty(p0,"__esModule",{value:!0});p0.callback=p0.promise=void 0;var dJ=x1();function cJ(q,$){return new Promise((J,Z)=>{l0(q,$,(Y,j)=>{if(Y)return Z(Y);J(j)})})}p0.promise=cJ;function l0(q,$,J){new dJ.Walker(q,$,J).start()}p0.callback=l0});var o0=y((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.sync=void 0;var pJ=x1();function iJ(q,$){return new pJ.Walker(q,$).start()}n0.sync=iJ});var $q=y((e0)=>{Object.defineProperty(e0,"__esModule",{value:!0});e0.APIBuilder=void 0;var a0=s0(),sJ=o0();class t0{root;options;constructor(q,$){this.root=q,this.options=$}withPromise(){return a0.promise(this.root,this.options)}withCallback(q){a0.callback(this.root,this.options,q)}sync(){return sJ.sync(this.root,this.options)}}e0.APIBuilder=t0});var j1=y((I8,Zq)=>{var Jq={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:"/"},nJ={...Jq,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:"\\"},rJ={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"};Zq.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:rJ,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(q){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${q.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(q){return q===!0?nJ:Jq}}});var X1=y((qZ)=>{var{REGEX_BACKSLASH:oJ,REGEX_REMOVE_BACKSLASH:aJ,REGEX_SPECIAL_CHARS:tJ,REGEX_SPECIAL_CHARS_GLOBAL:eJ}=j1();qZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);qZ.hasRegexChars=(q)=>tJ.test(q);qZ.isRegexChar=(q)=>q.length===1&&qZ.hasRegexChars(q);qZ.escapeRegex=(q)=>q.replace(eJ,"\\$1");qZ.toPosixSlashes=(q)=>q.replace(oJ,"/");qZ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let q=navigator.platform.toLowerCase();return q==="win32"||q==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};qZ.removeBackslashes=(q)=>{return q.replace(aJ,($)=>{return $==="\\"?"":$})};qZ.escapeLast=(q,$,J)=>{let Z=q.lastIndexOf($,J);if(Z===-1)return q;if(q[Z-1]==="\\")return qZ.escapeLast(q,$,Z-1);return`${q.slice(0,Z)}\\${q.slice(Z)}`};qZ.removePrefix=(q,$={})=>{let J=q;if(J.startsWith("./"))J=J.slice(2),$.prefix="./";return J};qZ.wrapOutput=(q,$={},J={})=>{let Z=J.contains?"":"^",Y=J.contains?"":"$",j=`${Z}(?:${q})${Y}`;if($.negated===!0)j=`(?:^(?!${j}).*\$)`;return j};qZ.basename=(q,{windows:$}={})=>{let J=q.split($?/[\\/]/:"/"),Z=J[J.length-1];if(Z==="")return J[J.length-2];return Z}});var Bq=y((_8,Kq)=>{var Xq=X1(),{CHAR_ASTERISK:y1,CHAR_AT:GZ,CHAR_BACKWARD_SLASH:Q1,CHAR_COMMA:FZ,CHAR_DOT:C1,CHAR_EXCLAMATION_MARK:D1,CHAR_FORWARD_SLASH:Fq,CHAR_LEFT_CURLY_BRACE:k1,CHAR_LEFT_PARENTHESES:L1,CHAR_LEFT_SQUARE_BRACKET:KZ,CHAR_PLUS:BZ,CHAR_QUESTION_MARK:Qq,CHAR_RIGHT_CURLY_BRACE:wZ,CHAR_RIGHT_PARENTHESES:Uq,CHAR_RIGHT_SQUARE_BRACKET:MZ}=j1(),zq=(q)=>{return q===Fq||q===Q1},Gq=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},VZ=(q,$)=>{let J=$||{},Z=q.length-1,Y=J.parts===!0||J.scanToEnd===!0,j=[],Q=[],X=[],U=q,z=-1,G=0,V=0,H=!1,W=!1,I=!1,_=!1,S=!1,E=!1,A=!1,m=!1,t=!1,h=!1,g=0,c,O,P={value:"",depth:0,isGlob:!1},B=()=>z>=Z,d=()=>U.charCodeAt(z+1),b=()=>{return c=O,U.charCodeAt(++z)};while(z<Z){O=b();let T;if(O===Q1){if(A=P.backslashes=!0,O=b(),O===k1)E=!0;continue}if(E===!0||O===k1){g++;while(B()!==!0&&(O=b())){if(O===Q1){A=P.backslashes=!0,b();continue}if(O===k1){g++;continue}if(E!==!0&&O===C1&&(O=b())===C1){if(H=P.isBrace=!0,I=P.isGlob=!0,h=!0,Y===!0)continue;break}if(E!==!0&&O===FZ){if(H=P.isBrace=!0,I=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===wZ){if(g--,g===0){E=!1,H=P.isBrace=!0,h=!0;break}}}if(Y===!0)continue;break}if(O===Fq){if(j.push(z),Q.push(P),P={value:"",depth:0,isGlob:!1},h===!0)continue;if(c===C1&&z===G+1){G+=2;continue}V=z+1;continue}if(J.noext!==!0){if((O===BZ||O===GZ||O===y1||O===Qq||O===D1)===!0&&d()===L1){if(I=P.isGlob=!0,_=P.isExtglob=!0,h=!0,O===D1&&z===G)t=!0;if(Y===!0){while(B()!==!0&&(O=b())){if(O===Q1){A=P.backslashes=!0,O=b();continue}if(O===Uq){I=P.isGlob=!0,h=!0;break}}continue}break}}if(O===y1){if(c===y1)S=P.isGlobstar=!0;if(I=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===Qq){if(I=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===KZ){while(B()!==!0&&(T=b())){if(T===Q1){A=P.backslashes=!0,b();continue}if(T===MZ){W=P.isBracket=!0,I=P.isGlob=!0,h=!0;break}}if(Y===!0)continue;break}if(J.nonegate!==!0&&O===D1&&z===G){m=P.negated=!0,G++;continue}if(J.noparen!==!0&&O===L1){if(I=P.isGlob=!0,Y===!0){while(B()!==!0&&(O=b())){if(O===L1){A=P.backslashes=!0,O=b();continue}if(O===Uq){h=!0;break}}continue}break}if(I===!0){if(h=!0,Y===!0)continue;break}}if(J.noext===!0)_=!1,I=!1;let k=U,F="",K="";if(G>0)F=U.slice(0,G),U=U.slice(G),V-=G;if(k&&I===!0&&V>0)k=U.slice(0,V),K=U.slice(V);else if(I===!0)k="",K=U;else k=U;if(k&&k!==""&&k!=="/"&&k!==U){if(zq(k.charCodeAt(k.length-1)))k=k.slice(0,-1)}if(J.unescape===!0){if(K)K=Xq.removeBackslashes(K);if(k&&A===!0)k=Xq.removeBackslashes(k)}let l={prefix:F,input:q,start:G,base:k,glob:K,isBrace:H,isBracket:W,isGlob:I,isExtglob:_,isGlobstar:S,negated:m,negatedExtglob:t};if(J.tokens===!0){if(l.maxDepth=0,!zq(O))Q.push(P);l.tokens=Q}if(J.parts===!0||J.tokens===!0){let T;for(let C=0;C<j.length;C++){let n=T?T+1:G,p=j[C],o=q.slice(n,p);if(J.tokens){if(C===0&&G!==0)Q[C].isPrefix=!0,Q[C].value=F;else Q[C].value=o;Gq(Q[C]),l.maxDepth+=Q[C].depth}if(C!==0||o!=="")X.push(o);T=p}if(T&&T+1<q.length){let C=q.slice(T+1);if(X.push(C),J.tokens)Q[Q.length-1].value=C,Gq(Q[Q.length-1]),l.maxDepth+=Q[Q.length-1].depth}l.slashes=j,l.parts=X}return l};Kq.exports=VZ});var Vq=y((O8,Mq)=>{var N1=j1(),s=X1(),{MAX_LENGTH:H1,POSIX_REGEX_SOURCE:NZ,REGEX_NON_SPECIAL_CHARS:HZ,REGEX_SPECIAL_CHARS_BACKREF:IZ,REPLACEMENTS:wq}=N1,WZ=(q,$)=>{if(typeof $.expandRange==="function")return $.expandRange(...q,$);q.sort();let J=`[${q.join("-")}]`;try{new RegExp(J)}catch(Z){return q.map((Y)=>s.escapeRegex(Y)).join("..")}return J},Y1=(q,$)=>{return`Missing ${q}: "${$}" - use "\\\\${$}" to match literal characters`},b1=(q,$)=>{if(typeof q!=="string")throw new TypeError("Expected a string");q=wq[q]||q;let J={...$},Z=typeof J.maxLength==="number"?Math.min(H1,J.maxLength):H1,Y=q.length;if(Y>Z)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${Z}`);let j={type:"bos",value:"",output:J.prepend||""},Q=[j],X=J.capture?"":"?:",U=N1.globChars(J.windows),z=N1.extglobChars(U),{DOT_LITERAL:G,PLUS_LITERAL:V,SLASH_LITERAL:H,ONE_CHAR:W,DOTS_SLASH:I,NO_DOT:_,NO_DOT_SLASH:S,NO_DOTS_SLASH:E,QMARK:A,QMARK_NO_DOT:m,STAR:t,START_ANCHOR:h}=U,g=(N)=>{return`(${X}(?:(?!${h}${N.dot?I:G}).)*?)`},c=J.dot?"":_,O=J.dot?A:m,P=J.bash===!0?g(J):t;if(J.capture)P=`(${P})`;if(typeof J.noext==="boolean")J.noextglob=J.noext;let B={input:q,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:Q};q=s.removePrefix(q,B),Y=q.length;let d=[],b=[],k=[],F=j,K,l=()=>B.index===Y-1,T=B.peek=(N=1)=>q[B.index+N],C=B.advance=()=>q[++B.index]||"",n=()=>q.slice(B.index+1),p=(N="",x=0)=>{B.consumed+=N,B.index+=x},o=(N)=>{B.output+=N.output!=null?N.output:N.value,p(N.value)},dq=()=>{let N=1;while(T()==="!"&&(T(2)!=="("||T(3)==="?"))C(),B.start++,N++;if(N%2===0)return!1;return B.negated=!0,B.start++,!0},z1=(N)=>{B[N]++,k.push(N)},e=(N)=>{B[N]--,k.pop()},f=(N)=>{if(F.type==="globstar"){let x=B.braces>0&&(N.type==="comma"||N.type==="brace"),M=N.extglob===!0||d.length&&(N.type==="pipe"||N.type==="paren");if(N.type!=="slash"&&N.type!=="paren"&&!x&&!M)B.output=B.output.slice(0,-F.output.length),F.type="star",F.value="*",F.output=P,B.output+=F.output}if(d.length&&N.type!=="paren")d[d.length-1].inner+=N.value;if(N.value||N.output)o(N);if(F&&F.type==="text"&&N.type==="text"){F.output=(F.output||F.value)+N.value,F.value+=N.value;return}N.prev=F,Q.push(N),F=N},G1=(N,x)=>{let M={...z[x],conditions:1,inner:""};M.prev=F,M.parens=B.parens,M.output=B.output;let R=(J.capture?"(":"")+M.open;z1("parens"),f({type:N,value:x,output:B.output?"":W}),f({type:"paren",extglob:!0,value:C(),output:R}),d.push(M)},cq=(N)=>{let x=N.close+(J.capture?")":""),M;if(N.type==="negate"){let R=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/"))R=g(J);if(R!==P||l()||/^\)+$/.test(n()))x=N.close=`)\$))${R}`;if(N.inner.includes("*")&&(M=n())&&/^\.[^\\/.]+$/.test(M)){let D=b1(M,{...$,fastpaths:!1}).output;x=N.close=`)${D})${R})`}if(N.prev.type==="bos")B.negatedExtglob=!0}f({type:"paren",extglob:!0,value:K,output:x}),e("parens")};if(J.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let N=!1,x=q.replace(IZ,(M,R,D,u,v,W1)=>{if(u==="\\")return N=!0,M;if(u==="?"){if(R)return R+u+(v?A.repeat(v.length):"");if(W1===0)return O+(v?A.repeat(v.length):"");return A.repeat(D.length)}if(u===".")return G.repeat(D.length);if(u==="*"){if(R)return R+u+(v?P:"");return P}return R?M:`\\${M}`});if(N===!0)if(J.unescape===!0)x=x.replace(/\\/g,"");else x=x.replace(/\\+/g,(M)=>{return M.length%2===0?"\\\\":M?"\\":""});if(x===q&&J.contains===!0)return B.output=q,B;return B.output=s.wrapOutput(x,B,$),B}while(!l()){if(K=C(),K==="\0")continue;if(K==="\\"){let M=T();if(M==="/"&&J.bash!==!0)continue;if(M==="."||M===";")continue;if(!M){K+="\\",f({type:"text",value:K});continue}let R=/^\\+/.exec(n()),D=0;if(R&&R[0].length>2){if(D=R[0].length,B.index+=D,D%2!==0)K+="\\"}if(J.unescape===!0)K=C();else K+=C();if(B.brackets===0){f({type:"text",value:K});continue}}if(B.brackets>0&&(K!=="]"||F.value==="["||F.value==="[^")){if(J.posix!==!1&&K===":"){let M=F.value.slice(1);if(M.includes("[")){if(F.posix=!0,M.includes(":")){let R=F.value.lastIndexOf("["),D=F.value.slice(0,R),u=F.value.slice(R+2),v=NZ[u];if(v){if(F.value=D+v,B.backtrack=!0,C(),!j.output&&Q.indexOf(F)===1)j.output=W;continue}}}}if(K==="["&&T()!==":"||K==="-"&&T()==="]")K=`\\${K}`;if(K==="]"&&(F.value==="["||F.value==="[^"))K=`\\${K}`;if(J.posix===!0&&K==="!"&&F.value==="[")K="^";F.value+=K,o({value:K});continue}if(B.quotes===1&&K!=='"'){K=s.escapeRegex(K),F.value+=K,o({value:K});continue}if(K==='"'){if(B.quotes=B.quotes===1?0:1,J.keepQuotes===!0)f({type:"text",value:K});continue}if(K==="("){z1("parens"),f({type:"paren",value:K});continue}if(K===")"){if(B.parens===0&&J.strictBrackets===!0)throw new SyntaxError(Y1("opening","("));let M=d[d.length-1];if(M&&B.parens===M.parens+1){cq(d.pop());continue}f({type:"paren",value:K,output:B.parens?")":"\\)"}),e("parens");continue}if(K==="["){if(J.nobracket===!0||!n().includes("]")){if(J.nobracket!==!0&&J.strictBrackets===!0)throw new SyntaxError(Y1("closing","]"));K=`\\${K}`}else z1("brackets");f({type:"bracket",value:K});continue}if(K==="]"){if(J.nobracket===!0||F&&F.type==="bracket"&&F.value.length===1){f({type:"text",value:K,output:`\\${K}`});continue}if(B.brackets===0){if(J.strictBrackets===!0)throw new SyntaxError(Y1("opening","["));f({type:"text",value:K,output:`\\${K}`});continue}e("brackets");let M=F.value.slice(1);if(F.posix!==!0&&M[0]==="^"&&!M.includes("/"))K=`/${K}`;if(F.value+=K,o({value:K}),J.literalBrackets===!1||s.hasRegexChars(M))continue;let R=s.escapeRegex(F.value);if(B.output=B.output.slice(0,-F.value.length),J.literalBrackets===!0){B.output+=R,F.value=R;continue}F.value=`(${X}${R}|${F.value})`,B.output+=F.value;continue}if(K==="{"&&J.nobrace!==!0){z1("braces");let M={type:"brace",value:K,output:"(",outputIndex:B.output.length,tokensIndex:B.tokens.length};b.push(M),f(M);continue}if(K==="}"){let M=b[b.length-1];if(J.nobrace===!0||!M){f({type:"text",value:K,output:K});continue}let R=")";if(M.dots===!0){let D=Q.slice(),u=[];for(let v=D.length-1;v>=0;v--){if(Q.pop(),D[v].type==="brace")break;if(D[v].type!=="dots")u.unshift(D[v].value)}R=WZ(u,J),B.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let D=B.output.slice(0,M.outputIndex),u=B.tokens.slice(M.tokensIndex);M.value=M.output="\\{",K=R="\\}",B.output=D;for(let v of u)B.output+=v.output||v.value}f({type:"brace",value:K,output:R}),e("braces"),b.pop();continue}if(K==="|"){if(d.length>0)d[d.length-1].conditions++;f({type:"text",value:K});continue}if(K===","){let M=K,R=b[b.length-1];if(R&&k[k.length-1]==="braces")R.comma=!0,M="|";f({type:"comma",value:K,output:M});continue}if(K==="/"){if(F.type==="dot"&&B.index===B.start+1){B.start=B.index+1,B.consumed="",B.output="",Q.pop(),F=j;continue}f({type:"slash",value:K,output:H});continue}if(K==="."){if(B.braces>0&&F.type==="dot"){if(F.value===".")F.output=G;let M=b[b.length-1];F.type="dots",F.output+=K,F.value+=K,M.dots=!0;continue}if(B.braces+B.parens===0&&F.type!=="bos"&&F.type!=="slash"){f({type:"text",value:K,output:G});continue}f({type:"dot",value:K,output:G});continue}if(K==="?"){if(!(F&&F.value==="(")&&J.noextglob!==!0&&T()==="("&&T(2)!=="?"){G1("qmark",K);continue}if(F&&F.type==="paren"){let R=T(),D=K;if(F.value==="("&&!/[!=<:]/.test(R)||R==="<"&&!/<([!=]|\w+>)/.test(n()))D=`\\${K}`;f({type:"text",value:K,output:D});continue}if(J.dot!==!0&&(F.type==="slash"||F.type==="bos")){f({type:"qmark",value:K,output:m});continue}f({type:"qmark",value:K,output:A});continue}if(K==="!"){if(J.noextglob!==!0&&T()==="("){if(T(2)!=="?"||!/[!=<:]/.test(T(3))){G1("negate",K);continue}}if(J.nonegate!==!0&&B.index===0){dq();continue}}if(K==="+"){if(J.noextglob!==!0&&T()==="("&&T(2)!=="?"){G1("plus",K);continue}if(F&&F.value==="("||J.regex===!1){f({type:"plus",value:K,output:V});continue}if(F&&(F.type==="bracket"||F.type==="paren"||F.type==="brace")||B.parens>0){f({type:"plus",value:K});continue}f({type:"plus",value:V});continue}if(K==="@"){if(J.noextglob!==!0&&T()==="("&&T(2)!=="?"){f({type:"at",extglob:!0,value:K,output:""});continue}f({type:"text",value:K});continue}if(K!=="*"){if(K==="$"||K==="^")K=`\\${K}`;let M=HZ.exec(n());if(M)K+=M[0],B.index+=M[0].length;f({type:"text",value:K});continue}if(F&&(F.type==="globstar"||F.star===!0)){F.type="star",F.star=!0,F.value+=K,F.output=P,B.backtrack=!0,B.globstar=!0,p(K);continue}let N=n();if(J.noextglob!==!0&&/^\([^?]/.test(N)){G1("star",K);continue}if(F.type==="star"){if(J.noglobstar===!0){p(K);continue}let M=F.prev,R=M.prev,D=M.type==="slash"||M.type==="bos",u=R&&(R.type==="star"||R.type==="globstar");if(J.bash===!0&&(!D||N[0]&&N[0]!=="/")){f({type:"star",value:K,output:""});continue}let v=B.braces>0&&(M.type==="comma"||M.type==="brace"),W1=d.length&&(M.type==="pipe"||M.type==="paren");if(!D&&M.type!=="paren"&&!v&&!W1){f({type:"star",value:K,output:""});continue}while(N.slice(0,3)==="/**"){let F1=q[B.index+4];if(F1&&F1!=="/")break;N=N.slice(3),p("/**",3)}if(M.type==="bos"&&l()){F.type="globstar",F.value+=K,F.output=g(J),B.output=F.output,B.globstar=!0,p(K);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!u&&l()){B.output=B.output.slice(0,-(M.output+F.output).length),M.output=`(?:${M.output}`,F.type="globstar",F.output=g(J)+(J.strictSlashes?")":"|$)"),F.value+=K,B.globstar=!0,B.output+=M.output+F.output,p(K);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&N[0]==="/"){let F1=N[1]!==void 0?"|$":"";B.output=B.output.slice(0,-(M.output+F.output).length),M.output=`(?:${M.output}`,F.type="globstar",F.output=`${g(J)}${H}|${H}${F1})`,F.value+=K,B.output+=M.output+F.output,B.globstar=!0,p(K+C()),f({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&N[0]==="/"){F.type="globstar",F.value+=K,F.output=`(?:^|${H}|${g(J)}${H})`,B.output=F.output,B.globstar=!0,p(K+C()),f({type:"slash",value:"/",output:""});continue}B.output=B.output.slice(0,-F.output.length),F.type="globstar",F.output=g(J),F.value+=K,B.output+=F.output,B.globstar=!0,p(K);continue}let x={type:"star",value:K,output:P};if(J.bash===!0){if(x.output=".*?",F.type==="bos"||F.type==="slash")x.output=c+x.output;f(x);continue}if(F&&(F.type==="bracket"||F.type==="paren")&&J.regex===!0){x.output=K,f(x);continue}if(B.index===B.start||F.type==="slash"||F.type==="dot"){if(F.type==="dot")B.output+=S,F.output+=S;else if(J.dot===!0)B.output+=E,F.output+=E;else B.output+=c,F.output+=c;if(T()!=="*")B.output+=W,F.output+=W}f(x)}while(B.brackets>0){if(J.strictBrackets===!0)throw new SyntaxError(Y1("closing","]"));B.output=s.escapeLast(B.output,"["),e("brackets")}while(B.parens>0){if(J.strictBrackets===!0)throw new SyntaxError(Y1("closing",")"));B.output=s.escapeLast(B.output,"("),e("parens")}while(B.braces>0){if(J.strictBrackets===!0)throw new SyntaxError(Y1("closing","}"));B.output=s.escapeLast(B.output,"{"),e("braces")}if(J.strictSlashes!==!0&&(F.type==="star"||F.type==="bracket"))f({type:"maybe_slash",value:"",output:`${H}?`});if(B.backtrack===!0){B.output="";for(let N of B.tokens)if(B.output+=N.output!=null?N.output:N.value,N.suffix)B.output+=N.suffix}return B};b1.fastpaths=(q,$)=>{let J={...$},Z=typeof J.maxLength==="number"?Math.min(H1,J.maxLength):H1,Y=q.length;if(Y>Z)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${Z}`);q=wq[q]||q;let{DOT_LITERAL:j,SLASH_LITERAL:Q,ONE_CHAR:X,DOTS_SLASH:U,NO_DOT:z,NO_DOTS:G,NO_DOTS_SLASH:V,STAR:H,START_ANCHOR:W}=N1.globChars(J.windows),I=J.dot?G:z,_=J.dot?V:z,S=J.capture?"":"?:",E={negated:!1,prefix:""},A=J.bash===!0?".*?":H;if(J.capture)A=`(${A})`;let m=(c)=>{if(c.noglobstar===!0)return A;return`(${S}(?:(?!${W}${c.dot?U:j}).)*?)`},t=(c)=>{switch(c){case"*":return`${I}${X}${A}`;case".*":return`${j}${X}${A}`;case"*.*":return`${I}${A}${j}${X}${A}`;case"*/*":return`${I}${A}${Q}${X}${_}${A}`;case"**":return I+m(J);case"**/*":return`(?:${I}${m(J)}${Q})?${_}${X}${A}`;case"**/*.*":return`(?:${I}${m(J)}${Q})?${_}${A}${j}${X}${A}`;case"**/.*":return`(?:${I}${m(J)}${Q})?${j}${X}${A}`;default:{let O=/^(.*?)\.(\w+)$/.exec(c);if(!O)return;let P=t(O[1]);if(!P)return;return P+j+O[2]}}},h=s.removePrefix(q,E),g=t(h);if(g&&J.strictSlashes!==!0)g+=`${Q}?`;return g};Mq.exports=b1});var Iq=y((R8,Hq)=>{var _Z=Bq(),v1=Vq(),Nq=X1(),OZ=j1(),RZ=(q)=>q&&typeof q==="object"&&!Array.isArray(q),L=(q,$,J=!1)=>{if(Array.isArray(q)){let G=q.map((H)=>L(H,$,J));return(H)=>{for(let W of G){let I=W(H);if(I)return I}return!1}}let Z=RZ(q)&&q.tokens&&q.input;if(q===""||typeof q!=="string"&&!Z)throw new TypeError("Expected pattern to be a non-empty string");let Y=$||{},j=Y.windows,Q=Z?L.compileRe(q,$):L.makeRe(q,$,!1,!0),X=Q.state;delete Q.state;let U=()=>!1;if(Y.ignore){let G={...$,ignore:null,onMatch:null,onResult:null};U=L(Y.ignore,G,J)}let z=(G,V=!1)=>{let{isMatch:H,match:W,output:I}=L.test(G,Q,$,{glob:q,posix:j}),_={glob:q,state:X,regex:Q,posix:j,input:G,output:I,match:W,isMatch:H};if(typeof Y.onResult==="function")Y.onResult(_);if(H===!1)return _.isMatch=!1,V?_:!1;if(U(G)){if(typeof Y.onIgnore==="function")Y.onIgnore(_);return _.isMatch=!1,V?_:!1}if(typeof Y.onMatch==="function")Y.onMatch(_);return V?_:!0};if(J)z.state=X;return z};L.test=(q,$,J,{glob:Z,posix:Y}={})=>{if(typeof q!=="string")throw new TypeError("Expected input to be a string");if(q==="")return{isMatch:!1,output:""};let j=J||{},Q=j.format||(Y?Nq.toPosixSlashes:null),X=q===Z,U=X&&Q?Q(q):q;if(X===!1)U=Q?Q(q):q,X=U===Z;if(X===!1||j.capture===!0)if(j.matchBase===!0||j.basename===!0)X=L.matchBase(q,$,J,Y);else X=$.exec(U);return{isMatch:Boolean(X),match:X,output:U}};L.matchBase=(q,$,J)=>{return($ instanceof RegExp?$:L.makeRe($,J)).test(Nq.basename(q))};L.isMatch=(q,$,J)=>L($,J)(q);L.parse=(q,$)=>{if(Array.isArray(q))return q.map((J)=>L.parse(J,$));return v1(q,{...$,fastpaths:!1})};L.scan=(q,$)=>_Z(q,$);L.compileRe=(q,$,J=!1,Z=!1)=>{if(J===!0)return q.output;let Y=$||{},j=Y.contains?"":"^",Q=Y.contains?"":"$",X=`${j}(?:${q.output})${Q}`;if(q&&q.negated===!0)X=`^(?!${X}).*\$`;let U=L.toRegex(X,$);if(Z===!0)U.state=q;return U};L.makeRe=(q,$={},J=!1,Z=!1)=>{if(!q||typeof q!=="string")throw new TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if($.fastpaths!==!1&&(q[0]==="."||q[0]==="*"))Y.output=v1.fastpaths(q,$);if(!Y.output)Y=v1(q,$);return L.compileRe(Y,$,J,Z)};L.toRegex=(q,$)=>{try{let J=$||{};return new RegExp(q,J.flags||(J.nocase?"i":""))}catch(J){if($&&$.debug===!0)throw J;return/$^/}};L.constants=OZ;Hq.exports=L});var U1=y((P8,Oq)=>{var Wq=Iq(),PZ=X1();function _q(q,$,J=!1){if($&&($.windows===null||$.windows===void 0))$={...$,windows:PZ.isWindows()};return Wq(q,$,J)}Object.assign(_q,Wq);Oq.exports=_q});var Tq=y((Eq)=>{Object.defineProperty(Eq,"__esModule",{value:!0});Eq.Builder=void 0;var fZ=import.meta.require("path"),Rq=$q(),Pq=null;try{import.meta.require.resolve("picomatch"),Pq=U1()}catch(q){}class fq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:fZ.sep,filters:[]};globFunction;constructor(q){this.options={...this.options,...q},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(q){return this.options.pathSeparator=q,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(q){return this.options.maxDepth=q,this}withMaxFiles(q){return this.options.maxFiles=q,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:q=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=q,this.withFullPaths()}withAbortSignal(q){return this.options.signal=q,this}normalize(){return this.options.normalizePath=!0,this}filter(q){return this.options.filters.push(q),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(q){return this.options.exclude=q,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(q){return new Rq.APIBuilder(q||".",this.options)}withGlobFunction(q){return this.globFunction=q,this}crawlWithOptions(q,$){return this.options={...this.options,...$},new Rq.APIBuilder(q||".",this.options)}glob(...q){if(this.globFunction)return this.globWithOptions(q);return this.globWithOptions(q,...[{dot:!0}])}globWithOptions(q,...$){let J=this.globFunction||Pq;if(!J)throw new Error("Please specify a glob function to use glob matching.");var Z=this.globCache[q.join("\0")];if(!Z)Z=J(q,...$),this.globCache[q.join("\0")]=Z;return this.options.filters.push((Y)=>Z(Y)),this}}Eq.Builder=fq});var xq=y((Sq)=>{Object.defineProperty(Sq,"__esModule",{value:!0})});var yq=y((r)=>{var EZ=r&&r.__createBinding||(Object.create?function(q,$,J,Z){if(Z===void 0)Z=J;var Y=Object.getOwnPropertyDescriptor($,J);if(!Y||("get"in Y?!$.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return $[J]}};Object.defineProperty(q,Z,Y)}:function(q,$,J,Z){if(Z===void 0)Z=J;q[Z]=$[J]}),AZ=r&&r.__exportStar||function(q,$){for(var J in q)if(J!=="default"&&!Object.prototype.hasOwnProperty.call($,J))EZ($,q,J)};Object.defineProperty(r,"__esModule",{value:!0});r.fdir=void 0;var TZ=Tq();Object.defineProperty(r,"fdir",{enumerable:!0,get:function(){return TZ.Builder}});AZ(xq(),r)});import l1 from"process";import{resolve as nq}from"path";import rq from"process";function _1(q,...$){if(!$.length)return q;let J=$.shift();if(B1(q)&&B1(J)){for(let Z in J)if(Object.prototype.hasOwnProperty.call(J,Z)){let Y=J[Z];if(B1(Y)&&B1(q[Z]))q[Z]=_1(q[Z],Y);else q[Z]=Y}}return _1(q,...$)}function B1(q){return q&&typeof q==="object"&&!Array.isArray(q)}async function c1({name:q,cwd:$,defaultConfig:J}){let Z=$??rq.cwd(),Y=nq(Z,`${q}.config`);try{let j=await import(Y),Q=j.default||j;return _1(J,Q)}catch(j){return console.error(`Error loading config from ${Y}:`,j),J}}var q1=await c1({name:"dts",cwd:l1.cwd(),defaultConfig:{cwd:l1.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json",verbose:!1}});function O1(q){if(w("params",`Cleaning parameters: ${q}`),!q.trim())return"";let $=[],J="",Z=0,Y=!1,j="",Q=!1;for(let U of q){if(U==='"'||U==="\'"||U==="`"){if(!Y)Y=!0,j=U;else if(U===j)Y=!1}if(!Y){if(U==="{")Q=!0,Z++;if(U==="}")Q=!1,Z--;if(U==="<"||U==="(")Z++;if(U===">"||U===")")Z--;if(U===","&&Z===0&&!Q){if(J.trim())$.push(p1(J));J="";continue}}J+=U}if(J.trim())$.push(p1(J));let X=$.join(", ");return w("params",`Cleaned parameters: ${X}`),X}function p1(q){w("param-clean",`Cleaning parameter: ${q}`);let $=q.match(/^([^:]+):\s*([^=]+)(?:=\s*.+)?$/);if($){let[,Z,Y]=$,j=Y.replace(/\s*&\s*/g," & ").replace(/\s{2,}/g," ").trim(),Q=`${Z.trim()}: ${j}`;return w("param-clean",`Cleaned to: ${Q}`),Q}let J=q.match(/^([^=]+)=\s*(.+)$/);if(J){let[,Z,Y]=J,j=G$(Y.trim()),Q=`${Z.trim()}: ${j}`;return w("param-clean",`Inferred type: ${Q}`),Q}return q.trim()}async function o1(q){try{let $=await Bun.file(q).text();return oq($)}catch($){throw console.error("Failed to extract types:",$),new Error("Failed to extract and generate .d.ts file")}}function oq(q){let $=X$();q.split("\n").forEach((Z)=>{if(Z.includes("import "))q0(Z,$.importTracking)}),A$(q,$),$.dtsLines.forEach((Z)=>{if(Z.trim()&&!Z.startsWith("import"))D$(Z,$.importTracking),k$(Z,$.importTracking)});let J=J$($.importTracking);return $.dtsLines=[...J.map((Z)=>`${Z};`),"",...$.dtsLines.filter((Z)=>!Z.trim().startsWith("import"))],Y$($)}function aq(q){w("signature-start",`Processing declaration: ${q}`);let $=S$(q);w("signature-clean",`Clean declaration: ${$}`);let J=tq($),Z=$.slice($.indexOf(J)+J.length).trim();w("signature-content",`Content after name: ${Z}`);let{generics:Y,rest:j}=eq(Z);Z=j.trim(),w("signature-after-generics",`Remaining content: ${Z}`);let{params:Q,rest:X}=q$(Z);Z=X.trim(),w("signature-after-params",`Remaining content: ${Z}`);let{returnType:U}=$$(Z);w("signature-return",`Extracted return type: ${U}`);let z={name:J,generics:Y,params:Q,returnType:U};return w("signature-final",`Final signature object: ${JSON.stringify(z,null,2)}`),z}function tq(q){let $=q.match(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*([^(<\s]+)/);if(!$)throw new Error("Invalid function declaration");return $[1]}function eq(q){let $="";if(q.startsWith("<")){let J=1,Z=0,Y="<",j=!1,Q="";w("generics-input",`Starting generic extraction with: ${q}`);for(let X=1;X<q.length;X++){let U=q[X],z=X<q.length-1?q[X+1]:"",G=X>0?q[X-1]:"";if(w("generics-char",`Processing char: ${U}, next char: ${z}, depth: ${J}, pos: ${X}`),(U==='"'||U==="\'"||U==="`")&&G!=="\\"){if(!j)j=!0,Q=U,w("generics-string",`Entering string with ${Q}`);else if(U===Q)j=!1,w("generics-string","Exiting string")}if(!j){if(U==="<")J++,w("generics-depth",`Increasing depth to ${J} at pos ${X}`);else if(U===">"){if(J--,w("generics-depth",`Decreasing depth to ${J} at pos ${X}`),J===0&&z===">"){Y+=">>",Z=X+1,w("generics-complete",`Found double closing bracket at pos ${X}, final buffer: ${Y}`);break}else if(J===0){Y+=">",Z=X,w("generics-complete",`Found single closing bracket at pos ${X}, final buffer: ${Y}`);break}}}if(J>0)Y+=U,w("generics-buffer",`Current buffer: ${Y}`)}if(Y)$=Y,q=q.slice(Z+1),w("generics-success",`Successfully extracted generics: ${$}`),w("generics-rest",`Remaining text: ${q}`);else w("generics-fail",`Failed to extract generics from: ${q}`)}return{generics:$,rest:q}}function q$(q){let $="";if(q.includes("(")){let J=q.indexOf("("),Z=1,Y=J+1,j="";w("params-extraction-start",`Starting params extraction from pos ${Y}: ${q}`);for(;Y<q.length;Y++){let Q=q[Y];if(Q==="(")Z++;if(Q===")"){if(Z--,Z===0){w("params-depth-zero",`Found closing parenthesis at pos ${Y}`);break}}j+=Q}$=j.trim(),q=q.slice(Y+1).trim(),w("signature-params",`Extracted params: ${$}`)}return{params:$,rest:q}}function $$(q){let $="void";if(q.startsWith(":")){w("return-start",`Starting return type extraction with: ${q}`),q=q.slice(1).trim();let J=0,Z="",Y=0,j=!1,Q="",X=!1;w("return-extraction","Starting character-by-character extraction");while(Y<q.length&&!X){let U=q[Y],z=Y>0?q[Y-1]:"";if(w("return-char",`Pos ${Y}: Char "${U}", Depth ${J}, InString ${j}, Buffer length ${Z.length}`),(U==='"'||U==="\'"||U==="`")&&z!=="\\"){if(!j)j=!0,Q=U,w("return-string",`Entering string with ${Q}`);else if(U===Q)j=!1,w("return-string","Exiting string")}if(!j){if(U==="{"||U==="<"||U==="(")J++,w("return-depth",`Opening bracket, increasing depth to ${J}`);else if(U==="}"||U===">"||U===")"){if(J--,w("return-depth",`Closing bracket, decreasing depth to ${J}`),J===0&&U==="}"){if(Z+=U,q.slice(Y+1).trim()[0]==="{"){w("return-end",`Found end of return type at pos ${Y}, next char is function body`),X=!0;break}}}if(J===0&&U===";"){w("return-end","Found semicolon at depth 0"),X=!0;break}}Z+=U,w("return-buffer",`Updated buffer: ${Z}`),Y++}$=Z.trim(),w("return-final",`Final extracted return type: ${$}`)}return{returnType:$}}function f1(q){w("extract-function",`Extracting function type from: ${q}`);let $=q.trim(),J=0,Z=$.length;if(!$.startsWith("(")){let H=$.match(/^function\s*\w*\s*\((.*?)\)/s);if(H){let[,W]=H,I=O1(W||""),_=$.match(/\):\s*([^{;]+)(?:[{;]|$)/),S=_?L$(_[1]):"unknown";return`(${I}) => ${S}`}return null}J++;let Y=1,j=J,Q=!1,X="";for(;J<Z;J++){let H=$[J],W=J>0?$[J-1]:"";if(Q){if(H===X&&W!=="\\")Q=!1;else if(H==="\\")J++}else if(H==='"'||H==="\'"||H==="`")Q=!0,X=H;else if(H==="(")Y++;else if(H===")"){if(Y--,Y===0)break}}if(Y!==0)return w("extract-function","Unbalanced parentheses in function parameters"),null;let U=J,z=$.slice(j,U);J++;while(J<Z&&/\s/.test($[J]))J++;let G="unknown";if($[J]===":"){J++;while(J<Z&&/\s/.test($[J]))J++;let H=J;while(J<Z&&!$.startsWith("=>",J)&&$[J]!=="{")J++;let W=J;G=$.slice(H,W).trim()}while(J<Z&&/\s/.test($[J]))J++;if($.startsWith("=>",J))J+=2;else return w("extract-function",'Function expression missing "=>"'),null;let V=O1(z||"");return w("extract-function",`Extracted function type: (${V}) => ${G}`),`(${V}) => ${G}`}function J$(q){let $=[],J=new Set;w("import-gen",`Generating optimized imports. ${q.exportedTypes.size} exported types`);for(let[Z,Y]of q.typeImports){w("import-type-check",`Checking types from ${Z}: ${Array.from(Y).join(", ")}`);let j=Array.from(Y).filter((Q)=>{let X=q.exportedTypes.has(Q)||q.usedTypes.has(Q);return w("import-type-filter",`Type ${Q}: exported=${q.exportedTypes.has(Q)}, used=${q.usedTypes.has(Q)}`),X}).map((Q)=>{let X=q.valueAliases.get(Q);return X?`${Q} as ${X}`:Q}).sort();if(j.length>0){let Q=`import type { ${j.join(", ")} } from '${Z}'`;if(!J.has(Q))$.push(Q),J.add(Q),w("import-add-type",`Added type import: ${Q}`)}}for(let[Z,Y]of q.valueImports){let j=new Map,Q=Array.from(Y).filter((X)=>{let U=Array.from(q.valueAliases.entries()).find(([G,V])=>V===X)?.[0],z=q.exportedValues.has(X)||q.usedValues.has(X)||X===q.defaultExportValue||U&&(q.exportedValues.has(U)||U===q.defaultExportValue);if(z&&U)j.set(X,U);return z}).map((X)=>{let U=j.get(X);return U?`${X} as ${U}`:X}).sort();if(Q.length>0){let X=`import { ${Q.join(", ")} } from '${Z}'`;if(!J.has(X))$.push(X),J.add(X),w("import-add-value",`Added value import: ${X}`)}}return $.sort()}function Z$(q){let $=q.trim();if(!$.startsWith("{"))return null;let J=0,Z=!1,Y="";for(let j=0;j<$.length;j++){let Q=$[j],X=j>0?$[j-1]:"";if((Q==='"'||Q==="\'"||Q==="`")&&X!=="\\"){if(!Z)Z=!0,Y=Q;else if(Q===Y)Z=!1;continue}if(!Z){if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(0,j+1)}}}return null}function Y$(q){let $=new Set;q.dtsLines.filter((j)=>j.startsWith("import")).forEach((j)=>$.add(j.replace(/;+$/,"")));let J=q.dtsLines.filter((j)=>!j.startsWith("import")).map((j)=>{let Q=j.trim();if(!Q)return"";if(Q.startsWith("export *")||Q.endsWith(";"))return Q;if(Q.startsWith("export type"))return`${Q};`;return Q.replace(/;+$/,";")}),Z=Array.from(q.defaultExports).map((j)=>j.trim().replace(/;+$/,";"));return`${[...Array.from($).map((j)=>`${j};`),"",...J.filter(Boolean),"",...Z].map((j)=>j.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"")).filter((j)=>j.trim()||j==="").join("\n")}`.trim()}function j$(q){let $=q.split("\n"),J=0;while(J<$.length){let Z=$[J].trim();if(Z.startsWith("//")||Z.startsWith("/*")||Z.startsWith("*")||Z==="")J++;else break}return $.slice(J).join("\n")}function X$(){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:Q$(),defaultExports:new Set,currentScope:"top"}}function Q$(){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 i1(q,$,J){let Z=q.split("\n");if(Z.length===1)return`${$}${q}${J?"":" |"}`;let Y=[],j=!1,Q=0;return Z.forEach((U)=>{let z=U.trim();if(z.startsWith("Array<"))Q=0;if(z==="}"||z.startsWith("> |")||z===">")j=Q===1;if(z&&!z.startsWith("Array<")&&!z.endsWith(">")&&!z.startsWith("{")&&!z.endsWith("}"))Q++}),Z.map((U,z)=>{let G=U.trim();if(!G)return"";let V=$;if(z>0){let _=Y.reduce((S,E)=>S+E.depth,0);if(V=$+" ".repeat(_),G.match(/^['"]/))V+=" ";if((G.startsWith("}")||G.startsWith(">")||G.startsWith("> |"))&&Y.length>0)V=$+" ".repeat(Math.max(0,_-1))}let H=G.match(/[{<[]/g)||[],W=G.match(/[}\]>]/g)||[];if(H.forEach((_)=>{let S=G.startsWith("Array")&&_==="<";Y.push({char:_,indent:V,isArray:S,depth:1,isSingleElement:j})}),W.length>0){for(let _=0;_<W.length;_++)if(Y.length>0)Y.pop()}let I=!1;if(!J&&z===Z.length-1&&!G.endsWith(" |")&&!G.endsWith(";"))I=!0;if(G==="}"){if([...Y].reverse().find((S)=>S.isArray)?.isSingleElement)I=!1}if(G.endsWith(" |"))I=!1;return`${V}${G}${I?" |":""}`}).filter(Boolean).join("\n")}function U$(q){let $=q.split("\n").map((Z)=>Z.trim()).join(" ");if(/^['"`].*['"`]$/.test($))return $;if(!Number.isNaN(Number($)))return $;if($==="true"||$==="false")return $;let J=$.match(/\([^)]*\)\s*:\s*([^=>{]+)/);if(J)return J[1].trim();if($.includes("=>"))return"(...args: any[]) => unknown";return"unknown"}function w1(q,$,J=!1){let Z=q.slice(1,-1).trim(),Y=q.trim().endsWith("as const");if(!Z)return Y?"readonly unknown[]":"unknown[]";let j=Y0(Z);if(Y||j.some((z)=>z.includes("as const"))){let z=j.map((G)=>{let V=G.trim().replace(/\s*as\s*const\s*$/,"").trim();return a1(V,$)});if(B$(z))return`readonly [\n${z.map((V,H)=>i1(V," ",H===z.length-1)).join("\n")}\n ]`;return`readonly [${z.join(", ")}]`}let X=j.map((z)=>{let G=z.trim();if(G.startsWith("["))return w1(G,$);else if(G.startsWith("{"))return $1(G,$);else if(G.includes("=>")||G.includes("function")){let V=f1(G);return V?`(${V})`:"((...args: any[]) => unknown)"}else return w$(G)}).filter(Boolean);if(X.some((z)=>z.includes("\n")||z.includes("{")||z.length>40||X.join(" | ").length>60)&&J)return`Array<\n${X.map((G,V)=>i1(G," ",V===X.length-1)).join("\n")}\n >`;return`Array<${X.join(" | ")}>`}function $1(q,$,J=0){let Z=Z$(q);if(!Z)return"Record<string, unknown>";let Y=" ".repeat(J),j=" ".repeat(J+1),Q=Y,X=C$(Z,$,J);if(!X.length)return"{}";return`{\n${X.map(({key:z,value:G})=>{return`${j}${z}: ${G}`}).join(";\n")}\n${Q}}`}function a1(q,$){if(/^['"`].*['"`]$/.test(q))return`'${q.replace(/\]\s*as\s*cons.*$/,"").replace(/^['"`]|['"`]$/g,"")}'`;if(q.startsWith("[")){let Z=q.slice(1,-1).trim();return`readonly [${Y0(Z).map((Q)=>{let X=Q.trim();if(X.includes("] as cons")||X.includes("] as const"))X=X.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").trim();if(X.startsWith("["))return a1(X,$);if(X.startsWith("{"))return $1(X,$).replace(/^\{/,"{ readonly").replace(/;\s+/g,"; readonly ");if(/^['"`].*['"`]$/.test(X))return`'${X.replace(/^['"`]|['"`]$/g,"")}'`;if(!Number.isNaN(Number(X)))return X;if(X==="true"||X==="false")return X;return`'${X.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}).join(", ")}]`}return`'${q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}function z$(q,$){if(q.startsWith("{"))return $1(q,$);if(q.startsWith("["))return w1(q,$,!0);return q}function G$(q){if(/^['"`].*['"`]$/.test(q))return"string";if(!Number.isNaN(Number(q)))return"number";if(q==="true"||q==="false")return"boolean";if(q.startsWith("["))return"unknown[]";if(q.startsWith("{"))return"object";if(q==="null")return"null";if(q==="undefined")return"undefined";return"unknown"}function t1(q){return q.trim().startsWith("export default")}function F$(q){if(K$(q))return!1;let $=q.trim();if(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*[a-zA-Z_$][\w$]*/.test($))return!0;return $.startsWith("export ")||$.startsWith("interface ")||$.startsWith("type ")||$.startsWith("const ")||$.startsWith("function ")||$.startsWith("async function ")||$.startsWith("declare ")||$.startsWith("declare module")||/^export\s+(?:interface|type|const|function\*?|async\s+function\*?)/.test($)}function K$(q){return q.includes("\\")||q.includes("[^")||q.includes("(?:")||q.includes("(?=")||q.includes("(?!")||q.includes("\\s*")||q.includes("\\w+")||q.includes("\\d+")||q.includes("(?<")||q.includes("(?!")||q.includes("(?<=")||q.includes("(?<!")}function q8(q){return/^\s*\(.*\)\s*=>\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/.test(q.trim())}function $8(q){let J=(Array.isArray(q)?q.join("\n"):q).replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim();return/;\s*$/.test(J)||/\}\s*$/.test(J)}function e1(q,$){let J=q.trim();return $.currentScope==="function"&&(J.startsWith("const ")||J.startsWith("let ")||J.startsWith("var ")||/^(?:const|let|var)\s+[a-zA-Z_$][\w$]*\s*(?::|=)/.test(J))}function B$(q){return q.some(($)=>$.includes("\n")||$.includes("{")||$.length>40||q.join(" | ").length>60)}function w$(q){if(q.includes("=>")||q.match(/\bfunction\b/))return"((...args: any[]) => unknown)";if(q.match(/\w+\s*\([^)]*\)/))return"unknown";if(q.startsWith("new "))return"unknown";if(q.includes("."))return"unknown";if(/^[a-z_$][\w$]*$/i.test(q)&&!["unknown","string","number","boolean","null","undefined","any","never","void"].includes(q)&&!/^['"`]|^\d/.test(q)&&q!=="true"&&q!=="false")return"unknown";return q}function R1(q,$,J){w("block-processing","Starting block processing");let Z=[],Y=0,j=0,Q=0,X=!1,U=q.length;w("block-scan",`Total available lines: ${U}`);while(Q<U){let V=q[Q],H=V.trim(),W=(V.match(/\{/g)||[]).length,I=(V.match(/\}/g)||[]).length,_=(V.match(/</g)||[]).length,S=(V.match(/>/g)||[]).length;if(w("block-scan-details",`Scanning line ${Q+1}: "${H}" Current depths - Bracket: ${Y}, Angle: ${j} Found body: ${X} Changes - Curly: +${W}/-${I}, Angle: +${_}/-${S}`),Z.push(V),Y+=W-I,j+=_-S,H.includes("{"))X=!0,w("block-scan",`Found body start at line ${Q+1}`);if(w("block-collection",`Line ${Q+1}: "${H}" Updated depths - Bracket: ${Y}, Angle: ${j} Found body: ${X}`),Y===0&&(j===0||X)&&H.endsWith("}")&&X){w("block-scan",`Found complete block at line ${Q+1}`);break}Q++}let z=Z.join("\n");w("block-scan",`Collected block:\n${z}`);let G=j$(z).trim();if(w("block-processing",`Full block content:\n${G}`),!G){w("block-processing","Empty declaration block");return}if(e1(G,J)){w("block-processing","Skipping variable declaration inside function");return}if(G.startsWith("interface")||G.startsWith("export interface")){if(w("block-processing","Processing interface declaration using interface block processor"),N$(G,z,J)){w("block-processing","Interface successfully processed");return}}if(G.includes("\n\nexport function")||G.includes("\n\nfunction")){let V=b$(G);if(V.length>1){w("block-processing",`Found ${V.length} function declarations to process`),V.forEach((H)=>{let W=H.split("\n");R1(W,$,J)});return}}if(V$(G,J))return;if(M$(G,q,J))return;if(H$(G,z,J))return;if(I$(G,J))return;if(W$(G,J))return;if(_$(G,z,J))return;if(E$(G,z,J))return;w("processing",`Unhandled declaration type: ${G.split("\n")[0]}`)}function M$(q,$,J){if(!q.match(/^(?:export\s+)?(const|let|var)\s+/))return!1;if(e1(q,J))return w("variable-processing","Skipping variable inside function"),!0;let Y=q.startsWith("export");if(J.currentScope==="top"){let j=$.join("\n");J.dtsLines.push(J0(j,Y,J))}else w("block-processing","Skipping variable declared inside a function");return!0}function V$(q,$){if(w("function-processing",`Processing potential function block: ${q.slice(0,100)}...`),/^(?:export\s+)?(?:async\s+)?function\s*\*/.test(q)){w("block-processing","Processing generator function declaration");let z=x$(q);if(z)return $.dtsLines.push(z),!0}if(!/^(?:export\s+)?(?:async\s+)?function\s+[a-zA-Z_$][\w$]*/.test(q))return!1;w("block-processing","Processing function declaration");let J=q.split(/[\n;]/).map((z)=>z.trim()).filter((z)=>z.startsWith("export function")||z.startsWith("function"));if(J.length>1)return J.forEach((z)=>{if(!z.endsWith("{")){let G=P1(z,$.usedTypes,z.startsWith("export"));if(G)$.dtsLines.push(G)}}),!0;let Z=0,Y=0,j=0;for(let z=0;z<q.length;z++){let G=q[z];if(G==="(")Y++;if(G===")")Y--;if(G==="<")j++;if(G===">")j--;if(G==="{"){if(Y===0&&j===0){Z=z;break}}}if(Z===0)Z=q.length;let Q=q.slice(0,Z).trim();w("signature-extraction",`Extracted signature: ${Q}`);let X=Q.startsWith("export"),U=P1(Q,$.usedTypes,X);if(U)w("function-processed",`Generated declaration: ${U}`),$.dtsLines.push(U);return!0}function N$(q,$,J){if(w("interface-processing",`Starting interface processing with declaration: ${q.slice(0,100)}...`),!q.startsWith("interface")&&!q.startsWith("export interface"))return w("interface-processing","Not an interface declaration, skipping"),!1;let Z=$.split("\n"),Y=0,j=0,Q=[],X=!0,U=!1;w("interface-processing",`Processing ${Z.length} lines`);for(let H=0;H<Z.length;H++){let W=Z[H],I=W.trim(),_=(W.match(/\{/g)||[]).length,S=(W.match(/\}/g)||[]).length,E=(W.match(/</g)||[]).length,A=(W.match(/>/g)||[]).length;if(Y+=_-S,j+=E-A,I.includes("{"))U=!0;if(w("interface-depth",`Line ${H+1}: "${I}" Bracket depth: ${Y}, Angle depth: ${j}, Has started body: ${U}`),X){let m=I.startsWith("export")?"export declare":"declare";Q.push(W.replace(/^(\s*)(?:export\s+)?interface/,`\$1${m} interface`)),X=!1}else Q.push(W)}let z=Q.join("\n"),G=z.includes("{")&&z.includes("}");if(Y===0&&(j===0||z.includes(">"))&&G)return w("interface-processing",`Successfully processed interface:\n${z}`),J.dtsLines.push(z),!0;return w("interface-processing",`Interface processing incomplete. Bracket depth: ${Y}, Angle depth: ${j}, Has started body: ${U}`),!1}function H$(q,$,J){if(!q.startsWith("type")&&!q.startsWith("export type"))return!1;let Z=q.startsWith("export");return J.dtsLines.push($0($,Z)),!0}function I$(q,$){if(!t1(q))return!1;let J=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");$.importTracking.defaultExportValue=J;let Z=q.endsWith(";")?q:`${q};`;return $.defaultExports.add(Z),!0}function W$(q,$){if(!q.startsWith("export *"))return!1;return $.exportAllStatements.push(q),$.dtsLines.push(q),!0}function _$(q,$,J){if(!q.startsWith("export"))return!1;if(R$(q,J))return!0;if(P$(q,J))return!0;if(f$(q,J))return!0;if(q.startsWith("export {"))return J.dtsLines.push($),!0;return w("processing",`Unhandled exported declaration type: ${q.split("\n")[0]}`),!0}function O$(q,$){w("export-processing",`Processing export: ${q}`);let J=q.match(/export\s*\{([^}]+)\}(?:\s*from\s*['"]([^'"]+)['"])?/);if(!J){w("export-error","Failed to match export pattern");return}let[,Z,Y]=J;w("export-found",`Found exports: ${Z}, source: ${Y||"local"}`),Z.split(",").forEach((j)=>{let[Q,X]=j.trim().split(/\s+as\s+/).map((U)=>U.trim());if(Q.startsWith("type ")){let U=Q.replace(/^type\s+/,"").trim(),z=X||U;if($.importTracking.exportedTypes.add(z),Y)$.importTracking.typeExportSources.set(z,Y);w("export-type-processed",`Added exported type: ${z}`)}else{let U=X||Q;$.importTracking.exportedValues.add(U),w("export-value-processed",`Added exported value: ${U}`)}})}function R$(q,$){if(!q.startsWith("export class")&&!q.startsWith("export abstract class"))return!1;let J=`export declare ${q.replace(/^export\s+/,"")}`;return $.dtsLines.push(J),!0}function P$(q,$){if(!q.startsWith("export enum")&&!q.startsWith("export const enum"))return!1;let J=`export declare ${q.replace(/^export\s+/,"")}`;return $.dtsLines.push(J),!0}function f$(q,$){if(!q.startsWith("export namespace"))return!1;let J=`export declare ${q.replace(/^export\s+/,"")}`;return $.dtsLines.push(J),!0}function E$(q,$,J){if(!q.startsWith("declare module"))return!1;let Z=Z0($);return J.dtsLines.push(Z),!0}function J8(q,$,J){if(t1(q)){let Z=q.endsWith(";")?q:`${q};`;J.defaultExports.add(Z);return}if(q.startsWith("declare module")){let Z=Z0($);J.dtsLines.push(Z);return}if(q.startsWith("export const")||q.startsWith("const")){let Z=q.trimStart().startsWith("export"),Y=J0($,Z,J);J.dtsLines.push(Y);return}if(q.startsWith("interface")||q.startsWith("export interface")){let Z=y$($,q.startsWith("export"));J.dtsLines.push(Z);return}if(q.startsWith("type")||q.startsWith("export type")){let Z=$0($,q.startsWith("export"));J.dtsLines.push(Z);return}if(q.startsWith("function")||q.startsWith("export function")||q.startsWith("async function")||q.startsWith("export async function")){let Z=P1($,J.usedTypes,q.startsWith("export"));J.dtsLines.push(Z);return}if(q.startsWith("export *")){J.exportAllStatements.push(q),J.dtsLines.push($);return}if(q.startsWith("export {")){J.dtsLines.push($);return}if(q.startsWith("export type {")){J.dtsLines.push($);return}if(q.startsWith("class")||q.startsWith("export class")||q.startsWith("abstract class")||q.startsWith("export abstract class")){let Y=`${q.startsWith("export")?"export ":""}declare ${q.replace(/^export\s+/,"")}`;J.dtsLines.push(Y);return}if(q.startsWith("enum")||q.startsWith("export enum")||q.startsWith("const enum")||q.startsWith("export const enum")){let Y=`${q.startsWith("export")?"export ":""}declare ${q.replace(/^export\s+/,"")}`;J.dtsLines.push(Y);return}if(q.startsWith("namespace")||q.startsWith("export namespace")){let Y=`${q.startsWith("export")?"export ":""}declare ${q.replace(/^export\s+/,"")}`;J.dtsLines.push(Y);return}if(q.startsWith("let")||q.startsWith("export let")||q.startsWith("var")||q.startsWith("export var")){let Y=`${q.startsWith("export")?"export ":""}declare ${q.replace(/^export\s+/,"")}`;J.dtsLines.push(Y);return}console.warn("Unhandled declaration type:",q.split("\n")[0])}function A$(q,$){let J=q.split("\n"),Z=[],Y=[],j=0,Q=0,X=!1;$.currentScope="top",w("source-processing",`Processing source file with ${J.length} lines`);for(let U=0;U<J.length;U++){let z=J[U],G=z.trim();if(w("source-scan",`First pass - Line ${U+1}: ${G}`),z.includes("import "))q0(z,$.importTracking),w("import",`Processed import: ${z}`);if(G.startsWith("export type {")){w("type-export",`Found type export: ${G}`),T$(G,$),$.dtsLines.push(z);continue}if(G.startsWith("export {")){w("mixed-export",`Found mixed export: ${G}`),O$(G,$),$.dtsLines.push(z);continue}}for(let U=0;U<J.length;U++){let z=J[U],G=z.trim();if(G.startsWith("import ")||G.startsWith("export type {")||G.startsWith("export {"))continue;if(G.startsWith("/*")||G.startsWith("//")){Y.push(z);continue}let V=(z.match(/\{/g)||[]).length,H=(z.match(/\}/g)||[]).length,W=(z.match(/</g)||[]).length,I=(z.match(/>/g)||[]).length;if(!X&&F$(G)){w("declaration",`Found declaration start: ${G}`),X=!0,Z=[z],j=V-H,Q=W-I;continue}if(X){Z.push(z),j+=V-H,Q+=W-I;let _=j===0&&Q===0&&G.endsWith("}"),S=U<J.length-1?J[U+1]?.trim():"";if(!(j>0||Q>0||S&&!S.startsWith("export")&&!S.startsWith("interface"))||_)w("declaration-complete",`Declaration complete at line ${U+1}`),R1(Z,Y,$),Z=[],Y=[],X=!1,j=0,Q=0}}if(Z.length>0)R1(Z,Y,$)}function q0(q,$){w("import-processing",`Processing import line: ${q}`);let J=q.match(/import\s+type\s*(?:\{([^}]+)\}|([^;\s]+))\s*from\s*['"]([^'"]+)['"]/);if(J){let[,Y,j,Q]=J,X=Y||j;if(w("import-type",`Found type imports from ${Q}: ${X}`),!$.typeImports.has(Q))$.typeImports.set(Q,new Set);if(X)X.split(",").forEach((U)=>{let[z,G]=U.trim().split(/\s+as\s+/).map((V)=>V.trim());if($.typeImports.get(Q).add(z),$.typeExportSources.set(z,Q),w("import-type-tracking",`Tracking type ${z} from ${Q}`),G)$.valueAliases.set(G,z),w("import-alias",`Registered type alias: ${z} as ${G}`)});return}let Z=q.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/);if(Z){let[,Y,j]=Z;if(w("import-value",`Found value imports from ${j}: ${Y}`),!$.valueImports.has(j))$.valueImports.set(j,new Set);Y.split(",").forEach((Q)=>{let[X,U]=Q.trim().split(/\s+as\s+/).map((z)=>z.trim());if(X.startsWith("type ")){let z=X.replace(/^type\s+/,"").trim();if(!$.typeImports.has(j))$.typeImports.set(j,new Set);$.typeImports.get(j).add(z),$.typeExportSources.set(z,j),w("import-type-in-value",`Found inline type import: ${z} from ${j}`)}else if($.valueImports.get(j).add(X),$.importSources.set(X,j),U){if($.valueAliases.set(U,X),U===$.defaultExportValue)$.usedValues.add(X);$.valueImports.get(j).add(X),w("import-alias",`Registered value alias: ${X} as ${U}`)}})}}function $0(q,$=!0){let J=q.split("\n");if(J[0].trim().startsWith("export type {"))return q;let Y=$?"export declare":"declare";return[J[0].replace(/^(\s*)(?:export\s+)?type(?!\s*\{)/,`\$1${Y} type`),...J.slice(1)].join("\n")}function T$(q,$){w("type-export-processing",`Processing type export: ${q}`);let J=q.match(/export\s+type\s*\{([^}]+)\}(?:\s*from\s*['"]([^'"]+)['"])?/);if(!J){w("type-export-error","Failed to match type export pattern");return}let[,Z,Y]=J;w("type-export-found",`Found types: ${Z}, source: ${Y||"local"}`),Z.split(",").forEach((j)=>{let[Q,X]=j.trim().split(/\s+as\s+/).map((z)=>z.trim()),U=X||Q;if($.importTracking.exportedTypes.add(U),Y)$.importTracking.typeExportSources.set(U,Y);w("type-export-processed",`Added exported type: ${U}`)})}function J0(q,$,J){let Z=q.includes("let ")?"let":q.includes("var ")?"var":"const",Y=q.match(/(?:export\s+)?(?:const|let|var)\s+([^:\s]+)\s*:\s*([^=]+)=/);if(Y){let[,V,H]=Y;return`${$?"export ":""}declare ${Z} ${V}: ${H.trim()};`}let j=q.match(/(?:export\s+)?(?:const|let|var)\s+([^=\s]+)\s*=\s*([\s\S]+)$/);if(!j)return q;let[,Q,X]=j,U=X.trim(),z=U.match(/^\(\s*.*?\)\s*:\s*([^=>\s{]).*=>/);if(z){let V=z[1];return`${$?"export ":""}declare ${Z} ${Q}: ${V};`}let G;if(U.includes("as const")){let V=U.replace(/\s*as\s*const\s*$/,"");G=z$(V,J)}else if(U.startsWith("{"))G=$1(U,J);else if(U.startsWith("["))G=w1(U,J);else if(U.includes("=>")||U.includes("function"))G=f1(U)||"(...args: any[]) => unknown";else G=U$(U);return`${$?"export ":""}declare ${Z} ${Q}: ${G};`}function P1(q,$,J=!0){w("process-function-start",`Starting to process: ${q}`);let Z=q.split("\n").map((X)=>X.trim()).join(" ").replace(/\s+/g," ").replace(/;$/,"");w("process-function-normalized",`Normalized declaration: ${Z}`);let Y=aq(Z);if(w("process-function-signature",`Extracted signature: ${JSON.stringify(Y,null,2)}`),!Y.params&&Z.includes("("))w("process-function-warning","Found parentheses but no params extracted");if(Y.returnType==="void"&&Z.includes("):"))w("process-function-warning","Found return type indicator but extracted void");let Q=[J?"export ":"","declare function ",Y.name,Y.generics,`(${Y.params})`,Y.returnType?`: ${Y.returnType}`:"",";"].filter(Boolean).join("");return w("process-function-final",`Final declaration: ${Q}`),Q}function S$(q){let $=q.split("\n"),J=0;while(J<$.length){let Z=$[J].trim();if(!Z.startsWith("//")&&!Z.startsWith("/*")&&!Z.startsWith("*")&&Z!=="")break;J++}return $.slice(J).join("\n").trim()}function x$(q){w("generator-function",`Processing generator function: ${q}`);let $=q.replace(/^export\s+/,"").replace(/^async\s+/,"").trim(),J=$.match(/function\*\s+([^(<\s]+)/);if(!J)return w("generator-function","Failed to match generator function name"),"";let[,Z]=J,Y=$.slice($.indexOf(Z)+Z.length).trim(),j="";if(Y.startsWith("<")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="<")U++;if(Y[z]===">")U--}j=Y.slice(0,z),Y=Y.slice(z).trim()}let Q="";if(Y.startsWith("(")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="(")U++;if(Y[z]===")")U--}Q=Y.slice(1,z-1).trim(),Y=Y.slice(z).trim()}let X="any";if(Y.startsWith(":")){Y=Y.slice(1).trim();let U=Y.match(/([^{;]+)/);if(U)X=U[1].trim()}return["export declare function ",Z,j?`${j}`:"",`(${Q})`,": ",X].filter(Boolean).join("").concat(";")}function y$(q,$=!0){let J=q.split("\n"),Z=J[0],Y=$?"export declare":"declare";return[Z.replace(/^(\s*)(?:export\s+)?interface/,`\$1${Y} interface`),...J.slice(1)].join("\n")}function Z0(q){let $=q.split("\n"),J=" ",Z=0;return $.map((j,Q)=>{let X=j.trim();if(!X)return"";if(X.startsWith("}"))Z--;let U=" ".repeat(Math.max(0,Z)),z=Q===0?X:`${U}${X}`;if(X.endsWith("{"))Z++;if(X.includes("}")&&X.includes("{"))Z=Math.max(0,Z);return z}).join("\n")}function s1(q){let $=/^(?:async\s+)?(\w+)\s*(<[^>]*>)?\s*\(([^)]*)\)\s*(?::\s*([^ {][^;{]*))?/,J=q.match($);if(!J)return{name:q.split("(")[0].trim().replace(/^async\s+/,""),signature:"() => unknown"};let[,Z,Y="",j,Q="void"]=J,X=Q.trim();if(/^async\s+/.test(q)&&!/^Promise<.*>$/.test(X))X=`Promise<${X}>`;let z=O1(j||""),G=[Y?`${Y}`:"",`(${z})`,"=>",X].filter(Boolean).join(" ").trim();return{name:Z,signature:G}}function C$(q,$,J=0){let Z=[],Y=q.slice(1,-1).trim();if(!Y)return Z;let j="",Q=0,X=!1,U="",z="",G=!0,V=!1;for(let H=0;H<Y.length;H++){let W=Y[H],I=H>0?Y[H-1]:"";if((W==='"'||W==="\'"||W==="`")&&I!=="\\"){if(!X)X=!0,U=W;else if(W===U)X=!1}if(!X){if(W==="{"||W==="["||W==="(")Q++;else if(W==="}"||W==="]"||W===")")Q--;else if(Q===0){if(W===":"&&!V){V=!0,z=j.trim(),j="",G=!1;continue}else if((W===","||W===";")&&!G){if(z){let _=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:E,signature:A}=s1(z);Z.push({key:E,value:A})}else{let E=n1(_,J+1,$);Z.push({key:r1(z),value:E})}}j="",z="",G=!0,V=!1;continue}}}j+=W}if(z&&!G&&j.trim()){let H=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:I,signature:_}=s1(z);Z.push({key:I,value:_})}else{let I=n1(H,J+1,$);Z.push({key:r1(z),value:I})}}return Z}function n1(q,$,J){let Z=q.trim();if(Z.startsWith("{")&&Z.includes("(")&&Z.includes(")")&&Z.includes(":"))return $1(Z,J,$);if(Z.startsWith("["))return w1(Z,J,!0);if(Z.startsWith("{"))return $1(Z,J,$);if(Z.includes("=>")||Z.includes("function"))return f1(Z)||"(...args: any[]) => unknown";if(/^(['"`]).*\1$/.test(Z)||!Number.isNaN(Number(Z))||Z==="true"||Z==="false")return Z;return"unknown"}function D$(q,$){let J=/(?:extends|implements|:|<)\s*([A-Z][a-zA-Z0-9]*(?:<[^>]+>)?)/g,Z;while((Z=J.exec(q))!==null){let Y=Z[1].split("<")[0];$.usedTypes.add(Y)}}function k$(q,$){let J=q.match(/export\s*\{([^}]+)\}/);if(J)J[1].split(",").map((j)=>j.trim()).forEach((j)=>{let[Q]=j.split(/\s+as\s+/);$.exportedValues.add(Q.trim())});let Z=[/export\s+declare\s+\{\s*([^}\s]+)(?:\s*,\s*[^}\s]+)*\s*\}/g,/export\s+declare\s+(?:const|function|class)\s+([a-zA-Z_$][\w$]*)/g,/export\s+\{\s*([^}\s]+)(?:\s*,\s*[^}\s]+)*\s*\}/g];for(let Y of Z){let j;while((j=Y.exec(q))!==null)j[1].split(",").map((X)=>X.trim()).forEach((X)=>{if(!["type","interface","declare","extends","implements","function","const","let","var"].includes(X))$.usedValues.add(X)})}}function w(q,$){if(q1.verbose)console.debug(`[dtsx:${q}] ${$}`)}function L$(q){return q.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function r1(q){let $=q.replace(/^['"`]|['"`]$/g,"");if(!/^[a-z_$][\w$]*$/i.test($))return`'${$}'`;return $}function Y0(q){let $=[],J="",Z=0,Y=!1,j="";for(let X=0;X<q.length;X++){let U=q[X],z=X>0?q[X-1]:"";if((U==='"'||U==="\'"||U==="`")&&z!=="\\"){if(!Y)Y=!0,j=U;else if(U===j)Y=!1}if(!Y){if(U==="["||U==="{"||U==="(")Z++;else if(U==="]"||U==="}"||U===")")Z--;else if(U===","&&Z===0){let G=J.trim();if(G)$.push(G);J="";continue}}J+=U}let Q=J.trim();if(Q)$.push(Q);return $}function b$(q){let $=[],J=q.split("\n"),Z=[];for(let Y=0;Y<J.length;Y++){let j=J[Y].trim();if((j.startsWith("export function")||j.startsWith("function"))&&Z.length>0)$.push(Z.join("\n")),Z=[];Z.push(J[Y])}if(Z.length>0)$.push(Z.join("\n"));return $}import{mkdir as hZ,rm as uZ}from"fs/promises";import{dirname as mZ,join as dZ,parse as cZ,relative as lZ}from"path";var kq=K1(yq(),1),h1=K1(U1(),1),Lq=K1(U1(),1);import Dq,{posix as I1}from"path";var SZ=/\\(?![()[\]{}!+@])/g;function xZ(q){return bq(q)}function yZ(q){return vq(q).replace(SZ,"/")}var S8=process.platform==="win32"?yZ:xZ,CZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,DZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,bq=(q)=>q.replace(CZ,"\\$&"),vq=(q)=>q.replace(DZ,"\\$&"),x8=process.platform==="win32"?vq:bq;function kZ(q,$){if(($==null?void 0:$.caseSensitiveMatch)===!1)return!0;let J=Lq.default.scan(q);return J.isGlob||J.negated}function g1(q,$,J,Z,Y){var j;let Q=q;if(q.endsWith("/"))Q=q.slice(0,-1);if(!Q.endsWith("*")&&$)Q+="/**";if(Dq.isAbsolute(Q.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))Q=I1.relative(J,Q);else Q=I1.normalize(Q);let X=/^(\/?\.\.)+/.exec(Q);if(X==null?void 0:X[0]){let U=I1.join(J,X[0]);if(Z.root.length>U.length)Z.root=U,Z.depthOffset=-(X[0].length+1)/3}else if(!Y&&Z.depthOffset>=0){let U=Q.split("/");(j=Z.commonPath)!=null||(Z.commonPath=U);let z=[];for(let G=0;G<Math.min(Z.commonPath.length,U.length);G++){let V=U[G];if(V==="**"&&!U[G+1]){z.pop();break}if(V!==Z.commonPath[G]||kZ(V)||G===U.length-1)break;z.push(V)}Z.depthOffset=z.length,Z.commonPath=z,Z.root=z.length>0?`${J}/${z.join("/")}`:J}return Q}function LZ({patterns:q,ignore:$=[],expandDirectories:J=!0},Z,Y){if(typeof q==="string")q=[q];else if(!q)q=["**/*"];if(typeof $==="string")$=[$];let j=[],Q=[];for(let X of $)if(!X.startsWith("!")||X[1]==="("){let U=g1(X,J,Z,Y,!0);Q.push(U)}for(let X of q)if(!X.startsWith("!")||X[1]==="("){let U=g1(X,J,Z,Y,!1);j.push(U)}else if(X[1]!=="!"||X[2]==="("){let U=g1(X.slice(1),J,Z,Y,!0);Q.push(U)}return{match:j,ignore:Q}}function u1(q,$,J){return I1.relative($,`${J}/${q}`)}function Cq(q,$,J,Z,Y){let j=Y?q.slice(J.length+1)||".":q;if(J===$)return Z&&j!=="."?j.slice(0,-1):j;return u1(j,$,J)}function bZ(q,$,J){let Z={root:$,commonPath:null,depthOffset:0},Y=LZ(q,$,Z),j=h1.default(Y.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:Y.ignore}),Q=h1.default(Y.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),X={filters:[(z,G)=>j(Cq(z,$,Z.root,G,q.absolute))],exclude:(z,G)=>Q(Cq(G,$,Z.root,!0,!0)),pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0};if(q.deep)X.maxDepth=Math.round(q.deep-Z.depthOffset);if(q.absolute)X.relativePaths=!1,X.resolvePaths=!0,X.includeBasePath=!0;if(q.followSymbolicLinks===!1)X.resolveSymlinks=!1,X.excludeSymlinks=!0;if(q.onlyDirectories)X.excludeFiles=!0,X.includeDirs=!0;else if(q.onlyFiles===!1)X.includeDirs=!0;Z.root=Z.root.replace(/\\/g,"");let U=new kq.fdir(X).crawl(Z.root);if($===Z.root||q.absolute)return J?U.sync():U.withPromise();return J?U.sync().map((z)=>u1(z,$,Z.root)+(!z||z.endsWith("/")?"/":"")):U.withPromise().then((z)=>z.map((G)=>u1(G,$,Z.root)+(!G||G.endsWith("/")?"/":"")))}async function gq(q,$){if(q&&($==null?void 0:$.patterns))throw new Error("Cannot pass patterns as both an argument and an option");let J=Array.isArray(q)||typeof q==="string"?{...$,patterns:q}:q,Z=J.cwd?Dq.resolve(J.cwd).replace(/\\/g,"/"):process.cwd().replace(/\\/g,"/");return bZ(J,Z,!1)}import{readdir as vZ}from"fs/promises";import{extname as gZ,join as hq}from"path";async function uq(q,$){await Bun.write(q,$)}async function m1(q){let $=q??q1.root,J=await vZ($,{withFileTypes:!0}),Z=await Promise.all(J.map((Y)=>{let j=hq($,Y.name);return Y.isDirectory()?m1(j):j}));return Array.prototype.concat(...Z).filter((Y)=>gZ(Y)===".ts")}async function mq(q){try{return(await import(q?.tsconfigPath||hq(q?.cwd??"./","tsconfig.json"))).compilerOptions?.isolatedDeclarations===!0}catch($){return console.log("Error reading tsconfig.json:",$),!1}}async function pZ(q){try{if(!await mq(q)){console.error("Error: isolatedModules must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await uZ(q.outdir,{recursive:!0,force:!0});let J;if(q?.entrypoints)J=await gq(q.entrypoints,{cwd:q.root??`${q.cwd}/src`,absolute:!0});else J=await m1(q?.root??`${q?.cwd}/src`);for(let Z of J){let Y=await o1(Z);if(Y){let j=lZ(q?.root??"./src",Z),Q=cZ(j),X=dZ(q?.outdir??"./dist",`${Q.name}.d.ts`);await hZ(mZ(X),{recursive:!0}),await uq(X,Y)}else console.warn(`No declarations extracted for ${Z}`)}}catch($){console.error("Error generating declarations:",$)}}async function d8(q){await pZ({...q1,...q})}export{uq as writeToFile,J8 as processSpecificDeclaration,q8 as isFunctionType,$8 as isDeclarationComplete,m1 as getAllTypeScriptFiles,pZ as generateDeclarationsFromFiles,d8 as generate,oq as extractDtsTypes,o1 as extract,q1 as config,mq as checkIsolatedDeclarations};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "description": "A modern, fast .d.ts generation tool, powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -65,9 +65,10 @@
65
65
  "@stacksjs/cli": "^0.67.0",
66
66
  "@stacksjs/development": "^0.67.0",
67
67
  "@stacksjs/eslint-config": "^3.8.1-beta.2",
68
- "@types/bun": "^1.1.12",
69
- "tinyglobby": "^0.2.9",
70
- "vitepress": "^1.4.1"
68
+ "@types/bun": "^1.1.13",
69
+ "bun-config": "^0.1.1",
70
+ "tinyglobby": "^0.2.10",
71
+ "vitepress": "^1.5.0"
71
72
  },
72
73
  "simple-git-hooks": {
73
74
  "pre-commit": "bunx lint-staged"
package/dist/config.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { DtsGenerationConfig } from './types';
2
-
3
- declare interface Options<T> {
4
- name: string;
5
- cwd?: string;
6
- defaultConfig: T;
7
- }
8
-
9
- export declare function loadConfig<T extends Record<string, unknown>>(options: Options<T>): Promise<T>;
10
-
11
- export declare const config: DtsGenerationConfig;
package/dist/extract.d.ts DELETED
@@ -1,156 +0,0 @@
1
- /**
2
- * RegExp patterns used throughout the module
3
- */
4
- export declare interface RegexPatterns {
5
- readonly typeImport: RegExp;
6
- readonly regularImport: RegExp;
7
- readonly returnType: RegExp;
8
- readonly constType: RegExp;
9
- readonly bracketOpen: RegExp;
10
- readonly bracketClose: RegExp;
11
- readonly functionReturn: RegExp;
12
- }
13
-
14
- /**
15
- * Regular expression patterns used throughout the module
16
- */
17
- export declare const REGEX: RegexPatterns;
18
-
19
- declare const Type: /const([^:;
20
-
21
- declare function functionReturn:(): void;
22
-
23
- /** Nested properties for objects */
24
- export declare interface PropertyInfo {
25
- key: string;
26
- value: string;
27
- type: string;
28
- nested?: PropertyInfo[];
29
- }
30
-
31
- /**
32
- * Represents the current state of the processing
33
- */
34
- export declare interface ProcessingState {
35
- dtsLines: string[];
36
- usedTypes: Set<string>;
37
- typeSources: Map<string, string>;
38
- defaultExport: string;
39
- currentDeclaration: string;
40
- lastCommentBlock: string;
41
- bracketCount: number;
42
- isMultiLineDeclaration: boolean;
43
- moduleImports: Map<string, ImportInfo>;
44
- availableTypes: Map<string, string>;
45
- availableValues: Map<string, string>;
46
- }
47
-
48
- /**
49
- * Initialize processing state
50
- */
51
- export declare function createProcessingState(): ProcessingState;
52
-
53
- declare interface TypeAnnotation {
54
- raw: string | null;
55
- parsed: string;
56
- }
57
-
58
- declare function getTypeAnnotation(declaration: string): TypeAnnotation;
59
-
60
- /**
61
- * Extracts types from a TypeScript file and generates corresponding .d.ts content
62
- */
63
- export declare function extract(filePath: string): Promise<string>;
64
-
65
- /**
66
- * Generates TypeScript declaration types from source code.
67
- */
68
- export declare function extractDtsTypes(sourceCode: string): string;
69
-
70
- export declare function processLine(line: string, state: ProcessingState): void;
71
-
72
- export declare interface ImportInfo {
73
- kind: 'type' | 'value' | 'mixed';
74
- usedTypes: Set<string>;
75
- usedValues: Set<string>;
76
- source: string;
77
- }
78
-
79
- /**
80
- * Process import statements with improved tracking
81
- */
82
- export declare function processImport(line: string, state: ProcessingState): string;
83
-
84
- declare const valueImportMatch: {
85
-
86
- };
87
-
88
- declare const match: {
89
-
90
- };
91
-
92
- declare const isTypeImport: {
93
-
94
- };
95
-
96
- declare const [, items, source]: {
97
-
98
- };
99
-
100
- declare const moduleInfo: {
101
-
102
- };
103
-
104
- declare const [name, alias]: {
105
-
106
- };
107
-
108
- declare const importedName: {
109
-
110
- };
111
-
112
- /**
113
- * Generate final import statements
114
- */
115
- export declare function generateImports(state: ProcessingState): string[];
116
-
117
- declare const imports: string[];
118
-
119
- declare const { usedTypes, usedValues }: {
120
-
121
- };
122
-
123
- declare const types: {
124
-
125
- };
126
-
127
- declare const values: {
128
-
129
- };
130
-
131
- /**
132
- * Process imports while preserving their original sources
133
- */
134
- export declare function processImports(imports: string[], usedTypes: Set<string>): string[];
135
-
136
- declare const match: {
137
-
138
- };
139
-
140
- declare const types: {
141
-
142
- };
143
-
144
- declare const [type, alias]: {
145
-
146
- };
147
-
148
- declare const module: {
149
-
150
- };
151
-
152
- declare type s.forEach(( = > {
153
-
154
- declare const relevantTypes: {
155
-
156
- };
@@ -1,5 +0,0 @@
1
- import type { DtsGenerationConfig, DtsGenerationOption } from './types';
2
-
3
- export declare function generateDeclarationsFromFiles(options?: DtsGenerationConfig): Promise<void>;
4
-
5
- export declare function generate(options?: DtsGenerationOption): Promise<void>;
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export { config } from './config';
2
-
3
- export * from './extract';
4
- export * from './generate';
5
- export * from './types';
6
- export * from './utils';
package/dist/types.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * DtsGenerationConfig
3
- *
4
- * This is the configuration object for the DTS generation process.
5
- */
6
- export declare interface DtsGenerationConfig {
7
- cwd: string;
8
- root: string;
9
- entrypoints: string[];
10
- outdir: string;
11
- keepComments: boolean;
12
- clean: boolean;
13
- tsconfigPath: string;
14
- }
15
-
16
- /**
17
- * DtsGenerationOption
18
- *
19
- * This is the configuration object for the DTS generation process.
20
- */
21
- export declare type DtsGenerationOption = Partial<DtsGenerationConfig>;
22
-
23
- /**
24
- * DtsGenerationOptions
25
- *
26
- * This is the configuration object for the DTS generation process.
27
- */
28
- export declare type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[];
package/dist/utils.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { DtsGenerationConfig } from './types';
2
- import { join } from 'node:path';
3
-
4
- export declare function writeToFile(filePath: string, content: string): Promise<void>;
5
-
6
- export declare function getAllTypeScriptFiles(directory?: string): Promise<string[]>;
7
-
8
- export declare function checkIsolatedDeclarations(options?: DtsGenerationConfig): Promise<boolean>;