@stacksjs/dtsx 0.6.2 → 0.7.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 sq=Object.create;var{getPrototypeOf:nq,defineProperty:l1,getOwnPropertyNames:rq}=Object;var oq=Object.prototype.hasOwnProperty;var K1=(q,$,J)=>{J=q!=null?sq(nq(q)):{};let Z=$||!q||!q.__esModule?l1(J,"default",{value:q,enumerable:!0}):J;for(let Y of rq(q))if(!oq.call(Z,Y))l1(Z,Y,{get:()=>q[Y],enumerable:!0});return Z};var x=(q,$)=>()=>($||q(($={exports:{}}).exports,$),$.exports);var S1=x((Q0)=>{Object.defineProperty(Q0,"__esModule",{value:!0});Q0.normalizePath=Q0.convertSlashes=Q0.cleanPath=void 0;var A1=import.meta.require("path");function j0(q){let $=A1.normalize(q);if($.length>1&&$[$.length-1]===A1.sep)$=$.substring(0,$.length-1);return $}Q0.cleanPath=j0;var d$=/[\\/]/g;function X0(q,$){return q.replace(d$,$)}Q0.convertSlashes=X0;function c$(q,$){let{resolvePaths:J,normalizePath:Z,pathSeparator:Y}=$,j=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if(J)q=A1.resolve(q);if(Z||j)q=j0(q);if(q===".")return"";let X=q[q.length-1]!==Y;return X0(X?q+Y:q,Y)}Q0.normalizePath=c$});var K0=x((G0)=>{Object.defineProperty(G0,"__esModule",{value:!0});G0.build=G0.joinDirectoryPath=G0.joinPathWithBasePath=void 0;var i$=import.meta.require("path"),s$=S1();function z0(q,$){return $+q}G0.joinPathWithBasePath=z0;function n$(q,$){return function(J,Z){if(Z.startsWith(q))return Z.replace(q,"")+J;else return s$.convertSlashes(i$.relative(q,Z),$.pathSeparator)+$.pathSeparator+J}}function r$(q){return q}function o$(q,$,J){return $+q+J}G0.joinDirectoryPath=o$;function a$(q,$){let{relativePaths:J,includeBasePath:Z}=$;return J&&q?n$(q,$):Z?z0:r$}G0.build=a$});var M0=x((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.build=void 0;function qJ(q){return function($,J){J.push($.substring(q.length)||".")}}function $J(q){return function($,J,Z){let Y=$.substring(q.length)||".";if(Z.every((j)=>j(Y,!0)))J.push(Y)}}var JJ=(q,$)=>{$.push(q||".")},ZJ=(q,$,J)=>{let Z=q||".";if(J.every((Y)=>Y(Z,!0)))$.push(Z)},YJ=()=>{};function jJ(q,$){let{includeDirs:J,filters:Z,relativePaths:Y}=$;if(!J)return YJ;if(Y)return Z&&Z.length?$J(q):qJ(q);return Z&&Z.length?ZJ:JJ}B0.build=jJ});var H0=x((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.build=void 0;var XJ=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))J.files++},QJ=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))$.push(q)},UJ=(q,$,J,Z)=>{J.files++},zJ=(q,$)=>{$.push(q)},GJ=()=>{};function FJ(q){let{excludeFiles:$,filters:J,onlyCounts:Z}=q;if($)return GJ;if(J&&J.length)return Z?XJ:QJ;else if(Z)return UJ;else return zJ}V0.build=FJ});var _0=x((W0)=>{Object.defineProperty(W0,"__esModule",{value:!0});W0.build=void 0;var KJ=(q)=>{return q},BJ=()=>{return[""].slice(0,0)};function wJ(q){return q.group?BJ:KJ}W0.build=wJ});var P0=x((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.build=void 0;var MJ=(q,$,J)=>{q.push({directory:$,files:J,dir:$})},VJ=()=>{};function NJ(q){return q.group?MJ:VJ}O0.build=NJ});var A0=x((J1)=>{var HJ=J1&&J1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(J1,"__esModule",{value:!0});J1.build=void 0;var M1=HJ(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,X)=>{if(j)return Z.dequeue(Y?null:j,$);M1.default.stat(X,(Q,U)=>{if(Q)return Z.dequeue(Y?null:Q,$);if(U.isDirectory()&&E0(q,X,$))return Z.dequeue(null,$);J(U,X),Z.dequeue(null,$)})})},IJ=function(q,$,J){let{queue:Z,options:{suppressErrors:Y}}=$;Z.enqueue();try{let j=M1.default.realpathSync(q),X=M1.default.statSync(j);if(X.isDirectory()&&E0(q,j,$))return;J(X,j)}catch(j){if(!Y)throw j}};function _J(q,$){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return $?IJ:WJ}J1.build=_J;function E0(q,$,J){if(J.options.useRealPaths)return OJ($,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 OJ(q,$){return $.visited.includes(q+$.options.pathSeparator)}});var y0=x((S0)=>{Object.defineProperty(S0,"__esModule",{value:!0});S0.build=void 0;var RJ=(q)=>{return q.counts},PJ=(q)=>{return q.groups},fJ=(q)=>{return q.paths},EJ=(q)=>{return q.paths.slice(0,q.options.maxFiles)},AJ=(q,$,J)=>{return V1($,J,q.counts,q.options.suppressErrors),null},SJ=(q,$,J)=>{return V1($,J,q.paths,q.options.suppressErrors),null},TJ=(q,$,J)=>{return V1($,J,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},yJ=(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 xJ(q,$){let{onlyCounts:J,group:Z,maxFiles:Y}=q;if(J)return $?RJ:AJ;else if(Z)return $?PJ:yJ;else if(Y)return $?EJ:TJ;else return $?fJ:SJ}S0.build=xJ});var D0=x((Z1)=>{var CJ=Z1&&Z1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(Z1,"__esModule",{value:!0});Z1.build=void 0;var x0=CJ(import.meta.require("fs")),C0={withFileTypes:!0},DJ=(q,$,J,Z,Y)=>{if(Z<0)return q.queue.dequeue(null,q);q.visited.push($),q.counts.directories++,q.queue.enqueue(),x0.default.readdir($||".",C0,(j,X=[])=>{Y(X,J,Z),q.queue.dequeue(q.options.suppressErrors?null:j,q)})},LJ=(q,$,J,Z,Y)=>{if(Z<0)return;q.visited.push($),q.counts.directories++;let j=[];try{j=x0.default.readdirSync($||".",C0)}catch(X){if(!q.options.suppressErrors)throw X}Y(j,J,Z)};function kJ(q){return q?LJ:DJ}Z1.build=kJ});var v0=x((k0)=>{Object.defineProperty(k0,"__esModule",{value:!0});k0.Queue=void 0;class L0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,$){if(--this.count<=0||q)this.onQueueEmpty(q,$)}}k0.Queue=L0});var m0=x((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=x((i)=>{var bJ=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]}),vJ=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))bJ($,q,J)}return vJ($,q),$};Object.defineProperty(i,"__esModule",{value:!0});i.Walker=void 0;var d0=import.meta.require("path"),T1=S1(),y1=a(K0()),gJ=a(M0()),hJ=a(H0()),uJ=a(_0()),mJ=a(P0()),dJ=a(A0()),cJ=a(y0()),lJ=a(D0()),pJ=v0(),iJ=m0();class c0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,$,J){this.isSynchronous=!J,this.callbackInvoker=cJ.build($,this.isSynchronous),this.root=T1.normalizePath(q,$),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new iJ.Counter,options:$,queue:new pJ.Queue((Z,Y)=>this.callbackInvoker(Y,Z,J)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=y1.build(this.root,$),this.pushDirectory=gJ.build(this.root,$),this.pushFile=hJ.build($),this.getArray=uJ.build($),this.groupFiles=mJ.build($),this.resolveSymlink=dJ.build($,this.isSynchronous),this.walkDirectory=lJ.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:X,exclude:Q,maxFiles:U,signal:z,useRealPaths:G,pathSeparator:H}}=this.state;if(z&&z.aborted||U&&Z.length>U)return;this.pushDirectory($,Z,Y);let N=this.getArray(this.state.paths);for(let I=0;I<q.length;++I){let W=q[I];if(W.isFile()||W.isSymbolicLink()&&!j&&!X){let _=this.joinPath(W.name,$);this.pushFile(_,N,this.state.counts,Y)}else if(W.isDirectory()){let _=y1.joinDirectoryPath(W.name,$,this.state.options.pathSeparator);if(Q&&Q(W.name,_))continue;this.walkDirectory(this.state,_,_,J-1,this.walk)}else if(W.isSymbolicLink()&&this.resolveSymlink){let _=y1.joinPathWithBasePath(W.name,$);this.resolveSymlink(_,this.state,(y,A)=>{if(y.isDirectory()){if(A=T1.normalizePath(A,this.state.options),Q&&Q(W.name,A))return;this.walkDirectory(this.state,A,G?A:_+H,J-1,this.walk)}else{A=G?A:_;let E=d0.basename(A),m=T1.normalizePath(d0.dirname(A),this.state.options);A=this.joinPath(E,m),this.pushFile(A,N,this.state.counts,Y)}})}}this.groupFiles(this.state.groups,$,N)}}i.Walker=c0});var s0=x((p0)=>{Object.defineProperty(p0,"__esModule",{value:!0});p0.callback=p0.promise=void 0;var sJ=x1();function nJ(q,$){return new Promise((J,Z)=>{l0(q,$,(Y,j)=>{if(Y)return Z(Y);J(j)})})}p0.promise=nJ;function l0(q,$,J){new sJ.Walker(q,$,J).start()}p0.callback=l0});var o0=x((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.sync=void 0;var oJ=x1();function aJ(q,$){return new oJ.Walker(q,$).start()}n0.sync=aJ});var $q=x((e0)=>{Object.defineProperty(e0,"__esModule",{value:!0});e0.APIBuilder=void 0;var a0=s0(),tJ=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 tJ.sync(this.root,this.options)}}e0.APIBuilder=t0});var j1=x((A8,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:"/"},eJ={...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:"\\"},qZ={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:qZ,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?eJ:Jq}}});var X1=x((jZ)=>{var{REGEX_BACKSLASH:$Z,REGEX_REMOVE_BACKSLASH:JZ,REGEX_SPECIAL_CHARS:ZZ,REGEX_SPECIAL_CHARS_GLOBAL:YZ}=j1();jZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);jZ.hasRegexChars=(q)=>ZZ.test(q);jZ.isRegexChar=(q)=>q.length===1&&jZ.hasRegexChars(q);jZ.escapeRegex=(q)=>q.replace(YZ,"\\$1");jZ.toPosixSlashes=(q)=>q.replace($Z,"/");jZ.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};jZ.removeBackslashes=(q)=>{return q.replace(JZ,($)=>{return $==="\\"?"":$})};jZ.escapeLast=(q,$,J)=>{let Z=q.lastIndexOf($,J);if(Z===-1)return q;if(q[Z-1]==="\\")return jZ.escapeLast(q,$,Z-1);return`${q.slice(0,Z)}\\${q.slice(Z)}`};jZ.removePrefix=(q,$={})=>{let J=q;if(J.startsWith("./"))J=J.slice(2),$.prefix="./";return J};jZ.wrapOutput=(q,$={},J={})=>{let Z=J.contains?"":"^",Y=J.contains?"":"$",j=`${Z}(?:${q})${Y}`;if($.negated===!0)j=`(?:^(?!${j}).*\$)`;return j};jZ.basename=(q,{windows:$}={})=>{let J=q.split($?/[\\/]/:"/"),Z=J[J.length-1];if(Z==="")return J[J.length-2];return Z}});var Bq=x((T8,Kq)=>{var Xq=X1(),{CHAR_ASTERISK:C1,CHAR_AT:MZ,CHAR_BACKWARD_SLASH:Q1,CHAR_COMMA:VZ,CHAR_DOT:D1,CHAR_EXCLAMATION_MARK:L1,CHAR_FORWARD_SLASH:Fq,CHAR_LEFT_CURLY_BRACE:k1,CHAR_LEFT_PARENTHESES:b1,CHAR_LEFT_SQUARE_BRACKET:NZ,CHAR_PLUS:HZ,CHAR_QUESTION_MARK:Qq,CHAR_RIGHT_CURLY_BRACE:WZ,CHAR_RIGHT_PARENTHESES:Uq,CHAR_RIGHT_SQUARE_BRACKET:IZ}=j1(),zq=(q)=>{return q===Fq||q===Q1},Gq=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},_Z=(q,$)=>{let J=$||{},Z=q.length-1,Y=J.parts===!0||J.scanToEnd===!0,j=[],X=[],Q=[],U=q,z=-1,G=0,H=0,N=!1,I=!1,W=!1,_=!1,y=!1,A=!1,E=!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 S;if(O===Q1){if(E=P.backslashes=!0,O=b(),O===k1)A=!0;continue}if(A===!0||O===k1){g++;while(B()!==!0&&(O=b())){if(O===Q1){E=P.backslashes=!0,b();continue}if(O===k1){g++;continue}if(A!==!0&&O===D1&&(O=b())===D1){if(N=P.isBrace=!0,W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(A!==!0&&O===VZ){if(N=P.isBrace=!0,W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===WZ){if(g--,g===0){A=!1,N=P.isBrace=!0,h=!0;break}}}if(Y===!0)continue;break}if(O===Fq){if(j.push(z),X.push(P),P={value:"",depth:0,isGlob:!1},h===!0)continue;if(c===D1&&z===G+1){G+=2;continue}H=z+1;continue}if(J.noext!==!0){if((O===HZ||O===MZ||O===C1||O===Qq||O===L1)===!0&&d()===b1){if(W=P.isGlob=!0,_=P.isExtglob=!0,h=!0,O===L1&&z===G)t=!0;if(Y===!0){while(B()!==!0&&(O=b())){if(O===Q1){E=P.backslashes=!0,O=b();continue}if(O===Uq){W=P.isGlob=!0,h=!0;break}}continue}break}}if(O===C1){if(c===C1)y=P.isGlobstar=!0;if(W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===Qq){if(W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===NZ){while(B()!==!0&&(S=b())){if(S===Q1){E=P.backslashes=!0,b();continue}if(S===IZ){I=P.isBracket=!0,W=P.isGlob=!0,h=!0;break}}if(Y===!0)continue;break}if(J.nonegate!==!0&&O===L1&&z===G){m=P.negated=!0,G++;continue}if(J.noparen!==!0&&O===b1){if(W=P.isGlob=!0,Y===!0){while(B()!==!0&&(O=b())){if(O===b1){E=P.backslashes=!0,O=b();continue}if(O===Uq){h=!0;break}}continue}break}if(W===!0){if(h=!0,Y===!0)continue;break}}if(J.noext===!0)_=!1,W=!1;let L=U,F="",K="";if(G>0)F=U.slice(0,G),U=U.slice(G),H-=G;if(L&&W===!0&&H>0)L=U.slice(0,H),K=U.slice(H);else if(W===!0)L="",K=U;else L=U;if(L&&L!==""&&L!=="/"&&L!==U){if(zq(L.charCodeAt(L.length-1)))L=L.slice(0,-1)}if(J.unescape===!0){if(K)K=Xq.removeBackslashes(K);if(L&&E===!0)L=Xq.removeBackslashes(L)}let l={prefix:F,input:q,start:G,base:L,glob:K,isBrace:N,isBracket:I,isGlob:W,isExtglob:_,isGlobstar:y,negated:m,negatedExtglob:t};if(J.tokens===!0){if(l.maxDepth=0,!zq(O))X.push(P);l.tokens=X}if(J.parts===!0||J.tokens===!0){let S;for(let C=0;C<j.length;C++){let n=S?S+1:G,p=j[C],o=q.slice(n,p);if(J.tokens){if(C===0&&G!==0)X[C].isPrefix=!0,X[C].value=F;else X[C].value=o;Gq(X[C]),l.maxDepth+=X[C].depth}if(C!==0||o!=="")Q.push(o);S=p}if(S&&S+1<q.length){let C=q.slice(S+1);if(Q.push(C),J.tokens)X[X.length-1].value=C,Gq(X[X.length-1]),l.maxDepth+=X[X.length-1].depth}l.slashes=j,l.parts=Q}return l};Kq.exports=_Z});var Vq=x((y8,Mq)=>{var N1=j1(),s=X1(),{MAX_LENGTH:H1,POSIX_REGEX_SOURCE:OZ,REGEX_NON_SPECIAL_CHARS:RZ,REGEX_SPECIAL_CHARS_BACKREF:PZ,REPLACEMENTS:wq}=N1,fZ=(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`},v1=(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||""},X=[j],Q=J.capture?"":"?:",U=N1.globChars(J.windows),z=N1.extglobChars(U),{DOT_LITERAL:G,PLUS_LITERAL:H,SLASH_LITERAL:N,ONE_CHAR:I,DOTS_SLASH:W,NO_DOT:_,NO_DOT_SLASH:y,NO_DOTS_SLASH:A,QMARK:E,QMARK_NO_DOT:m,STAR:t,START_ANCHOR:h}=U,g=(V)=>{return`(${Q}(?:(?!${h}${V.dot?W:G}).)*?)`},c=J.dot?"":_,O=J.dot?E: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:X};q=s.removePrefix(q,B),Y=q.length;let d=[],b=[],L=[],F=j,K,l=()=>B.index===Y-1,S=B.peek=(V=1)=>q[B.index+V],C=B.advance=()=>q[++B.index]||"",n=()=>q.slice(B.index+1),p=(V="",T=0)=>{B.consumed+=V,B.index+=T},o=(V)=>{B.output+=V.output!=null?V.output:V.value,p(V.value)},pq=()=>{let V=1;while(S()==="!"&&(S(2)!=="("||S(3)==="?"))C(),B.start++,V++;if(V%2===0)return!1;return B.negated=!0,B.start++,!0},z1=(V)=>{B[V]++,L.push(V)},e=(V)=>{B[V]--,L.pop()},f=(V)=>{if(F.type==="globstar"){let T=B.braces>0&&(V.type==="comma"||V.type==="brace"),M=V.extglob===!0||d.length&&(V.type==="pipe"||V.type==="paren");if(V.type!=="slash"&&V.type!=="paren"&&!T&&!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&&V.type!=="paren")d[d.length-1].inner+=V.value;if(V.value||V.output)o(V);if(F&&F.type==="text"&&V.type==="text"){F.output=(F.output||F.value)+V.value,F.value+=V.value;return}V.prev=F,X.push(V),F=V},G1=(V,T)=>{let M={...z[T],conditions:1,inner:""};M.prev=F,M.parens=B.parens,M.output=B.output;let R=(J.capture?"(":"")+M.open;z1("parens"),f({type:V,value:T,output:B.output?"":I}),f({type:"paren",extglob:!0,value:C(),output:R}),d.push(M)},iq=(V)=>{let T=V.close+(J.capture?")":""),M;if(V.type==="negate"){let R=P;if(V.inner&&V.inner.length>1&&V.inner.includes("/"))R=g(J);if(R!==P||l()||/^\)+$/.test(n()))T=V.close=`)\$))${R}`;if(V.inner.includes("*")&&(M=n())&&/^\.[^\\/.]+$/.test(M)){let D=v1(M,{...$,fastpaths:!1}).output;T=V.close=`)${D})${R})`}if(V.prev.type==="bos")B.negatedExtglob=!0}f({type:"paren",extglob:!0,value:K,output:T}),e("parens")};if(J.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let V=!1,T=q.replace(PZ,(M,R,D,u,v,I1)=>{if(u==="\\")return V=!0,M;if(u==="?"){if(R)return R+u+(v?E.repeat(v.length):"");if(I1===0)return O+(v?E.repeat(v.length):"");return E.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(V===!0)if(J.unescape===!0)T=T.replace(/\\/g,"");else T=T.replace(/\\+/g,(M)=>{return M.length%2===0?"\\\\":M?"\\":""});if(T===q&&J.contains===!0)return B.output=q,B;return B.output=s.wrapOutput(T,B,$),B}while(!l()){if(K=C(),K==="\0")continue;if(K==="\\"){let M=S();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=OZ[u];if(v){if(F.value=D+v,B.backtrack=!0,C(),!j.output&&X.indexOf(F)===1)j.output=I;continue}}}}if(K==="["&&S()!==":"||K==="-"&&S()==="]")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){iq(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=`(${Q}${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=X.slice(),u=[];for(let v=D.length-1;v>=0;v--){if(X.pop(),D[v].type==="brace")break;if(D[v].type!=="dots")u.unshift(D[v].value)}R=fZ(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&&L[L.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="",X.pop(),F=j;continue}f({type:"slash",value:K,output:N});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&&S()==="("&&S(2)!=="?"){G1("qmark",K);continue}if(F&&F.type==="paren"){let R=S(),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:E});continue}if(K==="!"){if(J.noextglob!==!0&&S()==="("){if(S(2)!=="?"||!/[!=<:]/.test(S(3))){G1("negate",K);continue}}if(J.nonegate!==!0&&B.index===0){pq();continue}}if(K==="+"){if(J.noextglob!==!0&&S()==="("&&S(2)!=="?"){G1("plus",K);continue}if(F&&F.value==="("||J.regex===!1){f({type:"plus",value:K,output:H});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:H});continue}if(K==="@"){if(J.noextglob!==!0&&S()==="("&&S(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=RZ.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 V=n();if(J.noextglob!==!0&&/^\([^?]/.test(V)){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||V[0]&&V[0]!=="/")){f({type:"star",value:K,output:""});continue}let v=B.braces>0&&(M.type==="comma"||M.type==="brace"),I1=d.length&&(M.type==="pipe"||M.type==="paren");if(!D&&M.type!=="paren"&&!v&&!I1){f({type:"star",value:K,output:""});continue}while(V.slice(0,3)==="/**"){let F1=q[B.index+4];if(F1&&F1!=="/")break;V=V.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"&&V[0]==="/"){let F1=V[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)}${N}|${N}${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"&&V[0]==="/"){F.type="globstar",F.value+=K,F.output=`(?:^|${N}|${g(J)}${N})`,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 T={type:"star",value:K,output:P};if(J.bash===!0){if(T.output=".*?",F.type==="bos"||F.type==="slash")T.output=c+T.output;f(T);continue}if(F&&(F.type==="bracket"||F.type==="paren")&&J.regex===!0){T.output=K,f(T);continue}if(B.index===B.start||F.type==="slash"||F.type==="dot"){if(F.type==="dot")B.output+=y,F.output+=y;else if(J.dot===!0)B.output+=A,F.output+=A;else B.output+=c,F.output+=c;if(S()!=="*")B.output+=I,F.output+=I}f(T)}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:`${N}?`});if(B.backtrack===!0){B.output="";for(let V of B.tokens)if(B.output+=V.output!=null?V.output:V.value,V.suffix)B.output+=V.suffix}return B};v1.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:X,ONE_CHAR:Q,DOTS_SLASH:U,NO_DOT:z,NO_DOTS:G,NO_DOTS_SLASH:H,STAR:N,START_ANCHOR:I}=N1.globChars(J.windows),W=J.dot?G:z,_=J.dot?H:z,y=J.capture?"":"?:",A={negated:!1,prefix:""},E=J.bash===!0?".*?":N;if(J.capture)E=`(${E})`;let m=(c)=>{if(c.noglobstar===!0)return E;return`(${y}(?:(?!${I}${c.dot?U:j}).)*?)`},t=(c)=>{switch(c){case"*":return`${W}${Q}${E}`;case".*":return`${j}${Q}${E}`;case"*.*":return`${W}${E}${j}${Q}${E}`;case"*/*":return`${W}${E}${X}${Q}${_}${E}`;case"**":return W+m(J);case"**/*":return`(?:${W}${m(J)}${X})?${_}${Q}${E}`;case"**/*.*":return`(?:${W}${m(J)}${X})?${_}${E}${j}${Q}${E}`;case"**/.*":return`(?:${W}${m(J)}${X})?${j}${Q}${E}`;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,A),g=t(h);if(g&&J.strictSlashes!==!0)g+=`${X}?`;return g};Mq.exports=v1});var Wq=x((x8,Hq)=>{var EZ=Bq(),g1=Vq(),Nq=X1(),AZ=j1(),SZ=(q)=>q&&typeof q==="object"&&!Array.isArray(q),k=(q,$,J=!1)=>{if(Array.isArray(q)){let G=q.map((N)=>k(N,$,J));return(N)=>{for(let I of G){let W=I(N);if(W)return W}return!1}}let Z=SZ(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,X=Z?k.compileRe(q,$):k.makeRe(q,$,!1,!0),Q=X.state;delete X.state;let U=()=>!1;if(Y.ignore){let G={...$,ignore:null,onMatch:null,onResult:null};U=k(Y.ignore,G,J)}let z=(G,H=!1)=>{let{isMatch:N,match:I,output:W}=k.test(G,X,$,{glob:q,posix:j}),_={glob:q,state:Q,regex:X,posix:j,input:G,output:W,match:I,isMatch:N};if(typeof Y.onResult==="function")Y.onResult(_);if(N===!1)return _.isMatch=!1,H?_:!1;if(U(G)){if(typeof Y.onIgnore==="function")Y.onIgnore(_);return _.isMatch=!1,H?_:!1}if(typeof Y.onMatch==="function")Y.onMatch(_);return H?_:!0};if(J)z.state=Q;return z};k.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||{},X=j.format||(Y?Nq.toPosixSlashes:null),Q=q===Z,U=Q&&X?X(q):q;if(Q===!1)U=X?X(q):q,Q=U===Z;if(Q===!1||j.capture===!0)if(j.matchBase===!0||j.basename===!0)Q=k.matchBase(q,$,J,Y);else Q=$.exec(U);return{isMatch:Boolean(Q),match:Q,output:U}};k.matchBase=(q,$,J)=>{return($ instanceof RegExp?$:k.makeRe($,J)).test(Nq.basename(q))};k.isMatch=(q,$,J)=>k($,J)(q);k.parse=(q,$)=>{if(Array.isArray(q))return q.map((J)=>k.parse(J,$));return g1(q,{...$,fastpaths:!1})};k.scan=(q,$)=>EZ(q,$);k.compileRe=(q,$,J=!1,Z=!1)=>{if(J===!0)return q.output;let Y=$||{},j=Y.contains?"":"^",X=Y.contains?"":"$",Q=`${j}(?:${q.output})${X}`;if(q&&q.negated===!0)Q=`^(?!${Q}).*\$`;let U=k.toRegex(Q,$);if(Z===!0)U.state=q;return U};k.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=g1.fastpaths(q,$);if(!Y.output)Y=g1(q,$);return k.compileRe(Y,$,J,Z)};k.toRegex=(q,$)=>{try{let J=$||{};return new RegExp(q,J.flags||(J.nocase?"i":""))}catch(J){if($&&$.debug===!0)throw J;return/$^/}};k.constants=AZ;Hq.exports=k});var U1=x((C8,Oq)=>{var Iq=Wq(),TZ=X1();function _q(q,$,J=!1){if($&&($.windows===null||$.windows===void 0))$={...$,windows:TZ.isWindows()};return Iq(q,$,J)}Object.assign(_q,Iq);Oq.exports=_q});var Sq=x((Eq)=>{Object.defineProperty(Eq,"__esModule",{value:!0});Eq.Builder=void 0;var yZ=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:yZ.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 yq=x((Tq)=>{Object.defineProperty(Tq,"__esModule",{value:!0})});var xq=x((r)=>{var xZ=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]}),CZ=r&&r.__exportStar||function(q,$){for(var J in q)if(J!=="default"&&!Object.prototype.hasOwnProperty.call($,J))xZ($,q,J)};Object.defineProperty(r,"__esModule",{value:!0});r.fdir=void 0;var DZ=Sq();Object.defineProperty(r,"fdir",{enumerable:!0,get:function(){return DZ.Builder}});CZ(yq(),r)});import eq from"process";import{resolve as aq}from"path";import tq 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 p1({name:q,cwd:$,defaultConfig:J}){let Z=aq($||tq.cwd(),`${q}.config`);try{let Y=await import(Z),j=Y.default||Y;return _1(J,j)}catch(Y){return J}}var q1=await p1({name:"dts",defaultConfig:{cwd:eq.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="",X=!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==="{")X=!0,Z++;if(U==="}")X=!1,Z--;if(U==="<"||U==="(")Z++;if(U===">"||U===")")Z--;if(U===","&&Z===0&&!X){if(J.trim())$.push(i1(J));J="";continue}}J+=U}if(J.trim())$.push(i1(J));let Q=$.join(", ");return w("params",`Cleaned parameters: ${Q}`),Q}function i1(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(),X=`${Z.trim()}: ${j}`;return w("param-clean",`Cleaned to: ${X}`),X}let J=q.match(/^([^=]+)=\s*(.+)$/);if(J){let[,Z,Y]=J,j=w$(Y.trim()),X=`${Z.trim()}: ${j}`;return w("param-clean",`Inferred type: ${X}`),X}return q.trim()}async function a1(q){try{let $=await Bun.file(q).text();return q$($)}catch($){throw console.error("Failed to extract types:",$),new Error("Failed to extract and generate .d.ts file")}}function q$(q){let $=G$();q.split("\n").forEach((Z)=>{if(Z.includes("import "))$0(Z,$.importTracking)}),C$(q,$),$.dtsLines.forEach((Z)=>{if(Z.trim()&&!Z.startsWith("import"))g$(Z,$.importTracking),h$(Z,$.importTracking)});let J=X$($.importTracking);return $.dtsLines=[...J.map((Z)=>`${Z};`),"",...$.dtsLines.filter((Z)=>!Z.trim().startsWith("import"))],U$($)}function $$(q){w("signature-start",`Processing declaration: ${q}`);let $=L$(q);w("signature-clean",`Clean declaration: ${$}`);let J=J$($),Z=$.slice($.indexOf(J)+J.length).trim();w("signature-content",`Content after name: ${Z}`);let{generics:Y,rest:j}=Z$(Z);Z=j.trim(),w("signature-after-generics",`Remaining content: ${Z}`);let{params:X,rest:Q}=Y$(Z);Z=Q.trim(),w("signature-after-params",`Remaining content: ${Z}`);let{returnType:U}=j$(Z);w("signature-return",`Extracted return type: ${U}`);let z={name:J,generics:Y,params:X,returnType:U};return w("signature-final",`Final signature object: ${JSON.stringify(z,null,2)}`),z}function J$(q){let $=q.match(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*([^(<\s]+)/);if(!$)throw new Error("Invalid function declaration");return $[1]}function Z$(q){let $="";if(q.startsWith("<")){let J=1,Z=0,Y="<",j=!1,X="";w("generics-input",`Starting generic extraction with: ${q}`);for(let Q=1;Q<q.length;Q++){let U=q[Q],z=Q<q.length-1?q[Q+1]:"",G=Q>0?q[Q-1]:"";if(w("generics-char",`Processing char: ${U}, next char: ${z}, depth: ${J}, pos: ${Q}`),(U==='"'||U==="\'"||U==="`")&&G!=="\\"){if(!j)j=!0,X=U,w("generics-string",`Entering string with ${X}`);else if(U===X)j=!1,w("generics-string","Exiting string")}if(!j){if(U==="<")J++,w("generics-depth",`Increasing depth to ${J} at pos ${Q}`);else if(U===">"){if(J--,w("generics-depth",`Decreasing depth to ${J} at pos ${Q}`),J===0&&z===">"){Y+=">>",Z=Q+1,w("generics-complete",`Found double closing bracket at pos ${Q}, final buffer: ${Y}`);break}else if(J===0){Y+=">",Z=Q,w("generics-complete",`Found single closing bracket at pos ${Q}, 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 Y$(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 X=q[Y];if(X==="(")Z++;if(X===")"){if(Z--,Z===0){w("params-depth-zero",`Found closing parenthesis at pos ${Y}`);break}}j+=X}$=j.trim(),q=q.slice(Y+1).trim(),w("signature-params",`Extracted params: ${$}`)}return{params:$,rest:q}}function j$(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,X="",Q=!1;w("return-extraction","Starting character-by-character extraction");while(Y<q.length&&!Q){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,X=U,w("return-string",`Entering string with ${X}`);else if(U===X)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`),Q=!0;break}}}if(J===0&&U===";"){w("return-end","Found semicolon at depth 0"),Q=!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 N=$.match(/^function\s*\w*\s*\((.*?)\)/s);if(N){let[,I]=N,W=O1(I||""),_=$.match(/\):\s*([^{;]+)(?:[{;]|$)/),y=_?u$(_[1]):"unknown";return`(${W}) => ${y}`}return null}J++;let Y=1,j=J,X=!1,Q="";for(;J<Z;J++){let N=$[J],I=J>0?$[J-1]:"";if(X){if(N===Q&&I!=="\\")X=!1;else if(N==="\\")J++}else if(N==='"'||N==="\'"||N==="`")X=!0,Q=N;else if(N==="(")Y++;else if(N===")"){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 N=J;while(J<Z&&!$.startsWith("=>",J)&&$[J]!=="{")J++;let I=J;G=$.slice(N,I).trim()}while(J<Z&&/\s/.test($[J]))J++;if($.startsWith("=>",J))J+=2;else return w("extract-function",'Function expression missing "=>"'),null;let H=O1(z||"");return w("extract-function",`Extracted function type: (${H}) => ${G}`),`(${H}) => ${G}`}function X$(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((X)=>{let Q=q.exportedTypes.has(X)||q.usedTypes.has(X);return w("import-type-filter",`Type ${X}: exported=${q.exportedTypes.has(X)}, used=${q.usedTypes.has(X)}`),Q}).map((X)=>{let Q=q.valueAliases.get(X);return Q?`${X} as ${Q}`:X}).sort();if(j.length>0){let X=`import type { ${j.join(", ")} } from '${Z}'`;if(!J.has(X))$.push(X),J.add(X),w("import-add-type",`Added type import: ${X}`)}}for(let[Z,Y]of q.valueImports){let j=new Map,X=Array.from(Y).filter((Q)=>{let U=Array.from(q.valueAliases.entries()).find(([G,H])=>H===Q)?.[0],z=q.exportedValues.has(Q)||q.usedValues.has(Q)||Q===q.defaultExportValue||U&&(q.exportedValues.has(U)||U===q.defaultExportValue);if(z&&U)j.set(Q,U);return z}).map((Q)=>{let U=j.get(Q);return U?`${Q} as ${U}`:Q}).sort();if(X.length>0){let Q=`import { ${X.join(", ")} } from '${Z}'`;if(!J.has(Q))$.push(Q),J.add(Q),w("import-add-value",`Added value import: ${Q}`)}}return $.sort()}function Q$(q){let $=q.trim();if(!$.startsWith("{"))return null;let J=0,Z=!1,Y="";for(let j=0;j<$.length;j++){let X=$[j],Q=j>0?$[j-1]:"";if((X==='"'||X==="\'"||X==="`")&&Q!=="\\"){if(!Z)Z=!0,Y=X;else if(X===Y)Z=!1;continue}if(!Z){if(X==="{")J++;else if(X==="}"){if(J--,J===0)return $.slice(0,j+1)}}}return null}function U$(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)=>{if(j.trim().startsWith("/*")||j.trim().startsWith("*")||j.trim().startsWith("//"))return"";let X=j.trim();if(!X)return"";if(X.startsWith("export *")||X.endsWith(";"))return X;if(X.startsWith("export type"))return`${X};`;return X.replace(/;+$/,";")}).filter((j)=>j.trim()),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 z$(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 G$(){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:F$(),defaultExports:new Set,currentScope:"top"}}function F$(){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 s1(q,$,J){let Z=q.split("\n");if(Z.length===1)return`${$}${q}${J?"":" |"}`;let Y=[],j=!1,X=0;return Z.forEach((U)=>{let z=U.trim();if(z.startsWith("Array<"))X=0;if(z==="}"||z.startsWith("> |")||z===">")j=X===1;if(z&&!z.startsWith("Array<")&&!z.endsWith(">")&&!z.startsWith("{")&&!z.endsWith("}"))X++}),Z.map((U,z)=>{let G=U.trim();if(!G)return"";let H=$;if(z>0){let _=Y.reduce((y,A)=>y+A.depth,0);if(H=$+" ".repeat(_),G.match(/^['"]/))H+=" ";if((G.startsWith("}")||G.startsWith(">")||G.startsWith("> |"))&&Y.length>0)H=$+" ".repeat(Math.max(0,_-1))}let N=G.match(/[{<[]/g)||[],I=G.match(/[}\]>]/g)||[];if(N.forEach((_)=>{let y=G.startsWith("Array")&&_==="<";Y.push({char:_,indent:H,isArray:y,depth:1,isSingleElement:j})}),I.length>0){for(let _=0;_<I.length;_++)if(Y.length>0)Y.pop()}let W=!1;if(!J&&z===Z.length-1&&!G.endsWith(" |")&&!G.endsWith(";"))W=!0;if(G==="}"){if([...Y].reverse().find((y)=>y.isArray)?.isSingleElement)W=!1}if(G.endsWith(" |"))W=!1;return`${H}${G}${W?" |":""}`}).filter(Boolean).join("\n")}function K$(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 H=G.trim().replace(/\s*as\s*const\s*$/,"").trim();return t1(H,$)});if(H$(z))return`readonly [\n${z.map((H,N)=>s1(H," ",N===z.length-1)).join("\n")}\n ]`;return`readonly [${z.join(", ")}]`}let Q=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 H=f1(G);return H?`(${H})`:"((...args: any[]) => unknown)"}else return W$(G)}).filter(Boolean);if(Q.some((z)=>z.includes("\n")||z.includes("{")||z.length>40||Q.join(" | ").length>60)&&J)return`Array<\n${Q.map((G,H)=>s1(G," ",H===Q.length-1)).join("\n")}\n >`;return`Array<${Q.join(" | ")}>`}function $1(q,$,J=0){let Z=Q$(q);if(!Z)return"Record<string, unknown>";let Y=" ".repeat(J),j=" ".repeat(J+1),X=Y,Q=v$(Z,$,J);if(!Q.length)return"{}";return`{\n${Q.map(({key:z,value:G})=>{return`${j}${z}: ${G}`}).join(";\n")}\n${X}}`}function t1(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((X)=>{let Q=X.trim();if(Q.includes("] as cons")||Q.includes("] as const"))Q=Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").trim();if(Q.startsWith("["))return t1(Q,$);if(Q.startsWith("{"))return $1(Q,$).replace(/^\{/,"{ readonly").replace(/;\s+/g,"; readonly ");if(/^['"`].*['"`]$/.test(Q))return`'${Q.replace(/^['"`]|['"`]$/g,"")}'`;if(!Number.isNaN(Number(Q)))return Q;if(Q==="true"||Q==="false")return Q;return`'${Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}).join(", ")}]`}return`'${q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}function B$(q,$){if(q.startsWith("{"))return $1(q,$);if(q.startsWith("["))return w1(q,$,!0);return q}function w$(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 e1(q){return q.trim().startsWith("export default")}function M$(q){if(V$(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 V$(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 N$(q){if(!q.includes("&"))return!1;let $=q.split("&").map((Y)=>Y.trim());if($.length!==2)return!1;let J=$[1];if(!J.startsWith("{")||!J.endsWith("}"))return!1;return J.slice(1,-1).trim().includes("__brand")}function U8(q){return/^\s*\(.*\)\s*=>\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/.test(q.trim())}function z8(q){let J=(Array.isArray(q)?q.join("\n"):q).replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim();return/;\s*$/.test(J)||/\}\s*$/.test(J)}function q0(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 H$(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=q.filter((X)=>{let Q=X.trim();return!Q.startsWith("/*")&&!Q.startsWith("*")&&!Q.startsWith("//")});if(Z.length===0)return;let Y=Z.join("\n"),j=z$(Y).trim();if(w("block-processing",`Full block content:\n${j}`),!j){w("block-processing","Empty declaration block");return}if(q0(j,J)){w("block-processing","Skipping variable declaration inside function");return}if(N$(j)){let X=E1(Y,j.startsWith("export"));J.dtsLines.push(X);return}if(j.startsWith("interface")||j.startsWith("export interface")){if(w("block-processing","Processing interface declaration using interface block processor"),O$(j,Y,J)){w("block-processing","Interface successfully processed");return}}if(j.includes("\n\nexport function")||j.includes("\n\nfunction")){let X=m$(j);if(X.length>1){w("block-processing",`Found ${X.length} function declarations to process`),X.forEach((Q)=>{let U=Q.split("\n");R1(U,$,J)});return}}if(_$(j,J))return;if(I$(j,q,J))return;if(R$(j,Y,J))return;if(P$(j,J))return;if(f$(j,J))return;if(E$(j,Y,J))return;if(x$(j,Y,J))return;w("processing",`Unhandled declaration type: ${j.split("\n")[0]}`)}function I$(q,$,J){if(!q.match(/^(?:export\s+)?(const|let|var)\s+/))return!1;if(q0(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 _$(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=k$(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 X=q.slice(0,Z).trim();w("signature-extraction",`Extracted signature: ${X}`);let Q=X.startsWith("export"),U=P1(X,$.usedTypes,Q);if(U)w("function-processed",`Generated declaration: ${U}`),$.dtsLines.push(U);return!0}function O$(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,X=[],Q=!0,U=!1;w("interface-processing",`Processing ${Z.length} lines`);for(let N=0;N<Z.length;N++){let I=Z[N],W=I.trim(),_=(I.match(/\{/g)||[]).length,y=(I.match(/\}/g)||[]).length,A=(I.match(/</g)||[]).length,E=(I.match(/>/g)||[]).length;if(Y+=_-y,j+=A-E,W.includes("{"))U=!0;if(w("interface-depth",`Line ${N+1}: "${W}" Bracket depth: ${Y}, Angle depth: ${j}, Has started body: ${U}`),Q){let m=W.startsWith("export")?"export declare":"declare";X.push(I.replace(/^(\s*)(?:export\s+)?interface/,`\$1${m} interface`)),Q=!1}else X.push(I)}let z=X.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 R$(q,$,J){if(!q.startsWith("type")&&!q.startsWith("export type"))return!1;let Z=q.startsWith("export");return J.dtsLines.push(E1($,Z)),!0}function P$(q,$){if(!e1(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 f$(q,$){if(!q.startsWith("export *"))return!1;return $.exportAllStatements.push(q),$.dtsLines.push(q),!0}function E$(q,$,J){if(!q.startsWith("export"))return!1;if(S$(q,J))return!0;if(T$(q,J))return!0;if(y$(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 A$(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[X,Q]=j.trim().split(/\s+as\s+/).map((U)=>U.trim());if(X.startsWith("type ")){let U=X.replace(/^type\s+/,"").trim(),z=Q||U;if($.importTracking.exportedTypes.add(z),Y)$.importTracking.typeExportSources.set(z,Y);w("export-type-processed",`Added exported type: ${z}`)}else{let U=Q||X;$.importTracking.exportedValues.add(U),w("export-value-processed",`Added exported value: ${U}`)}})}function S$(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 T$(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 y$(q,$){if(!q.startsWith("export namespace"))return!1;let J=`export declare ${q.replace(/^export\s+/,"")}`;return $.dtsLines.push(J),!0}function x$(q,$,J){if(!q.startsWith("declare module"))return!1;let Z=Z0($);return J.dtsLines.push(Z),!0}function G8(q,$,J){if(e1(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=b$($,q.startsWith("export"));J.dtsLines.push(Z);return}if(q.startsWith("type")||q.startsWith("export type")){let Z=E1($,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 C$(q,$){let J=q.split("\n"),Z=[],Y=[],j=0,X=0,Q=!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 "))$0(z,$.importTracking),w("import",`Processed import: ${z}`);if(G.startsWith("export type {")){w("type-export",`Found type export: ${G}`),D$(G,$),$.dtsLines.push(z);continue}if(G.startsWith("export {")){w("mixed-export",`Found mixed export: ${G}`),A$(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 H=(z.match(/\{/g)||[]).length,N=(z.match(/\}/g)||[]).length,I=(z.match(/</g)||[]).length,W=(z.match(/>/g)||[]).length;if(!Q&&M$(G)){w("declaration",`Found declaration start: ${G}`),Q=!0,Z=[z],j=H-N,X=I-W;continue}if(Q){Z.push(z),j+=H-N,X+=I-W;let _=j===0&&X===0&&G.endsWith("}"),y=U<J.length-1?J[U+1]?.trim():"";if(!(j>0||X>0||y&&!y.startsWith("export")&&!y.startsWith("interface"))||_)w("declaration-complete",`Declaration complete at line ${U+1}`),R1(Z,Y,$),Z=[],Y=[],Q=!1,j=0,X=0}}if(Z.length>0)R1(Z,Y,$)}function $0(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,X]=J,Q=Y||j;if(w("import-type",`Found type imports from ${X}: ${Q}`),!$.typeImports.has(X))$.typeImports.set(X,new Set);if(Q)Q.split(",").forEach((U)=>{let[z,G]=U.trim().split(/\s+as\s+/).map((H)=>H.trim());if($.typeImports.get(X).add(z),$.typeExportSources.set(z,X),w("import-type-tracking",`Tracking type ${z} from ${X}`),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((X)=>{let[Q,U]=X.trim().split(/\s+as\s+/).map((z)=>z.trim());if(Q.startsWith("type ")){let z=Q.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(Q),$.importSources.set(Q,j),U){if($.valueAliases.set(U,Q),U===$.defaultExportValue)$.usedValues.add(Q);$.valueImports.get(j).add(Q),w("import-alias",`Registered value alias: ${Q} as ${U}`)}})}}function E1(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 D$(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[X,Q]=j.trim().split(/\s+as\s+/).map((z)=>z.trim()),U=Q||X;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[,H,N]=Y;return`${$?"export ":""}declare ${Z} ${H}: ${N.trim()};`}let j=q.match(/(?:export\s+)?(?:const|let|var)\s+([^=\s]+)\s*=\s*([\s\S]+)$/);if(!j)return q;let[,X,Q]=j,U=Q.trim(),z=U.match(/^\(\s*.*?\)\s*:\s*([^=>\s{]).*=>/);if(z){let H=z[1];return`${$?"export ":""}declare ${Z} ${X}: ${H};`}let G;if(U.includes("as const")){let H=U.replace(/\s*as\s*const\s*$/,"");G=B$(H,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=K$(U);return`${$?"export ":""}declare ${Z} ${X}: ${G};`}function P1(q,$,J=!0){w("process-function-start",`Starting to process: ${q}`);let Z=q.split("\n").map((Q)=>Q.trim()).join(" ").replace(/\s+/g," ").replace(/;$/,"");w("process-function-normalized",`Normalized declaration: ${Z}`);let Y=$$(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 X=[J?"export ":"","declare function ",Y.name,Y.generics,`(${Y.params})`,Y.returnType?`: ${Y.returnType}`:"",";"].filter(Boolean).join("");return w("process-function-final",`Final declaration: ${X}`),X}function L$(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 k$(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 X="";if(Y.startsWith("(")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="(")U++;if(Y[z]===")")U--}X=Y.slice(1,z-1).trim(),Y=Y.slice(z).trim()}let Q="any";if(Y.startsWith(":")){Y=Y.slice(1).trim();let U=Y.match(/([^{;]+)/);if(U)Q=U[1].trim()}return["export declare function ",Z,j?`${j}`:"",`(${X})`,": ",Q].filter(Boolean).join("").concat(";")}function b$(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,X)=>{let Q=j.trim();if(!Q)return"";if(Q.startsWith("}"))Z--;let U=" ".repeat(Math.max(0,Z)),z=X===0?Q:`${U}${Q}`;if(Q.endsWith("{"))Z++;if(Q.includes("}")&&Q.includes("{"))Z=Math.max(0,Z);return z}).join("\n")}function n1(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,X="void"]=J,Q=X.trim();if(/^async\s+/.test(q)&&!/^Promise<.*>$/.test(Q))Q=`Promise<${Q}>`;let z=O1(j||""),G=[Y?`${Y}`:"",`(${z})`,"=>",Q].filter(Boolean).join(" ").trim();return{name:Z,signature:G}}function v$(q,$,J=0){let Z=[],Y=q.slice(1,-1).trim();if(!Y)return Z;let j="",X=0,Q=!1,U="",z="",G=!0,H=!1;for(let N=0;N<Y.length;N++){let I=Y[N],W=N>0?Y[N-1]:"";if((I==='"'||I==="\'"||I==="`")&&W!=="\\"){if(!Q)Q=!0,U=I;else if(I===U)Q=!1}if(!Q){if(I==="{"||I==="["||I==="(")X++;else if(I==="}"||I==="]"||I===")")X--;else if(X===0){if(I===":"&&!H){H=!0,z=j.trim(),j="",G=!1;continue}else if((I===","||I===";")&&!G){if(z){let _=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:A,signature:E}=n1(z);Z.push({key:A,value:E})}else{let A=r1(_,J+1,$);Z.push({key:o1(z),value:A})}}j="",z="",G=!0,H=!1;continue}}}j+=I}if(z&&!G&&j.trim()){let N=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:W,signature:_}=n1(z);Z.push({key:W,value:_})}else{let W=r1(N,J+1,$);Z.push({key:o1(z),value:W})}}return Z}function r1(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 g$(q,$){let J=/(?:extends|implements|:|<)\s*([A-Z][a-zA-Z0-9]*(?:<[^>]+>)?)/g,Z=/(?:^|[\s<,])\s*([A-Z][a-zA-Z0-9]*)(?:[<>,\s]|$)/g,Y;while((Y=J.exec(q))!==null){let X=Y[1].split("<")[0];$.usedTypes.add(X)}while((Y=Z.exec(q))!==null){let X=Y[1];$.usedTypes.add(X)}let j=/Partial<([^>]+)>/g;while((Y=j.exec(q))!==null){let X=Y[1].trim();if(/^[A-Z]/.test(X))$.usedTypes.add(X)}}function h$(q,$){let J=q.match(/export\s*\{([^}]+)\}/);if(J)J[1].split(",").map((j)=>j.trim()).forEach((j)=>{let[X]=j.split(/\s+as\s+/);$.exportedValues.add(X.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((Q)=>Q.trim()).forEach((Q)=>{if(!["type","interface","declare","extends","implements","function","const","let","var"].includes(Q))$.usedValues.add(Q)})}}function w(q,$){if(q1.verbose)console.debug(`[dtsx:${q}] ${$}`)}function u$(q){return q.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function o1(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 Q=0;Q<q.length;Q++){let U=q[Q],z=Q>0?q[Q-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 X=J.trim();if(X)$.push(X);return $}function m$(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 iZ,rm as sZ}from"fs/promises";import{dirname as nZ,join as rZ,parse as oZ,relative as aZ}from"path";import tZ from"process";var Lq=K1(xq(),1),u1=K1(U1(),1),kq=K1(U1(),1);import Dq,{posix as W1}from"path";var LZ=/\\(?![()[\]{}!+@])/g;function kZ(q){return bq(q)}function bZ(q){return vq(q).replace(LZ,"/")}var v8=process.platform==="win32"?bZ:kZ,vZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,gZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,bq=(q)=>q.replace(vZ,"\\$&"),vq=(q)=>q.replace(gZ,"\\$&"),g8=process.platform==="win32"?vq:bq;function hZ(q,$){if(($==null?void 0:$.caseSensitiveMatch)===!1)return!0;let J=kq.default.scan(q);return J.isGlob||J.negated}function h1(q,$,J,Z,Y){var j;let X=q;if(q.endsWith("/"))X=q.slice(0,-1);if(!X.endsWith("*")&&$)X+="/**";if(Dq.isAbsolute(X.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))X=W1.relative(J,X);else X=W1.normalize(X);let Q=/^(\/?\.\.)+/.exec(X);if(Q==null?void 0:Q[0]){let U=W1.join(J,Q[0]);if(Z.root.length>U.length)Z.root=U,Z.depthOffset=-(Q[0].length+1)/3}else if(!Y&&Z.depthOffset>=0){let U=X.split("/");(j=Z.commonPath)!=null||(Z.commonPath=U);let z=[];for(let G=0;G<Math.min(Z.commonPath.length,U.length);G++){let H=U[G];if(H==="**"&&!U[G+1]){z.pop();break}if(H!==Z.commonPath[G]||hZ(H)||G===U.length-1)break;z.push(H)}Z.depthOffset=z.length,Z.commonPath=z,Z.root=z.length>0?`${J}/${z.join("/")}`:J}return X}function uZ({patterns:q,ignore:$=[],expandDirectories:J=!0},Z,Y){if(typeof q==="string")q=[q];else if(!q)q=["**/*"];if(typeof $==="string")$=[$];let j=[],X=[];for(let Q of $)if(!Q.startsWith("!")||Q[1]==="("){let U=h1(Q,J,Z,Y,!0);X.push(U)}for(let Q of q)if(!Q.startsWith("!")||Q[1]==="("){let U=h1(Q,J,Z,Y,!1);j.push(U)}else if(Q[1]!=="!"||Q[2]==="("){let U=h1(Q.slice(1),J,Z,Y,!0);X.push(U)}return{match:j,ignore:X}}function m1(q,$,J){return W1.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 m1(j,$,J)}function mZ(q,$,J){let Z={root:$,commonPath:null,depthOffset:0},Y=uZ(q,$,Z),j=u1.default(Y.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:Y.ignore}),X=u1.default(Y.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),Q={filters:[(z,G)=>j(Cq(z,$,Z.root,G,q.absolute))],exclude:(z,G)=>X(Cq(G,$,Z.root,!0,!0)),pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0};if(q.deep)Q.maxDepth=Math.round(q.deep-Z.depthOffset);if(q.absolute)Q.relativePaths=!1,Q.resolvePaths=!0,Q.includeBasePath=!0;if(q.followSymbolicLinks===!1)Q.resolveSymlinks=!1,Q.excludeSymlinks=!0;if(q.onlyDirectories)Q.excludeFiles=!0,Q.includeDirs=!0;else if(q.onlyFiles===!1)Q.includeDirs=!0;Z.root=Z.root.replace(/\\/g,"");let U=new Lq.fdir(Q).crawl(Z.root);if($===Z.root||q.absolute)return J?U.sync():U.withPromise();return J?U.sync().map((z)=>m1(z,$,Z.root)+(!z||z.endsWith("/")?"/":"")):U.withPromise().then((z)=>z.map((G)=>m1(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 mZ(J,Z,!1)}import{readdir as dZ}from"fs/promises";import{dirname as cZ,extname as lZ,isAbsolute as pZ,join as mq,resolve as hq}from"path";import dq from"process";import{pathToFileURL as d1}from"url";async function cq(q,$){await Bun.write(q,$)}async function c1(q){let $=q??q1.root,J=await dZ($,{withFileTypes:!0}),Z=await Promise.all(J.map((Y)=>{let j=mq($,Y.name);return Y.isDirectory()?c1(j):j}));return Array.prototype.concat(...Z).filter((Y)=>lZ(Y)===".ts")}async function lq(q){try{let $=q?.cwd||dq.cwd(),J=q?.tsconfigPath||mq($,"tsconfig.json"),Y=await import(d1(J).href);if(Y.compilerOptions?.isolatedDeclarations===!0)return!0;if(Y.extends){let j=uq(J,Y.extends),X=j.endsWith(".json")?j:`${j}.json`,U=await import(d1(X).href);if(U.compilerOptions?.isolatedDeclarations===!0)return!0;if(U.extends){let z=uq(X,U.extends),G=z.endsWith(".json")?z:`${z}.json`;if((await import(d1(G).href)).compilerOptions?.isolatedDeclarations===!0)return!0}}return!1}catch($){return!1}}function uq(q,$){if(pZ($))return $;if($.startsWith("."))return hq(cZ(q),$);return hq(dq.cwd(),"node_modules",$)}async function eZ(q){try{if(!await lq(q)){console.error("Error: isolatedDeclarations must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await sZ(q.outdir,{recursive:!0,force:!0});let J=q?.cwd||tZ.cwd(),Z;if(q?.entrypoints)Z=await gq(q.entrypoints,{cwd:q.root??`${J}/src`,absolute:!0});else Z=await c1(q?.root??`${J}/src`);for(let Y of Z){let j=await a1(Y);if(j){let X=aZ(q?.root??"./src",Y),Q=oZ(X),U=rZ(q?.outdir??"./dist",`${Q.name}.d.ts`);await iZ(nZ(U),{recursive:!0}),await cq(U,j)}else console.warn(`No declarations extracted for ${Y}`)}}catch($){console.error("Error generating declarations:",$)}}async function e8(q){await eZ({...q1,...q})}export{cq as writeToFile,G8 as processSpecificDeclaration,U8 as isFunctionType,z8 as isDeclarationComplete,c1 as getAllTypeScriptFiles,eZ as generateDeclarationsFromFiles,e8 as generate,q$ as extractDtsTypes,a1 as extract,q1 as config,lq as checkIsolatedDeclarations};
2
+ var sq=Object.create;var{getPrototypeOf:nq,defineProperty:l1,getOwnPropertyNames:rq}=Object;var oq=Object.prototype.hasOwnProperty;var K1=(q,$,J)=>{J=q!=null?sq(nq(q)):{};let Z=$||!q||!q.__esModule?l1(J,"default",{value:q,enumerable:!0}):J;for(let Y of rq(q))if(!oq.call(Z,Y))l1(Z,Y,{get:()=>q[Y],enumerable:!0});return Z};var y=(q,$)=>()=>($||q(($={exports:{}}).exports,$),$.exports);var S1=y((Q0)=>{Object.defineProperty(Q0,"__esModule",{value:!0});Q0.normalizePath=Q0.convertSlashes=Q0.cleanPath=void 0;var A1=import.meta.require("path");function j0(q){let $=A1.normalize(q);if($.length>1&&$[$.length-1]===A1.sep)$=$.substring(0,$.length-1);return $}Q0.cleanPath=j0;var d$=/[\\/]/g;function X0(q,$){return q.replace(d$,$)}Q0.convertSlashes=X0;function c$(q,$){let{resolvePaths:J,normalizePath:Z,pathSeparator:Y}=$,j=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if(J)q=A1.resolve(q);if(Z||j)q=j0(q);if(q===".")return"";let X=q[q.length-1]!==Y;return X0(X?q+Y:q,Y)}Q0.normalizePath=c$});var K0=y((G0)=>{Object.defineProperty(G0,"__esModule",{value:!0});G0.build=G0.joinDirectoryPath=G0.joinPathWithBasePath=void 0;var i$=import.meta.require("path"),s$=S1();function z0(q,$){return $+q}G0.joinPathWithBasePath=z0;function n$(q,$){return function(J,Z){if(Z.startsWith(q))return Z.replace(q,"")+J;else return s$.convertSlashes(i$.relative(q,Z),$.pathSeparator)+$.pathSeparator+J}}function r$(q){return q}function o$(q,$,J){return $+q+J}G0.joinDirectoryPath=o$;function a$(q,$){let{relativePaths:J,includeBasePath:Z}=$;return J&&q?n$(q,$):Z?z0:r$}G0.build=a$});var M0=y((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.build=void 0;function qJ(q){return function($,J){J.push($.substring(q.length)||".")}}function $J(q){return function($,J,Z){let Y=$.substring(q.length)||".";if(Z.every((j)=>j(Y,!0)))J.push(Y)}}var JJ=(q,$)=>{$.push(q||".")},ZJ=(q,$,J)=>{let Z=q||".";if(J.every((Y)=>Y(Z,!0)))$.push(Z)},YJ=()=>{};function jJ(q,$){let{includeDirs:J,filters:Z,relativePaths:Y}=$;if(!J)return YJ;if(Y)return Z&&Z.length?$J(q):qJ(q);return Z&&Z.length?ZJ:JJ}B0.build=jJ});var H0=y((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.build=void 0;var XJ=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))J.files++},QJ=(q,$,J,Z)=>{if(Z.every((Y)=>Y(q,!1)))$.push(q)},UJ=(q,$,J,Z)=>{J.files++},zJ=(q,$)=>{$.push(q)},GJ=()=>{};function FJ(q){let{excludeFiles:$,filters:J,onlyCounts:Z}=q;if($)return GJ;if(J&&J.length)return Z?XJ:QJ;else if(Z)return UJ;else return zJ}V0.build=FJ});var _0=y((W0)=>{Object.defineProperty(W0,"__esModule",{value:!0});W0.build=void 0;var KJ=(q)=>{return q},BJ=()=>{return[""].slice(0,0)};function wJ(q){return q.group?BJ:KJ}W0.build=wJ});var P0=y((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.build=void 0;var MJ=(q,$,J)=>{q.push({directory:$,files:J,dir:$})},VJ=()=>{};function NJ(q){return q.group?MJ:VJ}O0.build=NJ});var A0=y((J1)=>{var HJ=J1&&J1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(J1,"__esModule",{value:!0});J1.build=void 0;var M1=HJ(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,X)=>{if(j)return Z.dequeue(Y?null:j,$);M1.default.stat(X,(Q,U)=>{if(Q)return Z.dequeue(Y?null:Q,$);if(U.isDirectory()&&E0(q,X,$))return Z.dequeue(null,$);J(U,X),Z.dequeue(null,$)})})},IJ=function(q,$,J){let{queue:Z,options:{suppressErrors:Y}}=$;Z.enqueue();try{let j=M1.default.realpathSync(q),X=M1.default.statSync(j);if(X.isDirectory()&&E0(q,j,$))return;J(X,j)}catch(j){if(!Y)throw j}};function _J(q,$){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return $?IJ:WJ}J1.build=_J;function E0(q,$,J){if(J.options.useRealPaths)return OJ($,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 OJ(q,$){return $.visited.includes(q+$.options.pathSeparator)}});var y0=y((S0)=>{Object.defineProperty(S0,"__esModule",{value:!0});S0.build=void 0;var RJ=(q)=>{return q.counts},PJ=(q)=>{return q.groups},fJ=(q)=>{return q.paths},EJ=(q)=>{return q.paths.slice(0,q.options.maxFiles)},AJ=(q,$,J)=>{return V1($,J,q.counts,q.options.suppressErrors),null},SJ=(q,$,J)=>{return V1($,J,q.paths,q.options.suppressErrors),null},TJ=(q,$,J)=>{return V1($,J,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},yJ=(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 xJ(q,$){let{onlyCounts:J,group:Z,maxFiles:Y}=q;if(J)return $?RJ:AJ;else if(Z)return $?PJ:yJ;else if(Y)return $?EJ:TJ;else return $?fJ:SJ}S0.build=xJ});var D0=y((Z1)=>{var CJ=Z1&&Z1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(Z1,"__esModule",{value:!0});Z1.build=void 0;var x0=CJ(import.meta.require("fs")),C0={withFileTypes:!0},DJ=(q,$,J,Z,Y)=>{if(Z<0)return q.queue.dequeue(null,q);q.visited.push($),q.counts.directories++,q.queue.enqueue(),x0.default.readdir($||".",C0,(j,X=[])=>{Y(X,J,Z),q.queue.dequeue(q.options.suppressErrors?null:j,q)})},LJ=(q,$,J,Z,Y)=>{if(Z<0)return;q.visited.push($),q.counts.directories++;let j=[];try{j=x0.default.readdirSync($||".",C0)}catch(X){if(!q.options.suppressErrors)throw X}Y(j,J,Z)};function kJ(q){return q?LJ:DJ}Z1.build=kJ});var v0=y((k0)=>{Object.defineProperty(k0,"__esModule",{value:!0});k0.Queue=void 0;class L0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,$){if(--this.count<=0||q)this.onQueueEmpty(q,$)}}k0.Queue=L0});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 bJ=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]}),vJ=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))bJ($,q,J)}return vJ($,q),$};Object.defineProperty(i,"__esModule",{value:!0});i.Walker=void 0;var d0=import.meta.require("path"),T1=S1(),y1=a(K0()),gJ=a(M0()),hJ=a(H0()),uJ=a(_0()),mJ=a(P0()),dJ=a(A0()),cJ=a(y0()),lJ=a(D0()),pJ=v0(),iJ=m0();class c0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,$,J){this.isSynchronous=!J,this.callbackInvoker=cJ.build($,this.isSynchronous),this.root=T1.normalizePath(q,$),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new iJ.Counter,options:$,queue:new pJ.Queue((Z,Y)=>this.callbackInvoker(Y,Z,J)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=y1.build(this.root,$),this.pushDirectory=gJ.build(this.root,$),this.pushFile=hJ.build($),this.getArray=uJ.build($),this.groupFiles=mJ.build($),this.resolveSymlink=dJ.build($,this.isSynchronous),this.walkDirectory=lJ.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:X,exclude:Q,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 I=0;I<q.length;++I){let W=q[I];if(W.isFile()||W.isSymbolicLink()&&!j&&!X){let _=this.joinPath(W.name,$);this.pushFile(_,H,this.state.counts,Y)}else if(W.isDirectory()){let _=y1.joinDirectoryPath(W.name,$,this.state.options.pathSeparator);if(Q&&Q(W.name,_))continue;this.walkDirectory(this.state,_,_,J-1,this.walk)}else if(W.isSymbolicLink()&&this.resolveSymlink){let _=y1.joinPathWithBasePath(W.name,$);this.resolveSymlink(_,this.state,(D,E)=>{if(D.isDirectory()){if(E=T1.normalizePath(E,this.state.options),Q&&Q(W.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 sJ=x1();function nJ(q,$){return new Promise((J,Z)=>{l0(q,$,(Y,j)=>{if(Y)return Z(Y);J(j)})})}p0.promise=nJ;function l0(q,$,J){new sJ.Walker(q,$,J).start()}p0.callback=l0});var o0=y((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.sync=void 0;var oJ=x1();function aJ(q,$){return new oJ.Walker(q,$).start()}n0.sync=aJ});var $q=y((e0)=>{Object.defineProperty(e0,"__esModule",{value:!0});e0.APIBuilder=void 0;var a0=s0(),tJ=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 tJ.sync(this.root,this.options)}}e0.APIBuilder=t0});var j1=y((A8,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:"/"},eJ={...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:"\\"},qZ={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:qZ,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?eJ:Jq}}});var X1=y((jZ)=>{var{REGEX_BACKSLASH:$Z,REGEX_REMOVE_BACKSLASH:JZ,REGEX_SPECIAL_CHARS:ZZ,REGEX_SPECIAL_CHARS_GLOBAL:YZ}=j1();jZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);jZ.hasRegexChars=(q)=>ZZ.test(q);jZ.isRegexChar=(q)=>q.length===1&&jZ.hasRegexChars(q);jZ.escapeRegex=(q)=>q.replace(YZ,"\\$1");jZ.toPosixSlashes=(q)=>q.replace($Z,"/");jZ.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};jZ.removeBackslashes=(q)=>{return q.replace(JZ,($)=>{return $==="\\"?"":$})};jZ.escapeLast=(q,$,J)=>{let Z=q.lastIndexOf($,J);if(Z===-1)return q;if(q[Z-1]==="\\")return jZ.escapeLast(q,$,Z-1);return`${q.slice(0,Z)}\\${q.slice(Z)}`};jZ.removePrefix=(q,$={})=>{let J=q;if(J.startsWith("./"))J=J.slice(2),$.prefix="./";return J};jZ.wrapOutput=(q,$={},J={})=>{let Z=J.contains?"":"^",Y=J.contains?"":"$",j=`${Z}(?:${q})${Y}`;if($.negated===!0)j=`(?:^(?!${j}).*\$)`;return j};jZ.basename=(q,{windows:$}={})=>{let J=q.split($?/[\\/]/:"/"),Z=J[J.length-1];if(Z==="")return J[J.length-2];return Z}});var Bq=y((T8,Kq)=>{var Xq=X1(),{CHAR_ASTERISK:C1,CHAR_AT:MZ,CHAR_BACKWARD_SLASH:Q1,CHAR_COMMA:VZ,CHAR_DOT:D1,CHAR_EXCLAMATION_MARK:L1,CHAR_FORWARD_SLASH:Fq,CHAR_LEFT_CURLY_BRACE:k1,CHAR_LEFT_PARENTHESES:b1,CHAR_LEFT_SQUARE_BRACKET:NZ,CHAR_PLUS:HZ,CHAR_QUESTION_MARK:Qq,CHAR_RIGHT_CURLY_BRACE:WZ,CHAR_RIGHT_PARENTHESES:Uq,CHAR_RIGHT_SQUARE_BRACKET:IZ}=j1(),zq=(q)=>{return q===Fq||q===Q1},Gq=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},_Z=(q,$)=>{let J=$||{},Z=q.length-1,Y=J.parts===!0||J.scanToEnd===!0,j=[],X=[],Q=[],U=q,z=-1,G=0,V=0,H=!1,I=!1,W=!1,_=!1,D=!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 S;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===D1&&(O=b())===D1){if(H=P.isBrace=!0,W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(E!==!0&&O===VZ){if(H=P.isBrace=!0,W=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),X.push(P),P={value:"",depth:0,isGlob:!1},h===!0)continue;if(c===D1&&z===G+1){G+=2;continue}V=z+1;continue}if(J.noext!==!0){if((O===HZ||O===MZ||O===C1||O===Qq||O===L1)===!0&&d()===b1){if(W=P.isGlob=!0,_=P.isExtglob=!0,h=!0,O===L1&&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){W=P.isGlob=!0,h=!0;break}}continue}break}}if(O===C1){if(c===C1)D=P.isGlobstar=!0;if(W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===Qq){if(W=P.isGlob=!0,h=!0,Y===!0)continue;break}if(O===NZ){while(B()!==!0&&(S=b())){if(S===Q1){A=P.backslashes=!0,b();continue}if(S===IZ){I=P.isBracket=!0,W=P.isGlob=!0,h=!0;break}}if(Y===!0)continue;break}if(J.nonegate!==!0&&O===L1&&z===G){m=P.negated=!0,G++;continue}if(J.noparen!==!0&&O===b1){if(W=P.isGlob=!0,Y===!0){while(B()!==!0&&(O=b())){if(O===b1){A=P.backslashes=!0,O=b();continue}if(O===Uq){h=!0;break}}continue}break}if(W===!0){if(h=!0,Y===!0)continue;break}}if(J.noext===!0)_=!1,W=!1;let L=U,F="",K="";if(G>0)F=U.slice(0,G),U=U.slice(G),V-=G;if(L&&W===!0&&V>0)L=U.slice(0,V),K=U.slice(V);else if(W===!0)L="",K=U;else L=U;if(L&&L!==""&&L!=="/"&&L!==U){if(zq(L.charCodeAt(L.length-1)))L=L.slice(0,-1)}if(J.unescape===!0){if(K)K=Xq.removeBackslashes(K);if(L&&A===!0)L=Xq.removeBackslashes(L)}let l={prefix:F,input:q,start:G,base:L,glob:K,isBrace:H,isBracket:I,isGlob:W,isExtglob:_,isGlobstar:D,negated:m,negatedExtglob:t};if(J.tokens===!0){if(l.maxDepth=0,!zq(O))X.push(P);l.tokens=X}if(J.parts===!0||J.tokens===!0){let S;for(let x=0;x<j.length;x++){let n=S?S+1:G,p=j[x],o=q.slice(n,p);if(J.tokens){if(x===0&&G!==0)X[x].isPrefix=!0,X[x].value=F;else X[x].value=o;Gq(X[x]),l.maxDepth+=X[x].depth}if(x!==0||o!=="")Q.push(o);S=p}if(S&&S+1<q.length){let x=q.slice(S+1);if(Q.push(x),J.tokens)X[X.length-1].value=x,Gq(X[X.length-1]),l.maxDepth+=X[X.length-1].depth}l.slashes=j,l.parts=Q}return l};Kq.exports=_Z});var Vq=y((y8,Mq)=>{var N1=j1(),s=X1(),{MAX_LENGTH:H1,POSIX_REGEX_SOURCE:OZ,REGEX_NON_SPECIAL_CHARS:RZ,REGEX_SPECIAL_CHARS_BACKREF:PZ,REPLACEMENTS:wq}=N1,fZ=(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`},v1=(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||""},X=[j],Q=J.capture?"":"?:",U=N1.globChars(J.windows),z=N1.extglobChars(U),{DOT_LITERAL:G,PLUS_LITERAL:V,SLASH_LITERAL:H,ONE_CHAR:I,DOTS_SLASH:W,NO_DOT:_,NO_DOT_SLASH:D,NO_DOTS_SLASH:E,QMARK:A,QMARK_NO_DOT:m,STAR:t,START_ANCHOR:h}=U,g=(N)=>{return`(${Q}(?:(?!${h}${N.dot?W: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:X};q=s.removePrefix(q,B),Y=q.length;let d=[],b=[],L=[],F=j,K,l=()=>B.index===Y-1,S=B.peek=(N=1)=>q[B.index+N],x=B.advance=()=>q[++B.index]||"",n=()=>q.slice(B.index+1),p=(N="",T=0)=>{B.consumed+=N,B.index+=T},o=(N)=>{B.output+=N.output!=null?N.output:N.value,p(N.value)},pq=()=>{let N=1;while(S()==="!"&&(S(2)!=="("||S(3)==="?"))x(),B.start++,N++;if(N%2===0)return!1;return B.negated=!0,B.start++,!0},z1=(N)=>{B[N]++,L.push(N)},e=(N)=>{B[N]--,L.pop()},f=(N)=>{if(F.type==="globstar"){let T=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"&&!T&&!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,X.push(N),F=N},G1=(N,T)=>{let M={...z[T],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:T,output:B.output?"":I}),f({type:"paren",extglob:!0,value:x(),output:R}),d.push(M)},iq=(N)=>{let T=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()))T=N.close=`)\$))${R}`;if(N.inner.includes("*")&&(M=n())&&/^\.[^\\/.]+$/.test(M)){let C=v1(M,{...$,fastpaths:!1}).output;T=N.close=`)${C})${R})`}if(N.prev.type==="bos")B.negatedExtglob=!0}f({type:"paren",extglob:!0,value:K,output:T}),e("parens")};if(J.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let N=!1,T=q.replace(PZ,(M,R,C,u,v,I1)=>{if(u==="\\")return N=!0,M;if(u==="?"){if(R)return R+u+(v?A.repeat(v.length):"");if(I1===0)return O+(v?A.repeat(v.length):"");return A.repeat(C.length)}if(u===".")return G.repeat(C.length);if(u==="*"){if(R)return R+u+(v?P:"");return P}return R?M:`\\${M}`});if(N===!0)if(J.unescape===!0)T=T.replace(/\\/g,"");else T=T.replace(/\\+/g,(M)=>{return M.length%2===0?"\\\\":M?"\\":""});if(T===q&&J.contains===!0)return B.output=q,B;return B.output=s.wrapOutput(T,B,$),B}while(!l()){if(K=x(),K==="\0")continue;if(K==="\\"){let M=S();if(M==="/"&&J.bash!==!0)continue;if(M==="."||M===";")continue;if(!M){K+="\\",f({type:"text",value:K});continue}let R=/^\\+/.exec(n()),C=0;if(R&&R[0].length>2){if(C=R[0].length,B.index+=C,C%2!==0)K+="\\"}if(J.unescape===!0)K=x();else K+=x();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("["),C=F.value.slice(0,R),u=F.value.slice(R+2),v=OZ[u];if(v){if(F.value=C+v,B.backtrack=!0,x(),!j.output&&X.indexOf(F)===1)j.output=I;continue}}}}if(K==="["&&S()!==":"||K==="-"&&S()==="]")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){iq(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=`(${Q}${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 C=X.slice(),u=[];for(let v=C.length-1;v>=0;v--){if(X.pop(),C[v].type==="brace")break;if(C[v].type!=="dots")u.unshift(C[v].value)}R=fZ(u,J),B.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let C=B.output.slice(0,M.outputIndex),u=B.tokens.slice(M.tokensIndex);M.value=M.output="\\{",K=R="\\}",B.output=C;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&&L[L.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="",X.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&&S()==="("&&S(2)!=="?"){G1("qmark",K);continue}if(F&&F.type==="paren"){let R=S(),C=K;if(F.value==="("&&!/[!=<:]/.test(R)||R==="<"&&!/<([!=]|\w+>)/.test(n()))C=`\\${K}`;f({type:"text",value:K,output:C});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&&S()==="("){if(S(2)!=="?"||!/[!=<:]/.test(S(3))){G1("negate",K);continue}}if(J.nonegate!==!0&&B.index===0){pq();continue}}if(K==="+"){if(J.noextglob!==!0&&S()==="("&&S(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&&S()==="("&&S(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=RZ.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,C=M.type==="slash"||M.type==="bos",u=R&&(R.type==="star"||R.type==="globstar");if(J.bash===!0&&(!C||N[0]&&N[0]!=="/")){f({type:"star",value:K,output:""});continue}let v=B.braces>0&&(M.type==="comma"||M.type==="brace"),I1=d.length&&(M.type==="pipe"||M.type==="paren");if(!C&&M.type!=="paren"&&!v&&!I1){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+x()),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+x()),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 T={type:"star",value:K,output:P};if(J.bash===!0){if(T.output=".*?",F.type==="bos"||F.type==="slash")T.output=c+T.output;f(T);continue}if(F&&(F.type==="bracket"||F.type==="paren")&&J.regex===!0){T.output=K,f(T);continue}if(B.index===B.start||F.type==="slash"||F.type==="dot"){if(F.type==="dot")B.output+=D,F.output+=D;else if(J.dot===!0)B.output+=E,F.output+=E;else B.output+=c,F.output+=c;if(S()!=="*")B.output+=I,F.output+=I}f(T)}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};v1.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:X,ONE_CHAR:Q,DOTS_SLASH:U,NO_DOT:z,NO_DOTS:G,NO_DOTS_SLASH:V,STAR:H,START_ANCHOR:I}=N1.globChars(J.windows),W=J.dot?G:z,_=J.dot?V:z,D=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`(${D}(?:(?!${I}${c.dot?U:j}).)*?)`},t=(c)=>{switch(c){case"*":return`${W}${Q}${A}`;case".*":return`${j}${Q}${A}`;case"*.*":return`${W}${A}${j}${Q}${A}`;case"*/*":return`${W}${A}${X}${Q}${_}${A}`;case"**":return W+m(J);case"**/*":return`(?:${W}${m(J)}${X})?${_}${Q}${A}`;case"**/*.*":return`(?:${W}${m(J)}${X})?${_}${A}${j}${Q}${A}`;case"**/.*":return`(?:${W}${m(J)}${X})?${j}${Q}${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+=`${X}?`;return g};Mq.exports=v1});var Wq=y((x8,Hq)=>{var EZ=Bq(),g1=Vq(),Nq=X1(),AZ=j1(),SZ=(q)=>q&&typeof q==="object"&&!Array.isArray(q),k=(q,$,J=!1)=>{if(Array.isArray(q)){let G=q.map((H)=>k(H,$,J));return(H)=>{for(let I of G){let W=I(H);if(W)return W}return!1}}let Z=SZ(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,X=Z?k.compileRe(q,$):k.makeRe(q,$,!1,!0),Q=X.state;delete X.state;let U=()=>!1;if(Y.ignore){let G={...$,ignore:null,onMatch:null,onResult:null};U=k(Y.ignore,G,J)}let z=(G,V=!1)=>{let{isMatch:H,match:I,output:W}=k.test(G,X,$,{glob:q,posix:j}),_={glob:q,state:Q,regex:X,posix:j,input:G,output:W,match:I,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=Q;return z};k.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||{},X=j.format||(Y?Nq.toPosixSlashes:null),Q=q===Z,U=Q&&X?X(q):q;if(Q===!1)U=X?X(q):q,Q=U===Z;if(Q===!1||j.capture===!0)if(j.matchBase===!0||j.basename===!0)Q=k.matchBase(q,$,J,Y);else Q=$.exec(U);return{isMatch:Boolean(Q),match:Q,output:U}};k.matchBase=(q,$,J)=>{return($ instanceof RegExp?$:k.makeRe($,J)).test(Nq.basename(q))};k.isMatch=(q,$,J)=>k($,J)(q);k.parse=(q,$)=>{if(Array.isArray(q))return q.map((J)=>k.parse(J,$));return g1(q,{...$,fastpaths:!1})};k.scan=(q,$)=>EZ(q,$);k.compileRe=(q,$,J=!1,Z=!1)=>{if(J===!0)return q.output;let Y=$||{},j=Y.contains?"":"^",X=Y.contains?"":"$",Q=`${j}(?:${q.output})${X}`;if(q&&q.negated===!0)Q=`^(?!${Q}).*\$`;let U=k.toRegex(Q,$);if(Z===!0)U.state=q;return U};k.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=g1.fastpaths(q,$);if(!Y.output)Y=g1(q,$);return k.compileRe(Y,$,J,Z)};k.toRegex=(q,$)=>{try{let J=$||{};return new RegExp(q,J.flags||(J.nocase?"i":""))}catch(J){if($&&$.debug===!0)throw J;return/$^/}};k.constants=AZ;Hq.exports=k});var U1=y((C8,Oq)=>{var Iq=Wq(),TZ=X1();function _q(q,$,J=!1){if($&&($.windows===null||$.windows===void 0))$={...$,windows:TZ.isWindows()};return Iq(q,$,J)}Object.assign(_q,Iq);Oq.exports=_q});var Sq=y((Eq)=>{Object.defineProperty(Eq,"__esModule",{value:!0});Eq.Builder=void 0;var yZ=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:yZ.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 yq=y((Tq)=>{Object.defineProperty(Tq,"__esModule",{value:!0})});var xq=y((r)=>{var xZ=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]}),CZ=r&&r.__exportStar||function(q,$){for(var J in q)if(J!=="default"&&!Object.prototype.hasOwnProperty.call($,J))xZ($,q,J)};Object.defineProperty(r,"__esModule",{value:!0});r.fdir=void 0;var DZ=Sq();Object.defineProperty(r,"fdir",{enumerable:!0,get:function(){return DZ.Builder}});CZ(yq(),r)});import eq from"process";import{resolve as aq}from"path";import tq 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 p1({name:q,cwd:$,defaultConfig:J}){let Z=aq($||tq.cwd(),`${q}.config`);try{let Y=await import(Z),j=Y.default||Y;return _1(J,j)}catch(Y){return J}}var q1=await p1({name:"dts",defaultConfig:{cwd:eq.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="",X=!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==="{")X=!0,Z++;if(U==="}")X=!1,Z--;if(U==="<"||U==="(")Z++;if(U===">"||U===")")Z--;if(U===","&&Z===0&&!X){if(J.trim())$.push(i1(J));J="";continue}}J+=U}if(J.trim())$.push(i1(J));let Q=$.join(", ");return w("params",`Cleaned parameters: ${Q}`),Q}function i1(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(),X=`${Z.trim()}: ${j}`;return w("param-clean",`Cleaned to: ${X}`),X}let J=q.match(/^([^=]+)=\s*(.+)$/);if(J){let[,Z,Y]=J,j=w$(Y.trim()),X=`${Z.trim()}: ${j}`;return w("param-clean",`Inferred type: ${X}`),X}return q.trim()}async function a1(q){try{let $=await Bun.file(q).text();return q$($)}catch($){throw console.error("Failed to extract types:",$),new Error("Failed to extract and generate .d.ts file")}}function q$(q){let $=G$();q.split("\n").forEach((Z)=>{if(Z.includes("import "))$0(Z,$.importTracking)}),C$(q,$),$.dtsLines.forEach((Z)=>{if(Z.trim()&&!Z.startsWith("import"))g$(Z,$.importTracking),h$(Z,$.importTracking)});let J=X$($.importTracking);return $.dtsLines=[...J.map((Z)=>`${Z};`),"",...$.dtsLines.filter((Z)=>!Z.trim().startsWith("import"))],U$($)}function $$(q){w("signature-start",`Processing declaration: ${q}`);let $=L$(q);w("signature-clean",`Clean declaration: ${$}`);let J=J$($),Z=$.slice($.indexOf(J)+J.length).trim();w("signature-content",`Content after name: ${Z}`);let{generics:Y,rest:j}=Z$(Z);Z=j.trim(),w("signature-after-generics",`Remaining content: ${Z}`);let{params:X,rest:Q}=Y$(Z);Z=Q.trim(),w("signature-after-params",`Remaining content: ${Z}`);let{returnType:U}=j$(Z);w("signature-return",`Extracted return type: ${U}`);let z={name:J,generics:Y,params:X,returnType:U};return w("signature-final",`Final signature object: ${JSON.stringify(z,null,2)}`),z}function J$(q){let $=q.match(/^(?:export\s+)?(?:async\s+)?function\s*\*?\s*([^(<\s]+)/);if(!$)throw new Error("Invalid function declaration");return $[1]}function Z$(q){let $="";if(q.startsWith("<")){let J=1,Z=0,Y="<",j=!1,X="";w("generics-input",`Starting generic extraction with: ${q}`);for(let Q=1;Q<q.length;Q++){let U=q[Q],z=Q<q.length-1?q[Q+1]:"",G=Q>0?q[Q-1]:"";if(w("generics-char",`Processing char: ${U}, next char: ${z}, depth: ${J}, pos: ${Q}`),(U==='"'||U==="\'"||U==="`")&&G!=="\\"){if(!j)j=!0,X=U,w("generics-string",`Entering string with ${X}`);else if(U===X)j=!1,w("generics-string","Exiting string")}if(!j){if(U==="<")J++,w("generics-depth",`Increasing depth to ${J} at pos ${Q}`);else if(U===">"){if(J--,w("generics-depth",`Decreasing depth to ${J} at pos ${Q}`),J===0&&z===">"){Y+=">>",Z=Q+1,w("generics-complete",`Found double closing bracket at pos ${Q}, final buffer: ${Y}`);break}else if(J===0){Y+=">",Z=Q,w("generics-complete",`Found single closing bracket at pos ${Q}, 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 Y$(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 X=q[Y];if(X==="(")Z++;if(X===")"){if(Z--,Z===0){w("params-depth-zero",`Found closing parenthesis at pos ${Y}`);break}}j+=X}$=j.trim(),q=q.slice(Y+1).trim(),w("signature-params",`Extracted params: ${$}`)}return{params:$,rest:q}}function j$(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,X="",Q=!1;w("return-extraction","Starting character-by-character extraction");while(Y<q.length&&!Q){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,X=U,w("return-string",`Entering string with ${X}`);else if(U===X)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`),Q=!0;break}}}if(J===0&&U===";"){w("return-end","Found semicolon at depth 0"),Q=!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[,I]=H,W=O1(I||""),_=$.match(/\):\s*([^{;]+)(?:[{;]|$)/),D=_?u$(_[1]):"unknown";return`(${W}) => ${D}`}return null}J++;let Y=1,j=J,X=!1,Q="";for(;J<Z;J++){let H=$[J],I=J>0?$[J-1]:"";if(X){if(H===Q&&I!=="\\")X=!1;else if(H==="\\")J++}else if(H==='"'||H==="\'"||H==="`")X=!0,Q=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 I=J;G=$.slice(H,I).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 X$(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((X)=>{let Q=q.exportedTypes.has(X)||q.usedTypes.has(X);return w("import-type-filter",`Type ${X}: exported=${q.exportedTypes.has(X)}, used=${q.usedTypes.has(X)}`),Q}).map((X)=>{let Q=q.valueAliases.get(X);return Q?`${X} as ${Q}`:X}).sort();if(j.length>0){let X=`import type { ${j.join(", ")} } from '${Z}'`;if(!J.has(X))$.push(X),J.add(X),w("import-add-type",`Added type import: ${X}`)}}for(let[Z,Y]of q.valueImports){let j=new Map,X=Array.from(Y).filter((Q)=>{let U=Array.from(q.valueAliases.entries()).find(([G,V])=>V===Q)?.[0],z=q.exportedValues.has(Q)||q.usedValues.has(Q)||Q===q.defaultExportValue||U&&(q.exportedValues.has(U)||U===q.defaultExportValue);if(z&&U)j.set(Q,U);return z}).map((Q)=>{let U=j.get(Q);return U?`${Q} as ${U}`:Q}).sort();if(X.length>0){let Q=`import { ${X.join(", ")} } from '${Z}'`;if(!J.has(Q))$.push(Q),J.add(Q),w("import-add-value",`Added value import: ${Q}`)}}return $.sort()}function Q$(q){let $=q.trim();if(!$.startsWith("{"))return null;let J=0,Z=!1,Y="";for(let j=0;j<$.length;j++){let X=$[j],Q=j>0?$[j-1]:"";if((X==='"'||X==="\'"||X==="`")&&Q!=="\\"){if(!Z)Z=!0,Y=X;else if(X===Y)Z=!1;continue}if(!Z){if(X==="{")J++;else if(X==="}"){if(J--,J===0)return $.slice(0,j+1)}}}return null}function U$(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)=>{if(j.trim().startsWith("/*")||j.trim().startsWith("*")||j.trim().startsWith("//"))return"";let X=j.trim();if(!X)return"";if(X.startsWith("export *")||X.endsWith(";"))return X;if(X.startsWith("export type"))return`${X};`;return X.replace(/;+$/,";")}).filter((j)=>j.trim()),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 z$(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 G$(){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:F$(),defaultExports:new Set,currentScope:"top"}}function F$(){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 s1(q,$,J){let Z=q.split("\n");if(Z.length===1)return`${$}${q}${J?"":" |"}`;let Y=[],j=!1,X=0;return Z.forEach((U)=>{let z=U.trim();if(z.startsWith("Array<"))X=0;if(z==="}"||z.startsWith("> |")||z===">")j=X===1;if(z&&!z.startsWith("Array<")&&!z.endsWith(">")&&!z.startsWith("{")&&!z.endsWith("}"))X++}),Z.map((U,z)=>{let G=U.trim();if(!G)return"";let V=$;if(z>0){let _=Y.reduce((D,E)=>D+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)||[],I=G.match(/[}\]>]/g)||[];if(H.forEach((_)=>{let D=G.startsWith("Array")&&_==="<";Y.push({char:_,indent:V,isArray:D,depth:1,isSingleElement:j})}),I.length>0){for(let _=0;_<I.length;_++)if(Y.length>0)Y.pop()}let W=!1;if(!J&&z===Z.length-1&&!G.endsWith(" |")&&!G.endsWith(";"))W=!0;if(G==="}"){if([...Y].reverse().find((D)=>D.isArray)?.isSingleElement)W=!1}if(G.endsWith(" |"))W=!1;return`${V}${G}${W?" |":""}`}).filter(Boolean).join("\n")}function K$(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 t1(V,$)});if(H$(z))return`readonly [\n${z.map((V,H)=>s1(V," ",H===z.length-1)).join("\n")}\n ]`;return`readonly [${z.join(", ")}]`}let Q=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(Q.some((z)=>z.includes("\n")||z.includes("{")||z.length>40||Q.join(" | ").length>60)&&J)return`Array<\n${Q.map((G,V)=>s1(G," ",V===Q.length-1)).join("\n")}\n >`;return`Array<${Q.join(" | ")}>`}function $1(q,$,J=0){let Z=Q$(q);if(!Z)return"Record<string, unknown>";let Y=" ".repeat(J),j=" ".repeat(J+1),X=Y,Q=v$(Z,$,J);if(!Q.length)return"{}";return`{\n${Q.map(({key:z,value:G})=>{return`${j}${z}: ${G}`}).join(";\n")}\n${X}}`}function t1(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((X)=>{let Q=X.trim();if(Q.includes("] as cons")||Q.includes("] as const"))Q=Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").trim();if(Q.startsWith("["))return t1(Q,$);if(Q.startsWith("{"))return $1(Q,$).replace(/^\{/,"{ readonly").replace(/;\s+/g,"; readonly ");if(/^['"`].*['"`]$/.test(Q))return`'${Q.replace(/^['"`]|['"`]$/g,"")}'`;if(!Number.isNaN(Number(Q)))return Q;if(Q==="true"||Q==="false")return Q;return`'${Q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}).join(", ")}]`}return`'${q.replace(/\]\s*as\s*cons.*$/,"").replace(/\]\s*as\s*const.*$/,"").replace(/^['"`]|['"`]$/g,"").trim()}'`}function B$(q,$){if(q.startsWith("{"))return $1(q,$);if(q.startsWith("["))return w1(q,$,!0);return q}function w$(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 e1(q){return q.trim().startsWith("export default")}function M$(q){if(V$(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 V$(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 N$(q){if(!q.includes("&"))return!1;let $=q.split("&").map((Y)=>Y.trim());if($.length!==2)return!1;let J=$[1];if(!J.startsWith("{")||!J.endsWith("}"))return!1;return J.slice(1,-1).trim().includes("__brand")}function U8(q){return/^\s*\(.*\)\s*=>\s*(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])$/.test(q.trim())}function z8(q){let J=(Array.isArray(q)?q.join("\n"):q).replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim();return/;\s*$/.test(J)||/\}\s*$/.test(J)}function q0(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 H$(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=q.filter((X)=>{let Q=X.trim();return!Q.startsWith("/*")&&!Q.startsWith("*")&&!Q.startsWith("//")});if(Z.length===0)return;let Y=Z.join("\n"),j=z$(Y).trim();if(w("block-processing",`Full block content:\n${j}`),!j){w("block-processing","Empty declaration block");return}if(q0(j,J)){w("block-processing","Skipping variable declaration inside function");return}if(N$(j)){let X=E1(Y,j.startsWith("export"));J.dtsLines.push(X);return}if(j.startsWith("interface")||j.startsWith("export interface")){if(w("block-processing","Processing interface declaration using interface block processor"),O$(j,Y,J)){w("block-processing","Interface successfully processed");return}}if(j.includes("\n\nexport function")||j.includes("\n\nfunction")){let X=m$(j);if(X.length>1){w("block-processing",`Found ${X.length} function declarations to process`),X.forEach((Q)=>{let U=Q.split("\n");R1(U,$,J)});return}}if(_$(j,J))return;if(I$(j,q,J))return;if(R$(j,Y,J))return;if(P$(j,J))return;if(f$(j,J))return;if(E$(j,Y,J))return;if(x$(j,Y,J))return;w("processing",`Unhandled declaration type: ${j.split("\n")[0]}`)}function I$(q,$,J){if(!q.match(/^(?:export\s+)?(const|let|var)\s+/))return!1;if(q0(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 _$(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=k$(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 X=q.slice(0,Z).trim();w("signature-extraction",`Extracted signature: ${X}`);let Q=X.startsWith("export"),U=P1(X,$.usedTypes,Q);if(U)w("function-processed",`Generated declaration: ${U}`),$.dtsLines.push(U);return!0}function O$(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,X=[],Q=!0,U=!1;w("interface-processing",`Processing ${Z.length} lines`);for(let H=0;H<Z.length;H++){let I=Z[H],W=I.trim(),_=(I.match(/\{/g)||[]).length,D=(I.match(/\}/g)||[]).length,E=(I.match(/</g)||[]).length,A=(I.match(/>/g)||[]).length;if(Y+=_-D,j+=E-A,W.includes("{"))U=!0;if(w("interface-depth",`Line ${H+1}: "${W}" Bracket depth: ${Y}, Angle depth: ${j}, Has started body: ${U}`),Q){let m=W.startsWith("export")?"export declare":"declare";X.push(I.replace(/^(\s*)(?:export\s+)?interface/,`\$1${m} interface`)),Q=!1}else X.push(I)}let z=X.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 R$(q,$,J){if(!q.startsWith("type")&&!q.startsWith("export type"))return!1;let Z=q.startsWith("export");return J.dtsLines.push(E1($,Z)),!0}function P$(q,$){if(!e1(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 f$(q,$){if(!q.startsWith("export *"))return!1;return $.exportAllStatements.push(q),$.dtsLines.push(q),!0}function E$(q,$,J){if(!q.startsWith("export"))return!1;if(q.startsWith("export {"))return J.dtsLines.push($),!0;if(S$(q,J))return!0;if(T$(q,J))return!0;if(y$(q,J))return!0;if(q.includes("export {"))return J.dtsLines.push($),!0;return w("processing",`Unhandled exported declaration type: ${q.split("\n")[0]}`),!0}function A$(q,$){if(w("export-processing",`Processing export: ${q}`),q.includes("{")&&!q.includes("}")){$.currentDeclaration=q;return}if($.currentDeclaration){if($.currentDeclaration+=` ${q}`,!q.includes("}"))return;q=$.currentDeclaration,$.currentDeclaration=""}let J=q.match(/export\s*\{([^}]+)\}(?:\s*from\s*['"]([^'"]+)['"])?/);if(!J){if(w("export-error","Failed to match export pattern"),q.startsWith("export {"))$.dtsLines.push(q);return}let[,Z,Y]=J;if(w("export-found",`Found exports: ${Z}, source: ${Y||"local"}`),q.startsWith("export {"))$.dtsLines.push(q);Z.split(",").forEach((j)=>{let[X,Q]=j.trim().split(/\s+as\s+/).map((U)=>U.trim());if(X.startsWith("type ")){let U=X.replace(/^type\s+/,"").trim(),z=Q||U;if($.importTracking.exportedTypes.add(z),Y)$.importTracking.typeExportSources.set(z,Y);w("export-type-processed",`Added exported type: ${z}`)}else{let U=Q||X;$.importTracking.exportedValues.add(U),w("export-value-processed",`Added exported value: ${U}`)}})}function S$(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 T$(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 y$(q,$){if(!q.startsWith("export namespace"))return!1;let J=`export declare ${q.replace(/^export\s+/,"")}`;return $.dtsLines.push(J),!0}function x$(q,$,J){if(!q.startsWith("declare module"))return!1;let Z=Z0($);return J.dtsLines.push(Z),!0}function G8(q,$,J){if(e1(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=b$($,q.startsWith("export"));J.dtsLines.push(Z);return}if(q.startsWith("type")||q.startsWith("export type")){let Z=E1($,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 C$(q,$){let J=q.split("\n"),Z=[],Y=[],j=0,X=0,Q=!1,U=!1;$.currentScope="top",w("source-processing",`Processing source file with ${J.length} lines`);for(let z=0;z<J.length;z++){let G=J[z],V=G.trim();if(V.startsWith("export {")){if(V.includes("}")){$.dtsLines.push(G);continue}U=!0,Z=[G];continue}if(U){if(Z.push(G),G.includes("}"))$.dtsLines.push(Z.join("\n")),Z=[],U=!1;continue}if(G.includes("import "))$0(G,$.importTracking),w("import",`Processed import: ${G}`);if(V.startsWith("export type {")){w("type-export",`Found type export: ${V}`),D$(V,$),$.dtsLines.push(G);continue}if(V.startsWith("export {")){if(w("mixed-export",`Found mixed export: ${V}`),A$(V,$),V.includes("}"))$.dtsLines.push(G);continue}}for(let z=0;z<J.length;z++){let G=J[z],V=G.trim();if(V.startsWith("import ")||V.startsWith("export type {")||V.startsWith("export {"))continue;if(V.startsWith("/*")||V.startsWith("//")){Y.push(G);continue}let H=(G.match(/\{/g)||[]).length,I=(G.match(/\}/g)||[]).length,W=(G.match(/</g)||[]).length,_=(G.match(/>/g)||[]).length;if(!Q&&M$(V)){w("declaration",`Found declaration start: ${V}`),Q=!0,Z=[G],j=H-I,X=W-_;continue}if(Q){Z.push(G),j+=H-I,X+=W-_;let D=j===0&&X===0&&V.endsWith("}"),E=z<J.length-1?J[z+1]?.trim():"";if(!(j>0||X>0||E&&!E.startsWith("export")&&!E.startsWith("interface"))||D)w("declaration-complete",`Declaration complete at line ${z+1}`),R1(Z,Y,$),Z=[],Y=[],Q=!1,j=0,X=0}}if(Z.length>0)R1(Z,Y,$)}function $0(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,X]=J,Q=Y||j;if(w("import-type",`Found type imports from ${X}: ${Q}`),!$.typeImports.has(X))$.typeImports.set(X,new Set);if(Q)Q.split(",").forEach((U)=>{let[z,G]=U.trim().split(/\s+as\s+/).map((V)=>V.trim());if($.typeImports.get(X).add(z),$.typeExportSources.set(z,X),w("import-type-tracking",`Tracking type ${z} from ${X}`),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((X)=>{let[Q,U]=X.trim().split(/\s+as\s+/).map((z)=>z.trim());if(Q.startsWith("type ")){let z=Q.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(Q),$.importSources.set(Q,j),U){if($.valueAliases.set(U,Q),U===$.defaultExportValue)$.usedValues.add(Q);$.valueImports.get(j).add(Q),w("import-alias",`Registered value alias: ${Q} as ${U}`)}})}}function E1(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 D$(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[X,Q]=j.trim().split(/\s+as\s+/).map((z)=>z.trim()),U=Q||X;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[,X,Q]=j,U=Q.trim(),z=U.match(/^\(\s*.*?\)\s*:\s*([^=>\s{]).*=>/);if(z){let V=z[1];return`${$?"export ":""}declare ${Z} ${X}: ${V};`}let G;if(U.includes("as const")){let V=U.replace(/\s*as\s*const\s*$/,"");G=B$(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=K$(U);return`${$?"export ":""}declare ${Z} ${X}: ${G};`}function P1(q,$,J=!0){w("process-function-start",`Starting to process: ${q}`);let Z=q.split("\n").map((Q)=>Q.trim()).join(" ").replace(/\s+/g," ").replace(/;$/,"");w("process-function-normalized",`Normalized declaration: ${Z}`);let Y=$$(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 X=[J?"export ":"","declare function ",Y.name,Y.generics,`(${Y.params})`,Y.returnType?`: ${Y.returnType}`:"",";"].filter(Boolean).join("");return w("process-function-final",`Final declaration: ${X}`),X}function L$(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 k$(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 X="";if(Y.startsWith("(")){let U=1,z=1;for(;z<Y.length&&U>0;z++){if(Y[z]==="(")U++;if(Y[z]===")")U--}X=Y.slice(1,z-1).trim(),Y=Y.slice(z).trim()}let Q="any";if(Y.startsWith(":")){Y=Y.slice(1).trim();let U=Y.match(/([^{;]+)/);if(U)Q=U[1].trim()}return["export declare function ",Z,j?`${j}`:"",`(${X})`,": ",Q].filter(Boolean).join("").concat(";")}function b$(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,X)=>{let Q=j.trim();if(!Q)return"";if(Q.startsWith("}"))Z--;let U=" ".repeat(Math.max(0,Z)),z=X===0?Q:`${U}${Q}`;if(Q.endsWith("{"))Z++;if(Q.includes("}")&&Q.includes("{"))Z=Math.max(0,Z);return z}).join("\n")}function n1(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,X="void"]=J,Q=X.trim();if(/^async\s+/.test(q)&&!/^Promise<.*>$/.test(Q))Q=`Promise<${Q}>`;let z=O1(j||""),G=[Y?`${Y}`:"",`(${z})`,"=>",Q].filter(Boolean).join(" ").trim();return{name:Z,signature:G}}function v$(q,$,J=0){let Z=[],Y=q.slice(1,-1).trim();if(!Y)return Z;let j="",X=0,Q=!1,U="",z="",G=!0,V=!1;for(let H=0;H<Y.length;H++){let I=Y[H],W=H>0?Y[H-1]:"";if((I==='"'||I==="\'"||I==="`")&&W!=="\\"){if(!Q)Q=!0,U=I;else if(I===U)Q=!1}if(!Q){if(I==="{"||I==="["||I==="(")X++;else if(I==="}"||I==="]"||I===")")X--;else if(X===0){if(I===":"&&!V){V=!0,z=j.trim(),j="",G=!1;continue}else if((I===","||I===";")&&!G){if(z){let _=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:E,signature:A}=n1(z);Z.push({key:E,value:A})}else{let E=r1(_,J+1,$);Z.push({key:o1(z),value:E})}}j="",z="",G=!0,V=!1;continue}}}j+=I}if(z&&!G&&j.trim()){let H=j.trim();if(z.includes("(")||z.match(/^\s*(?:async\s+)?\w+\s*(?:<[^>]+>)?\s*\(/)){let{name:W,signature:_}=n1(z);Z.push({key:W,value:_})}else{let W=r1(H,J+1,$);Z.push({key:o1(z),value:W})}}return Z}function r1(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 g$(q,$){let J=/(?:extends|implements|:|<)\s*([A-Z][a-zA-Z0-9]*(?:<[^>]+>)?)/g,Z=/(?:^|[\s<,])\s*([A-Z][a-zA-Z0-9]*)(?:[<>,\s]|$)/g,Y;while((Y=J.exec(q))!==null){let X=Y[1].split("<")[0];$.usedTypes.add(X)}while((Y=Z.exec(q))!==null){let X=Y[1];$.usedTypes.add(X)}let j=/Partial<([^>]+)>/g;while((Y=j.exec(q))!==null){let X=Y[1].trim();if(/^[A-Z]/.test(X))$.usedTypes.add(X)}}function h$(q,$){let J=q.match(/export\s*\{([^}]+)\}/);if(J)J[1].split(",").map((j)=>j.trim()).forEach((j)=>{let[X]=j.split(/\s+as\s+/);$.exportedValues.add(X.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((Q)=>Q.trim()).forEach((Q)=>{if(!["type","interface","declare","extends","implements","function","const","let","var"].includes(Q))$.usedValues.add(Q)})}}function w(q,$){if(q1.verbose)console.debug(`[dtsx:${q}] ${$}`)}function u$(q){return q.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function o1(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 Q=0;Q<q.length;Q++){let U=q[Q],z=Q>0?q[Q-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 X=J.trim();if(X)$.push(X);return $}function m$(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 iZ,rm as sZ}from"fs/promises";import{dirname as nZ,join as rZ,parse as oZ,relative as aZ}from"path";import tZ from"process";var Lq=K1(xq(),1),u1=K1(U1(),1),kq=K1(U1(),1);import Dq,{posix as W1}from"path";var LZ=/\\(?![()[\]{}!+@])/g;function kZ(q){return bq(q)}function bZ(q){return vq(q).replace(LZ,"/")}var v8=process.platform==="win32"?bZ:kZ,vZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,gZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,bq=(q)=>q.replace(vZ,"\\$&"),vq=(q)=>q.replace(gZ,"\\$&"),g8=process.platform==="win32"?vq:bq;function hZ(q,$){if(($==null?void 0:$.caseSensitiveMatch)===!1)return!0;let J=kq.default.scan(q);return J.isGlob||J.negated}function h1(q,$,J,Z,Y){var j;let X=q;if(q.endsWith("/"))X=q.slice(0,-1);if(!X.endsWith("*")&&$)X+="/**";if(Dq.isAbsolute(X.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))X=W1.relative(J,X);else X=W1.normalize(X);let Q=/^(\/?\.\.)+/.exec(X);if(Q==null?void 0:Q[0]){let U=W1.join(J,Q[0]);if(Z.root.length>U.length)Z.root=U,Z.depthOffset=-(Q[0].length+1)/3}else if(!Y&&Z.depthOffset>=0){let U=X.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]||hZ(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 X}function uZ({patterns:q,ignore:$=[],expandDirectories:J=!0},Z,Y){if(typeof q==="string")q=[q];else if(!q)q=["**/*"];if(typeof $==="string")$=[$];let j=[],X=[];for(let Q of $)if(!Q.startsWith("!")||Q[1]==="("){let U=h1(Q,J,Z,Y,!0);X.push(U)}for(let Q of q)if(!Q.startsWith("!")||Q[1]==="("){let U=h1(Q,J,Z,Y,!1);j.push(U)}else if(Q[1]!=="!"||Q[2]==="("){let U=h1(Q.slice(1),J,Z,Y,!0);X.push(U)}return{match:j,ignore:X}}function m1(q,$,J){return W1.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 m1(j,$,J)}function mZ(q,$,J){let Z={root:$,commonPath:null,depthOffset:0},Y=uZ(q,$,Z),j=u1.default(Y.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:Y.ignore}),X=u1.default(Y.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),Q={filters:[(z,G)=>j(Cq(z,$,Z.root,G,q.absolute))],exclude:(z,G)=>X(Cq(G,$,Z.root,!0,!0)),pathSeparator:"/",relativePaths:!0,resolveSymlinks:!0};if(q.deep)Q.maxDepth=Math.round(q.deep-Z.depthOffset);if(q.absolute)Q.relativePaths=!1,Q.resolvePaths=!0,Q.includeBasePath=!0;if(q.followSymbolicLinks===!1)Q.resolveSymlinks=!1,Q.excludeSymlinks=!0;if(q.onlyDirectories)Q.excludeFiles=!0,Q.includeDirs=!0;else if(q.onlyFiles===!1)Q.includeDirs=!0;Z.root=Z.root.replace(/\\/g,"");let U=new Lq.fdir(Q).crawl(Z.root);if($===Z.root||q.absolute)return J?U.sync():U.withPromise();return J?U.sync().map((z)=>m1(z,$,Z.root)+(!z||z.endsWith("/")?"/":"")):U.withPromise().then((z)=>z.map((G)=>m1(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 mZ(J,Z,!1)}import{readdir as dZ}from"fs/promises";import{dirname as cZ,extname as lZ,isAbsolute as pZ,join as mq,resolve as hq}from"path";import dq from"process";import{pathToFileURL as d1}from"url";async function cq(q,$){await Bun.write(q,$)}async function c1(q){let $=q??q1.root,J=await dZ($,{withFileTypes:!0}),Z=await Promise.all(J.map((Y)=>{let j=mq($,Y.name);return Y.isDirectory()?c1(j):j}));return Array.prototype.concat(...Z).filter((Y)=>lZ(Y)===".ts")}async function lq(q){try{let $=q?.cwd||dq.cwd(),J=q?.tsconfigPath||mq($,"tsconfig.json"),Y=await import(d1(J).href);if(Y.compilerOptions?.isolatedDeclarations===!0)return!0;if(Y.extends){let j=uq(J,Y.extends),X=j.endsWith(".json")?j:`${j}.json`,U=await import(d1(X).href);if(U.compilerOptions?.isolatedDeclarations===!0)return!0;if(U.extends){let z=uq(X,U.extends),G=z.endsWith(".json")?z:`${z}.json`;if((await import(d1(G).href)).compilerOptions?.isolatedDeclarations===!0)return!0}}return!1}catch($){return!1}}function uq(q,$){if(pZ($))return $;if($.startsWith("."))return hq(cZ(q),$);return hq(dq.cwd(),"node_modules",$)}async function eZ(q){try{if(!await lq(q)){console.error("Error: isolatedDeclarations must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await sZ(q.outdir,{recursive:!0,force:!0});let J=q?.cwd||tZ.cwd(),Z;if(q?.entrypoints)Z=await gq(q.entrypoints,{cwd:q.root??`${J}/src`,absolute:!0});else Z=await c1(q?.root??`${J}/src`);for(let Y of Z){let j=await a1(Y);if(j){let X=aZ(q?.root??"./src",Y),Q=oZ(X),U=rZ(q?.outdir??"./dist",`${Q.name}.d.ts`);await iZ(nZ(U),{recursive:!0}),await cq(U,j)}else console.warn(`No declarations extracted for ${Y}`)}}catch($){console.error("Error generating declarations:",$)}}async function e8(q){await eZ({...q1,...q})}export{cq as writeToFile,G8 as processSpecificDeclaration,U8 as isFunctionType,z8 as isDeclarationComplete,c1 as getAllTypeScriptFiles,eZ as generateDeclarationsFromFiles,e8 as generate,q$ as extractDtsTypes,a1 as extract,q1 as config,lq as checkIsolatedDeclarations};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.7.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",
@@ -66,7 +66,7 @@
66
66
  "@stacksjs/eslint-config": "^3.8.1-beta.2",
67
67
  "@types/bun": "^1.1.13",
68
68
  "bun-config": "^0.1.4",
69
- "bun-plugin-dtsx": "^0.21.5",
69
+ "bun-plugin-dtsx": "^0.21.7",
70
70
  "tinyglobby": "^0.2.10",
71
71
  "vitepress": "^1.5.0"
72
72
  },