@nice2dev/templates 1.2.0 → 1.2.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/index.cjs +1 -1
- package/dist/index.mjs +1424 -1390
- package/package.json +6 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var ne = (s, e, t) => e in s ? te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var k = (s, e, t) => ne(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { useNiceTranslation as w } from "@nice2dev/ui-core";
|
|
6
|
+
import { useContext as W, useState as D, useCallback as L, createContext as N, useMemo as z, useEffect as re } from "react";
|
|
7
|
+
import { NtdArrowUp as $, NtdArrowDown as j, NtdDownload as ae, NtdUpload as oe } from "@nice2dev/icons";
|
|
8
|
+
const ie = [
|
|
7
9
|
{
|
|
8
10
|
id: "apple",
|
|
9
11
|
name: "Apple",
|
|
@@ -111,28 +113,28 @@ const J = [
|
|
|
111
113
|
fiber: 3.5
|
|
112
114
|
}
|
|
113
115
|
];
|
|
114
|
-
class
|
|
116
|
+
class se {
|
|
115
117
|
constructor() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
k(this, "workouts", /* @__PURE__ */ new Map());
|
|
119
|
+
k(this, "meals", /* @__PURE__ */ new Map());
|
|
120
|
+
k(this, "sleep", /* @__PURE__ */ new Map());
|
|
121
|
+
k(this, "medicalRecords", /* @__PURE__ */ new Map());
|
|
122
|
+
k(this, "medications", /* @__PURE__ */ new Map());
|
|
123
|
+
k(this, "medicationLogs", []);
|
|
124
|
+
k(this, "vitals", []);
|
|
125
|
+
k(this, "goals", []);
|
|
126
|
+
k(this, "foodDatabase", [...ie]);
|
|
125
127
|
}
|
|
126
128
|
/* ─────────────────────────────────────────────────────────────
|
|
127
129
|
WORKOUTS
|
|
128
130
|
───────────────────────────────────────────────────────────── */
|
|
129
131
|
addWorkout(e) {
|
|
130
|
-
const t = this.generateId(),
|
|
131
|
-
return this.workouts.set(t,
|
|
132
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
133
|
+
return this.workouts.set(t, n), n;
|
|
132
134
|
}
|
|
133
135
|
updateWorkout(e, t) {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
+
const n = this.workouts.get(e);
|
|
137
|
+
n && this.workouts.set(e, { ...n, ...t, id: e });
|
|
136
138
|
}
|
|
137
139
|
deleteWorkout(e) {
|
|
138
140
|
this.workouts.delete(e);
|
|
@@ -143,37 +145,37 @@ class Z {
|
|
|
143
145
|
);
|
|
144
146
|
}
|
|
145
147
|
getWorkoutsForPeriod(e, t) {
|
|
146
|
-
return this.getAllWorkouts().filter((
|
|
147
|
-
const
|
|
148
|
-
return
|
|
148
|
+
return this.getAllWorkouts().filter((n) => {
|
|
149
|
+
const o = new Date(n.date);
|
|
150
|
+
return o >= e && o <= t;
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
153
|
getWorkoutStats(e = 7) {
|
|
152
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
153
|
-
for (const
|
|
154
|
-
|
|
154
|
+
const t = new Date(Date.now() - e * 864e5), n = this.getWorkoutsForPeriod(t, /* @__PURE__ */ new Date()), o = /* @__PURE__ */ new Map();
|
|
155
|
+
for (const r of n)
|
|
156
|
+
o.set(r.type, (o.get(r.type) || 0) + 1);
|
|
155
157
|
return {
|
|
156
|
-
totalWorkouts:
|
|
157
|
-
totalDuration:
|
|
158
|
-
totalCalories:
|
|
159
|
-
avgDuration:
|
|
160
|
-
byType: Array.from(
|
|
158
|
+
totalWorkouts: n.length,
|
|
159
|
+
totalDuration: n.reduce((r, i) => r + i.duration, 0),
|
|
160
|
+
totalCalories: n.reduce((r, i) => r + i.caloriesBurned, 0),
|
|
161
|
+
avgDuration: n.length > 0 ? n.reduce((r, i) => r + i.duration, 0) / n.length : 0,
|
|
162
|
+
byType: Array.from(o.entries()).map(([r, i]) => ({ type: r, count: i }))
|
|
161
163
|
};
|
|
162
164
|
}
|
|
163
165
|
/* ─────────────────────────────────────────────────────────────
|
|
164
166
|
NUTRITION
|
|
165
167
|
───────────────────────────────────────────────────────────── */
|
|
166
168
|
addMeal(e) {
|
|
167
|
-
const t = this.generateId(),
|
|
168
|
-
return this.meals.set(t,
|
|
169
|
+
const t = this.generateId(), n = this.calculateMealTotals(e.foods), o = { ...e, id: t, ...n };
|
|
170
|
+
return this.meals.set(t, o), o;
|
|
169
171
|
}
|
|
170
172
|
calculateMealTotals(e) {
|
|
171
173
|
return e.reduce(
|
|
172
|
-
(t, { item:
|
|
173
|
-
totalCalories: t.totalCalories +
|
|
174
|
-
totalProtein: t.totalProtein +
|
|
175
|
-
totalCarbs: t.totalCarbs +
|
|
176
|
-
totalFat: t.totalFat +
|
|
174
|
+
(t, { item: n, servings: o }) => ({
|
|
175
|
+
totalCalories: t.totalCalories + n.calories * o,
|
|
176
|
+
totalProtein: t.totalProtein + n.protein * o,
|
|
177
|
+
totalCarbs: t.totalCarbs + n.carbs * o,
|
|
178
|
+
totalFat: t.totalFat + n.fat * o
|
|
177
179
|
}),
|
|
178
180
|
{ totalCalories: 0, totalProtein: 0, totalCarbs: 0, totalFat: 0 }
|
|
179
181
|
);
|
|
@@ -189,46 +191,46 @@ class Z {
|
|
|
189
191
|
getMealsForDate(e) {
|
|
190
192
|
const t = new Date(e);
|
|
191
193
|
t.setHours(0, 0, 0, 0);
|
|
192
|
-
const
|
|
193
|
-
return this.getAllMeals().filter((
|
|
194
|
-
const
|
|
195
|
-
return
|
|
194
|
+
const n = new Date(t.getTime() + 864e5);
|
|
195
|
+
return this.getAllMeals().filter((o) => {
|
|
196
|
+
const r = new Date(o.date);
|
|
197
|
+
return r >= t && r < n;
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
getDailyNutrition(e) {
|
|
199
201
|
const t = this.getMealsForDate(e);
|
|
200
202
|
return {
|
|
201
|
-
calories: t.reduce((
|
|
202
|
-
protein: t.reduce((
|
|
203
|
-
carbs: t.reduce((
|
|
204
|
-
fat: t.reduce((
|
|
203
|
+
calories: t.reduce((n, o) => n + o.totalCalories, 0),
|
|
204
|
+
protein: t.reduce((n, o) => n + o.totalProtein, 0),
|
|
205
|
+
carbs: t.reduce((n, o) => n + o.totalCarbs, 0),
|
|
206
|
+
fat: t.reduce((n, o) => n + o.totalFat, 0),
|
|
205
207
|
meals: t.length
|
|
206
208
|
};
|
|
207
209
|
}
|
|
208
210
|
searchFoods(e) {
|
|
209
211
|
const t = e.toLowerCase();
|
|
210
|
-
return this.foodDatabase.filter((
|
|
212
|
+
return this.foodDatabase.filter((n) => n.name.toLowerCase().includes(t));
|
|
211
213
|
}
|
|
212
214
|
addCustomFood(e) {
|
|
213
|
-
const t = this.generateId(),
|
|
214
|
-
return this.foodDatabase.push(
|
|
215
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
216
|
+
return this.foodDatabase.push(n), n;
|
|
215
217
|
}
|
|
216
218
|
/* ─────────────────────────────────────────────────────────────
|
|
217
219
|
SLEEP
|
|
218
220
|
───────────────────────────────────────────────────────────── */
|
|
219
221
|
addSleepEntry(e) {
|
|
220
|
-
const t = this.generateId(),
|
|
221
|
-
return this.sleep.set(t,
|
|
222
|
+
const t = this.generateId(), n = (new Date(e.wakeTime).getTime() - new Date(e.bedtime).getTime()) / 36e5, o = { ...e, id: t, duration: n };
|
|
223
|
+
return this.sleep.set(t, o), o;
|
|
222
224
|
}
|
|
223
225
|
updateSleepEntry(e, t) {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
let
|
|
226
|
+
const n = this.sleep.get(e);
|
|
227
|
+
if (n) {
|
|
228
|
+
let o = n.duration;
|
|
227
229
|
if (t.bedtime || t.wakeTime) {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
+
const r = t.bedtime || n.bedtime, i = t.wakeTime || n.wakeTime;
|
|
231
|
+
o = (new Date(i).getTime() - new Date(r).getTime()) / 36e5;
|
|
230
232
|
}
|
|
231
|
-
this.sleep.set(e, { ...
|
|
233
|
+
this.sleep.set(e, { ...n, ...t, id: e, duration: o });
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
deleteSleepEntry(e) {
|
|
@@ -240,20 +242,20 @@ class Z {
|
|
|
240
242
|
);
|
|
241
243
|
}
|
|
242
244
|
getSleepStats(e = 7) {
|
|
243
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
245
|
+
const t = new Date(Date.now() - e * 864e5), n = this.getAllSleepEntries().filter((i) => new Date(i.date) >= t), o = {
|
|
244
246
|
poor: 1,
|
|
245
247
|
fair: 2,
|
|
246
248
|
good: 3,
|
|
247
249
|
excellent: 4
|
|
248
|
-
},
|
|
249
|
-
for (const
|
|
250
|
-
|
|
250
|
+
}, r = /* @__PURE__ */ new Map();
|
|
251
|
+
for (const i of n)
|
|
252
|
+
r.set(i.quality, (r.get(i.quality) || 0) + 1);
|
|
251
253
|
return {
|
|
252
|
-
avgDuration:
|
|
253
|
-
avgQuality:
|
|
254
|
-
totalEntries:
|
|
255
|
-
qualityDistribution: Array.from(
|
|
256
|
-
quality:
|
|
254
|
+
avgDuration: n.length > 0 ? n.reduce((i, d) => i + d.duration, 0) / n.length : 0,
|
|
255
|
+
avgQuality: n.length > 0 ? n.reduce((i, d) => i + o[d.quality], 0) / n.length : 0,
|
|
256
|
+
totalEntries: n.length,
|
|
257
|
+
qualityDistribution: Array.from(r.entries()).map(([i, d]) => ({
|
|
258
|
+
quality: i,
|
|
257
259
|
count: d
|
|
258
260
|
}))
|
|
259
261
|
};
|
|
@@ -262,12 +264,12 @@ class Z {
|
|
|
262
264
|
MEDICAL RECORDS
|
|
263
265
|
───────────────────────────────────────────────────────────── */
|
|
264
266
|
addMedicalRecord(e) {
|
|
265
|
-
const t = this.generateId(),
|
|
266
|
-
return this.medicalRecords.set(t,
|
|
267
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
268
|
+
return this.medicalRecords.set(t, n), n;
|
|
267
269
|
}
|
|
268
270
|
updateMedicalRecord(e, t) {
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
+
const n = this.medicalRecords.get(e);
|
|
272
|
+
n && this.medicalRecords.set(e, { ...n, ...t, id: e });
|
|
271
273
|
}
|
|
272
274
|
deleteMedicalRecord(e) {
|
|
273
275
|
this.medicalRecords.delete(e);
|
|
@@ -281,21 +283,21 @@ class Z {
|
|
|
281
283
|
return this.getAllMedicalRecords().filter((t) => t.type === e);
|
|
282
284
|
}
|
|
283
285
|
getUpcomingFollowUps(e = 30) {
|
|
284
|
-
const t = /* @__PURE__ */ new Date(),
|
|
286
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() + e * 864e5);
|
|
285
287
|
return this.getAllMedicalRecords().filter(
|
|
286
|
-
(
|
|
288
|
+
(o) => o.followUp && new Date(o.followUp) >= t && new Date(o.followUp) <= n
|
|
287
289
|
);
|
|
288
290
|
}
|
|
289
291
|
/* ─────────────────────────────────────────────────────────────
|
|
290
292
|
MEDICATIONS
|
|
291
293
|
───────────────────────────────────────────────────────────── */
|
|
292
294
|
addMedication(e) {
|
|
293
|
-
const t = this.generateId(),
|
|
294
|
-
return this.medications.set(t,
|
|
295
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
296
|
+
return this.medications.set(t, n), n;
|
|
295
297
|
}
|
|
296
298
|
updateMedication(e, t) {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
+
const n = this.medications.get(e);
|
|
300
|
+
n && this.medications.set(e, { ...n, ...t, id: e });
|
|
299
301
|
}
|
|
300
302
|
deleteMedication(e) {
|
|
301
303
|
this.medications.delete(e), this.medicationLogs = this.medicationLogs.filter((t) => t.medicationId !== e);
|
|
@@ -306,46 +308,46 @@ class Z {
|
|
|
306
308
|
getActiveMedications() {
|
|
307
309
|
return this.getAllMedications().filter((e) => e.isActive);
|
|
308
310
|
}
|
|
309
|
-
logMedication(e, t,
|
|
310
|
-
const
|
|
311
|
+
logMedication(e, t, n, o) {
|
|
312
|
+
const r = {
|
|
311
313
|
id: this.generateId(),
|
|
312
314
|
medicationId: e,
|
|
313
315
|
scheduledTime: t,
|
|
314
|
-
takenTime:
|
|
315
|
-
skipped: !
|
|
316
|
-
notes:
|
|
316
|
+
takenTime: n ? /* @__PURE__ */ new Date() : void 0,
|
|
317
|
+
skipped: !n,
|
|
318
|
+
notes: o
|
|
317
319
|
};
|
|
318
|
-
this.medicationLogs.push(
|
|
320
|
+
this.medicationLogs.push(r);
|
|
319
321
|
}
|
|
320
322
|
getMedicationLogsForDate(e) {
|
|
321
323
|
const t = new Date(e);
|
|
322
324
|
t.setHours(0, 0, 0, 0);
|
|
323
|
-
const
|
|
324
|
-
return this.medicationLogs.filter((
|
|
325
|
-
const
|
|
326
|
-
return
|
|
325
|
+
const n = new Date(t.getTime() + 864e5);
|
|
326
|
+
return this.medicationLogs.filter((o) => {
|
|
327
|
+
const r = new Date(o.scheduledTime);
|
|
328
|
+
return r >= t && r < n;
|
|
327
329
|
});
|
|
328
330
|
}
|
|
329
331
|
getTodayMedicationSchedule() {
|
|
330
|
-
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e),
|
|
331
|
-
for (const
|
|
332
|
-
for (const
|
|
333
|
-
const
|
|
334
|
-
(d) => d.medicationId ===
|
|
332
|
+
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e), n = [];
|
|
333
|
+
for (const o of this.getActiveMedications())
|
|
334
|
+
for (const r of o.times) {
|
|
335
|
+
const i = t.find(
|
|
336
|
+
(d) => d.medicationId === o.id && new Date(d.scheduledTime).toTimeString().startsWith(r)
|
|
335
337
|
);
|
|
336
|
-
|
|
337
|
-
medication:
|
|
338
|
-
time:
|
|
339
|
-
taken: (
|
|
338
|
+
n.push({
|
|
339
|
+
medication: o,
|
|
340
|
+
time: r,
|
|
341
|
+
taken: (i == null ? void 0 : i.takenTime) !== void 0
|
|
340
342
|
});
|
|
341
343
|
}
|
|
342
|
-
return
|
|
344
|
+
return n.sort((o, r) => o.time.localeCompare(r.time));
|
|
343
345
|
}
|
|
344
346
|
/* ─────────────────────────────────────────────────────────────
|
|
345
347
|
VITALS
|
|
346
348
|
───────────────────────────────────────────────────────────── */
|
|
347
349
|
recordVitals(e) {
|
|
348
|
-
this.vitals.push(e), this.vitals.sort((t,
|
|
350
|
+
this.vitals.push(e), this.vitals.sort((t, n) => new Date(n.date).getTime() - new Date(t.date).getTime());
|
|
349
351
|
}
|
|
350
352
|
getVitalsHistory() {
|
|
351
353
|
return [...this.vitals];
|
|
@@ -355,21 +357,21 @@ class Z {
|
|
|
355
357
|
}
|
|
356
358
|
getWeightHistory(e = 30) {
|
|
357
359
|
const t = new Date(Date.now() - e * 864e5);
|
|
358
|
-
return this.vitals.filter((
|
|
360
|
+
return this.vitals.filter((n) => n.weight !== void 0 && new Date(n.date) >= t).map((n) => ({ date: n.date, weight: n.weight }));
|
|
359
361
|
}
|
|
360
362
|
/* ─────────────────────────────────────────────────────────────
|
|
361
363
|
GOALS
|
|
362
364
|
───────────────────────────────────────────────────────────── */
|
|
363
365
|
setGoal(e) {
|
|
364
|
-
const t = this.goals.findIndex((
|
|
366
|
+
const t = this.goals.findIndex((n) => n.id === e.id);
|
|
365
367
|
t >= 0 ? this.goals[t] = e : this.goals.push(e);
|
|
366
368
|
}
|
|
367
369
|
getGoals() {
|
|
368
370
|
return [...this.goals];
|
|
369
371
|
}
|
|
370
372
|
updateGoalProgress(e, t) {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
+
const n = this.goals.find((o) => o.id === e);
|
|
374
|
+
n && (n.current = t);
|
|
373
375
|
}
|
|
374
376
|
/* ─────────────────────────────────────────────────────────────
|
|
375
377
|
UTILITIES
|
|
@@ -381,17 +383,17 @@ class Z {
|
|
|
381
383
|
this.workouts.clear(), this.meals.clear(), this.sleep.clear(), this.medicalRecords.clear(), this.medications.clear(), this.medicationLogs = [], this.vitals = [], this.goals = [];
|
|
382
384
|
}
|
|
383
385
|
}
|
|
384
|
-
function
|
|
385
|
-
return new
|
|
386
|
+
function qe() {
|
|
387
|
+
return new se();
|
|
386
388
|
}
|
|
387
|
-
const
|
|
388
|
-
function
|
|
389
|
-
const s =
|
|
389
|
+
const G = /* @__PURE__ */ N(null);
|
|
390
|
+
function Ke() {
|
|
391
|
+
const s = W(G);
|
|
390
392
|
if (!s)
|
|
391
393
|
throw new Error("useHealth must be used within HealthProvider");
|
|
392
394
|
return s;
|
|
393
395
|
}
|
|
394
|
-
const
|
|
396
|
+
const f = {
|
|
395
397
|
container: {
|
|
396
398
|
display: "flex",
|
|
397
399
|
height: "100%",
|
|
@@ -462,185 +464,176 @@ const h = {
|
|
|
462
464
|
borderBottom: "1px solid #f0f0f0"
|
|
463
465
|
}
|
|
464
466
|
};
|
|
465
|
-
function
|
|
466
|
-
const [,
|
|
467
|
-
{ id: "overview", label: "Overview" },
|
|
468
|
-
{ id: "workouts", label: "Workouts" },
|
|
469
|
-
{ id: "nutrition", label: "Nutrition" },
|
|
470
|
-
{ id: "sleep", label: "Sleep" },
|
|
471
|
-
{ id: "medical", label: "Medical" },
|
|
472
|
-
{ id: "medications", label: "Medications" }
|
|
467
|
+
function Qe({ service: s, className: e, style: t }) {
|
|
468
|
+
const { t: n } = w(), [, o] = D(0), [r, i] = D("overview"), d = L(() => o((u) => u + 1), []), c = { service: s, refresh: d }, g = [
|
|
469
|
+
{ id: "overview", label: n("health.overview", "Overview") },
|
|
470
|
+
{ id: "workouts", label: n("health.workouts", "Workouts") },
|
|
471
|
+
{ id: "nutrition", label: n("health.nutrition", "Nutrition") },
|
|
472
|
+
{ id: "sleep", label: n("health.sleep", "Sleep") },
|
|
473
|
+
{ id: "medical", label: n("health.medical", "Medical") },
|
|
474
|
+
{ id: "medications", label: n("health.medications", "Medications") }
|
|
473
475
|
];
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ a(G.Provider, { value: c, children: /* @__PURE__ */ l("div", { className: e, style: { ...f.container, ...t }, children: [
|
|
477
|
+
/* @__PURE__ */ a("div", { style: f.sidebar, children: g.map((u) => /* @__PURE__ */ a(
|
|
476
478
|
"div",
|
|
477
479
|
{
|
|
478
|
-
onClick: () =>
|
|
480
|
+
onClick: () => i(u.id),
|
|
479
481
|
style: {
|
|
480
|
-
...
|
|
481
|
-
backgroundColor:
|
|
482
|
-
borderLeftColor:
|
|
483
|
-
fontWeight:
|
|
482
|
+
...f.navItem,
|
|
483
|
+
backgroundColor: r === u.id ? "#e3f2fd" : "transparent",
|
|
484
|
+
borderLeftColor: r === u.id ? "#1976d2" : "transparent",
|
|
485
|
+
fontWeight: r === u.id ? 600 : 400
|
|
484
486
|
},
|
|
485
|
-
children: /* @__PURE__ */
|
|
487
|
+
children: /* @__PURE__ */ a("span", { children: u.label })
|
|
486
488
|
},
|
|
487
|
-
|
|
489
|
+
u.id
|
|
488
490
|
)) }),
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
491
|
+
/* @__PURE__ */ l("div", { style: f.main, children: [
|
|
492
|
+
r === "overview" && /* @__PURE__ */ a(le, { service: s }),
|
|
493
|
+
r === "workouts" && /* @__PURE__ */ a(de, { service: s, refresh: d }),
|
|
494
|
+
r === "nutrition" && /* @__PURE__ */ a(ce, { service: s }),
|
|
495
|
+
r === "sleep" && /* @__PURE__ */ a(he, { service: s }),
|
|
496
|
+
r === "medical" && /* @__PURE__ */ a(ue, { service: s }),
|
|
497
|
+
r === "medications" && /* @__PURE__ */ a(ge, { service: s, refresh: d })
|
|
496
498
|
] })
|
|
497
499
|
] }) });
|
|
498
500
|
}
|
|
499
|
-
function
|
|
500
|
-
const e = s.getWorkoutStats(7),
|
|
501
|
-
return /* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
501
|
+
function le({ service: s }) {
|
|
502
|
+
const { t: e } = w(), t = s.getWorkoutStats(7), n = s.getSleepStats(7), o = s.getDailyNutrition(/* @__PURE__ */ new Date()), r = s.getLatestVitals(), i = s.getTodayMedicationSchedule();
|
|
503
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
504
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.healthOverview", "Health Overview") }),
|
|
505
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
506
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
507
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.thisWeeksWorkouts", "This Week's Workouts") }),
|
|
508
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: t.totalWorkouts }),
|
|
509
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.workouts", "Workouts") }),
|
|
510
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "12px", display: "flex", gap: "20px" }, children: [
|
|
511
|
+
/* @__PURE__ */ l("div", { children: [
|
|
512
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: t.totalDuration }),
|
|
513
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.minutes", "Minutes") })
|
|
512
514
|
] }),
|
|
513
|
-
/* @__PURE__ */
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ l("div", { children: [
|
|
516
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: t.totalCalories }),
|
|
517
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.calories", "Calories") })
|
|
516
518
|
] })
|
|
517
519
|
] })
|
|
518
520
|
] }),
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
|
|
521
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
522
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.sleep7DayAverage", "Sleep (7-Day Average)") }),
|
|
523
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
524
|
+
n.avgDuration.toFixed(1),
|
|
523
525
|
"h"
|
|
524
526
|
] }),
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
"
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
] }) })
|
|
527
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.perNight", "Per Night") }),
|
|
528
|
+
/* @__PURE__ */ a("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: e("health.quality4", "Quality: {avgQuality}/4").replace(
|
|
529
|
+
"{avgQuality}",
|
|
530
|
+
String(n.avgQuality.toFixed(1))
|
|
531
|
+
) }) })
|
|
531
532
|
] }),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
534
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysNutrition", "Today's Nutrition") }),
|
|
535
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.calories }),
|
|
536
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.calories", "Calories") }),
|
|
537
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "12px", display: "flex", gap: "16px", fontSize: "14px" }, children: [
|
|
538
|
+
/* @__PURE__ */ l("div", { children: [
|
|
538
539
|
"P: ",
|
|
539
|
-
|
|
540
|
+
o.protein,
|
|
540
541
|
"g"
|
|
541
542
|
] }),
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ l("div", { children: [
|
|
543
544
|
"C: ",
|
|
544
|
-
|
|
545
|
+
o.carbs,
|
|
545
546
|
"g"
|
|
546
547
|
] }),
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
+
/* @__PURE__ */ l("div", { children: [
|
|
548
549
|
"F: ",
|
|
549
|
-
|
|
550
|
+
o.fat,
|
|
550
551
|
"g"
|
|
551
552
|
] })
|
|
552
553
|
] })
|
|
553
554
|
] }),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
555
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
556
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.latestVitals", "Latest Vitals") }),
|
|
557
|
+
r ? /* @__PURE__ */ l("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }, children: [
|
|
558
|
+
r.weight && /* @__PURE__ */ l("div", { children: [
|
|
559
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
560
|
+
r.weight,
|
|
560
561
|
" ",
|
|
561
|
-
|
|
562
|
+
r.weightUnit || e("health.kg", "kg")
|
|
562
563
|
] }),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.weight", "Weight") })
|
|
564
565
|
] }),
|
|
565
|
-
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
|
|
566
|
+
r.bloodPressureSystolic && /* @__PURE__ */ l("div", { children: [
|
|
567
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
568
|
+
r.bloodPressureSystolic,
|
|
568
569
|
"/",
|
|
569
|
-
|
|
570
|
+
r.bloodPressureDiastolic
|
|
570
571
|
] }),
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.bloodPressure", "Blood Pressure") })
|
|
572
573
|
] }),
|
|
573
|
-
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
/* @__PURE__ */
|
|
574
|
+
r.heartRate && /* @__PURE__ */ l("div", { children: [
|
|
575
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: r.heartRate }),
|
|
576
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.heartRate", "Heart Rate") })
|
|
576
577
|
] })
|
|
577
|
-
] }) : /* @__PURE__ */
|
|
578
|
+
] }) : /* @__PURE__ */ a("div", { style: { color: "#999" }, children: e("health.noVitalsRecorded", "No vitals recorded") })
|
|
578
579
|
] })
|
|
579
580
|
] }),
|
|
580
|
-
/* @__PURE__ */
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
|
|
581
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
582
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysMedications", "Today's Medications") }),
|
|
583
|
+
i.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: e("health.noMedicationsScheduled", "No medications scheduled") }) : i.map((d, c) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
584
|
+
/* @__PURE__ */ a("span", { style: { width: "60px", fontWeight: 500 }, children: d.time }),
|
|
585
|
+
/* @__PURE__ */ l("span", { style: { flex: 1 }, children: [
|
|
586
|
+
d.medication.name,
|
|
586
587
|
" (",
|
|
587
|
-
|
|
588
|
+
d.medication.dosage,
|
|
588
589
|
")"
|
|
589
590
|
] }),
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ a(
|
|
591
592
|
"span",
|
|
592
593
|
{
|
|
593
594
|
style: {
|
|
594
595
|
padding: "4px 12px",
|
|
595
596
|
borderRadius: "12px",
|
|
596
597
|
fontSize: "12px",
|
|
597
|
-
backgroundColor:
|
|
598
|
-
color:
|
|
598
|
+
backgroundColor: d.taken ? "#e8f5e9" : "#fff3e0",
|
|
599
|
+
color: d.taken ? "#2e7d32" : "#ef6c00"
|
|
599
600
|
},
|
|
600
|
-
children:
|
|
601
|
+
children: d.taken ? e("health.taken", "Taken") : e("health.pending", "Pending")
|
|
601
602
|
}
|
|
602
603
|
)
|
|
603
|
-
] },
|
|
604
|
+
] }, c))
|
|
604
605
|
] })
|
|
605
606
|
] });
|
|
606
607
|
}
|
|
607
|
-
function
|
|
608
|
+
function de({
|
|
608
609
|
service: s,
|
|
609
610
|
refresh: e
|
|
610
611
|
}) {
|
|
611
|
-
const t = s.getAllWorkouts(),
|
|
612
|
-
return /* @__PURE__ */
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
612
|
+
const { t } = w(), n = s.getAllWorkouts(), o = s.getWorkoutStats(30);
|
|
613
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
614
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("health.workouts", "Workouts") }),
|
|
615
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
616
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
617
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalWorkouts }),
|
|
618
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.workouts30Days", "Workouts (30 days)") })
|
|
618
619
|
] }),
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
620
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
621
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalDuration }),
|
|
622
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.totalMinutes", "Total Minutes") })
|
|
622
623
|
] }),
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
625
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalCalories }),
|
|
626
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.caloriesBurned", "Calories Burned") })
|
|
626
627
|
] })
|
|
627
628
|
] }),
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
634
|
-
new Date(n.date).toLocaleDateString(),
|
|
635
|
-
" • ",
|
|
636
|
-
n.duration,
|
|
637
|
-
" min •",
|
|
638
|
-
" ",
|
|
639
|
-
n.caloriesBurned,
|
|
640
|
-
" cal"
|
|
641
|
-
] })
|
|
629
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
630
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.recentWorkouts", "Recent Workouts") }),
|
|
631
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: t("health.noWorkoutsLoggedYet", "No workouts logged yet") }) : n.slice(0, 10).map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
632
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
633
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: r.name }),
|
|
634
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: t("health.minCal", "{date} • {duration} min • {caloriesBurned} cal").replace("{date}", String(new Date(r.date).toLocaleDateString())).replace("{duration}", String(r.duration)).replace("{caloriesBurned}", String(r.caloriesBurned)) })
|
|
642
635
|
] }),
|
|
643
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ a(
|
|
644
637
|
"span",
|
|
645
638
|
{
|
|
646
639
|
style: {
|
|
@@ -648,188 +641,201 @@ function te({
|
|
|
648
641
|
borderRadius: "4px",
|
|
649
642
|
fontSize: "12px",
|
|
650
643
|
backgroundColor: "#e3f2fd",
|
|
651
|
-
color: "#1565c0"
|
|
652
|
-
textTransform: "capitalize"
|
|
644
|
+
color: "#1565c0"
|
|
653
645
|
},
|
|
654
|
-
children:
|
|
646
|
+
children: t(`health.exerciseType.${r.type}`, r.type)
|
|
655
647
|
}
|
|
656
648
|
)
|
|
657
|
-
] },
|
|
649
|
+
] }, r.id))
|
|
658
650
|
] })
|
|
659
651
|
] });
|
|
660
652
|
}
|
|
661
|
-
function
|
|
662
|
-
const e = s.getDailyNutrition(/* @__PURE__ */ new Date()),
|
|
663
|
-
return /* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
{
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
653
|
+
function ce({ service: s }) {
|
|
654
|
+
const { t: e } = w(), t = s.getDailyNutrition(/* @__PURE__ */ new Date()), n = s.getMealsForDate(/* @__PURE__ */ new Date()), o = { calories: 2e3, protein: 150, carbs: 250, fat: 65 };
|
|
655
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
656
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.nutrition", "Nutrition") }),
|
|
657
|
+
/* @__PURE__ */ a("div", { style: f.grid, children: [
|
|
658
|
+
{
|
|
659
|
+
label: e("health.calories", "Calories"),
|
|
660
|
+
value: t.calories,
|
|
661
|
+
target: o.calories,
|
|
662
|
+
unit: ""
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
label: e("health.protein", "Protein"),
|
|
666
|
+
value: t.protein,
|
|
667
|
+
target: o.protein,
|
|
668
|
+
unit: "g"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
label: e("health.carbs", "Carbs"),
|
|
672
|
+
value: t.carbs,
|
|
673
|
+
target: o.carbs,
|
|
674
|
+
unit: "g"
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
label: e("health.fat", "Fat"),
|
|
678
|
+
value: t.fat,
|
|
679
|
+
target: o.fat,
|
|
680
|
+
unit: "g"
|
|
681
|
+
}
|
|
682
|
+
].map((r) => /* @__PURE__ */ l("div", { style: f.card, children: [
|
|
683
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
684
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: r.label }),
|
|
685
|
+
/* @__PURE__ */ l("span", { children: [
|
|
686
|
+
r.value,
|
|
687
|
+
r.unit,
|
|
676
688
|
" / ",
|
|
677
|
-
|
|
678
|
-
|
|
689
|
+
r.target,
|
|
690
|
+
r.unit
|
|
679
691
|
] })
|
|
680
692
|
] }),
|
|
681
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ a("div", { style: f.progressBar, children: /* @__PURE__ */ a(
|
|
682
694
|
"div",
|
|
683
695
|
{
|
|
684
696
|
style: {
|
|
685
|
-
width: `${Math.min(100,
|
|
697
|
+
width: `${Math.min(100, r.value / r.target * 100)}%`,
|
|
686
698
|
height: "100%",
|
|
687
|
-
backgroundColor:
|
|
699
|
+
backgroundColor: r.value > r.target ? "#f44336" : "#4caf50",
|
|
688
700
|
borderRadius: "4px"
|
|
689
701
|
}
|
|
690
702
|
}
|
|
691
703
|
) })
|
|
692
|
-
] },
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
700
|
-
|
|
701
|
-
" cal • P:"
|
|
702
|
-
|
|
703
|
-
"g C:",
|
|
704
|
-
n.totalCarbs,
|
|
705
|
-
"g F:",
|
|
706
|
-
n.totalFat,
|
|
707
|
-
"g"
|
|
708
|
-
] })
|
|
704
|
+
] }, r.label)) }),
|
|
705
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
706
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysMeals", "Today's Meals") }),
|
|
707
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noMealsLoggedToday", "No meals logged today") }) : n.map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
708
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500, width: "80px" }, children: e(`health.mealType.${r.type}`, r.type) }),
|
|
709
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
710
|
+
/* @__PURE__ */ a("div", { children: r.foods.map((i) => i.item.name).join(", ") }),
|
|
711
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e(
|
|
712
|
+
"health.calPGCG",
|
|
713
|
+
"{totalCalories} cal • P:{totalProtein}g C:{totalCarbs}g F:{totalFat}g"
|
|
714
|
+
).replace("{totalCalories}", String(r.totalCalories)).replace("{totalProtein}", String(r.totalProtein)).replace("{totalCarbs}", String(r.totalCarbs)).replace("{totalFat}", String(r.totalFat)) })
|
|
709
715
|
] })
|
|
710
|
-
] },
|
|
716
|
+
] }, r.id))
|
|
711
717
|
] })
|
|
712
718
|
] });
|
|
713
719
|
}
|
|
714
|
-
function
|
|
715
|
-
const e = s.getSleepStats(7),
|
|
720
|
+
function he({ service: s }) {
|
|
721
|
+
const { t: e } = w(), t = s.getSleepStats(7), n = s.getAllSleepEntries(), o = {
|
|
716
722
|
poor: "#f44336",
|
|
717
723
|
fair: "#ff9800",
|
|
718
724
|
good: "#4caf50",
|
|
719
725
|
excellent: "#2196f3"
|
|
720
726
|
};
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
|
|
727
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
728
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.sleepTracking", "Sleep Tracking") }),
|
|
729
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
730
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
731
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
732
|
+
t.avgDuration.toFixed(1),
|
|
727
733
|
"h"
|
|
728
734
|
] }),
|
|
729
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.avgSleep7Days", "Avg Sleep (7 days)") })
|
|
730
736
|
] }),
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
|
|
737
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
738
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
739
|
+
t.avgQuality.toFixed(1),
|
|
734
740
|
"/4"
|
|
735
741
|
] }),
|
|
736
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.avgQuality", "Avg Quality") })
|
|
737
743
|
] })
|
|
738
744
|
] }),
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */ a("span", { style: { flex: 1 }, children:
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
746
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.sleepHistory", "Sleep History") }),
|
|
747
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noSleepDataLogged", "No sleep data logged") }) : n.slice(0, 10).map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
748
|
+
/* @__PURE__ */ a("span", { style: { width: "100px" }, children: new Date(r.date).toLocaleDateString() }),
|
|
749
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: e("health.hours", "{duration} hours").replace(
|
|
750
|
+
"{duration}",
|
|
751
|
+
String(r.duration.toFixed(1))
|
|
752
|
+
) }),
|
|
753
|
+
/* @__PURE__ */ a(
|
|
748
754
|
"span",
|
|
749
755
|
{
|
|
750
756
|
style: {
|
|
751
757
|
padding: "4px 12px",
|
|
752
758
|
borderRadius: "12px",
|
|
753
759
|
fontSize: "12px",
|
|
754
|
-
backgroundColor: r
|
|
755
|
-
color: r
|
|
756
|
-
textTransform: "capitalize"
|
|
760
|
+
backgroundColor: o[r.quality] + "20",
|
|
761
|
+
color: o[r.quality]
|
|
757
762
|
},
|
|
758
|
-
children:
|
|
763
|
+
children: e(`health.sleepQuality.${r.quality}`, r.quality)
|
|
759
764
|
}
|
|
760
765
|
)
|
|
761
|
-
] },
|
|
766
|
+
] }, r.id))
|
|
762
767
|
] })
|
|
763
768
|
] });
|
|
764
769
|
}
|
|
765
|
-
function
|
|
766
|
-
const e = s.getAllMedicalRecords(),
|
|
767
|
-
appointment: "Appt",
|
|
768
|
-
"lab-result": "Lab",
|
|
769
|
-
vaccination: "Vacc",
|
|
770
|
-
prescription: "Rx",
|
|
771
|
-
procedure: "Proc",
|
|
772
|
-
diagnosis: "Dx",
|
|
773
|
-
note: "Note"
|
|
774
|
-
},
|
|
770
|
+
function ue({ service: s }) {
|
|
771
|
+
const { t: e } = w(), t = s.getAllMedicalRecords(), n = s.getUpcomingFollowUps(), o = {
|
|
772
|
+
appointment: e("health.appt", "Appt"),
|
|
773
|
+
"lab-result": e("health.lab", "Lab"),
|
|
774
|
+
vaccination: e("health.vacc", "Vacc"),
|
|
775
|
+
prescription: e("health.rx", "Rx"),
|
|
776
|
+
procedure: e("health.proc", "Proc"),
|
|
777
|
+
diagnosis: e("health.dx", "Dx"),
|
|
778
|
+
note: e("health.note", "Note")
|
|
779
|
+
}, r = {
|
|
775
780
|
minWidth: "40px",
|
|
776
781
|
fontSize: "11px",
|
|
777
782
|
fontWeight: 600,
|
|
778
783
|
textTransform: "uppercase",
|
|
779
784
|
color: "#666"
|
|
780
785
|
};
|
|
781
|
-
return /* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
] },
|
|
786
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
787
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.medicalRecords", "Medical Records") }),
|
|
788
|
+
n.length > 0 && /* @__PURE__ */ l("div", { style: { ...f.card, marginBottom: "20px", backgroundColor: "#fff3e0" }, children: [
|
|
789
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.upcomingFollowUps", "Upcoming Follow-ups") }),
|
|
790
|
+
n.map((i) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
791
|
+
/* @__PURE__ */ a("span", { style: r, children: o[i.type] }),
|
|
792
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: i.title }),
|
|
793
|
+
/* @__PURE__ */ a("span", { style: { color: "#ef6c00" }, children: new Date(i.followUp).toLocaleDateString() })
|
|
794
|
+
] }, i.id))
|
|
790
795
|
] }),
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
new Date(
|
|
799
|
-
|
|
796
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
797
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.allRecords", "All Records") }),
|
|
798
|
+
t.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noMedicalRecords", "No medical records") }) : t.slice(0, 15).map((i) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
799
|
+
/* @__PURE__ */ a("span", { style: r, children: o[i.type] }),
|
|
800
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
801
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.title }),
|
|
802
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
803
|
+
new Date(i.date).toLocaleDateString(),
|
|
804
|
+
i.provider && ` • ${i.provider}`
|
|
800
805
|
] })
|
|
801
806
|
] })
|
|
802
|
-
] },
|
|
807
|
+
] }, i.id))
|
|
803
808
|
] })
|
|
804
809
|
] });
|
|
805
810
|
}
|
|
806
|
-
function
|
|
811
|
+
function ge({
|
|
807
812
|
service: s,
|
|
808
813
|
refresh: e
|
|
809
814
|
}) {
|
|
815
|
+
const { t } = w();
|
|
810
816
|
s.getAllMedications();
|
|
811
|
-
const
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
parseInt(
|
|
815
|
-
parseInt(
|
|
817
|
+
const n = s.getActiveMedications(), o = s.getTodayMedicationSchedule(), r = (i) => {
|
|
818
|
+
const d = /* @__PURE__ */ new Date();
|
|
819
|
+
d.setHours(
|
|
820
|
+
parseInt(i.times[0].split(":")[0]),
|
|
821
|
+
parseInt(i.times[0].split(":")[1]),
|
|
816
822
|
0
|
|
817
|
-
), s.logMedication(
|
|
823
|
+
), s.logMedication(i.id, d, !0), e();
|
|
818
824
|
};
|
|
819
|
-
return /* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
825
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
826
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("health.medications", "Medications") }),
|
|
827
|
+
/* @__PURE__ */ l("div", { style: { ...f.card, marginBottom: "20px" }, children: [
|
|
828
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.todaysSchedule", "Today's Schedule") }),
|
|
829
|
+
o.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: t("health.noMedicationsScheduled", "No medications scheduled") }) : o.map((i, d) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
830
|
+
/* @__PURE__ */ a("span", { style: { width: "60px", fontWeight: 500 }, children: i.time }),
|
|
831
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
832
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.medication.name }),
|
|
833
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: i.medication.dosage })
|
|
828
834
|
] }),
|
|
829
|
-
!
|
|
835
|
+
!i.taken && /* @__PURE__ */ a(
|
|
830
836
|
"button",
|
|
831
837
|
{
|
|
832
|
-
onClick: () =>
|
|
838
|
+
onClick: () => r(i.medication),
|
|
833
839
|
style: {
|
|
834
840
|
padding: "6px 16px",
|
|
835
841
|
border: "none",
|
|
@@ -839,28 +845,28 @@ function oe({
|
|
|
839
845
|
cursor: "pointer",
|
|
840
846
|
fontSize: "12px"
|
|
841
847
|
},
|
|
842
|
-
children: "Mark Taken"
|
|
848
|
+
children: t("health.markTaken", "Mark Taken")
|
|
843
849
|
}
|
|
844
850
|
),
|
|
845
|
-
|
|
846
|
-
] },
|
|
851
|
+
i.taken && /* @__PURE__ */ a("span", { style: { color: "#4caf50", fontSize: "12px" }, children: t("health.taken", "Taken") })
|
|
852
|
+
] }, d))
|
|
847
853
|
] }),
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
|
|
854
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
855
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.activeMedications", "Active Medications") }),
|
|
856
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: t("health.noActiveMedications", "No active medications") }) : n.map((i) => /* @__PURE__ */ a("div", { style: f.listItem, children: /* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
857
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.name }),
|
|
858
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
859
|
+
i.dosage,
|
|
854
860
|
" • ",
|
|
855
|
-
|
|
861
|
+
i.frequency,
|
|
856
862
|
" • ",
|
|
857
|
-
|
|
863
|
+
i.times.join(", ")
|
|
858
864
|
] })
|
|
859
|
-
] }) },
|
|
865
|
+
] }) }, i.id))
|
|
860
866
|
] })
|
|
861
867
|
] });
|
|
862
868
|
}
|
|
863
|
-
const
|
|
869
|
+
const pe = [
|
|
864
870
|
{ id: "income", name: "Income", icon: "dollar", color: "#4caf50" },
|
|
865
871
|
{ id: "salary", name: "Salary", icon: "briefcase", color: "#4caf50", parent: "income" },
|
|
866
872
|
{ id: "interest", name: "Interest", icon: "building", color: "#4caf50", parent: "income" },
|
|
@@ -883,31 +889,31 @@ const se = [
|
|
|
883
889
|
{ id: "transfer", name: "Transfer", icon: "shuffle", color: "#9e9e9e" },
|
|
884
890
|
{ id: "other", name: "Other", icon: "box", color: "#9e9e9e" }
|
|
885
891
|
];
|
|
886
|
-
class
|
|
892
|
+
class fe {
|
|
887
893
|
constructor() {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
894
|
+
k(this, "accounts", /* @__PURE__ */ new Map());
|
|
895
|
+
k(this, "transactions", /* @__PURE__ */ new Map());
|
|
896
|
+
k(this, "budgets", /* @__PURE__ */ new Map());
|
|
897
|
+
k(this, "bills", /* @__PURE__ */ new Map());
|
|
898
|
+
k(this, "investments", /* @__PURE__ */ new Map());
|
|
899
|
+
k(this, "categories", [...pe]);
|
|
900
|
+
k(this, "netWorthHistory", []);
|
|
895
901
|
}
|
|
896
902
|
/* ─────────────────────────────────────────────────────────────
|
|
897
903
|
ACCOUNTS
|
|
898
904
|
───────────────────────────────────────────────────────────── */
|
|
899
905
|
addAccount(e) {
|
|
900
|
-
const t = this.generateId(),
|
|
901
|
-
return this.accounts.set(t,
|
|
906
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
907
|
+
return this.accounts.set(t, n), n;
|
|
902
908
|
}
|
|
903
909
|
updateAccount(e, t) {
|
|
904
|
-
const
|
|
905
|
-
|
|
910
|
+
const n = this.accounts.get(e);
|
|
911
|
+
n && this.accounts.set(e, { ...n, ...t, id: e });
|
|
906
912
|
}
|
|
907
913
|
deleteAccount(e) {
|
|
908
914
|
this.accounts.delete(e);
|
|
909
|
-
for (const [t,
|
|
910
|
-
|
|
915
|
+
for (const [t, n] of this.transactions)
|
|
916
|
+
n.accountId === e && this.transactions.delete(t);
|
|
911
917
|
}
|
|
912
918
|
getAllAccounts() {
|
|
913
919
|
return Array.from(this.accounts.values());
|
|
@@ -940,30 +946,30 @@ class ae {
|
|
|
940
946
|
TRANSACTIONS
|
|
941
947
|
───────────────────────────────────────────────────────────── */
|
|
942
948
|
addTransaction(e) {
|
|
943
|
-
const t = this.generateId(),
|
|
944
|
-
this.transactions.set(t,
|
|
945
|
-
const
|
|
946
|
-
if (
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
950
|
+
this.transactions.set(t, n);
|
|
951
|
+
const o = this.accounts.get(e.accountId);
|
|
952
|
+
if (o) {
|
|
953
|
+
const r = e.type === "income" ? e.amount : -e.amount;
|
|
954
|
+
o.balance += r, this.accounts.set(o.id, o);
|
|
949
955
|
}
|
|
950
956
|
if (e.categoryId && e.type === "expense") {
|
|
951
|
-
const
|
|
952
|
-
|
|
957
|
+
const r = this.getBudgetByCategory(e.categoryId);
|
|
958
|
+
r && (r.spent += e.amount, this.budgets.set(r.id, r));
|
|
953
959
|
}
|
|
954
|
-
return
|
|
960
|
+
return n;
|
|
955
961
|
}
|
|
956
962
|
updateTransaction(e, t) {
|
|
957
|
-
const
|
|
958
|
-
|
|
963
|
+
const n = this.transactions.get(e);
|
|
964
|
+
n && this.transactions.set(e, { ...n, ...t, id: e });
|
|
959
965
|
}
|
|
960
966
|
deleteTransaction(e) {
|
|
961
967
|
const t = this.transactions.get(e);
|
|
962
968
|
if (t) {
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
const
|
|
966
|
-
|
|
969
|
+
const n = this.accounts.get(t.accountId);
|
|
970
|
+
if (n) {
|
|
971
|
+
const o = t.type === "income" ? -t.amount : t.amount;
|
|
972
|
+
n.balance += o, this.accounts.set(n.id, n);
|
|
967
973
|
}
|
|
968
974
|
this.transactions.delete(e);
|
|
969
975
|
}
|
|
@@ -977,9 +983,9 @@ class ae {
|
|
|
977
983
|
return this.getAllTransactions().filter((t) => t.accountId === e);
|
|
978
984
|
}
|
|
979
985
|
getTransactionsForPeriod(e, t) {
|
|
980
|
-
return this.getAllTransactions().filter((
|
|
981
|
-
const
|
|
982
|
-
return
|
|
986
|
+
return this.getAllTransactions().filter((n) => {
|
|
987
|
+
const o = new Date(n.date);
|
|
988
|
+
return o >= e && o <= t;
|
|
983
989
|
});
|
|
984
990
|
}
|
|
985
991
|
getTransactionsByCategory(e) {
|
|
@@ -999,9 +1005,9 @@ class ae {
|
|
|
999
1005
|
{ pattern: /doctor|pharmacy|hospital|medical/i, categoryId: "health" },
|
|
1000
1006
|
{ pattern: /payroll|salary|paycheck|deposit/i, categoryId: "salary" }
|
|
1001
1007
|
];
|
|
1002
|
-
for (const
|
|
1003
|
-
if (
|
|
1004
|
-
return
|
|
1008
|
+
for (const n of t)
|
|
1009
|
+
if (n.pattern.test(e))
|
|
1010
|
+
return n.categoryId;
|
|
1005
1011
|
}
|
|
1006
1012
|
/* ─────────────────────────────────────────────────────────────
|
|
1007
1013
|
CATEGORIES
|
|
@@ -1022,12 +1028,12 @@ class ae {
|
|
|
1022
1028
|
BUDGETS
|
|
1023
1029
|
───────────────────────────────────────────────────────────── */
|
|
1024
1030
|
addBudget(e) {
|
|
1025
|
-
const t = this.generateId(),
|
|
1026
|
-
return this.budgets.set(t,
|
|
1031
|
+
const t = this.generateId(), n = { ...e, id: t, spent: 0 };
|
|
1032
|
+
return this.budgets.set(t, n), n;
|
|
1027
1033
|
}
|
|
1028
1034
|
updateBudget(e, t) {
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1035
|
+
const n = this.budgets.get(e);
|
|
1036
|
+
n && this.budgets.set(e, { ...n, ...t, id: e });
|
|
1031
1037
|
}
|
|
1032
1038
|
deleteBudget(e) {
|
|
1033
1039
|
this.budgets.delete(e);
|
|
@@ -1043,19 +1049,19 @@ class ae {
|
|
|
1043
1049
|
t.rollover || (t.spent = 0), this.budgets.set(e, t);
|
|
1044
1050
|
}
|
|
1045
1051
|
calculateBudgetStatus() {
|
|
1046
|
-
const e = this.getAllBudgets(), t = e.reduce((
|
|
1047
|
-
return { total: t, used:
|
|
1052
|
+
const e = this.getAllBudgets(), t = e.reduce((r, i) => r + i.amount, 0), n = e.reduce((r, i) => r + i.spent, 0), o = e.filter((r) => r.spent > r.amount);
|
|
1053
|
+
return { total: t, used: n, remaining: t - n, overBudget: o };
|
|
1048
1054
|
}
|
|
1049
1055
|
/* ─────────────────────────────────────────────────────────────
|
|
1050
1056
|
BILLS
|
|
1051
1057
|
───────────────────────────────────────────────────────────── */
|
|
1052
1058
|
addBill(e) {
|
|
1053
|
-
const t = this.generateId(),
|
|
1054
|
-
return this.bills.set(t,
|
|
1059
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
1060
|
+
return this.bills.set(t, n), n;
|
|
1055
1061
|
}
|
|
1056
1062
|
updateBill(e, t) {
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1063
|
+
const n = this.bills.get(e);
|
|
1064
|
+
n && this.bills.set(e, { ...n, ...t, id: e });
|
|
1059
1065
|
}
|
|
1060
1066
|
deleteBill(e) {
|
|
1061
1067
|
this.bills.delete(e);
|
|
@@ -1068,11 +1074,11 @@ class ae {
|
|
|
1068
1074
|
return Array.from(this.bills.values());
|
|
1069
1075
|
}
|
|
1070
1076
|
getUpcomingBills(e = 30) {
|
|
1071
|
-
const
|
|
1072
|
-
return this.getAllBills().filter((
|
|
1073
|
-
let
|
|
1074
|
-
return
|
|
1075
|
-
}).sort((
|
|
1077
|
+
const n = (/* @__PURE__ */ new Date()).getDate();
|
|
1078
|
+
return this.getAllBills().filter((o) => {
|
|
1079
|
+
let r = o.dueDate - n;
|
|
1080
|
+
return r < 0 && (r += 30), r <= e;
|
|
1081
|
+
}).sort((o, r) => o.dueDate - r.dueDate);
|
|
1076
1082
|
}
|
|
1077
1083
|
calculateMonthlyBillTotal() {
|
|
1078
1084
|
return this.getAllBills().filter((e) => e.frequency === "monthly").reduce((e, t) => e + t.amount, 0);
|
|
@@ -1081,12 +1087,12 @@ class ae {
|
|
|
1081
1087
|
INVESTMENTS
|
|
1082
1088
|
───────────────────────────────────────────────────────────── */
|
|
1083
1089
|
addInvestment(e) {
|
|
1084
|
-
const t = this.generateId(),
|
|
1085
|
-
return this.investments.set(t,
|
|
1090
|
+
const t = this.generateId(), n = e.shares * e.currentPrice, o = n - e.costBasis, r = e.costBasis > 0 ? o / e.costBasis * 100 : 0, i = { ...e, id: t, currentValue: n, gain: o, gainPercent: r };
|
|
1091
|
+
return this.investments.set(t, i), i;
|
|
1086
1092
|
}
|
|
1087
1093
|
updateInvestmentPrice(e, t) {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1094
|
+
const n = this.investments.get(e);
|
|
1095
|
+
n && (n.currentPrice = t, n.currentValue = n.shares * t, n.gain = n.currentValue - n.costBasis, n.gainPercent = n.costBasis > 0 ? n.gain / n.costBasis * 100 : 0, this.investments.set(e, n));
|
|
1090
1096
|
}
|
|
1091
1097
|
deleteInvestment(e) {
|
|
1092
1098
|
this.investments.delete(e);
|
|
@@ -1104,47 +1110,47 @@ class ae {
|
|
|
1104
1110
|
return this.getAllInvestments().reduce((e, t) => e + t.gain, 0);
|
|
1105
1111
|
}
|
|
1106
1112
|
getPortfolioAllocation() {
|
|
1107
|
-
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(),
|
|
1108
|
-
for (const
|
|
1109
|
-
|
|
1110
|
-
return Array.from(
|
|
1111
|
-
type:
|
|
1112
|
-
value:
|
|
1113
|
-
percentage: t > 0 ?
|
|
1113
|
+
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(), n = /* @__PURE__ */ new Map();
|
|
1114
|
+
for (const o of e)
|
|
1115
|
+
n.set(o.type, (n.get(o.type) || 0) + o.currentValue);
|
|
1116
|
+
return Array.from(n.entries()).map(([o, r]) => ({
|
|
1117
|
+
type: o,
|
|
1118
|
+
value: r,
|
|
1119
|
+
percentage: t > 0 ? r / t * 100 : 0
|
|
1114
1120
|
}));
|
|
1115
1121
|
}
|
|
1116
1122
|
/* ─────────────────────────────────────────────────────────────
|
|
1117
1123
|
ANALYTICS
|
|
1118
1124
|
───────────────────────────────────────────────────────────── */
|
|
1119
1125
|
getSpendingSummary(e, t) {
|
|
1120
|
-
const
|
|
1121
|
-
(
|
|
1122
|
-
),
|
|
1123
|
-
let
|
|
1124
|
-
for (const
|
|
1125
|
-
const d =
|
|
1126
|
-
c.amount +=
|
|
1126
|
+
const n = this.getTransactionsForPeriod(e, t).filter(
|
|
1127
|
+
(i) => i.type === "expense"
|
|
1128
|
+
), o = /* @__PURE__ */ new Map();
|
|
1129
|
+
let r = 0;
|
|
1130
|
+
for (const i of n) {
|
|
1131
|
+
const d = i.categoryId || "other", c = o.get(d) || { amount: 0, count: 0 };
|
|
1132
|
+
c.amount += i.amount, c.count++, o.set(d, c), r += i.amount;
|
|
1127
1133
|
}
|
|
1128
|
-
return Array.from(
|
|
1129
|
-
const c = this.categories.find((g) => g.id ===
|
|
1134
|
+
return Array.from(o.entries()).map(([i, d]) => {
|
|
1135
|
+
const c = this.categories.find((g) => g.id === i);
|
|
1130
1136
|
return {
|
|
1131
|
-
categoryId:
|
|
1137
|
+
categoryId: i,
|
|
1132
1138
|
categoryName: (c == null ? void 0 : c.name) || "Other",
|
|
1133
1139
|
amount: d.amount,
|
|
1134
|
-
percentage:
|
|
1140
|
+
percentage: r > 0 ? d.amount / r * 100 : 0,
|
|
1135
1141
|
transactions: d.count,
|
|
1136
1142
|
trend: "stable"
|
|
1137
1143
|
// Would compare with previous period
|
|
1138
1144
|
};
|
|
1139
|
-
}).sort((
|
|
1145
|
+
}).sort((i, d) => d.amount - i.amount);
|
|
1140
1146
|
}
|
|
1141
1147
|
getMonthlyIncome() {
|
|
1142
1148
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1143
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1149
|
+
return this.getTransactionsForPeriod(t, e).filter((o) => o.type === "income").reduce((o, r) => o + r.amount, 0);
|
|
1144
1150
|
}
|
|
1145
1151
|
getMonthlyExpenses() {
|
|
1146
1152
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1147
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1153
|
+
return this.getTransactionsForPeriod(t, e).filter((o) => o.type === "expense").reduce((o, r) => o + r.amount, 0);
|
|
1148
1154
|
}
|
|
1149
1155
|
getSavingsRate() {
|
|
1150
1156
|
const e = this.getMonthlyIncome(), t = this.getMonthlyExpenses();
|
|
@@ -1178,17 +1184,17 @@ class ae {
|
|
|
1178
1184
|
);
|
|
1179
1185
|
}
|
|
1180
1186
|
}
|
|
1181
|
-
function
|
|
1182
|
-
return new
|
|
1187
|
+
function Ye() {
|
|
1188
|
+
return new fe();
|
|
1183
1189
|
}
|
|
1184
|
-
const
|
|
1185
|
-
function
|
|
1186
|
-
const s =
|
|
1190
|
+
const q = /* @__PURE__ */ N(null);
|
|
1191
|
+
function _e() {
|
|
1192
|
+
const s = W(q);
|
|
1187
1193
|
if (!s)
|
|
1188
1194
|
throw new Error("usePersonalFinance must be used within PersonalFinanceProvider");
|
|
1189
1195
|
return s;
|
|
1190
1196
|
}
|
|
1191
|
-
const
|
|
1197
|
+
const y = {
|
|
1192
1198
|
container: {
|
|
1193
1199
|
display: "flex",
|
|
1194
1200
|
height: "100%",
|
|
@@ -1270,43 +1276,42 @@ const m = {
|
|
|
1270
1276
|
marginTop: "8px"
|
|
1271
1277
|
}
|
|
1272
1278
|
};
|
|
1273
|
-
function
|
|
1279
|
+
function Xe({
|
|
1274
1280
|
service: s,
|
|
1275
1281
|
className: e,
|
|
1276
1282
|
style: t
|
|
1277
1283
|
}) {
|
|
1278
|
-
const [,
|
|
1279
|
-
return /* @__PURE__ */
|
|
1280
|
-
/* @__PURE__ */
|
|
1281
|
-
/* @__PURE__ */
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
+
const { t: n } = w(), [, o] = D(0), [r, i] = D("overview"), d = L(() => o((p) => p + 1), []), c = { service: s, refresh: d }, g = (p) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(p), u = s.getAllAccounts(), h = s.calculateNetWorth();
|
|
1285
|
+
return /* @__PURE__ */ a(q.Provider, { value: c, children: /* @__PURE__ */ l("div", { className: e, style: { ...y.container, ...t }, children: [
|
|
1286
|
+
/* @__PURE__ */ l("div", { style: y.sidebar, children: [
|
|
1287
|
+
/* @__PURE__ */ l("div", { style: y.netWorth, children: [
|
|
1288
|
+
/* @__PURE__ */ a("div", { style: y.netWorthLabel, children: n("personalFinance.netWorth", "Net Worth") }),
|
|
1289
|
+
/* @__PURE__ */ a("div", { style: { ...y.netWorthValue, color: h >= 0 ? "#4caf50" : "#f44336" }, children: g(h) })
|
|
1284
1290
|
] }),
|
|
1285
|
-
/* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1286
1292
|
"overview",
|
|
1287
1293
|
"accounts",
|
|
1288
1294
|
"transactions",
|
|
1289
1295
|
"budgets",
|
|
1290
1296
|
"bills",
|
|
1291
1297
|
"investments"
|
|
1292
|
-
].map((p) => /* @__PURE__ */
|
|
1298
|
+
].map((p) => /* @__PURE__ */ a(
|
|
1293
1299
|
"div",
|
|
1294
1300
|
{
|
|
1295
|
-
onClick: () =>
|
|
1301
|
+
onClick: () => i(p),
|
|
1296
1302
|
style: {
|
|
1297
1303
|
padding: "12px 16px",
|
|
1298
1304
|
borderRadius: "8px",
|
|
1299
1305
|
cursor: "pointer",
|
|
1300
1306
|
marginBottom: "4px",
|
|
1301
|
-
backgroundColor:
|
|
1302
|
-
textTransform: "capitalize"
|
|
1307
|
+
backgroundColor: r === p ? "rgba(255,255,255,0.1)" : "transparent"
|
|
1303
1308
|
},
|
|
1304
|
-
children: p
|
|
1309
|
+
children: n(`personalFinance.tab.${p}`, p.charAt(0).toUpperCase() + p.slice(1))
|
|
1305
1310
|
},
|
|
1306
1311
|
p
|
|
1307
1312
|
)) }),
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ l("div", { style: y.accountList, children: [
|
|
1314
|
+
/* @__PURE__ */ a(
|
|
1310
1315
|
"div",
|
|
1311
1316
|
{
|
|
1312
1317
|
style: {
|
|
@@ -1315,41 +1320,41 @@ function Ee({
|
|
|
1315
1320
|
marginBottom: "12px",
|
|
1316
1321
|
textTransform: "uppercase"
|
|
1317
1322
|
},
|
|
1318
|
-
children: "Accounts"
|
|
1323
|
+
children: n("personalFinance.accounts", "Accounts")
|
|
1319
1324
|
}
|
|
1320
1325
|
),
|
|
1321
|
-
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1326
|
+
u.slice(0, 5).map((p) => /* @__PURE__ */ l("div", { style: y.accountItem, children: [
|
|
1327
|
+
/* @__PURE__ */ a("span", { children: p.name }),
|
|
1328
|
+
/* @__PURE__ */ a("span", { style: { color: p.balance >= 0 ? "#4caf50" : "#f44336" }, children: g(p.balance) })
|
|
1324
1329
|
] }, p.id))
|
|
1325
1330
|
] })
|
|
1326
1331
|
] }),
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1332
|
+
/* @__PURE__ */ l("div", { style: y.main, children: [
|
|
1333
|
+
r === "overview" && /* @__PURE__ */ a(me, { service: s }),
|
|
1334
|
+
r === "accounts" && /* @__PURE__ */ a(ye, { service: s, refresh: d }),
|
|
1335
|
+
r === "transactions" && /* @__PURE__ */ a(xe, { service: s }),
|
|
1336
|
+
r === "budgets" && /* @__PURE__ */ a(be, { service: s }),
|
|
1337
|
+
r === "bills" && /* @__PURE__ */ a(ve, { service: s }),
|
|
1338
|
+
r === "investments" && /* @__PURE__ */ a(we, { service: s })
|
|
1334
1339
|
] })
|
|
1335
1340
|
] }) });
|
|
1336
1341
|
}
|
|
1337
|
-
function
|
|
1338
|
-
const e = (
|
|
1339
|
-
return /* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1342
|
+
function me({ service: s }) {
|
|
1343
|
+
const { t: e, lang: t } = w(), n = (h) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(h), o = s.getMonthlyIncome(), r = s.getMonthlyExpenses(), i = s.getSavingsRate(), d = s.calculateBudgetStatus(), c = s.getUpcomingBills(14), g = /* @__PURE__ */ new Date(), u = s.getSpendingSummary(new Date(g.getFullYear(), g.getMonth(), 1), g);
|
|
1344
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1345
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.financialOverview", "Financial Overview") }),
|
|
1346
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1347
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1348
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.thisMonth", "This Month") }),
|
|
1349
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1350
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.income", "Income") }),
|
|
1351
|
+
/* @__PURE__ */ a("span", { style: { color: "#4caf50", fontWeight: 600 }, children: n(o) })
|
|
1347
1352
|
] }),
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1354
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.expenses", "Expenses") }),
|
|
1355
|
+
/* @__PURE__ */ a("span", { style: { color: "#f44336", fontWeight: 600 }, children: n(r) })
|
|
1351
1356
|
] }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ l(
|
|
1353
1358
|
"div",
|
|
1354
1359
|
{
|
|
1355
1360
|
style: {
|
|
@@ -1359,44 +1364,44 @@ function le({ service: s }) {
|
|
|
1359
1364
|
paddingTop: "12px"
|
|
1360
1365
|
},
|
|
1361
1366
|
children: [
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
|
|
1367
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.savingsRate", "Savings Rate") }),
|
|
1368
|
+
/* @__PURE__ */ l("span", { style: { fontWeight: 600 }, children: [
|
|
1369
|
+
i.toFixed(1),
|
|
1365
1370
|
"%"
|
|
1366
1371
|
] })
|
|
1367
1372
|
]
|
|
1368
1373
|
}
|
|
1369
1374
|
)
|
|
1370
1375
|
] }),
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
|
|
1376
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1377
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.budgetStatus", "Budget Status") }),
|
|
1378
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
1379
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.used", "Used") }),
|
|
1380
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1381
|
+
n(d.used),
|
|
1377
1382
|
" / ",
|
|
1378
|
-
|
|
1383
|
+
n(d.total)
|
|
1379
1384
|
] })
|
|
1380
1385
|
] }),
|
|
1381
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1382
1387
|
"div",
|
|
1383
1388
|
{
|
|
1384
1389
|
style: {
|
|
1385
|
-
width: `${Math.min(100,
|
|
1390
|
+
width: `${Math.min(100, d.used / d.total * 100)}%`,
|
|
1386
1391
|
height: "100%",
|
|
1387
|
-
backgroundColor:
|
|
1392
|
+
backgroundColor: d.used > d.total ? "#f44336" : "#4caf50",
|
|
1388
1393
|
borderRadius: "4px"
|
|
1389
1394
|
}
|
|
1390
1395
|
}
|
|
1391
1396
|
) }),
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
" categories over budget"
|
|
1395
|
-
|
|
1397
|
+
d.overBudget.length > 0 && /* @__PURE__ */ a("div", { style: { color: "#f44336", fontSize: "12px", marginTop: "8px" }, children: e(
|
|
1398
|
+
"personalFinance.categoriesOverBudget",
|
|
1399
|
+
"{overBudget} categories over budget"
|
|
1400
|
+
).replace("{overBudget}", String(d.overBudget.length)) })
|
|
1396
1401
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
|
|
1402
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1403
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.upcomingBills14Days", "Upcoming Bills (14 days)") }),
|
|
1404
|
+
c.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: e("personalFinance.noUpcomingBills", "No upcoming bills") }) : c.slice(0, 4).map((h) => /* @__PURE__ */ l(
|
|
1400
1405
|
"div",
|
|
1401
1406
|
{
|
|
1402
1407
|
style: {
|
|
@@ -1406,61 +1411,60 @@ function le({ service: s }) {
|
|
|
1406
1411
|
borderBottom: "1px solid #f0f0f0"
|
|
1407
1412
|
},
|
|
1408
1413
|
children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
1412
|
-
"
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
] })
|
|
1414
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1415
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: h.name }),
|
|
1416
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("personalFinance.dueOn", "Due: {day}").replace(
|
|
1417
|
+
"{day}",
|
|
1418
|
+
K(h.dueDate, t)
|
|
1419
|
+
) })
|
|
1416
1420
|
] }),
|
|
1417
|
-
/* @__PURE__ */
|
|
1421
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: n(h.amount) })
|
|
1418
1422
|
]
|
|
1419
1423
|
},
|
|
1420
|
-
|
|
1424
|
+
h.id
|
|
1421
1425
|
))
|
|
1422
1426
|
] }),
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1428
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.spendingByCategory", "Spending by Category") }),
|
|
1429
|
+
u.slice(0, 5).map((h) => /* @__PURE__ */ l("div", { style: { marginBottom: "12px" }, children: [
|
|
1430
|
+
/* @__PURE__ */ l(
|
|
1427
1431
|
"div",
|
|
1428
1432
|
{
|
|
1429
1433
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" },
|
|
1430
1434
|
children: [
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
|
|
1435
|
+
/* @__PURE__ */ a("span", { children: h.categoryName }),
|
|
1436
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1437
|
+
n(h.amount),
|
|
1434
1438
|
" (",
|
|
1435
|
-
|
|
1439
|
+
h.percentage.toFixed(0),
|
|
1436
1440
|
"%)"
|
|
1437
1441
|
] })
|
|
1438
1442
|
]
|
|
1439
1443
|
}
|
|
1440
1444
|
),
|
|
1441
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1442
1446
|
"div",
|
|
1443
1447
|
{
|
|
1444
1448
|
style: {
|
|
1445
|
-
width: `${
|
|
1449
|
+
width: `${h.percentage}%`,
|
|
1446
1450
|
height: "100%",
|
|
1447
1451
|
backgroundColor: "#1976d2",
|
|
1448
1452
|
borderRadius: "4px"
|
|
1449
1453
|
}
|
|
1450
1454
|
}
|
|
1451
1455
|
) })
|
|
1452
|
-
] },
|
|
1456
|
+
] }, h.categoryId))
|
|
1453
1457
|
] })
|
|
1454
1458
|
] })
|
|
1455
1459
|
] });
|
|
1456
1460
|
}
|
|
1457
|
-
function
|
|
1461
|
+
function ye({
|
|
1458
1462
|
service: s,
|
|
1459
1463
|
refresh: e
|
|
1460
1464
|
}) {
|
|
1461
|
-
const t = (
|
|
1465
|
+
const { t } = w(), n = (d) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(d);
|
|
1462
1466
|
s.getAllAccounts();
|
|
1463
|
-
const
|
|
1467
|
+
const o = s.calculateTotalAssets(), r = s.calculateTotalLiabilities(), i = [
|
|
1464
1468
|
"checking",
|
|
1465
1469
|
"savings",
|
|
1466
1470
|
"credit-card",
|
|
@@ -1468,72 +1472,72 @@ function de({
|
|
|
1468
1472
|
"loan",
|
|
1469
1473
|
"cash"
|
|
1470
1474
|
];
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1476
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("personalFinance.accounts", "Accounts") }),
|
|
1477
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1478
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1479
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: t("personalFinance.assets", "Assets") }),
|
|
1480
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600, color: "#4caf50" }, children: n(o) })
|
|
1477
1481
|
] }),
|
|
1478
|
-
/* @__PURE__ */
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
1482
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1483
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: t("personalFinance.liabilities", "Liabilities") }),
|
|
1484
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600, color: "#f44336" }, children: n(r) })
|
|
1481
1485
|
] })
|
|
1482
1486
|
] }),
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
return
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1487
|
+
i.map((d) => {
|
|
1488
|
+
const c = s.getAccountsByType(d);
|
|
1489
|
+
return c.length === 0 ? null : /* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1490
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: d.replace("-", " ").replace(/\b\w/g, (g) => g.toUpperCase()) }),
|
|
1491
|
+
c.map((g) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1492
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1493
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: g.name }),
|
|
1494
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: g.institution })
|
|
1491
1495
|
] }),
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
] },
|
|
1494
|
-
] },
|
|
1496
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600, color: g.balance >= 0 ? "#333" : "#f44336" }, children: n(g.balance) })
|
|
1497
|
+
] }, g.id))
|
|
1498
|
+
] }, d);
|
|
1495
1499
|
})
|
|
1496
1500
|
] });
|
|
1497
1501
|
}
|
|
1498
|
-
function
|
|
1499
|
-
const e = (
|
|
1500
|
-
var
|
|
1501
|
-
return ((
|
|
1502
|
+
function xe({ service: s }) {
|
|
1503
|
+
const { t: e } = w(), t = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), n = s.getAllTransactions(), o = s.getAllCategories(), r = (i) => {
|
|
1504
|
+
var d;
|
|
1505
|
+
return ((d = o.find((c) => c.id === i)) == null ? void 0 : d.name) || "Uncategorized";
|
|
1502
1506
|
};
|
|
1503
|
-
return /* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
new Date(
|
|
1507
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1508
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.transactions", "Transactions") }),
|
|
1509
|
+
/* @__PURE__ */ a("div", { style: y.card, children: n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noTransactions", "No transactions") }) : n.slice(0, 20).map((i) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1510
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1511
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.description }),
|
|
1512
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1513
|
+
new Date(i.date).toLocaleDateString(),
|
|
1510
1514
|
" • ",
|
|
1511
|
-
|
|
1515
|
+
r(i.categoryId)
|
|
1512
1516
|
] })
|
|
1513
1517
|
] }),
|
|
1514
|
-
/* @__PURE__ */
|
|
1518
|
+
/* @__PURE__ */ l(
|
|
1515
1519
|
"span",
|
|
1516
1520
|
{
|
|
1517
|
-
style: { fontWeight: 600, color:
|
|
1521
|
+
style: { fontWeight: 600, color: i.type === "income" ? "#4caf50" : "#f44336" },
|
|
1518
1522
|
children: [
|
|
1519
|
-
|
|
1520
|
-
|
|
1523
|
+
i.type === "income" ? "+" : "-",
|
|
1524
|
+
t(i.amount)
|
|
1521
1525
|
]
|
|
1522
1526
|
}
|
|
1523
1527
|
)
|
|
1524
|
-
] },
|
|
1528
|
+
] }, i.id)) })
|
|
1525
1529
|
] });
|
|
1526
1530
|
}
|
|
1527
|
-
function
|
|
1528
|
-
const e = (
|
|
1529
|
-
var
|
|
1530
|
-
return ((
|
|
1531
|
+
function be({ service: s }) {
|
|
1532
|
+
const { t: e } = w(), t = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), n = s.getAllBudgets(), o = s.getAllCategories(), r = (i) => {
|
|
1533
|
+
var d;
|
|
1534
|
+
return ((d = o.find((c) => c.id === i)) == null ? void 0 : d.name) || "Unknown";
|
|
1531
1535
|
};
|
|
1532
|
-
return /* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
const
|
|
1536
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1537
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.budgets", "Budgets") }),
|
|
1538
|
+
/* @__PURE__ */ a("div", { style: y.card, children: n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noBudgetsSet", "No budgets set") }) : n.map((i) => {
|
|
1539
|
+
const d = i.spent / i.amount * 100, c = i.spent > i.amount;
|
|
1540
|
+
return /* @__PURE__ */ l(
|
|
1537
1541
|
"div",
|
|
1538
1542
|
{
|
|
1539
1543
|
style: {
|
|
@@ -1542,181 +1546,188 @@ function ue({ service: s }) {
|
|
|
1542
1546
|
borderBottom: "1px solid #f0f0f0"
|
|
1543
1547
|
},
|
|
1544
1548
|
children: [
|
|
1545
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ l(
|
|
1546
1550
|
"div",
|
|
1547
1551
|
{
|
|
1548
1552
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
1549
1553
|
children: [
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
|
|
1554
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: r(i.categoryId) }),
|
|
1555
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1556
|
+
t(i.spent),
|
|
1553
1557
|
" / ",
|
|
1554
|
-
|
|
1558
|
+
t(i.amount)
|
|
1555
1559
|
] })
|
|
1556
1560
|
]
|
|
1557
1561
|
}
|
|
1558
1562
|
),
|
|
1559
|
-
/* @__PURE__ */
|
|
1563
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1560
1564
|
"div",
|
|
1561
1565
|
{
|
|
1562
1566
|
style: {
|
|
1563
|
-
width: `${Math.min(100,
|
|
1567
|
+
width: `${Math.min(100, d)}%`,
|
|
1564
1568
|
height: "100%",
|
|
1565
|
-
backgroundColor:
|
|
1569
|
+
backgroundColor: c ? "#f44336" : d > 80 ? "#ff9800" : "#4caf50",
|
|
1566
1570
|
borderRadius: "4px"
|
|
1567
1571
|
}
|
|
1568
1572
|
}
|
|
1569
1573
|
) }),
|
|
1570
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ a(
|
|
1571
1575
|
"div",
|
|
1572
1576
|
{
|
|
1573
|
-
style: { fontSize: "12px", color:
|
|
1574
|
-
children:
|
|
1577
|
+
style: { fontSize: "12px", color: c ? "#f44336" : "#666", marginTop: "4px" },
|
|
1578
|
+
children: c ? e("personalFinance.overBy", "Over by {amount}").replace(
|
|
1579
|
+
"{amount}",
|
|
1580
|
+
String(t(i.spent - i.amount))
|
|
1581
|
+
) : e("personalFinance.remaining", "{spent} remaining").replace(
|
|
1582
|
+
"{spent}",
|
|
1583
|
+
String(t(i.amount - i.spent))
|
|
1584
|
+
)
|
|
1575
1585
|
}
|
|
1576
1586
|
)
|
|
1577
1587
|
]
|
|
1578
1588
|
},
|
|
1579
|
-
|
|
1589
|
+
i.id
|
|
1580
1590
|
);
|
|
1581
1591
|
}) })
|
|
1582
1592
|
] });
|
|
1583
1593
|
}
|
|
1584
|
-
function
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1594
|
+
function K(s, e) {
|
|
1595
|
+
return e !== "en" ? String(s) : `${s}${{ one: "st", two: "nd", few: "rd", other: "th" }[new Intl.PluralRules("en", { type: "ordinal" }).select(s)] ?? "th"}`;
|
|
1596
|
+
}
|
|
1597
|
+
function ve({ service: s }) {
|
|
1598
|
+
const { t: e, lang: t } = w(), n = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), o = s.getAllBills(), r = s.calculateMonthlyBillTotal();
|
|
1599
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1600
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.billsSubscriptions", "Bills & Subscriptions") }),
|
|
1601
|
+
/* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1602
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.monthlyBillsTotal", "Monthly Bills Total") }),
|
|
1603
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600 }, children: n(r) })
|
|
1591
1604
|
] }),
|
|
1592
|
-
/* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1596
|
-
"Due: "
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1605
|
+
/* @__PURE__ */ a("div", { style: y.card, children: o.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noBillsTracked", "No bills tracked") }) : o.map((i) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1606
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1607
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.name }),
|
|
1608
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1609
|
+
e("personalFinance.dueOn", "Due: {day}").replace(
|
|
1610
|
+
"{day}",
|
|
1611
|
+
K(i.dueDate, t)
|
|
1612
|
+
),
|
|
1613
|
+
" • ",
|
|
1614
|
+
e(`personalFinance.frequency.${i.frequency}`, i.frequency),
|
|
1615
|
+
i.autoPay && e("personalFinance.autoPay", " • Auto-pay")
|
|
1601
1616
|
] })
|
|
1602
1617
|
] }),
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
] },
|
|
1618
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: n(i.amount) })
|
|
1619
|
+
] }, i.id)) })
|
|
1605
1620
|
] });
|
|
1606
1621
|
}
|
|
1607
|
-
function
|
|
1608
|
-
const e = (
|
|
1609
|
-
return /* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1613
|
-
/* @__PURE__ */
|
|
1614
|
-
/* @__PURE__ */
|
|
1622
|
+
function we({ service: s }) {
|
|
1623
|
+
const { t: e } = w(), t = (d) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(d), n = s.getAllInvestments(), o = s.calculateTotalInvestmentValue(), r = s.calculateTotalGain(), i = s.getPortfolioAllocation();
|
|
1624
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1625
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.investments", "Investments") }),
|
|
1626
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1627
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1628
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.portfolioValue", "Portfolio Value") }),
|
|
1629
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600 }, children: t(o) })
|
|
1615
1630
|
] }),
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1632
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.totalGainLoss", "Total Gain/Loss") }),
|
|
1633
|
+
/* @__PURE__ */ l(
|
|
1619
1634
|
"div",
|
|
1620
1635
|
{
|
|
1621
1636
|
style: {
|
|
1622
1637
|
fontSize: "24px",
|
|
1623
1638
|
fontWeight: 600,
|
|
1624
|
-
color:
|
|
1639
|
+
color: r >= 0 ? "#4caf50" : "#f44336"
|
|
1625
1640
|
},
|
|
1626
1641
|
children: [
|
|
1627
|
-
|
|
1628
|
-
|
|
1642
|
+
r >= 0 ? "+" : "",
|
|
1643
|
+
t(r)
|
|
1629
1644
|
]
|
|
1630
1645
|
}
|
|
1631
1646
|
)
|
|
1632
1647
|
] })
|
|
1633
1648
|
] }),
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
|
|
1649
|
+
/* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1650
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.assetAllocation", "Asset Allocation") }),
|
|
1651
|
+
i.map((d) => /* @__PURE__ */ l("div", { style: { marginBottom: "12px" }, children: [
|
|
1652
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" }, children: [
|
|
1653
|
+
/* @__PURE__ */ a("span", { children: e(`personalFinance.assetType.${d.type}`, d.type) }),
|
|
1654
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1655
|
+
d.percentage.toFixed(1),
|
|
1641
1656
|
"%"
|
|
1642
1657
|
] })
|
|
1643
1658
|
] }),
|
|
1644
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1645
1660
|
"div",
|
|
1646
1661
|
{
|
|
1647
1662
|
style: {
|
|
1648
|
-
width: `${
|
|
1663
|
+
width: `${d.percentage}%`,
|
|
1649
1664
|
height: "100%",
|
|
1650
1665
|
backgroundColor: "#1976d2",
|
|
1651
1666
|
borderRadius: "4px"
|
|
1652
1667
|
}
|
|
1653
1668
|
}
|
|
1654
1669
|
) })
|
|
1655
|
-
] },
|
|
1670
|
+
] }, d.type))
|
|
1656
1671
|
] }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
-
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
1663
|
-
l.shares,
|
|
1664
|
-
" shares @ ",
|
|
1665
|
-
e(l.currentPrice)
|
|
1666
|
-
] })
|
|
1672
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1673
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.holdings", "Holdings") }),
|
|
1674
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noInvestmentsTracked", "No investments tracked") }) : n.map((d) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1675
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1676
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: d.symbol }),
|
|
1677
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("personalFinance.shares", "{shares} shares @ {currentPrice}").replace("{shares}", String(d.shares)).replace("{currentPrice}", String(t(d.currentPrice))) })
|
|
1667
1678
|
] }),
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
|
|
1672
|
-
|
|
1679
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "right" }, children: [
|
|
1680
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 600 }, children: t(d.currentValue) }),
|
|
1681
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: d.gain >= 0 ? "#4caf50" : "#f44336" }, children: [
|
|
1682
|
+
d.gain >= 0 ? "+" : "",
|
|
1683
|
+
t(d.gain),
|
|
1673
1684
|
" (",
|
|
1674
|
-
|
|
1685
|
+
d.gainPercent.toFixed(1),
|
|
1675
1686
|
"%)"
|
|
1676
1687
|
] })
|
|
1677
1688
|
] })
|
|
1678
|
-
] },
|
|
1689
|
+
] }, d.id))
|
|
1679
1690
|
] })
|
|
1680
1691
|
] });
|
|
1681
1692
|
}
|
|
1682
|
-
const
|
|
1693
|
+
const E = {
|
|
1683
1694
|
urgent: 0,
|
|
1684
1695
|
high: 1,
|
|
1685
1696
|
medium: 2,
|
|
1686
1697
|
low: 3,
|
|
1687
1698
|
none: 4
|
|
1688
1699
|
};
|
|
1689
|
-
class
|
|
1700
|
+
class ke {
|
|
1690
1701
|
constructor() {
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1702
|
+
k(this, "tasks", /* @__PURE__ */ new Map());
|
|
1703
|
+
k(this, "projects", /* @__PURE__ */ new Map());
|
|
1704
|
+
k(this, "tags", /* @__PURE__ */ new Map());
|
|
1705
|
+
k(this, "timeBlocks", /* @__PURE__ */ new Map());
|
|
1695
1706
|
}
|
|
1696
1707
|
/* ─────────────────────────────────────────────────────────────
|
|
1697
1708
|
TASKS
|
|
1698
1709
|
───────────────────────────────────────────────────────────── */
|
|
1699
1710
|
addTask(e) {
|
|
1700
|
-
const t = this.generateId(),
|
|
1711
|
+
const t = this.generateId(), n = /* @__PURE__ */ new Date(), o = {
|
|
1701
1712
|
...e,
|
|
1702
1713
|
id: t,
|
|
1703
1714
|
subtasks: [],
|
|
1704
|
-
createdAt:
|
|
1705
|
-
updatedAt:
|
|
1715
|
+
createdAt: n,
|
|
1716
|
+
updatedAt: n
|
|
1706
1717
|
};
|
|
1707
|
-
return this.tasks.set(t,
|
|
1718
|
+
return this.tasks.set(t, o), o;
|
|
1708
1719
|
}
|
|
1709
1720
|
updateTask(e, t) {
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1721
|
+
const n = this.tasks.get(e);
|
|
1722
|
+
n && this.tasks.set(e, { ...n, ...t, id: e, updatedAt: /* @__PURE__ */ new Date() });
|
|
1712
1723
|
}
|
|
1713
1724
|
deleteTask(e) {
|
|
1714
1725
|
const t = this.tasks.get(e);
|
|
1715
1726
|
if (t) {
|
|
1716
|
-
for (const
|
|
1717
|
-
this.deleteTask(
|
|
1718
|
-
for (const
|
|
1719
|
-
this.timeBlocks.delete(
|
|
1727
|
+
for (const n of t.subtasks)
|
|
1728
|
+
this.deleteTask(n.id);
|
|
1729
|
+
for (const n of t.timeBlocks)
|
|
1730
|
+
this.timeBlocks.delete(n.id);
|
|
1720
1731
|
this.tasks.delete(e);
|
|
1721
1732
|
}
|
|
1722
1733
|
}
|
|
@@ -1742,23 +1753,23 @@ class pe {
|
|
|
1742
1753
|
});
|
|
1743
1754
|
}
|
|
1744
1755
|
parseQuickAdd(e) {
|
|
1745
|
-
let t = e,
|
|
1746
|
-
const
|
|
1747
|
-
let
|
|
1748
|
-
e.includes("!!!") ? (
|
|
1756
|
+
let t = e, n = "none", o;
|
|
1757
|
+
const r = [];
|
|
1758
|
+
let i;
|
|
1759
|
+
e.includes("!!!") ? (n = "urgent", t = t.replace("!!!", "")) : e.includes("!!") ? (n = "high", t = t.replace("!!", "")) : e.includes("!") && (n = "medium", t = t.replace("!", ""));
|
|
1749
1760
|
const d = e.match(/#(\w+)/);
|
|
1750
1761
|
if (d) {
|
|
1751
1762
|
const u = Array.from(this.projects.values()).find(
|
|
1752
|
-
(
|
|
1763
|
+
(h) => h.name.toLowerCase() === d[1].toLowerCase()
|
|
1753
1764
|
);
|
|
1754
|
-
u && (
|
|
1765
|
+
u && (o = u.id, t = t.replace(d[0], ""));
|
|
1755
1766
|
}
|
|
1756
1767
|
const c = e.matchAll(/@(\w+)/g);
|
|
1757
1768
|
for (const u of c) {
|
|
1758
|
-
const
|
|
1759
|
-
(
|
|
1769
|
+
const h = Array.from(this.tags.values()).find(
|
|
1770
|
+
(p) => p.name.toLowerCase() === u[1].toLowerCase()
|
|
1760
1771
|
);
|
|
1761
|
-
|
|
1772
|
+
h && (r.push(h.id), t = t.replace(u[0], ""));
|
|
1762
1773
|
}
|
|
1763
1774
|
const g = [
|
|
1764
1775
|
{ pattern: /\btoday\b/i, offset: () => /* @__PURE__ */ new Date() },
|
|
@@ -1772,17 +1783,17 @@ class pe {
|
|
|
1772
1783
|
}
|
|
1773
1784
|
}
|
|
1774
1785
|
];
|
|
1775
|
-
for (const { pattern: u, offset:
|
|
1786
|
+
for (const { pattern: u, offset: h } of g)
|
|
1776
1787
|
if (u.test(e)) {
|
|
1777
|
-
|
|
1788
|
+
i = h(), i.setHours(23, 59, 59, 999), t = t.replace(u, "");
|
|
1778
1789
|
break;
|
|
1779
1790
|
}
|
|
1780
1791
|
return {
|
|
1781
1792
|
title: t.trim(),
|
|
1782
|
-
priority:
|
|
1783
|
-
projectId:
|
|
1784
|
-
tags:
|
|
1785
|
-
dueDate:
|
|
1793
|
+
priority: n,
|
|
1794
|
+
projectId: o,
|
|
1795
|
+
tags: r,
|
|
1796
|
+
dueDate: i
|
|
1786
1797
|
};
|
|
1787
1798
|
}
|
|
1788
1799
|
/** Complete a task */
|
|
@@ -1811,87 +1822,87 @@ class pe {
|
|
|
1811
1822
|
return null;
|
|
1812
1823
|
const {
|
|
1813
1824
|
pattern: t,
|
|
1814
|
-
interval:
|
|
1815
|
-
endDate:
|
|
1816
|
-
endAfterOccurrences:
|
|
1817
|
-
} = e.recurrence,
|
|
1825
|
+
interval: n,
|
|
1826
|
+
endDate: o,
|
|
1827
|
+
endAfterOccurrences: r
|
|
1828
|
+
} = e.recurrence, i = new Date(e.dueDate);
|
|
1818
1829
|
let d;
|
|
1819
1830
|
switch (t) {
|
|
1820
1831
|
case "daily":
|
|
1821
|
-
d = new Date(
|
|
1832
|
+
d = new Date(i.getTime() + n * 864e5);
|
|
1822
1833
|
break;
|
|
1823
1834
|
case "weekdays":
|
|
1824
|
-
d = new Date(
|
|
1835
|
+
d = new Date(i);
|
|
1825
1836
|
do
|
|
1826
1837
|
d.setDate(d.getDate() + 1);
|
|
1827
1838
|
while (d.getDay() === 0 || d.getDay() === 6);
|
|
1828
1839
|
break;
|
|
1829
1840
|
case "weekly":
|
|
1830
|
-
d = new Date(
|
|
1841
|
+
d = new Date(i.getTime() + n * 7 * 864e5);
|
|
1831
1842
|
break;
|
|
1832
1843
|
case "bi-weekly":
|
|
1833
|
-
d = new Date(
|
|
1844
|
+
d = new Date(i.getTime() + 14 * 864e5);
|
|
1834
1845
|
break;
|
|
1835
1846
|
case "monthly":
|
|
1836
|
-
d = new Date(
|
|
1847
|
+
d = new Date(i), d.setMonth(d.getMonth() + n);
|
|
1837
1848
|
break;
|
|
1838
1849
|
case "yearly":
|
|
1839
|
-
d = new Date(
|
|
1850
|
+
d = new Date(i), d.setFullYear(d.getFullYear() + n);
|
|
1840
1851
|
break;
|
|
1841
1852
|
default:
|
|
1842
1853
|
return null;
|
|
1843
1854
|
}
|
|
1844
|
-
return
|
|
1855
|
+
return o && d > o ? null : d;
|
|
1845
1856
|
}
|
|
1846
1857
|
/* ─────────────────────────────────────────────────────────────
|
|
1847
1858
|
FILTERING & SORTING
|
|
1848
1859
|
───────────────────────────────────────────────────────────── */
|
|
1849
1860
|
filterTasks(e) {
|
|
1850
|
-
var
|
|
1861
|
+
var n, o, r;
|
|
1851
1862
|
let t = this.getAllTasks();
|
|
1852
|
-
if ((
|
|
1853
|
-
const { start:
|
|
1863
|
+
if ((n = e.status) != null && n.length && (t = t.filter((i) => e.status.includes(i.status))), (o = e.priority) != null && o.length && (t = t.filter((i) => e.priority.includes(i.priority))), e.projectId !== void 0 && (t = t.filter((i) => i.projectId === e.projectId)), (r = e.tags) != null && r.length && (t = t.filter((i) => e.tags.some((d) => i.tags.includes(d)))), e.dueDateRange) {
|
|
1864
|
+
const { start: i, end: d } = e.dueDateRange;
|
|
1854
1865
|
t = t.filter((c) => {
|
|
1855
1866
|
if (!c.dueDate)
|
|
1856
1867
|
return !1;
|
|
1857
1868
|
const g = new Date(c.dueDate);
|
|
1858
|
-
return !(
|
|
1869
|
+
return !(i && g < i || d && g > d);
|
|
1859
1870
|
});
|
|
1860
1871
|
}
|
|
1861
1872
|
if (e.search) {
|
|
1862
|
-
const
|
|
1873
|
+
const i = e.search.toLowerCase();
|
|
1863
1874
|
t = t.filter(
|
|
1864
1875
|
(d) => {
|
|
1865
1876
|
var c;
|
|
1866
|
-
return d.title.toLowerCase().includes(
|
|
1877
|
+
return d.title.toLowerCase().includes(i) || ((c = d.description) == null ? void 0 : c.toLowerCase().includes(i)) || d.notes.toLowerCase().includes(i);
|
|
1867
1878
|
}
|
|
1868
1879
|
);
|
|
1869
1880
|
}
|
|
1870
1881
|
return t;
|
|
1871
1882
|
}
|
|
1872
|
-
sortTasks(e, t = "dueDate",
|
|
1873
|
-
return [...e].sort((
|
|
1883
|
+
sortTasks(e, t = "dueDate", n = "asc") {
|
|
1884
|
+
return [...e].sort((r, i) => {
|
|
1874
1885
|
let d = 0;
|
|
1875
1886
|
switch (t) {
|
|
1876
1887
|
case "dueDate": {
|
|
1877
|
-
const c =
|
|
1888
|
+
const c = r.dueDate ? new Date(r.dueDate).getTime() : 1 / 0, g = i.dueDate ? new Date(i.dueDate).getTime() : 1 / 0;
|
|
1878
1889
|
d = c - g;
|
|
1879
1890
|
break;
|
|
1880
1891
|
}
|
|
1881
1892
|
case "priority":
|
|
1882
|
-
d =
|
|
1893
|
+
d = E[r.priority] - E[i.priority];
|
|
1883
1894
|
break;
|
|
1884
1895
|
case "createdAt":
|
|
1885
|
-
d = new Date(
|
|
1896
|
+
d = new Date(r.createdAt).getTime() - new Date(i.createdAt).getTime();
|
|
1886
1897
|
break;
|
|
1887
1898
|
case "title":
|
|
1888
|
-
d =
|
|
1899
|
+
d = r.title.localeCompare(i.title);
|
|
1889
1900
|
break;
|
|
1890
1901
|
case "status":
|
|
1891
|
-
d =
|
|
1902
|
+
d = r.status.localeCompare(i.status);
|
|
1892
1903
|
break;
|
|
1893
1904
|
}
|
|
1894
|
-
return
|
|
1905
|
+
return n === "asc" ? d : -d;
|
|
1895
1906
|
});
|
|
1896
1907
|
}
|
|
1897
1908
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -1912,10 +1923,10 @@ class pe {
|
|
|
1912
1923
|
getUpcoming(e = 7) {
|
|
1913
1924
|
const t = /* @__PURE__ */ new Date();
|
|
1914
1925
|
t.setHours(0, 0, 0, 0);
|
|
1915
|
-
const
|
|
1926
|
+
const n = new Date(t.getTime() + e * 864e5);
|
|
1916
1927
|
return this.filterTasks({
|
|
1917
1928
|
status: ["todo", "in-progress"],
|
|
1918
|
-
dueDateRange: { start: t, end:
|
|
1929
|
+
dueDateRange: { start: t, end: n }
|
|
1919
1930
|
});
|
|
1920
1931
|
}
|
|
1921
1932
|
getOverdue() {
|
|
@@ -1928,27 +1939,27 @@ class pe {
|
|
|
1928
1939
|
PRIORITY MATRIX
|
|
1929
1940
|
───────────────────────────────────────────────────────────── */
|
|
1930
1941
|
getPriorityMatrix() {
|
|
1931
|
-
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (
|
|
1942
|
+
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (o) => o.dueDate ? Math.ceil((new Date(o.dueDate).getTime() - Date.now()) / 864e5) <= 2 : !1, n = (o) => ["urgent", "high"].includes(o.priority);
|
|
1932
1943
|
return {
|
|
1933
1944
|
doFirst: {
|
|
1934
1945
|
name: "Do First",
|
|
1935
1946
|
description: "Urgent and Important",
|
|
1936
|
-
tasks: e.filter((
|
|
1947
|
+
tasks: e.filter((o) => t(o) && n(o))
|
|
1937
1948
|
},
|
|
1938
1949
|
schedule: {
|
|
1939
1950
|
name: "Schedule",
|
|
1940
1951
|
description: "Important but Not Urgent",
|
|
1941
|
-
tasks: e.filter((
|
|
1952
|
+
tasks: e.filter((o) => !t(o) && n(o))
|
|
1942
1953
|
},
|
|
1943
1954
|
delegate: {
|
|
1944
1955
|
name: "Delegate",
|
|
1945
1956
|
description: "Urgent but Not Important",
|
|
1946
|
-
tasks: e.filter((
|
|
1957
|
+
tasks: e.filter((o) => t(o) && !n(o))
|
|
1947
1958
|
},
|
|
1948
1959
|
eliminate: {
|
|
1949
1960
|
name: "Eliminate",
|
|
1950
1961
|
description: "Neither Urgent nor Important",
|
|
1951
|
-
tasks: e.filter((
|
|
1962
|
+
tasks: e.filter((o) => !t(o) && !n(o))
|
|
1952
1963
|
}
|
|
1953
1964
|
};
|
|
1954
1965
|
}
|
|
@@ -1956,54 +1967,54 @@ class pe {
|
|
|
1956
1967
|
TIME BLOCKING
|
|
1957
1968
|
───────────────────────────────────────────────────────────── */
|
|
1958
1969
|
addTimeBlock(e) {
|
|
1959
|
-
const t = this.generateId(),
|
|
1960
|
-
if (this.timeBlocks.set(t,
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1970
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
1971
|
+
if (this.timeBlocks.set(t, n), e.taskId) {
|
|
1972
|
+
const o = this.tasks.get(e.taskId);
|
|
1973
|
+
o && (o.timeBlocks.push(n), this.tasks.set(e.taskId, o));
|
|
1963
1974
|
}
|
|
1964
|
-
return
|
|
1975
|
+
return n;
|
|
1965
1976
|
}
|
|
1966
1977
|
updateTimeBlock(e, t) {
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1978
|
+
const n = this.timeBlocks.get(e);
|
|
1979
|
+
n && this.timeBlocks.set(e, { ...n, ...t, id: e });
|
|
1969
1980
|
}
|
|
1970
1981
|
deleteTimeBlock(e) {
|
|
1971
1982
|
const t = this.timeBlocks.get(e);
|
|
1972
1983
|
if (t != null && t.taskId) {
|
|
1973
|
-
const
|
|
1974
|
-
|
|
1984
|
+
const n = this.tasks.get(t.taskId);
|
|
1985
|
+
n && (n.timeBlocks = n.timeBlocks.filter((o) => o.id !== e), this.tasks.set(n.id, n));
|
|
1975
1986
|
}
|
|
1976
1987
|
this.timeBlocks.delete(e);
|
|
1977
1988
|
}
|
|
1978
1989
|
getTimeBlocksForDate(e) {
|
|
1979
1990
|
const t = new Date(e);
|
|
1980
1991
|
t.setHours(0, 0, 0, 0);
|
|
1981
|
-
const
|
|
1982
|
-
return Array.from(this.timeBlocks.values()).filter((
|
|
1983
|
-
const
|
|
1984
|
-
return
|
|
1992
|
+
const n = new Date(t.getTime() + 864e5);
|
|
1993
|
+
return Array.from(this.timeBlocks.values()).filter((o) => {
|
|
1994
|
+
const r = new Date(o.start);
|
|
1995
|
+
return r >= t && r < n;
|
|
1985
1996
|
});
|
|
1986
1997
|
}
|
|
1987
1998
|
/* ─────────────────────────────────────────────────────────────
|
|
1988
1999
|
PROJECTS
|
|
1989
2000
|
───────────────────────────────────────────────────────────── */
|
|
1990
2001
|
addProject(e) {
|
|
1991
|
-
const t = this.generateId(),
|
|
2002
|
+
const t = this.generateId(), n = {
|
|
1992
2003
|
...e,
|
|
1993
2004
|
id: t,
|
|
1994
2005
|
order: this.projects.size,
|
|
1995
2006
|
createdAt: /* @__PURE__ */ new Date()
|
|
1996
2007
|
};
|
|
1997
|
-
return this.projects.set(t,
|
|
2008
|
+
return this.projects.set(t, n), n;
|
|
1998
2009
|
}
|
|
1999
2010
|
updateProject(e, t) {
|
|
2000
|
-
const
|
|
2001
|
-
|
|
2011
|
+
const n = this.projects.get(e);
|
|
2012
|
+
n && this.projects.set(e, { ...n, ...t, id: e });
|
|
2002
2013
|
}
|
|
2003
2014
|
deleteProject(e) {
|
|
2004
2015
|
this.projects.delete(e);
|
|
2005
|
-
for (const [t,
|
|
2006
|
-
|
|
2016
|
+
for (const [t, n] of this.tasks)
|
|
2017
|
+
n.projectId === e && (n.projectId = void 0, this.tasks.set(t, n));
|
|
2007
2018
|
}
|
|
2008
2019
|
getAllProjects() {
|
|
2009
2020
|
return Array.from(this.projects.values()).sort((e, t) => e.order - t.order);
|
|
@@ -2012,24 +2023,24 @@ class pe {
|
|
|
2012
2023
|
return this.filterTasks({ projectId: e });
|
|
2013
2024
|
}
|
|
2014
2025
|
getProjectProgress(e) {
|
|
2015
|
-
const t = this.getProjectTasks(e),
|
|
2026
|
+
const t = this.getProjectTasks(e), n = t.filter((o) => o.status === "done").length;
|
|
2016
2027
|
return {
|
|
2017
2028
|
total: t.length,
|
|
2018
|
-
completed:
|
|
2019
|
-
percentage: t.length > 0 ? Math.round(
|
|
2029
|
+
completed: n,
|
|
2030
|
+
percentage: t.length > 0 ? Math.round(n / t.length * 100) : 0
|
|
2020
2031
|
};
|
|
2021
2032
|
}
|
|
2022
2033
|
/* ─────────────────────────────────────────────────────────────
|
|
2023
2034
|
TAGS
|
|
2024
2035
|
───────────────────────────────────────────────────────────── */
|
|
2025
2036
|
addTag(e) {
|
|
2026
|
-
const t = this.generateId(),
|
|
2027
|
-
return this.tags.set(t,
|
|
2037
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2038
|
+
return this.tags.set(t, n), n;
|
|
2028
2039
|
}
|
|
2029
2040
|
deleteTag(e) {
|
|
2030
2041
|
this.tags.delete(e);
|
|
2031
|
-
for (const [t,
|
|
2032
|
-
|
|
2042
|
+
for (const [t, n] of this.tasks)
|
|
2043
|
+
n.tags.includes(e) && (n.tags = n.tags.filter((o) => o !== e), this.tasks.set(t, n));
|
|
2033
2044
|
}
|
|
2034
2045
|
getAllTags() {
|
|
2035
2046
|
return Array.from(this.tags.values());
|
|
@@ -2040,16 +2051,16 @@ class pe {
|
|
|
2040
2051
|
getStatistics() {
|
|
2041
2052
|
const e = this.getAllTasks(), t = /* @__PURE__ */ new Date();
|
|
2042
2053
|
t.setHours(0, 0, 0, 0);
|
|
2043
|
-
const
|
|
2044
|
-
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) <
|
|
2054
|
+
const n = new Date(t.getTime() + 864e5), o = e.filter((c) => c.status === "done").length, r = this.getOverdue().length, i = e.filter(
|
|
2055
|
+
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) < n && c.status !== "done"
|
|
2045
2056
|
).length, d = e.filter((c) => c.status === "in-progress").length;
|
|
2046
2057
|
return {
|
|
2047
2058
|
total: e.length,
|
|
2048
|
-
completed:
|
|
2049
|
-
overdue:
|
|
2050
|
-
dueToday:
|
|
2059
|
+
completed: o,
|
|
2060
|
+
overdue: r,
|
|
2061
|
+
dueToday: i,
|
|
2051
2062
|
inProgress: d,
|
|
2052
|
-
completionRate: e.length > 0 ? Math.round(
|
|
2063
|
+
completionRate: e.length > 0 ? Math.round(o / e.length * 100) : 0
|
|
2053
2064
|
};
|
|
2054
2065
|
}
|
|
2055
2066
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2062,17 +2073,17 @@ class pe {
|
|
|
2062
2073
|
this.tasks.clear(), this.projects.clear(), this.tags.clear(), this.timeBlocks.clear();
|
|
2063
2074
|
}
|
|
2064
2075
|
}
|
|
2065
|
-
function
|
|
2066
|
-
return new
|
|
2076
|
+
function Je() {
|
|
2077
|
+
return new ke();
|
|
2067
2078
|
}
|
|
2068
|
-
const
|
|
2069
|
-
function
|
|
2070
|
-
const s =
|
|
2079
|
+
const Q = /* @__PURE__ */ N(null);
|
|
2080
|
+
function Ze() {
|
|
2081
|
+
const s = W(Q);
|
|
2071
2082
|
if (!s)
|
|
2072
2083
|
throw new Error("useTaskManager must be used within TaskManagerProvider");
|
|
2073
2084
|
return s;
|
|
2074
2085
|
}
|
|
2075
|
-
const
|
|
2086
|
+
const S = {
|
|
2076
2087
|
container: {
|
|
2077
2088
|
display: "flex",
|
|
2078
2089
|
height: "100%",
|
|
@@ -2194,172 +2205,170 @@ const k = {
|
|
|
2194
2205
|
padding: "16px",
|
|
2195
2206
|
overflow: "auto"
|
|
2196
2207
|
}
|
|
2197
|
-
},
|
|
2208
|
+
}, V = {
|
|
2198
2209
|
urgent: "#f44336",
|
|
2199
2210
|
high: "#ff9800",
|
|
2200
2211
|
medium: "#2196f3",
|
|
2201
2212
|
low: "#4caf50",
|
|
2202
2213
|
none: "#e0e0e0"
|
|
2203
2214
|
};
|
|
2204
|
-
function
|
|
2215
|
+
function et({
|
|
2205
2216
|
service: s,
|
|
2206
2217
|
className: e,
|
|
2207
2218
|
style: t
|
|
2208
2219
|
}) {
|
|
2209
|
-
var
|
|
2210
|
-
const [,
|
|
2211
|
-
|
|
2212
|
-
},
|
|
2213
|
-
|
|
2220
|
+
var P;
|
|
2221
|
+
const { t: n } = w(), [, o] = D(0), [r, i] = D("inbox"), [d, c] = D(null), [g, u] = D(""), h = L(() => o((I) => I + 1), []), p = { service: s, refresh: h }, T = s.getStatistics(), m = s.getAllProjects(), b = () => {
|
|
2222
|
+
g.trim() && (s.quickAddTask(g), u(""), h());
|
|
2223
|
+
}, C = (I, U) => {
|
|
2224
|
+
i(I), c(U ?? null);
|
|
2214
2225
|
};
|
|
2215
|
-
return /* @__PURE__ */
|
|
2216
|
-
/* @__PURE__ */
|
|
2217
|
-
/* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ a(Q.Provider, { value: p, children: /* @__PURE__ */ l("div", { className: e, style: { ...S.container, ...t }, children: [
|
|
2227
|
+
/* @__PURE__ */ l("div", { style: S.sidebar, children: [
|
|
2228
|
+
/* @__PURE__ */ l(
|
|
2218
2229
|
"div",
|
|
2219
2230
|
{
|
|
2220
|
-
onClick: () =>
|
|
2231
|
+
onClick: () => C("inbox"),
|
|
2221
2232
|
style: {
|
|
2222
|
-
...
|
|
2223
|
-
backgroundColor:
|
|
2233
|
+
...S.menuItem,
|
|
2234
|
+
backgroundColor: r === "inbox" ? "#e3f2fd" : "transparent"
|
|
2224
2235
|
},
|
|
2225
2236
|
children: [
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
|
|
2237
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.inbox", "Inbox") }),
|
|
2238
|
+
T.total - T.completed > 0 && /* @__PURE__ */ a("span", { style: S.badge, children: s.getInbox().length })
|
|
2228
2239
|
]
|
|
2229
2240
|
}
|
|
2230
2241
|
),
|
|
2231
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ l(
|
|
2232
2243
|
"div",
|
|
2233
2244
|
{
|
|
2234
|
-
onClick: () =>
|
|
2245
|
+
onClick: () => C("today"),
|
|
2235
2246
|
style: {
|
|
2236
|
-
...
|
|
2237
|
-
backgroundColor:
|
|
2247
|
+
...S.menuItem,
|
|
2248
|
+
backgroundColor: r === "today" ? "#e3f2fd" : "transparent"
|
|
2238
2249
|
},
|
|
2239
2250
|
children: [
|
|
2240
|
-
/* @__PURE__ */
|
|
2241
|
-
|
|
2251
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.today", "Today") }),
|
|
2252
|
+
T.dueToday > 0 && /* @__PURE__ */ a("span", { style: S.badge, children: T.dueToday })
|
|
2242
2253
|
]
|
|
2243
2254
|
}
|
|
2244
2255
|
),
|
|
2245
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ a(
|
|
2246
2257
|
"div",
|
|
2247
2258
|
{
|
|
2248
|
-
onClick: () =>
|
|
2259
|
+
onClick: () => C("upcoming"),
|
|
2249
2260
|
style: {
|
|
2250
|
-
...
|
|
2251
|
-
backgroundColor:
|
|
2261
|
+
...S.menuItem,
|
|
2262
|
+
backgroundColor: r === "upcoming" ? "#e3f2fd" : "transparent"
|
|
2252
2263
|
},
|
|
2253
|
-
children: /* @__PURE__ */
|
|
2264
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.upcoming", "Upcoming") })
|
|
2254
2265
|
}
|
|
2255
2266
|
),
|
|
2256
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ a(
|
|
2257
2268
|
"div",
|
|
2258
2269
|
{
|
|
2259
|
-
onClick: () =>
|
|
2270
|
+
onClick: () => C("matrix"),
|
|
2260
2271
|
style: {
|
|
2261
|
-
...
|
|
2262
|
-
backgroundColor:
|
|
2272
|
+
...S.menuItem,
|
|
2273
|
+
backgroundColor: r === "matrix" ? "#e3f2fd" : "transparent"
|
|
2263
2274
|
},
|
|
2264
|
-
children: /* @__PURE__ */
|
|
2275
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.priorityMatrix", "Priority Matrix") })
|
|
2265
2276
|
}
|
|
2266
2277
|
),
|
|
2267
|
-
/* @__PURE__ */
|
|
2278
|
+
/* @__PURE__ */ a(
|
|
2268
2279
|
"div",
|
|
2269
2280
|
{
|
|
2270
|
-
onClick: () =>
|
|
2281
|
+
onClick: () => C("all"),
|
|
2271
2282
|
style: {
|
|
2272
|
-
...
|
|
2273
|
-
backgroundColor:
|
|
2283
|
+
...S.menuItem,
|
|
2284
|
+
backgroundColor: r === "all" ? "#e3f2fd" : "transparent"
|
|
2274
2285
|
},
|
|
2275
|
-
children: /* @__PURE__ */
|
|
2286
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.allTasks", "All Tasks") })
|
|
2276
2287
|
}
|
|
2277
2288
|
),
|
|
2278
|
-
|
|
2279
|
-
/* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2289
|
+
T.overdue > 0 && /* @__PURE__ */ l("div", { style: { ...S.menuItem, color: "#f44336" }, children: [
|
|
2290
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.overdue", "Overdue") }),
|
|
2291
|
+
/* @__PURE__ */ a("span", { style: { ...S.badge, backgroundColor: "#f44336" }, children: T.overdue })
|
|
2281
2292
|
] }),
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
|
|
2284
|
-
const
|
|
2285
|
-
return /* @__PURE__ */
|
|
2293
|
+
/* @__PURE__ */ a("div", { style: S.sectionTitle, children: n("taskManager.projects", "Projects") }),
|
|
2294
|
+
m.map((I) => {
|
|
2295
|
+
const U = s.getProjectProgress(I.id);
|
|
2296
|
+
return /* @__PURE__ */ l(
|
|
2286
2297
|
"div",
|
|
2287
2298
|
{
|
|
2288
|
-
onClick: () =>
|
|
2299
|
+
onClick: () => C("project", I.id),
|
|
2289
2300
|
style: {
|
|
2290
|
-
...
|
|
2291
|
-
backgroundColor:
|
|
2301
|
+
...S.menuItem,
|
|
2302
|
+
backgroundColor: r === "project" && d === I.id ? "#e3f2fd" : "transparent"
|
|
2292
2303
|
},
|
|
2293
2304
|
children: [
|
|
2294
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ a(
|
|
2295
2306
|
"span",
|
|
2296
2307
|
{
|
|
2297
2308
|
style: {
|
|
2298
2309
|
width: "10px",
|
|
2299
2310
|
height: "10px",
|
|
2300
2311
|
borderRadius: "50%",
|
|
2301
|
-
backgroundColor:
|
|
2312
|
+
backgroundColor: I.color
|
|
2302
2313
|
}
|
|
2303
2314
|
}
|
|
2304
2315
|
),
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
|
|
2316
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: I.name }),
|
|
2317
|
+
/* @__PURE__ */ l("span", { style: { fontSize: "12px", color: "#999" }, children: [
|
|
2318
|
+
U.percentage,
|
|
2308
2319
|
"%"
|
|
2309
2320
|
] })
|
|
2310
2321
|
]
|
|
2311
2322
|
},
|
|
2312
|
-
|
|
2323
|
+
I.id
|
|
2313
2324
|
);
|
|
2314
2325
|
})
|
|
2315
2326
|
] }),
|
|
2316
|
-
/* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2327
|
+
/* @__PURE__ */ l("div", { style: S.main, children: [
|
|
2328
|
+
/* @__PURE__ */ l("div", { style: S.header, children: [
|
|
2329
|
+
/* @__PURE__ */ l("div", { style: S.title, children: [
|
|
2330
|
+
r === "inbox" && n("taskManager.inbox", "Inbox"),
|
|
2331
|
+
r === "today" && n("taskManager.today", "Today"),
|
|
2332
|
+
r === "upcoming" && n("taskManager.upcoming", "Upcoming"),
|
|
2333
|
+
r === "matrix" && n("taskManager.priorityMatrix", "Priority Matrix"),
|
|
2334
|
+
r === "all" && n("taskManager.allTasks", "All Tasks"),
|
|
2335
|
+
r === "project" && ((P = m.find((I) => I.id === d)) == null ? void 0 : P.name)
|
|
2325
2336
|
] }),
|
|
2326
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children:
|
|
2327
|
-
y.completed,
|
|
2328
|
-
"/",
|
|
2329
|
-
y.total,
|
|
2330
|
-
" completed"
|
|
2331
|
-
] })
|
|
2337
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: n("taskManager.completed", "{completed}/{total} completed").replace("{completed}", String(T.completed)).replace("{total}", String(T.total)) })
|
|
2332
2338
|
] }),
|
|
2333
|
-
|
|
2339
|
+
r !== "matrix" && /* @__PURE__ */ a(
|
|
2334
2340
|
"input",
|
|
2335
2341
|
{
|
|
2336
2342
|
type: "text",
|
|
2337
|
-
placeholder:
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2343
|
+
placeholder: n(
|
|
2344
|
+
"taskManager.quickAddTaskEG",
|
|
2345
|
+
"Quick add task (e.g., 'Buy groceries tomorrow #shopping !')"
|
|
2346
|
+
),
|
|
2347
|
+
value: g,
|
|
2348
|
+
onChange: (I) => u(I.target.value),
|
|
2349
|
+
onKeyDown: (I) => I.key === "Enter" && b(),
|
|
2350
|
+
style: S.taskInput
|
|
2342
2351
|
}
|
|
2343
2352
|
),
|
|
2344
|
-
|
|
2345
|
-
|
|
2353
|
+
r === "matrix" ? /* @__PURE__ */ a(Te, { service: s, onComplete: h }) : /* @__PURE__ */ a(
|
|
2354
|
+
Se,
|
|
2346
2355
|
{
|
|
2347
2356
|
service: s,
|
|
2348
|
-
view:
|
|
2349
|
-
projectId:
|
|
2350
|
-
onComplete:
|
|
2357
|
+
view: r,
|
|
2358
|
+
projectId: d,
|
|
2359
|
+
onComplete: h
|
|
2351
2360
|
}
|
|
2352
2361
|
)
|
|
2353
2362
|
] })
|
|
2354
2363
|
] }) });
|
|
2355
2364
|
}
|
|
2356
|
-
function
|
|
2365
|
+
function Se({
|
|
2357
2366
|
service: s,
|
|
2358
2367
|
view: e,
|
|
2359
2368
|
projectId: t,
|
|
2360
|
-
onComplete:
|
|
2369
|
+
onComplete: n
|
|
2361
2370
|
}) {
|
|
2362
|
-
const
|
|
2371
|
+
const { t: o } = w(), r = z(() => {
|
|
2363
2372
|
switch (e) {
|
|
2364
2373
|
case "inbox":
|
|
2365
2374
|
return s.getInbox();
|
|
@@ -2378,89 +2387,89 @@ function fe({
|
|
|
2378
2387
|
return [];
|
|
2379
2388
|
}
|
|
2380
2389
|
}, [s, e, t]);
|
|
2381
|
-
return
|
|
2390
|
+
return r.length === 0 ? /* @__PURE__ */ a("div", { style: { textAlign: "center", padding: "60px", color: "#999" }, children: /* @__PURE__ */ a("div", { children: o("taskManager.noTasksHere", "No tasks here!") }) }) : /* @__PURE__ */ a("div", { children: r.map((i) => /* @__PURE__ */ a(Y, { task: i, service: s, onComplete: n }, i.id)) });
|
|
2382
2391
|
}
|
|
2383
|
-
function
|
|
2392
|
+
function Y({
|
|
2384
2393
|
task: s,
|
|
2385
2394
|
service: e,
|
|
2386
2395
|
onComplete: t
|
|
2387
2396
|
}) {
|
|
2388
|
-
const
|
|
2389
|
-
|
|
2390
|
-
},
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2393
|
-
const
|
|
2394
|
-
return
|
|
2395
|
-
},
|
|
2396
|
-
return /* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2397
|
+
const { t: n } = w(), o = (d) => {
|
|
2398
|
+
d.stopPropagation(), e.completeTask(s.id), t();
|
|
2399
|
+
}, r = (d) => {
|
|
2400
|
+
const c = new Date(d), g = /* @__PURE__ */ new Date();
|
|
2401
|
+
g.setHours(0, 0, 0, 0);
|
|
2402
|
+
const u = new Date(g.getTime() + 864e5);
|
|
2403
|
+
return c < g ? n("taskManager.overdue", "Overdue") : c.toDateString() === g.toDateString() ? n("taskManager.today", "Today") : c.toDateString() === u.toDateString() ? n("taskManager.tomorrow", "Tomorrow") : c.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
2404
|
+
}, i = s.dueDate && new Date(s.dueDate) < /* @__PURE__ */ new Date() && s.status !== "done";
|
|
2405
|
+
return /* @__PURE__ */ l("div", { style: S.taskItem, children: [
|
|
2406
|
+
/* @__PURE__ */ a(
|
|
2398
2407
|
"div",
|
|
2399
2408
|
{
|
|
2400
|
-
style: { ...
|
|
2409
|
+
style: { ...S.priorityIndicator, backgroundColor: V[s.priority] }
|
|
2401
2410
|
}
|
|
2402
2411
|
),
|
|
2403
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ a(
|
|
2404
2413
|
"div",
|
|
2405
2414
|
{
|
|
2406
|
-
onClick:
|
|
2415
|
+
onClick: o,
|
|
2407
2416
|
style: {
|
|
2408
|
-
...
|
|
2409
|
-
borderColor:
|
|
2417
|
+
...S.checkbox,
|
|
2418
|
+
borderColor: V[s.priority]
|
|
2410
2419
|
}
|
|
2411
2420
|
}
|
|
2412
2421
|
),
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
s.dueDate && /* @__PURE__ */
|
|
2417
|
-
s.estimatedMinutes && /* @__PURE__ */ a("span", { children:
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
s.recurrence && /* @__PURE__ */
|
|
2422
|
+
/* @__PURE__ */ l("div", { style: S.taskContent, children: [
|
|
2423
|
+
/* @__PURE__ */ a("div", { style: S.taskTitle, children: s.title }),
|
|
2424
|
+
/* @__PURE__ */ l("div", { style: S.taskMeta, children: [
|
|
2425
|
+
s.dueDate && /* @__PURE__ */ a("span", { style: { color: i ? "#f44336" : "#666" }, children: r(s.dueDate) }),
|
|
2426
|
+
s.estimatedMinutes && /* @__PURE__ */ a("span", { children: n("taskManager.min", "{estimatedMinutes} min").replace(
|
|
2427
|
+
"{estimatedMinutes}",
|
|
2428
|
+
String(s.estimatedMinutes)
|
|
2429
|
+
) }),
|
|
2430
|
+
s.recurrence && /* @__PURE__ */ a("span", { children: n("taskManager.repeats", "Repeats") })
|
|
2422
2431
|
] })
|
|
2423
2432
|
] })
|
|
2424
2433
|
] });
|
|
2425
2434
|
}
|
|
2426
|
-
function
|
|
2435
|
+
function Te({
|
|
2427
2436
|
service: s,
|
|
2428
2437
|
onComplete: e
|
|
2429
2438
|
}) {
|
|
2430
|
-
const t = s.getPriorityMatrix(),
|
|
2439
|
+
const { t } = w(), n = s.getPriorityMatrix(), o = {
|
|
2431
2440
|
doFirst: { bg: "#ffebee", border: "#f44336" },
|
|
2432
2441
|
schedule: { bg: "#fff3e0", border: "#ff9800" },
|
|
2433
2442
|
delegate: { bg: "#e3f2fd", border: "#2196f3" },
|
|
2434
2443
|
eliminate: { bg: "#f5f5f5", border: "#9e9e9e" }
|
|
2435
2444
|
};
|
|
2436
|
-
return /* @__PURE__ */
|
|
2437
|
-
const
|
|
2438
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ a("div", { style: S.matrixGrid, children: ["doFirst", "schedule", "delegate", "eliminate"].map((r) => {
|
|
2446
|
+
const i = n[r], d = o[r];
|
|
2447
|
+
return /* @__PURE__ */ l(
|
|
2439
2448
|
"div",
|
|
2440
2449
|
{
|
|
2441
2450
|
style: {
|
|
2442
|
-
...
|
|
2443
|
-
backgroundColor:
|
|
2444
|
-
borderLeft: `4px solid ${
|
|
2451
|
+
...S.matrixQuadrant,
|
|
2452
|
+
backgroundColor: d.bg,
|
|
2453
|
+
borderLeft: `4px solid ${d.border}`
|
|
2445
2454
|
},
|
|
2446
2455
|
children: [
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
|
|
2450
|
-
|
|
2456
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 600, marginBottom: "8px" }, children: t(`taskManager.quadrant.${r}.name`, i.name) }),
|
|
2457
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666", marginBottom: "12px" }, children: t(`taskManager.quadrant.${r}.description`, i.description) }),
|
|
2458
|
+
i.tasks.map((c) => /* @__PURE__ */ a(Y, { task: c, service: s, onComplete: e }, c.id)),
|
|
2459
|
+
i.tasks.length === 0 && /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: t("taskManager.empty", "Empty") })
|
|
2451
2460
|
]
|
|
2452
2461
|
},
|
|
2453
|
-
|
|
2462
|
+
r
|
|
2454
2463
|
);
|
|
2455
2464
|
}) });
|
|
2456
2465
|
}
|
|
2457
|
-
class
|
|
2466
|
+
class De {
|
|
2458
2467
|
constructor() {
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2468
|
+
k(this, "kpis", /* @__PURE__ */ new Map());
|
|
2469
|
+
k(this, "goals", /* @__PURE__ */ new Map());
|
|
2470
|
+
k(this, "habits", /* @__PURE__ */ new Map());
|
|
2471
|
+
k(this, "moodEntries", /* @__PURE__ */ new Map());
|
|
2472
|
+
k(this, "financeSummary", {
|
|
2464
2473
|
netWorth: 0,
|
|
2465
2474
|
monthlyIncome: 0,
|
|
2466
2475
|
monthlyExpenses: 0,
|
|
@@ -2477,18 +2486,18 @@ class ye {
|
|
|
2477
2486
|
KPIs
|
|
2478
2487
|
───────────────────────────────────────────────────────────── */
|
|
2479
2488
|
addKPI(e) {
|
|
2480
|
-
const t = this.generateId(),
|
|
2481
|
-
return this.kpis.set(t,
|
|
2489
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2490
|
+
return this.kpis.set(t, n), n;
|
|
2482
2491
|
}
|
|
2483
2492
|
updateKPI(e, t) {
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2493
|
+
const n = this.kpis.get(e);
|
|
2494
|
+
n && this.kpis.set(e, { ...n, ...t, id: e });
|
|
2486
2495
|
}
|
|
2487
2496
|
recordKPIValue(e, t) {
|
|
2488
|
-
const
|
|
2489
|
-
if (
|
|
2490
|
-
const
|
|
2491
|
-
|
|
2497
|
+
const n = this.kpis.get(e);
|
|
2498
|
+
if (n) {
|
|
2499
|
+
const o = n.currentValue;
|
|
2500
|
+
n.currentValue = t, n.history.push({ date: /* @__PURE__ */ new Date(), value: t }), n.trend = t > o ? "up" : t < o ? "down" : "stable", this.kpis.set(e, n);
|
|
2492
2501
|
}
|
|
2493
2502
|
}
|
|
2494
2503
|
getAllKPIs() {
|
|
@@ -2504,24 +2513,24 @@ class ye {
|
|
|
2504
2513
|
GOALS
|
|
2505
2514
|
───────────────────────────────────────────────────────────── */
|
|
2506
2515
|
addGoal(e) {
|
|
2507
|
-
const t = this.generateId(),
|
|
2508
|
-
return this.goals.set(t,
|
|
2516
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2517
|
+
return this.goals.set(t, n), n;
|
|
2509
2518
|
}
|
|
2510
2519
|
updateGoal(e, t) {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2520
|
+
const n = this.goals.get(e);
|
|
2521
|
+
n && this.goals.set(e, { ...n, ...t, id: e });
|
|
2513
2522
|
}
|
|
2514
2523
|
completeGoalMilestone(e, t) {
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2524
|
+
const n = this.goals.get(e);
|
|
2525
|
+
if (n) {
|
|
2526
|
+
const o = n.milestones.find((r) => r.id === t);
|
|
2527
|
+
o && (o.completed = !0, o.completedDate = /* @__PURE__ */ new Date(), n.progress = this.calculateGoalProgress(n), this.goals.set(e, n));
|
|
2519
2528
|
}
|
|
2520
2529
|
}
|
|
2521
2530
|
calculateGoalProgress(e) {
|
|
2522
2531
|
if (e.milestones.length === 0)
|
|
2523
2532
|
return e.progress;
|
|
2524
|
-
const t = e.milestones.filter((
|
|
2533
|
+
const t = e.milestones.filter((n) => n.completed).length;
|
|
2525
2534
|
return Math.round(t / e.milestones.length * 100);
|
|
2526
2535
|
}
|
|
2527
2536
|
getAllGoals() {
|
|
@@ -2534,14 +2543,14 @@ class ye {
|
|
|
2534
2543
|
return this.getAllGoals().filter((t) => t.category === e);
|
|
2535
2544
|
}
|
|
2536
2545
|
getUpcomingDeadlines(e = 30) {
|
|
2537
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2538
|
-
return this.getActiveGoals().filter((
|
|
2546
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() + e * 24 * 60 * 60 * 1e3);
|
|
2547
|
+
return this.getActiveGoals().filter((o) => o.targetDate <= n).sort((o, r) => o.targetDate.getTime() - r.targetDate.getTime());
|
|
2539
2548
|
}
|
|
2540
2549
|
/* ─────────────────────────────────────────────────────────────
|
|
2541
2550
|
HABITS
|
|
2542
2551
|
───────────────────────────────────────────────────────────── */
|
|
2543
2552
|
addHabit(e) {
|
|
2544
|
-
const t = this.generateId(),
|
|
2553
|
+
const t = this.generateId(), n = {
|
|
2545
2554
|
...e,
|
|
2546
2555
|
id: t,
|
|
2547
2556
|
streak: 0,
|
|
@@ -2549,64 +2558,64 @@ class ye {
|
|
|
2549
2558
|
completions: [],
|
|
2550
2559
|
createdAt: /* @__PURE__ */ new Date()
|
|
2551
2560
|
};
|
|
2552
|
-
return this.habits.set(t,
|
|
2553
|
-
}
|
|
2554
|
-
completeHabit(e, t = 1,
|
|
2555
|
-
const
|
|
2556
|
-
if (
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2559
|
-
const
|
|
2560
|
-
(d) => new Date(d.date).toDateString() ===
|
|
2561
|
+
return this.habits.set(t, n), n;
|
|
2562
|
+
}
|
|
2563
|
+
completeHabit(e, t = 1, n) {
|
|
2564
|
+
const o = this.habits.get(e);
|
|
2565
|
+
if (o) {
|
|
2566
|
+
const r = /* @__PURE__ */ new Date();
|
|
2567
|
+
r.setHours(0, 0, 0, 0);
|
|
2568
|
+
const i = o.completions.find(
|
|
2569
|
+
(d) => new Date(d.date).toDateString() === r.toDateString()
|
|
2561
2570
|
);
|
|
2562
|
-
|
|
2571
|
+
i ? (i.count += t, n && (i.note = n)) : o.completions.push({ date: r, count: t, note: n }), this.updateStreak(o), this.habits.set(e, o);
|
|
2563
2572
|
}
|
|
2564
2573
|
}
|
|
2565
2574
|
updateStreak(e) {
|
|
2566
2575
|
const t = [...e.completions].sort(
|
|
2567
|
-
(
|
|
2576
|
+
(r, i) => new Date(i.date).getTime() - new Date(r.date).getTime()
|
|
2568
2577
|
);
|
|
2569
2578
|
if (t.length === 0) {
|
|
2570
2579
|
e.streak = 0;
|
|
2571
2580
|
return;
|
|
2572
2581
|
}
|
|
2573
|
-
let
|
|
2574
|
-
const
|
|
2575
|
-
|
|
2576
|
-
for (let
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2579
|
-
const d = new Date(
|
|
2580
|
-
if (
|
|
2581
|
-
if (t[
|
|
2582
|
-
|
|
2582
|
+
let n = 0;
|
|
2583
|
+
const o = /* @__PURE__ */ new Date();
|
|
2584
|
+
o.setHours(0, 0, 0, 0);
|
|
2585
|
+
for (let r = 0; r < t.length; r++) {
|
|
2586
|
+
const i = new Date(t[r].date);
|
|
2587
|
+
i.setHours(0, 0, 0, 0);
|
|
2588
|
+
const d = new Date(o.getTime() - r * 24 * 60 * 60 * 1e3);
|
|
2589
|
+
if (i.getTime() === d.getTime())
|
|
2590
|
+
if (t[r].count >= e.targetPerPeriod)
|
|
2591
|
+
n++;
|
|
2583
2592
|
else
|
|
2584
2593
|
break;
|
|
2585
2594
|
else
|
|
2586
2595
|
break;
|
|
2587
2596
|
}
|
|
2588
|
-
e.streak =
|
|
2597
|
+
e.streak = n, n > e.longestStreak && (e.longestStreak = n);
|
|
2589
2598
|
}
|
|
2590
2599
|
getAllHabits() {
|
|
2591
2600
|
return Array.from(this.habits.values());
|
|
2592
2601
|
}
|
|
2593
2602
|
getHabitCompletionRate(e, t = 30) {
|
|
2594
|
-
const
|
|
2595
|
-
if (!
|
|
2603
|
+
const n = this.habits.get(e);
|
|
2604
|
+
if (!n)
|
|
2596
2605
|
return 0;
|
|
2597
|
-
const
|
|
2598
|
-
(d) => new Date(d.date) >=
|
|
2606
|
+
const o = /* @__PURE__ */ new Date(), r = new Date(o.getTime() - t * 24 * 60 * 60 * 1e3), i = n.completions.filter(
|
|
2607
|
+
(d) => new Date(d.date) >= r && d.count >= n.targetPerPeriod
|
|
2599
2608
|
);
|
|
2600
|
-
return Math.round(
|
|
2609
|
+
return Math.round(i.length / t * 100);
|
|
2601
2610
|
}
|
|
2602
2611
|
getTodayHabitStatus() {
|
|
2603
2612
|
const e = (/* @__PURE__ */ new Date()).toDateString();
|
|
2604
2613
|
return this.getAllHabits().map((t) => {
|
|
2605
|
-
const
|
|
2614
|
+
const n = t.completions.find((o) => new Date(o.date).toDateString() === e);
|
|
2606
2615
|
return {
|
|
2607
2616
|
habit: t,
|
|
2608
|
-
completed:
|
|
2609
|
-
count: (
|
|
2617
|
+
completed: n ? n.count >= t.targetPerPeriod : !1,
|
|
2618
|
+
count: (n == null ? void 0 : n.count) ?? 0
|
|
2610
2619
|
};
|
|
2611
2620
|
});
|
|
2612
2621
|
}
|
|
@@ -2614,8 +2623,8 @@ class ye {
|
|
|
2614
2623
|
MOOD & HEALTH
|
|
2615
2624
|
───────────────────────────────────────────────────────────── */
|
|
2616
2625
|
addMoodEntry(e) {
|
|
2617
|
-
const t = this.generateId(),
|
|
2618
|
-
return this.moodEntries.set(t,
|
|
2626
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2627
|
+
return this.moodEntries.set(t, n), n;
|
|
2619
2628
|
}
|
|
2620
2629
|
getAllMoodEntries() {
|
|
2621
2630
|
return Array.from(this.moodEntries.values()).sort(
|
|
@@ -2624,37 +2633,37 @@ class ye {
|
|
|
2624
2633
|
}
|
|
2625
2634
|
getMoodEntriesForPeriod(e, t) {
|
|
2626
2635
|
return this.getAllMoodEntries().filter(
|
|
2627
|
-
(
|
|
2636
|
+
(n) => new Date(n.date) >= e && new Date(n.date) <= t
|
|
2628
2637
|
);
|
|
2629
2638
|
}
|
|
2630
2639
|
getAverageMood(e = 7) {
|
|
2631
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2632
|
-
return
|
|
2640
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), o = this.getMoodEntriesForPeriod(n, t);
|
|
2641
|
+
return o.length === 0 ? 0 : o.reduce((r, i) => r + i.mood, 0) / o.length;
|
|
2633
2642
|
}
|
|
2634
2643
|
getAverageSleep(e = 7) {
|
|
2635
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2636
|
-
return
|
|
2644
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), o = this.getMoodEntriesForPeriod(n, t);
|
|
2645
|
+
return o.length === 0 ? 0 : o.reduce((r, i) => r + i.sleep, 0) / o.length;
|
|
2637
2646
|
}
|
|
2638
2647
|
getMoodCorrelations() {
|
|
2639
2648
|
const e = this.getAllMoodEntries();
|
|
2640
2649
|
if (e.length < 5)
|
|
2641
2650
|
return [];
|
|
2642
|
-
const t = [],
|
|
2643
|
-
e.map((
|
|
2644
|
-
e.map((
|
|
2651
|
+
const t = [], n = this.calculateCorrelation(
|
|
2652
|
+
e.map((r) => r.sleep),
|
|
2653
|
+
e.map((r) => r.mood)
|
|
2645
2654
|
);
|
|
2646
|
-
t.push({ factor: "Sleep", correlation:
|
|
2647
|
-
const
|
|
2648
|
-
e.map((
|
|
2649
|
-
e.map((
|
|
2655
|
+
t.push({ factor: "Sleep", correlation: n });
|
|
2656
|
+
const o = this.calculateCorrelation(
|
|
2657
|
+
e.map((r) => r.stress),
|
|
2658
|
+
e.map((r) => r.mood)
|
|
2650
2659
|
);
|
|
2651
|
-
return t.push({ factor: "Stress", correlation:
|
|
2660
|
+
return t.push({ factor: "Stress", correlation: o }), t.sort((r, i) => Math.abs(i.correlation) - Math.abs(r.correlation));
|
|
2652
2661
|
}
|
|
2653
2662
|
calculateCorrelation(e, t) {
|
|
2654
|
-
const
|
|
2655
|
-
if (
|
|
2663
|
+
const n = e.length;
|
|
2664
|
+
if (n === 0)
|
|
2656
2665
|
return 0;
|
|
2657
|
-
const
|
|
2666
|
+
const o = e.reduce((h, p) => h + p, 0), r = t.reduce((h, p) => h + p, 0), i = e.reduce((h, p, T) => h + p * t[T], 0), d = e.reduce((h, p) => h + p * p, 0), c = t.reduce((h, p) => h + p * p, 0), g = n * i - o * r, u = Math.sqrt((n * d - o ** 2) * (n * c - r ** 2));
|
|
2658
2667
|
return u === 0 ? 0 : g / u;
|
|
2659
2668
|
}
|
|
2660
2669
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2669,14 +2678,14 @@ class ye {
|
|
|
2669
2678
|
calculateFinanceHealth() {
|
|
2670
2679
|
const e = [], t = Math.min(100, this.financeSummary.savingsRate / 20 * 100);
|
|
2671
2680
|
e.push({ name: "Savings Rate", score: t });
|
|
2672
|
-
const
|
|
2681
|
+
const n = this.financeSummary.budgetTotal > 0 ? Math.min(
|
|
2673
2682
|
100,
|
|
2674
2683
|
(1 - this.financeSummary.budgetUsed / this.financeSummary.budgetTotal) * 100 + 50
|
|
2675
2684
|
) : 50;
|
|
2676
|
-
e.push({ name: "Budget Adherence", score:
|
|
2677
|
-
const
|
|
2678
|
-
e.push({ name: "Debt Management", score:
|
|
2679
|
-
const
|
|
2685
|
+
e.push({ name: "Budget Adherence", score: n });
|
|
2686
|
+
const o = this.financeSummary.monthlyIncome > 0 ? this.financeSummary.debts / (this.financeSummary.monthlyIncome * 12) : 0, r = Math.max(0, 100 - o * 100);
|
|
2687
|
+
e.push({ name: "Debt Management", score: r });
|
|
2688
|
+
const i = this.financeSummary.monthlyExpenses > 0 ? this.financeSummary.savings / this.financeSummary.monthlyExpenses : 0, d = Math.min(100, i / 6 * 100);
|
|
2680
2689
|
e.push({ name: "Emergency Fund", score: d });
|
|
2681
2690
|
const c = e.reduce((g, u) => g + u.score, 0) / e.length;
|
|
2682
2691
|
return { score: Math.round(c), factors: e };
|
|
@@ -2685,12 +2694,12 @@ class ye {
|
|
|
2685
2694
|
INSIGHTS
|
|
2686
2695
|
───────────────────────────────────────────────────────────── */
|
|
2687
2696
|
generateDailyInsights() {
|
|
2688
|
-
const e = [], t = this.getAllKPIs(),
|
|
2689
|
-
|
|
2690
|
-
const
|
|
2691
|
-
|
|
2692
|
-
const
|
|
2693
|
-
|
|
2697
|
+
const e = [], t = this.getAllKPIs(), n = t.filter((g) => g.currentValue >= g.targetValue);
|
|
2698
|
+
n.length > 0 && e.push(`You've achieved ${n.length} of ${t.length} KPI targets!`);
|
|
2699
|
+
const o = this.getTodayHabitStatus(), r = o.filter((g) => g.completed);
|
|
2700
|
+
r.length === o.length && o.length > 0 ? e.push("All habits completed today! Keep it up!") : r.length > 0 && e.push(`${r.length}/${o.length} habits completed today.`);
|
|
2701
|
+
const i = this.getAllHabits().reduce((g, u) => Math.max(g, u.streak), 0);
|
|
2702
|
+
i >= 7 && e.push(`Amazing ${i}-day streak! You're building a strong routine.`);
|
|
2694
2703
|
const d = this.getUpcomingDeadlines(7);
|
|
2695
2704
|
d.length > 0 && e.push(`${d.length} goal deadline(s) coming up this week.`);
|
|
2696
2705
|
const c = this.getAverageMood(7);
|
|
@@ -2706,12 +2715,12 @@ class ye {
|
|
|
2706
2715
|
this.kpis.clear(), this.goals.clear(), this.habits.clear(), this.moodEntries.clear();
|
|
2707
2716
|
}
|
|
2708
2717
|
}
|
|
2709
|
-
function
|
|
2710
|
-
return new
|
|
2718
|
+
function tt() {
|
|
2719
|
+
return new De();
|
|
2711
2720
|
}
|
|
2712
|
-
const
|
|
2713
|
-
function
|
|
2714
|
-
const s =
|
|
2721
|
+
const _ = /* @__PURE__ */ N(null);
|
|
2722
|
+
function nt() {
|
|
2723
|
+
const s = W(_);
|
|
2715
2724
|
if (!s)
|
|
2716
2725
|
throw new Error("useLifeDashboard must be used within LifeDashboardProvider");
|
|
2717
2726
|
return s;
|
|
@@ -2806,32 +2815,32 @@ const v = {
|
|
|
2806
2815
|
color: "#1565c0"
|
|
2807
2816
|
}
|
|
2808
2817
|
};
|
|
2809
|
-
function
|
|
2818
|
+
function rt({
|
|
2810
2819
|
service: s,
|
|
2811
2820
|
className: e,
|
|
2812
2821
|
style: t
|
|
2813
2822
|
}) {
|
|
2814
|
-
const [,
|
|
2815
|
-
|
|
2816
|
-
}, []),
|
|
2817
|
-
return /* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
2823
|
+
const { t: n } = w(), [, o] = D(0), r = L(() => {
|
|
2824
|
+
o((m) => m + 1);
|
|
2825
|
+
}, []), i = { service: s, refresh: r }, d = s.generateDailyInsights(), c = s.getAllKPIs(), g = s.getTodayHabitStatus(), u = s.getActiveGoals(), h = s.getFinanceSummary(), p = s.calculateFinanceHealth(), T = (m) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(m);
|
|
2826
|
+
return /* @__PURE__ */ a(_.Provider, { value: i, children: /* @__PURE__ */ l("div", { className: e, style: { ...v.dashboard, ...t }, children: [
|
|
2827
|
+
/* @__PURE__ */ l("div", { style: v.header, children: [
|
|
2828
|
+
/* @__PURE__ */ a("div", { style: v.title, children: n("lifeDashboard.lifeDashboard", "Life Dashboard") }),
|
|
2829
|
+
/* @__PURE__ */ a("div", { style: { color: "#666" }, children: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
2821
2830
|
weekday: "long",
|
|
2822
2831
|
year: "numeric",
|
|
2823
2832
|
month: "long",
|
|
2824
2833
|
day: "numeric"
|
|
2825
2834
|
}) })
|
|
2826
2835
|
] }),
|
|
2827
|
-
|
|
2828
|
-
/* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2831
|
-
|
|
2832
|
-
const b = s.calculateKPIProgress(
|
|
2833
|
-
return /* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
2836
|
+
d.length > 0 && /* @__PURE__ */ a("div", { children: d.map((m, b) => /* @__PURE__ */ a("div", { style: v.insight, children: m }, b)) }),
|
|
2837
|
+
/* @__PURE__ */ l("div", { style: v.grid, children: [
|
|
2838
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2839
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.personalKpis", "Personal KPIs") }),
|
|
2840
|
+
c.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noKpisDefinedYet", "No KPIs defined yet") }) : c.slice(0, 5).map((m) => {
|
|
2841
|
+
const b = s.calculateKPIProgress(m);
|
|
2842
|
+
return /* @__PURE__ */ l("div", { style: { marginBottom: "16px" }, children: [
|
|
2843
|
+
/* @__PURE__ */ l(
|
|
2835
2844
|
"div",
|
|
2836
2845
|
{
|
|
2837
2846
|
style: {
|
|
@@ -2840,19 +2849,25 @@ function Qe({
|
|
|
2840
2849
|
marginBottom: "4px"
|
|
2841
2850
|
},
|
|
2842
2851
|
children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
|
|
2846
|
-
|
|
2852
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: m.name }),
|
|
2853
|
+
/* @__PURE__ */ l("span", { style: { color: "#666" }, children: [
|
|
2854
|
+
m.currentValue,
|
|
2855
|
+
m.unit ? ` ${m.unit}` : "",
|
|
2847
2856
|
" / ",
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2857
|
+
m.targetValue,
|
|
2858
|
+
m.trend === "up" && /* @__PURE__ */ a($, { size: 12, style: { marginLeft: 4, verticalAlign: "-1px" } }),
|
|
2859
|
+
m.trend === "down" && /* @__PURE__ */ a(
|
|
2860
|
+
j,
|
|
2861
|
+
{
|
|
2862
|
+
size: 12,
|
|
2863
|
+
style: { marginLeft: 4, verticalAlign: "-1px" }
|
|
2864
|
+
}
|
|
2865
|
+
)
|
|
2851
2866
|
] })
|
|
2852
2867
|
]
|
|
2853
2868
|
}
|
|
2854
2869
|
),
|
|
2855
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2856
2871
|
"div",
|
|
2857
2872
|
{
|
|
2858
2873
|
style: {
|
|
@@ -2862,13 +2877,13 @@ function Qe({
|
|
|
2862
2877
|
}
|
|
2863
2878
|
}
|
|
2864
2879
|
) })
|
|
2865
|
-
] },
|
|
2880
|
+
] }, m.id);
|
|
2866
2881
|
})
|
|
2867
2882
|
] }),
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
|
|
2871
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2884
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.activeGoals", "Active Goals") }),
|
|
2885
|
+
u.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noActiveGoals", "No active goals") }) : u.slice(0, 4).map((m) => /* @__PURE__ */ l("div", { style: { marginBottom: "16px" }, children: [
|
|
2886
|
+
/* @__PURE__ */ l(
|
|
2872
2887
|
"div",
|
|
2873
2888
|
{
|
|
2874
2889
|
style: {
|
|
@@ -2877,34 +2892,34 @@ function Qe({
|
|
|
2877
2892
|
marginBottom: "4px"
|
|
2878
2893
|
},
|
|
2879
2894
|
children: [
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2882
|
-
|
|
2895
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: m.title }),
|
|
2896
|
+
/* @__PURE__ */ l("span", { style: { color: "#666" }, children: [
|
|
2897
|
+
m.progress,
|
|
2883
2898
|
"%"
|
|
2884
2899
|
] })
|
|
2885
2900
|
]
|
|
2886
2901
|
}
|
|
2887
2902
|
),
|
|
2888
|
-
/* @__PURE__ */
|
|
2903
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2889
2904
|
"div",
|
|
2890
2905
|
{
|
|
2891
2906
|
style: {
|
|
2892
2907
|
...v.progressFill,
|
|
2893
|
-
width: `${
|
|
2908
|
+
width: `${m.progress}%`,
|
|
2894
2909
|
backgroundColor: "#ff9800"
|
|
2895
2910
|
}
|
|
2896
2911
|
}
|
|
2897
2912
|
) }),
|
|
2898
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#999", marginTop: "4px" }, children:
|
|
2899
|
-
"
|
|
2900
|
-
new Date(
|
|
2901
|
-
|
|
2902
|
-
] },
|
|
2913
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#999", marginTop: "4px" }, children: n("lifeDashboard.due", "Due: {targetDate}").replace(
|
|
2914
|
+
"{targetDate}",
|
|
2915
|
+
String(new Date(m.targetDate).toLocaleDateString())
|
|
2916
|
+
) })
|
|
2917
|
+
] }, m.id))
|
|
2903
2918
|
] }),
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
|
|
2907
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2920
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.todaysHabits", "Today's Habits") }),
|
|
2921
|
+
g.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noHabitsTrackedYet", "No habits tracked yet") }) : g.map(({ habit: m, completed: b, count: C }) => /* @__PURE__ */ l("div", { style: v.habitItem, children: [
|
|
2922
|
+
/* @__PURE__ */ a(
|
|
2908
2923
|
"div",
|
|
2909
2924
|
{
|
|
2910
2925
|
style: {
|
|
@@ -2913,12 +2928,12 @@ function Qe({
|
|
|
2913
2928
|
borderColor: b ? "#4caf50" : "#ccc"
|
|
2914
2929
|
},
|
|
2915
2930
|
onClick: () => {
|
|
2916
|
-
s.completeHabit(
|
|
2931
|
+
s.completeHabit(m.id), r();
|
|
2917
2932
|
},
|
|
2918
|
-
children: b && /* @__PURE__ */
|
|
2933
|
+
children: b && /* @__PURE__ */ a(
|
|
2919
2934
|
"span",
|
|
2920
2935
|
{
|
|
2921
|
-
"aria-label": "Done",
|
|
2936
|
+
"aria-label": n("lifeDashboard.done", "Done"),
|
|
2922
2937
|
style: {
|
|
2923
2938
|
width: "6px",
|
|
2924
2939
|
height: "11px",
|
|
@@ -2931,55 +2946,51 @@ function Qe({
|
|
|
2931
2946
|
)
|
|
2932
2947
|
}
|
|
2933
2948
|
),
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
2937
|
-
|
|
2938
|
-
"/"
|
|
2939
|
-
|
|
2940
|
-
" • ",
|
|
2941
|
-
f.streak,
|
|
2942
|
-
" day streak"
|
|
2943
|
-
] })
|
|
2949
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
2950
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: m.name }),
|
|
2951
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n(
|
|
2952
|
+
"lifeDashboard.dayStreak",
|
|
2953
|
+
"{count}/{targetPerPeriod} • {streak} day streak"
|
|
2954
|
+
).replace("{count}", String(C)).replace("{targetPerPeriod}", String(m.targetPerPeriod)).replace("{streak}", String(m.streak)) })
|
|
2944
2955
|
] })
|
|
2945
|
-
] },
|
|
2956
|
+
] }, m.id))
|
|
2946
2957
|
] }),
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2959
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.financeOverview", "Finance Overview") }),
|
|
2960
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2961
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.netWorth", "Net Worth") }),
|
|
2962
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: T(h.netWorth) })
|
|
2952
2963
|
] }),
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2964
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2965
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.monthlyIncome", "Monthly Income") }),
|
|
2966
|
+
/* @__PURE__ */ a("span", { style: { color: "#4caf50" }, children: T(h.monthlyIncome) })
|
|
2956
2967
|
] }),
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2969
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.monthlyExpenses", "Monthly Expenses") }),
|
|
2970
|
+
/* @__PURE__ */ a("span", { style: { color: "#f44336" }, children: T(h.monthlyExpenses) })
|
|
2960
2971
|
] }),
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
|
|
2972
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2973
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.savingsRate", "Savings Rate") }),
|
|
2974
|
+
/* @__PURE__ */ l("span", { children: [
|
|
2975
|
+
h.savingsRate.toFixed(1),
|
|
2965
2976
|
"%"
|
|
2966
2977
|
] })
|
|
2967
2978
|
] }),
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "16px" }, children: [
|
|
2980
|
+
/* @__PURE__ */ l(
|
|
2970
2981
|
"div",
|
|
2971
2982
|
{
|
|
2972
2983
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
2973
2984
|
children: [
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2985
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.financeHealth", "Finance Health") }),
|
|
2986
|
+
/* @__PURE__ */ l("span", { style: { fontWeight: 600 }, children: [
|
|
2976
2987
|
p.score,
|
|
2977
2988
|
"/100"
|
|
2978
2989
|
] })
|
|
2979
2990
|
]
|
|
2980
2991
|
}
|
|
2981
2992
|
),
|
|
2982
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2983
2994
|
"div",
|
|
2984
2995
|
{
|
|
2985
2996
|
style: {
|
|
@@ -2991,35 +3002,38 @@ function Qe({
|
|
|
2991
3002
|
) })
|
|
2992
3003
|
] })
|
|
2993
3004
|
] }),
|
|
2994
|
-
/* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
|
|
3005
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
3006
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.moodHealth", "Mood & Health") }),
|
|
3007
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-around", marginBottom: "20px" }, children: [
|
|
3008
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "center" }, children: [
|
|
3009
|
+
/* @__PURE__ */ a("div", { style: v.moodEmoji, children: n(
|
|
3010
|
+
`lifeDashboard.mood.${Math.round(s.getAverageMood(7))}`,
|
|
3011
|
+
Ie(Math.round(s.getAverageMood(7)))
|
|
3012
|
+
) }),
|
|
3013
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n("lifeDashboard.avgMood7d", "Avg Mood (7d)") })
|
|
3000
3014
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "center" }, children: [
|
|
3016
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "28px", fontWeight: 600 }, children: [
|
|
3003
3017
|
s.getAverageSleep(7).toFixed(1),
|
|
3004
3018
|
"h"
|
|
3005
3019
|
] }),
|
|
3006
|
-
/* @__PURE__ */
|
|
3020
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n("lifeDashboard.avgSleep7d", "Avg Sleep (7d)") })
|
|
3007
3021
|
] })
|
|
3008
3022
|
] }),
|
|
3009
|
-
s.getMoodCorrelations().slice(0, 2).map((
|
|
3010
|
-
/* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
|
|
3023
|
+
s.getMoodCorrelations().slice(0, 2).map((m) => /* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
3024
|
+
/* @__PURE__ */ a("span", { children: m.factor }),
|
|
3025
|
+
/* @__PURE__ */ l("span", { style: { color: m.correlation > 0 ? "#4caf50" : "#f44336" }, children: [
|
|
3026
|
+
m.correlation > 0 ? /* @__PURE__ */ a($, { size: 12, style: { verticalAlign: "-1px" } }) : /* @__PURE__ */ a(j, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3013
3027
|
" ",
|
|
3014
|
-
Math.abs(
|
|
3028
|
+
Math.abs(m.correlation * 100).toFixed(0),
|
|
3015
3029
|
"%"
|
|
3016
3030
|
] })
|
|
3017
|
-
] },
|
|
3031
|
+
] }, m.factor))
|
|
3018
3032
|
] })
|
|
3019
3033
|
] })
|
|
3020
3034
|
] }) });
|
|
3021
3035
|
}
|
|
3022
|
-
function
|
|
3036
|
+
function Ie(s) {
|
|
3023
3037
|
return {
|
|
3024
3038
|
1: "Very low",
|
|
3025
3039
|
2: "Low",
|
|
@@ -3028,7 +3042,7 @@ function xe(s) {
|
|
|
3028
3042
|
5: "Great"
|
|
3029
3043
|
}[s] || "Neutral";
|
|
3030
3044
|
}
|
|
3031
|
-
const
|
|
3045
|
+
const Ce = {
|
|
3032
3046
|
colors: {
|
|
3033
3047
|
background: "#1a1a2e",
|
|
3034
3048
|
surface: "#16213e",
|
|
@@ -3050,7 +3064,7 @@ const be = {
|
|
|
3050
3064
|
},
|
|
3051
3065
|
borderRadius: "8px",
|
|
3052
3066
|
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
3053
|
-
},
|
|
3067
|
+
}, O = [
|
|
3054
3068
|
{ id: "name", label: "Name", sortable: !0, visible: !0 },
|
|
3055
3069
|
{ id: "size", label: "Size", width: "100px", sortable: !0, visible: !0 },
|
|
3056
3070
|
{ id: "progress", label: "Progress", width: "150px", sortable: !0, visible: !0 },
|
|
@@ -3061,9 +3075,9 @@ const be = {
|
|
|
3061
3075
|
{ id: "uploadSpeed", label: "Up", width: "100px", sortable: !0, visible: !0 },
|
|
3062
3076
|
{ id: "eta", label: "ETA", width: "100px", sortable: !0, visible: !0 },
|
|
3063
3077
|
{ id: "ratio", label: "Ratio", width: "80px", sortable: !0, visible: !0 }
|
|
3064
|
-
],
|
|
3065
|
-
function
|
|
3066
|
-
const s =
|
|
3078
|
+
], X = /* @__PURE__ */ N(null);
|
|
3079
|
+
function A() {
|
|
3080
|
+
const s = W(X);
|
|
3067
3081
|
if (!s)
|
|
3068
3082
|
throw new Error("useTorrentUI must be used within TorrentUIProvider");
|
|
3069
3083
|
return s;
|
|
@@ -3071,13 +3085,13 @@ function C() {
|
|
|
3071
3085
|
function R(s, e = 2) {
|
|
3072
3086
|
if (s === 0)
|
|
3073
3087
|
return "0 B";
|
|
3074
|
-
const t = 1024,
|
|
3075
|
-
return `${parseFloat((s / Math.pow(t,
|
|
3088
|
+
const t = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB"], o = Math.floor(Math.log(s) / Math.log(t));
|
|
3089
|
+
return `${parseFloat((s / Math.pow(t, o)).toFixed(e))} ${n[o]}`;
|
|
3076
3090
|
}
|
|
3077
|
-
function
|
|
3091
|
+
function H(s) {
|
|
3078
3092
|
return `${R(s)}/s`;
|
|
3079
3093
|
}
|
|
3080
|
-
function
|
|
3094
|
+
function Ae(s) {
|
|
3081
3095
|
if (!s || s <= 0)
|
|
3082
3096
|
return "∞";
|
|
3083
3097
|
if (s < 60)
|
|
@@ -3085,16 +3099,16 @@ function we(s) {
|
|
|
3085
3099
|
if (s < 3600)
|
|
3086
3100
|
return `${Math.floor(s / 60)}m`;
|
|
3087
3101
|
if (s < 86400) {
|
|
3088
|
-
const
|
|
3089
|
-
return `${
|
|
3102
|
+
const n = Math.floor(s / 3600), o = Math.floor(s % 3600 / 60);
|
|
3103
|
+
return `${n}h ${o}m`;
|
|
3090
3104
|
}
|
|
3091
3105
|
const e = Math.floor(s / 86400), t = Math.floor(s % 86400 / 3600);
|
|
3092
3106
|
return `${e}d ${t}h`;
|
|
3093
3107
|
}
|
|
3094
|
-
function
|
|
3108
|
+
function J(s) {
|
|
3095
3109
|
return s.toFixed(2);
|
|
3096
3110
|
}
|
|
3097
|
-
function
|
|
3111
|
+
function Z(s, e) {
|
|
3098
3112
|
switch (s) {
|
|
3099
3113
|
case "downloading":
|
|
3100
3114
|
return e.colors.primary;
|
|
@@ -3112,70 +3126,70 @@ function K(s, e) {
|
|
|
3112
3126
|
return e.colors.text;
|
|
3113
3127
|
}
|
|
3114
3128
|
}
|
|
3115
|
-
function
|
|
3129
|
+
function Me({
|
|
3116
3130
|
client: s,
|
|
3117
3131
|
config: e = {},
|
|
3118
3132
|
children: t
|
|
3119
3133
|
}) {
|
|
3120
|
-
const
|
|
3121
|
-
() => ({ ...
|
|
3134
|
+
const n = z(
|
|
3135
|
+
() => ({ ...Ce, ...e.theme }),
|
|
3122
3136
|
[e.theme]
|
|
3123
|
-
), [
|
|
3124
|
-
|
|
3137
|
+
), [o, r] = D([]), [i, d] = D(null), [c, g] = D("all"), [u, h] = D(""), p = L(() => {
|
|
3138
|
+
r(s.getAllTorrents());
|
|
3125
3139
|
}, [s]);
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
const
|
|
3129
|
-
return s.on("torrent_added",
|
|
3130
|
-
clearInterval(
|
|
3140
|
+
re(() => {
|
|
3141
|
+
p();
|
|
3142
|
+
const m = setInterval(p, e.refreshInterval || 1e3), b = () => p(), C = () => p();
|
|
3143
|
+
return s.on("torrent_added", b), s.on("torrent_removed", C), () => {
|
|
3144
|
+
clearInterval(m), s.off("torrent_added", b), s.off("torrent_removed", C);
|
|
3131
3145
|
};
|
|
3132
|
-
}, [s, e.refreshInterval,
|
|
3133
|
-
const
|
|
3146
|
+
}, [s, e.refreshInterval, p]);
|
|
3147
|
+
const T = {
|
|
3134
3148
|
client: s,
|
|
3135
3149
|
config: e,
|
|
3136
|
-
theme:
|
|
3137
|
-
torrents:
|
|
3138
|
-
selectedTorrent:
|
|
3150
|
+
theme: n,
|
|
3151
|
+
torrents: o,
|
|
3152
|
+
selectedTorrent: i,
|
|
3139
3153
|
setSelectedTorrent: d,
|
|
3140
3154
|
filter: c,
|
|
3141
3155
|
setFilter: g,
|
|
3142
3156
|
searchQuery: u,
|
|
3143
|
-
setSearchQuery:
|
|
3144
|
-
refresh:
|
|
3157
|
+
setSearchQuery: h,
|
|
3158
|
+
refresh: p
|
|
3145
3159
|
};
|
|
3146
|
-
return /* @__PURE__ */
|
|
3160
|
+
return /* @__PURE__ */ a(X.Provider, { value: T, children: /* @__PURE__ */ a("div", { style: { fontFamily: n.fontFamily, color: n.colors.text }, children: t }) });
|
|
3147
3161
|
}
|
|
3148
|
-
function
|
|
3162
|
+
function Be({
|
|
3149
3163
|
progress: s,
|
|
3150
3164
|
status: e,
|
|
3151
3165
|
showLabel: t = !0,
|
|
3152
|
-
height:
|
|
3153
|
-
className:
|
|
3154
|
-
style:
|
|
3166
|
+
height: n = "20px",
|
|
3167
|
+
className: o,
|
|
3168
|
+
style: r
|
|
3155
3169
|
}) {
|
|
3156
|
-
const { theme:
|
|
3157
|
-
return /* @__PURE__ */
|
|
3170
|
+
const { theme: i } = A(), d = Math.min(100, Math.max(0, s * 100)), c = Z(e, i);
|
|
3171
|
+
return /* @__PURE__ */ l(
|
|
3158
3172
|
"div",
|
|
3159
3173
|
{
|
|
3160
|
-
className:
|
|
3174
|
+
className: o,
|
|
3161
3175
|
style: {
|
|
3162
3176
|
display: "flex",
|
|
3163
3177
|
alignItems: "center",
|
|
3164
|
-
gap:
|
|
3165
|
-
...
|
|
3178
|
+
gap: i.spacing.sm,
|
|
3179
|
+
...r
|
|
3166
3180
|
},
|
|
3167
3181
|
children: [
|
|
3168
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ a(
|
|
3169
3183
|
"div",
|
|
3170
3184
|
{
|
|
3171
3185
|
style: {
|
|
3172
3186
|
flex: 1,
|
|
3173
|
-
height:
|
|
3174
|
-
backgroundColor:
|
|
3175
|
-
borderRadius:
|
|
3187
|
+
height: n,
|
|
3188
|
+
backgroundColor: i.colors.border,
|
|
3189
|
+
borderRadius: i.borderRadius,
|
|
3176
3190
|
overflow: "hidden"
|
|
3177
3191
|
},
|
|
3178
|
-
children: /* @__PURE__ */
|
|
3192
|
+
children: /* @__PURE__ */ a(
|
|
3179
3193
|
"div",
|
|
3180
3194
|
{
|
|
3181
3195
|
style: {
|
|
@@ -3188,7 +3202,7 @@ function Se({
|
|
|
3188
3202
|
)
|
|
3189
3203
|
}
|
|
3190
3204
|
),
|
|
3191
|
-
t && /* @__PURE__ */
|
|
3205
|
+
t && /* @__PURE__ */ l("span", { style: { fontSize: "12px", minWidth: "45px", textAlign: "right" }, children: [
|
|
3192
3206
|
d.toFixed(1),
|
|
3193
3207
|
"%"
|
|
3194
3208
|
] })
|
|
@@ -3196,165 +3210,165 @@ function Se({
|
|
|
3196
3210
|
}
|
|
3197
3211
|
);
|
|
3198
3212
|
}
|
|
3199
|
-
function
|
|
3200
|
-
const { theme:
|
|
3201
|
-
downloading: "Downloading",
|
|
3202
|
-
seeding: "Seeding",
|
|
3203
|
-
paused: "Paused",
|
|
3204
|
-
checking: "Checking",
|
|
3205
|
-
error: "Error",
|
|
3206
|
-
queued: "Queued"
|
|
3213
|
+
function Fe({ status: s, className: e, style: t }) {
|
|
3214
|
+
const { t: n } = w(), { theme: o } = A(), r = Z(s, o), i = {
|
|
3215
|
+
downloading: n("torrentUI.downloading", "Downloading"),
|
|
3216
|
+
seeding: n("torrentUI.seeding", "Seeding"),
|
|
3217
|
+
paused: n("torrentUI.paused", "Paused"),
|
|
3218
|
+
checking: n("torrentUI.checking", "Checking"),
|
|
3219
|
+
error: n("torrentUI.error", "Error"),
|
|
3220
|
+
queued: n("torrentUI.queued", "Queued")
|
|
3207
3221
|
};
|
|
3208
|
-
return /* @__PURE__ */
|
|
3222
|
+
return /* @__PURE__ */ l(
|
|
3209
3223
|
"span",
|
|
3210
3224
|
{
|
|
3211
3225
|
className: e,
|
|
3212
3226
|
style: {
|
|
3213
3227
|
display: "inline-flex",
|
|
3214
3228
|
alignItems: "center",
|
|
3215
|
-
gap:
|
|
3216
|
-
padding: `${
|
|
3217
|
-
backgroundColor: `${
|
|
3218
|
-
color:
|
|
3219
|
-
borderRadius:
|
|
3229
|
+
gap: o.spacing.xs,
|
|
3230
|
+
padding: `${o.spacing.xs} ${o.spacing.sm}`,
|
|
3231
|
+
backgroundColor: `${r}20`,
|
|
3232
|
+
color: r,
|
|
3233
|
+
borderRadius: o.borderRadius,
|
|
3220
3234
|
fontSize: "12px",
|
|
3221
3235
|
fontWeight: 500,
|
|
3222
3236
|
textTransform: "capitalize",
|
|
3223
3237
|
...t
|
|
3224
3238
|
},
|
|
3225
3239
|
children: [
|
|
3226
|
-
/* @__PURE__ */
|
|
3240
|
+
/* @__PURE__ */ a(
|
|
3227
3241
|
"span",
|
|
3228
3242
|
{
|
|
3229
3243
|
style: {
|
|
3230
3244
|
width: "8px",
|
|
3231
3245
|
height: "8px",
|
|
3232
3246
|
borderRadius: "50%",
|
|
3233
|
-
backgroundColor:
|
|
3247
|
+
backgroundColor: r
|
|
3234
3248
|
}
|
|
3235
3249
|
}
|
|
3236
3250
|
),
|
|
3237
|
-
|
|
3251
|
+
i[s]
|
|
3238
3252
|
]
|
|
3239
3253
|
}
|
|
3240
3254
|
);
|
|
3241
3255
|
}
|
|
3242
|
-
function
|
|
3256
|
+
function Re({
|
|
3243
3257
|
onTorrentSelect: s,
|
|
3244
3258
|
onTorrentDoubleClick: e,
|
|
3245
3259
|
className: t,
|
|
3246
|
-
style:
|
|
3260
|
+
style: n
|
|
3247
3261
|
}) {
|
|
3248
|
-
const { theme:
|
|
3249
|
-
if (
|
|
3250
|
-
if (
|
|
3262
|
+
const { t: o } = w(), { theme: r, torrents: i, filter: d, searchQuery: c, selectedTorrent: g, setSelectedTorrent: u, config: h } = A(), [p, T] = D(h.defaultSortBy || "name"), [m, b] = D(h.defaultSortOrder || "asc"), C = h.columns || O, P = z(() => i.filter((x) => {
|
|
3263
|
+
if (d !== "all") {
|
|
3264
|
+
if (d === "completed") {
|
|
3251
3265
|
if (x.stats.progress < 1)
|
|
3252
3266
|
return !1;
|
|
3253
|
-
} else if (
|
|
3267
|
+
} else if (d === "active") {
|
|
3254
3268
|
if (x.status !== "downloading" && x.status !== "seeding")
|
|
3255
3269
|
return !1;
|
|
3256
|
-
} else if (x.status !==
|
|
3270
|
+
} else if (x.status !== d)
|
|
3257
3271
|
return !1;
|
|
3258
3272
|
}
|
|
3259
|
-
if (
|
|
3260
|
-
const
|
|
3261
|
-
if (!x.metadata.name.toLowerCase().includes(
|
|
3273
|
+
if (c) {
|
|
3274
|
+
const M = c.toLowerCase();
|
|
3275
|
+
if (!x.metadata.name.toLowerCase().includes(M))
|
|
3262
3276
|
return !1;
|
|
3263
3277
|
}
|
|
3264
3278
|
return !0;
|
|
3265
|
-
}), [
|
|
3266
|
-
let
|
|
3279
|
+
}), [i, d, c]), I = z(() => [...P].sort((x, M) => {
|
|
3280
|
+
let B, F;
|
|
3267
3281
|
switch (p) {
|
|
3268
3282
|
case "name":
|
|
3269
|
-
|
|
3283
|
+
B = x.metadata.name.toLowerCase(), F = M.metadata.name.toLowerCase();
|
|
3270
3284
|
break;
|
|
3271
3285
|
case "size":
|
|
3272
|
-
|
|
3286
|
+
B = x.metadata.size, F = M.metadata.size;
|
|
3273
3287
|
break;
|
|
3274
3288
|
case "progress":
|
|
3275
|
-
|
|
3289
|
+
B = x.stats.progress, F = M.stats.progress;
|
|
3276
3290
|
break;
|
|
3277
3291
|
case "status":
|
|
3278
|
-
|
|
3292
|
+
B = x.status, F = M.status;
|
|
3279
3293
|
break;
|
|
3280
3294
|
case "downloadSpeed":
|
|
3281
|
-
|
|
3295
|
+
B = x.stats.downloadSpeed, F = M.stats.downloadSpeed;
|
|
3282
3296
|
break;
|
|
3283
3297
|
case "uploadSpeed":
|
|
3284
|
-
|
|
3298
|
+
B = x.stats.uploadSpeed, F = M.stats.uploadSpeed;
|
|
3285
3299
|
break;
|
|
3286
3300
|
case "ratio":
|
|
3287
|
-
|
|
3301
|
+
B = x.stats.ratio, F = M.stats.ratio;
|
|
3288
3302
|
break;
|
|
3289
3303
|
default:
|
|
3290
|
-
|
|
3304
|
+
B = x.metadata.name, F = M.metadata.name;
|
|
3291
3305
|
}
|
|
3292
|
-
return
|
|
3293
|
-
}), [
|
|
3294
|
-
p === x ? b(
|
|
3295
|
-
},
|
|
3296
|
-
|
|
3306
|
+
return B < F ? m === "asc" ? -1 : 1 : B > F ? m === "asc" ? 1 : -1 : 0;
|
|
3307
|
+
}), [P, p, m]), U = (x) => {
|
|
3308
|
+
p === x ? b(m === "asc" ? "desc" : "asc") : (T(x), b("asc"));
|
|
3309
|
+
}, ee = (x) => {
|
|
3310
|
+
u(x), s == null || s(x);
|
|
3297
3311
|
};
|
|
3298
|
-
return /* @__PURE__ */
|
|
3312
|
+
return /* @__PURE__ */ l(
|
|
3299
3313
|
"div",
|
|
3300
3314
|
{
|
|
3301
3315
|
className: t,
|
|
3302
3316
|
style: {
|
|
3303
|
-
backgroundColor:
|
|
3304
|
-
borderRadius:
|
|
3317
|
+
backgroundColor: r.colors.surface,
|
|
3318
|
+
borderRadius: r.borderRadius,
|
|
3305
3319
|
overflow: "hidden",
|
|
3306
|
-
...
|
|
3320
|
+
...n
|
|
3307
3321
|
},
|
|
3308
3322
|
children: [
|
|
3309
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ a(
|
|
3310
3324
|
"div",
|
|
3311
3325
|
{
|
|
3312
3326
|
style: {
|
|
3313
3327
|
display: "grid",
|
|
3314
|
-
gridTemplateColumns:
|
|
3315
|
-
padding: `${
|
|
3316
|
-
backgroundColor:
|
|
3317
|
-
borderBottom: `1px solid ${
|
|
3328
|
+
gridTemplateColumns: C.filter((x) => x.visible !== !1).map((x) => x.width || "1fr").join(" "),
|
|
3329
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3330
|
+
backgroundColor: r.colors.primary,
|
|
3331
|
+
borderBottom: `1px solid ${r.colors.border}`,
|
|
3318
3332
|
fontSize: "12px",
|
|
3319
3333
|
fontWeight: 600,
|
|
3320
3334
|
textTransform: "uppercase"
|
|
3321
3335
|
},
|
|
3322
|
-
children:
|
|
3336
|
+
children: C.filter((x) => x.visible !== !1).map((x) => /* @__PURE__ */ l(
|
|
3323
3337
|
"div",
|
|
3324
3338
|
{
|
|
3325
|
-
onClick: () => x.sortable &&
|
|
3339
|
+
onClick: () => x.sortable && U(x.id),
|
|
3326
3340
|
style: {
|
|
3327
3341
|
cursor: x.sortable ? "pointer" : "default",
|
|
3328
3342
|
display: "flex",
|
|
3329
3343
|
alignItems: "center",
|
|
3330
|
-
gap:
|
|
3344
|
+
gap: r.spacing.xs
|
|
3331
3345
|
},
|
|
3332
3346
|
children: [
|
|
3333
|
-
x.label,
|
|
3334
|
-
p === x.id && /* @__PURE__ */
|
|
3347
|
+
O.includes(x) ? o(`torrentUI.column.${x.id}`, x.label) : x.label,
|
|
3348
|
+
p === x.id && (m === "asc" ? /* @__PURE__ */ a($, { size: 12 }) : /* @__PURE__ */ a(j, { size: 12 }))
|
|
3335
3349
|
]
|
|
3336
3350
|
},
|
|
3337
3351
|
x.id
|
|
3338
3352
|
))
|
|
3339
3353
|
}
|
|
3340
3354
|
),
|
|
3341
|
-
/* @__PURE__ */
|
|
3355
|
+
/* @__PURE__ */ a("div", { style: { maxHeight: "500px", overflowY: "auto" }, children: I.length === 0 ? /* @__PURE__ */ a(
|
|
3342
3356
|
"div",
|
|
3343
3357
|
{
|
|
3344
3358
|
style: {
|
|
3345
|
-
padding:
|
|
3359
|
+
padding: r.spacing.xl,
|
|
3346
3360
|
textAlign: "center",
|
|
3347
|
-
color:
|
|
3361
|
+
color: r.colors.textSecondary
|
|
3348
3362
|
},
|
|
3349
|
-
children: "No torrents found"
|
|
3363
|
+
children: o("torrentUI.noTorrentsFound", "No torrents found")
|
|
3350
3364
|
}
|
|
3351
|
-
) :
|
|
3352
|
-
|
|
3365
|
+
) : I.map((x) => /* @__PURE__ */ a(
|
|
3366
|
+
Pe,
|
|
3353
3367
|
{
|
|
3354
3368
|
torrent: x,
|
|
3355
|
-
columns:
|
|
3356
|
-
isSelected:
|
|
3357
|
-
onClick: () =>
|
|
3369
|
+
columns: C,
|
|
3370
|
+
isSelected: g === x.metadata.infoHash,
|
|
3371
|
+
onClick: () => ee(x.metadata.infoHash),
|
|
3358
3372
|
onDoubleClick: () => e == null ? void 0 : e(x.metadata.infoHash)
|
|
3359
3373
|
},
|
|
3360
3374
|
x.metadata.infoHash
|
|
@@ -3363,61 +3377,61 @@ function De({
|
|
|
3363
3377
|
}
|
|
3364
3378
|
);
|
|
3365
3379
|
}
|
|
3366
|
-
function
|
|
3380
|
+
function Pe({
|
|
3367
3381
|
torrent: s,
|
|
3368
3382
|
columns: e,
|
|
3369
3383
|
isSelected: t,
|
|
3370
|
-
onClick:
|
|
3371
|
-
onDoubleClick:
|
|
3384
|
+
onClick: n,
|
|
3385
|
+
onDoubleClick: o
|
|
3372
3386
|
}) {
|
|
3373
|
-
const { theme:
|
|
3387
|
+
const { theme: r } = A(), { metadata: i, stats: d, status: c } = s, g = (u) => {
|
|
3374
3388
|
switch (u) {
|
|
3375
3389
|
case "name":
|
|
3376
|
-
return /* @__PURE__ */
|
|
3377
|
-
/* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
|
|
3390
|
+
return /* @__PURE__ */ l("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3391
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: i.name }),
|
|
3392
|
+
/* @__PURE__ */ l("span", { style: { fontSize: "11px", color: r.colors.textSecondary }, children: [
|
|
3393
|
+
i.infoHash.substring(0, 8),
|
|
3380
3394
|
"..."
|
|
3381
3395
|
] })
|
|
3382
3396
|
] });
|
|
3383
3397
|
case "size":
|
|
3384
|
-
return R(
|
|
3398
|
+
return R(i.size);
|
|
3385
3399
|
case "progress":
|
|
3386
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ a(Be, { progress: d.progress, status: c, height: "16px" });
|
|
3387
3401
|
case "status":
|
|
3388
|
-
return /* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ a(Fe, { status: c });
|
|
3389
3403
|
case "seeds":
|
|
3390
3404
|
return d.seeds;
|
|
3391
3405
|
case "peers":
|
|
3392
3406
|
return d.peers;
|
|
3393
3407
|
case "downloadSpeed":
|
|
3394
|
-
return d.downloadSpeed > 0 ?
|
|
3408
|
+
return d.downloadSpeed > 0 ? H(d.downloadSpeed) : "-";
|
|
3395
3409
|
case "uploadSpeed":
|
|
3396
|
-
return d.uploadSpeed > 0 ?
|
|
3410
|
+
return d.uploadSpeed > 0 ? H(d.uploadSpeed) : "-";
|
|
3397
3411
|
case "eta":
|
|
3398
|
-
return c === "downloading" ?
|
|
3412
|
+
return c === "downloading" ? Ae(d.eta) : "-";
|
|
3399
3413
|
case "ratio":
|
|
3400
|
-
return
|
|
3414
|
+
return J(d.ratio);
|
|
3401
3415
|
default:
|
|
3402
3416
|
return "-";
|
|
3403
3417
|
}
|
|
3404
3418
|
};
|
|
3405
|
-
return /* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ a(
|
|
3406
3420
|
"div",
|
|
3407
3421
|
{
|
|
3408
|
-
onClick:
|
|
3409
|
-
onDoubleClick:
|
|
3422
|
+
onClick: n,
|
|
3423
|
+
onDoubleClick: o,
|
|
3410
3424
|
style: {
|
|
3411
3425
|
display: "grid",
|
|
3412
3426
|
gridTemplateColumns: e.filter((u) => u.visible !== !1).map((u) => u.width || "1fr").join(" "),
|
|
3413
|
-
padding: `${
|
|
3414
|
-
backgroundColor: t ?
|
|
3415
|
-
borderBottom: `1px solid ${
|
|
3427
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3428
|
+
backgroundColor: t ? r.colors.primary : "transparent",
|
|
3429
|
+
borderBottom: `1px solid ${r.colors.border}`,
|
|
3416
3430
|
cursor: "pointer",
|
|
3417
3431
|
transition: "background-color 0.15s",
|
|
3418
3432
|
fontSize: "13px"
|
|
3419
3433
|
},
|
|
3420
|
-
children: e.filter((u) => u.visible !== !1).map((u) => /* @__PURE__ */
|
|
3434
|
+
children: e.filter((u) => u.visible !== !1).map((u) => /* @__PURE__ */ a(
|
|
3421
3435
|
"div",
|
|
3422
3436
|
{
|
|
3423
3437
|
style: {
|
|
@@ -3434,10 +3448,10 @@ function Ce({
|
|
|
3434
3448
|
}
|
|
3435
3449
|
);
|
|
3436
3450
|
}
|
|
3437
|
-
function
|
|
3438
|
-
const { theme:
|
|
3439
|
-
const
|
|
3440
|
-
all:
|
|
3451
|
+
function Ue({ className: s, style: e }) {
|
|
3452
|
+
const { t } = w(), { theme: n, filter: o, setFilter: r, searchQuery: i, setSearchQuery: d, torrents: c } = A(), g = z(() => {
|
|
3453
|
+
const h = {
|
|
3454
|
+
all: c.length,
|
|
3441
3455
|
downloading: 0,
|
|
3442
3456
|
seeding: 0,
|
|
3443
3457
|
paused: 0,
|
|
@@ -3446,69 +3460,69 @@ function Ae({ className: s, style: e }) {
|
|
|
3446
3460
|
completed: 0,
|
|
3447
3461
|
active: 0
|
|
3448
3462
|
};
|
|
3449
|
-
for (const p of
|
|
3450
|
-
p.status === "downloading" &&
|
|
3451
|
-
return
|
|
3452
|
-
}, [
|
|
3453
|
-
{ id: "all", label: "All" },
|
|
3454
|
-
{ id: "downloading", label: "Downloading" },
|
|
3455
|
-
{ id: "seeding", label: "Seeding" },
|
|
3456
|
-
{ id: "completed", label: "Completed" },
|
|
3457
|
-
{ id: "active", label: "Active" },
|
|
3458
|
-
{ id: "paused", label: "Paused" },
|
|
3459
|
-
{ id: "error", label: "Error" }
|
|
3463
|
+
for (const p of c)
|
|
3464
|
+
p.status === "downloading" && h.downloading++, p.status === "seeding" && h.seeding++, p.status === "paused" && h.paused++, p.status === "checking" && h.checking++, p.status === "error" && h.error++, p.stats.progress >= 1 && h.completed++, (p.status === "downloading" || p.status === "seeding") && h.active++;
|
|
3465
|
+
return h;
|
|
3466
|
+
}, [c]), u = [
|
|
3467
|
+
{ id: "all", label: t("torrentUI.all", "All") },
|
|
3468
|
+
{ id: "downloading", label: t("torrentUI.downloading", "Downloading") },
|
|
3469
|
+
{ id: "seeding", label: t("torrentUI.seeding", "Seeding") },
|
|
3470
|
+
{ id: "completed", label: t("torrentUI.completed", "Completed") },
|
|
3471
|
+
{ id: "active", label: t("torrentUI.active", "Active") },
|
|
3472
|
+
{ id: "paused", label: t("torrentUI.paused", "Paused") },
|
|
3473
|
+
{ id: "error", label: t("torrentUI.error", "Error") }
|
|
3460
3474
|
];
|
|
3461
|
-
return /* @__PURE__ */
|
|
3475
|
+
return /* @__PURE__ */ l(
|
|
3462
3476
|
"div",
|
|
3463
3477
|
{
|
|
3464
3478
|
className: s,
|
|
3465
3479
|
style: {
|
|
3466
3480
|
display: "flex",
|
|
3467
3481
|
alignItems: "center",
|
|
3468
|
-
gap:
|
|
3469
|
-
padding:
|
|
3470
|
-
backgroundColor:
|
|
3471
|
-
borderRadius:
|
|
3482
|
+
gap: n.spacing.md,
|
|
3483
|
+
padding: n.spacing.md,
|
|
3484
|
+
backgroundColor: n.colors.surface,
|
|
3485
|
+
borderRadius: n.borderRadius,
|
|
3472
3486
|
...e
|
|
3473
3487
|
},
|
|
3474
3488
|
children: [
|
|
3475
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: n.spacing.xs }, children: u.map((h) => /* @__PURE__ */ l(
|
|
3476
3490
|
"button",
|
|
3477
3491
|
{
|
|
3478
|
-
onClick: () =>
|
|
3492
|
+
onClick: () => r(h.id),
|
|
3479
3493
|
style: {
|
|
3480
|
-
padding: `${
|
|
3481
|
-
backgroundColor:
|
|
3482
|
-
color:
|
|
3494
|
+
padding: `${n.spacing.xs} ${n.spacing.sm}`,
|
|
3495
|
+
backgroundColor: o === h.id ? n.colors.primary : "transparent",
|
|
3496
|
+
color: o === h.id ? n.colors.text : n.colors.textSecondary,
|
|
3483
3497
|
border: "none",
|
|
3484
|
-
borderRadius:
|
|
3498
|
+
borderRadius: n.borderRadius,
|
|
3485
3499
|
cursor: "pointer",
|
|
3486
3500
|
fontSize: "13px",
|
|
3487
3501
|
transition: "all 0.15s"
|
|
3488
3502
|
},
|
|
3489
3503
|
children: [
|
|
3490
|
-
|
|
3504
|
+
h.label,
|
|
3491
3505
|
" (",
|
|
3492
|
-
|
|
3506
|
+
g[h.id],
|
|
3493
3507
|
")"
|
|
3494
3508
|
]
|
|
3495
3509
|
},
|
|
3496
|
-
|
|
3510
|
+
h.id
|
|
3497
3511
|
)) }),
|
|
3498
|
-
/* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 } }),
|
|
3513
|
+
/* @__PURE__ */ a(
|
|
3500
3514
|
"input",
|
|
3501
3515
|
{
|
|
3502
3516
|
type: "text",
|
|
3503
|
-
placeholder: "Search torrents...",
|
|
3504
|
-
value:
|
|
3505
|
-
onChange: (
|
|
3517
|
+
placeholder: t("torrentUI.searchTorrents", "Search torrents..."),
|
|
3518
|
+
value: i,
|
|
3519
|
+
onChange: (h) => d(h.target.value),
|
|
3506
3520
|
style: {
|
|
3507
|
-
padding: `${
|
|
3508
|
-
backgroundColor:
|
|
3509
|
-
color:
|
|
3510
|
-
border: `1px solid ${
|
|
3511
|
-
borderRadius:
|
|
3521
|
+
padding: `${n.spacing.sm} ${n.spacing.md}`,
|
|
3522
|
+
backgroundColor: n.colors.background,
|
|
3523
|
+
color: n.colors.text,
|
|
3524
|
+
border: `1px solid ${n.colors.border}`,
|
|
3525
|
+
borderRadius: n.borderRadius,
|
|
3512
3526
|
outline: "none",
|
|
3513
3527
|
fontSize: "13px",
|
|
3514
3528
|
width: "250px"
|
|
@@ -3519,46 +3533,58 @@ function Ae({ className: s, style: e }) {
|
|
|
3519
3533
|
}
|
|
3520
3534
|
);
|
|
3521
3535
|
}
|
|
3522
|
-
function
|
|
3536
|
+
function ze({
|
|
3523
3537
|
infoHash: s,
|
|
3524
3538
|
className: e,
|
|
3525
3539
|
style: t
|
|
3526
3540
|
}) {
|
|
3527
|
-
const { theme:
|
|
3528
|
-
if (!
|
|
3541
|
+
const { t: n } = w(), { theme: o, client: r } = A(), [i, d] = D("files"), c = r == null ? void 0 : r.getTorrent(s);
|
|
3542
|
+
if (!c)
|
|
3529
3543
|
return null;
|
|
3530
|
-
const { metadata:
|
|
3531
|
-
{
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3544
|
+
const { metadata: g, stats: u, files: h, peers: p, trackers: T } = c, m = [
|
|
3545
|
+
{
|
|
3546
|
+
id: "files",
|
|
3547
|
+
label: n("torrentUI.files", "Files ({files})").replace("{files}", String(h.length))
|
|
3548
|
+
},
|
|
3549
|
+
{
|
|
3550
|
+
id: "peers",
|
|
3551
|
+
label: n("torrentUI.peers", "Peers ({peers})").replace("{peers}", String(p.length))
|
|
3552
|
+
},
|
|
3553
|
+
{
|
|
3554
|
+
id: "trackers",
|
|
3555
|
+
label: n("torrentUI.trackers", "Trackers ({trackers})").replace(
|
|
3556
|
+
"{trackers}",
|
|
3557
|
+
String(T.length)
|
|
3558
|
+
)
|
|
3559
|
+
},
|
|
3560
|
+
{ id: "info", label: n("torrentUI.info", "Info") }
|
|
3535
3561
|
];
|
|
3536
|
-
return /* @__PURE__ */
|
|
3562
|
+
return /* @__PURE__ */ l(
|
|
3537
3563
|
"div",
|
|
3538
3564
|
{
|
|
3539
3565
|
className: e,
|
|
3540
3566
|
style: {
|
|
3541
|
-
backgroundColor:
|
|
3542
|
-
borderRadius:
|
|
3567
|
+
backgroundColor: o.colors.surface,
|
|
3568
|
+
borderRadius: o.borderRadius,
|
|
3543
3569
|
overflow: "hidden",
|
|
3544
3570
|
...t
|
|
3545
3571
|
},
|
|
3546
3572
|
children: [
|
|
3547
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ a(
|
|
3548
3574
|
"div",
|
|
3549
3575
|
{
|
|
3550
3576
|
style: {
|
|
3551
3577
|
display: "flex",
|
|
3552
|
-
borderBottom: `1px solid ${
|
|
3578
|
+
borderBottom: `1px solid ${o.colors.border}`
|
|
3553
3579
|
},
|
|
3554
|
-
children:
|
|
3580
|
+
children: m.map((b) => /* @__PURE__ */ a(
|
|
3555
3581
|
"button",
|
|
3556
3582
|
{
|
|
3557
|
-
onClick: () =>
|
|
3583
|
+
onClick: () => d(b.id),
|
|
3558
3584
|
style: {
|
|
3559
|
-
padding: `${
|
|
3560
|
-
backgroundColor:
|
|
3561
|
-
color:
|
|
3585
|
+
padding: `${o.spacing.sm} ${o.spacing.md}`,
|
|
3586
|
+
backgroundColor: i === b.id ? o.colors.primary : "transparent",
|
|
3587
|
+
color: i === b.id ? o.colors.text : o.colors.textSecondary,
|
|
3562
3588
|
border: "none",
|
|
3563
3589
|
cursor: "pointer",
|
|
3564
3590
|
fontSize: "13px",
|
|
@@ -3570,19 +3596,19 @@ function Ie({
|
|
|
3570
3596
|
))
|
|
3571
3597
|
}
|
|
3572
3598
|
),
|
|
3573
|
-
/* @__PURE__ */
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3599
|
+
/* @__PURE__ */ l("div", { style: { padding: o.spacing.md, maxHeight: "300px", overflowY: "auto" }, children: [
|
|
3600
|
+
i === "files" && /* @__PURE__ */ a(We, { files: h }),
|
|
3601
|
+
i === "peers" && /* @__PURE__ */ a(Le, { peers: p }),
|
|
3602
|
+
i === "trackers" && /* @__PURE__ */ a(Ne, { trackers: T }),
|
|
3603
|
+
i === "info" && /* @__PURE__ */ a(He, { metadata: g, stats: u, addedAt: c.addedAt })
|
|
3578
3604
|
] })
|
|
3579
3605
|
]
|
|
3580
3606
|
}
|
|
3581
3607
|
);
|
|
3582
3608
|
}
|
|
3583
|
-
function
|
|
3584
|
-
const { theme: e } =
|
|
3585
|
-
return /* @__PURE__ */
|
|
3609
|
+
function We({ files: s }) {
|
|
3610
|
+
const { theme: e } = A();
|
|
3611
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, n) => /* @__PURE__ */ l(
|
|
3586
3612
|
"div",
|
|
3587
3613
|
{
|
|
3588
3614
|
style: {
|
|
@@ -3595,60 +3621,62 @@ function Be({ files: s }) {
|
|
|
3595
3621
|
fontSize: "13px"
|
|
3596
3622
|
},
|
|
3597
3623
|
children: [
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ a("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.path }),
|
|
3625
|
+
/* @__PURE__ */ a("span", { style: { color: e.colors.textSecondary }, children: R(t.size) }),
|
|
3626
|
+
/* @__PURE__ */ l("span", { style: { width: "50px", textAlign: "right" }, children: [
|
|
3601
3627
|
(t.progress * 100).toFixed(0),
|
|
3602
3628
|
"%"
|
|
3603
3629
|
] })
|
|
3604
3630
|
]
|
|
3605
3631
|
},
|
|
3606
|
-
|
|
3632
|
+
n
|
|
3607
3633
|
)) });
|
|
3608
3634
|
}
|
|
3609
|
-
function
|
|
3610
|
-
const {
|
|
3611
|
-
return /* @__PURE__ */
|
|
3635
|
+
function Le({ peers: s }) {
|
|
3636
|
+
const { t: e } = w(), { theme: t } = A();
|
|
3637
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: t.spacing.xs }, children: s.length === 0 ? /* @__PURE__ */ a("div", { style: { color: t.colors.textSecondary }, children: e("torrentUI.noPeersConnected", "No peers connected") }) : s.map((n) => /* @__PURE__ */ l(
|
|
3612
3638
|
"div",
|
|
3613
3639
|
{
|
|
3614
3640
|
style: {
|
|
3615
3641
|
display: "grid",
|
|
3616
3642
|
gridTemplateColumns: "1fr 80px 100px 100px 80px",
|
|
3617
3643
|
alignItems: "center",
|
|
3618
|
-
padding:
|
|
3619
|
-
backgroundColor:
|
|
3620
|
-
borderRadius:
|
|
3644
|
+
padding: t.spacing.sm,
|
|
3645
|
+
backgroundColor: t.colors.background,
|
|
3646
|
+
borderRadius: t.borderRadius,
|
|
3621
3647
|
fontSize: "12px"
|
|
3622
3648
|
},
|
|
3623
3649
|
children: [
|
|
3624
|
-
/* @__PURE__ */
|
|
3625
|
-
|
|
3650
|
+
/* @__PURE__ */ l("span", { children: [
|
|
3651
|
+
n.ip,
|
|
3626
3652
|
":",
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3653
|
+
n.port,
|
|
3654
|
+
n.isUTP && /* @__PURE__ */ a("span", { style: { marginLeft: "4px", color: t.colors.secondary }, children: e("torrentUI.tp", "µTP") }),
|
|
3655
|
+
n.isEncrypted && /* @__PURE__ */ a("span", { style: { marginLeft: "4px", color: t.colors.secondary }, children: e("torrentUI.enc", "enc") })
|
|
3630
3656
|
] }),
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
"
|
|
3634
|
-
|
|
3657
|
+
/* @__PURE__ */ a("span", { style: { color: t.colors.textSecondary }, children: n.client || e("torrentUI.unknown", "Unknown") }),
|
|
3658
|
+
/* @__PURE__ */ l("span", { style: { color: t.colors.success }, children: [
|
|
3659
|
+
/* @__PURE__ */ a(ae, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3660
|
+
" ",
|
|
3661
|
+
H(n.downloadSpeed)
|
|
3635
3662
|
] }),
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
"
|
|
3638
|
-
|
|
3663
|
+
/* @__PURE__ */ l("span", { style: { color: t.colors.warning }, children: [
|
|
3664
|
+
/* @__PURE__ */ a(oe, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3665
|
+
" ",
|
|
3666
|
+
H(n.uploadSpeed)
|
|
3639
3667
|
] }),
|
|
3640
|
-
/* @__PURE__ */
|
|
3641
|
-
(
|
|
3668
|
+
/* @__PURE__ */ l("span", { children: [
|
|
3669
|
+
(n.progress * 100).toFixed(0),
|
|
3642
3670
|
"%"
|
|
3643
3671
|
] })
|
|
3644
3672
|
]
|
|
3645
3673
|
},
|
|
3646
|
-
|
|
3674
|
+
n.id
|
|
3647
3675
|
)) });
|
|
3648
3676
|
}
|
|
3649
|
-
function
|
|
3650
|
-
const { theme: e } =
|
|
3651
|
-
return /* @__PURE__ */
|
|
3677
|
+
function Ne({ trackers: s }) {
|
|
3678
|
+
const { theme: e } = A();
|
|
3679
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, n) => /* @__PURE__ */ l(
|
|
3652
3680
|
"div",
|
|
3653
3681
|
{
|
|
3654
3682
|
style: {
|
|
@@ -3661,7 +3689,7 @@ function Re({ trackers: s }) {
|
|
|
3661
3689
|
fontSize: "12px"
|
|
3662
3690
|
},
|
|
3663
3691
|
children: [
|
|
3664
|
-
/* @__PURE__ */
|
|
3692
|
+
/* @__PURE__ */ a(
|
|
3665
3693
|
"span",
|
|
3666
3694
|
{
|
|
3667
3695
|
style: {
|
|
@@ -3672,8 +3700,8 @@ function Re({ trackers: s }) {
|
|
|
3672
3700
|
}
|
|
3673
3701
|
}
|
|
3674
3702
|
),
|
|
3675
|
-
/* @__PURE__ */
|
|
3676
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ a("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.url }),
|
|
3704
|
+
/* @__PURE__ */ l("span", { style: { color: e.colors.textSecondary }, children: [
|
|
3677
3705
|
"S: ",
|
|
3678
3706
|
t.seeds,
|
|
3679
3707
|
" | L: ",
|
|
@@ -3681,62 +3709,65 @@ function Re({ trackers: s }) {
|
|
|
3681
3709
|
] })
|
|
3682
3710
|
]
|
|
3683
3711
|
},
|
|
3684
|
-
|
|
3712
|
+
n
|
|
3685
3713
|
)) });
|
|
3686
3714
|
}
|
|
3687
|
-
function
|
|
3715
|
+
function He({
|
|
3688
3716
|
metadata: s,
|
|
3689
3717
|
stats: e,
|
|
3690
3718
|
addedAt: t
|
|
3691
3719
|
}) {
|
|
3692
|
-
const { theme:
|
|
3693
|
-
{ label: "Name", value: s.name },
|
|
3694
|
-
{ label: "Info Hash", value: s.infoHash },
|
|
3695
|
-
{ label: "Size", value: R(s.size) },
|
|
3696
|
-
{
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
{ label: "
|
|
3701
|
-
{ label: "
|
|
3702
|
-
{ label: "
|
|
3703
|
-
{ label: "
|
|
3704
|
-
{ label: "
|
|
3705
|
-
{ label: "
|
|
3720
|
+
const { t: n } = w(), { theme: o } = A(), r = [
|
|
3721
|
+
{ label: n("torrentUI.name", "Name"), value: s.name },
|
|
3722
|
+
{ label: n("torrentUI.infoHash", "Info Hash"), value: s.infoHash },
|
|
3723
|
+
{ label: n("torrentUI.size", "Size"), value: R(s.size) },
|
|
3724
|
+
{
|
|
3725
|
+
label: n("torrentUI.pieces", "Pieces"),
|
|
3726
|
+
value: `${e.piecesComplete} / ${e.piecesTotal}`
|
|
3727
|
+
},
|
|
3728
|
+
{ label: n("torrentUI.downloads", "Downloads"), value: R(e.downloaded) },
|
|
3729
|
+
{ label: n("torrentUI.uploaded", "Uploaded"), value: R(e.uploaded) },
|
|
3730
|
+
{ label: n("torrentUI.ratio", "Ratio"), value: J(e.ratio) },
|
|
3731
|
+
{ label: n("torrentUI.availability", "Availability"), value: e.availability.toFixed(2) },
|
|
3732
|
+
{ label: n("torrentUI.wasted", "Wasted"), value: R(e.wastedBytes) },
|
|
3733
|
+
{ label: n("torrentUI.hashFails", "Hash Fails"), value: e.hashFailures },
|
|
3734
|
+
{ label: n("torrentUI.added", "Added"), value: t.toLocaleString() },
|
|
3735
|
+
{ label: n("torrentUI.comment", "Comment"), value: s.comment || "-" },
|
|
3736
|
+
{ label: n("torrentUI.private", "Private"), value: s.isPrivate ? "Yes" : "No" }
|
|
3706
3737
|
];
|
|
3707
|
-
return /* @__PURE__ */
|
|
3738
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: o.spacing.xs }, children: r.map((i) => /* @__PURE__ */ l(
|
|
3708
3739
|
"div",
|
|
3709
3740
|
{
|
|
3710
3741
|
style: {
|
|
3711
3742
|
display: "flex",
|
|
3712
3743
|
justifyContent: "space-between",
|
|
3713
|
-
padding: `${
|
|
3744
|
+
padding: `${o.spacing.xs} ${o.spacing.sm}`,
|
|
3714
3745
|
fontSize: "13px"
|
|
3715
3746
|
},
|
|
3716
3747
|
children: [
|
|
3717
|
-
/* @__PURE__ */
|
|
3718
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ a("span", { style: { color: o.colors.textSecondary }, children: i.label }),
|
|
3749
|
+
/* @__PURE__ */ a("span", { style: { fontFamily: "monospace" }, children: i.value })
|
|
3719
3750
|
]
|
|
3720
3751
|
},
|
|
3721
|
-
|
|
3752
|
+
i.label
|
|
3722
3753
|
)) });
|
|
3723
3754
|
}
|
|
3724
|
-
function
|
|
3755
|
+
function $e({
|
|
3725
3756
|
isOpen: s,
|
|
3726
3757
|
onClose: e,
|
|
3727
3758
|
onAdd: t,
|
|
3728
|
-
className:
|
|
3759
|
+
className: n
|
|
3729
3760
|
}) {
|
|
3730
|
-
const { theme:
|
|
3761
|
+
const { t: o } = w(), { theme: r, config: i, client: d } = A(), [c, g] = D(""), [u, h] = D(""), [p, T] = D(!1);
|
|
3731
3762
|
if (!s)
|
|
3732
3763
|
return null;
|
|
3733
|
-
const
|
|
3734
|
-
b.preventDefault(),
|
|
3764
|
+
const m = (b) => {
|
|
3765
|
+
b.preventDefault(), c.trim() && (t(c.trim(), { path: u || void 0, paused: p }), g(""), h(""), T(!1), e());
|
|
3735
3766
|
};
|
|
3736
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ a(
|
|
3737
3768
|
"div",
|
|
3738
3769
|
{
|
|
3739
|
-
className:
|
|
3770
|
+
className: n,
|
|
3740
3771
|
style: {
|
|
3741
3772
|
position: "fixed",
|
|
3742
3773
|
inset: 0,
|
|
@@ -3747,121 +3778,124 @@ function ze({
|
|
|
3747
3778
|
zIndex: 1e3
|
|
3748
3779
|
},
|
|
3749
3780
|
onClick: e,
|
|
3750
|
-
children: /* @__PURE__ */
|
|
3781
|
+
children: /* @__PURE__ */ l(
|
|
3751
3782
|
"div",
|
|
3752
3783
|
{
|
|
3753
3784
|
style: {
|
|
3754
|
-
backgroundColor:
|
|
3755
|
-
borderRadius:
|
|
3756
|
-
padding:
|
|
3785
|
+
backgroundColor: r.colors.surface,
|
|
3786
|
+
borderRadius: r.borderRadius,
|
|
3787
|
+
padding: r.spacing.lg,
|
|
3757
3788
|
width: "500px",
|
|
3758
3789
|
maxWidth: "90vw"
|
|
3759
3790
|
},
|
|
3760
3791
|
onClick: (b) => b.stopPropagation(),
|
|
3761
3792
|
children: [
|
|
3762
|
-
/* @__PURE__ */
|
|
3763
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ a("h2", { style: { margin: 0, marginBottom: r.spacing.md }, children: o("torrentUI.addTorrent", "Add Torrent") }),
|
|
3794
|
+
/* @__PURE__ */ l(
|
|
3764
3795
|
"form",
|
|
3765
3796
|
{
|
|
3766
|
-
onSubmit:
|
|
3767
|
-
style: { display: "flex", flexDirection: "column", gap:
|
|
3797
|
+
onSubmit: m,
|
|
3798
|
+
style: { display: "flex", flexDirection: "column", gap: r.spacing.md },
|
|
3768
3799
|
children: [
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
3800
|
+
/* @__PURE__ */ l("div", { children: [
|
|
3801
|
+
/* @__PURE__ */ a("label", { style: { display: "block", marginBottom: r.spacing.xs, fontSize: "13px" }, children: o("torrentUI.magnetUriOrTorrentFile", "Magnet URI or .torrent file path") }),
|
|
3802
|
+
/* @__PURE__ */ a(
|
|
3772
3803
|
"input",
|
|
3773
3804
|
{
|
|
3774
3805
|
type: "text",
|
|
3775
|
-
value:
|
|
3776
|
-
onChange: (b) =>
|
|
3777
|
-
placeholder:
|
|
3806
|
+
value: c,
|
|
3807
|
+
onChange: (b) => g(b.target.value),
|
|
3808
|
+
placeholder: o(
|
|
3809
|
+
"torrentUI.magnetXtUrnBtihOr",
|
|
3810
|
+
"magnet:?xt=urn:btih:... or C:\\path\\to\\file.torrent"
|
|
3811
|
+
),
|
|
3778
3812
|
style: {
|
|
3779
3813
|
width: "100%",
|
|
3780
|
-
padding:
|
|
3781
|
-
backgroundColor:
|
|
3782
|
-
color:
|
|
3783
|
-
border: `1px solid ${
|
|
3784
|
-
borderRadius:
|
|
3814
|
+
padding: r.spacing.sm,
|
|
3815
|
+
backgroundColor: r.colors.background,
|
|
3816
|
+
color: r.colors.text,
|
|
3817
|
+
border: `1px solid ${r.colors.border}`,
|
|
3818
|
+
borderRadius: r.borderRadius,
|
|
3785
3819
|
outline: "none",
|
|
3786
3820
|
fontSize: "13px"
|
|
3787
3821
|
}
|
|
3788
3822
|
}
|
|
3789
3823
|
)
|
|
3790
3824
|
] }),
|
|
3791
|
-
/* @__PURE__ */
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3825
|
+
/* @__PURE__ */ l("div", { children: [
|
|
3826
|
+
/* @__PURE__ */ a("label", { style: { display: "block", marginBottom: r.spacing.xs, fontSize: "13px" }, children: o("torrentUI.saveLocation", "Save Location") }),
|
|
3827
|
+
/* @__PURE__ */ a(
|
|
3794
3828
|
"input",
|
|
3795
3829
|
{
|
|
3796
3830
|
type: "text",
|
|
3797
|
-
value:
|
|
3798
|
-
onChange: (b) =>
|
|
3799
|
-
placeholder: "Leave empty for default",
|
|
3831
|
+
value: u,
|
|
3832
|
+
onChange: (b) => h(b.target.value),
|
|
3833
|
+
placeholder: o("torrentUI.leaveEmptyForDefault", "Leave empty for default"),
|
|
3800
3834
|
style: {
|
|
3801
3835
|
width: "100%",
|
|
3802
|
-
padding:
|
|
3803
|
-
backgroundColor:
|
|
3804
|
-
color:
|
|
3805
|
-
border: `1px solid ${
|
|
3806
|
-
borderRadius:
|
|
3836
|
+
padding: r.spacing.sm,
|
|
3837
|
+
backgroundColor: r.colors.background,
|
|
3838
|
+
color: r.colors.text,
|
|
3839
|
+
border: `1px solid ${r.colors.border}`,
|
|
3840
|
+
borderRadius: r.borderRadius,
|
|
3807
3841
|
outline: "none",
|
|
3808
3842
|
fontSize: "13px"
|
|
3809
3843
|
}
|
|
3810
3844
|
}
|
|
3811
3845
|
)
|
|
3812
3846
|
] }),
|
|
3813
|
-
/* @__PURE__ */
|
|
3847
|
+
/* @__PURE__ */ l(
|
|
3814
3848
|
"label",
|
|
3815
3849
|
{
|
|
3816
3850
|
style: {
|
|
3817
3851
|
display: "flex",
|
|
3818
3852
|
alignItems: "center",
|
|
3819
|
-
gap:
|
|
3853
|
+
gap: r.spacing.sm,
|
|
3820
3854
|
fontSize: "13px"
|
|
3821
3855
|
},
|
|
3822
3856
|
children: [
|
|
3823
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ a(
|
|
3824
3858
|
"input",
|
|
3825
3859
|
{
|
|
3826
3860
|
type: "checkbox",
|
|
3827
3861
|
checked: p,
|
|
3828
|
-
onChange: (b) =>
|
|
3862
|
+
onChange: (b) => T(b.target.checked)
|
|
3829
3863
|
}
|
|
3830
3864
|
),
|
|
3831
|
-
"Start paused"
|
|
3865
|
+
o("torrentUI.startPaused", "Start paused")
|
|
3832
3866
|
]
|
|
3833
3867
|
}
|
|
3834
3868
|
),
|
|
3835
|
-
/* @__PURE__ */
|
|
3836
|
-
/* @__PURE__ */
|
|
3869
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", gap: r.spacing.sm, justifyContent: "flex-end" }, children: [
|
|
3870
|
+
/* @__PURE__ */ a(
|
|
3837
3871
|
"button",
|
|
3838
3872
|
{
|
|
3839
3873
|
type: "button",
|
|
3840
3874
|
onClick: e,
|
|
3841
3875
|
style: {
|
|
3842
|
-
padding: `${
|
|
3876
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3843
3877
|
backgroundColor: "transparent",
|
|
3844
|
-
color:
|
|
3845
|
-
border: `1px solid ${
|
|
3846
|
-
borderRadius:
|
|
3878
|
+
color: r.colors.text,
|
|
3879
|
+
border: `1px solid ${r.colors.border}`,
|
|
3880
|
+
borderRadius: r.borderRadius,
|
|
3847
3881
|
cursor: "pointer"
|
|
3848
3882
|
},
|
|
3849
|
-
children: "Cancel"
|
|
3883
|
+
children: o("torrentUI.cancel", "Cancel")
|
|
3850
3884
|
}
|
|
3851
3885
|
),
|
|
3852
|
-
/* @__PURE__ */
|
|
3886
|
+
/* @__PURE__ */ a(
|
|
3853
3887
|
"button",
|
|
3854
3888
|
{
|
|
3855
3889
|
type: "submit",
|
|
3856
3890
|
style: {
|
|
3857
|
-
padding: `${
|
|
3858
|
-
backgroundColor:
|
|
3859
|
-
color:
|
|
3891
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3892
|
+
backgroundColor: r.colors.primary,
|
|
3893
|
+
color: r.colors.text,
|
|
3860
3894
|
border: "none",
|
|
3861
|
-
borderRadius:
|
|
3895
|
+
borderRadius: r.borderRadius,
|
|
3862
3896
|
cursor: "pointer"
|
|
3863
3897
|
},
|
|
3864
|
-
children: "Add Torrent"
|
|
3898
|
+
children: o("torrentUI.addTorrent", "Add Torrent")
|
|
3865
3899
|
}
|
|
3866
3900
|
)
|
|
3867
3901
|
] })
|
|
@@ -3874,14 +3908,14 @@ function ze({
|
|
|
3874
3908
|
}
|
|
3875
3909
|
);
|
|
3876
3910
|
}
|
|
3877
|
-
function
|
|
3911
|
+
function at({
|
|
3878
3912
|
client: s,
|
|
3879
3913
|
config: e,
|
|
3880
3914
|
className: t,
|
|
3881
|
-
style:
|
|
3915
|
+
style: n
|
|
3882
3916
|
}) {
|
|
3883
|
-
const [
|
|
3884
|
-
return /* @__PURE__ */
|
|
3917
|
+
const { t: o } = w(), [r, i] = D(!1), [d, c] = D(null);
|
|
3918
|
+
return /* @__PURE__ */ a(Me, { client: s, config: e, children: /* @__PURE__ */ l(
|
|
3885
3919
|
"div",
|
|
3886
3920
|
{
|
|
3887
3921
|
className: t,
|
|
@@ -3890,13 +3924,13 @@ function Ye({
|
|
|
3890
3924
|
flexDirection: "column",
|
|
3891
3925
|
gap: "16px",
|
|
3892
3926
|
height: "100%",
|
|
3893
|
-
...
|
|
3927
|
+
...n
|
|
3894
3928
|
},
|
|
3895
3929
|
children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3930
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: "8px" }, children: /* @__PURE__ */ a(
|
|
3897
3931
|
"button",
|
|
3898
3932
|
{
|
|
3899
|
-
onClick: () =>
|
|
3933
|
+
onClick: () => i(!0),
|
|
3900
3934
|
style: {
|
|
3901
3935
|
padding: "8px 16px",
|
|
3902
3936
|
backgroundColor: "#0f3460",
|
|
@@ -3905,18 +3939,18 @@ function Ye({
|
|
|
3905
3939
|
borderRadius: "8px",
|
|
3906
3940
|
cursor: "pointer"
|
|
3907
3941
|
},
|
|
3908
|
-
children: "+ Add Torrent"
|
|
3942
|
+
children: o("torrentUI.addTorrent2", "+ Add Torrent")
|
|
3909
3943
|
}
|
|
3910
3944
|
) }),
|
|
3911
|
-
/* @__PURE__ */
|
|
3912
|
-
/* @__PURE__ */
|
|
3913
|
-
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
|
|
3945
|
+
/* @__PURE__ */ a(Ue, {}),
|
|
3946
|
+
/* @__PURE__ */ a(Re, { onTorrentSelect: c, style: { flex: 1 } }),
|
|
3947
|
+
d && /* @__PURE__ */ a(ze, { infoHash: d }),
|
|
3948
|
+
/* @__PURE__ */ a(
|
|
3949
|
+
$e,
|
|
3916
3950
|
{
|
|
3917
|
-
isOpen:
|
|
3918
|
-
onClose: () =>
|
|
3919
|
-
onAdd: (
|
|
3951
|
+
isOpen: r,
|
|
3952
|
+
onClose: () => i(!1),
|
|
3953
|
+
onAdd: (g, u) => s.addTorrent(g, u)
|
|
3920
3954
|
}
|
|
3921
3955
|
)
|
|
3922
3956
|
]
|
|
@@ -3924,34 +3958,34 @@ function Ye({
|
|
|
3924
3958
|
) });
|
|
3925
3959
|
}
|
|
3926
3960
|
export {
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3961
|
+
$e as AddTorrentDialog,
|
|
3962
|
+
Ue as FilterBar,
|
|
3963
|
+
se as HealthService,
|
|
3964
|
+
De as LifeDashboardService,
|
|
3965
|
+
Qe as NiceHealth,
|
|
3966
|
+
rt as NiceLifeDashboard,
|
|
3967
|
+
Xe as NicePersonalFinance,
|
|
3968
|
+
et as NiceTaskManager,
|
|
3969
|
+
at as NiceTorrentUI,
|
|
3970
|
+
fe as PersonalFinanceService,
|
|
3971
|
+
Be as ProgressBar,
|
|
3972
|
+
Fe as StatusBadge,
|
|
3973
|
+
ke as TaskManagerService,
|
|
3974
|
+
ze as TorrentDetails,
|
|
3975
|
+
Re as TorrentList,
|
|
3976
|
+
Me as TorrentUIProvider,
|
|
3977
|
+
qe as createHealthService,
|
|
3978
|
+
tt as createLifeDashboardService,
|
|
3979
|
+
Ye as createPersonalFinanceService,
|
|
3980
|
+
Je as createTaskManagerService,
|
|
3947
3981
|
R as formatBytes,
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3982
|
+
Ae as formatETA,
|
|
3983
|
+
J as formatRatio,
|
|
3984
|
+
H as formatSpeed,
|
|
3985
|
+
Z as getStatusColor,
|
|
3986
|
+
Ke as useHealth,
|
|
3987
|
+
nt as useLifeDashboard,
|
|
3988
|
+
_e as usePersonalFinance,
|
|
3989
|
+
Ze as useTaskManager,
|
|
3990
|
+
A as useTorrentUI
|
|
3957
3991
|
};
|