@synnaxlabs/drift 0.42.0 → 0.42.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/drift",
3
- "version": "0.42.0",
3
+ "version": "0.42.3",
4
4
  "description": "State synchronization and Redux state synchronization for Tauri Apps",
5
5
  "repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "react-dom": "^19.1.0",
23
23
  "react-redux": "^9.2.0",
24
24
  "zod": "^4.0.0-beta",
25
- "@synnaxlabs/x": "0.42.0"
25
+ "@synnaxlabs/x": "0.42.3"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "^19.1.0",
@@ -36,8 +36,8 @@
36
36
  "vite": "^6.2.5",
37
37
  "vitest": "^3.1.1",
38
38
  "@synnaxlabs/tsconfig": "0.0.2",
39
- "@synnaxlabs/vite-plugin": "0.0.1",
40
- "eslint-config-synnaxlabs": "0.0.1"
39
+ "eslint-config-synnaxlabs": "0.0.1",
40
+ "@synnaxlabs/vite-plugin": "0.0.1"
41
41
  },
42
42
  "files": [
43
43
  "dist"
@@ -1 +0,0 @@
1
- "use strict";const N=require("@reduxjs/toolkit"),d=require("./window-DLsE0-fP.cjs"),w=(e=!1,...n)=>{e&&console.log(...n)},m=(e=!1,...n)=>{e&&console.group(...n)},W=e=>{e&&console.groupEnd()},_=(e,n,o=".")=>{const t=e.split(o);return t.map((i,l)=>{const r=n(i,l,t);return r==null?null:typeof r=="string"?r:r.join(o)}).filter(i=>i!=null).join(o)},I=(e,n,o={optional:!1,separator:"."})=>{o.separator??(o.separator=".");const{optional:t,getter:i=(a,s)=>a[s]}=o,l=n.split(o.separator);if(l.length===1&&l[0]==="")return e;let r=e;for(const a of l){const s=i(r,a);if(s==null){if(t)return null;throw new Error(`Path ${n} does not exist. ${a} is null`)}r=s}return r},L=(e,n,o)=>{const t=n.split(".");let i=e;for(let l=0;l<t.length-1;l++){const r=t[l];i[r]??(i[r]={}),i=i[r]}try{i[t[t.length-1]]=o}catch(l){throw console.error("failed to set value",o,"at path",n,"on object",e),l}},D=(e,n)=>{const o=n.split(".");let t=e;for(let i=0;i<o.length-1;i++){const l=o[i];if(t[l]==null)return;t=t[l]}if(Array.isArray(t)){const i=parseInt(o[o.length-1]);if(isNaN(i))return;t.splice(i,1);return}delete t[o[o.length-1]]},M=(e,n)=>{const o=e.split(".");return n<0?o[o.length+n]:o[n]},j=(e,n)=>{try{return I(e,n),!0}catch{return!1}},R=(e,n)=>{if(n.length===0)return!0;const o=e.split("."),t=n.split(".");if(t.length>o.length)return!1;for(let i=0;i<t.length;i++){const l=o[i],r=t[i];if(r!=="*"&&l!==r)return!1}return!0},v=e=>JSON.parse(JSON.stringify(e)),C=(e,...n)=>(n.forEach(o=>{let t=e;const i=o.split(".");i.forEach((l,r)=>{r===i.length-1?delete t[l]:l in t&&(t=t[l])})}),e),$=(e,n,o="")=>{const t={},i=(l,r,a)=>{if(typeof l!=typeof r||l===null||r===null){t[a]=[l,r];return}if(typeof l=="object"&&typeof r=="object")if(Array.isArray(l)&&Array.isArray(r)){if(l.length!==r.length){t[a]=[l,r];return}for(let s=0;s<l.length;s++)i(l[s],r[s],`${a}[${s}]`)}else new Set([...Object.keys(l),...Object.keys(r)]).forEach(s=>{i(l[s],r[s],a!==""?`${a}.${s}`:s)});else l!==r&&(t[a]=[l,r])};return i(e,n,o),t},b=(e,n)=>{const o=Array.isArray(e),t=Array.isArray(n);if(o!==t)return!1;if(o&&t){const r=e,a=n;if(r.length!==a.length)return!1;for(let s=0;s<r.length;s++)if(!b(r[s],a[s]))return!1;return!0}if(e==null||n==null||typeof e!="object"||typeof n!="object")return e===n;if("equals"in e)return e.equals(n);const i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(const r of i){const a=e[r],s=n[r];if(typeof a=="object"&&typeof s=="object"){if(!b(a,s))return!1}else if(a!==s)return!1}return!0},k=(e,n)=>{if(typeof e!="object"||e==null)return e===n;const o=Object.keys(e),t=Object.keys(n);if(t.length>o.length)return!1;for(const i of t){const l=e[i],r=n[i];if(typeof l=="object"&&typeof r=="object"){if(!k(l,r))return!1}else if(l!==r)return!1}return!0},y=(e,...n)=>{if(n.length===0)return e;const o=n.shift();if(d.o(e)&&d.o(o))for(const t in o)try{d.o(o[t])?(t in e||Object.assign(e,{[t]:{}}),y(e[t],o[t])):Object.assign(e,{[t]:o[t]})}catch(i){throw i instanceof TypeError?new TypeError(`.${t}: ${i.message}`):i}return y(e,...n)},x=(e,n,o)=>{const t=(i,l,r)=>{for(const a in l){const s=l[a],p=r.shape;if(p!=null&&p[a]){const E=p[a].safeParse(s);E.success&&(i[a]=E.data)}else typeof s=="object"&&!Array.isArray(s)&&s!==null&&r&&r.shape&&r.shape[a]&&(i[a]||(i[a]={}),t(i[a],s,r.shape[a]))}return i};return t({...e},n,o)},g=Object.freeze(Object.defineProperty({__proto__:null,copy:v,deleteD:C,difference:$,element:M,equal:b,get:I,has:j,override:y,overrideValidItems:x,partialEqual:k,pathsMatch:R,remove:D,set:L,transformPath:_},Symbol.toStringTag,{value:"Module"})),q=d.O.milliseconds(50),z=()=>setTimeout(()=>window.location.reload(),q.milliseconds),A={label:d.MAIN_WINDOW,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...d.INITIAL_WINDOW_STATE,key:d.MAIN_WINDOW,reserved:!0}},labelKeys:{main:d.MAIN_WINDOW},keyLabels:{main:d.MAIN_WINDOW}},F=(e,n)=>{if(e.type===P.type)return n.label!==d.MAIN_WINDOW||(e.payload.label=d.Lt.create(),e.payload.prerenderLabel=d.Lt.create()),e;if("label"in e.payload)return e;let o=n.label;const t=e.payload;return t.key!=null&&(t.key in n.windows?o=t.key:o=n.keyLabels[t.key]),e.payload={...e.payload,label:o},e},c=e=>(n,o)=>{if(!("label"in o.payload))throw new Error("Missing label");e(n,o)},u=(e,n=!1)=>c((o,t)=>{let i=n;const l=o.windows[t.payload.label];if(l!=null){if(t.payload.value!=null)i=t.payload.value;else{const r=l[e];r!=null&&(i=!r)}o.windows[t.payload.label]={...l,[e]:i}}}),f=(e,n=!1)=>(o,t)=>{const i=o.windows[t.payload.label];i!=null&&(o.windows[t.payload.label]={...i,[e]:i[e]+(n?-1:1)})},K=e=>Object.values(e.windows).some(n=>n.key===d.PRERENDER_WINDOW&&!n.reserved),S="drift",V=(e,n,o)=>e.position!=null&&e.size!=null&&n==null?d.$t.topLeft(d.$t.positionInCenter(d.$t.construct(d.J.ZERO,o??d.J.ZERO),d.$t.construct(e.position,e.size))):n,J=(e,{payload:n})=>{if(n.key===d.PRERENDER_WINDOW)return;const{key:o,label:t,prerenderLabel:i}=n;if(t==null||i==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(e.config.debug),m(e.config.debug,"reducer create window");const l=e.windows.main;if(n.position=V(l,n.position,n.size),o in e.keyLabels){w(e.config.debug,"window already exists, un-minimize and focus it");const s=e.keyLabels[n.key];e.windows[s].visible=!0,e.windows[s].focusCount+=1,e.windows[s].minimized=!1,e.windows[s].position=n.position,W(e.config.debug);return}const[r,a]=Object.entries(e.windows).find(([,s])=>!s.reserved)??[null,null];r!=null?(w(e.config.debug,"using available pre-rendered window"),e.windows[r]={...a,visible:!0,reserved:!0,focusCount:1,focus:!0,...n},e.labelKeys[r]=n.key,e.keyLabels[n.key]=r):(w(e.config.debug,"creating new window"),e.windows[t]={...e.config.defaultWindowProps,...d.INITIAL_WINDOW_STATE,...n,reserved:!0},e.labelKeys[t]=o,e.keyLabels[o]=t),e.config.enablePrerender&&!K(e)&&(w(e.config.debug,"creating pre-render window"),e.windows[i]=g.copy({...e.config.defaultWindowProps,...d.INITIAL_PRERENDER_WINDOW_STATE})),W(e.config.debug)},Z=c((e,n)=>{const o=e.windows[n.payload.label];o!=null&&(o.stage=n.payload.stage)}),B=c((e,{payload:{label:n}})=>{const o=e.windows[n];o==null||o.processCount>0||(o.stage="closing",delete e.windows[n],delete e.labelKeys[n],delete e.keyLabels[o.key])}),H=c((e,n)=>{const o=e.windows[n.payload.label];o==null||o.processCount>0||(o.stage="reloading",z())}),U=c(f("processCount")),X=c((e,n)=>{f("processCount",!0)(e,n);const o=e.windows[n.payload.label];o!=null&&o.processCount===0&&(o.stage==="reloading"?z():(e.windows[n.payload.label].visible=!1,delete e.windows[n.payload.label],delete e.labelKeys[n.payload.label],delete e.keyLabels[o.key]))}),Y=(e,n)=>{const o=e.windows[n.payload.key];o!=null&&(o.error=n.payload.message)},G=c((e,n)=>{const o=e.windows[n.payload.label];o!=null&&(o.visible!==!0&&(o.visible=!0),f("focusCount")(e,n))}),Q=u("minimized"),ee=u("maximized"),ne=u("visible",!0),oe=u("fullscreen",!0),te=c(f("centerCount")),ie=c((e,n)=>{e.windows[n.payload.label].position=n.payload.position}),re=c((e,n)=>{e.windows[n.payload.label].size=n.payload.size}),le=c((e,n)=>{e.windows[n.payload.label].minSize=n.payload.size}),se=c((e,n)=>{e.windows[n.payload.label].maxSize=n.payload.size}),ae=u("resizable"),de=u("skipTaskbar"),ce=u("alwaysOnTop"),ue=c((e,n)=>{e.windows[n.payload.label].title=n.payload.title}),we=u("decorations"),h=(e,n)=>{const o=e.windows[n.payload.label];g.partialEqual(o,n.payload)||(e.windows[n.payload.label]={...o,...n.payload})},fe=(e,n)=>{if(e.config={...e.config,...n.payload},e.label=n.payload.label,e.label===d.MAIN_WINDOW&&e.config.enablePrerender){const o=d.Lt.create();e.windows[o]={...e.config.defaultWindowProps,...d.INITIAL_PRERENDER_WINDOW_STATE}}},O=N.createSlice({name:S,initialState:A,reducers:{internalSetInitial:fe,createWindow:J,setWindowStage:Z,closeWindow:B,registerProcess:U,completeProcess:X,setWindowError:Y,focusWindow:G,reloadWindow:H,setWindowMinimized:Q,setWindowMaximized:ee,setWindowVisible:ne,setWindowFullscreen:oe,centerWindow:te,setWindowPosition:ie,setWindowSize:re,setWindowMinSize:le,setWindowMaxSize:se,setWindowResizable:ae,setWindowSkipTaskbar:de,setWindowAlwaysOnTop:ce,setWindowTitle:ue,setWindowDecorations:we,runtimeSetWindowProps:h,setWindowProps:h}}),{actions:{runtimeSetWindowProps:pe,setWindowProps:We,createWindow:P,internalSetInitial:T,setWindowStage:be,closeWindow:ye,registerProcess:ge,completeProcess:Se,setWindowError:Ee,focusWindow:he,reloadWindow:me,setWindowMinimized:Ie,setWindowMaximized:ke,setWindowVisible:ze,setWindowFullscreen:Ae,centerWindow:xe,setWindowPosition:Oe,setWindowSize:Pe,setWindowMinSize:Te,setWindowMaxSize:Ne,setWindowResizable:_e,setWindowSkipTaskbar:Le,setWindowAlwaysOnTop:De,setWindowTitle:Me,setWindowDecorations:je}}=O,Re=O.reducer,ve=e=>e.startsWith(S),Ce=[T.type],$e=(e,n)=>!e&&!Ce.includes(n);exports.SLICE_NAME=S;exports.ZERO_SLICE_STATE=A;exports._=g;exports.assignLabel=F;exports.closeWindow=ye;exports.completeProcess=Se;exports.createWindow=P;exports.focusWindow=he;exports.group=m;exports.groupEnd=W;exports.internalSetInitial=T;exports.isDriftAction=ve;exports.log=w;exports.reducer=Re;exports.registerProcess=ge;exports.reloadWindow=me;exports.runtimeSetWindowProps=pe;exports.setWindowAlwaysOnTop=De;exports.setWindowDecorations=je;exports.setWindowError=Ee;exports.setWindowFullscreen=Ae;exports.setWindowMaxSize=Ne;exports.setWindowMaximized=ke;exports.setWindowMinSize=Te;exports.setWindowMinimized=Ie;exports.setWindowPosition=Oe;exports.setWindowProps=We;exports.setWindowResizable=_e;exports.setWindowSize=Pe;exports.setWindowSkipTaskbar=Le;exports.setWindowStage=be;exports.setWindowTitle=Me;exports.setWindowVisible=ze;exports.shouldEmit=$e;
@@ -1,396 +0,0 @@
1
- import { createSlice as C } from "@reduxjs/toolkit";
2
- import { o as b, O as M, M as u, I as z, P, a as O, L as g, $ as w, J as m } from "./window-BIbHrbtA.js";
3
- const f = (e = !1, ...n) => {
4
- e && console.log(...n);
5
- }, R = (e = !1, ...n) => {
6
- e && console.group(...n);
7
- }, k = (e) => {
8
- e && console.groupEnd();
9
- }, _ = (e, n, o = ".") => {
10
- const t = e.split(o);
11
- return t.map((i, s) => {
12
- const r = n(i, s, t);
13
- return r == null ? null : typeof r == "string" ? r : r.join(o);
14
- }).filter((i) => i != null).join(o);
15
- }, A = (e, n, o = { optional: !1, separator: "." }) => {
16
- o.separator ?? (o.separator = ".");
17
- const { optional: t, getter: i = (a, l) => a[l] } = o, s = n.split(o.separator);
18
- if (s.length === 1 && s[0] === "") return e;
19
- let r = e;
20
- for (const a of s) {
21
- const l = i(r, a);
22
- if (l == null) {
23
- if (t) return null;
24
- throw new Error(`Path ${n} does not exist. ${a} is null`);
25
- }
26
- r = l;
27
- }
28
- return r;
29
- }, D = (e, n, o) => {
30
- const t = n.split(".");
31
- let i = e;
32
- for (let s = 0; s < t.length - 1; s++) {
33
- const r = t[s];
34
- i[r] ?? (i[r] = {}), i = i[r];
35
- }
36
- try {
37
- i[t[t.length - 1]] = o;
38
- } catch (s) {
39
- throw console.error("failed to set value", o, "at path", n, "on object", e), s;
40
- }
41
- }, N = (e, n) => {
42
- const o = n.split(".");
43
- let t = e;
44
- for (let i = 0; i < o.length - 1; i++) {
45
- const s = o[i];
46
- if (t[s] == null) return;
47
- t = t[s];
48
- }
49
- if (Array.isArray(t)) {
50
- const i = parseInt(o[o.length - 1]);
51
- if (isNaN(i)) return;
52
- t.splice(i, 1);
53
- return;
54
- }
55
- delete t[o[o.length - 1]];
56
- }, $ = (e, n) => {
57
- const o = e.split(".");
58
- return n < 0 ? o[o.length + n] : o[n];
59
- }, x = (e, n) => {
60
- try {
61
- return A(e, n), !0;
62
- } catch {
63
- return !1;
64
- }
65
- }, q = (e, n) => {
66
- if (n.length === 0) return !0;
67
- const o = e.split("."), t = n.split(".");
68
- if (t.length > o.length) return !1;
69
- for (let i = 0; i < t.length; i++) {
70
- const s = o[i], r = t[i];
71
- if (r !== "*" && s !== r)
72
- return !1;
73
- }
74
- return !0;
75
- }, K = (e) => JSON.parse(JSON.stringify(e)), F = (e, ...n) => (n.forEach((o) => {
76
- let t = e;
77
- const i = o.split(".");
78
- i.forEach((s, r) => {
79
- r === i.length - 1 ? delete t[s] : s in t && (t = t[s]);
80
- });
81
- }), e), V = (e, n, o = "") => {
82
- const t = {}, i = (s, r, a) => {
83
- if (typeof s != typeof r || s === null || r === null) {
84
- t[a] = [s, r];
85
- return;
86
- }
87
- if (typeof s == "object" && typeof r == "object")
88
- if (Array.isArray(s) && Array.isArray(r)) {
89
- if (s.length !== r.length) {
90
- t[a] = [s, r];
91
- return;
92
- }
93
- for (let l = 0; l < s.length; l++) i(s[l], r[l], `${a}[${l}]`);
94
- } else
95
- (/* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(r)])).forEach((l) => {
96
- i(s[l], r[l], a !== "" ? `${a}.${l}` : l);
97
- });
98
- else s !== r && (t[a] = [s, r]);
99
- };
100
- return i(e, n, o), t;
101
- }, W = (e, n) => {
102
- const o = Array.isArray(e), t = Array.isArray(n);
103
- if (o !== t) return !1;
104
- if (o && t) {
105
- const r = e, a = n;
106
- if (r.length !== a.length) return !1;
107
- for (let l = 0; l < r.length; l++) if (!W(r[l], a[l])) return !1;
108
- return !0;
109
- }
110
- if (e == null || n == null || typeof e != "object" || typeof n != "object")
111
- return e === n;
112
- if ("equals" in e) return e.equals(n);
113
- const i = Object.keys(e), s = Object.keys(n);
114
- if (i.length !== s.length) return !1;
115
- for (const r of i) {
116
- const a = e[r], l = n[r];
117
- if (typeof a == "object" && typeof l == "object") {
118
- if (!W(a, l)) return !1;
119
- } else if (a !== l) return !1;
120
- }
121
- return !0;
122
- }, j = (e, n) => {
123
- if (typeof e != "object" || e == null) return e === n;
124
- const o = Object.keys(e), t = Object.keys(n);
125
- if (t.length > o.length) return !1;
126
- for (const i of t) {
127
- const s = e[i], r = n[i];
128
- if (typeof s == "object" && typeof r == "object") {
129
- if (!j(s, r)) return !1;
130
- } else if (s !== r) return !1;
131
- }
132
- return !0;
133
- }, S = (e, ...n) => {
134
- if (n.length === 0) return e;
135
- const o = n.shift();
136
- if (b(e) && b(o))
137
- for (const t in o)
138
- try {
139
- b(o[t]) ? (t in e || Object.assign(e, { [t]: {} }), S(e[t], o[t])) : Object.assign(e, { [t]: o[t] });
140
- } catch (i) {
141
- throw i instanceof TypeError ? new TypeError(`.${t}: ${i.message}`) : i;
142
- }
143
- return S(e, ...n);
144
- }, Z = (e, n, o) => {
145
- const t = (i, s, r) => {
146
- for (const a in s) {
147
- const l = s[a], y = r.shape;
148
- if (y != null && y[a]) {
149
- const h = y[a].safeParse(l);
150
- h.success && (i[a] = h.data);
151
- } else typeof l == "object" && !Array.isArray(l) && l !== null && r && r.shape && r.shape[a] && (i[a] || (i[a] = {}), t(i[a], l, r.shape[a]));
152
- }
153
- return i;
154
- };
155
- return t({ ...e }, n, o);
156
- }, v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
157
- __proto__: null,
158
- copy: K,
159
- deleteD: F,
160
- difference: V,
161
- element: $,
162
- equal: W,
163
- get: A,
164
- has: x,
165
- override: S,
166
- overrideValidItems: Z,
167
- partialEqual: j,
168
- pathsMatch: q,
169
- remove: N,
170
- set: D,
171
- transformPath: _
172
- }, Symbol.toStringTag, { value: "Module" })), J = M.milliseconds(50), L = () => setTimeout(() => window.location.reload(), J.milliseconds), B = {
173
- label: u,
174
- config: {
175
- enablePrerender: !0,
176
- debug: !1,
177
- defaultWindowProps: {}
178
- },
179
- windows: {
180
- main: {
181
- ...z,
182
- key: u,
183
- reserved: !0
184
- }
185
- },
186
- labelKeys: {
187
- main: u
188
- },
189
- keyLabels: {
190
- main: u
191
- }
192
- }, ze = (e, n) => {
193
- if (e.type === Se.type)
194
- return n.label !== u || (e.payload.label = g.create(), e.payload.prerenderLabel = g.create()), e;
195
- if ("label" in e.payload) return e;
196
- let o = n.label;
197
- const t = e.payload;
198
- return t.key != null && (t.key in n.windows ? o = t.key : o = n.keyLabels[t.key]), e.payload = { ...e.payload, label: o }, e;
199
- }, d = (e) => (n, o) => {
200
- if (!("label" in o.payload)) throw new Error("Missing label");
201
- e(n, o);
202
- }, c = (e, n = !1) => d((o, t) => {
203
- let i = n;
204
- const s = o.windows[t.payload.label];
205
- if (s != null) {
206
- if (t.payload.value != null) i = t.payload.value;
207
- else {
208
- const r = s[e];
209
- r != null && (i = !r);
210
- }
211
- o.windows[t.payload.label] = { ...s, [e]: i };
212
- }
213
- }), p = (e, n = !1) => (o, t) => {
214
- const i = o.windows[t.payload.label];
215
- i != null && (o.windows[t.payload.label] = {
216
- ...i,
217
- [e]: i[e] + (n ? -1 : 1)
218
- });
219
- }, H = (e) => Object.values(e.windows).some((n) => n.key === P && !n.reserved), T = "drift", U = (e, n, o) => e.position != null && e.size != null && n == null ? w.topLeft(
220
- w.positionInCenter(
221
- w.construct(m.ZERO, o ?? m.ZERO),
222
- w.construct(e.position, e.size)
223
- )
224
- ) : n, X = (e, { payload: n }) => {
225
- if (n.key === P) return;
226
- const { key: o, label: t, prerenderLabel: i } = n;
227
- if (t == null || i == null)
228
- throw new Error("[drift] - bug - missing label and prerender label");
229
- console.log(e.config.debug), R(e.config.debug, "reducer create window");
230
- const s = e.windows.main;
231
- if (n.position = U(s, n.position, n.size), o in e.keyLabels) {
232
- f(e.config.debug, "window already exists, un-minimize and focus it");
233
- const l = e.keyLabels[n.key];
234
- e.windows[l].visible = !0, e.windows[l].focusCount += 1, e.windows[l].minimized = !1, e.windows[l].position = n.position, k(e.config.debug);
235
- return;
236
- }
237
- const [r, a] = Object.entries(e.windows).find(
238
- ([, l]) => !l.reserved
239
- ) ?? [null, null];
240
- r != null ? (f(e.config.debug, "using available pre-rendered window"), e.windows[r] = {
241
- ...a,
242
- visible: !0,
243
- reserved: !0,
244
- focusCount: 1,
245
- focus: !0,
246
- ...n
247
- }, e.labelKeys[r] = n.key, e.keyLabels[n.key] = r) : (f(e.config.debug, "creating new window"), e.windows[t] = {
248
- ...e.config.defaultWindowProps,
249
- ...z,
250
- ...n,
251
- reserved: !0
252
- }, e.labelKeys[t] = o, e.keyLabels[o] = t), e.config.enablePrerender && !H(e) && (f(e.config.debug, "creating pre-render window"), e.windows[i] = v.copy({
253
- ...e.config.defaultWindowProps,
254
- ...O
255
- })), k(e.config.debug);
256
- }, Y = d((e, n) => {
257
- const o = e.windows[n.payload.label];
258
- o != null && (o.stage = n.payload.stage);
259
- }), G = d(
260
- (e, { payload: { label: n } }) => {
261
- const o = e.windows[n];
262
- o == null || o.processCount > 0 || (o.stage = "closing", delete e.windows[n], delete e.labelKeys[n], delete e.keyLabels[o.key]);
263
- }
264
- ), Q = d((e, n) => {
265
- const o = e.windows[n.payload.label];
266
- o == null || o.processCount > 0 || (o.stage = "reloading", L());
267
- }), ee = d(
268
- p("processCount")
269
- ), ne = d((e, n) => {
270
- p("processCount", !0)(e, n);
271
- const o = e.windows[n.payload.label];
272
- o != null && o.processCount === 0 && (o.stage === "reloading" ? L() : (e.windows[n.payload.label].visible = !1, delete e.windows[n.payload.label], delete e.labelKeys[n.payload.label], delete e.keyLabels[o.key]));
273
- }), oe = (e, n) => {
274
- const o = e.windows[n.payload.key];
275
- o != null && (o.error = n.payload.message);
276
- }, te = d((e, n) => {
277
- const o = e.windows[n.payload.label];
278
- o != null && (o.visible !== !0 && (o.visible = !0), p("focusCount")(e, n));
279
- }), ie = c("minimized"), re = c("maximized"), se = c("visible", !0), le = c("fullscreen", !0), ae = d(
280
- p("centerCount")
281
- ), de = d((e, n) => {
282
- e.windows[n.payload.label].position = n.payload.position;
283
- }), ce = d((e, n) => {
284
- e.windows[n.payload.label].size = n.payload.size;
285
- }), ue = d((e, n) => {
286
- e.windows[n.payload.label].minSize = n.payload.size;
287
- }), we = d((e, n) => {
288
- e.windows[n.payload.label].maxSize = n.payload.size;
289
- }), fe = c("resizable"), pe = c("skipTaskbar"), ye = c("alwaysOnTop"), be = d((e, n) => {
290
- e.windows[n.payload.label].title = n.payload.title;
291
- }), ge = c("decorations"), E = (e, n) => {
292
- const o = e.windows[n.payload.label];
293
- v.partialEqual(o, n.payload) || (e.windows[n.payload.label] = { ...o, ...n.payload });
294
- }, We = (e, n) => {
295
- if (e.config = { ...e.config, ...n.payload }, e.label = n.payload.label, e.label === u && e.config.enablePrerender) {
296
- const o = g.create();
297
- e.windows[o] = {
298
- ...e.config.defaultWindowProps,
299
- ...O
300
- };
301
- }
302
- }, I = C({
303
- name: T,
304
- initialState: B,
305
- reducers: {
306
- internalSetInitial: We,
307
- createWindow: X,
308
- setWindowStage: Y,
309
- closeWindow: G,
310
- registerProcess: ee,
311
- completeProcess: ne,
312
- setWindowError: oe,
313
- focusWindow: te,
314
- reloadWindow: Q,
315
- setWindowMinimized: ie,
316
- setWindowMaximized: re,
317
- setWindowVisible: se,
318
- setWindowFullscreen: le,
319
- centerWindow: ae,
320
- setWindowPosition: de,
321
- setWindowSize: ce,
322
- setWindowMinSize: ue,
323
- setWindowMaxSize: we,
324
- setWindowResizable: fe,
325
- setWindowSkipTaskbar: pe,
326
- setWindowAlwaysOnTop: ye,
327
- setWindowTitle: be,
328
- setWindowDecorations: ge,
329
- runtimeSetWindowProps: E,
330
- setWindowProps: E
331
- }
332
- }), {
333
- actions: {
334
- runtimeSetWindowProps: Pe,
335
- setWindowProps: Oe,
336
- createWindow: Se,
337
- internalSetInitial: he,
338
- setWindowStage: Ae,
339
- closeWindow: je,
340
- registerProcess: ve,
341
- completeProcess: Le,
342
- setWindowError: Te,
343
- focusWindow: Ie,
344
- reloadWindow: Ce,
345
- setWindowMinimized: Me,
346
- setWindowMaximized: Re,
347
- setWindowVisible: _e,
348
- setWindowFullscreen: De,
349
- centerWindow: Ne,
350
- setWindowPosition: $e,
351
- setWindowSize: xe,
352
- setWindowMinSize: qe,
353
- setWindowMaxSize: Ke,
354
- setWindowResizable: Fe,
355
- setWindowSkipTaskbar: Ve,
356
- setWindowAlwaysOnTop: Ze,
357
- setWindowTitle: Je,
358
- setWindowDecorations: Be
359
- }
360
- } = I, He = I.reducer, Ue = (e) => e.startsWith(T), me = [he.type], Xe = (e, n) => !e && !me.includes(n);
361
- export {
362
- Fe as A,
363
- xe as B,
364
- Ve as C,
365
- Je as D,
366
- _e as E,
367
- T as S,
368
- B as Z,
369
- v as _,
370
- k as a,
371
- Ce as b,
372
- ze as c,
373
- Te as d,
374
- he as e,
375
- Ae as f,
376
- R as g,
377
- je as h,
378
- Ue as i,
379
- Le as j,
380
- Se as k,
381
- f as l,
382
- Ie as m,
383
- He as n,
384
- ve as o,
385
- Ze as p,
386
- Be as q,
387
- Pe as r,
388
- Xe as s,
389
- De as t,
390
- Ke as u,
391
- Re as v,
392
- qe as w,
393
- Me as x,
394
- $e as y,
395
- Oe as z
396
- };