@synnaxlabs/drift 0.44.0 → 0.44.2

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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./state-yfMrLzJG.cjs"),v=require("./debounce-BUAIXXZt.cjs"),u="drift://action",m="drift://create",_="drift://focus",S="drift://close",p="drift://set-minimized",w="drift://set-maximized",b="drift://set-visible",I="drift://set-fullscreen",N="drift://center",z="drift://set-position",y="drift://set-size",M="drift://set-min-size",O="drift://set-max-size",A="drift://set-resizable",g="drift://set-skip-taskbar",V="drift://set-always-on-top",x="drift://set-title",D="drift://set-decorations",T="drift://get-props",W="drift://get-label",R=[u,m,_,S,p,w,b,I,N,z,y,M,O,A,g,V,x,D,T],B=t=>{if(!R.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},H=[u],Z=t=>{if(!H.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},q=[T,W],F=t=>{if(!q.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},U=t=>({x:t.position?.x,y:t.position?.y,width:t.size?.width,height:t.size?.height,center:t.center,minHeight:t.minSize?.height,minWidth:t.minSize?.width,maxHeight:t.maxSize?.height,maxWidth:t.maxSize?.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}),$=t=>{const[s,a]=t.getSize(),[o,l]=t.getPosition();return{size:{width:s,height:a},position:{x:o,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}},G=({mainWindow:t,createWindow:s})=>{const a=new Map,o=new Map;a.set(f.MAIN_WINDOW,t.id),o.set(t.id,f.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:E}=require("electron"),d=(i,e)=>l.on(i,(n,r)=>{const c=E.fromWebContents(n.sender);c!=null&&e(c,r)});l.on(S,(i,e)=>{const n=a.get(e);if(n==null)return;const r=E.fromId(n);r!=null&&(r.close(),a.delete(e),o.delete(n))}),l.handle(T,i=>{const e=E.fromWebContents(i.sender);return e==null?void 0:{...$(e),label:o.get(e.id)}}),l.handle(W,i=>{const e=E.fromWebContents(i.sender);if(e!=null)return o.get(e.id)});const C=(i,e,n)=>{i.on(e,v.o(n,500))},P=i=>{for(const e of o.keys())E.fromId(e)?.webContents.send(u,i)},k=(i,e)=>{const n=(r,c)=>{C(e,r,()=>{P({action:f.runtimeSetWindowProps({label:i,...c(e)}),emitter:"WHITELIST"})})};n("resize",r=>{const[c,L]=r.getSize();return{size:{width:c,height:L}}}),n("move",()=>{const[r,c]=e.getPosition();return{position:{x:r,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",r=>(r.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(e.setWindowButtonVisibility(!1),{fullscreen:!1}))};k(f.MAIN_WINDOW,t),d(_,i=>i.focus()),d(p,i=>i.minimize()),d(w,i=>i.maximize()),d(b,(i,e)=>e?i.show():i.hide()),d(I,i=>i.setFullScreen(!0)),d(N,i=>i.center()),d(z,(i,{x:e,y:n})=>{i.setPosition(Math.round(e),Math.round(n))}),d(y,(i,{width:e,height:n})=>{i.setSize(Math.round(e),Math.round(n))}),d(M,(i,{width:e,height:n})=>i.setMinimumSize(Math.round(e),Math.round(n))),d(O,(i,{width:e,height:n})=>i.setMaximumSize(Math.round(e),Math.round(n))),d(A,(i,e)=>i.setResizable(e)),d(g,(i,e)=>i.setSkipTaskbar(e)),d(V,(i,e)=>i.setAlwaysOnTop(e)),d(x,(i,e)=>i.setTitle(e)),l.on(m,(i,e,n)=>{const r=s(U(n));a.set(e,r.id),o.set(r.id,e),k(e,r)}),l.on(u,(i,e,n)=>{if(e==null)return;if(n==null)return P(e);const r=a.get(n);if(r==null)return;const c=E.fromId(r);c?.webContents.send(u,e)})},h="driftAPI",J=()=>{const{ipcRenderer:t,contextBridge:s}=require("electron"),a={send:(o,...l)=>{B(o),t.send(o,...l)},invoke:async(o,...l)=>(F(o),await t.invoke(o,...l)),on:(o,l)=>{Z(o),t.on(o,l)}};s.exposeInMainWorld(h,a)},K=async()=>{if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[h].invoke(W)};class X{_label="";props=null;api;constructor(){if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[h]}async configure(){const{label:s,...a}=await this.api.invoke(T);this._label=s,this.props=a}label(){return this._label}isMain(){return this._label===f.MAIN_WINDOW}release(){}async emit(s,a){this.api.send(u,{...s,emitter:this.label()},a)}async subscribe(s){this.api.on(u,(a,o)=>s(o))}onCloseRequested(){}async create(s,a){this.api.send(m,s,JSON.parse(JSON.stringify(a)))}async close(s){this.api.send(S,s)}async listLabels(){return[]}async focus(){this.api.send(_)}async setMinimized(s){this.api.send(p,s)}async setMaximized(s){this.api.send(w,s)}async setVisible(s){this.api.send(b,s)}async setFullscreen(s){this.api.send(I,s)}async center(){this.api.send(N)}async setPosition(s){this.api.send(z,s)}async setSize(s){this.api.send(y,s)}async setMinSize(s){this.api.send(M,s)}async setMaxSize(s){this.api.send(O,s)}async setResizable(s){this.api.send(A,s)}async setSkipTaskbar(s){this.api.send(g,s)}async setAlwaysOnTop(s){this.api.send(V,s)}async setTitle(s){this.api.send(x,s)}async setDecorations(s){this.api.send(D,s)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=X;exports.exposeAPI=J;exports.getWindowLabel=K;exports.listenOnMain=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./state-pRw1_Nwc.cjs"),v=require("./debounce-BUAIXXZt.cjs"),u="drift://action",m="drift://create",_="drift://focus",S="drift://close",p="drift://set-minimized",w="drift://set-maximized",b="drift://set-visible",I="drift://set-fullscreen",N="drift://center",z="drift://set-position",y="drift://set-size",M="drift://set-min-size",O="drift://set-max-size",A="drift://set-resizable",g="drift://set-skip-taskbar",V="drift://set-always-on-top",x="drift://set-title",D="drift://set-decorations",T="drift://get-props",W="drift://get-label",R=[u,m,_,S,p,w,b,I,N,z,y,M,O,A,g,V,x,D,T],B=t=>{if(!R.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},H=[u],Z=t=>{if(!H.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},q=[T,W],F=t=>{if(!q.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},U=t=>({x:t.position?.x,y:t.position?.y,width:t.size?.width,height:t.size?.height,center:t.center,minHeight:t.minSize?.height,minWidth:t.minSize?.width,maxHeight:t.maxSize?.height,maxWidth:t.maxSize?.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}),$=t=>{const[s,a]=t.getSize(),[o,l]=t.getPosition();return{size:{width:s,height:a},position:{x:o,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}},G=({mainWindow:t,createWindow:s})=>{const a=new Map,o=new Map;a.set(f.MAIN_WINDOW,t.id),o.set(t.id,f.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:E}=require("electron"),d=(i,e)=>l.on(i,(n,r)=>{const c=E.fromWebContents(n.sender);c!=null&&e(c,r)});l.on(S,(i,e)=>{const n=a.get(e);if(n==null)return;const r=E.fromId(n);r!=null&&(r.close(),a.delete(e),o.delete(n))}),l.handle(T,i=>{const e=E.fromWebContents(i.sender);return e==null?void 0:{...$(e),label:o.get(e.id)}}),l.handle(W,i=>{const e=E.fromWebContents(i.sender);if(e!=null)return o.get(e.id)});const C=(i,e,n)=>{i.on(e,v.o(n,500))},P=i=>{for(const e of o.keys())E.fromId(e)?.webContents.send(u,i)},k=(i,e)=>{const n=(r,c)=>{C(e,r,()=>{P({action:f.runtimeSetWindowProps({label:i,...c(e)}),emitter:"WHITELIST"})})};n("resize",r=>{const[c,L]=r.getSize();return{size:{width:c,height:L}}}),n("move",()=>{const[r,c]=e.getPosition();return{position:{x:r,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",r=>(r.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(e.setWindowButtonVisibility(!1),{fullscreen:!1}))};k(f.MAIN_WINDOW,t),d(_,i=>i.focus()),d(p,i=>i.minimize()),d(w,i=>i.maximize()),d(b,(i,e)=>e?i.show():i.hide()),d(I,i=>i.setFullScreen(!0)),d(N,i=>i.center()),d(z,(i,{x:e,y:n})=>{i.setPosition(Math.round(e),Math.round(n))}),d(y,(i,{width:e,height:n})=>{i.setSize(Math.round(e),Math.round(n))}),d(M,(i,{width:e,height:n})=>i.setMinimumSize(Math.round(e),Math.round(n))),d(O,(i,{width:e,height:n})=>i.setMaximumSize(Math.round(e),Math.round(n))),d(A,(i,e)=>i.setResizable(e)),d(g,(i,e)=>i.setSkipTaskbar(e)),d(V,(i,e)=>i.setAlwaysOnTop(e)),d(x,(i,e)=>i.setTitle(e)),l.on(m,(i,e,n)=>{const r=s(U(n));a.set(e,r.id),o.set(r.id,e),k(e,r)}),l.on(u,(i,e,n)=>{if(e==null)return;if(n==null)return P(e);const r=a.get(n);if(r==null)return;const c=E.fromId(r);c?.webContents.send(u,e)})},h="driftAPI",J=()=>{const{ipcRenderer:t,contextBridge:s}=require("electron"),a={send:(o,...l)=>{B(o),t.send(o,...l)},invoke:async(o,...l)=>(F(o),await t.invoke(o,...l)),on:(o,l)=>{Z(o),t.on(o,l)}};s.exposeInMainWorld(h,a)},K=async()=>{if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[h].invoke(W)};class X{_label="";props=null;api;constructor(){if(!(h in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[h]}async configure(){const{label:s,...a}=await this.api.invoke(T);this._label=s,this.props=a}label(){return this._label}isMain(){return this._label===f.MAIN_WINDOW}release(){}async emit(s,a){this.api.send(u,{...s,emitter:this.label()},a)}async subscribe(s){this.api.on(u,(a,o)=>s(o))}onCloseRequested(){}async create(s,a){this.api.send(m,s,JSON.parse(JSON.stringify(a)))}async close(s){this.api.send(S,s)}async listLabels(){return[]}async focus(){this.api.send(_)}async setMinimized(s){this.api.send(p,s)}async setMaximized(s){this.api.send(w,s)}async setVisible(s){this.api.send(b,s)}async setFullscreen(s){this.api.send(I,s)}async center(){this.api.send(N)}async setPosition(s){this.api.send(z,s)}async setSize(s){this.api.send(y,s)}async setMinSize(s){this.api.send(M,s)}async setMaxSize(s){this.api.send(O,s)}async setResizable(s){this.api.send(A,s)}async setSkipTaskbar(s){this.api.send(g,s)}async setAlwaysOnTop(s){this.api.send(V,s)}async setTitle(s){this.api.send(x,s)}async setDecorations(s){this.api.send(D,s)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=X;exports.exposeAPI=J;exports.getWindowLabel=K;exports.listenOnMain=G;
package/dist/electron.js CHANGED
@@ -1,4 +1,4 @@
1
- import { M as h, r as v } from "./state-D41-Dai4.js";
1
+ import { M as h, r as v } from "./state-Ca5Yd_KX.js";
2
2
  import { o as R } from "./debounce-DOZKRZa9.js";
3
3
  const u = "drift://action", m = "drift://create", _ = "drift://focus", p = "drift://close", S = "drift://set-minimized", w = "drift://set-maximized", z = "drift://set-visible", b = "drift://set-fullscreen", y = "drift://center", I = "drift://set-position", N = "drift://set-size", M = "drift://set-min-size", O = "drift://set-max-size", g = "drift://set-resizable", A = "drift://set-skip-taskbar", V = "drift://set-always-on-top", x = "drift://set-title", W = "drift://set-decorations", T = "drift://get-props", k = "drift://get-label", B = [
4
4
  u,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@reduxjs/toolkit"),t=require("./state-yfMrLzJG.cjs"),f=require("./selectors-2mPd0CjI.cjs"),P=new Error("request for lock canceled");var N=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class C{constructor(e,s=P){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},c=T(this._queue,l=>s<=l.priority);c===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(c+1,0,a)})}runExclusive(e){return N(this,arguments,void 0,function*(s,o=1,n=0){const[a,c]=yield this.acquire(o,n);try{return yield s(a)}finally{c()}})}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]=[]),L(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 L(i,e){const s=T(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function T(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var q=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new C(1,e)}acquire(){return q(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 R=i=>[...new Set(i)],F=(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())},V=Object.freeze(Object.defineProperty({__proto__:null,by:F,unique:R},Symbol.toStringTag,{value:"Module"})),M="DA@",E="://",j=(i,e)=>M.concat(e,E,i),Z=i=>{const[e,s]=i.split(E);if(s==null)return[i,""];const[,o]=e.split(M);return[s,o]},b=(i,e)=>({...i,type:j(i.type,e)}),U=i=>{const[e,s]=Z(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},K=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:c,reserved:l,minimized:d,...u}=i;return u},Q=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(r=>r!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(r=>r!==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 c=V.unique([...n,...a]);for(const r of c)!n.includes(r)&&s.isMain()?(t.log(o,"state window not in runtime, creating",r),await k(s,r,i.windows[r],o)):a.includes(r)||(t.log(o,"runtime window not in state, closing",r),await y(s,r,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await I(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},X=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await $(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await I(n,a,s,o)},I=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,c=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??=(await s.getProps()).position,d!=null&&(await s.setPosition(t.J.translate(d,{x:1,y:1})),await s.setPosition(d))}]);if(a&&c&&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&&!c&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:r}]of n)t.log(o,d,u,"->",r);t.groupEnd(o);for(const[,,d]of n)await d()}},$=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)),c=s.isMain();if(c&&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 y(s,d,o))),await y(s,l,o);if(c&&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,K(s))),y=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",p=i=>{if(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)},J=new D,Y=[t.runtimeSetWindowProps.type,t.reloadWindow.type],B=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:c,emitter:l}=U(n);const d=i.label();p({action:n,emitted:c,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:c,emitter:l,host:d}),l===i.label())return;const r=u&&!Y.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=r?s.getState().drift:null,O=t.shouldEmit(c,a.type);return J.runExclusive(async()=>{try{w!==null&&_!==null&&await X(w,_,i,e),O&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:c,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},G=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[B(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...c})=>{await i.configure();let l;l=A.configureStore({...c,preloadedState:await x(o,i,()=>l,a,e),middleware:G(s,i,o)}),await Q(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?.dispatch(t.closeWindow({}))),l},x=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:c,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(c!=null){p({action:c,emitter:l}),u.dispatch(b(c,l));return}const r=u.getState();d===!0&&e.emit({state:r},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((c,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:r,state:w})=>{const h=s();if(h==null)return w!=null?c(w):void 0;u!=null&&(p({action:u,emitter:r}),h.dispatch(b(u,r)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),W=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?.visible!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s};class v{async emit(){}async subscribe(){}isMain(){return!0}label(){return t.MAIN_WINDOW}onCloseRequested(){}async listLabels(){return[]}async getProps(){return{}}async create(){}async close(){}async focus(){}async setMinimized(){}async setMaximized(){}async setVisible(){}async setFullscreen(){}async center(){}async setPosition(){}async setSize(){}async setMinSize(){}async setMaxSize(){}async setResizable(){}async setSkipTaskbar(){}async setAlwaysOnTop(){}async setDecorations(){}async setTitle(){}async configure(){}}const ee=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,NoopRuntime:v,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:W,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=ee;exports.NoopRuntime=v;exports.configureStore=W;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@reduxjs/toolkit"),t=require("./state-pRw1_Nwc.cjs"),f=require("./selectors-Cwz1BBM-.cjs"),P=new Error("request for lock canceled");var N=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class C{constructor(e,s=P){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},c=T(this._queue,l=>s<=l.priority);c===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(c+1,0,a)})}runExclusive(e){return N(this,arguments,void 0,function*(s,o=1,n=0){const[a,c]=yield this.acquire(o,n);try{return yield s(a)}finally{c()}})}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]=[]),L(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 L(i,e){const s=T(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function T(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var q=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function l(r){try{u(o.next(r))}catch(w){c(w)}}function d(r){try{u(o.throw(r))}catch(w){c(w)}}function u(r){r.done?a(r.value):n(r.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class D{constructor(e){this._semaphore=new C(1,e)}acquire(){return q(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 R=i=>[...new Set(i)],F=(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())},V=Object.freeze(Object.defineProperty({__proto__:null,by:F,unique:R},Symbol.toStringTag,{value:"Module"})),M="DA@",E="://",j=(i,e)=>M.concat(e,E,i),Z=i=>{const[e,s]=i.split(E);if(s==null)return[i,""];const[,o]=e.split(M);return[s,o]},b=(i,e)=>({...i,type:j(i.type,e)}),U=i=>{const[e,s]=Z(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},K=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:c,reserved:l,minimized:d,...u}=i;return u},Q=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(r=>r!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(r=>r!==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 c=V.unique([...n,...a]);for(const r of c)!n.includes(r)&&s.isMain()?(t.log(o,"state window not in runtime, creating",r),await k(s,r,i.windows[r],o)):a.includes(r)||(t.log(o,"runtime window not in state, closing",r),await y(s,r,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await I(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},X=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await $(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await I(n,a,s,o)},I=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,c=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??=(await s.getProps()).position,d!=null&&(await s.setPosition(t.K.translate(d,{x:1,y:1})),await s.setPosition(d))}]);if(a&&c&&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&&!c&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:r}]of n)t.log(o,d,u,"->",r);t.groupEnd(o);for(const[,,d]of n)await d()}},$=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)),c=s.isMain();if(c&&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 y(s,d,o))),await y(s,l,o);if(c&&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,K(s))),y=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",p=i=>{if(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)},Y=new D,B=[t.runtimeSetWindowProps.type,t.reloadWindow.type],G=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:c,emitter:l}=U(n);const d=i.label();p({action:n,emitted:c,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:c,emitter:l,host:d}),l===i.label())return;const r=u&&!B.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=r?s.getState().drift:null,O=t.shouldEmit(c,a.type);return Y.runExclusive(async()=>{try{w!==null&&_!==null&&await X(w,_,i,e),O&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:c,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},H=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[G(e,s),...n]},J=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...c})=>{await i.configure();let l;l=A.configureStore({...c,preloadedState:await x(o,i,()=>l,a,e),middleware:H(s,i,o)}),await Q(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?.dispatch(t.closeWindow({}))),l},x=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:c,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(c!=null){p({action:c,emitter:l}),u.dispatch(b(c,l));return}const r=u.getState();d===!0&&e.emit({state:r},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((c,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:r,state:w})=>{const h=s();if(h==null)return w!=null?c(w):void 0;u!=null&&(p({action:u,emitter:r}),h.dispatch(b(u,r)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),W=J,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?.visible!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s};class v{async emit(){}async subscribe(){}isMain(){return!0}label(){return t.MAIN_WINDOW}onCloseRequested(){}async listLabels(){return[]}async getProps(){return{}}async create(){}async close(){}async focus(){}async setMinimized(){}async setMaximized(){}async setVisible(){}async setFullscreen(){}async center(){}async setPosition(){}async setSize(){}async setMinSize(){}async setMaxSize(){}async setResizable(){}async setSkipTaskbar(){}async setAlwaysOnTop(){}async setDecorations(){}async setTitle(){}async configure(){}}const ee=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,NoopRuntime:v,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:W,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=ee;exports.NoopRuntime=v;exports.configureStore=W;
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 y, J as F, I as N, b as M, i as V, c as $, s as U, d as Q, e as Z, f as I, h as C, S as q, 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 te, x as ie, y as ae, z as oe, A as ne, B as ce, C as le, D as re, E as ue, F as fe } from "./state-D41-Dai4.js";
3
- import { s as de, a as we, b as he, c as ye, d as pe, e as _e } from "./selectors-C36jHClh.js";
2
+ import { M as w, g, l as d, a as T, r as E, _ as y, K as F, I as N, b as M, i as V, c as $, s as U, d as K, e as Q, f as I, h as C, S as q, Z, j as X, k as B, m as Y, n as G, o as H, p as J, q as x, t as W, u as ee, v as se, w as te, x as ie, y as ae, z as oe, A as ne, B as ce, C as le, D as re, E as ue, F as fe } from "./state-Ca5Yd_KX.js";
3
+ import { s as de, a as we, b as he, c as ye, d as pe, e as _e } from "./selectors-VFn-iYrs.js";
4
4
  const be = new Error("request for lock canceled");
5
5
  var me = function(t, e, s, i) {
6
6
  function a(o) {
@@ -357,7 +357,7 @@ const ge = (t) => [...new Set(t)], Te = (t, e, s = !0) => {
357
357
  emitted: c,
358
358
  emitter: n,
359
359
  host: r
360
- }), s.dispatch(Q({ key: r, message: m.message }));
360
+ }), s.dispatch(K({ key: r, message: m.message }));
361
361
  }
362
362
  }), h;
363
363
  }, je = (t, e, s = !1) => (i) => {
@@ -387,7 +387,7 @@ const ge = (t) => [...new Set(t)], Te = (t, e, s = !0) => {
387
387
  }), await Oe(n.getState().drift, n.dispatch, t, i);
388
388
  const r = t.label();
389
389
  return n.dispatch(
390
- Z({ enablePrerender: a, defaultWindowProps: o, debug: i, label: r })
390
+ Q({ enablePrerender: a, defaultWindowProps: o, debug: i, label: r })
391
391
  ), n.dispatch(I({ stage: "created" })), t.onCloseRequested(() => n?.dispatch(C({}))), n;
392
392
  }, Ne = async (t, e, s, i, a) => e.isMain() ? (await e.subscribe(({ action: c, emitter: n, sendState: r }) => {
393
393
  const u = s();
@@ -474,19 +474,19 @@ class $e {
474
474
  async configure() {
475
475
  }
476
476
  }
477
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
477
+ const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
478
478
  __proto__: null,
479
479
  MAIN_WINDOW: w,
480
480
  NoopRuntime: $e,
481
481
  SLICE_NAME: q,
482
- ZERO_SLICE_STATE: K,
482
+ ZERO_SLICE_STATE: Z,
483
483
  closeWindow: C,
484
484
  completeProcess: X,
485
485
  configureStore: Ve,
486
486
  createWindow: B,
487
- focusWindow: J,
488
- reducer: Y,
489
- registerProcess: G,
487
+ focusWindow: Y,
488
+ reducer: G,
489
+ registerProcess: H,
490
490
  reloadWindow: M,
491
491
  selectSliceState: de,
492
492
  selectWindow: we,
@@ -494,7 +494,7 @@ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
494
494
  selectWindowKey: ye,
495
495
  selectWindowLabel: pe,
496
496
  selectWindows: _e,
497
- setWindowAlwaysOnTop: H,
497
+ setWindowAlwaysOnTop: J,
498
498
  setWindowDecorations: x,
499
499
  setWindowFullscreen: W,
500
500
  setWindowMaxSize: ee,
@@ -512,18 +512,18 @@ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
512
512
  windowPropsZ: fe
513
513
  }, Symbol.toStringTag, { value: "Module" }));
514
514
  export {
515
- Ke as Drift,
515
+ Ze as Drift,
516
516
  w as MAIN_WINDOW,
517
517
  $e as NoopRuntime,
518
518
  q as SLICE_NAME,
519
- K as ZERO_SLICE_STATE,
519
+ Z as ZERO_SLICE_STATE,
520
520
  C as closeWindow,
521
521
  X as completeProcess,
522
522
  Ve as configureStore,
523
523
  B as createWindow,
524
- J as focusWindow,
525
- Y as reducer,
526
- G as registerProcess,
524
+ Y as focusWindow,
525
+ G as reducer,
526
+ H as registerProcess,
527
527
  M as reloadWindow,
528
528
  de as selectSliceState,
529
529
  we as selectWindow,
@@ -531,7 +531,7 @@ export {
531
531
  ye as selectWindowKey,
532
532
  pe as selectWindowLabel,
533
533
  _e as selectWindows,
534
- H as setWindowAlwaysOnTop,
534
+ J as setWindowAlwaysOnTop,
535
535
  x as setWindowDecorations,
536
536
  W as setWindowFullscreen,
537
537
  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-2mPd0CjI.cjs"),i=require("./state-yfMrLzJG.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-Cwz1BBM-.cjs"),i=require("./state-pRw1_Nwc.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-C36jHClh.js";
5
- import { o as w, j as p } from "./state-D41-Dai4.js";
4
+ import { a as k, e as S, c as P, b as v } from "./selectors-VFn-iYrs.js";
5
+ import { o as w, j as p } from "./state-Ca5Yd_KX.js";
6
6
  const h = (e) => u(
7
7
  l(
8
8
  i((r) => k(r, e)),
@@ -1 +1 @@
1
- "use strict";const i=require("./state-yfMrLzJG.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)=>c(n,e)?.[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-pRw1_Nwc.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)=>c(n,e)?.[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,4 +1,4 @@
1
- import { M as i } from "./state-D41-Dai4.js";
1
+ import { M as i } from "./state-Ca5Yd_KX.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];