@stacksjs/desktop 0.2.360 → 0.2.362
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/dist/browser.d.ts +2 -0
- package/dist/browser.js +1 -1
- package/dist/{chunk-dr2ba0an.js → chunk-gzgq8v6d.js} +1 -1
- package/dist/{chunk-qmw80h4r.js → chunk-hgcnqp53.js} +15 -15
- package/dist/index.d.ts +6 -1
- package/dist/index.js +24 -24
- package/dist/menu.d.ts +10 -3
- package/dist/sidebar.d.ts +29 -0
- package/dist/test-utils.js +1 -1
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './bluetooth';
|
|
|
26
26
|
export * from './bonjour';
|
|
27
27
|
export * from './capabilities';
|
|
28
28
|
export * from './clipboard';
|
|
29
|
+
export * from './context-menu';
|
|
29
30
|
export * from './continuity-camera';
|
|
30
31
|
export * from './coreml';
|
|
31
32
|
export * from './crash-reporter';
|
|
@@ -65,6 +66,7 @@ export * from './screen-sharing';
|
|
|
65
66
|
export * from './serial';
|
|
66
67
|
export * from './service-menu';
|
|
67
68
|
export * from './shell';
|
|
69
|
+
export * from './sidebar';
|
|
68
70
|
export * from './speech';
|
|
69
71
|
export * from './speech-recognition';
|
|
70
72
|
export * from './spotlight';
|
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as Az,$a as AA,A as jq,Aa as $z,B as xq,Ba as jz,C as kq,Ca as xz,D as yq,Da as kz,E as wq,Ea as yz,F as fq,Fa as wz,G as gq,Ga as fz,H as vq,Ha as gz,I as bq,Ia as vz,J as mq,Ja as bz,K as dq,Ka as mz,L as hq,La as dz,M as uq,Ma as hz,N as pq,Na as uz,O as lq,Oa as pz,P as cq,Pa as lz,Q as nq,Qa as cz,R as rq,Ra as nz,S as aq,Sa as rz,T as sq,Ta as az,U as oq,Ua as sz,V as tq,Va as oz,W as iq,Wa as tz,X as eq,Xa as iz,Ya as ez,Z as qz,Za as qA,_ as zz,_a as zA,a as Cq,aa as Bz,ab as BA,b as Dq,ba as Cz,bb as CA,c as Eq,ca as Dz,cb as DA,d as Fq,da as Ez,db as EA,e as Gq,ea as Fz,eb as FA,f as Hq,fa as Gz,fb as GA,g as Iq,ga as Hz,h as Jq,ha as Iz,i as Kq,ia as Jz,j as Lq,ja as Kz,k as Mq,ka as Lz,l as Nq,la as Mz,m as Oq,ma as Nz,n as Pq,na as Oz,o as Qq,oa as Pz,p as Rq,pa as Qz,q as Sq,qa as Rz,r as Tq,ra as Sz,s as Uq,sa as Tz,t as Vq,ta as Uz,u as Wq,ua as Vz,v as Xq,va as Wz,w as Yq,wa as Xz,x as Zq,xa as Yz,y as _q,ya as Zz,z as $q,za as _z}from"./chunk-hgcnqp53.js";import"./chunk-gzgq8v6d.js";export{Kz as windowEvents,mz as watchScreenSharing,qA as vision,Jz as updater,nq as unregisterHotkey,rq as unregisterAllHotkeys,Wz as touchbar,Dz as theme,az as tags,Mz as standardMenus,iz as spotlight,ez as speechRecognition,Yz as speech,$z as signPayload,Pz as sidebar,Hq as showWarningToast,Qq as showWarningModal,fq as showWarningDialog,Eq as showToast,Gq as showSuccessToast,Sq as showSuccessModal,$q as showSaveDialog,Tq as showQuestionModal,_q as showOpenDialog,Oq as showModal,jq as showMessageBox,Fq as showInfoToast,Pq as showInfoModal,Iq as showErrorToast,Rq as showErrorModal,wq as showErrorDialog,yq as showConfirmDialog,xq as showColorPicker,kq as showAlertDialog,Dq as showAlert,Bz as shell,CA as serviceMenu,DA as serial,bz as screenSharing,wz as screenCapture,Qz as screen,Cq as requestNotificationPermission,cq as registerHotkey,_z as redactPII,Wq as prompt,Tz as printing,Sz as permissions,sz as pdf,pq as parseShortcut,Jq as notify,zz as notifications,Iz as network,Vz as nativeWindow,Uz as nativeAutoLaunch,zA as midi,Nz as menu,oz as log,yz as location,pz as localServer,kz as liveActivities,Rz as keychain,Fz as isDragOutAvailable,mq as isCaffeinated,GA as isAvailable,jz as iap,hz as hasFocusShortcuts,xz as handoff,Cz as globalShortcuts,aq as getRegisteredHotkeys,gq as getDialogBridgeScript,FA as getCapability,EA as getCapabilities,dq as getCaffeinateStatus,Xq as getActiveModalCount,Mq as getActiveAlertCount,Az as fs,iq as formatTime,lq as formatShortcut,hq as formatRemainingTime,uq as formatDuration,eq as formatCompact,uz as focusShortcutsReady,dz as focus,rz as fileAssociations,Ez as dragOut,Lq as dismissAllAlerts,Kq as dismissAlertById,tq as delay,Gz as deepLinks,bq as decaffeinate,sq as createTimer,oq as createInterval,Zz as crashReporter,AA as coreml,BA as continuityCamera,Oz as contextMenu,Uq as confirm,Yq as closeAllModals,qz as clipboard,vq as caffeinate,tz as bonjour,Xz as bluetooth,lz as biometric,Hz as battery,cz as audio,nz as appleScript,Lz as app,Vq as alert,Nq as TOAST_STYLES,Zq as MODAL_STYLES,fz as MIN_WATCH_INTERVAL_MS,gz as MAX_WATCH_INTERVAL_MS,vz as DEFAULT_WATCH_INTERVAL_MS};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function wZ(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function h(){return typeof window<"u"&&typeof document<"u"}async function M4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var U=new Map;function IZ(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function yZ(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function fZ(Z="top-right"){if(!h())throw Error("Toast container requires browser environment");try{let Y=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if(Y)return Y}catch{}let $=document.createElement("div");$.className=`stx-toast-container ${Z}`,$.dataset.position=Z;try{if(document.body)document.body.appendChild($)}catch{}return $}function BZ(Z){let{options:$}=Z,Y=yZ($.type),z=$.type||"info",G=$.duration!==0;return`
|
|
3
3
|
<div class="stx-toast ${z}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
4
|
<div class="stx-toast-icon">${Y}</div>
|
|
5
5
|
<div class="stx-toast-content">
|
|
6
|
-
${$.title?`<div class="stx-toast-title">${
|
|
7
|
-
<div class="stx-toast-message">${
|
|
6
|
+
${$.title?`<div class="stx-toast-title">${YZ($.title)}</div>`:""}
|
|
7
|
+
<div class="stx-toast-message">${YZ($.message)}</div>
|
|
8
8
|
</div>
|
|
9
9
|
${G?'<button class="stx-toast-close" aria-label="Close">×</button>':""}
|
|
10
10
|
</div>
|
|
11
|
-
`}function
|
|
11
|
+
`}function YZ(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(Z){if(Z.timeout)clearTimeout(Z.timeout);if(U.delete(Z.id),Z.element&&h())Z.element.classList.add("dismissing"),setTimeout(()=>{Z.element?.remove()},200)}async function zZ(Z){let $=IZ(),Y=wZ(),z=Z.duration??5000,G={id:$,options:Z};if(U.set($,G),Y&&Z.type!=="error")try{let X=new Notification(Z.title||"Notification",{body:Z.message,icon:Z.type==="success"?"\u2713":Z.type==="warning"?"\u26A0":"\u2139",tag:$});if(X.onclick=()=>{if(Z.onClick)Z.onClick();X.close()},z>0)G.timeout=setTimeout(()=>{X.close(),U.delete($)},z);return}catch{}if(h())try{let X=fZ(Z.position),O=document.createElement("div");O.innerHTML=BZ(G);let P=O.firstElementChild;if(!P){let F=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${F}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`);return}G.element=P;try{X.appendChild(P)}catch{let F=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${F}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`);return}if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>{try{P.classList.add("visible")}catch{}});try{P.addEventListener("click",(F)=>{if(F.target.classList?.contains("stx-toast-close")){w(G);return}if(Z.onClick)Z.onClick()})}catch{}if(z>0)G.timeout=setTimeout(()=>{w(G)},z)}catch{let X=(Z.type||"info").toUpperCase();console.log(`[stx-alert] ${X}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`)}else{let X=(Z.type||"info").toUpperCase();if(console.log(`[stx-alert] ${X}: ${Z.title||""}`),console.log(`[stx-alert] ${Z.message}`),z>0)G.timeout=setTimeout(()=>{U.delete($)},z)}}async function I(Z){return zZ({...Z,position:Z.position||"top-right"})}async function S4(Z,$=3000){return I({message:Z,type:"info",duration:$})}async function A4(Z,$=3000){return I({message:Z,type:"success",duration:$})}async function T4(Z,$=3000){return I({message:Z,type:"warning",duration:$})}async function _4(Z,$=5000){return I({message:Z,type:"error",duration:$})}async function x4(Z,$,Y="info"){return zZ({title:Z,message:$,type:Y})}function E4(Z){let $=U.get(Z);if($)w($)}function C4(){for(let Z of U.values())w(Z)}function w4(){return U.size}var I4=`
|
|
12
12
|
.stx-toast-container {
|
|
13
13
|
position: fixed;
|
|
14
14
|
z-index: 10001;
|
|
@@ -110,18 +110,18 @@ function TZ(){if(typeof Notification<"u"&&Notification.permission==="granted")re
|
|
|
110
110
|
.stx-toast.success { border-left: 4px solid #27ae60; }
|
|
111
111
|
.stx-toast.warning { border-left: 4px solid #f39c12; }
|
|
112
112
|
.stx-toast.error { border-left: 4px solid #e74c3c; }
|
|
113
|
-
`;function
|
|
113
|
+
`;function vZ(){return!1}function c(){return typeof window<"u"&&typeof document<"u"}var M=[];function mZ(){return`modal-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function bZ(Z){switch(Z){case"info":return"ℹ";case"warning":return"⚠";case"error":return"✖";case"success":return"✔";case"question":return"❓";default:return"ℹ"}}function y(Z){if(Z==="question")return[{label:"No",style:"default"},{label:"Yes",style:"primary"}];return[{label:"OK",style:"primary"}]}function uZ(Z){let{options:$}=Z,Y=bZ($.type),z=$.buttons||y($.type),G=$.type||"info",X="";return z.forEach((O,P)=>{let F=O.style==="destructive"?"destructive":O.style==="primary"?"primary":"default",j=P===($.defaultButton??z.length-1)?"autofocus":"";X+=`<button class="stx-modal-btn ${F}" data-index="${P}" ${j}>${O.label}</button>`}),`
|
|
114
114
|
<div class="stx-modal-overlay" data-modal-id="${Z.id}">
|
|
115
115
|
<div class="stx-modal ${G}" role="dialog" aria-modal="true" aria-labelledby="${Z.id}-title">
|
|
116
116
|
<div class="stx-modal-icon">${Y}</div>
|
|
117
117
|
<div class="stx-modal-content">
|
|
118
|
-
${$.title?`<h2 id="${Z.id}-title" class="stx-modal-title">${
|
|
119
|
-
<p class="stx-modal-message">${
|
|
118
|
+
${$.title?`<h2 id="${Z.id}-title" class="stx-modal-title">${GZ($.title)}</h2>`:""}
|
|
119
|
+
<p class="stx-modal-message">${GZ($.message)}</p>
|
|
120
120
|
</div>
|
|
121
121
|
<div class="stx-modal-buttons">${X}</div>
|
|
122
122
|
</div>
|
|
123
123
|
</div>
|
|
124
|
-
`}function
|
|
124
|
+
`}function GZ(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(Z,$,Y=!1){let z=M.indexOf(Z);if(z>-1)M.splice(z,1);if(Z.element&&c())Z.element.remove();let X=(Z.options.buttons||y(Z.options.type))[$];if(X?.action)X.action();Z.resolve({buttonIndex:$,cancelled:Y})}async function T(Z){let $=vZ(),Y=mZ();return new Promise((z)=>{let G={id:Y,options:Z,resolve:z};if(M.push(G),$)console.log(`[stx-modal] Showing native modal: ${Z.title||"Modal"}`),setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0);else if(c())try{let X=document.createElement("div");X.innerHTML=uZ(G);let O=X.firstElementChild;if(!O){console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0);return}G.element=O;try{document.body.appendChild(O)}catch{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0);return}try{O.querySelectorAll(".stx-modal-btn").forEach((P)=>{P.addEventListener("click",()=>{let F=Number.parseInt(P.dataset.index||"0",10);D(G,F,!1)})})}catch{}try{O.addEventListener("click",(P)=>{if(P.target===O){let F=Z.cancelButton??0;D(G,F,!0)}})}catch{}try{let P=(F)=>{if(F.key==="Escape"){let j=Z.cancelButton??0;D(G,j,!0),document.removeEventListener("keydown",P)}else if(F.key==="Enter"){let j=Z.defaultButton??(Z.buttons||y(Z.type)).length-1;D(G,j,!1),document.removeEventListener("keydown",P)}};document.addEventListener("keydown",P)}catch{}try{let P=O.querySelector(".stx-modal-btn[autofocus]");if(P)P.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`),setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${Z.type?.toUpperCase()||"INFO"}: ${Z.title||"Modal"}`),console.log(`[stx-modal] ${Z.message}`);let X=Z.buttons||y(Z.type);console.log(`[stx-modal] Buttons: ${X.map((O)=>O.label).join(", ")}`),setTimeout(()=>{D(G,Z.defaultButton??0,!1)},0)}})}async function lZ(Z,$){return T({title:Z,message:$,type:"info"})}async function f4(Z,$){return T({title:Z,message:$,type:"warning"})}async function B4(Z,$){return T({title:Z,message:$,type:"error"})}async function v4(Z,$){return T({title:Z,message:$,type:"success"})}async function gZ(Z,$){return T({title:Z,message:$,type:"question",buttons:[{label:"No",style:"default"},{label:"Yes",style:"primary"}],defaultButton:1,cancelButton:0})}async function m4(Z,$="Confirm"){return(await gZ($,Z)).buttonIndex===1}async function b4(Z,$="Alert"){await lZ($,Z)}async function u4(Z,$="",Y="Input"){if(c()&&typeof window.prompt==="function")return window.prompt(Z,$);return console.log(`[stx-modal] PROMPT: ${Y}`),console.log(`[stx-modal] ${Z}`),console.log(`[stx-modal] Default: ${$}`),$}function l4(){return M.length}function g4(){while(M.length>0){let Z=M[M.length-1];D(Z,0,!0)}}var h4=`
|
|
125
125
|
.stx-modal-overlay {
|
|
126
126
|
position: fixed;
|
|
127
127
|
inset: 0;
|
|
@@ -253,9 +253,9 @@ function TZ(){if(typeof Notification<"u"&&Notification.permission==="granted")re
|
|
|
253
253
|
background: #555;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
`;function
|
|
256
|
+
`;function QZ(Z){let $=new Set(Z.properties??[]);if(Z.canChooseDirectories)$.add("openDirectory");if(Z.canChooseFiles)$.add("openFile");if(Z.multiSelections)$.add("multiSelections");if(Z.showHiddenFiles)$.add("showHiddenFiles");if(Z.canCreateDirectories)$.add("createDirectory");return{...Z,properties:[...$]}}function f(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function p4(Z={}){if(f()){let $=window;try{return await $.craft.dialog.showOpenDialog(QZ(Z))}catch(Y){console.warn("[stx-dialog] Failed to show native open dialog:",Y)}}return new Promise(($)=>{if(typeof document>"u"){$({canceled:!0,filePaths:[]});return}let Y=new Set(QZ(Z).properties),z=document.createElement("input");if(z.type="file",z.multiple=Y.has("multiSelections"),Z.filters?.length){let G=Z.filters.flatMap((X)=>X.extensions.map((O)=>`.${O}`));z.accept=G.join(",")}if(Y.has("openDirectory")&&!Y.has("openFile"))z.webkitdirectory=!0;z.onchange=()=>{let G=Array.from(z.files||[]);if(G.length===0)$({canceled:!0,filePaths:[]});else{let X=G.map((O)=>O.name);$({canceled:!1,filePaths:X})}},z.oncancel=()=>{$({canceled:!0,filePaths:[]})},z.click()})}async function d4(Z={}){if(f()){let Y=window;try{return await Y.craft.dialog.showSaveDialog(Z)}catch(z){console.warn("[stx-dialog] Failed to show native save dialog:",z)}}if(typeof window<"u"&&"showSaveFilePicker"in window)try{let Y=Z.filters?.map((G)=>({description:G.name,accept:{"*/*":G.extensions.map((X)=>`.${X}`)}}));return{canceled:!1,filePath:(await window.showSaveFilePicker({suggestedName:Z.defaultPath,types:Y})).name}}catch(Y){return{canceled:!0}}console.warn("[stx-dialog] Save dialog not available, using prompt fallback");let $=prompt("Enter filename:",Z.defaultPath||"file.txt");if($)return{canceled:!1,filePath:$};return{canceled:!0}}async function B(Z){if(f()){let O=window;try{return await O.craft.dialog.showMessageBox(Z)}catch(P){console.warn("[stx-dialog] Failed to show native message box:",P)}}let $=Z.buttons||["OK"],Y=Z.detail?`
|
|
257
257
|
|
|
258
|
-
${Z.detail}`:"",z=`${Z.message}${Y}`;if($.length===1)return alert(z),{response:0};let G=Z.cancelButton??$.length-1,X=Z.defaultButton!==void 0&&Z.defaultButton!==G?Z.defaultButton:$.findIndex((O,P)=>P!==G);if($.length>2)console.warn(`[stx-dialog] ${$.length} buttons requested; a browser confirm offers two. Reachable: "${$[X]}" and "${$[G]}".`);return{response:confirm(z)?X:G}}async function
|
|
258
|
+
${Z.detail}`:"",z=`${Z.message}${Y}`;if($.length===1)return alert(z),{response:0};let G=Z.cancelButton??$.length-1,X=Z.defaultButton!==void 0&&Z.defaultButton!==G?Z.defaultButton:$.findIndex((O,P)=>P!==G);if($.length>2)console.warn(`[stx-dialog] ${$.length} buttons requested; a browser confirm offers two. Reachable: "${$[X]}" and "${$[G]}".`);return{response:confirm(z)?X:G}}async function r4(Z={}){if(f()){let $=window;try{return await $.craft.dialog.showColorPicker(Z)}catch(Y){console.warn("[stx-dialog] Failed to show native color picker:",Y)}}return new Promise(($)=>{if(typeof document>"u"){$({canceled:!0});return}let Y=document.createElement("input");Y.type="color",Y.value=Z.color||"#000000",Y.onchange=()=>{$({canceled:!1,color:Y.value})},Y.oncancel=()=>{$({canceled:!0})},Y.click()})}async function n4(Z,$){await B({type:"info",title:$||"Alert",message:Z,buttons:["OK"]})}async function o4(Z,$){return(await B({type:"question",title:$||"Confirm",message:Z,buttons:["OK","Cancel"],defaultButton:0,cancelButton:1})).response===0}async function a4(Z,$){await B({type:"error",title:$||"Error",message:Z,buttons:["OK"]})}async function i4(Z,$){await B({type:"warning",title:$||"Warning",message:Z,buttons:["OK"]})}function s4(){return`
|
|
259
259
|
// STX Desktop Dialog Bridge
|
|
260
260
|
// Provides convenient wrappers around window.craft.dialog APIs
|
|
261
261
|
window.stxDialog = {
|
|
@@ -304,12 +304,12 @@ window.stxDialog = {
|
|
|
304
304
|
// Check if dialog is available
|
|
305
305
|
isAvailable: () => typeof window.craft?.dialog !== 'undefined',
|
|
306
306
|
};
|
|
307
|
-
`}var p=null,W=null;class
|
|
307
|
+
`}var p=null,W=null;class XZ{_process;_startedAt;_endsAt;_options;_expireHandlers=[];_expireTimer=null;_stopped=!1;constructor(Z,$){this._process=Z,this._options=$,this._startedAt=new Date;let Y=$.duration;if(Y&&Y>0){let z=Y*60*1000;this._endsAt=new Date(this._startedAt.getTime()+z),this._expireTimer=setTimeout(()=>{this._stopped=!0;for(let G of this._expireHandlers)try{G()}catch{}},z)}else this._endsAt=null}get pid(){return this._process.pid}get startedAt(){return this._startedAt}get endsAt(){return this._endsAt}get options(){return{...this._options}}get isActive(){if(this._stopped)return!1;return this._process.exitCode===null}get remainingMs(){if(!this._endsAt)return null;let Z=this._endsAt.getTime()-Date.now();return Math.max(0,Z)}get elapsedMs(){return Date.now()-this._startedAt.getTime()}stop(){if(this._stopped)return;if(this._stopped=!0,this._expireTimer)clearTimeout(this._expireTimer),this._expireTimer=null;try{this._process.kill()}catch{}}onExpire(Z){this._expireHandlers.push(Z)}}function e4(Z={}){hZ();let{duration:$,preventDisplaySleep:Y=!0,preventIdleSleep:z=!0,preventSystemSleep:G=!0,preventDiskSleep:X=!1,assertUserActivity:O=!0}=Z,P=[];if(Y)P.push("-d");if(z)P.push("-i");if(G)P.push("-s");if(X)P.push("-m");if(O)P.push("-u");let F=[...P];if($&&$>0)F.push("-t",String($*60));let j=Bun.spawn(["/usr/bin/caffeinate",...F],{stdio:["ignore","ignore","ignore"]}),R=new XZ(j,Z);return p=j,W=R,R}function hZ(Z){if(Z){if(Z.stop(),W===Z)p=null,W=null;return}if(W)W.stop();p=null,W=null}function Z8(){return W!==null&&W.isActive}function $8(){if(!W||!W.isActive)return{active:!1,instance:null,startedAt:null,endsAt:null,durationMinutes:null};let $=W.options.duration;return{active:!0,instance:W,startedAt:W.startedAt,endsAt:W.endsAt,durationMinutes:$&&$>0?$:-1}}function J8(Z){let $=Z||W;if(!$||!$.isActive)return"0:00";let Y=$.remainingMs;if(Y===null)return"\u221E";let z=Math.ceil(Y/1000),G=Math.floor(z/3600),X=Math.floor(z%3600/60),O=z%60;if(G>0)return`${G}:${String(X).padStart(2,"0")}:${String(O).padStart(2,"0")}`;return`${X}:${String(O).padStart(2,"0")}`}function Y8(Z){if(Z<=0||Z===-1)return"Indefinitely";if(Z<60)return`${Z} minutes`;if(Z===60)return"1 hour";if(Z%60===0)return`${Z/60} hours`;let $=Math.floor(Z/60),Y=Z%60;return`${$}h ${Y}m`}var N=new Map,cZ=0,v=!1;function pZ(Z){let $=Z.split("+").map((z)=>z.trim()),Y={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let z of $){let G=z.toLowerCase();switch(G){case"cmd":case"command":case"meta":case"\u2318":Y.meta=!0;break;case"ctrl":case"control":case"\u2303":Y.ctrl=!0;break;case"shift":case"\u21E7":Y.shift=!0;break;case"alt":case"option":case"opt":case"\u2325":Y.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")Y.meta=!0;else Y.ctrl=!0;break;default:Y.key=G}}return Y}function G8(Z){let $=[];if(Z.ctrl)$.push("\u2303");if(Z.alt)$.push("\u2325");if(Z.shift)$.push("\u21E7");if(Z.meta)$.push("\u2318");return $.push(Z.key.toUpperCase()),$.join("")}function dZ(Z,$){if($.meta!==Z.metaKey)return!1;if($.ctrl!==Z.ctrlKey)return!1;if($.shift!==Z.shiftKey)return!1;if($.alt!==Z.altKey)return!1;return Z.key.toLowerCase()===$.key||Z.code.toLowerCase()===`key${$.key}`}function PZ(Z){for(let[,$]of N)if(dZ(Z,$.parsed)){Z.preventDefault(),Z.stopPropagation();try{$.handler()}catch{}break}}function rZ(){if(v)return;if(typeof document>"u")return;document.addEventListener("keydown",PZ,!0),v=!0}function d(){if(!v)return;if(typeof document>"u")return;document.removeEventListener("keydown",PZ,!0),v=!1}async function nZ(Z,$){if(typeof window>"u")return!1;let Y=window.craft;if(!Y?.hotkeys?.register)return!1;try{return await Y.hotkeys.register(Z,$),!0}catch{return!1}}async function r(Z){if(typeof window>"u")return;let $=window.craft;if(!$?.hotkeys?.unregister)return;try{await $.hotkeys.unregister(Z)}catch{}}function Q8(Z,$){let Y=`hotkey_${++cZ}_${Date.now()}`,z=pZ(Z);N.set(Y,{shortcut:Z,handler:$,parsed:z}),nZ(Y,Z),rZ();let G={shortcut:Z,id:Y,unregister(){oZ(G)}};return G}function oZ(Z){if(N.delete(Z.id),r(Z.id),N.size===0)d()}function X8(){for(let[Z]of N)r(Z);N.clear(),d()}function P8(){return Array.from(N.entries()).map(([Z,$])=>({shortcut:$.shortcut,id:Z,unregister(){if(N.delete(Z),r(Z),N.size===0)d()}}))}class OZ{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(Z){if(this._duration=Z.duration,this._tickInterval=Z.tickInterval||1000,this._remaining=Z.duration,Z.onComplete)this._completionHandlers.add(Z.onComplete);if(Z.onTick)this._tickHandlers.add(Z.onTick);if(Z.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let Z=Date.now()-this._lastTick;return Math.max(0,this._remaining-Z)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let Z=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-Z),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(Z){return this._completionHandlers.add(Z),()=>{this._completionHandlers.delete(Z)}}onTick(Z){return this._tickHandlers.add(Z),()=>{this._tickHandlers.delete(Z)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let Z=Date.now(),$=Z-this._lastTick;this._lastTick=Z,this._remaining=Math.max(0,this._remaining-$);for(let Y of this._tickHandlers)try{Y(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let Y of this._completionHandlers)try{Y()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class VZ{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(Z){if(this._interval=Z.interval,this._handler=Z.handler,this._immediate=Z.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function V8(Z){return new OZ(Z)}function F8(Z){return new VZ(Z)}function j8(Z){return new Promise(($)=>setTimeout($,Z))}function W8(Z){let $=Math.ceil(Z/1000),Y=Math.floor($/3600),z=Math.floor($%3600/60),G=$%60;if(Y>0)return`${Y}:${String(z).padStart(2,"0")}:${String(G).padStart(2,"0")}`;return`${z}:${String(G).padStart(2,"0")}`}function K8(Z){let $=Math.ceil(Z/1000),Y=Math.floor($/3600),z=Math.floor($%3600/60),G=$%60;if(Y>0){if(z>0)return`${Y}h ${z}m`;return`${Y}h`}if(z>0){if(G>0)return`${z}m ${G}s`;return`${z}m`}return`${G}s`}function J(Z){if(typeof window>"u")return!1;let $=window.craft;return!!($&&$[Z])}function V(Z){if(!J(Z))throw Error(`craft.${Z} is not available \u2014 this API requires a Craft native window`);return window.craft[Z]}function Q(Z,$){if(typeof window>"u")return()=>{};let Y=(z)=>$(z.detail??{});return window.addEventListener(Z,Y),()=>window.removeEventListener(Z,Y)}var N8={async writeText(Z){if(J("clipboard")){await window.craft.clipboard.writeText(Z);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(Z)},async readText(){if(J("clipboard")){let Z=await window.craft.clipboard.readText();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(Z){if(J("clipboard")){await window.craft.clipboard.writeHTML(Z);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let $=new window.ClipboardItem({"text/html":new Blob([Z],{type:"text/html"}),"text/plain":new Blob([aZ(Z)],{type:"text/plain"})});await navigator.clipboard.write([$])}catch{}},async readHTML(){if(J("clipboard")){let Z=await window.craft.clipboard.readHTML();return typeof Z==="string"?Z:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let Z=await navigator.clipboard.read();for(let $ of Z)if($.types.includes("text/html"))return await(await $.getType("text/html")).text()}catch{}return""},async clear(){if(J("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(J("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(J("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(J("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function aZ(Z){return Z.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
|
|
308
308
|
`).replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\n{3,}/g,`
|
|
309
309
|
|
|
310
|
-
`).trim()}var K8={async show(Z){if(!Z.title)throw Error("notification title is required");if(J("notifications")){await window.craft.notifications.show(Z);return}if(typeof window<"u"&&"Notification"in window){let $=window.Notification;if($.permission==="granted")new $(Z.title,{body:Z.body,icon:Z.icon});else if($.permission==="default"){if(await $.requestPermission()==="granted")new $(Z.title,{body:Z.body,icon:Z.icon})}}},async schedule(Z){if(J("notifications")){let z={...Z};if(z.triggerAt instanceof Date)z.triggerAt=z.triggerAt.toISOString();await window.craft.notifications.schedule(z);return}let $=pZ(Z.triggerAt),Y=Math.max(0,$-Date.now());setTimeout(()=>{this.show(Z).catch(()=>{})},Y)},async cancel(Z){if(J("notifications"))await window.craft.notifications.cancel(Z)},async cancelAll(){if(J("notifications"))await window.craft.notifications.cancelAll()},async setBadge(Z){let $=Math.max(0,Math.round(Number.isFinite(Z)?Z:0));if(J("notifications")){await window.craft.notifications.setBadge($);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge($)}catch{}},async clearBadge(){if(J("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(J("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")return!0;if(Z.permission==="denied")return!1;return await Z.requestPermission()==="granted"}return!1},async registerCategories(Z){if(!Array.isArray(Z)||Z.length===0)return;if(J("notifications")){let $=window.craft.notifications.registerCategories;if(typeof $==="function")await $(Z)}},onActionClicked(Z){return Q("craft:notification:actionClicked",Z)},onReply(Z){return Q("craft:notification:reply",Z)}};function pZ(Z){if(Z==null)return Date.now();if(Z instanceof Date)return Z.getTime();if(typeof Z==="number")return Z;let $=Date.parse(Z);return Number.isNaN($)?Date.now():$}var D8={async readFile(Z){let $=await V("fs").readFile(Z);return $&&$.data||""},async readBuffer(Z){let $=await V("fs").readFile(Z),Y=$&&$.data||"";if($&&$.base64===!0)return rZ(Y);return new TextEncoder().encode(Y)},async writeFile(Z,$){await V("fs").writeFile(Z,$)},async writeBuffer(Z,$){let Y=dZ($),z=V("fs");if(typeof z.writeFileBytes==="function")await z.writeFileBytes(Z,Y);else await z.writeFile(Z,Y)},async copy(Z,$){if(Z===$)throw Error("fs.copy: source and destination must differ");await V("fs").copy(Z,$)},async move(Z,$){if(Z===$)throw Error("fs.move: source and destination must differ");await V("fs").move(Z,$)},async appendFile(Z,$){await V("fs").appendFile(Z,$)},async deleteFile(Z){await V("fs").deleteFile(Z)},async exists(Z){return await V("fs").exists(Z)},async stat(Z){return nZ(await V("fs").stat(Z))},async readDir(Z){let $=await V("fs").readDir(Z),Y=$&&$.entries||[],z=Z.endsWith("/")?Z.slice(0,-1):Z;return Y.map((G)=>({name:G.name,path:`${z}/${G.name}`,isDirectory:!!G.isDirectory}))},async mkdir(Z,$){await V("fs").mkdir(Z,$)},async rmdir(Z,$){await V("fs").rmdir(Z,$)},async watch(Z,$){await V("fs").watch(Z,$)},async unwatch(Z){await V("fs").unwatch(Z)},onChange(Z){return Q("craft:fs:change",Z)},async watchTree(Z,$,Y){let z=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,G=V("fs");await G.watch(Z,z,{recursive:!!$.recursive});let X=$.kinds&&$.kinds.length>0?new Set($.kinds):null,O=Math.max(0,Math.floor($.coalesceMs??0)),P=[],F=null,j=!1,R=()=>{if(F=null,P.length===0)return;let L=P;P=[];try{Y(L)}catch{}},q=Q("craft:fs:change",(L)=>{if(j)return;if(L.id!==z)return;if(X&&L.kind&&!X.has(L.kind))return;if(P.push(L),O===0){R();return}if(F==null)F=setTimeout(R,O)});return{id:z,async stop(){if(j)return;if(j=!0,q(),F)clearTimeout(F),F=null;if(P.length>0)R();try{await G.unwatch(z)}catch{}}}},async homeDir(){return await V("fs").homeDir()},async tempDir(){return await V("fs").tempDir()},async appDataDir(){return await V("fs").appDataDir()}};function dZ(Z){let $="";for(let Y=0;Y<Z.length;Y++)$+=String.fromCharCode(Z[Y]);return typeof btoa==="function"?btoa($):Buffer.from(Z).toString("base64")}function rZ(Z){let $=typeof atob==="function"?atob(Z):Buffer.from(Z,"base64").toString("binary"),Y=new Uint8Array($.length);for(let z=0;z<$.length;z++)Y[z]=$.charCodeAt(z);return Y}function nZ(Z){return{isFile:!!Z.isFile,isDirectory:!!Z.isDirectory,isSymlink:!!Z.isSymlink,size:Number(Z.size)||0,modifiedAt:Z.modifiedAt!=null?Z.modifiedAt<1000000000000?Z.modifiedAt*1000:Z.modifiedAt:0}}var x=new Set,VZ=!1;function oZ(){if(VZ)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let $=Z.detail;if($?.id)x.delete($.id)}),VZ=!0}var aZ=new Set(["javascript:","data:","file:","vbscript:"]),q8={async openExternal(Z){let $=Z.trim().toLowerCase();for(let Y of aZ)if($.startsWith(Y))throw Error(`shell.openExternal: ${Y} URLs are blocked for safety`);if(J("shell")){await window.craft.shell.openExternal(Z);return}if(typeof window<"u"&&typeof window.open==="function")window.open(Z,"_blank","noopener,noreferrer")},async openPath(Z){await V("shell").openPath(Z)},async showInFinder(Z){await V("shell").showInFinder(Z)},async spawn(Z,$,Y=[],z={}){if(oZ(),!Z||typeof Z!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!$||typeof $!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(Y))throw Error("shell.spawn: args must be an array");for(let G of Y)if(typeof G!=="string")throw Error("shell.spawn: args entries must be strings");if(x.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);x.add(Z);try{await V("shell").spawn(Z,$,Y,z)}catch(G){throw x.delete(Z),G}},async kill(Z){await V("shell").kill(Z),x.delete(Z)},async getEnv(Z){if(J("shell")){let $=await window.craft.shell.getEnv(Z);return $==null?void 0:String($)}return},async setEnv(Z,$){await V("shell").setEnv(Z,$)},onStdout(Z){return Q("craft:shell:stdout",Z)},onStderr(Z){return Q("craft:shell:stderr",Z)},onExit(Z){return Q("craft:shell:exit",Z)}};function S(){return window.craft.shortcuts}var M8={async register(Z,$,Y){if(!J("shortcuts"))return;await S().register(Z,$,Y)},async unregister(Z){if(!J("shortcuts"))return;await S().unregister(Z)},async unregisterAll(){if(!J("shortcuts"))return;await S().unregisterAll()},async enable(Z){if(!J("shortcuts"))return;await S().enable(Z)},async disable(Z){if(!J("shortcuts"))return;await S().disable(Z)},async isRegistered(Z){if(!J("shortcuts"))return!1;return await S().isRegistered(Z)},async list(){if(!J("shortcuts"))return[];return await S().list()},on(Z){return Q("craft:shortcut",Z)}};var A8={get(){if(J("theme"))try{return window.craft.theme.get()}catch{}return{appearance:iZ()}},onChange(Z){if(Z(this.get()),J("theme"))return Q("craft:theme",Z);if(typeof window<"u"&&window.matchMedia){let $=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>Z({appearance:$.matches?"dark":"light"});return $.addEventListener("change",Y),()=>$.removeEventListener("change",Y)}return()=>{}},async current(){return this.get()}};function iZ(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function E8(Z,$={}){if(!J("dragOut"))throw Error("dragOut requires a Craft native window");let Y=Array.isArray(Z)?Z:[Z];if(Y.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(Y,$)}function C8(){return J("dragOut")}var y8={onUrl(Z){if(!J("deepLink"))return()=>{};return Q("craft:deepLink",Z)},getInitialUrl(){if(typeof window>"u")return null;if(J("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let Z=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return Z},isAvailable(){return J("deepLink")}};var B8={async isCharging(){if(J("power"))return await window.craft.power.isCharging();let Z=await v();return Z?!!Z.charging:!1},async isPluggedIn(){if(J("power"))return await window.craft.power.isPluggedIn();let Z=await v();return Z?!!Z.charging||Z.level>=0.999:!1},async isLowPowerMode(){if(J("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(J("power")){let $=await window.craft.power.batteryLevel();return typeof $==="number"?$:null}let Z=await v();return Z?Z.level:null},async timeRemaining(){if(J("power")){let Y=await window.craft.power.timeRemaining();return typeof Y==="number"?Y:null}let Z=await v();if(!Z)return null;let $=Z.charging?Z.chargingTime:Z.dischargingTime;return Number.isFinite($)?Math.round($/60):null},async thermalState(){if(J("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(J("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(Z="app is busy"){if(J("power")){await window.craft.power.preventSleep(Z);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let $=window;if($.__craftWebWakeLock?.release){try{await $.__craftWebWakeLock.release()}catch{}$.__craftWebWakeLock=null}try{let Y=await navigator.wakeLock.request("screen");$.__craftWebWakeLock=Y}catch{}},async allowSleep(){if(J("power")){await window.craft.power.allowSleep();return}let Z=window.__craftWebWakeLock;if(Z&&typeof Z.release==="function"){try{await Z.release()}catch{}window.__craftWebWakeLock=null}},onSleep(Z){return Q("craft:powerSleep",Z)},onWake(Z){return Q("craft:powerWake",Z)}};async function v(){if(typeof navigator>"u")return null;let Z=navigator;if(typeof Z.getBattery!=="function")return null;try{return await Z.getBattery()}catch{return null}}var g8={async connectionType(){if(J("network"))return await window.craft.network.connectionType();return FZ()},async wifiSSID(){if(J("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(J("network")){let Z=await window.craft.network.wifiSignalStrength();return typeof Z==="number"?Z:void 0}return},async ipAddress(){if(J("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(J("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(J("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(J("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(J("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(J("network"))await window.craft.network.openPreferences()},onChange(Z){if(J("network"))return Q("craft:networkChange",Z);if(typeof window>"u")return()=>{};let $=()=>Z({type:FZ(),online:!0}),Y=()=>Z({type:"none",online:!1});return window.addEventListener("online",$),window.addEventListener("offline",Y),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",Y)}}};function FZ(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let Z=navigator.connection;if(!Z)return"unknown";let $=String(Z.type||Z.effectiveType||"unknown").toLowerCase();if($==="wifi"||$==="cellular"||$==="ethernet"||$==="bluetooth"||$==="none")return $;return"unknown"}var h8={async checkForUpdates(){if(!J("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!J("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(Z){if(!J("updater"))return;await window.craft.updater.setAutomaticChecks(Z)},async setCheckInterval(Z){if(!J("updater"))return;if(!Number.isFinite(Z))throw Error("setCheckInterval: must be a finite number");let $=Z<=0?0:Math.max(60,Math.round(Z));await window.craft.updater.setCheckInterval($)},async setFeedURL(Z){if(!J("updater"))return;await window.craft.updater.setFeedURL(Z)},async getLastUpdateCheckDate(){if(!J("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!J("updater"))return null;let Z=await window.craft.updater.getUpdateInfo();if(!Z||typeof Z.version!=="string"||Z.version.length===0)return null;return Z},onAvailable(Z){return Q("craft:updateAvailable",Z)},onDownloaded(Z){return Q("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:$,publicKeyB64:Y}){let z=jZ(Z),G;try{G=await crypto.subtle.importKey("raw",b(Y),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",G,b($),z)}catch{return!1}},async verifyDownload({url:Z,signatureB64:$,publicKeyB64:Y,fetchInit:z}){let G;try{G=await fetch(Z,z)}catch{return{ok:!1,reason:"fetch-failed"}}if(!G.ok)return{ok:!1,reason:"http-error",status:G.status};let X=new Uint8Array(await G.arrayBuffer()),O;try{O=await crypto.subtle.importKey("raw",b(Y),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let P=!1;try{P=await crypto.subtle.verify("Ed25519",O,b($),jZ(X))}catch{P=!1}if(!P)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:X}}};function jZ(Z){if(Z instanceof ArrayBuffer)return new Uint8Array(Z);let $=new ArrayBuffer(Z.byteLength),Y=new Uint8Array($);return Y.set(Z),Y}function b(Z){if(typeof atob==="function"){let z=atob(Z),G=new ArrayBuffer(z.length),X=new Uint8Array(G);for(let O=0;O<z.length;O++)X[O]=z.charCodeAt(O);return X}let $=Buffer.from(Z,"base64"),Y=new ArrayBuffer($.length);return new Uint8Array(Y).set($),new Uint8Array(Y)}var d8={onFocus(Z){if(J("window"))return Q("craft:window:focus",()=>Z());return n("focus",Z)},onBlur(Z){if(J("window"))return Q("craft:window:blur",()=>Z());return n("blur",Z)},onResize(Z){if(J("window"))return Q("craft:window:resize",Z);if(typeof window>"u")return()=>{};let $=()=>Z({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},onMove(Z){if(J("window"))return Q("craft:window:move",Z);return()=>{}},onClose(Z){if(J("window"))return Q("craft:window:close",()=>Z());return n("beforeunload",Z)},onMinimize(Z){if(J("window"))return Q("craft:window:minimize",()=>Z());if(typeof document>"u")return()=>{};let $=()=>{if(document.visibilityState==="hidden")Z()};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)},onRestore(Z){if(J("window"))return Q("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let $=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)}};function n(Z,$){if(typeof window>"u")return()=>{};let Y=()=>$();return window.addEventListener(Z,Y),()=>window.removeEventListener(Z,Y)}var WZ={name:"",version:"0.0.0"},o8={async hideDockIcon(){if(J("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(J("app"))await window.craft.app.showDockIcon()},async quit(){if(J("app"))await window.craft.app.quit()},async getInfo(){if(!J("app"))return WZ;let Z=await window.craft.app.getInfo();return{...WZ,...Z||{}}},async notify(Z){if(!Z.title)throw Error("notify: title is required");if(J("app"))await window.craft.app.notify(Z)},async setBadge(Z){if(J("app"))await window.craft.app.setBadge(Z)},async bounce(Z="informational"){if(J("app"))await window.craft.app.bounce(Z)}};var s8={app(Z){return{label:Z,items:[{label:`About ${Z}`,role:"about"},{separator:!0},{label:`Hide ${Z}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${Z}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(Z){return[this.app(Z),this.edit()]}},sZ=0;function tZ(Z){let $=new Map;return{payload:{menus:Z.menus.map((z)=>({label:z.label,items:z.items.map((G)=>{let{onClick:X,...O}=G;if(O.separator)return O;let P=O.id??`stx.menu.${sZ++}`;if(X)$.set(P,X);return{...O,id:P}})}))},handlers:$}}var o=null,t8={async set(Z){if(!J("menu"))return!1;let{payload:$,handlers:Y}=tZ(Z);if(o?.(),o=null,Y.size>0)o=Q("craft:menu:action",(z)=>{Y.get(z.id)?.()});return await window.craft.menu.set($),!0},async setDock(Z){if(J("menu"))await window.craft.menu.setDock(Z)},async addItem(Z,$){if(J("menu"))await window.craft.menu.addItem(Z,$)},async removeItem(Z){if(J("menu"))await window.craft.menu.removeItem(Z)},async enableItem(Z){if(J("menu"))await window.craft.menu.enableItem(Z)},async disableItem(Z){if(J("menu"))await window.craft.menu.disableItem(Z)},async checkItem(Z){if(J("menu"))await window.craft.menu.checkItem(Z)},async uncheckItem(Z){if(J("menu"))await window.craft.menu.uncheckItem(Z)},async setItemLabel(Z,$){if(J("menu"))await window.craft.menu.setItemLabel(Z,$)},async clearDock(){if(J("menu"))await window.craft.menu.clearDock()},onAction(Z){return Q("craft:menu:action",Z)}};var $$={async getDisplays(){if(J("screen"))return await window.craft.screen.getDisplays();return KZ()},async getPrimary(){if(J("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return KZ()[0]??null},onChange(Z){if(J("screen"))return Q("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let $=()=>Z();return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)}};function KZ(){if(typeof window>"u"||!window.screen)return[];let Z=window.screen;return[{id:0,x:Z.left??0,y:Z.top??0,width:Z.width||0,height:Z.height||0,workX:Z.availLeft??0,workY:Z.availTop??0,workWidth:Z.availWidth??Z.width??0,workHeight:Z.availHeight??Z.height??0,scaleFactor:window.devicePixelRatio||1}]}var z$={async set(Z,$,Y){if(!Z)throw Error("keychain.set: service is required");if(!$)throw Error("keychain.set: account is required");await V("keychain").set(Z,$,Y)},async get(Z,$){if(!Z)throw Error("keychain.get: service is required");if(!$)throw Error("keychain.get: account is required");let Y=await V("keychain").get(Z,$);return typeof Y==="string"?Y:null},async delete(Z,$){if(!Z)throw Error("keychain.delete: service is required");if(!$)throw Error("keychain.delete: account is required");await V("keychain").delete(Z,$)},async has(Z,$){if(!Z)throw Error("keychain.has: service is required");if(!$)throw Error("keychain.has: account is required");return await V("keychain").has(Z,$)}};var X$={async check(Z){if(J("permissions"))return await window.craft.permissions.check(Z);return await RZ(Z)},async request(Z){if(J("permissions"))return await window.craft.permissions.request(Z);return await eZ(Z)},async openSettings(Z){if(J("permissions"))await window.craft.permissions.openSettings(Z)}};async function RZ(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let $=await navigator.permissions.query({name:Z});return Z4($.state)}catch{return"not-supported"}}async function eZ(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let $=await window.Notification.requestPermission();return $==="granted"?"granted":$==="denied"?"denied":"undetermined"}return await RZ(Z)}function Z4(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var V$={async print(){if(J("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(Z){if(!Z)throw Error("printToPDF: path is required");let $=Z.startsWith("/"),Y=/^[a-zA-Z]:[\\/]/.test(Z)||Z.startsWith("\\\\");if(!$&&!Y)throw Error("printToPDF: path must be absolute");let z=await V("printing").printToPDF(Z);return{ok:!!(z&&z.ok),path:z?.path}}};var W$={async enable(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function a(){if(!J("window"))return null;return window.craft.window}function N(Z){let $=a();if(!$)return Promise.resolve();try{return Promise.resolve(Z($)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var L$={get available(){return a()!==null},open(Z){let $=()=>{if(typeof window<"u"&&Z.url)window.open(Z.url,Z.name);return{name:Z.name}},Y=a();if(!Y?.open)return Promise.resolve($());return Y.open(Z).then((z)=>({name:z?.name||Z.name})).catch($)},close:()=>N((Z)=>Z.close?.()),focus:()=>N((Z)=>Z.focus?.()),minimize:()=>N((Z)=>Z.minimize?.()),maximize:()=>N((Z)=>Z.maximize?.()),center:()=>N((Z)=>Z.center?.()),startDrag:()=>N((Z)=>Z.startDrag?.()),setTitle:(Z)=>N(($)=>$.setTitle?.(Z)),setSize:(Z,$)=>N((Y)=>Y.setSize?.(Z,$)),setAppearance:(Z)=>N(($)=>$.setAppearance?.(Z))};var N$={async addItem(Z){if(J("touchbar"))await window.craft.touchbar.addItem(Z)},async removeItem(Z){if(J("touchbar"))await window.craft.touchbar.removeItem(Z)},async updateItem(Z,$){if(J("touchbar"))await window.craft.touchbar.updateItem(Z,$)},async setLabel(Z,$){if(J("touchbar"))await window.craft.touchbar.setLabel(Z,$)},async setIcon(Z,$){if(J("touchbar"))await window.craft.touchbar.setIcon(Z,$)},async setEnabled(Z,$){if(J("touchbar"))await window.craft.touchbar.setEnabled(Z,$)},async setSliderValue(Z,$){if(J("touchbar"))await window.craft.touchbar.setSliderValue(Z,$)},async clear(){if(J("touchbar"))await window.craft.touchbar.clear()},async show(){if(J("touchbar"))await window.craft.touchbar.show()},async hide(){if(J("touchbar"))await window.craft.touchbar.hide()},onAction(Z){return Q("craft:touchbar:action",Z)}};var $4=/^[\da-f]*$/i;function J4(Z,$){if(typeof $!=="string"||!$4.test($)||$.length%2!==0)throw Error(`${Z}: must be a hex string with even length, got ${JSON.stringify($)}`)}var U$={async isEnabled(){return J("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return J("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return J("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return J("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(J("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(J("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return J("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(Z){if(J("bluetooth"))await window.craft.bluetooth.connect(Z)},async disconnect(Z){if(J("bluetooth"))await window.craft.bluetooth.disconnect(Z)},async openPreferences(){if(J("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(Z){if(!Z)throw Error("bluetooth.discoverServices: deviceId is required");if(!J("bluetooth"))return[];let $=await window.craft.bluetooth.discoverServices(Z);return Array.isArray($)?$:[]},async discoverCharacteristics(Z,$){if(!Z||!$)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!J("bluetooth"))return[];let Y=await window.craft.bluetooth.discoverCharacteristics(Z,$);return Array.isArray(Y)?Y:[]},async readCharacteristic(Z,$,Y){if(!Z||!$||!Y)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(Z,$,Y)},async writeCharacteristic(Z,$,Y,z,G="with-response"){if(!Z||!$||!Y)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(J4("bluetooth.writeCharacteristic.valueHex",z),!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(Z,$,Y,z,G)},async setCharacteristicNotify(Z,$,Y,z){if(!Z||!$||!Y)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(Z,$,Y,z)},onDeviceFound(Z){return Q("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return Q("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return Q("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return Q("craft:bluetooth:characteristicValue",Z)}};var T$={async speak(Z,$){if(!Z)throw Error("speech.speak: text is required");if(J("speech")){await window.craft.speech.speak(Z,$);return}if(typeof window<"u"&&window.speechSynthesis){let Y=new window.SpeechSynthesisUtterance(Z);if($){if($.rate!=null)Y.rate=$.rate;if($.pitch!=null)Y.pitch=$.pitch;if($.volume!=null)Y.volume=$.volume;if($.voice){let G=window.speechSynthesis.getVoices().find((X)=>X.voiceURI===$.voice||X.name===$.voice||X.lang===$.voice);if(G)Y.voice=G}}window.speechSynthesis.speak(Y)}},async stop(){if(J("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(J("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(J("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(J("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(J("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map(($)=>({id:$.voiceURI||$.name,name:$.name,language:$.lang||"",quality:"default"}));return[]}};var _=[],i=!0,s,t,g={async report(Z){if(J("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!i)return;let $=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:s,appVersion:t}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:s,appVersion:t};if(_.length>=64)_.shift();_.push($)},async flush(){if(J("crashReporter"))return await window.craft.crashReporter.flush();return[..._]},async clear(){if(J("crashReporter")){await window.craft.crashReporter.clear();return}_.length=0},async setEnabled(Z){if(J("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}i=Z},async isEnabled(){if(J("crashReporter"))return await window.craft.crashReporter.isEnabled();return i},async setUser(Z){if(J("crashReporter")){await window.craft.crashReporter.setUser(Z);return}s=Z||void 0},async setAppVersion(Z){if(J("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}t=Z||void 0},attachGlobalHandlers(){if(J("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=(Y)=>{g.report({severity:"error",message:Y.message,source:"js",stack:Y.error?.stack||`${Y.message}
|
|
311
|
-
at ${Y.filename}:${Y.lineno}:${Y.colno}`}).catch(()=>{})},$=(Y)=>{let z=Y.reason;
|
|
310
|
+
`).trim()}var H8={async show(Z){if(!Z.title)throw Error("notification title is required");if(J("notifications")){await window.craft.notifications.show(Z);return}if(typeof window<"u"&&"Notification"in window){let $=window.Notification;if($.permission==="granted")new $(Z.title,{body:Z.body,icon:Z.icon});else if($.permission==="default"){if(await $.requestPermission()==="granted")new $(Z.title,{body:Z.body,icon:Z.icon})}}},async schedule(Z){if(J("notifications")){let z={...Z};if(z.triggerAt instanceof Date)z.triggerAt=z.triggerAt.toISOString();await window.craft.notifications.schedule(z);return}let $=iZ(Z.triggerAt),Y=Math.max(0,$-Date.now());setTimeout(()=>{this.show(Z).catch(()=>{})},Y)},async cancel(Z){if(J("notifications"))await window.craft.notifications.cancel(Z)},async cancelAll(){if(J("notifications"))await window.craft.notifications.cancelAll()},async setBadge(Z){let $=Math.max(0,Math.round(Number.isFinite(Z)?Z:0));if(J("notifications")){await window.craft.notifications.setBadge($);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge($)}catch{}},async clearBadge(){if(J("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(J("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let Z=window.Notification;if(Z.permission==="granted")return!0;if(Z.permission==="denied")return!1;return await Z.requestPermission()==="granted"}return!1},async registerCategories(Z){if(!Array.isArray(Z)||Z.length===0)return;if(J("notifications")){let $=window.craft.notifications.registerCategories;if(typeof $==="function")await $(Z)}},onActionClicked(Z){return Q("craft:notification:actionClicked",Z)},onReply(Z){return Q("craft:notification:reply",Z)}};function iZ(Z){if(Z==null)return Date.now();if(Z instanceof Date)return Z.getTime();if(typeof Z==="number")return Z;let $=Date.parse(Z);return Number.isNaN($)?Date.now():$}var S8={async readFile(Z){let $=await V("fs").readFile(Z);return $&&$.data||""},async readBuffer(Z){let $=await V("fs").readFile(Z),Y=$&&$.data||"";if($&&$.base64===!0)return tZ(Y);return new TextEncoder().encode(Y)},async writeFile(Z,$){await V("fs").writeFile(Z,$)},async writeBuffer(Z,$){let Y=sZ($),z=V("fs");if(typeof z.writeFileBytes==="function")await z.writeFileBytes(Z,Y);else await z.writeFile(Z,Y)},async copy(Z,$){if(Z===$)throw Error("fs.copy: source and destination must differ");await V("fs").copy(Z,$)},async move(Z,$){if(Z===$)throw Error("fs.move: source and destination must differ");await V("fs").move(Z,$)},async appendFile(Z,$){await V("fs").appendFile(Z,$)},async deleteFile(Z){await V("fs").deleteFile(Z)},async exists(Z){return await V("fs").exists(Z)},async stat(Z){return eZ(await V("fs").stat(Z))},async readDir(Z){let $=await V("fs").readDir(Z),Y=$&&$.entries||[],z=Z.endsWith("/")?Z.slice(0,-1):Z;return Y.map((G)=>({name:G.name,path:`${z}/${G.name}`,isDirectory:!!G.isDirectory}))},async mkdir(Z,$){await V("fs").mkdir(Z,$)},async rmdir(Z,$){await V("fs").rmdir(Z,$)},async watch(Z,$){await V("fs").watch(Z,$)},async unwatch(Z){await V("fs").unwatch(Z)},onChange(Z){return Q("craft:fs:change",Z)},async watchTree(Z,$,Y){let z=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,G=V("fs");await G.watch(Z,z,{recursive:!!$.recursive});let X=$.kinds&&$.kinds.length>0?new Set($.kinds):null,O=Math.max(0,Math.floor($.coalesceMs??0)),P=[],F=null,j=!1,R=()=>{if(F=null,P.length===0)return;let L=P;P=[];try{Y(L)}catch{}},q=Q("craft:fs:change",(L)=>{if(j)return;if(L.id!==z)return;if(X&&L.kind&&!X.has(L.kind))return;if(P.push(L),O===0){R();return}if(F==null)F=setTimeout(R,O)});return{id:z,async stop(){if(j)return;if(j=!0,q(),F)clearTimeout(F),F=null;if(P.length>0)R();try{await G.unwatch(z)}catch{}}}},async homeDir(){return await V("fs").homeDir()},async tempDir(){return await V("fs").tempDir()},async appDataDir(){return await V("fs").appDataDir()}};function sZ(Z){let $="";for(let Y=0;Y<Z.length;Y++)$+=String.fromCharCode(Z[Y]);return typeof btoa==="function"?btoa($):Buffer.from(Z).toString("base64")}function tZ(Z){let $=typeof atob==="function"?atob(Z):Buffer.from(Z,"base64").toString("binary"),Y=new Uint8Array($.length);for(let z=0;z<$.length;z++)Y[z]=$.charCodeAt(z);return Y}function eZ(Z){return{isFile:!!Z.isFile,isDirectory:!!Z.isDirectory,isSymlink:!!Z.isSymlink,size:Number(Z.size)||0,modifiedAt:Z.modifiedAt!=null?Z.modifiedAt<1000000000000?Z.modifiedAt*1000:Z.modifiedAt:0}}var _=new Set,FZ=!1;function Z4(){if(FZ)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let $=Z.detail;if($?.id)_.delete($.id)}),FZ=!0}var $4=new Set(["javascript:","data:","file:","vbscript:"]),_8={async openExternal(Z){let $=Z.trim().toLowerCase();for(let Y of $4)if($.startsWith(Y))throw Error(`shell.openExternal: ${Y} URLs are blocked for safety`);if(J("shell")){await window.craft.shell.openExternal(Z);return}if(typeof window<"u"&&typeof window.open==="function")window.open(Z,"_blank","noopener,noreferrer")},async openPath(Z){await V("shell").openPath(Z)},async showInFinder(Z){await V("shell").showInFinder(Z)},async spawn(Z,$,Y=[],z={}){if(Z4(),!Z||typeof Z!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!$||typeof $!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(Y))throw Error("shell.spawn: args must be an array");for(let G of Y)if(typeof G!=="string")throw Error("shell.spawn: args entries must be strings");if(_.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);_.add(Z);try{await V("shell").spawn(Z,$,Y,z)}catch(G){throw _.delete(Z),G}},async kill(Z){await V("shell").kill(Z),_.delete(Z)},async getEnv(Z){if(J("shell")){let $=await window.craft.shell.getEnv(Z);return $==null?void 0:String($)}return},async setEnv(Z,$){await V("shell").setEnv(Z,$)},onStdout(Z){return Q("craft:shell:stdout",Z)},onStderr(Z){return Q("craft:shell:stderr",Z)},onExit(Z){return Q("craft:shell:exit",Z)}};function S(){return window.craft.shortcuts}var C8={async register(Z,$,Y){if(!J("shortcuts"))return;await S().register(Z,$,Y)},async unregister(Z){if(!J("shortcuts"))return;await S().unregister(Z)},async unregisterAll(){if(!J("shortcuts"))return;await S().unregisterAll()},async enable(Z){if(!J("shortcuts"))return;await S().enable(Z)},async disable(Z){if(!J("shortcuts"))return;await S().disable(Z)},async isRegistered(Z){if(!J("shortcuts"))return!1;return await S().isRegistered(Z)},async list(){if(!J("shortcuts"))return[];return await S().list()},on(Z){return Q("craft:shortcut",Z)}};var y8={get(){if(J("theme"))try{return window.craft.theme.get()}catch{}return{appearance:J4()}},onChange(Z){if(Z(this.get()),J("theme"))return Q("craft:theme",Z);if(typeof window<"u"&&window.matchMedia){let $=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>Z({appearance:$.matches?"dark":"light"});return $.addEventListener("change",Y),()=>$.removeEventListener("change",Y)}return()=>{}},async current(){return this.get()}};function J4(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function v8(Z,$={}){if(!J("dragOut"))throw Error("dragOut requires a Craft native window");let Y=Array.isArray(Z)?Z:[Z];if(Y.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(Y,$)}function m8(){return J("dragOut")}var l8={onUrl(Z){if(!J("deepLink"))return()=>{};return Q("craft:deepLink",Z)},getInitialUrl(){if(typeof window>"u")return null;if(J("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let Z=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return Z},isAvailable(){return J("deepLink")}};var c8={async isCharging(){if(J("power"))return await window.craft.power.isCharging();let Z=await m();return Z?!!Z.charging:!1},async isPluggedIn(){if(J("power"))return await window.craft.power.isPluggedIn();let Z=await m();return Z?!!Z.charging||Z.level>=0.999:!1},async isLowPowerMode(){if(J("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(J("power")){let $=await window.craft.power.batteryLevel();return typeof $==="number"?$:null}let Z=await m();return Z?Z.level:null},async timeRemaining(){if(J("power")){let Y=await window.craft.power.timeRemaining();return typeof Y==="number"?Y:null}let Z=await m();if(!Z)return null;let $=Z.charging?Z.chargingTime:Z.dischargingTime;return Number.isFinite($)?Math.round($/60):null},async thermalState(){if(J("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(J("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(Z="app is busy"){if(J("power")){await window.craft.power.preventSleep(Z);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let $=window;if($.__craftWebWakeLock?.release){try{await $.__craftWebWakeLock.release()}catch{}$.__craftWebWakeLock=null}try{let Y=await navigator.wakeLock.request("screen");$.__craftWebWakeLock=Y}catch{}},async allowSleep(){if(J("power")){await window.craft.power.allowSleep();return}let Z=window.__craftWebWakeLock;if(Z&&typeof Z.release==="function"){try{await Z.release()}catch{}window.__craftWebWakeLock=null}},onSleep(Z){return Q("craft:powerSleep",Z)},onWake(Z){return Q("craft:powerWake",Z)}};async function m(){if(typeof navigator>"u")return null;let Z=navigator;if(typeof Z.getBattery!=="function")return null;try{return await Z.getBattery()}catch{return null}}var r8={async connectionType(){if(J("network"))return await window.craft.network.connectionType();return jZ()},async wifiSSID(){if(J("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(J("network")){let Z=await window.craft.network.wifiSignalStrength();return typeof Z==="number"?Z:void 0}return},async ipAddress(){if(J("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(J("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(J("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(J("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(J("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(J("network"))await window.craft.network.openPreferences()},onChange(Z){if(J("network"))return Q("craft:networkChange",Z);if(typeof window>"u")return()=>{};let $=()=>Z({type:jZ(),online:!0}),Y=()=>Z({type:"none",online:!1});return window.addEventListener("online",$),window.addEventListener("offline",Y),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",Y)}}};function jZ(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let Z=navigator.connection;if(!Z)return"unknown";let $=String(Z.type||Z.effectiveType||"unknown").toLowerCase();if($==="wifi"||$==="cellular"||$==="ethernet"||$==="bluetooth"||$==="none")return $;return"unknown"}var a8={async checkForUpdates(){if(!J("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!J("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(Z){if(!J("updater"))return;await window.craft.updater.setAutomaticChecks(Z)},async setCheckInterval(Z){if(!J("updater"))return;if(!Number.isFinite(Z))throw Error("setCheckInterval: must be a finite number");let $=Z<=0?0:Math.max(60,Math.round(Z));await window.craft.updater.setCheckInterval($)},async setFeedURL(Z){if(!J("updater"))return;await window.craft.updater.setFeedURL(Z)},async getLastUpdateCheckDate(){if(!J("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!J("updater"))return null;let Z=await window.craft.updater.getUpdateInfo();if(!Z||typeof Z.version!=="string"||Z.version.length===0)return null;return Z},onAvailable(Z){return Q("craft:updateAvailable",Z)},onDownloaded(Z){return Q("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:$,publicKeyB64:Y}){let z=WZ(Z),G;try{G=await crypto.subtle.importKey("raw",b(Y),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",G,b($),z)}catch{return!1}},async verifyDownload({url:Z,signatureB64:$,publicKeyB64:Y,fetchInit:z}){let G;try{G=await fetch(Z,z)}catch{return{ok:!1,reason:"fetch-failed"}}if(!G.ok)return{ok:!1,reason:"http-error",status:G.status};let X=new Uint8Array(await G.arrayBuffer()),O;try{O=await crypto.subtle.importKey("raw",b(Y),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let P=!1;try{P=await crypto.subtle.verify("Ed25519",O,b($),WZ(X))}catch{P=!1}if(!P)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:X}}};function WZ(Z){if(Z instanceof ArrayBuffer)return new Uint8Array(Z);let $=new ArrayBuffer(Z.byteLength),Y=new Uint8Array($);return Y.set(Z),Y}function b(Z){if(typeof atob==="function"){let z=atob(Z),G=new ArrayBuffer(z.length),X=new Uint8Array(G);for(let O=0;O<z.length;O++)X[O]=z.charCodeAt(O);return X}let $=Buffer.from(Z,"base64"),Y=new ArrayBuffer($.length);return new Uint8Array(Y).set($),new Uint8Array(Y)}var t8={onFocus(Z){if(J("window"))return Q("craft:window:focus",()=>Z());return n("focus",Z)},onBlur(Z){if(J("window"))return Q("craft:window:blur",()=>Z());return n("blur",Z)},onResize(Z){if(J("window"))return Q("craft:window:resize",Z);if(typeof window>"u")return()=>{};let $=()=>Z({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},onMove(Z){if(J("window"))return Q("craft:window:move",Z);return()=>{}},onClose(Z){if(J("window"))return Q("craft:window:close",()=>Z());return n("beforeunload",Z)},onMinimize(Z){if(J("window"))return Q("craft:window:minimize",()=>Z());if(typeof document>"u")return()=>{};let $=()=>{if(document.visibilityState==="hidden")Z()};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)},onRestore(Z){if(J("window"))return Q("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let $=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)}};function n(Z,$){if(typeof window>"u")return()=>{};let Y=()=>$();return window.addEventListener(Z,Y),()=>window.removeEventListener(Z,Y)}var KZ={name:"",version:"0.0.0"},$$={async hideDockIcon(){if(J("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(J("app"))await window.craft.app.showDockIcon()},async quit(){if(J("app"))await window.craft.app.quit()},async getInfo(){if(!J("app"))return KZ;let Z=await window.craft.app.getInfo();return{...KZ,...Z||{}}},async notify(Z){if(!Z.title)throw Error("notify: title is required");if(J("app"))await window.craft.app.notify(Z)},async setBadge(Z){if(J("app"))await window.craft.app.setBadge(Z)},async bounce(Z="informational"){if(J("app"))await window.craft.app.bounce(Z)}};var z$={app(Z,$={}){return{label:Z,items:[{label:`About ${Z}`,role:"about"},{separator:!0},...$.settings?[{id:"stx.menu.settings",label:"Settings\u2026",shortcut:"cmd+,",onClick:$.settings},{separator:!0}]:[],{label:`Hide ${Z}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${Z}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(Z,$={}){return[this.app(Z,$),this.edit()]}},Y4=0;function z4(Z){let $=new Map;return{payload:{menus:Z.menus.map((z)=>({label:z.label,items:z.items.map((G)=>{let{onClick:X,...O}=G;if(O.separator)return O;let P=O.id??`stx.menu.${Y4++}`;if(X)$.set(P,X);return{...O,id:P}})}))},handlers:$}}var o=null,G$={async set(Z){if(!J("menu"))return!1;let{payload:$,handlers:Y}=z4(Z);if(o?.(),o=null,Y.size>0)o=Q("craft:menu:action",(z)=>{Y.get(z.id)?.()});return await window.craft.menu.set($),!0},async setDock(Z){if(J("menu"))await window.craft.menu.setDock(Z)},async addItem(Z,$){if(J("menu"))await window.craft.menu.addItem(Z,$)},async removeItem(Z){if(J("menu"))await window.craft.menu.removeItem(Z)},async enableItem(Z){if(J("menu"))await window.craft.menu.enableItem(Z)},async disableItem(Z){if(J("menu"))await window.craft.menu.disableItem(Z)},async checkItem(Z){if(J("menu"))await window.craft.menu.checkItem(Z)},async uncheckItem(Z){if(J("menu"))await window.craft.menu.uncheckItem(Z)},async setItemLabel(Z,$){if(J("menu"))await window.craft.menu.setItemLabel(Z,$)},async clearDock(){if(J("menu"))await window.craft.menu.clearDock()},onAction(Z){return Q("craft:menu:action",Z)}};function LZ(Z){if(Z.separator)return{id:Z.id||"",title:"",type:"separator"};return{id:Z.id||"",title:Z.title||"",icon:Z.icon,shortcut:Z.shortcut,enabled:Z.disabled?!1:void 0,checked:Z.checked?!0:void 0,type:Z.submenu?"submenu":void 0,submenu:Z.submenu?.map(LZ)}}async function RZ(Z){if(!Z.items||Z.items.length===0)throw Error("contextMenu.show requires at least one item");if(!J("nativeUI"))return null;let $=await window.craft.nativeUI.showContextMenu({targetId:Z.targetId||"",targetType:"general",x:Math.round(Z.x),y:Math.round(Z.y),items:Z.items.map(LZ)});return{id:typeof $?.id==="string"?$.id:null,targetId:$?.targetId}}var P$={available(){return J("nativeUI")},async show(Z){return await RZ(Z)!==null},async pick(Z){return(await RZ(Z))?.id??null},onAction(Z){return Q("craft:contextmenu:action",($)=>{if(typeof $.id==="string")Z({id:$.id,targetId:$.targetId??""})})}};function a(Z){if(Z===null||Z===void 0||Z===0)return"";return String(Z)}function DZ(Z){return Z.map(($)=>({id:$.id,header:$.header,items:$.items.map((Y)=>({id:Y.id,label:Y.label,icon:Y.icon,badge:a(Y.badge)||void 0}))}))}function NZ(Z){return JSON.stringify(Z.map(($)=>[$.id,$.header??"",$.items.map((Y)=>[Y.id,Y.label,Y.icon??""])]))}function kZ(Z){return new Map(Z.flatMap(($)=>$.items.map((Y)=>[Y.id,a(Y.badge)])))}var G4={available(){return J("nativeUI")&&typeof window.craft?.nativeUI?._emitSidebarSelect==="function"},create(Z){if(!G4.available())return null;let $=window.craft.nativeUI.createSidebar({id:Z.id,sections:DZ(Z.sections),selected:Z.selected}),Y=Z.sections,z=new Set;return $.onSelect((G)=>{for(let X of[...z])X(G)}),{id:$.id,update(G){if(NZ(G)===NZ(Y)){let X=kZ(Y);for(let[O,P]of kZ(G))if(X.get(O)!==P)$.updateItem(O,{badge:P})}else $.setSections(DZ(G));Y=G},updateItem(G,X){$.updateItem(G,{...X.label!==void 0?{label:X.label}:{},...X.icon!==void 0?{icon:X.icon}:{},..."badge"in X?{badge:a(X.badge)}:{}}),Y=Y.map((O)=>({...O,items:O.items.map((P)=>P.id===G?{...P,...X}:P)}))},select(G){$.setSelectedItem(G)},onSelect(G){return z.add(G),()=>z.delete(G)},destroy(){z.clear(),$.destroy()}}}};var W$={async getDisplays(){if(J("screen"))return await window.craft.screen.getDisplays();return qZ()},async getPrimary(){if(J("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return qZ()[0]??null},onChange(Z){if(J("screen"))return Q("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let $=()=>Z();return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)}};function qZ(){if(typeof window>"u"||!window.screen)return[];let Z=window.screen;return[{id:0,x:Z.left??0,y:Z.top??0,width:Z.width||0,height:Z.height||0,workX:Z.availLeft??0,workY:Z.availTop??0,workWidth:Z.availWidth??Z.width??0,workHeight:Z.availHeight??Z.height??0,scaleFactor:window.devicePixelRatio||1}]}var L$={async set(Z,$,Y){if(!Z)throw Error("keychain.set: service is required");if(!$)throw Error("keychain.set: account is required");await V("keychain").set(Z,$,Y)},async get(Z,$){if(!Z)throw Error("keychain.get: service is required");if(!$)throw Error("keychain.get: account is required");let Y=await V("keychain").get(Z,$);return typeof Y==="string"?Y:null},async delete(Z,$){if(!Z)throw Error("keychain.delete: service is required");if(!$)throw Error("keychain.delete: account is required");await V("keychain").delete(Z,$)},async has(Z,$){if(!Z)throw Error("keychain.has: service is required");if(!$)throw Error("keychain.has: account is required");return await V("keychain").has(Z,$)}};var k$={async check(Z){if(J("permissions"))return await window.craft.permissions.check(Z);return await HZ(Z)},async request(Z){if(J("permissions"))return await window.craft.permissions.request(Z);return await Q4(Z)},async openSettings(Z){if(J("permissions"))await window.craft.permissions.openSettings(Z)}};async function HZ(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let $=await navigator.permissions.query({name:Z});return X4($.state)}catch{return"not-supported"}}async function Q4(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let $=await window.Notification.requestPermission();return $==="granted"?"granted":$==="denied"?"denied":"undetermined"}return await HZ(Z)}function X4(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var U$={async print(){if(J("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(Z){if(!Z)throw Error("printToPDF: path is required");let $=Z.startsWith("/"),Y=/^[a-zA-Z]:[\\/]/.test(Z)||Z.startsWith("\\\\");if(!$&&!Y)throw Error("printToPDF: path must be absolute");let z=await V("printing").printToPDF(Z);return{ok:!!(z&&z.ok),path:z?.path}}};var A$={async enable(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!J("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function i(){if(!J("window"))return null;return window.craft.window}function k(Z){let $=i();if(!$)return Promise.resolve();try{return Promise.resolve(Z($)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var x$={get available(){return i()!==null},open(Z){let $=()=>{if(typeof window<"u"&&Z.url)window.open(Z.url,Z.name);return{name:Z.name}},Y=i();if(!Y?.open)return Promise.resolve($());return Y.open(Z).then((z)=>({name:z?.name||Z.name})).catch($)},close:()=>k((Z)=>Z.close?.()),focus:()=>k((Z)=>Z.focus?.()),minimize:()=>k((Z)=>Z.minimize?.()),maximize:()=>k((Z)=>Z.maximize?.()),center:()=>k((Z)=>Z.center?.()),startDrag:()=>k((Z)=>Z.startDrag?.()),setTitle:(Z)=>k(($)=>$.setTitle?.(Z)),setSize:(Z,$)=>k((Y)=>Y.setSize?.(Z,$)),setAppearance:(Z)=>k(($)=>$.setAppearance?.(Z))};var w$={async addItem(Z){if(J("touchbar"))await window.craft.touchbar.addItem(Z)},async removeItem(Z){if(J("touchbar"))await window.craft.touchbar.removeItem(Z)},async updateItem(Z,$){if(J("touchbar"))await window.craft.touchbar.updateItem(Z,$)},async setLabel(Z,$){if(J("touchbar"))await window.craft.touchbar.setLabel(Z,$)},async setIcon(Z,$){if(J("touchbar"))await window.craft.touchbar.setIcon(Z,$)},async setEnabled(Z,$){if(J("touchbar"))await window.craft.touchbar.setEnabled(Z,$)},async setSliderValue(Z,$){if(J("touchbar"))await window.craft.touchbar.setSliderValue(Z,$)},async clear(){if(J("touchbar"))await window.craft.touchbar.clear()},async show(){if(J("touchbar"))await window.craft.touchbar.show()},async hide(){if(J("touchbar"))await window.craft.touchbar.hide()},onAction(Z){return Q("craft:touchbar:action",Z)}};var P4=/^[\da-f]*$/i;function O4(Z,$){if(typeof $!=="string"||!P4.test($)||$.length%2!==0)throw Error(`${Z}: must be a hex string with even length, got ${JSON.stringify($)}`)}var f$={async isEnabled(){return J("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return J("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return J("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return J("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(J("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(J("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return J("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(Z){if(J("bluetooth"))await window.craft.bluetooth.connect(Z)},async disconnect(Z){if(J("bluetooth"))await window.craft.bluetooth.disconnect(Z)},async openPreferences(){if(J("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(Z){if(!Z)throw Error("bluetooth.discoverServices: deviceId is required");if(!J("bluetooth"))return[];let $=await window.craft.bluetooth.discoverServices(Z);return Array.isArray($)?$:[]},async discoverCharacteristics(Z,$){if(!Z||!$)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!J("bluetooth"))return[];let Y=await window.craft.bluetooth.discoverCharacteristics(Z,$);return Array.isArray(Y)?Y:[]},async readCharacteristic(Z,$,Y){if(!Z||!$||!Y)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(Z,$,Y)},async writeCharacteristic(Z,$,Y,z,G="with-response"){if(!Z||!$||!Y)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(O4("bluetooth.writeCharacteristic.valueHex",z),!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(Z,$,Y,z,G)},async setCharacteristicNotify(Z,$,Y,z){if(!Z||!$||!Y)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!J("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(Z,$,Y,z)},onDeviceFound(Z){return Q("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return Q("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return Q("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return Q("craft:bluetooth:characteristicValue",Z)}};var m$={async speak(Z,$){if(!Z)throw Error("speech.speak: text is required");if(J("speech")){await window.craft.speech.speak(Z,$);return}if(typeof window<"u"&&window.speechSynthesis){let Y=new window.SpeechSynthesisUtterance(Z);if($){if($.rate!=null)Y.rate=$.rate;if($.pitch!=null)Y.pitch=$.pitch;if($.volume!=null)Y.volume=$.volume;if($.voice){let G=window.speechSynthesis.getVoices().find((X)=>X.voiceURI===$.voice||X.name===$.voice||X.lang===$.voice);if(G)Y.voice=G}}window.speechSynthesis.speak(Y)}},async stop(){if(J("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(J("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(J("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(J("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(J("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map(($)=>({id:$.voiceURI||$.name,name:$.name,language:$.lang||"",quality:"default"}));return[]}};var x=[],s=!0,t,e,u={async report(Z){if(J("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!s)return;let $=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:t,appVersion:e}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:t,appVersion:e};if(x.length>=64)x.shift();x.push($)},async flush(){if(J("crashReporter"))return await window.craft.crashReporter.flush();return[...x]},async clear(){if(J("crashReporter")){await window.craft.crashReporter.clear();return}x.length=0},async setEnabled(Z){if(J("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}s=Z},async isEnabled(){if(J("crashReporter"))return await window.craft.crashReporter.isEnabled();return s},async setUser(Z){if(J("crashReporter")){await window.craft.crashReporter.setUser(Z);return}t=Z||void 0},async setAppVersion(Z){if(J("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}e=Z||void 0},attachGlobalHandlers(){if(J("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=(Y)=>{u.report({severity:"error",message:Y.message,source:"js",stack:Y.error?.stack||`${Y.message}
|
|
311
|
+
at ${Y.filename}:${Y.lineno}:${Y.colno}`}).catch(()=>{})},$=(Y)=>{let z=Y.reason;u.report({severity:"error",message:z?.message||String(z),source:"js",stack:z?.stack||""}).catch(()=>{})};return window.addEventListener("error",Z),window.addEventListener("unhandledrejection",$),()=>{window.removeEventListener("error",Z),window.removeEventListener("unhandledrejection",$)}},forwardTo(Z){return D4(Z)}},V4="craft:crashReporter:pending",F4=/[\w.+-]+@[\w-]+\.[\w.-]+/g,j4=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,W4=/\/(?:Users|home)\/[^\s/'"`]+/g;function K4(Z){let $=(Y)=>Y.replace(F4,"<email>").replace(j4,"<ip>").replace(W4,"/<home>");return{...Z,message:$(Z.message),stack:$(Z.stack)}}async function R4(Z,$){let Y=new TextEncoder,z=await crypto.subtle.importKey("raw",Y.encode(Z),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),G=await crypto.subtle.sign("HMAC",z,Y.encode($));return[...new Uint8Array(G)].map((X)=>X.toString(16).padStart(2,"0")).join("")}function L4(Z){if(!Z||typeof localStorage>"u")return[];try{let $=localStorage.getItem(Z);if(!$)return[];let Y=JSON.parse($);return Array.isArray(Y)?Y:[]}catch{return[]}}function UZ(Z,$){if(!Z||typeof localStorage>"u")return;try{if($.length===0)localStorage.removeItem(Z);else localStorage.setItem(Z,JSON.stringify($))}catch{}}function D4(Z){let{endpoint:$,intervalMs:Y=60000,signingSecret:z,redact:G=!0,headers:X={},maxRetries:O=5,persistKey:P}=Z,F=P===null?null:P??V4,j=L4(F),R=!1,q=null,L=null,xZ=typeof G==="function"?G:G===!1?(H)=>H:K4;async function EZ(H){let E=JSON.stringify({entries:H}),C={"Content-Type":"application/json",...X};if(z)C["X-Craft-Signature"]=await R4(z,E);let JZ=0,g=1000;while(!R)try{let A=await fetch($,{method:"POST",headers:C,body:E});if(A.ok)return;if(A.status>=400&&A.status<500)return;throw Error(`HTTP ${A.status}`)}catch(A){if(JZ+=1,JZ>O)throw j=[...H,...j],UZ(F,j),A;await new Promise((CZ)=>{setTimeout(CZ,g)}),g=Math.min(g*2,60000)}}async function $Z(){if(R||L)return L??void 0;let H=await u.flush();if(H.length>0)await u.clear();if(j=[...j,...H.map((C)=>xZ(C))],j.length===0)return;let E=j;return j=[],UZ(F,j),L=EZ(E).catch(()=>{}).finally(()=>{L=null}),L}if(Y>0)q=setInterval(()=>{$Z().catch(()=>{})},Y);return{async flushNow(){await $Z()},stop(){if(R=!0,q)clearInterval(q);q=null},pending(){return[...j]}}}var c$={async isAvailable(){if(!J("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(Z){if(!J("iap"))return[];let $=Array.isArray(Z)?Z:[String(Z)];return await window.craft.iap.getProducts($)},async purchase(Z){if(!J("iap"))return{queued:!1,productId:Z,reason:"IAP bridge not available"};let $=await window.craft.iap.purchase(Z);return{queued:!!($&&$.queued),productId:$?.productId,reason:$?.reason}},async restorePurchases(){if(!J("iap"))return{ok:!1};let Z=await window.craft.iap.restorePurchases();return{ok:!!(Z&&Z.ok)}},async finishTransaction(Z){if(!J("iap"))return;await window.craft.iap.finishTransaction(Z)},async getReceiptData(){if(!J("iap"))return null;let Z=await window.craft.iap.getReceiptData();return Z?String(Z):null},onPurchased(Z){return Q("craft:iap:purchased",Z)},onFailed(Z){return Q("craft:iap:failed",Z)},onRestored(Z){return Q("craft:iap:restored",Z)},onProductsLoaded(Z){return Q("craft:iap:productsLoaded",($)=>Z($.products||[]))},onRefunded(Z){return Q("craft:iap:refunded",Z)},onSubscriptionStatusChanged(Z){return Q("craft:iap:subscriptionStatusChanged",Z)},async getActiveSubscriptions(){if(!J("iap"))return[];let Z=window.craft.iap.getActiveSubscriptions;if(typeof Z!=="function")return[];let $=await Z();return Array.isArray($)?$:[]},async isEligibleForIntroOffer(Z){if(!J("iap"))return!1;let $=window.craft.iap.isEligibleForIntroOffer;if(typeof $!=="function")return!1;return!!await $(Z)}};var l={async startActivity(Z,$){if(!Z)throw Error("handoff.startActivity: type is required");if(!J("handoff"))return!1;let Y=await window.craft.handoff.startActivity(Z,$);return typeof Y==="boolean"?Y:!!(Y&&Y.ok)},async updateActivity(Z){if(!J("handoff"))return!1;let $=await window.craft.handoff.updateActivity(Z);return typeof $==="boolean"?$:!!($&&$.ok)},async stopActivity(){if(!J("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!J("handoff"))return null;let Z=await window.craft.handoff.getCurrentActivity();return Z&&typeof Z.type==="string"?Z:null},onIncoming(Z){return Q("craft:handoff:incoming",Z)}};var o$={async start(Z,$){return l.startActivity(Z,{title:$?.title,webpageURL:$?.webpageURL,userInfo:$?.state})},async update(Z){return l.updateActivity({title:Z.title,webpageURL:Z.webpageURL,userInfo:Z.state})},async stop(){await l.stopActivity()}};var s$={async requestPermission(Z="whenInUse"){if(J("location"))return await window.craft.location.requestPermission(Z);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(J("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(J("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((Z)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:Z.coords.latitude,longitude:Z.coords.longitude,altitude:Z.coords.altitude,horizontalAccuracy:Z.coords.accuracy,verticalAccuracy:Z.coords.altitudeAccuracy,speed:Z.coords.speed}}))},(Z)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:Z.message||String(Z)}}))}),{requested:!0};return{requested:!1}},async startWatching(Z){if(J("location"))return await window.craft.location.startWatching(Z);if(typeof navigator<"u"&&navigator.geolocation){let $=navigator.geolocation.watchPosition((Y)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:Y.coords.latitude,longitude:Y.coords.longitude,altitude:Y.coords.altitude,horizontalAccuracy:Y.coords.accuracy,verticalAccuracy:Y.coords.altitudeAccuracy,speed:Y.coords.speed}}))});return window.__craftWebLocationWatchId=$,!0}return!1},async stopWatching(){if(J("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let Z=window.__craftWebLocationWatchId;if(Z!=null)navigator.geolocation.clearWatch(Z),window.__craftWebLocationWatchId=null}},onUpdate(Z){return Q("craft:location:update",Z)},onError(Z){return Q("craft:location:error",Z)},onAuthChanged(Z){return Q("craft:location:authChanged",Z)}};var ZJ={async captureScreen(){if(!J("screenCapture"))return null;let Z=await window.craft.screenCapture.captureScreen();return Z?String(Z):null},async captureWindow(Z){if(!J("screenCapture"))return null;if(!Number.isFinite(Z)||Z<=0)throw Error("captureWindow: id must be a positive number");let $=await window.craft.screenCapture.captureWindow(Z);return $?String($):null},async listWindows(){if(!J("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var N4=250,k4=60000,SZ=2000,MZ={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function q4(){return{...MZ,signals:{...MZ.signals},sources:[]}}var ZZ={async getState(){if(!J("screenSharing"))return q4();return await window.craft.screenSharing.getState()},async watch(Z=SZ){let $=Math.min(k4,Math.max(N4,Math.round(Z)));if(!J("screenSharing"))return $;let Y=await window.craft.screenSharing.watch($);return Y&&Y.intervalMs||$},async stop(){if(!J("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(Z){return Q("craft:screenSharing:change",Z)}};async function YJ(Z,$=SZ){let Y=ZZ.onChange(Z);return await ZZ.watch($),()=>{Y(),ZZ.stop()}}var H4={supported:!1,isFocused:null,authorization:"unsupported"};function AZ(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var TZ={async getStatus(){if(!J("focus"))return{...H4};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!J("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(Z,$={}){if(!J("focus"))return AZ();if(!(Z?$.onShortcut:$.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${Z?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(Z,$)},async runShortcut(Z){if(!J("focus"))return AZ();if(!Z)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(Z)},async listShortcuts(){if(!J("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!J("focus"))return{canList:!1,shortcuts:[]};let $=await window.craft.focus.listShortcutsResult?.();return{canList:Boolean($?.canList),shortcuts:$?.shortcuts??[]}}};async function QJ(...Z){if(Z.length===0)return!1;let $=new Set(await TZ.listShortcuts());return Z.every((Y)=>$.has(Y))}async function XJ(...Z){if(Z.length===0)return!1;let{canList:$,shortcuts:Y}=await TZ.listShortcutsResult();if(!$)return"unknown";let z=new Set(Y);return Z.every((G)=>z.has(G))}var VJ={async start(Z=0,$="127.0.0.1"){if(!J("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(Z,$)},async stop(){if(!J("localServer"))return;await window.craft.localServer.stop()},async respond(Z){if(!J("localServer"))return;await window.craft.localServer.respond(Z||{status:200,body:"OK"})},onRequest(Z){return Q("craft:localServer:request",Z)},async awaitOAuthCallback(Z={}){V("localServer");let{port:$=0,host:Y="127.0.0.1",timeoutMs:z=300000,successHTML:G}=Z,X=await this.start($,Y);if(!X.started)throw Error(`localServer: start failed${X.reason?` \u2014 ${X.reason}`:""}`);return new Promise((O,P)=>{let F=setTimeout(()=>{j(),this.stop().catch(()=>{}),P(Error("localServer: OAuth callback timed out"))},z),j=this.onRequest(({url:R})=>{clearTimeout(F),j();let q=G??`<!doctype html><meta charset="utf-8"><title>Done</title>
|
|
312
312
|
<style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
|
|
313
313
|
<div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
|
|
314
|
-
<script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:q,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),O({url:R,port:X.port})})})}};var
|
|
315
|
-
export{
|
|
314
|
+
<script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:q,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),O({url:R,port:X.port})})})}};var WJ={async isAvailable(){if(!J("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!J("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(Z,$){if(!Z)throw Error("biometric.evaluate: reason is required");if(!J("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(Z,$)}};var K=null,LJ={async play(Z,$){if(J("audio"))return await window.craft.audio.play(Z,$);if(typeof window>"u"||typeof Audio>"u")return!1;if(K)K.pause(),K=null;if(K=new Audio(Z),$?.volume!=null)K.volume=$.volume;if($?.loops)K.loop=!0;try{return await K.play(),!0}catch{return!1}},async playSystemSound(Z){if(J("audio"))return await window.craft.audio.playSystemSound(Z);if(typeof window>"u"||typeof Audio>"u")return!1;try{return K=new Audio(`/System/Library/Sounds/${Z}.aiff`),await K.play(),!0}catch{return!1}},async stop(){if(J("audio")){await window.craft.audio.stop();return}if(K)K.pause(),K.currentTime=0,K=null},async isPlaying(){if(J("audio"))return await window.craft.audio.isPlaying();return!!(K&&!K.paused)},async startRecording(Z,$){if(J("audio"))return await window.craft.audio.startRecording(Z,$);return!1},async stopRecording(){if(J("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(J("audio"))return await window.craft.audio.isRecording();return!1}};var kJ={async execute(Z){if(!Z)throw Error("appleScript.execute: source is required");if(!J("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(Z)}};var UJ={async getDefault(Z){if(!Z)throw Error("fileAssociations.getDefault: uti is required");if(!J("fileAssociations"))return null;let $=await window.craft.fileAssociations.getDefault(Z);return $?String($):null},async setDefault(Z,$){if(!Z||!$)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!J("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(Z,$)}};var AJ={async get(Z){if(!Z)throw Error("tags.get: path is required");if(!J("tags"))return[];return await window.craft.tags.get(Z)},async set(Z,$){if(!Z)throw Error("tags.set: path is required");if(!J("tags"))return!1;let Y=Array.isArray($)?$:[String($)];return await window.craft.tags.set(Z,Y)},async clear(Z){if(!Z)throw Error("tags.clear: path is required");if(!J("tags"))return!1;return await window.craft.tags.clear(Z)}};var xJ={async countPages(Z){if(!Z)throw Error("pdf.countPages: path is required");if(!J("pdf"))return 0;return await window.craft.pdf.countPages(Z)},async extractText(Z){if(!Z)throw Error("pdf.extractText: path is required");if(!J("pdf"))return"";return await window.craft.pdf.extractText(Z)}};var wJ={async debug(Z){if(J("log"))await window.craft.log.debug(Z);else console.debug(Z)},async info(Z){if(J("log"))await window.craft.log.info(Z);else console.info(Z)},async warn(Z){if(J("log"))await window.craft.log.warn(Z);else console.warn(Z)},async error(Z){if(J("log"))await window.craft.log.error(Z);else console.error(Z)}};var fJ={async browse(Z){if(!J("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(Z)},async stop(){if(J("bonjour"))await window.craft.bonjour.stop()},onFound(Z){return Q("craft:bonjour:found",Z)},onLost(Z){return Q("craft:bonjour:lost",Z)}};var mJ={async index(Z){if(!J("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(Z)},async remove(Z){if(!J("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(Z)},async removeAll(){if(!J("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}};var lJ={async isAvailable(){if(!J("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(Z){if(!J("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(Z)},async stop(){if(J("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(Z){return Q("craft:speechRecognition:partial",Z)},onFinal(Z){return Q("craft:speechRecognition:final",Z)}};var cJ={async recognizeText(Z){if(!Z)throw Error("vision.recognizeText: path is required");if(!J("vision"))return[];return await window.craft.vision.recognizeText(Z)},async detectFaces(Z){if(!Z)throw Error("vision.detectFaces: path is required");if(!J("vision"))return[];return await window.craft.vision.detectFaces(Z)},async detectBarcodes(Z){if(!Z)throw Error("vision.detectBarcodes: path is required");if(!J("vision"))return[];return await window.craft.vision.detectBarcodes(Z)}};var rJ={async listSources(){if(!J("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!J("midi"))return[];return await window.craft.midi.listDestinations()},async send(Z,$){if(!J("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(Z,$)},async subscribe(Z){if(!J("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(Z)},async unsubscribe(Z){if(!J("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(Z)},onMessage(Z){return Q("craft:midi:message",Z)}};var aJ={async loadModel(Z,$){if(!Z||!$)throw Error("coreml.loadModel: id and path are required");if(!J("coreml"))return!1;return await window.craft.coreml.loadModel(Z,$)},async unloadModel(Z){if(!J("coreml"))return;await window.craft.coreml.unloadModel(Z)},async predict(Z,$){if(!Z)throw Error("coreml.predict: id is required");if(!J("coreml"))return null;return await window.craft.coreml.predict(Z,$)}};var tJ={async listCameras(){if(!J("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}};var $Y={async register(Z){if(!Z)throw Error("serviceMenu.register: name is required");if(!J("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(Z)},async unregister(Z){if(!Z)throw Error("serviceMenu.unregister: name is required");if(!J("serviceMenu"))return;await window.craft.serviceMenu.unregister(Z)},onInvoked(Z){return Q("craft:serviceMenu:invoked",Z)}};var zY={async list(){if(!J("serial"))return[];return await window.craft.serial.list()},async open(Z,$=9600){if(!Z)throw Error("serial.open: path is required");if(!J("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(Z,$)},async write(Z,$){if(!Z)throw Error("serial.write: id is required");if(!J("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(Z,$)},async close(Z){if(!J("serial"))return;await window.craft.serial.close(Z)},onData(Z){return Q("craft:serial:data",Z)}};var _Z=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function XY(){return _Z.map(({name:Z,support:$})=>({name:Z,support:$,available:J(Z)}))}function U4(Z){let $=_Z.find((Y)=>Y.name===Z);if(!$)return;return{...$,available:J(Z)}}function PY(Z){let $=U4(Z);return!!$&&$.available}
|
|
315
|
+
export{M4 as a,zZ as b,I as c,S4 as d,A4 as e,T4 as f,_4 as g,x4 as h,E4 as i,C4 as j,w4 as k,I4 as l,T as m,lZ as n,f4 as o,B4 as p,v4 as q,gZ as r,m4 as s,b4 as t,u4 as u,l4 as v,g4 as w,h4 as x,p4 as y,d4 as z,B as A,r4 as B,n4 as C,o4 as D,a4 as E,i4 as F,s4 as G,e4 as H,hZ as I,Z8 as J,$8 as K,J8 as L,Y8 as M,pZ as N,G8 as O,Q8 as P,oZ as Q,X8 as R,P8 as S,V8 as T,F8 as U,j8 as V,W8 as W,K8 as X,J as Y,N8 as Z,H8 as _,S8 as $,_8 as aa,C8 as ba,y8 as ca,v8 as da,m8 as ea,l8 as fa,c8 as ga,r8 as ha,a8 as ia,t8 as ja,$$ as ka,z$ as la,G$ as ma,P$ as na,G4 as oa,W$ as pa,L$ as qa,k$ as ra,U$ as sa,A$ as ta,x$ as ua,w$ as va,f$ as wa,m$ as xa,u as ya,K4 as za,R4 as Aa,c$ as Ba,l as Ca,o$ as Da,s$ as Ea,ZJ as Fa,N4 as Ga,k4 as Ha,SZ as Ia,ZZ as Ja,YJ as Ka,TZ as La,QJ as Ma,XJ as Na,VJ as Oa,WJ as Pa,LJ as Qa,kJ as Ra,UJ as Sa,AJ as Ta,xJ as Ua,wJ as Va,fJ as Wa,mJ as Xa,lJ as Ya,cJ as Za,rJ as _a,aJ as $a,tJ as ab,$Y as bb,zY as cb,XY as db,U4 as eb,PY as fb};
|
package/dist/index.d.ts
CHANGED
|
@@ -155,13 +155,14 @@ export type {
|
|
|
155
155
|
} from './updater';
|
|
156
156
|
export type { WindowEvents, WindowPosition, WindowSize } from './window-events';
|
|
157
157
|
export type { AppAPI, AppInfo, AppNotifyOptions } from './app-info';
|
|
158
|
-
export type { ApplicationMenu, Menu, MenuActionEvent, MenuAPI, MenuItem, MenuRole } from './menu';
|
|
158
|
+
export type { ApplicationMenu, Menu, MenuActionEvent, MenuAPI, MenuItem, MenuRole, StandardMenuOptions } from './menu';
|
|
159
159
|
export type {
|
|
160
160
|
ContextMenuAPI,
|
|
161
161
|
ContextMenuActionEvent,
|
|
162
162
|
ContextMenuItem,
|
|
163
163
|
ContextMenuOptions,
|
|
164
164
|
} from './context-menu';
|
|
165
|
+
export type { SidebarAPI, SidebarHandle, SidebarItem, SidebarOptions, SidebarSection } from './sidebar';
|
|
165
166
|
export type { SystemInfo } from './system';
|
|
166
167
|
export type { Display, ScreenAPI } from './screen';
|
|
167
168
|
export type { KeychainAPI } from './keychain';
|
|
@@ -545,6 +546,10 @@ export { menu, standardMenus } from './menu';
|
|
|
545
546
|
// =============================================================================
|
|
546
547
|
export { contextMenu } from './context-menu';
|
|
547
548
|
// =============================================================================
|
|
549
|
+
// Native Sidebar (a real source list beside the page)
|
|
550
|
+
// =============================================================================
|
|
551
|
+
export { sidebar } from './sidebar';
|
|
552
|
+
// =============================================================================
|
|
548
553
|
// System / Host Info
|
|
549
554
|
// =============================================================================
|
|
550
555
|
export { system } from './system';
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as Q1,$a as Q2,A as x0,Aa as C1,B as H0,Ba as x1,C as v0,Ca as H1,D as w0,Da as v1,E as f0,Ea as w1,F as S0,Fa as f1,G as g0,Ga as S1,H as b0,Ha as g1,I as y0,Ia as b1,J as u0,Ja as y1,K as h0,Ka as u1,L as m0,La as h1,M as c0,Ma as m1,N as d0,Na as c1,O as p0,Oa as d1,P as r0,Pa as p1,Q as n0,Qa as r1,R as o0,Ra as n1,S as l0,Sa as o1,T as a0,Ta as l1,U as i0,Ua as a1,V as s0,Va as i1,W as t0,Wa as s1,X as e0,Xa as t1,Y as n,Ya as e1,Z as Y1,Za as Y2,_ as Z1,_a as Z2,a as $0,aa as X1,ab as X2,b as J0,ba as $1,bb as $2,c as G0,ca as J1,cb as J2,d as R0,da as G1,db as G2,e as q0,ea as R1,eb as R2,f as K0,fa as q1,fb as q2,g as U0,ga as K1,h as _0,ha as U1,i as E0,ia as _1,j as F0,ja as E1,k as j0,ka as F1,l as B0,la as j1,m as V0,ma as B1,n as O0,na as V1,o as z0,oa as O1,p as M0,pa as z1,q as L0,qa as M1,r as T0,ra as L1,s as D0,sa as T1,t as W0,ta as D1,u as P0,ua as W1,v as A0,va as P1,w as N0,wa as A1,x as I0,xa as N1,y as k0,ya as I1,z as C0,za as k1}from"./chunk-hgcnqp53.js";import{gb as N}from"./chunk-gzgq8v6d.js";function z(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function F(Y){return Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(...Y){return Y.filter(Boolean).join(" ")}function V(Y){if(!Y)return"";return Object.entries(Y).map(([Z,Q])=>`${Z.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Q}`).join("; ")}function OY(Y){let{text:Z,variant:Q="primary",size:X="medium",disabled:$=!1,loading:J=!1,icon:K,iconPosition:R="left",id:G=z("btn"),className:_,style:U}=Y,E=O("stx-button",`stx-button--${Q}`,`stx-button--${X}`,$&&"stx-button--disabled",J&&"stx-button--loading",_),q=V(U),j=K?`<span class="stx-button-icon">${K}</span>`:"",B=J?'<span class="stx-button-spinner"></span>':"",M=R==="left"?`${j}${B}<span class="stx-button-text">${F(Z)}</span>`:`<span class="stx-button-text">${F(Z)}</span>${j}${B}`;return`<button id="${G}" class="${E}" ${$||J?"disabled":""} ${q?`style='${q}'`:""}>${M}</button>`}function zY(Y){let{value:Z="",placeholder:Q="",type:X="text",disabled:$=!1,readonly:J=!1,maxLength:K,minLength:R,pattern:G,required:_=!1,autocomplete:U,label:E,error:q,hint:j,id:B=z("input"),className:M,style:L}=Y,T=O("stx-input",q&&"stx-input--error",$&&"stx-input--disabled",M),w=V(L),VY=[`type="${X}"`,`id="${B}"`,`class="${T}"`,Z&&`value="${F(Z)}"`,Q&&`placeholder="${F(Q)}"`,$&&"disabled",J&&"readonly",_&&"required",K&&`maxlength="${K}"`,R&&`minlength="${R}"`,G&&`pattern="${F(G)}"`,U&&`autocomplete="${U}"`,w&&`style="${w}"`].filter(Boolean).join(" "),x="";if(E)x+=`<label class="stx-input-label" for="${B}">${F(E)}</label>`;if(x+=`<input ${VY} />`,q)x+=`<div class="stx-input-error">${F(q)}</div>`;else if(j)x+=`<div class="stx-input-hint">${F(j)}</div>`;return`<div class="stx-input-wrapper">${x}</div>`}function MY(Y){let{checked:Z=!1,label:Q,disabled:X=!1,indeterminate:$=!1,id:J=z("checkbox"),className:K,style:R}=Y,G=O("stx-checkbox",X&&"stx-checkbox--disabled",K),_=V(R),U=['type="checkbox"',`id="${J}"`,Z&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
3
3
|
<label class="${G}" ${_?`style="${_}"`:""}>
|
|
4
4
|
<input ${U} />
|
|
5
5
|
<span class="stx-checkbox-box"></span>
|
|
6
6
|
${Q?`<span class="stx-checkbox-label">${F(Q)}</span>`:""}
|
|
7
7
|
</label>
|
|
8
|
-
`}function
|
|
8
|
+
`}function LY(Y){let{value:Z=50,min:Q=0,max:X=100,step:$=1,disabled:J=!1,label:K,showValue:R=!0,id:G=z("slider"),className:_,style:U}=Y,E=O("stx-slider",J&&"stx-slider--disabled",_),q=V(U),j=['type="range"',`id="${G}"`,`value="${Z}"`,`min="${Q}"`,`max="${X}"`,`step="${$}"`,J&&"disabled"].filter(Boolean).join(" "),B="";if(K)B+=`<label class="stx-slider-label" for="${G}">${F(K)}</label>`;if(B+=`<div class="stx-slider-track"><input ${j} /></div>`,R)B+=`<span class="stx-slider-value">${Z}</span>`;return`<div class="${E}" ${q?`style='${q}'`:""}>${B}</div>`}function TY(Y){let{value:Z,max:Q=100,variant:X="default",size:$="medium",showLabel:J=!1,indeterminate:K=!1,id:R=z("progress"),className:G,style:_}=Y,U=Math.min(100,Math.max(0,Z/Q*100)),E=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",G),q=V(_);return`
|
|
9
9
|
<div id="${R}" class="${E}" role="progressbar" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${Q}" ${q?`style="${q}"`:""}>
|
|
10
10
|
<div class="stx-progress-bar" style="width: ${K?"100%":`${U}%`}"></div>
|
|
11
11
|
${J?`<span class="stx-progress-label">${Math.round(U)}%</span>`:""}
|
|
12
12
|
</div>
|
|
13
|
-
`}function
|
|
13
|
+
`}function DY(Y){let{text:Z,variant:Q="default",size:X="medium",id:$=z("badge"),className:J,style:K}=Y,R=O("stx-badge",`stx-badge--${Q}`,`stx-badge--${X}`,J),G=V(K);return`<span id="${$}" class="${R}" ${G?`style='${G}'`:""}>${F(Z)}</span>`}function WY(Y){let{src:Z,alt:Q="",name:X,size:$="medium",shape:J="circle",id:K=z("avatar"),className:R,style:G}=Y,_=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",E=O("stx-avatar",_,`stx-avatar--${J}`,R),q=[U,V(G)].filter(Boolean).join(" "),j=X?X.split(" ").map((B)=>B[0]).join("").toUpperCase().slice(0,2):"";if(Z)return`<div id="${K}" class="${E}" ${q?`style="${q}"`:""}>
|
|
14
14
|
<img src="${F(Z)}" alt="${F(Q)}" class="stx-avatar-img" />
|
|
15
15
|
</div>`;return`<div id="${K}" class="${E}" ${q?`style="${q}"`:""}>
|
|
16
16
|
<span class="stx-avatar-initials">${j}</span>
|
|
17
|
-
</div>`}function
|
|
17
|
+
</div>`}function PY(Y){let{title:Z,subtitle:Q,content:X,image:$,footer:J,variant:K="default",id:R=z("card"),className:G,style:_}=Y,U=O("stx-card",`stx-card--${K}`,G),E=V(_),q="";if($)q+=`<div class="stx-card-image"><img src="${F($)}" alt="" /></div>`;if(q+='<div class="stx-card-body">',Z)q+=`<h3 class="stx-card-title">${F(Z)}</h3>`;if(Q)q+=`<p class="stx-card-subtitle">${F(Q)}</p>`;if(X)q+=`<div class="stx-card-content">${F(X)}</div>`;if(q+="</div>",J)q+=`<div class="stx-card-footer">${F(J)}</div>`;return`<div id="${R}" class="${U}" ${E?`style='${E}'`:""}>${q}</div>`}function AY(Y){let{tabs:Z,activeTab:Q,variant:X="default",id:$=z("tabs"),className:J,style:K}=Y,R=O("stx-tabs",`stx-tabs--${X}`,J),G=V(K),_=Z.map((U,E)=>{let q=Q?U.value===Q:E===0;return`<button class="${O("stx-tab",q&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${F(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${q}">${F(U.label)}</button>`}).join("");return`<div id="${$}" class="${R}" role="tablist" ${G?`style='${G}'`:""}>${_}</div>`}function NY(Y){let{options:Z,value:Q,placeholder:X="Select...",disabled:$=!1,id:J=z("dropdown"),className:K,style:R}=Y,G=O("stx-dropdown",$&&"stx-dropdown--disabled",K),_=V(R),U=Z.map((q)=>{let j=q.value===Q?"selected":"",B=q.disabled?"disabled":"";return`<option value="${F(q.value)}" ${j} ${B}>${F(q.label)}</option>`}).join(""),E=Q?"":`<option value="" disabled selected>${F(X)}</option>`;return`<select id="${J}" class="${G}" ${$?"disabled":""} ${_?`style='${_}'`:""}>${E}${U}</select>`}function IY(Y){let{value:Z=0,max:Q=5,readonly:X=!1,size:$="medium",allowHalf:J=!1,id:K=z("rating"),className:R,style:G}=Y,_=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",R),U=V(G),E="";for(let q=1;q<=Q;q++){let j=q<=Z,B=J&&q-0.5===Z;E+=`<span class="stx-star ${j?"stx-star--filled":B?"stx-star--half":""}" data-value="${q}">\u2605</span>`}return`<div id="${K}" class="${_}" role="slider" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${Q}" ${U?`style='${U}'`:""}>${E}</div>`}function kY(Y){let{value:Z,name:Q,checked:X=!1,label:$,disabled:J=!1,id:K=z("radio"),className:R,style:G}=Y,_=O("stx-radio",J&&"stx-radio--disabled",R),U=V(G),E=['type="radio"',`id="${K}"`,`name="${F(Q)}"`,`value="${F(Z)}"`,X&&"checked",J&&"disabled"].filter(Boolean).join(" ");return`
|
|
18
18
|
<label class="${_}" ${U?`style="${U}"`:""}>
|
|
19
19
|
<input ${E} />
|
|
20
20
|
<span class="stx-radio-circle"></span>
|
|
21
21
|
${$?`<span class="stx-radio-label">${F($)}</span>`:""}
|
|
22
22
|
</label>
|
|
23
|
-
`}function
|
|
23
|
+
`}function CY(Y){let{value:Z="#3498db",disabled:Q=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:J=z("color"),className:K,style:R}=Y,G=O("stx-color-picker",Q&&"stx-color-picker--disabled",K),_=V(R),U="";if(X)U+=`<label class="stx-color-picker-label" for="${J}">${F(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
|
|
24
24
|
<input type="color" id="${J}" value="${F(Z)}" ${Q?"disabled":""} />
|
|
25
25
|
<span class="stx-color-picker-value">${F(Z)}</span>
|
|
26
|
-
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${F(E)}" data-color="${F(E)}" ${Q?"disabled":""}></button>`;U+="</div>"}return`<div class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
26
|
+
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${F(E)}" data-color="${F(E)}" ${Q?"disabled":""}></button>`;U+="</div>"}return`<div class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function xY(Y){let{value:Z,min:Q,max:X,disabled:$=!1,label:J,placeholder:K="Select date",showClear:R=!0,id:G=z("date"),className:_,style:U}=Y,E=O("stx-date-picker",$&&"stx-date-picker--disabled",_),q=V(U),j=Z instanceof Date?Z.toISOString().split("T")[0]:Z||"",B=Q instanceof Date?Q.toISOString().split("T")[0]:Q,M=X instanceof Date?X.toISOString().split("T")[0]:X,L=['type="date"',`id="${G}"`,j&&`value="${j}"`,B&&`min="${B}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${F(K)}"`].filter(Boolean).join(" "),T="";if(J)T+=`<label class="stx-date-picker-label" for="${G}">${F(J)}</label>`;return T+=`<div class="stx-date-picker-input">
|
|
27
27
|
<input ${L} />
|
|
28
28
|
${R&&j?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
29
|
-
</div>`,`<div class="${E}" ${q?`style='${q}'`:""}>${T}</div>`}function
|
|
29
|
+
</div>`,`<div class="${E}" ${q?`style='${q}'`:""}>${T}</div>`}function HY(Y){let{value:Z="",disabled:Q=!1,label:X,step:$=60,min:J,max:K,id:R=z("time"),className:G,style:_}=Y,U=O("stx-time-picker",Q&&"stx-time-picker--disabled",G),E=V(_),q=['type="time"',`id="${R}"`,Z&&`value="${F(Z)}"`,`step="${$}"`,J&&`min="${F(J)}"`,K&&`max="${F(K)}"`,Q&&"disabled"].filter(Boolean).join(" "),j="";if(X)j+=`<label class="stx-time-picker-label" for="${R}">${F(X)}</label>`;return j+=`<input ${q} class="stx-time-picker-input" />`,`<div class="${U}" ${E?`style='${E}'`:""}>${j}</div>`}function vY(Y){let{options:Z,value:Q="",placeholder:X="Search...",disabled:$=!1,label:J,loading:K=!1,id:R=z("autocomplete"),className:G,style:_}=Y,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",G),E=V(_),q=Z.find((M)=>M.value===Q),j=q?q.label:Q,B="";if(J)B+=`<label class="stx-autocomplete-label" for="${R}">${F(J)}</label>`;B+=`<div class="stx-autocomplete-input-wrapper">
|
|
30
30
|
<input type="text" id="${R}" value="${F(j)}" placeholder="${F(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
31
31
|
${K?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
32
|
-
</div>`,B+='<ul class="stx-autocomplete-list">';for(let M of Z)B+=`<li class="stx-autocomplete-item ${M.value===Q?"stx-autocomplete-item--selected":""}" data-value="${F(M.value)}">${F(M.label)}</li>`;return B+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${B}</div>`}function
|
|
32
|
+
</div>`,B+='<ul class="stx-autocomplete-list">';for(let M of Z)B+=`<li class="stx-autocomplete-item ${M.value===Q?"stx-autocomplete-item--selected":""}" data-value="${F(M.value)}">${F(M.label)}</li>`;return B+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${B}</div>`}function wY(Y){let{text:Z,htmlFor:Q,required:X=!1,size:$="medium",id:J=z("label"),className:K,style:R}=Y,G=O("stx-label",`stx-label--${$}`,K),_=V(R);return`<label id="${J}" class="${G}" ${Q?`for='${F(Q)}'`:""} ${_?`style='${_}'`:""}>${F(Z)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function fY(Y){let{src:Z,alt:Q="",width:X,height:$,objectFit:J="cover",fallback:K,loading:R="lazy",id:G=z("image"),className:_,style:U}=Y,E=O("stx-image",_),q={objectFit:J};if(X)q.width=typeof X==="number"?`${X}px`:X;if($)q.height=typeof $==="number"?`${$}px`:$;let j=[V(q),V(U)].filter(Boolean).join("; "),B=K?`onerror="this.src='${F(K)}'"`:"";return`<img id="${G}" class="${E}" src="${F(Z)}" alt="${F(Q)}" loading="${R}" ${j?`style='${j}'`:""} ${B} />`}function SY(Y){let{text:Z,variant:Q="default",size:X="medium",removable:$=!1,icon:J,id:K=z("chip"),className:R,style:G}=Y,_=O("stx-chip",`stx-chip--${Q}`,`stx-chip--${X}`,R),U=V(G),E="";if(J)E+=`<span class="stx-chip-icon">${J}</span>`;if(E+=`<span class="stx-chip-text">${F(Z)}</span>`,$)E+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${K}" class="${_}" ${U?`style='${U}'`:""}>${E}</span>`}function gY(Y){let{text:Z,position:Q="top",delay:X=200,children:$,id:J=z("tooltip"),className:K,style:R}=Y,G=O("stx-tooltip-wrapper",K),_=V(R);return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""} data-tooltip="${F(Z)}" data-position="${Q}" data-delay="${X}">
|
|
33
33
|
${$}
|
|
34
34
|
<span class="stx-tooltip stx-tooltip--${Q}">${F(Z)}</span>
|
|
35
|
-
</div>`}function
|
|
35
|
+
</div>`}function bY(Y){let{direction:Z="vertical",showScrollbar:Q=!0,smooth:X=!0,height:$,width:J,children:K,id:R=z("scroll"),className:G,style:_}=Y,U=O("stx-scroll-view",`stx-scroll-view--${Z}`,!Q&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",G),E={};if($)E.height=typeof $==="number"?`${$}px`:$;if(J)E.width=typeof J==="number"?`${J}px`:J;let q=[V(E),V(_)].filter(Boolean).join("; ");return`<div id="${R}" class="${U}" ${q?`style='${q}'`:""}>${K}</div>`}function yY(Y){let{direction:Z="horizontal",sizes:Q=[50,50],resizable:X=!0,children:$,id:J=z("split"),className:K,style:R}=Y,G=O("stx-split-view",`stx-split-view--${Z}`,X&&"stx-split-view--resizable",K),_=V(R),U=Z==="horizontal"?"width":"height";return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
|
|
36
36
|
<div class="stx-split-pane" style="${U}: ${Q[0]}%">${$[0]}</div>
|
|
37
37
|
${X?'<div class="stx-split-divider"></div>':""}
|
|
38
38
|
<div class="stx-split-pane" style="${U}: ${Q[1]}%">${$[1]}</div>
|
|
39
|
-
</div>`}function
|
|
39
|
+
</div>`}function uY(Y){let{items:Z,multiple:Q=!1,defaultOpen:X=[],id:$=z("accordion"),className:J,style:K}=Y,R=O("stx-accordion",J),G=V(K),_="";return Z.forEach((U,E)=>{let q=X.includes(E),j=O("stx-accordion-item",q&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");_+=`<div class="${j}" data-index="${E}">
|
|
40
40
|
<button class="stx-accordion-header" ${U.disabled?"disabled":""} aria-expanded="${q}" data-multiple="${Q}">
|
|
41
41
|
<span class="stx-accordion-title">${F(U.title)}</span>
|
|
42
42
|
<span class="stx-accordion-icon">\u25BC</span>
|
|
@@ -44,7 +44,7 @@ import{$ as J1,$a as J2,A as f0,Aa as v1,B as S0,Ba as w1,C as g0,Ca as f1,D as
|
|
|
44
44
|
<div class="stx-accordion-content" ${q?"":"hidden"}>
|
|
45
45
|
${F(U.content)}
|
|
46
46
|
</div>
|
|
47
|
-
</div>`}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function
|
|
47
|
+
</div>`}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function hY(Y){let{steps:Z,currentStep:Q,orientation:X="horizontal",id:$=z("stepper"),className:J,style:K}=Y,R=O("stx-stepper",`stx-stepper--${X}`,J),G=V(K),_="";return Z.forEach((U,E)=>{let q=O("stx-step",E<Q&&"stx-step--completed",E===Q&&"stx-step--active");if(_+=`<div class="${q}" data-step="${E}">
|
|
48
48
|
<div class="stx-step-indicator">
|
|
49
49
|
${E<Q?"\u2713":E+1}
|
|
50
50
|
</div>
|
|
@@ -52,9 +52,9 @@ import{$ as J1,$a as J2,A as f0,Aa as v1,B as S0,Ba as w1,C as g0,Ca as f1,D as
|
|
|
52
52
|
<div class="stx-step-label">${F(U.label)}</div>
|
|
53
53
|
${U.description?`<div class="stx-step-description">${F(U.description)}</div>`:""}
|
|
54
54
|
</div>
|
|
55
|
-
</div>`,E<Z.length-1)_+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function
|
|
55
|
+
</div>`,E<Z.length-1)_+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function mY(Y){let{open:Z=!1,title:Q,size:X="medium",closable:$=!0,children:J,footer:K,id:R=z("modal"),className:G,style:_}=Y,U=O("stx-modal-component",`stx-modal-component--${X}`,G),E=V(_);if(!Z)return`<div id="${R}" class="${U} stx-modal-component--hidden" ${E?`style='${E}'`:""}></div>`;let q='<div class="stx-modal-component-overlay">';if(q+='<div class="stx-modal-component-dialog">',Q||$){if(q+='<div class="stx-modal-component-header">',Q)q+=`<h3 class="stx-modal-component-title">${F(Q)}</h3>`;if($)q+='<button class="stx-modal-component-close">×</button>';q+="</div>"}if(q+=`<div class="stx-modal-component-body">${J}</div>`,K)q+=`<div class="stx-modal-component-footer">${K}</div>`;return q+="</div></div>",`<div id="${R}" class="${U}" ${E?`style='${E}'`:""}>${q}</div>`}function cY(Y){let{items:Z,selectable:Q=!1,multiSelect:X=!1,emptyMessage:$="No items",id:J=z("list"),className:K,style:R}=Y,G=O("stx-list-view",Q&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),_=V(R);if(Z.length===0)return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
|
|
56
56
|
<div class="stx-list-view-empty">${F($)}</div>
|
|
57
|
-
</div>`;let U='<ul class="stx-list-view-items">';for(let E of Z){let q=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${q}" data-id="${F(E.id)}" ${Q?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
57
|
+
</div>`;let U='<ul class="stx-list-view-items">';for(let E of Z){let q=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${q}" data-id="${F(E.id)}" ${Q?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function dY(Y){let{columns:Z,data:Q,striped:X=!1,bordered:$=!1,hoverable:J=!0,sortBy:K,sortOrder:R,id:G=z("table"),className:_,style:U}=Y,E=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",J&&"stx-table--hoverable",_),q=V(U),j="<table>";j+="<thead><tr>";for(let B of Z){let L=B.key===K?`stx-table-sorted stx-table-sorted--${R}`:"",T=B.sortable?'data-sortable="true"':"",w=B.width?`style="width: ${B.width}"`:"";j+=`<th class="${L}" ${T} ${w} data-key="${F(B.key)}">${F(B.label)}${B.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}j+="</tr></thead>",j+="<tbody>";for(let B of Q){j+="<tr>";for(let M of Z){let L=B[M.key];j+=`<td>${L!=null?F(String(L)):""}</td>`}j+="</tr>"}return j+="</tbody></table>",`<div id="${G}" class="${E}" ${q?`style='${q}'`:""}>${j}</div>`}function o(Y,Z,Q,X){let $=Z.includes(Y.key),J=Q.includes(Y.key),K=Y.children&&Y.children.length>0,G=`<div class="${O("stx-tree-node",J&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${F(Y.key)}">`;if(G+='<div class="stx-tree-node-content">',K)G+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else G+='<span class="stx-tree-toggle-placeholder"></span>';if(X)G+=`<input type="checkbox" class="stx-tree-checkbox" ${J?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)G+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(G+=`<span class="stx-tree-label">${F(Y.label)}</span>`,G+="</div>",K&&$){G+='<div class="stx-tree-children">';for(let _ of Y.children)G+=o(_,Z,Q,X);G+="</div>"}return G+="</div>",G}function pY(Y){let{nodes:Z,expandedKeys:Q=[],selectedKeys:X=[],checkable:$=!1,id:J=z("tree"),className:K,style:R}=Y,G=O("stx-tree-view",$&&"stx-tree-view--checkable",K),_=V(R),U="";for(let E of Z)U+=o(E,Q,X,$);return`<div id="${J}" class="${G}" role="tree" ${_?`style='${_}'`:""}>${U}</div>`}function rY(Y){let{columns:Z,data:Q,pagination:X,selectable:$=!1,id:J=z("datagrid"),className:K,style:R}=Y,G=O("stx-data-grid",$&&"stx-data-grid--selectable",K),_=V(R),U='<div class="stx-data-grid-table-wrapper">';if(U+='<table class="stx-data-grid-table">',U+="<thead><tr>",$)U+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let E of Z){let q=E.width?`style="width: ${E.width}"`:"";U+=`<th ${q}>
|
|
58
58
|
<div class="stx-data-grid-header-cell">
|
|
59
59
|
<span>${F(E.label)}</span>
|
|
60
60
|
${E.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
@@ -66,21 +66,21 @@ import{$ as J1,$a as J2,A as f0,Aa as v1,B as S0,Ba as w1,C as g0,Ca as f1,D as
|
|
|
66
66
|
<button class="stx-data-grid-page-btn" ${X.page<=1?"disabled":""}>\u25C0</button>
|
|
67
67
|
<button class="stx-data-grid-page-btn" ${X.page>=E?"disabled":""}>\u25B6</button>
|
|
68
68
|
</div>
|
|
69
|
-
</div>`}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
69
|
+
</div>`}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function nY(Y){let{type:Z,data:Q,options:X={},width:$="100%",height:J=300,id:K=z("chart"),className:R,style:G}=Y,_=O("stx-chart",`stx-chart--${Z}`,R),U={width:typeof $==="number"?`${$}px`:$,height:typeof J==="number"?`${J}px`:J},E=[V(U),V(G)].filter(Boolean).join("; "),q=JSON.stringify({type:Z,data:Q,options:X});return`<div id="${K}" class="${_}" style="${E}" data-chart='${F(q)}'>
|
|
70
70
|
<div class="stx-chart-placeholder">
|
|
71
71
|
${X.title?`<div class="stx-chart-title">${F(X.title)}</div>`:""}
|
|
72
72
|
<div class="stx-chart-type">${Z.charAt(0).toUpperCase()+Z.slice(1)} Chart</div>
|
|
73
73
|
<div class="stx-chart-info">${Q.datasets.length} dataset(s), ${Q.labels.length} labels</div>
|
|
74
74
|
</div>
|
|
75
|
-
</div>`}function
|
|
76
|
-
`),L="";if($){L+='<div class="stx-code-editor-gutter">';for(let T=1;T<=M.length;T++)L+=`<div class="stx-code-editor-line-number">${T}</div>`;L+="</div>"}return L+=`<pre class="stx-code-editor-content"><code class="language-${F(Q)}">${F(Z)}</code></pre>`,`<div id="${_}" class="${q}" style="${B}" data-language="${F(Q)}" data-tab-size="${R}">${L}</div>`}function
|
|
75
|
+
</div>`}function oY(Y){let{value:Z="",language:Q="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:J=!1,height:K=300,tabSize:R=2,wordWrap:G=!1,id:_=z("code"),className:U,style:E}=Y,q=O("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",J&&"stx-code-editor--readonly",G&&"stx-code-editor--wrap",U),j={height:typeof K==="number"?`${K}px`:K},B=[V(j),V(E)].filter(Boolean).join("; "),M=Z.split(`
|
|
76
|
+
`),L="";if($){L+='<div class="stx-code-editor-gutter">';for(let T=1;T<=M.length;T++)L+=`<div class="stx-code-editor-line-number">${T}</div>`;L+="</div>"}return L+=`<pre class="stx-code-editor-content"><code class="language-${F(Q)}">${F(Z)}</code></pre>`,`<div id="${_}" class="${q}" style="${B}" data-language="${F(Q)}" data-tab-size="${R}">${L}</div>`}function lY(Y){let{src:Z,type:Q="video",poster:X,autoplay:$=!1,loop:J=!1,muted:K=!1,controls:R=!0,width:G,height:_,id:U=z("media"),className:E,style:q}=Y,j=O("stx-media-player",`stx-media-player--${Q}`,E),B={};if(G)B.width=typeof G==="number"?`${G}px`:G;if(_)B.height=typeof _==="number"?`${_}px`:_;let M=[V(B),V(q)].filter(Boolean).join("; "),L=[`id="${U}-media"`,`src="${F(Z)}"`,R&&"controls",$&&"autoplay",J&&"loop",K&&"muted",Q==="video"&&X&&`poster="${F(X)}"`].filter(Boolean).join(" "),T=Q==="video"?`<video ${L}>Your browser does not support the video tag.</video>`:`<audio ${L}>Your browser does not support the audio tag.</audio>`;return`<div id="${U}" class="${j}" ${M?`style='${M}'`:""}>${T}</div>`}function aY(Y){if(Y===void 0)return"";let Z=["B","KB","MB","GB"],Q=Y,X=0;while(Q>=1024&&X<Z.length-1)Q/=1024,X++;return`${Q.toFixed(1)} ${Z[X]}`}function iY(Y){let{files:Z,viewMode:Q="list",showHidden:X=!1,selectable:$=!0,id:J=z("files"),className:K,style:R}=Y,G=O("stx-file-explorer",`stx-file-explorer--${Q}`,K),_=V(R),U=X?Z:Z.filter((q)=>!q.name.startsWith(".")),E="";if(Q==="list"){E='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let q of U){let j=q.icon||(q.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),B=q.type==="file"?aY(q.size):"",M=q.modified?q.modified.toLocaleDateString():"";E+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(q.path)}" data-type="${q.type}">
|
|
77
77
|
<td><span class="stx-file-explorer-icon">${j}</span>${F(q.name)}</td>
|
|
78
78
|
<td>${B}</td>
|
|
79
79
|
<td>${M}</td>
|
|
80
80
|
</tr>`}E+="</tbody></table>"}else{E='<div class="stx-file-explorer-grid">';for(let q of U){let j=q.icon||(q.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");E+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(q.path)}" data-type="${q.type}">
|
|
81
81
|
<div class="stx-file-explorer-icon">${j}</div>
|
|
82
82
|
<div class="stx-file-explorer-name">${F(q.name)}</div>
|
|
83
|
-
</div>`}E+="</div>"}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${E}</div>`}function
|
|
83
|
+
</div>`}E+="</div>"}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${E}</div>`}function sY(Y){let{url:Z,width:Q="100%",height:X=400,sandbox:$=!0,allowScripts:J=!0,id:K=z("webview"),className:R,style:G}=Y,_=O("stx-webview",R),U={width:typeof Q==="number"?`${Q}px`:Q,height:typeof X==="number"?`${X}px`:X},E=[V(U),V(G)].filter(Boolean).join("; "),q=[];if($){if(q.push("allow-same-origin"),J)q.push("allow-scripts")}let j=$?`sandbox="${q.join(" ")}"`:"";return`<iframe id="${K}" class="${_}" src="${F(Z)}" style="${E}" ${j} loading="lazy" frameborder="0"></iframe>`}var tY=["Button","TextInput","Checkbox","RadioButton","Slider","ColorPicker","DatePicker","TimePicker","Autocomplete","Label","ImageView","ProgressBar","Avatar","Badge","Chip","Card","Tooltip","Toast","ScrollView","SplitView","Accordion","Stepper","Modal","Tabs","Dropdown","ListView","Table","TreeView","DataGrid","Chart","Rating","CodeEditor","MediaPlayer","FileExplorer","WebView"],eY=`
|
|
84
84
|
/* Button */
|
|
85
85
|
.stx-button {
|
|
86
86
|
display: inline-flex;
|
|
@@ -437,7 +437,7 @@ import{$ as J1,$a as J2,A as f0,Aa as v1,B as S0,Ba as w1,C as g0,Ca as f1,D as
|
|
|
437
437
|
.stx-chip--warning { background: #3a2a1a; }
|
|
438
438
|
.stx-chip--error { background: #3a1a1a; }
|
|
439
439
|
}
|
|
440
|
-
`;import l from"process";function
|
|
440
|
+
`;import l from"process";function YZ(){if(l.platform)return l.platform;return"unknown"}function i(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function s(Y,Z){if(Y.type==="separator")return{id:`sep-${Z}`,label:"",type:"separator"};let Q={id:`item-${Z}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Q.shortcut=Y.accelerator;if(Y.type==="checkbox")Q.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Q.submenu=Y.submenu.map((X,$)=>s(X,$));return Q}function y(Y){return Y.map((Z,Q)=>s(Z,Q))}function t(Y,Z=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Q=" ".repeat(Z),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",J=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",K=`${Q}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(K+=`<span class="label">${$}${Y.label}</span>${J}`,Y.type==="submenu"&&Y.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let R of Y.submenu)K+=t(R,Z+1);K+="</div>"}return K+="</div>",K}function ZZ(Y){let Z='<div class="stx-tray-menu">';for(let Q of Y)Z+=t(Q);return Z+="</div>",Z}var A=new Map;function QZ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var a=!1;function XZ(){if(a||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Z}=Y.detail;for(let Q of A.values()){let X=Q.handlers.get(Z);if(X){X();break}}}),a=!0}async function e(Y={}){let Z=QZ(),Q=YZ(),X=i(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},J=new Map;for(let R of Y.menu||[]){if(R.type!=="separator"&&R.onClick)J.set(R.label,R.onClick);if(R.type==="submenu"&&R.submenu){for(let G of R.submenu)if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick)}}if(A.set(Z,{state:$,handlers:J}),X){XZ();let R=window;try{if($.tooltip)await R.craft.tray.setTitle({title:$.tooltip}),await R.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await R.craft.tray.setIcon({icon:$.icon});let G=y($.menu);await R.craft.tray.setMenu({items:G}),console.log(`[stx-tray] Native tray created for ${Q}`)}catch(G){console.warn("[stx-tray] Failed to create native tray:",G)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Z}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Z,setIcon:(R)=>{if($.icon=R,X)window.craft.tray.setIcon({icon:R}).catch((_)=>{console.warn("[stx-tray] Failed to set icon:",_)});console.log(`[stx-tray:${Z}] Icon updated`)},setTooltip:(R)=>{if($.tooltip=R,X)window.craft.tray.setTooltip({tooltip:R}).catch((_)=>{console.warn("[stx-tray] Failed to set tooltip:",_)});console.log(`[stx-tray:${Z}] Tooltip: ${R}`)},setMenu:(R)=>{$.menu=R,J.clear();for(let G of R){if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick);if(G.type==="submenu"&&G.submenu){for(let _ of G.submenu)if(_.type!=="separator"&&_.onClick)J.set(_.label,_.onClick)}}if(X){let G=window,_=y(R);G.craft.tray.setMenu({items:_}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Z}] Menu updated (${R.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Z),X)window.craft.tray.destroy?.().catch((G)=>{console.warn("[stx-tray] Failed to destroy tray:",G)});console.log(`[stx-tray:${Z}] Destroyed`)}}}var $Z=e;function JZ(){return Array.from(A.keys())}function GZ(Y){let Z=A.get(Y);if(!Z)return null;let Q=i();return{id:Y,setIcon:(X)=>{if(Z.state.icon=X,Q)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Z.state.tooltip=X,Q)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Z.state.menu=X,Q){let $=window,J=y(X);$.craft.tray.setMenu({items:J}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Q)window.craft.tray.destroy?.().catch(()=>{})}}}function RZ(Y,Z){let Q=A.get(Y);if(!Q)return!1;let X=Q.handlers.get(Z);if(X)return X(),!0;return!1}function qZ(Y){let Z=A.get(Y);if(!Z)return null;return ZZ(Z.state.menu)}function KZ(){return`
|
|
441
441
|
// STX Desktop Tray Bridge
|
|
442
442
|
// Provides convenient wrappers around window.craft.tray APIs
|
|
443
443
|
window.stxTray = {
|
|
@@ -450,7 +450,7 @@ window.stxTray = {
|
|
|
450
450
|
// Check if tray is available
|
|
451
451
|
isAvailable: () => typeof window.craft?.tray !== 'undefined',
|
|
452
452
|
};
|
|
453
|
-
`}var
|
|
453
|
+
`}var UZ=`
|
|
454
454
|
.stx-tray-menu {
|
|
455
455
|
background: #2d2d2d;
|
|
456
456
|
border-radius: 8px;
|
|
@@ -516,7 +516,7 @@ window.stxTray = {
|
|
|
516
516
|
.stx-tray-item:hover > .stx-tray-submenu {
|
|
517
517
|
display: block;
|
|
518
518
|
}
|
|
519
|
-
`;import P from"process";import{existsSync as
|
|
519
|
+
`;import P from"process";import{existsSync as _Z}from"fs";import{dirname as EZ,join as FZ}from"path";import{craftBinaryNotFoundMessage as YY,resolveCraftBinary as jZ}from"craft-native";var I={};function BZ(Y){I={...I,...Y}}function VZ(){return{...I}}function OZ(){I={}}function u(Y){if(!Y.sidebarConfig)return;let Z={...Y.sidebarConfig};if(Z.variant==="desktop")Z.material=Z.material??"sidebar",Z.backgroundEffect=Z.backgroundEffect??"shimmer",Z.allowsVibrancy=Z.allowsVibrancy??!0;return Z}function f(){let Y=EZ(P.execPath),Z=Y.includes(".app/Contents/MacOS")?FZ(Y,"craft"):void 0,Q=[P.env.CRAFT_BINARY_PATH,I.craftBinaryPath,...I.additionalSearchPaths||[],Z];for(let X of Q)if(X&&_Z(X))return X;return jZ()}var D=new Map;function h(Y){let Z=D.get(Y);if(!Z||Z.closed)return;Z.closed=!0;for(let Q of Z.closeListeners??[])try{Q()}catch(X){console.warn(`[stx/desktop] window ${Y} close listener threw:`,X)}Z.closeListeners?.clear()}var zZ=50;async function m(Y,Z){let Q=Z.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Q,new Promise(($)=>setTimeout(()=>$(null),zZ))]);if(X?.failed)throw X.error;Q.then(()=>h(Y))}function MZ(){return Array.from(D.keys())}function LZ(Y){let Z=D.get(Y);if(!Z)return null;return S(Y,Z.app)}function TZ(){for(let[Y,Z]of D)try{Z.app?.close?.()}catch(Q){console.warn(`Failed to close window ${Y}:`,Q)}D.clear()}function S(Y,Z){return{id:Y,show:()=>{console.log(`[stx/desktop] Window ${Y} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let Q=D.get(Y);if(Q?.app)Q.app.close(),h(Y),D.delete(Y),console.log(`[stx/desktop] Window ${Y} closed`)},onClosed:(Q)=>{let X=D.get(Y);if(!X||X.closed)return queueMicrotask(Q),()=>{};return X.closeListeners??=new Set,X.closeListeners.add(Q),()=>X.closeListeners?.delete(Q)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:(Q)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Q}" }) from inside the webview`)},loadURL:(Q)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Q}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function c(Y,Z={}){let Q=["--url",Y,"--title",Z.title||"stx Desktop","--width",String(Z.width??1200),"--height",String(Z.height??800)];if(Z.darkMode)Q.push("--dark");if(Z.hotReload)Q.push("--hot-reload");if(Z.resizable===!1)Q.push("--no-resize");if(Z.frameless)Q.push("--frameless");if(Z.alwaysOnTop)Q.push("--always-on-top");if(Z.titlebarHidden)Q.push("--titlebar-hidden");if(Z.systemTray)Q.push("--system-tray");if(Z.hideDockIcon)Q.push("--hide-dock-icon");if(Z.devTools===!1)Q.push("--no-devtools");if(Z.nativeSidebar)Q.push("--native-sidebar");if(Z.sidebarWidth!==void 0)Q.push("--sidebar-width",String(Z.sidebarWidth));let X=u(Z);if(X)Q.push("--sidebar-config",JSON.stringify(X));return Q}async function DZ(Y,Z={}){let Q=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=f();try{let{createApp:$}=await import("craft-native"),J=$({url:Y,craftPath:X,window:{title:Z.title||"stx Desktop",width:Z.width??1200,height:Z.height??800,darkMode:Z.darkMode??!1,hotReload:Z.hotReload??!1,resizable:Z.resizable??!0,frameless:Z.frameless??!1,alwaysOnTop:Z.alwaysOnTop??!1,titlebarHidden:Z.titlebarHidden??!1,systemTray:Z.systemTray??!1,hideDockIcon:Z.hideDockIcon??!1,devTools:Z.devTools??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth,sidebarConfig:u(Z)}});return D.set(Q,{app:J,url:Y,options:Z}),await m(Q,J),S(Q,J)}catch{try{let{spawn:$}=await import("child_process"),J=$(X,c(Y,Z),{stdio:"inherit"});J.on("error",(R)=>{console.error(R.code==="ENOENT"?YY(X):`craft child error: ${R.message}`)});let K={close:()=>J.kill()};return D.set(Q,{app:K,url:Y,options:Z}),J.on("exit",()=>h(Q)),S(Q,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function WZ(Y,Z={}){let Q=`http://localhost:${Y}/`;if(P.env.NODE_ENV==="test"||P.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:$}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let J=!Z.nativeSidebar,K=u(Z),R=$({url:Q,craftPath:f(),window:{title:Z.title||"stx Development",width:Z.width||1400,height:Z.height||900,resizable:!0,systemTray:J,darkMode:Z.darkMode??!0,hotReload:Z.hotReload??!0,devTools:!0,titlebarHidden:Z.titlebarHidden??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth??260,sidebarConfig:K}}),G=`dev-window-${Y}`;return D.set(G,{app:R,url:Q,options:Z}),await m(G,R),console.log(`\u2713 Native window opened at ${Q}`),!0}catch{let $=f();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:J}=await import("child_process"),K=J($,c(Q,{title:"stx Development",width:1400,height:900,hotReload:!0,...Z}),{stdio:"inherit"});K.on("exit",()=>P.exit(0)),K.on("error",(G)=>{console.warn(G.code==="ENOENT"?YY($):`craft child error: ${G.message}`)});let R=`dev-window-${Y}`;return D.set(R,{app:{close:()=>K.kill()},url:Q,options:Z}),console.log(`\u2713 Native window opened at ${Q}`),!0}catch(J){console.warn("\u26A0 Could not spawn craft binary:",J.message)}if(P.env.NODE_ENV==="test"||P.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:J}=await import("child_process"),K=P.platform;return J(K==="darwin"?"open":K==="win32"?"cmd":"xdg-open",K==="win32"?["/c","start",Q]:[Q],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Q}`),!0}catch(J){return console.error("Could not open browser:",J),console.log(`Please open manually: ${Q}`),!1}}}async function PZ(Y,Z={}){let{title:Q="stx Desktop",width:X=1200,height:$=800,darkMode:J=!1,hotReload:K=!1,resizable:R=!0,frameless:G=!1,alwaysOnTop:_=!1}=Z;try{let{createApp:U}=await import("craft-native"),E=f(),q=U({html:Y,craftPath:E,window:{title:Q,width:X,height:$,darkMode:J,hotReload:K,resizable:R,frameless:G,alwaysOnTop:_}}),j=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(j,{app:q,url:"html-content",options:Z}),await m(j,q),S(j,q)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function AZ(){try{return N.resolve("craft-native"),!0}catch{return!1}}function NZ(){return`
|
|
520
520
|
// STX Desktop Window Bridge
|
|
521
521
|
// Provides convenient wrappers around window.craft APIs
|
|
522
522
|
window.stxWindow = {
|
|
@@ -557,7 +557,7 @@ window.stxWindow = {
|
|
|
557
557
|
|
|
558
558
|
// Expose as global for backwards compatibility
|
|
559
559
|
window.desktop = window.stxWindow;
|
|
560
|
-
`}import{pack as
|
|
560
|
+
`}import{pack as IZ,packageApp as kZ}from"craft-native";import{craftBinaryNotFoundMessage as CZ,resolveCraftBinary as xZ}from"craft-native";import H from"process";import{spawn as HZ}from"child_process";import{AutoUpdater as ZY,canReplaceBundle as vZ,clearQuarantine as wZ,extractBundle as fZ,generateUpdateManifest as QY,readBundleIdentity as d,swapBundle as SZ,verifyBundleTrust as gZ}from"craft-native";var XY="update.json";function $Y(Y,Z){return`https://github.com/${Y}/releases/latest/download/${Z}`}function JY(Y,Z,Q){return`https://github.com/${Y}/releases/download/${Z}/${Q}`}function GY(Y){let{repository:Z,manifestAsset:Q=XY,...X}=Y;return new ZY({...X,updateUrl:$Y(Z,Q)})}function bZ(Y){let Z=Y.tag??`v${Y.version}`,Q={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Q[X]={path:$,url:JY(Y.repository,Z,$.split("/").pop())}}return QY({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Q})}function g(Y=H.execPath){let Z=Y.split("/");for(let Q=0;Q<Z.length;Q++)if(Z[Q].endsWith(".app"))return Z.slice(0,Q+1).join("/");return null}async function yZ(){let Y=g();if(!Y)return null;return(await d(Y)).teamId}function RY(){let Y=H.ppid;if(Y>1)try{H.kill(Y,"SIGTERM");return}catch{}H.exit(0)}function qY(Y={}){let Z=Y.appPath??g(),Q=Y.quit??(()=>H.exit(0));if(Z)HZ("/usr/bin/open",["-n",Z],{detached:!0,stdio:"ignore"}).unref();let X=Y.quitDelayMs??0;if(X>0){setTimeout(Q,X).unref?.();return}Q()}async function uZ(Y){let{appPath:Z,requireSameTeam:Q=!0,macos:X,...$}=Y,J=Z??g();if(!J)throw Error("createSelfUpdater: this process is not running from an .app bundle, so there is nothing to update. Pass `appPath` explicitly, or skip the updater in development.");let K=X?.teamId??(Q?(await d(J)).teamId??void 0:void 0);return GY({...$,appPath:J,macos:{...X,teamId:K},relaunch:Y.relaunch??((R)=>qY({appPath:R,quit:RY,quitDelayMs:250}))})}import{existsSync as p,mkdirSync as hZ,readFileSync as mZ,watch as cZ,writeFileSync as dZ}from"fs";import{homedir as pZ,platform as rZ}from"os";import{dirname as nZ,join as v}from"path";function oZ(Y){let Z=rZ(),Q=pZ();switch(Z){case"darwin":return v(Q,"Library","Application Support",Y);case"win32":return v(process.env.APPDATA||v(Q,"AppData","Roaming"),Y);default:return v(Q,".config",Y)}}class KY{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Z=Y.path?nZ(Y.path):oZ(Y.name);if(this._path=Y.path||v(Z,"preferences.json"),!p(Z))hZ(Z,{recursive:!0});if(this._data=this._load(),Y.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Y){if(Y in this._data)return this._data[Y];return this._defaults[Y]}set(Y,Z){let Q=this.get(Y);if(JSON.stringify(Q)===JSON.stringify(Z))return;this._data[Y]=Z,this._scheduleSave(),this._notifyChange(Y,Z,Q)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Z=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Z)}reset(){let Y={...this._data};this._data={},this._save();for(let Z of Object.keys(Y)){let Q=this._defaults[Z];this._notifyChange(Z,Q,Y[Z])}}onChange(Y,Z){let Q=Y;if(!this._changeHandlers.has(Q))this._changeHandlers.set(Q,new Set);return this._changeHandlers.get(Q).add(Z),()=>{this._changeHandlers.get(Q)?.delete(Z)}}onAnyChange(Y){return this._anyChangeHandlers.add(Y),()=>{this._anyChangeHandlers.delete(Y)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(p(this._path)){let Y=mZ(this._path,"utf-8");return JSON.parse(Y)}}catch{}return{}}_save(){this._writing=!0;try{let Y=JSON.stringify({...this._defaults,...this._data},null,2);dZ(this._path,Y,"utf-8")}catch(Y){console.error(`Failed to save preferences to ${this._path}:`,Y)}finally{setTimeout(()=>{this._writing=!1},100)}}_scheduleSave(){if(this._writeTimer)clearTimeout(this._writeTimer);this._writeTimer=setTimeout(()=>{this._writeTimer=null,this._save()},50)}_setupWatcher(){try{if(!p(this._path))this._save();this._watcher=cZ(this._path,()=>{if(this._writing)return;let Y=this._load(),Z={...this._data};this._data=Y;let Q=new Set([...Object.keys(Z),...Object.keys(Y)]);for(let X of Q){let $=X in Z?Z[X]:this._defaults[X],J=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(J))this._notifyChange(X,J,$)}})}catch{}}_notifyChange(Y,Z,Q){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Z,Q)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Z,Q)}catch{}}}function lZ(Y){return new KY(Y)}import{existsSync as k,mkdirSync as UY,readFileSync as aZ,unlinkSync as _Y,writeFileSync as EY}from"fs";import{homedir as b,platform as FY}from"os";import{join as C}from"path";function jY(Y){let Z=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return C(b(),"Library","LaunchAgents",`com.${Z}.plist`)}function BY(Y){let Z=process.env.XDG_CONFIG_HOME||C(b(),".config");return C(Z,"autostart",`${Y.toLowerCase()}.desktop`)}async function iZ(Y,Z){let Q=Z.appName||"StxApp",X=jY(Q),$=C(b(),"Library","LaunchAgents");if(Y){let J=Z.appPath||process.execPath,K=Z.args||[],R=[J,...K],G=`<?xml version="1.0" encoding="UTF-8"?>
|
|
561
561
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
562
562
|
<plist version="1.0">
|
|
563
563
|
<dict>
|
|
@@ -565,7 +565,7 @@ window.desktop = window.stxWindow;
|
|
|
565
565
|
<string>com.${Q.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
|
|
566
566
|
<key>ProgramArguments</key>
|
|
567
567
|
<array>
|
|
568
|
-
${R.map((_)=>` <string>${
|
|
568
|
+
${R.map((_)=>` <string>${Y0(_)}</string>`).join(`
|
|
569
569
|
`)}
|
|
570
570
|
</array>
|
|
571
571
|
<key>RunAtLoad</key>
|
|
@@ -575,7 +575,7 @@ ${R.map((_)=>` <string>${X0(_)}</string>`).join(`
|
|
|
575
575
|
${Z.isHidden?` <key>ProcessType</key>
|
|
576
576
|
<string>Background</string>`:""}
|
|
577
577
|
</dict>
|
|
578
|
-
</plist>`;if(!
|
|
578
|
+
</plist>`;if(!k($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(k(X))_Y(X)}async function sZ(Y,Z){let Q=Z.appName||"StxApp",X=BY(Q),$=C(process.env.XDG_CONFIG_HOME||C(b(),".config"),"autostart");if(Y){let J=Z.appPath||process.execPath,K=Z.args||[],R=[J,...K].join(" "),G=`[Desktop Entry]
|
|
579
579
|
Type=Application
|
|
580
580
|
Name=${Q}
|
|
581
581
|
Exec=${R}
|
|
@@ -583,4 +583,4 @@ Terminal=false
|
|
|
583
583
|
StartupNotify=false
|
|
584
584
|
${Z.isHidden?`X-GNOME-Autostart-enabled=true
|
|
585
585
|
NoDisplay=true`:""}
|
|
586
|
-
`;if(!
|
|
586
|
+
`;if(!k($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(k(X))_Y(X)}async function tZ(Y){return k(jY(Y))}async function eZ(Y){let Z=BY(Y);if(!k(Z))return!1;try{let Q=aZ(Z,"utf-8");if(Q.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Q.includes("Hidden=true"))return!1;return!0}catch{return!1}}function Y0(Y){return Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function Z0(Y,Z={}){let Q=FY();switch(Q){case"darwin":return iZ(Y,Z);case"linux":return sZ(Y,Z);default:throw Error(`Auto-launch is not yet supported on ${Q}`)}}async function Q0(Y){let Z=Y||"StxApp";switch(FY()){case"darwin":return tZ(Z);case"linux":return eZ(Z);default:return!1}}var X0={accentColor:()=>W("system","accentColor",()=>""),highlightColor:()=>W("system","highlightColor",()=>""),language:()=>W("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>W("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>W("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>W("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>W("system","reduceMotion",()=>r("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>W("system","reduceTransparency",()=>r("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>W("system","increaseContrast",()=>r("(prefers-contrast: more)")),systemVersion:()=>W("system","systemVersion",()=>""),hostname:()=>W("system","hostname",()=>""),username:()=>W("system","username",()=>""),async openPreferences(){if(n("system"))await window.craft.system.openPreferences()}};async function W(Y,Z,Q){if(n(Y))return await window.craft[Y][Z]();return await Q()}function r(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{E1 as windowEvents,u1 as watchScreenSharing,Y2 as vision,gZ as verifyBundleTrust,_1 as updater,n0 as unregisterHotkey,o0 as unregisterAllHotkeys,RZ as triggerTrayAction,P1 as touchbar,J1 as theme,l1 as tags,X0 as system,SZ as swapBundle,j1 as standardMenus,t1 as spotlight,e1 as speechRecognition,N1 as speech,C1 as signPayload,O1 as sidebar,K0 as showWarningToast,z0 as showWarningModal,S0 as showWarningDialog,G0 as showToast,q0 as showSuccessToast,L0 as showSuccessModal,C0 as showSaveDialog,T0 as showQuestionModal,k0 as showOpenDialog,V0 as showModal,x0 as showMessageBox,R0 as showInfoToast,O0 as showInfoModal,U0 as showErrorToast,M0 as showErrorModal,f0 as showErrorDialog,w0 as showConfirmDialog,H0 as showColorPicker,v0 as showAlertDialog,J0 as showAlert,X1 as shell,BZ as setDesktopConfig,Z0 as setAutoLaunch,$2 as serviceMenu,J2 as serial,y1 as screenSharing,f1 as screenCapture,z1 as screen,yZ as runningBundleTeamId,xZ as resolveCraftBinary,OZ as resetDesktopConfig,$0 as requestNotificationPermission,qY as relaunchBundle,r0 as registerHotkey,k1 as redactPII,d as readBundleIdentity,RY as quitLauncher,P0 as prompt,T1 as printing,L1 as permissions,a1 as pdf,d0 as parseShortcut,kZ as packageApp,IZ as pack,WZ as openDevWindow,_0 as notify,Z1 as notifications,U1 as network,W1 as nativeWindow,D1 as nativeAutoLaunch,Z2 as midi,B1 as menu,i1 as log,w1 as location,d1 as localServer,v1 as liveActivities,M1 as keychain,AZ as isWebviewAvailable,R1 as isDragOutAvailable,u0 as isCaffeinated,q2 as isAvailable,Q0 as isAutoLaunchEnabled,x1 as iap,m1 as hasFocusShortcuts,H1 as handoff,$1 as globalShortcuts,JY as githubReleaseAssetUrl,$Y as githubLatestAssetUrl,NZ as getWindowBridgeScript,LZ as getWindow,GZ as getTrayInstance,KZ as getTrayBridgeScript,qZ as getSimulatedTrayHTML,l0 as getRegisteredHotkeys,g0 as getDialogBridgeScript,VZ as getDesktopConfig,R2 as getCapability,G2 as getCapabilities,h0 as getCaffeinateStatus,MZ as getActiveWindowIds,JZ as getActiveTrayInstances,A0 as getActiveModalCount,j0 as getActiveAlertCount,QY as generateUpdateManifest,Q1 as fs,t0 as formatTime,p0 as formatShortcut,m0 as formatRemainingTime,c0 as formatDuration,e0 as formatCompact,c1 as focusShortcutsReady,h1 as focus,o1 as fileAssociations,fZ as extractBundle,G1 as dragOut,F0 as dismissAllAlerts,E0 as dismissAlertById,s0 as delay,q1 as deepLinks,y0 as decaffeinate,PZ as createWindowWithHTML,DZ as createWindow,sY as createWebView,pY as createTreeView,gY as createTooltip,a0 as createTimer,HY as createTimePicker,zY as createTextInput,AY as createTabs,dY as createTable,e as createSystemTray,hY as createStepper,yY as createSplitView,LY as createSlider,uZ as createSelfUpdater,bY as createScrollView,IY as createRating,kY as createRadioButton,TY as createProgressBar,lZ as createPreferences,mY as createModalComponent,$Z as createMenubar,lY as createMediaPlayer,cY as createListView,wY as createLabel,i0 as createInterval,fY as createImageView,GY as createGitHubUpdater,bZ as createGitHubUpdateManifest,iY as createFileExplorer,NY as createDropdown,xY as createDatePicker,rY as createDataGrid,CY as createColorPicker,oY as createCodeEditor,SY as createChip,MY as createCheckbox,nY as createChart,PY as createCard,OY as createButton,DY as createBadge,WY as createAvatar,vY as createAutocomplete,uY as createAccordion,I1 as crashReporter,c as craftWindowArguments,CZ as craftBinaryNotFoundMessage,Q2 as coreml,X2 as continuityCamera,V1 as contextMenu,D0 as confirm,TZ as closeAllWindows,N0 as closeAllModals,Y1 as clipboard,wZ as clearQuarantine,vZ as canReplaceBundle,b0 as caffeinate,g as bundlePathForExecutable,s1 as bonjour,A1 as bluetooth,p1 as biometric,K1 as battery,r1 as audio,n1 as appleScript,F1 as appInfo,W0 as alert,XY as UPDATE_MANIFEST_ASSET,UZ as TRAY_MENU_STYLES,B0 as TOAST_STYLES,I0 as MODAL_STYLES,S1 as MIN_WATCH_INTERVAL_MS,g1 as MAX_WATCH_INTERVAL_MS,b1 as DEFAULT_WATCH_INTERVAL_MS,eY as COMPONENT_STYLES,ZY as AutoUpdater,tY as AVAILABLE_COMPONENTS};
|
package/dist/menu.d.ts
CHANGED
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
* menu — which it only does for menus it recognises.
|
|
10
10
|
*/
|
|
11
11
|
export declare const standardMenus: {
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The application menu. Must be first in the bar; AppKit titles it for you.
|
|
14
|
+
* Pass `settings` and it gets "Settings…" with Cmd+, after About, where
|
|
15
|
+
* every Mac app keeps it.
|
|
16
|
+
*/
|
|
17
|
+
app: (appName: string, options?: StandardMenuOptions) => Menu;
|
|
14
18
|
/** Undo/redo and the clipboard. Roles throughout, which is the only way these work. */
|
|
15
19
|
edit: () => Menu;
|
|
16
20
|
/** Minimise, zoom and close. */
|
|
@@ -21,7 +25,7 @@ export declare const standardMenus: {
|
|
|
21
25
|
* Spread this first and add your own menus after: the app menu has to be
|
|
22
26
|
* index zero, and Edit is the one people notice missing.
|
|
23
27
|
*/
|
|
24
|
-
leading: (appName: string) => Menu[]
|
|
28
|
+
leading: (appName: string, options?: StandardMenuOptions) => Menu[]
|
|
25
29
|
};
|
|
26
30
|
export declare const menu: MenuAPI;
|
|
27
31
|
export declare interface MenuItem {
|
|
@@ -73,6 +77,9 @@ export declare interface MenuAPI {
|
|
|
73
77
|
clearDock: () => Promise<void>
|
|
74
78
|
onAction: (cb: (event: MenuActionEvent) => void) => () => void
|
|
75
79
|
}
|
|
80
|
+
export declare interface StandardMenuOptions {
|
|
81
|
+
settings?: () => void
|
|
82
|
+
}
|
|
76
83
|
/**
|
|
77
84
|
* The stock behaviours macOS already knows how to perform.
|
|
78
85
|
*
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const sidebar: SidebarAPI;
|
|
2
|
+
export declare interface SidebarItem {
|
|
3
|
+
id: string
|
|
4
|
+
label: string
|
|
5
|
+
icon?: string
|
|
6
|
+
badge?: string | number | null
|
|
7
|
+
}
|
|
8
|
+
export declare interface SidebarSection {
|
|
9
|
+
id: string
|
|
10
|
+
header?: string
|
|
11
|
+
items: SidebarItem[]
|
|
12
|
+
}
|
|
13
|
+
export declare interface SidebarOptions {
|
|
14
|
+
sections: SidebarSection[]
|
|
15
|
+
selected?: string
|
|
16
|
+
id?: string
|
|
17
|
+
}
|
|
18
|
+
export declare interface SidebarHandle {
|
|
19
|
+
readonly id: string
|
|
20
|
+
update: (sections: SidebarSection[]) => void
|
|
21
|
+
updateItem: (itemId: string, changes: Partial<Omit<SidebarItem, 'id'>>) => void
|
|
22
|
+
select: (itemId: string) => void
|
|
23
|
+
onSelect: (callback: (itemId: string) => void) => () => void
|
|
24
|
+
destroy: () => void
|
|
25
|
+
}
|
|
26
|
+
export declare interface SidebarAPI {
|
|
27
|
+
available: () => boolean
|
|
28
|
+
create: (options: SidebarOptions) => SidebarHandle | null
|
|
29
|
+
}
|
package/dist/test-utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-gzgq8v6d.js";O();function O(){if(typeof window>"u")return;let A=window;if(typeof A.addEventListener==="function"&&typeof A.dispatchEvent==="function")return;let B=new Map;A.addEventListener=(j,q)=>{let D=B.get(j);if(!D)D=new Set,B.set(j,D);D.add(q)},A.removeEventListener=(j,q)=>{B.get(j)?.delete(q)},A.dispatchEvent=(j)=>{let q=B.get(j.type);if(q)for(let D of q)try{D(j)}catch{}return!0}}function P(A=[]){let B=[],j=new Map,q=window.craft,D=q&&q.__craft_bridge_loaded?void 0:q;function I(x,z){return(...C)=>{B.push({ns:x,method:z,args:C});let F=`${x}:${z}`;if(j.has(F)){let G=j.get(F),L=typeof G==="function"?G(...C):G;return Promise.resolve(L)}return Promise.resolve(void 0)}}function J(x){return new Proxy({},{get(z,C){if(typeof C!=="string")return;if(j.has(`${x}:${C}`)){let F=j.get(`${x}:${C}`);if(typeof F==="function"&&F.length===0)return()=>{return B.push({ns:x,method:C,args:[]}),F()}}return I(x,C)}})}let K=new Proxy({},{get(x,z){if(typeof z!=="string")return;return J(z)},has(x,z){if(typeof z!=="string")return!1;if(A.length===0)return!0;return A.includes(z)}});return window.craft=K,{calls:B,whenCalled(x,z,C){j.set(`${x}:${z}`,C)},uninstall(){if(D===void 0)delete window.craft;else window.craft=D}}}function Q(A,B,j){return A.find((q)=>q.ns===B&&q.method===j)}export{P as installMockBridge,Q as findCall};
|
package/package.json
CHANGED