forge-terminal 0.5.5 → 0.5.6

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.
Files changed (93) hide show
  1. package/README.md +26 -8
  2. package/dist/chunks/{about-credits-VRRE6342.js → about-credits-TM34J3IS.js} +1 -1
  3. package/dist/chunks/args-7OJGCKH4.js +3 -0
  4. package/dist/chunks/{boot-MX7UP2M2.js → boot-5KSVFF4C.js} +1 -1
  5. package/dist/chunks/{chunk-ZBETH6BR.js → chunk-2BPH3IL6.js} +33 -24
  6. package/dist/chunks/{chunk-BI2E72HM.js → chunk-2HGBB3DQ.js} +1 -1
  7. package/dist/chunks/{chunk-OUXPGAQL.js → chunk-37U22UEW.js} +1 -1
  8. package/dist/chunks/{chunk-R7BEV6PR.js → chunk-3RH2AXJW.js} +1 -1
  9. package/dist/chunks/{chunk-7I2OSTBX.js → chunk-4KGC5ZBZ.js} +1 -1
  10. package/dist/chunks/{chunk-J6AZTW62.js → chunk-4MJEEEFA.js} +1 -1
  11. package/dist/chunks/{chunk-YK26E3OX.js → chunk-4RNVZQRC.js} +1 -1
  12. package/dist/chunks/{chunk-TRJXZLR6.js → chunk-6RCS3KBP.js} +1 -1
  13. package/dist/chunks/{chunk-UGATQHEE.js → chunk-75GYDNAQ.js} +1 -1
  14. package/dist/chunks/{chunk-BU4YYGUJ.js → chunk-7R7KDE3R.js} +1 -1
  15. package/dist/chunks/chunk-7XFLG32B.js +3 -0
  16. package/dist/chunks/{chunk-2ZZXIDYX.js → chunk-CZDI37SI.js} +1 -1
  17. package/dist/chunks/{chunk-HACM3MAD.js → chunk-FAUL5L2W.js} +1 -1
  18. package/dist/chunks/{chunk-HWCXNKIN.js → chunk-HTA25PO2.js} +1 -1
  19. package/dist/chunks/{chunk-BROTSQXG.js → chunk-ILQDMVJR.js} +1 -1
  20. package/dist/chunks/chunk-JDTDXCZE.js +3 -0
  21. package/dist/chunks/{chunk-MES4FVLR.js → chunk-KQ2AHGLK.js} +1 -1
  22. package/dist/chunks/{chunk-SZCSV3PX.js → chunk-LAJAXLGQ.js} +1 -1
  23. package/dist/chunks/{chunk-45BFQHJB.js → chunk-LM4K7CZQ.js} +1 -1
  24. package/dist/chunks/chunk-N32JL4UI.js +3 -0
  25. package/dist/chunks/{chunk-Q7ERPAG3.js → chunk-NMECUMJD.js} +1 -1
  26. package/dist/chunks/chunk-POM7FXIV.js +3 -0
  27. package/dist/chunks/{chunk-MMLROWBQ.js → chunk-QV27SER6.js} +2 -2
  28. package/dist/chunks/{chunk-JJV2YXZQ.js → chunk-QYAJFKQL.js} +1 -1
  29. package/dist/chunks/chunk-RUAEBL2F.js +4 -0
  30. package/dist/chunks/chunk-TFGK7IRZ.js +19 -0
  31. package/dist/chunks/{chunk-OGYSMKRM.js → chunk-TLHUFIXD.js} +1 -1
  32. package/dist/chunks/{chunk-L5JBHB4G.js → chunk-U2XQL7AA.js} +1 -1
  33. package/dist/chunks/{chunk-HYMPLIHW.js → chunk-UB6YVCIS.js} +1 -1
  34. package/dist/chunks/{chunk-RLOJSZ6W.js → chunk-V6GWPR2A.js} +1 -1
  35. package/dist/chunks/{chunk-BONMSCKD.js → chunk-W43SUVWN.js} +1 -1
  36. package/dist/chunks/{chunk-HGJXGAGJ.js → chunk-W53XNVNH.js} +1 -1
  37. package/dist/chunks/{chunk-D4R7UACU.js → chunk-WBV6I7UP.js} +1 -1
  38. package/dist/chunks/{chunk-7KYO62XK.js → chunk-WBW6G4N6.js} +1 -1
  39. package/dist/chunks/{chunk-HVMQTKP6.js → chunk-WNYM6NSV.js} +1 -1
  40. package/dist/chunks/{chunk-WCOFUMZU.js → chunk-XY7C5I5T.js} +1 -1
  41. package/dist/chunks/{chunk-KDBKDURW.js → chunk-XZZCVJ64.js} +2 -2
  42. package/dist/chunks/chunk-YJ6XLDRA.js +3 -0
  43. package/dist/chunks/{chunk-7IWX5VSI.js → chunk-YR7QRQ5F.js} +1 -1
  44. package/dist/chunks/chunk-ZBMJTIYR.js +3 -0
  45. package/dist/chunks/chunk-ZJ45XUJW.js +3 -0
  46. package/dist/chunks/clip-command-3JBZK6Q3.js +3 -0
  47. package/dist/chunks/{clipboard-3VFHDKYE.js → clipboard-XOIVXPVL.js} +1 -1
  48. package/dist/chunks/colour-CEKEW7RV.js +3 -0
  49. package/dist/chunks/{command-BKAPI4A5.js → command-GAGAD65W.js} +1 -1
  50. package/dist/chunks/{config-command-6GXRV627.js → config-command-CKPJXJEE.js} +1 -1
  51. package/dist/chunks/{continue-editing-4W3XWWCE.js → continue-editing-M6WESEVB.js} +1 -1
  52. package/dist/chunks/{decoded-SMEHAVCH.js → decoded-XWKU23RG.js} +1 -1
  53. package/dist/chunks/{entry-7GW4RIK2.js → entry-64GTSHV2.js} +2 -2
  54. package/dist/chunks/execute-3J755YKG.js +3 -0
  55. package/dist/chunks/extensions-QQT6OD7W.js +3 -0
  56. package/dist/chunks/{extensions-command-VXZL55KR.js → extensions-command-FV3N7CBV.js} +1 -1
  57. package/dist/chunks/{ffmpeg-Z7JQT53Y.js → ffmpeg-VGE2QCC7.js} +1 -1
  58. package/dist/chunks/{image-FYCF2AVH.js → image-R5C3AWHT.js} +1 -1
  59. package/dist/chunks/{install-5YXQ6YV3.js → install-KGFOAQCU.js} +1 -1
  60. package/dist/chunks/{install-C6XNONFF.js → install-MFYGS5TG.js} +1 -1
  61. package/dist/chunks/{launch-U63VZQXC.js → launch-ATJNO6ZO.js} +5 -5
  62. package/dist/chunks/{lock-AFVXUDOM.js → lock-BG3CLOHA.js} +1 -1
  63. package/dist/chunks/manager-ROCFK7AS.js +4 -0
  64. package/dist/chunks/{needed-X5D4E5X5.js → needed-T722HOKD.js} +1 -1
  65. package/dist/chunks/{own-5JN35AUV.js → own-CX3EJ2AH.js} +1 -1
  66. package/dist/chunks/{pdfium-GKF4ES7K.js → pdfium-77L526HZ.js} +1 -1
  67. package/dist/chunks/{preset-command-H6G22SZD.js → preset-command-M7SESD5C.js} +1 -1
  68. package/dist/chunks/{registry-LLAHKI4G.js → registry-7BJ4J2SD.js} +1 -1
  69. package/dist/chunks/{run-WSETTQXP.js → run-GUFPETHF.js} +1 -1
  70. package/dist/chunks/{server-CIGFNW7X.js → server-64H64DIC.js} +18 -18
  71. package/dist/chunks/{theme-HAB66OAL.js → theme-S234JXQH.js} +1 -1
  72. package/dist/chunks/{transcribe-FVCOCTGA.js → transcribe-L64JHZ3U.js} +1 -1
  73. package/dist/chunks/{transcribe-command-XCBGAQMI.js → transcribe-command-Y3AHXLVA.js} +1 -1
  74. package/dist/chunks/{update-command-DJLYU6AB.js → update-command-DWEBUFT5.js} +1 -1
  75. package/dist/chunks/{update-note-47IPWQKY.js → update-note-YQD2W5B2.js} +1 -1
  76. package/dist/chunks/{watch-command-VL6LOERU.js → watch-command-B2Z4KSWR.js} +1 -1
  77. package/dist/index.js +6 -6
  78. package/package.json +5 -5
  79. package/dist/chunks/args-5BPKCNTL.js +0 -3
  80. package/dist/chunks/chunk-2NSUAERD.js +0 -3
  81. package/dist/chunks/chunk-3YWAVKDZ.js +0 -19
  82. package/dist/chunks/chunk-57M4J2BR.js +0 -3
  83. package/dist/chunks/chunk-CVNYUROW.js +0 -3
  84. package/dist/chunks/chunk-HFQOGB4T.js +0 -4
  85. package/dist/chunks/chunk-PBIS2ONZ.js +0 -3
  86. package/dist/chunks/chunk-QVACE4IE.js +0 -3
  87. package/dist/chunks/chunk-U5TEGDGH.js +0 -3
  88. package/dist/chunks/chunk-VTA6Z45X.js +0 -3
  89. package/dist/chunks/clip-command-WJ5P4DTN.js +0 -3
  90. package/dist/chunks/colour-5YBDFXXX.js +0 -3
  91. package/dist/chunks/execute-LBGFY5TG.js +0 -3
  92. package/dist/chunks/extensions-HTBACHMC.js +0 -3
  93. package/dist/chunks/manager-QUTR3RYR.js +0 -4
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as Ht,c as kt}from"./chunk-L5JBHB4G.js";import{j as It}from"./chunk-MES4FVLR.js";import{D as Ot,a as Tt,b as gt}from"./chunk-CVNYUROW.js";import{a as wt}from"./chunk-H3DIRJFE.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,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:"\\"},Pr={__proto__:null,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"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
3
+ import{a as Ht,c as kt}from"./chunk-U2XQL7AA.js";import{j as It}from"./chunk-KQ2AHGLK.js";import{F as Ot,a as Tt,b as gt}from"./chunk-ZBMJTIYR.js";import{a as wt}from"./chunk-H3DIRJFE.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,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:"\\"},Pr={__proto__:null,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"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{A as P,B as l,C as S}from"./chunk-CVNYUROW.js";import{c as x}from"./chunk-H3DIRJFE.js";import{existsSync as h,statSync as w}from"node:fs";import{basename as f,dirname as _,extname as g,isAbsolute as M,join as c,relative as D,resolve as i,sep as F}from"node:path";function $(t){return t.endsWith("/")||t.endsWith(F)||h(t)&&w(t).isDirectory()?!0:g(t)===""}var O=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function a(t,r,n=process.platform){if(b(t+r,n)<=O)return t+r;let e="";for(let s of t){if(b(e+s+r,n)>O)break;e+=s}return e+r}function it(t,r){if(i(t)===i(r))return!0;try{let n=w(t),e=w(r);return n.dev===e.dev&&n.ino===e.ino}catch{return!1}}function L(t,r){let n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;return a(s,x(r))}function v(t,r,n){if(!n)return t;let e=D(i(n),r);return!e||e.startsWith("..")?t:c(t,e)}function k(t){let r=i(t.sourcePath),n=L(r,t.target);if(!t.output)return c(i(r,".."),n);let e=M(t.output)?t.output:i(t.output);return $(t.output)?c(v(e,i(r,".."),t.sourceRoot),n):i(e)}function st(t){let r=k(t);if(t.output&&!$(t.output))return r;let n=g(r);return c(i(r,".."),a(f(r,n),`-${t.suffix}${n}`))}function ot(t){if(!h(t))return t;let r=i(t,".."),n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;for(let o=1;o<1e4;o++){let u=c(r,a(s,` (${o})${e}`));if(!h(u))return u}throw new Error(`no free name beside ${n}`)}function p(t){let r=i(t,".."),n=f(t),e=g(n);return{dir:r,stem:e?n.slice(0,-e.length):n,ext:e||".pdf"}}function A(t,r){let{dir:n,stem:e,ext:s}=p(i(t));return c(n,a(e,`-${r}${s}`))}function ut(t,r){let{dir:n,stem:e,ext:s}=p(i(t)),o=String(r).length;return Array.from({length:r},(u,m)=>c(n,a(e,`-${String(m+1).padStart(o,"0")}${s}`)))}function ct(t,r,n,e,s){let{stem:o}=p(i(t)),u=e?v(i(e),i(t,".."),s):i(t,".."),m=x(n),I=String(Math.max(1,...r.map(d=>d+1))).length,R=r.map(d=>c(u,a(o,`-${String(d+1).padStart(I,"0")}${m}`))),[E,...T]=R;if(E===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[E,...T]}function at(t,r,n){if(!n)return[A(t,"extract")];let{dir:e,stem:s,ext:o}=p(i(t));return r.map(u=>c(e,a(s,`-p${u+1}${o}`)))}function mt(t){let r=i(t[0]??"merged.pdf");if(new Set(t.map(e=>i(e,".."))).size===1){let e=i(r,"..");return c(e,a(f(e),"-merged.pdf"))}return A(r,"merged")}function B(t,r,n){let e=r?t.map(o=>c(r,f(o))):t,[s]=e;return!n||e.length!==1||s===void 0?e:[c(_(s),`${n}${g(s)}`)]}function ft(t,r,n){return B([t],r,n)[0]??t}import{execFile as J}from"node:child_process";import{randomBytes as j}from"node:crypto";import{constants as C}from"node:fs";import{access as U,mkdir as Y,rename as N,rm as z,writeFile as G}from"node:fs/promises";import{basename as y,dirname as W,extname as K,join as H}from"node:path";function Q(t,r=j(6).toString("hex")){let n=K(t);return H(W(t),a(`.forge-${r}-${y(t,n)}`,n))}async function V(t){let r=W(t);try{await Y(r,{recursive:!0})}catch(n){let e=l(t,n);throw e===n?S(t,n):e}try{await U(r,C.W_OK)}catch(n){throw P(t,n)}}var X=new Set(["EPERM","EBUSY","EACCES"]),Z=5,Et=9;async function q(t,r,n=process.platform,e=o=>new Promise(u=>setTimeout(u,o)),s=Z){if(n!=="win32"){await N(t,r),n==="darwin"&&await tt(t,r);return}for(let o=1;;o++)try{await N(t,r);return}catch(u){let m=u.code;if(o>=s||!m||!X.has(m))throw u;await e(Math.min(50*2**(o-1),1e3))}}function tt(t,r){return!y(t).startsWith(".")||y(r).startsWith(".")?Promise.resolve():new Promise(n=>{J("/usr/bin/chflags",["nohidden",r],()=>n())})}async function Pt(t,r){await V(t);let n=Q(t);try{return await G(n,r),await q(n,t),r.byteLength}catch(e){throw await z(n,{force:!0}).catch(()=>{}),l(t,e)}}export{$ as a,a as b,it as c,k as d,st as e,ot as f,A as g,ut as h,ct as i,at as j,mt as k,B as l,ft as m,Q as n,V as o,Et as p,q,Pt as r};
3
+ import{C as P,D as l,E as S}from"./chunk-ZBMJTIYR.js";import{c as x}from"./chunk-H3DIRJFE.js";import{existsSync as h,statSync as w}from"node:fs";import{basename as f,dirname as _,extname as g,isAbsolute as M,join as c,relative as D,resolve as i,sep as F}from"node:path";function $(t){return t.endsWith("/")||t.endsWith(F)||h(t)&&w(t).isDirectory()?!0:g(t)===""}var O=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function a(t,r,n=process.platform){if(b(t+r,n)<=O)return t+r;let e="";for(let s of t){if(b(e+s+r,n)>O)break;e+=s}return e+r}function it(t,r){if(i(t)===i(r))return!0;try{let n=w(t),e=w(r);return n.dev===e.dev&&n.ino===e.ino}catch{return!1}}function L(t,r){let n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;return a(s,x(r))}function v(t,r,n){if(!n)return t;let e=D(i(n),r);return!e||e.startsWith("..")?t:c(t,e)}function k(t){let r=i(t.sourcePath),n=L(r,t.target);if(!t.output)return c(i(r,".."),n);let e=M(t.output)?t.output:i(t.output);return $(t.output)?c(v(e,i(r,".."),t.sourceRoot),n):i(e)}function st(t){let r=k(t);if(t.output&&!$(t.output))return r;let n=g(r);return c(i(r,".."),a(f(r,n),`-${t.suffix}${n}`))}function ot(t){if(!h(t))return t;let r=i(t,".."),n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;for(let o=1;o<1e4;o++){let u=c(r,a(s,` (${o})${e}`));if(!h(u))return u}throw new Error(`no free name beside ${n}`)}function p(t){let r=i(t,".."),n=f(t),e=g(n);return{dir:r,stem:e?n.slice(0,-e.length):n,ext:e||".pdf"}}function A(t,r){let{dir:n,stem:e,ext:s}=p(i(t));return c(n,a(e,`-${r}${s}`))}function ut(t,r){let{dir:n,stem:e,ext:s}=p(i(t)),o=String(r).length;return Array.from({length:r},(u,m)=>c(n,a(e,`-${String(m+1).padStart(o,"0")}${s}`)))}function ct(t,r,n,e,s){let{stem:o}=p(i(t)),u=e?v(i(e),i(t,".."),s):i(t,".."),m=x(n),I=String(Math.max(1,...r.map(d=>d+1))).length,R=r.map(d=>c(u,a(o,`-${String(d+1).padStart(I,"0")}${m}`))),[E,...T]=R;if(E===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[E,...T]}function at(t,r,n){if(!n)return[A(t,"extract")];let{dir:e,stem:s,ext:o}=p(i(t));return r.map(u=>c(e,a(s,`-p${u+1}${o}`)))}function mt(t){let r=i(t[0]??"merged.pdf");if(new Set(t.map(e=>i(e,".."))).size===1){let e=i(r,"..");return c(e,a(f(e),"-merged.pdf"))}return A(r,"merged")}function B(t,r,n){let e=r?t.map(o=>c(r,f(o))):t,[s]=e;return!n||e.length!==1||s===void 0?e:[c(_(s),`${n}${g(s)}`)]}function ft(t,r,n){return B([t],r,n)[0]??t}import{execFile as J}from"node:child_process";import{randomBytes as j}from"node:crypto";import{constants as C}from"node:fs";import{access as U,mkdir as Y,rename as N,rm as z,writeFile as G}from"node:fs/promises";import{basename as y,dirname as W,extname as K,join as H}from"node:path";function Q(t,r=j(6).toString("hex")){let n=K(t);return H(W(t),a(`.forge-${r}-${y(t,n)}`,n))}async function V(t){let r=W(t);try{await Y(r,{recursive:!0})}catch(n){let e=l(t,n);throw e===n?S(t,n):e}try{await U(r,C.W_OK)}catch(n){throw P(t,n)}}var X=new Set(["EPERM","EBUSY","EACCES"]),Z=5,Et=9;async function q(t,r,n=process.platform,e=o=>new Promise(u=>setTimeout(u,o)),s=Z){if(n!=="win32"){await N(t,r),n==="darwin"&&await tt(t,r);return}for(let o=1;;o++)try{await N(t,r);return}catch(u){let m=u.code;if(o>=s||!m||!X.has(m))throw u;await e(Math.min(50*2**(o-1),1e3))}}function tt(t,r){return!y(t).startsWith(".")||y(r).startsWith(".")?Promise.resolve():new Promise(n=>{J("/usr/bin/chflags",["nohidden",r],()=>n())})}async function Pt(t,r){await V(t);let n=Q(t);try{return await G(n,r),await q(n,t),r.byteLength}catch(e){throw await z(n,{force:!0}).catch(()=>{}),l(t,e)}}export{$ as a,a as b,it as c,k as d,st as e,ot as f,A as g,ut as h,ct as i,at as j,mt as k,B as l,ft as m,Q as n,V as o,Et as p,q,Pt as r};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
3
  import{execFile as I,spawn as R}from"node:child_process";import{access as T,constants as K}from"node:fs/promises";import{dirname as $,join as L}from"node:path";import{promisify as C}from"node:util";function S(e){let[t,r]=(e??"").split("/").map(Number);return!t||!r?0:Math.round(t/r*100)/100}function O(e){let t=e.side_data_list?.find(n=>typeof n.rotation=="number")?.rotation,r=t!==void 0?-t:Number(e.tags?.rotate??0);return(Math.round(r/90)*90%360+360)%360}function A(e){let t=e,r=t.streams??[],n=r.find(o=>o.codec_type==="video"&&o.disposition?.attached_pic!==1),i=r.find(o=>o.codec_type==="audio"),a={duration:Number(t.format?.duration)||Math.max(0,...r.map(o=>Number(o.duration)||0))};if(n){let o=O(n),f=o===90||o===270,s=n.width??0,c=n.height??0;a.video={codec:n.codec_name??"",width:f?c:s,height:f?s:c,fps:S(n.avg_frame_rate)||S(n.r_frame_rate),rotation:o,hdr:n.color_transfer==="arib-std-b67"||n.color_transfer==="smpte2084"}}return i&&(a.audio={codec:i.codec_name??"",channels:i.channels??0,sampleRate:Number(i.sample_rate)||0}),a}var v=C(I);function D(e,t){let r=t.PATH??t.Path??"",n=e==="win32"?";":":",i=r.split(n).filter(Boolean);return e==="darwin"&&i.push("/opt/homebrew/bin","/usr/local/bin"),[...new Set(i)]}var k=e=>process.platform==="win32"?`${e}.exe`:e;async function N(e){try{return await T(e,K.X_OK),!0}catch{return!1}}function G(e){let t=new Set;for(let r of e.split(`
4
- `)){let n=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);n?.[1]&&n[1]!=="="&&t.add(n[1])}return t}async function J(){try{let{installed:e}=await import("./paths-6OENILJ4.js");return(await e("video"))?.dir}catch{return}}async function j(){try{let{chosenPath:e}=await import("./own-5JN35AUV.js"),t=await e("video");return t===void 0?void 0:$(t)}catch{return}}async function q(){try{let{removeForgeCopy:e}=await import("./own-5JN35AUV.js");await e("video")}catch{}}async function H(){let e=await J(),t=await j(),r=[...t?[t]:[],...D(process.platform,process.env),...e?[e]:[]];for(let n of r){let i=L(n,k("ffmpeg")),m=L(n,k("ffprobe"));if(!await N(i)||!await N(m))continue;try{await v(i,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[a,o]=await Promise.all(["-encoders","-filters"].map(s=>v(i,["-hide_banner",s],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:c})=>G(c)).catch(()=>{}))),f=a&&o?new Set([...a,...o]):void 0;return e!==void 0&&n!==e&&await q(),{ffmpeg:i,ffprobe:m,...f?{has:f}:{}}}}var b,w=null,F;function y(){return w?Promise.resolve(w.value):(b=(b??H()).then(t=>(t||(b=void 0),F=t,t)),b)}function te(){return w?w.value:F}function ne(e){w=e===null?null:{value:e},b=void 0,F=void 0}async function re(e,t){let r=t??await y();if(!r)throw new Error("ffmpeg is not installed");let{stdout:n}=await v(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return A(JSON.parse(n))}async function oe(e,t,r){let n=r??await y();if(!n)return;let i=Math.max(0,t-15),{stdout:m}=await v(n.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${t+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
4
+ `)){let n=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);n?.[1]&&n[1]!=="="&&t.add(n[1])}return t}async function J(){try{let{installed:e}=await import("./paths-6OENILJ4.js");return(await e("video"))?.dir}catch{return}}async function j(){try{let{chosenPath:e}=await import("./own-CX3EJ2AH.js"),t=await e("video");return t===void 0?void 0:$(t)}catch{return}}async function q(){try{let{removeForgeCopy:e}=await import("./own-CX3EJ2AH.js");await e("video")}catch{}}async function H(){let e=await J(),t=await j(),r=[...t?[t]:[],...D(process.platform,process.env),...e?[e]:[]];for(let n of r){let i=L(n,k("ffmpeg")),m=L(n,k("ffprobe"));if(!await N(i)||!await N(m))continue;try{await v(i,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[a,o]=await Promise.all(["-encoders","-filters"].map(s=>v(i,["-hide_banner",s],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:c})=>G(c)).catch(()=>{}))),f=a&&o?new Set([...a,...o]):void 0;return e!==void 0&&n!==e&&await q(),{ffmpeg:i,ffprobe:m,...f?{has:f}:{}}}}var b,w=null,F;function y(){return w?Promise.resolve(w.value):(b=(b??H()).then(t=>(t||(b=void 0),F=t,t)),b)}function te(){return w?w.value:F}function ne(e){w=e===null?null:{value:e},b=void 0,F=void 0}async function re(e,t){let r=t??await y();if(!r)throw new Error("ffmpeg is not installed");let{stdout:n}=await v(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return A(JSON.parse(n))}async function oe(e,t,r){let n=r??await y();if(!n)return;let i=Math.max(0,t-15),{stdout:m}=await v(n.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${t+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
5
5
  `).map(o=>Number.parseFloat(o)).filter(o=>Number.isFinite(o)&&o<=t+.001);return a.length?Math.max(...a):void 0}var B=4e3;async function ie(e,t,r,n={}){let i=n.tools??await y();if(!i)return null;let m=Math.max(1,Math.round(t*B)),a=Math.max(1,Math.ceil(m/r)),o=new Array(r).fill(0),f=0,s=Buffer.alloc(0);if(!await new Promise((p,d)=>{let u=R(i.ffmpeg,["-hide_banner","-nostdin","-loglevel","error","-i",e,"-map","0:a:0","-ac","1","-ar",String(B),"-f","s16le","-"],{stdio:["ignore","pipe","pipe"]}),h=()=>u.kill("SIGKILL");n.signal?.addEventListener("abort",h,{once:!0}),u.stdout.on("data",l=>{let _=s.length?Buffer.concat([s,l]):l,P=_.length-_.length%2;for(let x=0;x<P;x+=2){let M=Math.abs(_.readInt16LE(x)),E=Math.min(r-1,Math.floor(f/a));M>(o[E]??0)&&(o[E]=M),f++}s=_.subarray(P)}),u.stderr.resume(),u.on("error",d),u.on("close",l=>{n.signal?.removeEventListener("abort",h),n.signal?.aborted?d(n.signal.reason??new Error("aborted")):p(l===0&&f>0)})}))return null;let g=Math.max(1,...o);return o.map(p=>Math.sqrt(p/g))}async function se(e,t,r,n){await Z(["-ss",String(Math.max(0,t)),"-i",e,"-frames:v","1","-y",r],{tools:n})}function V(e){let t;for(let r of e.matchAll(/out_time_us=(\d+)/g))t=Number(r[1])/1e6;return t}var X=4e3;async function Z(e,t={}){let{signal:r,onTime:n}=t;if(r?.aborted)throw r.reason??new Error("aborted");let i=t.tools??await y();if(!i)throw new Error("ffmpeg is not installed");let a=["-hide_banner","-nostdin","-loglevel",t.report?"info":"error","-progress","pipe:1","-nostats",...e];return new Promise((o,f)=>{let s=R(i.ffmpeg,a,{stdio:["ignore","pipe","pipe"]}),c="",g=()=>s.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),s.stdout.setEncoding("utf8");let p="";s.stdout.on("data",d=>{let u=p+d,h=u.lastIndexOf(`
6
6
  `);p=u.slice(h+1);let l=V(u.slice(0,h+1));l!==void 0&&n?.(l)}),s.stderr.setEncoding("utf8"),s.stderr.on("data",d=>{c=(c+d).slice(-X)}),s.on("error",d=>{r?.removeEventListener("abort",g),f(d)}),s.on("close",d=>{r?.removeEventListener("abort",g),r?.aborted?f(r.reason??new Error("aborted")):d===0?o(c):f(new Error(c.trim()||`ffmpeg exited with ${d}`))})})}export{D as a,G as b,y as c,te as d,ne as e,re as f,oe as g,ie as h,se as i,V as j,Z as k};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{f as p,q as g,r as f}from"./chunk-RLOJSZ6W.js";import{randomBytes as l}from"node:crypto";import{copyFile as P,mkdir as w,readdir as h,readFile as y,rename as C,rm as u,stat as k}from"node:fs/promises";import{tmpdir as x}from"node:os";import{extname as c,join as o}from"node:path";function m(){return o(x(),"forge-clip")}var v=5,d={".png":"png",".jpg":"jpeg",".jpeg":"jpeg",".webp":"webp",".heic":"heic",".avif":"avif",".gif":"gif",".tiff":"tiff"};async function O(e,a=m()){let t=`${Date.now().toString(36)}-${l(3).toString("hex")}`,i=o(a,t),r=await e.read(o(i,"in"));if(!r)return await u(i,{recursive:!0,force:!0}),null;let n=o(i,"out");await w(n,{recursive:!0}),await F(a,r.path);let s=o(i,"in","Copied image");return await C(r.path,s),await T(a,t),{source:s,outDir:n,changeCount:r.changeCount}}async function F(e,a){let t=o(e,"last"),i=`Copied image${c(a)}`,r=o(e,`.last-${l(4).toString("hex")}`);await w(r,{recursive:!0}),await P(a,o(r,i)),await u(t,{recursive:!0,force:!0}),await g(r,t)}async function T(e,a){let t=await h(e,{withFileTypes:!0}).catch(()=>[]),r=(await Promise.all(t.filter(n=>n.isDirectory()&&n.name!=="last"&&!n.name.startsWith(".")).map(async n=>({name:n.name,at:(await k(o(e,n.name)).catch(()=>null))?.mtimeMs??0})))).filter(n=>n.name!==a).sort((n,s)=>s.at-n.at).slice(v-1);await Promise.all(r.map(n=>u(o(e,n.name),{recursive:!0,force:!0})))}async function b(e=m()){let a=o(e,"last"),t=(await h(a).catch(()=>[])).find(i=>d[c(i).toLowerCase()]!==void 0);return t===void 0?null:{path:o(a,t),format:d[c(t).toLowerCase()]}}async function S(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.write(t,i),"placed")}async function A(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.writeText(t,i),"placed")}async function E(e,a=m()){let t=await b(a);return t?(await e.write(t.path,t.format),!0):!1}async function _(e,a){let t=p(o(a,`Copied image${c(e)}`));return await f(t,await y(e)),t}export{O as a,S as b,A as c,E as d,_ as e};
3
+ import{f as p,q as g,r as f}from"./chunk-V6GWPR2A.js";import{randomBytes as l}from"node:crypto";import{copyFile as P,mkdir as w,readdir as h,readFile as y,rename as C,rm as u,stat as k}from"node:fs/promises";import{tmpdir as x}from"node:os";import{extname as c,join as o}from"node:path";function m(){return o(x(),"forge-clip")}var v=5,d={".png":"png",".jpg":"jpeg",".jpeg":"jpeg",".webp":"webp",".heic":"heic",".avif":"avif",".gif":"gif",".tiff":"tiff"};async function O(e,a=m()){let t=`${Date.now().toString(36)}-${l(3).toString("hex")}`,i=o(a,t),r=await e.read(o(i,"in"));if(!r)return await u(i,{recursive:!0,force:!0}),null;let n=o(i,"out");await w(n,{recursive:!0}),await F(a,r.path);let s=o(i,"in","Copied image");return await C(r.path,s),await T(a,t),{source:s,outDir:n,changeCount:r.changeCount}}async function F(e,a){let t=o(e,"last"),i=`Copied image${c(a)}`,r=o(e,`.last-${l(4).toString("hex")}`);await w(r,{recursive:!0}),await P(a,o(r,i)),await u(t,{recursive:!0,force:!0}),await g(r,t)}async function T(e,a){let t=await h(e,{withFileTypes:!0}).catch(()=>[]),r=(await Promise.all(t.filter(n=>n.isDirectory()&&n.name!=="last"&&!n.name.startsWith(".")).map(async n=>({name:n.name,at:(await k(o(e,n.name)).catch(()=>null))?.mtimeMs??0})))).filter(n=>n.name!==a).sort((n,s)=>s.at-n.at).slice(v-1);await Promise.all(r.map(n=>u(o(e,n.name),{recursive:!0,force:!0})))}async function b(e=m()){let a=o(e,"last"),t=(await h(a).catch(()=>[])).find(i=>d[c(i).toLowerCase()]!==void 0);return t===void 0?null:{path:o(a,t),format:d[c(t).toLowerCase()]}}async function S(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.write(t,i),"placed")}async function A(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.writeText(t,i),"placed")}async function E(e,a=m()){let t=await b(a);return t?(await e.write(t.path,t.format),!0):!1}async function _(e,a){let t=p(o(a,`Copied image${c(e)}`));return await f(t,await y(e)),t}export{O as a,S as b,A as c,E as d,_ as e};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as o}from"./chunk-SZCSV3PX.js";import{f as n}from"./chunk-MES4FVLR.js";import{E as i}from"./chunk-CVNYUROW.js";import{a as r}from"./chunk-H3DIRJFE.js";var I=5,h=200,x=5;function z(t){return t.format==="heic"||t.format==="raw"?"jpeg":o(t).includes(t.format)?t.format:"png"}function E(t,m){let e=n.find(f=>f.id==="image")?.writes;if(!e?.has(t))return i(`Cannot ${m} into ${r[t].label}; only an image format can take the edit.`,`Choose one of: ${[...e??[]].join(", ")}.`)}var c=t=>`${t.width}x${t.height}`,u=t=>"percent"in t?`${t.percent}pct`:"width"in t?`${t.width}w`:`${t.height}h`;export{I as a,h as b,x as c,z as d,E as e,c as f,u as g};
3
+ import{a as o}from"./chunk-LAJAXLGQ.js";import{f as n}from"./chunk-KQ2AHGLK.js";import{G as i}from"./chunk-ZBMJTIYR.js";import{a as r}from"./chunk-H3DIRJFE.js";var I=5,h=200,x=5;function z(t){return t.format==="heic"||t.format==="raw"?"jpeg":o(t).includes(t.format)?t.format:"png"}function E(t,m){let e=n.find(f=>f.id==="image")?.writes;if(!e?.has(t))return i(`Cannot ${m} into ${r[t].label}; only an image format can take the edit.`,`Choose one of: ${[...e??[]].join(", ")}.`)}var c=t=>`${t.width}x${t.height}`,u=t=>"percent"in t?`${t.percent}pct`:"width"in t?`${t.width}w`:`${t.height}h`;export{I as a,h as b,x as c,z as d,E as e,c as f,u as g};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{l as S,m as U}from"./chunk-CVNYUROW.js";import{b as P}from"./chunk-KXKQDFHX.js";import{readFile as ve,stat as Ne}from"node:fs/promises";import{execFile as ie}from"node:child_process";import{randomBytes as oe}from"node:crypto";import{mkdtemp as ae,open as H,readFile as se,rm as D}from"node:fs/promises";import{tmpdir as J}from"node:os";import{join as B}from"node:path";import{promisify as ce}from"node:util";var v=ce(ie),z=async()=>({...await import("./paths-6OENILJ4.js"),...await import("./run-WSETTQXP.js")}),E,N=e=>e!=="darwin";async function _(e=process.platform){return N(e)?await(await z()).installed("heic")!==void 0:k()}async function k(){if(E!==void 0)return E;try{await v("/usr/bin/sips",["--help"],{timeout:5e3}),E=!0}catch{E=!1}return E}async function O(e,n=process.platform){if(N(n))return fe(e,n);let t=B(J(),`forge-heic-${oe(8).toString("hex")}.png`),i=async()=>{await D(t,{force:!0}).catch(()=>{})};try{return await v("/usr/bin/sips",["-s","format","png",e,"--out",t],{timeout:12e4}),{path:t,cleanup:i}}catch(r){throw await i(),r}}async function L(e,n){let{installed:t,runExtension:i}=await z(),r=await t("heic");if(r===void 0)throw S(e,n);return{ext:r,runExtension:i}}async function fe(e,n){let t=await ae(B(J(),"forge-heic-")),i=async()=>{await D(t,{recursive:!0,force:!0}).catch(()=>{})};try{let{ext:r,runExtension:o}=await L(e,n),a=B(t,"decoded.rgba"),f=B(t,"decoded.png"),{width:m,height:y}=await o(r,["--in",e,"--out",a],{subject:e});return await(await P())(await se(a),{raw:{width:m,height:y,channels:4}}).png().toFile(f),await D(a,{force:!0}),{path:f,cleanup:i}}catch(r){throw await i(),r}}var ue=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1"]),de=new Set(["avif","avis"]);async function $e(e){let n;try{n=await H(e,"r")}catch{return!1}try{let t=Buffer.alloc(64),{bytesRead:i}=await n.read(t,0,64,0);if(i<12||t.toString("latin1",4,8)!=="ftyp")return!1;let r=Math.min(t.readUInt32BE(0),i),o=[];for(let a=8;a+4<=r;a+=4)o.push(t.toString("latin1",a,a+4));return o.some(a=>de.has(a))?!1:o.some(a=>ue.has(a))}catch{return!1}finally{await n.close().catch(()=>{})}}async function qe(e,n=process.platform){if(N(n)){let{ext:a,runExtension:f}=await L(e,n),m=await f(a,["--info","--in",e],{subject:e});return{width:m.width,height:m.height,hasAlpha:m.hasAlpha??!0}}let{stdout:t}=await v("/usr/bin/sips",["-g","pixelWidth","-g","pixelHeight","-g","hasAlpha",e],{timeout:3e4}),i=Number(/pixelWidth:\s*(\d+)/.exec(t)?.[1]??0),r=Number(/pixelHeight:\s*(\d+)/.exec(t)?.[1]??0),o=await me(e);return{width:o?r:i,height:o?i:r,hasAlpha:/hasAlpha:\s*yes/i.test(t)}}function*x(e,n,t){let i=n;for(;i+8<=t;){let r=e.readUInt32BE(i),o=8;if(r===1&&i+16<=t?(r=Number(e.readBigUInt64BE(i+8)),o=16):r===0&&(r=t-i),r<o)return;yield{type:e.toString("latin1",i+4,i+8),start:i+o,end:Math.min(i+r,t)},i+=r}}async function me(e){let n=await H(e,"r");try{let t=Buffer.alloc(262144),{bytesRead:i}=await n.read(t,0,t.length,0),r=[...x(t,0,i)].find(l=>l.type==="meta");if(!r)return!1;let o=[...x(t,r.start+4,r.end)],a=o.find(l=>l.type==="pitm"),f=o.find(l=>l.type==="iprp");if(!a||!f)return!1;let m=t.readUInt8(a.start)===0?t.readUInt16BE(a.start+4):t.readUInt32BE(a.start+4),y=[...x(t,f.start,f.end)],s=y.find(l=>l.type==="ipco"),c=y.find(l=>l.type==="ipma");if(!s||!c)return!1;let u=new Map;if([...x(t,s.start,s.end)].forEach((l,b)=>{l.type==="irot"&&u.set(b+1,t.readUInt8(l.start)&3)}),u.size===0)return!1;let h=t.readUInt8(c.start),w=(t.readUInt8(c.start+3)&1)===1,d=c.start+4,p=t.readUInt32BE(d);d+=4;for(let l=0;l<p&&d<c.end;l++){let b=h<1?t.readUInt16BE(d):t.readUInt32BE(d);d+=h<1?2:4;let ne=t.readUInt8(d);d+=1;for(let C=0;C<ne;C++){let re=w?t.readUInt16BE(d)&32767:t.readUInt8(d)&127;if(d+=w?2:1,b===m&&(u.get(re)??0)%2===1)return!0}}return!1}catch{return!1}finally{await n.close().catch(()=>{})}}import{execFile as le}from"node:child_process";import{randomBytes as he}from"node:crypto";import{copyFile as we,mkdtemp as W,open as pe,readFile as ye,rm as R}from"node:fs/promises";import{tmpdir as A}from"node:os";import{extname as K,join as I}from"node:path";import{promisify as ge}from"node:util";var $=ge(le),q=async()=>({...await import("./paths-6OENILJ4.js"),...await import("./run-WSETTQXP.js")}),F=e=>e!=="darwin",xe={".nef":[".nef",".nrw"],".arw":[".arw",".srf",".sr2"],".rw2":[".rw2",".rwl"],".3fr":[".3fr",".fff"],".dcr":[".dcr",".kdc"]},be=[["nikon",".nef"],["sony",".arw"],["pentax",".pef"],["ricoh",".pef"],["samsung",".srw"],["hasselblad",".3fr"],["seiko epson",".erf"],["epson",".erf"],["kodak",".dcr"],["eastman kodak",".dcr"],["leaf",".mos"]],Ie=new Set([32803,34892]),Ee=new Set([32767,32769,32770,34316,34713,65e3,65535]),Se="85c0b687820f11e08111f4ce462b6a48";function j(e,n){let t=(s,c)=>n?s.readUInt16LE(c):s.readUInt16BE(c),i=(s,c)=>n?s.readUInt32LE(c):s.readUInt32BE(c),r={1:1,2:1,3:2,4:4,7:1,13:4};async function o(s){if(s<=0)return;let c=await e(s,2);if(c.length<2)return;let u=t(c,0);if(u===0||u>1e3)return;let h=await e(s+2,u*12+4);if(h.length<u*12+4)return;let w=new Map;for(let d=0;d<u;d++){let p=d*12;w.set(t(h,p),{type:t(h,p+2),count:i(h,p+4),inline:h.subarray(p+8,p+12),offset:i(h,p+8)})}return{entries:w,next:i(h,u*12)}}async function a(s,c=16){if(!s)return[];let u=r[s.type]===2?2:4,h=Math.min(s.count,c),w=h*u<=4?s.inline:await e(s.offset,h*u),d=[];for(let p=0;p<h&&(p+1)*u<=w.length;p++)d.push(u===2?t(w,p*u):i(w,p*u));return d}async function f(s){if(s?.type!==2)return"";let c=Math.min(s.count,64);return(c<=4?s.inline.subarray(0,c):await e(s.offset,c)).toString("latin1").replace(/\0.*$/s,"").trim()}async function m(s){let[c]=await a(s.entries.get(274),1);return c!==void 0&&c>=1&&c<=8?c:1}async function y(s){let c=[s],u=new Set;for(let h=0;c.length>0&&h<12;h++){let w=c.shift(),[d]=await a(w.entries.get(262),1),[p]=await a(w.entries.get(259),1);if(d!==void 0&&Ie.has(d)||p!==void 0&&Ee.has(p))return!0;for(let l of[...await a(w.entries.get(330),8),w.next]){if(l===0||u.has(l))continue;u.add(l);let b=await o(l);b&&c.push(b)}}return!1}return{directory:o,text:f,orientation:m,hasMosaic:y,u32:i}}function V(e){let n=e.toString("latin1",0,2);return n==="II"?!0:n==="MM"?!1:void 0}async function Y(e,n){let t=V(e.subarray(n,n+2));if(t===void 0)return 1;let r=j(async(a,f)=>e.subarray(n+a,n+a+f),t),o=await r.directory(r.u32(e,n+4));return o?r.orientation(o):1}async function Pe(e){if(e[0]!==255||e[1]!==216)return 1;let n=2;for(;n+4<=e.length&&e[n]===255;){let t=e[n+1],i=e.readUInt16BE(n+2);if(t===225&&e.toString("latin1",n+4,n+10)==="Exif\0\0")return Y(e,n+10);if(t===218)break;n+=2+i}return 1}async function Be(e,n){let t=await e(0,Math.min(n,1048576)),i=[...x(t,0,t.length)].find(r=>r.type==="moov");if(!i)return 1;for(let r of x(t,i.start,i.end)){if(r.type!=="uuid"||t.toString("hex",r.start,r.start+16)!==Se)continue;let o=[...x(t,r.start+16,r.end)].find(a=>a.type==="CMT1");return o?Y(t,o.start):1}return 1}async function Re(e,n){if(n.length<92)return 1;let t=n.readUInt32BE(84),i=n.readUInt32BE(88);return t===0||i===0?1:Pe(await e(t,Math.min(i,65536)))}async function Me(e){let n;try{n=await pe(e,"r")}catch{return}try{let{size:t}=await n.stat(),i=async(u,h)=>{let w=Math.max(0,Math.min(h,t-u)),d=Buffer.alloc(w);return w>0&&await n.read(d,0,w,u),d},r=await i(0,96);if(r.length<16)return;let o=r.toString("latin1",0,4);if(r.toString("latin1",0,15)==="FUJIFILMCCD-RAW")return{ext:".raf",orientation:await Re(i,r)};if(r.toString("latin1",4,12)==="ftypcrx ")return{ext:".cr3",orientation:await Be(i,t)};let a=V(r);if(a===void 0)return;let f=j(i,a),m=await f.directory(f.u32(r,4));if(!m)return;let y=await f.orientation(m);if(o==="IIRO"||o==="IIRS"||o==="MMOR")return{ext:".orf",orientation:y};if(o==="IIU\0")return{ext:".rw2",orientation:y};if(o!=="II*\0"&&o!=="MM\0*")return;if(m.entries.has(50706))return{ext:".dng",orientation:y};if(r.toString("latin1",8,11)==="CR")return{ext:".cr2",orientation:y};let s=(await f.text(m.entries.get(271))).toLowerCase(),c=be.find(([u])=>s.startsWith(u));return!c||!await f.hasMosaic(m)?void 0:{ext:c[1],orientation:y}}catch{return}finally{await n.close().catch(()=>{})}}async function Ue(e=process.platform){return F(e)?await(await q()).installed("raw")!==void 0:k()}async function Z(e,n){let{installed:t,runExtension:i}=await q(),r=await t("raw");if(r===void 0)throw U(e,n);return{ext:r,runExtension:i}}async function G(e,n,t){let i=K(e).toLowerCase();if((xe[n.ext]??[n.ext]).includes(i))return t(e);let r=await W(I(A(),"forge-raw-"));try{let o=I(r,`photo${n.ext}`);return await we(e,o),await t(o)}finally{await R(r,{recursive:!0,force:!0}).catch(()=>{})}}async function rt(e,n,t=process.platform){if(F(t)){let{ext:a,runExtension:f}=await Z(e,t),m=await f(a,["--info","--in",e],{subject:e,platform:t});if(!(m.width>0&&m.height>0))throw new Error("the raw extension reported no size");return{width:m.width,height:m.height}}let{stdout:i}=await G(e,n,a=>$("/usr/bin/sips",["-g","typeIdentifier","-g","pixelWidth","-g","pixelHeight",a],{timeout:3e4}));if(!/typeIdentifier:\s*\S*raw-image/.test(i))return;let r=Number(/pixelWidth:\s*(\d+)/.exec(i)?.[1]??0),o=Number(/pixelHeight:\s*(\d+)/.exec(i)?.[1]??0);if(!(r===0||o===0))return n.orientation>=5?{width:o,height:r}:{width:r,height:o}}async function Q(e,n=process.platform){if(F(n))return De(e,n);if(!await Ue(n))throw U(e,n);let t=await Me(e)??{ext:K(e).toLowerCase(),orientation:1},i=I(A(),`forge-raw-${he(8).toString("hex")}.png`),r=async()=>{await R(i,{force:!0}).catch(()=>{})};try{return await G(e,t,o=>$("/usr/bin/sips",["-s","format","png",o,"--out",i],{timeout:3e5})),{path:i,cleanup:r}}catch(o){throw await r(),o}}async function De(e,n){let t=await W(I(A(),"forge-raw-")),i=async()=>{await R(t,{recursive:!0,force:!0}).catch(()=>{})};try{let{ext:r,runExtension:o}=await Z(e,n),a=I(t,"decoded.rgb"),f=I(t,"decoded.png"),{width:m,height:y}=await o(r,["--in",e,"--out",a],{subject:e,platform:n});return await(await P())(await ye(a),{raw:{width:m,height:y,channels:3}}).png().toFile(f),await R(a,{force:!0}),{path:f,cleanup:i}}catch(r){throw await i(),r}}async function ft(e,n){return n!=="heic"&&n!=="raw"?e:Fe(e,n)}var ke=4,X=256*1024*1024,T=X,ee=6e4,te=ee,M;function Ae(){clearTimeout(M),M=setTimeout(()=>g.clear(),te),M.unref?.()}var g=new Map;async function Fe(e,n){let{size:t,mtimeMs:i}=await Ne(e);Ae();let r=`${n}\0${e}`,o=g.get(r);if(g.delete(r),o&&o.size===t&&o.mtimeMs===i)return g.set(r,o),o.png;let a={size:t,mtimeMs:i,png:Ce(e,n),bytes:0};return g.set(r,a),a.png.then(f=>{a.bytes=f.length,f.length>T&&g.get(r)===a&&g.delete(r),Te()},()=>{g.get(r)===a&&g.delete(r)}),a.png}function Te(){let e=0;for(let n of g.values())e+=n.bytes;for(let[n,t]of g){if(g.size<=ke&&e<=T)break;g.delete(n),e-=t.bytes}}async function Ce(e,n){if(n==="heic"&&!await _())throw S(e);let t=n==="heic"?await O(e):await Q(e);try{return await ve(t.path)}finally{await t.cleanup()}}function ut(){g.clear(),clearTimeout(M)}function dt(e){te=e??ee}function mt(e){T=e??X}export{_ as a,$e as b,qe as c,Me as d,Ue as e,rt as f,ft as g,ut as h,dt as i,mt as j};
3
+ import{n as S,o as U}from"./chunk-ZBMJTIYR.js";import{b as P}from"./chunk-KXKQDFHX.js";import{readFile as ve,stat as Ne}from"node:fs/promises";import{execFile as ie}from"node:child_process";import{randomBytes as oe}from"node:crypto";import{mkdtemp as ae,open as H,readFile as se,rm as D}from"node:fs/promises";import{tmpdir as J}from"node:os";import{join as B}from"node:path";import{promisify as ce}from"node:util";var v=ce(ie),z=async()=>({...await import("./paths-6OENILJ4.js"),...await import("./run-GUFPETHF.js")}),E,N=e=>e!=="darwin";async function _(e=process.platform){return N(e)?await(await z()).installed("heic")!==void 0:k()}async function k(){if(E!==void 0)return E;try{await v("/usr/bin/sips",["--help"],{timeout:5e3}),E=!0}catch{E=!1}return E}async function O(e,n=process.platform){if(N(n))return fe(e,n);let t=B(J(),`forge-heic-${oe(8).toString("hex")}.png`),i=async()=>{await D(t,{force:!0}).catch(()=>{})};try{return await v("/usr/bin/sips",["-s","format","png",e,"--out",t],{timeout:12e4}),{path:t,cleanup:i}}catch(r){throw await i(),r}}async function L(e,n){let{installed:t,runExtension:i}=await z(),r=await t("heic");if(r===void 0)throw S(e,n);return{ext:r,runExtension:i}}async function fe(e,n){let t=await ae(B(J(),"forge-heic-")),i=async()=>{await D(t,{recursive:!0,force:!0}).catch(()=>{})};try{let{ext:r,runExtension:o}=await L(e,n),a=B(t,"decoded.rgba"),f=B(t,"decoded.png"),{width:m,height:y}=await o(r,["--in",e,"--out",a],{subject:e});return await(await P())(await se(a),{raw:{width:m,height:y,channels:4}}).png().toFile(f),await D(a,{force:!0}),{path:f,cleanup:i}}catch(r){throw await i(),r}}var ue=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1"]),de=new Set(["avif","avis"]);async function $e(e){let n;try{n=await H(e,"r")}catch{return!1}try{let t=Buffer.alloc(64),{bytesRead:i}=await n.read(t,0,64,0);if(i<12||t.toString("latin1",4,8)!=="ftyp")return!1;let r=Math.min(t.readUInt32BE(0),i),o=[];for(let a=8;a+4<=r;a+=4)o.push(t.toString("latin1",a,a+4));return o.some(a=>de.has(a))?!1:o.some(a=>ue.has(a))}catch{return!1}finally{await n.close().catch(()=>{})}}async function qe(e,n=process.platform){if(N(n)){let{ext:a,runExtension:f}=await L(e,n),m=await f(a,["--info","--in",e],{subject:e});return{width:m.width,height:m.height,hasAlpha:m.hasAlpha??!0}}let{stdout:t}=await v("/usr/bin/sips",["-g","pixelWidth","-g","pixelHeight","-g","hasAlpha",e],{timeout:3e4}),i=Number(/pixelWidth:\s*(\d+)/.exec(t)?.[1]??0),r=Number(/pixelHeight:\s*(\d+)/.exec(t)?.[1]??0),o=await me(e);return{width:o?r:i,height:o?i:r,hasAlpha:/hasAlpha:\s*yes/i.test(t)}}function*x(e,n,t){let i=n;for(;i+8<=t;){let r=e.readUInt32BE(i),o=8;if(r===1&&i+16<=t?(r=Number(e.readBigUInt64BE(i+8)),o=16):r===0&&(r=t-i),r<o)return;yield{type:e.toString("latin1",i+4,i+8),start:i+o,end:Math.min(i+r,t)},i+=r}}async function me(e){let n=await H(e,"r");try{let t=Buffer.alloc(262144),{bytesRead:i}=await n.read(t,0,t.length,0),r=[...x(t,0,i)].find(l=>l.type==="meta");if(!r)return!1;let o=[...x(t,r.start+4,r.end)],a=o.find(l=>l.type==="pitm"),f=o.find(l=>l.type==="iprp");if(!a||!f)return!1;let m=t.readUInt8(a.start)===0?t.readUInt16BE(a.start+4):t.readUInt32BE(a.start+4),y=[...x(t,f.start,f.end)],s=y.find(l=>l.type==="ipco"),c=y.find(l=>l.type==="ipma");if(!s||!c)return!1;let u=new Map;if([...x(t,s.start,s.end)].forEach((l,b)=>{l.type==="irot"&&u.set(b+1,t.readUInt8(l.start)&3)}),u.size===0)return!1;let h=t.readUInt8(c.start),w=(t.readUInt8(c.start+3)&1)===1,d=c.start+4,p=t.readUInt32BE(d);d+=4;for(let l=0;l<p&&d<c.end;l++){let b=h<1?t.readUInt16BE(d):t.readUInt32BE(d);d+=h<1?2:4;let ne=t.readUInt8(d);d+=1;for(let C=0;C<ne;C++){let re=w?t.readUInt16BE(d)&32767:t.readUInt8(d)&127;if(d+=w?2:1,b===m&&(u.get(re)??0)%2===1)return!0}}return!1}catch{return!1}finally{await n.close().catch(()=>{})}}import{execFile as le}from"node:child_process";import{randomBytes as he}from"node:crypto";import{copyFile as we,mkdtemp as W,open as pe,readFile as ye,rm as R}from"node:fs/promises";import{tmpdir as A}from"node:os";import{extname as K,join as I}from"node:path";import{promisify as ge}from"node:util";var $=ge(le),q=async()=>({...await import("./paths-6OENILJ4.js"),...await import("./run-GUFPETHF.js")}),F=e=>e!=="darwin",xe={".nef":[".nef",".nrw"],".arw":[".arw",".srf",".sr2"],".rw2":[".rw2",".rwl"],".3fr":[".3fr",".fff"],".dcr":[".dcr",".kdc"]},be=[["nikon",".nef"],["sony",".arw"],["pentax",".pef"],["ricoh",".pef"],["samsung",".srw"],["hasselblad",".3fr"],["seiko epson",".erf"],["epson",".erf"],["kodak",".dcr"],["eastman kodak",".dcr"],["leaf",".mos"]],Ie=new Set([32803,34892]),Ee=new Set([32767,32769,32770,34316,34713,65e3,65535]),Se="85c0b687820f11e08111f4ce462b6a48";function j(e,n){let t=(s,c)=>n?s.readUInt16LE(c):s.readUInt16BE(c),i=(s,c)=>n?s.readUInt32LE(c):s.readUInt32BE(c),r={1:1,2:1,3:2,4:4,7:1,13:4};async function o(s){if(s<=0)return;let c=await e(s,2);if(c.length<2)return;let u=t(c,0);if(u===0||u>1e3)return;let h=await e(s+2,u*12+4);if(h.length<u*12+4)return;let w=new Map;for(let d=0;d<u;d++){let p=d*12;w.set(t(h,p),{type:t(h,p+2),count:i(h,p+4),inline:h.subarray(p+8,p+12),offset:i(h,p+8)})}return{entries:w,next:i(h,u*12)}}async function a(s,c=16){if(!s)return[];let u=r[s.type]===2?2:4,h=Math.min(s.count,c),w=h*u<=4?s.inline:await e(s.offset,h*u),d=[];for(let p=0;p<h&&(p+1)*u<=w.length;p++)d.push(u===2?t(w,p*u):i(w,p*u));return d}async function f(s){if(s?.type!==2)return"";let c=Math.min(s.count,64);return(c<=4?s.inline.subarray(0,c):await e(s.offset,c)).toString("latin1").replace(/\0.*$/s,"").trim()}async function m(s){let[c]=await a(s.entries.get(274),1);return c!==void 0&&c>=1&&c<=8?c:1}async function y(s){let c=[s],u=new Set;for(let h=0;c.length>0&&h<12;h++){let w=c.shift(),[d]=await a(w.entries.get(262),1),[p]=await a(w.entries.get(259),1);if(d!==void 0&&Ie.has(d)||p!==void 0&&Ee.has(p))return!0;for(let l of[...await a(w.entries.get(330),8),w.next]){if(l===0||u.has(l))continue;u.add(l);let b=await o(l);b&&c.push(b)}}return!1}return{directory:o,text:f,orientation:m,hasMosaic:y,u32:i}}function V(e){let n=e.toString("latin1",0,2);return n==="II"?!0:n==="MM"?!1:void 0}async function Y(e,n){let t=V(e.subarray(n,n+2));if(t===void 0)return 1;let r=j(async(a,f)=>e.subarray(n+a,n+a+f),t),o=await r.directory(r.u32(e,n+4));return o?r.orientation(o):1}async function Pe(e){if(e[0]!==255||e[1]!==216)return 1;let n=2;for(;n+4<=e.length&&e[n]===255;){let t=e[n+1],i=e.readUInt16BE(n+2);if(t===225&&e.toString("latin1",n+4,n+10)==="Exif\0\0")return Y(e,n+10);if(t===218)break;n+=2+i}return 1}async function Be(e,n){let t=await e(0,Math.min(n,1048576)),i=[...x(t,0,t.length)].find(r=>r.type==="moov");if(!i)return 1;for(let r of x(t,i.start,i.end)){if(r.type!=="uuid"||t.toString("hex",r.start,r.start+16)!==Se)continue;let o=[...x(t,r.start+16,r.end)].find(a=>a.type==="CMT1");return o?Y(t,o.start):1}return 1}async function Re(e,n){if(n.length<92)return 1;let t=n.readUInt32BE(84),i=n.readUInt32BE(88);return t===0||i===0?1:Pe(await e(t,Math.min(i,65536)))}async function Me(e){let n;try{n=await pe(e,"r")}catch{return}try{let{size:t}=await n.stat(),i=async(u,h)=>{let w=Math.max(0,Math.min(h,t-u)),d=Buffer.alloc(w);return w>0&&await n.read(d,0,w,u),d},r=await i(0,96);if(r.length<16)return;let o=r.toString("latin1",0,4);if(r.toString("latin1",0,15)==="FUJIFILMCCD-RAW")return{ext:".raf",orientation:await Re(i,r)};if(r.toString("latin1",4,12)==="ftypcrx ")return{ext:".cr3",orientation:await Be(i,t)};let a=V(r);if(a===void 0)return;let f=j(i,a),m=await f.directory(f.u32(r,4));if(!m)return;let y=await f.orientation(m);if(o==="IIRO"||o==="IIRS"||o==="MMOR")return{ext:".orf",orientation:y};if(o==="IIU\0")return{ext:".rw2",orientation:y};if(o!=="II*\0"&&o!=="MM\0*")return;if(m.entries.has(50706))return{ext:".dng",orientation:y};if(r.toString("latin1",8,11)==="CR")return{ext:".cr2",orientation:y};let s=(await f.text(m.entries.get(271))).toLowerCase(),c=be.find(([u])=>s.startsWith(u));return!c||!await f.hasMosaic(m)?void 0:{ext:c[1],orientation:y}}catch{return}finally{await n.close().catch(()=>{})}}async function Ue(e=process.platform){return F(e)?await(await q()).installed("raw")!==void 0:k()}async function Z(e,n){let{installed:t,runExtension:i}=await q(),r=await t("raw");if(r===void 0)throw U(e,n);return{ext:r,runExtension:i}}async function G(e,n,t){let i=K(e).toLowerCase();if((xe[n.ext]??[n.ext]).includes(i))return t(e);let r=await W(I(A(),"forge-raw-"));try{let o=I(r,`photo${n.ext}`);return await we(e,o),await t(o)}finally{await R(r,{recursive:!0,force:!0}).catch(()=>{})}}async function rt(e,n,t=process.platform){if(F(t)){let{ext:a,runExtension:f}=await Z(e,t),m=await f(a,["--info","--in",e],{subject:e,platform:t});if(!(m.width>0&&m.height>0))throw new Error("the raw extension reported no size");return{width:m.width,height:m.height}}let{stdout:i}=await G(e,n,a=>$("/usr/bin/sips",["-g","typeIdentifier","-g","pixelWidth","-g","pixelHeight",a],{timeout:3e4}));if(!/typeIdentifier:\s*\S*raw-image/.test(i))return;let r=Number(/pixelWidth:\s*(\d+)/.exec(i)?.[1]??0),o=Number(/pixelHeight:\s*(\d+)/.exec(i)?.[1]??0);if(!(r===0||o===0))return n.orientation>=5?{width:o,height:r}:{width:r,height:o}}async function Q(e,n=process.platform){if(F(n))return De(e,n);if(!await Ue(n))throw U(e,n);let t=await Me(e)??{ext:K(e).toLowerCase(),orientation:1},i=I(A(),`forge-raw-${he(8).toString("hex")}.png`),r=async()=>{await R(i,{force:!0}).catch(()=>{})};try{return await G(e,t,o=>$("/usr/bin/sips",["-s","format","png",o,"--out",i],{timeout:3e5})),{path:i,cleanup:r}}catch(o){throw await r(),o}}async function De(e,n){let t=await W(I(A(),"forge-raw-")),i=async()=>{await R(t,{recursive:!0,force:!0}).catch(()=>{})};try{let{ext:r,runExtension:o}=await Z(e,n),a=I(t,"decoded.rgb"),f=I(t,"decoded.png"),{width:m,height:y}=await o(r,["--in",e,"--out",a],{subject:e,platform:n});return await(await P())(await ye(a),{raw:{width:m,height:y,channels:3}}).png().toFile(f),await R(a,{force:!0}),{path:f,cleanup:i}}catch(r){throw await i(),r}}async function ft(e,n){return n!=="heic"&&n!=="raw"?e:Fe(e,n)}var ke=4,X=256*1024*1024,T=X,ee=6e4,te=ee,M;function Ae(){clearTimeout(M),M=setTimeout(()=>g.clear(),te),M.unref?.()}var g=new Map;async function Fe(e,n){let{size:t,mtimeMs:i}=await Ne(e);Ae();let r=`${n}\0${e}`,o=g.get(r);if(g.delete(r),o&&o.size===t&&o.mtimeMs===i)return g.set(r,o),o.png;let a={size:t,mtimeMs:i,png:Ce(e,n),bytes:0};return g.set(r,a),a.png.then(f=>{a.bytes=f.length,f.length>T&&g.get(r)===a&&g.delete(r),Te()},()=>{g.get(r)===a&&g.delete(r)}),a.png}function Te(){let e=0;for(let n of g.values())e+=n.bytes;for(let[n,t]of g){if(g.size<=ke&&e<=T)break;g.delete(n),e-=t.bytes}}async function Ce(e,n){if(n==="heic"&&!await _())throw S(e);let t=n==="heic"?await O(e):await Q(e);try{return await ve(t.path)}finally{await t.cleanup()}}function ut(){g.clear(),clearTimeout(M)}function dt(e){te=e??ee}function mt(e){T=e??X}export{_ as a,$e as b,qe as c,Me as d,Ue as e,rt as f,ft as g,ut as h,dt as i,mt as j};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- var v="0.5.5",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
3
+ var v="0.5.6",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
4
4
  \u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},f={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEdit:"#b39ae8",modeEditBg:"#2a2238",modeTranscribe:"#e63946",modeTranscribeBg:"#3a1a1d",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},o={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEdit:"#64569f",modeEditBg:"#f0ebfa",modeTranscribe:"#c0102c",modeTranscribeBg:"#fef0ef",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},i={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEdit:"magenta",modeEditBg:"",modeTranscribe:"redBright",modeTranscribeBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},d=["convert","compress","pdf","edit","transcribe","colour"],k=`1\u2013${d.length}`;function E(e,t){let r=d,n=e==="menu"?r.length:r.indexOf(e),a=Math.max(0,Math.min(r.length-1,n+t));return r[a]}function P(e){return/^[1-9]$/.test(e)?d[Number(e)-1]:void 0}var S={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",edit:"\u2726",transcribe:"\xB6"},c="#7d6ad0",l="#cc8ae2";function s(e,t){return t==="compress"?{fg:e.modeCompress,bg:e.modeCompressBg}:t==="pdf"?{fg:e.modePdf,bg:e.modePdfBg}:t==="colour"?{fg:e.modeColour,bg:e.modeColourBg}:t==="edit"?{fg:e.modeEdit,bg:e.modeEditBg}:t==="transcribe"?{fg:e.modeTranscribe,bg:e.modeTranscribeBg}:{fg:e.modeConvert,bg:e.modeConvertBg}}var g=["#f26e69","#e5a23c","#ace02c","#55c7d9","#6579fd","#ad95e9"],b=["#e5a23c","#f2cf6b"],m={convert:["#1e96a7","#1e94b3","#1e92c0","#1d8ed2","#1b86ef","#4a7df8","#6974f8","#816af8","#995cf8"],compress:["#24b459","#22ab6d","#21a479","#209f81","#1f9c89","#1f9a91","#1e9998","#1e97a0","#1e96a7"],pdf:["#eb4319","#e3541a","#de601b","#db6a1c","#d9731d","#d87c1e","#d8841f","#d98c20","#d99522"],edit:["#9b5af8","#985cf8","#965ef8","#945ff8","#9161f8","#8f62f8","#8d64f8","#8a65f8","#8867f8"],transcribe:["#f3233e","#f12259","#ee2270","#ea2186","#e6219b","#e121b0","#da22c6","#d122dc","#c723f2"],colour:["#f42335","#e05b1a","#d87d1e","#da9b23","#d2b427","#b4c027","#5bbf23","#20a27c","#1e989b","#1e94b6","#1c8cd9","#577af8","#7371f8","#8568f8","#965df8"]},u=["#d99522","#da9822","#da9b23","#da9f24","#d9a224","#d9a525","#d8a825","#d7ab26","#d6ad26"],B={convert:["#d6f7fd","#ddf5fe","#e1f4fe","#e4f2fe","#e7f1fe","#eaf0fe","#eceffe","#efeefe","#f1edfe"],compress:["#e0f7e4","#def8e7","#dcf8ea","#daf8ed","#d8f8f1","#d7f8f4","#d6f8f7","#d6f8fa","#d6f7fd"],pdf:["#feece7","#feece6","#feece5","#feece3","#feece2","#feede0","#feedde","#feeddc","#feeed9"],edit:["#f2edfe","#f1edfe","#f1edfe","#f1eefe","#f0eefe","#f0eefe","#f0eefe","#f0eefe","#efeefe"],transcribe:["#feebea","#feebec","#feebee","#feeaf0","#feeaf2","#feeaf5","#fee9f9","#fde9fd","#f9eafe"],colour:["#feebe9","#feece5","#feede0","#feeed7","#f7f1d6","#eff3d9","#e5f6df","#dbf8eb","#d6f8f8","#def5fe","#e5f2fe","#ebf0fe","#edeffe","#efeefe","#f1edfe"]},p=["#feeed9","#feeed8","#feeed7","#fdeed6","#fcefd6","#fbefd6","#fbefd6","#faefd6","#f9f0d6"],T={convert:["#138291","#8467bd"],compress:["#2b8748","#138291"],pdf:["#d54322","#a06c10"],edit:["#8567bc","#7b67cd"],transcribe:["#df3140","#9c5cb1"],colour:["#cb4b49","#a06c10","#618110","#138291","#5869ec","#8268bd"]};function C(e,t){return e.name==="light"?t==="menu"?u:m[t]:t==="menu"?e.name==="dark"?b:[e.brand]:t==="compress"?[e.modeCompress,e.modeConvert]:t==="pdf"?[e.modePdf,e.brand]:t==="colour"?e.name==="dark"?g:[e.modeColour,e.violet]:t==="edit"?[e.modeEdit,e.name==="dark"?c:e.violet]:t==="transcribe"?[e.modeTranscribe,e.name==="dark"?l:e.violet]:[e.modeConvert,e.violet]}function y(e,t){if(e.name==="light")return t==="menu"?p:B[t]}function w(e,t){return e.name==="light"?T[t]:C(e,t)}function M(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function R(e,t){let{fg:r,bg:n}=s(e,t);return{...e,accent:r,tag:r,label:r,band:n===""?e.band:n}}function H(e){return e.canvas!==""}function O(e){return e==="dark"?f:e==="light"?o:i}function D(e){return e===""?void 0:e}var _={filled:"\u2501",empty:"\u2501",knob:"\u25CF"};function h(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.stdout.isTTY===!0}function F(){h()||(process.env.FORCE_COLOR="0")}export{v as a,x as b,f as c,o as d,i as e,d as f,k as g,E as h,P as i,S as j,s as k,C as l,y as m,w as n,M as o,R as p,H as q,O as r,D as s,_ as t,h as u,F as v};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{b as B,c as C,d as U}from"./chunk-L5JBHB4G.js";import{i as q}from"./chunk-MES4FVLR.js";import{c as T}from"./chunk-RLOJSZ6W.js";import{a as x,aa as E,ba as A,ka as R,o as I,r as k,w as J,x as P,y as M,z as w}from"./chunk-CVNYUROW.js";function D(e=1,t=100){let o=Math.max(1,t-e+1);return 1+Math.max(0,Math.ceil(Math.log2(o)))}async function O(e){let t=e.min??1,o=e.max??100,c=D(t,o),a=0,n=async f=>(a+=1,e.onAttempt?.(a,c),e.encode(f)),s=()=>e.signal?.aborted===!0,u=await n(o);if(s())return{quality:o,bytes:u,missed:!1,cancelled:!0};if(u<=e.targetBytes)return{quality:o,bytes:u,missed:!1};let d=t,p=o,m;for(;d<=p;){let f=Math.floor((d+p)/2),g=await n(f);if(s())return{quality:f,bytes:g,missed:!1,cancelled:!0};g<=e.targetBytes?(m={quality:f,bytes:g,missed:!1},d=f+1):p=f-1}if(m)return m;let b=await e.encode(t);return{quality:t,bytes:b,missed:!0}}import{existsSync as L}from"node:fs";import{resolve as v}from"node:path";function N(e){let t=e.sources[0]?.path??e.outputs[0]??"",o=new Set;for(let c of e.outputs){let a=v(c);if(o.has(a))return{output:c,error:M(t,c)};o.add(a)}}function W(e,t,o){let c=N(e);if(c)return c;let a=e.sources[0]?.path??e.outputs[0]??"";for(let n of e.outputs){let s=v(n);if(e.sources.some(d=>T(d.path,s))&&!o)return{output:n,error:w(n,e.op)};let u=t.get(s);if(u){let d=u.sources[0]?.path??u.outputs[0]??"";return{output:n,error:P([d,a],n)}}if(L(s)&&!o)return{output:n,error:J(n,e.op)}}}function _(e,t){let o=[],c=[],a=new Map;for(let n of e){let s=W(n,a,t.force);if(s){let u=n.sources[0]?.path??s.output;c.push({path:u,error:s.error});continue}for(let u of n.outputs)a.set(v(u),n);o.push(n)}return{jobs:o,failures:c}}async function z(e,t,o,c,a,n){let s=e.sources[0].path,u=r=>({kind:"failed",failure:{path:s,error:x(r)?r:R(s,r)}}),d=o(e);if(d?.sizeTo){let r=e.sources[0],i=e.options.compress!==void 0;if(i&&r.bytes<=t)return{kind:"failed",failure:{path:s,error:A(s,r.bytes,t)}};let l=t,h=d.sizeTo(e,l);return h&&i&&h.floor>=r.bytes?{kind:"failed",failure:{path:s,error:E(s,r.bytes,h.floor,!0)}}:h?{kind:"unreachable",entry:{job:e,smallest:h.floor,settings:{quality:1,media:{...e.options.media,targetBytes:h.floor}},error:k(r,t,h.floor)}}:(e.options={...e.options,media:{...e.options.media,targetBytes:l}},{kind:"ready"})}let p;try{p=await o(e)?.measurer?.(e)}catch(r){return u(r)}if(!p||p.ladder.length===0)return{kind:"refused",failure:{path:s,error:I(e.sources[0],e.target)}};let m=p,b=e.sources[0],f=e.options.compress!==void 0&&b.bytes<=t,g=f?b.bytes-1:t;if(a?.aborted)return{kind:"cancelled"};let F=Number.POSITIVE_INFINITY,y;try{for(let r of m.ladder){let i=await O({encode:l=>m.measure({...e.options,...r,quality:l}),targetBytes:g,...n===void 0?{}:{max:n},onAttempt:(l,h)=>c({type:"search:attempt",job:e,attempt:l,of:h,rung:r}),...a===void 0?{}:{signal:a}});if(i.cancelled)return{kind:"cancelled"};if(i.bytes<F&&(F=i.bytes,y={...r,quality:i.quality}),!i.missed)return e.options={...e.options,...r,quality:i.quality},{kind:"ready"}}}catch(r){return u(r)}return f?{kind:"failed",failure:{path:s,error:E(s,b.bytes,F,!0)}}:{kind:"unreachable",entry:{job:e,smallest:F,settings:y??{quality:1},error:k(e.sources[0],t,F)}}}async function te(e,t){let o=t.onEvent??(()=>{}),c=t.engineFor??q,a=t.targetBytes,n=_(e,{force:t.force}),s=a===void 0?0:n.jobs.filter(r=>r.op==="convert").length,u=[],d=0;await C(n.jobs,B(t.concurrency),async(r,i)=>{if(a===void 0||r.op!=="convert"){u[i]={kind:"ready"};return}if(t.signal?.aborted){u[i]={kind:"cancelled"};return}let l=await z(r,a,c,o,t.signal,t.maxQuality);u[i]=l,l.kind!=="cancelled"&&(d+=1,o({type:"search:settled",job:r,completed:d,total:s}))});let p=[...n.failures],m=[],b=[],f=[],g=!1;for(let[r,i]of n.jobs.entries()){let l=u[r]??{kind:"ready"};l.kind==="ready"?f.push(i):l.kind==="refused"?p.push(l.failure):l.kind==="failed"?b.push(l.failure):l.kind==="unreachable"?m.push(l.entry):g=!0}if(g)return{results:[],refusals:p,unreachable:[],failures:[],inputBytes:0,outputBytes:0,cancelled:!0};let F=new Set,y=await U(f,{...t.concurrency===void 0?{}:{concurrency:t.concurrency},...t.engineFor===void 0?{}:{engineFor:t.engineFor},...t.signal===void 0?{}:{signal:t.signal},onEvent:r=>{r.type==="job:error"&&!t.signal?.aborted&&F.add(r.failure),o(r)}}),S=f.length-y.results.length;if(t.signal?.aborted&&S>0){let r=y.failures.filter(i=>F.has(i));return{...y,refusals:p,unreachable:m,failures:[...b,...r],cancelled:!0}}return{results:y.results,refusals:p,unreachable:m,failures:[...b,...y.failures],inputBytes:y.inputBytes,outputBytes:y.outputBytes}}export{_ as a,te as b};
3
+ import{b as B,c as C,d as U}from"./chunk-U2XQL7AA.js";import{i as q}from"./chunk-KQ2AHGLK.js";import{c as T}from"./chunk-V6GWPR2A.js";import{A as M,B as w,a as x,ca as E,da as A,ma as R,q as I,t as k,y as J,z as P}from"./chunk-ZBMJTIYR.js";function D(e=1,t=100){let o=Math.max(1,t-e+1);return 1+Math.max(0,Math.ceil(Math.log2(o)))}async function O(e){let t=e.min??1,o=e.max??100,c=D(t,o),a=0,n=async f=>(a+=1,e.onAttempt?.(a,c),e.encode(f)),s=()=>e.signal?.aborted===!0,u=await n(o);if(s())return{quality:o,bytes:u,missed:!1,cancelled:!0};if(u<=e.targetBytes)return{quality:o,bytes:u,missed:!1};let d=t,p=o,m;for(;d<=p;){let f=Math.floor((d+p)/2),g=await n(f);if(s())return{quality:f,bytes:g,missed:!1,cancelled:!0};g<=e.targetBytes?(m={quality:f,bytes:g,missed:!1},d=f+1):p=f-1}if(m)return m;let b=await e.encode(t);return{quality:t,bytes:b,missed:!0}}import{existsSync as L}from"node:fs";import{resolve as v}from"node:path";function N(e){let t=e.sources[0]?.path??e.outputs[0]??"",o=new Set;for(let c of e.outputs){let a=v(c);if(o.has(a))return{output:c,error:M(t,c)};o.add(a)}}function W(e,t,o){let c=N(e);if(c)return c;let a=e.sources[0]?.path??e.outputs[0]??"";for(let n of e.outputs){let s=v(n);if(e.sources.some(d=>T(d.path,s))&&!o)return{output:n,error:w(n,e.op)};let u=t.get(s);if(u){let d=u.sources[0]?.path??u.outputs[0]??"";return{output:n,error:P([d,a],n)}}if(L(s)&&!o)return{output:n,error:J(n,e.op)}}}function _(e,t){let o=[],c=[],a=new Map;for(let n of e){let s=W(n,a,t.force);if(s){let u=n.sources[0]?.path??s.output;c.push({path:u,error:s.error});continue}for(let u of n.outputs)a.set(v(u),n);o.push(n)}return{jobs:o,failures:c}}async function z(e,t,o,c,a,n){let s=e.sources[0].path,u=r=>({kind:"failed",failure:{path:s,error:x(r)?r:R(s,r)}}),d=o(e);if(d?.sizeTo){let r=e.sources[0],i=e.options.compress!==void 0;if(i&&r.bytes<=t)return{kind:"failed",failure:{path:s,error:A(s,r.bytes,t)}};let l=t,h=d.sizeTo(e,l);return h&&i&&h.floor>=r.bytes?{kind:"failed",failure:{path:s,error:E(s,r.bytes,h.floor,!0)}}:h?{kind:"unreachable",entry:{job:e,smallest:h.floor,settings:{quality:1,media:{...e.options.media,targetBytes:h.floor}},error:k(r,t,h.floor)}}:(e.options={...e.options,media:{...e.options.media,targetBytes:l}},{kind:"ready"})}let p;try{p=await o(e)?.measurer?.(e)}catch(r){return u(r)}if(!p||p.ladder.length===0)return{kind:"refused",failure:{path:s,error:I(e.sources[0],e.target)}};let m=p,b=e.sources[0],f=e.options.compress!==void 0&&b.bytes<=t,g=f?b.bytes-1:t;if(a?.aborted)return{kind:"cancelled"};let F=Number.POSITIVE_INFINITY,y;try{for(let r of m.ladder){let i=await O({encode:l=>m.measure({...e.options,...r,quality:l}),targetBytes:g,...n===void 0?{}:{max:n},onAttempt:(l,h)=>c({type:"search:attempt",job:e,attempt:l,of:h,rung:r}),...a===void 0?{}:{signal:a}});if(i.cancelled)return{kind:"cancelled"};if(i.bytes<F&&(F=i.bytes,y={...r,quality:i.quality}),!i.missed)return e.options={...e.options,...r,quality:i.quality},{kind:"ready"}}}catch(r){return u(r)}return f?{kind:"failed",failure:{path:s,error:E(s,b.bytes,F,!0)}}:{kind:"unreachable",entry:{job:e,smallest:F,settings:y??{quality:1},error:k(e.sources[0],t,F)}}}async function te(e,t){let o=t.onEvent??(()=>{}),c=t.engineFor??q,a=t.targetBytes,n=_(e,{force:t.force}),s=a===void 0?0:n.jobs.filter(r=>r.op==="convert").length,u=[],d=0;await C(n.jobs,B(t.concurrency),async(r,i)=>{if(a===void 0||r.op!=="convert"){u[i]={kind:"ready"};return}if(t.signal?.aborted){u[i]={kind:"cancelled"};return}let l=await z(r,a,c,o,t.signal,t.maxQuality);u[i]=l,l.kind!=="cancelled"&&(d+=1,o({type:"search:settled",job:r,completed:d,total:s}))});let p=[...n.failures],m=[],b=[],f=[],g=!1;for(let[r,i]of n.jobs.entries()){let l=u[r]??{kind:"ready"};l.kind==="ready"?f.push(i):l.kind==="refused"?p.push(l.failure):l.kind==="failed"?b.push(l.failure):l.kind==="unreachable"?m.push(l.entry):g=!0}if(g)return{results:[],refusals:p,unreachable:[],failures:[],inputBytes:0,outputBytes:0,cancelled:!0};let F=new Set,y=await U(f,{...t.concurrency===void 0?{}:{concurrency:t.concurrency},...t.engineFor===void 0?{}:{engineFor:t.engineFor},...t.signal===void 0?{}:{signal:t.signal},onEvent:r=>{r.type==="job:error"&&!t.signal?.aborted&&F.add(r.failure),o(r)}}),S=f.length-y.results.length;if(t.signal?.aborted&&S>0){let r=y.failures.filter(i=>F.has(i));return{...y,refusals:p,unreachable:m,failures:[...b,...r],cancelled:!0}}return{results:y.results,refusals:p,unreachable:m,failures:[...b,...y.failures],inputBytes:y.inputBytes,outputBytes:y.outputBytes}}export{_ as a,te as b};