forge-terminal 0.5.9 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +53 -16
  2. package/dist/chunks/{about-credits-32BUKO4K.js → about-credits-PWTKZG3Y.js} +1 -1
  3. package/dist/chunks/args-RHIBM3R3.js +3 -0
  4. package/dist/chunks/{available-TNMISSBA.js → available-FPBRQ3LS.js} +1 -1
  5. package/dist/chunks/boot-PHDTJAFT.js +3 -0
  6. package/dist/chunks/{catalog-FMHWWMUX.js → catalog-G44MXIAF.js} +1 -1
  7. package/dist/chunks/check-BFHBPCGW.js +3 -0
  8. package/dist/chunks/chunk-2YU4EI24.js +3 -0
  9. package/dist/chunks/chunk-3IAJTXYM.js +3 -0
  10. package/dist/chunks/chunk-3OCPO5V6.js +3 -0
  11. package/dist/chunks/chunk-42IEPG2K.js +3 -0
  12. package/dist/chunks/{chunk-WE6KP4FR.js → chunk-4AL5QJLM.js} +1 -1
  13. package/dist/chunks/chunk-56B3VZCM.js +3 -0
  14. package/dist/chunks/chunk-56QHX7QR.js +3 -0
  15. package/dist/chunks/chunk-6NCN7OJ5.js +7 -0
  16. package/dist/chunks/chunk-6PUV4HSU.js +3 -0
  17. package/dist/chunks/chunk-72UR37EG.js +3 -0
  18. package/dist/chunks/chunk-7NP76V4U.js +3 -0
  19. package/dist/chunks/{chunk-7XFLG32B.js → chunk-AETM2PCZ.js} +1 -1
  20. package/dist/chunks/chunk-BQV3DSUZ.js +23 -0
  21. package/dist/chunks/chunk-BSFBZBAI.js +16 -0
  22. package/dist/chunks/chunk-DC2DHMXO.js +3 -0
  23. package/dist/chunks/{chunk-WBW6G4N6.js → chunk-DKHBJ52G.js} +1 -1
  24. package/dist/chunks/chunk-E5VPEBUQ.js +3 -0
  25. package/dist/chunks/chunk-EYOO35US.js +3 -0
  26. package/dist/chunks/chunk-F4TUCI6D.js +3 -0
  27. package/dist/chunks/{chunk-MF3KKEFB.js → chunk-FEJSM3E4.js} +1 -1
  28. package/dist/chunks/chunk-FGR6QCG5.js +3 -0
  29. package/dist/chunks/{chunk-W53XNVNH.js → chunk-G2V33TMN.js} +1 -1
  30. package/dist/chunks/{chunk-ILQDMVJR.js → chunk-G4M2XYFJ.js} +1 -1
  31. package/dist/chunks/chunk-H332YFSO.js +4 -0
  32. package/dist/chunks/chunk-HAOKWLD3.js +4 -0
  33. package/dist/chunks/chunk-I2LPGKUU.js +3 -0
  34. package/dist/chunks/{chunk-YRXJDFP3.js → chunk-I3C3SRF2.js} +1 -1
  35. package/dist/chunks/{chunk-SM735FG7.js → chunk-ID4GJZJ6.js} +1 -1
  36. package/dist/chunks/chunk-ID75X37Z.js +3 -0
  37. package/dist/chunks/chunk-JPASVE56.js +3 -0
  38. package/dist/chunks/chunk-JZM37DG2.js +3 -0
  39. package/dist/chunks/chunk-KPUKMAYK.js +19 -0
  40. package/dist/chunks/{chunk-SZRSAL64.js → chunk-M7HB4L6L.js} +1 -1
  41. package/dist/chunks/chunk-NUCGWLOY.js +8 -0
  42. package/dist/chunks/{chunk-4KGC5ZBZ.js → chunk-OK56WDPA.js} +1 -1
  43. package/dist/chunks/{chunk-I25E2XDH.js → chunk-OLKPV4WO.js} +1 -1
  44. package/dist/chunks/chunk-OPDC577C.js +3 -0
  45. package/dist/chunks/chunk-OQ6DTE56.js +3 -0
  46. package/dist/chunks/chunk-PA7AG2NK.js +55 -0
  47. package/dist/chunks/chunk-PNPAHKJR.js +3 -0
  48. package/dist/chunks/chunk-PON65UTS.js +3 -0
  49. package/dist/chunks/{chunk-GVVQP3LF.js → chunk-PXCEMDOY.js} +2 -2
  50. package/dist/chunks/chunk-QMNERJL2.js +3 -0
  51. package/dist/chunks/{chunk-OXDRJO4V.js → chunk-R6QVLPGC.js} +1 -1
  52. package/dist/chunks/chunk-S44LAUHZ.js +3 -0
  53. package/dist/chunks/chunk-SCJ2QXZF.js +80 -0
  54. package/dist/chunks/{chunk-4MJEEEFA.js → chunk-SJIDFYPT.js} +1 -1
  55. package/dist/chunks/{chunk-3374PCO5.js → chunk-TQEGSODD.js} +1 -1
  56. package/dist/chunks/chunk-ULX4ZD2Y.js +3 -0
  57. package/dist/chunks/chunk-W6QOV4RP.js +6 -0
  58. package/dist/chunks/chunk-WWWWXOM4.js +3 -0
  59. package/dist/chunks/{chunk-6RCS3KBP.js → chunk-XIR3VWQY.js} +1 -1
  60. package/dist/chunks/chunk-XUJLUOGD.js +6 -0
  61. package/dist/chunks/chunk-Y3DMALHT.js +66 -0
  62. package/dist/chunks/chunk-YXV3PYVI.js +3 -0
  63. package/dist/chunks/chunk-Z3PQ5TMU.js +3 -0
  64. package/dist/chunks/chunk-ZL7E7PZN.js +4 -0
  65. package/dist/chunks/clip-command-6Q7BTXR5.js +3 -0
  66. package/dist/chunks/clipboard-QWNPA3GM.js +3 -0
  67. package/dist/chunks/colour-7HPH6KTY.js +3 -0
  68. package/dist/chunks/command-JTK4IOS7.js +3 -0
  69. package/dist/chunks/config-command-DIQTU7DM.js +3 -0
  70. package/dist/chunks/continue-editing-FTUY6UFG.js +3 -0
  71. package/dist/chunks/decoded-IXLPWTGZ.js +3 -0
  72. package/dist/chunks/{entry-BZYPZONY.js → entry-ZF7D32ZI.js} +2 -2
  73. package/dist/chunks/execute-RP7ZMWLZ.js +3 -0
  74. package/dist/chunks/extensions-YOZ4IF4E.js +3 -0
  75. package/dist/chunks/{extensions-command-JZSOQJEV.js → extensions-command-O7UHUJ3Y.js} +1 -1
  76. package/dist/chunks/ffmpeg-2ZP3GXJX.js +3 -0
  77. package/dist/chunks/image-6A7FXKIR.js +3 -0
  78. package/dist/chunks/{install-KGFOAQCU.js → install-4L7JGP3X.js} +1 -1
  79. package/dist/chunks/install-XJAPLIH2.js +3 -0
  80. package/dist/chunks/launch-2KSJ4GGN.js +18 -0
  81. package/dist/chunks/link-inputs-GTEW6ZH4.js +3 -0
  82. package/dist/chunks/lock-KNR7XS7Q.js +3 -0
  83. package/dist/chunks/manager-YH5XAMZA.js +4 -0
  84. package/dist/chunks/{needed-DYERJ72M.js → needed-TB3OC76N.js} +1 -1
  85. package/dist/chunks/notify-UD7FQAWX.js +3 -0
  86. package/dist/chunks/{own-2QGMHSKL.js → own-KUGTZ3BV.js} +1 -1
  87. package/dist/chunks/{paths-6OENILJ4.js → paths-BBUKTDDP.js} +1 -1
  88. package/dist/chunks/pdfium-MJ65YOXW.js +3 -0
  89. package/dist/chunks/preferences-7S7YZOFK.js +3 -0
  90. package/dist/chunks/preset-command-KMKR6KMG.js +3 -0
  91. package/dist/chunks/registry-657JRJR5.js +3 -0
  92. package/dist/chunks/run-VJDF5WRF.js +3 -0
  93. package/dist/chunks/server-6PH2DSFW.js +81 -0
  94. package/dist/chunks/signals-VY2XE3LV.js +3 -0
  95. package/dist/chunks/text-layer-PFIDCTEL.js +5 -0
  96. package/dist/chunks/theme-FVQOSLPB.js +3 -0
  97. package/dist/chunks/transcribe-FUN2SKRN.js +3 -0
  98. package/dist/chunks/transcribe-command-KNSUHROE.js +3 -0
  99. package/dist/chunks/update-command-X4OSYETA.js +3 -0
  100. package/dist/chunks/update-note-LV7G4CHE.js +3 -0
  101. package/dist/chunks/video-link-CF7GUA6V.js +3 -0
  102. package/dist/chunks/watch-command-3C4AWM7A.js +3 -0
  103. package/dist/helpers/forge-transcribe +0 -0
  104. package/dist/index.js +16 -15
  105. package/package.json +15 -3
  106. package/skills/forge/SKILL.md +7 -3
  107. package/dist/chunks/args-ZVZQR23M.js +0 -3
  108. package/dist/chunks/boot-2YFTQOMG.js +0 -3
  109. package/dist/chunks/check-B6NP7BEM.js +0 -3
  110. package/dist/chunks/chunk-4RNVZQRC.js +0 -3
  111. package/dist/chunks/chunk-6KUWZQGG.js +0 -3
  112. package/dist/chunks/chunk-6MWJO3GB.js +0 -4
  113. package/dist/chunks/chunk-6PEIZZNE.js +0 -3
  114. package/dist/chunks/chunk-7FW7JX74.js +0 -36
  115. package/dist/chunks/chunk-7XDMC7FL.js +0 -72
  116. package/dist/chunks/chunk-AR3M2PLK.js +0 -3
  117. package/dist/chunks/chunk-ASLKQXZ2.js +0 -3
  118. package/dist/chunks/chunk-BKLPRILS.js +0 -3
  119. package/dist/chunks/chunk-EEQSUBBL.js +0 -3
  120. package/dist/chunks/chunk-FAUL5L2W.js +0 -3
  121. package/dist/chunks/chunk-FBVRKMAF.js +0 -3
  122. package/dist/chunks/chunk-GHYODKA3.js +0 -3
  123. package/dist/chunks/chunk-H3DIRJFE.js +0 -3
  124. package/dist/chunks/chunk-HTA25PO2.js +0 -3
  125. package/dist/chunks/chunk-J7FLFHQJ.js +0 -3
  126. package/dist/chunks/chunk-K253E723.js +0 -3
  127. package/dist/chunks/chunk-KH5DHZ2U.js +0 -8
  128. package/dist/chunks/chunk-L44NRTP4.js +0 -3
  129. package/dist/chunks/chunk-N32JL4UI.js +0 -3
  130. package/dist/chunks/chunk-N6RCLJE6.js +0 -4
  131. package/dist/chunks/chunk-NDYMC3HY.js +0 -66
  132. package/dist/chunks/chunk-NMECUMJD.js +0 -7
  133. package/dist/chunks/chunk-OQBIYNGK.js +0 -6
  134. package/dist/chunks/chunk-Q6KQWJ4J.js +0 -3
  135. package/dist/chunks/chunk-QQV7CCAY.js +0 -3
  136. package/dist/chunks/chunk-RCWFUBTG.js +0 -3
  137. package/dist/chunks/chunk-TFGK7IRZ.js +0 -19
  138. package/dist/chunks/chunk-TGC24JEW.js +0 -4
  139. package/dist/chunks/chunk-TLHUFIXD.js +0 -3
  140. package/dist/chunks/chunk-V6GWPR2A.js +0 -3
  141. package/dist/chunks/chunk-VJMOZPHW.js +0 -3
  142. package/dist/chunks/chunk-YPAFAG4W.js +0 -6
  143. package/dist/chunks/chunk-ZBMJTIYR.js +0 -3
  144. package/dist/chunks/chunk-ZX5FDZZW.js +0 -55
  145. package/dist/chunks/clip-command-MDSM6KJP.js +0 -3
  146. package/dist/chunks/clipboard-IZJTBTSW.js +0 -3
  147. package/dist/chunks/colour-2MYODUDY.js +0 -3
  148. package/dist/chunks/command-GAGAD65W.js +0 -3
  149. package/dist/chunks/config-command-CKPJXJEE.js +0 -3
  150. package/dist/chunks/continue-editing-M6WESEVB.js +0 -3
  151. package/dist/chunks/decoded-XWKU23RG.js +0 -3
  152. package/dist/chunks/execute-7M6WA4W7.js +0 -3
  153. package/dist/chunks/extensions-E3OUBT36.js +0 -3
  154. package/dist/chunks/ffmpeg-KDZEPLNA.js +0 -3
  155. package/dist/chunks/image-R5C3AWHT.js +0 -3
  156. package/dist/chunks/install-MFYGS5TG.js +0 -3
  157. package/dist/chunks/launch-VNW4YQ4Z.js +0 -17
  158. package/dist/chunks/lock-BG3CLOHA.js +0 -3
  159. package/dist/chunks/manager-L753MI7U.js +0 -4
  160. package/dist/chunks/notify-NQNNOBFC.js +0 -3
  161. package/dist/chunks/pdfium-77L526HZ.js +0 -3
  162. package/dist/chunks/preferences-3P4V2EDX.js +0 -3
  163. package/dist/chunks/preset-command-UNMXHW5A.js +0 -3
  164. package/dist/chunks/registry-RS7LQ3UA.js +0 -3
  165. package/dist/chunks/run-GUFPETHF.js +0 -3
  166. package/dist/chunks/server-PIXRL5PA.js +0 -77
  167. package/dist/chunks/text-layer-LHZNDMPZ.js +0 -3
  168. package/dist/chunks/theme-P3ZE2ZYB.js +0 -3
  169. package/dist/chunks/transcribe-KXQXEVBJ.js +0 -3
  170. package/dist/chunks/transcribe-command-JHWN4RWU.js +0 -3
  171. package/dist/chunks/update-command-DWEBUFT5.js +0 -3
  172. package/dist/chunks/update-note-CY3LCBCJ.js +0 -3
  173. package/dist/chunks/watch-command-QGVXM23I.js +0 -3
@@ -1,7 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{c as L}from"./chunk-4RNVZQRC.js";import{W as S,X as k,Y as P,ma as b}from"./chunk-ZBMJTIYR.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,6 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{execFile as I,spawn as R}from"node:child_process";import{access as T,constants as K}from"node:fs/promises";import{dirname as $,join as L}from"node:path";import{promisify as C}from"node:util";function S(e){let[t,r]=(e??"").split("/").map(Number);return!t||!r?0:Math.round(t/r*100)/100}function O(e){let t=e.side_data_list?.find(n=>typeof n.rotation=="number")?.rotation,r=t!==void 0?-t:Number(e.tags?.rotate??0);return(Math.round(r/90)*90%360+360)%360}function A(e){let t=e,r=t.streams??[],n=r.find(o=>o.codec_type==="video"&&o.disposition?.attached_pic!==1),i=r.find(o=>o.codec_type==="audio"),a={duration:Number(t.format?.duration)||Math.max(0,...r.map(o=>Number(o.duration)||0))};if(n){let o=O(n),f=o===90||o===270,s=n.width??0,c=n.height??0;a.video={codec:n.codec_name??"",width:f?c:s,height:f?s:c,fps:S(n.avg_frame_rate)||S(n.r_frame_rate),rotation:o,hdr:n.color_transfer==="arib-std-b67"||n.color_transfer==="smpte2084"}}return i&&(a.audio={codec:i.codec_name??"",channels:i.channels??0,sampleRate:Number(i.sample_rate)||0}),a}var v=C(I);function D(e,t){let r=t.PATH??t.Path??"",n=e==="win32"?";":":",i=r.split(n).filter(Boolean);return e==="darwin"&&i.push("/opt/homebrew/bin","/usr/local/bin"),[...new Set(i)]}var k=e=>process.platform==="win32"?`${e}.exe`:e;async function N(e){try{return await T(e,K.X_OK),!0}catch{return!1}}function G(e){let t=new Set;for(let r of e.split(`
4
- `)){let n=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);n?.[1]&&n[1]!=="="&&t.add(n[1])}return t}async function J(){try{let{installed:e}=await import("./paths-6OENILJ4.js");return(await e("video"))?.dir}catch{return}}async function j(){try{let{chosenPath:e}=await import("./own-2QGMHSKL.js"),t=await e("video");return t===void 0?void 0:$(t)}catch{return}}async function q(){try{let{removeForgeCopy:e}=await import("./own-2QGMHSKL.js");await e("video")}catch{}}async function H(){let e=await J(),t=await j(),r=[...t?[t]:[],...D(process.platform,process.env),...e?[e]:[]];for(let n of r){let i=L(n,k("ffmpeg")),m=L(n,k("ffprobe"));if(!await N(i)||!await N(m))continue;try{await v(i,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[a,o]=await Promise.all(["-encoders","-filters"].map(s=>v(i,["-hide_banner",s],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:c})=>G(c)).catch(()=>{}))),f=a&&o?new Set([...a,...o]):void 0;return e!==void 0&&n!==e&&await q(),{ffmpeg:i,ffprobe:m,...f?{has:f}:{}}}}var b,w=null,F;function y(){return w?Promise.resolve(w.value):(b=(b??H()).then(t=>(t||(b=void 0),F=t,t)),b)}function te(){return w?w.value:F}function ne(e){w=e===null?null:{value:e},b=void 0,F=void 0}async function re(e,t){let r=t??await y();if(!r)throw new Error("ffmpeg is not installed");let{stdout:n}=await v(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return A(JSON.parse(n))}async function oe(e,t,r){let n=r??await y();if(!n)return;let i=Math.max(0,t-15),{stdout:m}=await v(n.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${t+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
5
- `).map(o=>Number.parseFloat(o)).filter(o=>Number.isFinite(o)&&o<=t+.001);return a.length?Math.max(...a):void 0}var B=4e3;async function ie(e,t,r,n={}){let i=n.tools??await y();if(!i)return null;let m=Math.max(1,Math.round(t*B)),a=Math.max(1,Math.ceil(m/r)),o=new Array(r).fill(0),f=0,s=Buffer.alloc(0);if(!await new Promise((p,d)=>{let u=R(i.ffmpeg,["-hide_banner","-nostdin","-loglevel","error","-i",e,"-map","0:a:0","-ac","1","-ar",String(B),"-f","s16le","-"],{stdio:["ignore","pipe","pipe"]}),h=()=>u.kill("SIGKILL");n.signal?.addEventListener("abort",h,{once:!0}),u.stdout.on("data",l=>{let _=s.length?Buffer.concat([s,l]):l,P=_.length-_.length%2;for(let x=0;x<P;x+=2){let M=Math.abs(_.readInt16LE(x)),E=Math.min(r-1,Math.floor(f/a));M>(o[E]??0)&&(o[E]=M),f++}s=_.subarray(P)}),u.stderr.resume(),u.on("error",d),u.on("close",l=>{n.signal?.removeEventListener("abort",h),n.signal?.aborted?d(n.signal.reason??new Error("aborted")):p(l===0&&f>0)})}))return null;let g=Math.max(1,...o);return o.map(p=>Math.sqrt(p/g))}async function se(e,t,r,n){await Z(["-ss",String(Math.max(0,t)),"-i",e,"-frames:v","1","-y",r],{tools:n})}function V(e){let t;for(let r of e.matchAll(/out_time_us=(\d+)/g))t=Number(r[1])/1e6;return t}var X=4e3;async function Z(e,t={}){let{signal:r,onTime:n}=t;if(r?.aborted)throw r.reason??new Error("aborted");let i=t.tools??await y();if(!i)throw new Error("ffmpeg is not installed");let a=["-hide_banner","-nostdin","-loglevel",t.report?"info":"error","-progress","pipe:1","-nostats",...e];return new Promise((o,f)=>{let s=R(i.ffmpeg,a,{stdio:["ignore","pipe","pipe"]}),c="",g=()=>s.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),s.stdout.setEncoding("utf8");let p="";s.stdout.on("data",d=>{let u=p+d,h=u.lastIndexOf(`
6
- `);p=u.slice(h+1);let l=V(u.slice(0,h+1));l!==void 0&&n?.(l)}),s.stderr.setEncoding("utf8"),s.stderr.on("data",d=>{c=(c+d).slice(-X)}),s.on("error",d=>{r?.removeEventListener("abort",g),f(d)}),s.on("close",d=>{r?.removeEventListener("abort",g),r?.aborted?f(r.reason??new Error("aborted")):d===0?o(c):f(new Error(c.trim()||`ffmpeg exited with ${d}`))})})}export{D as a,G as b,y as c,te as d,ne as e,re as f,oe as g,ie as h,se as i,V as j,Z as k};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{d as s,h as a}from"./chunk-EEQSUBBL.js";import{a as r}from"./chunk-J7FLFHQJ.js";import{a as i}from"./chunk-H3DIRJFE.js";import{win32 as d}from"node:path";function l(n,e=process.platform){return e==="win32"?d.basename(n):n.split("/").pop()}function f(n){return n.facts?n.facts.video!==void 0:i[n.format].media==="video"}function v(n){return n==="mp3"?"mp3":n==="opus"?"opus":"m4a"}var u=n=>n===1?"mono":n===2?"stereo":`${n} channels`,m=n=>`${Math.round(n/100)/10} kHz`;function F(n){let e=r(n.bytes),o=n.facts;if(!o)return`${f(n)?"video":"sound"} \xB7 ${e}`;let t=[s(o.duration)];return o.video?(t.push(`${o.video.width}\xD7${o.video.height}`,`${o.video.fps} fps`),o.video.hdr&&t.push("HDR")):o.audio&&t.push(u(o.audio.channels),m(o.audio.sampleRate)),t.push(e),t.join(" \xB7 ")}function p(n){return n.facts?a(n.facts):void 0}function $(n){let e=p(n)??0;return[...e<1e6?["kb"]:[],...n.bytes>=1e6||e>=1e6?["mb"]:[],...n.bytes>1e9?["gb"]:[]]}var c=n=>n==="opus"?96:128;function k(n,e){let o=n.facts;if(!(!o?.audio||i[e].media!=="sound")){if(i[e].lossy)return Math.round(c(e)*1e3*o.duration/8);if(e==="wav"||e==="aiff")return Math.round(o.audio.sampleRate*o.audio.channels*2*o.duration)}}export{l as a,f as b,v as c,F as d,p as e,$ as f,k as g};
@@ -1,3 +0,0 @@
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-AR3M2PLK.js";import{j as It}from"./chunk-K253E723.js";import{F as Ot,a as Tt,b as gt}from"./chunk-ZBMJTIYR.js";import{a as wt}from"./chunk-H3DIRJFE.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Pr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
@@ -1,3 +0,0 @@
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-6KUWZQGG.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-BKLPRILS.js";import{b as w}from"./chunk-VJMOZPHW.js";import{b as _}from"./chunk-AR3M2PLK.js";import{d as x}from"./chunk-FBVRKMAF.js";import{a as P}from"./chunk-3374PCO5.js";import{f as B,g as M,h as K}from"./chunk-TLHUFIXD.js";import{b as k}from"./chunk-V6GWPR2A.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};
@@ -1,19 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as w,h as et,i as P}from"./chunk-7XFLG32B.js";import{b as y,c as F,d as D,f as O,g as K,h as tt}from"./chunk-N32JL4UI.js";var ht=[[15,"rose"],[45,"red"],[70,"orange"],[95,"amber"],[120,"yellow"],[140,"lime"],[165,"green"],[185,"teal"],[215,"cyan"],[250,"sky"],[280,"blue"],[295,"indigo"],[315,"violet"],[340,"purple"],[355,"pink"],[360,"rose"]];function S(t){let{C:e,h:n}=O(F(t));return e<.03?"grey":B(n)}function B(t){let e=(t%360+360)%360;return(ht.find(([n])=>e<n)??[360,"rose"])[1]}var wt=["full","mono","analogous","opposite","split","triad","pastel"],nt={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},W={brightness:0,saturation:0,hue:0,contrast:0},St=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),Y=[{name:"red",hex:{r:251,g:44,b:54},role:"danger"},{name:"orange",hex:{r:255,g:105,b:0}},{name:"yellow",hex:{r:239,g:177,b:0},role:"warning"},{name:"green",hex:{r:0,g:201,b:80},role:"success"},{name:"teal",hex:{r:0,g:187,b:167}},{name:"blue",hex:{r:43,g:127,b:255},role:"info"},{name:"purple",hex:{r:173,g:70,b:255}},{name:"pink",hex:{r:246,g:51,b:154}}],ct={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},ut=.553,gt=.024,d=t=>O(F(t)),T=(t,e,n)=>D(K({L:t,C:Math.max(0,e),h:(n+360)%360})),G=(t,e)=>(t-e+540)%360-180;function rt(t,e,n){let r=K({L:t,C:e,h:n}),a=F(D(r));return Math.hypot(a.L-r.L,a.a-r.a,a.b-r.b)<.003}function L(t,e){let n=0,r=.4;for(let a=0;a<30;a++){let o=(n+r)/2;rt(t,o,e)?n=o:r=o}return n}function q({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var z=(t,e)=>e>=0?t+(.98-t)*(e/100):t+(t-.05)*(e/100),Q=(t,e,n)=>n>=0?t+(Math.max(t,e)-t)*(n/100):t*(1+n/100);function N(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:a}=d(t),o=z(n,e.brightness),s=(a+e.hue+360)%360,l=Q(r,L(o,s),e.saturation);for(let i=0;i<40&&l>0&&!rt(o,l,s);i++)l-=.005;return T(o,l,s)}function v(t,e,n,r){let a=z(t,r.brightness),o=(n+r.hue+360)%360,s=L(a,o);return T(a,Math.min(s,Q(e,s,r.saturation)),o)}function J(t,e,n){if(!e)return t;let r=d(t[n].rgb).L;return t.map((a,o)=>{if(o===n)return a;let s=d(a.rgb),l=Math.max(.02,Math.min(.995,r+(s.L-r)*(1+e/100))),i=T(l,Math.min(s.C,L(l,s.h)),s.h);return{...a,rgb:i,hex:y(i)}})}function Mt(t,e,n,r){return J(t(N(e,n)),n.contrast,r)}function ot(t,e){let n=d(t),r=Y.map(i=>d(i.hex)),a=0;r.forEach((i,h)=>{Math.abs(G(n.h,i.h))<Math.abs(G(n.h,r[a].h))&&(a=h)});let o=r[a],s=Math.max(-10,Math.min(10,G(n.h,o.h)/2)),l=q(n);return Y.map((i,h)=>{if(h===a)return{name:i.name,role:i.role,rgb:N(t,e),yours:!0};let u=r[h],c=n.L>=o.L?u.L+(n.L-o.L)*(1-u.L)/(1-o.L):u.L*n.L/o.L,x=z(c,e.brightness),m=(u.h+s+e.hue+360)%360,f=L(x,m),$=Math.min(1,q(u)),b=Math.min(f,Q(l*$*f,f,e.saturation));return{name:i.name,role:i.role,rgb:T(x,b,m),yours:!1}})}function mt(t,e,n){let r=d(t),a=S(t);if(e==="mono")return[{name:a,rgb:N(t,n),yours:!0},{name:`${a} soft`,rgb:v(r.L,r.C*.5,r.h,n),yours:!1},{name:`${a} dusty`,rgb:v(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return ot(t,W).map((l,i)=>{let h=d(l.rgb),u=h.C<.01?d(Y[i].hex).h:h.h;return{...l,rgb:v(.86,Math.min(.1,L(.86,u))*.85,u,n)}});let o=q(r);return(ct[e]??[0]).map(l=>{if(l===0)return{name:a,rgb:N(t,n),yours:!0};let i=(r.h+l+360)%360,h=o*L(r.L,i);return{name:o>0?B(i):S(v(r.L,h,i,W)),rgb:v(r.L,h,i,n),yours:!1}}).sort((l,i)=>Number(i.yours)-Number(l.yours))}function pt(t,e,n){let r=d(t).h+e.hue,a=Math.max(0,gt*(1+e.saturation/100));return P(T(z(ut,e.brightness),a,r),n)}function Lt(t,e,n=W,r=w){let a=et(r);return{rows:(e==="full"?ot(t,n):mt(t,e,n)).map(({name:l,role:i,rgb:h,yours:u})=>({name:l,...i?{role:i}:{},steps:J(P(h,r),n.contrast,a),yours:u})),neutral:J(pt(t,n,r),n.contrast,a)}}var R=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),I=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",M='font-family="Inter"',U=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function at(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var ft=`<defs><pattern id="checker" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#FFFFFF"/><rect width="8" height="8" fill="#E5E5E5"/><rect x="8" y="8" width="8" height="8" fill="#E5E5E5"/></pattern></defs>
4
- `;function H(t,e,n,r="light",a={}){let{ink:o,grey:s,edge:l,paper:i}=at(r),h=Math.min(n.length,a.perRow??n.length),u=Math.ceil(n.length/Math.max(1,h)),c=h>8?64:104,x=10,m=Math.max(c,...n.map(g=>Math.max(g.name.length*8,Math.ceil(g.value.length*6.5)))),f=c+56,$=48+h*m+Math.max(0,h-1)*x,b=84+u*f,k=c>80?12:10,j=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(t)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(e)}</text>`,C=n.map((g,E)=>`<g id="${I(g.id)}" transform="translate(${24+E%h*(m+x)} ${80+Math.floor(E/h)*f})">`+(g.alpha===void 0?"":`<rect id="checker" width="${c}" height="${c}" rx="${k}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${c}" height="${c}" rx="${k}" fill="${g.hex}"`+(g.alpha===void 0?"":` fill-opacity="${g.alpha.toFixed(3)}"`)+` stroke="${l}" stroke-opacity="0.08"/><text id="name" x="1" y="${c+22}" ${M} font-size="13" font-weight="600" fill="${o}">${R(g.name)}</text><text id="value" x="1" y="${c+40}" ${M} font-size="11" fill="${s}">${R(g.value)}</text></g>`).join(`
5
- `);return`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${b}" viewBox="0 0 ${$} ${b}">
6
- `+(n.some(g=>g.alpha!==void 0)?ft:"")+`<g id="${I(t)}">
7
- <rect id="card" width="${$}" height="${b}" rx="0" fill="${i}"/>
8
- ${j}
9
- ${C}
10
- </g>
11
- </svg>`}function Tt(t,e,n="light",r){let a=t.replace(/\.[^.]+$/,""),o=e.length;return H(t,r?`${o} shade${o===1?"":"s"} of ${r}`:`${o} colour${o===1?"":"s"}, most of the image first`,e.map((s,l)=>({id:`${a}-${l+1}`,name:s.hex,value:tt(s.rgb),hex:s.hex})),n)}function _(t){if(t.set==="radix")return"Radix 1\u201312";if(t.set==="even")return`${t.start}\u2013${t.end}, ${t.count} even steps`;let e=w;return t.start===e.start&&t.end===e.end?"50\u2013950":`Tailwind ${t.start}\u2013${t.end}`}function Et(t,e,n="light",r=w){let a=S(t);return H(U(a),`from ${y(t)} \xB7 ${_(r)} in OKLCH`,e.map(o=>({id:`${a}-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),n)}function At(t,e,n,r=w,a="light"){let{ink:o,grey:s,edge:l,paper:i}=at(a),h=`${U(S(t))} palette`,u=`from ${y(t)} \xB7 ${nt[n]} \xB7 ${_(r)} in OKLCH`,c=[...e.rows.map(p=>({name:p.name,steps:p.steps})),{name:"neutral",steps:e.neutral}],x=c[0]?.steps.map(p=>p.step)??[],m=44,f=6,$=m+10,b=92,k=24+Math.max(92,...c.map(p=>p.name.length*8+12)),j=k+x.length*m+Math.max(0,x.length-1)*f+24,C=Math.max(j,48+Math.ceil(u.length*6.5)),g=b+c.length*$+24+10,E=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(h)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(u)}</text>`,st=x.map((p,A)=>`<text id="step-${p}" x="${k+A*(m+f)+1}" y="${b-10}" ${M} font-size="11" font-weight="600" fill="${s}">${p}</text>`).join(""),it=c.map((p,A)=>{let V=b+A*$+(A===c.length-1?10:0),X=I(p.name);return`<g id="${X}"><text id="name" x="24" y="${V+m/2+4}" ${M} font-size="13" font-weight="600" fill="${o}">${R(p.name)}</text>`+p.steps.map((Z,lt)=>`<g id="${X}-${Z.step}"><rect id="swatch" x="${k+lt*(m+f)}" y="${V}" width="${m}" height="${m}" rx="8" fill="${Z.hex}" stroke="${l}" stroke-opacity="0.08"/></g>`).join("")+"</g>"}).join(`
12
- `);return`<svg xmlns="http://www.w3.org/2000/svg" width="${C}" height="${g}" viewBox="0 0 ${C} ${g}">
13
- <g id="${I(h)}">
14
- <rect id="card" width="${C}" height="${g}" rx="0" fill="${i}"/>
15
- ${E}
16
- <g id="steps">${st}</g>
17
- ${it}
18
- </g>
19
- </svg>`}function Ot(t,e,n,r="light",a=w){return H(`${U(S(t))} neutral`,`from ${y(t)} \xB7 ${n} tint \xB7 ${_(a)} in OKLCH`,e.map(o=>({id:`neutral-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),r)}function Nt(t,e,n,r="light",a=w){let o=S(t);return H(`${U(o)} alpha`,`from ${y(t)} \xB7 over ${n} \xB7 ${_(a)}`,e.map(s=>({id:`${o}-alpha-${s.step}`,name:String(s.step),value:s.hex8,hex:y(s.rgb),alpha:s.a})),r)}export{wt as a,nt as b,W as c,St as d,Mt as e,Lt as f,H as g,Tt as h,Et as i,At as j,Ot as k,Nt as l};
@@ -1,4 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- var v="0.5.9",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
4
- \u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},f={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEdit:"#b39ae8",modeEditBg:"#2a2238",modeTranscribe:"#e63946",modeTranscribeBg:"#3a1a1d",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},o={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEdit:"#64569f",modeEditBg:"#f0ebfa",modeTranscribe:"#c0102c",modeTranscribeBg:"#fef0ef",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},i={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEdit:"magenta",modeEditBg:"",modeTranscribe:"redBright",modeTranscribeBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},d=["convert","compress","pdf","edit","transcribe","colour"],k=`1\u2013${d.length}`;function E(e,t){let r=d,n=e==="menu"?r.length:r.indexOf(e),a=Math.max(0,Math.min(r.length-1,n+t));return r[a]}function P(e){return/^[1-9]$/.test(e)?d[Number(e)-1]:void 0}var S={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",edit:"\u2726",transcribe:"\xB6"},c="#7d6ad0",l="#cc8ae2";function s(e,t){return t==="compress"?{fg:e.modeCompress,bg:e.modeCompressBg}:t==="pdf"?{fg:e.modePdf,bg:e.modePdfBg}:t==="colour"?{fg:e.modeColour,bg:e.modeColourBg}:t==="edit"?{fg:e.modeEdit,bg:e.modeEditBg}:t==="transcribe"?{fg:e.modeTranscribe,bg:e.modeTranscribeBg}:{fg:e.modeConvert,bg:e.modeConvertBg}}var g=["#f26e69","#e5a23c","#ace02c","#55c7d9","#6579fd","#ad95e9"],b=["#e5a23c","#f2cf6b"],m={convert:["#1e96a7","#1e94b3","#1e92c0","#1d8ed2","#1b86ef","#4a7df8","#6974f8","#816af8","#995cf8"],compress:["#24b459","#22ab6d","#21a479","#209f81","#1f9c89","#1f9a91","#1e9998","#1e97a0","#1e96a7"],pdf:["#eb4319","#e3541a","#de601b","#db6a1c","#d9731d","#d87c1e","#d8841f","#d98c20","#d99522"],edit:["#9b5af8","#985cf8","#965ef8","#945ff8","#9161f8","#8f62f8","#8d64f8","#8a65f8","#8867f8"],transcribe:["#f3233e","#f12259","#ee2270","#ea2186","#e6219b","#e121b0","#da22c6","#d122dc","#c723f2"],colour:["#f42335","#e05b1a","#d87d1e","#da9b23","#d2b427","#b4c027","#5bbf23","#20a27c","#1e989b","#1e94b6","#1c8cd9","#577af8","#7371f8","#8568f8","#965df8"]},u=["#d99522","#da9822","#da9b23","#da9f24","#d9a224","#d9a525","#d8a825","#d7ab26","#d6ad26"],B={convert:["#d6f7fd","#ddf5fe","#e1f4fe","#e4f2fe","#e7f1fe","#eaf0fe","#eceffe","#efeefe","#f1edfe"],compress:["#e0f7e4","#def8e7","#dcf8ea","#daf8ed","#d8f8f1","#d7f8f4","#d6f8f7","#d6f8fa","#d6f7fd"],pdf:["#feece7","#feece6","#feece5","#feece3","#feece2","#feede0","#feedde","#feeddc","#feeed9"],edit:["#f2edfe","#f1edfe","#f1edfe","#f1eefe","#f0eefe","#f0eefe","#f0eefe","#f0eefe","#efeefe"],transcribe:["#feebea","#feebec","#feebee","#feeaf0","#feeaf2","#feeaf5","#fee9f9","#fde9fd","#f9eafe"],colour:["#feebe9","#feece5","#feede0","#feeed7","#f7f1d6","#eff3d9","#e5f6df","#dbf8eb","#d6f8f8","#def5fe","#e5f2fe","#ebf0fe","#edeffe","#efeefe","#f1edfe"]},p=["#feeed9","#feeed8","#feeed7","#fdeed6","#fcefd6","#fbefd6","#fbefd6","#faefd6","#f9f0d6"],T={convert:["#138291","#8467bd"],compress:["#2b8748","#138291"],pdf:["#d54322","#a06c10"],edit:["#8567bc","#7b67cd"],transcribe:["#df3140","#9c5cb1"],colour:["#cb4b49","#a06c10","#618110","#138291","#5869ec","#8268bd"]};function C(e,t){return e.name==="light"?t==="menu"?u:m[t]:t==="menu"?e.name==="dark"?b:[e.brand]:t==="compress"?[e.modeCompress,e.modeConvert]:t==="pdf"?[e.modePdf,e.brand]:t==="colour"?e.name==="dark"?g:[e.modeColour,e.violet]:t==="edit"?[e.modeEdit,e.name==="dark"?c:e.violet]:t==="transcribe"?[e.modeTranscribe,e.name==="dark"?l:e.violet]:[e.modeConvert,e.violet]}function y(e,t){if(e.name==="light")return t==="menu"?p:B[t]}function w(e,t){return e.name==="light"?T[t]:C(e,t)}function M(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function R(e,t){let{fg:r,bg:n}=s(e,t);return{...e,accent:r,tag:r,label:r,band:n===""?e.band:n}}function H(e){return e.canvas!==""}function O(e){return e==="dark"?f:e==="light"?o:i}function D(e){return e===""?void 0:e}var _={filled:"\u2501",empty:"\u2501",knob:"\u25CF"};function h(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.stdout.isTTY===!0}function F(){h()||(process.env.FORCE_COLOR="0")}export{v as a,x as b,f as c,o as d,i as e,d as f,k as g,E as h,P as i,S as j,s as k,C as l,y as m,w as n,M as o,R as p,H as q,O as r,D as s,_ as t,h as u,F as v};
@@ -1,3 +0,0 @@
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-4MJEEEFA.js";import{n as ye,o as j,q as ve}from"./chunk-V6GWPR2A.js";import{a as Se,b as Ie,c as xe,d as Ee,e as Me,f as Oe,g as $}from"./chunk-WBW6G4N6.js";import{D as fe,G as W,L as de,Z as ue,a as C,b as Z,c as ee,ca as me,d as U,e as te,ea as pe,f as re,fa as le,g as ne,ga as ge,h as oe,ha as we,i as ae,ia as be,ma as _,n as ie,o as se,p as ce,v as he,w as N}from"./chunk-ZBMJTIYR.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,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{C as P,D as l,E as S}from"./chunk-ZBMJTIYR.js";import{c as x}from"./chunk-H3DIRJFE.js";import{existsSync as h,statSync as w}from"node:fs";import{basename as f,dirname as _,extname as g,isAbsolute as M,join as c,relative as D,resolve as i,sep as F}from"node:path";function $(t){return t.endsWith("/")||t.endsWith(F)||h(t)&&w(t).isDirectory()?!0:g(t)===""}var O=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function a(t,r,n=process.platform){if(b(t+r,n)<=O)return t+r;let e="";for(let s of t){if(b(e+s+r,n)>O)break;e+=s}return e+r}function it(t,r){if(i(t)===i(r))return!0;try{let n=w(t),e=w(r);return n.dev===e.dev&&n.ino===e.ino}catch{return!1}}function L(t,r){let n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;return a(s,x(r))}function v(t,r,n){if(!n)return t;let e=D(i(n),r);return!e||e.startsWith("..")?t:c(t,e)}function k(t){let r=i(t.sourcePath),n=L(r,t.target);if(!t.output)return c(i(r,".."),n);let e=M(t.output)?t.output:i(t.output);return $(t.output)?c(v(e,i(r,".."),t.sourceRoot),n):i(e)}function st(t){let r=k(t);if(t.output&&!$(t.output))return r;let n=g(r);return c(i(r,".."),a(f(r,n),`-${t.suffix}${n}`))}function ot(t){if(!h(t))return t;let r=i(t,".."),n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;for(let o=1;o<1e4;o++){let u=c(r,a(s,` (${o})${e}`));if(!h(u))return u}throw new Error(`no free name beside ${n}`)}function p(t){let r=i(t,".."),n=f(t),e=g(n);return{dir:r,stem:e?n.slice(0,-e.length):n,ext:e||".pdf"}}function A(t,r){let{dir:n,stem:e,ext:s}=p(i(t));return c(n,a(e,`-${r}${s}`))}function ut(t,r){let{dir:n,stem:e,ext:s}=p(i(t)),o=String(r).length;return Array.from({length:r},(u,m)=>c(n,a(e,`-${String(m+1).padStart(o,"0")}${s}`)))}function ct(t,r,n,e,s){let{stem:o}=p(i(t)),u=e?v(i(e),i(t,".."),s):i(t,".."),m=x(n),I=String(Math.max(1,...r.map(d=>d+1))).length,R=r.map(d=>c(u,a(o,`-${String(d+1).padStart(I,"0")}${m}`))),[E,...T]=R;if(E===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[E,...T]}function at(t,r,n){if(!n)return[A(t,"extract")];let{dir:e,stem:s,ext:o}=p(i(t));return r.map(u=>c(e,a(s,`-p${u+1}${o}`)))}function mt(t){let r=i(t[0]??"merged.pdf");if(new Set(t.map(e=>i(e,".."))).size===1){let e=i(r,"..");return c(e,a(f(e),"-merged.pdf"))}return A(r,"merged")}function B(t,r,n){let e=r?t.map(o=>c(r,f(o))):t,[s]=e;return!n||e.length!==1||s===void 0?e:[c(_(s),`${n}${g(s)}`)]}function ft(t,r,n){return B([t],r,n)[0]??t}import{execFile as J}from"node:child_process";import{randomBytes as j}from"node:crypto";import{constants as C}from"node:fs";import{access as U,mkdir as Y,rename as N,rm as z,writeFile as G}from"node:fs/promises";import{basename as y,dirname as W,extname as K,join as H}from"node:path";function Q(t,r=j(6).toString("hex")){let n=K(t);return H(W(t),a(`.forge-${r}-${y(t,n)}`,n))}async function V(t){let r=W(t);try{await Y(r,{recursive:!0})}catch(n){let e=l(t,n);throw e===n?S(t,n):e}try{await U(r,C.W_OK)}catch(n){throw P(t,n)}}var X=new Set(["EPERM","EBUSY","EACCES"]),Z=5,Et=9;async function q(t,r,n=process.platform,e=o=>new Promise(u=>setTimeout(u,o)),s=Z){if(n!=="win32"){await N(t,r),n==="darwin"&&await tt(t,r);return}for(let o=1;;o++)try{await N(t,r);return}catch(u){let m=u.code;if(o>=s||!m||!X.has(m))throw u;await e(Math.min(50*2**(o-1),1e3))}}function tt(t,r){return!y(t).startsWith(".")||y(r).startsWith(".")?Promise.resolve():new Promise(n=>{J("/usr/bin/chflags",["nohidden",r],()=>n())})}async function Pt(t,r){await V(t);let n=Q(t);try{return await G(n,r),await q(n,t),r.byteLength}catch(e){throw await z(n,{force:!0}).catch(()=>{}),l(t,e)}}export{$ as a,a as b,it as c,k as d,st as e,ot as f,A as g,ut as h,ct as i,at as j,mt as k,B as l,ft as m,Q as n,V as o,Et as p,q,Pt as r};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{b as B,c as C,d as U}from"./chunk-AR3M2PLK.js";import{i as q}from"./chunk-K253E723.js";import{c as T}from"./chunk-V6GWPR2A.js";import{A as M,B as w,a as x,ca as E,da as A,ma as R,q as I,t as k,y as J,z as P}from"./chunk-ZBMJTIYR.js";function D(e=1,t=100){let o=Math.max(1,t-e+1);return 1+Math.max(0,Math.ceil(Math.log2(o)))}async function O(e){let t=e.min??1,o=e.max??100,c=D(t,o),a=0,n=async f=>(a+=1,e.onAttempt?.(a,c),e.encode(f)),s=()=>e.signal?.aborted===!0,u=await n(o);if(s())return{quality:o,bytes:u,missed:!1,cancelled:!0};if(u<=e.targetBytes)return{quality:o,bytes:u,missed:!1};let d=t,p=o,m;for(;d<=p;){let f=Math.floor((d+p)/2),g=await n(f);if(s())return{quality:f,bytes:g,missed:!1,cancelled:!0};g<=e.targetBytes?(m={quality:f,bytes:g,missed:!1},d=f+1):p=f-1}if(m)return m;let b=await e.encode(t);return{quality:t,bytes:b,missed:!0}}import{existsSync as L}from"node:fs";import{resolve as v}from"node:path";function N(e){let t=e.sources[0]?.path??e.outputs[0]??"",o=new Set;for(let c of e.outputs){let a=v(c);if(o.has(a))return{output:c,error:M(t,c)};o.add(a)}}function W(e,t,o){let c=N(e);if(c)return c;let a=e.sources[0]?.path??e.outputs[0]??"";for(let n of e.outputs){let s=v(n);if(e.sources.some(d=>T(d.path,s))&&!o)return{output:n,error:w(n,e.op)};let u=t.get(s);if(u){let d=u.sources[0]?.path??u.outputs[0]??"";return{output:n,error:P([d,a],n)}}if(L(s)&&!o)return{output:n,error:J(n,e.op)}}}function _(e,t){let o=[],c=[],a=new Map;for(let n of e){let s=W(n,a,t.force);if(s){let u=n.sources[0]?.path??s.output;c.push({path:u,error:s.error});continue}for(let u of n.outputs)a.set(v(u),n);o.push(n)}return{jobs:o,failures:c}}async function z(e,t,o,c,a,n){let s=e.sources[0].path,u=r=>({kind:"failed",failure:{path:s,error:x(r)?r:R(s,r)}}),d=o(e);if(d?.sizeTo){let r=e.sources[0],i=e.options.compress!==void 0;if(i&&r.bytes<=t)return{kind:"failed",failure:{path:s,error:A(s,r.bytes,t)}};let l=t,h=d.sizeTo(e,l);return h&&i&&h.floor>=r.bytes?{kind:"failed",failure:{path:s,error:E(s,r.bytes,h.floor,!0)}}:h?{kind:"unreachable",entry:{job:e,smallest:h.floor,settings:{quality:1,media:{...e.options.media,targetBytes:h.floor}},error:k(r,t,h.floor)}}:(e.options={...e.options,media:{...e.options.media,targetBytes:l}},{kind:"ready"})}let p;try{p=await o(e)?.measurer?.(e)}catch(r){return u(r)}if(!p||p.ladder.length===0)return{kind:"refused",failure:{path:s,error:I(e.sources[0],e.target)}};let m=p,b=e.sources[0],f=e.options.compress!==void 0&&b.bytes<=t,g=f?b.bytes-1:t;if(a?.aborted)return{kind:"cancelled"};let F=Number.POSITIVE_INFINITY,y;try{for(let r of m.ladder){let i=await O({encode:l=>m.measure({...e.options,...r,quality:l}),targetBytes:g,...n===void 0?{}:{max:n},onAttempt:(l,h)=>c({type:"search:attempt",job:e,attempt:l,of:h,rung:r}),...a===void 0?{}:{signal:a}});if(i.cancelled)return{kind:"cancelled"};if(i.bytes<F&&(F=i.bytes,y={...r,quality:i.quality}),!i.missed)return e.options={...e.options,...r,quality:i.quality},{kind:"ready"}}}catch(r){return u(r)}return f?{kind:"failed",failure:{path:s,error:E(s,b.bytes,F,!0)}}:{kind:"unreachable",entry:{job:e,smallest:F,settings:y??{quality:1},error:k(e.sources[0],t,F)}}}async function te(e,t){let o=t.onEvent??(()=>{}),c=t.engineFor??q,a=t.targetBytes,n=_(e,{force:t.force}),s=a===void 0?0:n.jobs.filter(r=>r.op==="convert").length,u=[],d=0;await C(n.jobs,B(t.concurrency),async(r,i)=>{if(a===void 0||r.op!=="convert"){u[i]={kind:"ready"};return}if(t.signal?.aborted){u[i]={kind:"cancelled"};return}let l=await z(r,a,c,o,t.signal,t.maxQuality);u[i]=l,l.kind!=="cancelled"&&(d+=1,o({type:"search:settled",job:r,completed:d,total:s}))});let p=[...n.failures],m=[],b=[],f=[],g=!1;for(let[r,i]of n.jobs.entries()){let l=u[r]??{kind:"ready"};l.kind==="ready"?f.push(i):l.kind==="refused"?p.push(l.failure):l.kind==="failed"?b.push(l.failure):l.kind==="unreachable"?m.push(l.entry):g=!0}if(g)return{results:[],refusals:p,unreachable:[],failures:[],inputBytes:0,outputBytes:0,cancelled:!0};let F=new Set,y=await U(f,{...t.concurrency===void 0?{}:{concurrency:t.concurrency},...t.engineFor===void 0?{}:{engineFor:t.engineFor},...t.signal===void 0?{}:{signal:t.signal},onEvent:r=>{r.type==="job:error"&&!t.signal?.aborted&&F.add(r.failure),o(r)}}),S=f.length-y.results.length;if(t.signal?.aborted&&S>0){let r=y.failures.filter(i=>F.has(i));return{...y,refusals:p,unreachable:m,failures:[...b,...r],cancelled:!0}}return{results:y.results,refusals:p,unreachable:m,failures:[...b,...y.failures],inputBytes:y.inputBytes,outputBytes:y.outputBytes}}export{_ as a,te as b};
@@ -1,6 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- var x=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com"]),b=/^[A-Za-z0-9_-]{11}$/,c=n=>n&&b.test(n)?{kind:"video",id:n,url:`https://www.youtube.com/watch?v=${n}`}:void 0;function E(n){let r=n.trim();if(r==="")return;let t;try{t=new URL(/^[a-z]+:\/\//i.test(r)?r:`https://${r}`)}catch{return}let e=t.hostname.toLowerCase();if(e==="youtu.be")return c(t.pathname.slice(1).split("/")[0]);if(!x.has(e))return;let[s,o]=t.pathname.split("/").filter(Boolean);if(s==="watch")return c(t.searchParams.get("v"));if(s==="shorts"||s==="live")return c(o);if(s==="playlist"&&t.searchParams.get("list"))return{kind:"playlist"}}var w="Summary and notes by Apple Intelligence. They may contain mistakes.";function g(n){let r=Math.floor(n),t=o=>String(o).padStart(2,"0"),e=Math.floor(r/3600),s=Math.floor(r/60)%60;return e>0?`${e}:${t(s)}:${t(r%60)}`:`${s}:${t(r%60)}`}var f=n=>n.split(/\s+/).filter(Boolean).length,$=60,S=140,y=1,k=10;function I(n){let r=[],t;for(let e of n){if(t){let s=e.start-t.end;if(!(s>k||s>y&&t.words>=$||t.words>=S)){t.text+=` ${e.text}`,t.end=e.end,t.words+=f(e.text);continue}r.push({start:t.start,text:t.text})}t={start:e.start,end:e.end,text:e.text,words:f(e.text)}}return t&&r.push({start:t.start,text:t.text}),r}var l=n=>I(n).flatMap(r=>[`**${g(r.start)}** ${r.text}`,""]),L=n=>/^https?:\/\/\S+$/.test(n)?`<${n}>`:n;function P(n,r,{transcript:t=!0}={}){let e=[`# ${r.title}`,"",L(r.from),""],s=n.notes;if(!s)return[...e,...l(n.segments)].join(`
4
- `);let o=s.parts,p=a=>{let i=o[a];return i?`### ${i.refused?`Part ${a+1}`:i.heading} \xB7 ${g(i.start)}`:""};e.push(s.summary,"","## Notes",""),o.forEach((a,i)=>{e.push(p(i),""),a.points.length>0&&e.push(...a.points.map(u=>`- ${u}`),"")});let d=[`_${w}_`,""];return t?(e.push("## Transcript",""),o.forEach((a,i)=>{let u=o[i+1]?.start??Number.POSITIVE_INFINITY,h=n.segments.filter(m=>m.start>=a.start&&m.start<u);e.push(p(i),"",...l(h))}),[...e,...d].join(`
5
- `)):[...e,...d].join(`
6
- `)}function M(n){let r=[...n].map(t=>(t.codePointAt(0)??0)<32?" ":t).join("").replace(/[/\\:*?"<>|]/g,"-").replace(/\s+/g," ").trim().slice(0,120).replace(/^\.+/,"");return r===""?"transcript":r}export{E as a,g as b,P as c,M as d};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as s}from"./chunk-J7FLFHQJ.js";import{c as r}from"./chunk-VLVNA4T3.js";import{a}from"./chunk-H3DIRJFE.js";import{dirname as f}from"node:path";var o=class extends Error{code;title;detail;short;hint;shellHint;constructor(t){super(`${t.title}: ${t.detail}`,t.cause===void 0?void 0:{cause:t.cause}),this.name="ForgeError",this.code=t.code,this.title=t.title,this.detail=t.detail,this.short=t.short,this.hint=t.hint,this.shellHint=t.shellHint}};function m(e){return e instanceof o}function v(e){return new o({code:"file-not-found",title:"File not found",detail:`${r(e)} could not be found.`,short:`${r(e)} could not be found.`,hint:"Check the filename and try again."})}function k(e){return new o({code:"not-a-file",title:"Not a file",detail:`${r(e)} is not a file.`,short:`${r(e)} is not a file.`,hint:"Point Forge at an image, or at a directory of images."})}function C(e){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(e)} could not be read.`,short:`${r(e)} could not be read.`,hint:"Check the file permissions and try again."})}function S(e){return new o({code:"not-a-directory",title:"Invalid path",detail:`${r(e)} could not be found: part of its path is not a directory.`,short:`part of ${r(e)}'s path is not a folder.`,hint:"Check the path and try again."})}function T(e){return new o({code:"symlink-loop",title:"Too many symbolic links",detail:`${r(e)} could not be resolved: its path contains a symbolic-link loop.`,short:`${r(e)}'s path loops back on itself.`,hint:"Check for a circular symlink somewhere in the path."})}function N(e){return new o({code:"path-too-long",title:"Path too long",detail:`${r(e)}'s path is too long for the filesystem to resolve.`,short:`${r(e)}'s path is too long.`,hint:"Use a shorter path and try again."})}function I(e,t){return new o({code:"unreadable-path",title:"Could not read path",detail:`${r(e)} could not be checked.`,short:`${r(e)} could not be checked.`,hint:"Check the path and try again.",cause:t})}function P(e,t){return new o({code:"unsupported-source",title:"Unsupported file type",detail:`${r(e)} is ${t}, which Forge cannot read.`,short:`${r(e)} is ${t}, which Forge cannot read.`,hint:"Forge 0.1 handles images only."})}function H(e,t){return new o({code:"unsupported-source",title:"Not an image",detail:`${r(e)} is ${t}, not an image.`,hint:"A palette is taken from a photo, a screenshot or artwork."})}function O(e){return new o({code:"unsupported-source",title:"Nothing to take colours from",detail:`${r(e)} has no visible pixels.`})}function R(e){return new o({code:"unsupported-source",title:"No colours",detail:`There are no colours in ${e} that Forge can read.`,hint:"Write one a line, a name and a colour (bg #F8F1E6), or use a CSV with name and hex columns, CSS variables or design tokens."})}function A(e,t){let n=t.slice(0,8).join("; "),i=t.length>8?`; and ${t.length-8} more`:"";return new o({code:"unsupported-source",title:"Not colours",detail:`${t.length===1?"One line":`${t.length} lines`} of ${e} could not be read as a colour: ${n}${i}.`,hint:"Write each as a name and a colour, such as bg #F8F1E6, or take the line out."})}function W(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e,t)} is a HEIC photo, which needs Forge's free HEIC extension on ${n}.`,short:"HEIC needs the heic extension.",hint:"Install it with: forge extensions add heic",shellHint:"Open /extensions to install it."})}return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e)} is a HEIC photo, which Forge decodes with the macOS sips tool.`,short:"HEIC needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function U(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which needs Forge's free RAW extension on ${n}.`,short:"RAW needs the raw extension.",hint:"Install it with: forge extensions add raw",shellHint:"Open /extensions to install it."})}return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which Forge reads with macOS's own RAW support.`,short:"RAW needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function D(e){return new o({code:"raw-decoder-unavailable",title:"Cannot read this RAW",detail:`${r(e)} is a camera RAW photo that this Mac cannot read.`,short:"macOS cannot read RAW photos from this camera.",hint:"A newer camera usually needs a newer macOS."})}function M(e,t){let n=r(e.path);if(t!==void 0&&t!==e.format){let i=a[t].label;return a[t].lossy?new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`Forge cannot search ${n} \u2192 ${i} toward a size yet.`,hint:"Convert it first, then compress the result with --max-size.",shellHint:"Convert it first, then /compress the result to a size."}):new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`${i} is lossless \u2014 there is no quality to trade away, so ${n} cannot be made to fit as ${i}.`,hint:"Drop --max-size, or choose a lossy target. forge --formats lists them.",shellHint:"Choose a lossy target to aim for a size."})}if(e.kind==="document"&&e.format==="pdf"){let i=e.images?.skipped??0;return new o({code:"unsupported-compress",title:"Nothing to compress",detail:i>0?`${n}'s images are a kind Forge cannot re-encode, so there is nothing to make smaller.`:`${n} has no images \u2014 it is text and layout, which compression cannot shrink.`,hint:"Try a page operation such as --extract to keep fewer pages, or --to <format> to turn its pages into images.",shellHint:"Try /pdf to keep fewer pages, or /convert to turn its pages into images."})}return e.kind==="document"?new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${a[e.format].label}, which has no images Forge can re-encode.`,hint:`Use --to pdf to change it to PDF instead: forge ${n} --to pdf`,shellHint:"Use /convert to change it to PDF instead."}):new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${a[e.format].label}, which is lossless \u2014 there is no quality to trade away.`,hint:"Use --to to change it to a smaller format instead. forge --formats lists them.",shellHint:"Use /convert to change it to a smaller format instead."})}function J(e){let t=r(e.path);return new o({code:"unsupported-pdf",title:"/pdf needs a PDF",detail:`${t} is ${a[e.format].label}, not a PDF.`,hint:"Converting it instead."})}function j(e,t,n){return new o({code:"unsupported-operation",title:`Cannot ${e} these files`,detail:`Not available for these files: ${t}.`,hint:n??"Page operations work on PDFs: --merge takes two or more, the others take one.",shellHint:n??"Use /pdf with a PDF staged \u2014 two or more for merge."})}function z(e,t,n){let i=e.kind==="media"?`The smallest ${r(e.path)} can get is ${s(n)}, which is still over ${s(t)}.`:`${r(e.path)} is ${s(n)} even at the lowest quality, which is still over ${s(t)}.`;return new o({code:"target-unreachable",title:"Cannot get that small",detail:i,hint:"Try a larger --max-size, or --to a smaller format.",shellHint:"Try a larger target, or /convert to a smaller format."})}function L(e,t,n){return new o({code:"unsupported-target",title:`Can't convert ${r(e.path)} to ${t}`,detail:`${r(e.path)} is a ${a[e.format].label} ${e.kind==="image"?"image":"document"}.`,hint:`Available: ${n.join(", ")}`})}function q(e,t){return new o({code:"corrupt-source",title:"Damaged file",detail:`${r(e)} could not be read. It may be damaged, or not a format Forge recognises.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:t})}function V(e,t,n){return new o({code:"corrupt-source",title:`Damaged ${a[t].label}`,detail:`${r(e)} is a ${a[t].label} file, but its content could not be read.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:n})}function Y(e,t={}){let n=r(e);return new o({code:"encrypted-source",title:"This PDF is password-protected",detail:`${n} is password-protected.`,short:`${n} is password-protected.`,hint:t.attempted?"That password didn't open it. Check it and try again.":`Convert it to images instead: forge ${n} --to jpeg --password-stdin`})}var c=e=>e==="convert"||e==="boost"||e==="remove-background";function _(e,t="convert"){return new o({code:"output-exists",title:"File already exists",detail:`${r(e)} is already there.`,hint:c(t)?"Pass --force to replace it, or choose a different --output.":"Pass --force to replace it, or move the existing file out of the way.",shellHint:"Run it again and Forge will ask before replacing it."})}function X(e,t){return new o({code:"output-collision",title:"Two files want the same output",detail:`${r(e[0])} and ${r(e[1])} would both become ${r(t)}.`,hint:"Convert them separately, or use --output to send them to different folders.",shellHint:"Convert them one at a time."})}function B(e,t){return new o({code:"output-collision",title:"One output, written twice",detail:`${r(e)} would write ${r(t)} twice, and only the second would survive.`,hint:"Every output has to be its own file. Check the selection for a repeated page."})}function G(e,t="convert"){return new o({code:"output-is-input",title:"Output would replace the original",detail:`${r(e)} is both the input and the output.`,hint:c(t)?"Choose a different --output, or pass --force to overwrite in place.":"Move or rename that file first, or pass --force to overwrite it in place.",shellHint:c(t)?"Choose a different folder to save it in.":"Move or rename that file first."})}function w(e,t){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(f(e))} is not a folder you can write to.`,hint:"Choose a different --output, or check the folder permissions.",shellHint:"Choose a different folder, or check its permissions.",cause:t})}var b=new Set(["EACCES","EPERM","EROFS"]);function K(e,t){if(m(t))return t;let n=t?.code;return n!==void 0&&b.has(n)?w(e,t):t}function Q(e,t){return new o({code:"output-invalid",title:"Cannot write there",detail:`${e} could not be written to.`,hint:"Check that the path is valid and that you have permission to write to it.",cause:t})}function Z(e){return new o({code:"empty-directory",title:"No images found",detail:`${r(e)} contains no images Forge can convert.`,hint:"Try --recursive to look inside subfolders.",shellHint:"Only files directly inside a folder are read \u2014 drop the files themselves, or the folder that holds them."})}function ee(e,t){return new o({code:"invalid-arguments",title:"Invalid arguments",detail:e,hint:t})}function te(e,t,n){return new o({code:"invalid-page-range",title:"Page range not understood",detail:t,hint:`This document has ${n} pages. Use numbers and spans, like "3-7, 12, 20-".`})}function oe(e){return new o({code:"empty-selection",title:"Nothing to write",detail:e,hint:"Select at least one page to keep."})}function ne(e){return new o({code:"invalid-dpi",title:"Invalid resolution",detail:`${String(e)} is not a resolution Forge can use.`,hint:"Give a number between 36 and 600. The default is 150."})}function re(e){return new o({code:"extension-missing",title:"Extension not installed",detail:`${e} is an optional extension and is not installed.`,hint:`Install it with: forge extensions add ${e}`,shellHint:"Open /extensions to install it."})}function ie(e,t,n,i){return new o({code:"extension-outdated",title:"Extension out of date",detail:`${e} ${n} cannot ${t}; that needs ${i} or later.`,hint:`Update it with: forge extensions add ${e}`,shellHint:"Open /extensions to update it."})}function ae(e,t){return new o({code:"extension-corrupt",title:"Extension failed verification",detail:`${e}: ${t}`,hint:`Nothing was installed. Try again with: forge extensions add ${e}`,shellHint:"Nothing was installed. Try again from /extensions."})}function se(e,t,n=process.platform){let i=n==="win32"?"PC":n==="darwin"?"Mac":"computer";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} cannot be installed on this ${i}: ${t}`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function le(e,t=process.platform){let n=t==="win32"?"Windows":t==="darwin"?"macOS":t==="linux"?"Linux":"this system";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} is not available on ${n}.`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function de(e){return new o({code:"update-unavailable",title:"Cannot update this Forge",detail:`This copy of Forge was not installed with npm i -g, so ${e} cannot be installed over it.`,hint:"npm i -g forge-terminal"})}function ue(e,t=process.platform){return t==="win32"?new o({code:"update-denied",title:"Forge is in use",detail:`npm could not replace Forge's files to update it to ${e}. Windows keeps them locked while Forge runs: close every Forge window, then run the command below. If Node is installed for every user, run it in a terminal opened as administrator.`,short:"Windows locks Forge while it runs: close it, then run this",hint:`npm i -g forge-terminal@${e}`}):new o({code:"update-denied",title:"npm needs permission",detail:`npm needs permission to update Forge to ${e}.`,short:"npm needs permission to update Forge",hint:`sudo npm i -g forge-terminal@${e}`})}function ce(e,t){return new o({code:"update-failed",title:"Update failed",detail:`npm could not install Forge ${e}: ${t}`,short:"npm could not install the update",hint:`npm i -g forge-terminal@${e}`})}function pe(){return new o({code:"update-unreachable",title:"Could not check for updates",detail:"The npm registry could not be reached.",short:"could not reach npm",hint:"Check your connection (and HTTPS_PROXY if you use a proxy), then run: forge update",shellHint:"Check your connection, then try again."})}function he(e,t){return new o({code:"extension-download-failed",title:"Download failed",detail:`${e}: ${t}`,hint:`Check your connection (and HTTPS_PROXY if you use a proxy), then run: forge extensions add ${e}`,shellHint:"Check your connection, then try again from /extensions."})}function ge(e,t){return new o({code:"extension-download-failed",title:"Not enough disk space",detail:`${e}: ${t}`,hint:`Free some disk space, then run: forge extensions add ${e}`,shellHint:"Free some disk space, then try again from /extensions."})}function fe(e,t,n){let i=t?t.what?`${t.what} (forge, pid ${t.pid})`:`another forge (pid ${t.pid}) is using it`:"another forge is using it";return new o({code:"extension-in-use",title:"Extension in use",detail:`${e} is in use: ${i}.`,hint:n==="remove"?`Wait for that job to finish, then run: forge extensions remove ${e}`:"Wait for that job to finish, then try again.",shellHint:n==="remove"?"It can be removed when that job finishes.":"Try again when that job finishes."})}function me(e){return new o({code:"no-subject",title:"No subject found",detail:`${r(e)} has no clear subject to cut out.`,hint:"Try a photo where the subject stands apart from the background."})}function we(e,t,n){return n===1?new o({code:"boost-too-large",title:"Too large to sharpen",detail:`${r(e)} is too large to sharpen.`,hint:"Sharpen works on images up to 16,384 px a side and 100 megapixels."}):new o({code:"boost-too-large",title:"Too large to boost",detail:t>=2?`${r(e)} is too large to boost that far; ${t}x is the most it can take.`:`${r(e)} is already too large to boost.`,hint:t>=2?`Try --boost ${t}.`:"Boost works on images up to 100 megapixels.",shellHint:t>=2?`Choose ${t}x instead.`:void 0})}function be(e,t,n,i=process.platform){let l=n===1?"sharpen":"boost",d=i==="win32"?"PC":i==="darwin"?"Mac":"computer",u=Math.max(1,Math.round(t/60));return new o({code:"boost-too-slow",title:`Too slow to ${l}`,detail:`${r(e)} would take about ${u} ${u===1?"minute":"minutes"} to ${l} on this ${d}.`,hint:"Try a smaller photo."})}function xe(e,t){return new o({code:"resize-too-large",title:"Too large to resize to",detail:`${r(e)} would be ${t.width} \xD7 ${t.height}.`,hint:"Resize works up to 16,384 px a side and 100 megapixels."})}var x={darwin:"\u2303\u21E7\u23184",win32:"Win+Shift+S"};function $e(e,t=process.platform){let n=x[t];return new o({code:"no-clipboard-image",title:"No image",detail:e==="text"?"The clipboard holds text, not a picture.":"The clipboard is empty.",hint:n===void 0?"Copy a picture or a screenshot, then run forge clip again.":`Copy a picture, or take a screenshot with ${n}, then run forge clip again.`})}function Fe(e=process.platform){return new o({code:"clipboard-unavailable",title:"No clipboard",detail:e==="linux"?"Forge reads the clipboard of a Wayland or X11 desktop, and not over SSH.":"Forge reads the clipboard on macOS, Windows and Linux, and not over SSH."})}function ye(e){return new o({code:"clipboard-tool-missing",title:`Clipboard needs ${e}`,detail:`Forge reaches the clipboard through ${e}, and it is not on this computer.`,short:`${e} is not on this computer`,hint:`Install it with sudo apt install ${e} (or your distribution's package manager), then try again.`})}function Ee(){return new o({code:"nothing-to-undo",title:"Nothing to undo",detail:"No copied image has been changed yet."})}function ve(e,t,n,i=!1){let l=r(e);if(i)return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${l} is no smaller even at the lowest quality, so nothing was written.`,short:"nothing written"});let d=n>t?`would grow from ${s(t)} to ${s(n)}`:`would stay at ${s(t)}`;return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${l} ${d}, so nothing was written.`,short:"nothing written",hint:"Try a lower --quality.",shellHint:"Try a lower quality."})}function ke(e,t,n){return new o({code:"cannot-compress-more",title:"Already small enough",detail:`${r(e)} is ${s(t)}, already under ${s(n)}, so nothing was written.`,short:"already under that size"})}function Ce(e){return new o({code:"nothing-to-trim",title:"Nothing to trim",detail:`${r(e)} has no empty edges.`,short:"no empty edges"})}function Se(e){return new o({code:"animated-trim",title:"Can't trim an animation",detail:`${r(e)} is animated; trimming works on still images.`})}function Te(e,t){return new o({code:"nothing-to-crop",title:"Nothing to crop",detail:`${r(e)} is already ${t}.`,short:`already ${t}`})}function Ne(e){return new o({code:"animated-crop",title:"Can't crop an animation",detail:`${r(e)} is animated; cropping works on still images.`})}function Ie(e){return new o({code:"animated-rotate",title:"Can't rotate an animation",detail:`${r(e)} is animated; rotating works on still images.`})}function Pe(e,t=process.platform,n=!1){let i=p(t),l=n?`forge extensions add video (or ${i})`:t==="linux"?`${i} (or your distribution's package manager)`:i;return new o({code:"ffmpeg-missing",title:"Video and audio need ffmpeg",detail:`${r(e)} is a video or audio file, and ffmpeg is not on this computer.`,short:"ffmpeg is not on this computer",hint:`Install it with ${l}, then run Forge again.`})}function He(e,t,n=process.platform){let i=a[e].label,l=/^[AEFHILMNORSX]/.test(t.codec)?"an":"a",d=t.encoders,u=d.length>1?`${d.slice(0,-1).join(", ")} or ${d.at(-1)}`:d[0]??"",h=d.length>1?"any of them":"it",g=n==="linux"?"Install a full build of ffmpeg, then run Forge again. On Fedora, RPM Fusion's ffmpeg replaces ffmpeg-free.":n==="win32"?`Install a full build of ffmpeg, such as gyan.dev's (${p(n)}), then run Forge again.`:`Install a full build of ffmpeg (${p(n)}), then run Forge again.`;return new o({code:"encoder-missing",title:`Your ffmpeg can't write ${i}`,detail:`${i} needs ${l} ${t.codec} encoder${t.sound?" for its sound":""}: ${u}. Your ffmpeg was built without ${h}.`,short:`Your ffmpeg has no ${t.codec} encoder`,hint:g})}function p(e=process.platform){return e==="win32"?"winget install ffmpeg":e==="linux"?"sudo apt install ffmpeg":"brew install ffmpeg"}function Oe(e,t){return new o({code:"conversion-failed",title:"Conversion failed",detail:`${r(e)} could not be converted.`,hint:"Run again with --debug for the underlying error.",shellHint:"Run the same conversion with forge --debug from the command line to see why.",cause:t})}function Re(e){return new o({code:"no-sound",title:"Nothing to transcribe",detail:`${r(e)} has no sound.`})}function Ae(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){return n==="whisper"?new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e,t)} cannot be read by whisper.`,hint:"Video and sound files can be transcribed."}):new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e)} cannot be read by Apple's speech recogniser.`,hint:"MP4, MOV, M4A, MP3, WAV and AIFF can be transcribed; with ffmpeg (brew install ffmpeg), any video or sound file."})}function We(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){let i=n==="apple"?"Apple's speech recogniser":"The whisper extension";return new o({code:"language-unsupported",title:"Language not supported",detail:`${i} does not support ${e}.`,hint:"Pass another with --language, for example --language en-US."})}function Ue(e,t,n={}){return new o({code:"link-unavailable",title:"Cannot transcribe this link",detail:e,...n,...t===void 0?{}:{cause:t}})}function De(e){return new o({code:"transcribe-unavailable",title:"Transcribe is not available",detail:e})}function Me(e=!1){return e?new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs Forge's free read-text extension.",short:"Needs the read-text extension.",hint:"Install it with: forge extensions add read-text",shellHint:"Open /extensions to install it."}):new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs macOS 26 or later.",short:"Reading text needs macOS 26 or later."})}function Je(e){let t=r(e);return new o({code:"no-text",title:"No text found",detail:`No text found in ${t}`,short:`No text found in ${t}`})}function je(e){return new o({code:"unexpected",title:"Something went wrong",detail:e instanceof Error?e.message:String(e),hint:"This was not expected. Try again \u2014 if it keeps happening, it may be worth reporting.",cause:e})}function ze(e,t={}){let n=[`\u2715 ${e.title}`,"",` ${e.detail}`];return e.hint&&n.push("",` ${e.hint}`),t.debug&&e.cause instanceof Error&&n.push("",` ${e.cause.stack??e.cause.message}`),n}export{m as a,v as b,k as c,C as d,S as e,T as f,N as g,I as h,P as i,H as j,O as k,R as l,A as m,W as n,U as o,D as p,M as q,J as r,j as s,z as t,L as u,q as v,V as w,Y as x,_ as y,X as z,B as A,G as B,w as C,K as D,Q as E,Z as F,ee as G,te as H,oe as I,ne as J,re as K,ie as L,ae as M,se as N,le as O,de as P,ue as Q,ce as R,pe as S,he as T,ge as U,fe as V,me as W,we as X,be as Y,xe as Z,$e as _,Fe as $,ye as aa,Ee as ba,ve as ca,ke as da,Ce as ea,Se as fa,Te as ga,Ne as ha,Ie as ia,Pe as ja,He as ka,p as la,Oe as ma,Re as na,Ae as oa,We as pa,Ue as qa,De as ra,Me as sa,Je as ta,je as ua,ze as va};
@@ -1,55 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as h}from"./chunk-6RMRWBMB.js";import{execFile as P}from"node:child_process";import{accessSync as U,constants as _}from"node:fs";import{isAbsolute as M,join as a}from"node:path";var D=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function x(e,t){if(typeof e=="string")return`${t}<string>${D(e)}</string>`;if(typeof e=="number")return`${t}<integer>${e}</integer>`;if(typeof e=="boolean")return`${t}<${e}/>`;if(Array.isArray(e))return`${t}<array>
4
- ${e.map(i=>x(i,`${t} `)).join(`
5
- `)}
6
- ${t}</array>`;let n=Object.entries(e).map(([i,o])=>`${t} <key>${D(i)}</key>
7
- ${x(o,`${t} `)}`);return n.length===0?`${t}<dict/>`:`${t}<dict>
8
- ${n.join(`
9
- `)}
10
- ${t}</dict>`}var N=e=>`<?xml version="1.0" encoding="UTF-8"?>
11
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
12
- <plist version="1.0">
13
- ${x(e,"")}
14
- </plist>
15
- `,v={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf",video:"public.movie",audio:"public.audio"};function w(e){return e.length===1&&e[0]==="image"?"com.apple.Automator.fileSystemObject.image":e.length===1&&e[0]==="pdf"?"com.apple.Automator.fileSystemObject.PDF":e.length===1&&e[0]==="folder"?"com.apple.Automator.fileSystemObject.folder":"com.apple.Automator.fileSystemObject"}var u=e=>`'${e.replace(/'/g,"'\\''")}'`,E="forge",A=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,G="com.forge-terminal.menu.",I="runWorkflowAsService",Q=e=>`${A(e)} - ${e.label} - ${I}`,k=`ObjC.import('Foundation')
16
- function run(argv) {
17
- const domain = argv[0]
18
- const defaults = $.NSUserDefaults.standardUserDefaults
19
- const or = (v) => (v.isNil() ? $.NSDictionary.dictionary : v)
20
- const all = $.NSMutableDictionary.dictionaryWithDictionary(or(defaults.persistentDomainForName(domain)))
21
- const status = $.NSMutableDictionary.dictionaryWithDictionary(or(all.objectForKey('NSServicesStatus')))
22
- const on = { presentation_modes: { ContextMenu: true, FinderPreview: true, ServicesMenu: true, TouchBar: true } }
23
- for (const arg of argv.slice(1)) {
24
- const key = arg.slice(1)
25
- if (arg[0] === '+') status.setObjectForKey($(on), key)
26
- else status.removeObjectForKey(key)
27
- }
28
- all.setObjectForKey(status, 'NSServicesStatus')
29
- defaults.setPersistentDomainForName(all, domain)
30
- }`;function z(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",k,e.domain??"pbs",...e.on.map(t=>`+${t}`),...e.off.map(t=>`-${t}`)]]}function Z(e,t){let n=N({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:A(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:E,NSMenuItem:{default:e.label},NSMessage:I,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(c=>v[c])}]}),i=e.preset===void 0?"":` ${u(e.preset)}`,o=`${u(t)} ${e.action}${i} "$@"`,r=N({AMApplicationBuild:"521",AMApplicationVersion:"2.10",AMDocumentVersion:"2",actions:[{action:{AMAccepts:{Container:"List",Optional:!0,Types:["com.apple.cocoa.path"]},AMActionVersion:"2.0.3",AMApplication:["Automator"],AMParameterProperties:{COMMAND_STRING:{},CheckedForUserDefaultShell:{},inputMethod:{},shell:{},source:{}},AMProvides:{Container:"List",Types:["com.apple.cocoa.string"]},ActionBundlePath:"/System/Library/Automator/Run Shell Script.action",ActionName:"Run Shell Script",ActionParameters:{COMMAND_STRING:o,CheckedForUserDefaultShell:!0,inputMethod:1,shell:"/bin/zsh",source:""},BundleIdentifier:"com.apple.RunShellScript",CFBundleVersion:"2.0.3",CanShowSelectedItemsWhenRun:!1,CanShowWhenRun:!0,Category:["AMCategoryUtilities"],"Class Name":"RunShellScriptAction",InputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A01",OutputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A02",UUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A03",UnlocalizedApplications:["Automator"]},isViewVisible:!0}],connectors:{},workflowMetaData:{serviceApplicationBundleID:"com.apple.finder",serviceApplicationPath:"/System/Library/CoreServices/Finder.app",serviceInputTypeIdentifier:w(e.kinds),serviceOutputTypeIdentifier:"com.apple.Automator.nothing",serviceProcessesInput:!1,workflowTypeIdentifier:"com.apple.Automator.servicesMenu"}});return{name:`${e.label}.workflow`,files:{"Contents/Info.plist":n,"Contents/document.wflow":r,"Contents/Resources/document.wflow":r}}}var d="forge-terminal-menu";function oe(e){let t=i=>i&&M(i)?i:void 0,n=(e.xdgConfigDirs??"").split(":").filter(i=>M(i));return{dataHome:t(e.xdgDataHome)??a(e.home,".local","share"),configHome:t(e.xdgConfigHome)??a(e.home,".config"),configDirs:n.length>0?n:["/etc/xdg"]}}function S(e,t=process.env.PATH){for(let n of(t??"").split(":"))if(n!=="")try{return U(a(n,e),_.X_OK),!0}catch{}return!1}var F={image:"image/*",folder:"inode/directory",pdf:"application/pdf",video:"video/*",audio:"audio/*"},L=e=>e.map(t=>`${F[t]};`).join(""),b=e=>`${e.paint}.png`,re=e=>a(e.dataHome,"nautilus","scripts","Forge"),f=e=>e.preset===void 0?e.action:`preset-${e.preset}`,g=e=>e.preset===void 0?e.action:`preset ${e.preset}`,se=e=>e.label;function ae(e,t){return`#!/bin/sh
31
- # ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
32
- if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
33
- IFS='
34
- '
35
- set -f
36
- set -- $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
37
- fi
38
- exec ${u(t)} ${g(e)} "$@"
39
- `}var ce=e=>a(e.dataHome,"nemo","actions"),ue=(e,t)=>`forge-${e.preset===void 0?t.indexOf(e.action)+1:t.length+1}-${f(e)}.nemo_action`,m=e=>e.replace(/%/g,"%%");function pe(e,t){return`[Nemo Action]
40
- # ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
41
- Name=${m(e.label)}
42
- Comment=${m(e.label)}
43
- Exec=${m(u(t))} ${g(e)} %F
44
- Selection=notnone
45
- Mimetypes=${L(e.kinds)}
46
- `}var le=e=>a(e.dataHome,"kio","servicemenus"),me=e=>`forge-${e}.desktop`,de=["image","folder","pdf","video","audio"],O=e=>m(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function fe(e,t,n){let i=t.filter(s=>s.kinds.includes(e));if(i.length===0)return;let o=i.length>1,r=["[Desktop Entry]",`# ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.`,"Type=Service","ServiceTypes=KonqPopupMenu/Plugin","X-KDE-ServiceTypes=KonqPopupMenu/Plugin",`MimeType=${F[e]};`,`Actions=${i.map(s=>`${f(s)};`).join("")}`,"X-KDE-Priority=TopLevel",...o?["X-KDE-Submenu=Forge",`Icon=${a(n.menuDir,"forge.png")}`]:[]],c=i.map(s=>["",`[Desktop Action ${f(s)}]`,`Name=${s.label}`,`Icon=${a(n.menuDir,b(s))}`,`Exec=${O(n.launcher)} ${g(s)} %F`].join(`
47
- `));return`${[...r,...c].join(`
48
- `)}
49
- `}var ge=e=>a(e.configHome,"Thunar","uca.xml"),$e=e=>e.configDirs.map(t=>a(t,"Thunar","uca.xml")),xe=`<?xml version="1.0" encoding="UTF-8"?>
50
- <actions>
51
- </actions>
52
- `,y=e=>`${d}-${f(e)}`,l=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),j={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"},video:{patterns:["*"],type:"video-files"},audio:{patterns:["*"],type:"audio-files"}};function ye(e,t){return e.flatMap(n=>{let i=n.kinds.filter(r=>r==="pdf"),o=n.kinds.filter(r=>r!=="pdf");return[...o.length>0?[{item:n,kinds:o,id:y(n)}]:[],...i.length>0?[{item:n,kinds:i,id:o.length>0?`${y(n)}-pdf`:y(n)}]:[]]}).map(({item:n,kinds:i,id:o})=>{let r=i.map(p=>j[p]),c=[...new Set(r.flatMap(p=>p.patterns))],s=c.includes("*")?["*"]:c;return["<action>",` <icon>${l(a(t.menuDir,b(n)))}</icon>`,` <name>${l(n.label)}</name>`,` <submenu>${i.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${o}</unique-id>`,` <command>${l(m(u(t.launcher)))} ${g(n)} %F</command>`,` <description>${l(n.label)}</description>`," <range></range>",` <patterns>${l(s.join(";"))}</patterns>`,...r.map(p=>` <${p.type}/>`),"</action>"].join(`
53
- `)}).map(n=>`${n}
54
- `).join("")}var R=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function B(e){return e.replace(R,t=>t.includes(`<unique-id>${d}-`)?"":t)}function Se(e,t){let n=B(e),i=n.lastIndexOf("</actions>");if(i===-1||!/<actions>/.test(n))return;let o=n.lastIndexOf(`
55
- `,i)+1;return/^[ \t]*$/.test(n.slice(o,i))&&(i=o),`${n.slice(0,i)}${t}${n.slice(i)}`}var he=(e,t,n)=>S("thunar",t)||n(a(e.configHome,"Thunar"));var K="ForgeTerminal.Forge",C=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),H=e=>e.replace(/['‘’‚‛]/g,"$&$&"),T=H;function W(e,t){return["[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null","$x = New-Object Windows.Data.Xml.Dom.XmlDocument",`$x.LoadXml('<toast><visual><binding template="ToastText02"><text id="1">${T(C(e))}</text><text id="2">${T(C(t))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${K}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function X(e,t,n=process.platform){return n==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",W(e,t)]]:["/usr/bin/osascript",["-e","on run argv","-e","display notification (item 2 of argv) with title (item 1 of argv)","-e","end run",e,t]]}var $=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function V(e,t,n={}){let i=n.has??(o=>S(o));if(i("notify-send"))return["notify-send",["--app-name=Forge",...n.icon?[`--icon=${n.icon}`]:[],"--",e,t]];if(i("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",$("Forge"),"0",$(n.icon??""),$(e),$(t),"[]","{}","-1"]]}function q(e,t,n=process.platform,i={}){let o=n==="linux"?V(e,t,i):X(e,t,n);return new Promise(r=>{if(o===void 0)return r();try{P(o[0],o[1],{timeout:1e4,windowsHide:!0},()=>r())}catch{r()}})}var J=(e,t)=>new Promise((n,i)=>P(e,t,{timeout:2e3},(o,r)=>o?i(o):n(r)));async function Y(e,t=J){let n=(await t("lsappinfo",["front"])).trim();return(await t("lsappinfo",["info","-only","bundleid",n])).match(/bundleID="([^"]*)"/)?.[1]===e}async function Me(e,t,n={}){if(e===void 0||!h(t))return;let i=n.platform??process.platform,o=n.env??process.env;if(o.FORGE_NO_NOTIFY||o.SSH_CONNECTION||o.SSH_TTY)return;let r=o.__CFBundleIdentifier;i==="darwin"&&r&&await Y(r,n.ask).catch(()=>!1)||await(n.post??((c,s)=>q(c,s,i)))(e.title,e.body)}export{u as a,E as b,G as c,Q as d,z as e,Z as f,d as g,oe as h,S as i,b as j,re as k,se as l,ae as m,ce as n,ue as o,pe as p,le as q,me as r,de as s,fe as t,ge as u,$e as v,xe as w,ye as x,B as y,Se as z,he as A,K as B,H as C,W as D,X as E,$ as F,V as G,q as H,Y as I,Me as J};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d}from"./chunk-GHYODKA3.js";import"./chunk-W53XNVNH.js";import"./chunk-SM735FG7.js";import"./chunk-6MWJO3GB.js";import"./chunk-ASLKQXZ2.js";import"./chunk-BKLPRILS.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-QQV7CCAY.js";import"./chunk-VJMOZPHW.js";import"./chunk-AR3M2PLK.js";import"./chunk-FBVRKMAF.js";import"./chunk-3374PCO5.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-TGC24JEW.js";import"./chunk-O7DK3GJT.js";import"./chunk-K253E723.js";import"./chunk-EEQSUBBL.js";import"./chunk-OQBIYNGK.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as clipLines,a as runClip,d as runClipCommand,c as runUndo};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c}from"./chunk-OXDRJO4V.js";import"./chunk-SM735FG7.js";import"./chunk-V6GWPR2A.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as V}from"./chunk-6PEIZZNE.js";import{g as F,h as G,i as B}from"./chunk-TFGK7IRZ.js";import{b as O,c as H}from"./chunk-POM7FXIV.js";import{i as D,l as _,m as M,o as U}from"./chunk-7XFLG32B.js";import{b as x,c as v,h as E,i as $,j as h}from"./chunk-N32JL4UI.js";import{a as J,b as T,c as W}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as b}from"./chunk-TGC24JEW.js";import"./chunk-K253E723.js";import"./chunk-EEQSUBBL.js";import"./chunk-OQBIYNGK.js";import"./chunk-FAUL5L2W.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{b as R,c as N,d as P,h as j,k as I,l as L,m as A}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import{c as w}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{readFile as nt}from"node:fs/promises";import{basename as st,resolve as z}from"node:path";function d(t,e){let o=h(e);if(!o)return;let s=o.alpha!==void 0&&o.alpha<1?o.alpha:void 0;return{name:t,hex:x(o.rgb),...s===void 0?{}:{alpha:s}}}function Y(t){let e=t.replace(/^/,"").trim();if(e==="")return{colours:[],bad:[]};if(e.startsWith("{")||e.startsWith("["))try{return X(JSON.parse(e))}catch{}return rt(e.split(/\r?\n/))}var m=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Q=["hex","colour","color","value","$value"];function X(t){let e={colours:[],bad:[]};if(Array.isArray(t)){for(let c of t){if(!m(c))continue;let i=typeof c.name=="string"?c.name:void 0,p=Q.find(a=>typeof c[a]=="string");if(!i||!p)continue;let l=c[p],f=d(i,l);f?e.colours.push(f):e.bad.push(`${i}: ${l}`)}return e}if(!m(t))return e;let o=Object.keys(t).filter(c=>!c.startsWith("$")),s=o.length===1?t[o[0]]:void 0,r=m(s)&&!("$value"in s)?s:t,n=(c,i=0)=>{let p=/^\{(.+)\}$/.exec(c.trim());if(!p||i>8)return c;let l=t;for(let f of p[1].split("."))l=m(l)?l[f]:void 0;return m(l)&&typeof l.$value=="string"?n(l.$value,i+1):typeof l=="string"?n(l,i+1):c},u=(c,i,p)=>{let l=c.$type??p;for(let[f,a]of Object.entries(c)){if(f.startsWith("$"))continue;let C=[...i,f].join("/");if(m(a)&&"$value"in a){let g=a.$type??l,y=a.$value;if(typeof y!="string")continue;let S=d(C,n(y));S?e.colours.push(S):g==="color"&&e.bad.push(`${C}: ${y}`)}else if(m(a))u(a,[...i,f],l);else if(typeof a=="string"){let g=d(C,n(a));g&&e.colours.push(g)}}};return u(r,[]),e}function q(t){let e=[],o="",s=!1;for(let r=0;r<t.length;r++){let n=t[r];s?n==='"'&&t[r+1]==='"'?(o+='"',r++):n==='"'?s=!1:o+=n:n==='"'?s=!0:n===","?(e.push(o.trim()),o=""):o+=n}return e.push(o.trim()),e}var Z=["name","token","label"],tt=["hex","colour","color","value","rgb"];function et(t,e,o){let s={colours:[],bad:[]};for(let r of t){if(r.trim()==="")continue;let n=q(r),u=n[e]??"",c=n[o]??"",i=u?d(u,c):void 0;i?s.colours.push(i):s.bad.push(r.trim())}return s}function ot(t){let e=t.replace(/^[-*•]\s+/,"").replace(/[;,]$/,"").trim();for(let r of[" ",":","=",","]){let n=e.indexOf(r);if(n<=0)continue;let u=d(e.slice(0,n).trim(),e.slice(n+1).trim());if(u?.name)return u}let o=e.split(/\s+/);for(let r=1;r<o.length;r++){let n=d(o.slice(0,r).join(" "),o.slice(r).join(" "));if(n)return n}for(let r=o.length-1;r>=1;r--){let n=d(o.slice(r).join(" "),o.slice(0,r).join(" "));if(n)return n}let s=d("",e);return s?{...s,name:s.hex}:void 0}function rt(t){let e=q(t[0]??"").map(c=>c.toLowerCase()),o=e.findIndex(c=>Z.includes(c)),s=e.findIndex(c=>tt.includes(c));if(e.length>1&&o!==-1&&s!==-1)return et(t.slice(1),o,s);let r=t.some(c=>/^\s*--[\w-]+\s*:/.test(c)),n={colours:[],bad:[]},u=!1;for(let c of t){let i=c.replace(/\/\*.*?\*\//g,"");if(u){let f=i.indexOf("*/");if(f===-1)continue;i=i.slice(f+2),u=!1}let p=i.indexOf("/*");if(p!==-1&&(i=i.slice(0,p),u=!0),i=i.trim(),i===""||i.startsWith("//"))continue;if(r){let f=/^--([\w-]+)\s*:\s*(.+?)\s*;?$/.exec(i);if(!f)continue;let a=d(f[1],f[2]);a&&n.colours.push(a);continue}if(i.startsWith("#")&&!h(i.split(/\s+/)[0]))continue;let l=ot(i);l?n.colours.push(l):n.bad.push(i)}return n}var k=({r:t,g:e,b:o},s)=>s?`\x1B[38;2;${t};${e};${o}m\u2588\u2588\x1B[39m `:"";function it(t,e){let o=v(e),s,r=Number.POSITIVE_INFINITY;for(let n of t){let u=(n.centre.L-o.L)**2+(n.centre.a-o.a)**2+(n.centre.b-o.b)**2;u<r&&(r=u,s=n)}return s}async function ct(t){let{pixels:e}=await V(t.input),o=_(e);if(o.length===0)throw I(t.input);let s=t.inside?it(o,t.inside):void 0,r=s?M(e,s):o,n=T(b,{source:z(t.input),...s?{inside:s.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:E(c.rgb),oklch:$(c.rgb),share:c.share}))});return{groups:r,...s?{parent:s}:{},doc:n,svg:()=>G(w(t.input),r,"light",s?.hex)}}async function Et(t,e){let{groups:o,doc:s,svg:r}=await ct(t);if(t.svg)return{exitCode:0,stdout:[r()],stderr:[]};if(e.json)return{exitCode:0,stdout:[JSON.stringify(s)],stderr:[]};let n=U(o.map(u=>u.share));return{exitCode:0,stdout:o.map((u,c)=>`${k(u.rgb,e.colour)}${u.hex} ${String(n[c]).padStart(3)}%`),stderr:[]}}async function Rt(t,e){let o=D(t.colour);if(t.svg)return{exitCode:0,stdout:[B(t.colour,o)],stderr:[]};let s=o.map(r=>({...r,...H(r.rgb)}));if(e.json){let r=W(b,{reference:x(t.colour),steps:s.map(n=>({step:n.step,hex:n.hex,oklch:$(n.rgb),white:n.white,black:n.black}))});return{exitCode:0,stdout:[JSON.stringify(r)],stderr:[]}}return{exitCode:0,stdout:s.map(r=>`${String(r.step).padStart(4)} ${k(r.rgb,e.colour)}${r.hex} white ${r.white.toFixed(1)} ${O(r.white)} \xB7 black ${r.black.toFixed(1)} ${O(r.black)}`),stderr:[]}}async function ut(){let t=[];for await(let e of process.stdin)t.push(Buffer.from(e));return Buffer.concat(t).toString("utf8")}async function at(t){try{return await nt(t,"utf8")}catch(e){let o=e.code;throw o==="ENOENT"||o==="ENOTDIR"?R(t):o==="EISDIR"?N(t):o==="EACCES"||o==="EPERM"?P(t):j(t,e)}}var K=t=>t.alpha===void 0?t.hex:`${t.hex} ${Math.round(t.alpha*100)}%`;async function Nt(t,e,o=ut){let s=t.input==="-",r=s?await o():await at(t.input),n=s?"the text from stdin":w(t.input),{colours:u,bad:c}=Y(r);if(c.length>0)throw A(n,c);if(u.length===0)throw L(n);if(t.svg){let i=t.title??(s?"Colours":st(t.input).replace(/\..*$/,"")||"Colours"),p=u.length,l=u.map(a=>({id:a.name,name:a.name,value:K(a),hex:a.hex,...a.alpha===void 0?{}:{alpha:a.alpha}}));return{exitCode:0,stdout:[F(i,`${p} colour${p===1?"":"s"}`,l,"light",{perRow:8})],stderr:[]}}if(e.json){let i=J(b,{source:s?"-":z(t.input),colours:u});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}return{exitCode:0,stdout:u.map(i=>{let p=h(i.hex)?.rgb??{r:0,g:0,b:0};return`${k(p,e.colour)}${K(i)} ${i.name}`}),stderr:[]}}export{ct as readPalette,Nt as runCard,Et as runPalette,Rt as runScale};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as s}from"./chunk-WE6KP4FR.js";import{G as a}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var d=["open","convert","compress","sharpen","open-file","preset"];function f(t){let[e,n,...r]=t,o=n==="open-pdf"?"open-file":n;if(e==="install"||e==="remove")return{kind:e};if(e==="run"||e==="open"){if(!d.includes(o))throw a(`No menu action called "${o??""}".`);if(o==="preset"){let[i,...c]=r;if(e!=="run"||i===void 0||!s(i))throw a(`No preset called "${i??""}".`);return{kind:"run",action:o,preset:i,paths:c}}return{kind:e,action:o,paths:r}}throw a(`No menu command called "${e??""}".`)}function p(t,e,n=!1){switch(t){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-file":return{paths:e,mode:n?"pdf":"convert",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}async function h(t,e){let[n]=e;return p(t,e,t==="open-file"&&n!==void 0&&await u(n))}async function u(t){let{open:e}=await import("node:fs/promises");try{let n=await e(t,"r");try{let r=Buffer.alloc(1024),{bytesRead:o}=await n.read(r,0,r.length,0);return r.subarray(0,o).includes("%PDF-")}finally{await n.close()}}catch{return!1}}export{p as openedFor,h as openedForClick,f as parseMenuArgs};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b}from"./chunk-HTA25PO2.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as CONFIG_KEYS,b as runConfig};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d,e}from"./chunk-ILQDMVJR.js";import"./chunk-4MJEEEFA.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as OPS,d as chainLabels,e as reasonsFor,c as stepLabel,b as withStep};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{g as a,h as b,i as c,j as d}from"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as clearDecodedCacheForTests,a as decodedInput,c as idleDecodedCacheForTests,d as limitDecodedCacheForTests};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{c as a,d as b,e as c,f as d}from"./chunk-6MWJO3GB.js";import"./chunk-ASLKQXZ2.js";import"./chunk-BKLPRILS.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-QQV7CCAY.js";import"./chunk-VJMOZPHW.js";import"./chunk-AR3M2PLK.js";import"./chunk-FBVRKMAF.js";import"./chunk-3374PCO5.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-TGC24JEW.js";import"./chunk-O7DK3GJT.js";import"./chunk-K253E723.js";import"./chunk-EEQSUBBL.js";import"./chunk-OQBIYNGK.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{d as execute,a as exitCodeFor,c as renderRun,b as runIntent};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{Jb as a,Kb as b,Lb as c,Mb as d,Nb as e}from"./chunk-NDYMC3HY.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-POM7FXIV.js";import"./chunk-7XFLG32B.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-N32JL4UI.js";import"./chunk-TGC24JEW.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as ExtensionsFlow,c as byteCount,b as extensionCredits,d as extensionsChip,a as realManager};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-OQBIYNGK.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,i as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,b as readNames,j as readProgress,k as runFfmpeg,h as soundLevels};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h}from"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d,e,f}from"./chunk-4KGC5ZBZ.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{f as installUpdate,a as installedGlobally,e as lastWords,c as npmBeside,d as npmCliBeside,b as runningScript};