forge-terminal 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +7 -5
  2. package/dist/chunks/{about-credits-DBQHH5HA.js → about-credits-WSRAKKZF.js} +1 -1
  3. package/dist/chunks/{args-TZMA4ZR6.js → args-6CKJ6KH6.js} +1 -1
  4. package/dist/chunks/{boot-E57BKWEC.js → boot-HOUBXHJL.js} +1 -1
  5. package/dist/chunks/{chunk-5YUOG3A5.js → chunk-3FLV43Q2.js} +1 -1
  6. package/dist/chunks/{chunk-E2BYNETT.js → chunk-7UMELAOL.js} +1 -1
  7. package/dist/chunks/{chunk-EPDF4NQI.js → chunk-7WZYTDFI.js} +1 -1
  8. package/dist/chunks/{chunk-ZYIW4MAG.js → chunk-BB43QVW4.js} +1 -1
  9. package/dist/chunks/{chunk-6LMVOQQA.js → chunk-CWQCFW5J.js} +1 -1
  10. package/dist/chunks/{chunk-3GHHQNR6.js → chunk-J7GGNBDR.js} +1 -1
  11. package/dist/chunks/chunk-KOHJP7T4.js +82 -0
  12. package/dist/chunks/{chunk-IJRLRAC5.js → chunk-KS4ZE3X2.js} +1 -1
  13. package/dist/chunks/{chunk-IKZTH2RL.js → chunk-KSWBIKCI.js} +1 -1
  14. package/dist/chunks/{chunk-N3X3H4IZ.js → chunk-LJXEQGKU.js} +1 -1
  15. package/dist/chunks/{chunk-Z2H2GT2X.js → chunk-LSVZEQVK.js} +2 -2
  16. package/dist/chunks/{chunk-AFEYLHDD.js → chunk-MBZRADAZ.js} +1 -1
  17. package/dist/chunks/{chunk-TDYKRRZH.js → chunk-NS5CJZ4B.js} +1 -1
  18. package/dist/chunks/{chunk-7VR6LODN.js → chunk-PLBLOIQI.js} +1 -1
  19. package/dist/chunks/{chunk-4YFFT5CZ.js → chunk-QPYAKAHI.js} +2 -2
  20. package/dist/chunks/{chunk-EURVTBPH.js → chunk-RW4TOC5E.js} +1 -1
  21. package/dist/chunks/{chunk-QPJ2LNXB.js → chunk-SBQWOZTA.js} +1 -1
  22. package/dist/chunks/{chunk-ITJZ7ODJ.js → chunk-SNXX5TVZ.js} +2 -2
  23. package/dist/chunks/{chunk-FLMQ5VFR.js → chunk-VNZ3D7VG.js} +1 -1
  24. package/dist/chunks/{chunk-5IZBFF6Y.js → chunk-WE5MOCUL.js} +1 -1
  25. package/dist/chunks/{chunk-MNI6IKIU.js → chunk-YO2DKGGU.js} +1 -1
  26. package/dist/chunks/{chunk-AIINYKXW.js → chunk-YURNOHEF.js} +1 -1
  27. package/dist/chunks/chunk-ZX5FDZZW.js +55 -0
  28. package/dist/chunks/{clip-command-QPLYCGJ2.js → clip-command-S4JYPD6N.js} +1 -1
  29. package/dist/chunks/{colour-PZOAKNTH.js → colour-PXJ2VKHU.js} +1 -1
  30. package/dist/chunks/command-BKAPI4A5.js +3 -0
  31. package/dist/chunks/{entry-REXB6JNP.js → entry-RDY5AQA5.js} +2 -2
  32. package/dist/chunks/{execute-GKO4THUK.js → execute-7NVA5QSU.js} +1 -1
  33. package/dist/chunks/{extensions-UV4X2UUA.js → extensions-VHU2V3B6.js} +1 -1
  34. package/dist/chunks/{extensions-command-TLW53BUK.js → extensions-command-VT5CGCL5.js} +1 -1
  35. package/dist/chunks/{ffmpeg-32EEMAZS.js → ffmpeg-N4SJFTIP.js} +1 -1
  36. package/dist/chunks/{install-7ZRVQKCF.js → install-LDERVCWM.js} +1 -1
  37. package/dist/chunks/{launch-IVBMNYNY.js → launch-UEEW4R7F.js} +5 -5
  38. package/dist/chunks/{manager-XPO4ZIRY.js → manager-QOSWVNWL.js} +1 -1
  39. package/dist/chunks/{needed-NOGBHTHE.js → needed-P2KDSQRO.js} +1 -1
  40. package/dist/chunks/{notify-YEBP67MP.js → notify-NQNNOBFC.js} +1 -1
  41. package/dist/chunks/{own-G4G4MRGM.js → own-LYJ5WMGC.js} +1 -1
  42. package/dist/chunks/{preset-command-XXKLUJOS.js → preset-command-J7RTNKQI.js} +1 -1
  43. package/dist/chunks/{registry-PKOPEG3Z.js → registry-WZUVZQHU.js} +1 -1
  44. package/dist/chunks/{server-AR73FWWG.js → server-HQC6RCTV.js} +3 -3
  45. package/dist/chunks/{theme-D4AMWFFW.js → theme-NQIVXDUH.js} +1 -1
  46. package/dist/chunks/{transcribe-EFVJPBPG.js → transcribe-IZGN5EFT.js} +1 -1
  47. package/dist/chunks/{transcribe-command-Q4J3WTOB.js → transcribe-command-TMM4RLJD.js} +1 -1
  48. package/dist/chunks/{update-note-2YR3TLPK.js → update-note-BEM4E3NI.js} +1 -1
  49. package/dist/chunks/{watch-command-2D7NLDAM.js → watch-command-4TATMV2T.js} +1 -1
  50. package/dist/index.js +9 -9
  51. package/package.json +3 -11
  52. package/dist/chunks/chunk-3CLPUPJT.js +0 -55
  53. package/dist/chunks/chunk-NHMACTW3.js +0 -82
  54. package/dist/chunks/command-DMGGGAPS.js +0 -3
@@ -1,82 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{A as ge,B as le,C as pe,D as he,a,b as te,c as re,d as k,e as $,f as O,g as D,h as ie,j as oe,k as l,l as A,m as se,n as x,o as H,p as ae,q as E,r as L,s as R,t as ce,u as I,v as ue,w as fe,x as me,y as de,z as B}from"./chunk-3CLPUPJT.js";import{r as M}from"./chunk-BIBDLXCG.js";import{execFile as Ye}from"node:child_process";import{chmodSync as Q,existsSync as Ie,mkdirSync as Z,readdirSync as be,readFileSync as N,rmdirSync as qe,rmSync as p,writeFileSync as We}from"node:fs";import{dirname as P,join as c}from"node:path";var je={convert:"#55c7d9",compress:"#79c98b",edit:"#b39ae8",pdf:"#ff6b4a"},_e="#55c7d9",Ge="#a68ce0",Te=4/5,Je=(e,n,t,i)=>`<path fill="${i}" d="M${e} ${n}h${4*t}v${t}h${-3*t}v${t}h${2*t}v${t}h${-2*t}v${2*t}h${-t}z"/>`;function Ke(e,n){let t=n<=20,i=t?3:4,r=t?6:4.6,o=t?51:51.5,m=Array.from({length:i},(g,w)=>o-(i-1-w)*r).map(g=>`<line x1="${g}" y1="66" x2="${g+66*Te}" y2="0"/>`).join(""),u=e==="forge"?"url(#w)":je[e];return`<svg width="${n}" height="${n}" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="w" gradientUnits="userSpaceOnUse" x1="34" y1="0" x2="62" y2="0"><stop offset="0" stop-color="${_e}"/><stop offset="1" stop-color="${Ge}"/></linearGradient><clipPath id="c"><rect width="64" height="64" rx="14"/></clipPath><clipPath id="i"><rect x="1.5" y="1.5" width="61" height="61" rx="12.5"/></clipPath></defs><g clip-path="url(#c)"><rect width="64" height="64" fill="#1e1e1e"/><g clip-path="url(#i)" stroke="${u}" stroke-width="${t?3.6:2.4}">${m}</g>${Je(16,12,8,"#e7e7e7")}</g><rect x=".75" y=".75" width="62.5" height="62.5" rx="13.5" fill="none" stroke="#3a3a3a" stroke-width="1.5"/></svg>`}async function v(e,n){let{default:t}=await import("sharp");return t(Buffer.from(Ke(e,n))).png().toBuffer()}function ye(e){let n=Buffer.alloc(6);n.writeUInt16LE(0,0),n.writeUInt16LE(1,2),n.writeUInt16LE(e.length,4);let t=6+16*e.length,i=e.map(({size:r,png:o})=>{let s=Buffer.alloc(16);return s[0]=r>=256?0:r,s[1]=r>=256?0:r,s.writeUInt16LE(1,4),s.writeUInt16LE(32,6),s.writeUInt32LE(o.length,8),s.writeUInt32LE(t,12),t+=o.length,s});return Buffer.concat([n,...i,...e.map(r=>r.png)])}function h(e){let n=[{action:"open",label:"Open Forge",kinds:["image","folder"],window:!0,paint:"forge"},{action:"convert",label:"Convert in Forge",kinds:["image","folder"],window:!0,paint:"convert"},{action:"compress",label:"Compress in Forge",kinds:["image","folder"],window:!0,paint:"compress"},{action:"sharpen",label:"Sharpen in Forge",kinds:["image"],window:!1,paint:"edit"},{action:"open-pdf",label:"Open in Forge",kinds:["pdf"],window:!0,paint:"pdf"}],t=(e.presets??[]).map(i=>({action:"preset",preset:i,label:`${i} in Forge`,kinds:["image"],window:!1,paint:"forge"}));return[...e.sharpen?n:n.filter(i=>i.action!=="sharpen"),...t]}var U="Forge was uninstalled",j="Its menu items are removed.",we="Forge could not start",$e="Run forge in a terminal once to set its menu up again.";function xe(e){let{osascript:n,pbs:t}=e.tools??{osascript:"/usr/bin/osascript",pbs:"/System/Library/CoreServices/pbs"},i=[e.node,...e.execArgv,e.forge].map(a).join(" "),[r,o]=$({on:[],off:e.services,osascript:n}),s=[r,...o].map(a).join(" "),m=(u,g)=>`${a(n)} -e 'display notification "${g}" with title "${u}"'`;return`#!/bin/sh
4
- # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
5
- if [ ! -f ${a(e.forge)} ]; then
6
- # Forge is gone: take its menu with it, and say so once.
7
- ${e.bundles.map(u=>` rm -rf ${a(u)}`).join(`
8
- `)}
9
- rm -rf ${a(e.menuDir)}
10
- ${s}
11
- ${a(t)} -update
12
- ${m(U,j)}
13
- exit 0
14
- fi
15
- if [ ! -x ${a(e.node)} ]; then
16
- ${m(we,$e)}
17
- exit 1
18
- fi
19
- ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
20
- `}exec ${i} menu run "$@"
21
- `}function ve(e){let n=e.xdgConfigHome===void 0?{}:{XDG_CONFIG_HOME:e.xdgConfigHome};return`// Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
22
- import { execFileSync, spawn } from 'node:child_process'
23
- import { existsSync, rmSync } from 'node:fs'
24
-
25
- const FORGE = ${JSON.stringify(e.forge)}
26
- const ARGS = ${JSON.stringify(e.execArgv)}
27
- const MENU = ${JSON.stringify(e.menuDir)}
28
- const KEYS = ${JSON.stringify(e.keys)}
29
- const ENV = ${JSON.stringify(n)}
30
-
31
- if (existsSync(FORGE)) {
32
- const child = spawn(process.execPath, [...ARGS, FORGE, 'menu', 'run', ...process.argv.slice(2)], {
33
- stdio: 'inherit',
34
- windowsHide: true,
35
- env: { ...process.env, ...ENV },
36
- })
37
- child.on('exit', (code) => process.exit(code ?? 0))
38
- } else {
39
- // Forge is gone: say so while its app ID still exists, then take the menu with it.
40
- try {
41
- execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', ${JSON.stringify(he(U,j))}], { windowsHide: true })
42
- } catch {}
43
- for (const key of KEYS) {
44
- try {
45
- execFileSync('reg.exe', ['delete', key, '/f'], { windowsHide: true, stdio: 'ignore' })
46
- } catch {}
47
- }
48
- rmSync(MENU, { recursive: true, force: true })
49
- }
50
- `}function Ve(){return`say() {
51
- if command -v notify-send >/dev/null 2>&1; then
52
- notify-send --app-name=Forge -- "$1" "$2" >/dev/null 2>&1
53
- elif command -v gdbus >/dev/null 2>&1; then
54
- ${["gdbus call --session --dest org.freedesktop.Notifications","--object-path /org/freedesktop/Notifications","--method org.freedesktop.Notifications.Notify",`Forge 0 "''" "\\"$1\\"" "\\"$2\\"" '[]' '{}' -1`].join(" ")} >/dev/null 2>&1
55
- fi
56
- }`}function Se(e){let n=[e.node,...e.execArgv,e.forge].map(a).join(" "),t=e.files.map(a).join(` \\
57
- `),i="";if(e.thunar!==void 0){let r=a(e.thunar.file),o=a(`${e.thunar.file}.forge-tmp`),s=a(e.thunar.seed),m=['/<action>/ { held = ""; holding = 1 }',`holding { held = held $0 "\\n"; if (/<\\/action>/) { holding = 0; if (held !~ /<unique-id>${e.marker}-/) printf "%s", held }; next }`,"{ print }"].join(`
58
- `);i=` if [ -f ${r} ] && grep -qF '<unique-id>${e.marker}-' ${r}; then
59
- awk ${a(m)} ${r} > ${o} && mv -f ${o} ${r}
60
- if [ -f ${s} ] && cmp -s ${s} ${r}; then rm -f ${r}; fi
61
- fi
62
- `}return`#!/bin/sh
63
- # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
64
- ${Ve()}
65
- if [ ! -f ${a(e.forge)} ]; then
66
- # Forge is gone: take its menu with it, and say so once.
67
- for f in ${t}; do
68
- if [ -f "$f" ] && grep -qF ${a(e.marker)} "$f"; then rm -f "$f"; fi
69
- done
70
- ${i}${e.folders.map(r=>` rmdir ${a(r)} 2>/dev/null
71
- `).join("")} rm -rf ${a(e.menuDir)}
72
- say ${a(U)} ${a(j)}
73
- exit 0
74
- fi
75
- if [ ! -x ${a(e.node)} ]; then
76
- say ${a(we)} ${a($e)}
77
- exit 1
78
- fi
79
- ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
80
- `}exec ${n} menu run "$@"
81
- `}var b="HKCU\\Software\\Classes",Me=`${b}\\SystemFileAssociations\\image\\shell\\Forge`,ke=`${b}\\Directory\\shell\\Forge`,G=`${b}\\SystemFileAssociations\\.pdf\\shell\\ForgeOpen`,De=`${b}\\AppUserModelId\\${le}`,J=()=>[Me,ke,G,De],K=e=>`${e.paint}.ico`;function Ee(e){let n=o=>`conhost.exe --headless "${e.node}" "${e.menuDir}\\run.mjs" ${o.action}${o.preset===void 0?"":` ${o.preset}`} "%1"`,t=o=>`${e.menuDir}\\${K(o)}`,i=(o,s)=>{let m=e.items.filter(u=>u.kinds.includes(s));return m.length===0?[]:[{key:o,values:{MUIVerb:"Forge",Icon:t({paint:"forge"}),SubCommands:""}},...m.flatMap((u,g)=>{let w=u.preset===void 0?u.action:`preset-${u.preset}`,f=`${o}\\shell\\${g+1}${w}`;return[{key:f,values:{MUIVerb:u.label,Icon:t(u)}},{key:`${f}\\command`,values:{"":n(u)}}]})]},r=e.items.find(o=>o.kinds.includes("pdf"));return[...i(Me,"image"),...i(ke,"folder"),...r?[{key:G,values:{MUIVerb:r.label,Icon:t(r)}},{key:`${G}\\command`,values:{"":n(r)}}]:[],{key:De,values:{DisplayName:"Forge",IconUri:`${e.menuDir}\\forge.png`}}]}var T=e=>`'${pe(e)}'`,_=e=>T(`Registry::${e.replace(/^HKCU\\/,"HKEY_CURRENT_USER\\")}`);function V(e){return["$ErrorActionPreference = 'Stop'",...J().map(t=>`Remove-Item -Path ${_(t)} -Recurse -Force -ErrorAction SilentlyContinue`),...e.flatMap(({key:t,values:i})=>[`New-Item -Path ${_(t)} -Force | Out-Null`,...Object.entries(i).map(([r,o])=>`Set-ItemProperty -LiteralPath ${_(t)} -Name ${T(r===""?"(default)":r)} -Value ${T(o)}`)])].join(`
82
- `)}var vn=(e,n)=>e.version===n.version&&e.forge===n.forge&&e.node===n.node&&e.execArgv.join("\0")===n.execArgv.join("\0")&&e.xdgConfigHome===n.xdgConfigHome&&(e.presets??[]).join("\0")===(n.presets??[]).join("\0"),Fe="/System/Library/CoreServices/pbs",Pe=e=>c(e.menuDir,"state.json"),S=e=>c(e.home,"Library","Services"),q=e=>h({sharpen:!0}).map(n=>c(S(e),`${n.label}.workflow`)),W=()=>h({sharpen:!0}).map(k);function Ne(e){let n;try{n=be(S(e)).filter(t=>t.endsWith(".workflow"))}catch{return[]}return n.flatMap(t=>{let i=c(S(e),t);try{let r=N(c(i,"Contents","Info.plist"),"utf8"),o=/<key>CFBundleIdentifier<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1],s=/<key>CFBundleName<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1];return!o?.startsWith(re)||s===void 0?[]:[{path:i,key:`${o} - ${(u=>u.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"))(s)} - runWorkflowAsService`}]}catch{return[]}})}function Xe(e){try{return JSON.parse(N(Pe(e),"utf8"))}catch{return}}var Sn=e=>Xe(e)!==void 0,d=(e,n)=>{Z(P(e),{recursive:!0}),We(e,n)};async function Mn(e){if(!Qe(e.platform))return;let n=h({sharpen:e.sharpen,presets:e.presets??[]});if(Z(e.menuDir,{recursive:!0}),e.platform==="linux")await nn(e,n);else if(e.platform==="darwin"){let i=c(e.menuDir,"run"),r=n.filter(f=>f.preset!==void 0),o=r.map(f=>c(S(e),O(f,i).name));d(i,xe({...e,bundles:[...q(e),...o],services:[...W(),...r.map(k)]})),Q(i,493);let s=Ne(e);for(let f of[...q(e),...s.map(C=>C.path)])p(f,{recursive:!0,force:!0});let m=new Map,{default:u}=await import("sharp");for(let f of n){m.has(f.paint)||m.set(f.paint,await u(await v(f.paint,64)).tiff().toBuffer());let{name:C,files:Re}=O(f,i),ne=c(S(e),C);for(let[Be,Ue]of Object.entries(Re))d(c(ne,Be),Ue);d(c(ne,"Contents","Resources",`${te}.tiff`),m.get(f.paint))}let g=n.map(k),w=new Set([...W(),...s.map(f=>f.key)]);await e.run(...$({on:g,off:[...w].filter(f=>!g.includes(f))})),await e.run(Fe,["-update"])}else{d(c(e.menuDir,"run.mjs"),ve({...e,keys:J()}));for(let i of Ce){let r=await Promise.all([16,24,32,48,256].map(async o=>({size:o,png:await v(i,o)})));d(c(e.menuDir,K({paint:i})),ye(r))}d(c(e.menuDir,"forge.png"),await v("forge",256)),await e.run("powershell.exe",Le(V(Ee({...e,items:n}))))}let t={version:e.version,forge:e.forge,node:e.node,execArgv:e.execArgv,...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.presets&&e.presets.length>0?{presets:[...e.presets]}:{}};d(Pe(e),JSON.stringify(t))}var Qe=e=>e==="darwin"||e==="win32"||e==="linux",Ce=["forge","convert","compress","edit","pdf"],Oe=e=>ie({home:e.home,...e.xdgDataHome===void 0?{}:{xdgDataHome:e.xdgDataHome},...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.xdgConfigDirs===void 0?{}:{xdgConfigDirs:e.xdgConfigDirs}});function X(e){let n=h({sharpen:!0}),t=n.map(r=>r.action),i=(r,o)=>{try{return be(r).filter(o).map(s=>c(r,s))}catch{return[]}};return[...new Set([...n.map(r=>c(l(e),A(r))),...i(l(e),()=>!0),...n.map(r=>c(x(e),H(r,t))),...i(x(e),r=>r.startsWith("forge-")&&r.endsWith(".nemo_action")),...R.map(r=>c(E(e),L(r)))])]}var y=e=>{try{return N(e,"utf8")}catch{return}};function Ae(e){for(let n of e)y(n)?.includes(D)&&p(n,{force:!0})}var He=e=>c(e.menuDir,"made.json"),z=e=>{try{return JSON.parse(N(He(e),"utf8"))}catch{return[]}};function F(e,n){let t=[];for(let i=n;!Ie(i)&&P(i)!==i;i=P(i))t.push(i);t.length!==0&&(Z(n,{recursive:!0}),d(He(e),JSON.stringify([...new Set([...z(e),...t])])))}function Ze(e){for(let n of[...e].sort((t,i)=>i.length-t.length))try{qe(n)}catch{}}var ee=e=>c(e.menuDir,"thunar-seed.xml");async function ze(e,n,t,i){let r=I(n),o=y(r);if(o===void 0){if(!ge(n,e.path,Ie))return;o=ue(n).map(y).find(m=>m!==void 0&&B(m,"")!==void 0)??fe,d(ee(e),o),F(e,P(r))}let s=B(o,me(t,{launcher:i,menuDir:e.menuDir}));s!==void 0&&s!==y(r)&&await M(r,Buffer.from(s))}async function en(e,n){let t=I(n),i=y(t);if(i===void 0||!i.includes(`<unique-id>${D}-`))return;let r=de(i);r===y(ee(e))?p(t,{force:!0}):await M(t,Buffer.from(r))}async function Y(e,n,t=!1){await M(e,Buffer.from(n)),t&&Q(e,493)}async function nn(e,n){let t=Oe(e),i=c(e.menuDir,"run");for(let o of Ce)d(c(e.menuDir,oe({paint:o})),await v(o,128));Ae(X(t));let r=h({sharpen:!0}).map(o=>o.action);F(e,l(t));for(let o of n)await Y(c(l(t),A(o)),se(o,i),!0);F(e,x(t));for(let o of n)await Y(c(x(t),H(o,r)),ae(o,i));F(e,E(t));for(let o of R){let s=ce(o,n,{launcher:i,menuDir:e.menuDir});s!==void 0&&await Y(c(E(t),L(o)),s,!0)}await ze(e,t,n,i),d(i,Se({...e,files:X(t),folders:[...new Set([l(t),...z(e)])].sort((o,s)=>s.length-o.length),marker:D,thunar:{file:I(t),seed:ee(e)}})),Q(i,493)}async function tn(e){let n=Oe(e);Ae(X(n)),await en(e,n),Ze([l(n),...z(e)]),p(e.menuDir,{recursive:!0,force:!0})}async function kn(e){if(e.platform==="linux")await tn(e);else if(e.platform==="darwin"){let n=Ne(e);for(let i of[...q(e),...n.map(r=>r.path)])p(i,{recursive:!0,force:!0});p(e.menuDir,{recursive:!0,force:!0});let t=new Set([...W(),...n.map(i=>i.key)]);await e.run(...$({on:[],off:[...t]})),await e.run(Fe,["-update"])}else e.platform==="win32"&&(p(e.menuDir,{recursive:!0,force:!0}),await e.run("powershell.exe",Le(V([]))))}var Le=e=>["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",e],Dn=(e,n)=>new Promise((t,i)=>{Ye(e,n,{timeout:6e4,windowsHide:!0},r=>r?i(r):t())});export{vn as a,Xe as b,Sn as c,Mn as d,Qe as e,kn as f,Dn as g};
@@ -1,3 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{a as s}from"./chunk-WE6KP4FR.js";import{E as o}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var c=["open","convert","compress","sharpen","open-pdf","preset"];function u(r){let[e,n,...i]=r;if(e==="install"||e==="remove")return{kind:e};if(e==="run"||e==="open"){if(!c.includes(n))throw o(`No menu action called "${n??""}".`);if(n==="preset"){let[t,...a]=i;if(e!=="run"||t===void 0||!s(t))throw o(`No preset called "${t??""}".`);return{kind:"run",action:n,preset:t,paths:a}}return{kind:e,action:n,paths:i}}throw o(`No menu command called "${e??""}".`)}function m(r,e){switch(r){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-pdf":return{paths:e,mode:"pdf",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}export{m as openedFor,u as parseMenuArgs};