forge-terminal 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -7
- package/dist/chunks/{about-credits-XL2AIGQ7.js → about-credits-PWTKZG3Y.js} +1 -1
- package/dist/chunks/args-RHIBM3R3.js +3 -0
- package/dist/chunks/{available-TNMISSBA.js → available-FPBRQ3LS.js} +1 -1
- package/dist/chunks/{boot-QRKC4QBA.js → boot-PHDTJAFT.js} +1 -1
- package/dist/chunks/{catalog-FMHWWMUX.js → catalog-G44MXIAF.js} +1 -1
- package/dist/chunks/{check-HOITNMJX.js → check-BFHBPCGW.js} +1 -1
- package/dist/chunks/{chunk-EIPMQFIF.js → chunk-2YU4EI24.js} +1 -1
- package/dist/chunks/chunk-3IAJTXYM.js +3 -0
- package/dist/chunks/{chunk-ECA4PW5T.js → chunk-3OCPO5V6.js} +1 -1
- package/dist/chunks/chunk-42IEPG2K.js +3 -0
- package/dist/chunks/{chunk-BYUOU2Q2.js → chunk-4AL5QJLM.js} +1 -1
- package/dist/chunks/{chunk-UUTBDIFR.js → chunk-56B3VZCM.js} +1 -1
- package/dist/chunks/{chunk-QIMSNTKL.js → chunk-56QHX7QR.js} +1 -1
- package/dist/chunks/{chunk-HXKLYK3M.js → chunk-6NCN7OJ5.js} +1 -1
- package/dist/chunks/{chunk-YBA6DJQ4.js → chunk-6PUV4HSU.js} +1 -1
- package/dist/chunks/{chunk-2OSM4W4D.js → chunk-72UR37EG.js} +1 -1
- package/dist/chunks/{chunk-3IX3QA76.js → chunk-7NP76V4U.js} +1 -1
- package/dist/chunks/{chunk-5FJT4BNY.js → chunk-AETM2PCZ.js} +1 -1
- package/dist/chunks/{chunk-GIG4I2IC.js → chunk-BQV3DSUZ.js} +2 -2
- package/dist/chunks/chunk-DC2DHMXO.js +3 -0
- package/dist/chunks/{chunk-6HUYBVQA.js → chunk-DKHBJ52G.js} +1 -1
- package/dist/chunks/chunk-E5VPEBUQ.js +3 -0
- package/dist/chunks/chunk-F4TUCI6D.js +3 -0
- package/dist/chunks/{chunk-MF3KKEFB.js → chunk-FEJSM3E4.js} +1 -1
- package/dist/chunks/{chunk-JUA63KQK.js → chunk-G2V33TMN.js} +1 -1
- package/dist/chunks/{chunk-FXA45V4B.js → chunk-G4M2XYFJ.js} +1 -1
- package/dist/chunks/{chunk-WID72ZII.js → chunk-H332YFSO.js} +1 -1
- package/dist/chunks/chunk-HAOKWLD3.js +4 -0
- package/dist/chunks/{chunk-S7BZPV5T.js → chunk-I3C3SRF2.js} +1 -1
- package/dist/chunks/{chunk-NUTTDNTG.js → chunk-ID4GJZJ6.js} +1 -1
- package/dist/chunks/{chunk-X4QI2EYV.js → chunk-ID75X37Z.js} +1 -1
- package/dist/chunks/{chunk-FWVE3GNA.js → chunk-JPASVE56.js} +1 -1
- package/dist/chunks/{chunk-UN5DSJE2.js → chunk-JZM37DG2.js} +1 -1
- package/dist/chunks/{chunk-G6L5NIJ5.js → chunk-KPUKMAYK.js} +1 -1
- package/dist/chunks/{chunk-UEAZTRTL.js → chunk-M7HB4L6L.js} +1 -1
- package/dist/chunks/{chunk-NLM2SP3F.js → chunk-OK56WDPA.js} +1 -1
- package/dist/chunks/{chunk-I25E2XDH.js → chunk-OLKPV4WO.js} +1 -1
- package/dist/chunks/chunk-OPDC577C.js +3 -0
- package/dist/chunks/chunk-OQ6DTE56.js +3 -0
- package/dist/chunks/chunk-PNPAHKJR.js +3 -0
- package/dist/chunks/{chunk-3HG7RXC2.js → chunk-PXCEMDOY.js} +2 -2
- package/dist/chunks/{chunk-YJZEHJ6U.js → chunk-QMNERJL2.js} +1 -1
- package/dist/chunks/{chunk-TNIPRV6K.js → chunk-R6QVLPGC.js} +1 -1
- package/dist/chunks/{chunk-65Y7YCZZ.js → chunk-S44LAUHZ.js} +1 -1
- package/dist/chunks/{chunk-YYZYZWF5.js → chunk-SCJ2QXZF.js} +22 -22
- package/dist/chunks/{chunk-QO4JUY6B.js → chunk-SJIDFYPT.js} +1 -1
- package/dist/chunks/{chunk-PISCJKIG.js → chunk-TQEGSODD.js} +1 -1
- package/dist/chunks/chunk-ULX4ZD2Y.js +3 -0
- package/dist/chunks/{chunk-BWJNZT75.js → chunk-W6QOV4RP.js} +1 -1
- package/dist/chunks/chunk-WWWWXOM4.js +3 -0
- package/dist/chunks/{chunk-2JU3YZQU.js → chunk-XIR3VWQY.js} +1 -1
- package/dist/chunks/chunk-XUJLUOGD.js +6 -0
- package/dist/chunks/chunk-Y3DMALHT.js +66 -0
- package/dist/chunks/chunk-YXV3PYVI.js +3 -0
- package/dist/chunks/{chunk-QPUKPSPZ.js → chunk-Z3PQ5TMU.js} +1 -1
- package/dist/chunks/chunk-ZL7E7PZN.js +4 -0
- package/dist/chunks/clip-command-6Q7BTXR5.js +3 -0
- package/dist/chunks/{clipboard-W67Q22JG.js → clipboard-QWNPA3GM.js} +1 -1
- package/dist/chunks/colour-7HPH6KTY.js +3 -0
- package/dist/chunks/{command-ZX3L5VFO.js → command-JTK4IOS7.js} +1 -1
- package/dist/chunks/{config-command-VEGQPXVB.js → config-command-DIQTU7DM.js} +1 -1
- package/dist/chunks/{continue-editing-LTMIEFRD.js → continue-editing-FTUY6UFG.js} +1 -1
- package/dist/chunks/{decoded-SK6W44WW.js → decoded-IXLPWTGZ.js} +1 -1
- package/dist/chunks/{entry-3R2GK3IW.js → entry-ZF7D32ZI.js} +2 -2
- package/dist/chunks/execute-RP7ZMWLZ.js +3 -0
- package/dist/chunks/extensions-YOZ4IF4E.js +3 -0
- package/dist/chunks/{extensions-command-RNAPQYWV.js → extensions-command-O7UHUJ3Y.js} +1 -1
- package/dist/chunks/{ffmpeg-G4TRWUTV.js → ffmpeg-2ZP3GXJX.js} +1 -1
- package/dist/chunks/{image-67XO45NW.js → image-6A7FXKIR.js} +1 -1
- package/dist/chunks/{install-X7EEH5CQ.js → install-4L7JGP3X.js} +1 -1
- package/dist/chunks/{install-UN3YGSJW.js → install-XJAPLIH2.js} +1 -1
- package/dist/chunks/launch-2KSJ4GGN.js +18 -0
- package/dist/chunks/link-inputs-GTEW6ZH4.js +3 -0
- package/dist/chunks/{lock-5ZO5PCZP.js → lock-KNR7XS7Q.js} +1 -1
- package/dist/chunks/manager-YH5XAMZA.js +4 -0
- package/dist/chunks/{needed-7IUPDEJB.js → needed-TB3OC76N.js} +1 -1
- package/dist/chunks/{own-5BD5BVE7.js → own-KUGTZ3BV.js} +1 -1
- package/dist/chunks/{paths-6OENILJ4.js → paths-BBUKTDDP.js} +1 -1
- package/dist/chunks/pdfium-MJ65YOXW.js +3 -0
- package/dist/chunks/{preferences-E2CH2YSG.js → preferences-7S7YZOFK.js} +1 -1
- package/dist/chunks/preset-command-KMKR6KMG.js +3 -0
- package/dist/chunks/registry-657JRJR5.js +3 -0
- package/dist/chunks/{run-3DX3SROY.js → run-VJDF5WRF.js} +1 -1
- package/dist/chunks/{server-TF32DQEO.js → server-6PH2DSFW.js} +20 -20
- package/dist/chunks/{signals-QSXY3F2A.js → signals-VY2XE3LV.js} +1 -1
- package/dist/chunks/{theme-4Y66DDAO.js → theme-FVQOSLPB.js} +1 -1
- package/dist/chunks/{transcribe-HH5P3PV4.js → transcribe-FUN2SKRN.js} +1 -1
- package/dist/chunks/transcribe-command-KNSUHROE.js +3 -0
- package/dist/chunks/{update-command-6VVDG75Y.js → update-command-X4OSYETA.js} +1 -1
- package/dist/chunks/{update-note-XV2T2NNG.js → update-note-LV7G4CHE.js} +1 -1
- package/dist/chunks/video-link-CF7GUA6V.js +3 -0
- package/dist/chunks/watch-command-3C4AWM7A.js +3 -0
- package/dist/index.js +7 -7
- package/package.json +9 -13
- package/skills/forge/SKILL.md +7 -3
- package/dist/chunks/args-PS5SVBZY.js +0 -3
- package/dist/chunks/chunk-2L66A2X6.js +0 -3
- package/dist/chunks/chunk-3SVHRKQH.js +0 -6
- package/dist/chunks/chunk-4MZV4SRU.js +0 -4
- package/dist/chunks/chunk-4NDZTK22.js +0 -3
- package/dist/chunks/chunk-5XJCMMCM.js +0 -3
- package/dist/chunks/chunk-CCNRNCRU.js +0 -3
- package/dist/chunks/chunk-EEQSUBBL.js +0 -3
- package/dist/chunks/chunk-EJWTYDBJ.js +0 -3
- package/dist/chunks/chunk-JD3RB6IV.js +0 -66
- package/dist/chunks/chunk-NMGQGYVM.js +0 -3
- package/dist/chunks/chunk-SFN3LBB6.js +0 -3
- package/dist/chunks/chunk-UI4EUC3S.js +0 -3
- package/dist/chunks/chunk-X2YUHPOU.js +0 -4
- package/dist/chunks/clip-command-4ON3Q57W.js +0 -3
- package/dist/chunks/colour-2BGK2BFR.js +0 -3
- package/dist/chunks/execute-TC3QZ6GL.js +0 -3
- package/dist/chunks/extensions-3SG2LW7R.js +0 -3
- package/dist/chunks/launch-EGFNGHLN.js +0 -18
- package/dist/chunks/manager-272REVNF.js +0 -4
- package/dist/chunks/pdfium-MHPBLZY5.js +0 -3
- package/dist/chunks/preset-command-5I3NZ2OP.js +0 -3
- package/dist/chunks/registry-DWFV4GBG.js +0 -3
- package/dist/chunks/transcribe-command-VY5HYNXV.js +0 -3
- package/dist/chunks/watch-command-BMSMGIHK.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as x,b as v}from"./chunk-42IEPG2K.js";import{B as O,C as P,D as k,b as A,c as y,h as o}from"./chunk-YXV3PYVI.js";import{h as S,i as m,k as I}from"./chunk-ULX4ZD2Y.js";import{g as c,h as g,j as b,k as h,l,m as a}from"./chunk-JZM37DG2.js";import{S as d}from"./chunk-PNPAHKJR.js";var f=e=>e.filter(t=>t.kind==="document"&&t.format==="pdf"),D={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:e=>f(e).length>=2&&f(e).length===e.length,unavailable:e=>f(e).length!==e.length?"PDFs only":"needs 2+ files",options:()=>[],plan(e,t){let n=a(h(e.map(r=>r.path)),o(t.destination),o(t.name));return[{op:"merge",sources:e,outputs:[n]}]}},z=e=>e.length>=2&&e.every(t=>t.kind==="image"||t.kind==="document"&&t.format==="pdf");function i(e){return e.filter(n=>n.kind==="document"&&n.format==="pdf").length===0?"PDFs only":"one PDF at a time"}var u=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,T={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:e=>(u(e)?.pages??0)>1,unavailable:e=>u(e)===void 0?i(e):"only one page",options(e){let t=u(e);return t?[{kind:"select",id:"mode",label:"How",default:"every-page",choices:[{value:"every-page",label:"Every page",hint:`${t.pages} files`},{value:"every-n",label:"Every N pages",hint:"ask how many"},{value:"points",label:"At points I choose",hint:"grid"}]}]:[]},plan(e,t){let n=u(e);if(!n)return[];let r=Array.isArray(t.cuts)?t.cuts:[],p=I(r,n.pages).length,q=l(g(n.path,p),o(t.destination),o(t.name));return[{op:"split",sources:[n],outputs:q,cuts:r}]}};function Q(e){return Array.from({length:Math.max(0,e-1)},(t,n)=>n)}function U(e,t){if(!Number.isInteger(t)||t<1)throw d("Splitting every N pages needs N to be a whole number, at least 1.");let n=[];for(let r=t;r<e;r+=t)n.push(r-1);return n}var s=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0;function w(e,t){return Array.isArray(t.pages)?m(t.pages):typeof t.pages=="string"?m(S(t.pages,e.pages)):[]}var R=e=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${e.pages}`}),j={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:e=>s(e)!==void 0,unavailable:i,options:e=>{let t=s(e);return t?[R(t),{kind:"select",id:"separate",label:"Output",default:"one",choices:[{value:"one",label:"One file",hint:"all selected pages together"},{value:"many",label:"Separate files",hint:"one per page"}]}]:[]},plan(e,t){let n=s(e);if(!n)return[];let r=w(n,t),p=t.separate==="many";return[{op:"extract",sources:[n],outputs:l(b(n.path,r,p),o(t.destination),o(t.name)),pages:r,separate:p}]}},J={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:e=>s(e)!==void 0,unavailable:i,options:e=>{let t=s(e);return t?[R(t)]:[]},plan(e,t){let n=s(e);return n?[{op:"delete",sources:[n],outputs:[a(c(n.path,"trimmed"),o(t.destination),o(t.name))],pages:w(n,t)}]:[]}};var N=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,E={id:"rotate",label:"Rotate",verb:"Rotating",hint:"turn pages",appliesTo:e=>N(e)!==void 0,unavailable:i,options:()=>[{kind:"select",id:"degrees",label:"Turn",default:"90",choices:[{value:"90",label:"90\xB0 right",hint:"a quarter turn"},{value:"180",label:"180\xB0",hint:"upside down"},{value:"270",label:"90\xB0 left",hint:"a quarter turn back"}]}],plan(e,t){let n=N(e);if(!n)return[];let p=Number(t.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[a(c(n.path,"rotated"),o(t.destination),o(t.name))],turns:p}]}};var C=[v,x,D,T,j,J,E,O,P,k],de=C.filter(e=>!["convert","compress","trim","resize","crop"].includes(e.id)),F=[A,y];function ge(e,t=new Set){return[...C,...F.filter(n=>n.requires&&t.has(n.requires))].filter(n=>n.appliesTo(e))}function be(e,t){return e.appliesTo(t)?void 0:e.unavailable?.(t)}export{D as a,z as b,E as c,T as d,Q as e,U as f,C as g,de as h,ge as i,be as j};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{G as r,Ga as a}from"./chunk-PNPAHKJR.js";var s=["en"];function d(e){let t=e?.split(/[-_]/)[0]?.toLowerCase();return t!==void 0&&s.includes(t)}function g(e){if(e.kind!=="media"){if(e.kind==="image"){let{path:t,format:n,bytes:p,width:o,height:u}=e;return{what:"image",path:t,format:n,bytes:p,width:o,height:u}}if(e.format!=="pdf")throw a(e.path);if(e.encrypted)throw r(e.path);return{what:"pdf",path:e.path,bytes:e.bytes,pages:e.pages}}}export{d as a,g as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{e as c}from"./chunk-
|
|
3
|
+
import{e as c}from"./chunk-OLKPV4WO.js";import{a}from"./chunk-HON4OV7M.js";import{access as x,readFile as p}from"node:fs/promises";import{join as n,sep as y}from"node:path";function g(){return n(a(),"forge","extensions")}var E=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function v(e){if(c(e)!==void 0)try{let u=n(g(),e),t=(await p(n(u,"current"),"utf8")).trim();if(!E.test(t))return;let r=n(u,t),i=JSON.parse(await p(n(r,"manifest.json"),"utf8"));if(typeof i!="object"||i===null)return;let{id:m,version:l,entry:o,kind:s,files:d}=i;if(m!==e||l!==t||s!=="node"&&s!=="exec"||typeof o!="string"||typeof d!="object"||d===null||!(o in d))return;let f=n(r,o);return f.startsWith(`${r}${y}`)?(await x(f),{id:e,version:t,dir:r,entry:f,kind:s}):void 0}catch{return}}export{g as a,E as b,v as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{f as p,u as g,w as f}from"./chunk-
|
|
3
|
+
import{f as p,u as g,w as f}from"./chunk-JZM37DG2.js";import{randomBytes as l}from"node:crypto";import{copyFile as P,mkdir as w,readdir as h,readFile as y,rename as C,rm as u,stat as k}from"node:fs/promises";import{tmpdir as x}from"node:os";import{extname as c,join as o}from"node:path";function m(){return o(x(),"forge-clip")}var v=5,d={".png":"png",".jpg":"jpeg",".jpeg":"jpeg",".webp":"webp",".heic":"heic",".avif":"avif",".gif":"gif",".tiff":"tiff"};async function O(e,a=m()){let t=`${Date.now().toString(36)}-${l(3).toString("hex")}`,i=o(a,t),r=await e.read(o(i,"in"));if(!r)return await u(i,{recursive:!0,force:!0}),null;let n=o(i,"out");await w(n,{recursive:!0}),await F(a,r.path);let s=o(i,"in","Copied image");return await C(r.path,s),await T(a,t),{source:s,outDir:n,changeCount:r.changeCount}}async function F(e,a){let t=o(e,"last"),i=`Copied image${c(a)}`,r=o(e,`.last-${l(4).toString("hex")}`);await w(r,{recursive:!0}),await P(a,o(r,i)),await u(t,{recursive:!0,force:!0}),await g(r,t)}async function T(e,a){let t=await h(e,{withFileTypes:!0}).catch(()=>[]),r=(await Promise.all(t.filter(n=>n.isDirectory()&&n.name!=="last"&&!n.name.startsWith(".")).map(async n=>({name:n.name,at:(await k(o(e,n.name)).catch(()=>null))?.mtimeMs??0})))).filter(n=>n.name!==a).sort((n,s)=>s.at-n.at).slice(v-1);await Promise.all(r.map(n=>u(o(e,n.name),{recursive:!0,force:!0})))}async function b(e=m()){let a=o(e,"last"),t=(await h(a).catch(()=>[])).find(i=>d[c(i).toLowerCase()]!==void 0);return t===void 0?null:{path:o(a,t),format:d[c(t).toLowerCase()]}}async function S(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.write(t,i),"placed")}async function A(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.writeText(t,i),"placed")}async function E(e,a=m()){let t=await b(a);return t?(await e.write(t.path,t.format),!0):!1}async function _(e,a){let t=p(o(a,`Copied image${c(e)}`));return await f(t,await y(e)),t}export{O as a,S as b,A as c,E as d,_ as e};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{e as a}from"./chunk-
|
|
3
|
+
import{e as a}from"./chunk-SJIDFYPT.js";import{d as t}from"./chunk-PNPAHKJR.js";var p=[{op:"compress",label:"Compress"},{op:"resize",label:"Resize"},{op:"crop",label:"Crop to shape"},{op:"trim",label:"Trim edges"},{op:"format",label:"Convert to another format"},{op:"sharpen",label:"Sharpen"},{op:"boost",label:"Boost resolution"},{op:"cutout",label:"Remove background"}],n=r=>t[r]?.label??r.toUpperCase(),i=r=>`under ${Math.round(r/1e3)} KB`,u=r=>"width"in r?`${r.width} wide`:"height"in r?`${r.height} high`:`${r.percent}%`;function l(r,e){let o={...r};switch(e.op){case"compress":return"quality"in e?(delete o.maxBytes,o.quality=e.quality,o.compress=r.compress??{dither:!1}):o.maxBytes=e.bytes,o;case"resize":return o.resize=e.spec,o;case"crop":return o.crop=e.aspect,o;case"trim":return o.trim=!0,o;case"format":return o.to=e.to,e.quality===void 0?delete o.quality:o.quality=e.quality,o;case"sharpen":return o.sharpen=!0,o;case"boost":return o.boost=e.scale,o;case"cutout":return o.removeBackground=!0,o}}function d(r){switch(r.op){case"compress":return"quality"in r?`quality ${r.quality}`:i(r.bytes);case"resize":return u(r.spec);case"crop":return`${r.aspect.w}:${r.aspect.h}`;case"trim":return"Trim";case"format":return`${n(r.to)}${r.quality===void 0?"":` ${r.quality}`}`;case"sharpen":return"Sharpen";case"boost":return`Boost ${r.scale}\xD7`;case"cutout":return"Remove background"}}function b(r,e){return[...!(e.to===void 0||e.to===r)&&e.to?[`${n(e.to)}${e.quality===void 0?"":` ${e.quality}`}`]:e.quality!==void 0?[`quality ${e.quality}`]:[],...e.resize?[u(e.resize)]:[],...e.trim?["Trim"]:[],...e.crop?[`${e.crop.w}:${e.crop.h}`]:[],...e.sharpen&&!e.boost?["Sharpen"]:[],...e.boost?[`Boost ${e.boost}\xD7`]:[],...e.removeBackground?["Remove background"]:[],...e.maxBytes?[i(e.maxBytes)]:[]]}function h(r,e){if(r.frames>1)return{trim:"animated",crop:"animated"};let o={};return e?.trimmed==="nothing"&&(o.trim="no empty edges"),a(r).length===0&&(o.crop="no shape to cut"),o}export{p as a,l as b,d as c,b as d,h as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
var v="0.
|
|
3
|
+
var v="0.7.0",k={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
|
|
4
4
|
\u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},o={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"},i={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"},a={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:""},x={...a,keycapBg:"white",keycapFg:"black"},d=["convert","compress","pdf","edit","transcribe","colour"],y=`1\u2013${d.length}`;function P(e,t){let r=d,n=e==="menu"?r.length:r.indexOf(e),f=Math.max(0,Math.min(r.length-1,n+t));return r[f]}function S(e){return/^[1-9]$/.test(e)?d[Number(e)-1]:void 0}var E={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",edit:"\u2726",transcribe:"\xB6"},c="#7d6ad0",l="#cc8ae2";function g(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 s=["#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"?s:[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 w(e,t){if(e.name==="light")return t==="menu"?p:B[t]}function M(e,t){return e.name==="light"?T[t]:C(e,t)}function R(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function H(e,t){let{fg:r,bg:n}=g(e,t);return{...e,accent:r,tag:r,label:r,band:n===""?e.band:n}}function O(e){return e.canvas!==""}function _(e){return e==="dark"?o:e==="light"?i:a}function D(e){return e===""?void 0:e}var F={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 N(){h()||(process.env.FORCE_COLOR="0")}export{v as a,k as b,o as c,i as d,a as e,x as f,d as g,y as h,P as i,S as j,E as k,g as l,C as m,w as n,M as o,R as p,H as q,O as r,_ as s,D as t,F as u,h as v,N as w};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{b as le,e as ge,f as he,g as ye,i as be,j as we}from"./chunk-E5VPEBUQ.js";import{a as z,b as T}from"./chunk-42IEPG2K.js";import{A as me,a as ue,b as de,c as pe,o as ce,t as fe}from"./chunk-YXV3PYVI.js";import{a as k}from"./chunk-ID75X37Z.js";import{b as $}from"./chunk-56QHX7QR.js";import{b as se,c as W}from"./chunk-6RMRWBMB.js";import{d as Ee,e as q}from"./chunk-Z3PQ5TMU.js";import{f as ke,g as ve,h as xe,i as Ie,j as Pe,k as $e}from"./chunk-YJ6XLDRA.js";import{a as S,c as ae,d as ie,e as j,f as J}from"./chunk-TQEGSODD.js";import{d as F}from"./chunk-ULX4ZD2Y.js";import{a as b}from"./chunk-H332YFSO.js";import{b as ne}from"./chunk-7NP76V4U.js";import{b as Re}from"./chunk-OQ6DTE56.js";import{a as _,d as ee}from"./chunk-JPASVE56.js";import{a as P,c as re,d as B,e as oe,i as te}from"./chunk-JZM37DG2.js";import{B as E,D as Y,G as A,Oa as Z,S as C,V as K,Y as Q,_ as X,d as R,f as D,g as G,i as I,z as U}from"./chunk-PNPAHKJR.js";import{a as w,b as H}from"./chunk-FGR6QCG5.js";import{b as x,c as v}from"./chunk-VLVNA4T3.js";import{basename as Ae,dirname as We,extname as ze,resolve as L}from"node:path";async function Fe(e){let o=[],r=[...e.resolved.failures];for(let t of e.resolved.sources){let s=S(t);if(!s.includes(e.target)){r.push({path:t.path,error:Y(t,e.target,s)});continue}let a={sourcePath:t.path,target:e.target,output:e.output,sourceRoot:e.resolved.roots.get(t.path)},n=B(a);re(n,t.path)&&e.target!==t.format&&(n=oe({...a,suffix:e.target})),o.push({op:"convert",sources:[t],outputs:[n],target:e.target,options:e.options})}return{jobs:o,failures:r}}import{resolve as Ve}from"node:path";function Ge(e,o=new Set){let r={path:Ve(e.path),kind:e.kind,format:e.format,bytes:e.bytes},t=e.kind==="document"&&e.encrypted===!0,s={targets:S(e).filter(a=>!t||j(a)),actions:be([e],o).filter(a=>!t||a.id===T.id).map(a=>a.id)};if(e.kind==="image")return{...r,width:e.width,height:e.height,...s};if(e.kind==="media"){let a=e.facts;return{...r,...a?{duration:a.duration}:{},...a?.video?{width:a.video.width,height:a.video.height,fps:a.video.fps}:{},...s}}return{...r,...e.pages>0?{pages:e.pages}:{},encrypted:e.encrypted,...s}}async function Oe(e){let o=await k(e,{recursive:!1}),{installedExtensionIds:r}=await import("./available-FPBRQ3LS.js"),t=await r();return{probes:o.sources.map(s=>Ge(s,t)),failures:o.failures}}import{dirname as He}from"node:path";var O=e=>({cwd:e.cwd??process.cwd(),...e.home===void 0?{}:{home:e.home}});function Ce(e,o){let r=x(He(e),O(o));return r==="."?"":` in ${r.endsWith("/")?r:`${r}/`}`}function Be(e,o){let{pct:r,direction:t}=H(e,o);return t==="same"?"same size":`${r}% ${t}`}function Se(e,o={}){let r=e.results[0];if(!r)return[];let t=r.job.sources[0],s=r.job.outputs;if(s.length>1){let n=[`\u2713 ${v(t.path)} \u2192 ${s.length} files${Ce(s[0],o)}`,` ${s.map(i=>v(i)).join(", ")}`,` ${w(t.bytes)} \u2192 ${w(r.outputBytes)} total`];for(let i of r.warnings)n.push("",`\u26A0 ${i.message}`);return n}if(ce(r.job)){let n=[`\u2713 ${x(s[0],O(o))}`,` ${w(r.outputBytes)}`];for(let i of r.warnings)n.push("",`\u26A0 ${i.message}`);return n}let a=[`\u2713 ${v(t.path)} \u2192 ${x(s[0],O(o))}`,` ${w(t.bytes)} \u2192 ${w(r.outputBytes)} \xB7 ${Be(t.bytes,r.outputBytes)}`];for(let n of r.warnings)a.push("",`\u26A0 ${n.message}`);return a}function je(e,o={}){let r=[`\u2713 ${e.results.length} converted`,` ${w(e.inputBytes)} \u2192 ${w(e.outputBytes)} \xB7 ${Be(e.inputBytes,e.outputBytes)}`];for(let s of e.results)for(let a of s.job.outputs)r.push(` ${x(a,O(o))}`);let t=e.results.flatMap(s=>s.warnings);if(t.length>0){r.push("");for(let s of t)r.push(`\u26A0 ${s.message}`)}return r}function Je(e,o={}){let r=e.results.flatMap(u=>u.job.outputs),t=r.map(u=>v(u)).join(", "),s=r.length===1?"file":"files",a=r[0]===void 0?"":Ce(r[0],o),n=[`\u2713 ${r.length} ${s} \xB7 ${t}${a}`],i=e.results.flatMap(u=>u.warnings);for(let u of i)n.push("",`\u26A0 ${u.message}`);return n}function M(e,o){if(e.length===0)return[];let r=[];for(let t of e)r.push(...Z(t.error,{debug:o.debug}),"");return r}function Te(){let e=new Set(ae()),o=new Set(ie()),r=["Formats",""],t=J(),s=Math.max(...t.map(n=>n.label.length));for(let n of t){let i=n.read&&n.write?"read and write":n.read?"read only":"write only";r.push(` ${n.label.padEnd(s)} ${i.padEnd(14)} ${n.extensions.join(" ")}`)}let a=[...e].filter(n=>!o.has(n)).map(n=>R[n].label);if(a.length>0){let n=a.join(", "),[i,u]=a.length===1?["is","it"]:["are","them"];r.push("",`${n} ${i} read only because Forge cannot yet write ${u}.`)}return r}function Me(e,o={}){let r=[R[e.format].label,w(e.bytes)];return e.duration!==void 0&&r.push(F(e.duration)),e.width!==void 0&&e.height!==void 0&&r.push(`${e.width}\xD7${e.height}`),e.fps!==void 0&&r.push(`${e.fps} fps`),e.pages!==void 0&&r.push(`${e.pages} ${e.pages===1?"page":"pages"}`),e.encrypted&&r.push("password-protected"),[`${x(e.path,O(o))} \xB7 ${r.join(" \xB7 ")}`,` converts to ${e.targets.join(", ")}`,` actions ${e.actions.join(", ")}`]}import{createInterface as Ne}from"node:readline";import{PassThrough as Ue}from"node:stream";function Ye(e){return new Promise(o=>{let r=Ne({input:e,terminal:!1}),t=!1,s=a=>{if(t)return;t=!0,r.close(),e.pause(),e.unref?.(),o(a.replace(/\r$/,""))};r.once("line",s),r.once("close",()=>s(""))})}async function De(e){if(e.stdin)return Ye(process.stdin);if(!process.stdin.isTTY)return;let o=new Ue,r=Ne({input:process.stdin,output:o,terminal:!0});try{return process.stderr.write("Password: "),await new Promise(t=>r.question("",t))}finally{process.stderr.write(`
|
|
4
|
+
`),r.close()}}function Ke(e){return e.kind==="preset"?e.name:e.kind==="pageop"?"PDF":e.kind==="compress"?"Compress":e.kind==="convert"?"Convert":"Edit"}function V(e){return e.length===0?0:e.some(o=>o.error.code==="invalid-arguments")?2:1}function Qe(e,o){if(e.action==="merge")return{};if(e.action==="rotate")return{degrees:e.rotate};if(e.action==="extract")return{pages:e.pages,separate:e.separate?"many":"one"};if(e.action==="delete")return{pages:e.pages};let r=o.find(n=>n.kind==="document"),t=r?.pages??0,s=e.split;if(!s)throw C("--split needs a mode: every-page, every=N or at=N,N.");if(s.mode==="every-page")return{cuts:ge(t)};if(s.mode==="every-n"){let n=he(t,s.n);if(n.length===0&&r)throw Q(r.path,t,s.n);return{cuts:n}}let a=Math.max(t-1,0);for(let n of s.after)if(!Number.isInteger(n)||n<1||n>a)throw K(n,r?v(r.path):"The document",t);return{cuts:s.after.map(n=>n-1)}}function Xe(e,o){let r;return()=>o?(r??=De({stdin:e}).then(t=>e&&t===""?void 0:t),r):Promise.resolve(void 0)}async function Ze(e,o,r,t){let s;if(e.encrypted){if(s=o.password??await r(),s===void 0)return{failure:{path:e.path,error:A(e.path)}};if(!await ne(e.path,s))return{failure:{path:e.path,error:A(e.path,{attempted:!0})}}}let a;try{a=T.plan([e],{target:o.target,background:o.options.background,keepMetadata:o.options.keepMetadata,dpi:String(o.dpi??150),...o.options.quality===void 0?{}:{quality:o.options.quality},...o.pages===void 0?{}:{pages:o.pages},...o.output===void 0||!P(o.output)?{}:{destination:o.output},...t===void 0?{}:{sourceRoot:t}})}catch(i){if(!I(i))throw i;return{failure:{path:e.path,error:i}}}let n=a[0];if(n?.op!=="convert")throw new Error(`convertAction.plan() did not return a convert job for ${e.path}`);return s!==void 0&&(n.options.password=s),o.output!==void 0&&!P(o.output)&&(n.outputs=n.outputs.length===1?[L(o.output)]:te(L(o.output),n.options.pages??[],o.target)),{job:n}}function N(e,o){return r=>{if(r.type==="search:attempt"){o||e.onSearch?.(r.rung.dpi===void 0?`attempt ${r.attempt} of ${r.of}`:`${r.rung.dpi} dpi \xB7 attempt ${r.attempt} of ${r.of}`);return}if(r.type==="search:settled"){o&&e.onSearch?.(`${r.completed} of ${r.total} searched`);return}if(!o&&r.type==="job:phase"&&r.progress.phase==="time"){let t=r.progress,s=`${F(t.done)} of ${F(t.total)}`;e.onEncode?.(t.pass?`pass ${t.pass.at} of ${t.pass.of} \xB7 ${s}`:s);return}o&&(r.type==="job:done"||r.type==="job:error")&&e.onProgress?.({completed:r.completed,total:r.total})}}var h=(e,o)=>({kind:e,results:[],failures:o,inputBytes:0,outputBytes:0});async function _e(e,o){let r=await k(e.inputs,{recursive:!1});if(r.sources.length===0)return h("pageop",r.failures);let t=ye.find(u=>u.id===e.action);if(!t)throw new Error(`no action registered for "${e.action}"`);let s=r.sources[0]?.path??"",a=e.action==="merge";if(a?!le(r.sources):!t.appliesTo(r.sources)){let u=a?r.sources.length<2?"needs 2+ files":"PDFs and images only":we(t,r.sources)??"not available for these files";return h("pageop",[...r.failures,{path:s,error:E(e.action,u)}])}let n;try{n=t.plan(r.sources,Qe(e,r.sources))}catch(u){if(!I(u))throw u;return h("pageop",[...r.failures,{path:s,error:u}])}let i=await $(n,{force:e.force,...o.signal===void 0?{}:{signal:o.signal}});return{kind:"pageop",results:i.results,failures:[...r.failures,...i.refusals,...i.failures],inputBytes:i.inputBytes,outputBytes:i.outputBytes}}async function er(e,o){let r=await k(e.inputs,{recursive:e.recursive}),t=e.output===void 0||P(e.output)?[]:D(ze(e.output)),s=t[0];if(s!==void 0&&r.sources.some(d=>!t.some(c=>c.id===d.format)))return qe({kind:"convert",inputs:e.inputs,target:s.id,options:{...e.options,...e.quality===void 0?{}:{quality:e.quality}},force:e.force,recursive:e.recursive,debug:e.debug,dpi:e.dpi??150,...e.output===void 0?{}:{output:e.output},...e.maxBytes===void 0?{}:{maxBytes:e.maxBytes},...e.concurrency===void 0?{}:{concurrency:e.concurrency}},o);let a=[],n=[];for(let d of r.sources){if(!z.appliesTo([d])){n.push({path:d.path,error:U(d)});continue}let c=e.output!==void 0&&!P(e.output)?L(e.output):void 0,l=e.output===void 0||c!==void 0?We(d.path):We(B({sourcePath:d.path,target:d.format,output:e.output,sourceRoot:r.roots.get(d.path)})),[f]=z.plan([d],{mode:e.maxBytes===void 0?"quality":"size",...e.quality===void 0?{}:{quality:e.quality},...e.options.media??{},destination:l});f?.op==="convert"&&(c!==void 0&&(f.outputs=[c]),e.dpi!==void 0&&(f.options.dpi=e.dpi),a.push(f))}let i=a.length>1;i&&o.onProgress?.({completed:0,total:a.length});let u=await $(a,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},...o.signal===void 0?{}:{signal:o.signal},onEvent:N(o,i)});return{kind:"compress",results:u.results,failures:[...r.failures,...n,...u.refusals,...u.unreachable.map(d=>({path:d.job.sources[0].path,error:d.error})),...u.failures],inputBytes:u.inputBytes,outputBytes:u.outputBytes}}async function rr(e,o){let r=e.kind,t=e.op==="remove-background"&&e.target!==void 0?_(e.target):void 0;if(t)return h(r,[{path:"",error:t}]);let{installed:s}=await import("./paths-BBUKTDDP.js"),a=await s(e.op);if(!a)return h(r,[{path:"",error:X(e.op)}]);if(e.op==="boost"&&e.scale!==void 0){let{assetFor:f,catalogEntry:m}=await import("./catalog-G44MXIAF.js"),p=m("boost"),g=p&&f(p)?.version,y=ee(e.scale,a.version,g);if(y)return h(r,[{path:"",error:y}])}let n=await k(e.inputs,{recursive:e.recursive}),i=e.op==="boost"?de:pe,u=[],d=[];for(let f of n.sources){if(!i.appliesTo([f])){d.push({path:f.path,error:E(e.op==="remove-background"?"remove the background of":e.scale===1?"sharpen":"boost","it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});continue}let m=e.target??(e.op==="boost"&&f.kind==="image"?Ee(f):"png"),p=ue(f,m);if(p){d.push({path:f.path,error:p});continue}u.push(...i.plan([f],{target:m,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.scale===void 0?{}:{scale:e.scale},...e.options.quality===void 0?{}:{quality:e.options.quality},...e.output===void 0?{}:{output:e.output},roots:n.roots}))}let c=u.length>1;c&&o.onProgress?.({completed:0,total:u.length});let l=await $(u,{force:e.force,concurrency:1,...o.signal===void 0?{}:{signal:o.signal},onEvent:N(o,c)});return{kind:r,results:l.results,failures:[...n.failures,...d,...l.refusals,...l.failures],inputBytes:l.inputBytes,outputBytes:l.outputBytes}}function or(e){let o=Object.keys(e??{});return o.length===1&&(o[0]==="cut"||o[0]==="mute")?o[0]:"edit"}async function tr(e,o){let r=e.crop!==void 0?"crop":e.resize!==void 0?"resize":"trim",t=e.target===void 0?void 0:q(e.target,r);if(t)return h(e.kind,[{path:"",error:t}]);let s=await k(e.inputs,{recursive:e.recursive}),a=[],n=[],i=[];for(let y of s.sources)y.kind==="image"&&e.media===void 0?a.push(y):y.kind==="media"&&!e.trim?n.push(y):y.kind==="image"?i.push({path:y.path,error:E(or(e.media),"it works on video and sound, not images","Try a video or sound file, such as a MOV, MP4 or WAV.")}):i.push({path:y.path,error:E(r,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});let u=e.target===void 0?e.named:void 0,d=u===void 0||a.length===0?void 0:q(u,r);if(d)return h(e.kind,[{path:"",error:d}]);let c=e.target??u,l=fe(n,{...e.download?{download:!0}:{},...e.media===void 0?{}:{media:e.media},...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...c===void 0?{}:{target:c},...e.output===void 0?{}:{output:e.output},roots:s.roots}),m=[...me(a,{trim:e.trim,...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...c===void 0?{}:{target:c},...e.output===void 0?{}:{output:e.output},roots:s.roots,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.options.quality===void 0?{}:{quality:e.options.quality}}),...l],p=m.length>1;p&&o.onProgress?.({completed:0,total:m.length});let g=await $(m,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...o.signal===void 0?{}:{signal:o.signal},onEvent:N(o,p)});return{kind:e.kind,results:g.results,failures:[...s.failures,...i,...g.refusals,...g.failures],inputBytes:g.inputBytes,outputBytes:g.outputBytes}}async function qe(e,o){let r=await k(e.inputs,{recursive:e.recursive}),t=p=>p.kind==="document"&&p.format==="pdf",s=j(e.target),a=s?r.sources.filter(t):[],n=s?r.sources.filter(p=>!t(p)):r.sources,i=[],u=[],d=Xe(e.passwordStdin??!1,o.interactive??!0);for(let p of a){let g=await Ze(p,e,d,r.roots.get(p.path));"failure"in g?u.push(g.failure):i.push(g.job)}let c=await Fe({resolved:{sources:n,failures:[],roots:r.roots},target:e.target,options:e.options,force:e.force,...e.output===void 0?{}:{output:e.output}}),l=[...c.jobs,...i],f=l.length>1;f&&o.onProgress?.({completed:0,total:l.length});let m=await $(l,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},...o.signal===void 0?{}:{signal:o.signal},onEvent:N(o,f)});return{kind:"convert",results:m.results,failures:[...r.failures,...u,...c.failures,...m.refusals,...m.unreachable.map(p=>({path:p.job.sources[0].path,error:p.error})),...m.failures],inputBytes:m.inputBytes,outputBytes:m.outputBytes}}function sr(e){if(e.kind!=="convert"&&e.kind!=="edit"&&e.kind!=="extension-op"||e.output===void 0||P(e.output))return e;let o=ze(e.output),t=D(o)[0];if(t===void 0)return e;if(e.target===void 0)return e.kind==="edit"?{...e,named:t.id}:{...e,target:t.id};if(R[e.target].extensions.includes(o.toLowerCase()))return e;let s=Ae(e.output);throw C(`-o ${s} conflicts with --to ${e.target}.`,`Name it ${Ae(s,o)}${G(e.target)}, or use --to ${t.id}.`)}async function Le(e,o={}){if((e.kind==="convert"||e.kind==="compress"||e.kind==="edit")&&Re(e.inputs)){let{fetchLinkInputs:r}=await import("./link-inputs-GTEW6ZH4.js"),t;try{t=await r(e.inputs,{...o.signal?{signal:o.signal}:{},...e.signIn?{signIn:e.signIn}:{},...o.onLinkDownload?{onStatus:o.onLinkDownload}:{}})}catch(s){if(!I(s))throw s;return h(e.kind,[{path:"",error:s}])}try{if(t.inputs.length===0)return h(e.kind,t.failures);let s=await Le({...e,inputs:t.inputs,output:e.output??o.linkOutput??t.output},o);return{...s,failures:[...t.failures,...s.failures]}}finally{await t.dispose()}}try{if(e.kind==="pageop")return await _e(e,o);if(e.kind==="extension-op")return await rr(e,o);if(e.kind==="edit")return await tr(e,o);if(e.kind==="preset"){let{runPresetCommand:r}=await import("./preset-command-KMKR6KMG.js");return await r(e,o.signal)}return e.kind==="compress"?await er(e,o):await qe(e,o)}catch(r){if(!I(r))throw r;return h(e.kind,[{path:"",error:r}])}}function nr(e,o){let r=V(e.failures);if(o.json)return{exitCode:r,stdout:[JSON.stringify(ke(b,e))],stderr:[]};let t=e.results.length===0?[]:e.kind==="pageop"?Je(e):e.results.length===1?Se(e):je(e);return{exitCode:r,stdout:t,stderr:M(e.failures,{debug:o.debug})}}function ar(e,o){let r=[{path:"",error:e}],t=V(r);return o.json?{exitCode:t,stdout:[JSON.stringify(ve(b,e))],stderr:[]}:{exitCode:t,stdout:[],stderr:M(r,{debug:o.debug})}}async function ir(e,o){let{runConfig:r}=await import("./config-command-DIQTU7DM.js"),t=await r(e);return o?{exitCode:0,stdout:[JSON.stringify(Pe(b,t.config,t.warnings))],stderr:[]}:{exitCode:0,stdout:t.stdout,stderr:[]}}async function ro(e,o={}){let r=o.json??!1,t="debug"in e?e.debug:!1;try{if(e.kind==="config")return await ir(e,r);if(e.kind==="clip"){let{runClipCommand:n}=await import("./clip-command-6Q7BTXR5.js");return await n(e,{...o,json:r,debug:t})}if(e.kind==="update"){let{runUpdate:n}=await import("./update-command-X4OSYETA.js"),i=await n(b,{...o.onInstalling?{onInstalling:o.onInstalling}:{}});return{exitCode:0,stdout:r?[JSON.stringify({forge:b,ok:!0,...i.data})]:i.stdout,stderr:[]}}if(e.kind==="uninstall"){let{runUninstall:n}=await import("./entry-ZF7D32ZI.js"),i=[];return{exitCode:await n(b,d=>i.push(d)),stdout:i,stderr:[]}}if(e.kind==="extensions"){let{runExtensions:n}=await import("./extensions-command-O7UHUJ3Y.js"),i=await n(e,{onDownload:o.onDownload});return{exitCode:0,stdout:r?[JSON.stringify($e(b,i.data))]:i.stdout,stderr:[]}}if(e.kind==="formats")return r?{exitCode:0,stdout:[JSON.stringify(xe(b,J()))],stderr:[]}:{exitCode:0,stdout:Te(),stderr:[]};if(e.kind==="probe"){let{probes:n,failures:i}=await Oe(e.inputs),u=V(i);return r?{exitCode:u,stdout:[JSON.stringify(Ie(b,{probes:n,failures:i}))],stderr:[]}:{exitCode:u,stdout:n.flatMap((d,c)=>[...c>0?[""]:[],...Me(d)]),stderr:M(i,{debug:t})}}if(e.kind==="palette"||e.kind==="scale"||e.kind==="card"){let{runCard:n,runPalette:i,runScale:u}=await import("./colour-7HPH6KTY.js"),d={json:r,colour:o.colour??!1};return e.kind==="card"?await n(e,d):e.kind==="palette"?await i(e,d):await u(e,d)}if(e.kind==="transcribe"){let{runTranscribeCommand:n,transcribeFact:i}=await import("./transcribe-command-KNSUHROE.js"),u=[],d=[],c,{onTranscribe:l}=o,f="";return{exitCode:await n(e,{out:p=>u.push(p),err:p=>d.push(p),...l?{onStart:p=>{f=p==="read"?"reading text":"transcribing",l(f,"")},onProgress:p=>l(f,i(p))}:{},finished:p=>{c=W("Transcribe",p)}}),stdout:u,stderr:d,...c?{notice:c}:{}}}if(e.kind==="shell")return{exitCode:0,stdout:[],stderr:[]};if(e.kind==="watch")throw C("forge watch runs in a terminal until ctrl-c.","Try: forge watch ./images --to webp");let s=await Le(sr(e),o),a=W(Ke(e),se(s.results,s.failures));return{...nr(s,{json:r,debug:t}),...a?{notice:a}:{}}}catch(s){if(!I(s))throw s;return ar(s,{json:r,debug:t})}}export{Oe as a,Be as b,V as c,Le as d,nr as e,ro as f};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as P}from"./chunk-
|
|
3
|
+
import{b as P}from"./chunk-56QHX7QR.js";import{q as v}from"./chunk-ULX4ZD2Y.js";import{Ca as s,i as y}from"./chunk-PNPAHKJR.js";import{mkdtemp as x,rm as F}from"node:fs/promises";import{tmpdir as z}from"node:os";import{join as h}from"node:path";var f={background:"#ffffff",keepMetadata:!1};function q(e,r,n){switch(e.kind){case"cut":return{op:"convert",sources:[r],outputs:[n],target:"png",options:{...f,...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}};case"cutout":return{op:"remove-background",sources:[r],outputs:[n],target:"png",options:f};case"boost":return{op:"boost",sources:[r],outputs:[n],scale:e.scale,target:"png",options:f};case"encode":return{op:"convert",sources:[r],outputs:[n],target:e.target,options:{...f,...e.background?{background:e.background}:{},...e.quality!==void 0?{quality:e.quality}:{},...e.compress?{compress:e.compress}:{},...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}}}}async function C(e,r,n,o){let E=o.probe??v,d=await x(h(z(),"forge-preset-")),I={force:o.force,...o.signal?{signal:o.signal}:{},...o.onEvent?{onEvent:o.onEvent}:{}};try{let i=e;for(let[l,t]of r.entries()){o.onPass?.(l);let u=l===r.length-1,m=u?n:h(d,`${l}.png`),a=await P([q(t,i,m)],{...I,...u?{}:{force:!0},...u&&t.kind==="encode"&&t.maxBytes?{targetBytes:t.maxBytes,...t.quality===void 0?{}:{maxQuality:t.quality}}:{}});if(a.cancelled)return{kind:"cancelled"};let g=a.refusals[0];if(g)return{kind:"refused",error:g.error};let p=a.unreachable[0];if(p)return{kind:"unreachable",entry:p};let b=a.failures[0];if(b)return{kind:"failed",pass:t,error:b.error};let c=a.results[0];if(!c)return{kind:"failed",pass:t,error:s(e.path,"no result")};if(u){let j=c.job.op==="convert"?{...c.job,sources:[e]}:c.job;return{kind:"done",result:{...c,job:j}}}let k=await E(m);if(k.kind!=="image")return{kind:"failed",pass:t,error:s(e.path,"not an image")};i=k}return{kind:"failed",pass:{kind:"encode",target:e.format},error:s(e.path,"nothing to run")}}catch(i){return{kind:"failed",pass:r[r.length-1]??{kind:"encode",target:e.format},error:y(i)?i:s(e.path,i,e.format)}}finally{await F(d,{recursive:!0,force:!0})}}export{C as a};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{w as E}from"./chunk-
|
|
3
|
+
import{w as E}from"./chunk-JZM37DG2.js";import{qa as O}from"./chunk-PNPAHKJR.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as T}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:u}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return u.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let u=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(u&&i.type===e.standIn))}function h(t,e){return e.text.some(u=>t.includes(u))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
|
|
4
4
|
`)).update("\0").update(e).digest().readUIntBE(0,6)}function x(t){return v("sha256").update(t).digest("hex")}async function L(t,e){let{default:u}=await import("sharp"),i=m(e,"Copied image.png");return await u(t).keepIccProfile().png().toFile(`${i}.part`),await A(`${i}.part`,i),await w(t,{force:!0}),i}var X=`ObjC.import('AppKit')
|
|
5
5
|
const pb = $.NSPasteboard.generalPasteboard
|
|
6
6
|
JSON.stringify({ types: ObjC.deepUnwrap(pb.types) || [], count: Number(pb.changeCount) })`,K=`function run(argv) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as Ht,c as kt}from"./chunk-ECA4PW5T.js";import{j as It}from"./chunk-NMGQGYVM.js";import{L as Ot,a as wt,f as Tt,g as gt}from"./chunk-CCNRNCRU.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Pr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
|
|
3
|
+
import{a as Ht,c as kt}from"./chunk-3OCPO5V6.js";import{q as It}from"./chunk-ULX4ZD2Y.js";import{O as Ot,d as wt,i as Tt,j as gt}from"./chunk-PNPAHKJR.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Pr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as U,k as j}from"./chunk-QO4JUY6B.js";import{n as Se,o as ve,p as Ie,s as J,u as Ee}from"./chunk-UN5DSJE2.js";import{a as Me,b as Be,c as Ae,d as Oe,e as Fe,f as ze,g as $}from"./chunk-6HUYBVQA.js";import{b as M}from"./chunk-KXKQDFHX.js";import{B as de,C as _,J as he,P as H,Y as me,a as w,f as C,g as te,h as re,i as W,j as ne,k as ie,ka as pe,l as oe,m as ae,n as se,o as V,pa as le,ra as ge,sa as we,t as fe,ta as be,u as ce,ua as ye,v as ue,va as xe,za as q}from"./chunk-CCNRNCRU.js";import{c as N}from"./chunk-VLVNA4T3.js";import{constants as it}from"node:fs";import{access as ot,readFile as at,rm as st,stat as ft,writeFile as ct}from"node:fs/promises";import{dirname as ut}from"node:path";var Te=[{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}]}],Bt=1,At=e=>Te.some(r=>r.id===e),De=e=>Te.find(r=>r.id===e),Ot=e=>`debanded-${e}`;function Dt(e){if(w[e].hasAlpha)return;let r=Object.keys(w).filter(t=>w[t].hasAlpha&&t!=="heic").join(", ");return H(`${w[e].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${r}.`)}var ke="1.1.0";function Le(e,r){let t=e.split(".").map(i=>Number.parseInt(i,10)||0),n=r.split(".").map(i=>Number.parseInt(i,10)||0);for(let i=0;i<Math.max(t.length,n.length);i++){let a=(t[i]??0)-(n[i]??0);if(a!==0)return a>0}return!0}var Je="1.4.0";function kt(e){return e!==void 0&&Le(e,Je)}function K(e){return e!==void 0&&Le(e,ke)?[2,3,4]:[2,4]}function Lt(e,r,t){if(e===1||K(r).some(i=>i===e))return;if(t!==void 0&&K(t).some(i=>i===e))return me("boost",`boost ${e}\xD7`,r,ke);let n=K(r).map(i=>`--boost ${i}`);return H(`No released boost makes ${e}\xD7 yet.`,`Try ${n.slice(0,-1).join(", ")} or ${n.at(-1)}.`)}var Ke=16384,Ye=1e8;function Re(e,r,t){let n=Math.max(e,r)*t;if(n>Ke)return{side:n};let i=e*t*r*t;if(i>Ye)return{megapixels:Math.round(i/1e6)}}var F=e=>Math.max(1,Math.round(e));function Y(e,r){return"percent"in r?{width:F(e.width*r.percent/100),height:F(e.height*r.percent/100)}:"width"in r?{width:F(r.width),height:F(e.height*r.width/e.width)}:{width:F(e.width*r.height/e.height),height:F(r.height)}}function Pe(e){return Re(e.width,e.height,1)}function Xe(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 Ne(e,r,t,n,{threshold:i,range:a},f=1){let m=Buffer.from(e),o=Math.min(3,n),s=Xe(f),d=c=>c<0?0:c>=r?r-1:c,h=c=>c<0?0:c>=t?t-1:c;for(let c=0;c<t;c++)for(let p=0;p<r;p++){let g=s()*a,l=s()*2*Math.PI,u=Math.round(Math.cos(l)*g),y=Math.round(Math.sin(l)*g),x=(h(c+y)*r+d(p+u))*n,v=(h(c-y)*r+d(p-u))*n,I=(h(c+y)*r+d(p-u))*n,B=(h(c-y)*r+d(p+u))*n,E=(c*r+p)*n;for(let S=0;S<o;S++){let T=(e[x+S]+e[v+S]+e[I+S]+e[B+S])/4;Math.abs(e[E+S]-T)<i&&(m[E+S]=Math.round(T))}}return m}function Ce(e,r){let t=new Map;for(let n=0;n<e.length;n+=3){let i=e[n],a=e[n+1],f=e[n+2],m=i<<16|a<<8|f;if(!t.has(m)){if(t.size>=r)return;t.set(m,[i,a,f])}}return[...t.values()]}function _e(e,r,t,n){let i=Buffer.alloc(e.length),a=Int16Array.from(n.flatMap(d=>[...d])),f=n.length,m=(r+2)*3,o=new Float32Array(m),s=new Float32Array(m);for(let d=0;d<t;d++){let h=d%2===0;for(let p=0;p<r;p++){let g=h?p:r-1-p,l=(d*r+g)*3,u=(g+1)*3,y=Math.min(255,Math.max(0,e[l]+o[u])),x=Math.min(255,Math.max(0,e[l+1]+o[u+1])),v=Math.min(255,Math.max(0,e[l+2]+o[u+2])),I=0,B=Number.POSITIVE_INFINITY;for(let O=0;O<f;O++){let G=y-a[O*3],Q=x-a[O*3+1],Z=v-a[O*3+2],ee=G*G+Q*Q+Z*Z;ee<B&&(B=ee,I=O)}let E=a[I*3],S=a[I*3+1],T=a[I*3+2];i[l]=E,i[l+1]=S,i[l+2]=T;let L=y-E,R=x-S,P=v-T,b=h?u+3:u-3,A=h?u-3:u+3;o[b]=o[b]+L*7/16,o[b+1]=o[b+1]+R*7/16,o[b+2]=o[b+2]+P*7/16,s[A]=s[A]+L*3/16,s[A+1]=s[A+1]+R*3/16,s[A+2]=s[A+2]+P*3/16,s[u]=s[u]+L*5/16,s[u+1]=s[u+1]+R*5/16,s[u+2]=s[u+2]+P*5/16,s[b]=s[b]+L/16,s[b+1]=s[b+1]+R/16,s[b+2]=s[b+2]+P/16}let c=o;o=s,s=c,s.fill(0)}return i}import{open as Ge}from"node:fs/promises";async function qe(e,r){let t=await Ge(e,"r");try{let n=Buffer.alloc(r),{bytesRead:i}=await t.read(n,0,r,0);return n.subarray(0,i)}finally{await t.close()}}var z=(e,r,t)=>e.subarray(r,r+t).toString("latin1"),Qe=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1","avif","avis","crx "]),Ze=new Set(["M4A ","M4B ","M4P ","F4A ","F4B "]);function et(e){let r=z(e,8,4);if(!Qe.has(r))return r==="qt "?"mov":Ze.has(r)?"m4a":"mp4"}function Ue(e){if(e.length<4)return;if(z(e,4,4)==="ftyp")return et(e);if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return e.includes("webm",0,"latin1")?"webm":"mkv";let r=z(e,0,4);if(r==="RIFF"){let t=z(e,8,4);return t==="WAVE"?"wav":t==="AVI "?"avi":void 0}if(r==="FORM"){let t=z(e,8,4);return t==="AIFF"||t==="AIFC"?"aiff":void 0}if(r==="fLaC")return"flac";if(r==="OggS")return e.includes("OpusHead",0,"latin1")?"opus":"ogg";if(z(e,0,3)==="ID3"||e[0]===255&&((e[1]??0)&224)===224&&((e[1]??0)&6)===2)return"mp3"}var $e=1029,tt=Buffer.from([80,75,3,4]),rt=Buffer.from([208,207,17,224]);function nt(e){for(let t of e)if(t===127||t<32&&t!==9&&t!==10&&t!==13)return!1;return!new TextDecoder("utf-8").decode(e).slice(0,-1).includes("\uFFFD")}function We(e){if(e.length!==0&&!e.includes("%PDF-",0,"latin1")&&Ue(e)===void 0&&!(e.subarray(0,4).equals(tt)||e.subarray(0,4).equals(rt))){if(e.length>=26&&e.toString("latin1",0,2)==="BM"&&e.readUInt32LE(14)>=12)return"a BMP image";if(nt(e))return/<svg[\s>]/i.test(e.toString("utf8"))?"an SVG image":"text"}}var dt=new Set(["jpeg","png","webp","avif","heic","raw","gif","tiff"]),ht=new Set(["jpeg","png","webp","avif","gif","tiff"]),mt={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function pt(e,r){if(r.format==="heif")return r.compression==="av1"?"avif":"heic";let t=mt[r.format??""];if(!t)throw V(e,r.format?`${se(r.format.toUpperCase())} image`:"an unknown format");return t}async function lt(e){let r;try{r=await ft(e)}catch(a){let f=a.code;throw f==="ENOENT"?te(e):f==="EACCES"||f==="EPERM"?W(e):f==="ENOTDIR"?ne(e):f==="ELOOP"?ie(e):f==="ENAMETOOLONG"?oe(e):ae(e,a)}if(!r.isFile())throw re(e);try{await ot(e,it.R_OK)}catch{throw W(e)}if(await Be(e)){if(!await Me())throw fe(e);let a;try{a=await Ae(e)}catch(f){throw _(e,"heic",f)}if(a.width===0||a.height===0)throw _(e,"heic",void 0);return{kind:"image",path:e,format:"heic",width:a.width,height:a.height,bytes:r.size,hasAlpha:a.hasAlpha,frames:1}}let t=await Oe(e);if(t){if(!await Fe())throw ce(e);let a;try{a=await ze(e,t)}catch(f){throw _(e,"raw",f)}if(!a)throw ue(e);return{kind:"image",path:e,format:"raw",width:a.width,height:a.height,bytes:r.size,hasAlpha:!1,frames:1}}let n=await M(),i;try{i=await n(e).metadata()}catch(a){let f=We(await qe(e,$e).catch(()=>Buffer.alloc(0)));throw f?V(e,f):de(e,a)}return{kind:"image",path:e,format:pt(e,i),width:i.autoOrient?.width??i.width??0,height:i.autoOrient?.height??i.height??0,bytes:r.size,hasAlpha:i.hasAlpha??!1,frames:i.pages??1}}function Ve(e,r,t,n){let i=t??w[r].defaultQuality;if(n&&w[r].quantisable)return gt(e,r,t,n);switch(r){case"jpeg":return e.jpeg({quality:i,mozjpeg:!0});case"webp":return e.webp({quality:i});case"avif":return e.avif({quality:i});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 gt(e,r,t,{dither:n}){let i=t??100,a=n?1:0;return r==="gif"?e.gif({interFrameMaxError:Math.round(32*(100-i)/100),dither:a}):e.png({palette:!0,quality:i,dither:a,compressionLevel:9,effort:10})}async function X(e,r,t,n){if(t.deband){let u=await M(),{data:y,info:x}=await e.clone().withIccProfile("srgb").raw().toBuffer({resolveWithObject:!0}),v=y;De(t.deband).passes.forEach((B,E)=>{v=Ne(v,x.width,x.height,x.channels,B,E+1)});let I={width:x.width,height:x.height,channels:x.channels};return await Ve(u(v,{raw:I}).withIccProfile("srgb"),r,t.quality,t.compress).toBuffer()}let i=t.dither;if(i===void 0||!w[r].quantisable)return await Ve(e,r,t.quality,t.compress).toBuffer();let a=u=>r==="gif"?u.gif({colours:i,dither:0,effort:10}):u.png({palette:!0,colours:i,quality:100,dither:0,compressionLevel:9,effort:10}),f=()=>r==="gif"?e.gif({colours:i,dither:1,effort:10}):e.png({palette:!0,colours:i,quality:100,dither:1,compressionLevel:9,effort:10});if(n)return await f().toBuffer();let m=await M(),o=e.clone().withIccProfile("srgb"),{data:s,info:d}=await o.raw().toBuffer({resolveWithObject:!0});if(d.channels===4){for(let u=3;u<s.length;u+=4)if(s[u]!==255)return await f().toBuffer()}let h=d.channels===3?s:wt(s),c=await a(m(h,{raw:{width:d.width,height:d.height,channels:3}})).toBuffer(),p=await m(c).removeAlpha().raw().toBuffer(),g=Ce(p,i);if(!g)return await f().toBuffer();let l=_e(h,d.width,d.height,g);return await a(m(l,{raw:{width:d.width,height:d.height,channels:3}}).withIccProfile("srgb")).toBuffer()}function wt(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 D=(e,r)=>e.kind==="image"&&e.frames>1&&w[r].animatable;async function bt(e,r){let t=ut(r);await J(r);let n=ve(Se(r));try{return await ct(n,e),await Ee(n,r),e.length}catch(i){throw await st(n,{force:!0}).catch(()=>{}),he(r,i)}finally{Ie(n)}}async function k(e,r,t,n,i,a){if(e.kind!=="image")throw new Error("pipelineFor received a non-image source");let f=i??await $(e.path,e.format),o=(await M())(f,n?{animated:!0}:{});if(o=o.rotate(),t.trim&&(o=o.trim()),t.crop){if(!t.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");o=o.extract(t.crop.box)}if(t.resize){if(!a&&(t.trim||t.crop))throw new Error("pipelineFor needs the resolved size to resize a cut image");let s=a??Y(e,t.resize);o=o.resize(s.width,s.height,{fit:"fill"})}return t.rotate&&(o=o.rotate(t.rotate)),e.hasAlpha&&!w[r].hasAlpha&&(o=o.flatten({background:t.background})),o=t.keepMetadata?o.keepMetadata():o.keepIccProfile(),{pipeline:o}}async function cr(e,r){let t={background:"#ffffff",keepMetadata:!1},{pipeline:n}=await k(e,"png",t,!1);await n.png({compressionLevel:1}).toFile(r)}async function ur(e,r,t){let{pipeline:n}=await k(e,r,t,D(e,r));return await X(n,r,t,D(e,r))}async function yt(e){let r={width:e.width,height:e.height};if(e.frames>1)return{upright:r,trimmed:"animated"};if(r.width<3||r.height<3)return{upright:r,trimmed:"nothing"};let t=await $(e.path,e.format);try{let n=await M(),{info:i}=await n(t).rotate().trim().jpeg({quality:1}).toBuffer({resolveWithObject:!0});return i.width===r.width&&i.height===r.height?{upright:r,trimmed:"nothing"}:{upright:r,trimmed:{width:i.width,height:i.height}}}catch(n){throw C(n)?n:q(e.path,n,e.format)}}var He=1024;async function xt(e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:t}=await k(e,"png",r,!1);try{let{data:n,info:i}=await t.resize(He,He,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),a=i.width*i.height,f=i.channels,m=new Uint8Array(a*3),o=new Uint8Array(a),s=!1;for(let d=0;d<a;d++){for(let h=0;h<3;h++)m[d*3+h]=n[d*f+(f>=4?h:0)]??0;o[d]=n[d*f+f-1]??255,o[d]!==255&&(s=!0)}return{size:{width:e.width,height:e.height},thumb:{width:i.width,height:i.height,rgb:m,...s?{alpha:o}:{}}}}catch(n){throw C(n)?n:q(e.path,n,e.format)}}var je=128;async function St(e,r){let{thumb:t,size:n}=e,i=U(t,r),a=await M(),{info:f}=await a(vt(t),{raw:{width:t.width,height:t.height,channels:3}}).resize(i.width,i.height,{fit:"cover",position:a.strategy.attention}).raw().toBuffer({resolveWithObject:!0}),m=U(n,r),o=Math.round(-(f.cropOffsetLeft??0)*n.width/t.width),s=Math.round(-(f.cropOffsetTop??0)*n.height/t.height);return{...m,left:Math.min(Math.max(o,0),n.width-m.width),top:Math.min(Math.max(s,0),n.height-m.height)}}function vt(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 i=(r[Math.floor(n/3)]??255)/255;t[n]=Math.round(je+((e.rgb[n]??0)-je)*i)}return t}async function It(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 i=w[e.target],a=[];r({phase:"reading"});let f=t.frames>1,m=D(t,e.target);f&&!i.animatable&&a.push({code:"animation-flattened",message:`${N(t.path)} has ${t.frames} frames, and ${i.label} cannot animate. Only the first frame was converted.`});let o=e.options,s;if(o.rotate&&f)throw xe(t.path);if(o.trim||o.crop||o.resize){let h={width:t.width,height:t.height};if(o.trim&&o.crop)throw new Error("a job cannot both trim and crop");if(o.crop){if(f)throw ye(t.path);let{aspect:c}=o.crop,p=u=>u.width===t.width&&u.height===t.height,g=U(h,c),l=o.crop.box??(p(g)?g:await St(await xt(t),c));if(p(l)){if(!o.resize)throw be(t.path,j(c));a.push({code:"nothing-cropped",message:`${N(t.path)} is already ${j(c)}; resized only.`});let{crop:u,...y}=o;o=y}else o={...o,crop:{aspect:c,box:l}},h={width:l.width,height:l.height}}if(o.trim){if(f)throw we(t.path);let{trimmed:c}=await yt(t);if(c==="nothing"){if(!o.resize)throw ge(t.path);a.push({code:"nothing-trimmed",message:`${N(t.path)} has no empty edges; resized only.`});let{trim:p,...g}=o;o=g}else c!=="animated"&&(h=c)}if(o.resize&&(s=Y(h,o.resize),Pe(s)))throw pe(t.path,s)}r({phase:"decoding"});let{pipeline:d}=await k(t,e.target,o,m,void 0,s);try{await J(n),r({phase:"encoding"});let h=await X(d,e.target,o,m);if(o.compress&&h.length>=t.bytes)throw le(t.path,t.bytes,h.length);r({phase:"writing"});let c=await bt(h,n);return{job:e,outputBytes:c,warnings:a}}catch(h){throw C(h)?h:q(t.path,h,t.format)}}async function Et(e){let r=await $(e.path,e.format);return typeof r=="string"?await at(r):r}async function Mt(e){if(e.op!=="convert")return;let r=w[e.target];if(!r.lossy&&!(r.quantisable&&e.options.compress))return;let t=e.sources[0];if(t.kind!=="image")return;let n=await Et(t);return{ladder:[{}],measure:async i=>{let{pipeline:a}=await k(t,e.target,i,D(t,e.target),n);return(await X(a,e.target,i,D(t,e.target))).length}}}var dr={id:"image",reads:dt,writes:ht,ops:new Set(["convert"]),probe:lt,run:It,measurer:Mt};export{Dt as a,kt as b,K as c,Lt as d,Ke as e,Re as f,Te as g,Bt as h,At as i,Ot as j,Y as k,Pe as l,qe as m,Ue as n,Ve as o,bt as p,cr as q,ur as r,yt as s,xt as t,St as u,dr as v};
|
|
3
|
+
import{d as U,k as j}from"./chunk-SJIDFYPT.js";import{n as Se,o as ve,p as Ie,s as J,u as Ee}from"./chunk-JZM37DG2.js";import{a as Me,b as Be,c as Ae,d as Oe,e as Fe,f as ze,g as $}from"./chunk-DKHBJ52G.js";import{b as M}from"./chunk-KXKQDFHX.js";import{$ as me,Ca as q,E as de,F as _,M as he,S as H,d as w,i as C,j as te,k as re,l as W,m as ne,n as ie,na as pe,o as oe,p as ae,q as se,r as V,sa as le,ua as ge,va as we,w as fe,wa as be,x as ce,xa as ye,y as ue,ya as xe}from"./chunk-PNPAHKJR.js";import{c as N}from"./chunk-VLVNA4T3.js";import{constants as it}from"node:fs";import{access as ot,readFile as at,rm as st,stat as ft,writeFile as ct}from"node:fs/promises";import{dirname as ut}from"node:path";var Te=[{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}]}],Bt=1,At=e=>Te.some(r=>r.id===e),De=e=>Te.find(r=>r.id===e),Ot=e=>`debanded-${e}`;function Dt(e){if(w[e].hasAlpha)return;let r=Object.keys(w).filter(t=>w[t].hasAlpha&&t!=="heic").join(", ");return H(`${w[e].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${r}.`)}var ke="1.1.0";function Le(e,r){let t=e.split(".").map(i=>Number.parseInt(i,10)||0),n=r.split(".").map(i=>Number.parseInt(i,10)||0);for(let i=0;i<Math.max(t.length,n.length);i++){let a=(t[i]??0)-(n[i]??0);if(a!==0)return a>0}return!0}var Je="1.4.0";function kt(e){return e!==void 0&&Le(e,Je)}function K(e){return e!==void 0&&Le(e,ke)?[2,3,4]:[2,4]}function Lt(e,r,t){if(e===1||K(r).some(i=>i===e))return;if(t!==void 0&&K(t).some(i=>i===e))return me("boost",`boost ${e}\xD7`,r,ke);let n=K(r).map(i=>`--boost ${i}`);return H(`No released boost makes ${e}\xD7 yet.`,`Try ${n.slice(0,-1).join(", ")} or ${n.at(-1)}.`)}var Ke=16384,Ye=1e8;function Re(e,r,t){let n=Math.max(e,r)*t;if(n>Ke)return{side:n};let i=e*t*r*t;if(i>Ye)return{megapixels:Math.round(i/1e6)}}var F=e=>Math.max(1,Math.round(e));function Y(e,r){return"percent"in r?{width:F(e.width*r.percent/100),height:F(e.height*r.percent/100)}:"width"in r?{width:F(r.width),height:F(e.height*r.width/e.width)}:{width:F(e.width*r.height/e.height),height:F(r.height)}}function Pe(e){return Re(e.width,e.height,1)}function Xe(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 Ne(e,r,t,n,{threshold:i,range:a},f=1){let m=Buffer.from(e),o=Math.min(3,n),s=Xe(f),d=c=>c<0?0:c>=r?r-1:c,h=c=>c<0?0:c>=t?t-1:c;for(let c=0;c<t;c++)for(let p=0;p<r;p++){let g=s()*a,l=s()*2*Math.PI,u=Math.round(Math.cos(l)*g),y=Math.round(Math.sin(l)*g),x=(h(c+y)*r+d(p+u))*n,v=(h(c-y)*r+d(p-u))*n,I=(h(c+y)*r+d(p-u))*n,B=(h(c-y)*r+d(p+u))*n,E=(c*r+p)*n;for(let S=0;S<o;S++){let T=(e[x+S]+e[v+S]+e[I+S]+e[B+S])/4;Math.abs(e[E+S]-T)<i&&(m[E+S]=Math.round(T))}}return m}function Ce(e,r){let t=new Map;for(let n=0;n<e.length;n+=3){let i=e[n],a=e[n+1],f=e[n+2],m=i<<16|a<<8|f;if(!t.has(m)){if(t.size>=r)return;t.set(m,[i,a,f])}}return[...t.values()]}function _e(e,r,t,n){let i=Buffer.alloc(e.length),a=Int16Array.from(n.flatMap(d=>[...d])),f=n.length,m=(r+2)*3,o=new Float32Array(m),s=new Float32Array(m);for(let d=0;d<t;d++){let h=d%2===0;for(let p=0;p<r;p++){let g=h?p:r-1-p,l=(d*r+g)*3,u=(g+1)*3,y=Math.min(255,Math.max(0,e[l]+o[u])),x=Math.min(255,Math.max(0,e[l+1]+o[u+1])),v=Math.min(255,Math.max(0,e[l+2]+o[u+2])),I=0,B=Number.POSITIVE_INFINITY;for(let O=0;O<f;O++){let G=y-a[O*3],Q=x-a[O*3+1],Z=v-a[O*3+2],ee=G*G+Q*Q+Z*Z;ee<B&&(B=ee,I=O)}let E=a[I*3],S=a[I*3+1],T=a[I*3+2];i[l]=E,i[l+1]=S,i[l+2]=T;let L=y-E,R=x-S,P=v-T,b=h?u+3:u-3,A=h?u-3:u+3;o[b]=o[b]+L*7/16,o[b+1]=o[b+1]+R*7/16,o[b+2]=o[b+2]+P*7/16,s[A]=s[A]+L*3/16,s[A+1]=s[A+1]+R*3/16,s[A+2]=s[A+2]+P*3/16,s[u]=s[u]+L*5/16,s[u+1]=s[u+1]+R*5/16,s[u+2]=s[u+2]+P*5/16,s[b]=s[b]+L/16,s[b+1]=s[b+1]+R/16,s[b+2]=s[b+2]+P/16}let c=o;o=s,s=c,s.fill(0)}return i}import{open as Ge}from"node:fs/promises";async function qe(e,r){let t=await Ge(e,"r");try{let n=Buffer.alloc(r),{bytesRead:i}=await t.read(n,0,r,0);return n.subarray(0,i)}finally{await t.close()}}var z=(e,r,t)=>e.subarray(r,r+t).toString("latin1"),Qe=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1","avif","avis","crx "]),Ze=new Set(["M4A ","M4B ","M4P ","F4A ","F4B "]);function et(e){let r=z(e,8,4);if(!Qe.has(r))return r==="qt "?"mov":Ze.has(r)?"m4a":"mp4"}function Ue(e){if(e.length<4)return;if(z(e,4,4)==="ftyp")return et(e);if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return e.includes("webm",0,"latin1")?"webm":"mkv";let r=z(e,0,4);if(r==="RIFF"){let t=z(e,8,4);return t==="WAVE"?"wav":t==="AVI "?"avi":void 0}if(r==="FORM"){let t=z(e,8,4);return t==="AIFF"||t==="AIFC"?"aiff":void 0}if(r==="fLaC")return"flac";if(r==="OggS")return e.includes("OpusHead",0,"latin1")?"opus":"ogg";if(z(e,0,3)==="ID3"||e[0]===255&&((e[1]??0)&224)===224&&((e[1]??0)&6)===2)return"mp3"}var $e=1029,tt=Buffer.from([80,75,3,4]),rt=Buffer.from([208,207,17,224]);function nt(e){for(let t of e)if(t===127||t<32&&t!==9&&t!==10&&t!==13)return!1;return!new TextDecoder("utf-8").decode(e).slice(0,-1).includes("\uFFFD")}function We(e){if(e.length!==0&&!e.includes("%PDF-",0,"latin1")&&Ue(e)===void 0&&!(e.subarray(0,4).equals(tt)||e.subarray(0,4).equals(rt))){if(e.length>=26&&e.toString("latin1",0,2)==="BM"&&e.readUInt32LE(14)>=12)return"a BMP image";if(nt(e))return/<svg[\s>]/i.test(e.toString("utf8"))?"an SVG image":"text"}}var dt=new Set(["jpeg","png","webp","avif","heic","raw","gif","tiff"]),ht=new Set(["jpeg","png","webp","avif","gif","tiff"]),mt={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function pt(e,r){if(r.format==="heif")return r.compression==="av1"?"avif":"heic";let t=mt[r.format??""];if(!t)throw V(e,r.format?`${se(r.format.toUpperCase())} image`:"an unknown format");return t}async function lt(e){let r;try{r=await ft(e)}catch(a){let f=a.code;throw f==="ENOENT"?te(e):f==="EACCES"||f==="EPERM"?W(e):f==="ENOTDIR"?ne(e):f==="ELOOP"?ie(e):f==="ENAMETOOLONG"?oe(e):ae(e,a)}if(!r.isFile())throw re(e);try{await ot(e,it.R_OK)}catch{throw W(e)}if(await Be(e)){if(!await Me())throw fe(e);let a;try{a=await Ae(e)}catch(f){throw _(e,"heic",f)}if(a.width===0||a.height===0)throw _(e,"heic",void 0);return{kind:"image",path:e,format:"heic",width:a.width,height:a.height,bytes:r.size,hasAlpha:a.hasAlpha,frames:1}}let t=await Oe(e);if(t){if(!await Fe())throw ce(e);let a;try{a=await ze(e,t)}catch(f){throw _(e,"raw",f)}if(!a)throw ue(e);return{kind:"image",path:e,format:"raw",width:a.width,height:a.height,bytes:r.size,hasAlpha:!1,frames:1}}let n=await M(),i;try{i=await n(e).metadata()}catch(a){let f=We(await qe(e,$e).catch(()=>Buffer.alloc(0)));throw f?V(e,f):de(e,a)}return{kind:"image",path:e,format:pt(e,i),width:i.autoOrient?.width??i.width??0,height:i.autoOrient?.height??i.height??0,bytes:r.size,hasAlpha:i.hasAlpha??!1,frames:i.pages??1}}function Ve(e,r,t,n){let i=t??w[r].defaultQuality;if(n&&w[r].quantisable)return gt(e,r,t,n);switch(r){case"jpeg":return e.jpeg({quality:i,mozjpeg:!0});case"webp":return e.webp({quality:i});case"avif":return e.avif({quality:i});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 gt(e,r,t,{dither:n}){let i=t??100,a=n?1:0;return r==="gif"?e.gif({interFrameMaxError:Math.round(32*(100-i)/100),dither:a}):e.png({palette:!0,quality:i,dither:a,compressionLevel:9,effort:10})}async function X(e,r,t,n){if(t.deband){let u=await M(),{data:y,info:x}=await e.clone().withIccProfile("srgb").raw().toBuffer({resolveWithObject:!0}),v=y;De(t.deband).passes.forEach((B,E)=>{v=Ne(v,x.width,x.height,x.channels,B,E+1)});let I={width:x.width,height:x.height,channels:x.channels};return await Ve(u(v,{raw:I}).withIccProfile("srgb"),r,t.quality,t.compress).toBuffer()}let i=t.dither;if(i===void 0||!w[r].quantisable)return await Ve(e,r,t.quality,t.compress).toBuffer();let a=u=>r==="gif"?u.gif({colours:i,dither:0,effort:10}):u.png({palette:!0,colours:i,quality:100,dither:0,compressionLevel:9,effort:10}),f=()=>r==="gif"?e.gif({colours:i,dither:1,effort:10}):e.png({palette:!0,colours:i,quality:100,dither:1,compressionLevel:9,effort:10});if(n)return await f().toBuffer();let m=await M(),o=e.clone().withIccProfile("srgb"),{data:s,info:d}=await o.raw().toBuffer({resolveWithObject:!0});if(d.channels===4){for(let u=3;u<s.length;u+=4)if(s[u]!==255)return await f().toBuffer()}let h=d.channels===3?s:wt(s),c=await a(m(h,{raw:{width:d.width,height:d.height,channels:3}})).toBuffer(),p=await m(c).removeAlpha().raw().toBuffer(),g=Ce(p,i);if(!g)return await f().toBuffer();let l=_e(h,d.width,d.height,g);return await a(m(l,{raw:{width:d.width,height:d.height,channels:3}}).withIccProfile("srgb")).toBuffer()}function wt(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 D=(e,r)=>e.kind==="image"&&e.frames>1&&w[r].animatable;async function bt(e,r){let t=ut(r);await J(r);let n=ve(Se(r));try{return await ct(n,e),await Ee(n,r),e.length}catch(i){throw await st(n,{force:!0}).catch(()=>{}),he(r,i)}finally{Ie(n)}}async function k(e,r,t,n,i,a){if(e.kind!=="image")throw new Error("pipelineFor received a non-image source");let f=i??await $(e.path,e.format),o=(await M())(f,n?{animated:!0}:{});if(o=o.rotate(),t.trim&&(o=o.trim()),t.crop){if(!t.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");o=o.extract(t.crop.box)}if(t.resize){if(!a&&(t.trim||t.crop))throw new Error("pipelineFor needs the resolved size to resize a cut image");let s=a??Y(e,t.resize);o=o.resize(s.width,s.height,{fit:"fill"})}return t.rotate&&(o=o.rotate(t.rotate)),e.hasAlpha&&!w[r].hasAlpha&&(o=o.flatten({background:t.background})),o=t.keepMetadata?o.keepMetadata():o.keepIccProfile(),{pipeline:o}}async function cr(e,r){let t={background:"#ffffff",keepMetadata:!1},{pipeline:n}=await k(e,"png",t,!1);await n.png({compressionLevel:1}).toFile(r)}async function ur(e,r,t){let{pipeline:n}=await k(e,r,t,D(e,r));return await X(n,r,t,D(e,r))}async function yt(e){let r={width:e.width,height:e.height};if(e.frames>1)return{upright:r,trimmed:"animated"};if(r.width<3||r.height<3)return{upright:r,trimmed:"nothing"};let t=await $(e.path,e.format);try{let n=await M(),{info:i}=await n(t).rotate().trim().jpeg({quality:1}).toBuffer({resolveWithObject:!0});return i.width===r.width&&i.height===r.height?{upright:r,trimmed:"nothing"}:{upright:r,trimmed:{width:i.width,height:i.height}}}catch(n){throw C(n)?n:q(e.path,n,e.format)}}var He=1024;async function xt(e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:t}=await k(e,"png",r,!1);try{let{data:n,info:i}=await t.resize(He,He,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),a=i.width*i.height,f=i.channels,m=new Uint8Array(a*3),o=new Uint8Array(a),s=!1;for(let d=0;d<a;d++){for(let h=0;h<3;h++)m[d*3+h]=n[d*f+(f>=4?h:0)]??0;o[d]=n[d*f+f-1]??255,o[d]!==255&&(s=!0)}return{size:{width:e.width,height:e.height},thumb:{width:i.width,height:i.height,rgb:m,...s?{alpha:o}:{}}}}catch(n){throw C(n)?n:q(e.path,n,e.format)}}var je=128;async function St(e,r){let{thumb:t,size:n}=e,i=U(t,r),a=await M(),{info:f}=await a(vt(t),{raw:{width:t.width,height:t.height,channels:3}}).resize(i.width,i.height,{fit:"cover",position:a.strategy.attention}).raw().toBuffer({resolveWithObject:!0}),m=U(n,r),o=Math.round(-(f.cropOffsetLeft??0)*n.width/t.width),s=Math.round(-(f.cropOffsetTop??0)*n.height/t.height);return{...m,left:Math.min(Math.max(o,0),n.width-m.width),top:Math.min(Math.max(s,0),n.height-m.height)}}function vt(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 i=(r[Math.floor(n/3)]??255)/255;t[n]=Math.round(je+((e.rgb[n]??0)-je)*i)}return t}async function It(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 i=w[e.target],a=[];r({phase:"reading"});let f=t.frames>1,m=D(t,e.target);f&&!i.animatable&&a.push({code:"animation-flattened",message:`${N(t.path)} has ${t.frames} frames, and ${i.label} cannot animate. Only the first frame was converted.`});let o=e.options,s;if(o.rotate&&f)throw xe(t.path);if(o.trim||o.crop||o.resize){let h={width:t.width,height:t.height};if(o.trim&&o.crop)throw new Error("a job cannot both trim and crop");if(o.crop){if(f)throw ye(t.path);let{aspect:c}=o.crop,p=u=>u.width===t.width&&u.height===t.height,g=U(h,c),l=o.crop.box??(p(g)?g:await St(await xt(t),c));if(p(l)){if(!o.resize)throw be(t.path,j(c));a.push({code:"nothing-cropped",message:`${N(t.path)} is already ${j(c)}; resized only.`});let{crop:u,...y}=o;o=y}else o={...o,crop:{aspect:c,box:l}},h={width:l.width,height:l.height}}if(o.trim){if(f)throw we(t.path);let{trimmed:c}=await yt(t);if(c==="nothing"){if(!o.resize)throw ge(t.path);a.push({code:"nothing-trimmed",message:`${N(t.path)} has no empty edges; resized only.`});let{trim:p,...g}=o;o=g}else c!=="animated"&&(h=c)}if(o.resize&&(s=Y(h,o.resize),Pe(s)))throw pe(t.path,s)}r({phase:"decoding"});let{pipeline:d}=await k(t,e.target,o,m,void 0,s);try{await J(n),r({phase:"encoding"});let h=await X(d,e.target,o,m);if(o.compress&&h.length>=t.bytes)throw le(t.path,t.bytes,h.length);r({phase:"writing"});let c=await bt(h,n);return{job:e,outputBytes:c,warnings:a}}catch(h){throw C(h)?h:q(t.path,h,t.format)}}async function Et(e){let r=await $(e.path,e.format);return typeof r=="string"?await at(r):r}async function Mt(e){if(e.op!=="convert")return;let r=w[e.target];if(!r.lossy&&!(r.quantisable&&e.options.compress))return;let t=e.sources[0];if(t.kind!=="image")return;let n=await Et(t);return{ladder:[{}],measure:async i=>{let{pipeline:a}=await k(t,e.target,i,D(t,e.target),n);return(await X(a,e.target,i,D(t,e.target))).length}}}var dr={id:"image",reads:dt,writes:ht,ops:new Set(["convert"]),probe:lt,run:It,measurer:Mt};export{Dt as a,kt as b,K as c,Lt as d,Ke as e,Re as f,Te as g,Bt as h,At as i,Ot as j,Y as k,Pe as l,qe as m,Ue as n,Ve as o,bt as p,cr as q,ur as r,yt as s,xt as t,St as u,dr as v};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{H as h,L as T,M as w,N as v,g as x}from"./chunk-PNPAHKJR.js";import{existsSync as E,statSync as S}from"node:fs";import{basename as m,dirname as U,extname as g,isAbsolute as j,join as u,relative as K,resolve as o,sep as Y}from"node:path";function $(t){return t.endsWith("/")||t.endsWith(Y)||E(t)&&S(t).isDirectory()?!0:g(t)===""}var N=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function a(t,r,e=process.platform){if(b(t+r,e)<=N)return t+r;let n="";for(let i of t){if(b(n+i+r,e)>N)break;n+=i}return n+r}function yt(t,r){if(o(t)===o(r))return!0;try{let e=S(t),n=S(r);return e.dev===n.dev&&e.ino===n.ino}catch{return!1}}function C(t,r){let e=m(t),n=g(e),i=n?e.slice(0,-n.length):e;return a(i,x(r))}function M(t,r,e){if(!e)return t;let n=K(o(e),r);return!n||n.startsWith("..")?t:u(t,n)}function X(t){let r=o(t.sourcePath),e=C(r,t.target);if(!t.output)return u(o(r,".."),e);let n=j(t.output)?t.output:o(t.output);return $(t.output)?u(M(n,o(r,".."),t.sourceRoot),e):o(n)}function Ot(t){let r=X(t);if(t.output&&!$(t.output))return r;let e=g(r);return u(o(r,".."),a(m(r,e),`-${t.suffix}${e}`))}function Tt(t){if(!E(t))return t;let r=o(t,".."),e=m(t),n=g(e),i=n?e.slice(0,-n.length):e;for(let s=1;s<1e4;s++){let c=u(r,a(i,` (${s})${n}`));if(!E(c))return c}throw new Error(`no free name beside ${e}`)}function d(t){let r=o(t,".."),e=m(t),n=g(e);return{dir:r,stem:n?e.slice(0,-n.length):e,ext:n||".pdf"}}function A(t,r){let{dir:e,stem:n,ext:i}=d(o(t));return u(e,a(n,`-${r}${i}`))}function vt(t,r){let{dir:e,stem:n,ext:i}=d(o(t)),s=String(r).length;return Array.from({length:r},(c,f)=>u(e,a(n,`-${String(f+1).padStart(s,"0")}${i}`)))}function Nt(t,r,e,n,i){let{stem:s}=d(o(t)),c=n?M(o(n),o(t,".."),i):o(t,".."),f=x(e),F=String(Math.max(1,...r.map(l=>l+1))).length,B=r.map(l=>u(c,a(s,`-${String(l+1).padStart(F,"0")}${f}`))),[O,...J]=B;if(O===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[O,...J]}function bt(t,r,e){if(!e)return[A(t,"extract")];let{dir:n,stem:i,ext:s}=d(o(t));return r.map(c=>u(n,a(i,`-p${c+1}${s}`)))}function $t(t){let r=o(t[0]??"merged.pdf");if(new Set(t.map(n=>o(n,".."))).size===1){let n=o(r,"..");return u(n,a(m(n),"-merged.pdf"))}return A(r,"merged")}function z(t,r,e){let n=r?t.map(s=>u(r,m(s))):t,[i]=n;return!e||n.length!==1||i===void 0?n:[u(U(i),`${e}${g(i)}`)]}function Mt(t,r,e){return z([t],r,e)[0]??t}import{AsyncLocalStorage as G}from"node:async_hooks";import{execFile as V}from"node:child_process";import{randomBytes as H}from"node:crypto";import{constants as Q,existsSync as Z,rmSync as q}from"node:fs";import{access as tt,link as rt,lstat as et,mkdir as nt,readdir as it,rename as I,rm as L,unlink as st,writeFile as ot}from"node:fs/promises";import{basename as P,dirname as R,extname as ct,join as k}from"node:path";function ut(t,r=H(6).toString("hex")){let e=ct(t);return k(R(t),a(`.forge-${r}-${P(t,e)}`,e))}var p=new Set;function at(t){return p.add(t),t}function ft(t){p.delete(t)}function Bt(){return[...p]}function Jt(){for(let t of p){try{q(t,{force:!0})}catch{}p.delete(t)}}var mt=/^\.forge-(?:pass-)?[0-9a-f]{12}(?:-|$)/,gt=1440*60*1e3;async function pt(t,r=Date.now()){let e;try{e=await it(t)}catch{return}await Promise.all(e.filter(n=>mt.test(n)).map(async n=>{let i=k(t,n);if(!p.has(i))try{let s=await et(i);if(!s.isFile()||r-s.mtimeMs<gt)return;await L(i,{force:!0})}catch{}}))}var W=new Map;async function dt(t){let r=R(t);try{await nt(r,{recursive:!0})}catch(n){let i=w(t,n);throw i===n?v(t,n):i}try{await tt(r,Q.W_OK)}catch(n){throw T(t,n)}let e=W.get(r);e||(e=pt(r),W.set(r,e)),await e}var lt=new Set(["EPERM","EBUSY","EACCES"]),xt=5,Ut=9;async function D(t,r,e=process.platform,n=s=>new Promise(c=>setTimeout(c,s)),i=xt){if(y.getStore()===!0){if(!await ht(t,r)){if(Z(r))throw h(r);return y.exit(()=>D(t,r,e,n,i))}e==="darwin"&&await _(t,r);return}if(e!=="win32"){await I(t,r),e==="darwin"&&await _(t,r);return}for(let s=1;;s++)try{await I(t,r);return}catch(c){let f=c.code;if(s>=i||!f||!lt.has(f))throw c;await n(Math.min(50*2**(s-1),1e3))}}var y=new G;function jt(t){return y.run(!0,t)}async function ht(t,r){try{await rt(t,r)}catch(e){let n=e.code;if(n==="EEXIST")throw h(r);if(n!==void 0&&wt.has(n))return!1;throw e}return await st(t).catch(()=>{}),!0}var wt=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS","EXDEV","EMLINK"]);function _(t,r){return!P(t).startsWith(".")||P(r).startsWith(".")?Promise.resolve():new Promise(e=>{V("/usr/bin/chflags",["nohidden",r],()=>e())})}async function Kt(t,r){await dt(t);let e=at(ut(t));try{return await ot(e,r),await D(e,t),r.byteLength}catch(n){throw await L(e,{force:!0}).catch(()=>{}),w(t,n)}finally{ft(e)}}export{$ as a,a as b,yt as c,X as d,Ot as e,Tt as f,A as g,vt as h,Nt as i,bt as j,$t as k,z as l,Mt as m,ut as n,at as o,ft as p,Bt as q,Jt as r,dt as s,Ut as t,D as u,jt as v,Kt as w};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as w,h as nt,i as P}from"./chunk-
|
|
3
|
+
import{a as w,h as nt,i as P}from"./chunk-AETM2PCZ.js";import{b as y,c as F,d as D,f as O,g as K,h as et}from"./chunk-EYOO35US.js";import{a as tt}from"./chunk-I2LPGKUU.js";var ct=[[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(ct.find(([n])=>e<n)??[360,"rose"])[1]}var St=["full","mono","analogous","opposite","split","triad","pastel"],rt={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},Mt=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}}],ut={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},gt=.553,mt=.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 ot(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;ot(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&&!ot(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 Lt(t,e,n,r){return J(t(N(e,n)),n.contrast,r)}function at(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 pt(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 at(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(ut[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 ft(t,e,n){let r=d(t).h+e.hue,a=Math.max(0,mt*(1+e.saturation/100));return P(T(z(gt,e.brightness),a,r),n)}function Rt(t,e,n=W,r=w){let a=nt(r);return{rows:(e==="full"?at(t,n):pt(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(ft(t,n,r),n.contrast,a)}}var R=t=>tt(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),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 st(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var xt=`<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
4
|
`;function H(t,e,n,r="light",a={}){let{ink:o,grey:s,edge:l,paper:i}=st(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
5
|
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${b}" viewBox="0 0 ${$} ${b}">
|
|
6
6
|
`+(n.some(g=>g.alpha!==void 0)?xt:"")+`<g id="${I(t)}">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as f}from"./chunk-
|
|
3
|
+
import{c as f}from"./chunk-ZL7E7PZN.js";import{randomBytes as g}from"node:crypto";import{mkdir as N,readFile as b,rename as x,rm as y,writeFile as k}from"node:fs/promises";import{dirname as l,join as E}from"node:path";var A="https://registry.npmjs.org/forge-terminal/latest",C=1440*60*1e3,R=3e3,O=/^(\d+)\.(\d+)\.(\d+)$/;function a(t){let e=O.exec(t);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:void 0}function P(t,e){let n=a(t),o=a(e);if(!n||!o)return!1;for(let r=0;r<3;r++)if(n[r]!==o[r])return n[r]>o[r];return!1}function D(t,e=process.env){return!(t.updateCheck===!1||e.CI!==void 0&&e.CI!==""&&e.CI!=="false"||e.FORGE_NO_UPDATE_CHECK!==void 0&&e.FORGE_NO_UPDATE_CHECK!=="")}var S=20,_=22,T=200;function U(t){let e=t.codePointAt(0)??0;return e>=32&&(e<127||e>159)}var d=(t,e)=>typeof t=="string"?[...t].filter(U).join("").trim().slice(0,e):"";function p(t){if(!Array.isArray(t))return;let e=t.map(n=>{let{title:o,text:r}=typeof n=="object"&&n!==null?n:{};return{title:d(o,_),text:d(r,T)}}).filter(n=>n.title!==""&&n.text!=="").slice(0,S);return e.length>0?e:void 0}function h(){return E(l(f()),"update-check.json")}async function c(){try{let t=JSON.parse(await b(h(),"utf8"));if(typeof t!="object"||t===null)return;let{checkedAt:e,latest:n,notifiedAt:o,whatsNew:r}=t;if(typeof e!="number")return;let s=typeof n=="string"&&a(n)!==void 0,i=s?p(r):void 0;return{checkedAt:e,...s?{latest:n}:{},...typeof o=="number"?{notifiedAt:o}:{},...i?{whatsNew:i}:{}}}catch{return}}async function F(t){let e=h();await N(l(e),{recursive:!0});let n=`${e}.${g(4).toString("hex")}.tmp`;try{await k(n,`${JSON.stringify(t)}
|
|
4
4
|
`),await x(n,e)}catch(o){throw await y(n,{force:!0}).catch(()=>{}),o}}function L(t,e=Date.now()){return t===void 0?!0:t.checkedAt>e||e-t.checkedAt>C}async function $(t={}){return(await w(t))?.version}async function w(t){let e=t.fetchImpl??fetch,n=AbortSignal.timeout(t.timeoutMs??R),o=t.signal?AbortSignal.any([t.signal,n]):n;try{let r=await e(A,{signal:o,headers:{accept:"application/json"}});if(!r.ok)return;let s=await r.json(),{version:i,whatsNew:m}=s??{};if(typeof i!="string"||!a(i))return;let u=p(m);return u?{version:i,whatsNew:u}:{version:i}}catch{return}}async function G(t={}){let e=await w(t),n=await c(),o=e??(n?.latest!==void 0?n:void 0),r=e?.version??n?.latest,s={checkedAt:t.now??Date.now(),...r!==void 0?{latest:r}:{},...n?.notifiedAt!==void 0?{notifiedAt:n.notifiedAt}:{},...o?.whatsNew!==void 0?{whatsNew:o.whatsNew}:{}};return await F(s).catch(()=>{}),e?.version}async function H(t){let e=await c();return e?.latest===t?e.whatsNew??[]:[]}async function J(t){let e=(await c())?.latest;return e!==void 0&&P(e,t)?e:void 0}export{A as a,C as b,P as c,D as d,S as e,_ as f,T as g,h,c as i,F as j,L as k,$ as l,G as m,H as n,J as o};
|