@synnaxlabs/drift 0.40.1 → 0.41.0

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/electron.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var _=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./state-u8UjvjPJ.cjs"),H=require("./debounce-BUAIXXZt.cjs"),E="drift://action",p="drift://create",w="drift://focus",b="drift://close",I="drift://set-minimized",N="drift://set-maximized",z="drift://set-visible",y="drift://set-fullscreen",M="drift://center",O="drift://set-position",A="drift://set-size",g="drift://set-min-size",V="drift://set-max-size",x="drift://set-resizable",W="drift://set-skip-taskbar",P="drift://set-always-on-top",k="drift://set-title",L="drift://set-decorations",S="drift://get-props",D="drift://get-label",Z=[E,p,w,b,I,N,z,y,M,O,A,g,V,x,W,P,k,L,S],q=t=>{if(!Z.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},F=[E],U=t=>{if(!F.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},$=[S,D],G=t=>{if(!$.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},J=t=>{var e,o,r,l,u,d,m,f;return{x:(e=t.position)==null?void 0:e.x,y:(o=t.position)==null?void 0:o.y,width:(r=t.size)==null?void 0:r.width,height:(l=t.size)==null?void 0:l.height,center:t.center,minHeight:(u=t.minSize)==null?void 0:u.height,minWidth:(d=t.minSize)==null?void 0:d.width,maxHeight:(m=t.maxSize)==null?void 0:m.height,maxWidth:(f=t.maxSize)==null?void 0:f.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}},K=t=>{const[e,o]=t.getSize(),[r,l]=t.getPosition();return{size:{width:e,height:o},position:{x:r,y:l},minimized:t.isMinimized(),maximized:t.isMaximized(),fullscreen:t.isFullScreen(),visible:t.isVisible(),resizable:t.isResizable(),skipTaskbar:!1,title:t.getTitle(),alwaysOnTop:t.isAlwaysOnTop(),decorations:!1}},X=({mainWindow:t,createWindow:e})=>{const o=new Map,r=new Map;o.set(h.MAIN_WINDOW,t.id),r.set(t.id,h.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:u}=require("electron"),d=(s,i)=>l.on(s,(n,a)=>{const c=u.fromWebContents(n.sender);c!=null&&i(c,a)});l.on(b,(s,i)=>{const n=o.get(i);if(n==null)return;const a=u.fromId(n);a!=null&&(a.close(),o.delete(i),r.delete(n))}),l.handle(S,s=>{const i=u.fromWebContents(s.sender);return i==null?void 0:{...K(i),label:r.get(i.id)}}),l.handle(D,s=>{const i=u.fromWebContents(s.sender);if(i!=null)return r.get(i.id)});const m=(s,i,n)=>{s.on(i,H.o(n,500))},f=s=>{var i;for(const n of r.keys())(i=u.fromId(n))==null||i.webContents.send(E,s)},C=(s,i)=>{const n=(a,c)=>{m(i,a,()=>{f({action:h.runtimeSetWindowProps({label:s,...c(i)}),emitter:"WHITELIST"})})};n("resize",a=>{const[c,v]=a.getSize();return{size:{width:c,height:v}}}),n("move",()=>{const[a,c]=i.getPosition();return{position:{x:a,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",a=>(a.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(i.setWindowButtonVisibility(!1),{fullscreen:!1}))};C(h.MAIN_WINDOW,t),d(w,s=>s.focus()),d(I,s=>s.minimize()),d(N,s=>s.maximize()),d(z,(s,i)=>i?s.show():s.hide()),d(y,s=>s.setFullScreen(!0)),d(M,s=>s.center()),d(O,(s,{x:i,y:n})=>{s.setPosition(Math.round(i),Math.round(n))}),d(A,(s,{width:i,height:n})=>{s.setSize(Math.round(i),Math.round(n))}),d(g,(s,{width:i,height:n})=>s.setMinimumSize(Math.round(i),Math.round(n))),d(V,(s,{width:i,height:n})=>s.setMaximumSize(Math.round(i),Math.round(n))),d(x,(s,i)=>s.setResizable(i)),d(W,(s,i)=>s.setSkipTaskbar(i)),d(P,(s,i)=>s.setAlwaysOnTop(i)),d(k,(s,i)=>s.setTitle(i)),l.on(p,(s,i,n)=>{const a=e(J(n));o.set(i,a.id),r.set(a.id,i),C(i,a)}),l.on(E,(s,i,n)=>{if(i==null)return;if(n==null)return f(i);const a=o.get(n);if(a==null)return;const c=u.fromId(a);c!=null&&c.webContents.send(E,i)})},T="driftAPI",j=()=>{const{ipcRenderer:t,contextBridge:e}=require("electron"),o={send:(r,...l)=>{q(r),t.send(r,...l)},invoke:async(r,...l)=>(G(r),await t.invoke(r,...l)),on:(r,l)=>{U(r),t.on(r,l)}};e.exposeInMainWorld(T,o)},Y=async()=>{if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[T].invoke(D)};class Q{constructor(){_(this,"_label","");_(this,"props",null);_(this,"api");if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[T]}async configure(){const{label:e,...o}=await this.api.invoke(S);this._label=e,this.props=o}label(){return this._label}isMain(){return this._label===h.MAIN_WINDOW}release(){}async emit(e,o){this.api.send(E,{...e,emitter:this.label()},o)}async subscribe(e){this.api.on(E,(o,r)=>e(r))}onCloseRequested(){}async create(e,o){this.api.send(p,e,JSON.parse(JSON.stringify(o)))}async close(e){this.api.send(b,e)}async listLabels(){return[]}async focus(){this.api.send(w)}async setMinimized(e){this.api.send(I,e)}async setMaximized(e){this.api.send(N,e)}async setVisible(e){this.api.send(z,e)}async setFullscreen(e){this.api.send(y,e)}async center(){this.api.send(M)}async setPosition(e){this.api.send(O,e)}async setSize(e){this.api.send(A,e)}async setMinSize(e){this.api.send(g,e)}async setMaxSize(e){this.api.send(V,e)}async setResizable(e){this.api.send(x,e)}async setSkipTaskbar(e){this.api.send(W,e)}async setAlwaysOnTop(e){this.api.send(P,e)}async setTitle(e){this.api.send(k,e)}async setDecorations(e){this.api.send(L,e)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=Q;exports.exposeAPI=j;exports.getWindowLabel=Y;exports.listenOnMain=X;
1
+ "use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var _=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./state-DliTJ_c2.cjs"),H=require("./debounce-BUAIXXZt.cjs"),E="drift://action",p="drift://create",w="drift://focus",b="drift://close",I="drift://set-minimized",N="drift://set-maximized",z="drift://set-visible",y="drift://set-fullscreen",M="drift://center",O="drift://set-position",A="drift://set-size",g="drift://set-min-size",V="drift://set-max-size",x="drift://set-resizable",W="drift://set-skip-taskbar",P="drift://set-always-on-top",k="drift://set-title",L="drift://set-decorations",S="drift://get-props",D="drift://get-label",Z=[E,p,w,b,I,N,z,y,M,O,A,g,V,x,W,P,k,L,S],q=t=>{if(!Z.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},F=[E],U=t=>{if(!F.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},$=[S,D],G=t=>{if(!$.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},J=t=>{var e,o,r,l,u,d,m,f;return{x:(e=t.position)==null?void 0:e.x,y:(o=t.position)==null?void 0:o.y,width:(r=t.size)==null?void 0:r.width,height:(l=t.size)==null?void 0:l.height,center:t.center,minHeight:(u=t.minSize)==null?void 0:u.height,minWidth:(d=t.minSize)==null?void 0:d.width,maxHeight:(m=t.maxSize)==null?void 0:m.height,maxWidth:(f=t.maxSize)==null?void 0:f.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}},K=t=>{const[e,o]=t.getSize(),[r,l]=t.getPosition();return{size:{width:e,height:o},position:{x:r,y:l},minimized:t.isMinimized(),maximized:t.isMaximized(),fullscreen:t.isFullScreen(),visible:t.isVisible(),resizable:t.isResizable(),skipTaskbar:!1,title:t.getTitle(),alwaysOnTop:t.isAlwaysOnTop(),decorations:!1}},X=({mainWindow:t,createWindow:e})=>{const o=new Map,r=new Map;o.set(h.MAIN_WINDOW,t.id),r.set(t.id,h.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:u}=require("electron"),d=(s,i)=>l.on(s,(n,a)=>{const c=u.fromWebContents(n.sender);c!=null&&i(c,a)});l.on(b,(s,i)=>{const n=o.get(i);if(n==null)return;const a=u.fromId(n);a!=null&&(a.close(),o.delete(i),r.delete(n))}),l.handle(S,s=>{const i=u.fromWebContents(s.sender);return i==null?void 0:{...K(i),label:r.get(i.id)}}),l.handle(D,s=>{const i=u.fromWebContents(s.sender);if(i!=null)return r.get(i.id)});const m=(s,i,n)=>{s.on(i,H.o(n,500))},f=s=>{var i;for(const n of r.keys())(i=u.fromId(n))==null||i.webContents.send(E,s)},C=(s,i)=>{const n=(a,c)=>{m(i,a,()=>{f({action:h.runtimeSetWindowProps({label:s,...c(i)}),emitter:"WHITELIST"})})};n("resize",a=>{const[c,v]=a.getSize();return{size:{width:c,height:v}}}),n("move",()=>{const[a,c]=i.getPosition();return{position:{x:a,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",a=>(a.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(i.setWindowButtonVisibility(!1),{fullscreen:!1}))};C(h.MAIN_WINDOW,t),d(w,s=>s.focus()),d(I,s=>s.minimize()),d(N,s=>s.maximize()),d(z,(s,i)=>i?s.show():s.hide()),d(y,s=>s.setFullScreen(!0)),d(M,s=>s.center()),d(O,(s,{x:i,y:n})=>{s.setPosition(Math.round(i),Math.round(n))}),d(A,(s,{width:i,height:n})=>{s.setSize(Math.round(i),Math.round(n))}),d(g,(s,{width:i,height:n})=>s.setMinimumSize(Math.round(i),Math.round(n))),d(V,(s,{width:i,height:n})=>s.setMaximumSize(Math.round(i),Math.round(n))),d(x,(s,i)=>s.setResizable(i)),d(W,(s,i)=>s.setSkipTaskbar(i)),d(P,(s,i)=>s.setAlwaysOnTop(i)),d(k,(s,i)=>s.setTitle(i)),l.on(p,(s,i,n)=>{const a=e(J(n));o.set(i,a.id),r.set(a.id,i),C(i,a)}),l.on(E,(s,i,n)=>{if(i==null)return;if(n==null)return f(i);const a=o.get(n);if(a==null)return;const c=u.fromId(a);c!=null&&c.webContents.send(E,i)})},T="driftAPI",j=()=>{const{ipcRenderer:t,contextBridge:e}=require("electron"),o={send:(r,...l)=>{q(r),t.send(r,...l)},invoke:async(r,...l)=>(G(r),await t.invoke(r,...l)),on:(r,l)=>{U(r),t.on(r,l)}};e.exposeInMainWorld(T,o)},Y=async()=>{if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[T].invoke(D)};class Q{constructor(){_(this,"_label","");_(this,"props",null);_(this,"api");if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[T]}async configure(){const{label:e,...o}=await this.api.invoke(S);this._label=e,this.props=o}label(){return this._label}isMain(){return this._label===h.MAIN_WINDOW}release(){}async emit(e,o){this.api.send(E,{...e,emitter:this.label()},o)}async subscribe(e){this.api.on(E,(o,r)=>e(r))}onCloseRequested(){}async create(e,o){this.api.send(p,e,JSON.parse(JSON.stringify(o)))}async close(e){this.api.send(b,e)}async listLabels(){return[]}async focus(){this.api.send(w)}async setMinimized(e){this.api.send(I,e)}async setMaximized(e){this.api.send(N,e)}async setVisible(e){this.api.send(z,e)}async setFullscreen(e){this.api.send(y,e)}async center(){this.api.send(M)}async setPosition(e){this.api.send(O,e)}async setSize(e){this.api.send(A,e)}async setMinSize(e){this.api.send(g,e)}async setMaxSize(e){this.api.send(V,e)}async setResizable(e){this.api.send(x,e)}async setSkipTaskbar(e){this.api.send(W,e)}async setAlwaysOnTop(e){this.api.send(P,e)}async setTitle(e){this.api.send(k,e)}async setDecorations(e){this.api.send(L,e)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=Q;exports.exposeAPI=j;exports.getWindowLabel=Y;exports.listenOnMain=X;
package/dist/electron.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var R = Object.defineProperty;
2
2
  var B = (t, e, o) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
3
  var m = (t, e, o) => B(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { M as _, r as H } from "./state-B_nrpWi0.js";
4
+ import { M as _, r as H } from "./state-DO5anaj4.js";
5
5
  import { o as Z } from "./debounce-DOZKRZa9.js";
6
6
  const E = "drift://action", S = "drift://create", w = "drift://focus", z = "drift://close", b = "drift://set-minimized", y = "drift://set-maximized", I = "drift://set-visible", N = "drift://set-fullscreen", M = "drift://center", O = "drift://set-position", g = "drift://set-size", A = "drift://set-min-size", V = "drift://set-max-size", x = "drift://set-resizable", k = "drift://set-skip-taskbar", C = "drift://set-always-on-top", P = "drift://set-title", L = "drift://set-decorations", p = "drift://get-props", W = "drift://get-label", F = [
7
7
  E,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-u8UjvjPJ.cjs"),f=require("./selectors-DsoUWQIE.cjs"),A=new Error("request for lock canceled");var C=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class L{constructor(e,s=A){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},r=E(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return C(this,arguments,void 0,function*(s,o=1,n=0){const[a,r]=yield this.acquire(o,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),N(this._weightedWaiters[e-1],{resolve:o,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function N(i,e){const s=E(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function E(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var P=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class q{constructor(e){this._semaphore=new L(1,e)}acquire(){return P(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const D=i=>[...new Set(i)],R=(i,e,s=!0)=>{const o=new Map;return i.forEach(n=>{const a=e(n);if(o.has(a)){if(s)return;o.delete(a)}o.set(a,n)}),Array.from(o.values())},F=Object.freeze(Object.defineProperty({__proto__:null,by:R,unique:D},Symbol.toStringTag,{value:"Module"})),T="DA@",I="://",V=(i,e)=>T.concat(e,I,i),j=i=>{const[e,s]=i.split(I);if(s==null)return[i,""];const[,o]=e.split(T);return[s,o]},b=(i,e)=>({...i,type:V(i.type,e)}),Z=i=>{const[e,s]=j(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},U=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},K=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(c=>c!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const r=F.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(t.log(o,"state window not in runtime, creating",c),await k(s,c,i.windows[c],o)):a.includes(c)||(t.log(o,"runtime window not in state, closing",c),await p(s,c,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await M(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},Q=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await X(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await M(n,a,s,o)},M=async(i,e,s,o)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(t.G.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!t._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)t.log(o,d,u,"->",c);t.groupEnd(o);for(const[,,d]of n)await d()}},X=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await p(s,d,o))),await p(s,l,o);if(r&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,U(s))),p=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",y=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},$=new q,G=[t.runtimeSetWindowProps.type,t.reloadWindow.type],Y=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:r,emitter:l}=Z(n);const d=i.label();y({action:n,emitted:r,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!G.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=c?s.getState().drift:null,W=t.shouldEmit(r,a.type);return $.runExclusive(async()=>{try{w!==null&&_!==null&&await Q(w,_,i,e),W&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},B=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[Y(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=O.configureStore({...r,preloadedState:await J(o,i,()=>l,a,e),middleware:B(s,i,o)}),await K(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(t.closeWindow({}))),l},J=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){y({action:r,emitter:l}),u.dispatch(b(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const h=s();if(h==null)return w!=null?r(w):void 0;u!=null&&(y({action:u,emitter:c}),h.dispatch(b(u,c)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),v=H,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},x=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:v,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=x;exports.configureStore=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-DliTJ_c2.cjs"),f=require("./selectors-DPMyygQa.cjs"),A=new Error("request for lock canceled");var C=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class L{constructor(e,s=A){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},r=E(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return C(this,arguments,void 0,function*(s,o=1,n=0){const[a,r]=yield this.acquire(o,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),N(this._weightedWaiters[e-1],{resolve:o,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function N(i,e){const s=E(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function E(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var P=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class q{constructor(e){this._semaphore=new L(1,e)}acquire(){return P(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const D=i=>[...new Set(i)],R=(i,e,s=!0)=>{const o=new Map;return i.forEach(n=>{const a=e(n);if(o.has(a)){if(s)return;o.delete(a)}o.set(a,n)}),Array.from(o.values())},F=Object.freeze(Object.defineProperty({__proto__:null,by:R,unique:D},Symbol.toStringTag,{value:"Module"})),T="DA@",I="://",V=(i,e)=>T.concat(e,I,i),j=i=>{const[e,s]=i.split(I);if(s==null)return[i,""];const[,o]=e.split(T);return[s,o]},b=(i,e)=>({...i,type:V(i.type,e)}),Z=i=>{const[e,s]=j(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},U=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},K=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(c=>c!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const r=F.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(t.log(o,"state window not in runtime, creating",c),await k(s,c,i.windows[c],o)):a.includes(c)||(t.log(o,"runtime window not in state, closing",c),await p(s,c,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await M(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},Q=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await X(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await M(n,a,s,o)},M=async(i,e,s,o)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(t.J.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!t._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)t.log(o,d,u,"->",c);t.groupEnd(o);for(const[,,d]of n)await d()}},X=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await p(s,d,o))),await p(s,l,o);if(r&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,U(s))),p=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",y=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},$=new q,J=[t.runtimeSetWindowProps.type,t.reloadWindow.type],Y=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:r,emitter:l}=Z(n);const d=i.label();y({action:n,emitted:r,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!J.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=c?s.getState().drift:null,W=t.shouldEmit(r,a.type);return $.runExclusive(async()=>{try{w!==null&&_!==null&&await Q(w,_,i,e),W&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},B=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[Y(e,s),...n]},G=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=O.configureStore({...r,preloadedState:await H(o,i,()=>l,a,e),middleware:B(s,i,o)}),await K(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(t.closeWindow({}))),l},H=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){y({action:r,emitter:l}),u.dispatch(b(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const h=s();if(h==null)return w!=null?r(w):void 0;u!=null&&(y({action:u,emitter:c}),h.dispatch(b(u,c)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),v=G,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},x=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:v,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=x;exports.configureStore=v;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { configureStore as j } from "@reduxjs/toolkit";
2
- import { M as w, g, l as d, a as T, r as E, _ as p, G as F, I as N, b as I, i as V, c as $, s as U, d as Q, e as Z, f as C, h as q, S as M, Z as K, j as X, k as B, m as G, n as Y, o as H, p as J, q as x, t as W, u as ee, v as se, w as ie, x as te, y as ae, z as oe, A as ne, B as le, C as re, D as ce, E as ue, F as fe } from "./state-B_nrpWi0.js";
3
- import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-CVXi0LBk.js";
2
+ import { M as w, g, l as d, a as T, r as E, _ as p, J as F, I as N, b as I, i as V, c as $, s as U, d as Q, e as Z, f as C, h as q, S as M, Z as K, j as X, k as B, m as J, n as Y, o as G, p as H, q as x, t as W, u as ee, v as se, w as ie, x as te, y as ae, z as oe, A as ne, B as le, C as re, D as ce, E as ue, F as fe } from "./state-DO5anaj4.js";
3
+ import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-BJ5IDnos.js";
4
4
  const be = new Error("request for lock canceled");
5
5
  var me = function(i, e, s, t) {
6
6
  function a(o) {
@@ -426,9 +426,9 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
426
426
  completeProcess: X,
427
427
  configureStore: Ve,
428
428
  createWindow: B,
429
- focusWindow: G,
429
+ focusWindow: J,
430
430
  reducer: Y,
431
- registerProcess: H,
431
+ registerProcess: G,
432
432
  reloadWindow: I,
433
433
  selectSliceState: de,
434
434
  selectWindow: we,
@@ -436,7 +436,7 @@ const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
436
436
  selectWindowKey: pe,
437
437
  selectWindowLabel: ye,
438
438
  selectWindows: _e,
439
- setWindowAlwaysOnTop: J,
439
+ setWindowAlwaysOnTop: H,
440
440
  setWindowDecorations: x,
441
441
  setWindowFullscreen: W,
442
442
  setWindowMaxSize: ee,
@@ -462,9 +462,9 @@ export {
462
462
  X as completeProcess,
463
463
  Ve as configureStore,
464
464
  B as createWindow,
465
- G as focusWindow,
465
+ J as focusWindow,
466
466
  Y as reducer,
467
- H as registerProcess,
467
+ G as registerProcess,
468
468
  I as reloadWindow,
469
469
  de as selectSliceState,
470
470
  we as selectWindow,
@@ -472,7 +472,7 @@ export {
472
472
  pe as selectWindowKey,
473
473
  ye as selectWindowLabel,
474
474
  _e as selectWindows,
475
- J as setWindowAlwaysOnTop,
475
+ H as setWindowAlwaysOnTop,
476
476
  x as setWindowDecorations,
477
477
  W as setWindowFullscreen,
478
478
  ee as setWindowMaxSize,
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-DsoUWQIE.cjs"),i=require("./state-u8UjvjPJ.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-DPMyygQa.cjs"),i=require("./state-DliTJ_c2.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
package/dist/react.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { useCallback as l, useRef as f, useEffect as m, useState as d, createElement as W } from "react";
2
2
  import { useSelector as u, useDispatch as y, Provider as g } from "react-redux";
3
3
  import { memoize as i } from "proxy-memoize";
4
- import { a as k, e as S, c as P, b as v } from "./selectors-CVXi0LBk.js";
5
- import { o as w, j as p } from "./state-B_nrpWi0.js";
4
+ import { a as k, e as S, c as P, b as v } from "./selectors-BJ5IDnos.js";
5
+ import { o as w, j as p } from "./state-DO5anaj4.js";
6
6
  const h = (e) => u(
7
7
  l(
8
8
  i((r) => k(r, e)),
@@ -1,4 +1,4 @@
1
- import { M as i } from "./state-B_nrpWi0.js";
1
+ import { M as i } from "./state-DO5anaj4.js";
2
2
  const l = (n) => n.drift, a = (n) => Object.values(l(n).windows), r = (n, e) => {
3
3
  const t = l(n);
4
4
  if (e == null) return t.windows[t.label];
@@ -1 +1 @@
1
- "use strict";const i=require("./state-u8UjvjPJ.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},u=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},w=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},d=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=w;exports.selectWindowKey=u;exports.selectWindowLabel=d;exports.selectWindows=r;
1
+ "use strict";const i=require("./state-DliTJ_c2.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},u=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},w=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},d=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=w;exports.selectWindowKey=u;exports.selectWindowLabel=d;exports.selectWindows=r;