forge-terminal 0.5.6 → 0.5.8
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 +14 -9
- package/dist/chunks/{about-credits-TM34J3IS.js → about-credits-PQSIWSE2.js} +1 -1
- package/dist/chunks/{args-7OJGCKH4.js → args-J5JEHQLE.js} +1 -1
- package/dist/chunks/{boot-5KSVFF4C.js → boot-ETZUHG3U.js} +1 -1
- package/dist/chunks/{chunk-QV27SER6.js → chunk-2M5PPZIS.js} +2 -2
- package/dist/chunks/{chunk-WNYM6NSV.js → chunk-4OSMYHKQ.js} +1 -1
- package/dist/chunks/{chunk-W43SUVWN.js → chunk-6TTONCYR.js} +1 -1
- package/dist/chunks/{chunk-XZZCVJ64.js → chunk-BP6CVOQR.js} +2 -2
- package/dist/chunks/{chunk-QYAJFKQL.js → chunk-DD5Z6NSH.js} +1 -1
- package/dist/chunks/{chunk-WBV6I7UP.js → chunk-DHW72U6X.js} +1 -1
- package/dist/chunks/{chunk-2HGBB3DQ.js → chunk-FEFNS6YZ.js} +1 -1
- package/dist/chunks/{chunk-UB6YVCIS.js → chunk-H3KW7HTC.js} +1 -1
- package/dist/chunks/{chunk-ZJ45XUJW.js → chunk-J7Z7ULLN.js} +1 -1
- package/dist/chunks/{chunk-3RH2AXJW.js → chunk-JI7YY44M.js} +1 -1
- package/dist/chunks/{chunk-LAJAXLGQ.js → chunk-KTCHWHQB.js} +1 -1
- package/dist/chunks/chunk-NAE3AJ3M.js +3 -0
- package/dist/chunks/{chunk-XY7C5I5T.js → chunk-NUW4YOJ6.js} +1 -1
- package/dist/chunks/{chunk-7R7KDE3R.js → chunk-OXDRJO4V.js} +1 -1
- package/dist/chunks/{chunk-KQ2AHGLK.js → chunk-RQWWUCGQ.js} +1 -1
- package/dist/chunks/{chunk-75GYDNAQ.js → chunk-RT6EXB2P.js} +1 -1
- package/dist/chunks/{chunk-LM4K7CZQ.js → chunk-SM735FG7.js} +7 -6
- package/dist/chunks/{chunk-RUAEBL2F.js → chunk-T4CLHCLJ.js} +2 -2
- package/dist/chunks/{chunk-37U22UEW.js → chunk-TJ5YBJEO.js} +1 -1
- package/dist/chunks/{chunk-U2XQL7AA.js → chunk-VBDRWNEG.js} +1 -1
- package/dist/chunks/{chunk-CZDI37SI.js → chunk-XGG3NYQN.js} +1 -1
- package/dist/chunks/{chunk-2BPH3IL6.js → chunk-YISJTRB6.js} +1 -1
- package/dist/chunks/chunk-YPAFAG4W.js +6 -0
- package/dist/chunks/{chunk-JDTDXCZE.js → chunk-Z6IQV737.js} +1 -1
- package/dist/chunks/{clip-command-3JBZK6Q3.js → clip-command-QIMH2U7N.js} +1 -1
- package/dist/chunks/{clipboard-XOIVXPVL.js → clipboard-IZJTBTSW.js} +1 -1
- package/dist/chunks/colour-3MFAFJNN.js +3 -0
- package/dist/chunks/{entry-64GTSHV2.js → entry-HGEJC7CZ.js} +1 -1
- package/dist/chunks/{execute-3J755YKG.js → execute-MRVDAKZO.js} +1 -1
- package/dist/chunks/{extensions-QQT6OD7W.js → extensions-ONARRS5Q.js} +1 -1
- package/dist/chunks/{extensions-command-FV3N7CBV.js → extensions-command-65QEMN2L.js} +1 -1
- package/dist/chunks/{ffmpeg-VGE2QCC7.js → ffmpeg-RTFJS67A.js} +1 -1
- package/dist/chunks/{launch-ATJNO6ZO.js → launch-T7YOO7BQ.js} +5 -5
- package/dist/chunks/{manager-ROCFK7AS.js → manager-5EJGANFW.js} +1 -1
- package/dist/chunks/{needed-T722HOKD.js → needed-6GCBKP3S.js} +1 -1
- package/dist/chunks/{own-CX3EJ2AH.js → own-KMIT2CXF.js} +1 -1
- package/dist/chunks/{preset-command-M7SESD5C.js → preset-command-3ILRQZSJ.js} +1 -1
- package/dist/chunks/{registry-7BJ4J2SD.js → registry-K245FDI2.js} +1 -1
- package/dist/chunks/server-M5YGJHOL.js +77 -0
- package/dist/chunks/{theme-S234JXQH.js → theme-XKWZV7OX.js} +1 -1
- package/dist/chunks/{transcribe-L64JHZ3U.js → transcribe-SQC6QTV5.js} +1 -1
- package/dist/chunks/transcribe-command-PAHSXMWG.js +3 -0
- package/dist/chunks/{update-note-YQD2W5B2.js → update-note-NRPILOCL.js} +1 -1
- package/dist/chunks/{watch-command-B2Z4KSWR.js → watch-command-QOMMDISG.js} +1 -1
- package/dist/index.js +6 -6
- package/package.json +5 -5
- package/skills/forge/SKILL.md +67 -4
- package/dist/chunks/chunk-YR7QRQ5F.js +0 -6
- package/dist/chunks/colour-CEKEW7RV.js +0 -3
- package/dist/chunks/server-64H64DIC.js +0 -74
- package/dist/chunks/transcribe-command-Y3AHXLVA.js +0 -3
|
@@ -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 y,c as b}from"./chunk-
|
|
3
|
+
import{a as y,c as b}from"./chunk-VBDRWNEG.js";import{a as p}from"./chunk-KTCHWHQB.js";import{j as h}from"./chunk-RQWWUCGQ.js";import{a as m}from"./chunk-ZBMJTIYR.js";import{a as c}from"./chunk-H3DIRJFE.js";import{open as g,readdir as w,stat as x}from"node:fs/promises";import{extname as S,join as k,resolve as v}from"node:path";function K(e){return e.startsWith(".")||/\.(crdownload|part|download|tmp)$/i.test(e)}function A(e){return e.kind==="image"?"images":e.format==="pdf"?"pdfs":"documents"}var R=new Set(Object.values(c).flatMap(e=>e.extensions));async function O(e){let i=await g(e,"r"),t=Buffer.alloc(4096),r=0;try{r=(await i.read(t,0,t.length,0)).bytesRead}finally{await i.close()}let n=t.subarray(0,r),o=(d,f)=>n.subarray(d,d+f).toString("latin1");return o(4,4)==="ftyp"?/^(M4A |M4B |M4P )$/.test(o(8,4))?"audio":"video":n[0]===26&&n[1]===69&&n[2]===223&&n[3]===163?"video":o(0,4)==="RIFF"?o(8,4)==="WAVE"?"audio":o(8,3)==="AVI"?"video":"other":n[0]===0&&n[1]===0&&n[2]===1&&(n[3]===186||n[3]===179)?"video":o(0,3)==="ID3"||o(0,4)==="fLaC"||o(0,4)==="OggS"||o(0,4)==="FORM"&&/^AIF[FC]$/.test(o(8,4))||n[0]===255&&n[1]!==void 0&&(n[1]&224)===224?"audio":r>0&&!n.includes(0)&&M(n)?"text":"other"}function M(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e,{stream:!0}),!0}catch{return!1}}var F=["images","pdfs","documents","videos","audio","other"];function j(e,i){if(e==="videos"||e==="audio")return"not yet supported";if(e==="other")return i.every(t=>t==="text")?i.length===1?"a text file":"text files":"not supported"}async function V(e){let i=v(e),t=await w(i,{withFileTypes:!0}),r=[],n=[],o=new Map,d=[],f=0;for(let s of t.sort((a,u)=>a.name.localeCompare(u.name)))!s.isFile()||K(s.name)||d.push(k(i,s.name));for(let s of await E(d))if(s.kind==="source")r.push(s.source),f+=s.source.bytes;else if(s.kind==="failed")n.push(s.failure),f+=s.bytes;else{let a=s.kind,u=o.get(a)??{bytes:0,sniffed:[]};u.bytes+=s.bytes,u.sniffed.push(s.sniffed),o.set(a,u),f+=s.bytes}let l=I(r);for(let s of F){let a=o.get(s);if(!a)continue;let u=j(s,a.sniffed);l.push({id:s,count:a.sniffed.length,bytes:a.bytes,sources:[],...u===void 0?{}:{why:u}})}return{dir:i,sources:r,failures:n,kinds:l,bytes:f,paths:d}}async function E(e){let i=[];return await b(e,y(),async(t,r)=>{try{i[r]={read:await C(t)}}catch(n){i[r]={error:n}}}),i.map(t=>{if("error"in t)throw t.error;return t.read})}function I(e){let i=[];for(let t of F){let r=e.filter(n=>A(n)===t);r.length>0&&i.push({id:t,count:r.length,bytes:r.reduce((n,o)=>n+o.bytes,0),sources:r})}return i.sort((t,r)=>r.count-t.count)}function W(e,i=[]){let t=e.filter(o=>o.kind==="media"),r=e.filter(o=>o.kind!=="media"),n=I(r);for(let o of["videos","audio"]){let d=t.filter(f=>c[f.format].media==="video"==(o==="videos"));if(d.length>0){let f=d.reduce((l,s)=>l+s.bytes,0);n.push({id:o,count:d.length,bytes:f,sources:[],why:"one at a time"})}}return{dir:"",sources:r,failures:i,kinds:n,bytes:e.reduce((o,d)=>o+d.bytes,0),paths:e.map(o=>o.path)}}async function C(e){let i=()=>x(e).then(t=>t.size,()=>0);try{let t=await h(e);if(t.kind==="media"){let r=c[t.format].media==="video";return{kind:r?"videos":"audio",sniffed:r?"video":"audio",bytes:t.bytes}}return{kind:"source",source:t}}catch(t){let r=await i(),n=await O(e).catch(()=>"other");if(n==="video"||n==="audio")return{kind:n==="video"?"videos":"audio",sniffed:n,bytes:r};if(R.has(S(e).toLowerCase())){let o=m(t)?t:void 0;if(o)return{kind:"failed",failure:{path:e,error:o},bytes:r}}return{kind:"other",sniffed:n,bytes:r}}}function D(e){let i=new Set(e.flatMap(t=>p(t).filter(r=>r!==t.format)));return Object.keys(c).filter(t=>i.has(t))}function _(e,i){let t=D(e),r=e[0],n=r?.kind==="image"?"webp":r?.format==="pdf"?"png":void 0,o=n&&t.includes(n)?n:t[0];if(o)return N(e,o,i)}function N(e,i,t){let r={target:i};return c[i].lossy&&(r.quality=t),e.some(n=>n.kind==="document"&&n.format==="pdf")&&(i==="png"||i==="jpeg")&&(r.dpi=150),r}export{K as a,A as b,O as c,V as d,W as e,C as f,D as g,_ as h,N as i};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{r as E}from"./chunk-V6GWPR2A.js";import{aa as O}from"./chunk-ZBMJTIYR.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
|
|
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:
|
|
3
|
+
import{r as E}from"./chunk-V6GWPR2A.js";import{aa as O}from"./chunk-ZBMJTIYR.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
|
+
`)).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) {
|
|
7
7
|
ObjC.import('AppKit')
|
|
@@ -25,11 +25,12 @@ JSON.stringify({ types: ObjC.deepUnwrap(pb.types) || [], count: Number(pb.change
|
|
|
25
25
|
const read = (p) => $.NSString.stringWithContentsOfFileEncodingError(p, $.NSUTF8StringEncoding, null)
|
|
26
26
|
const item = $.NSPasteboardItem.alloc.init
|
|
27
27
|
item.setStringForType(read(argv[0]), 'public.utf8-plain-text')
|
|
28
|
-
|
|
28
|
+
// No HTML given: plain text only, so no app pastes an empty page instead.
|
|
29
|
+
if (argv.length > 1) item.setStringForType(read(argv[1]), 'public.html')
|
|
29
30
|
pb.clearContents
|
|
30
31
|
pb.writeObjects($.NSArray.arrayWithObject(item))
|
|
31
32
|
return JSON.stringify({ count: Number(pb.changeCount) })
|
|
32
|
-
}`;function Q(t=U){let e=S.darwin,
|
|
33
|
+
}`;function Q(t=U){let e=S.darwin,u=async()=>{try{let{types:i,count:s}=JSON.parse(await t(X,[]));return{changeCount:s,image:_(i,e)?.type??null,text:h(i,e)}}catch{return I}};return{peek:u,async read(i){let{image:s}=await u(),n=e.images.find(g=>g.type===s);if(!n)return null;await k(i,{recursive:!0});let r=m(i,`Copied image.${n.ext}`),a=JSON.parse(await t(K,[n.type,r]));return!a.ok||a.count===void 0?null:n.format!=="tiff"?{path:r,changeCount:a.count}:{path:await L(r,i),changeCount:a.count}},async write(i,s){let{count:n}=JSON.parse(await t(q,[i,Y(s)]));return n},async writeText(i,s){let n=await P(m(T(),"forge-text-"));try{let r=m(n,"text.txt"),a=m(n,"text.html");await $(r,i,"utf8"),s!==""&&await $(a,s,"utf8");let g=s===""?[r]:[r,a],{count:c}=JSON.parse(await t(z,g));return c}finally{await w(n,{recursive:!0,force:!0})}}}}function R(t,e,u){return new Promise((i,s)=>{F(t,e,{...u,encoding:"buffer"},(n,r)=>n?s(n):i(r))})}var V=async(t,e)=>(await R("powershell.exe",["-NoProfile","-NonInteractive","-STA","-EncodedCommand",Buffer.from(t,"utf16le").toString("base64")],{env:{...process.env,...e},timeout:15e3,windowsHide:!0})).toString("utf8").trim(),Z=`$ErrorActionPreference = 'Stop'
|
|
33
34
|
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
34
35
|
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
|
|
35
36
|
$data = [Windows.Forms.Clipboard]::GetDataObject()
|
|
@@ -76,5 +77,5 @@ $data.SetFileDropList($files)
|
|
|
76
77
|
[Windows.Forms.Clipboard]::SetDataObject($data, $true)`,et=`$ErrorActionPreference = 'Stop'
|
|
77
78
|
Add-Type -AssemblyName System.Windows.Forms
|
|
78
79
|
$text = [IO.File]::ReadAllText($env:FORGE_CLIP_TEXT, [Text.Encoding]::UTF8)
|
|
79
|
-
[Windows.Forms.Clipboard]::SetText($text)`;function nt(t){return Array.isArray(t)?t.map(String):typeof t=="string"?[t]:[]}function rt(t=V){let e=S.win32,
|
|
80
|
-
`).map(o=>o.trim()).filter(o=>o!=="")}catch(
|
|
80
|
+
[Windows.Forms.Clipboard]::SetText($text)`;function nt(t){return Array.isArray(t)?t.map(String):typeof t=="string"?[t]:[]}function rt(t=V){let e=S.win32,u={FORGE_CLIP_ORDER:e.images.map(n=>n.type).join("|"),FORGE_CLIP_FILE:e.file,FORGE_CLIP_STAND_IN:e.standIn??""},i=async n=>{let r=JSON.parse(await t(Z,{...u,...n===void 0?{}:{FORGE_CLIP_PATH:n}})),a=nt(r.types),g=typeof r.image=="string"&&r.image!==""?r.image:null;return{types:a,image:g,digest:typeof r.digest=="string"?r.digest:""}},s=async()=>{try{let n=await i();return{changeCount:y(n.types,n.digest),image:n.image,text:h(n.types,e)}}catch{return I}};return{peek:s,async read(n){await k(n,{recursive:!0});let r=m(n,".Copied image.part"),a=await i(r),g=e.images.find(p=>p.type===a.image);if(!g)return await w(r,{force:!0}),null;let c=m(n,`Copied image.${g.ext}`);return await A(r,c),{path:c,changeCount:y(a.types,a.digest)}},async write(n,r){let a=e.images.filter(g=>g.format===r&&g.type!==e.standIn);return await t(tt,{FORGE_CLIP_PATH:n,FORGE_CLIP_TYPES:(a.length>0?a.map(g=>g.type):[`image/${r}`]).join("|")}),(await s()).changeCount},async writeText(n){let r=await P(m(T(),"forge-text-"));try{let a=m(r,"text.txt");return await $(a,n,"utf8"),await t(et,{FORGE_CLIP_TEXT:a}),(await s()).changeCount}finally{await w(r,{recursive:!0,force:!0})}}}}var it={run(t,e){return R(t,e,{maxBuffer:512*1024*1024,timeout:5e3})},async copy(t,e,u){let i=await D(u,"r");try{await new Promise((s,n)=>{let r=W(t,e,{stdio:[i.fd,"ignore","ignore"],detached:!0});r.on("error",n),r.on("exit",a=>a===0?s():n(new Error(`${t} exited with ${a}`)))})}finally{await i.close()}}},at={name:"wayland",tool:"wl-clipboard",types:["wl-paste",["--list-types"]],read:t=>["wl-paste",["--type",t]],write:t=>["wl-copy",["--type",t]]},ot={name:"x11",tool:"xclip",types:["xclip",["-selection","clipboard","-t","TARGETS","-o"]],read:t=>["xclip",["-selection","clipboard","-t",t,"-o"]],write:t=>["xclip",["-selection","clipboard","-t",t,"-i"]]};function j(t=process.env){return[...t.WAYLAND_DISPLAY?[at]:[],...t.DISPLAY?[ot]:[]]}var st=40,ct=50;function C(t){return t?.code==="ENOENT"}function pt(t=process.env,e=it){let u=S.linux,i=j(t),s,n=async c=>{if(s)return c(s);for(let p of i)try{let o=await c(p);return s=p,o}catch(o){if(!C(o))throw s=p,o}throw O(i[0]?.tool??"xclip")},r=async c=>{try{return(await e.run(...c.types)).toString("utf8").split(`
|
|
81
|
+
`).map(o=>o.trim()).filter(o=>o!=="")}catch(p){if(C(p))throw p;return[]}},a=c=>n(async p=>{let o=await r(p),l=_(o,u),f=l&&c?await e.run(...p.read(l.type)):void 0;return{types:o,image:l,bytes:f}}),g=async()=>{try{let{types:c,image:p,bytes:o}=await a(!0);return{changeCount:y(c,o?x(o):""),image:p?.type??null,text:h(c,u)}}catch{return I}};return{peek:g,async read(c){let{types:p,image:o,bytes:l}=await a(!0);if(!o||!l||l.length===0)return null;let f=m(c,`Copied image.${o.ext}`);await E(f,l);let d=y(p,x(l));return o.format!=="tiff"?{path:f,changeCount:d}:{path:await L(f,c),changeCount:d}},async write(c,p){let o=u.images.find(d=>d.format===p)?.type??`image/${p}`;await n(d=>e.copy(...d.write(o),c));let l=x(await J(c)),f=-1;for(let d=0;d<st;d++){let b=await a(!0).catch(()=>null),N=b?.bytes?x(b.bytes):"";if(b&&(f=y(b.types,N)),N===l)return f;await new Promise(G=>setTimeout(G,ct))}return f},async writeText(c){let p=await P(m(T(),"forge-text-"));try{let o=m(p,"text.txt");return await $(o,c,"utf8"),await n(l=>e.copy(...l.write(l.name==="x11"?"UTF8_STRING":"text/plain;charset=utf-8"),o)),(await g()).changeCount}finally{await w(p,{recursive:!0,force:!0})}}}}function xt(t=process.platform,e=process.env){return t==="win32"?rt():t==="linux"?pt(e):Q()}export{bt as a,j as b,xt as c};
|
|
@@ -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 ie,d as ue,e as pe,g as ce,h as de}from"./chunk-
|
|
4
|
-
`),r.close()}}function Ae(e){return e.kind==="preset"?e.name:e.kind==="pageop"?"PDF":e.kind==="compress"?"Compress":e.kind==="convert"?"Convert":"Edit"}function A(e){return e.length===0?0:e.some(t=>t.error.code==="invalid-arguments")?2:1}function De(e,t){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=t.find(n=>n.kind==="document"),o=r?.pages??0,s=e.split;if(!s)throw N("--split needs a mode: every-page, every=N or at=N,N.");if(s.mode==="every-page")return{cuts:ie(o)};if(s.mode==="every-n")return{cuts:ue(o,s.n)};let a=Math.max(o-1,0);for(let n of s.after)if(!Number.isInteger(n)||n<1||n>a)throw V(String(n),`"${n}" is outside 1 and ${a} \u2014 ${r?w(r.path):"the document"} has ${o} pages.`,o);return{cuts:s.after.map(n=>n-1)}}function We(e,t){let r;return()=>t?(r??=Fe({stdin:e}).then(o=>e&&o===""?void 0:o),r):Promise.resolve(void 0)}async function ze(e,t,r,o){let s;if(e.encrypted){if(s=t.password??await r(),s===void 0)return{failure:{path:e.path,error:J(e.path)}};let i;try{i=await Z(await Te(e.path),s)}catch{return{failure:{path:e.path,error:J(e.path,{attempted:!0})}}}i.destroy()}let a;try{a=O.plan([e],{target:t.target,background:t.options.background,keepMetadata:t.options.keepMetadata,dpi:String(t.dpi??150),...t.options.quality===void 0?{}:{quality:t.options.quality},...t.pages===void 0?{}:{pages:t.pages},...t.output===void 0?{}:{destination:t.output},...o===void 0?{}:{sourceRoot:o}})}catch(i){if(!P(i))throw i;return{failure:{path:e.path,error:i}}}let n=a[0];if(n?.op!=="convert")throw new Error(`convertAction.plan() did not return a convert job for ${e.path}`);return s!==void 0&&(n.options.password=s),{job:n}}function S(e,t){return r=>{if(r.type==="search:attempt"){t||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"){t&&e.onSearch?.(`${r.completed} of ${r.total} searched`);return}if(!t&&r.type==="job:phase"&&r.progress.phase==="time"){let o=r.progress,s=`${$(o.done)} of ${$(o.total)}`;e.onEncode?.(o.pass?`pass ${o.pass.at} of ${o.pass.of} \xB7 ${s}`:s);return}t&&(r.type==="job:done"||r.type==="job:error")&&e.onProgress?.({completed:r.completed,total:r.total})}}var b=(e,t)=>({kind:e,results:[],failures:t,inputBytes:0,outputBytes:0});async function qe(e){let t=await y(e.inputs,{recursive:!1});if(t.sources.length===0)return b("pageop",t.failures);let r=pe.find(n=>n.id===e.action);if(!r)throw new Error(`no action registered for "${e.action}"`);let o=t.sources[0]?.path??"";if(!r.appliesTo(t.sources)){let n=de(r,t.sources)??"not available for these files";return b("pageop",[...t.failures,{path:o,error:k(e.action,n)}])}let s;try{s=r.plan(t.sources,De(e,t.sources))}catch(n){if(!P(n))throw n;return b("pageop",[...t.failures,{path:o,error:n}])}let a=await I(s,{force:e.force});return{kind:"pageop",results:a.results,failures:[...t.failures,...a.refusals,...a.failures],inputBytes:a.inputBytes,outputBytes:a.outputBytes}}async function Ve(e,t){let r=await y(e.inputs,{recursive:e.recursive}),o=[],s=[];for(let i of r.sources){if(!M.appliesTo([i])){s.push({path:i.path,error:z(i)});continue}let u=e.output!==void 0&&!Y(e.output)?Me(e.output):void 0,p=e.output===void 0||u!==void 0?Oe(i.path):Oe(E({sourcePath:i.path,target:i.format,output:e.output,sourceRoot:r.roots.get(i.path)})),[f]=M.plan([i],{mode:e.maxBytes===void 0?"quality":"size",...e.quality===void 0?{}:{quality:e.quality},...e.options.media??{},destination:p});f?.op==="convert"&&(u!==void 0&&(f.outputs=[u]),e.dpi!==void 0&&(f.options.dpi=e.dpi),o.push(f))}let a=o.length>1;a&&t.onProgress?.({completed:0,total:o.length});let n=await I(o,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(t,a)});return{kind:"compress",results:n.results,failures:[...r.failures,...s,...n.refusals,...n.unreachable.map(i=>({path:i.job.sources[0].path,error:i.error})),...n.failures],inputBytes:n.inputBytes,outputBytes:n.outputBytes}}async function Ge(e,t){let r=e.kind,o=e.op==="remove-background"?L(e.target):void 0;if(o)return b(r,[{path:"",error:o}]);let{installed:s}=await import("./paths-6OENILJ4.js"),a=await s(e.op);if(!a)return b(r,[{path:"",error:G(e.op)}]);if(e.op==="boost"&&e.scale!==void 0){let{assetFor:l,catalogEntry:c}=await import("./catalog-FMHWWMUX.js"),m=c("boost"),v=m&&l(m)?.version,D=U(e.scale,a.version,v);if(D)return b(r,[{path:"",error:D}])}let n=await y(e.inputs,{recursive:e.recursive}),i=e.op==="boost"?oe:se,u=[],p=[];for(let l of n.sources){if(!i.appliesTo([l])){p.push({path:l.path,error:k(e.op,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});continue}let c=te(l,e.target);if(c){p.push({path:l.path,error:c});continue}u.push(...i.plan([l],{target:e.target,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.scale===void 0?{}:{scale:e.scale},...e.options.quality===void 0?{}:{quality:e.options.quality},...e.output===void 0?{}:{output:e.output},roots:n.roots}))}let f=u.length>1;f&&t.onProgress?.({completed:0,total:u.length});let d=await I(u,{force:e.force,concurrency:1,...t.signal===void 0?{}:{signal:t.signal},onEvent:S(t,f)});return{kind:r,results:d.results,failures:[...n.failures,...p,...d.refusals,...d.failures],inputBytes:d.inputBytes,outputBytes:d.outputBytes}}async function He(e,t){let r=e.crop!==void 0?"crop":e.resize!==void 0?"resize":"trim",o=e.target===void 0?void 0:be(e.target,r);if(o)return b(e.kind,[{path:"",error:o}]);let s=await y(e.inputs,{recursive:e.recursive}),a=[],n=[],i=[];for(let c of s.sources)c.kind==="image"&&e.media===void 0?a.push(c):c.kind==="media"&&!e.trim?n.push(c):c.kind==="image"?i.push({path:c.path,error:k("cut","it works on video and sound, not images","Try a video or sound file, such as a MOV, MP4 or WAV.")}):i.push({path:c.path,error:k(r,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});let u=ne(n,{...e.media===void 0?{}:{media:e.media},...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots}),f=[...ae(a,{trim:e.trim,...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.options.quality===void 0?{}:{quality:e.options.quality}}),...u],d=f.length>1;d&&t.onProgress?.({completed:0,total:f.length});let l=await I(f,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},onEvent:S(t,d)});return{kind:e.kind,results:l.results,failures:[...s.failures,...i,...l.refusals,...l.failures],inputBytes:l.inputBytes,outputBytes:l.outputBytes}}async function Le(e,t){let r=await y(e.inputs,{recursive:e.recursive}),o=m=>m.kind==="document"&&m.format==="pdf",s=F(e.target),a=s?r.sources.filter(o):[],n=s?r.sources.filter(m=>!o(m)):r.sources,i=[],u=[],p=We(e.passwordStdin??!1,t.interactive??!0);for(let m of a){let v=await ze(m,e,p,r.roots.get(m.path));"failure"in v?u.push(v.failure):i.push(v.job)}let f=await we({resolved:{sources:n,failures:[],roots:r.roots},target:e.target,options:e.options,force:e.force,...e.output===void 0?{}:{output:e.output}}),d=[...f.jobs,...i],l=d.length>1;l&&t.onProgress?.({completed:0,total:d.length});let c=await I(d,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(t,l)});return{kind:"convert",results:c.results,failures:[...r.failures,...u,...f.failures,...c.refusals,...c.unreachable.map(m=>({path:m.job.sources[0].path,error:m.error})),...c.failures],inputBytes:c.inputBytes,outputBytes:c.outputBytes}}async function Ue(e,t={}){try{if(e.kind==="pageop")return await qe(e);if(e.kind==="extension-op")return await Ge(e,t);if(e.kind==="edit")return await He(e,t);if(e.kind==="preset"){let{runPresetCommand:r}=await import("./preset-command-M7SESD5C.js");return await r(e)}return e.kind==="compress"?await Ve(e,t):await Le(e,t)}catch(r){if(!P(r))throw r;return b(e.kind,[{path:"",error:r}])}}function Ye(e,t){let r=A(e.failures);if(t.json)return{exitCode:r,stdout:[JSON.stringify(fe(g,e))],stderr:[]};let o=e.results.length===0?[]:e.kind==="pageop"?$e(e):e.results.length===1?Pe(e):ke(e);return{exitCode:r,stdout:o,stderr:B(e.failures,{debug:t.debug})}}function Ke(e,t){let r=[{path:"",error:e}],o=A(r);return t.json?{exitCode:o,stdout:[JSON.stringify(le(g,e))],stderr:[]}:{exitCode:o,stdout:[],stderr:B(r,{debug:t.debug})}}async function Qe(e,t){let{runConfig:r}=await import("./config-command-CKPJXJEE.js"),o=await r(e);return t?{exitCode:0,stdout:[JSON.stringify(he(g,o.config,o.warnings))],stderr:[]}:{exitCode:0,stdout:o.stdout,stderr:[]}}async function zr(e,t={}){let r=t.json??!1,o="debug"in e?e.debug:!1;try{if(e.kind==="config")return await Qe(e,r);if(e.kind==="clip"){let{runClipCommand:n}=await import("./clip-command-3JBZK6Q3.js");return await n(e,{...t,json:r,debug:o})}if(e.kind==="update"){let{runUpdate:n}=await import("./update-command-DWEBUFT5.js"),i=await n(g,{...t.onInstalling?{onInstalling:t.onInstalling}:{}});return{exitCode:0,stdout:r?[JSON.stringify({forge:g,ok:!0,...i.data})]:i.stdout,stderr:[]}}if(e.kind==="uninstall"){let{runUninstall:n}=await import("./entry-64GTSHV2.js"),i=[];return{exitCode:await n(g,p=>i.push(p)),stdout:i,stderr:[]}}if(e.kind==="extensions"){let{runExtensions:n}=await import("./extensions-command-FV3N7CBV.js"),i=await n(e,{onDownload:t.onDownload});return{exitCode:0,stdout:r?[JSON.stringify(ye(g,i.data))]:i.stdout,stderr:[]}}if(e.kind==="formats")return r?{exitCode:0,stdout:[JSON.stringify(me(g,re()))],stderr:[]}:{exitCode:0,stdout:Re(),stderr:[]};if(e.kind==="probe"){let{probes:n,failures:i}=await Ie(e.inputs),u=A(i);return r?{exitCode:u,stdout:[JSON.stringify(ge(g,{probes:n,failures:i}))],stderr:[]}:{exitCode:u,stdout:n.flatMap((p,f)=>[...f>0?[""]:[],...Ee(p)]),stderr:B(i,{debug:o})}}if(e.kind==="palette"||e.kind==="scale"||e.kind==="card"){let{runCard:n,runPalette:i,runScale:u}=await import("./colour-CEKEW7RV.js"),p={json:r,colour:t.colour??!1};return e.kind==="card"?await n(e,p):e.kind==="palette"?await i(e,p):await u(e,p)}if(e.kind==="transcribe"){let{runTranscribeCommand:n}=await import("./transcribe-command-Y3AHXLVA.js"),i=[],u=[],p;return{exitCode:await n(e,{out:d=>i.push(d),err:d=>u.push(d),finished:d=>{p=T("Transcribe",d)}}),stdout:i,stderr:u,...p?{notice:p}:{}}}if(e.kind==="shell")return{exitCode:0,stdout:[],stderr:[]};if(e.kind==="watch")throw N("forge watch runs in a terminal until ctrl-c.","Try: forge watch ./images --to webp");let s=await Ue(e,t),a=T(Ae(e),X(s.results,s.failures));return{...Ye(s,{json:r,debug:o}),...a?{notice:a}:{}}}catch(s){if(!P(s))throw s;return Ke(s,{json:r,debug:o})}}export{Ie as a,xe as b,A as c,Ue as d,Ye as e,zr as f};
|
|
3
|
+
import{c as ie,d as ue,e as pe,g as ce,h as de}from"./chunk-TJ5YBJEO.js";import{a as te,b as oe,c as se,k as ne,m as M,n as O,s as ae}from"./chunk-FEFNS6YZ.js";import{b as X,c as T}from"./chunk-6RMRWBMB.js";import{a as y}from"./chunk-H3KW7HTC.js";import{b as I}from"./chunk-NUW4YOJ6.js";import{e as be}from"./chunk-DHW72U6X.js";import{a as C,c as _,d as ee,e as F,f as re}from"./chunk-KTCHWHQB.js";import{f as fe,g as le,h as me,i as ge,j as he,k as ye}from"./chunk-YJ6XLDRA.js";import{a as g}from"./chunk-4OSMYHKQ.js";import{d as $}from"./chunk-EEQSUBBL.js";import{a as Z}from"./chunk-FAUL5L2W.js";import{a as L,d as U}from"./chunk-TLHUFIXD.js";import{a as Y,c as K,d as E,e as Q}from"./chunk-V6GWPR2A.js";import{G as N,H as V,K as G,a as P,q as z,s as k,u as q,va as H,x as J}from"./chunk-ZBMJTIYR.js";import{a as h,b as W}from"./chunk-J7FLFHQJ.js";import{b as x,c as w}from"./chunk-VLVNA4T3.js";import{a as R}from"./chunk-H3DIRJFE.js";import{readFile as Te}from"node:fs/promises";import{dirname as Oe,resolve as Me}from"node:path";async function we(e){let t=[],r=[...e.resolved.failures];for(let o of e.resolved.sources){let s=C(o);if(!s.includes(e.target)){r.push({path:o.path,error:q(o,e.target,s)});continue}let a={sourcePath:o.path,target:e.target,output:e.output,sourceRoot:e.resolved.roots.get(o.path)},n=E(a);K(n,o.path)&&e.target!==o.format&&(n=Q({...a,suffix:e.target})),t.push({op:"convert",sources:[o],outputs:[n],target:e.target,options:e.options})}return{jobs:t,failures:r}}import{resolve as je}from"node:path";function Be(e,t=new Set){let r={path:je(e.path),kind:e.kind,format:e.format,bytes:e.bytes},o=e.kind==="document"&&e.encrypted===!0,s={targets:C(e).filter(a=>!o||F(a)),actions:ce([e],t).filter(a=>!o||a.id===O.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,pages:e.pages,encrypted:e.encrypted,...s}}async function Ie(e){let t=await y(e,{recursive:!1}),{installedExtensionIds:r}=await import("./available-TNMISSBA.js"),o=await r();return{probes:t.sources.map(s=>Be(s,o)),failures:t.failures}}import{dirname as Se}from"node:path";var j=e=>({cwd:e.cwd??process.cwd(),...e.home===void 0?{}:{home:e.home}});function ve(e,t){let r=x(Se(e),j(t));return r==="."?"":` in ${r.endsWith("/")?r:`${r}/`}`}function xe(e,t){let{pct:r,direction:o}=W(e,t);return o==="same"?"same size":`${r}% ${o}`}function Pe(e,t={}){let r=e.results[0];if(!r)return[];let o=r.job.sources[0],s=r.job.outputs;if(s.length>1){let n=[`\u2713 ${w(o.path)} \u2192 ${s.length} files${ve(s[0],t)}`,` ${s.map(i=>w(i)).join(", ")}`,` ${h(o.bytes)} \u2192 ${h(r.outputBytes)} total`];for(let i of r.warnings)n.push("",`\u26A0 ${i.message}`);return n}let a=[`\u2713 ${w(o.path)} \u2192 ${x(s[0],j(t))}`,` ${h(o.bytes)} \u2192 ${h(r.outputBytes)} \xB7 ${xe(o.bytes,r.outputBytes)}`];for(let n of r.warnings)a.push("",`\u26A0 ${n.message}`);return a}function ke(e,t={}){let r=[`\u2713 ${e.results.length} converted`,` ${h(e.inputBytes)} \u2192 ${h(e.outputBytes)} \xB7 ${xe(e.inputBytes,e.outputBytes)}`];for(let s of e.results)for(let a of s.job.outputs)r.push(` ${x(a,j(t))}`);let o=e.results.flatMap(s=>s.warnings);if(o.length>0){r.push("");for(let s of o)r.push(`\u26A0 ${s.message}`)}return r}function $e(e,t={}){let r=e.results.flatMap(u=>u.job.outputs),o=r.map(u=>w(u)).join(", "),s=r.length===1?"file":"files",a=r[0]===void 0?"":ve(r[0],t),n=[`\u2713 ${r.length} ${s} \xB7 ${o}${a}`],i=e.results.flatMap(u=>u.warnings);for(let u of i)n.push("",`\u26A0 ${u.message}`);return n}function B(e,t){if(e.length===0)return[];let r=[];for(let o of e)r.push(...H(o.error,{debug:t.debug}),"");return r}function Re(){let e=new Set(_()),t=new Set(ee()),r=["Formats",""];for(let s of e){let a=R[s],n=t.has(s)?"read and write":"read only";r.push(` ${a.label.padEnd(6)} ${a.extensions.join(" ").padEnd(12)} ${n}`)}let o=[...e].filter(s=>!t.has(s)).map(s=>R[s].label);if(o.length>0){let s=o.join(", "),[a,n]=o.length===1?["is","it"]:["are","them"];r.push("",`${s} ${a} read only because Forge cannot yet write ${n}.`)}return r}function Ee(e,t={}){let r=[R[e.format].label,h(e.bytes)];return e.duration!==void 0&&r.push($(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,j(t))} \xB7 ${r.join(" \xB7 ")}`,` converts to ${e.targets.join(", ")}`,` actions ${e.actions.join(", ")}`]}import{createInterface as Ce}from"node:readline";import{PassThrough as Je}from"node:stream";function Ne(e){return new Promise(t=>{let r=Ce({input:e,terminal:!1}),o=!1,s=a=>{if(o)return;o=!0,r.close(),e.pause(),e.unref?.(),t(a.replace(/\r$/,""))};r.once("line",s),r.once("close",()=>s(""))})}async function Fe(e){if(e.stdin)return Ne(process.stdin);if(!process.stdin.isTTY)return;let t=new Je,r=Ce({input:process.stdin,output:t,terminal:!0});try{return process.stderr.write("Password: "),await new Promise(o=>r.question("",o))}finally{process.stderr.write(`
|
|
4
|
+
`),r.close()}}function Ae(e){return e.kind==="preset"?e.name:e.kind==="pageop"?"PDF":e.kind==="compress"?"Compress":e.kind==="convert"?"Convert":"Edit"}function A(e){return e.length===0?0:e.some(t=>t.error.code==="invalid-arguments")?2:1}function De(e,t){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=t.find(n=>n.kind==="document"),o=r?.pages??0,s=e.split;if(!s)throw N("--split needs a mode: every-page, every=N or at=N,N.");if(s.mode==="every-page")return{cuts:ie(o)};if(s.mode==="every-n")return{cuts:ue(o,s.n)};let a=Math.max(o-1,0);for(let n of s.after)if(!Number.isInteger(n)||n<1||n>a)throw V(String(n),`"${n}" is outside 1 and ${a} \u2014 ${r?w(r.path):"the document"} has ${o} pages.`,o);return{cuts:s.after.map(n=>n-1)}}function We(e,t){let r;return()=>t?(r??=Fe({stdin:e}).then(o=>e&&o===""?void 0:o),r):Promise.resolve(void 0)}async function ze(e,t,r,o){let s;if(e.encrypted){if(s=t.password??await r(),s===void 0)return{failure:{path:e.path,error:J(e.path)}};let i;try{i=await Z(await Te(e.path),s)}catch{return{failure:{path:e.path,error:J(e.path,{attempted:!0})}}}i.destroy()}let a;try{a=O.plan([e],{target:t.target,background:t.options.background,keepMetadata:t.options.keepMetadata,dpi:String(t.dpi??150),...t.options.quality===void 0?{}:{quality:t.options.quality},...t.pages===void 0?{}:{pages:t.pages},...t.output===void 0?{}:{destination:t.output},...o===void 0?{}:{sourceRoot:o}})}catch(i){if(!P(i))throw i;return{failure:{path:e.path,error:i}}}let n=a[0];if(n?.op!=="convert")throw new Error(`convertAction.plan() did not return a convert job for ${e.path}`);return s!==void 0&&(n.options.password=s),{job:n}}function S(e,t){return r=>{if(r.type==="search:attempt"){t||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"){t&&e.onSearch?.(`${r.completed} of ${r.total} searched`);return}if(!t&&r.type==="job:phase"&&r.progress.phase==="time"){let o=r.progress,s=`${$(o.done)} of ${$(o.total)}`;e.onEncode?.(o.pass?`pass ${o.pass.at} of ${o.pass.of} \xB7 ${s}`:s);return}t&&(r.type==="job:done"||r.type==="job:error")&&e.onProgress?.({completed:r.completed,total:r.total})}}var b=(e,t)=>({kind:e,results:[],failures:t,inputBytes:0,outputBytes:0});async function qe(e){let t=await y(e.inputs,{recursive:!1});if(t.sources.length===0)return b("pageop",t.failures);let r=pe.find(n=>n.id===e.action);if(!r)throw new Error(`no action registered for "${e.action}"`);let o=t.sources[0]?.path??"";if(!r.appliesTo(t.sources)){let n=de(r,t.sources)??"not available for these files";return b("pageop",[...t.failures,{path:o,error:k(e.action,n)}])}let s;try{s=r.plan(t.sources,De(e,t.sources))}catch(n){if(!P(n))throw n;return b("pageop",[...t.failures,{path:o,error:n}])}let a=await I(s,{force:e.force});return{kind:"pageop",results:a.results,failures:[...t.failures,...a.refusals,...a.failures],inputBytes:a.inputBytes,outputBytes:a.outputBytes}}async function Ve(e,t){let r=await y(e.inputs,{recursive:e.recursive}),o=[],s=[];for(let i of r.sources){if(!M.appliesTo([i])){s.push({path:i.path,error:z(i)});continue}let u=e.output!==void 0&&!Y(e.output)?Me(e.output):void 0,p=e.output===void 0||u!==void 0?Oe(i.path):Oe(E({sourcePath:i.path,target:i.format,output:e.output,sourceRoot:r.roots.get(i.path)})),[f]=M.plan([i],{mode:e.maxBytes===void 0?"quality":"size",...e.quality===void 0?{}:{quality:e.quality},...e.options.media??{},destination:p});f?.op==="convert"&&(u!==void 0&&(f.outputs=[u]),e.dpi!==void 0&&(f.options.dpi=e.dpi),o.push(f))}let a=o.length>1;a&&t.onProgress?.({completed:0,total:o.length});let n=await I(o,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(t,a)});return{kind:"compress",results:n.results,failures:[...r.failures,...s,...n.refusals,...n.unreachable.map(i=>({path:i.job.sources[0].path,error:i.error})),...n.failures],inputBytes:n.inputBytes,outputBytes:n.outputBytes}}async function Ge(e,t){let r=e.kind,o=e.op==="remove-background"?L(e.target):void 0;if(o)return b(r,[{path:"",error:o}]);let{installed:s}=await import("./paths-6OENILJ4.js"),a=await s(e.op);if(!a)return b(r,[{path:"",error:G(e.op)}]);if(e.op==="boost"&&e.scale!==void 0){let{assetFor:l,catalogEntry:c}=await import("./catalog-FMHWWMUX.js"),m=c("boost"),v=m&&l(m)?.version,D=U(e.scale,a.version,v);if(D)return b(r,[{path:"",error:D}])}let n=await y(e.inputs,{recursive:e.recursive}),i=e.op==="boost"?oe:se,u=[],p=[];for(let l of n.sources){if(!i.appliesTo([l])){p.push({path:l.path,error:k(e.op,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});continue}let c=te(l,e.target);if(c){p.push({path:l.path,error:c});continue}u.push(...i.plan([l],{target:e.target,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.scale===void 0?{}:{scale:e.scale},...e.options.quality===void 0?{}:{quality:e.options.quality},...e.output===void 0?{}:{output:e.output},roots:n.roots}))}let f=u.length>1;f&&t.onProgress?.({completed:0,total:u.length});let d=await I(u,{force:e.force,concurrency:1,...t.signal===void 0?{}:{signal:t.signal},onEvent:S(t,f)});return{kind:r,results:d.results,failures:[...n.failures,...p,...d.refusals,...d.failures],inputBytes:d.inputBytes,outputBytes:d.outputBytes}}async function He(e,t){let r=e.crop!==void 0?"crop":e.resize!==void 0?"resize":"trim",o=e.target===void 0?void 0:be(e.target,r);if(o)return b(e.kind,[{path:"",error:o}]);let s=await y(e.inputs,{recursive:e.recursive}),a=[],n=[],i=[];for(let c of s.sources)c.kind==="image"&&e.media===void 0?a.push(c):c.kind==="media"&&!e.trim?n.push(c):c.kind==="image"?i.push({path:c.path,error:k("cut","it works on video and sound, not images","Try a video or sound file, such as a MOV, MP4 or WAV.")}):i.push({path:c.path,error:k(r,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});let u=ne(n,{...e.media===void 0?{}:{media:e.media},...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots}),f=[...ae(a,{trim:e.trim,...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.options.quality===void 0?{}:{quality:e.options.quality}}),...u],d=f.length>1;d&&t.onProgress?.({completed:0,total:f.length});let l=await I(f,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},onEvent:S(t,d)});return{kind:e.kind,results:l.results,failures:[...s.failures,...i,...l.refusals,...l.failures],inputBytes:l.inputBytes,outputBytes:l.outputBytes}}async function Le(e,t){let r=await y(e.inputs,{recursive:e.recursive}),o=m=>m.kind==="document"&&m.format==="pdf",s=F(e.target),a=s?r.sources.filter(o):[],n=s?r.sources.filter(m=>!o(m)):r.sources,i=[],u=[],p=We(e.passwordStdin??!1,t.interactive??!0);for(let m of a){let v=await ze(m,e,p,r.roots.get(m.path));"failure"in v?u.push(v.failure):i.push(v.job)}let f=await we({resolved:{sources:n,failures:[],roots:r.roots},target:e.target,options:e.options,force:e.force,...e.output===void 0?{}:{output:e.output}}),d=[...f.jobs,...i],l=d.length>1;l&&t.onProgress?.({completed:0,total:d.length});let c=await I(d,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(t,l)});return{kind:"convert",results:c.results,failures:[...r.failures,...u,...f.failures,...c.refusals,...c.unreachable.map(m=>({path:m.job.sources[0].path,error:m.error})),...c.failures],inputBytes:c.inputBytes,outputBytes:c.outputBytes}}async function Ue(e,t={}){try{if(e.kind==="pageop")return await qe(e);if(e.kind==="extension-op")return await Ge(e,t);if(e.kind==="edit")return await He(e,t);if(e.kind==="preset"){let{runPresetCommand:r}=await import("./preset-command-3ILRQZSJ.js");return await r(e)}return e.kind==="compress"?await Ve(e,t):await Le(e,t)}catch(r){if(!P(r))throw r;return b(e.kind,[{path:"",error:r}])}}function Ye(e,t){let r=A(e.failures);if(t.json)return{exitCode:r,stdout:[JSON.stringify(fe(g,e))],stderr:[]};let o=e.results.length===0?[]:e.kind==="pageop"?$e(e):e.results.length===1?Pe(e):ke(e);return{exitCode:r,stdout:o,stderr:B(e.failures,{debug:t.debug})}}function Ke(e,t){let r=[{path:"",error:e}],o=A(r);return t.json?{exitCode:o,stdout:[JSON.stringify(le(g,e))],stderr:[]}:{exitCode:o,stdout:[],stderr:B(r,{debug:t.debug})}}async function Qe(e,t){let{runConfig:r}=await import("./config-command-CKPJXJEE.js"),o=await r(e);return t?{exitCode:0,stdout:[JSON.stringify(he(g,o.config,o.warnings))],stderr:[]}:{exitCode:0,stdout:o.stdout,stderr:[]}}async function zr(e,t={}){let r=t.json??!1,o="debug"in e?e.debug:!1;try{if(e.kind==="config")return await Qe(e,r);if(e.kind==="clip"){let{runClipCommand:n}=await import("./clip-command-QIMH2U7N.js");return await n(e,{...t,json:r,debug:o})}if(e.kind==="update"){let{runUpdate:n}=await import("./update-command-DWEBUFT5.js"),i=await n(g,{...t.onInstalling?{onInstalling:t.onInstalling}:{}});return{exitCode:0,stdout:r?[JSON.stringify({forge:g,ok:!0,...i.data})]:i.stdout,stderr:[]}}if(e.kind==="uninstall"){let{runUninstall:n}=await import("./entry-HGEJC7CZ.js"),i=[];return{exitCode:await n(g,p=>i.push(p)),stdout:i,stderr:[]}}if(e.kind==="extensions"){let{runExtensions:n}=await import("./extensions-command-65QEMN2L.js"),i=await n(e,{onDownload:t.onDownload});return{exitCode:0,stdout:r?[JSON.stringify(ye(g,i.data))]:i.stdout,stderr:[]}}if(e.kind==="formats")return r?{exitCode:0,stdout:[JSON.stringify(me(g,re()))],stderr:[]}:{exitCode:0,stdout:Re(),stderr:[]};if(e.kind==="probe"){let{probes:n,failures:i}=await Ie(e.inputs),u=A(i);return r?{exitCode:u,stdout:[JSON.stringify(ge(g,{probes:n,failures:i}))],stderr:[]}:{exitCode:u,stdout:n.flatMap((p,f)=>[...f>0?[""]:[],...Ee(p)]),stderr:B(i,{debug:o})}}if(e.kind==="palette"||e.kind==="scale"||e.kind==="card"){let{runCard:n,runPalette:i,runScale:u}=await import("./colour-3MFAFJNN.js"),p={json:r,colour:t.colour??!1};return e.kind==="card"?await n(e,p):e.kind==="palette"?await i(e,p):await u(e,p)}if(e.kind==="transcribe"){let{runTranscribeCommand:n}=await import("./transcribe-command-PAHSXMWG.js"),i=[],u=[],p;return{exitCode:await n(e,{out:d=>i.push(d),err:d=>u.push(d),finished:d=>{p=T("Transcribe",d)}}),stdout:i,stderr:u,...p?{notice:p}:{}}}if(e.kind==="shell")return{exitCode:0,stdout:[],stderr:[]};if(e.kind==="watch")throw N("forge watch runs in a terminal until ctrl-c.","Try: forge watch ./images --to webp");let s=await Ue(e,t),a=T(Ae(e),X(s.results,s.failures));return{...Ye(s,{json:r,debug:o}),...a?{notice:a}:{}}}catch(s){if(!P(s))throw s;return Ke(s,{json:r,debug:o})}}export{Ie as a,xe as b,A as c,Ue as d,Ye as e,zr 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 h,c as A,g as o,m as y,n as I,t as v,u as O,v as P}from"./chunk-
|
|
3
|
+
import{b as h,c as A,g as o,m as y,n as I,t as v,u as O,v as P}from"./chunk-FEFNS6YZ.js";import{a as x,b as u,d as S}from"./chunk-RQWWUCGQ.js";import{g as s,h as f,j as g,k as b,l as c,m as a}from"./chunk-V6GWPR2A.js";import{G as d}from"./chunk-ZBMJTIYR.js";var l=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,k={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:e=>(l(e)?.pages??0)>1,unavailable:e=>l(e)===void 0?"one PDF at a time":"only one page",options(e){let t=l(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=l(e);if(!n)return[];let r=Array.isArray(t.cuts)?t.cuts:[],i=S(r,n.pages).length,C=c(f(n.path,i),o(t.destination),o(t.name));return[{op:"split",sources:[n],outputs:C,cuts:r}]}};function $(e){return Array.from({length:Math.max(0,e-1)},(t,n)=>n)}function B(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 p=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0;function D(e,t){return Array.isArray(t.pages)?u(t.pages):typeof t.pages=="string"?u(x(t.pages,e.pages)):[]}var w=e=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${e.pages}`}),T={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(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=p(e);if(!n)return[];let r=D(n,t),i=t.separate==="many";return[{op:"extract",sources:[n],outputs:c(g(n.path,r,i),o(t.destination),o(t.name)),pages:r,separate:i}]}},j={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(t)]:[]},plan(e,t){let n=p(e);return n?[{op:"delete",sources:[n],outputs:[a(s(n.path,"trimmed"),o(t.destination),o(t.name))],pages:D(n,t)}]:[]}};var m=e=>e.filter(t=>t.kind==="document"&&t.format==="pdf"),J={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:e=>m(e).length>=2&&m(e).length===e.length,unavailable:e=>m(e).length!==e.length?"PDFs only":"needs 2+ files",options:()=>[],plan(e,t){let n=a(b(e.map(r=>r.path)),o(t.destination),o(t.name));return[{op:"merge",sources:e,outputs:[n]}]}};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:()=>"one PDF at a time",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 i=Number(t.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[a(s(n.path,"rotated"),o(t.destination),o(t.name))],turns:i}]}};var R=[I,y,J,k,T,j,E,v,O,P],se=R.filter(e=>!["convert","compress","trim","resize","crop"].includes(e.id)),F=[h,A];function ce(e,t=new Set){return[...R,...F.filter(n=>n.requires&&t.has(n.requires))].filter(n=>n.appliesTo(e))}function le(e,t){return e.appliesTo(t)?void 0:e.unavailable?.(t)}export{E as a,k as b,$ as c,B as d,R as e,se as f,ce as g,le as h};
|
|
@@ -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 E}from"./chunk-O7DK3GJT.js";import{i as R}from"./chunk-
|
|
3
|
+
import{a as E}from"./chunk-O7DK3GJT.js";import{i as R}from"./chunk-RQWWUCGQ.js";import{a as F,ma as y}from"./chunk-ZBMJTIYR.js";function P(n=process.env){let r=Number(n.UV_THREADPOOL_SIZE),o=E();return Number.isInteger(r)&&r>0?Math.min(o,r):o}function w(n){let r=n!==void 0&&Number.isFinite(n)?n:void 0;return Math.max(1,r??P())}async function x(n,r,o,f){let b=[],l=[];for(let[i,u]of n.entries())(f?.(u)?l:b).push(i);let p=0,m=0,t,g=async()=>{for(;;){let i=b[p],u=t?void 0:l[m];if(i!==void 0&&(u===void 0||i<u))p++,await o(n[i],i);else if(u!==void 0)m++,t=o(n[u],u).finally(()=>{t=void 0}),await t;else if(t)await t;else return}},d=Math.min(w(r),n.length);await Promise.all(Array.from({length:d},g))}async function T(n,r){let o=r.onEvent??(()=>{}),f=r.engineFor??R,b=w(r.concurrency),l=n.length,p=[],m=[],t=0;await x(n,b,async(e,a)=>{if(r.signal?.aborted)return;o({type:"job:start",job:e,index:a,total:l});let h=f(e);if(!h){t++;let s=e.sources[0].path,c={path:s,error:y(s,new Error(`no engine runs ${e.op}`))};m[a]=c,o({type:"job:error",job:e,failure:c,completed:t,total:l});return}try{let s=await h.run(e,c=>o({type:"job:phase",job:e,progress:c}),r.signal);p[a]=s,t++,o({type:"job:done",job:e,result:s,completed:t,total:l})}catch(s){t++;let c=e.sources[0].path,J=F(s)?s:y(c,s),v={path:c,error:J};m[a]=v,o({type:"job:error",job:e,failure:v,completed:t,total:l})}},e=>f(e)?.alone===!0);let d=p.filter(e=>e!==void 0),i=m.filter(e=>e!==void 0),u={results:d,failures:i,inputBytes:d.reduce((e,a)=>e+a.job.sources[0].bytes,0),outputBytes:d.reduce((e,a)=>e+a.outputBytes,0)};return o({type:"batch:done",summary:u}),u}export{P as a,w as b,x as c,T as d};
|
|
@@ -2,5 +2,5 @@ import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
3
|
import{a as l,c}from"./chunk-MF3KKEFB.js";import{e as p,f as u}from"./chunk-I25E2XDH.js";import{execFile as P}from"node:child_process";import{access as N,constants as A,mkdir as I,readFile as E,realpath as _,writeFile as F}from"node:fs/promises";import{homedir as B}from"node:os";import{dirname as C,join as f,posix as R,sep as m,win32 as S}from"node:path";import{promisify as T}from"node:util";var w=T(P),H=["yt-dlp","video"],X=e=>H.includes(e),a={"yt-dlp":{binary:"yt-dlp",name:"yt-dlp",formula:"yt-dlp",versionArgs:["--version"],version:e=>e.trim().split(`
|
|
4
4
|
`)[0]?.match(/^\d+(\.\d+)+$/)?.[0]},video:{binary:"ffmpeg",name:"ffmpeg",formula:"ffmpeg",versionArgs:["-hide_banner","-version"],version:e=>e.match(/ffmpeg version (\S+)/)?.[1],beside:["ffprobe"]}},Y=e=>a[e].name,q=e=>a[e].formula;function $(e,n){let r=e.split(".").map(Number),i=n.split(".").map(Number);for(let t=0;t<Math.max(r.length,i.length);t++){let o=r[t]??0,s=i[t]??0;if(Number.isNaN(o)||Number.isNaN(s))return e>n;if(o!==s)return o>s}return!1}function g(e){let n=p(e);return n&&(u(n)?.version??u(n,"darwin","universal")?.version)}function y({platform:e=process.platform,env:n=process.env,deep:r=!1}={}){let t=(n.PATH??n.Path??"").split(e==="win32"?";":":").filter(Boolean);if(e==="darwin"&&t.push("/opt/homebrew/bin","/usr/local/bin"),r){let o=n.HOME??B(),{join:s}=e==="win32"?S:R;t.push(s(o,".local","bin"),s(o,"bin"),"/opt/local/bin","/usr/bin")}return[...new Set(t)]}var O=(e,n=process.platform)=>n==="win32"?`${e}.exe`:e;async function d(e){try{return await N(e,A.X_OK),!0}catch{return!1}}async function b(e,n){let r=a[e];if(await d(n)){for(let i of r.beside??[])if(!await d(f(C(n),O(i))))return;try{let{stdout:i}=await w(n,r.versionArgs,{timeout:5e3}),t=r.version(i);if(t===void 0)return;let o=await _(n).catch(()=>n),s=g(e);return{id:e,path:n,version:t,homebrew:o.includes(`${m}Cellar${m}`),tooOld:e==="yt-dlp"&&s!==void 0&&$(s,t)}}catch{return}}}var h=()=>f(l(),"own.json");async function v(){try{let e=JSON.parse(await E(h(),"utf8"));return typeof e=="object"&&e!==null?e:{}}catch{return{}}}async function j(e){let n=(await v())[e];return typeof n=="string"&&n!==""?n:void 0}async function z(e,n){let r=await v();n===void 0?delete r[e]:r[e]=n,await I(l(),{recursive:!0}),await F(h(),`${JSON.stringify(r,null,2)}
|
|
5
|
-
`)}async function J(e,n={}){let r=await j(e);if(r!==void 0){let o=await b(e,r);if(o)return o}let t=process.env.FORGE_NO_OWN_TOOLS==="1"&&n.dirs===void 0?[]:n.dirs??y({deep:n.deep??!1});for(let o of t){let s=await b(e,f(o,O(a[e].binary)));if(s)return s}}async function k(e){if(await c(e)===void 0)return 0;try{let{removeExtension:n,extensionBytes:r}=await import("./manager-
|
|
5
|
+
`)}async function J(e,n={}){let r=await j(e);if(r!==void 0){let o=await b(e,r);if(o)return o}let t=process.env.FORGE_NO_OWN_TOOLS==="1"&&n.dirs===void 0?[]:n.dirs??y({deep:n.deep??!1});for(let o of t){let s=await b(e,f(o,O(a[e].binary)));if(s)return s}}async function k(e){if(await c(e)===void 0)return 0;try{let{removeExtension:n,extensionBytes:r}=await import("./manager-5EJGANFW.js"),i=await r(e);return await n(e)?i:0}catch{return 0}}async function Q(e={}){let n=await J("yt-dlp",e);if(n&&!n.tooOld)return await k("yt-dlp"),{entry:n.path,own:!0};let r=await c("yt-dlp");return r?{entry:r.entry,own:!1}:void 0}async function x(e){if(e.brew!==void 0)return await d(e.brew)?e.brew:void 0;for(let n of y({env:{PATH:process.env.PATH??""}})){let r=f(n,"brew");if(await d(r))return r}}async function V(e,n={}){if(e.tooOld)return g(e.id);if(!e.homebrew)return;let r=await x(n);if(r!==void 0)try{let{stdout:i}=await w(r,["outdated","--json=v2","--formula",a[e.id].formula],{timeout:15e3,env:{...process.env,HOMEBREW_NO_AUTO_UPDATE:"1"}}),t=JSON.parse(i);if(!Array.isArray(t.formulae))return;let o=t.formulae[0]?.current_version;return typeof o=="string"?o:null}catch{return}}var Z=e=>e.homebrew?"Homebrew":e.id==="yt-dlp"?"yt-dlp":void 0;async function ee(e,n={}){let r,i;if(e.homebrew){let t=await x(n);if(t===void 0)throw new Error("Homebrew was not found");r=t,i=["upgrade",a[e.id].formula]}else if(e.id==="yt-dlp")r=e.path,i=["--update"];else throw new Error(`${a[e.id].name} cannot update itself`);try{await w(r,i,{timeout:10*6e4,maxBuffer:8<<20,...n.signal?{signal:n.signal}:{}})}catch(t){if(n.signal?.aborted)throw n.signal.reason??t;let o=t,s=(o.stderr??"").trim().split(`
|
|
6
6
|
`).filter(Boolean).at(-1)?.replace(/^Error:\s*/,"");throw new Error(s||o.message||"the update failed")}}export{H as a,X as b,Y as c,q as d,$ as e,y as f,b as g,j as h,z as i,J as j,k,Q as l,V as m,Z as n,ee as o};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as D}from"./chunk-
|
|
3
|
+
import{b as D}from"./chunk-DHW72U6X.js";import{a as X,b as Q}from"./chunk-HZDYZ5RD.js";import{j as M}from"./chunk-N32JL4UI.js";import{a as K}from"./chunk-4OSMYHKQ.js";import{b as J}from"./chunk-EEQSUBBL.js";import{a as W}from"./chunk-HTA25PO2.js";import{a as Y}from"./chunk-KH5DHZ2U.js";import{a as U}from"./chunk-TLHUFIXD.js";import{m as R}from"./chunk-4MJEEEFA.js";import{G as d,J as H}from"./chunk-ZBMJTIYR.js";import{d as L}from"./chunk-J7FLFHQJ.js";import{b as z}from"./chunk-H3DIRJFE.js";var O=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},k=class extends O{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var E=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new k(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function N(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}import{EventEmitter as le}from"node:events";import G from"node:child_process";import C from"node:path";import F from"node:fs";import m from"node:process";import{stripVTControlCharacters as ce}from"node:util";import{stripVTControlCharacters as se}from"node:util";var T=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>N(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[])}),t.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[]),i.get(o).push(r)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function r(h,p){return t.formatItem(h,n,p,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],u=t.commandDescription(e);u.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(u),i),""]));let l=t.visibleArguments(e).map(h=>r(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));if(o=o.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),h=>h.helpGroupHeading??"Options:").forEach((h,p)=>{let x=h.map(_=>r(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));o=o.concat(this.formatItemList(p,x,t))}),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(p=>r(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",h,t))}return this.groupItems(e.commands,t.visibleCommands(e),h=>h.helpGroup()||"Commands:").forEach((h,p)=>{let x=h.map(_=>r(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));o=o.concat(this.formatItemList(p,x,t))}),o.join(`
|
|
4
4
|
`)}displayWidth(e){return se(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let o=" ".repeat(2);if(!n)return o+e;let u=e.padEnd(t+e.length-i.displayWidth(e)),l=2,a=(this.helpWidth??80)-t-l-2,h;return a<this.minWidthToWrap||i.preformatted(n)?h=n:h=i.boxWrap(n,a).replace(/\n/g,`
|
|
5
5
|
`+" ".repeat(t+l)),o+u+" ".repeat(l)+h.replace(/\n/g,`
|
|
6
6
|
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,r=[];return n.forEach(o=>{let u=o.match(i);if(u===null){r.push("");return}let l=[u.shift()],c=this.displayWidth(l[0]);u.forEach(a=>{let h=this.displayWidth(a);if(c+h<=t){l.push(a),c+=h;return}r.push(l.join(""));let p=a.trimStart();l=[p],c=this.displayWidth(p)}),r.push(l.join(""))}),r.join(`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
var x=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com"]),b=/^[A-Za-z0-9_-]{11}$/,c=n=>n&&b.test(n)?{kind:"video",id:n,url:`https://www.youtube.com/watch?v=${n}`}:void 0;function E(n){let r=n.trim();if(r==="")return;let t;try{t=new URL(/^[a-z]+:\/\//i.test(r)?r:`https://${r}`)}catch{return}let e=t.hostname.toLowerCase();if(e==="youtu.be")return c(t.pathname.slice(1).split("/")[0]);if(!x.has(e))return;let[s,o]=t.pathname.split("/").filter(Boolean);if(s==="watch")return c(t.searchParams.get("v"));if(s==="shorts"||s==="live")return c(o);if(s==="playlist"&&t.searchParams.get("list"))return{kind:"playlist"}}var w="Summary and notes by Apple Intelligence. They may contain mistakes.";function g(n){let r=Math.floor(n),t=o=>String(o).padStart(2,"0"),e=Math.floor(r/3600),s=Math.floor(r/60)%60;return e>0?`${e}:${t(s)}:${t(r%60)}`:`${s}:${t(r%60)}`}var f=n=>n.split(/\s+/).filter(Boolean).length,$=60,S=140,y=1,k=10;function I(n){let r=[],t;for(let e of n){if(t){let s=e.start-t.end;if(!(s>k||s>y&&t.words>=$||t.words>=S)){t.text+=` ${e.text}`,t.end=e.end,t.words+=f(e.text);continue}r.push({start:t.start,text:t.text})}t={start:e.start,end:e.end,text:e.text,words:f(e.text)}}return t&&r.push({start:t.start,text:t.text}),r}var l=n=>I(n).flatMap(r=>[`**${g(r.start)}** ${r.text}`,""]),L=n=>/^https?:\/\/\S+$/.test(n)?`<${n}>`:n;function P(n,r,{transcript:t=!0}={}){let e=[`# ${r.title}`,"",L(r.from),""],s=n.notes;if(!s)return[...e,...l(n.segments)].join(`
|
|
4
|
+
`);let o=s.parts,p=a=>{let i=o[a];return i?`### ${i.refused?`Part ${a+1}`:i.heading} \xB7 ${g(i.start)}`:""};e.push(s.summary,"","## Notes",""),o.forEach((a,i)=>{e.push(p(i),""),a.points.length>0&&e.push(...a.points.map(u=>`- ${u}`),"")});let d=[`_${w}_`,""];return t?(e.push("## Transcript",""),o.forEach((a,i)=>{let u=o[i+1]?.start??Number.POSITIVE_INFINITY,h=n.segments.filter(m=>m.start>=a.start&&m.start<u);e.push(p(i),"",...l(h))}),[...e,...d].join(`
|
|
5
|
+
`)):[...e,...d].join(`
|
|
6
|
+
`)}function M(n){let r=[...n].map(t=>(t.codePointAt(0)??0)<32?" ":t).join("").replace(/[/\\:*?"<>|]/g,"-").replace(/\s+/g," ").trim().slice(0,120).replace(/^\.+/,"");return r===""?"transcript":r}export{E as a,g as b,P as c,M as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as w,b as I,d as k,e as m}from"./chunk-W53XNVNH.js";import{a as $,c as O}from"./chunk-
|
|
3
|
+
import{a as w,b as I,d as k,e as m}from"./chunk-W53XNVNH.js";import{a as $,c as O}from"./chunk-SM735FG7.js";import{b as h,d as P,e as R}from"./chunk-T4CLHCLJ.js";import{f as x}from"./chunk-YJ6XLDRA.js";import{a as l}from"./chunk-4OSMYHKQ.js";import{j as B}from"./chunk-RQWWUCGQ.js";import{$ as C,_ as g,ba as v}from"./chunk-ZBMJTIYR.js";import{a as f}from"./chunk-J7FLFHQJ.js";import{b as p}from"./chunk-VLVNA4T3.js";import{a as c}from"./chunk-H3DIRJFE.js";import{dirname as S,join as q}from"node:path";async function T(t){if(t.fallback!==void 0)return t.fallback;let{loadPreferences:r,expandTilde:e}=await import("./preferences-3P4V2EDX.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!$())throw C();return O()}function E(t,r,e,o){let a=q(r.outDir,`Copied image${c[o].extensions[0]}`),s={inputs:[r.source],output:a,force:!1,recursive:!1,debug:t.debug},n={background:"#ffffff",keepMetadata:!1,...t.quality===void 0?{}:{quality:t.quality}};return o===e?{kind:"compress",...s,options:n,...t.quality===void 0?{}:{quality:t.quality},...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}:{kind:"convert",...s,target:o,options:n,...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}}async function J(t,r={}){let e=r.clip??{},o=F(e),a=await w(o,e.root);if(!a)throw g((await o.peek()).text?"text":"nothing");let s=await B(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await P(b,r),y=i.results[0];if(!y||i.failures.length>0)return{report:i,status:"failed"};let u=y.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await I(o,a,u,n)==="changed")return{...d,status:"changed",saved:await m(u,await T(e))};if(t.save===void 0)return{...d,status:"placed"};let j=t.save===!0?await T(e):t.save,{expandTilde:D}=await import("./preferences-3P4V2EDX.js");return{...d,status:"placed",saved:await m(u,D(j))}}function N(t){let r=t.target===t.source.format?"":` as ${c[t.target].label}`,e=` ${f(t.source.bytes)} \u2192 ${f(t.report.outputBytes)} \xB7 ${h(t.source.bytes,t.report.outputBytes)}`;if(t.status==="changed"){let a=t.target===t.source.format?"compressed":"converted";return[`\u2713 Copied image \u2192 ${p(t.saved)}${r}`,e,"","\u26A0 Clipboard changed"," The file you uploaded is no longer in the clipboard.",` The ${a} image is saved to ${p(S(t.saved))}.`]}let o=t.saved===void 0?"":` + ${p(t.saved)}`;return[`\u2713 Copied image \u2192 clipboard${r}${o}`,e]}async function U(t){if(!await k(F(t),t.root))throw v()}async function Z(t,r){if(t.undo)return await U(r.clip??{}),{exitCode:0,stdout:r.json?[JSON.stringify({forge:l,ok:!0,clipboard:"restored"})]:["\u2713 The original is back on the clipboard"],stderr:[]};let e=await J(t,r);if(e.status==="failed")return R(e.report,r);if(r.json){let o={...x(l,e.report),clipboard:e.status,...e.saved===void 0?{}:{saved:e.saved}};return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:N(e),stderr:[]}}export{J as a,N as b,U as c,Z as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d}from"./chunk-
|
|
3
|
+
import{a,b,c,d}from"./chunk-Z6IQV737.js";import"./chunk-W53XNVNH.js";import"./chunk-SM735FG7.js";import"./chunk-T4CLHCLJ.js";import"./chunk-TJ5YBJEO.js";import"./chunk-FEFNS6YZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-H3KW7HTC.js";import"./chunk-NUW4YOJ6.js";import"./chunk-VBDRWNEG.js";import"./chunk-DHW72U6X.js";import"./chunk-KTCHWHQB.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-4OSMYHKQ.js";import"./chunk-O7DK3GJT.js";import"./chunk-RQWWUCGQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-6TTONCYR.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as clipLines,a as runClip,d as runClipCommand,c as runUndo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c}from"./chunk-
|
|
3
|
+
import{a,b,c}from"./chunk-OXDRJO4V.js";import"./chunk-SM735FG7.js";import"./chunk-V6GWPR2A.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as V}from"./chunk-J7Z7ULLN.js";import{g as F,h as G,i as B}from"./chunk-TFGK7IRZ.js";import{b as O,c as H}from"./chunk-POM7FXIV.js";import{i as D,l as _,m as M,o as U}from"./chunk-7XFLG32B.js";import{b as x,c as v,h as E,i as $,j as h}from"./chunk-N32JL4UI.js";import{a as J,b as T,c as W}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as b}from"./chunk-4OSMYHKQ.js";import"./chunk-RQWWUCGQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-6TTONCYR.js";import"./chunk-FAUL5L2W.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{b as R,c as N,d as P,h as j,k as I,l as L,m as A}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import{c as w}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{readFile as nt}from"node:fs/promises";import{basename as st,resolve as z}from"node:path";function d(t,e){let o=h(e);if(!o)return;let s=o.alpha!==void 0&&o.alpha<1?o.alpha:void 0;return{name:t,hex:x(o.rgb),...s===void 0?{}:{alpha:s}}}function Y(t){let e=t.replace(/^/,"").trim();if(e==="")return{colours:[],bad:[]};if(e.startsWith("{")||e.startsWith("["))try{return X(JSON.parse(e))}catch{}return rt(e.split(/\r?\n/))}var m=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Q=["hex","colour","color","value","$value"];function X(t){let e={colours:[],bad:[]};if(Array.isArray(t)){for(let c of t){if(!m(c))continue;let i=typeof c.name=="string"?c.name:void 0,p=Q.find(a=>typeof c[a]=="string");if(!i||!p)continue;let l=c[p],f=d(i,l);f?e.colours.push(f):e.bad.push(`${i}: ${l}`)}return e}if(!m(t))return e;let o=Object.keys(t).filter(c=>!c.startsWith("$")),s=o.length===1?t[o[0]]:void 0,r=m(s)&&!("$value"in s)?s:t,n=(c,i=0)=>{let p=/^\{(.+)\}$/.exec(c.trim());if(!p||i>8)return c;let l=t;for(let f of p[1].split("."))l=m(l)?l[f]:void 0;return m(l)&&typeof l.$value=="string"?n(l.$value,i+1):typeof l=="string"?n(l,i+1):c},u=(c,i,p)=>{let l=c.$type??p;for(let[f,a]of Object.entries(c)){if(f.startsWith("$"))continue;let C=[...i,f].join("/");if(m(a)&&"$value"in a){let g=a.$type??l,y=a.$value;if(typeof y!="string")continue;let S=d(C,n(y));S?e.colours.push(S):g==="color"&&e.bad.push(`${C}: ${y}`)}else if(m(a))u(a,[...i,f],l);else if(typeof a=="string"){let g=d(C,n(a));g&&e.colours.push(g)}}};return u(r,[]),e}function q(t){let e=[],o="",s=!1;for(let r=0;r<t.length;r++){let n=t[r];s?n==='"'&&t[r+1]==='"'?(o+='"',r++):n==='"'?s=!1:o+=n:n==='"'?s=!0:n===","?(e.push(o.trim()),o=""):o+=n}return e.push(o.trim()),e}var Z=["name","token","label"],tt=["hex","colour","color","value","rgb"];function et(t,e,o){let s={colours:[],bad:[]};for(let r of t){if(r.trim()==="")continue;let n=q(r),u=n[e]??"",c=n[o]??"",i=u?d(u,c):void 0;i?s.colours.push(i):s.bad.push(r.trim())}return s}function ot(t){let e=t.replace(/^[-*•]\s+/,"").replace(/[;,]$/,"").trim();for(let r of[" ",":","=",","]){let n=e.indexOf(r);if(n<=0)continue;let u=d(e.slice(0,n).trim(),e.slice(n+1).trim());if(u?.name)return u}let o=e.split(/\s+/);for(let r=1;r<o.length;r++){let n=d(o.slice(0,r).join(" "),o.slice(r).join(" "));if(n)return n}for(let r=o.length-1;r>=1;r--){let n=d(o.slice(r).join(" "),o.slice(0,r).join(" "));if(n)return n}let s=d("",e);return s?{...s,name:s.hex}:void 0}function rt(t){let e=q(t[0]??"").map(c=>c.toLowerCase()),o=e.findIndex(c=>Z.includes(c)),s=e.findIndex(c=>tt.includes(c));if(e.length>1&&o!==-1&&s!==-1)return et(t.slice(1),o,s);let r=t.some(c=>/^\s*--[\w-]+\s*:/.test(c)),n={colours:[],bad:[]},u=!1;for(let c of t){let i=c.replace(/\/\*.*?\*\//g,"");if(u){let f=i.indexOf("*/");if(f===-1)continue;i=i.slice(f+2),u=!1}let p=i.indexOf("/*");if(p!==-1&&(i=i.slice(0,p),u=!0),i=i.trim(),i===""||i.startsWith("//"))continue;if(r){let f=/^--([\w-]+)\s*:\s*(.+?)\s*;?$/.exec(i);if(!f)continue;let a=d(f[1],f[2]);a&&n.colours.push(a);continue}if(i.startsWith("#")&&!h(i.split(/\s+/)[0]))continue;let l=ot(i);l?n.colours.push(l):n.bad.push(i)}return n}var k=({r:t,g:e,b:o},s)=>s?`\x1B[38;2;${t};${e};${o}m\u2588\u2588\x1B[39m `:"";function it(t,e){let o=v(e),s,r=Number.POSITIVE_INFINITY;for(let n of t){let u=(n.centre.L-o.L)**2+(n.centre.a-o.a)**2+(n.centre.b-o.b)**2;u<r&&(r=u,s=n)}return s}async function ct(t){let{pixels:e}=await V(t.input),o=_(e);if(o.length===0)throw I(t.input);let s=t.inside?it(o,t.inside):void 0,r=s?M(e,s):o,n=T(b,{source:z(t.input),...s?{inside:s.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:E(c.rgb),oklch:$(c.rgb),share:c.share}))});return{groups:r,...s?{parent:s}:{},doc:n,svg:()=>G(w(t.input),r,"light",s?.hex)}}async function Et(t,e){let{groups:o,doc:s,svg:r}=await ct(t);if(t.svg)return{exitCode:0,stdout:[r()],stderr:[]};if(e.json)return{exitCode:0,stdout:[JSON.stringify(s)],stderr:[]};let n=U(o.map(u=>u.share));return{exitCode:0,stdout:o.map((u,c)=>`${k(u.rgb,e.colour)}${u.hex} ${String(n[c]).padStart(3)}%`),stderr:[]}}async function Rt(t,e){let o=D(t.colour);if(t.svg)return{exitCode:0,stdout:[B(t.colour,o)],stderr:[]};let s=o.map(r=>({...r,...H(r.rgb)}));if(e.json){let r=W(b,{reference:x(t.colour),steps:s.map(n=>({step:n.step,hex:n.hex,oklch:$(n.rgb),white:n.white,black:n.black}))});return{exitCode:0,stdout:[JSON.stringify(r)],stderr:[]}}return{exitCode:0,stdout:s.map(r=>`${String(r.step).padStart(4)} ${k(r.rgb,e.colour)}${r.hex} white ${r.white.toFixed(1)} ${O(r.white)} \xB7 black ${r.black.toFixed(1)} ${O(r.black)}`),stderr:[]}}async function ut(){let t=[];for await(let e of process.stdin)t.push(Buffer.from(e));return Buffer.concat(t).toString("utf8")}async function at(t){try{return await nt(t,"utf8")}catch(e){let o=e.code;throw o==="ENOENT"||o==="ENOTDIR"?R(t):o==="EISDIR"?N(t):o==="EACCES"||o==="EPERM"?P(t):j(t,e)}}var K=t=>t.alpha===void 0?t.hex:`${t.hex} ${Math.round(t.alpha*100)}%`;async function Nt(t,e,o=ut){let s=t.input==="-",r=s?await o():await at(t.input),n=s?"the text from stdin":w(t.input),{colours:u,bad:c}=Y(r);if(c.length>0)throw A(n,c);if(u.length===0)throw L(n);if(t.svg){let i=t.title??(s?"Colours":st(t.input).replace(/\..*$/,"")||"Colours"),p=u.length,l=u.map(a=>({id:a.name,name:a.name,value:K(a),hex:a.hex,...a.alpha===void 0?{}:{alpha:a.alpha}}));return{exitCode:0,stdout:[F(i,`${p} colour${p===1?"":"s"}`,l,"light",{perRow:8})],stderr:[]}}if(e.json){let i=J(b,{source:s?"-":z(t.input),colours:u});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}return{exitCode:0,stdout:u.map(i=>{let p=h(i.hex)?.rgb??{r:0,g:0,b:0};return`${k(p,e.colour)}${K(i)} ${i.name}`}),stderr:[]}}export{ct as readPalette,Nt as runCard,Et as runPalette,Rt as runScale};
|
|
@@ -2,5 +2,5 @@ import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
3
|
import{a as $,b as R,d as g,e as F,f as m,g as G}from"./chunk-6RCS3KBP.js";import{H as k,a as N,i as I,j as O}from"./chunk-ZX5FDZZW.js";import"./chunk-6RMRWBMB.js";import{c as b}from"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import{c as S}from"./chunk-N72E43Z3.js";import{a as T,b as v,c as _,d as A,e as D}from"./chunk-4KGC5ZBZ.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-V6GWPR2A.js";import{a as y}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as ee}from"node:child_process";import{homedir as Te}from"node:os";import{join as M,resolve as ve}from"node:path";import{appendFileSync as te,mkdirSync as C,readFileSync as ne,renameSync as re,rmSync as x,statSync as L}from"node:fs";import{join as j}from"node:path";var ie={quiet:500,cap:3e3,poll:50},oe=15e3,X=e=>new Promise(n=>setTimeout(n,e));async function H(e,n,t,r=ie){C(e,{recursive:!0});let i=j(e,`${n}.spool`),o=j(e,`${n}.lock`),s=p=>{try{return ne(p,"utf8").split(`
|
|
4
4
|
`).filter(Boolean)}catch{return[]}},u=()=>{try{return L(i).size}catch{return 0}};for(te(i,`${t}
|
|
5
|
-
`);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-KGFOAQCU.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-
|
|
5
|
+
`);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-KGFOAQCU.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-XKWZV7OX.js"),{savePreferences:t}=await import("./preferences-3P4V2EDX.js"),r=await h(n);e?await g(r):await m(r),await t({rightClickMenu:e})}async function ht(){if(!process.env.FORGE_NO_MENU)try{await K(await h(""))}catch{}}async function De(e){let{parseArgs:n}=await import("./args-J5JEHQLE.js"),{runIntent:t}=await import("./execute-MRVDAKZO.js"),r=n([e,"--sharpen","--output",W(e)]),i=await t(r),o=i.results[0]?.job.outputs[0];if(o!==void 0)return{output:o};let s=i.failures[0]?.error;return{error:y(s)?s.detail:"It could not be sharpened."}}async function Ne(e,n){let{runPresetCommand:t}=await import("./preset-command-3ILRQZSJ.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-M6WESEVB.js");try{let o=await t({kind:"preset",inputs:[n],name:e,force:!1,recursive:!1,debug:!1,keepBoth:!0}),s=o.results[0],u=s?.job.outputs[0];if(s!==void 0&&u!==void 0){let{prefs:l}=await r(),c=l.presets?.find(f=>f.name===e)?.steps,a=s.job.sources[0]?.format;return{output:u,chain:c&&a?i(a,c):[]}}let p=o.failures[0]?.error;return{error:y(p)?p.detail:"It could not be made."}}catch(o){return{error:y(o)?o.detail:"It could not be made."}}}var Ie=(e,n)=>new Promise(t=>{let r=ee(e,n,{detached:!0,stdio:"ignore"});r.on("error",()=>t()),r.unref(),t()});async function wt(e,n){let t=await h(n);if(e.kind==="install")return await g(t),0;if(e.kind==="remove")return await m(t),0;if(e.kind!=="run")return 2;let r=e.paths.map(i=>ve(i));if(t.platform==="win32"&&r.length===1){let i=e.preset===void 0?e.action:`preset-${e.preset}`,o=await H(M(t.menuDir,"spool"),i,r[0]);if(o===null)return 0;r=o}return await z(e.action,r,{platform:t.platform,self:[t.node,...t.execArgv,t.forge],terminal:Q(t),launch:Ie,sharpen:De,runPreset:Ne,notify:(i,o)=>k(i,o,t.platform,{icon:M(t.menuDir,O({paint:"forge"}))}),has:i=>I(i,t.path),reveal:async i=>{await S(i,t.platform)}},e.preset),0}async function yt(e,n){let t=await h(e),r=i=>new Promise(o=>{let s=t.platform==="win32"?A(t.node):void 0,[u,p]=s!==void 0?[t.node,[s,...i]]:[_(t.node),i],l="",c=ee(u,p,{stdio:["ignore","pipe","pipe"]});c.stdout.setEncoding("utf8").on("data",a=>{l+=a}),c.stderr.setEncoding("utf8").on("data",a=>{l+=a}),c.on("error",a=>o({code:null,output:`${l}
|
|
6
6
|
${a.message}`})),c.on("close",a=>o({code:a,output:l}))});return Z(t,{forgeDir:M(P(),"forge"),npm:r,out:n})}export{mt as menuAtStart,dt as menuIsOn,h as realMenuEnv,ht as resyncMenu,wt as runMenuCommand,yt as runUninstall,gt as switchMenu};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as a,d as b,e as c,f as d}from"./chunk-
|
|
3
|
+
import{c as a,d as b,e as c,f as d}from"./chunk-T4CLHCLJ.js";import"./chunk-TJ5YBJEO.js";import"./chunk-FEFNS6YZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-H3KW7HTC.js";import"./chunk-NUW4YOJ6.js";import"./chunk-VBDRWNEG.js";import"./chunk-DHW72U6X.js";import"./chunk-KTCHWHQB.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-4OSMYHKQ.js";import"./chunk-O7DK3GJT.js";import"./chunk-RQWWUCGQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-6TTONCYR.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{d as execute,a as exitCodeFor,c as renderRun,b as runIntent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{Jb as a,Kb as b,Lb as c,Mb as d,Nb as e}from"./chunk-
|
|
3
|
+
import{Jb as a,Kb as b,Lb as c,Mb as d,Nb as e}from"./chunk-BP6CVOQR.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-POM7FXIV.js";import"./chunk-7XFLG32B.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-N32JL4UI.js";import"./chunk-4OSMYHKQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as ExtensionsFlow,c as byteCount,b as extensionCredits,d as extensionsChip,a as realManager};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-
|
|
3
|
+
import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-5EJGANFW.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(f=>f.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let{hideUnneeded:m}=await import("./needed-6GCBKP3S.js"),r=await m(await a());return{stdout:s===void 0?v(r):[s],data:{extensions:r.map(x),...i?{changed:i}:{}}}}export{w as runExtensions,x as toExtensionJson};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-6TTONCYR.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,i as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,b as readNames,j as readProgress,k as runFfmpeg,h as soundLevels};
|