forge-terminal 0.5.1 → 0.5.3

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 (117) hide show
  1. package/README.md +7 -6
  2. package/dist/chunks/{about-credits-FZ35HUFP.js → about-credits-DBQHH5HA.js} +1 -1
  3. package/dist/chunks/args-TZMA4ZR6.js +3 -0
  4. package/dist/chunks/{boot-PCZBPNFR.js → boot-E57BKWEC.js} +1 -1
  5. package/dist/chunks/chunk-3CLPUPJT.js +55 -0
  6. package/dist/chunks/chunk-3GHHQNR6.js +3 -0
  7. package/dist/chunks/chunk-4YFFT5CZ.js +66 -0
  8. package/dist/chunks/{chunk-BD3OLIVT.js → chunk-5IZBFF6Y.js} +1 -1
  9. package/dist/chunks/{chunk-S2M4XESA.js → chunk-5YUOG3A5.js} +1 -1
  10. package/dist/chunks/{chunk-X26WUHWB.js → chunk-6LMVOQQA.js} +1 -1
  11. package/dist/chunks/chunk-6RMRWBMB.js +3 -0
  12. package/dist/chunks/{chunk-63ZK5SRQ.js → chunk-7I2OSTBX.js} +1 -1
  13. package/dist/chunks/chunk-7KYO62XK.js +3 -0
  14. package/dist/chunks/{chunk-HCLEHCAR.js → chunk-7VR6LODN.js} +1 -1
  15. package/dist/chunks/{chunk-3KWAO2N2.js → chunk-AFEYLHDD.js} +1 -1
  16. package/dist/chunks/{chunk-YNZIN42P.js → chunk-AIINYKXW.js} +1 -1
  17. package/dist/chunks/{chunk-DZOBIUV6.js → chunk-BIBDLXCG.js} +1 -1
  18. package/dist/chunks/{chunk-G46QQBT3.js → chunk-BROTSQXG.js} +1 -1
  19. package/dist/chunks/chunk-CVNYUROW.js +3 -0
  20. package/dist/chunks/{chunk-QXNB5DQ2.js → chunk-E2BYNETT.js} +1 -1
  21. package/dist/chunks/{chunk-SK2UZ25Y.js → chunk-EITGK5OI.js} +1 -1
  22. package/dist/chunks/chunk-EPDF4NQI.js +3 -0
  23. package/dist/chunks/{chunk-JOIHR724.js → chunk-EURVTBPH.js} +1 -1
  24. package/dist/chunks/{chunk-MTDCDKPU.js → chunk-FLMQ5VFR.js} +2 -2
  25. package/dist/chunks/{chunk-JMBEZPYC.js → chunk-HWCXNKIN.js} +1 -1
  26. package/dist/chunks/{chunk-XURW53YK.js → chunk-IE6NFN3N.js} +1 -1
  27. package/dist/chunks/chunk-IJRLRAC5.js +3 -0
  28. package/dist/chunks/chunk-IKZTH2RL.js +3 -0
  29. package/dist/chunks/chunk-ITJZ7ODJ.js +4 -0
  30. package/dist/chunks/{chunk-THDAQBQ3.js → chunk-J6AZTW62.js} +1 -1
  31. package/dist/chunks/chunk-MNI6IKIU.js +3 -0
  32. package/dist/chunks/chunk-N3X3H4IZ.js +3 -0
  33. package/dist/chunks/chunk-NHMACTW3.js +82 -0
  34. package/dist/chunks/chunk-O7DK3GJT.js +3 -0
  35. package/dist/chunks/chunk-Q7ERPAG3.js +7 -0
  36. package/dist/chunks/{chunk-2CX33C6H.js → chunk-QPJ2LNXB.js} +1 -1
  37. package/dist/chunks/chunk-TDYKRRZH.js +3 -0
  38. package/dist/chunks/chunk-TFOEI5VF.js +3 -0
  39. package/dist/chunks/{chunk-EKTUUKDP.js → chunk-TYWGB767.js} +1 -1
  40. package/dist/chunks/chunk-VLVNA4T3.js +3 -0
  41. package/dist/chunks/{chunk-YINYF6C7.js → chunk-VTA6Z45X.js} +1 -1
  42. package/dist/chunks/{chunk-GLAD7GP2.js → chunk-YK26E3OX.js} +1 -1
  43. package/dist/chunks/chunk-Z2H2GT2X.js +36 -0
  44. package/dist/chunks/{chunk-C4UCCBCX.js → chunk-ZOQA3JAR.js} +1 -1
  45. package/dist/chunks/chunk-ZYIW4MAG.js +3 -0
  46. package/dist/chunks/clip-command-QPLYCGJ2.js +3 -0
  47. package/dist/chunks/clipboard-7KSZNWWT.js +3 -0
  48. package/dist/chunks/colour-PZOAKNTH.js +3 -0
  49. package/dist/chunks/command-DMGGGAPS.js +3 -0
  50. package/dist/chunks/config-command-6GXRV627.js +3 -0
  51. package/dist/chunks/continue-editing-4W3XWWCE.js +3 -0
  52. package/dist/chunks/decoded-SMEHAVCH.js +3 -0
  53. package/dist/chunks/{entry-2XJD7UCY.js → entry-REXB6JNP.js} +2 -2
  54. package/dist/chunks/execute-GKO4THUK.js +3 -0
  55. package/dist/chunks/extensions-UV4X2UUA.js +3 -0
  56. package/dist/chunks/{extensions-command-MGPRISPH.js → extensions-command-TLW53BUK.js} +1 -1
  57. package/dist/chunks/{ffmpeg-2UZXAB3C.js → ffmpeg-32EEMAZS.js} +1 -1
  58. package/dist/chunks/image-YMCS4PTS.js +3 -0
  59. package/dist/chunks/install-7ZRVQKCF.js +3 -0
  60. package/dist/chunks/install-C6XNONFF.js +3 -0
  61. package/dist/chunks/launch-IVBMNYNY.js +17 -0
  62. package/dist/chunks/lock-AFVXUDOM.js +3 -0
  63. package/dist/chunks/manager-XPO4ZIRY.js +4 -0
  64. package/dist/chunks/{needed-YEXRZMZX.js → needed-NOGBHTHE.js} +1 -1
  65. package/dist/chunks/notify-YEBP67MP.js +3 -0
  66. package/dist/chunks/{own-WOK6H277.js → own-G4G4MRGM.js} +1 -1
  67. package/dist/chunks/pdfium-BAMNBCNW.js +3 -0
  68. package/dist/chunks/preset-command-XXKLUJOS.js +3 -0
  69. package/dist/chunks/registry-PKOPEG3Z.js +3 -0
  70. package/dist/chunks/run-WSETTQXP.js +3 -0
  71. package/dist/chunks/{server-QNWPC2CC.js → server-AR73FWWG.js} +3 -3
  72. package/dist/chunks/{theme-EHFY7DT6.js → theme-D4AMWFFW.js} +1 -1
  73. package/dist/chunks/transcribe-EFVJPBPG.js +3 -0
  74. package/dist/chunks/transcribe-command-Q4J3WTOB.js +3 -0
  75. package/dist/chunks/update-command-DJLYU6AB.js +3 -0
  76. package/dist/chunks/{update-note-GYJWUDFS.js → update-note-2YR3TLPK.js} +1 -1
  77. package/dist/chunks/watch-command-2D7NLDAM.js +3 -0
  78. package/dist/index.js +13 -13
  79. package/package.json +7 -11
  80. package/dist/chunks/args-FSQFXDIX.js +0 -3
  81. package/dist/chunks/chunk-2J2PTA5O.js +0 -3
  82. package/dist/chunks/chunk-2MLASXG5.js +0 -3
  83. package/dist/chunks/chunk-5TEAR5XH.js +0 -3
  84. package/dist/chunks/chunk-63BBFKT2.js +0 -4
  85. package/dist/chunks/chunk-655UG277.js +0 -3
  86. package/dist/chunks/chunk-72TNSFL5.js +0 -36
  87. package/dist/chunks/chunk-AYB5AJ4E.js +0 -3
  88. package/dist/chunks/chunk-C32KGH4S.js +0 -3
  89. package/dist/chunks/chunk-LBDSFSYP.js +0 -3
  90. package/dist/chunks/chunk-OY4EGSPE.js +0 -3
  91. package/dist/chunks/chunk-UXRQ4UBQ.js +0 -66
  92. package/dist/chunks/chunk-WIPP5TWQ.js +0 -3
  93. package/dist/chunks/chunk-WZWK3PEZ.js +0 -3
  94. package/dist/chunks/chunk-ZRHYGR2L.js +0 -134
  95. package/dist/chunks/clip-command-NZNC46H2.js +0 -3
  96. package/dist/chunks/clipboard-GICOXMMN.js +0 -3
  97. package/dist/chunks/colour-GSDOHCFK.js +0 -3
  98. package/dist/chunks/command-GYCYLUHN.js +0 -3
  99. package/dist/chunks/config-command-6YUMMZF3.js +0 -3
  100. package/dist/chunks/continue-editing-QE5RRIMG.js +0 -3
  101. package/dist/chunks/decoded-NBZ335RZ.js +0 -3
  102. package/dist/chunks/execute-FYEXZ7EY.js +0 -3
  103. package/dist/chunks/extensions-V5O4NIHI.js +0 -3
  104. package/dist/chunks/image-3CMUB2P4.js +0 -3
  105. package/dist/chunks/install-IDUHZTTS.js +0 -3
  106. package/dist/chunks/install-L5C2UT6M.js +0 -3
  107. package/dist/chunks/launch-GUHDBMSJ.js +0 -17
  108. package/dist/chunks/lock-UQJ66TZ3.js +0 -3
  109. package/dist/chunks/manager-UKTMRXKE.js +0 -4
  110. package/dist/chunks/pdfium-LYHOU6WV.js +0 -3
  111. package/dist/chunks/preset-command-6A2C6VPQ.js +0 -3
  112. package/dist/chunks/registry-2YU7NW4P.js +0 -3
  113. package/dist/chunks/run-U2CU6VGE.js +0 -5
  114. package/dist/chunks/transcribe-SCL3LFZU.js +0 -3
  115. package/dist/chunks/transcribe-command-BX2VVUI3.js +0 -3
  116. package/dist/chunks/update-command-JCTCRPCS.js +0 -3
  117. package/dist/chunks/watch-command-ZLZAWTNJ.js +0 -3
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as Ht,c as kt}from"./chunk-IJRLRAC5.js";import{j as It}from"./chunk-EPDF4NQI.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};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as ie,d as ue,e as pe,g as ce,h as de}from"./chunk-EURVTBPH.js";import{a as re,b as oe,c as se,k as ne,m as M,n as O,s as ae}from"./chunk-3GHHQNR6.js";import{b as X,c as T}from"./chunk-6RMRWBMB.js";import{a as y}from"./chunk-IKZTH2RL.js";import{b as I}from"./chunk-ZYIW4MAG.js";import{e as be}from"./chunk-7VR6LODN.js";import{a as F,c as _,d as ee,e as C,f as te}from"./chunk-5IZBFF6Y.js";import{e as fe,f as le,g as me,h as ge,i as he,j as ye}from"./chunk-57M4J2BR.js";import{a as g}from"./chunk-AFEYLHDD.js";import{d as $}from"./chunk-EEQSUBBL.js";import{a as Z}from"./chunk-IE6NFN3N.js";import{a as L,d as U}from"./chunk-TFOEI5VF.js";import{a as Y,c as K,d as E,e as Q}from"./chunk-BIBDLXCG.js";import{E as N,F as V,I as G,a as P,o as z,q as k,s as q,ta as H,v as J}from"./chunk-CVNYUROW.js";import{a as h,b as W}from"./chunk-J7FLFHQJ.js";import{b as x,c as w}from"./chunk-VLVNA4T3.js";import{a as R}from"./chunk-H3DIRJFE.js";import{readFile as Te}from"node:fs/promises";import{dirname as Oe,resolve as Me}from"node:path";async function we(e){let r=[],t=[...e.resolved.failures];for(let o of e.resolved.sources){let s=F(o);if(!s.includes(e.target)){t.push({path:o.path,error:q(o,e.target,s)});continue}let a={sourcePath:o.path,target:e.target,output:e.output,sourceRoot:e.resolved.roots.get(o.path)},n=E(a);K(n,o.path)&&e.target!==o.format&&(n=Q({...a,suffix:e.target})),r.push({op:"convert",sources:[o],outputs:[n],target:e.target,options:e.options})}return{jobs:r,failures:t}}import{resolve as je}from"node:path";function Be(e,r=new Set){let t={path:je(e.path),kind:e.kind,format:e.format,bytes:e.bytes},o=e.kind==="document"&&e.encrypted===!0,s={targets:F(e).filter(a=>!o||C(a)),actions:ce([e],r).filter(a=>!o||a.id===O.id).map(a=>a.id)};if(e.kind==="image")return{...t,width:e.width,height:e.height,...s};if(e.kind==="media"){let a=e.facts;return{...t,...a?{duration:a.duration}:{},...a?.video?{width:a.video.width,height:a.video.height,fps:a.video.fps}:{},...s}}return{...t,pages:e.pages,encrypted:e.encrypted,...s}}async function Ie(e){let r=await y(e,{recursive:!1}),{installedExtensionIds:t}=await import("./available-TNMISSBA.js"),o=await t();return{probes:r.sources.map(s=>Be(s,o)),failures:r.failures}}import{dirname as Se}from"node:path";var j=e=>({cwd:e.cwd??process.cwd(),...e.home===void 0?{}:{home:e.home}});function ve(e,r){let t=x(Se(e),j(r));return t==="."?"":` in ${t.endsWith("/")?t:`${t}/`}`}function xe(e,r){let{pct:t,direction:o}=W(e,r);return o==="same"?"same size":`${t}% ${o}`}function Pe(e,r={}){let t=e.results[0];if(!t)return[];let o=t.job.sources[0],s=t.job.outputs;if(s.length>1){let n=[`\u2713 ${w(o.path)} \u2192 ${s.length} files${ve(s[0],r)}`,` ${s.map(i=>w(i)).join(", ")}`,` ${h(o.bytes)} \u2192 ${h(t.outputBytes)} total`];for(let i of t.warnings)n.push("",`\u26A0 ${i.message}`);return n}let a=[`\u2713 ${w(o.path)} \u2192 ${x(s[0],j(r))}`,` ${h(o.bytes)} \u2192 ${h(t.outputBytes)} \xB7 ${xe(o.bytes,t.outputBytes)}`];for(let n of t.warnings)a.push("",`\u26A0 ${n.message}`);return a}function ke(e,r={}){let t=[`\u2713 ${e.results.length} converted`,` ${h(e.inputBytes)} \u2192 ${h(e.outputBytes)} \xB7 ${xe(e.inputBytes,e.outputBytes)}`];for(let s of e.results)for(let a of s.job.outputs)t.push(` ${x(a,j(r))}`);let o=e.results.flatMap(s=>s.warnings);if(o.length>0){t.push("");for(let s of o)t.push(`\u26A0 ${s.message}`)}return t}function $e(e,r={}){let t=e.results.flatMap(u=>u.job.outputs),o=t.map(u=>w(u)).join(", "),s=t.length===1?"file":"files",a=t[0]===void 0?"":ve(t[0],r),n=[`\u2713 ${t.length} ${s} \xB7 ${o}${a}`],i=e.results.flatMap(u=>u.warnings);for(let u of i)n.push("",`\u26A0 ${u.message}`);return n}function B(e,r){if(e.length===0)return[];let t=[];for(let o of e)t.push(...H(o.error,{debug:r.debug}),"");return t}function Re(){let e=new Set(_()),r=new Set(ee()),t=["Formats",""];for(let s of e){let a=R[s],n=r.has(s)?"read and write":"read only";t.push(` ${a.label.padEnd(6)} ${a.extensions.join(" ").padEnd(12)} ${n}`)}let o=[...e].filter(s=>!r.has(s)).map(s=>R[s].label);if(o.length>0){let s=o.join(", "),[a,n]=o.length===1?["is","it"]:["are","them"];t.push("",`${s} ${a} read only because Forge cannot yet write ${n}.`)}return t}function Ee(e,r={}){let t=[R[e.format].label,h(e.bytes)];return e.duration!==void 0&&t.push($(e.duration)),e.width!==void 0&&e.height!==void 0&&t.push(`${e.width}\xD7${e.height}`),e.fps!==void 0&&t.push(`${e.fps} fps`),e.pages!==void 0&&t.push(`${e.pages} ${e.pages===1?"page":"pages"}`),e.encrypted&&t.push("password-protected"),[`${x(e.path,j(r))} \xB7 ${t.join(" \xB7 ")}`,` converts to ${e.targets.join(", ")}`,` actions ${e.actions.join(", ")}`]}import{createInterface as Fe}from"node:readline";import{PassThrough as Je}from"node:stream";function Ne(e){return new Promise(r=>{let t=Fe({input:e,terminal:!1}),o=!1,s=a=>{if(o)return;o=!0,t.close(),e.pause(),e.unref?.(),r(a.replace(/\r$/,""))};t.once("line",s),t.once("close",()=>s(""))})}async function Ce(e){if(e.stdin)return Ne(process.stdin);if(!process.stdin.isTTY)return;let r=new Je,t=Fe({input:process.stdin,output:r,terminal:!0});try{return process.stderr.write("Password: "),await new Promise(o=>t.question("",o))}finally{process.stderr.write(`
4
+ `),t.close()}}function Ae(e){return e.kind==="preset"?e.name:e.kind==="pageop"?"PDF":e.kind==="compress"?"Compress":e.kind==="convert"?"Convert":"Edit"}function A(e){return e.length===0?0:e.some(r=>r.error.code==="invalid-arguments")?2:1}function De(e,r){if(e.action==="merge")return{};if(e.action==="rotate")return{degrees:e.rotate};if(e.action==="extract")return{pages:e.pages,separate:e.separate?"many":"one"};if(e.action==="delete")return{pages:e.pages};let t=r.find(n=>n.kind==="document"),o=t?.pages??0,s=e.split;if(!s)throw N("--split needs a mode: every-page, every=N or at=N,N.");if(s.mode==="every-page")return{cuts:ie(o)};if(s.mode==="every-n")return{cuts:ue(o,s.n)};let a=Math.max(o-1,0);for(let n of s.after)if(!Number.isInteger(n)||n<1||n>a)throw V(String(n),`"${n}" is outside 1 and ${a} \u2014 ${t?w(t.path):"the document"} has ${o} pages.`,o);return{cuts:s.after.map(n=>n-1)}}function We(e,r){let t;return()=>r?(t??=Ce({stdin:e}).then(o=>e&&o===""?void 0:o),t):Promise.resolve(void 0)}async function ze(e,r,t,o){let s;if(e.encrypted){if(s=r.password??await t(),s===void 0)return{failure:{path:e.path,error:J(e.path)}};let i;try{i=await Z(await Te(e.path),s)}catch{return{failure:{path:e.path,error:J(e.path,{attempted:!0})}}}i.destroy()}let a;try{a=O.plan([e],{target:r.target,background:r.options.background,keepMetadata:r.options.keepMetadata,dpi:String(r.dpi??150),...r.options.quality===void 0?{}:{quality:r.options.quality},...r.pages===void 0?{}:{pages:r.pages},...r.output===void 0?{}:{destination:r.output},...o===void 0?{}:{sourceRoot:o}})}catch(i){if(!P(i))throw i;return{failure:{path:e.path,error:i}}}let n=a[0];if(n?.op!=="convert")throw new Error(`convertAction.plan() did not return a convert job for ${e.path}`);return s!==void 0&&(n.options.password=s),{job:n}}function S(e,r){return t=>{if(t.type==="search:attempt"){r||e.onSearch?.(t.rung.dpi===void 0?`attempt ${t.attempt} of ${t.of}`:`${t.rung.dpi} dpi \xB7 attempt ${t.attempt} of ${t.of}`);return}if(t.type==="search:settled"){r&&e.onSearch?.(`${t.completed} of ${t.total} searched`);return}if(!r&&t.type==="job:phase"&&t.progress.phase==="time"){let o=t.progress,s=`${$(o.done)} of ${$(o.total)}`;e.onEncode?.(o.pass?`pass ${o.pass.at} of 2 \xB7 ${s}`:s);return}r&&(t.type==="job:done"||t.type==="job:error")&&e.onProgress?.({completed:t.completed,total:t.total})}}var b=(e,r)=>({kind:e,results:[],failures:r,inputBytes:0,outputBytes:0});async function qe(e){let r=await y(e.inputs,{recursive:!1});if(r.sources.length===0)return b("pageop",r.failures);let t=pe.find(n=>n.id===e.action);if(!t)throw new Error(`no action registered for "${e.action}"`);let o=r.sources[0]?.path??"";if(!t.appliesTo(r.sources)){let n=de(t,r.sources)??"not available for these files";return b("pageop",[...r.failures,{path:o,error:k(e.action,n)}])}let s;try{s=t.plan(r.sources,De(e,r.sources))}catch(n){if(!P(n))throw n;return b("pageop",[...r.failures,{path:o,error:n}])}let a=await I(s,{force:e.force});return{kind:"pageop",results:a.results,failures:[...r.failures,...a.refusals,...a.failures],inputBytes:a.inputBytes,outputBytes:a.outputBytes}}async function Ve(e,r){let t=await y(e.inputs,{recursive:e.recursive}),o=[],s=[];for(let i of t.sources){if(!M.appliesTo([i])){s.push({path:i.path,error:z(i)});continue}let u=e.output!==void 0&&!Y(e.output)?Me(e.output):void 0,f=e.output===void 0||u!==void 0?Oe(i.path):Oe(E({sourcePath:i.path,target:i.format,output:e.output,sourceRoot:t.roots.get(i.path)})),[d]=M.plan([i],{mode:e.maxBytes===void 0?"quality":"size",...e.quality===void 0?{}:{quality:e.quality},...e.options.media??{},destination:f});d?.op==="convert"&&(u!==void 0&&(d.outputs=[u]),e.dpi!==void 0&&(d.options.dpi=e.dpi),o.push(d))}let a=o.length>1;a&&r.onProgress?.({completed:0,total:o.length});let n=await I(o,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(r,a)});return{kind:"compress",results:n.results,failures:[...t.failures,...s,...n.refusals,...n.unreachable.map(i=>({path:i.job.sources[0].path,error:i.error})),...n.failures],inputBytes:n.inputBytes,outputBytes:n.outputBytes}}async function Ge(e,r){let t=e.kind,o=e.op==="remove-background"?L(e.target):void 0;if(o)return b(t,[{path:"",error:o}]);let{installed:s}=await import("./paths-6OENILJ4.js"),a=await s(e.op);if(!a)return b(t,[{path:"",error:G(e.op)}]);if(e.op==="boost"&&e.scale!==void 0){let{assetFor:l,catalogEntry:p}=await import("./catalog-FMHWWMUX.js"),m=p("boost"),v=m&&l(m)?.version,D=U(e.scale,a.version,v);if(D)return b(t,[{path:"",error:D}])}let n=await y(e.inputs,{recursive:e.recursive}),i=e.op==="boost"?oe:se,u=[],f=[];for(let l of n.sources){if(!i.appliesTo([l])){f.push({path:l.path,error:k(e.op,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});continue}let p=re(l,e.target);if(p){f.push({path:l.path,error:p});continue}u.push(...i.plan([l],{target:e.target,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.scale===void 0?{}:{scale:e.scale},...e.options.quality===void 0?{}:{quality:e.options.quality},...e.output===void 0?{}:{output:e.output},roots:n.roots}))}let d=u.length>1;d&&r.onProgress?.({completed:0,total:u.length});let c=await I(u,{force:e.force,concurrency:1,...r.signal===void 0?{}:{signal:r.signal},onEvent:S(r,d)});return{kind:t,results:c.results,failures:[...n.failures,...f,...c.refusals,...c.failures],inputBytes:c.inputBytes,outputBytes:c.outputBytes}}async function He(e,r){let t=e.crop!==void 0?"crop":e.resize!==void 0?"resize":"trim",o=e.target===void 0?void 0:be(e.target,t);if(o)return b(e.kind,[{path:"",error:o}]);let s=await y(e.inputs,{recursive:e.recursive}),a=[],n=[],i=[];for(let p of s.sources)p.kind==="image"&&e.media===void 0?a.push(p):p.kind==="media"&&!e.trim?n.push(p):p.kind==="image"?i.push({path:p.path,error:k("cut","it works on video and sound, not images","Try a video or sound file, such as a MOV, MP4 or WAV.")}):i.push({path:p.path,error:k(t,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});let u=ne(n,{...e.media===void 0?{}:{media:e.media},...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots}),d=[...ae(a,{trim:e.trim,...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.options.quality===void 0?{}:{quality:e.options.quality}}),...u],c=d.length>1;c&&r.onProgress?.({completed:0,total:d.length});let l=await I(d,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},onEvent:S(r,c)});return{kind:e.kind,results:l.results,failures:[...s.failures,...i,...l.refusals,...l.failures],inputBytes:l.inputBytes,outputBytes:l.outputBytes}}async function Le(e,r){let t=await y(e.inputs,{recursive:e.recursive}),o=m=>m.kind==="document"&&m.format==="pdf",s=C(e.target),a=s?t.sources.filter(o):[],n=s?t.sources.filter(m=>!o(m)):t.sources,i=[],u=[],f=We(e.passwordStdin??!1,r.interactive??!0);for(let m of a){let v=await ze(m,e,f,t.roots.get(m.path));"failure"in v?u.push(v.failure):i.push(v.job)}let d=await we({resolved:{sources:n,failures:[],roots:t.roots},target:e.target,options:e.options,force:e.force,...e.output===void 0?{}:{output:e.output}}),c=[...d.jobs,...i],l=c.length>1;l&&r.onProgress?.({completed:0,total:c.length});let p=await I(c,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(r,l)});return{kind:"convert",results:p.results,failures:[...t.failures,...u,...d.failures,...p.refusals,...p.unreachable.map(m=>({path:m.job.sources[0].path,error:m.error})),...p.failures],inputBytes:p.inputBytes,outputBytes:p.outputBytes}}async function Ue(e,r={}){try{if(e.kind==="pageop")return await qe(e);if(e.kind==="extension-op")return await Ge(e,r);if(e.kind==="edit")return await He(e,r);if(e.kind==="preset"){let{runPresetCommand:t}=await import("./preset-command-XXKLUJOS.js");return await t(e)}return e.kind==="compress"?await Ve(e,r):await Le(e,r)}catch(t){if(!P(t))throw t;return b(e.kind,[{path:"",error:t}])}}function Ye(e,r){let t=A(e.failures);if(r.json)return{exitCode:t,stdout:[JSON.stringify(fe(g,e))],stderr:[]};let o=e.results.length===0?[]:e.kind==="pageop"?$e(e):e.results.length===1?Pe(e):ke(e);return{exitCode:t,stdout:o,stderr:B(e.failures,{debug:r.debug})}}function Ke(e,r){let t=[{path:"",error:e}],o=A(t);return r.json?{exitCode:o,stdout:[JSON.stringify(le(g,e))],stderr:[]}:{exitCode:o,stdout:[],stderr:B(t,{debug:r.debug})}}async function Qe(e,r){let{runConfig:t}=await import("./config-command-6GXRV627.js"),o=await t(e);return r?{exitCode:0,stdout:[JSON.stringify(he(g,o.config,o.warnings))],stderr:[]}:{exitCode:0,stdout:o.stdout,stderr:[]}}async function zt(e,r={}){let t=r.json??!1,o="debug"in e?e.debug:!1;try{if(e.kind==="config")return await Qe(e,t);if(e.kind==="clip"){let{runClipCommand:n}=await import("./clip-command-QPLYCGJ2.js");return await n(e,{...r,json:t,debug:o})}if(e.kind==="update"){let{runUpdate:n}=await import("./update-command-DJLYU6AB.js"),i=await n(g,{...r.onInstalling?{onInstalling:r.onInstalling}:{}});return{exitCode:0,stdout:t?[JSON.stringify({forge:g,ok:!0,...i.data})]:i.stdout,stderr:[]}}if(e.kind==="uninstall"){let{runUninstall:n}=await import("./entry-REXB6JNP.js"),i=[];return{exitCode:await n(g,f=>i.push(f)),stdout:i,stderr:[]}}if(e.kind==="extensions"){let{runExtensions:n}=await import("./extensions-command-TLW53BUK.js"),i=await n(e,{onDownload:r.onDownload});return{exitCode:0,stdout:t?[JSON.stringify(ye(g,i.data))]:i.stdout,stderr:[]}}if(e.kind==="formats")return t?{exitCode:0,stdout:[JSON.stringify(me(g,te()))],stderr:[]}:{exitCode:0,stdout:Re(),stderr:[]};if(e.kind==="probe"){let{probes:n,failures:i}=await Ie(e.inputs),u=A(i);return t?{exitCode:u,stdout:[JSON.stringify(ge(g,{probes:n,failures:i}))],stderr:[]}:{exitCode:u,stdout:n.flatMap((f,d)=>[...d>0?[""]:[],...Ee(f)]),stderr:B(i,{debug:o})}}if(e.kind==="palette"||e.kind==="scale"){let{runPalette:n,runScale:i}=await import("./colour-PZOAKNTH.js"),u={json:t,colour:r.colour??!1};return e.kind==="palette"?await n(e,u):await i(e,u)}if(e.kind==="transcribe"){let{runTranscribeCommand:n}=await import("./transcribe-command-Q4J3WTOB.js"),i=[],u=[],f;return{exitCode:await n(e,{out:c=>i.push(c),err:c=>u.push(c),finished:c=>{f=T("Transcribe",c)}}),stdout:i,stderr:u,...f?{notice:f}:{}}}if(e.kind==="shell")return{exitCode:0,stdout:[],stderr:[]};if(e.kind==="watch")throw N("forge watch runs in a terminal until ctrl-c.","Try: forge watch ./images --to webp");let s=await Ue(e,r),a=T(Ae(e),X(s.results,s.failures));return{...Ye(s,{json:t,debug:o}),...a?{notice:a}:{}}}catch(s){if(!P(s))throw s;return Ke(s,{json:t,debug:o})}}export{Ie as a,xe as b,A as c,Ue as d,Ye as e,zt as f};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{H as $}from"./chunk-WIPP5TWQ.js";var _=[{w:1,h:1,label:"1:1"},{w:4,h:5,label:"4:5"},{w:16,h:9,label:"16:9"},{w:9,h:16,label:"9:16"}],v=20,D=10,p=t=>Math.max(1,Math.round(t)),u=(t,e,n)=>Math.min(Math.max(t,e),n);function P(t,e){let n=p(t.width*e.h/e.w),[r,i]=n<=t.height?[t.width,n]:[Math.min(t.width,p(t.height*e.w/e.h)),t.height];return{left:Math.floor((t.width-r)/2),top:Math.floor((t.height-i)/2),width:r,height:i}}var T=(t,e)=>e.width===t.width&&e.height===t.height;function N(t){return _.filter(e=>!T(t,P(t,e)))}function W(t,e,n,r){let i=P(t,e),o,h;return e.w>=e.h?(o=p(i.width*r/100),h=Math.min(t.height,p(o*e.h/e.w))):(h=p(i.height*r/100),o=Math.min(t.width,p(h*e.w/e.h))),{left:u(Math.round(n.x-o/2),0,t.width-o),top:u(Math.round(n.y-h/2),0,t.height-h),width:o,height:h}}function k(t,e,n,r){return{...e,left:u(e.left+n,0,t.width-e.width),top:u(e.top+r,0,t.height-e.height)}}function E(t,e){return{x:e.width<t.width,y:e.height<t.height}}function H(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}function Z(t,e){return Math.round(e.width*e.height*100/(t.width*t.height))}var F=t=>`${t.w}:${t.h}`,I=t=>`cropped-${t.w}x${t.h}`;function L(t){let e=/^(\d{1,3}):(\d{1,3})$/.exec(t.trim()),n=Number(e?.[1]),r=Number(e?.[2]);if(!e||n<1||n>100||r<1||r>100)throw $(`"${t}" is not a shape; it takes two whole numbers from 1 to 100, as W:H.`,"Try --crop 1:1 or --crop 16:9.");return{w:n,h:r}}function q(t,e,n){let r=n*2,i=new Uint8Array(e*r*3),o=t.alpha?new Uint8Array(e*r):void 0,h=t.width/e,M=t.height/r;for(let c=0;c<r;c++){let w=c*M,y=w+M;for(let s=0;s<e;s++){let f=s*h,b=f+h,A=0,S=0,B=0,a=0,x=0;for(let d=Math.floor(w);d<Math.min(Math.ceil(y),t.height);d++){let R=Math.min(d+1,y)-Math.max(d,w);for(let l=Math.floor(f);l<Math.min(Math.ceil(b),t.width);l++){let C=d*t.width+l,U=(Math.min(l+1,b)-Math.max(l,f))*R,m=U*(t.alpha?(t.alpha[C]??0)/255:1),g=C*3;A+=(t.rgb[g]??0)*m,S+=(t.rgb[g+1]??0)*m,B+=(t.rgb[g+2]??0)*m,a+=m,x+=U}}let O=c*e+s;a>0&&i.set([A/a,S/a,B/a].map(Math.round),O*3),o&&x>0&&(o[O]=Math.round(a*255/x))}}return{cols:e,dotRows:r,rgb:i,...o?{alpha:o}:{}}}export{_ as a,v as b,D as c,P as d,N as e,W as f,k as g,E as h,H as i,Z as j,F as k,I as l,L as m,q as n};
3
+ import{E as $}from"./chunk-CVNYUROW.js";var _=[{w:1,h:1,label:"1:1"},{w:4,h:5,label:"4:5"},{w:16,h:9,label:"16:9"},{w:9,h:16,label:"9:16"}],v=20,D=10,p=t=>Math.max(1,Math.round(t)),u=(t,e,n)=>Math.min(Math.max(t,e),n);function P(t,e){let n=p(t.width*e.h/e.w),[r,i]=n<=t.height?[t.width,n]:[Math.min(t.width,p(t.height*e.w/e.h)),t.height];return{left:Math.floor((t.width-r)/2),top:Math.floor((t.height-i)/2),width:r,height:i}}var T=(t,e)=>e.width===t.width&&e.height===t.height;function N(t){return _.filter(e=>!T(t,P(t,e)))}function W(t,e,n,r){let i=P(t,e),o,h;return e.w>=e.h?(o=p(i.width*r/100),h=Math.min(t.height,p(o*e.h/e.w))):(h=p(i.height*r/100),o=Math.min(t.width,p(h*e.w/e.h))),{left:u(Math.round(n.x-o/2),0,t.width-o),top:u(Math.round(n.y-h/2),0,t.height-h),width:o,height:h}}function k(t,e,n,r){return{...e,left:u(e.left+n,0,t.width-e.width),top:u(e.top+r,0,t.height-e.height)}}function E(t,e){return{x:e.width<t.width,y:e.height<t.height}}function H(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}function Z(t,e){return Math.round(e.width*e.height*100/(t.width*t.height))}var F=t=>`${t.w}:${t.h}`,I=t=>`cropped-${t.w}x${t.h}`;function L(t){let e=/^(\d{1,3}):(\d{1,3})$/.exec(t.trim()),n=Number(e?.[1]),r=Number(e?.[2]);if(!e||n<1||n>100||r<1||r>100)throw $(`"${t}" is not a shape; it takes two whole numbers from 1 to 100, as W:H.`,"Try --crop 1:1 or --crop 16:9.");return{w:n,h:r}}function q(t,e,n){let r=n*2,i=new Uint8Array(e*r*3),o=t.alpha?new Uint8Array(e*r):void 0,h=t.width/e,M=t.height/r;for(let c=0;c<r;c++){let w=c*M,y=w+M;for(let s=0;s<e;s++){let f=s*h,b=f+h,A=0,S=0,B=0,a=0,x=0;for(let d=Math.floor(w);d<Math.min(Math.ceil(y),t.height);d++){let R=Math.min(d+1,y)-Math.max(d,w);for(let l=Math.floor(f);l<Math.min(Math.ceil(b),t.width);l++){let C=d*t.width+l,U=(Math.min(l+1,b)-Math.max(l,f))*R,m=U*(t.alpha?(t.alpha[C]??0)/255:1),g=C*3;A+=(t.rgb[g]??0)*m,S+=(t.rgb[g+1]??0)*m,B+=(t.rgb[g+2]??0)*m,a+=m,x+=U}}let O=c*e+s;a>0&&i.set([A/a,S/a,B/a].map(Math.round),O*3),o&&x>0&&(o[O]=Math.round(a*255/x))}}return{cols:e,dotRows:r,rgb:i,...o?{alpha:o}:{}}}export{_ as a,v as b,D as c,P as d,N as e,W as f,k as g,E as h,H as i,Z as j,F as k,I as l,L as m,q as n};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as H,b as U,f as V}from"./chunk-TDYKRRZH.js";import{b as z,c as L,m as E,n as J,o as D,q as T,r as W,t as O,u as $,w as q,x as N,y as C}from"./chunk-3GHHQNR6.js";import{b as w}from"./chunk-ZYIW4MAG.js";import{b as _}from"./chunk-IJRLRAC5.js";import{d as x}from"./chunk-7VR6LODN.js";import{a as P}from"./chunk-5IZBFF6Y.js";import{f as B,g as M,h as K}from"./chunk-TFOEI5VF.js";import{b as k}from"./chunk-BIBDLXCG.js";import{a as I}from"./chunk-J7FLFHQJ.js";import{a as v}from"./chunk-H3DIRJFE.js";import{existsSync as R}from"node:fs";import{basename as Z,dirname as ee,extname as te,join as ne}from"node:path";var oe={images:"an image",pdfs:"a PDF",documents:"a document",videos:"a video",audio:"audio",other:"a file Forge reads"};function re(e){let t=Object.keys(e).filter(s=>e[s]);if(t.length===0)return"not supported";let n=t.map(s=>oe[s]);return`not ${n.length===1?n[0]:`${n.slice(0,-1).join(", ")} or ${n.at(-1)}`}`}function se(e){return e.kind==="document"?e.format==="pdf"?"no images to shrink":"nothing to compress":`${v[e.format].label} is lossless`}function ie(e,t,n){if(e.kind!=="image")return{left:"images only"};let s=e,r=n===void 0?{}:{output:n};if(t.tool==="sharpen"||t.tool==="boost"){let a=t.tool==="sharpen"?1:t.scale??2;if(B(s.width,s.height,a))return{left:a===1?"too large":`too large for ${a}\xD7`};let[f]=z.plan([s],{scale:String(a),target:x(s),...r});return f?{job:f}:{left:"not supported"}}if(t.tool==="cutout"){let[a]=L.plan([s],{target:"png",...r});return a?{job:a}:{left:"not supported"}}if(t.tool==="rotate"){if(s.frames>1)return{left:"animated"};let[a]=q.plan([s],{turn:t.turn??90,...r});return a?{job:a}:{left:"not supported"}}if(t.tool==="deband"){if(s.frames>1)return{left:"animated"};let[a]=C.plan([s],{deband:t.level??M[K].id,target:x(s),...r});return a?{job:a}:{left:"not supported"}}if(t.tool==="dither"){if(!W(s))return{left:"animated"};let[a]=N.plan([s],{dither:t.colours??D[0],target:T(s),...r});return a?{job:a}:{left:"not supported"}}if(t.tool==="trim"&&s.frames>1)return{left:"animated"};let o=t.tool==="trim"?O:$,[i]=o.plan([s],{target:x(s),...t.resize?{resize:t.resize}:{},...r});return i?{job:i}:{left:"not supported"}}function ae(e,t,n){if(t.op==="edit")return ie(e,t,n);if(e.kind==="media")return{left:"one at a time"};let s=n===void 0?{}:{destination:n};if(t.op==="compress"){if(!E.appliesTo([e]))return{left:se(e)};if(t.targetBytes!==void 0&&e.bytes<=t.targetBytes)return{left:"already under that size"};let[i]=E.plan([e],{mode:t.targetBytes===void 0?"quality":"size",...t.quality===void 0?{}:{quality:t.quality},...s});return i?{job:i}:{left:"not supported"}}let r=t.answers[U(e)];if(!r)return{left:re(t.answers)};if(e.format===r.target)return{left:`already ${v[r.target].label}`};if(!P(e).includes(r.target))return{left:`can\u2019t become ${v[r.target].label}`};let[o]=J.plan([e],{target:r.target,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:String(r.dpi)},pages:"all",...s});return o?.op==="convert"?{job:o}:{left:"not supported"}}function le(e,t){if(!t(e))return e;let n=te(e),s=Z(e,n);for(let r=1;;r++){let o=ne(ee(e),k(s,` (${r})${n}`));if(!t(o)&&!R(o))return o}}function ce(e,t,n,s={}){let r=s.existing??"leave",o=ae(e,t,s.destination);if(!("job"in o))return o;let{job:i}=o,a=i.outputs.some(l=>R(l)&&!n.has(l));if(a&&r==="leave")return{left:t.op==="compress"?"already compressed":t.op==="edit"?"already edited":"already converted"};let f=r==="number"?l=>n.has(l)||R(l):l=>n.has(l);i.outputs=i.outputs.map(l=>le(l,f));for(let l of i.outputs)n.add(l);return a&&r==="ask"?{job:i,taken:!0}:{job:i}}function S(e,t,n,s={}){let r=[],o=[],i=[];for(let a of e){let f=ce(a,t,n,s);"job"in f?(r.push(f.job),f.taken&&i.push(f.job)):o.push({path:a.path,reason:f.left})}return{jobs:r,left:o,taken:i}}async function G(e,t,n={}){let s=new Set,r=n.existing??"leave",{jobs:o,left:i}=S(e,t,s,{destination:n.destination,existing:r});return{outcome:await w(o,{force:r==="replace",...t.op==="compress"&&t.targetBytes!==void 0?{targetBytes:t.targetBytes}:{},...n.concurrency===void 0?{}:{concurrency:n.concurrency},...n.onEvent?{onEvent:n.onEvent}:{},...n.signal?{signal:n.signal}:{}}),left:i,claimed:s,jobs:o}}function Q(e,t){let{outcome:n,left:s}=t,r=new Map;for(let o of n.results){let i=o.job.sources[0].path;r.set(i,{path:i,state:"done",result:o})}for(let o of[...n.refusals,...n.failures])if(o.error.code==="cannot-compress-more"){let i=o.error.short==="nothing written"?"can\u2019t get smaller":"already under that size";r.set(o.path,{path:o.path,state:"left",reason:i})}else o.error.code==="nothing-to-trim"?r.set(o.path,{path:o.path,state:"left",reason:"no empty edges"}):r.set(o.path,{path:o.path,state:"failed",reason:o.error.title.toLowerCase()});for(let o of n.unreachable){let i=o.job.sources[0].path;r.set(i,{path:i,state:"left",reason:`can\u2019t get below ${I(o.smallest)}`})}for(let o of s)r.set(o.path,{path:o.path,state:"left",reason:o.reason});return e.map(o=>r.get(o.path)??{path:o.path,state:"left",reason:n.cancelled?"stopped":"not run"})}import{watch as fe}from"node:fs";import{readdir as de,stat as ue}from"node:fs/promises";import{join as pe,resolve as X}from"node:path";function Y(e,t,n){let s=X(e),r=n.settleMs??1e3,o=n.pollMs??500,i=new Set([...t].map(m=>X(m))),a=new Map,f=!1,l=!1,d=!1,p=async()=>{if(!f){if(l){d=!0;return}l=!0;try{let m=await de(s,{withFileTypes:!0}).catch(()=>[]),g=new Set;for(let c of m){if(!c.isFile()||H(c.name))continue;let u=pe(s,c.name);if(g.add(u),i.has(u)||n.ignore?.(u))continue;let b=await ue(u).catch(()=>{});if(!b||f)continue;let F=Date.now(),y=a.get(u);if(!y||y.size!==b.size||y.mtimeMs!==b.mtimeMs){a.set(u,{size:b.size,mtimeMs:b.mtimeMs,since:F});continue}F-y.since<r||(a.delete(u),i.add(u),n.onFile(u))}for(let c of[...i,...a.keys()])g.has(c)||(i.delete(c),a.delete(c))}finally{l=!1,d&&!f&&(d=!1,p())}}},j=setInterval(()=>{p()},o),h;try{h=fe(s,{persistent:!1},()=>{p()}),h.on("error",()=>{})}catch{}return p(),{close(){f=!0,clearInterval(j),h?.close()}}}var A=e=>"op"in e&&(e.op==="convert"||e.op==="compress"||e.op==="edit")?e:{op:"convert",answers:e};function me(e,t,n,s){let{jobs:r,left:o}=S(e,A(t),n,{destination:s});return{jobs:r,left:o}}async function Ne(e,t,n={}){return G(e.sources,A(t),n)}var ge=(e,t)=>e==="other"?t==="text"?"a text file":"not supported":"not yet supported";function Ce(e){let t=_(e.concurrency),n=A(e.answers),s=[],r=new Set,o=!1,i=async l=>{e.onEvent({type:"arrived",path:l}),e.onEvent({type:"phase",path:l,phase:"reading"});let d=await V(l);if(d.kind==="failed"){e.onEvent({type:"failed",path:l,error:d.failure.error});return}if(d.kind!=="source"){e.onEvent({type:"left",path:l,reason:ge(d.kind,d.sniffed)});return}let{jobs:p,left:j}=me([d.source],n,e.claimed,e.destination),[h]=j;if(h){e.onEvent({type:"left",path:l,reason:h.reason});return}let m=await w(p,{force:!1,concurrency:1,...n.op==="compress"&&n.targetBytes!==void 0?{targetBytes:n.targetBytes}:{},onEvent:c=>{c.type==="job:phase"&&"phase"in c.progress&&c.progress.phase!=="page"&&c.progress.phase!=="time"&&c.progress.phase!=="tiles"&&e.onEvent({type:"phase",path:l,phase:c.progress.phase,job:c.job})}}),[g]=Q([d.source],{outcome:m,left:[],claimed:e.claimed,jobs:p});if(g?.result)e.onEvent({type:"converted",path:l,result:g.result});else if(g?.state==="left")e.onEvent({type:"left",path:l,reason:g.reason??""});else{let c=[...m.refusals,...m.failures][0];c&&e.onEvent({type:"failed",path:l,error:c.error})}},a=()=>{for(;!o&&r.size<t&&s.length>0;){let l=s.shift(),d=i(l).catch(()=>{}).finally(()=>{r.delete(d),a()});r.add(d)}},f=Y(e.dir,e.known,{...e.settleMs===void 0?{}:{settleMs:e.settleMs},...e.pollMs===void 0?{}:{pollMs:e.pollMs},ignore:l=>e.claimed.has(l),onFile:l=>{s.push(l),a()}});return{async stop(){o=!0,f.close(),s.length=0,await Promise.all([...r])}}}export{S as a,Q as b,Ne as c,Ce as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as w,b as I,d as k,e as m}from"./chunk-ZOQA3JAR.js";import{a as $,c as O}from"./chunk-TYWGB767.js";import{b as h,d as P,e as R}from"./chunk-ITJZ7ODJ.js";import{e as x}from"./chunk-57M4J2BR.js";import{a as l}from"./chunk-AFEYLHDD.js";import{j as B}from"./chunk-EPDF4NQI.js";import{$ as v,Y as g,Z as C}from"./chunk-CVNYUROW.js";import{a as f}from"./chunk-J7FLFHQJ.js";import{b as p}from"./chunk-VLVNA4T3.js";import{a as c}from"./chunk-H3DIRJFE.js";import{dirname as S,join as q}from"node:path";async function T(t){if(t.fallback!==void 0)return t.fallback;let{loadPreferences:r,expandTilde:e}=await import("./preferences-3P4V2EDX.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!$())throw C();return O()}function E(t,r,e,o){let a=q(r.outDir,`Copied image${c[o].extensions[0]}`),s={inputs:[r.source],output:a,force:!1,recursive:!1,debug:t.debug},n={background:"#ffffff",keepMetadata:!1,...t.quality===void 0?{}:{quality:t.quality}};return o===e?{kind:"compress",...s,options:n,...t.quality===void 0?{}:{quality:t.quality},...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}:{kind:"convert",...s,target:o,options:n,...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}}async function J(t,r={}){let e=r.clip??{},o=F(e),a=await w(o,e.root);if(!a)throw g((await o.peek()).text?"text":"nothing");let s=await B(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await P(b,r),y=i.results[0];if(!y||i.failures.length>0)return{report:i,status:"failed"};let u=y.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await I(o,a,u,n)==="changed")return{...d,status:"changed",saved:await m(u,await T(e))};if(t.save===void 0)return{...d,status:"placed"};let j=t.save===!0?await T(e):t.save,{expandTilde:D}=await import("./preferences-3P4V2EDX.js");return{...d,status:"placed",saved:await m(u,D(j))}}function N(t){let r=t.target===t.source.format?"":` as ${c[t.target].label}`,e=` ${f(t.source.bytes)} \u2192 ${f(t.report.outputBytes)} \xB7 ${h(t.source.bytes,t.report.outputBytes)}`;if(t.status==="changed"){let a=t.target===t.source.format?"compressed":"converted";return[`\u2713 Copied image \u2192 ${p(t.saved)}${r}`,e,"","\u26A0 Clipboard changed"," The file you uploaded is no longer in the clipboard.",` The ${a} image is saved to ${p(S(t.saved))}.`]}let o=t.saved===void 0?"":` + ${p(t.saved)}`;return[`\u2713 Copied image \u2192 clipboard${r}${o}`,e]}async function U(t){if(!await k(F(t),t.root))throw v()}async function Z(t,r){if(t.undo)return await U(r.clip??{}),{exitCode:0,stdout:r.json?[JSON.stringify({forge:l,ok:!0,clipboard:"restored"})]:["\u2713 The original is back on the clipboard"],stderr:[]};let e=await J(t,r);if(e.status==="failed")return R(e.report,r);if(r.json){let o={...x(l,e.report),clipboard:e.status,...e.saved===void 0?{}:{saved:e.saved}};return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:N(e),stderr:[]}}export{J as a,N as b,U as c,Z as d};
@@ -0,0 +1,82 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{A as ge,B as le,C as pe,D as he,a,b as te,c as re,d as k,e as $,f as O,g as D,h as ie,j as oe,k as l,l as A,m as se,n as x,o as H,p as ae,q as E,r as L,s as R,t as ce,u as I,v as ue,w as fe,x as me,y as de,z as B}from"./chunk-3CLPUPJT.js";import{r as M}from"./chunk-BIBDLXCG.js";import{execFile as Ye}from"node:child_process";import{chmodSync as Q,existsSync as Ie,mkdirSync as Z,readdirSync as be,readFileSync as N,rmdirSync as qe,rmSync as p,writeFileSync as We}from"node:fs";import{dirname as P,join as c}from"node:path";var je={convert:"#55c7d9",compress:"#79c98b",edit:"#b39ae8",pdf:"#ff6b4a"},_e="#55c7d9",Ge="#a68ce0",Te=4/5,Je=(e,n,t,i)=>`<path fill="${i}" d="M${e} ${n}h${4*t}v${t}h${-3*t}v${t}h${2*t}v${t}h${-2*t}v${2*t}h${-t}z"/>`;function Ke(e,n){let t=n<=20,i=t?3:4,r=t?6:4.6,o=t?51:51.5,m=Array.from({length:i},(g,w)=>o-(i-1-w)*r).map(g=>`<line x1="${g}" y1="66" x2="${g+66*Te}" y2="0"/>`).join(""),u=e==="forge"?"url(#w)":je[e];return`<svg width="${n}" height="${n}" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="w" gradientUnits="userSpaceOnUse" x1="34" y1="0" x2="62" y2="0"><stop offset="0" stop-color="${_e}"/><stop offset="1" stop-color="${Ge}"/></linearGradient><clipPath id="c"><rect width="64" height="64" rx="14"/></clipPath><clipPath id="i"><rect x="1.5" y="1.5" width="61" height="61" rx="12.5"/></clipPath></defs><g clip-path="url(#c)"><rect width="64" height="64" fill="#1e1e1e"/><g clip-path="url(#i)" stroke="${u}" stroke-width="${t?3.6:2.4}">${m}</g>${Je(16,12,8,"#e7e7e7")}</g><rect x=".75" y=".75" width="62.5" height="62.5" rx="13.5" fill="none" stroke="#3a3a3a" stroke-width="1.5"/></svg>`}async function v(e,n){let{default:t}=await import("sharp");return t(Buffer.from(Ke(e,n))).png().toBuffer()}function ye(e){let n=Buffer.alloc(6);n.writeUInt16LE(0,0),n.writeUInt16LE(1,2),n.writeUInt16LE(e.length,4);let t=6+16*e.length,i=e.map(({size:r,png:o})=>{let s=Buffer.alloc(16);return s[0]=r>=256?0:r,s[1]=r>=256?0:r,s.writeUInt16LE(1,4),s.writeUInt16LE(32,6),s.writeUInt32LE(o.length,8),s.writeUInt32LE(t,12),t+=o.length,s});return Buffer.concat([n,...i,...e.map(r=>r.png)])}function h(e){let n=[{action:"open",label:"Open Forge",kinds:["image","folder"],window:!0,paint:"forge"},{action:"convert",label:"Convert in Forge",kinds:["image","folder"],window:!0,paint:"convert"},{action:"compress",label:"Compress in Forge",kinds:["image","folder"],window:!0,paint:"compress"},{action:"sharpen",label:"Sharpen in Forge",kinds:["image"],window:!1,paint:"edit"},{action:"open-pdf",label:"Open in Forge",kinds:["pdf"],window:!0,paint:"pdf"}],t=(e.presets??[]).map(i=>({action:"preset",preset:i,label:`${i} in Forge`,kinds:["image"],window:!1,paint:"forge"}));return[...e.sharpen?n:n.filter(i=>i.action!=="sharpen"),...t]}var U="Forge was uninstalled",j="Its menu items are removed.",we="Forge could not start",$e="Run forge in a terminal once to set its menu up again.";function xe(e){let{osascript:n,pbs:t}=e.tools??{osascript:"/usr/bin/osascript",pbs:"/System/Library/CoreServices/pbs"},i=[e.node,...e.execArgv,e.forge].map(a).join(" "),[r,o]=$({on:[],off:e.services,osascript:n}),s=[r,...o].map(a).join(" "),m=(u,g)=>`${a(n)} -e 'display notification "${g}" with title "${u}"'`;return`#!/bin/sh
4
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
5
+ if [ ! -f ${a(e.forge)} ]; then
6
+ # Forge is gone: take its menu with it, and say so once.
7
+ ${e.bundles.map(u=>` rm -rf ${a(u)}`).join(`
8
+ `)}
9
+ rm -rf ${a(e.menuDir)}
10
+ ${s}
11
+ ${a(t)} -update
12
+ ${m(U,j)}
13
+ exit 0
14
+ fi
15
+ if [ ! -x ${a(e.node)} ]; then
16
+ ${m(we,$e)}
17
+ exit 1
18
+ fi
19
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
20
+ `}exec ${i} menu run "$@"
21
+ `}function ve(e){let n=e.xdgConfigHome===void 0?{}:{XDG_CONFIG_HOME:e.xdgConfigHome};return`// Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
22
+ import { execFileSync, spawn } from 'node:child_process'
23
+ import { existsSync, rmSync } from 'node:fs'
24
+
25
+ const FORGE = ${JSON.stringify(e.forge)}
26
+ const ARGS = ${JSON.stringify(e.execArgv)}
27
+ const MENU = ${JSON.stringify(e.menuDir)}
28
+ const KEYS = ${JSON.stringify(e.keys)}
29
+ const ENV = ${JSON.stringify(n)}
30
+
31
+ if (existsSync(FORGE)) {
32
+ const child = spawn(process.execPath, [...ARGS, FORGE, 'menu', 'run', ...process.argv.slice(2)], {
33
+ stdio: 'inherit',
34
+ windowsHide: true,
35
+ env: { ...process.env, ...ENV },
36
+ })
37
+ child.on('exit', (code) => process.exit(code ?? 0))
38
+ } else {
39
+ // Forge is gone: say so while its app ID still exists, then take the menu with it.
40
+ try {
41
+ execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', ${JSON.stringify(he(U,j))}], { windowsHide: true })
42
+ } catch {}
43
+ for (const key of KEYS) {
44
+ try {
45
+ execFileSync('reg.exe', ['delete', key, '/f'], { windowsHide: true, stdio: 'ignore' })
46
+ } catch {}
47
+ }
48
+ rmSync(MENU, { recursive: true, force: true })
49
+ }
50
+ `}function Ve(){return`say() {
51
+ if command -v notify-send >/dev/null 2>&1; then
52
+ notify-send --app-name=Forge -- "$1" "$2" >/dev/null 2>&1
53
+ elif command -v gdbus >/dev/null 2>&1; then
54
+ ${["gdbus call --session --dest org.freedesktop.Notifications","--object-path /org/freedesktop/Notifications","--method org.freedesktop.Notifications.Notify",`Forge 0 "''" "\\"$1\\"" "\\"$2\\"" '[]' '{}' -1`].join(" ")} >/dev/null 2>&1
55
+ fi
56
+ }`}function Se(e){let n=[e.node,...e.execArgv,e.forge].map(a).join(" "),t=e.files.map(a).join(` \\
57
+ `),i="";if(e.thunar!==void 0){let r=a(e.thunar.file),o=a(`${e.thunar.file}.forge-tmp`),s=a(e.thunar.seed),m=['/<action>/ { held = ""; holding = 1 }',`holding { held = held $0 "\\n"; if (/<\\/action>/) { holding = 0; if (held !~ /<unique-id>${e.marker}-/) printf "%s", held }; next }`,"{ print }"].join(`
58
+ `);i=` if [ -f ${r} ] && grep -qF '<unique-id>${e.marker}-' ${r}; then
59
+ awk ${a(m)} ${r} > ${o} && mv -f ${o} ${r}
60
+ if [ -f ${s} ] && cmp -s ${s} ${r}; then rm -f ${r}; fi
61
+ fi
62
+ `}return`#!/bin/sh
63
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
64
+ ${Ve()}
65
+ if [ ! -f ${a(e.forge)} ]; then
66
+ # Forge is gone: take its menu with it, and say so once.
67
+ for f in ${t}; do
68
+ if [ -f "$f" ] && grep -qF ${a(e.marker)} "$f"; then rm -f "$f"; fi
69
+ done
70
+ ${i}${e.folders.map(r=>` rmdir ${a(r)} 2>/dev/null
71
+ `).join("")} rm -rf ${a(e.menuDir)}
72
+ say ${a(U)} ${a(j)}
73
+ exit 0
74
+ fi
75
+ if [ ! -x ${a(e.node)} ]; then
76
+ say ${a(we)} ${a($e)}
77
+ exit 1
78
+ fi
79
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
80
+ `}exec ${n} menu run "$@"
81
+ `}var b="HKCU\\Software\\Classes",Me=`${b}\\SystemFileAssociations\\image\\shell\\Forge`,ke=`${b}\\Directory\\shell\\Forge`,G=`${b}\\SystemFileAssociations\\.pdf\\shell\\ForgeOpen`,De=`${b}\\AppUserModelId\\${le}`,J=()=>[Me,ke,G,De],K=e=>`${e.paint}.ico`;function Ee(e){let n=o=>`conhost.exe --headless "${e.node}" "${e.menuDir}\\run.mjs" ${o.action}${o.preset===void 0?"":` ${o.preset}`} "%1"`,t=o=>`${e.menuDir}\\${K(o)}`,i=(o,s)=>{let m=e.items.filter(u=>u.kinds.includes(s));return m.length===0?[]:[{key:o,values:{MUIVerb:"Forge",Icon:t({paint:"forge"}),SubCommands:""}},...m.flatMap((u,g)=>{let w=u.preset===void 0?u.action:`preset-${u.preset}`,f=`${o}\\shell\\${g+1}${w}`;return[{key:f,values:{MUIVerb:u.label,Icon:t(u)}},{key:`${f}\\command`,values:{"":n(u)}}]})]},r=e.items.find(o=>o.kinds.includes("pdf"));return[...i(Me,"image"),...i(ke,"folder"),...r?[{key:G,values:{MUIVerb:r.label,Icon:t(r)}},{key:`${G}\\command`,values:{"":n(r)}}]:[],{key:De,values:{DisplayName:"Forge",IconUri:`${e.menuDir}\\forge.png`}}]}var T=e=>`'${pe(e)}'`,_=e=>T(`Registry::${e.replace(/^HKCU\\/,"HKEY_CURRENT_USER\\")}`);function V(e){return["$ErrorActionPreference = 'Stop'",...J().map(t=>`Remove-Item -Path ${_(t)} -Recurse -Force -ErrorAction SilentlyContinue`),...e.flatMap(({key:t,values:i})=>[`New-Item -Path ${_(t)} -Force | Out-Null`,...Object.entries(i).map(([r,o])=>`Set-ItemProperty -LiteralPath ${_(t)} -Name ${T(r===""?"(default)":r)} -Value ${T(o)}`)])].join(`
82
+ `)}var vn=(e,n)=>e.version===n.version&&e.forge===n.forge&&e.node===n.node&&e.execArgv.join("\0")===n.execArgv.join("\0")&&e.xdgConfigHome===n.xdgConfigHome&&(e.presets??[]).join("\0")===(n.presets??[]).join("\0"),Fe="/System/Library/CoreServices/pbs",Pe=e=>c(e.menuDir,"state.json"),S=e=>c(e.home,"Library","Services"),q=e=>h({sharpen:!0}).map(n=>c(S(e),`${n.label}.workflow`)),W=()=>h({sharpen:!0}).map(k);function Ne(e){let n;try{n=be(S(e)).filter(t=>t.endsWith(".workflow"))}catch{return[]}return n.flatMap(t=>{let i=c(S(e),t);try{let r=N(c(i,"Contents","Info.plist"),"utf8"),o=/<key>CFBundleIdentifier<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1],s=/<key>CFBundleName<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1];return!o?.startsWith(re)||s===void 0?[]:[{path:i,key:`${o} - ${(u=>u.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"))(s)} - runWorkflowAsService`}]}catch{return[]}})}function Xe(e){try{return JSON.parse(N(Pe(e),"utf8"))}catch{return}}var Sn=e=>Xe(e)!==void 0,d=(e,n)=>{Z(P(e),{recursive:!0}),We(e,n)};async function Mn(e){if(!Qe(e.platform))return;let n=h({sharpen:e.sharpen,presets:e.presets??[]});if(Z(e.menuDir,{recursive:!0}),e.platform==="linux")await nn(e,n);else if(e.platform==="darwin"){let i=c(e.menuDir,"run"),r=n.filter(f=>f.preset!==void 0),o=r.map(f=>c(S(e),O(f,i).name));d(i,xe({...e,bundles:[...q(e),...o],services:[...W(),...r.map(k)]})),Q(i,493);let s=Ne(e);for(let f of[...q(e),...s.map(C=>C.path)])p(f,{recursive:!0,force:!0});let m=new Map,{default:u}=await import("sharp");for(let f of n){m.has(f.paint)||m.set(f.paint,await u(await v(f.paint,64)).tiff().toBuffer());let{name:C,files:Re}=O(f,i),ne=c(S(e),C);for(let[Be,Ue]of Object.entries(Re))d(c(ne,Be),Ue);d(c(ne,"Contents","Resources",`${te}.tiff`),m.get(f.paint))}let g=n.map(k),w=new Set([...W(),...s.map(f=>f.key)]);await e.run(...$({on:g,off:[...w].filter(f=>!g.includes(f))})),await e.run(Fe,["-update"])}else{d(c(e.menuDir,"run.mjs"),ve({...e,keys:J()}));for(let i of Ce){let r=await Promise.all([16,24,32,48,256].map(async o=>({size:o,png:await v(i,o)})));d(c(e.menuDir,K({paint:i})),ye(r))}d(c(e.menuDir,"forge.png"),await v("forge",256)),await e.run("powershell.exe",Le(V(Ee({...e,items:n}))))}let t={version:e.version,forge:e.forge,node:e.node,execArgv:e.execArgv,...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.presets&&e.presets.length>0?{presets:[...e.presets]}:{}};d(Pe(e),JSON.stringify(t))}var Qe=e=>e==="darwin"||e==="win32"||e==="linux",Ce=["forge","convert","compress","edit","pdf"],Oe=e=>ie({home:e.home,...e.xdgDataHome===void 0?{}:{xdgDataHome:e.xdgDataHome},...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.xdgConfigDirs===void 0?{}:{xdgConfigDirs:e.xdgConfigDirs}});function X(e){let n=h({sharpen:!0}),t=n.map(r=>r.action),i=(r,o)=>{try{return be(r).filter(o).map(s=>c(r,s))}catch{return[]}};return[...new Set([...n.map(r=>c(l(e),A(r))),...i(l(e),()=>!0),...n.map(r=>c(x(e),H(r,t))),...i(x(e),r=>r.startsWith("forge-")&&r.endsWith(".nemo_action")),...R.map(r=>c(E(e),L(r)))])]}var y=e=>{try{return N(e,"utf8")}catch{return}};function Ae(e){for(let n of e)y(n)?.includes(D)&&p(n,{force:!0})}var He=e=>c(e.menuDir,"made.json"),z=e=>{try{return JSON.parse(N(He(e),"utf8"))}catch{return[]}};function F(e,n){let t=[];for(let i=n;!Ie(i)&&P(i)!==i;i=P(i))t.push(i);t.length!==0&&(Z(n,{recursive:!0}),d(He(e),JSON.stringify([...new Set([...z(e),...t])])))}function Ze(e){for(let n of[...e].sort((t,i)=>i.length-t.length))try{qe(n)}catch{}}var ee=e=>c(e.menuDir,"thunar-seed.xml");async function ze(e,n,t,i){let r=I(n),o=y(r);if(o===void 0){if(!ge(n,e.path,Ie))return;o=ue(n).map(y).find(m=>m!==void 0&&B(m,"")!==void 0)??fe,d(ee(e),o),F(e,P(r))}let s=B(o,me(t,{launcher:i,menuDir:e.menuDir}));s!==void 0&&s!==y(r)&&await M(r,Buffer.from(s))}async function en(e,n){let t=I(n),i=y(t);if(i===void 0||!i.includes(`<unique-id>${D}-`))return;let r=de(i);r===y(ee(e))?p(t,{force:!0}):await M(t,Buffer.from(r))}async function Y(e,n,t=!1){await M(e,Buffer.from(n)),t&&Q(e,493)}async function nn(e,n){let t=Oe(e),i=c(e.menuDir,"run");for(let o of Ce)d(c(e.menuDir,oe({paint:o})),await v(o,128));Ae(X(t));let r=h({sharpen:!0}).map(o=>o.action);F(e,l(t));for(let o of n)await Y(c(l(t),A(o)),se(o,i),!0);F(e,x(t));for(let o of n)await Y(c(x(t),H(o,r)),ae(o,i));F(e,E(t));for(let o of R){let s=ce(o,n,{launcher:i,menuDir:e.menuDir});s!==void 0&&await Y(c(E(t),L(o)),s,!0)}await ze(e,t,n,i),d(i,Se({...e,files:X(t),folders:[...new Set([l(t),...z(e)])].sort((o,s)=>s.length-o.length),marker:D,thunar:{file:I(t),seed:ee(e)}})),Q(i,493)}async function tn(e){let n=Oe(e);Ae(X(n)),await en(e,n),Ze([l(n),...z(e)]),p(e.menuDir,{recursive:!0,force:!0})}async function kn(e){if(e.platform==="linux")await tn(e);else if(e.platform==="darwin"){let n=Ne(e);for(let i of[...q(e),...n.map(r=>r.path)])p(i,{recursive:!0,force:!0});p(e.menuDir,{recursive:!0,force:!0});let t=new Set([...W(),...n.map(i=>i.key)]);await e.run(...$({on:[],off:[...t]})),await e.run(Fe,["-update"])}else e.platform==="win32"&&(p(e.menuDir,{recursive:!0,force:!0}),await e.run("powershell.exe",Le(V([]))))}var Le=e=>["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",e],Dn=(e,n)=>new Promise((t,i)=>{Ye(e,n,{timeout:6e4,windowsHide:!0},r=>r?i(r):t())});export{vn as a,Xe as b,Sn as c,Mn as d,Qe as e,kn as f,Dn as g};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{availableParallelism as o}from"node:os";function r(){return Math.max(1,Math.min(o(),8))}function i(e=process.env){e.UV_THREADPOOL_SIZE===void 0&&(e.UV_THREADPOOL_SIZE=String(r()))}export{r as a,i as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as L}from"./chunk-YK26E3OX.js";import{U as S,V as k,W as P,ka as b}from"./chunk-CVNYUROW.js";import{spawn as A}from"node:child_process";var O=new Map;function H(e,n,t={}){let r=()=>(t.onStart?.(),e.serve?j(e,n,t):F(e,n,t)),o=(t.platform??process.platform)==="darwin"?void 0:e.id,s=(O.get(o)??Promise.resolve()).then(()=>e.id===void 0?r():L(e.id,r,{...t.what!==void 0?{what:t.what}:{},...t.signal!==void 0?{signal:t.signal}:{},...t.onWait!==void 0?{onWait:t.onWait}:{}}));return O.set(o,s.catch(()=>{})),s}function N(e){let n=e.indexOf("--in");return(n>=0?e[n+1]:e[0])??""}function J(e){if(e.startsWith('{"progress"'))try{let n=JSON.parse(e);return typeof n.progress!="number"||typeof n.of!="number"||n.of<=0?void 0:{done:n.progress,of:n.of}}catch{return}}function I(e,n,t,r,o,i){return e==="no-subject"?S(t):e==="boost-too-large"?k(t,r.maxScale??0):e==="boost-too-slow"?P(t,i??0,Number(o[o.indexOf("--scale")+1])):b(t,new Error(n))}function W(e){return{width:Number(e.width),height:Number(e.height),ms:Number(e.ms),...typeof e.hasAlpha=="boolean"?{hasAlpha:e.hasAlpha}:{},...Array.isArray(e.pages)?{pages:e.pages}:{}}}function T(e,n,t,r){return I(String(e.code??""),String(e.message??""),n,t,r,typeof e.seconds=="number"?e.seconds:void 0)}function F(e,n,t){let{signal:r}=t,o=t.subject??N(n);return r?.aborted?Promise.reject(r.reason??new Error("aborted")):new Promise((i,s)=>{let[f,w]=e.kind==="node"?[process.execPath,[e.entry,...n]]:[e.entry,n],l=A(f,w,{stdio:["ignore","pipe","pipe"]}),g="",d="",m=!1,a=u=>{m||(m=!0,r?.removeEventListener("abort",x),u())},x=()=>l.kill("SIGKILL");l.on("exit",()=>{r?.aborted&&a(()=>s(r.reason??new Error("aborted")))}),r?.addEventListener("abort",x,{once:!0});let R="";l.stdout.setEncoding("utf8").on("data",u=>{if(g+=u,!t.onProgress&&!t.onLine)return;let v=(R+u).split(`
4
+ `);R=v.pop()??"";for(let h of v){let c=J(h);if(c){t.onProgress?.(c.done,c.of);continue}if(!(!t.onLine||!h.trim().startsWith("{")))try{let y=JSON.parse(h);"ok"in y||t.onLine(y)}catch{}}}),l.stderr.setEncoding("utf8").on("data",u=>{d+=u}),l.on("error",u=>a(()=>s(b(o,u)))),l.on("close",u=>a(()=>{let v=g.split(`
5
+ `).filter(y=>y.trim().startsWith("{")).at(-1),h;try{h=v?JSON.parse(v):void 0}catch{h=void 0}let c=h;if(c&&c.ok===!0&&u===0)return i(W(c));if(c&&c.ok===!1)return s(T(c,o,t,n));s(b(o,new Error(`extension exited ${u} without a result: ${(d||g).trim().slice(-500)}`)))}))})}var $=5e3,E=class{constructor(n){this.ext=n;let[t,r]=n.kind==="node"?[process.execPath,[n.entry,"--serve"]]:[n.entry,["--serve"]];this.child=A(t,r,{stdio:["pipe","pipe","pipe"]});let o="";this.child.stdout.setEncoding("utf8").on("data",i=>{let s=(o+i).split(`
6
+ `);o=s.pop()??"";for(let f of s)this.listener?.line(f)}),this.child.stderr.setEncoding("utf8").on("data",i=>{this.said=(this.said+i).slice(-2e3)}),this.child.stdin.on("error",()=>{}),this.child.on("error",i=>{this.gone(),this.listener?.error(i)}),this.child.on("exit",()=>{this.gone(),this.listener?.exit()}),this.child.on("close",(i,s)=>this.listener?.close(s??`exit ${i}`))}ext;child;listener;exited=!1;said="";idle;gone(){this.exited=!0,clearTimeout(this.idle),p.get(this.ext.entry)===this&&p.delete(this.ext.entry)}holdAll(n){for(let t of[this.child,this.child.stdin,this.child.stdout,this.child.stderr])t[n]?.()}hold(n){clearTimeout(this.idle),this.said="",this.listener=n,this.holdAll("ref")}rest(n){this.listener=void 0,this.holdAll("unref"),this.idle=setTimeout(()=>{this.close()},n),this.idle.unref()}close(){return new Promise(n=>{if(this.exited)return n();this.gone();let t=setTimeout(()=>this.child.kill("SIGKILL"),3e3);t.unref(),this.child.once("exit",()=>{clearTimeout(t),n()}),this.child.stdin.end()})}},p=new Map;function M(e){for(let r of[...p.values()])e.id!==void 0&&r.ext.id===e.id&&r.ext.entry!==e.entry&&!r.listener&&r.close();let n=p.get(e.entry);if(n&&!n.exited&&!n.listener)return n;let t=new E(e);return p.set(e.entry,t),t}async function _(e){await Promise.all([...p.values()].filter(n=>(e===void 0||n.ext.id===e)&&!n.listener).map(n=>n.close()))}function j(e,n,t){let{signal:r}=t,o=t.subject??N(n);if(r?.aborted)return Promise.reject(r.reason??new Error("aborted"));let i=M(e);return new Promise((s,f)=>{let w=!1,l=d=>{w||(w=!0,r?.removeEventListener("abort",g),d())},g=()=>i.child.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),i.hold({line(d){let m=J(d);if(m)return t.onProgress?.(m.done,m.of);if(!d.trim().startsWith("{"))return;let a;try{a=JSON.parse(d)}catch{return}if(!("ok"in a))return t.onLine?.(a);l(()=>{i.rest(t.idleMs??$),a.ok===!0?s(W(a)):f(T(a,o,t,n))})},exit(){r?.aborted&&l(()=>f(r.reason??new Error("aborted")))},close(d){l(()=>f(b(o,new Error(`extension exited ${d} without a result: ${i.said.trim().slice(-500)}`))))},error(d){l(()=>f(b(o,d)))}}),i.child.stdin.write(`${JSON.stringify({args:n})}
7
+ `)})}export{H as a,_ as b};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{c as P}from"./chunk-C32KGH4S.js";import{j as v}from"./chunk-WZWK3PEZ.js";import{d as y,na as s}from"./chunk-WIPP5TWQ.js";import{mkdtemp as x,rm as F}from"node:fs/promises";import{tmpdir as z}from"node:os";import{join as h}from"node:path";var f={background:"#ffffff",keepMetadata:!1};function q(e,r,n){switch(e.kind){case"cut":return{op:"convert",sources:[r],outputs:[n],target:"png",options:{...f,...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}};case"cutout":return{op:"remove-background",sources:[r],outputs:[n],target:"png",options:f};case"boost":return{op:"boost",sources:[r],outputs:[n],scale:e.scale,target:"png",options:f};case"encode":return{op:"convert",sources:[r],outputs:[n],target:e.target,options:{...f,...e.background?{background:e.background}:{},...e.quality!==void 0?{quality:e.quality}:{},...e.compress?{compress:e.compress}:{},...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}}}}async function C(e,r,n,o){let E=o.probe??v,d=await x(h(z(),"forge-preset-")),I={force:o.force,...o.signal?{signal:o.signal}:{},...o.onEvent?{onEvent:o.onEvent}:{}};try{let i=e;for(let[l,t]of r.entries()){o.onPass?.(l);let u=l===r.length-1,m=u?n:h(d,`${l}.png`),a=await P([q(t,i,m)],{...I,...u?{}:{force:!0},...u&&t.kind==="encode"&&t.maxBytes?{targetBytes:t.maxBytes,...t.quality===void 0?{}:{maxQuality:t.quality}}:{}});if(a.cancelled)return{kind:"cancelled"};let g=a.refusals[0];if(g)return{kind:"refused",error:g.error};let p=a.unreachable[0];if(p)return{kind:"unreachable",entry:p};let b=a.failures[0];if(b)return{kind:"failed",pass:t,error:b.error};let c=a.results[0];if(!c)return{kind:"failed",pass:t,error:s(e.path,"no result")};if(u){let j=c.job.op==="convert"?{...c.job,sources:[e]}:c.job;return{kind:"done",result:{...c,job:j}}}let k=await E(m);if(k.kind!=="image")return{kind:"failed",pass:t,error:s(e.path,"not an image")};i=k}return{kind:"failed",pass:{kind:"encode",target:e.format},error:s(e.path,"nothing to run")}}catch(i){return{kind:"failed",pass:r[r.length-1]??{kind:"encode",target:e.format},error:y(i)?i:s(e.path,i)}}finally{await F(d,{recursive:!0,force:!0})}}export{C as a};
3
+ import{b as P}from"./chunk-ZYIW4MAG.js";import{j as v}from"./chunk-EPDF4NQI.js";import{a as y,ka as s}from"./chunk-CVNYUROW.js";import{mkdtemp as x,rm as F}from"node:fs/promises";import{tmpdir as z}from"node:os";import{join as h}from"node:path";var f={background:"#ffffff",keepMetadata:!1};function q(e,r,n){switch(e.kind){case"cut":return{op:"convert",sources:[r],outputs:[n],target:"png",options:{...f,...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}};case"cutout":return{op:"remove-background",sources:[r],outputs:[n],target:"png",options:f};case"boost":return{op:"boost",sources:[r],outputs:[n],scale:e.scale,target:"png",options:f};case"encode":return{op:"convert",sources:[r],outputs:[n],target:e.target,options:{...f,...e.background?{background:e.background}:{},...e.quality!==void 0?{quality:e.quality}:{},...e.compress?{compress:e.compress}:{},...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}}}}async function C(e,r,n,o){let E=o.probe??v,d=await x(h(z(),"forge-preset-")),I={force:o.force,...o.signal?{signal:o.signal}:{},...o.onEvent?{onEvent:o.onEvent}:{}};try{let i=e;for(let[l,t]of r.entries()){o.onPass?.(l);let u=l===r.length-1,m=u?n:h(d,`${l}.png`),a=await P([q(t,i,m)],{...I,...u?{}:{force:!0},...u&&t.kind==="encode"&&t.maxBytes?{targetBytes:t.maxBytes,...t.quality===void 0?{}:{maxQuality:t.quality}}:{}});if(a.cancelled)return{kind:"cancelled"};let g=a.refusals[0];if(g)return{kind:"refused",error:g.error};let p=a.unreachable[0];if(p)return{kind:"unreachable",entry:p};let b=a.failures[0];if(b)return{kind:"failed",pass:t,error:b.error};let c=a.results[0];if(!c)return{kind:"failed",pass:t,error:s(e.path,"no result")};if(u){let j=c.job.op==="convert"?{...c.job,sources:[e]}:c.job;return{kind:"done",result:{...c,job:j}}}let k=await E(m);if(k.kind!=="image")return{kind:"failed",pass:t,error:s(e.path,"not an image")};i=k}return{kind:"failed",pass:{kind:"encode",target:e.format},error:s(e.path,"nothing to run")}}catch(i){return{kind:"failed",pass:r[r.length-1]??{kind:"encode",target:e.format},error:y(i)?i:s(e.path,i)}}finally{await F(d,{recursive:!0,force:!0})}}export{C as a};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as y,c as b}from"./chunk-IJRLRAC5.js";import{a as p}from"./chunk-5IZBFF6Y.js";import{j as h}from"./chunk-EPDF4NQI.js";import{a as m}from"./chunk-CVNYUROW.js";import{a as c}from"./chunk-H3DIRJFE.js";import{open as g,readdir as w,stat as x}from"node:fs/promises";import{extname as S,join as k,resolve as v}from"node:path";function K(e){return e.startsWith(".")||/\.(crdownload|part|download|tmp)$/i.test(e)}function A(e){return e.kind==="image"?"images":e.format==="pdf"?"pdfs":"documents"}var R=new Set(Object.values(c).flatMap(e=>e.extensions));async function O(e){let i=await g(e,"r"),t=Buffer.alloc(4096),r=0;try{r=(await i.read(t,0,t.length,0)).bytesRead}finally{await i.close()}let n=t.subarray(0,r),o=(d,f)=>n.subarray(d,d+f).toString("latin1");return o(4,4)==="ftyp"?/^(M4A |M4B |M4P )$/.test(o(8,4))?"audio":"video":n[0]===26&&n[1]===69&&n[2]===223&&n[3]===163?"video":o(0,4)==="RIFF"?o(8,4)==="WAVE"?"audio":o(8,3)==="AVI"?"video":"other":n[0]===0&&n[1]===0&&n[2]===1&&(n[3]===186||n[3]===179)?"video":o(0,3)==="ID3"||o(0,4)==="fLaC"||o(0,4)==="OggS"||o(0,4)==="FORM"&&/^AIF[FC]$/.test(o(8,4))||n[0]===255&&n[1]!==void 0&&(n[1]&224)===224?"audio":r>0&&!n.includes(0)&&M(n)?"text":"other"}function M(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e,{stream:!0}),!0}catch{return!1}}var F=["images","pdfs","documents","videos","audio","other"];function j(e,i){if(e==="videos"||e==="audio")return"not yet supported";if(e==="other")return i.every(t=>t==="text")?i.length===1?"a text file":"text files":"not supported"}async function V(e){let i=v(e),t=await w(i,{withFileTypes:!0}),r=[],n=[],o=new Map,d=[],f=0;for(let s of t.sort((a,u)=>a.name.localeCompare(u.name)))!s.isFile()||K(s.name)||d.push(k(i,s.name));for(let s of await E(d))if(s.kind==="source")r.push(s.source),f+=s.source.bytes;else if(s.kind==="failed")n.push(s.failure),f+=s.bytes;else{let a=s.kind,u=o.get(a)??{bytes:0,sniffed:[]};u.bytes+=s.bytes,u.sniffed.push(s.sniffed),o.set(a,u),f+=s.bytes}let l=I(r);for(let s of F){let a=o.get(s);if(!a)continue;let u=j(s,a.sniffed);l.push({id:s,count:a.sniffed.length,bytes:a.bytes,sources:[],...u===void 0?{}:{why:u}})}return{dir:i,sources:r,failures:n,kinds:l,bytes:f,paths:d}}async function E(e){let i=[];return await b(e,y(),async(t,r)=>{try{i[r]={read:await C(t)}}catch(n){i[r]={error:n}}}),i.map(t=>{if("error"in t)throw t.error;return t.read})}function I(e){let i=[];for(let t of F){let r=e.filter(n=>A(n)===t);r.length>0&&i.push({id:t,count:r.length,bytes:r.reduce((n,o)=>n+o.bytes,0),sources:r})}return i.sort((t,r)=>r.count-t.count)}function W(e,i=[]){let t=e.filter(o=>o.kind==="media"),r=e.filter(o=>o.kind!=="media"),n=I(r);for(let o of["videos","audio"]){let d=t.filter(f=>c[f.format].media==="video"==(o==="videos"));if(d.length>0){let f=d.reduce((l,s)=>l+s.bytes,0);n.push({id:o,count:d.length,bytes:f,sources:[],why:"one at a time"})}}return{dir:"",sources:r,failures:i,kinds:n,bytes:e.reduce((o,d)=>o+d.bytes,0),paths:e.map(o=>o.path)}}async function C(e){let i=()=>x(e).then(t=>t.size,()=>0);try{let t=await h(e);if(t.kind==="media"){let r=c[t.format].media==="video";return{kind:r?"videos":"audio",sniffed:r?"video":"audio",bytes:t.bytes}}return{kind:"source",source:t}}catch(t){let r=await i(),n=await O(e).catch(()=>"other");if(n==="video"||n==="audio")return{kind:n==="video"?"videos":"audio",sniffed:n,bytes:r};if(R.has(S(e).toLowerCase())){let o=m(t)?t:void 0;if(o)return{kind:"failed",failure:{path:e,error:o},bytes:r}}return{kind:"other",sniffed:n,bytes:r}}}function D(e){let i=new Set(e.flatMap(t=>p(t).filter(r=>r!==t.format)));return Object.keys(c).filter(t=>i.has(t))}function _(e,i){let t=D(e),r=e[0],n=r?.kind==="image"?"webp":r?.format==="pdf"?"png":void 0,o=n&&t.includes(n)?n:t[0];if(o)return N(e,o,i)}function N(e,i,t){let r={target:i};return c[i].lossy&&(r.quality=t),e.some(n=>n.kind==="document"&&n.format==="pdf")&&(i==="png"||i==="jpeg")&&(r.dpi=150),r}export{K as a,A as b,O as c,V as d,W as e,C as f,D as g,_ as h,N as i};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{d as q,k as V}from"./chunk-J6AZTW62.js";import{n as ye,o as j,q as ve}from"./chunk-BIBDLXCG.js";import{a as Se,b as Ie,c as xe,d as Ee,e as Me,f as Oe,g as $}from"./chunk-7KYO62XK.js";import{B as fe,E as W,J as de,X as ue,a as C,aa as me,b as Z,c as ee,ca as pe,d as U,da as le,e as te,ea as ge,f as re,fa as we,g as ne,ga as be,h as oe,i as ae,ka as _,l as ie,m as se,n as ce,t as he,u as N}from"./chunk-CVNYUROW.js";import{c as P}from"./chunk-VLVNA4T3.js";import{a as g}from"./chunk-H3DIRJFE.js";import{b as M}from"./chunk-KXKQDFHX.js";import{constants as We}from"node:fs";import{access as Ve,readFile as je,rm as Je,stat as Xe,writeFile as Ge}from"node:fs/promises";import{dirname as He}from"node:path";var ze=[{id:"light",label:"Light",passes:[{threshold:12,range:24}]},{id:"medium",label:"Medium",passes:[{threshold:20,range:48},{threshold:20,range:24}]},{id:"strong",label:"Strong",passes:[{threshold:31,range:64},{threshold:31,range:32}]}],dt=1,ut=e=>ze.some(r=>r.id===e),Ae=e=>ze.find(r=>r.id===e),mt=e=>`debanded-${e}`;function wt(e){if(g[e].hasAlpha)return;let r=Object.keys(g).filter(t=>g[t].hasAlpha&&t!=="heic").join(", ");return W(`${g[e].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${r}.`)}var Be="1.1.0";function Fe(e,r){let t=e.split(".").map(o=>Number.parseInt(o,10)||0),n=r.split(".").map(o=>Number.parseInt(o,10)||0);for(let o=0;o<Math.max(t.length,n.length);o++){let i=(t[o]??0)-(n[o]??0);if(i!==0)return i>0}return!0}var _e="1.4.0";function bt(e){return e!==void 0&&Fe(e,_e)}function J(e){return e!==void 0&&Fe(e,Be)?[2,3,4]:[2,4]}function yt(e,r,t){if(e===1||J(r).some(o=>o===e))return;if(t!==void 0&&J(t).some(o=>o===e))return de("boost",`boost ${e}\xD7`,r,Be);let n=J(r).map(o=>`--boost ${o}`);return W(`No released boost makes ${e}\xD7 yet.`,`Try ${n.slice(0,-1).join(", ")} or ${n.at(-1)}.`)}var qe=16384,$e=1e8;function Te(e,r,t){let n=Math.max(e,r)*t;if(n>qe)return{side:n};let o=e*t*r*t;if(o>$e)return{megapixels:Math.round(o/1e6)}}var B=e=>Math.max(1,Math.round(e));function X(e,r){return"percent"in r?{width:B(e.width*r.percent/100),height:B(e.height*r.percent/100)}:"width"in r?{width:B(r.width),height:B(e.height*r.width/e.width)}:{width:B(e.width*r.height/e.height),height:B(r.height)}}function Le(e){return Te(e.width,e.height,1)}function Ue(e){let r=e>>>0;return()=>{r=r+1831565813>>>0;let t=r;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function De(e,r,t,n,{threshold:o,range:i},c=1){let m=Buffer.from(e),a=Math.min(3,n),s=Ue(c),d=h=>h<0?0:h>=r?r-1:h,u=h=>h<0?0:h>=t?t-1:h;for(let h=0;h<t;h++)for(let p=0;p<r;p++){let b=s()*i,l=s()*2*Math.PI,f=Math.round(Math.cos(l)*b),y=Math.round(Math.sin(l)*b),v=(u(h+y)*r+d(p+f))*n,I=(u(h-y)*r+d(p-f))*n,x=(u(h+y)*r+d(p-f))*n,O=(u(h-y)*r+d(p+f))*n,E=(h*r+p)*n;for(let S=0;S<a;S++){let F=(e[v+S]+e[I+S]+e[x+S]+e[O+S])/4;Math.abs(e[E+S]-F)<o&&(m[E+S]=Math.round(F))}}return m}function Re(e,r){let t=new Map;for(let n=0;n<e.length;n+=3){let o=e[n],i=e[n+1],c=e[n+2],m=o<<16|i<<8|c;if(!t.has(m)){if(t.size>=r)return;t.set(m,[o,i,c])}}return[...t.values()]}function ke(e,r,t,n){let o=Buffer.alloc(e.length),i=Int16Array.from(n.flatMap(d=>[...d])),c=n.length,m=(r+2)*3,a=new Float32Array(m),s=new Float32Array(m);for(let d=0;d<t;d++){let u=d%2===0;for(let p=0;p<r;p++){let b=u?p:r-1-p,l=(d*r+b)*3,f=(b+1)*3,y=Math.min(255,Math.max(0,e[l]+a[f])),v=Math.min(255,Math.max(0,e[l+1]+a[f+1])),I=Math.min(255,Math.max(0,e[l+2]+a[f+2])),x=0,O=Number.POSITIVE_INFINITY;for(let A=0;A<c;A++){let H=y-i[A*3],Y=v-i[A*3+1],K=I-i[A*3+2],Q=H*H+Y*Y+K*K;Q<O&&(O=Q,x=A)}let E=i[x*3],S=i[x*3+1],F=i[x*3+2];o[l]=E,o[l+1]=S,o[l+2]=F;let D=y-E,R=v-S,k=I-F,w=u?f+3:f-3,z=u?f-3:f+3;a[w]=a[w]+D*7/16,a[w+1]=a[w+1]+R*7/16,a[w+2]=a[w+2]+k*7/16,s[z]=s[z]+D*3/16,s[z+1]=s[z+1]+R*3/16,s[z+2]=s[z+2]+k*3/16,s[f]=s[f]+D*5/16,s[f+1]=s[f+1]+R*5/16,s[f+2]=s[f+2]+k*5/16,s[w]=s[w]+D/16,s[w+1]=s[w+1]+R/16,s[w+2]=s[w+2]+k/16}let h=a;a=s,s=h,s.fill(0)}return o}var Ye=new Set(["jpeg","png","webp","avif","heic","raw","gif","tiff"]),Ke=new Set(["jpeg","png","webp","avif","gif","tiff"]),Qe={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function Ze(e,r){if(r.format==="heif")return r.compression==="av1"?"avif":"heic";let t=Qe[r.format??""];if(!t)throw ae(e,r.format??"an unknown format");return t}async function et(e){let r;try{r=await Xe(e)}catch(i){let c=i.code;throw c==="ENOENT"?Z(e):c==="EACCES"||c==="EPERM"?U(e):c==="ENOTDIR"?te(e):c==="ELOOP"?re(e):c==="ENAMETOOLONG"?ne(e):oe(e,i)}if(!r.isFile())throw ee(e);try{await Ve(e,We.R_OK)}catch{throw U(e)}if(await Ie(e)){if(!await Se())throw ie(e);let i;try{i=await xe(e)}catch(c){throw N(e,"heic",c)}if(i.width===0||i.height===0)throw N(e,"heic",void 0);return{kind:"image",path:e,format:"heic",width:i.width,height:i.height,bytes:r.size,hasAlpha:i.hasAlpha,frames:1}}let t=await Ee(e);if(t){if(!await Me())throw se(e);let i;try{i=await Oe(e,t)}catch(c){throw N(e,"raw",c)}if(!i)throw ce(e);return{kind:"image",path:e,format:"raw",width:i.width,height:i.height,bytes:r.size,hasAlpha:!1,frames:1}}let n=await M(),o;try{o=await n(e).metadata()}catch(i){throw he(e,i)}return{kind:"image",path:e,format:Ze(e,o),width:o.autoOrient?.width??o.width??0,height:o.autoOrient?.height??o.height??0,bytes:r.size,hasAlpha:o.hasAlpha??!1,frames:o.pages??1}}function Pe(e,r,t,n){let o=t??g[r].defaultQuality;if(n&&g[r].quantisable)return tt(e,r,t,n);switch(r){case"jpeg":return e.jpeg({quality:o,mozjpeg:!0});case"webp":return e.webp({quality:o});case"avif":return e.avif({quality:o});case"png":return e.png({compressionLevel:9});case"gif":return e.gif();case"tiff":return e.tiff({compression:"deflate"});case"heic":throw new Error("heic is not writable; the capability graph should have prevented this");case"raw":throw new Error("raw is not writable; the capability graph should have prevented this");case"pdf":throw new Error("pdf is not an image target; the capability graph should have prevented this");case"docx":throw new Error("docx is not an image target; the capability graph should have prevented this");case"doc":throw new Error("doc is not an image target; the capability graph should have prevented this");default:throw new Error(`${r} is not an image target; the capability graph should have prevented this`)}}function tt(e,r,t,{dither:n}){let o=t??100,i=n?1:0;return r==="gif"?e.gif({interFrameMaxError:Math.round(32*(100-o)/100),dither:i}):e.png({palette:!0,quality:o,dither:i,compressionLevel:9,effort:10})}async function G(e,r,t,n){if(t.deband){let f=await M(),{data:y,info:v}=await e.clone().withIccProfile("srgb").raw().toBuffer({resolveWithObject:!0}),I=y;Ae(t.deband).passes.forEach((O,E)=>{I=De(I,v.width,v.height,v.channels,O,E+1)});let x={width:v.width,height:v.height,channels:v.channels};return await Pe(f(I,{raw:x}).withIccProfile("srgb"),r,t.quality,t.compress).toBuffer()}let o=t.dither;if(o===void 0||!g[r].quantisable)return await Pe(e,r,t.quality,t.compress).toBuffer();let i=f=>r==="gif"?f.gif({colours:o,dither:0,effort:10}):f.png({palette:!0,colours:o,quality:100,dither:0,compressionLevel:9,effort:10}),c=()=>r==="gif"?e.gif({colours:o,dither:1,effort:10}):e.png({palette:!0,colours:o,quality:100,dither:1,compressionLevel:9,effort:10});if(n)return await c().toBuffer();let m=await M(),a=e.clone().withIccProfile("srgb"),{data:s,info:d}=await a.raw().toBuffer({resolveWithObject:!0});if(d.channels===4){for(let f=3;f<s.length;f+=4)if(s[f]!==255)return await c().toBuffer()}let u=d.channels===3?s:rt(s),h=await i(m(u,{raw:{width:d.width,height:d.height,channels:3}})).toBuffer(),p=await m(h).removeAlpha().raw().toBuffer(),b=Re(p,o);if(!b)return await c().toBuffer();let l=ke(u,d.width,d.height,b);return await i(m(l,{raw:{width:d.width,height:d.height,channels:3}}).withIccProfile("srgb")).toBuffer()}function rt(e){let r=Buffer.alloc(e.length/4*3);for(let t=0,n=0;t<e.length;t+=4,n+=3)r[n]=e[t],r[n+1]=e[t+1],r[n+2]=e[t+2];return r}var T=(e,r)=>e.kind==="image"&&e.frames>1&&g[r].animatable;async function nt(e,r){let t=He(r);await j(r);let n=ye(r);try{return await Ge(n,e),await ve(n,r),e.length}catch(o){throw await Je(n,{force:!0}).catch(()=>{}),fe(r,o)}}async function L(e,r,t,n,o,i){if(e.kind!=="image")throw new Error("pipelineFor received a non-image source");let c=o??await $(e.path,e.format),a=(await M())(c,n?{animated:!0}:{});if(a=a.rotate(),t.trim&&(a=a.trim()),t.crop){if(!t.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");a=a.extract(t.crop.box)}if(t.resize){if(!i&&(t.trim||t.crop))throw new Error("pipelineFor needs the resolved size to resize a cut image");let s=i??X(e,t.resize);a=a.resize(s.width,s.height,{fit:"fill"})}return t.rotate&&(a=a.rotate(t.rotate)),e.hasAlpha&&!g[r].hasAlpha&&(a=a.flatten({background:t.background})),a=t.keepMetadata?a.keepMetadata():a.keepIccProfile(),{pipeline:a}}async function $t(e,r){let t={background:"#ffffff",keepMetadata:!1},{pipeline:n}=await L(e,"png",t,!1);await n.png({compressionLevel:1}).toFile(r)}async function Ut(e,r,t){let{pipeline:n}=await L(e,r,t,T(e,r));return await G(n,r,t,T(e,r))}async function ot(e){let r={width:e.width,height:e.height};if(e.frames>1)return{upright:r,trimmed:"animated"};let t=await $(e.path,e.format);try{let n=await M(),{info:o}=await n(t).rotate().trim().jpeg({quality:1}).toBuffer({resolveWithObject:!0});return o.width===r.width&&o.height===r.height?{upright:r,trimmed:"nothing"}:{upright:r,trimmed:{width:o.width,height:o.height}}}catch(n){throw C(n)?n:_(e.path,n)}}var Ce=1024;async function at(e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:t}=await L(e,"png",r,!1);try{let{data:n,info:o}=await t.resize(Ce,Ce,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),i=o.width*o.height,c=o.channels,m=new Uint8Array(i*3),a=new Uint8Array(i),s=!1;for(let d=0;d<i;d++){for(let u=0;u<3;u++)m[d*3+u]=n[d*c+(c>=4?u:0)]??0;a[d]=n[d*c+c-1]??255,a[d]!==255&&(s=!0)}return{size:{width:e.width,height:e.height},thumb:{width:o.width,height:o.height,rgb:m,...s?{alpha:a}:{}}}}catch(n){throw C(n)?n:_(e.path,n)}}var Ne=128;async function it(e,r){let{thumb:t,size:n}=e,o=q(t,r),i=await M(),{info:c}=await i(st(t),{raw:{width:t.width,height:t.height,channels:3}}).resize(o.width,o.height,{fit:"cover",position:i.strategy.attention}).raw().toBuffer({resolveWithObject:!0}),m=q(n,r),a=Math.round(-(c.cropOffsetLeft??0)*n.width/t.width),s=Math.round(-(c.cropOffsetTop??0)*n.height/t.height);return{...m,left:Math.min(Math.max(a,0),n.width-m.width),top:Math.min(Math.max(s,0),n.height-m.height)}}function st(e){let{alpha:r}=e;if(!r)return e.rgb;let t=new Uint8Array(e.rgb.length);for(let n=0;n<t.length;n++){let o=(r[Math.floor(n/3)]??255)/255;t[n]=Math.round(Ne+((e.rgb[n]??0)-Ne)*o)}return t}async function ct(e,r){if(e.op!=="convert")throw new Error(`image engine cannot ${e.op}`);let t=e.sources[0],n=e.outputs[0];if(t.kind!=="image")throw new Error("the image engine cannot convert a document source");let o=g[e.target],i=[];r({phase:"reading"});let c=t.frames>1,m=T(t,e.target);c&&!o.animatable&&i.push({code:"animation-flattened",message:`${P(t.path)} has ${t.frames} frames, and ${o.label} cannot animate. Only the first frame was converted.`});let a=e.options,s;if(a.rotate&&c)throw be(t.path);if(a.trim||a.crop||a.resize){let u={width:t.width,height:t.height};if(a.trim&&a.crop)throw new Error("a job cannot both trim and crop");if(a.crop){if(c)throw we(t.path);let{aspect:h}=a.crop,p=f=>f.width===t.width&&f.height===t.height,b=q(u,h),l=a.crop.box??(p(b)?b:await it(await at(t),h));if(p(l)){if(!a.resize)throw ge(t.path,V(h));i.push({code:"nothing-cropped",message:`${P(t.path)} is already ${V(h)}; resized only.`});let{crop:f,...y}=a;a=y}else a={...a,crop:{aspect:h,box:l}},u={width:l.width,height:l.height}}if(a.trim){if(c)throw le(t.path);let{trimmed:h}=await ot(t);if(h==="nothing"){if(!a.resize)throw pe(t.path);i.push({code:"nothing-trimmed",message:`${P(t.path)} has no empty edges; resized only.`})}else h!=="animated"&&(u=h)}if(a.resize&&(s=X(u,a.resize),Le(s)))throw ue(t.path,s)}r({phase:"decoding"});let{pipeline:d}=await L(t,e.target,a,m,void 0,s);try{await j(n),r({phase:"encoding"});let u=await G(d,e.target,a,m);if(a.compress&&u.length>=t.bytes)throw me(t.path,t.bytes,u.length);r({phase:"writing"});let h=await nt(u,n);return{job:e,outputBytes:h,warnings:i}}catch(u){throw C(u)?u:_(t.path,u)}}async function ht(e){let r=await $(e.path,e.format);return typeof r=="string"?await je(r):r}async function ft(e){if(e.op!=="convert")return;let r=g[e.target];if(!r.lossy&&!(r.quantisable&&e.options.compress))return;let t=e.sources[0];if(t.kind!=="image")return;let n=await ht(t);return{ladder:[{}],measure:async o=>{let{pipeline:i}=await L(t,e.target,o,T(t,e.target),n);return(await G(i,e.target,o,T(t,e.target))).length}}}var Wt={id:"image",reads:Ye,writes:Ke,ops:new Set(["convert"]),probe:et,run:ct,measurer:ft};export{wt as a,bt as b,J as c,yt as d,qe as e,Te as f,ze as g,dt as h,ut as i,mt as j,X as k,Le as l,Pe as m,nt as n,$t as o,Ut as p,ot as q,at as r,it as s,Wt as t};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{r as E}from"./chunk-DZOBIUV6.js";import{ba as O}from"./chunk-WIPP5TWQ.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as h}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:c}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return c.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let c=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(c&&i.type===e.standIn))}function T(t,e){return e.text.some(c=>t.includes(c))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
3
+ import{r as E}from"./chunk-BIBDLXCG.js";import{_ as O}from"./chunk-CVNYUROW.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as h}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:c}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return c.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let c=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(c&&i.type===e.standIn))}function T(t,e){return e.text.some(c=>t.includes(c))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
4
4
  `)).update("\0").update(e).digest().readUIntBE(0,6)}function x(t){return v("sha256").update(t).digest("hex")}async function L(t,e){let{default:c}=await import("sharp"),i=m(e,"Copied image.png");return await c(t).keepIccProfile().png().toFile(`${i}.part`),await A(`${i}.part`,i),await w(t,{force:!0}),i}var X=`ObjC.import('AppKit')
5
5
  const pb = $.NSPasteboard.generalPasteboard
6
6
  JSON.stringify({ types: ObjC.deepUnwrap(pb.types) || [], count: Number(pb.changeCount) })`,K=`function run(argv) {
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{homedir as m}from"node:os";import{posix as f,win32 as u}from"node:path";var d=/[\u0000-\u001f\u007f-\u009f‪-‮⁦-⁩]/g;function o(r){return r.replace(d,"?")}function s(r,n,e){let t=e.relative(n,r);if(t==="")return"";if(!(t===".."||t.startsWith(`..${e.sep}`)||e.isAbsolute(t)))return t}function w(r,n={}){return o(a(r,n))}function a(r,n){let e=(n.platform??process.platform)==="win32"?u:f;if(n.cwd!==void 0){let i=s(r,n.cwd,e);if(i!==void 0)return i===""?".":i}let t=s(r,n.home??m(),e);return t!==void 0?t===""?"~":`~${e.sep}${t}`:r}function h(r,n=process.platform){return o((n==="win32"?u:f).basename(r))}export{o as a,w as b,h as c};
@@ -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 g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{H as y}from"./chunk-WIPP5TWQ.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
3
+ import{b as g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{E as y}from"./chunk-CVNYUROW.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
@@ -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 m}from"./chunk-MF3KKEFB.js";import{W as l}from"./chunk-WIPP5TWQ.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};
3
+ import{a as m}from"./chunk-MF3KKEFB.js";import{T as l}from"./chunk-CVNYUROW.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};