forge-terminal 0.5.3 → 0.5.5

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 (68) hide show
  1. package/README.md +7 -5
  2. package/dist/chunks/{about-credits-DBQHH5HA.js → about-credits-VRRE6342.js} +1 -1
  3. package/dist/chunks/{args-TZMA4ZR6.js → args-5BPKCNTL.js} +1 -1
  4. package/dist/chunks/{boot-E57BKWEC.js → boot-MX7UP2M2.js} +1 -1
  5. package/dist/chunks/{chunk-N3X3H4IZ.js → chunk-2NSUAERD.js} +1 -1
  6. package/dist/chunks/{chunk-6LMVOQQA.js → chunk-2ZZXIDYX.js} +1 -1
  7. package/dist/chunks/{chunk-FLMQ5VFR.js → chunk-3YWAVKDZ.js} +1 -1
  8. package/dist/chunks/{chunk-TYWGB767.js → chunk-45BFQHJB.js} +1 -1
  9. package/dist/chunks/{chunk-5YUOG3A5.js → chunk-7IWX5VSI.js} +1 -1
  10. package/dist/chunks/{chunk-3GHHQNR6.js → chunk-BI2E72HM.js} +1 -1
  11. package/dist/chunks/{chunk-E2BYNETT.js → chunk-BONMSCKD.js} +1 -1
  12. package/dist/chunks/{chunk-EITGK5OI.js → chunk-BU4YYGUJ.js} +1 -1
  13. package/dist/chunks/{chunk-7VR6LODN.js → chunk-D4R7UACU.js} +1 -1
  14. package/dist/chunks/{chunk-IE6NFN3N.js → chunk-HACM3MAD.js} +1 -1
  15. package/dist/chunks/chunk-HFQOGB4T.js +4 -0
  16. package/dist/chunks/{chunk-ZOQA3JAR.js → chunk-HGJXGAGJ.js} +1 -1
  17. package/dist/chunks/{chunk-AFEYLHDD.js → chunk-HVMQTKP6.js} +1 -1
  18. package/dist/chunks/{chunk-IKZTH2RL.js → chunk-HYMPLIHW.js} +1 -1
  19. package/dist/chunks/{chunk-MNI6IKIU.js → chunk-JJV2YXZQ.js} +1 -1
  20. package/dist/chunks/{chunk-4YFFT5CZ.js → chunk-KDBKDURW.js} +2 -2
  21. package/dist/chunks/{chunk-IJRLRAC5.js → chunk-L5JBHB4G.js} +1 -1
  22. package/dist/chunks/chunk-MES4FVLR.js +3 -0
  23. package/dist/chunks/{chunk-Z2H2GT2X.js → chunk-MMLROWBQ.js} +2 -2
  24. package/dist/chunks/{chunk-TFOEI5VF.js → chunk-OGYSMKRM.js} +1 -1
  25. package/dist/chunks/{chunk-EURVTBPH.js → chunk-OUXPGAQL.js} +1 -1
  26. package/dist/chunks/{chunk-QPJ2LNXB.js → chunk-R7BEV6PR.js} +1 -1
  27. package/dist/chunks/chunk-RLOJSZ6W.js +3 -0
  28. package/dist/chunks/{chunk-5IZBFF6Y.js → chunk-SZCSV3PX.js} +1 -1
  29. package/dist/chunks/chunk-TRJXZLR6.js +82 -0
  30. package/dist/chunks/{chunk-TDYKRRZH.js → chunk-UGATQHEE.js} +1 -1
  31. package/dist/chunks/{chunk-ZYIW4MAG.js → chunk-WCOFUMZU.js} +1 -1
  32. package/dist/chunks/{chunk-AIINYKXW.js → chunk-ZBETH6BR.js} +1 -1
  33. package/dist/chunks/chunk-ZX5FDZZW.js +55 -0
  34. package/dist/chunks/clip-command-WJ5P4DTN.js +3 -0
  35. package/dist/chunks/{clipboard-7KSZNWWT.js → clipboard-3VFHDKYE.js} +1 -1
  36. package/dist/chunks/{colour-PZOAKNTH.js → colour-5YBDFXXX.js} +1 -1
  37. package/dist/chunks/command-BKAPI4A5.js +3 -0
  38. package/dist/chunks/{entry-REXB6JNP.js → entry-7GW4RIK2.js} +2 -2
  39. package/dist/chunks/execute-LBGFY5TG.js +3 -0
  40. package/dist/chunks/{extensions-UV4X2UUA.js → extensions-HTBACHMC.js} +1 -1
  41. package/dist/chunks/{extensions-command-TLW53BUK.js → extensions-command-VXZL55KR.js} +1 -1
  42. package/dist/chunks/{ffmpeg-32EEMAZS.js → ffmpeg-Z7JQT53Y.js} +1 -1
  43. package/dist/chunks/{image-YMCS4PTS.js → image-FYCF2AVH.js} +1 -1
  44. package/dist/chunks/{install-7ZRVQKCF.js → install-5YXQ6YV3.js} +1 -1
  45. package/dist/chunks/{launch-IVBMNYNY.js → launch-U63VZQXC.js} +5 -5
  46. package/dist/chunks/{manager-XPO4ZIRY.js → manager-QUTR3RYR.js} +2 -2
  47. package/dist/chunks/{needed-NOGBHTHE.js → needed-X5D4E5X5.js} +1 -1
  48. package/dist/chunks/{notify-YEBP67MP.js → notify-NQNNOBFC.js} +1 -1
  49. package/dist/chunks/{own-G4G4MRGM.js → own-5JN35AUV.js} +1 -1
  50. package/dist/chunks/{pdfium-BAMNBCNW.js → pdfium-GKF4ES7K.js} +1 -1
  51. package/dist/chunks/{preset-command-XXKLUJOS.js → preset-command-H6G22SZD.js} +1 -1
  52. package/dist/chunks/{registry-PKOPEG3Z.js → registry-LLAHKI4G.js} +1 -1
  53. package/dist/chunks/{server-AR73FWWG.js → server-CIGFNW7X.js} +3 -3
  54. package/dist/chunks/{theme-D4AMWFFW.js → theme-HAB66OAL.js} +1 -1
  55. package/dist/chunks/{transcribe-EFVJPBPG.js → transcribe-FVCOCTGA.js} +1 -1
  56. package/dist/chunks/{transcribe-command-Q4J3WTOB.js → transcribe-command-XCBGAQMI.js} +1 -1
  57. package/dist/chunks/{update-note-2YR3TLPK.js → update-note-47IPWQKY.js} +1 -1
  58. package/dist/chunks/{watch-command-2D7NLDAM.js → watch-command-VL6LOERU.js} +1 -1
  59. package/dist/index.js +9 -9
  60. package/package.json +5 -9
  61. package/dist/chunks/chunk-3CLPUPJT.js +0 -55
  62. package/dist/chunks/chunk-BIBDLXCG.js +0 -3
  63. package/dist/chunks/chunk-EPDF4NQI.js +0 -3
  64. package/dist/chunks/chunk-ITJZ7ODJ.js +0 -4
  65. package/dist/chunks/chunk-NHMACTW3.js +0 -82
  66. package/dist/chunks/clip-command-QPLYCGJ2.js +0 -3
  67. package/dist/chunks/command-DMGGGAPS.js +0 -3
  68. package/dist/chunks/execute-GKO4THUK.js +0 -3
@@ -0,0 +1,55 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as h}from"./chunk-6RMRWBMB.js";import{execFile as P}from"node:child_process";import{accessSync as U,constants as _}from"node:fs";import{isAbsolute as M,join as a}from"node:path";var D=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function x(e,t){if(typeof e=="string")return`${t}<string>${D(e)}</string>`;if(typeof e=="number")return`${t}<integer>${e}</integer>`;if(typeof e=="boolean")return`${t}<${e}/>`;if(Array.isArray(e))return`${t}<array>
4
+ ${e.map(i=>x(i,`${t} `)).join(`
5
+ `)}
6
+ ${t}</array>`;let n=Object.entries(e).map(([i,o])=>`${t} <key>${D(i)}</key>
7
+ ${x(o,`${t} `)}`);return n.length===0?`${t}<dict/>`:`${t}<dict>
8
+ ${n.join(`
9
+ `)}
10
+ ${t}</dict>`}var N=e=>`<?xml version="1.0" encoding="UTF-8"?>
11
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
12
+ <plist version="1.0">
13
+ ${x(e,"")}
14
+ </plist>
15
+ `,v={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf",video:"public.movie",audio:"public.audio"};function w(e){return e.length===1&&e[0]==="image"?"com.apple.Automator.fileSystemObject.image":e.length===1&&e[0]==="pdf"?"com.apple.Automator.fileSystemObject.PDF":e.length===1&&e[0]==="folder"?"com.apple.Automator.fileSystemObject.folder":"com.apple.Automator.fileSystemObject"}var u=e=>`'${e.replace(/'/g,"'\\''")}'`,E="forge",A=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,G="com.forge-terminal.menu.",I="runWorkflowAsService",Q=e=>`${A(e)} - ${e.label} - ${I}`,k=`ObjC.import('Foundation')
16
+ function run(argv) {
17
+ const domain = argv[0]
18
+ const defaults = $.NSUserDefaults.standardUserDefaults
19
+ const or = (v) => (v.isNil() ? $.NSDictionary.dictionary : v)
20
+ const all = $.NSMutableDictionary.dictionaryWithDictionary(or(defaults.persistentDomainForName(domain)))
21
+ const status = $.NSMutableDictionary.dictionaryWithDictionary(or(all.objectForKey('NSServicesStatus')))
22
+ const on = { presentation_modes: { ContextMenu: true, FinderPreview: true, ServicesMenu: true, TouchBar: true } }
23
+ for (const arg of argv.slice(1)) {
24
+ const key = arg.slice(1)
25
+ if (arg[0] === '+') status.setObjectForKey($(on), key)
26
+ else status.removeObjectForKey(key)
27
+ }
28
+ all.setObjectForKey(status, 'NSServicesStatus')
29
+ defaults.setPersistentDomainForName(all, domain)
30
+ }`;function z(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",k,e.domain??"pbs",...e.on.map(t=>`+${t}`),...e.off.map(t=>`-${t}`)]]}function Z(e,t){let n=N({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:A(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:E,NSMenuItem:{default:e.label},NSMessage:I,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(c=>v[c])}]}),i=e.preset===void 0?"":` ${u(e.preset)}`,o=`${u(t)} ${e.action}${i} "$@"`,r=N({AMApplicationBuild:"521",AMApplicationVersion:"2.10",AMDocumentVersion:"2",actions:[{action:{AMAccepts:{Container:"List",Optional:!0,Types:["com.apple.cocoa.path"]},AMActionVersion:"2.0.3",AMApplication:["Automator"],AMParameterProperties:{COMMAND_STRING:{},CheckedForUserDefaultShell:{},inputMethod:{},shell:{},source:{}},AMProvides:{Container:"List",Types:["com.apple.cocoa.string"]},ActionBundlePath:"/System/Library/Automator/Run Shell Script.action",ActionName:"Run Shell Script",ActionParameters:{COMMAND_STRING:o,CheckedForUserDefaultShell:!0,inputMethod:1,shell:"/bin/zsh",source:""},BundleIdentifier:"com.apple.RunShellScript",CFBundleVersion:"2.0.3",CanShowSelectedItemsWhenRun:!1,CanShowWhenRun:!0,Category:["AMCategoryUtilities"],"Class Name":"RunShellScriptAction",InputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A01",OutputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A02",UUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A03",UnlocalizedApplications:["Automator"]},isViewVisible:!0}],connectors:{},workflowMetaData:{serviceApplicationBundleID:"com.apple.finder",serviceApplicationPath:"/System/Library/CoreServices/Finder.app",serviceInputTypeIdentifier:w(e.kinds),serviceOutputTypeIdentifier:"com.apple.Automator.nothing",serviceProcessesInput:!1,workflowTypeIdentifier:"com.apple.Automator.servicesMenu"}});return{name:`${e.label}.workflow`,files:{"Contents/Info.plist":n,"Contents/document.wflow":r,"Contents/Resources/document.wflow":r}}}var d="forge-terminal-menu";function oe(e){let t=i=>i&&M(i)?i:void 0,n=(e.xdgConfigDirs??"").split(":").filter(i=>M(i));return{dataHome:t(e.xdgDataHome)??a(e.home,".local","share"),configHome:t(e.xdgConfigHome)??a(e.home,".config"),configDirs:n.length>0?n:["/etc/xdg"]}}function S(e,t=process.env.PATH){for(let n of(t??"").split(":"))if(n!=="")try{return U(a(n,e),_.X_OK),!0}catch{}return!1}var F={image:"image/*",folder:"inode/directory",pdf:"application/pdf",video:"video/*",audio:"audio/*"},L=e=>e.map(t=>`${F[t]};`).join(""),b=e=>`${e.paint}.png`,re=e=>a(e.dataHome,"nautilus","scripts","Forge"),f=e=>e.preset===void 0?e.action:`preset-${e.preset}`,g=e=>e.preset===void 0?e.action:`preset ${e.preset}`,se=e=>e.label;function ae(e,t){return`#!/bin/sh
31
+ # ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
32
+ if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
33
+ IFS='
34
+ '
35
+ set -f
36
+ set -- $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
37
+ fi
38
+ exec ${u(t)} ${g(e)} "$@"
39
+ `}var ce=e=>a(e.dataHome,"nemo","actions"),ue=(e,t)=>`forge-${e.preset===void 0?t.indexOf(e.action)+1:t.length+1}-${f(e)}.nemo_action`,m=e=>e.replace(/%/g,"%%");function pe(e,t){return`[Nemo Action]
40
+ # ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
41
+ Name=${m(e.label)}
42
+ Comment=${m(e.label)}
43
+ Exec=${m(u(t))} ${g(e)} %F
44
+ Selection=notnone
45
+ Mimetypes=${L(e.kinds)}
46
+ `}var le=e=>a(e.dataHome,"kio","servicemenus"),me=e=>`forge-${e}.desktop`,de=["image","folder","pdf","video","audio"],O=e=>m(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function fe(e,t,n){let i=t.filter(s=>s.kinds.includes(e));if(i.length===0)return;let o=i.length>1,r=["[Desktop Entry]",`# ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.`,"Type=Service","ServiceTypes=KonqPopupMenu/Plugin","X-KDE-ServiceTypes=KonqPopupMenu/Plugin",`MimeType=${F[e]};`,`Actions=${i.map(s=>`${f(s)};`).join("")}`,"X-KDE-Priority=TopLevel",...o?["X-KDE-Submenu=Forge",`Icon=${a(n.menuDir,"forge.png")}`]:[]],c=i.map(s=>["",`[Desktop Action ${f(s)}]`,`Name=${s.label}`,`Icon=${a(n.menuDir,b(s))}`,`Exec=${O(n.launcher)} ${g(s)} %F`].join(`
47
+ `));return`${[...r,...c].join(`
48
+ `)}
49
+ `}var ge=e=>a(e.configHome,"Thunar","uca.xml"),$e=e=>e.configDirs.map(t=>a(t,"Thunar","uca.xml")),xe=`<?xml version="1.0" encoding="UTF-8"?>
50
+ <actions>
51
+ </actions>
52
+ `,y=e=>`${d}-${f(e)}`,l=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),j={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"},video:{patterns:["*"],type:"video-files"},audio:{patterns:["*"],type:"audio-files"}};function ye(e,t){return e.flatMap(n=>{let i=n.kinds.filter(r=>r==="pdf"),o=n.kinds.filter(r=>r!=="pdf");return[...o.length>0?[{item:n,kinds:o,id:y(n)}]:[],...i.length>0?[{item:n,kinds:i,id:o.length>0?`${y(n)}-pdf`:y(n)}]:[]]}).map(({item:n,kinds:i,id:o})=>{let r=i.map(p=>j[p]),c=[...new Set(r.flatMap(p=>p.patterns))],s=c.includes("*")?["*"]:c;return["<action>",` <icon>${l(a(t.menuDir,b(n)))}</icon>`,` <name>${l(n.label)}</name>`,` <submenu>${i.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${o}</unique-id>`,` <command>${l(m(u(t.launcher)))} ${g(n)} %F</command>`,` <description>${l(n.label)}</description>`," <range></range>",` <patterns>${l(s.join(";"))}</patterns>`,...r.map(p=>` <${p.type}/>`),"</action>"].join(`
53
+ `)}).map(n=>`${n}
54
+ `).join("")}var R=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function B(e){return e.replace(R,t=>t.includes(`<unique-id>${d}-`)?"":t)}function Se(e,t){let n=B(e),i=n.lastIndexOf("</actions>");if(i===-1||!/<actions>/.test(n))return;let o=n.lastIndexOf(`
55
+ `,i)+1;return/^[ \t]*$/.test(n.slice(o,i))&&(i=o),`${n.slice(0,i)}${t}${n.slice(i)}`}var he=(e,t,n)=>S("thunar",t)||n(a(e.configHome,"Thunar"));var K="ForgeTerminal.Forge",C=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),H=e=>e.replace(/['‘’‚‛]/g,"$&$&"),T=H;function W(e,t){return["[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null","$x = New-Object Windows.Data.Xml.Dom.XmlDocument",`$x.LoadXml('<toast><visual><binding template="ToastText02"><text id="1">${T(C(e))}</text><text id="2">${T(C(t))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${K}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function X(e,t,n=process.platform){return n==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",W(e,t)]]:["/usr/bin/osascript",["-e","on run argv","-e","display notification (item 2 of argv) with title (item 1 of argv)","-e","end run",e,t]]}var $=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function V(e,t,n={}){let i=n.has??(o=>S(o));if(i("notify-send"))return["notify-send",["--app-name=Forge",...n.icon?[`--icon=${n.icon}`]:[],"--",e,t]];if(i("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",$("Forge"),"0",$(n.icon??""),$(e),$(t),"[]","{}","-1"]]}function q(e,t,n=process.platform,i={}){let o=n==="linux"?V(e,t,i):X(e,t,n);return new Promise(r=>{if(o===void 0)return r();try{P(o[0],o[1],{timeout:1e4,windowsHide:!0},()=>r())}catch{r()}})}var J=(e,t)=>new Promise((n,i)=>P(e,t,{timeout:2e3},(o,r)=>o?i(o):n(r)));async function Y(e,t=J){let n=(await t("lsappinfo",["front"])).trim();return(await t("lsappinfo",["info","-only","bundleid",n])).match(/bundleID="([^"]*)"/)?.[1]===e}async function Me(e,t,n={}){if(e===void 0||!h(t))return;let i=n.platform??process.platform,o=n.env??process.env;if(o.FORGE_NO_NOTIFY||o.SSH_CONNECTION||o.SSH_TTY)return;let r=o.__CFBundleIdentifier;i==="darwin"&&r&&await Y(r,n.ask).catch(()=>!1)||await(n.post??((c,s)=>q(c,s,i)))(e.title,e.body)}export{u as a,E as b,G as c,Q as d,z as e,Z as f,d as g,oe as h,S as i,b as j,re as k,se as l,ae as m,ce as n,ue as o,pe as p,le as q,me as r,de as s,fe as t,ge as u,$e as v,xe as w,ye as x,B as y,Se as z,he as A,K as B,H as C,W as D,X as E,$ as F,V as G,q as H,Y as I,Me as J};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d}from"./chunk-2NSUAERD.js";import"./chunk-HGJXGAGJ.js";import"./chunk-45BFQHJB.js";import"./chunk-HFQOGB4T.js";import"./chunk-OUXPGAQL.js";import"./chunk-BI2E72HM.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-HYMPLIHW.js";import"./chunk-WCOFUMZU.js";import"./chunk-L5JBHB4G.js";import"./chunk-D4R7UACU.js";import"./chunk-SZCSV3PX.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-HVMQTKP6.js";import"./chunk-O7DK3GJT.js";import"./chunk-MES4FVLR.js";import"./chunk-EEQSUBBL.js";import"./chunk-BONMSCKD.js";import"./chunk-HACM3MAD.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-OGYSMKRM.js";import"./chunk-J6AZTW62.js";import"./chunk-RLOJSZ6W.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.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-EITGK5OI.js";import"./chunk-TYWGB767.js";import"./chunk-BIBDLXCG.js";import"./chunk-CVNYUROW.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};
3
+ import{a,b,c}from"./chunk-BU4YYGUJ.js";import"./chunk-45BFQHJB.js";import"./chunk-RLOJSZ6W.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{h as S,i as k,m as C}from"./chunk-FLMQ5VFR.js";import{i as $,k as u,l as w}from"./chunk-VTA6Z45X.js";import{c as I,d as y,f as O}from"./chunk-PBIS2ONZ.js";import{b as m,c as d,h as f,i as p}from"./chunk-QVACE4IE.js";import{a as h,b as g}from"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import{a as l}from"./chunk-AFEYLHDD.js";import"./chunk-EPDF4NQI.js";import"./chunk-EEQSUBBL.js";import"./chunk-E2BYNETT.js";import"./chunk-IE6NFN3N.js";import"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import{k as x}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import{c as b}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{resolve as R}from"node:path";var P=({r:t,g:n,b:o},s)=>s?`\x1B[38;2;${t};${n};${o}m\u2588\u2588\x1B[39m `:"";function N(t,n){let o=d(n),s,e=Number.POSITIVE_INFINITY;for(let r of t){let a=(r.centre.L-o.L)**2+(r.centre.a-o.a)**2+(r.centre.b-o.b)**2;a<e&&(e=a,s=r)}return s}async function D(t,n){let{pixels:o}=await C(t.input),s=I(o);if(s.length===0)throw x(t.input);let e=t.inside?N(s,t.inside):void 0,r=e?y(o,e):s;if(t.svg)return{exitCode:0,stdout:[S(b(t.input),r,"light",e?.hex)],stderr:[]};if(n.json){let i=h(l,{source:R(t.input),...e?{inside:e.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:f(c.rgb),oklch:p(c.rgb),share:c.share}))});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}let a=O(r.map(i=>i.share));return{exitCode:0,stdout:r.map((i,c)=>`${P(i.rgb,n.colour)}${i.hex} ${String(a[c]).padStart(3)}%`),stderr:[]}}async function H(t,n){let o=$(t.colour);if(t.svg)return{exitCode:0,stdout:[k(t.colour,o)],stderr:[]};let s=o.map(e=>({...e,...w(e.rgb)}));if(n.json){let e=g(l,{reference:m(t.colour),steps:s.map(r=>({step:r.step,hex:r.hex,oklch:p(r.rgb),white:r.white,black:r.black}))});return{exitCode:0,stdout:[JSON.stringify(e)],stderr:[]}}return{exitCode:0,stdout:s.map(e=>`${String(e.step).padStart(4)} ${P(e.rgb,n.colour)}${e.hex} white ${e.white.toFixed(1)} ${u(e.white)} \xB7 black ${e.black.toFixed(1)} ${u(e.black)}`),stderr:[]}}export{D as runPalette,H as runScale};
3
+ import{h as S,i as k,m as C}from"./chunk-3YWAVKDZ.js";import{i as $,k as u,l as w}from"./chunk-VTA6Z45X.js";import{c as I,d as y,f as O}from"./chunk-PBIS2ONZ.js";import{b as m,c as d,h as f,i as p}from"./chunk-QVACE4IE.js";import{a as h,b as g}from"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import{a as l}from"./chunk-HVMQTKP6.js";import"./chunk-MES4FVLR.js";import"./chunk-EEQSUBBL.js";import"./chunk-BONMSCKD.js";import"./chunk-HACM3MAD.js";import"./chunk-OGYSMKRM.js";import"./chunk-J6AZTW62.js";import"./chunk-RLOJSZ6W.js";import"./chunk-7KYO62XK.js";import{k as x}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import{c as b}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{resolve as R}from"node:path";var P=({r:t,g:n,b:o},s)=>s?`\x1B[38;2;${t};${n};${o}m\u2588\u2588\x1B[39m `:"";function N(t,n){let o=d(n),s,e=Number.POSITIVE_INFINITY;for(let r of t){let a=(r.centre.L-o.L)**2+(r.centre.a-o.a)**2+(r.centre.b-o.b)**2;a<e&&(e=a,s=r)}return s}async function D(t,n){let{pixels:o}=await C(t.input),s=I(o);if(s.length===0)throw x(t.input);let e=t.inside?N(s,t.inside):void 0,r=e?y(o,e):s;if(t.svg)return{exitCode:0,stdout:[S(b(t.input),r,"light",e?.hex)],stderr:[]};if(n.json){let i=h(l,{source:R(t.input),...e?{inside:e.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:f(c.rgb),oklch:p(c.rgb),share:c.share}))});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}let a=O(r.map(i=>i.share));return{exitCode:0,stdout:r.map((i,c)=>`${P(i.rgb,n.colour)}${i.hex} ${String(a[c]).padStart(3)}%`),stderr:[]}}async function H(t,n){let o=$(t.colour);if(t.svg)return{exitCode:0,stdout:[k(t.colour,o)],stderr:[]};let s=o.map(e=>({...e,...w(e.rgb)}));if(n.json){let e=g(l,{reference:m(t.colour),steps:s.map(r=>({step:r.step,hex:r.hex,oklch:p(r.rgb),white:r.white,black:r.black}))});return{exitCode:0,stdout:[JSON.stringify(e)],stderr:[]}}return{exitCode:0,stdout:s.map(e=>`${String(e.step).padStart(4)} ${P(e.rgb,n.colour)}${e.hex} white ${e.white.toFixed(1)} ${u(e.white)} \xB7 black ${e.black.toFixed(1)} ${u(e.black)}`),stderr:[]}}export{D as runPalette,H as runScale};
@@ -0,0 +1,3 @@
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 a}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var d=["open","convert","compress","sharpen","open-file","preset"];function f(t){let[e,n,...r]=t,o=n==="open-pdf"?"open-file":n;if(e==="install"||e==="remove")return{kind:e};if(e==="run"||e==="open"){if(!d.includes(o))throw a(`No menu action called "${o??""}".`);if(o==="preset"){let[i,...c]=r;if(e!=="run"||i===void 0||!s(i))throw a(`No preset called "${i??""}".`);return{kind:"run",action:o,preset:i,paths:c}}return{kind:e,action:o,paths:r}}throw a(`No menu command called "${e??""}".`)}function p(t,e,n=!1){switch(t){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-file":return{paths:e,mode:n?"pdf":"convert",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}async function h(t,e){let[n]=e;return p(t,e,t==="open-file"&&n!==void 0&&await u(n))}async function u(t){let{open:e}=await import("node:fs/promises");try{let n=await e(t,"r");try{let r=Buffer.alloc(1024),{bytesRead:o}=await n.read(r,0,r.length,0);return r.subarray(0,o).includes("%PDF-")}finally{await n.close()}}catch{return!1}}export{p as openedFor,h as openedForClick,f as parseMenuArgs};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as $,b as R,d as g,e as F,f as m,g as G}from"./chunk-NHMACTW3.js";import{H as k,a as N,i as I,j as O}from"./chunk-3CLPUPJT.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-7I2OSTBX.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-BIBDLXCG.js";import{a as y}from"./chunk-CVNYUROW.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(`
3
+ import{a as $,b as R,d as g,e as F,f as m,g as G}from"./chunk-TRJXZLR6.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-7I2OSTBX.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-RLOJSZ6W.js";import{a as y}from"./chunk-CVNYUROW.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-7ZRVQKCF.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-D4AMWFFW.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-TZMA4ZR6.js"),{runIntent:t}=await import("./execute-GKO4THUK.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-XXKLUJOS.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-4W3XWWCE.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}
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-5YXQ6YV3.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-HAB66OAL.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-5BPKCNTL.js"),{runIntent:t}=await import("./execute-LBGFY5TG.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-H6G22SZD.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-4W3XWWCE.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};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as a,d as b,e as c,f as d}from"./chunk-HFQOGB4T.js";import"./chunk-OUXPGAQL.js";import"./chunk-BI2E72HM.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-HYMPLIHW.js";import"./chunk-WCOFUMZU.js";import"./chunk-L5JBHB4G.js";import"./chunk-D4R7UACU.js";import"./chunk-SZCSV3PX.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-HVMQTKP6.js";import"./chunk-O7DK3GJT.js";import"./chunk-MES4FVLR.js";import"./chunk-EEQSUBBL.js";import"./chunk-BONMSCKD.js";import"./chunk-HACM3MAD.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-OGYSMKRM.js";import"./chunk-J6AZTW62.js";import"./chunk-RLOJSZ6W.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.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-4YFFT5CZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-VTA6Z45X.js";import"./chunk-PBIS2ONZ.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-U5TEGDGH.js";import"./chunk-QVACE4IE.js";import"./chunk-AFEYLHDD.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-CVNYUROW.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};
3
+ import{Jb as a,Kb as b,Lb as c,Mb as d,Nb as e}from"./chunk-KDBKDURW.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-VTA6Z45X.js";import"./chunk-PBIS2ONZ.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-U5TEGDGH.js";import"./chunk-QVACE4IE.js";import"./chunk-HVMQTKP6.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-CVNYUROW.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-XPO4ZIRY.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-NOGBHTHE.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};
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-QUTR3RYR.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-X5D4E5X5.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-E2BYNETT.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};
3
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-BONMSCKD.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,i as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,b as readNames,j as readProgress,k as runFfmpeg,h as soundLevels};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h}from"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
3
+ import{m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h}from"./chunk-OGYSMKRM.js";import"./chunk-J6AZTW62.js";import"./chunk-RLOJSZ6W.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
@@ -1,3 +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}from"./chunk-NHMACTW3.js";import"./chunk-3CLPUPJT.js";import"./chunk-6RMRWBMB.js";import"./chunk-BIBDLXCG.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};
3
+ import{a,b,c,d,e,f,g}from"./chunk-TRJXZLR6.js";import"./chunk-ZX5FDZZW.js";import"./chunk-6RMRWBMB.js";import"./chunk-RLOJSZ6W.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};