Socket
Socket
Sign inDemoInstall

@neutralinojs/lib

Package Overview
Dependencies
0
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.13.0 to 5.0.0-nightly-20240129

16

dist/index.d.ts
declare namespace filesystem {
interface DirectoryEntry {
entry: string;
path: string;
type: string;

@@ -10,2 +11,5 @@ }

}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {

@@ -29,3 +33,3 @@ id: number;

function createDirectory(path: string): Promise<void>;
function removeDirectory(path: string): Promise<void>;
function remove(path: string): Promise<void>;
function writeFile(path: string, data: string): Promise<void>;

@@ -43,6 +47,5 @@ function appendFile(path: string, data: string): Promise<void>;

function getOpenedFileInfo(id: number): Promise<OpenedFile>;
function removeFile(path: string): Promise<void>;
function readDirectory(path: string): Promise<DirectoryEntry[]>;
function copyFile(source: string, destination: string): Promise<void>;
function moveFile(source: string, destination: string): Promise<void>;
function readDirectory(path: string, options?: DirectoryReaderOptions): Promise<DirectoryEntry[]>;
function copy(source: string, destination: string): Promise<void>;
function move(source: string, destination: string): Promise<void>;
function getStats(path: string): Promise<Stats>;

@@ -197,2 +200,5 @@ }

function broadcast(event: string, data?: any): Promise<void>;
function readProcessInput(readAll?: boolean): Promise<string>;
function writeProcessOutput(data: string): Promise<void>;
function writeProcessError(data: string): Promise<void>;
}

@@ -199,0 +205,0 @@ declare namespace window {

@@ -1,1 +0,1 @@

"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function t(){return l("extensions.getStats")}Object.defineProperty(exports,"__esModule",{value:!0});var n=Object.freeze({__proto__:null,dispatch:function(n,o,i){return new Promise(((r,s)=>e(this,void 0,void 0,(function*(){let e=yield t();if(e.loaded.includes(n))if(e.connected.includes(n))try{let e=yield l("extensions.dispatch",{extensionId:n,event:o,data:i});r(e)}catch(e){s(e)}else!function(e,t){e in u?u[e].push(t):u[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},broadcast:function(e,t){return l("extensions.broadcast",{event:e,data:t})},getStats:t});function o(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function i(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function r(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let s,a={},c=[],u={};function d(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),s=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield f(c),!window.NL_EXTENABLED)return;let e=yield t();for(let t of e.connected)i("extensionReady",t)})))),o("extClientConnect",(e=>{i("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in u&&(yield f(u[t.detail]),delete u[t.detail])}))))}(),function(){s.addEventListener("message",(e=>{var t,n,o;const c=JSON.parse(e.data);c.id&&c.id in a?((null===(t=c.data)||void 0===t?void 0:t.error)?(a[c.id].reject(c.data.error),"NE_RT_INVTOKN"==c.data.error.code&&(s.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=c.data)||void 0===n?void 0:n.success)&&a[c.id].resolve(c.data.hasOwnProperty("returnValue")?c.data.returnValue:c.data),delete a[c.id]):c.event&&("openedFile"==c.event&&"dataBinary"==(null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.action)&&(c.data.data=r(c.data.data)),i(c.event,c.data))})),s.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){i("ready")})))),s.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){i("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function l(e,t){return new Promise(((n,o)=>{if((null==s?void 0:s.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void c.push(i);var i;const r="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),u=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";a[r]={resolve:n,reject:o},s.send(JSON.stringify({id:r,method:e,data:t,accessToken:u}))}))}function f(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){let e=t.shift();try{let t=yield l(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function p(e,t){return l("filesystem.writeBinaryFile",{path:e,data:g(t)})}function g(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var m,w,v=Object.freeze({__proto__:null,createDirectory:function(e){return l("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return l("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return l("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return l("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:p,appendBinaryFile:function(e,t){return l("filesystem.appendBinaryFile",{path:e,data:g(t)})},readFile:function(e,t){return l("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{l("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(r(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return l("filesystem.openFile",{path:e})},createWatcher:function(e){return l("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return l("filesystem.removeWatcher",{id:e})},getWatchers:function(){return l("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return l("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return l("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return l("filesystem.removeFile",{path:e})},readDirectory:function(e){return l("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return l("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return l("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return l("filesystem.getStats",{path:e})}});function _(e,t){return l("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(m||(m={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(w||(w={}));var h=Object.freeze({__proto__:null,get Icon(){return m},get MessageBoxChoice(){return w},execCommand:_,spawnProcess:function(e,t){return l("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return l("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return l("os.getSpawnedProcesses")},getEnv:function(e){return l("os.getEnv",{key:e})},getEnvs:function(){return l("os.getEnvs")},showOpenDialog:function(e,t){return l("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return l("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return l("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return l("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return l("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return l("os.setTray",e)},open:function(e){return l("os.open",{url:e})},getPath:function(e){return l("os.getPath",{name:e})}});var y=Object.freeze({__proto__:null,getMemoryInfo:function(){return l("computer.getMemoryInfo")},getArch:function(){return l("computer.getArch")},getKernelInfo:function(){return l("computer.getKernelInfo")},getOSInfo:function(){return l("computer.getOSInfo")},getCPUInfo:function(){return l("computer.getCPUInfo")},getDisplays:function(){return l("computer.getDisplays")},getMousePosition:function(){return l("computer.getMousePosition")}});var O,N=Object.freeze({__proto__:null,setData:function(e,t){return l("storage.setData",{key:e,data:t})},getData:function(e){return l("storage.getData",{key:e})},getKeys:function(){return l("storage.getKeys")}});function E(e,t){return l("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(O||(O={}));var b=Object.freeze({__proto__:null,get LoggerType(){return O},log:E});function R(e){return l("app.exit",{code:e})}var x=Object.freeze({__proto__:null,exit:R,killProcess:function(){return l("app.killProcess")},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield _(e,{background:!0}),R(),n()}))))},getConfig:function(){return l("app.getConfig")},broadcast:function(e,t){return l("app.broadcast",{event:e,data:t})}});const T=new WeakMap;function P(e,t){return l("window.move",{x:e,y:t})}function S(){return l("window.getSize")}var D=Object.freeze({__proto__:null,setTitle:function(e){return l("window.setTitle",{title:e})},getTitle:function(){return l("window.getTitle")},maximize:function(){return l("window.maximize")},unmaximize:function(){return l("window.unmaximize")},isMaximized:function(){return l("window.isMaximized")},minimize:function(){return l("window.minimize")},setFullScreen:function(){return l("window.setFullScreen")},exitFullScreen:function(){return l("window.exitFullScreen")},isFullScreen:function(){return l("window.isFullScreen")},show:function(){return l("window.show")},hide:function(){return l("window.hide")},isVisible:function(){return l("window.isVisible")},focus:function(){return l("window.focus")},setIcon:function(e){return l("window.setIcon",{icon:e})},move:P,center:function(){return l("window.center")},setDraggableRegion:function(t){return new Promise(((n,o)=>{const i=t instanceof Element?t:document.getElementById(t);let r=0,s=0,a=0,c=!1,u=performance.now();if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(T.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(t){return e(this,void 0,void 0,(function*(){if(c){const e=performance.now(),n=e-u;if(n<5)return;return u=e-(n-5),void(yield P(t.screenX-r,t.screenY-s))}a=Math.sqrt(t.movementX*t.movementX+t.movementY*t.movementY),a>=10&&(c=!0,i.setPointerCapture(t.pointerId))}))}function l(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",d))}function f(e){i.removeEventListener("pointermove",d),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",l),i.addEventListener("pointerup",f),T.set(i,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!T.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=T.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),T.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){let e=yield S();l("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:S,getPosition:function(){return l("window.getPosition")},setAlwaysOnTop:function(e){return l("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),_(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}});var L=Object.freeze({__proto__:null,broadcast:function(e,t){return l("events.broadcast",{event:e,data:t})},on:o,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:i});let F=null;var I=Object.freeze({__proto__:null,checkForUpdates:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){if(!t)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let e=yield fetch(t);F=JSON.parse(yield e.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(F)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(F)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((t,n)=>e(this,void 0,void 0,(function*(){if(!F)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let e=yield fetch(F.resourcesURL),n=yield e.arrayBuffer();yield p(window.NL_PATH+"/resources.neu",n),t({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}});var C=Object.freeze({__proto__:null,readText:function(e,t){return l("clipboard.readText",{key:e,data:t})},writeText:function(e){return l("clipboard.writeText",{data:e})}});var A=Object.freeze({__proto__:null,getMethods:function(){return l("custom.getMethods")}});let j=!1;exports.app=x,exports.clipboard=C,exports.computer=y,exports.custom=A,exports.debug=b,exports.events=L,exports.extensions=n,exports.filesystem=v,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!j){if(d(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield E("Reloading the application..."),location.reload()})))),t.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return l("custom."+e,n)};window.NL_CVERSION="3.13.0",window.NL_CCOMMIT="26e9ccc7986db4fb7df7041ea7c90b3d2ed1093e",j=!0}},exports.os=h,exports.storage=N,exports.updater=I,exports.window=D;
"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function t(){return l("extensions.getStats")}Object.defineProperty(exports,"__esModule",{value:!0});var n=Object.freeze({__proto__:null,dispatch:function(n,o,r){return new Promise(((i,s)=>e(this,void 0,void 0,(function*(){let e=yield t();if(e.loaded.includes(n))if(e.connected.includes(n))try{let e=yield l("extensions.dispatch",{extensionId:n,event:o,data:r});i(e)}catch(e){s(e)}else!function(e,t){e in u?u[e].push(t):u[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:r},resolve:i,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},broadcast:function(e,t){return l("extensions.broadcast",{event:e,data:t})},getStats:t});function o(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function i(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let s,a={},c=[],u={};function d(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const n=p().split(".")[1];s=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${n}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield f(c),!window.NL_EXTENABLED)return;let e=yield t();for(let t of e.connected)r("extensionReady",t)})))),o("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in u&&(yield f(u[t.detail]),delete u[t.detail])}))))}(),function(){s.addEventListener("message",(e=>{var t,n,o;const c=JSON.parse(e.data);c.id&&c.id in a?((null===(t=c.data)||void 0===t?void 0:t.error)?(a[c.id].reject(c.data.error),"NE_RT_INVTOKN"==c.data.error.code&&(s.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=c.data)||void 0===n?void 0:n.success)&&a[c.id].resolve(c.data.hasOwnProperty("returnValue")?c.data.returnValue:c.data),delete a[c.id]):c.event&&("openedFile"==c.event&&"dataBinary"==(null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.action)&&(c.data.data=i(c.data.data)),r(c.event,c.data))})),s.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){r("ready")})))),s.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})})))),s.addEventListener("error",(t=>e(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function l(e,t){return new Promise(((n,o)=>{if((null==s?void 0:s.readyState)!=WebSocket.OPEN)return r={method:e,data:t,resolve:n,reject:o},void c.push(r);var r;const i="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),u=p();a[i]={resolve:n,reject:o},s.send(JSON.stringify({id:i,method:e,data:t,accessToken:u}))}))}function f(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){let e=t.shift();try{let t=yield l(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function p(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function g(e,t){return l("filesystem.writeBinaryFile",{path:e,data:w(t)})}function w(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var m,v,_=Object.freeze({__proto__:null,createDirectory:function(e){return l("filesystem.createDirectory",{path:e})},remove:function(e){return l("filesystem.remove",{path:e})},writeFile:function(e,t){return l("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return l("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:g,appendBinaryFile:function(e,t){return l("filesystem.appendBinaryFile",{path:e,data:w(t)})},readFile:function(e,t){return l("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{l("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(i(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return l("filesystem.openFile",{path:e})},createWatcher:function(e){return l("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return l("filesystem.removeWatcher",{id:e})},getWatchers:function(){return l("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return l("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return l("filesystem.getOpenedFileInfo",{id:e})},readDirectory:function(e,t){return l("filesystem.readDirectory",Object.assign({path:e},t))},copy:function(e,t){return l("filesystem.copy",{source:e,destination:t})},move:function(e,t){return l("filesystem.move",{source:e,destination:t})},getStats:function(e){return l("filesystem.getStats",{path:e})}});function h(e,t){return l("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(m||(m={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(v||(v={}));var O=Object.freeze({__proto__:null,get Icon(){return m},get MessageBoxChoice(){return v},execCommand:h,spawnProcess:function(e,t){return l("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return l("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return l("os.getSpawnedProcesses")},getEnv:function(e){return l("os.getEnv",{key:e})},getEnvs:function(){return l("os.getEnvs")},showOpenDialog:function(e,t){return l("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return l("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return l("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return l("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return l("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return l("os.setTray",e)},open:function(e){return l("os.open",{url:e})},getPath:function(e){return l("os.getPath",{name:e})}});var y=Object.freeze({__proto__:null,getMemoryInfo:function(){return l("computer.getMemoryInfo")},getArch:function(){return l("computer.getArch")},getKernelInfo:function(){return l("computer.getKernelInfo")},getOSInfo:function(){return l("computer.getOSInfo")},getCPUInfo:function(){return l("computer.getCPUInfo")},getDisplays:function(){return l("computer.getDisplays")},getMousePosition:function(){return l("computer.getMousePosition")}});var N,E=Object.freeze({__proto__:null,setData:function(e,t){return l("storage.setData",{key:e,data:t})},getData:function(e){return l("storage.getData",{key:e})},getKeys:function(){return l("storage.getKeys")}});function b(e,t){return l("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(N||(N={}));var R=Object.freeze({__proto__:null,get LoggerType(){return N},log:b});function T(e){return l("app.exit",{code:e})}var P=Object.freeze({__proto__:null,exit:T,killProcess:function(){return l("app.killProcess")},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield h(e,{background:!0}),T(),n()}))))},getConfig:function(){return l("app.getConfig")},broadcast:function(e,t){return l("app.broadcast",{event:e,data:t})},readProcessInput:function(e){return l("app.readProcessInput",{readAll:e})},writeProcessOutput:function(e){return l("app.writeProcessOutput",{data:e})},writeProcessError:function(e){return l("app.writeProcessError",{data:e})}});const x=new WeakMap;function L(e,t){return l("window.move",{x:e,y:t})}function S(){return l("window.getSize")}var I=Object.freeze({__proto__:null,setTitle:function(e){return l("window.setTitle",{title:e})},getTitle:function(){return l("window.getTitle")},maximize:function(){return l("window.maximize")},unmaximize:function(){return l("window.unmaximize")},isMaximized:function(){return l("window.isMaximized")},minimize:function(){return l("window.minimize")},setFullScreen:function(){return l("window.setFullScreen")},exitFullScreen:function(){return l("window.exitFullScreen")},isFullScreen:function(){return l("window.isFullScreen")},show:function(){return l("window.show")},hide:function(){return l("window.hide")},isVisible:function(){return l("window.isVisible")},focus:function(){return l("window.focus")},setIcon:function(e){return l("window.setIcon",{icon:e})},move:L,center:function(){return l("window.center")},setDraggableRegion:function(t){return new Promise(((n,o)=>{const r=t instanceof Element?t:document.getElementById(t);let i=0,s=0,a=0,c=!1,u=performance.now();if(!r)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(x.has(r))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(t){return e(this,void 0,void 0,(function*(){if(c){const e=performance.now(),n=e-u;if(n<5)return;return u=e-(n-5),void(yield L(t.screenX-i,t.screenY-s))}a=Math.sqrt(t.movementX*t.movementX+t.movementY*t.movementY),a>=10&&(c=!0,r.setPointerCapture(t.pointerId))}))}function l(e){0===e.button&&(i=e.clientX,s=e.clientY,r.addEventListener("pointermove",d))}function f(e){r.removeEventListener("pointermove",d),r.releasePointerCapture(e.pointerId)}r.addEventListener("pointerdown",l),r.addEventListener("pointerup",f),x.set(r,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!x.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:r,pointerup:i}=x.get(o);o.removeEventListener("pointerdown",r),o.removeEventListener("pointerup",i),x.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){let e=yield S();l("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:S,getPosition:function(){return l("window.getPosition")},setAlwaysOnTop:function(e){return l("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function r(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let i=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+r(t)),e)),"");i+=" --url="+r(e);for(let e in t){if("processArgs"==e)continue;i+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${r(t[e])}`}t&&t.processArgs&&(i+=" "+t.processArgs),h(i,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}});var D=Object.freeze({__proto__:null,broadcast:function(e,t){return l("events.broadcast",{event:e,data:t})},on:o,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:r});let C=null;var j=Object.freeze({__proto__:null,checkForUpdates:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){if(!t)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let e=yield fetch(t);C=JSON.parse(yield e.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(C)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(C)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((t,n)=>e(this,void 0,void 0,(function*(){if(!C)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let e=yield fetch(C.resourcesURL),n=yield e.arrayBuffer();yield g(window.NL_PATH+"/resources.neu",n),t({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}});var A=Object.freeze({__proto__:null,readText:function(e,t){return l("clipboard.readText",{key:e,data:t})},writeText:function(e){return l("clipboard.writeText",{data:e})}});var F=Object.freeze({__proto__:null,getMethods:function(){return l("custom.getMethods")}});let M=!1;exports.app=P,exports.clipboard=A,exports.computer=y,exports.custom=F,exports.debug=R,exports.events=D,exports.extensions=n,exports.filesystem=_,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!M){if(d(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield b("Reloading the application..."),location.reload()})))),t.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return l("custom."+e,n)};window.NL_CVERSION="5.0.0-nightly-20240129",window.NL_CCOMMIT="8ac7ce9a81b3001f5f185913760eff83c746eb5f",M=!0}},exports.os=O,exports.storage=E,exports.updater=j,exports.window=I;

@@ -1,2 +0,2 @@

// Type definitions for Neutralino 3.13.0
// Type definitions for Neutralino 5.0.0-nightly-20240129
// Project: https://github.com/neutralinojs

@@ -10,2 +10,3 @@ // Definitions project: https://github.com/neutralinojs/neutralino.js

entry: string;
path: string;
type: string;

@@ -17,2 +18,5 @@ }

}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {

@@ -36,3 +40,3 @@ id: number;

function createDirectory(path: string): Promise<void>;
function removeDirectory(path: string): Promise<void>;
function remove(path: string): Promise<void>;
function writeFile(path: string, data: string): Promise<void>;

@@ -50,6 +54,5 @@ function appendFile(path: string, data: string): Promise<void>;

function getOpenedFileInfo(id: number): Promise<OpenedFile>;
function removeFile(path: string): Promise<void>;
function readDirectory(path: string): Promise<DirectoryEntry[]>;
function copyFile(source: string, destination: string): Promise<void>;
function moveFile(source: string, destination: string): Promise<void>;
function readDirectory(path: string, options?: DirectoryReaderOptions): Promise<DirectoryEntry[]>;
function copy(source: string, destination: string): Promise<void>;
function move(source: string, destination: string): Promise<void>;
function getStats(path: string): Promise<Stats>;

@@ -204,2 +207,5 @@ }

function broadcast(event: string, data?: any): Promise<void>;
function readProcessInput(readAll?: boolean): Promise<string>;
function writeProcessOutput(data: string): Promise<void>;
function writeProcessError(data: string): Promise<void>;
}

@@ -326,3 +332,3 @@ namespace window {

/** Neutralinojs client version */
declare const NL_CVERSION: "3.13.0";
declare const NL_CVERSION: "5.0.0-nightly-20240129";

@@ -329,0 +335,0 @@ /** Current working directory */

@@ -1,1 +0,1 @@

var Neutralino=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function n(){return f("extensions.getStats")}var o={__proto__:null,dispatch:function(e,o,i){return new Promise(((r,s)=>t(this,void 0,void 0,(function*(){let t=yield n();if(t.loaded.includes(e))if(t.connected.includes(e))try{let t=yield f("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in d?d[e].push(t):d[e]=[t]}(e,{method:"extensions.dispatch",data:{extensionId:e,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${e} is not loaded`})}))))},broadcast:function(e,t){return f("extensions.broadcast",{event:e,data:t})},getStats:n};function i(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function s(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let a,c={},u=[],d={};function l(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),a=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield p(u),!window.NL_EXTENABLED)return;let e=yield n();for(let t of e.connected)r("extensionReady",t)})))),i("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;i("extensionReady",(e=>t(this,void 0,void 0,(function*(){e.detail in d&&(yield p(d[e.detail]),delete d[e.detail])}))))}(),function(){a.addEventListener("message",(e=>{var t,n,o;const i=JSON.parse(e.data);i.id&&i.id in c?((null===(t=i.data)||void 0===t?void 0:t.error)?(c[i.id].reject(i.data.error),"NE_RT_INVTOKN"==i.data.error.code&&(a.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=i.data)||void 0===n?void 0:n.success)&&c[i.id].resolve(i.data.hasOwnProperty("returnValue")?i.data.returnValue:i.data),delete c[i.id]):i.event&&("openedFile"==i.event&&"dataBinary"==(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.action)&&(i.data.data=s(i.data.data)),r(i.event,i.data))})),a.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),a.addEventListener("close",(e=>t(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function f(e,t){return new Promise(((n,o)=>{if((null==a?void 0:a.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void u.push(i);var i;const r="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),s=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";c[r]={resolve:n,reject:o},a.send(JSON.stringify({id:r,method:e,data:t,accessToken:s}))}))}function p(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){let t=e.shift();try{let e=yield f(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function g(e,t){return f("filesystem.writeBinaryFile",{path:e,data:m(t)})}function m(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var w,v,_={__proto__:null,createDirectory:function(e){return f("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return f("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return f("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return f("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:g,appendBinaryFile:function(e,t){return f("filesystem.appendBinaryFile",{path:e,data:m(t)})},readFile:function(e,t){return f("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{f("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(s(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return f("filesystem.openFile",{path:e})},createWatcher:function(e){return f("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return f("filesystem.removeWatcher",{id:e})},getWatchers:function(){return f("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return f("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return f("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return f("filesystem.removeFile",{path:e})},readDirectory:function(e){return f("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return f("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return f("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return f("filesystem.getStats",{path:e})}};function h(e,t){return f("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(w||(w={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(v||(v={}));var y={__proto__:null,get Icon(){return w},get MessageBoxChoice(){return v},execCommand:h,spawnProcess:function(e,t){return f("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return f("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return f("os.getSpawnedProcesses")},getEnv:function(e){return f("os.getEnv",{key:e})},getEnvs:function(){return f("os.getEnvs")},showOpenDialog:function(e,t){return f("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return f("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return f("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return f("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return f("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return f("os.setTray",e)},open:function(e){return f("os.open",{url:e})},getPath:function(e){return f("os.getPath",{name:e})}};var N={__proto__:null,getMemoryInfo:function(){return f("computer.getMemoryInfo")},getArch:function(){return f("computer.getArch")},getKernelInfo:function(){return f("computer.getKernelInfo")},getOSInfo:function(){return f("computer.getOSInfo")},getCPUInfo:function(){return f("computer.getCPUInfo")},getDisplays:function(){return f("computer.getDisplays")},getMousePosition:function(){return f("computer.getMousePosition")}};var E,O={__proto__:null,setData:function(e,t){return f("storage.setData",{key:e,data:t})},getData:function(e){return f("storage.getData",{key:e})},getKeys:function(){return f("storage.getKeys")}};function R(e,t){return f("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(E||(E={}));var b={__proto__:null,get LoggerType(){return E},log:R};function T(e){return f("app.exit",{code:e})}var S={__proto__:null,exit:T,killProcess:function(){return f("app.killProcess")},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield h(t,{background:!0}),T(),n()}))))},getConfig:function(){return f("app.getConfig")},broadcast:function(e,t){return f("app.broadcast",{event:e,data:t})}};const P=new WeakMap;function D(e,t){return f("window.move",{x:e,y:t})}function L(){return f("window.getSize")}var F={__proto__:null,setTitle:function(e){return f("window.setTitle",{title:e})},getTitle:function(){return f("window.getTitle")},maximize:function(){return f("window.maximize")},unmaximize:function(){return f("window.unmaximize")},isMaximized:function(){return f("window.isMaximized")},minimize:function(){return f("window.minimize")},setFullScreen:function(){return f("window.setFullScreen")},exitFullScreen:function(){return f("window.exitFullScreen")},isFullScreen:function(){return f("window.isFullScreen")},show:function(){return f("window.show")},hide:function(){return f("window.hide")},isVisible:function(){return f("window.isVisible")},focus:function(){return f("window.focus")},setIcon:function(e){return f("window.setIcon",{icon:e})},move:D,center:function(){return f("window.center")},setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0,a=0,c=!1,u=performance.now();if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(P.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(e){return t(this,void 0,void 0,(function*(){if(c){const t=performance.now(),n=t-u;if(n<5)return;return u=t-(n-5),void(yield D(e.screenX-r,e.screenY-s))}a=Math.sqrt(e.movementX*e.movementX+e.movementY*e.movementY),a>=10&&(c=!0,i.setPointerCapture(e.pointerId))}))}function l(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",d))}function f(e){i.removeEventListener("pointermove",d),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",l),i.addEventListener("pointerup",f),P.set(i,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!P.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=P.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),P.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){let t=yield L();f("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:L,getPosition:function(){return f("window.getPosition")},setAlwaysOnTop:function(e){return f("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),h(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}};var I={__proto__:null,broadcast:function(e,t){return f("events.broadcast",{event:e,data:t})},on:i,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:r};let C=null;var x={__proto__:null,checkForUpdates:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){if(!e)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let t=yield fetch(e);C=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(C)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(C)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((e,n)=>t(this,void 0,void 0,(function*(){if(!C)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let t=yield fetch(C.resourcesURL),n=yield t.arrayBuffer();yield g(window.NL_PATH+"/resources.neu",n),e({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}};var A={__proto__:null,readText:function(e,t){return f("clipboard.readText",{key:e,data:t})},writeText:function(e){return f("clipboard.writeText",{data:e})}};var M={__proto__:null,getMethods:function(){return f("custom.getMethods")}};let U=!1;return e.app=S,e.clipboard=A,e.computer=N,e.custom=M,e.debug=b,e.events=I,e.extensions=o,e.filesystem=_,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!U){if(l(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield R("Reloading the application..."),location.reload()})))),e.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return f("custom."+e,n)};window.NL_CVERSION="3.13.0",window.NL_CCOMMIT="26e9ccc7986db4fb7df7041ea7c90b3d2ed1093e",U=!0}},e.os=y,e.storage=O,e.updater=x,e.window=F,e}({});
var Neutralino=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function n(){return f("extensions.getStats")}var o={__proto__:null,dispatch:function(e,o,i){return new Promise(((r,s)=>t(this,void 0,void 0,(function*(){let t=yield n();if(t.loaded.includes(e))if(t.connected.includes(e))try{let t=yield f("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in d?d[e].push(t):d[e]=[t]}(e,{method:"extensions.dispatch",data:{extensionId:e,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${e} is not loaded`})}))))},broadcast:function(e,t){return f("extensions.broadcast",{event:e,data:t})},getStats:n};function i(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function s(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let a,c={},u=[],d={};function l(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const e=g().split(".")[1];a=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${e}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield p(u),!window.NL_EXTENABLED)return;let e=yield n();for(let t of e.connected)r("extensionReady",t)})))),i("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;i("extensionReady",(e=>t(this,void 0,void 0,(function*(){e.detail in d&&(yield p(d[e.detail]),delete d[e.detail])}))))}(),function(){a.addEventListener("message",(e=>{var t,n,o;const i=JSON.parse(e.data);i.id&&i.id in c?((null===(t=i.data)||void 0===t?void 0:t.error)?(c[i.id].reject(i.data.error),"NE_RT_INVTOKN"==i.data.error.code&&(a.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=i.data)||void 0===n?void 0:n.success)&&c[i.id].resolve(i.data.hasOwnProperty("returnValue")?i.data.returnValue:i.data),delete c[i.id]):i.event&&("openedFile"==i.event&&"dataBinary"==(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.action)&&(i.data.data=s(i.data.data)),r(i.event,i.data))})),a.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),a.addEventListener("close",(e=>t(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})})))),a.addEventListener("error",(e=>t(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function f(e,t){return new Promise(((n,o)=>{if((null==a?void 0:a.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void u.push(i);var i;const r="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),s=g();c[r]={resolve:n,reject:o},a.send(JSON.stringify({id:r,method:e,data:t,accessToken:s}))}))}function p(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){let t=e.shift();try{let e=yield f(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function g(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function w(e,t){return f("filesystem.writeBinaryFile",{path:e,data:m(t)})}function m(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var v,_,h={__proto__:null,createDirectory:function(e){return f("filesystem.createDirectory",{path:e})},remove:function(e){return f("filesystem.remove",{path:e})},writeFile:function(e,t){return f("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return f("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:w,appendBinaryFile:function(e,t){return f("filesystem.appendBinaryFile",{path:e,data:m(t)})},readFile:function(e,t){return f("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{f("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(s(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return f("filesystem.openFile",{path:e})},createWatcher:function(e){return f("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return f("filesystem.removeWatcher",{id:e})},getWatchers:function(){return f("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return f("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return f("filesystem.getOpenedFileInfo",{id:e})},readDirectory:function(e,t){return f("filesystem.readDirectory",Object.assign({path:e},t))},copy:function(e,t){return f("filesystem.copy",{source:e,destination:t})},move:function(e,t){return f("filesystem.move",{source:e,destination:t})},getStats:function(e){return f("filesystem.getStats",{path:e})}};function y(e,t){return f("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(v||(v={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(_||(_={}));var N={__proto__:null,get Icon(){return v},get MessageBoxChoice(){return _},execCommand:y,spawnProcess:function(e,t){return f("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return f("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return f("os.getSpawnedProcesses")},getEnv:function(e){return f("os.getEnv",{key:e})},getEnvs:function(){return f("os.getEnvs")},showOpenDialog:function(e,t){return f("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return f("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return f("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return f("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return f("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return f("os.setTray",e)},open:function(e){return f("os.open",{url:e})},getPath:function(e){return f("os.getPath",{name:e})}};var E={__proto__:null,getMemoryInfo:function(){return f("computer.getMemoryInfo")},getArch:function(){return f("computer.getArch")},getKernelInfo:function(){return f("computer.getKernelInfo")},getOSInfo:function(){return f("computer.getOSInfo")},getCPUInfo:function(){return f("computer.getCPUInfo")},getDisplays:function(){return f("computer.getDisplays")},getMousePosition:function(){return f("computer.getMousePosition")}};var O,R={__proto__:null,setData:function(e,t){return f("storage.setData",{key:e,data:t})},getData:function(e){return f("storage.getData",{key:e})},getKeys:function(){return f("storage.getKeys")}};function T(e,t){return f("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(O||(O={}));var P={__proto__:null,get LoggerType(){return O},log:T};function b(e){return f("app.exit",{code:e})}var L={__proto__:null,exit:b,killProcess:function(){return f("app.killProcess")},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield y(t,{background:!0}),b(),n()}))))},getConfig:function(){return f("app.getConfig")},broadcast:function(e,t){return f("app.broadcast",{event:e,data:t})},readProcessInput:function(e){return f("app.readProcessInput",{readAll:e})},writeProcessOutput:function(e){return f("app.writeProcessOutput",{data:e})},writeProcessError:function(e){return f("app.writeProcessError",{data:e})}};const S=new WeakMap;function I(e,t){return f("window.move",{x:e,y:t})}function D(){return f("window.getSize")}var C={__proto__:null,setTitle:function(e){return f("window.setTitle",{title:e})},getTitle:function(){return f("window.getTitle")},maximize:function(){return f("window.maximize")},unmaximize:function(){return f("window.unmaximize")},isMaximized:function(){return f("window.isMaximized")},minimize:function(){return f("window.minimize")},setFullScreen:function(){return f("window.setFullScreen")},exitFullScreen:function(){return f("window.exitFullScreen")},isFullScreen:function(){return f("window.isFullScreen")},show:function(){return f("window.show")},hide:function(){return f("window.hide")},isVisible:function(){return f("window.isVisible")},focus:function(){return f("window.focus")},setIcon:function(e){return f("window.setIcon",{icon:e})},move:I,center:function(){return f("window.center")},setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0,a=0,c=!1,u=performance.now();if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(S.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(e){return t(this,void 0,void 0,(function*(){if(c){const t=performance.now(),n=t-u;if(n<5)return;return u=t-(n-5),void(yield I(e.screenX-r,e.screenY-s))}a=Math.sqrt(e.movementX*e.movementX+e.movementY*e.movementY),a>=10&&(c=!0,i.setPointerCapture(e.pointerId))}))}function l(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",d))}function f(e){i.removeEventListener("pointermove",d),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",l),i.addEventListener("pointerup",f),S.set(i,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!S.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=S.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),S.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){let t=yield D();f("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:D,getPosition:function(){return f("window.getPosition")},setAlwaysOnTop:function(e){return f("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),y(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}};var x={__proto__:null,broadcast:function(e,t){return f("events.broadcast",{event:e,data:t})},on:i,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:r};let A=null;var F={__proto__:null,checkForUpdates:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){if(!e)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let t=yield fetch(e);A=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(A)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(A)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((e,n)=>t(this,void 0,void 0,(function*(){if(!A)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let t=yield fetch(A.resourcesURL),n=yield t.arrayBuffer();yield w(window.NL_PATH+"/resources.neu",n),e({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}};var M={__proto__:null,readText:function(e,t){return f("clipboard.readText",{key:e,data:t})},writeText:function(e){return f("clipboard.writeText",{data:e})}};var j={__proto__:null,getMethods:function(){return f("custom.getMethods")}};let U=!1;return e.app=L,e.clipboard=M,e.computer=E,e.custom=j,e.debug=P,e.events=x,e.extensions=o,e.filesystem=h,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!U){if(l(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield T("Reloading the application..."),location.reload()})))),e.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return f("custom."+e,n)};window.NL_CVERSION="5.0.0-nightly-20240129",window.NL_CCOMMIT="8ac7ce9a81b3001f5f185913760eff83c746eb5f",U=!0}},e.os=N,e.storage=R,e.updater=F,e.window=C,e}({});
{
"name": "@neutralinojs/lib",
"version": "3.13.0",
"version": "5.0.0-nightly-20240129",
"description": "JavaScript API for Neutralinojs",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc