var e=0;function t(t){return`${t}_callback_${Date.now()}_${e++}`}function n(e,n){return n===void 0&&(n={}),new Promise((r,i)=>{let a=t(`exec`);window[a]=(e,t,n)=>{r({errno:e,stdout:t,stderr:n}),o(a)};function o(e){delete window[e]}try{ksu.exec(e,JSON.stringify(n),a)}catch(e){i(e),o(a)}})}function r(){this.listeners={}}r.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},r.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function i(){this.listeners={},this.stdin=new r,this.stdout=new r,this.stderr=new r}i.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},i.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function a(e,n,r){n===void 0?n=[]:n instanceof Array||(r=n),r===void 0&&(r={});let a=new i,o=t(`spawn`);window[o]=a;function s(e){delete window[e]}a.on(`exit`,e=>{s(o)});try{ksu.spawn(e,JSON.stringify(n),JSON.stringify(r),o)}catch(e){a.emit(`error`,e),s(o)}return a}function o(e){ksu.fullScreen(e)}function s(e){ksu.enableEdgeToEdge(e)}function c(e){ksu.toast(e)}function l(){return ksu.moduleInfo()}function u(e){try{return JSON.parse(ksu.listPackages(e))}catch{return[]}}function d(e){try{return typeof e!=`string`&&(e=JSON.stringify(e)),JSON.parse(ksu.getPackagesInfo(e))}catch{return[]}}function f(){ksu.exit()}export{s as enableEdgeToEdge,n as exec,f as exit,o as fullScreen,d as getPackagesInfo,u as listPackages,l as moduleInfo,a as spawn,c as toast};