@stacksjs/dtsx 0.3.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 Lq=Object.create;var{getPrototypeOf:Pq,defineProperty:b1,getOwnPropertyNames:Tq}=Object;var Oq=Object.prototype.hasOwnProperty;var X1=(q,Z,$)=>{$=q!=null?Lq(Pq(q)):{};let J=Z||!q||!q.__esModule?b1($,"default",{value:q,enumerable:!0}):$;for(let j of Tq(q))if(!Oq.call(J,j))b1(J,j,{get:()=>q[j],enumerable:!0});return J};var O=(q,Z)=>()=>(Z||q((Z={exports:{}}).exports,Z),Z.exports);var f1=O((c1)=>{Object.defineProperty(c1,"__esModule",{value:!0});c1.normalizePath=c1.convertSlashes=c1.cleanPath=void 0;var D1=import.meta.require("path");function h1(q){let Z=D1.normalize(q);if(Z.length>1&&Z[Z.length-1]===D1.sep)Z=Z.substring(0,Z.length-1);return Z}c1.cleanPath=h1;var kq=/[\\/]/g;function l1(q,Z){return q.replace(kq,Z)}c1.convertSlashes=l1;function mq(q,Z){let{resolvePaths:$,normalizePath:J,pathSeparator:j}=Z,z=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if($)q=D1.resolve(q);if(J||z)q=h1(q);if(q===".")return"";let U=q[q.length-1]!==j;return l1(U?q+j:q,j)}c1.normalizePath=mq});var s1=O((r1)=>{Object.defineProperty(r1,"__esModule",{value:!0});r1.build=r1.joinDirectoryPath=r1.joinPathWithBasePath=void 0;var dq=import.meta.require("path"),hq=f1();function n1(q,Z){return Z+q}r1.joinPathWithBasePath=n1;function lq(q,Z){return function($,J){if(J.startsWith(q))return J.replace(q,"")+$;else return hq.convertSlashes(dq.relative(q,J),Z.pathSeparator)+Z.pathSeparator+$}}function cq(q){return q}function iq(q,Z,$){return Z+q+$}r1.joinDirectoryPath=iq;function nq(q,Z){let{relativePaths:$,includeBasePath:J}=Z;return $&&q?lq(q,Z):J?n1:cq}r1.build=nq});var e1=O((a1)=>{Object.defineProperty(a1,"__esModule",{value:!0});a1.build=void 0;function sq(q){return function(Z,$){$.push(Z.substring(q.length)||".")}}function aq(q){return function(Z,$,J){let j=Z.substring(q.length)||".";if(J.every((z)=>z(j,!0)))$.push(j)}}var oq=(q,Z)=>{Z.push(q||".")},eq=(q,Z,$)=>{let J=q||".";if($.every((j)=>j(J,!0)))Z.push(J)},tq=()=>{};function q$(q,Z){let{includeDirs:$,filters:J,relativePaths:j}=Z;if(!$)return tq;if(j)return J&&J.length?aq(q):sq(q);return J&&J.length?eq:oq}a1.build=q$});var $0=O((t1)=>{Object.defineProperty(t1,"__esModule",{value:!0});t1.build=void 0;var $$=(q,Z,$,J)=>{if(J.every((j)=>j(q,!1)))$.files++},Z$=(q,Z,$,J)=>{if(J.every((j)=>j(q,!1)))Z.push(q)},J$=(q,Z,$,J)=>{$.files++},j$=(q,Z)=>{Z.push(q)},V$=()=>{};function Y$(q){let{excludeFiles:Z,filters:$,onlyCounts:J}=q;if(Z)return V$;if($&&$.length)return J?$$:Z$;else if(J)return J$;else return j$}t1.build=Y$});var j0=O((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.build=void 0;var W$=(q)=>{return q},z$=()=>{return[""].slice(0,0)};function U$(q){return q.group?z$:W$}Z0.build=U$});var W0=O((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.build=void 0;var X$=(q,Z,$)=>{q.push({directory:Z,files:$,dir:Z})},B$=()=>{};function Q$(q){return q.group?X$:B$}V0.build=Q$});var X0=O((t)=>{var F$=t&&t.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(t,"__esModule",{value:!0});t.build=void 0;var F1=F$(import.meta.require("fs")),z0=import.meta.require("path"),K$=function(q,Z,$){let{queue:J,options:{suppressErrors:j}}=Z;J.enqueue(),F1.default.realpath(q,(z,U)=>{if(z)return J.dequeue(j?null:z,Z);F1.default.stat(U,(B,F)=>{if(B)return J.dequeue(j?null:B,Z);if(F.isDirectory()&&U0(q,U,Z))return J.dequeue(null,Z);$(F,U),J.dequeue(null,Z)})})},G$=function(q,Z,$){let{queue:J,options:{suppressErrors:j}}=Z;J.enqueue();try{let z=F1.default.realpathSync(q),U=F1.default.statSync(z);if(U.isDirectory()&&U0(q,z,Z))return;$(U,z)}catch(z){if(!j)throw z}};function M$(q,Z){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return Z?G$:K$}t.build=M$;function U0(q,Z,$){if($.options.useRealPaths)return N$(Z,$);let J=z0.dirname(q),j=1;while(J!==$.root&&j<2){let z=$.symlinks.get(J);if(!!z&&(z===Z||z.startsWith(Z)||Z.startsWith(z)))j++;else J=z0.dirname(J)}return $.symlinks.set(q,Z),j>1}function N$(q,Z){return Z.visited.includes(q+Z.options.pathSeparator)}});var F0=O((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.build=void 0;var w$=(q)=>{return q.counts},I$=(q)=>{return q.groups},y$=(q)=>{return q.paths},D$=(q)=>{return q.paths.slice(0,q.options.maxFiles)},f$=(q,Z,$)=>{return K1(Z,$,q.counts,q.options.suppressErrors),null},H$=(q,Z,$)=>{return K1(Z,$,q.paths,q.options.suppressErrors),null},C$=(q,Z,$)=>{return K1(Z,$,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},L$=(q,Z,$)=>{return K1(Z,$,q.groups,q.options.suppressErrors),null};function K1(q,Z,$,J){if(q&&!J)Z(q,$);else Z(null,$)}function P$(q,Z){let{onlyCounts:$,group:J,maxFiles:j}=q;if($)return Z?w$:f$;else if(J)return Z?I$:L$;else if(j)return Z?D$:C$;else return Z?y$:H$}B0.build=P$});var M0=O((q1)=>{var T$=q1&&q1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(q1,"__esModule",{value:!0});q1.build=void 0;var K0=T$(import.meta.require("fs")),G0={withFileTypes:!0},O$=(q,Z,$,J,j)=>{if(J<0)return q.queue.dequeue(null,q);q.visited.push(Z),q.counts.directories++,q.queue.enqueue(),K0.default.readdir(Z||".",G0,(z,U=[])=>{j(U,$,J),q.queue.dequeue(q.options.suppressErrors?null:z,q)})},_$=(q,Z,$,J,j)=>{if(J<0)return;q.visited.push(Z),q.counts.directories++;let z=[];try{z=K0.default.readdirSync(Z||".",G0)}catch(U){if(!q.options.suppressErrors)throw U}j(z,$,J)};function R$(q){return q?_$:O$}q1.build=R$});var y0=O((w0)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.Queue=void 0;class N0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,Z){if(--this.count<=0||q)this.onQueueEmpty(q,Z)}}w0.Queue=N0});var C0=O((f0)=>{Object.defineProperty(f0,"__esModule",{value:!0});f0.Counter=void 0;class D0{_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}}f0.Counter=D0});var L1=O((n)=>{var E$=n&&n.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var j=Object.getOwnPropertyDescriptor(Z,$);if(!j||("get"in j?!Z.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,j)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),x$=n&&n.__setModuleDefault||(Object.create?function(q,Z){Object.defineProperty(q,"default",{enumerable:!0,value:Z})}:function(q,Z){q.default=Z}),o=n&&n.__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,$))E$(Z,q,$)}return x$(Z,q),Z};Object.defineProperty(n,"__esModule",{value:!0});n.Walker=void 0;var L0=import.meta.require("path"),H1=f1(),C1=o(s1()),S$=o(e1()),A$=o($0()),b$=o(j0()),g$=o(W0()),k$=o(X0()),m$=o(F0()),v$=o(M0()),u$=y0(),d$=C0();class P0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,Z,$){this.isSynchronous=!$,this.callbackInvoker=m$.build(Z,this.isSynchronous),this.root=H1.normalizePath(q,Z),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new d$.Counter,options:Z,queue:new u$.Queue((J,j)=>this.callbackInvoker(j,J,$)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=C1.build(this.root,Z),this.pushDirectory=S$.build(this.root,Z),this.pushFile=A$.build(Z),this.getArray=b$.build(Z),this.groupFiles=g$.build(Z),this.resolveSymlink=k$.build(Z,this.isSynchronous),this.walkDirectory=v$.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:j,resolveSymlinks:z,excludeSymlinks:U,exclude:B,maxFiles:F,signal:w,useRealPaths:G,pathSeparator:P}}=this.state;if(w&&w.aborted||F&&J.length>F)return;this.pushDirectory(Z,J,j);let C=this.getArray(this.state.paths);for(let _=0;_<q.length;++_){let M=q[_];if(M.isFile()||M.isSymbolicLink()&&!z&&!U){let K=this.joinPath(M.name,Z);this.pushFile(K,C,this.state.counts,j)}else if(M.isDirectory()){let K=C1.joinDirectoryPath(M.name,Z,this.state.options.pathSeparator);if(B&&B(M.name,K))continue;this.walkDirectory(this.state,K,K,$-1,this.walk)}else if(M.isSymbolicLink()&&this.resolveSymlink){let K=C1.joinPathWithBasePath(M.name,Z);this.resolveSymlink(K,this.state,(d,H)=>{if(d.isDirectory()){if(H=H1.normalizePath(H,this.state.options),B&&B(M.name,H))return;this.walkDirectory(this.state,H,G?H:K+P,$-1,this.walk)}else{H=G?H:K;let f=L0.basename(H),b=H1.normalizePath(L0.dirname(H),this.state.options);H=this.joinPath(f,b),this.pushFile(H,C,this.state.counts,j)}})}}this.groupFiles(this.state.groups,Z,C)}}n.Walker=P0});var R0=O((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.callback=O0.promise=void 0;var h$=L1();function l$(q,Z){return new Promise(($,J)=>{T0(q,Z,(j,z)=>{if(j)return J(j);$(z)})})}O0.promise=l$;function T0(q,Z,$){new h$.Walker(q,Z,$).start()}O0.callback=T0});var S0=O((E0)=>{Object.defineProperty(E0,"__esModule",{value:!0});E0.sync=void 0;var i$=L1();function n$(q,Z){return new i$.Walker(q,Z).start()}E0.sync=n$});var m0=O((g0)=>{Object.defineProperty(g0,"__esModule",{value:!0});g0.APIBuilder=void 0;var A0=R0(),r$=S0();class b0{root;options;constructor(q,Z){this.root=q,this.options=Z}withPromise(){return A0.promise(this.root,this.options)}withCallback(q){A0.callback(this.root,this.options,q)}sync(){return r$.sync(this.root,this.options)}}g0.APIBuilder=b0});var J1=O((I8,u0)=>{var v0={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:"/"},p$={...v0,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:"\\"},s$={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"};u0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:s$,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?p$:v0}}});var j1=O((qZ)=>{var{REGEX_BACKSLASH:a$,REGEX_REMOVE_BACKSLASH:o$,REGEX_SPECIAL_CHARS:e$,REGEX_SPECIAL_CHARS_GLOBAL:t$}=J1();qZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);qZ.hasRegexChars=(q)=>e$.test(q);qZ.isRegexChar=(q)=>q.length===1&&qZ.hasRegexChars(q);qZ.escapeRegex=(q)=>q.replace(t$,"\\$1");qZ.toPosixSlashes=(q)=>q.replace(a$,"/");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(o$,(Z)=>{return Z==="\\"?"":Z})};qZ.escapeLast=(q,Z,$)=>{let J=q.lastIndexOf(Z,$);if(J===-1)return q;if(q[J-1]==="\\")return qZ.escapeLast(q,Z,J-1);return`${q.slice(0,J)}\\${q.slice(J)}`};qZ.removePrefix=(q,Z={})=>{let $=q;if($.startsWith("./"))$=$.slice(2),Z.prefix="./";return $};qZ.wrapOutput=(q,Z={},$={})=>{let J=$.contains?"":"^",j=$.contains?"":"$",z=`${J}(?:${q})${j}`;if(Z.negated===!0)z=`(?:^(?!${z}).*\$)`;return z};qZ.basename=(q,{windows:Z}={})=>{let $=q.split(Z?/[\\/]/:"/"),J=$[$.length-1];if(J==="")return $[$.length-2];return J}});var a0=O((D8,s0)=>{var l0=j1(),{CHAR_ASTERISK:P1,CHAR_AT:XZ,CHAR_BACKWARD_SLASH:V1,CHAR_COMMA:BZ,CHAR_DOT:T1,CHAR_EXCLAMATION_MARK:O1,CHAR_FORWARD_SLASH:p0,CHAR_LEFT_CURLY_BRACE:_1,CHAR_LEFT_PARENTHESES:R1,CHAR_LEFT_SQUARE_BRACKET:QZ,CHAR_PLUS:FZ,CHAR_QUESTION_MARK:c0,CHAR_RIGHT_CURLY_BRACE:KZ,CHAR_RIGHT_PARENTHESES:i0,CHAR_RIGHT_SQUARE_BRACKET:GZ}=J1(),n0=(q)=>{return q===p0||q===V1},r0=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},MZ=(q,Z)=>{let $=Z||{},J=q.length-1,j=$.parts===!0||$.scanToEnd===!0,z=[],U=[],B=[],F=q,w=-1,G=0,P=0,C=!1,_=!1,M=!1,K=!1,d=!1,H=!1,f=!1,b=!1,i=!1,g=!1,k=0,v,N,y={value:"",depth:0,isGlob:!1},W=()=>w>=J,h=()=>F.charCodeAt(w+1),A=()=>{return v=N,F.charCodeAt(++w)};while(w<J){N=A();let L;if(N===V1){if(f=y.backslashes=!0,N=A(),N===_1)H=!0;continue}if(H===!0||N===_1){k++;while(W()!==!0&&(N=A())){if(N===V1){f=y.backslashes=!0,A();continue}if(N===_1){k++;continue}if(H!==!0&&N===T1&&(N=A())===T1){if(C=y.isBrace=!0,M=y.isGlob=!0,g=!0,j===!0)continue;break}if(H!==!0&&N===BZ){if(C=y.isBrace=!0,M=y.isGlob=!0,g=!0,j===!0)continue;break}if(N===KZ){if(k--,k===0){H=!1,C=y.isBrace=!0,g=!0;break}}}if(j===!0)continue;break}if(N===p0){if(z.push(w),U.push(y),y={value:"",depth:0,isGlob:!1},g===!0)continue;if(v===T1&&w===G+1){G+=2;continue}P=w+1;continue}if($.noext!==!0){if((N===FZ||N===XZ||N===P1||N===c0||N===O1)===!0&&h()===R1){if(M=y.isGlob=!0,K=y.isExtglob=!0,g=!0,N===O1&&w===G)i=!0;if(j===!0){while(W()!==!0&&(N=A())){if(N===V1){f=y.backslashes=!0,N=A();continue}if(N===i0){M=y.isGlob=!0,g=!0;break}}continue}break}}if(N===P1){if(v===P1)d=y.isGlobstar=!0;if(M=y.isGlob=!0,g=!0,j===!0)continue;break}if(N===c0){if(M=y.isGlob=!0,g=!0,j===!0)continue;break}if(N===QZ){while(W()!==!0&&(L=A())){if(L===V1){f=y.backslashes=!0,A();continue}if(L===GZ){_=y.isBracket=!0,M=y.isGlob=!0,g=!0;break}}if(j===!0)continue;break}if($.nonegate!==!0&&N===O1&&w===G){b=y.negated=!0,G++;continue}if($.noparen!==!0&&N===R1){if(M=y.isGlob=!0,j===!0){while(W()!==!0&&(N=A())){if(N===R1){f=y.backslashes=!0,N=A();continue}if(N===i0){g=!0;break}}continue}break}if(M===!0){if(g=!0,j===!0)continue;break}}if($.noext===!0)K=!1,M=!1;let x=F,V="",Y="";if(G>0)V=F.slice(0,G),F=F.slice(G),P-=G;if(x&&M===!0&&P>0)x=F.slice(0,P),Y=F.slice(P);else if(M===!0)x="",Y=F;else x=F;if(x&&x!==""&&x!=="/"&&x!==F){if(n0(x.charCodeAt(x.length-1)))x=x.slice(0,-1)}if($.unescape===!0){if(Y)Y=l0.removeBackslashes(Y);if(x&&f===!0)x=l0.removeBackslashes(x)}let l={prefix:V,input:q,start:G,base:x,glob:Y,isBrace:C,isBracket:_,isGlob:M,isExtglob:K,isGlobstar:d,negated:b,negatedExtglob:i};if($.tokens===!0){if(l.maxDepth=0,!n0(N))U.push(y);l.tokens=U}if($.parts===!0||$.tokens===!0){let L;for(let R=0;R<z.length;R++){let p=L?L+1:G,c=z[R],a=q.slice(p,c);if($.tokens){if(R===0&&G!==0)U[R].isPrefix=!0,U[R].value=V;else U[R].value=a;r0(U[R]),l.maxDepth+=U[R].depth}if(R!==0||a!=="")B.push(a);L=c}if(L&&L+1<q.length){let R=q.slice(L+1);if(B.push(R),$.tokens)U[U.length-1].value=R,r0(U[U.length-1]),l.maxDepth+=U[U.length-1].depth}l.slashes=z,l.parts=B}return l};s0.exports=MZ});var t0=O((f8,e0)=>{var G1=J1(),r=j1(),{MAX_LENGTH:M1,POSIX_REGEX_SOURCE:NZ,REGEX_NON_SPECIAL_CHARS:wZ,REGEX_SPECIAL_CHARS_BACKREF:IZ,REPLACEMENTS:o0}=G1,yZ=(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((j)=>r.escapeRegex(j)).join("..")}return $},$1=(q,Z)=>{return`Missing ${q}: "${Z}" - use "\\\\${Z}" to match literal characters`},E1=(q,Z)=>{if(typeof q!=="string")throw new TypeError("Expected a string");q=o0[q]||q;let $={...Z},J=typeof $.maxLength==="number"?Math.min(M1,$.maxLength):M1,j=q.length;if(j>J)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);let z={type:"bos",value:"",output:$.prepend||""},U=[z],B=$.capture?"":"?:",F=G1.globChars($.windows),w=G1.extglobChars(F),{DOT_LITERAL:G,PLUS_LITERAL:P,SLASH_LITERAL:C,ONE_CHAR:_,DOTS_SLASH:M,NO_DOT:K,NO_DOT_SLASH:d,NO_DOTS_SLASH:H,QMARK:f,QMARK_NO_DOT:b,STAR:i,START_ANCHOR:g}=F,k=(Q)=>{return`(${B}(?:(?!${g}${Q.dot?M:G}).)*?)`},v=$.dot?"":K,N=$.dot?f:b,y=$.bash===!0?k($):i;if($.capture)y=`(${y})`;if(typeof $.noext==="boolean")$.noextglob=$.noext;let W={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:U};q=r.removePrefix(q,W),j=q.length;let h=[],A=[],x=[],V=z,Y,l=()=>W.index===j-1,L=W.peek=(Q=1)=>q[W.index+Q],R=W.advance=()=>q[++W.index]||"",p=()=>q.slice(W.index+1),c=(Q="",T=0)=>{W.consumed+=Q,W.index+=T},a=(Q)=>{W.output+=Q.output!=null?Q.output:Q.value,c(Q.value)},Hq=()=>{let Q=1;while(L()==="!"&&(L(2)!=="("||L(3)==="?"))R(),W.start++,Q++;if(Q%2===0)return!1;return W.negated=!0,W.start++,!0},W1=(Q)=>{W[Q]++,x.push(Q)},e=(Q)=>{W[Q]--,x.pop()},D=(Q)=>{if(V.type==="globstar"){let T=W.braces>0&&(Q.type==="comma"||Q.type==="brace"),X=Q.extglob===!0||h.length&&(Q.type==="pipe"||Q.type==="paren");if(Q.type!=="slash"&&Q.type!=="paren"&&!T&&!X)W.output=W.output.slice(0,-V.output.length),V.type="star",V.value="*",V.output=y,W.output+=V.output}if(h.length&&Q.type!=="paren")h[h.length-1].inner+=Q.value;if(Q.value||Q.output)a(Q);if(V&&V.type==="text"&&Q.type==="text"){V.output=(V.output||V.value)+Q.value,V.value+=Q.value;return}Q.prev=V,U.push(Q),V=Q},z1=(Q,T)=>{let X={...w[T],conditions:1,inner:""};X.prev=V,X.parens=W.parens,X.output=W.output;let I=($.capture?"(":"")+X.open;W1("parens"),D({type:Q,value:T,output:W.output?"":_}),D({type:"paren",extglob:!0,value:R(),output:I}),h.push(X)},Cq=(Q)=>{let T=Q.close+($.capture?")":""),X;if(Q.type==="negate"){let I=y;if(Q.inner&&Q.inner.length>1&&Q.inner.includes("/"))I=k($);if(I!==y||l()||/^\)+$/.test(p()))T=Q.close=`)\$))${I}`;if(Q.inner.includes("*")&&(X=p())&&/^\.[^\\/.]+$/.test(X)){let E=E1(X,{...Z,fastpaths:!1}).output;T=Q.close=`)${E})${I})`}if(Q.prev.type==="bos")W.negatedExtglob=!0}D({type:"paren",extglob:!0,value:Y,output:T}),e("parens")};if($.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let Q=!1,T=q.replace(IZ,(X,I,E,u,m,w1)=>{if(u==="\\")return Q=!0,X;if(u==="?"){if(I)return I+u+(m?f.repeat(m.length):"");if(w1===0)return N+(m?f.repeat(m.length):"");return f.repeat(E.length)}if(u===".")return G.repeat(E.length);if(u==="*"){if(I)return I+u+(m?y:"");return y}return I?X:`\\${X}`});if(Q===!0)if($.unescape===!0)T=T.replace(/\\/g,"");else T=T.replace(/\\+/g,(X)=>{return X.length%2===0?"\\\\":X?"\\":""});if(T===q&&$.contains===!0)return W.output=q,W;return W.output=r.wrapOutput(T,W,Z),W}while(!l()){if(Y=R(),Y==="\0")continue;if(Y==="\\"){let X=L();if(X==="/"&&$.bash!==!0)continue;if(X==="."||X===";")continue;if(!X){Y+="\\",D({type:"text",value:Y});continue}let I=/^\\+/.exec(p()),E=0;if(I&&I[0].length>2){if(E=I[0].length,W.index+=E,E%2!==0)Y+="\\"}if($.unescape===!0)Y=R();else Y+=R();if(W.brackets===0){D({type:"text",value:Y});continue}}if(W.brackets>0&&(Y!=="]"||V.value==="["||V.value==="[^")){if($.posix!==!1&&Y===":"){let X=V.value.slice(1);if(X.includes("[")){if(V.posix=!0,X.includes(":")){let I=V.value.lastIndexOf("["),E=V.value.slice(0,I),u=V.value.slice(I+2),m=NZ[u];if(m){if(V.value=E+m,W.backtrack=!0,R(),!z.output&&U.indexOf(V)===1)z.output=_;continue}}}}if(Y==="["&&L()!==":"||Y==="-"&&L()==="]")Y=`\\${Y}`;if(Y==="]"&&(V.value==="["||V.value==="[^"))Y=`\\${Y}`;if($.posix===!0&&Y==="!"&&V.value==="[")Y="^";V.value+=Y,a({value:Y});continue}if(W.quotes===1&&Y!=='"'){Y=r.escapeRegex(Y),V.value+=Y,a({value:Y});continue}if(Y==='"'){if(W.quotes=W.quotes===1?0:1,$.keepQuotes===!0)D({type:"text",value:Y});continue}if(Y==="("){W1("parens"),D({type:"paren",value:Y});continue}if(Y===")"){if(W.parens===0&&$.strictBrackets===!0)throw new SyntaxError($1("opening","("));let X=h[h.length-1];if(X&&W.parens===X.parens+1){Cq(h.pop());continue}D({type:"paren",value:Y,output:W.parens?")":"\\)"}),e("parens");continue}if(Y==="["){if($.nobracket===!0||!p().includes("]")){if($.nobracket!==!0&&$.strictBrackets===!0)throw new SyntaxError($1("closing","]"));Y=`\\${Y}`}else W1("brackets");D({type:"bracket",value:Y});continue}if(Y==="]"){if($.nobracket===!0||V&&V.type==="bracket"&&V.value.length===1){D({type:"text",value:Y,output:`\\${Y}`});continue}if(W.brackets===0){if($.strictBrackets===!0)throw new SyntaxError($1("opening","["));D({type:"text",value:Y,output:`\\${Y}`});continue}e("brackets");let X=V.value.slice(1);if(V.posix!==!0&&X[0]==="^"&&!X.includes("/"))Y=`/${Y}`;if(V.value+=Y,a({value:Y}),$.literalBrackets===!1||r.hasRegexChars(X))continue;let I=r.escapeRegex(V.value);if(W.output=W.output.slice(0,-V.value.length),$.literalBrackets===!0){W.output+=I,V.value=I;continue}V.value=`(${B}${I}|${V.value})`,W.output+=V.value;continue}if(Y==="{"&&$.nobrace!==!0){W1("braces");let X={type:"brace",value:Y,output:"(",outputIndex:W.output.length,tokensIndex:W.tokens.length};A.push(X),D(X);continue}if(Y==="}"){let X=A[A.length-1];if($.nobrace===!0||!X){D({type:"text",value:Y,output:Y});continue}let I=")";if(X.dots===!0){let E=U.slice(),u=[];for(let m=E.length-1;m>=0;m--){if(U.pop(),E[m].type==="brace")break;if(E[m].type!=="dots")u.unshift(E[m].value)}I=yZ(u,$),W.backtrack=!0}if(X.comma!==!0&&X.dots!==!0){let E=W.output.slice(0,X.outputIndex),u=W.tokens.slice(X.tokensIndex);X.value=X.output="\\{",Y=I="\\}",W.output=E;for(let m of u)W.output+=m.output||m.value}D({type:"brace",value:Y,output:I}),e("braces"),A.pop();continue}if(Y==="|"){if(h.length>0)h[h.length-1].conditions++;D({type:"text",value:Y});continue}if(Y===","){let X=Y,I=A[A.length-1];if(I&&x[x.length-1]==="braces")I.comma=!0,X="|";D({type:"comma",value:Y,output:X});continue}if(Y==="/"){if(V.type==="dot"&&W.index===W.start+1){W.start=W.index+1,W.consumed="",W.output="",U.pop(),V=z;continue}D({type:"slash",value:Y,output:C});continue}if(Y==="."){if(W.braces>0&&V.type==="dot"){if(V.value===".")V.output=G;let X=A[A.length-1];V.type="dots",V.output+=Y,V.value+=Y,X.dots=!0;continue}if(W.braces+W.parens===0&&V.type!=="bos"&&V.type!=="slash"){D({type:"text",value:Y,output:G});continue}D({type:"dot",value:Y,output:G});continue}if(Y==="?"){if(!(V&&V.value==="(")&&$.noextglob!==!0&&L()==="("&&L(2)!=="?"){z1("qmark",Y);continue}if(V&&V.type==="paren"){let I=L(),E=Y;if(V.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test(p()))E=`\\${Y}`;D({type:"text",value:Y,output:E});continue}if($.dot!==!0&&(V.type==="slash"||V.type==="bos")){D({type:"qmark",value:Y,output:b});continue}D({type:"qmark",value:Y,output:f});continue}if(Y==="!"){if($.noextglob!==!0&&L()==="("){if(L(2)!=="?"||!/[!=<:]/.test(L(3))){z1("negate",Y);continue}}if($.nonegate!==!0&&W.index===0){Hq();continue}}if(Y==="+"){if($.noextglob!==!0&&L()==="("&&L(2)!=="?"){z1("plus",Y);continue}if(V&&V.value==="("||$.regex===!1){D({type:"plus",value:Y,output:P});continue}if(V&&(V.type==="bracket"||V.type==="paren"||V.type==="brace")||W.parens>0){D({type:"plus",value:Y});continue}D({type:"plus",value:P});continue}if(Y==="@"){if($.noextglob!==!0&&L()==="("&&L(2)!=="?"){D({type:"at",extglob:!0,value:Y,output:""});continue}D({type:"text",value:Y});continue}if(Y!=="*"){if(Y==="$"||Y==="^")Y=`\\${Y}`;let X=wZ.exec(p());if(X)Y+=X[0],W.index+=X[0].length;D({type:"text",value:Y});continue}if(V&&(V.type==="globstar"||V.star===!0)){V.type="star",V.star=!0,V.value+=Y,V.output=y,W.backtrack=!0,W.globstar=!0,c(Y);continue}let Q=p();if($.noextglob!==!0&&/^\([^?]/.test(Q)){z1("star",Y);continue}if(V.type==="star"){if($.noglobstar===!0){c(Y);continue}let X=V.prev,I=X.prev,E=X.type==="slash"||X.type==="bos",u=I&&(I.type==="star"||I.type==="globstar");if($.bash===!0&&(!E||Q[0]&&Q[0]!=="/")){D({type:"star",value:Y,output:""});continue}let m=W.braces>0&&(X.type==="comma"||X.type==="brace"),w1=h.length&&(X.type==="pipe"||X.type==="paren");if(!E&&X.type!=="paren"&&!m&&!w1){D({type:"star",value:Y,output:""});continue}while(Q.slice(0,3)==="/**"){let U1=q[W.index+4];if(U1&&U1!=="/")break;Q=Q.slice(3),c("/**",3)}if(X.type==="bos"&&l()){V.type="globstar",V.value+=Y,V.output=k($),W.output=V.output,W.globstar=!0,c(Y);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&!u&&l()){W.output=W.output.slice(0,-(X.output+V.output).length),X.output=`(?:${X.output}`,V.type="globstar",V.output=k($)+($.strictSlashes?")":"|$)"),V.value+=Y,W.globstar=!0,W.output+=X.output+V.output,c(Y);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&Q[0]==="/"){let U1=Q[1]!==void 0?"|$":"";W.output=W.output.slice(0,-(X.output+V.output).length),X.output=`(?:${X.output}`,V.type="globstar",V.output=`${k($)}${C}|${C}${U1})`,V.value+=Y,W.output+=X.output+V.output,W.globstar=!0,c(Y+R()),D({type:"slash",value:"/",output:""});continue}if(X.type==="bos"&&Q[0]==="/"){V.type="globstar",V.value+=Y,V.output=`(?:^|${C}|${k($)}${C})`,W.output=V.output,W.globstar=!0,c(Y+R()),D({type:"slash",value:"/",output:""});continue}W.output=W.output.slice(0,-V.output.length),V.type="globstar",V.output=k($),V.value+=Y,W.output+=V.output,W.globstar=!0,c(Y);continue}let T={type:"star",value:Y,output:y};if($.bash===!0){if(T.output=".*?",V.type==="bos"||V.type==="slash")T.output=v+T.output;D(T);continue}if(V&&(V.type==="bracket"||V.type==="paren")&&$.regex===!0){T.output=Y,D(T);continue}if(W.index===W.start||V.type==="slash"||V.type==="dot"){if(V.type==="dot")W.output+=d,V.output+=d;else if($.dot===!0)W.output+=H,V.output+=H;else W.output+=v,V.output+=v;if(L()!=="*")W.output+=_,V.output+=_}D(T)}while(W.brackets>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","]"));W.output=r.escapeLast(W.output,"["),e("brackets")}while(W.parens>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing",")"));W.output=r.escapeLast(W.output,"("),e("parens")}while(W.braces>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","}"));W.output=r.escapeLast(W.output,"{"),e("braces")}if($.strictSlashes!==!0&&(V.type==="star"||V.type==="bracket"))D({type:"maybe_slash",value:"",output:`${C}?`});if(W.backtrack===!0){W.output="";for(let Q of W.tokens)if(W.output+=Q.output!=null?Q.output:Q.value,Q.suffix)W.output+=Q.suffix}return W};E1.fastpaths=(q,Z)=>{let $={...Z},J=typeof $.maxLength==="number"?Math.min(M1,$.maxLength):M1,j=q.length;if(j>J)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);q=o0[q]||q;let{DOT_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:B,DOTS_SLASH:F,NO_DOT:w,NO_DOTS:G,NO_DOTS_SLASH:P,STAR:C,START_ANCHOR:_}=G1.globChars($.windows),M=$.dot?G:w,K=$.dot?P:w,d=$.capture?"":"?:",H={negated:!1,prefix:""},f=$.bash===!0?".*?":C;if($.capture)f=`(${f})`;let b=(v)=>{if(v.noglobstar===!0)return f;return`(${d}(?:(?!${_}${v.dot?F:z}).)*?)`},i=(v)=>{switch(v){case"*":return`${M}${B}${f}`;case".*":return`${z}${B}${f}`;case"*.*":return`${M}${f}${z}${B}${f}`;case"*/*":return`${M}${f}${U}${B}${K}${f}`;case"**":return M+b($);case"**/*":return`(?:${M}${b($)}${U})?${K}${B}${f}`;case"**/*.*":return`(?:${M}${b($)}${U})?${K}${f}${z}${B}${f}`;case"**/.*":return`(?:${M}${b($)}${U})?${z}${B}${f}`;default:{let N=/^(.*?)\.(\w+)$/.exec(v);if(!N)return;let y=i(N[1]);if(!y)return;return y+z+N[2]}}},g=r.removePrefix(q,H),k=i(g);if(k&&$.strictSlashes!==!0)k+=`${U}?`;return k};e0.exports=E1});var Zq=O((H8,$q)=>{var DZ=a0(),x1=t0(),qq=j1(),fZ=J1(),HZ=(q)=>q&&typeof q==="object"&&!Array.isArray(q),S=(q,Z,$=!1)=>{if(Array.isArray(q)){let G=q.map((C)=>S(C,Z,$));return(C)=>{for(let _ of G){let M=_(C);if(M)return M}return!1}}let J=HZ(q)&&q.tokens&&q.input;if(q===""||typeof q!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let j=Z||{},z=j.windows,U=J?S.compileRe(q,Z):S.makeRe(q,Z,!1,!0),B=U.state;delete U.state;let F=()=>!1;if(j.ignore){let G={...Z,ignore:null,onMatch:null,onResult:null};F=S(j.ignore,G,$)}let w=(G,P=!1)=>{let{isMatch:C,match:_,output:M}=S.test(G,U,Z,{glob:q,posix:z}),K={glob:q,state:B,regex:U,posix:z,input:G,output:M,match:_,isMatch:C};if(typeof j.onResult==="function")j.onResult(K);if(C===!1)return K.isMatch=!1,P?K:!1;if(F(G)){if(typeof j.onIgnore==="function")j.onIgnore(K);return K.isMatch=!1,P?K:!1}if(typeof j.onMatch==="function")j.onMatch(K);return P?K:!0};if($)w.state=B;return w};S.test=(q,Z,$,{glob:J,posix:j}={})=>{if(typeof q!=="string")throw new TypeError("Expected input to be a string");if(q==="")return{isMatch:!1,output:""};let z=$||{},U=z.format||(j?qq.toPosixSlashes:null),B=q===J,F=B&&U?U(q):q;if(B===!1)F=U?U(q):q,B=F===J;if(B===!1||z.capture===!0)if(z.matchBase===!0||z.basename===!0)B=S.matchBase(q,Z,$,j);else B=Z.exec(F);return{isMatch:Boolean(B),match:B,output:F}};S.matchBase=(q,Z,$)=>{return(Z instanceof RegExp?Z:S.makeRe(Z,$)).test(qq.basename(q))};S.isMatch=(q,Z,$)=>S(Z,$)(q);S.parse=(q,Z)=>{if(Array.isArray(q))return q.map(($)=>S.parse($,Z));return x1(q,{...Z,fastpaths:!1})};S.scan=(q,Z)=>DZ(q,Z);S.compileRe=(q,Z,$=!1,J=!1)=>{if($===!0)return q.output;let j=Z||{},z=j.contains?"":"^",U=j.contains?"":"$",B=`${z}(?:${q.output})${U}`;if(q&&q.negated===!0)B=`^(?!${B}).*\$`;let F=S.toRegex(B,Z);if(J===!0)F.state=q;return F};S.makeRe=(q,Z={},$=!1,J=!1)=>{if(!q||typeof q!=="string")throw new TypeError("Expected a non-empty string");let j={negated:!1,fastpaths:!0};if(Z.fastpaths!==!1&&(q[0]==="."||q[0]==="*"))j.output=x1.fastpaths(q,Z);if(!j.output)j=x1(q,Z);return S.compileRe(j,Z,$,J)};S.toRegex=(q,Z)=>{try{let $=Z||{};return new RegExp(q,$.flags||($.nocase?"i":""))}catch($){if(Z&&Z.debug===!0)throw $;return/$^/}};S.constants=fZ;$q.exports=S});var Y1=O((C8,Vq)=>{var Jq=Zq(),CZ=j1();function jq(q,Z,$=!1){if(Z&&(Z.windows===null||Z.windows===void 0))Z={...Z,windows:CZ.isWindows()};return Jq(q,Z,$)}Object.assign(jq,Jq);Vq.exports=jq});var Bq=O((Uq)=>{Object.defineProperty(Uq,"__esModule",{value:!0});Uq.Builder=void 0;var LZ=import.meta.require("path"),Yq=m0(),Wq=null;try{import.meta.require.resolve("picomatch"),Wq=Y1()}catch(q){}class zq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:LZ.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 Yq.APIBuilder(q||".",this.options)}withGlobFunction(q){return this.globFunction=q,this}crawlWithOptions(q,Z){return this.options={...this.options,...Z},new Yq.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||Wq;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((j)=>J(j)),this}}Uq.Builder=zq});var Fq=O((Qq)=>{Object.defineProperty(Qq,"__esModule",{value:!0})});var Kq=O((s)=>{var PZ=s&&s.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var j=Object.getOwnPropertyDescriptor(Z,$);if(!j||("get"in j?!Z.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,j)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),TZ=s&&s.__exportStar||function(q,Z){for(var $ in q)if($!=="default"&&!Object.prototype.hasOwnProperty.call(Z,$))PZ(Z,q,$)};Object.defineProperty(s,"__esModule",{value:!0});s.fdir=void 0;var OZ=Bq();Object.defineProperty(s,"fdir",{enumerable:!0,get:function(){return OZ.Builder}});TZ(Fq(),s)});import{existsSync as Sq}from"fs";import{resolve as Aq}from"path";import y1 from"process";import{readdir as _q,readFile as Rq}from"fs/promises";import{extname as Eq,join as g1}from"path";import xq from"process";async function k1(q,Z){await Bun.write(q,Z)}async function I1(q){let Z=q??Z1.root,$=await _q(Z,{withFileTypes:!0}),J=await Promise.all($.map((j)=>{let z=g1(Z,j.name);return j.isDirectory()?I1(z):z}));return Array.prototype.concat(...J).filter((j)=>Eq(j)===".ts")}async function m1(q){try{let Z=q?.tsconfigPath||g1(q?.root??xq.cwd(),"tsconfig.json"),$=await Rq(Z,"utf-8");return JSON.parse($).compilerOptions?.isolatedDeclarations===!0}catch(Z){return console.log("Error reading tsconfig.json:",Z),!1}}function v1(q){let J=q.split("\n").map((j)=>{if(j=j.trimEnd(),j.startsWith("export interface")||j.startsWith("export type")){let z=j.split("{");if(z.length>1)return`${z[0].trim()} {${z[1]}`}if(j.endsWith(";"))j=j.slice(0,-1);return j}).join("\n");return J=J.replace(/\n{3,}/g,"\n\n"),J=J.replace(/\/\*\*\n([^*]*)(\n \*\/)/g,(j,z)=>{return`/**\n${z.split("\n").map((B)=>` *${B.trim()?` ${B.trim()}`:""}`).join("\n")}\n */`}),`${J.trim()}\n`}function u1(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 Q1(q,...Z){if(!Z.length)return q;let $=Z.shift();if(B1(q)&&B1($)){for(let J in $)if(Object.prototype.hasOwnProperty.call($,J)){let j=$[J];if(B1(j)&&B1(q[J]))q[J]=Q1(q[J],j);else q[J]=j}}return Q1(q,...Z)}function B1(q){return q&&typeof q==="object"&&!Array.isArray(q)}async function bq({name:q,cwd:Z,defaultConfig:$}){let J=Z??y1.cwd(),j=Aq(J,`${q}.config`);if(Sq(j))try{let z=await import(j),U=z.default||z;return Q1($,U)}catch(z){console.error(`Error loading config from ${j}:`,z)}return $}var Z1=await bq({name:"dts",cwd:y1.cwd(),defaultConfig:{cwd:y1.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json"}});import{readFile as gq}from"fs/promises";async function d1(q){let Z=await gq(q,"utf-8"),$="",J=new Set,j=new Map,z=/export\s*(?:\*|\{[^}]*\})\s*from\s*['"][^'"]+['"]/g,U;while((U=z.exec(Z))!==null)$+=`${U[0]}\n`;let B=/import\s+(?:(type)\s+)?(?:(\{[^}]+\})|(\w+))(?:\s*,\s*(?:(\{[^}]+\})|(\w+)))?\s+from\s+['"]([^'"]+)['"]/g,F;while((F=B.exec(Z))!==null){let[,C,_,M,K,d,H]=F;if(!j.has(H))j.set(H,new Set);let f=(b)=>{if(b)b.replace(/[{}]/g,"").split(",").map((g)=>{let[k,v]=g.split(" as ").map((N)=>N.trim());return{name:k.replace(/^type\s+/,""),alias:v||k.replace(/^type\s+/,"")}}).forEach(({name:g})=>{j.get(H).add(g)})};if(f(_),f(K),M)j.get(H).add(M);if(d)j.get(H).add(d)}let w=/(\/\*\*[\s\S]*?\*\/\s*)?(export\s+(?:async\s+)?(?:function|const|let|var|class|interface|type)\s+\w[\s\S]*?)(?=\n\s*(?:\/\*\*|export|$))/g,G;while((G=w.exec(Z))!==null){let[,C,_]=G,M=C?u1(C.trim()):"",K=_.trim();if(K.startsWith("export function")||K.startsWith("export async function")){K=K.replace(/^export\s+(async\s+)?function/,"export declare function");let f=K.match(/^.*?\)/);if(f){let b=f[0].slice(f[0].indexOf("(")+1,-1);b=b.replace(/\s*=[^,)]+/g,"");let i=K.match(/\):\s*([^{]+)/);K=`export declare function ${K.split("function")[1].split("(")[0].trim()}(${b})${i?`: ${i[1].trim()}`:""};`}}else if(K.startsWith("export const")||K.startsWith("export let")||K.startsWith("export var"))K=K.replace(/^export\s+(const|let|var)/,"export declare $1"),K=`${K.split("=")[0].trim()};`;$+=`${M}\n${K}\n\n`;let d=/\b([A-Z]\w+)(?:<[^>]*>)?/g,H;while((H=d.exec(K))!==null)J.add(H[1])}let P="";if(j.forEach((C,_)=>{let M=[...C].filter((K)=>J.has(K));if(M.length>0)P+=`import type { ${M.join(", ")} } from '${_}'\n`}),P)$=`${P}\n${$}`;return v1($)}import{mkdir as kZ,rm as mZ}from"fs/promises";import{dirname as vZ,join as uZ,parse as dZ,relative as hZ}from"path";var wq=X1(Kq(),1),S1=X1(Y1(),1),Iq=X1(Y1(),1);import Nq,{posix as N1}from"path";var _Z=/\\(?![()[\]{}!+@])/g;function RZ(q){return yq(q)}function EZ(q){return Dq(q).replace(_Z,"/")}var _8=process.platform==="win32"?EZ:RZ,xZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,SZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,yq=(q)=>q.replace(xZ,"\\$&"),Dq=(q)=>q.replace(SZ,"\\$&"),R8=process.platform==="win32"?Dq:yq;function AZ(q,Z){if((Z==null?void 0:Z.caseSensitiveMatch)===!1)return!0;let $=Iq.default.scan(q);return $.isGlob||$.negated}function Gq(q,Z,$,J,j){var z;let U=q;if(q.endsWith("/"))U=q.slice(0,-1);if(!U.endsWith("*")&&Z)U+="/**";if(Nq.isAbsolute(U.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))U=N1.relative($,U);else U=N1.normalize(U);let B=/^(\/?\.\.)+/.exec(U);if(B==null?void 0:B[0]){let F=N1.join($,B[0]);if(J.root.length>F.length)J.root=F,J.depthOffset=-(B[0].length+1)/3}else if(!j&&J.depthOffset>=0){let F=U.split("/");(z=J.commonPath)!=null||(J.commonPath=F);let w=[];for(let G=0;G<Math.min(J.commonPath.length,F.length);G++){let P=F[G];if(P==="**"&&!F[G+1]){w.pop();break}if(P!==J.commonPath[G]||AZ(P)||G===F.length-1)break;w.push(P)}J.depthOffset=w.length,J.commonPath=w,J.root=w.length>0?`${$}/${w.join("/")}`:$}return U}function bZ({patterns:q,ignore:Z=[],expandDirectories:$=!0},J,j){if(typeof q==="string")q=[q];if(typeof Z==="string")Z=[Z];let z=[],U=Z.map((B)=>Gq(B,$,J,j,!0));if(!q)return{match:["**/*"],ignore:U};for(let B of q)if(B=Gq(B,$,J,j,!1),B.startsWith("!")&&B[1]!=="(")U.push(B.slice(1));else z.push(B);return{match:z,ignore:U}}function A1(q,Z,$){return N1.relative(Z,`${$}/${q}`)}function Mq(q,Z,$,J,j){let z=j?q.slice($.length+1)||".":q;if($===Z)return J&&z!=="."?z.slice(0,-1):z;return A1(z,Z,$)}function gZ(q,Z,$){let J={root:Z,commonPath:null,depthOffset:0},j=bZ(q,Z,J),z=S1.default(j.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:j.ignore}),U=S1.default(j.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),B={filters:[(w,G)=>z(Mq(w,Z,J.root,G,q.absolute))],exclude:(w,G)=>U(Mq(G,Z,J.root,!0,!0)),pathSeparator:"/",relativePaths:!0};if(q.deep)B.maxDepth=Math.round(q.deep-J.depthOffset);if(q.absolute)B.relativePaths=!1,B.resolvePaths=!0,B.includeBasePath=!0;if(q.followSymbolicLinks===!1)B.resolveSymlinks=!1,B.excludeSymlinks=!0;if(q.onlyDirectories)B.excludeFiles=!0,B.includeDirs=!0;else if(q.onlyFiles===!1)B.includeDirs=!0;J.root=J.root.replace(/\\/g,"");let F=new wq.fdir(B).crawl(J.root);if(Z===J.root||q.absolute)return $?F.sync():F.withPromise();return $?F.sync().map((w)=>A1(w,Z,J.root)+(!w||w.endsWith("/")?"/":"")):F.withPromise().then((w)=>w.map((G)=>A1(G,Z,J.root)+(!G||G.endsWith("/")?"/":"")))}async function fq(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?Nq.resolve($.cwd).replace(/\\/g,"/"):process.cwd().replace(/\\/g,"/");return gZ($,J,!1)}async function lZ(q){try{if(!await m1(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 mZ(q.outdir,{recursive:!0,force:!0});let $;if(q?.entrypoints)$=await fq(q.entrypoints,{cwd:q.root??q.cwd,absolute:!0});else $=await I1(q?.root);for(let J of $){let j=await d1(J);if(j){let z=hZ(q?.root??"./src",J),U=dZ(z),B=uZ(q?.outdir??"./dist",`${U.name}.d.ts`);await kZ(vZ(B),{recursive:!0}),await k1(B,j)}else console.warn(`No declarations extracted for ${J}`)}}catch(Z){console.error("Error generating declarations:",Z)}}async function m8(q){await lZ({...Z1,...q})}export{k1 as writeToFile,I1 as getAllTypeScriptFiles,lZ as generateDeclarationsFromFiles,m8 as generate,v1 as formatDeclarations,u1 as formatComment,d1 as extractTypeFromSource,Q1 as deepMerge,Z1 as config,m1 as checkIsolatedDeclarations};
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.3.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,13 +65,13 @@
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.11",
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
- "pre-commit": "bunx lint-staged",
74
- "commit-msg": "bunx --no -- commitlint --edit $1"
74
+ "pre-commit": "bunx lint-staged"
75
75
  },
76
76
  "lint-staged": {
77
77
  "*.{js,jsx,ts,tsx}": "bunx eslint . --fix"
package/dist/config.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { DtsGenerationConfig } from './types'
2
-
3
- export declare function loadConfig<T extends Record<string, unknown>>({ name, cwd, defaultConfig }: Options<T>): Promise<T>
4
-
5
- export declare const config: DtsGenerationConfig
package/dist/extract.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function extractTypeFromSource(filePath: string): Promise<string>
@@ -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,5 +0,0 @@
1
- export { config } from './config'
2
- export * from './extract'
3
- export * from './generate'
4
- export * from './types'
5
- 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 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 type DtsGenerationOption = Partial<DtsGenerationConfig>
22
-
23
- /**
24
- * DtsGenerationOptions
25
- *
26
- * This is the configuration object for the DTS generation process.
27
- */
28
- export type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[]
package/dist/utils.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { DtsGenerationConfig } from './types'
2
-
3
- export declare function writeToFile(filePath: string, content: string): Promise<void>
4
-
5
- export declare function getAllTypeScriptFiles(directory?: string): Promise<string[]>
6
-
7
- export declare function checkIsolatedDeclarations(options?: DtsGenerationConfig): Promise<boolean>
8
-
9
- export declare function formatDeclarations(declarations: string): string
10
-
11
- export declare function formatComment(comment: string): string
12
-
13
- export declare function deepMerge<T extends object>(target: T, ...sources: Array<Partial<T>>): T