@stacksjs/desktop 0.2.230 → 0.2.231

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.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$ as eq,$a as ez,A as Zq,Aa as Yz,B as _q,Ba as Zz,C as $q,Ca as _z,D as jq,Da as $z,E as xq,Ea as jz,F as kq,Fa as xz,G as wq,Ga as kz,H as yq,Ha as wz,I as fq,Ia as yz,J as vq,Ja as fz,K as gq,Ka as vz,L as bq,La as gz,M as mq,Ma as bz,N as dq,Na as mz,O as uq,Oa as dz,P as hq,Pa as uz,Q as pq,Qa as hz,R as lq,Ra as pz,S as cq,Sa as lz,T as nq,Ta as cz,U as rq,Ua as nz,V as aq,Va as rz,W as sq,Wa as az,X as oq,Xa as sz,Ya as oz,Z as tq,Za as tz,_ as iq,_a as iz,a as zq,aa as qz,ab as qA,b as Aq,ba as zz,bb as zA,c as Bq,ca as Az,d as Cq,da as Bz,e as Dq,ea as Cz,f as Eq,fa as Dz,g as Fq,ga as Ez,h as Gq,ha as Fz,i as Hq,ia as Gz,j as Iq,ja as Hz,k as Jq,ka as Iz,l as Kq,la as Jz,m as Lq,ma as Kz,n as Mq,na as Lz,o as Nq,oa as Mz,p as Oq,pa as Nz,q as Pq,qa as Oz,r as Qq,ra as Pz,s as Rq,sa as Qz,t as Sq,ta as Rz,u as Tq,ua as Sz,v as Uq,va as Tz,w as Vq,wa as Uz,x as Wq,xa as Vz,y as Xq,ya as Wz,z as Yq,za as Xz}from"./chunk-0954hbsb.js";import"./chunk-ts9f0mxv.js";export{Hz as windowEvents,kz as watchScreenSharing,rz as vision,Gz as updater,pq as unregisterHotkey,lq as unregisterAllHotkeys,Pz as touchbar,Az as theme,uz as tags,cz as spotlight,nz as speechRecognition,Rz as speech,Uz as signPayload,Eq as showWarningToast,Nq as showWarningModal,kq as showWarningDialog,Bq as showToast,Dq as showSuccessToast,Pq as showSuccessModal,Yq as showSaveDialog,Qq as showQuestionModal,Xq as showOpenDialog,Lq as showModal,Zq as showMessageBox,Cq as showInfoToast,Mq as showInfoModal,Fq as showErrorToast,Oq as showErrorModal,xq as showErrorDialog,jq as showConfirmDialog,_q as showColorPicker,$q as showAlertDialog,Aq as showAlert,qz as shell,tz as serviceMenu,iz as serial,xz as screenSharing,Zz as screenCapture,Kz as screen,zq as requestNotificationPermission,hq as registerHotkey,Tz as redactPII,Tq as prompt,Nz as printing,Mz as permissions,hz as pdf,dq as parseShortcut,Gq as notify,iq as notifications,Fz as network,Oz as nativeAutoLaunch,az as midi,Jz as menu,pz as log,Yz as location,vz as localServer,Xz as liveActivities,Lz as keychain,Cz as isDragOutAvailable,vq as isCaffeinated,zA as isAvailable,Vz as iap,yz as hasFocusShortcuts,Wz as handoff,zz as globalShortcuts,cq as getRegisteredHotkeys,wq as getDialogBridgeScript,qA as getCapability,ez as getCapabilities,gq as getCaffeinateStatus,Uq as getActiveModalCount,Jq as getActiveAlertCount,eq as fs,sq as formatTime,uq as formatShortcut,bq as formatRemainingTime,mq as formatDuration,oq as formatCompact,fz as focusShortcutsReady,wz as focus,dz as fileAssociations,Bz as dragOut,Iq as dismissAllAlerts,Hq as dismissAlertById,aq as delay,Dz as deepLinks,fq as decaffeinate,nq as createTimer,rq as createInterval,Sz as crashReporter,sz as coreml,oz as continuityCamera,Rq as confirm,Vq as closeAllModals,tq as clipboard,yq as caffeinate,lz as bonjour,Qz as bluetooth,gz as biometric,Ez as battery,bz as audio,mz as appleScript,Iz as app,Sq as alert,Kq as TOAST_STYLES,Wq as MODAL_STYLES,_z as MIN_WATCH_INTERVAL_MS,$z as MAX_WATCH_INTERVAL_MS,jz as DEFAULT_WATCH_INTERVAL_MS};
2
+ import{$ as eq,$a as ez,A as Zq,Aa as Yz,B as _q,Ba as Zz,C as $q,Ca as _z,D as jq,Da as $z,E as xq,Ea as jz,F as kq,Fa as xz,G as wq,Ga as kz,H as yq,Ha as wz,I as fq,Ia as yz,J as vq,Ja as fz,K as gq,Ka as vz,L as bq,La as gz,M as mq,Ma as bz,N as dq,Na as mz,O as uq,Oa as dz,P as hq,Pa as uz,Q as pq,Qa as hz,R as lq,Ra as pz,S as cq,Sa as lz,T as nq,Ta as cz,U as rq,Ua as nz,V as aq,Va as rz,W as sq,Wa as az,X as oq,Xa as sz,Ya as oz,Z as tq,Za as tz,_ as iq,_a as iz,a as zq,aa as qz,ab as qA,b as Aq,ba as zz,bb as zA,c as Bq,ca as Az,d as Cq,da as Bz,e as Dq,ea as Cz,f as Eq,fa as Dz,g as Fq,ga as Ez,h as Gq,ha as Fz,i as Hq,ia as Gz,j as Iq,ja as Hz,k as Jq,ka as Iz,l as Kq,la as Jz,m as Lq,ma as Kz,n as Mq,na as Lz,o as Nq,oa as Mz,p as Oq,pa as Nz,q as Pq,qa as Oz,r as Qq,ra as Pz,s as Rq,sa as Qz,t as Sq,ta as Rz,u as Tq,ua as Sz,v as Uq,va as Tz,w as Vq,wa as Uz,x as Wq,xa as Vz,y as Xq,ya as Wz,z as Yq,za as Xz}from"./chunk-rgd4gjkd.js";import"./chunk-ts9f0mxv.js";export{Hz as windowEvents,kz as watchScreenSharing,rz as vision,Gz as updater,pq as unregisterHotkey,lq as unregisterAllHotkeys,Pz as touchbar,Az as theme,uz as tags,cz as spotlight,nz as speechRecognition,Rz as speech,Uz as signPayload,Eq as showWarningToast,Nq as showWarningModal,kq as showWarningDialog,Bq as showToast,Dq as showSuccessToast,Pq as showSuccessModal,Yq as showSaveDialog,Qq as showQuestionModal,Xq as showOpenDialog,Lq as showModal,Zq as showMessageBox,Cq as showInfoToast,Mq as showInfoModal,Fq as showErrorToast,Oq as showErrorModal,xq as showErrorDialog,jq as showConfirmDialog,_q as showColorPicker,$q as showAlertDialog,Aq as showAlert,qz as shell,tz as serviceMenu,iz as serial,xz as screenSharing,Zz as screenCapture,Kz as screen,zq as requestNotificationPermission,hq as registerHotkey,Tz as redactPII,Tq as prompt,Nz as printing,Mz as permissions,hz as pdf,dq as parseShortcut,Gq as notify,iq as notifications,Fz as network,Oz as nativeAutoLaunch,az as midi,Jz as menu,pz as log,Yz as location,vz as localServer,Xz as liveActivities,Lz as keychain,Cz as isDragOutAvailable,vq as isCaffeinated,zA as isAvailable,Vz as iap,yz as hasFocusShortcuts,Wz as handoff,zz as globalShortcuts,cq as getRegisteredHotkeys,wq as getDialogBridgeScript,qA as getCapability,ez as getCapabilities,gq as getCaffeinateStatus,Uq as getActiveModalCount,Jq as getActiveAlertCount,eq as fs,sq as formatTime,uq as formatShortcut,bq as formatRemainingTime,mq as formatDuration,oq as formatCompact,fz as focusShortcutsReady,wz as focus,dz as fileAssociations,Bz as dragOut,Iq as dismissAllAlerts,Hq as dismissAlertById,aq as delay,Dz as deepLinks,fq as decaffeinate,nq as createTimer,rq as createInterval,Sz as crashReporter,sz as coreml,oz as continuityCamera,Rq as confirm,Vq as closeAllModals,tq as clipboard,yq as caffeinate,lz as bonjour,Qz as bluetooth,gz as biometric,Ez as battery,bz as audio,mz as appleScript,Iz as app,Sq as alert,Kq as TOAST_STYLES,Wq as MODAL_STYLES,_z as MIN_WATCH_INTERVAL_MS,$z as MAX_WATCH_INTERVAL_MS,jz as DEFAULT_WATCH_INTERVAL_MS};
@@ -308,7 +308,7 @@ window.stxDialog = {
308
308
  `).replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/\n{3,}/g,`
309
309
 
310
310
  `).trim()}var Q8={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 $=lZ(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 O("craft:notification:actionClicked",Z)},onReply(Z){return O("craft:notification:reply",Z)}};function lZ(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 V8={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 uZ(Y);return new TextEncoder().encode(Y)},async writeFile(Z,$){await V("fs").writeFile(Z,$)},async writeBuffer(Z,$){let Y=gZ($),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 hZ(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 O("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 Q=$.kinds&&$.kinds.length>0?new Set($.kinds):null,P=Math.max(0,Math.floor($.coalesceMs??0)),X=[],F=null,j=!1,N=()=>{if(F=null,X.length===0)return;let R=X;X=[];try{Y(R)}catch{}},k=O("craft:fs:change",(R)=>{if(j)return;if(R.id!==z)return;if(Q&&R.kind&&!Q.has(R.kind))return;if(X.push(R),P===0){N();return}if(F==null)F=setTimeout(N,P)});return{id:z,async stop(){if(j)return;if(j=!0,k(),F)clearTimeout(F),F=null;if(X.length>0)N();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 gZ(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 uZ(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 hZ(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 S=new Set,GZ=!1;function cZ(){if(GZ)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(Z)=>{let $=Z.detail;if($?.id)S.delete($.id)}),GZ=!0}var pZ=new Set(["javascript:","data:","file:","vbscript:"]),W8={async openExternal(Z){let $=Z.trim().toLowerCase();for(let Y of pZ)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(cZ(),!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(S.has(Z))throw Error(`shell.spawn: id "${Z}" is already in use \u2014 call kill(id) first or pick a different id`);S.add(Z);try{await V("shell").spawn(Z,$,Y,z)}catch(G){throw S.delete(Z),G}},async kill(Z){await V("shell").kill(Z),S.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 O("craft:shell:stdout",Z)},onStderr(Z){return O("craft:shell:stderr",Z)},onExit(Z){return O("craft:shell:exit",Z)}};var R8={async register(Z,$,Y){if(!J("shortcuts"))return;await window.craft.shortcuts.register(Z,$,Y)},async unregister(Z){if(!J("shortcuts"))return;await window.craft.shortcuts.unregister(Z)},async unregisterAll(){if(!J("shortcuts"))return;await window.craft.shortcuts.unregisterAll()},async enable(Z){if(!J("shortcuts"))return;await window.craft.shortcuts.enable(Z)},async disable(Z){if(!J("shortcuts"))return;await window.craft.shortcuts.disable(Z)},async isRegistered(Z){if(!J("shortcuts"))return!1;return await window.craft.shortcuts.isRegistered(Z)},async list(){if(!J("shortcuts"))return[];return await window.craft.shortcuts.list()},on(Z){return O("craft:shortcut",Z)}};var k8={get(){if(J("theme"))try{return window.craft.theme.get()}catch{}return{appearance:dZ()}},onChange(Z){if(Z(this.get()),J("theme"))return O("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 dZ(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}async function U8(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 A8={onUrl(Z){if(!J("deepLink"))return()=>{};return O("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 E8={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 O("craft:powerSleep",Z)},onWake(Z){return O("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 w8={async connectionType(){if(J("network"))return await window.craft.network.connectionType();return OZ()},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 O("craft:networkChange",Z);if(typeof window>"u")return()=>{};let $=()=>Z({type:OZ(),online:!0}),Y=()=>Z({type:"none",online:!1});return window.addEventListener("online",$),window.addEventListener("offline",Y),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",Y)}}};function OZ(){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 m8={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 O("craft:updateAvailable",Z)},onDownloaded(Z){return O("craft:updateDownloaded",Z)},async verifySignature({payload:Z,signatureB64:$,publicKeyB64:Y}){let z=QZ(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 Q=new Uint8Array(await G.arrayBuffer()),P;try{P=await crypto.subtle.importKey("raw",B(Y),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let X=!1;try{X=await crypto.subtle.verify("Ed25519",P,B($),QZ(Q))}catch{X=!1}if(!X)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:Q}}};function QZ(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),Q=new Uint8Array(G);for(let P=0;P<z.length;P++)Q[P]=z.charCodeAt(P);return Q}let $=Buffer.from(Z,"base64"),Y=new ArrayBuffer($.length);return new Uint8Array(Y).set($),new Uint8Array(Y)}var b8={onFocus(Z){if(J("window"))return O("craft:window:focus",()=>Z());return d("focus",Z)},onBlur(Z){if(J("window"))return O("craft:window:blur",()=>Z());return d("blur",Z)},onResize(Z){if(J("window"))return O("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 O("craft:window:move",Z);return()=>{}},onClose(Z){if(J("window"))return O("craft:window:close",()=>Z());return d("beforeunload",Z)},onMinimize(Z){if(J("window"))return O("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 O("craft:window:restore",()=>Z());if(typeof document>"u")return()=>{};let $=()=>{if(document.visibilityState==="visible")Z()};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)}};function d(Z,$){if(typeof window>"u")return()=>{};let Y=()=>$();return window.addEventListener(Z,Y),()=>window.removeEventListener(Z,Y)}var XZ={name:"",version:"0.0.0"},u8={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 XZ;let Z=await window.craft.app.getInfo();return{...XZ,...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 p8={async set(Z){if(J("menu"))await window.craft.menu.set(Z)},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 O("craft:menu:action",Z)}};var r8={async getDisplays(){if(J("screen"))return await window.craft.screen.getDisplays();return PZ()},async getPrimary(){if(J("screen")){let Z=await window.craft.screen.getPrimary();return Z&&typeof Z.width==="number"?Z:null}return PZ()[0]??null},onChange(Z){if(J("screen"))return O("craft:screen:change",()=>Z());if(typeof window>"u")return()=>{};let $=()=>Z();return window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)}};function PZ(){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 i8={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 e8={async check(Z){if(J("permissions"))return await window.craft.permissions.check(Z);return await VZ(Z)},async request(Z){if(J("permissions"))return await window.craft.permissions.request(Z);return await nZ(Z)},async openSettings(Z){if(J("permissions"))await window.craft.permissions.openSettings(Z)}};async function VZ(Z){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let $=await navigator.permissions.query({name:Z});return rZ($.state)}catch{return"not-supported"}}async function nZ(Z){if(Z==="notifications"&&typeof window<"u"&&"Notification"in window){let $=await window.Notification.requestPermission();return $==="granted"?"granted":$==="denied"?"denied":"undetermined"}return await VZ(Z)}function rZ(Z){if(Z==="granted")return"granted";if(Z==="denied")return"denied";if(Z==="prompt")return"undetermined";return"undetermined"}var J$={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 G$={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()}};var X$={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 O("craft:touchbar:action",Z)}};var oZ=/^[\da-f]*$/i;function aZ(Z,$){if(typeof $!=="string"||!oZ.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(aZ("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 O("craft:bluetooth:deviceFound",Z)},onDeviceConnected(Z){return O("craft:bluetooth:deviceConnected",Z)},onDeviceDisconnected(Z){return O("craft:bluetooth:deviceDisconnected",Z)},onCharacteristicValue(Z){return O("craft:bluetooth:characteristicValue",Z)}};var K$={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((Q)=>Q.voiceURI===$.voice||Q.name===$.voice||Q.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 A=[],n=!0,r,o,v={async report(Z){if(J("crashReporter")){await window.craft.crashReporter.report(Z);return}if(!n)return;let $=Z instanceof Error?{timestamp:Date.now(),severity:"error",message:Z.message,source:"js",stack:Z.stack||"",userId:r,appVersion:o}:{timestamp:Date.now(),severity:Z.severity||"error",message:Z.message||"",source:Z.source||"js",stack:Z.stack||"",userId:r,appVersion:o};if(A.length>=64)A.shift();A.push($)},async flush(){if(J("crashReporter"))return await window.craft.crashReporter.flush();return[...A]},async clear(){if(J("crashReporter")){await window.craft.crashReporter.clear();return}A.length=0},async setEnabled(Z){if(J("crashReporter")){await window.craft.crashReporter.setEnabled(Z);return}n=Z},async isEnabled(){if(J("crashReporter"))return await window.craft.crashReporter.isEnabled();return n},async setUser(Z){if(J("crashReporter")){await window.craft.crashReporter.setUser(Z);return}r=Z||void 0},async setAppVersion(Z){if(J("crashReporter")){await window.craft.crashReporter.setAppVersion(Z);return}o=Z||void 0},attachGlobalHandlers(){if(J("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let Z=(Y)=>{v.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;v.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 Y4(Z)}},iZ="craft:crashReporter:pending",sZ=/[\w.+-]+@[\w-]+\.[\w.-]+/g,tZ=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,eZ=/\/(?:Users|home)\/[^\s/'"`]+/g;function Z4(Z){let $=(Y)=>Y.replace(sZ,"<email>").replace(tZ,"<ip>").replace(eZ,"/<home>");return{...Z,message:$(Z.message),stack:$(Z.stack)}}async function $4(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((Q)=>Q.toString(16).padStart(2,"0")).join("")}function J4(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 FZ(Z,$){if(!Z||typeof localStorage>"u")return;try{if($.length===0)localStorage.removeItem(Z);else localStorage.setItem(Z,JSON.stringify($))}catch{}}function Y4(Z){let{endpoint:$,intervalMs:Y=60000,signingSecret:z,redact:G=!0,headers:Q={},maxRetries:P=5,persistKey:X}=Z,F=X===null?null:X??iZ,j=J4(F),N=!1,k=null,R=null,LZ=typeof G==="function"?G:G===!1?(H)=>H:Z4;async function DZ(H){let x=JSON.stringify({entries:H}),_={"Content-Type":"application/json",...Q};if(z)_["X-Craft-Signature"]=await $4(z,x);let s=0,l=1000;while(!N)try{let M=await fetch($,{method:"POST",headers:_,body:x});if(M.ok)return;if(M.status>=400&&M.status<500)return;throw Error(`HTTP ${M.status}`)}catch(M){if(s+=1,s>P)throw j=[...H,...j],FZ(F,j),M;await new Promise((kZ)=>{setTimeout(kZ,l)}),l=Math.min(l*2,60000)}}async function i(){if(N||R)return R??void 0;let H=await v.flush();if(H.length>0)await v.clear();if(j=[...j,...H.map((_)=>LZ(_))],j.length===0)return;let x=j;return j=[],FZ(F,j),R=DZ(x).catch(()=>{}).finally(()=>{R=null}),R}if(Y>0)k=setInterval(()=>{i().catch(()=>{})},Y);return{async flushNow(){await i()},stop(){if(N=!0,k)clearInterval(k);k=null},pending(){return[...j]}}}var H$={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 O("craft:iap:purchased",Z)},onFailed(Z){return O("craft:iap:failed",Z)},onRestored(Z){return O("craft:iap:restored",Z)},onProductsLoaded(Z){return O("craft:iap:productsLoaded",($)=>Z($.products||[]))},onRefunded(Z){return O("craft:iap:refunded",Z)},onSubscriptionStatusChanged(Z){return O("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 b={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 O("craft:handoff:incoming",Z)}};var S$={async start(Z,$){return b.startActivity(Z,{title:$?.title,webpageURL:$?.webpageURL,userInfo:$?.state})},async update(Z){return b.updateActivity({title:Z.title,webpageURL:Z.webpageURL,userInfo:Z.state})},async stop(){await b.stopActivity()}};var _$={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 O("craft:location:update",Z)},onError(Z){return O("craft:location:error",Z)},onAuthChanged(Z){return O("craft:location:authChanged",Z)}};var I$={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 z4=250,G4=60000,WZ=2000,jZ={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function O4(){return{...jZ,signals:{...jZ.signals},sources:[]}}var a={async getState(){if(!J("screenSharing"))return O4();return await window.craft.screenSharing.getState()},async watch(Z=WZ){let $=Math.min(G4,Math.max(z4,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 O("craft:screenSharing:change",Z)}};async function f$(Z,$=WZ){let Y=a.onChange(Z);return await a.watch($),()=>{Y(),a.stop()}}var Q4={supported:!1,isFocused:null,authorization:"unsupported"};function KZ(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var NZ={async getStatus(){if(!J("focus"))return{...Q4};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 KZ();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 KZ();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 Z=await window.craft.focus.listShortcutsResult();return{canList:Boolean(Z?.canList),shortcuts:Z?.shortcuts||[]}}};async function v$(...Z){if(Z.length===0)return!1;let $=new Set(await NZ.listShortcuts());return Z.every((Y)=>$.has(Y))}async function b$(...Z){if(Z.length===0)return!1;let{canList:$,shortcuts:Y}=await NZ.listShortcutsResult();if(!$)return"unknown";let z=new Set(Y);return Z.every((G)=>z.has(G))}var u$={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 O("craft:localServer:request",Z)},async awaitOAuthCallback(Z={}){V("localServer");let{port:$=0,host:Y="127.0.0.1",timeoutMs:z=300000,successHTML:G}=Z,Q=await this.start($,Y);if(!Q.started)throw Error(`localServer: start failed${Q.reason?` \u2014 ${Q.reason}`:""}`);return new Promise((P,X)=>{let F=setTimeout(()=>{j(),this.stop().catch(()=>{}),X(Error("localServer: OAuth callback timed out"))},z),j=this.onRequest(({url:N})=>{clearTimeout(F),j();let k=G??`<!doctype html><meta charset="utf-8"><title>Done</title>
311
+ at ${Y.filename}:${Y.lineno}:${Y.colno}`}).catch(()=>{})},$=(Y)=>{let z=Y.reason;v.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 Y4(Z)}},iZ="craft:crashReporter:pending",sZ=/[\w.+-]+@[\w-]+\.[\w.-]+/g,tZ=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,eZ=/\/(?:Users|home)\/[^\s/'"`]+/g;function Z4(Z){let $=(Y)=>Y.replace(sZ,"<email>").replace(tZ,"<ip>").replace(eZ,"/<home>");return{...Z,message:$(Z.message),stack:$(Z.stack)}}async function $4(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((Q)=>Q.toString(16).padStart(2,"0")).join("")}function J4(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 FZ(Z,$){if(!Z||typeof localStorage>"u")return;try{if($.length===0)localStorage.removeItem(Z);else localStorage.setItem(Z,JSON.stringify($))}catch{}}function Y4(Z){let{endpoint:$,intervalMs:Y=60000,signingSecret:z,redact:G=!0,headers:Q={},maxRetries:P=5,persistKey:X}=Z,F=X===null?null:X??iZ,j=J4(F),N=!1,k=null,R=null,LZ=typeof G==="function"?G:G===!1?(H)=>H:Z4;async function DZ(H){let x=JSON.stringify({entries:H}),_={"Content-Type":"application/json",...Q};if(z)_["X-Craft-Signature"]=await $4(z,x);let s=0,l=1000;while(!N)try{let M=await fetch($,{method:"POST",headers:_,body:x});if(M.ok)return;if(M.status>=400&&M.status<500)return;throw Error(`HTTP ${M.status}`)}catch(M){if(s+=1,s>P)throw j=[...H,...j],FZ(F,j),M;await new Promise((kZ)=>{setTimeout(kZ,l)}),l=Math.min(l*2,60000)}}async function i(){if(N||R)return R??void 0;let H=await v.flush();if(H.length>0)await v.clear();if(j=[...j,...H.map((_)=>LZ(_))],j.length===0)return;let x=j;return j=[],FZ(F,j),R=DZ(x).catch(()=>{}).finally(()=>{R=null}),R}if(Y>0)k=setInterval(()=>{i().catch(()=>{})},Y);return{async flushNow(){await i()},stop(){if(N=!0,k)clearInterval(k);k=null},pending(){return[...j]}}}var H$={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 O("craft:iap:purchased",Z)},onFailed(Z){return O("craft:iap:failed",Z)},onRestored(Z){return O("craft:iap:restored",Z)},onProductsLoaded(Z){return O("craft:iap:productsLoaded",($)=>Z($.products||[]))},onRefunded(Z){return O("craft:iap:refunded",Z)},onSubscriptionStatusChanged(Z){return O("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 b={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 O("craft:handoff:incoming",Z)}};var S$={async start(Z,$){return b.startActivity(Z,{title:$?.title,webpageURL:$?.webpageURL,userInfo:$?.state})},async update(Z){return b.updateActivity({title:Z.title,webpageURL:Z.webpageURL,userInfo:Z.state})},async stop(){await b.stopActivity()}};var _$={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 O("craft:location:update",Z)},onError(Z){return O("craft:location:error",Z)},onAuthChanged(Z){return O("craft:location:authChanged",Z)}};var I$={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 z4=250,G4=60000,WZ=2000,jZ={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function O4(){return{...jZ,signals:{...jZ.signals},sources:[]}}var a={async getState(){if(!J("screenSharing"))return O4();return await window.craft.screenSharing.getState()},async watch(Z=WZ){let $=Math.min(G4,Math.max(z4,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 O("craft:screenSharing:change",Z)}};async function f$(Z,$=WZ){let Y=a.onChange(Z);return await a.watch($),()=>{Y(),a.stop()}}var Q4={supported:!1,isFocused:null,authorization:"unsupported"};function KZ(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var NZ={async getStatus(){if(!J("focus"))return{...Q4};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 KZ();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 KZ();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 v$(...Z){if(Z.length===0)return!1;let $=new Set(await NZ.listShortcuts());return Z.every((Y)=>$.has(Y))}async function b$(...Z){if(Z.length===0)return!1;let{canList:$,shortcuts:Y}=await NZ.listShortcutsResult();if(!$)return"unknown";let z=new Set(Y);return Z.every((G)=>z.has(G))}var u$={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 O("craft:localServer:request",Z)},async awaitOAuthCallback(Z={}){V("localServer");let{port:$=0,host:Y="127.0.0.1",timeoutMs:z=300000,successHTML:G}=Z,Q=await this.start($,Y);if(!Q.started)throw Error(`localServer: start failed${Q.reason?` \u2014 ${Q.reason}`:""}`);return new Promise((P,X)=>{let F=setTimeout(()=>{j(),this.stop().catch(()=>{}),X(Error("localServer: OAuth callback timed out"))},z),j=this.onRequest(({url:N})=>{clearTimeout(F),j();let k=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
314
  <script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:k,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),P({url:N,port:Q.port})})})}};var p$={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,r$={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 i$={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 e$={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 JJ={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 GJ={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 XJ={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 O("craft:bonjour:found",Z)},onLost(Z){return O("craft:bonjour:lost",Z)}};var KJ={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 O("craft:speechRecognition:partial",Z)},onFinal(Z){return O("craft:speechRecognition:final",Z)}};var HJ={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 MJ={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 O("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 EJ={async listCameras(){if(!J("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}};var wJ={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 O("craft:serviceMenu:invoked",Z)}};var mJ={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 O("craft:serial:data",Z)}};var RZ=[{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 bJ(){return RZ.map(({name:Z,support:$})=>({name:Z,support:$,available:J(Z)}))}function X4(Z){let $=RZ.find((Y)=>Y.name===Z);if(!$)return;return{...$,available:J(Z)}}function lJ(Z){let $=X4(Z);return!!$&&$.available}
package/dist/index.js CHANGED
@@ -1,86 +1,86 @@
1
1
  // @bun
2
- import{$ as dZ,$a as d0,A as OZ,Aa as V0,B as zZ,Ba as O0,C as MZ,Ca as z0,D as TZ,Da as M0,E as LZ,Ea as T0,F as DZ,Fa as L0,G as PZ,Ga as D0,H as WZ,Ha as P0,I as AZ,Ia as W0,J as NZ,Ja as A0,K as xZ,Ka as N0,L as IZ,La as x0,M as kZ,Ma as I0,N as CZ,Na as k0,O as HZ,Oa as C0,P as vZ,Pa as H0,Q as wZ,Qa as v0,R as fZ,Ra as w0,S as SZ,Sa as f0,T as gZ,Ta as S0,U as bZ,Ua as g0,V as uZ,Va as b0,W as yZ,Wa as u0,X as hZ,Xa as y0,Y as d,Ya as h0,Z as mZ,Za as m0,_ as cZ,_a as c0,a as rY,aa as pZ,ab as p0,b as nY,ba as rZ,bb as r0,c as oY,ca as nZ,d as lY,da as oZ,e as aY,ea as lZ,f as iY,fa as aZ,g as sY,ga as iZ,h as tY,ha as sZ,i as eY,ia as tZ,j as QZ,ja as eZ,k as YZ,ka as Q0,l as ZZ,la as Y0,m as XZ,ma as Z0,n as $Z,na as X0,o as JZ,oa as $0,p as GZ,pa as J0,q as qZ,qa as G0,r as RZ,ra as q0,s as KZ,sa as R0,t as UZ,ta as K0,u as BZ,ua as U0,v as EZ,va as B0,w as _Z,wa as E0,x as FZ,xa as _0,y as jZ,ya as F0,z as VZ,za as j0}from"./chunk-0954hbsb.js";import{cb as N}from"./chunk-ts9f0mxv.js";function z(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function _(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function O(...Y){return Y.filter(Boolean).join(" ")}function V(Y){if(!Y)return"";return Object.entries(Y).map(([Q,Z])=>`${Q.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Z}`).join("; ")}function BQ(Y){let{text:Q,variant:Z="primary",size:X="medium",disabled:$=!1,loading:G=!1,icon:K,iconPosition:q="left",id:J=z("btn"),className:B,style:U}=Y,E=O("stx-button",`stx-button--${Z}`,`stx-button--${X}`,$&&"stx-button--disabled",G&&"stx-button--loading",B),R=V(U),F=K?`<span class="stx-button-icon">${K}</span>`:"",j=G?'<span class="stx-button-spinner"></span>':"",M=q==="left"?`${F}${j}<span class="stx-button-text">${_(Q)}</span>`:`<span class="stx-button-text">${_(Q)}</span>${F}${j}`;return`<button id="${J}" class="${E}" ${$||G?"disabled":""} ${R?`style='${R}'`:""}>${M}</button>`}function EQ(Y){let{value:Q="",placeholder:Z="",type:X="text",disabled:$=!1,readonly:G=!1,maxLength:K,minLength:q,pattern:J,required:B=!1,autocomplete:U,label:E,error:R,hint:F,id:j=z("input"),className:M,style:T}=Y,L=O("stx-input",R&&"stx-input--error",$&&"stx-input--disabled",M),v=V(T),UQ=[`type="${X}"`,`id="${j}"`,`class="${L}"`,Q&&`value="${_(Q)}"`,Z&&`placeholder="${_(Z)}"`,$&&"disabled",G&&"readonly",B&&"required",K&&`maxlength="${K}"`,q&&`minlength="${q}"`,J&&`pattern="${_(J)}"`,U&&`autocomplete="${U}"`,v&&`style="${v}"`].filter(Boolean).join(" "),C="";if(E)C+=`<label class="stx-input-label" for="${j}">${_(E)}</label>`;if(C+=`<input ${UQ} />`,R)C+=`<div class="stx-input-error">${_(R)}</div>`;else if(F)C+=`<div class="stx-input-hint">${_(F)}</div>`;return`<div class="stx-input-wrapper">${C}</div>`}function _Q(Y){let{checked:Q=!1,label:Z,disabled:X=!1,indeterminate:$=!1,id:G=z("checkbox"),className:K,style:q}=Y,J=O("stx-checkbox",X&&"stx-checkbox--disabled",K),B=V(q),U=['type="checkbox"',`id="${G}"`,Q&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
3
- <label class="${J}" ${B?`style="${B}"`:""}>
2
+ import{$ as dZ,$a as d0,A as OZ,Aa as V0,B as zZ,Ba as O0,C as MZ,Ca as z0,D as TZ,Da as M0,E as LZ,Ea as T0,F as DZ,Fa as L0,G as PZ,Ga as D0,H as WZ,Ha as P0,I as AZ,Ia as W0,J as NZ,Ja as A0,K as IZ,Ka as N0,L as xZ,La as I0,M as kZ,Ma as x0,N as CZ,Na as k0,O as HZ,Oa as C0,P as vZ,Pa as H0,Q as wZ,Qa as v0,R as fZ,Ra as w0,S as SZ,Sa as f0,T as gZ,Ta as S0,U as bZ,Ua as g0,V as uZ,Va as b0,W as yZ,Wa as u0,X as hZ,Xa as y0,Y as d,Ya as h0,Z as mZ,Za as m0,_ as cZ,_a as c0,a as rY,aa as pZ,ab as p0,b as nY,ba as rZ,bb as r0,c as oY,ca as nZ,d as lY,da as oZ,e as aY,ea as lZ,f as iY,fa as aZ,g as sY,ga as iZ,h as tY,ha as sZ,i as eY,ia as tZ,j as QZ,ja as eZ,k as YZ,ka as Q0,l as ZZ,la as Y0,m as XZ,ma as Z0,n as $Z,na as X0,o as JZ,oa as $0,p as GZ,pa as J0,q as qZ,qa as G0,r as RZ,ra as q0,s as KZ,sa as R0,t as UZ,ta as K0,u as EZ,ua as U0,v as _Z,va as E0,w as BZ,wa as _0,x as FZ,xa as B0,y as jZ,ya as F0,z as VZ,za as j0}from"./chunk-rgd4gjkd.js";import{cb as N}from"./chunk-ts9f0mxv.js";function z(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function B(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function O(...Y){return Y.filter(Boolean).join(" ")}function V(Y){if(!Y)return"";return Object.entries(Y).map(([Q,Z])=>`${Q.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Z}`).join("; ")}function EQ(Y){let{text:Q,variant:Z="primary",size:X="medium",disabled:$=!1,loading:G=!1,icon:K,iconPosition:q="left",id:J=z("btn"),className:E,style:U}=Y,_=O("stx-button",`stx-button--${Z}`,`stx-button--${X}`,$&&"stx-button--disabled",G&&"stx-button--loading",E),R=V(U),F=K?`<span class="stx-button-icon">${K}</span>`:"",j=G?'<span class="stx-button-spinner"></span>':"",M=q==="left"?`${F}${j}<span class="stx-button-text">${B(Q)}</span>`:`<span class="stx-button-text">${B(Q)}</span>${F}${j}`;return`<button id="${J}" class="${_}" ${$||G?"disabled":""} ${R?`style='${R}'`:""}>${M}</button>`}function _Q(Y){let{value:Q="",placeholder:Z="",type:X="text",disabled:$=!1,readonly:G=!1,maxLength:K,minLength:q,pattern:J,required:E=!1,autocomplete:U,label:_,error:R,hint:F,id:j=z("input"),className:M,style:T}=Y,L=O("stx-input",R&&"stx-input--error",$&&"stx-input--disabled",M),v=V(T),UQ=[`type="${X}"`,`id="${j}"`,`class="${L}"`,Q&&`value="${B(Q)}"`,Z&&`placeholder="${B(Z)}"`,$&&"disabled",G&&"readonly",E&&"required",K&&`maxlength="${K}"`,q&&`minlength="${q}"`,J&&`pattern="${B(J)}"`,U&&`autocomplete="${U}"`,v&&`style="${v}"`].filter(Boolean).join(" "),C="";if(_)C+=`<label class="stx-input-label" for="${j}">${B(_)}</label>`;if(C+=`<input ${UQ} />`,R)C+=`<div class="stx-input-error">${B(R)}</div>`;else if(F)C+=`<div class="stx-input-hint">${B(F)}</div>`;return`<div class="stx-input-wrapper">${C}</div>`}function BQ(Y){let{checked:Q=!1,label:Z,disabled:X=!1,indeterminate:$=!1,id:G=z("checkbox"),className:K,style:q}=Y,J=O("stx-checkbox",X&&"stx-checkbox--disabled",K),E=V(q),U=['type="checkbox"',`id="${G}"`,Q&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
3
+ <label class="${J}" ${E?`style="${E}"`:""}>
4
4
  <input ${U} />
5
5
  <span class="stx-checkbox-box"></span>
6
- ${Z?`<span class="stx-checkbox-label">${_(Z)}</span>`:""}
6
+ ${Z?`<span class="stx-checkbox-label">${B(Z)}</span>`:""}
7
7
  </label>
8
- `}function FQ(Y){let{value:Q=50,min:Z=0,max:X=100,step:$=1,disabled:G=!1,label:K,showValue:q=!0,id:J=z("slider"),className:B,style:U}=Y,E=O("stx-slider",G&&"stx-slider--disabled",B),R=V(U),F=['type="range"',`id="${J}"`,`value="${Q}"`,`min="${Z}"`,`max="${X}"`,`step="${$}"`,G&&"disabled"].filter(Boolean).join(" "),j="";if(K)j+=`<label class="stx-slider-label" for="${J}">${_(K)}</label>`;if(j+=`<div class="stx-slider-track"><input ${F} /></div>`,q)j+=`<span class="stx-slider-value">${Q}</span>`;return`<div class="${E}" ${R?`style='${R}'`:""}>${j}</div>`}function jQ(Y){let{value:Q,max:Z=100,variant:X="default",size:$="medium",showLabel:G=!1,indeterminate:K=!1,id:q=z("progress"),className:J,style:B}=Y,U=Math.min(100,Math.max(0,Q/Z*100)),E=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",J),R=V(B);return`
9
- <div id="${q}" class="${E}" role="progressbar" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${R?`style="${R}"`:""}>
8
+ `}function FQ(Y){let{value:Q=50,min:Z=0,max:X=100,step:$=1,disabled:G=!1,label:K,showValue:q=!0,id:J=z("slider"),className:E,style:U}=Y,_=O("stx-slider",G&&"stx-slider--disabled",E),R=V(U),F=['type="range"',`id="${J}"`,`value="${Q}"`,`min="${Z}"`,`max="${X}"`,`step="${$}"`,G&&"disabled"].filter(Boolean).join(" "),j="";if(K)j+=`<label class="stx-slider-label" for="${J}">${B(K)}</label>`;if(j+=`<div class="stx-slider-track"><input ${F} /></div>`,q)j+=`<span class="stx-slider-value">${Q}</span>`;return`<div class="${_}" ${R?`style='${R}'`:""}>${j}</div>`}function jQ(Y){let{value:Q,max:Z=100,variant:X="default",size:$="medium",showLabel:G=!1,indeterminate:K=!1,id:q=z("progress"),className:J,style:E}=Y,U=Math.min(100,Math.max(0,Q/Z*100)),_=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",J),R=V(E);return`
9
+ <div id="${q}" class="${_}" role="progressbar" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${R?`style="${R}"`:""}>
10
10
  <div class="stx-progress-bar" style="width: ${K?"100%":`${U}%`}"></div>
11
11
  ${G?`<span class="stx-progress-label">${Math.round(U)}%</span>`:""}
12
12
  </div>
13
- `}function VQ(Y){let{text:Q,variant:Z="default",size:X="medium",id:$=z("badge"),className:G,style:K}=Y,q=O("stx-badge",`stx-badge--${Z}`,`stx-badge--${X}`,G),J=V(K);return`<span id="${$}" class="${q}" ${J?`style='${J}'`:""}>${_(Q)}</span>`}function OQ(Y){let{src:Q,alt:Z="",name:X,size:$="medium",shape:G="circle",id:K=z("avatar"),className:q,style:J}=Y,B=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",E=O("stx-avatar",B,`stx-avatar--${G}`,q),R=[U,V(J)].filter(Boolean).join(" "),F=X?X.split(" ").map((j)=>j[0]).join("").toUpperCase().slice(0,2):"";if(Q)return`<div id="${K}" class="${E}" ${R?`style="${R}"`:""}>
14
- <img src="${_(Q)}" alt="${_(Z)}" class="stx-avatar-img" />
15
- </div>`;return`<div id="${K}" class="${E}" ${R?`style="${R}"`:""}>
13
+ `}function VQ(Y){let{text:Q,variant:Z="default",size:X="medium",id:$=z("badge"),className:G,style:K}=Y,q=O("stx-badge",`stx-badge--${Z}`,`stx-badge--${X}`,G),J=V(K);return`<span id="${$}" class="${q}" ${J?`style='${J}'`:""}>${B(Q)}</span>`}function OQ(Y){let{src:Q,alt:Z="",name:X,size:$="medium",shape:G="circle",id:K=z("avatar"),className:q,style:J}=Y,E=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",_=O("stx-avatar",E,`stx-avatar--${G}`,q),R=[U,V(J)].filter(Boolean).join(" "),F=X?X.split(" ").map((j)=>j[0]).join("").toUpperCase().slice(0,2):"";if(Q)return`<div id="${K}" class="${_}" ${R?`style="${R}"`:""}>
14
+ <img src="${B(Q)}" alt="${B(Z)}" class="stx-avatar-img" />
15
+ </div>`;return`<div id="${K}" class="${_}" ${R?`style="${R}"`:""}>
16
16
  <span class="stx-avatar-initials">${F}</span>
17
- </div>`}function zQ(Y){let{title:Q,subtitle:Z,content:X,image:$,footer:G,variant:K="default",id:q=z("card"),className:J,style:B}=Y,U=O("stx-card",`stx-card--${K}`,J),E=V(B),R="";if($)R+=`<div class="stx-card-image"><img src="${_($)}" alt="" /></div>`;if(R+='<div class="stx-card-body">',Q)R+=`<h3 class="stx-card-title">${_(Q)}</h3>`;if(Z)R+=`<p class="stx-card-subtitle">${_(Z)}</p>`;if(X)R+=`<div class="stx-card-content">${_(X)}</div>`;if(R+="</div>",G)R+=`<div class="stx-card-footer">${_(G)}</div>`;return`<div id="${q}" class="${U}" ${E?`style='${E}'`:""}>${R}</div>`}function MQ(Y){let{tabs:Q,activeTab:Z,variant:X="default",id:$=z("tabs"),className:G,style:K}=Y,q=O("stx-tabs",`stx-tabs--${X}`,G),J=V(K),B=Q.map((U,E)=>{let R=Z?U.value===Z:E===0;return`<button class="${O("stx-tab",R&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${_(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${R}">${_(U.label)}</button>`}).join("");return`<div id="${$}" class="${q}" role="tablist" ${J?`style='${J}'`:""}>${B}</div>`}function TQ(Y){let{options:Q,value:Z,placeholder:X="Select...",disabled:$=!1,id:G=z("dropdown"),className:K,style:q}=Y,J=O("stx-dropdown",$&&"stx-dropdown--disabled",K),B=V(q),U=Q.map((R)=>{let F=R.value===Z?"selected":"",j=R.disabled?"disabled":"";return`<option value="${_(R.value)}" ${F} ${j}>${_(R.label)}</option>`}).join(""),E=Z?"":`<option value="" disabled selected>${_(X)}</option>`;return`<select id="${G}" class="${J}" ${$?"disabled":""} ${B?`style='${B}'`:""}>${E}${U}</select>`}function LQ(Y){let{value:Q=0,max:Z=5,readonly:X=!1,size:$="medium",allowHalf:G=!1,id:K=z("rating"),className:q,style:J}=Y,B=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",q),U=V(J),E="";for(let R=1;R<=Z;R++){let F=R<=Q,j=G&&R-0.5===Q;E+=`<span class="stx-star ${F?"stx-star--filled":j?"stx-star--half":""}" data-value="${R}">\u2605</span>`}return`<div id="${K}" class="${B}" role="slider" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${U?`style='${U}'`:""}>${E}</div>`}function DQ(Y){let{value:Q,name:Z,checked:X=!1,label:$,disabled:G=!1,id:K=z("radio"),className:q,style:J}=Y,B=O("stx-radio",G&&"stx-radio--disabled",q),U=V(J),E=['type="radio"',`id="${K}"`,`name="${_(Z)}"`,`value="${_(Q)}"`,X&&"checked",G&&"disabled"].filter(Boolean).join(" ");return`
18
- <label class="${B}" ${U?`style="${U}"`:""}>
19
- <input ${E} />
17
+ </div>`}function zQ(Y){let{title:Q,subtitle:Z,content:X,image:$,footer:G,variant:K="default",id:q=z("card"),className:J,style:E}=Y,U=O("stx-card",`stx-card--${K}`,J),_=V(E),R="";if($)R+=`<div class="stx-card-image"><img src="${B($)}" alt="" /></div>`;if(R+='<div class="stx-card-body">',Q)R+=`<h3 class="stx-card-title">${B(Q)}</h3>`;if(Z)R+=`<p class="stx-card-subtitle">${B(Z)}</p>`;if(X)R+=`<div class="stx-card-content">${B(X)}</div>`;if(R+="</div>",G)R+=`<div class="stx-card-footer">${B(G)}</div>`;return`<div id="${q}" class="${U}" ${_?`style='${_}'`:""}>${R}</div>`}function MQ(Y){let{tabs:Q,activeTab:Z,variant:X="default",id:$=z("tabs"),className:G,style:K}=Y,q=O("stx-tabs",`stx-tabs--${X}`,G),J=V(K),E=Q.map((U,_)=>{let R=Z?U.value===Z:_===0;return`<button class="${O("stx-tab",R&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${B(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${R}">${B(U.label)}</button>`}).join("");return`<div id="${$}" class="${q}" role="tablist" ${J?`style='${J}'`:""}>${E}</div>`}function TQ(Y){let{options:Q,value:Z,placeholder:X="Select...",disabled:$=!1,id:G=z("dropdown"),className:K,style:q}=Y,J=O("stx-dropdown",$&&"stx-dropdown--disabled",K),E=V(q),U=Q.map((R)=>{let F=R.value===Z?"selected":"",j=R.disabled?"disabled":"";return`<option value="${B(R.value)}" ${F} ${j}>${B(R.label)}</option>`}).join(""),_=Z?"":`<option value="" disabled selected>${B(X)}</option>`;return`<select id="${G}" class="${J}" ${$?"disabled":""} ${E?`style='${E}'`:""}>${_}${U}</select>`}function LQ(Y){let{value:Q=0,max:Z=5,readonly:X=!1,size:$="medium",allowHalf:G=!1,id:K=z("rating"),className:q,style:J}=Y,E=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",q),U=V(J),_="";for(let R=1;R<=Z;R++){let F=R<=Q,j=G&&R-0.5===Q;_+=`<span class="stx-star ${F?"stx-star--filled":j?"stx-star--half":""}" data-value="${R}">\u2605</span>`}return`<div id="${K}" class="${E}" role="slider" aria-valuenow="${Q}" aria-valuemin="0" aria-valuemax="${Z}" ${U?`style='${U}'`:""}>${_}</div>`}function DQ(Y){let{value:Q,name:Z,checked:X=!1,label:$,disabled:G=!1,id:K=z("radio"),className:q,style:J}=Y,E=O("stx-radio",G&&"stx-radio--disabled",q),U=V(J),_=['type="radio"',`id="${K}"`,`name="${B(Z)}"`,`value="${B(Q)}"`,X&&"checked",G&&"disabled"].filter(Boolean).join(" ");return`
18
+ <label class="${E}" ${U?`style="${U}"`:""}>
19
+ <input ${_} />
20
20
  <span class="stx-radio-circle"></span>
21
- ${$?`<span class="stx-radio-label">${_($)}</span>`:""}
21
+ ${$?`<span class="stx-radio-label">${B($)}</span>`:""}
22
22
  </label>
23
- `}function PQ(Y){let{value:Q="#3498db",disabled:Z=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:G=z("color"),className:K,style:q}=Y,J=O("stx-color-picker",Z&&"stx-color-picker--disabled",K),B=V(q),U="";if(X)U+=`<label class="stx-color-picker-label" for="${G}">${_(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
24
- <input type="color" id="${G}" value="${_(Q)}" ${Z?"disabled":""} />
25
- <span class="stx-color-picker-value">${_(Q)}</span>
26
- </div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${_(E)}" data-color="${_(E)}" ${Z?"disabled":""}></button>`;U+="</div>"}return`<div class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function WQ(Y){let{value:Q,min:Z,max:X,disabled:$=!1,label:G,placeholder:K="Select date",showClear:q=!0,id:J=z("date"),className:B,style:U}=Y,E=O("stx-date-picker",$&&"stx-date-picker--disabled",B),R=V(U),F=Q instanceof Date?Q.toISOString().split("T")[0]:Q||"",j=Z instanceof Date?Z.toISOString().split("T")[0]:Z,M=X instanceof Date?X.toISOString().split("T")[0]:X,T=['type="date"',`id="${J}"`,F&&`value="${F}"`,j&&`min="${j}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${_(K)}"`].filter(Boolean).join(" "),L="";if(G)L+=`<label class="stx-date-picker-label" for="${J}">${_(G)}</label>`;return L+=`<div class="stx-date-picker-input">
23
+ `}function PQ(Y){let{value:Q="#3498db",disabled:Z=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:G=z("color"),className:K,style:q}=Y,J=O("stx-color-picker",Z&&"stx-color-picker--disabled",K),E=V(q),U="";if(X)U+=`<label class="stx-color-picker-label" for="${G}">${B(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
24
+ <input type="color" id="${G}" value="${B(Q)}" ${Z?"disabled":""} />
25
+ <span class="stx-color-picker-value">${B(Q)}</span>
26
+ </div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let _ of $)U+=`<button class="stx-color-preset" style="background: ${B(_)}" data-color="${B(_)}" ${Z?"disabled":""}></button>`;U+="</div>"}return`<div class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function WQ(Y){let{value:Q,min:Z,max:X,disabled:$=!1,label:G,placeholder:K="Select date",showClear:q=!0,id:J=z("date"),className:E,style:U}=Y,_=O("stx-date-picker",$&&"stx-date-picker--disabled",E),R=V(U),F=Q instanceof Date?Q.toISOString().split("T")[0]:Q||"",j=Z instanceof Date?Z.toISOString().split("T")[0]:Z,M=X instanceof Date?X.toISOString().split("T")[0]:X,T=['type="date"',`id="${J}"`,F&&`value="${F}"`,j&&`min="${j}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${B(K)}"`].filter(Boolean).join(" "),L="";if(G)L+=`<label class="stx-date-picker-label" for="${J}">${B(G)}</label>`;return L+=`<div class="stx-date-picker-input">
27
27
  <input ${T} />
28
28
  ${q&&F?'<button class="stx-date-picker-clear" type="button">&times;</button>':""}
29
- </div>`,`<div class="${E}" ${R?`style='${R}'`:""}>${L}</div>`}function AQ(Y){let{value:Q="",disabled:Z=!1,label:X,step:$=60,min:G,max:K,id:q=z("time"),className:J,style:B}=Y,U=O("stx-time-picker",Z&&"stx-time-picker--disabled",J),E=V(B),R=['type="time"',`id="${q}"`,Q&&`value="${_(Q)}"`,`step="${$}"`,G&&`min="${_(G)}"`,K&&`max="${_(K)}"`,Z&&"disabled"].filter(Boolean).join(" "),F="";if(X)F+=`<label class="stx-time-picker-label" for="${q}">${_(X)}</label>`;return F+=`<input ${R} class="stx-time-picker-input" />`,`<div class="${U}" ${E?`style='${E}'`:""}>${F}</div>`}function NQ(Y){let{options:Q,value:Z="",placeholder:X="Search...",disabled:$=!1,label:G,loading:K=!1,id:q=z("autocomplete"),className:J,style:B}=Y,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",J),E=V(B),R=Q.find((M)=>M.value===Z),F=R?R.label:Z,j="";if(G)j+=`<label class="stx-autocomplete-label" for="${q}">${_(G)}</label>`;j+=`<div class="stx-autocomplete-input-wrapper">
30
- <input type="text" id="${q}" value="${_(F)}" placeholder="${_(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
29
+ </div>`,`<div class="${_}" ${R?`style='${R}'`:""}>${L}</div>`}function AQ(Y){let{value:Q="",disabled:Z=!1,label:X,step:$=60,min:G,max:K,id:q=z("time"),className:J,style:E}=Y,U=O("stx-time-picker",Z&&"stx-time-picker--disabled",J),_=V(E),R=['type="time"',`id="${q}"`,Q&&`value="${B(Q)}"`,`step="${$}"`,G&&`min="${B(G)}"`,K&&`max="${B(K)}"`,Z&&"disabled"].filter(Boolean).join(" "),F="";if(X)F+=`<label class="stx-time-picker-label" for="${q}">${B(X)}</label>`;return F+=`<input ${R} class="stx-time-picker-input" />`,`<div class="${U}" ${_?`style='${_}'`:""}>${F}</div>`}function NQ(Y){let{options:Q,value:Z="",placeholder:X="Search...",disabled:$=!1,label:G,loading:K=!1,id:q=z("autocomplete"),className:J,style:E}=Y,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",J),_=V(E),R=Q.find((M)=>M.value===Z),F=R?R.label:Z,j="";if(G)j+=`<label class="stx-autocomplete-label" for="${q}">${B(G)}</label>`;j+=`<div class="stx-autocomplete-input-wrapper">
30
+ <input type="text" id="${q}" value="${B(F)}" placeholder="${B(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
31
31
  ${K?'<span class="stx-autocomplete-spinner"></span>':""}
32
- </div>`,j+='<ul class="stx-autocomplete-list">';for(let M of Q)j+=`<li class="stx-autocomplete-item ${M.value===Z?"stx-autocomplete-item--selected":""}" data-value="${_(M.value)}">${_(M.label)}</li>`;return j+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${j}</div>`}function xQ(Y){let{text:Q,htmlFor:Z,required:X=!1,size:$="medium",id:G=z("label"),className:K,style:q}=Y,J=O("stx-label",`stx-label--${$}`,K),B=V(q);return`<label id="${G}" class="${J}" ${Z?`for='${_(Z)}'`:""} ${B?`style='${B}'`:""}>${_(Q)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function IQ(Y){let{src:Q,alt:Z="",width:X,height:$,objectFit:G="cover",fallback:K,loading:q="lazy",id:J=z("image"),className:B,style:U}=Y,E=O("stx-image",B),R={objectFit:G};if(X)R.width=typeof X==="number"?`${X}px`:X;if($)R.height=typeof $==="number"?`${$}px`:$;let F=[V(R),V(U)].filter(Boolean).join("; "),j=K?`onerror="this.src='${_(K)}'"`:"";return`<img id="${J}" class="${E}" src="${_(Q)}" alt="${_(Z)}" loading="${q}" ${F?`style='${F}'`:""} ${j} />`}function kQ(Y){let{text:Q,variant:Z="default",size:X="medium",removable:$=!1,icon:G,id:K=z("chip"),className:q,style:J}=Y,B=O("stx-chip",`stx-chip--${Z}`,`stx-chip--${X}`,q),U=V(J),E="";if(G)E+=`<span class="stx-chip-icon">${G}</span>`;if(E+=`<span class="stx-chip-text">${_(Q)}</span>`,$)E+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${K}" class="${B}" ${U?`style='${U}'`:""}>${E}</span>`}function CQ(Y){let{text:Q,position:Z="top",delay:X=200,children:$,id:G=z("tooltip"),className:K,style:q}=Y,J=O("stx-tooltip-wrapper",K),B=V(q);return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""} data-tooltip="${_(Q)}" data-position="${Z}" data-delay="${X}">
32
+ </div>`,j+='<ul class="stx-autocomplete-list">';for(let M of Q)j+=`<li class="stx-autocomplete-item ${M.value===Z?"stx-autocomplete-item--selected":""}" data-value="${B(M.value)}">${B(M.label)}</li>`;return j+="</ul>",`<div class="${U}" ${_?`style='${_}'`:""}>${j}</div>`}function IQ(Y){let{text:Q,htmlFor:Z,required:X=!1,size:$="medium",id:G=z("label"),className:K,style:q}=Y,J=O("stx-label",`stx-label--${$}`,K),E=V(q);return`<label id="${G}" class="${J}" ${Z?`for='${B(Z)}'`:""} ${E?`style='${E}'`:""}>${B(Q)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function xQ(Y){let{src:Q,alt:Z="",width:X,height:$,objectFit:G="cover",fallback:K,loading:q="lazy",id:J=z("image"),className:E,style:U}=Y,_=O("stx-image",E),R={objectFit:G};if(X)R.width=typeof X==="number"?`${X}px`:X;if($)R.height=typeof $==="number"?`${$}px`:$;let F=[V(R),V(U)].filter(Boolean).join("; "),j=K?`onerror="this.src='${B(K)}'"`:"";return`<img id="${J}" class="${_}" src="${B(Q)}" alt="${B(Z)}" loading="${q}" ${F?`style='${F}'`:""} ${j} />`}function kQ(Y){let{text:Q,variant:Z="default",size:X="medium",removable:$=!1,icon:G,id:K=z("chip"),className:q,style:J}=Y,E=O("stx-chip",`stx-chip--${Z}`,`stx-chip--${X}`,q),U=V(J),_="";if(G)_+=`<span class="stx-chip-icon">${G}</span>`;if(_+=`<span class="stx-chip-text">${B(Q)}</span>`,$)_+='<button class="stx-chip-remove" type="button">&times;</button>';return`<span id="${K}" class="${E}" ${U?`style='${U}'`:""}>${_}</span>`}function CQ(Y){let{text:Q,position:Z="top",delay:X=200,children:$,id:G=z("tooltip"),className:K,style:q}=Y,J=O("stx-tooltip-wrapper",K),E=V(q);return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""} data-tooltip="${B(Q)}" data-position="${Z}" data-delay="${X}">
33
33
  ${$}
34
- <span class="stx-tooltip stx-tooltip--${Z}">${_(Q)}</span>
35
- </div>`}function HQ(Y){let{direction:Q="vertical",showScrollbar:Z=!0,smooth:X=!0,height:$,width:G,children:K,id:q=z("scroll"),className:J,style:B}=Y,U=O("stx-scroll-view",`stx-scroll-view--${Q}`,!Z&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",J),E={};if($)E.height=typeof $==="number"?`${$}px`:$;if(G)E.width=typeof G==="number"?`${G}px`:G;let R=[V(E),V(B)].filter(Boolean).join("; ");return`<div id="${q}" class="${U}" ${R?`style='${R}'`:""}>${K}</div>`}function vQ(Y){let{direction:Q="horizontal",sizes:Z=[50,50],resizable:X=!0,children:$,id:G=z("split"),className:K,style:q}=Y,J=O("stx-split-view",`stx-split-view--${Q}`,X&&"stx-split-view--resizable",K),B=V(q),U=Q==="horizontal"?"width":"height";return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""}>
34
+ <span class="stx-tooltip stx-tooltip--${Z}">${B(Q)}</span>
35
+ </div>`}function HQ(Y){let{direction:Q="vertical",showScrollbar:Z=!0,smooth:X=!0,height:$,width:G,children:K,id:q=z("scroll"),className:J,style:E}=Y,U=O("stx-scroll-view",`stx-scroll-view--${Q}`,!Z&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",J),_={};if($)_.height=typeof $==="number"?`${$}px`:$;if(G)_.width=typeof G==="number"?`${G}px`:G;let R=[V(_),V(E)].filter(Boolean).join("; ");return`<div id="${q}" class="${U}" ${R?`style='${R}'`:""}>${K}</div>`}function vQ(Y){let{direction:Q="horizontal",sizes:Z=[50,50],resizable:X=!0,children:$,id:G=z("split"),className:K,style:q}=Y,J=O("stx-split-view",`stx-split-view--${Q}`,X&&"stx-split-view--resizable",K),E=V(q),U=Q==="horizontal"?"width":"height";return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""}>
36
36
  <div class="stx-split-pane" style="${U}: ${Z[0]}%">${$[0]}</div>
37
37
  ${X?'<div class="stx-split-divider"></div>':""}
38
38
  <div class="stx-split-pane" style="${U}: ${Z[1]}%">${$[1]}</div>
39
- </div>`}function wQ(Y){let{items:Q,multiple:Z=!1,defaultOpen:X=[],id:$=z("accordion"),className:G,style:K}=Y,q=O("stx-accordion",G),J=V(K),B="";return Q.forEach((U,E)=>{let R=X.includes(E),F=O("stx-accordion-item",R&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");B+=`<div class="${F}" data-index="${E}">
39
+ </div>`}function wQ(Y){let{items:Q,multiple:Z=!1,defaultOpen:X=[],id:$=z("accordion"),className:G,style:K}=Y,q=O("stx-accordion",G),J=V(K),E="";return Q.forEach((U,_)=>{let R=X.includes(_),F=O("stx-accordion-item",R&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");E+=`<div class="${F}" data-index="${_}">
40
40
  <button class="stx-accordion-header" ${U.disabled?"disabled":""} aria-expanded="${R}" data-multiple="${Z}">
41
- <span class="stx-accordion-title">${_(U.title)}</span>
41
+ <span class="stx-accordion-title">${B(U.title)}</span>
42
42
  <span class="stx-accordion-icon">\u25BC</span>
43
43
  </button>
44
44
  <div class="stx-accordion-content" ${R?"":"hidden"}>
45
- ${_(U.content)}
45
+ ${B(U.content)}
46
46
  </div>
47
- </div>`}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${B}</div>`}function fQ(Y){let{steps:Q,currentStep:Z,orientation:X="horizontal",id:$=z("stepper"),className:G,style:K}=Y,q=O("stx-stepper",`stx-stepper--${X}`,G),J=V(K),B="";return Q.forEach((U,E)=>{let R=O("stx-step",E<Z&&"stx-step--completed",E===Z&&"stx-step--active");if(B+=`<div class="${R}" data-step="${E}">
47
+ </div>`}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${E}</div>`}function fQ(Y){let{steps:Q,currentStep:Z,orientation:X="horizontal",id:$=z("stepper"),className:G,style:K}=Y,q=O("stx-stepper",`stx-stepper--${X}`,G),J=V(K),E="";return Q.forEach((U,_)=>{let R=O("stx-step",_<Z&&"stx-step--completed",_===Z&&"stx-step--active");if(E+=`<div class="${R}" data-step="${_}">
48
48
  <div class="stx-step-indicator">
49
- ${E<Z?"\u2713":E+1}
49
+ ${_<Z?"\u2713":_+1}
50
50
  </div>
51
51
  <div class="stx-step-content">
52
- <div class="stx-step-label">${_(U.label)}</div>
53
- ${U.description?`<div class="stx-step-description">${_(U.description)}</div>`:""}
52
+ <div class="stx-step-label">${B(U.label)}</div>
53
+ ${U.description?`<div class="stx-step-description">${B(U.description)}</div>`:""}
54
54
  </div>
55
- </div>`,E<Q.length-1)B+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${B}</div>`}function SQ(Y){let{open:Q=!1,title:Z,size:X="medium",closable:$=!0,children:G,footer:K,id:q=z("modal"),className:J,style:B}=Y,U=O("stx-modal-component",`stx-modal-component--${X}`,J),E=V(B);if(!Q)return`<div id="${q}" class="${U} stx-modal-component--hidden" ${E?`style='${E}'`:""}></div>`;let R='<div class="stx-modal-component-overlay">';if(R+='<div class="stx-modal-component-dialog">',Z||$){if(R+='<div class="stx-modal-component-header">',Z)R+=`<h3 class="stx-modal-component-title">${_(Z)}</h3>`;if($)R+='<button class="stx-modal-component-close">&times;</button>';R+="</div>"}if(R+=`<div class="stx-modal-component-body">${G}</div>`,K)R+=`<div class="stx-modal-component-footer">${K}</div>`;return R+="</div></div>",`<div id="${q}" class="${U}" ${E?`style='${E}'`:""}>${R}</div>`}function gQ(Y){let{items:Q,selectable:Z=!1,multiSelect:X=!1,emptyMessage:$="No items",id:G=z("list"),className:K,style:q}=Y,J=O("stx-list-view",Z&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),B=V(q);if(Q.length===0)return`<div id="${G}" class="${J}" ${B?`style="${B}"`:""}>
56
- <div class="stx-list-view-empty">${_($)}</div>
57
- </div>`;let U='<ul class="stx-list-view-items">';for(let E of Q){let R=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${R}" data-id="${_(E.id)}" ${Z?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function bQ(Y){let{columns:Q,data:Z,striped:X=!1,bordered:$=!1,hoverable:G=!0,sortBy:K,sortOrder:q,id:J=z("table"),className:B,style:U}=Y,E=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",G&&"stx-table--hoverable",B),R=V(U),F="<table>";F+="<thead><tr>";for(let j of Q){let T=j.key===K?`stx-table-sorted stx-table-sorted--${q}`:"",L=j.sortable?'data-sortable="true"':"",v=j.width?`style="width: ${j.width}"`:"";F+=`<th class="${T}" ${L} ${v} data-key="${_(j.key)}">${_(j.label)}${j.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}F+="</tr></thead>",F+="<tbody>";for(let j of Z){F+="<tr>";for(let M of Q){let T=j[M.key];F+=`<td>${T!=null?_(String(T)):""}</td>`}F+="</tr>"}return F+="</tbody></table>",`<div id="${J}" class="${E}" ${R?`style='${R}'`:""}>${F}</div>`}function p(Y,Q,Z,X){let $=Q.includes(Y.key),G=Z.includes(Y.key),K=Y.children&&Y.children.length>0,J=`<div class="${O("stx-tree-node",G&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${_(Y.key)}">`;if(J+='<div class="stx-tree-node-content">',K)J+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else J+='<span class="stx-tree-toggle-placeholder"></span>';if(X)J+=`<input type="checkbox" class="stx-tree-checkbox" ${G?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)J+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(J+=`<span class="stx-tree-label">${_(Y.label)}</span>`,J+="</div>",K&&$){J+='<div class="stx-tree-children">';for(let B of Y.children)J+=p(B,Q,Z,X);J+="</div>"}return J+="</div>",J}function uQ(Y){let{nodes:Q,expandedKeys:Z=[],selectedKeys:X=[],checkable:$=!1,id:G=z("tree"),className:K,style:q}=Y,J=O("stx-tree-view",$&&"stx-tree-view--checkable",K),B=V(q),U="";for(let E of Q)U+=p(E,Z,X,$);return`<div id="${G}" class="${J}" role="tree" ${B?`style='${B}'`:""}>${U}</div>`}function yQ(Y){let{columns:Q,data:Z,pagination:X,selectable:$=!1,id:G=z("datagrid"),className:K,style:q}=Y,J=O("stx-data-grid",$&&"stx-data-grid--selectable",K),B=V(q),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 Q){let R=E.width?`style="width: ${E.width}"`:"";U+=`<th ${R}>
55
+ </div>`,_<Q.length-1)E+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${E}</div>`}function SQ(Y){let{open:Q=!1,title:Z,size:X="medium",closable:$=!0,children:G,footer:K,id:q=z("modal"),className:J,style:E}=Y,U=O("stx-modal-component",`stx-modal-component--${X}`,J),_=V(E);if(!Q)return`<div id="${q}" class="${U} stx-modal-component--hidden" ${_?`style='${_}'`:""}></div>`;let R='<div class="stx-modal-component-overlay">';if(R+='<div class="stx-modal-component-dialog">',Z||$){if(R+='<div class="stx-modal-component-header">',Z)R+=`<h3 class="stx-modal-component-title">${B(Z)}</h3>`;if($)R+='<button class="stx-modal-component-close">&times;</button>';R+="</div>"}if(R+=`<div class="stx-modal-component-body">${G}</div>`,K)R+=`<div class="stx-modal-component-footer">${K}</div>`;return R+="</div></div>",`<div id="${q}" class="${U}" ${_?`style='${_}'`:""}>${R}</div>`}function gQ(Y){let{items:Q,selectable:Z=!1,multiSelect:X=!1,emptyMessage:$="No items",id:G=z("list"),className:K,style:q}=Y,J=O("stx-list-view",Z&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),E=V(q);if(Q.length===0)return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""}>
56
+ <div class="stx-list-view-empty">${B($)}</div>
57
+ </div>`;let U='<ul class="stx-list-view-items">';for(let _ of Q){let R=O("stx-list-view-item",_.selected&&"stx-list-view-item--selected");U+=`<li class="${R}" data-id="${B(_.id)}" ${Z?'tabindex="0"':""}>${_.content}</li>`}return U+="</ul>",`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function bQ(Y){let{columns:Q,data:Z,striped:X=!1,bordered:$=!1,hoverable:G=!0,sortBy:K,sortOrder:q,id:J=z("table"),className:E,style:U}=Y,_=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",G&&"stx-table--hoverable",E),R=V(U),F="<table>";F+="<thead><tr>";for(let j of Q){let T=j.key===K?`stx-table-sorted stx-table-sorted--${q}`:"",L=j.sortable?'data-sortable="true"':"",v=j.width?`style="width: ${j.width}"`:"";F+=`<th class="${T}" ${L} ${v} data-key="${B(j.key)}">${B(j.label)}${j.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}F+="</tr></thead>",F+="<tbody>";for(let j of Z){F+="<tr>";for(let M of Q){let T=j[M.key];F+=`<td>${T!=null?B(String(T)):""}</td>`}F+="</tr>"}return F+="</tbody></table>",`<div id="${J}" class="${_}" ${R?`style='${R}'`:""}>${F}</div>`}function p(Y,Q,Z,X){let $=Q.includes(Y.key),G=Z.includes(Y.key),K=Y.children&&Y.children.length>0,J=`<div class="${O("stx-tree-node",G&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${B(Y.key)}">`;if(J+='<div class="stx-tree-node-content">',K)J+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else J+='<span class="stx-tree-toggle-placeholder"></span>';if(X)J+=`<input type="checkbox" class="stx-tree-checkbox" ${G?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)J+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(J+=`<span class="stx-tree-label">${B(Y.label)}</span>`,J+="</div>",K&&$){J+='<div class="stx-tree-children">';for(let E of Y.children)J+=p(E,Q,Z,X);J+="</div>"}return J+="</div>",J}function uQ(Y){let{nodes:Q,expandedKeys:Z=[],selectedKeys:X=[],checkable:$=!1,id:G=z("tree"),className:K,style:q}=Y,J=O("stx-tree-view",$&&"stx-tree-view--checkable",K),E=V(q),U="";for(let _ of Q)U+=p(_,Z,X,$);return`<div id="${G}" class="${J}" role="tree" ${E?`style='${E}'`:""}>${U}</div>`}function yQ(Y){let{columns:Q,data:Z,pagination:X,selectable:$=!1,id:G=z("datagrid"),className:K,style:q}=Y,J=O("stx-data-grid",$&&"stx-data-grid--selectable",K),E=V(q),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 _ of Q){let R=_.width?`style="width: ${_.width}"`:"";U+=`<th ${R}>
58
58
  <div class="stx-data-grid-header-cell">
59
- <span>${_(E.label)}</span>
60
- ${E.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
61
- ${E.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
59
+ <span>${B(_.label)}</span>
60
+ ${_.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
61
+ ${_.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
62
62
  </div>
63
- </th>`}U+="</tr></thead>",U+="<tbody>";for(let E of Z){if(U+="<tr>",$)U+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of Q){let F=E[R.key];U+=`<td>${F!=null?_(String(F)):""}</td>`}U+="</tr>"}if(U+="</tbody></table></div>",X){let E=Math.ceil(X.total/X.pageSize);U+=`<div class="stx-data-grid-pagination">
64
- <span class="stx-data-grid-page-info">Page ${X.page} of ${E} (${X.total} items)</span>
63
+ </th>`}U+="</tr></thead>",U+="<tbody>";for(let _ of Z){if(U+="<tr>",$)U+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of Q){let F=_[R.key];U+=`<td>${F!=null?B(String(F)):""}</td>`}U+="</tr>"}if(U+="</tbody></table></div>",X){let _=Math.ceil(X.total/X.pageSize);U+=`<div class="stx-data-grid-pagination">
64
+ <span class="stx-data-grid-page-info">Page ${X.page} of ${_} (${X.total} items)</span>
65
65
  <div class="stx-data-grid-page-buttons">
66
66
  <button class="stx-data-grid-page-btn" ${X.page<=1?"disabled":""}>\u25C0</button>
67
- <button class="stx-data-grid-page-btn" ${X.page>=E?"disabled":""}>\u25B6</button>
67
+ <button class="stx-data-grid-page-btn" ${X.page>=_?"disabled":""}>\u25B6</button>
68
68
  </div>
69
- </div>`}return`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${U}</div>`}function hQ(Y){let{type:Q,data:Z,options:X={},width:$="100%",height:G=300,id:K=z("chart"),className:q,style:J}=Y,B=O("stx-chart",`stx-chart--${Q}`,q),U={width:typeof $==="number"?`${$}px`:$,height:typeof G==="number"?`${G}px`:G},E=[V(U),V(J)].filter(Boolean).join("; "),R=JSON.stringify({type:Q,data:Z,options:X});return`<div id="${K}" class="${B}" style="${E}" data-chart='${_(R)}'>
69
+ </div>`}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function hQ(Y){let{type:Q,data:Z,options:X={},width:$="100%",height:G=300,id:K=z("chart"),className:q,style:J}=Y,E=O("stx-chart",`stx-chart--${Q}`,q),U={width:typeof $==="number"?`${$}px`:$,height:typeof G==="number"?`${G}px`:G},_=[V(U),V(J)].filter(Boolean).join("; "),R=JSON.stringify({type:Q,data:Z,options:X});return`<div id="${K}" class="${E}" style="${_}" data-chart='${B(R)}'>
70
70
  <div class="stx-chart-placeholder">
71
- ${X.title?`<div class="stx-chart-title">${_(X.title)}</div>`:""}
71
+ ${X.title?`<div class="stx-chart-title">${B(X.title)}</div>`:""}
72
72
  <div class="stx-chart-type">${Q.charAt(0).toUpperCase()+Q.slice(1)} Chart</div>
73
73
  <div class="stx-chart-info">${Z.datasets.length} dataset(s), ${Z.labels.length} labels</div>
74
74
  </div>
75
- </div>`}function mQ(Y){let{value:Q="",language:Z="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:G=!1,height:K=300,tabSize:q=2,wordWrap:J=!1,id:B=z("code"),className:U,style:E}=Y,R=O("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",G&&"stx-code-editor--readonly",J&&"stx-code-editor--wrap",U),F={height:typeof K==="number"?`${K}px`:K},j=[V(F),V(E)].filter(Boolean).join("; "),M=Q.split(`
76
- `),T="";if($){T+='<div class="stx-code-editor-gutter">';for(let L=1;L<=M.length;L++)T+=`<div class="stx-code-editor-line-number">${L}</div>`;T+="</div>"}return T+=`<pre class="stx-code-editor-content"><code class="language-${_(Z)}">${_(Q)}</code></pre>`,`<div id="${B}" class="${R}" style="${j}" data-language="${_(Z)}" data-tab-size="${q}">${T}</div>`}function cQ(Y){let{src:Q,type:Z="video",poster:X,autoplay:$=!1,loop:G=!1,muted:K=!1,controls:q=!0,width:J,height:B,id:U=z("media"),className:E,style:R}=Y,F=O("stx-media-player",`stx-media-player--${Z}`,E),j={};if(J)j.width=typeof J==="number"?`${J}px`:J;if(B)j.height=typeof B==="number"?`${B}px`:B;let M=[V(j),V(R)].filter(Boolean).join("; "),T=[`id="${U}-media"`,`src="${_(Q)}"`,q&&"controls",$&&"autoplay",G&&"loop",K&&"muted",Z==="video"&&X&&`poster="${_(X)}"`].filter(Boolean).join(" "),L=Z==="video"?`<video ${T}>Your browser does not support the video tag.</video>`:`<audio ${T}>Your browser does not support the audio tag.</audio>`;return`<div id="${U}" class="${F}" ${M?`style='${M}'`:""}>${L}</div>`}function dQ(Y){if(Y===void 0)return"";let Q=["B","KB","MB","GB"],Z=Y,X=0;while(Z>=1024&&X<Q.length-1)Z/=1024,X++;return`${Z.toFixed(1)} ${Q[X]}`}function pQ(Y){let{files:Q,viewMode:Z="list",showHidden:X=!1,selectable:$=!0,id:G=z("files"),className:K,style:q}=Y,J=O("stx-file-explorer",`stx-file-explorer--${Z}`,K),B=V(q),U=X?Q:Q.filter((R)=>!R.name.startsWith(".")),E="";if(Z==="list"){E='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),j=R.type==="file"?dQ(R.size):"",M=R.modified?R.modified.toLocaleDateString():"";E+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${_(R.path)}" data-type="${R.type}">
77
- <td><span class="stx-file-explorer-icon">${F}</span>${_(R.name)}</td>
75
+ </div>`}function mQ(Y){let{value:Q="",language:Z="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:G=!1,height:K=300,tabSize:q=2,wordWrap:J=!1,id:E=z("code"),className:U,style:_}=Y,R=O("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",G&&"stx-code-editor--readonly",J&&"stx-code-editor--wrap",U),F={height:typeof K==="number"?`${K}px`:K},j=[V(F),V(_)].filter(Boolean).join("; "),M=Q.split(`
76
+ `),T="";if($){T+='<div class="stx-code-editor-gutter">';for(let L=1;L<=M.length;L++)T+=`<div class="stx-code-editor-line-number">${L}</div>`;T+="</div>"}return T+=`<pre class="stx-code-editor-content"><code class="language-${B(Z)}">${B(Q)}</code></pre>`,`<div id="${E}" class="${R}" style="${j}" data-language="${B(Z)}" data-tab-size="${q}">${T}</div>`}function cQ(Y){let{src:Q,type:Z="video",poster:X,autoplay:$=!1,loop:G=!1,muted:K=!1,controls:q=!0,width:J,height:E,id:U=z("media"),className:_,style:R}=Y,F=O("stx-media-player",`stx-media-player--${Z}`,_),j={};if(J)j.width=typeof J==="number"?`${J}px`:J;if(E)j.height=typeof E==="number"?`${E}px`:E;let M=[V(j),V(R)].filter(Boolean).join("; "),T=[`id="${U}-media"`,`src="${B(Q)}"`,q&&"controls",$&&"autoplay",G&&"loop",K&&"muted",Z==="video"&&X&&`poster="${B(X)}"`].filter(Boolean).join(" "),L=Z==="video"?`<video ${T}>Your browser does not support the video tag.</video>`:`<audio ${T}>Your browser does not support the audio tag.</audio>`;return`<div id="${U}" class="${F}" ${M?`style='${M}'`:""}>${L}</div>`}function dQ(Y){if(Y===void 0)return"";let Q=["B","KB","MB","GB"],Z=Y,X=0;while(Z>=1024&&X<Q.length-1)Z/=1024,X++;return`${Z.toFixed(1)} ${Q[X]}`}function pQ(Y){let{files:Q,viewMode:Z="list",showHidden:X=!1,selectable:$=!0,id:G=z("files"),className:K,style:q}=Y,J=O("stx-file-explorer",`stx-file-explorer--${Z}`,K),E=V(q),U=X?Q:Q.filter((R)=>!R.name.startsWith(".")),_="";if(Z==="list"){_='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),j=R.type==="file"?dQ(R.size):"",M=R.modified?R.modified.toLocaleDateString():"";_+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${B(R.path)}" data-type="${R.type}">
77
+ <td><span class="stx-file-explorer-icon">${F}</span>${B(R.name)}</td>
78
78
  <td>${j}</td>
79
79
  <td>${M}</td>
80
- </tr>`}E+="</tbody></table>"}else{E='<div class="stx-file-explorer-grid">';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");E+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${_(R.path)}" data-type="${R.type}">
80
+ </tr>`}_+="</tbody></table>"}else{_='<div class="stx-file-explorer-grid">';for(let R of U){let F=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");_+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${B(R.path)}" data-type="${R.type}">
81
81
  <div class="stx-file-explorer-icon">${F}</div>
82
- <div class="stx-file-explorer-name">${_(R.name)}</div>
83
- </div>`}E+="</div>"}return`<div id="${G}" class="${J}" ${B?`style='${B}'`:""}>${E}</div>`}function rQ(Y){let{url:Q,width:Z="100%",height:X=400,sandbox:$=!0,allowScripts:G=!0,id:K=z("webview"),className:q,style:J}=Y,B=O("stx-webview",q),U={width:typeof Z==="number"?`${Z}px`:Z,height:typeof X==="number"?`${X}px`:X},E=[V(U),V(J)].filter(Boolean).join("; "),R=[];if($){if(R.push("allow-same-origin"),G)R.push("allow-scripts")}let F=$?`sandbox="${R.join(" ")}"`:"";return`<iframe id="${K}" class="${B}" src="${_(Q)}" style="${E}" ${F} loading="lazy" frameborder="0"></iframe>`}var nQ=["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"],oQ=`
82
+ <div class="stx-file-explorer-name">${B(R.name)}</div>
83
+ </div>`}_+="</div>"}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${_}</div>`}function rQ(Y){let{url:Q,width:Z="100%",height:X=400,sandbox:$=!0,allowScripts:G=!0,id:K=z("webview"),className:q,style:J}=Y,E=O("stx-webview",q),U={width:typeof Z==="number"?`${Z}px`:Z,height:typeof X==="number"?`${X}px`:X},_=[V(U),V(J)].filter(Boolean).join("; "),R=[];if($){if(R.push("allow-same-origin"),G)R.push("allow-scripts")}let F=$?`sandbox="${R.join(" ")}"`:"";return`<iframe id="${K}" class="${E}" src="${B(Q)}" style="${_}" ${F} loading="lazy" frameborder="0"></iframe>`}var nQ=["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"],oQ=`
84
84
  /* Button */
85
85
  .stx-button {
86
86
  display: inline-flex;
@@ -437,7 +437,7 @@ import{$ as dZ,$a as d0,A as OZ,Aa as V0,B as zZ,Ba as O0,C as MZ,Ca as z0,D as
437
437
  .stx-chip--warning { background: #3a2a1a; }
438
438
  .stx-chip--error { background: #3a1a1a; }
439
439
  }
440
- `;import r from"process";function lQ(){if(r.platform)return r.platform;return"unknown"}function o(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function l(Y,Q){if(Y.type==="separator")return{id:`sep-${Q}`,label:"",type:"separator"};let Z={id:`item-${Q}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Z.shortcut=Y.accelerator;if(Y.type==="checkbox")Z.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Z.submenu=Y.submenu.map((X,$)=>l(X,$));return Z}function g(Y){return Y.map((Q,Z)=>l(Q,Z))}function a(Y,Q=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Z=" ".repeat(Q),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",G=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",K=`${Z}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(K+=`<span class="label">${$}${Y.label}</span>${G}`,Y.type==="submenu"&&Y.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let q of Y.submenu)K+=a(q,Q+1);K+="</div>"}return K+="</div>",K}function aQ(Y){let Q='<div class="stx-tray-menu">';for(let Z of Y)Q+=a(Z);return Q+="</div>",Q}var A=new Map;function iQ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var n=!1;function sQ(){if(n||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Q}=Y.detail;for(let Z of A.values()){let X=Z.handlers.get(Q);if(X){X();break}}}),n=!0}async function i(Y={}){let Q=iQ(),Z=lQ(),X=o(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},G=new Map;for(let q of Y.menu||[]){if(q.type!=="separator"&&q.onClick)G.set(q.label,q.onClick);if(q.type==="submenu"&&q.submenu){for(let J of q.submenu)if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick)}}if(A.set(Q,{state:$,handlers:G}),X){sQ();let q=window;try{if($.tooltip)await q.craft.tray.setTitle({title:$.tooltip}),await q.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await q.craft.tray.setIcon({icon:$.icon});let J=g($.menu);await q.craft.tray.setMenu({items:J}),console.log(`[stx-tray] Native tray created for ${Z}`)}catch(J){console.warn("[stx-tray] Failed to create native tray:",J)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Q}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Q,setIcon:(q)=>{if($.icon=q,X)window.craft.tray.setIcon({icon:q}).catch((B)=>{console.warn("[stx-tray] Failed to set icon:",B)});console.log(`[stx-tray:${Q}] Icon updated`)},setTooltip:(q)=>{if($.tooltip=q,X)window.craft.tray.setTooltip({tooltip:q}).catch((B)=>{console.warn("[stx-tray] Failed to set tooltip:",B)});console.log(`[stx-tray:${Q}] Tooltip: ${q}`)},setMenu:(q)=>{$.menu=q,G.clear();for(let J of q){if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick);if(J.type==="submenu"&&J.submenu){for(let B of J.submenu)if(B.type!=="separator"&&B.onClick)G.set(B.label,B.onClick)}}if(X){let J=window,B=g(q);J.craft.tray.setMenu({items:B}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Q}] Menu updated (${q.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Q),X)window.craft.tray.destroy?.().catch((J)=>{console.warn("[stx-tray] Failed to destroy tray:",J)});console.log(`[stx-tray:${Q}] Destroyed`)}}}var tQ=i;function eQ(){return Array.from(A.keys())}function QY(Y){let Q=A.get(Y);if(!Q)return null;let Z=o();return{id:Y,setIcon:(X)=>{if(Q.state.icon=X,Z)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Q.state.tooltip=X,Z)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Q.state.menu=X,Z){let $=window,G=g(X);$.craft.tray.setMenu({items:G}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Z)window.craft.tray.destroy?.().catch(()=>{})}}}function YY(Y,Q){let Z=A.get(Y);if(!Z)return!1;let X=Z.handlers.get(Q);if(X)return X(),!0;return!1}function ZY(Y){let Q=A.get(Y);if(!Q)return null;return aQ(Q.state.menu)}function XY(){return`
440
+ `;import r from"process";function lQ(){if(r.platform)return r.platform;return"unknown"}function o(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function l(Y,Q){if(Y.type==="separator")return{id:`sep-${Q}`,label:"",type:"separator"};let Z={id:`item-${Q}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Z.shortcut=Y.accelerator;if(Y.type==="checkbox")Z.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Z.submenu=Y.submenu.map((X,$)=>l(X,$));return Z}function g(Y){return Y.map((Q,Z)=>l(Q,Z))}function a(Y,Q=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Z=" ".repeat(Q),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",G=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",K=`${Z}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(K+=`<span class="label">${$}${Y.label}</span>${G}`,Y.type==="submenu"&&Y.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let q of Y.submenu)K+=a(q,Q+1);K+="</div>"}return K+="</div>",K}function aQ(Y){let Q='<div class="stx-tray-menu">';for(let Z of Y)Q+=a(Z);return Q+="</div>",Q}var A=new Map;function iQ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var n=!1;function sQ(){if(n||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Q}=Y.detail;for(let Z of A.values()){let X=Z.handlers.get(Q);if(X){X();break}}}),n=!0}async function i(Y={}){let Q=iQ(),Z=lQ(),X=o(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},G=new Map;for(let q of Y.menu||[]){if(q.type!=="separator"&&q.onClick)G.set(q.label,q.onClick);if(q.type==="submenu"&&q.submenu){for(let J of q.submenu)if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick)}}if(A.set(Q,{state:$,handlers:G}),X){sQ();let q=window;try{if($.tooltip)await q.craft.tray.setTitle({title:$.tooltip}),await q.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await q.craft.tray.setIcon({icon:$.icon});let J=g($.menu);await q.craft.tray.setMenu({items:J}),console.log(`[stx-tray] Native tray created for ${Z}`)}catch(J){console.warn("[stx-tray] Failed to create native tray:",J)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Q}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Q,setIcon:(q)=>{if($.icon=q,X)window.craft.tray.setIcon({icon:q}).catch((E)=>{console.warn("[stx-tray] Failed to set icon:",E)});console.log(`[stx-tray:${Q}] Icon updated`)},setTooltip:(q)=>{if($.tooltip=q,X)window.craft.tray.setTooltip({tooltip:q}).catch((E)=>{console.warn("[stx-tray] Failed to set tooltip:",E)});console.log(`[stx-tray:${Q}] Tooltip: ${q}`)},setMenu:(q)=>{$.menu=q,G.clear();for(let J of q){if(J.type!=="separator"&&J.onClick)G.set(J.label,J.onClick);if(J.type==="submenu"&&J.submenu){for(let E of J.submenu)if(E.type!=="separator"&&E.onClick)G.set(E.label,E.onClick)}}if(X){let J=window,E=g(q);J.craft.tray.setMenu({items:E}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Q}] Menu updated (${q.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Q),X)window.craft.tray.destroy?.().catch((J)=>{console.warn("[stx-tray] Failed to destroy tray:",J)});console.log(`[stx-tray:${Q}] Destroyed`)}}}var tQ=i;function eQ(){return Array.from(A.keys())}function QY(Y){let Q=A.get(Y);if(!Q)return null;let Z=o();return{id:Y,setIcon:(X)=>{if(Q.state.icon=X,Z)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Q.state.tooltip=X,Z)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Q.state.menu=X,Z){let $=window,G=g(X);$.craft.tray.setMenu({items:G}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Z)window.craft.tray.destroy?.().catch(()=>{})}}}function YY(Y,Q){let Z=A.get(Y);if(!Z)return!1;let X=Z.handlers.get(Q);if(X)return X(),!0;return!1}function ZY(Y){let Q=A.get(Y);if(!Q)return null;return aQ(Q.state.menu)}function XY(){return`
441
441
  // STX Desktop Tray Bridge
442
442
  // Provides convenient wrappers around window.craft.tray APIs
443
443
  window.stxTray = {
@@ -516,7 +516,7 @@ window.stxTray = {
516
516
  .stx-tray-item:hover > .stx-tray-submenu {
517
517
  display: block;
518
518
  }
519
- `;import W from"process";import{existsSync as JY}from"fs";import{dirname as GY,join as qY}from"path";import{craftBinaryNotFoundMessage as s,resolveCraftBinary as RY}from"craft-native";var x={};function KY(Y){x={...x,...Y}}function UY(){return{...x}}function BY(){x={}}function b(Y){if(!Y.sidebarConfig)return;let Q={...Y.sidebarConfig};if(Q.variant==="desktop")Q.material=Q.material??"sidebar",Q.backgroundEffect=Q.backgroundEffect??"shimmer",Q.allowsVibrancy=Q.allowsVibrancy??!0;return Q}function w(){let Y=[W.env.CRAFT_BINARY_PATH,x.craftBinaryPath,...x.additionalSearchPaths||[],qY(GY(W.execPath),"craft")];for(let Q of Y)if(Q&&JY(Q))return Q;return RY()}var D=new Map;function u(Y){let Q=D.get(Y);if(!Q||Q.closed)return;Q.closed=!0;for(let Z of Q.closeListeners??[])try{Z()}catch(X){console.warn(`[stx/desktop] window ${Y} close listener threw:`,X)}Q.closeListeners?.clear()}var EY=50;async function y(Y,Q){let Z=Q.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Z,new Promise(($)=>setTimeout(()=>$(null),EY))]);if(X?.failed)throw X.error;Z.then(()=>u(Y))}function _Y(){return Array.from(D.keys())}function FY(Y){let Q=D.get(Y);if(!Q)return null;return f(Y,Q.app)}function jY(){for(let[Y,Q]of D)try{Q.app?.close?.()}catch(Z){console.warn(`Failed to close window ${Y}:`,Z)}D.clear()}function f(Y,Q){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 Z=D.get(Y);if(Z?.app)Z.app.close(),u(Y),D.delete(Y),console.log(`[stx/desktop] Window ${Y} closed`)},onClosed:(Z)=>{let X=D.get(Y);if(!X||X.closed)return queueMicrotask(Z),()=>{};return X.closeListeners??=new Set,X.closeListeners.add(Z),()=>X.closeListeners?.delete(Z)},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:(Z)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Z}" }) from inside the webview`)},loadURL:(Z)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Z}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function h(Y,Q={}){let Z=["--url",Y,"--title",Q.title||"stx Desktop","--width",String(Q.width??1200),"--height",String(Q.height??800)];if(Q.darkMode)Z.push("--dark");if(Q.hotReload)Z.push("--hot-reload");if(Q.resizable===!1)Z.push("--no-resize");if(Q.frameless)Z.push("--frameless");if(Q.alwaysOnTop)Z.push("--always-on-top");if(Q.titlebarHidden)Z.push("--titlebar-hidden");if(Q.systemTray)Z.push("--system-tray");if(Q.hideDockIcon)Z.push("--hide-dock-icon");if(Q.devTools===!1)Z.push("--no-devtools");if(Q.nativeSidebar)Z.push("--native-sidebar");if(Q.sidebarWidth!==void 0)Z.push("--sidebar-width",String(Q.sidebarWidth));let X=b(Q);if(X)Z.push("--sidebar-config",JSON.stringify(X));return Z}async function VY(Y,Q={}){let Z=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=w();try{let{createApp:$}=await import("craft-native"),G=$({url:Y,craftPath:X,window:{title:Q.title||"stx Desktop",width:Q.width??1200,height:Q.height??800,darkMode:Q.darkMode??!1,hotReload:Q.hotReload??!1,resizable:Q.resizable??!0,frameless:Q.frameless??!1,alwaysOnTop:Q.alwaysOnTop??!1,titlebarHidden:Q.titlebarHidden??!1,systemTray:Q.systemTray??!1,hideDockIcon:Q.hideDockIcon??!1,devTools:Q.devTools??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth,sidebarConfig:b(Q)}});return D.set(Z,{app:G,url:Y,options:Q}),await y(Z,G),f(Z,G)}catch{try{let{spawn:$}=await import("child_process"),G=$(X,h(Y,Q),{stdio:"inherit"});G.on("error",(q)=>{console.error(q.code==="ENOENT"?s(X):`craft child error: ${q.message}`)});let K={close:()=>G.kill()};return D.set(Z,{app:K,url:Y,options:Q}),G.on("exit",()=>u(Z)),f(Z,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function OY(Y,Q={}){let Z=`http://localhost:${Y}/`;if(W.env.NODE_ENV==="test"||W.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 G=!Q.nativeSidebar,K=b(Q),q=$({url:Z,craftPath:w(),window:{title:Q.title||"stx Development",width:Q.width||1400,height:Q.height||900,resizable:!0,systemTray:G,darkMode:Q.darkMode??!0,hotReload:Q.hotReload??!0,devTools:!0,titlebarHidden:Q.titlebarHidden??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth??260,sidebarConfig:K}}),J=`dev-window-${Y}`;return D.set(J,{app:q,url:Z,options:Q}),await y(J,q),console.log(`\u2713 Native window opened at ${Z}`),!0}catch{let $=w();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:G}=await import("child_process"),K=G($,h(Z,{title:"stx Development",width:1400,height:900,hotReload:!0,...Q}),{stdio:"inherit"});K.on("exit",()=>W.exit(0)),K.on("error",(J)=>{console.warn(J.code==="ENOENT"?s($):`craft child error: ${J.message}`)});let q=`dev-window-${Y}`;return D.set(q,{app:{close:()=>K.kill()},url:Z,options:Q}),console.log(`\u2713 Native window opened at ${Z}`),!0}catch(G){console.warn("\u26A0 Could not spawn craft binary:",G.message)}if(W.env.NODE_ENV==="test"||W.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:G}=await import("child_process"),K=W.platform;return G(K==="darwin"?"open":K==="win32"?"cmd":"xdg-open",K==="win32"?["/c","start",Z]:[Z],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Z}`),!0}catch(G){return console.error("Could not open browser:",G),console.log(`Please open manually: ${Z}`),!1}}}async function zY(Y,Q={}){let{title:Z="stx Desktop",width:X=1200,height:$=800,darkMode:G=!1,hotReload:K=!1,resizable:q=!0,frameless:J=!1,alwaysOnTop:B=!1}=Q;try{let{createApp:U}=await import("craft-native"),E=w(),R=U({html:Y,craftPath:E,window:{title:Z,width:X,height:$,darkMode:G,hotReload:K,resizable:q,frameless:J,alwaysOnTop:B}}),F=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(F,{app:R,url:"html-content",options:Q}),await y(F,R),f(F,R)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function MY(){try{return N.resolve("craft-native"),!0}catch{return!1}}function TY(){return`
519
+ `;import W from"process";import{existsSync as JY}from"fs";import{dirname as GY,join as qY}from"path";import{craftBinaryNotFoundMessage as s,resolveCraftBinary as RY}from"craft-native";var I={};function KY(Y){I={...I,...Y}}function UY(){return{...I}}function EY(){I={}}function b(Y){if(!Y.sidebarConfig)return;let Q={...Y.sidebarConfig};if(Q.variant==="desktop")Q.material=Q.material??"sidebar",Q.backgroundEffect=Q.backgroundEffect??"shimmer",Q.allowsVibrancy=Q.allowsVibrancy??!0;return Q}function w(){let Y=GY(W.execPath),Q=Y.includes(".app/Contents/MacOS")?qY(Y,"craft"):void 0,Z=[W.env.CRAFT_BINARY_PATH,I.craftBinaryPath,...I.additionalSearchPaths||[],Q];for(let X of Z)if(X&&JY(X))return X;return RY()}var D=new Map;function u(Y){let Q=D.get(Y);if(!Q||Q.closed)return;Q.closed=!0;for(let Z of Q.closeListeners??[])try{Z()}catch(X){console.warn(`[stx/desktop] window ${Y} close listener threw:`,X)}Q.closeListeners?.clear()}var _Y=50;async function y(Y,Q){let Z=Q.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Z,new Promise(($)=>setTimeout(()=>$(null),_Y))]);if(X?.failed)throw X.error;Z.then(()=>u(Y))}function BY(){return Array.from(D.keys())}function FY(Y){let Q=D.get(Y);if(!Q)return null;return f(Y,Q.app)}function jY(){for(let[Y,Q]of D)try{Q.app?.close?.()}catch(Z){console.warn(`Failed to close window ${Y}:`,Z)}D.clear()}function f(Y,Q){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 Z=D.get(Y);if(Z?.app)Z.app.close(),u(Y),D.delete(Y),console.log(`[stx/desktop] Window ${Y} closed`)},onClosed:(Z)=>{let X=D.get(Y);if(!X||X.closed)return queueMicrotask(Z),()=>{};return X.closeListeners??=new Set,X.closeListeners.add(Z),()=>X.closeListeners?.delete(Z)},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:(Z)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Z}" }) from inside the webview`)},loadURL:(Z)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Z}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function h(Y,Q={}){let Z=["--url",Y,"--title",Q.title||"stx Desktop","--width",String(Q.width??1200),"--height",String(Q.height??800)];if(Q.darkMode)Z.push("--dark");if(Q.hotReload)Z.push("--hot-reload");if(Q.resizable===!1)Z.push("--no-resize");if(Q.frameless)Z.push("--frameless");if(Q.alwaysOnTop)Z.push("--always-on-top");if(Q.titlebarHidden)Z.push("--titlebar-hidden");if(Q.systemTray)Z.push("--system-tray");if(Q.hideDockIcon)Z.push("--hide-dock-icon");if(Q.devTools===!1)Z.push("--no-devtools");if(Q.nativeSidebar)Z.push("--native-sidebar");if(Q.sidebarWidth!==void 0)Z.push("--sidebar-width",String(Q.sidebarWidth));let X=b(Q);if(X)Z.push("--sidebar-config",JSON.stringify(X));return Z}async function VY(Y,Q={}){let Z=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=w();try{let{createApp:$}=await import("craft-native"),G=$({url:Y,craftPath:X,window:{title:Q.title||"stx Desktop",width:Q.width??1200,height:Q.height??800,darkMode:Q.darkMode??!1,hotReload:Q.hotReload??!1,resizable:Q.resizable??!0,frameless:Q.frameless??!1,alwaysOnTop:Q.alwaysOnTop??!1,titlebarHidden:Q.titlebarHidden??!1,systemTray:Q.systemTray??!1,hideDockIcon:Q.hideDockIcon??!1,devTools:Q.devTools??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth,sidebarConfig:b(Q)}});return D.set(Z,{app:G,url:Y,options:Q}),await y(Z,G),f(Z,G)}catch{try{let{spawn:$}=await import("child_process"),G=$(X,h(Y,Q),{stdio:"inherit"});G.on("error",(q)=>{console.error(q.code==="ENOENT"?s(X):`craft child error: ${q.message}`)});let K={close:()=>G.kill()};return D.set(Z,{app:K,url:Y,options:Q}),G.on("exit",()=>u(Z)),f(Z,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function OY(Y,Q={}){let Z=`http://localhost:${Y}/`;if(W.env.NODE_ENV==="test"||W.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 G=!Q.nativeSidebar,K=b(Q),q=$({url:Z,craftPath:w(),window:{title:Q.title||"stx Development",width:Q.width||1400,height:Q.height||900,resizable:!0,systemTray:G,darkMode:Q.darkMode??!0,hotReload:Q.hotReload??!0,devTools:!0,titlebarHidden:Q.titlebarHidden??!1,nativeSidebar:Q.nativeSidebar??!1,sidebarWidth:Q.sidebarWidth??260,sidebarConfig:K}}),J=`dev-window-${Y}`;return D.set(J,{app:q,url:Z,options:Q}),await y(J,q),console.log(`\u2713 Native window opened at ${Z}`),!0}catch{let $=w();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:G}=await import("child_process"),K=G($,h(Z,{title:"stx Development",width:1400,height:900,hotReload:!0,...Q}),{stdio:"inherit"});K.on("exit",()=>W.exit(0)),K.on("error",(J)=>{console.warn(J.code==="ENOENT"?s($):`craft child error: ${J.message}`)});let q=`dev-window-${Y}`;return D.set(q,{app:{close:()=>K.kill()},url:Z,options:Q}),console.log(`\u2713 Native window opened at ${Z}`),!0}catch(G){console.warn("\u26A0 Could not spawn craft binary:",G.message)}if(W.env.NODE_ENV==="test"||W.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:G}=await import("child_process"),K=W.platform;return G(K==="darwin"?"open":K==="win32"?"cmd":"xdg-open",K==="win32"?["/c","start",Z]:[Z],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Z}`),!0}catch(G){return console.error("Could not open browser:",G),console.log(`Please open manually: ${Z}`),!1}}}async function zY(Y,Q={}){let{title:Z="stx Desktop",width:X=1200,height:$=800,darkMode:G=!1,hotReload:K=!1,resizable:q=!0,frameless:J=!1,alwaysOnTop:E=!1}=Q;try{let{createApp:U}=await import("craft-native"),_=w(),R=U({html:Y,craftPath:_,window:{title:Z,width:X,height:$,darkMode:G,hotReload:K,resizable:q,frameless:J,alwaysOnTop:E}}),F=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(F,{app:R,url:"html-content",options:Q}),await y(F,R),f(F,R)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function MY(){try{return N.resolve("craft-native"),!0}catch{return!1}}function TY(){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 LY,packageApp as DY}from"craft-native";import{craftBinaryNotFoundMessage as PY,resolveCraftBinary as WY}from"craft-native";import{AutoUpdater as t,generateUpdateManifest as e}from"craft-native";var QQ="update.json";function YQ(Y,Q){return`https://github.com/${Y}/releases/latest/download/${Q}`}function ZQ(Y,Q,Z){return`https://github.com/${Y}/releases/download/${Q}/${Z}`}function AY(Y){let{repository:Q,manifestAsset:Z=QQ,...X}=Y;return new t({...X,updateUrl:YQ(Q,Z)})}function NY(Y){let Q=Y.tag??`v${Y.version}`,Z={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Z[X]={path:$,url:ZQ(Y.repository,Q,$.split("/").pop())}}return e({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Z})}import{existsSync as m,mkdirSync as xY,readFileSync as IY,watch as kY,writeFileSync as CY}from"fs";import{homedir as HY,platform as vY}from"os";import{dirname as wY,join as H}from"path";function fY(Y){let Q=vY(),Z=HY();switch(Q){case"darwin":return H(Z,"Library","Application Support",Y);case"win32":return H(process.env.APPDATA||H(Z,"AppData","Roaming"),Y);default:return H(Z,".config",Y)}}class XQ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Q=Y.path?wY(Y.path):fY(Y.name);if(this._path=Y.path||H(Q,"preferences.json"),!m(Q))xY(Q,{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,Q){let Z=this.get(Y);if(JSON.stringify(Z)===JSON.stringify(Q))return;this._data[Y]=Q,this._scheduleSave(),this._notifyChange(Y,Q,Z)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Q=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Q)}reset(){let Y={...this._data};this._data={},this._save();for(let Q of Object.keys(Y)){let Z=this._defaults[Q];this._notifyChange(Q,Z,Y[Q])}}onChange(Y,Q){let Z=Y;if(!this._changeHandlers.has(Z))this._changeHandlers.set(Z,new Set);return this._changeHandlers.get(Z).add(Q),()=>{this._changeHandlers.get(Z)?.delete(Q)}}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(m(this._path)){let Y=IY(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);CY(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(!m(this._path))this._save();this._watcher=kY(this._path,()=>{if(this._writing)return;let Y=this._load(),Q={...this._data};this._data=Y;let Z=new Set([...Object.keys(Q),...Object.keys(Y)]);for(let X of Z){let $=X in Q?Q[X]:this._defaults[X],G=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(G))this._notifyChange(X,G,$)}})}catch{}}_notifyChange(Y,Q,Z){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Q,Z)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Q,Z)}catch{}}}function SY(Y){return new XQ(Y)}import{existsSync as I,mkdirSync as $Q,readFileSync as gY,unlinkSync as JQ,writeFileSync as GQ}from"fs";import{homedir as S,platform as qQ}from"os";import{join as k}from"path";function RQ(Y){let Q=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return k(S(),"Library","LaunchAgents",`com.${Q}.plist`)}function KQ(Y){let Q=process.env.XDG_CONFIG_HOME||k(S(),".config");return k(Q,"autostart",`${Y.toLowerCase()}.desktop`)}async function bY(Y,Q){let Z=Q.appName||"StxApp",X=RQ(Z),$=k(S(),"Library","LaunchAgents");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K],J=`<?xml version="1.0" encoding="UTF-8"?>
560
+ `}import{pack as LY,packageApp as DY}from"craft-native";import{craftBinaryNotFoundMessage as PY,resolveCraftBinary as WY}from"craft-native";import{AutoUpdater as t,generateUpdateManifest as e}from"craft-native";var QQ="update.json";function YQ(Y,Q){return`https://github.com/${Y}/releases/latest/download/${Q}`}function ZQ(Y,Q,Z){return`https://github.com/${Y}/releases/download/${Q}/${Z}`}function AY(Y){let{repository:Q,manifestAsset:Z=QQ,...X}=Y;return new t({...X,updateUrl:YQ(Q,Z)})}function NY(Y){let Q=Y.tag??`v${Y.version}`,Z={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Z[X]={path:$,url:ZQ(Y.repository,Q,$.split("/").pop())}}return e({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Z})}import{existsSync as m,mkdirSync as IY,readFileSync as xY,watch as kY,writeFileSync as CY}from"fs";import{homedir as HY,platform as vY}from"os";import{dirname as wY,join as H}from"path";function fY(Y){let Q=vY(),Z=HY();switch(Q){case"darwin":return H(Z,"Library","Application Support",Y);case"win32":return H(process.env.APPDATA||H(Z,"AppData","Roaming"),Y);default:return H(Z,".config",Y)}}class XQ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Q=Y.path?wY(Y.path):fY(Y.name);if(this._path=Y.path||H(Q,"preferences.json"),!m(Q))IY(Q,{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,Q){let Z=this.get(Y);if(JSON.stringify(Z)===JSON.stringify(Q))return;this._data[Y]=Q,this._scheduleSave(),this._notifyChange(Y,Q,Z)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Q=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Q)}reset(){let Y={...this._data};this._data={},this._save();for(let Q of Object.keys(Y)){let Z=this._defaults[Q];this._notifyChange(Q,Z,Y[Q])}}onChange(Y,Q){let Z=Y;if(!this._changeHandlers.has(Z))this._changeHandlers.set(Z,new Set);return this._changeHandlers.get(Z).add(Q),()=>{this._changeHandlers.get(Z)?.delete(Q)}}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(m(this._path)){let Y=xY(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);CY(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(!m(this._path))this._save();this._watcher=kY(this._path,()=>{if(this._writing)return;let Y=this._load(),Q={...this._data};this._data=Y;let Z=new Set([...Object.keys(Q),...Object.keys(Y)]);for(let X of Z){let $=X in Q?Q[X]:this._defaults[X],G=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(G))this._notifyChange(X,G,$)}})}catch{}}_notifyChange(Y,Q,Z){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Q,Z)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Q,Z)}catch{}}}function SY(Y){return new XQ(Y)}import{existsSync as x,mkdirSync as $Q,readFileSync as gY,unlinkSync as JQ,writeFileSync as GQ}from"fs";import{homedir as S,platform as qQ}from"os";import{join as k}from"path";function RQ(Y){let Q=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return k(S(),"Library","LaunchAgents",`com.${Q}.plist`)}function KQ(Y){let Q=process.env.XDG_CONFIG_HOME||k(S(),".config");return k(Q,"autostart",`${Y.toLowerCase()}.desktop`)}async function bY(Y,Q){let Z=Q.appName||"StxApp",X=RQ(Z),$=k(S(),"Library","LaunchAgents");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K],J=`<?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.${Z.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
566
566
  <key>ProgramArguments</key>
567
567
  <array>
568
- ${q.map((B)=>` <string>${mY(B)}</string>`).join(`
568
+ ${q.map((E)=>` <string>${mY(E)}</string>`).join(`
569
569
  `)}
570
570
  </array>
571
571
  <key>RunAtLoad</key>
@@ -575,7 +575,7 @@ ${q.map((B)=>` <string>${mY(B)}</string>`).join(`
575
575
  ${Q.isHidden?` <key>ProcessType</key>
576
576
  <string>Background</string>`:""}
577
577
  </dict>
578
- </plist>`;if(!I($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(I(X))JQ(X)}async function uY(Y,Q){let Z=Q.appName||"StxApp",X=KQ(Z),$=k(process.env.XDG_CONFIG_HOME||k(S(),".config"),"autostart");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K].join(" "),J=`[Desktop Entry]
578
+ </plist>`;if(!x($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(x(X))JQ(X)}async function uY(Y,Q){let Z=Q.appName||"StxApp",X=KQ(Z),$=k(process.env.XDG_CONFIG_HOME||k(S(),".config"),"autostart");if(Y){let G=Q.appPath||process.execPath,K=Q.args||[],q=[G,...K].join(" "),J=`[Desktop Entry]
579
579
  Type=Application
580
580
  Name=${Z}
581
581
  Exec=${q}
@@ -583,4 +583,4 @@ Terminal=false
583
583
  StartupNotify=false
584
584
  ${Q.isHidden?`X-GNOME-Autostart-enabled=true
585
585
  NoDisplay=true`:""}
586
- `;if(!I($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(I(X))JQ(X)}async function yY(Y){return I(RQ(Y))}async function hY(Y){let Q=KQ(Y);if(!I(Q))return!1;try{let Z=gY(Q,"utf-8");if(Z.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Z.includes("Hidden=true"))return!1;return!0}catch{return!1}}function mY(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function cY(Y,Q={}){let Z=qQ();switch(Z){case"darwin":return bY(Y,Q);case"linux":return uY(Y,Q);default:throw Error(`Auto-launch is not yet supported on ${Z}`)}}async function dY(Y){let Q=Y||"StxApp";switch(qQ()){case"darwin":return yY(Q);case"linux":return hY(Q);default:return!1}}var pY={accentColor:()=>P("system","accentColor",()=>""),highlightColor:()=>P("system","highlightColor",()=>""),language:()=>P("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>P("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>P("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>P("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>P("system","reduceMotion",()=>c("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>P("system","reduceTransparency",()=>c("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>P("system","increaseContrast",()=>c("(prefers-contrast: more)")),systemVersion:()=>P("system","systemVersion",()=>""),hostname:()=>P("system","hostname",()=>""),username:()=>P("system","username",()=>""),async openPreferences(){if(d("system"))await window.craft.system.openPreferences()}};async function P(Y,Q,Z){if(d(Y))return await window.craft[Y][Q]();return await Z()}function c(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{eZ as windowEvents,D0 as watchScreenSharing,b0 as vision,tZ as updater,wZ as unregisterHotkey,fZ as unregisterAllHotkeys,YY as triggerTrayAction,q0 as touchbar,nZ as theme,H0 as tags,pY as system,S0 as spotlight,g0 as speechRecognition,K0 as speech,E0 as signPayload,iY as showWarningToast,JZ as showWarningModal,DZ as showWarningDialog,oY as showToast,aY as showSuccessToast,qZ as showSuccessModal,VZ as showSaveDialog,RZ as showQuestionModal,jZ as showOpenDialog,XZ as showModal,OZ as showMessageBox,lY as showInfoToast,$Z as showInfoModal,sY as showErrorToast,GZ as showErrorModal,LZ as showErrorDialog,TZ as showConfirmDialog,zZ as showColorPicker,MZ as showAlertDialog,nY as showAlert,pZ as shell,KY as setDesktopConfig,cY as setAutoLaunch,m0 as serviceMenu,c0 as serial,L0 as screenSharing,O0 as screenCapture,Z0 as screen,WY as resolveCraftBinary,BY as resetDesktopConfig,rY as requestNotificationPermission,vZ as registerHotkey,B0 as redactPII,BZ as prompt,J0 as printing,$0 as permissions,v0 as pdf,CZ as parseShortcut,DY as packageApp,LY as pack,OY as openDevWindow,tY as notify,cZ as notifications,sZ as network,G0 as nativeAutoLaunch,u0 as midi,Y0 as menu,w0 as log,V0 as location,N0 as localServer,j0 as liveActivities,X0 as keychain,MY as isWebviewAvailable,lZ as isDragOutAvailable,NZ as isCaffeinated,r0 as isAvailable,dY as isAutoLaunchEnabled,_0 as iap,W0 as hasFocusShortcuts,F0 as handoff,rZ as globalShortcuts,ZQ as githubReleaseAssetUrl,YQ as githubLatestAssetUrl,TY as getWindowBridgeScript,FY as getWindow,QY as getTrayInstance,XY as getTrayBridgeScript,ZY as getSimulatedTrayHTML,SZ as getRegisteredHotkeys,PZ as getDialogBridgeScript,UY as getDesktopConfig,p0 as getCapability,d0 as getCapabilities,xZ as getCaffeinateStatus,_Y as getActiveWindowIds,eQ as getActiveTrayInstances,EZ as getActiveModalCount,YZ as getActiveAlertCount,e as generateUpdateManifest,dZ as fs,yZ as formatTime,HZ as formatShortcut,IZ as formatRemainingTime,kZ as formatDuration,hZ as formatCompact,A0 as focusShortcutsReady,P0 as focus,C0 as fileAssociations,oZ as dragOut,QZ as dismissAllAlerts,eY as dismissAlertById,uZ as delay,aZ as deepLinks,AZ as decaffeinate,zY as createWindowWithHTML,VY as createWindow,rQ as createWebView,uQ as createTreeView,CQ as createTooltip,gZ as createTimer,AQ as createTimePicker,EQ as createTextInput,MQ as createTabs,bQ as createTable,i as createSystemTray,fQ as createStepper,vQ as createSplitView,FQ as createSlider,HQ as createScrollView,LQ as createRating,DQ as createRadioButton,jQ as createProgressBar,SY as createPreferences,SQ as createModalComponent,tQ as createMenubar,cQ as createMediaPlayer,gQ as createListView,xQ as createLabel,bZ as createInterval,IQ as createImageView,AY as createGitHubUpdater,NY as createGitHubUpdateManifest,pQ as createFileExplorer,TQ as createDropdown,WQ as createDatePicker,yQ as createDataGrid,PQ as createColorPicker,mQ as createCodeEditor,kQ as createChip,_Q as createCheckbox,hQ as createChart,zQ as createCard,BQ as createButton,VQ as createBadge,OQ as createAvatar,NQ as createAutocomplete,wQ as createAccordion,U0 as crashReporter,h as craftWindowArguments,PY as craftBinaryNotFoundMessage,y0 as coreml,h0 as continuityCamera,KZ as confirm,jY as closeAllWindows,_Z as closeAllModals,mZ as clipboard,WZ as caffeinate,f0 as bonjour,R0 as bluetooth,x0 as biometric,iZ as battery,I0 as audio,k0 as appleScript,Q0 as appInfo,UZ as alert,QQ as UPDATE_MANIFEST_ASSET,$Y as TRAY_MENU_STYLES,ZZ as TOAST_STYLES,FZ as MODAL_STYLES,z0 as MIN_WATCH_INTERVAL_MS,M0 as MAX_WATCH_INTERVAL_MS,T0 as DEFAULT_WATCH_INTERVAL_MS,oQ as COMPONENT_STYLES,t as AutoUpdater,nQ as AVAILABLE_COMPONENTS};
586
+ `;if(!x($))$Q($,{recursive:!0});GQ(X,J,"utf-8")}else if(x(X))JQ(X)}async function yY(Y){return x(RQ(Y))}async function hY(Y){let Q=KQ(Y);if(!x(Q))return!1;try{let Z=gY(Q,"utf-8");if(Z.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Z.includes("Hidden=true"))return!1;return!0}catch{return!1}}function mY(Y){return Y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}async function cY(Y,Q={}){let Z=qQ();switch(Z){case"darwin":return bY(Y,Q);case"linux":return uY(Y,Q);default:throw Error(`Auto-launch is not yet supported on ${Z}`)}}async function dY(Y){let Q=Y||"StxApp";switch(qQ()){case"darwin":return yY(Q);case"linux":return hY(Q);default:return!1}}var pY={accentColor:()=>P("system","accentColor",()=>""),highlightColor:()=>P("system","highlightColor",()=>""),language:()=>P("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>P("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>P("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>P("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>P("system","reduceMotion",()=>c("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>P("system","reduceTransparency",()=>c("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>P("system","increaseContrast",()=>c("(prefers-contrast: more)")),systemVersion:()=>P("system","systemVersion",()=>""),hostname:()=>P("system","hostname",()=>""),username:()=>P("system","username",()=>""),async openPreferences(){if(d("system"))await window.craft.system.openPreferences()}};async function P(Y,Q,Z){if(d(Y))return await window.craft[Y][Q]();return await Z()}function c(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{eZ as windowEvents,D0 as watchScreenSharing,b0 as vision,tZ as updater,wZ as unregisterHotkey,fZ as unregisterAllHotkeys,YY as triggerTrayAction,q0 as touchbar,nZ as theme,H0 as tags,pY as system,S0 as spotlight,g0 as speechRecognition,K0 as speech,_0 as signPayload,iY as showWarningToast,JZ as showWarningModal,DZ as showWarningDialog,oY as showToast,aY as showSuccessToast,qZ as showSuccessModal,VZ as showSaveDialog,RZ as showQuestionModal,jZ as showOpenDialog,XZ as showModal,OZ as showMessageBox,lY as showInfoToast,$Z as showInfoModal,sY as showErrorToast,GZ as showErrorModal,LZ as showErrorDialog,TZ as showConfirmDialog,zZ as showColorPicker,MZ as showAlertDialog,nY as showAlert,pZ as shell,KY as setDesktopConfig,cY as setAutoLaunch,m0 as serviceMenu,c0 as serial,L0 as screenSharing,O0 as screenCapture,Z0 as screen,WY as resolveCraftBinary,EY as resetDesktopConfig,rY as requestNotificationPermission,vZ as registerHotkey,E0 as redactPII,EZ as prompt,J0 as printing,$0 as permissions,v0 as pdf,CZ as parseShortcut,DY as packageApp,LY as pack,OY as openDevWindow,tY as notify,cZ as notifications,sZ as network,G0 as nativeAutoLaunch,u0 as midi,Y0 as menu,w0 as log,V0 as location,N0 as localServer,j0 as liveActivities,X0 as keychain,MY as isWebviewAvailable,lZ as isDragOutAvailable,NZ as isCaffeinated,r0 as isAvailable,dY as isAutoLaunchEnabled,B0 as iap,W0 as hasFocusShortcuts,F0 as handoff,rZ as globalShortcuts,ZQ as githubReleaseAssetUrl,YQ as githubLatestAssetUrl,TY as getWindowBridgeScript,FY as getWindow,QY as getTrayInstance,XY as getTrayBridgeScript,ZY as getSimulatedTrayHTML,SZ as getRegisteredHotkeys,PZ as getDialogBridgeScript,UY as getDesktopConfig,p0 as getCapability,d0 as getCapabilities,IZ as getCaffeinateStatus,BY as getActiveWindowIds,eQ as getActiveTrayInstances,_Z as getActiveModalCount,YZ as getActiveAlertCount,e as generateUpdateManifest,dZ as fs,yZ as formatTime,HZ as formatShortcut,xZ as formatRemainingTime,kZ as formatDuration,hZ as formatCompact,A0 as focusShortcutsReady,P0 as focus,C0 as fileAssociations,oZ as dragOut,QZ as dismissAllAlerts,eY as dismissAlertById,uZ as delay,aZ as deepLinks,AZ as decaffeinate,zY as createWindowWithHTML,VY as createWindow,rQ as createWebView,uQ as createTreeView,CQ as createTooltip,gZ as createTimer,AQ as createTimePicker,_Q as createTextInput,MQ as createTabs,bQ as createTable,i as createSystemTray,fQ as createStepper,vQ as createSplitView,FQ as createSlider,HQ as createScrollView,LQ as createRating,DQ as createRadioButton,jQ as createProgressBar,SY as createPreferences,SQ as createModalComponent,tQ as createMenubar,cQ as createMediaPlayer,gQ as createListView,IQ as createLabel,bZ as createInterval,xQ as createImageView,AY as createGitHubUpdater,NY as createGitHubUpdateManifest,pQ as createFileExplorer,TQ as createDropdown,WQ as createDatePicker,yQ as createDataGrid,PQ as createColorPicker,mQ as createCodeEditor,kQ as createChip,BQ as createCheckbox,hQ as createChart,zQ as createCard,EQ as createButton,VQ as createBadge,OQ as createAvatar,NQ as createAutocomplete,wQ as createAccordion,U0 as crashReporter,h as craftWindowArguments,PY as craftBinaryNotFoundMessage,y0 as coreml,h0 as continuityCamera,KZ as confirm,jY as closeAllWindows,BZ as closeAllModals,mZ as clipboard,WZ as caffeinate,f0 as bonjour,R0 as bluetooth,I0 as biometric,iZ as battery,x0 as audio,k0 as appleScript,Q0 as appInfo,UZ as alert,QQ as UPDATE_MANIFEST_ASSET,$Y as TRAY_MENU_STYLES,ZZ as TOAST_STYLES,FZ as MODAL_STYLES,z0 as MIN_WATCH_INTERVAL_MS,M0 as MAX_WATCH_INTERVAL_MS,T0 as DEFAULT_WATCH_INTERVAL_MS,oQ as COMPONENT_STYLES,t as AutoUpdater,nQ as AVAILABLE_COMPONENTS};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.2.230",
4
+ "version": "0.2.231",
5
5
  "description": "Native desktop application framework for stx (powered by Craft)",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -59,6 +59,6 @@
59
59
  "typecheck": "bun tsc --noEmit"
60
60
  },
61
61
  "dependencies": {
62
- "craft-native": ">=0.0.55"
62
+ "craft-native": ">=0.0.76"
63
63
  }
64
64
  }