@flux-ui/dashboard 3.0.0-next.67 → 3.0.0-next.68

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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, customRef, defineComponent, guardReactiveProps, inject, markRaw, mergeProps, normalizeClass, normalizeProps, openBlock, provide, ref, renderList, renderSlot, resolveComponent, toDisplayString, unref, useSlots, watch, withCtx } from "vue";
2
2
  import { DateTime } from "luxon";
3
3
  import { FluxIcon, FluxMenuItem, FluxSpacer } from "@flux-ui/components";
4
- //#region ../../node_modules/.bun/@basmilius+utils@3.30.0/node_modules/@basmilius/utils/dist/index.mjs
5
- function x$1(e) {
4
+ //#region ../../node_modules/.bun/@basmilius+utils@3.33.0/node_modules/@basmilius/utils/dist/index.mjs
5
+ function x(e) {
6
6
  let t = {};
7
7
  do {
8
8
  if (e.name === ``) break;
@@ -14,10 +14,10 @@ function x$1(e) {
14
14
  } while (e = Object.getPrototypeOf(e));
15
15
  return t;
16
16
  }
17
- function G$1(e, t, n) {
17
+ function G(e, t, n) {
18
18
  e.prototype[t] = n;
19
19
  }
20
- function K$1(e, t, n) {
20
+ function K(e, t, n) {
21
21
  Object.defineProperty(e, t, { value: n });
22
22
  }
23
23
  //#endregion
@@ -225,12 +225,12 @@ var num_per = `(?:${num$1}%|${num$1})`;
225
225
  var num_per_none = `(?:${num$1}%|${num$1}|none)`;
226
226
  var hue$1 = `(?:${num$1}(deg|grad|rad|turn)|${num$1})`;
227
227
  `${num$1}${num$1}`;
228
- var c$1 = `\\s*,\\s*`;
228
+ var c = `\\s*,\\s*`;
229
229
  new RegExp("^" + num_per_none + "$");
230
230
  //#endregion
231
231
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/rgb/parseRgbLegacy.js
232
- var rgb_num_old = new RegExp(`^rgba?\\(\\s*${num$1}${c$1}${num$1}${c$1}${num$1}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
233
- var rgb_per_old = new RegExp(`^rgba?\\(\\s*${per}${c$1}${per}${c$1}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
232
+ var rgb_num_old = new RegExp(`^rgba?\\(\\s*${num$1}${c}${num$1}${c}${num$1}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
233
+ var rgb_per_old = new RegExp(`^rgba?\\(\\s*${per}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
234
234
  var parseRgbLegacy = (color) => {
235
235
  let res = { mode: "rgb" };
236
236
  let match;
@@ -932,7 +932,7 @@ var convertLchToLab = ({ l, c, h, alpha }, mode = "lab") => {
932
932
  };
933
933
  //#endregion
934
934
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/xyz65/constants.js
935
- var k$5 = Math.pow(29, 3) / Math.pow(3, 3);
935
+ var k$4 = Math.pow(29, 3) / Math.pow(3, 3);
936
936
  var e$2 = Math.pow(6, 3) / Math.pow(29, 3);
937
937
  //#endregion
938
938
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/constants.js
@@ -950,7 +950,7 @@ Math.pow(29, 3) / Math.pow(3, 3);
950
950
  Math.pow(6, 3) / Math.pow(29, 3);
951
951
  //#endregion
952
952
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToXyz65.js
953
- var fn$1 = (v) => Math.pow(v, 3) > e$2 ? Math.pow(v, 3) : (116 * v - 16) / k$5;
953
+ var fn$1 = (v) => Math.pow(v, 3) > e$2 ? Math.pow(v, 3) : (116 * v - 16) / k$4;
954
954
  var convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
955
955
  if (l === void 0) l = 0;
956
956
  if (a === void 0) a = 0;
@@ -972,14 +972,14 @@ var convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
972
972
  var convertLab65ToRgb = (lab) => convertXyz65ToRgb(convertLab65ToXyz65(lab));
973
973
  //#endregion
974
974
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab65/convertXyz65ToLab65.js
975
- var f$2 = (value) => value > e$2 ? Math.cbrt(value) : (k$5 * value + 16) / 116;
975
+ var f$1 = (value) => value > e$2 ? Math.cbrt(value) : (k$4 * value + 16) / 116;
976
976
  var convertXyz65ToLab65 = ({ x, y, z, alpha }) => {
977
977
  if (x === void 0) x = 0;
978
978
  if (y === void 0) y = 0;
979
979
  if (z === void 0) z = 0;
980
- let f0 = f$2(x / D65.X);
981
- let f1 = f$2(y / D65.Y);
982
- let f2 = f$2(z / D65.Z);
980
+ let f0 = f$1(x / D65.X);
981
+ let f1 = f$1(y / D65.Y);
982
+ let f2 = f$1(z / D65.Z);
983
983
  let res = {
984
984
  mode: "lab65",
985
985
  l: 116 * f1 - 16,
@@ -1315,7 +1315,7 @@ var hueToDeg = (val, unit) => {
1315
1315
  };
1316
1316
  //#endregion
1317
1317
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/hsl/parseHslLegacy.js
1318
- var hsl_old = new RegExp(`^hsla?\\(\\s*${hue$1}${c$1}${per}${c$1}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
1318
+ var hsl_old = new RegExp(`^hsla?\\(\\s*${hue$1}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
1319
1319
  var parseHslLegacy = (color) => {
1320
1320
  let match = color.match(hsl_old);
1321
1321
  if (!match) return;
@@ -1665,12 +1665,12 @@ var definition$18 = {
1665
1665
  };
1666
1666
  //#endregion
1667
1667
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/jab/convertXyz65ToJab.js
1668
- var p$2 = 134.03437499999998;
1668
+ var p$1 = 134.03437499999998;
1669
1669
  var d0$1 = 16295499532821565e-27;
1670
1670
  var jabPqEncode = (v) => {
1671
1671
  if (v < 0) return 0;
1672
1672
  let vn = Math.pow(v / 1e4, M1);
1673
- return Math.pow((C1 + C2 * vn) / (1 + C3 * vn), p$2);
1673
+ return Math.pow((C1 + C2 * vn) / (1 + C3 * vn), p$1);
1674
1674
  };
1675
1675
  var abs = (v = 0) => Math.max(v * 203, 0);
1676
1676
  var convertXyz65ToJab = ({ x, y, z, alpha }) => {
@@ -1694,11 +1694,11 @@ var convertXyz65ToJab = ({ x, y, z, alpha }) => {
1694
1694
  };
1695
1695
  //#endregion
1696
1696
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/jab/convertJabToXyz65.js
1697
- var p$1 = 134.03437499999998;
1697
+ var p = 134.03437499999998;
1698
1698
  var d0 = 16295499532821565e-27;
1699
1699
  var jabPqDecode = (v) => {
1700
1700
  if (v < 0) return 0;
1701
- let vp = Math.pow(v, 1 / p$1);
1701
+ let vp = Math.pow(v, 1 / p);
1702
1702
  return 1e4 * Math.pow((C1 - vp) / (C3 * vp - C2), 1 / M1);
1703
1703
  };
1704
1704
  var rel = (v) => v / 203;
@@ -1834,11 +1834,11 @@ var definition$16 = {
1834
1834
  };
1835
1835
  //#endregion
1836
1836
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/xyz50/constants.js
1837
- var k$3 = Math.pow(29, 3) / Math.pow(3, 3);
1837
+ var k$2 = Math.pow(29, 3) / Math.pow(3, 3);
1838
1838
  var e = Math.pow(6, 3) / Math.pow(29, 3);
1839
1839
  //#endregion
1840
1840
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab/convertLabToXyz50.js
1841
- var fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k$3;
1841
+ var fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k$2;
1842
1842
  var convertLabToXyz50 = ({ l, a, b, alpha }) => {
1843
1843
  if (l === void 0) l = 0;
1844
1844
  if (a === void 0) a = 0;
@@ -1887,14 +1887,14 @@ var convertRgbToXyz50 = (rgb) => {
1887
1887
  };
1888
1888
  //#endregion
1889
1889
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab/convertXyz50ToLab.js
1890
- var f$1 = (value) => value > e ? Math.cbrt(value) : (k$3 * value + 16) / 116;
1890
+ var f = (value) => value > e ? Math.cbrt(value) : (k$2 * value + 16) / 116;
1891
1891
  var convertXyz50ToLab = ({ x, y, z, alpha }) => {
1892
1892
  if (x === void 0) x = 0;
1893
1893
  if (y === void 0) y = 0;
1894
1894
  if (z === void 0) z = 0;
1895
- let f0 = f$1(x / D50.X);
1896
- let f1 = f$1(y / D50.Y);
1897
- let f2 = f$1(z / D50.Z);
1895
+ let f0 = f(x / D50.X);
1896
+ let f1 = f(y / D50.Y);
1897
+ let f2 = f(z / D50.Z);
1898
1898
  let res = {
1899
1899
  mode: "lab",
1900
1900
  l: 116 * f1 - 16,
@@ -2093,7 +2093,7 @@ var u_fn$1 = (x, y, z) => 4 * x / (x + 15 * y + 3 * z);
2093
2093
  var v_fn$1 = (x, y, z) => 9 * y / (x + 15 * y + 3 * z);
2094
2094
  var un$1 = u_fn$1(D50.X, D50.Y, D50.Z);
2095
2095
  var vn$1 = v_fn$1(D50.X, D50.Y, D50.Z);
2096
- var l_fn = (value) => value <= e ? k$3 * value : 116 * Math.cbrt(value) - 16;
2096
+ var l_fn = (value) => value <= e ? k$2 * value : 116 * Math.cbrt(value) - 16;
2097
2097
  var convertXyz50ToLuv = ({ x, y, z, alpha }) => {
2098
2098
  if (x === void 0) x = 0;
2099
2099
  if (y === void 0) y = 0;
@@ -2133,7 +2133,7 @@ var convertLuvToXyz50 = ({ l, u, v, alpha }) => {
2133
2133
  if (v === void 0) v = 0;
2134
2134
  let up = u / (13 * l) + un;
2135
2135
  let vp = v / (13 * l) + vn;
2136
- let y = D50.Y * (l <= 8 ? l / k$3 : Math.pow((l + 16) / 116, 3));
2136
+ let y = D50.Y * (l <= 8 ? l / k$2 : Math.pow((l + 16) / 116, 3));
2137
2137
  let res = {
2138
2138
  mode: "xyz50",
2139
2139
  x: y * (9 * up) / (4 * vp),
@@ -3102,304 +3102,514 @@ useMode(definition$2);
3102
3102
  useMode(definition$1);
3103
3103
  useMode(definition);
3104
3104
  //#endregion
3105
- //#region ../../node_modules/.bun/@basmilius+http-client@3.30.0+638c9d1214a588db/node_modules/@basmilius/http-client/dist/index.mjs
3106
- function c(e) {
3107
- return class extends e {
3108
- constructor(...e) {
3109
- throw Error(`@adapter: cannot create instance of class.`);
3105
+ //#region ../../node_modules/.bun/@basmilius+http-client@3.33.0+ceec7979b6f4ef20/node_modules/@basmilius/http-client/dist/index.mjs
3106
+ function adapter_default(Parent) {
3107
+ return class extends Parent {
3108
+ constructor(...args) {
3109
+ throw new Error("@adapter: cannot create instance of class.");
3110
3110
  }
3111
3111
  };
3112
3112
  }
3113
- function ne(e, t) {
3114
- return e === t ? !0 : e === t;
3115
- }
3116
- var l = Symbol(), u = Symbol(), d = Symbol(), f = Symbol(), p = Symbol(), m = Symbol(), h = Symbol(), g = Symbol(), _ = Symbol(), re = Symbol(), ie$1 = Symbol();
3117
- function v(e) {
3118
- return e && typeof e == `object` && !!e[p];
3119
- }
3120
- function y(e) {
3121
- if (!v(e)) throw Error(`@dto assert given object is not a class decorated with @Dto.`);
3122
- }
3123
- var ae$1 = Symbol();
3124
- function b(e, t = 0, n) {
3125
- return function(...r) {
3126
- let i = e[ae$1] ??= /* @__PURE__ */ new WeakMap(), a = r[t], o = n === void 0 ? `self` : r[n];
3127
- if (typeof a != `object` || !a) return e.call(this, ...r);
3128
- i.has(a) || i.set(a, []);
3129
- let s = i.get(a);
3130
- if (!s.includes(o)) {
3131
- s.push(o);
3132
- try {
3133
- return e.call(this, ...r);
3134
- } finally {
3135
- let e = s.lastIndexOf(o);
3136
- e !== -1 && s.splice(e, 1), s.length === 0 && i.delete(a);
3137
- }
3113
+ /**
3114
+ * Checks if the two given values are equal. When both values are a
3115
+ * dto, the check is done by firstly converthing them to JSON.
3116
+ */
3117
+ function areEqual_default(a, b) {
3118
+ if (a === b) return true;
3119
+ return a === b;
3120
+ }
3121
+ var ARGS = Symbol();
3122
+ var CHILDREN = Symbol();
3123
+ var DESCRIPTORS = Symbol();
3124
+ var DIRTY = Symbol();
3125
+ var NAME = Symbol();
3126
+ var PARENT = Symbol();
3127
+ var PARENT_KEY = Symbol();
3128
+ var PROPERTIES = Symbol();
3129
+ var PROXY = Symbol();
3130
+ var TRACK = Symbol();
3131
+ var TRIGGER = Symbol();
3132
+ /**
3133
+ * Checks if the given object is a dto.
3134
+ */
3135
+ function isDto_default(obj) {
3136
+ return obj && typeof obj === "object" && !!obj[NAME];
3137
+ }
3138
+ /**
3139
+ * Asserts that the given object is a dto.
3140
+ */
3141
+ function assertDto_default(obj) {
3142
+ if (!isDto_default(obj)) throw new Error("@dto assert given object is not a class decorated with @Dto.");
3143
+ }
3144
+ var CIRCULAR_MAP = Symbol();
3145
+ function circularProtect_default(fn, arg1 = 0, arg2) {
3146
+ return function(...args) {
3147
+ const map = fn[CIRCULAR_MAP] ??= /* @__PURE__ */ new WeakMap();
3148
+ const primary = args[arg1];
3149
+ const secondary = arg2 !== void 0 ? args[arg2] : "self";
3150
+ if (typeof primary !== "object" || primary === null) return fn.call(this, ...args);
3151
+ if (!map.has(primary)) map.set(primary, []);
3152
+ const visited = map.get(primary);
3153
+ if (visited.includes(secondary)) return;
3154
+ visited.push(secondary);
3155
+ try {
3156
+ return fn.call(this, ...args);
3157
+ } finally {
3158
+ const index = visited.lastIndexOf(secondary);
3159
+ if (index !== -1) visited.splice(index, 1);
3160
+ if (visited.length === 0) map.delete(primary);
3138
3161
  }
3139
3162
  };
3140
3163
  }
3141
- function x(e) {
3142
- return y(e), e[f];
3143
- }
3144
- var S = b(function(e, t, n, r) {
3145
- let i = e[ie$1];
3146
- i(e, t, n, r), e[m] && S(e[m], e[h], e[m][e[h]]);
3147
- }, 0, 1), C = b(function(e) {
3148
- y(e), e[f] && (e[f] = !1, S(e, f, !1, !0)), !(!e[u] || e[u].length === 0) && e[u].filter(x).forEach(C);
3164
+ /**
3165
+ * Checks if the given dto is dirty.
3166
+ */
3167
+ function isDtoDirty_default(obj) {
3168
+ assertDto_default(obj);
3169
+ return obj[DIRTY];
3170
+ }
3171
+ /**
3172
+ * Trigger for when a dto property is being updated.
3173
+ */
3174
+ var triggerDto = circularProtect_default(function(dto, key, value, oldValue) {
3175
+ const trigger = dto[TRIGGER];
3176
+ trigger(dto, key, value, oldValue);
3177
+ dto[PARENT] && triggerDto(dto[PARENT], dto[PARENT_KEY], dto[PARENT][dto[PARENT_KEY]]);
3178
+ }, 0, 1);
3179
+ /**
3180
+ * Marks the given dto clean.
3181
+ */
3182
+ var markDtoClean = circularProtect_default(function(obj) {
3183
+ assertDto_default(obj);
3184
+ if (obj[DIRTY]) {
3185
+ obj[DIRTY] = false;
3186
+ triggerDto(obj, DIRTY, false, true);
3187
+ }
3188
+ if (!obj[CHILDREN] || obj[CHILDREN].length === 0) return;
3189
+ obj[CHILDREN].filter(isDtoDirty_default).forEach(markDtoClean);
3149
3190
  });
3150
- var w = b(function(e, t) {
3151
- y(e), e[f] || (e[f] = !0, S(e, f, !0, !1)), e[m] && w(e[m], e[h]);
3191
+ /**
3192
+ * Marks the given dto dirty.
3193
+ */
3194
+ var markDtoDirty = circularProtect_default(function(obj, key) {
3195
+ assertDto_default(obj);
3196
+ if (!obj[DIRTY]) {
3197
+ obj[DIRTY] = true;
3198
+ triggerDto(obj, DIRTY, true, false);
3199
+ }
3200
+ if (!obj[PARENT]) return;
3201
+ markDtoDirty(obj[PARENT], obj[PARENT_KEY]);
3152
3202
  });
3153
- function T(e, t, n) {
3154
- t[u] ??= [], !t[u].includes(e) && t[u].push(e), e[m] !== t && (e[m] = t), e[h] !== n && (e[h] = n);
3155
- }
3156
- function E(e, t, n) {
3157
- if (v(n)) T(n, e, t);
3158
- else if (Array.isArray(n)) {
3159
- for (let r of n) v(r) && T(r, e, t);
3160
- n[m] = e, n[h] = t;
3161
- }
3162
- }
3163
- function le(e, t) {
3164
- let n = e[re];
3165
- n(e, t);
3166
- }
3167
- function D$1(e, t) {
3168
- if (u in t) {
3169
- let n = t[u].indexOf(e);
3170
- n !== -1 && t[u].splice(n, 1);
3171
- }
3172
- e[m] = void 0, e[h] = void 0;
3173
- }
3174
- function ue(e, t) {
3175
- if (v(t)) D$1(t, e);
3176
- else if (Array.isArray(t)) {
3177
- for (let n of t) v(n) && D$1(n, e);
3178
- t[m] = void 0, t[h] = void 0;
3179
- }
3180
- }
3181
- var O = {};
3182
- var k$2 = {
3183
- deleteProperty(e, t) {
3184
- if (Reflect.deleteProperty(e, t), A(e, t)) return !0;
3185
- let n = e[m];
3186
- return n && S(n, e[h], n[e[h]]), n && w(n, e[h]), !0;
3187
- },
3188
- get(e, t, n) {
3189
- if (t === _) return !0;
3190
- if (A(e, t)) return Reflect.get(e, t, n);
3191
- let r = e[m];
3192
- return r && le(r, e[h]), Reflect.get(e, t);
3193
- },
3194
- set(e, t, n, r) {
3195
- if (A(e, t)) return Reflect.set(e, t, n, r);
3196
- let i = e[m];
3197
- return i && S(i, e[h], i[e[h]]), i && w(i, e[h]), Reflect.set(e, t, n);
3198
- }
3199
- };
3200
- function A(e, t) {
3201
- return typeof t == `symbol` || typeof e[t] == `function` || t === `length`;
3202
- }
3203
- var de = {
3204
- get(e, t, n) {
3205
- if (t === _) return !0;
3206
- if (typeof t == `symbol`) return Reflect.get(e, t, n);
3207
- let r = e[d][t];
3208
- if (!r || !r.get) return Reflect.get(e, t, n);
3209
- let i = r.get.call(e);
3210
- return le(e, t), E(e, t, i), i;
3211
- },
3212
- getOwnPropertyDescriptor(e, t) {
3213
- return e[d][t];
3214
- },
3215
- ownKeys(e) {
3216
- return e[g];
3217
- },
3218
- set(e, t, n, r) {
3219
- if (typeof t == `symbol`) return Reflect.set(e, t, n, r);
3220
- let i = e[d][t];
3221
- if (!i || !i.set) return Reflect.set(e, t, n, r);
3222
- let a = i.get?.call(e) ?? void 0;
3223
- return ne(n, a) ? !0 : (ue(e, a), Array.isArray(n) && !n[_] && (n = new Proxy(n, k$2)), i.set.call(e, n), E(e, t, n), w(e, t), S(e, t, n, a), !0);
3224
- }
3225
- }, fe = {
3226
- get(e, t, n) {
3227
- return t === `__v_isRef` ? !1 : t === _ ? !0 : t in e ? Reflect.get(e, t, n) : Reflect.get(e.value, t);
3228
- },
3229
- getOwnPropertyDescriptor(e, t) {
3230
- return Reflect.getOwnPropertyDescriptor(e.value, t);
3231
- },
3232
- ownKeys(e) {
3233
- return Reflect.ownKeys(e.value);
3234
- },
3235
- set(e, t, n, r) {
3236
- return t in e ? Reflect.set(e, t, n, r) : Reflect.set(e.value, t, n);
3237
- }
3238
- }, pe = { construct(e, t, n) {
3239
- t = t.map((e) => Array.isArray(e) ? new Proxy(e, k$2) : e);
3240
- let r = customRef((r, i) => {
3241
- let a = markRaw(Reflect.construct(e, t, n));
3242
- a[l] = t, a[f] = !1, a[re] = r, a[ie$1] = i;
3243
- let s = new Proxy(a, de);
3203
+ /**
3204
+ * Creates a parent-child relationship between the given two dtos.
3205
+ */
3206
+ function relateDtoTo_default(dto, parent, key) {
3207
+ parent[CHILDREN] ??= [];
3208
+ !parent[CHILDREN].includes(dto) && parent[CHILDREN].push(dto);
3209
+ dto[PARENT] !== parent && (dto[PARENT] = parent);
3210
+ dto[PARENT_KEY] !== key && (dto[PARENT_KEY] = key);
3211
+ }
3212
+ /**
3213
+ * Creates relationships between the given value and dto.
3214
+ */
3215
+ function relateValueTo_default(dto, key, value) {
3216
+ if (isDto_default(value)) relateDtoTo_default(value, dto, key);
3217
+ else if (Array.isArray(value)) {
3218
+ for (const item of value) {
3219
+ if (!isDto_default(item)) continue;
3220
+ relateDtoTo_default(item, dto, key);
3221
+ }
3222
+ value[PARENT] = dto;
3223
+ value[PARENT_KEY] = key;
3224
+ }
3225
+ }
3226
+ /**
3227
+ * Tracking for when a dto property is being accessed.
3228
+ */
3229
+ function trackDto(dto, key) {
3230
+ const track = dto[TRACK];
3231
+ track(dto, key);
3232
+ }
3233
+ /**
3234
+ * Removes a parent-child relationship between the given two dtos.
3235
+ */
3236
+ function unrelateDtoFrom_default(dto, parent) {
3237
+ if (CHILDREN in parent) {
3238
+ const index = parent[CHILDREN].indexOf(dto);
3239
+ if (index !== -1) parent[CHILDREN].splice(index, 1);
3240
+ }
3241
+ dto[PARENT] = void 0;
3242
+ dto[PARENT_KEY] = void 0;
3243
+ }
3244
+ /**
3245
+ * Removes relationships between the given value and dto.
3246
+ */
3247
+ function unrelateValueFrom_default(dto, value) {
3248
+ if (isDto_default(value)) unrelateDtoFrom_default(value, dto);
3249
+ else if (Array.isArray(value)) {
3250
+ for (const item of value) if (isDto_default(item)) unrelateDtoFrom_default(item, dto);
3251
+ value[PARENT] = void 0;
3252
+ value[PARENT_KEY] = void 0;
3253
+ }
3254
+ }
3255
+ var DTO_CLASS_MAP = {};
3256
+ var arrayProxy_default = {
3257
+ /**
3258
+ * Trap for when a property is deleted from the target. This
3259
+ * will mark the parent dto as dirty and trigger an update.
3260
+ */
3261
+ deleteProperty(target, key) {
3262
+ Reflect.deleteProperty(target, key);
3263
+ if (ignored(target, key)) return true;
3264
+ const dto = target[PARENT];
3265
+ dto && triggerDto(dto, target[PARENT_KEY], dto[target[PARENT_KEY]]);
3266
+ dto && markDtoDirty(dto, target[PARENT_KEY]);
3267
+ return true;
3268
+ },
3269
+ /**
3270
+ * Trap for when a property of the target is being accessed. The
3271
+ * property access is being tracked for further updates.
3272
+ */
3273
+ get(target, key, receiver) {
3274
+ if (key === PROXY) return true;
3275
+ if (ignored(target, key)) return Reflect.get(target, key, receiver);
3276
+ const dto = target[PARENT];
3277
+ dto && trackDto(dto, target[PARENT_KEY]);
3278
+ return Reflect.get(target, key);
3279
+ },
3280
+ /**
3281
+ * Trap for when a property of the target is being updated. This
3282
+ * will mark the parent dto as dirty and trigger an update.
3283
+ */
3284
+ set(target, key, value, receiver) {
3285
+ if (ignored(target, key)) return Reflect.set(target, key, value, receiver);
3286
+ const dto = target[PARENT];
3287
+ dto && triggerDto(dto, target[PARENT_KEY], dto[target[PARENT_KEY]]);
3288
+ dto && markDtoDirty(dto, target[PARENT_KEY]);
3289
+ return Reflect.set(target, key, value);
3290
+ }
3291
+ };
3292
+ /**
3293
+ * Checks if the given key should be ignored by the proxy.
3294
+ */
3295
+ function ignored(target, key) {
3296
+ return typeof key === "symbol" || typeof target[key] === "function" || key === "length";
3297
+ }
3298
+ var instanceProxy_default = {
3299
+ /**
3300
+ * Trap for when a dto property is being accessed. The property
3301
+ * access is being tracked for further updates. If the dto has
3302
+ * any child dtos, a relationship will be added between them.
3303
+ */
3304
+ get(target, key, receiver) {
3305
+ if (key === PROXY) return true;
3306
+ if (typeof key === "symbol") return Reflect.get(target, key, receiver);
3307
+ const descriptor = target[DESCRIPTORS][key];
3308
+ if (!descriptor || !descriptor.get) return Reflect.get(target, key, receiver);
3309
+ const value = descriptor.get.call(target);
3310
+ trackDto(target, key);
3311
+ relateValueTo_default(target, key, value);
3312
+ return value;
3313
+ },
3314
+ /**
3315
+ * Trap for when a descriptor of a dto property is requested.
3316
+ */
3317
+ getOwnPropertyDescriptor(target, key) {
3318
+ return target[DESCRIPTORS][key];
3319
+ },
3320
+ /**
3321
+ * Trap for when the keys of a dto are requested.
3322
+ */
3323
+ ownKeys(target) {
3324
+ return target[PROPERTIES];
3325
+ },
3326
+ /**
3327
+ * Trap for when a dto property is being updated. This will
3328
+ * mark the dto dirty and trigger an update. If an array is
3329
+ * passed, that array will be made reactive as well.
3330
+ */
3331
+ set(target, key, value, receiver) {
3332
+ if (typeof key === "symbol") return Reflect.set(target, key, value, receiver);
3333
+ const descriptor = target[DESCRIPTORS][key];
3334
+ if (!descriptor || !descriptor.set) return Reflect.set(target, key, value, receiver);
3335
+ const oldValue = descriptor.get?.call(target) ?? void 0;
3336
+ if (areEqual_default(value, oldValue)) return true;
3337
+ unrelateValueFrom_default(target, oldValue);
3338
+ if (Array.isArray(value) && !value[PROXY]) value = new Proxy(value, arrayProxy_default);
3339
+ descriptor.set.call(target, value);
3340
+ relateValueTo_default(target, key, value);
3341
+ markDtoDirty(target, key);
3342
+ triggerDto(target, key, value, oldValue);
3343
+ return true;
3344
+ }
3345
+ };
3346
+ var refProxy_default = {
3347
+ /**
3348
+ * Trap for when a ref property is being accessed. The property
3349
+ * access is being tracked for further updates. If the requested
3350
+ * property is not a part of {Ref}, the get is proxied to the
3351
+ * underlying dto instance.
3352
+ *
3353
+ * A little trick with __v_isRef is done here, all the features
3354
+ * of refs are used by our dto, but we don't want Vue to treat
3355
+ * it as a ref. We return false here to trick Vue.
3356
+ */
3357
+ get(target, key, receiver) {
3358
+ if (key === "__v_isRef") return false;
3359
+ if (key === PROXY) return true;
3360
+ if (key in target) return Reflect.get(target, key, receiver);
3361
+ return Reflect.get(target.value, key);
3362
+ },
3363
+ /**
3364
+ * Trap for when a descriptor of a property is requested, that
3365
+ * request is proxied to the underlying dto.
3366
+ */
3367
+ getOwnPropertyDescriptor(target, key) {
3368
+ return Reflect.getOwnPropertyDescriptor(target.value, key);
3369
+ },
3370
+ /**
3371
+ * Trap for when the keys of the ref are requested, that request
3372
+ * is proxied to the underlying dto.
3373
+ */
3374
+ ownKeys(target) {
3375
+ return Reflect.ownKeys(target.value);
3376
+ },
3377
+ /**
3378
+ * Trap for when a ref property is being updated. If the property
3379
+ * is not part of {Ref}, the set is proxied to the underlying dto
3380
+ * instance. In that proxy, the dto will be marked dirty and an
3381
+ * update is triggered.
3382
+ */
3383
+ set(target, key, value, receiver) {
3384
+ if (key in target) return Reflect.set(target, key, value, receiver);
3385
+ return Reflect.set(target.value, key, value);
3386
+ }
3387
+ };
3388
+ var classProxy_default = {
3389
+ /**
3390
+ * Trap for when a dto is being constructed. Reactivity is provided
3391
+ * to all arguments and a proxied custom ref is returned that references
3392
+ * the actual dto instance.
3393
+ */
3394
+ construct(target, argsArray, newTarget) {
3395
+ argsArray = argsArray.map((arg) => {
3396
+ if (!Array.isArray(arg)) return arg;
3397
+ return new Proxy(arg, arrayProxy_default);
3398
+ });
3399
+ const ref = customRef((track, trigger) => {
3400
+ const instance = markRaw(Reflect.construct(target, argsArray, newTarget));
3401
+ instance[ARGS] = argsArray;
3402
+ instance[DIRTY] = false;
3403
+ instance[TRACK] = track;
3404
+ instance[TRIGGER] = trigger;
3405
+ const proxied = new Proxy(instance, instanceProxy_default);
3244
3406
  return {
3245
- get: () => (r(), s),
3407
+ get: () => {
3408
+ track();
3409
+ return proxied;
3410
+ },
3246
3411
  set: () => void 0
3247
3412
  };
3248
3413
  });
3249
- return new Proxy(r, fe);
3414
+ return new Proxy(ref, refProxy_default);
3250
3415
  } };
3251
- function me() {
3252
- let e = this;
3253
- y(e);
3254
- let t = O[e[p]], n = new t(...e[l]);
3255
- for (let [e, t] of Object.entries(this[d])) t.set && (n[e] = v(this[e]) ? this[e].clone() : this[e]);
3256
- return n;
3257
- }
3258
- function he(e) {
3259
- for (let t in e) {
3260
- let n = this[d][t];
3261
- v(this[t]) && typeof e[t] == `object` ? this[t].fill(e[t]) : n && n.set && (this[t] = e[t]);
3262
- }
3263
- }
3264
- function ge$1() {
3265
- let e = {};
3266
- for (let t of this[g]) {
3267
- let n = this[t];
3268
- v(n) && (n = n.toJSON()), e[t] = n;
3269
- }
3270
- return e;
3271
- }
3272
- function j$1(e) {
3273
- ve(e);
3274
- let t = Object.freeze(x$1(e)), a = Object.keys(t);
3275
- return K$1(e.prototype, d, t), K$1(e.prototype, p, e.name), K$1(e.prototype, g, a), K$1(e, Symbol.hasInstance, (t) => typeof t == `object` && t?.[p] === e.name), G$1(e, `clone`, me), G$1(e, `fill`, he), G$1(e, `toJSON`, ge$1), _e$1(e);
3276
- }
3277
- function _e$1(e) {
3278
- let t = new Proxy(e, pe);
3279
- return O[e.name] = t, t;
3280
- }
3281
- function ve(e) {
3282
- let t = Object.getPrototypeOf(e.prototype);
3283
- if (p in t) throw Error(`⛔️ @dto ${e.name} cannot extend parent class which is also decorated with @dto ${t[p]}.`);
3284
- }
3285
- function B(e, t, n, r) {
3286
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
3287
- if (typeof Reflect == `object` && typeof Reflect.decorate == `function`) a = Reflect.decorate(e, t, n, r);
3288
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
3289
- return i > 3 && a && Object.defineProperty(t, n, a), a;
3290
- }
3291
- var V = class {
3416
+ /**
3417
+ * Returns a clone of the dto.
3418
+ */
3419
+ function clone_default() {
3420
+ const instance = this;
3421
+ assertDto_default(instance);
3422
+ const clazz = DTO_CLASS_MAP[instance[NAME]];
3423
+ const clone = new clazz(...instance[ARGS]);
3424
+ for (const [key, descriptor] of Object.entries(this[DESCRIPTORS])) {
3425
+ if (!descriptor.set) continue;
3426
+ clone[key] = isDto_default(this[key]) ? this[key].clone() : this[key];
3427
+ }
3428
+ return clone;
3429
+ }
3430
+ /**
3431
+ * Fills the dto with the given data.
3432
+ */
3433
+ function fill_default(data) {
3434
+ for (let key in data) {
3435
+ const descriptor = this[DESCRIPTORS][key];
3436
+ if (isDto_default(this[key]) && typeof data[key] === "object") this[key].fill(data[key]);
3437
+ else if (descriptor && descriptor.set) this[key] = data[key];
3438
+ }
3439
+ }
3440
+ /**
3441
+ * Returns the json object representation of the dto.
3442
+ */
3443
+ function toJSON_default() {
3444
+ const result = {};
3445
+ for (const property of this[PROPERTIES]) {
3446
+ let value = this[property];
3447
+ if (isDto_default(value)) value = value.toJSON();
3448
+ result[property] = value;
3449
+ }
3450
+ return result;
3451
+ }
3452
+ /**
3453
+ * Provides reactivity to the decorated class.
3454
+ */
3455
+ function dto_default(clazz) {
3456
+ validate(clazz);
3457
+ const descriptors = Object.freeze(x(clazz));
3458
+ const properties = Object.keys(descriptors);
3459
+ K(clazz.prototype, DESCRIPTORS, descriptors);
3460
+ K(clazz.prototype, NAME, clazz.name);
3461
+ K(clazz.prototype, PROPERTIES, properties);
3462
+ K(clazz, Symbol.hasInstance, (instance) => typeof instance === "object" && instance?.[NAME] === clazz.name);
3463
+ G(clazz, "clone", clone_default);
3464
+ G(clazz, "fill", fill_default);
3465
+ G(clazz, "toJSON", toJSON_default);
3466
+ return proxy(clazz);
3467
+ }
3468
+ function proxy(clazz) {
3469
+ const proxied = new Proxy(clazz, classProxy_default);
3470
+ DTO_CLASS_MAP[clazz.name] = proxied;
3471
+ return proxied;
3472
+ }
3473
+ function validate(clazz) {
3474
+ const parent = Object.getPrototypeOf(clazz.prototype);
3475
+ if (NAME in parent) throw new Error(`⛔️ @dto ${clazz.name} cannot extend parent class which is also decorated with @dto ${parent[NAME]}.`);
3476
+ }
3477
+ function __decorate(decorators, target, key, desc) {
3478
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3479
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3480
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3481
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3482
+ }
3483
+ var BlobResponse = class BlobResponse {
3292
3484
  get blob() {
3293
- return this.#e;
3485
+ return this.#blob;
3294
3486
  }
3295
3487
  get name() {
3296
- return this.#t;
3488
+ return this.#name;
3297
3489
  }
3298
- #e;
3299
- #t;
3300
- constructor(e, t) {
3301
- this.#e = e, this.#t = t;
3490
+ #blob;
3491
+ #name;
3492
+ constructor(blob, name) {
3493
+ this.#blob = blob;
3494
+ this.#name = name;
3302
3495
  }
3303
3496
  };
3304
- V = B([j$1], V);
3305
- var U = class {
3497
+ BlobResponse = __decorate([dto_default], BlobResponse);
3498
+ var Paginated = class Paginated {
3306
3499
  get items() {
3307
- return this.#e;
3500
+ return this.#items;
3308
3501
  }
3309
3502
  get page() {
3310
- return this.#t;
3503
+ return this.#page;
3311
3504
  }
3312
3505
  get pageSize() {
3313
- return this.#n;
3506
+ return this.#pageSize;
3314
3507
  }
3315
3508
  get pages() {
3316
- return this.#r;
3509
+ return this.#pages;
3317
3510
  }
3318
3511
  get total() {
3319
- return this.#i;
3320
- }
3321
- #e;
3322
- #t;
3323
- #n;
3324
- #r;
3325
- #i;
3326
- constructor(e, t, n, r, i) {
3327
- this.#e = e, this.#t = t, this.#n = n, this.#r = r, this.#i = i;
3328
- }
3329
- };
3330
- U = B([j$1], U);
3331
- var W = U;
3332
- var G = class {
3512
+ return this.#total;
3513
+ }
3514
+ #items;
3515
+ #page;
3516
+ #pageSize;
3517
+ #pages;
3518
+ #total;
3519
+ constructor(items, page, pageSize, pages, total) {
3520
+ this.#items = items;
3521
+ this.#page = page;
3522
+ this.#pageSize = pageSize;
3523
+ this.#pages = pages;
3524
+ this.#total = total;
3525
+ }
3526
+ };
3527
+ Paginated = __decorate([dto_default], Paginated);
3528
+ var Paginated_default = Paginated;
3529
+ var RequestError = class RequestError {
3333
3530
  get code() {
3334
- return this.#e;
3531
+ return this.#code;
3335
3532
  }
3336
3533
  get error() {
3337
- return this.#t;
3534
+ return this.#error;
3338
3535
  }
3339
3536
  get errorDescription() {
3340
- return this.#n;
3537
+ return this.#errorDescription;
3341
3538
  }
3342
3539
  get statusCode() {
3343
- return this.#r;
3344
- }
3345
- #e;
3346
- #t;
3347
- #n;
3348
- #r;
3349
- constructor(e, t, n, r) {
3350
- this.#e = e, this.#t = t, this.#n = n, this.#r = r;
3351
- }
3352
- };
3353
- G = B([j$1], G);
3354
- var K = G;
3355
- var q = class {
3540
+ return this.#statusCode;
3541
+ }
3542
+ #code;
3543
+ #error;
3544
+ #errorDescription;
3545
+ #statusCode;
3546
+ constructor(code, error, errorDescription, statusCode) {
3547
+ this.#code = code;
3548
+ this.#error = error;
3549
+ this.#errorDescription = errorDescription;
3550
+ this.#statusCode = statusCode;
3551
+ }
3552
+ };
3553
+ RequestError = __decorate([dto_default], RequestError);
3554
+ var RequestError_default = RequestError;
3555
+ var ValidationError = class ValidationError {
3356
3556
  get code() {
3357
- return this.#e;
3557
+ return this.#code;
3358
3558
  }
3359
3559
  get error() {
3360
- return this.#t;
3560
+ return this.#error;
3361
3561
  }
3362
3562
  get errorDescription() {
3363
- return this.#n;
3563
+ return this.#errorDescription;
3364
3564
  }
3365
3565
  get errors() {
3366
- return this.#r;
3566
+ return this.#errors;
3367
3567
  }
3368
3568
  get params() {
3369
- return this.#i;
3370
- }
3371
- #e;
3372
- #t;
3373
- #n;
3374
- #r;
3375
- #i;
3376
- constructor(e, t, n, r, i) {
3377
- this.#e = e, this.#t = t, this.#n = n, this.#r = r, this.#i = i;
3378
- }
3379
- };
3380
- q = B([j$1], q);
3381
- var J = q, Y;
3382
- var X = Y = class {
3383
- static parsePaginatedAdapter(e, t) {
3384
- return new W(e.items.map(t), e.page, e.page_size, e.pages, e.total);
3385
- }
3386
- static parseFileNameFromContentDispositionHeader(t) {
3387
- let n = `download-${DateTime.now().toFormat(`yyyy-MM-dd HH-mm-ss`)}`;
3388
- if (!t.startsWith(`attachment`)) return n;
3389
- let r = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);
3390
- return (r?.length || 0) < 2 ? n : r[1].replaceAll(`'`, ``).replaceAll(`"`, ``).replaceAll(`/`, `-`).replaceAll(`:`, `-`);
3391
- }
3392
- static parseRequestError(e, t) {
3393
- return new K(e.code, e.error, e.error_description, t);
3394
- }
3395
- static parseValidationError(e) {
3396
- let t;
3397
- return e.errors && (t = {}, Object.entries(e.errors).forEach(([e, n]) => {
3398
- t[e] = Y.parseValidationError(n);
3399
- })), new J(e.code, e.error, e.error_description, t, e.params);
3569
+ return this.#params;
3570
+ }
3571
+ #code;
3572
+ #error;
3573
+ #errorDescription;
3574
+ #errors;
3575
+ #params;
3576
+ constructor(code, error, errorDescription, errors, params) {
3577
+ this.#code = code;
3578
+ this.#error = error;
3579
+ this.#errorDescription = errorDescription;
3580
+ this.#errors = errors;
3581
+ this.#params = params;
3582
+ }
3583
+ };
3584
+ ValidationError = __decorate([dto_default], ValidationError);
3585
+ var ValidationError_default = ValidationError;
3586
+ var _HttpAdapter;
3587
+ var HttpAdapter = _HttpAdapter = class HttpAdapter {
3588
+ static parsePaginatedAdapter(data, adapterMethod) {
3589
+ return new Paginated_default(data.items.map(adapterMethod), data.page, data.page_size, data.pages, data.total);
3590
+ }
3591
+ static parseFileNameFromContentDispositionHeader(header) {
3592
+ const defaultFilename = `download-${DateTime.now().toFormat("yyyy-MM-dd HH-mm-ss")}`;
3593
+ if (!header.startsWith("attachment")) return defaultFilename;
3594
+ const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(header);
3595
+ if ((matches?.length || 0) < 2) return defaultFilename;
3596
+ return matches[1].replaceAll("'", "").replaceAll("\"", "").replaceAll("/", "-").replaceAll(":", "-");
3597
+ }
3598
+ static parseRequestError(data, statusCode) {
3599
+ return new RequestError_default(data.code, data.error, data.error_description, statusCode);
3600
+ }
3601
+ static parseValidationError(data) {
3602
+ let errors;
3603
+ if (data.errors) {
3604
+ errors = {};
3605
+ Object.entries(data.errors).forEach(([key, value]) => {
3606
+ errors[key] = _HttpAdapter.parseValidationError(value);
3607
+ });
3608
+ }
3609
+ return new ValidationError_default(data.code, data.error, data.error_description, errors, data.params);
3400
3610
  }
3401
3611
  };
3402
- X = Y = B([c], X);
3612
+ HttpAdapter = _HttpAdapter = __decorate([adapter_default], HttpAdapter);
3403
3613
  RegExp(`[a-z]`), RegExp(`[A-Z]`), RegExp(`[0-9]`), RegExp(`[!"#$%&'()*+,-./:;<=>?@[\\\\\\]^_\`{|}~]`);
3404
3614
  //#endregion
3405
3615
  //#region ../internals/dist/composable-5ooZTjm_.js