@brighterly/lib-core-functions 1.2.4
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/README.md +55 -0
- package/dist/index.js +728 -0
- package/dist/src/helpers/array.d.ts +5 -0
- package/dist/src/helpers/axios.d.ts +6 -0
- package/dist/src/helpers/bytes.d.ts +1 -0
- package/dist/src/helpers/date.d.ts +14 -0
- package/dist/src/helpers/diff-between-dates.d.ts +5 -0
- package/dist/src/helpers/index.d.ts +13 -0
- package/dist/src/helpers/number.d.ts +1 -0
- package/dist/src/helpers/object.d.ts +6 -0
- package/dist/src/helpers/price.d.ts +10 -0
- package/dist/src/helpers/query.d.ts +2 -0
- package/dist/src/helpers/resolve-url.d.ts +1 -0
- package/dist/src/helpers/storage.d.ts +2 -0
- package/dist/src/helpers/string.d.ts +2 -0
- package/dist/src/helpers/viewport.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @brighterly/lib-core-functions
|
|
2
|
+
|
|
3
|
+
Front-end core functions — helpers, utils, composables.
|
|
4
|
+
|
|
5
|
+
## Publishing New Versions
|
|
6
|
+
|
|
7
|
+
This project uses GitHub Actions for automatic deployment to NPM. To release a new version, follow these steps:
|
|
8
|
+
|
|
9
|
+
1. **Bump the version**
|
|
10
|
+
Use one of the following commands to update `package.json` and create a git tag:
|
|
11
|
+
```bash
|
|
12
|
+
pnpm version patch # 1.0.0 -> 1.0.1 (bug fixes)
|
|
13
|
+
pnpm version minor # 1.0.0 -> 1.1.0 (new features)
|
|
14
|
+
pnpm version major # 1.0.0 -> 2.0.0 (breaking changes)
|
|
15
|
+
```
|
|
16
|
+
2. Push repo to github:
|
|
17
|
+
```bash
|
|
18
|
+
git push
|
|
19
|
+
```
|
|
20
|
+
3. NPM release will be created automatically
|
|
21
|
+
|
|
22
|
+
## Git Hooks
|
|
23
|
+
|
|
24
|
+
### Pre-commit hook
|
|
25
|
+
|
|
26
|
+
Runs `pnpm lint`, `pnpm typecheck` and `pnpm test` on staged `.ts` / `.vue` files.
|
|
27
|
+
|
|
28
|
+
Prepare:
|
|
29
|
+
```shell
|
|
30
|
+
chmod +x _tools/git/pre-commit
|
|
31
|
+
ln -s ../../_tools/git/pre-commit .git/hooks/pre-commit
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Pre-push hook
|
|
35
|
+
|
|
36
|
+
Validates that a release tag (`v*`) matches the version in `package.json` before pushing.
|
|
37
|
+
|
|
38
|
+
Prepare:
|
|
39
|
+
```shell
|
|
40
|
+
chmod +x _tools/git/pre-push
|
|
41
|
+
ln -s ../../_tools/git/pre-push .git/hooks/pre-push
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Dependencies
|
|
45
|
+
|
|
46
|
+
Install deps:
|
|
47
|
+
```bash
|
|
48
|
+
pnpm install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## First time
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
pnpm publish --no-git-checks --access public --registry=https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
|
|
55
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
|
+
get: ((e) => i[e]).bind(null, d),
|
|
5
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
6
|
+
});
|
|
7
|
+
return e;
|
|
8
|
+
}, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
|
|
9
|
+
value: n,
|
|
10
|
+
enumerable: !0
|
|
11
|
+
}) : a, n)), l = (e) => Array.isArray(e) && e.length > 0, u = (e, t, n) => {
|
|
12
|
+
let r = e.concat(t);
|
|
13
|
+
return {
|
|
14
|
+
accepted: r.slice(0, n),
|
|
15
|
+
rejected: r.slice(n)
|
|
16
|
+
};
|
|
17
|
+
}, d = (e) => e.response?.data?.message || e?.message || "Unexpected error", f = (e) => {
|
|
18
|
+
let t = 1024, n = t * 1024, r = Math.abs(e), i = e < 0 ? "-" : "";
|
|
19
|
+
return r < t ? `${i}${r} B` : r < n ? `${i}${(r / t).toFixed(2)} KiB` : `${i}${(r / n).toFixed(2)} MiB`;
|
|
20
|
+
}, p;
|
|
21
|
+
(function(e) {
|
|
22
|
+
e.Default = "YYYY-MM-DD HH:mm:ss", e.DefaultDate = "YYYY-MM-DD", e.DefaultTime = "HH:mm", e.BookedDate = "ddd, DD MMM", e.BookedTime = "hh:mm A", e.BookedSlot = "ddd, DD", e.BookedDateSelect = "ddd, MMMM DD", e.BookedFullDate = "dddd, MMM DD h:mm A", e.AmPm = "h:mm A", e.ExtendedTime = "HH:mm:ss", e.SlotTime = "hA", e.FileDate = "MMM DD, YYYY", e.DateCalendar = "ddd D MMM, h:mm A", e.SummaryDate = "ddd, DD MMM h A", e.KanbanDate = "MMM DD, YYYY HH:mm", e.MainDate = "MMM DD, HH:mm";
|
|
23
|
+
})(p ||= {});
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js
|
|
26
|
+
var m = /* @__PURE__ */ o(((e, t) => {
|
|
27
|
+
(function(n, r) {
|
|
28
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
|
|
29
|
+
})(e, (function() {
|
|
30
|
+
var e = 1e3, t = 6e4, n = 36e5, r = "millisecond", i = "second", a = "minute", o = "hour", s = "day", c = "week", l = "month", u = "quarter", d = "year", f = "date", p = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, h = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, g = {
|
|
31
|
+
name: "en",
|
|
32
|
+
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
|
33
|
+
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
|
34
|
+
ordinal: function(e) {
|
|
35
|
+
var t = [
|
|
36
|
+
"th",
|
|
37
|
+
"st",
|
|
38
|
+
"nd",
|
|
39
|
+
"rd"
|
|
40
|
+
], n = e % 100;
|
|
41
|
+
return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
|
|
42
|
+
}
|
|
43
|
+
}, _ = function(e, t, n) {
|
|
44
|
+
var r = String(e);
|
|
45
|
+
return !r || r.length >= t ? e : "" + Array(t + 1 - r.length).join(n) + e;
|
|
46
|
+
}, v = {
|
|
47
|
+
s: _,
|
|
48
|
+
z: function(e) {
|
|
49
|
+
var t = -e.utcOffset(), n = Math.abs(t), r = Math.floor(n / 60), i = n % 60;
|
|
50
|
+
return (t <= 0 ? "+" : "-") + _(r, 2, "0") + ":" + _(i, 2, "0");
|
|
51
|
+
},
|
|
52
|
+
m: function e(t, n) {
|
|
53
|
+
if (t.date() < n.date()) return -e(n, t);
|
|
54
|
+
var r = 12 * (n.year() - t.year()) + (n.month() - t.month()), i = t.clone().add(r, l), a = n - i < 0, o = t.clone().add(r + (a ? -1 : 1), l);
|
|
55
|
+
return +(-(r + (n - i) / (a ? i - o : o - i)) || 0);
|
|
56
|
+
},
|
|
57
|
+
a: function(e) {
|
|
58
|
+
return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
|
|
59
|
+
},
|
|
60
|
+
p: function(e) {
|
|
61
|
+
return {
|
|
62
|
+
M: l,
|
|
63
|
+
y: d,
|
|
64
|
+
w: c,
|
|
65
|
+
d: s,
|
|
66
|
+
D: f,
|
|
67
|
+
h: o,
|
|
68
|
+
m: a,
|
|
69
|
+
s: i,
|
|
70
|
+
ms: r,
|
|
71
|
+
Q: u
|
|
72
|
+
}[e] || String(e || "").toLowerCase().replace(/s$/, "");
|
|
73
|
+
},
|
|
74
|
+
u: function(e) {
|
|
75
|
+
return e === void 0;
|
|
76
|
+
}
|
|
77
|
+
}, y = "en", b = {};
|
|
78
|
+
b[y] = g;
|
|
79
|
+
var x = "$isDayjsObject", S = function(e) {
|
|
80
|
+
return e instanceof E || !(!e || !e[x]);
|
|
81
|
+
}, C = function e(t, n, r) {
|
|
82
|
+
var i;
|
|
83
|
+
if (!t) return y;
|
|
84
|
+
if (typeof t == "string") {
|
|
85
|
+
var a = t.toLowerCase();
|
|
86
|
+
b[a] && (i = a), n && (b[a] = n, i = a);
|
|
87
|
+
var o = t.split("-");
|
|
88
|
+
if (!i && o.length > 1) return e(o[0]);
|
|
89
|
+
} else {
|
|
90
|
+
var s = t.name;
|
|
91
|
+
b[s] = t, i = s;
|
|
92
|
+
}
|
|
93
|
+
return !r && i && (y = i), i || !r && y;
|
|
94
|
+
}, w = function(e, t) {
|
|
95
|
+
if (S(e)) return e.clone();
|
|
96
|
+
var n = typeof t == "object" ? t : {};
|
|
97
|
+
return n.date = e, n.args = arguments, new E(n);
|
|
98
|
+
}, T = v;
|
|
99
|
+
T.l = C, T.i = S, T.w = function(e, t) {
|
|
100
|
+
return w(e, {
|
|
101
|
+
locale: t.$L,
|
|
102
|
+
utc: t.$u,
|
|
103
|
+
x: t.$x,
|
|
104
|
+
$offset: t.$offset
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
var E = function() {
|
|
108
|
+
function g(e) {
|
|
109
|
+
this.$L = C(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[x] = !0;
|
|
110
|
+
}
|
|
111
|
+
var _ = g.prototype;
|
|
112
|
+
return _.parse = function(e) {
|
|
113
|
+
this.$d = function(e) {
|
|
114
|
+
var t = e.date, n = e.utc;
|
|
115
|
+
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
116
|
+
if (T.u(t)) return /* @__PURE__ */ new Date();
|
|
117
|
+
if (t instanceof Date) return new Date(t);
|
|
118
|
+
if (typeof t == "string" && !/Z$/i.test(t)) {
|
|
119
|
+
var r = t.match(m);
|
|
120
|
+
if (r) {
|
|
121
|
+
var i = r[2] - 1 || 0, a = (r[7] || "0").substring(0, 3);
|
|
122
|
+
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return new Date(t);
|
|
126
|
+
}(e), this.init();
|
|
127
|
+
}, _.init = function() {
|
|
128
|
+
var e = this.$d;
|
|
129
|
+
this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
|
|
130
|
+
}, _.$utils = function() {
|
|
131
|
+
return T;
|
|
132
|
+
}, _.isValid = function() {
|
|
133
|
+
return this.$d.toString() !== p;
|
|
134
|
+
}, _.isSame = function(e, t) {
|
|
135
|
+
var n = w(e);
|
|
136
|
+
return this.startOf(t) <= n && n <= this.endOf(t);
|
|
137
|
+
}, _.isAfter = function(e, t) {
|
|
138
|
+
return w(e) < this.startOf(t);
|
|
139
|
+
}, _.isBefore = function(e, t) {
|
|
140
|
+
return this.endOf(t) < w(e);
|
|
141
|
+
}, _.$g = function(e, t, n) {
|
|
142
|
+
return T.u(e) ? this[t] : this.set(n, e);
|
|
143
|
+
}, _.unix = function() {
|
|
144
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
145
|
+
}, _.valueOf = function() {
|
|
146
|
+
return this.$d.getTime();
|
|
147
|
+
}, _.startOf = function(e, t) {
|
|
148
|
+
var n = this, r = !!T.u(t) || t, u = T.p(e), p = function(e, t) {
|
|
149
|
+
var i = T.w(n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e), n);
|
|
150
|
+
return r ? i : i.endOf(s);
|
|
151
|
+
}, m = function(e, t) {
|
|
152
|
+
return T.w(n.toDate()[e].apply(n.toDate("s"), (r ? [
|
|
153
|
+
0,
|
|
154
|
+
0,
|
|
155
|
+
0,
|
|
156
|
+
0
|
|
157
|
+
] : [
|
|
158
|
+
23,
|
|
159
|
+
59,
|
|
160
|
+
59,
|
|
161
|
+
999
|
|
162
|
+
]).slice(t)), n);
|
|
163
|
+
}, h = this.$W, g = this.$M, _ = this.$D, v = "set" + (this.$u ? "UTC" : "");
|
|
164
|
+
switch (u) {
|
|
165
|
+
case d: return r ? p(1, 0) : p(31, 11);
|
|
166
|
+
case l: return r ? p(1, g) : p(0, g + 1);
|
|
167
|
+
case c:
|
|
168
|
+
var y = this.$locale().weekStart || 0, b = (h < y ? h + 7 : h) - y;
|
|
169
|
+
return p(r ? _ - b : _ + (6 - b), g);
|
|
170
|
+
case s:
|
|
171
|
+
case f: return m(v + "Hours", 0);
|
|
172
|
+
case o: return m(v + "Minutes", 1);
|
|
173
|
+
case a: return m(v + "Seconds", 2);
|
|
174
|
+
case i: return m(v + "Milliseconds", 3);
|
|
175
|
+
default: return this.clone();
|
|
176
|
+
}
|
|
177
|
+
}, _.endOf = function(e) {
|
|
178
|
+
return this.startOf(e, !1);
|
|
179
|
+
}, _.$set = function(e, t) {
|
|
180
|
+
var n, c = T.p(e), u = "set" + (this.$u ? "UTC" : ""), p = (n = {}, n[s] = u + "Date", n[f] = u + "Date", n[l] = u + "Month", n[d] = u + "FullYear", n[o] = u + "Hours", n[a] = u + "Minutes", n[i] = u + "Seconds", n[r] = u + "Milliseconds", n)[c], m = c === s ? this.$D + (t - this.$W) : t;
|
|
181
|
+
if (c === l || c === d) {
|
|
182
|
+
var h = this.clone().set(f, 1);
|
|
183
|
+
h.$d[p](m), h.init(), this.$d = h.set(f, Math.min(this.$D, h.daysInMonth())).$d;
|
|
184
|
+
} else p && this.$d[p](m);
|
|
185
|
+
return this.init(), this;
|
|
186
|
+
}, _.set = function(e, t) {
|
|
187
|
+
return this.clone().$set(e, t);
|
|
188
|
+
}, _.get = function(e) {
|
|
189
|
+
return this[T.p(e)]();
|
|
190
|
+
}, _.add = function(r, u) {
|
|
191
|
+
var f, p = this;
|
|
192
|
+
r = Number(r);
|
|
193
|
+
var m = T.p(u), h = function(e) {
|
|
194
|
+
var t = w(p);
|
|
195
|
+
return T.w(t.date(t.date() + Math.round(e * r)), p);
|
|
196
|
+
};
|
|
197
|
+
if (m === l) return this.set(l, this.$M + r);
|
|
198
|
+
if (m === d) return this.set(d, this.$y + r);
|
|
199
|
+
if (m === s) return h(1);
|
|
200
|
+
if (m === c) return h(7);
|
|
201
|
+
var g = (f = {}, f[a] = t, f[o] = n, f[i] = e, f)[m] || 1, _ = this.$d.getTime() + r * g;
|
|
202
|
+
return T.w(_, this);
|
|
203
|
+
}, _.subtract = function(e, t) {
|
|
204
|
+
return this.add(-1 * e, t);
|
|
205
|
+
}, _.format = function(e) {
|
|
206
|
+
var t = this, n = this.$locale();
|
|
207
|
+
if (!this.isValid()) return n.invalidDate || p;
|
|
208
|
+
var r = e || "YYYY-MM-DDTHH:mm:ssZ", i = T.z(this), a = this.$H, o = this.$m, s = this.$M, c = n.weekdays, l = n.months, u = n.meridiem, d = function(e, n, i, a) {
|
|
209
|
+
return e && (e[n] || e(t, r)) || i[n].slice(0, a);
|
|
210
|
+
}, f = function(e) {
|
|
211
|
+
return T.s(a % 12 || 12, e, "0");
|
|
212
|
+
}, m = u || function(e, t, n) {
|
|
213
|
+
var r = e < 12 ? "AM" : "PM";
|
|
214
|
+
return n ? r.toLowerCase() : r;
|
|
215
|
+
};
|
|
216
|
+
return r.replace(h, (function(e, r) {
|
|
217
|
+
return r || function(e) {
|
|
218
|
+
switch (e) {
|
|
219
|
+
case "YY": return String(t.$y).slice(-2);
|
|
220
|
+
case "YYYY": return T.s(t.$y, 4, "0");
|
|
221
|
+
case "M": return s + 1;
|
|
222
|
+
case "MM": return T.s(s + 1, 2, "0");
|
|
223
|
+
case "MMM": return d(n.monthsShort, s, l, 3);
|
|
224
|
+
case "MMMM": return d(l, s);
|
|
225
|
+
case "D": return t.$D;
|
|
226
|
+
case "DD": return T.s(t.$D, 2, "0");
|
|
227
|
+
case "d": return String(t.$W);
|
|
228
|
+
case "dd": return d(n.weekdaysMin, t.$W, c, 2);
|
|
229
|
+
case "ddd": return d(n.weekdaysShort, t.$W, c, 3);
|
|
230
|
+
case "dddd": return c[t.$W];
|
|
231
|
+
case "H": return String(a);
|
|
232
|
+
case "HH": return T.s(a, 2, "0");
|
|
233
|
+
case "h": return f(1);
|
|
234
|
+
case "hh": return f(2);
|
|
235
|
+
case "a": return m(a, o, !0);
|
|
236
|
+
case "A": return m(a, o, !1);
|
|
237
|
+
case "m": return String(o);
|
|
238
|
+
case "mm": return T.s(o, 2, "0");
|
|
239
|
+
case "s": return String(t.$s);
|
|
240
|
+
case "ss": return T.s(t.$s, 2, "0");
|
|
241
|
+
case "SSS": return T.s(t.$ms, 3, "0");
|
|
242
|
+
case "Z": return i;
|
|
243
|
+
}
|
|
244
|
+
return null;
|
|
245
|
+
}(e) || i.replace(":", "");
|
|
246
|
+
}));
|
|
247
|
+
}, _.utcOffset = function() {
|
|
248
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
249
|
+
}, _.diff = function(r, f, p) {
|
|
250
|
+
var m, h = this, g = T.p(f), _ = w(r), v = (_.utcOffset() - this.utcOffset()) * t, y = this - _, b = function() {
|
|
251
|
+
return T.m(h, _);
|
|
252
|
+
};
|
|
253
|
+
switch (g) {
|
|
254
|
+
case d:
|
|
255
|
+
m = b() / 12;
|
|
256
|
+
break;
|
|
257
|
+
case l:
|
|
258
|
+
m = b();
|
|
259
|
+
break;
|
|
260
|
+
case u:
|
|
261
|
+
m = b() / 3;
|
|
262
|
+
break;
|
|
263
|
+
case c:
|
|
264
|
+
m = (y - v) / 6048e5;
|
|
265
|
+
break;
|
|
266
|
+
case s:
|
|
267
|
+
m = (y - v) / 864e5;
|
|
268
|
+
break;
|
|
269
|
+
case o:
|
|
270
|
+
m = y / n;
|
|
271
|
+
break;
|
|
272
|
+
case a:
|
|
273
|
+
m = y / t;
|
|
274
|
+
break;
|
|
275
|
+
case i:
|
|
276
|
+
m = y / e;
|
|
277
|
+
break;
|
|
278
|
+
default: m = y;
|
|
279
|
+
}
|
|
280
|
+
return p ? m : T.a(m);
|
|
281
|
+
}, _.daysInMonth = function() {
|
|
282
|
+
return this.endOf(l).$D;
|
|
283
|
+
}, _.$locale = function() {
|
|
284
|
+
return b[this.$L];
|
|
285
|
+
}, _.locale = function(e, t) {
|
|
286
|
+
if (!e) return this.$L;
|
|
287
|
+
var n = this.clone(), r = C(e, t, !0);
|
|
288
|
+
return r && (n.$L = r), n;
|
|
289
|
+
}, _.clone = function() {
|
|
290
|
+
return T.w(this.$d, this);
|
|
291
|
+
}, _.toDate = function() {
|
|
292
|
+
return new Date(this.valueOf());
|
|
293
|
+
}, _.toJSON = function() {
|
|
294
|
+
return this.isValid() ? this.toISOString() : null;
|
|
295
|
+
}, _.toISOString = function() {
|
|
296
|
+
return this.$d.toISOString();
|
|
297
|
+
}, _.toString = function() {
|
|
298
|
+
return this.$d.toUTCString();
|
|
299
|
+
}, g;
|
|
300
|
+
}(), D = E.prototype;
|
|
301
|
+
return w.prototype = D, [
|
|
302
|
+
["$ms", r],
|
|
303
|
+
["$s", i],
|
|
304
|
+
["$m", a],
|
|
305
|
+
["$H", o],
|
|
306
|
+
["$W", s],
|
|
307
|
+
["$M", l],
|
|
308
|
+
["$y", d],
|
|
309
|
+
["$D", f]
|
|
310
|
+
].forEach((function(e) {
|
|
311
|
+
D[e[1]] = function(t) {
|
|
312
|
+
return this.$g(t, e[0], e[1]);
|
|
313
|
+
};
|
|
314
|
+
})), w.extend = function(e, t) {
|
|
315
|
+
return e.$i ||= (e(t, E, w), !0), w;
|
|
316
|
+
}, w.locale = C, w.isDayjs = S, w.unix = function(e) {
|
|
317
|
+
return w(1e3 * e);
|
|
318
|
+
}, w.en = b[y], w.Ls = b, w.p = {}, w;
|
|
319
|
+
}));
|
|
320
|
+
})), h = /* @__PURE__ */ o(((e, t) => {
|
|
321
|
+
(function(n, r) {
|
|
322
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_utc = r();
|
|
323
|
+
})(e, (function() {
|
|
324
|
+
var e = "minute", t = /[+-]\d\d(?::?\d\d)?/g, n = /([+-]|\d\d)/g;
|
|
325
|
+
return function(r, i, a) {
|
|
326
|
+
var o = i.prototype;
|
|
327
|
+
a.utc = function(e) {
|
|
328
|
+
return new i({
|
|
329
|
+
date: e,
|
|
330
|
+
utc: !0,
|
|
331
|
+
args: arguments
|
|
332
|
+
});
|
|
333
|
+
}, o.utc = function(t) {
|
|
334
|
+
var n = a(this.toDate(), {
|
|
335
|
+
locale: this.$L,
|
|
336
|
+
utc: !0
|
|
337
|
+
});
|
|
338
|
+
return t ? n.add(this.utcOffset(), e) : n;
|
|
339
|
+
}, o.local = function() {
|
|
340
|
+
return a(this.toDate(), {
|
|
341
|
+
locale: this.$L,
|
|
342
|
+
utc: !1
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
var s = o.parse;
|
|
346
|
+
o.parse = function(e) {
|
|
347
|
+
e.utc && (this.$u = !0), this.$utils().u(e.$offset) || (this.$offset = e.$offset), s.call(this, e);
|
|
348
|
+
};
|
|
349
|
+
var c = o.init;
|
|
350
|
+
o.init = function() {
|
|
351
|
+
if (this.$u) {
|
|
352
|
+
var e = this.$d;
|
|
353
|
+
this.$y = e.getUTCFullYear(), this.$M = e.getUTCMonth(), this.$D = e.getUTCDate(), this.$W = e.getUTCDay(), this.$H = e.getUTCHours(), this.$m = e.getUTCMinutes(), this.$s = e.getUTCSeconds(), this.$ms = e.getUTCMilliseconds();
|
|
354
|
+
} else c.call(this);
|
|
355
|
+
};
|
|
356
|
+
var l = o.utcOffset;
|
|
357
|
+
o.utcOffset = function(r, i) {
|
|
358
|
+
var a = this.$utils().u;
|
|
359
|
+
if (a(r)) return this.$u ? 0 : a(this.$offset) ? l.call(this) : this.$offset;
|
|
360
|
+
if (typeof r == "string" && (r = function(e) {
|
|
361
|
+
e === void 0 && (e = "");
|
|
362
|
+
var r = e.match(t);
|
|
363
|
+
if (!r) return null;
|
|
364
|
+
var i = ("" + r[0]).match(n) || [
|
|
365
|
+
"-",
|
|
366
|
+
0,
|
|
367
|
+
0
|
|
368
|
+
], a = i[0], o = 60 * i[1] + +i[2];
|
|
369
|
+
return o === 0 ? 0 : a === "+" ? o : -o;
|
|
370
|
+
}(r), r === null)) return this;
|
|
371
|
+
var o = Math.abs(r) <= 16 ? 60 * r : r;
|
|
372
|
+
if (o === 0) return this.utc(i);
|
|
373
|
+
var s = this.clone();
|
|
374
|
+
if (i) return s.$offset = o, s.$u = !1, s;
|
|
375
|
+
var c = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
376
|
+
return (s = this.local().add(o + c, e)).$offset = o, s.$x.$localOffset = c, s;
|
|
377
|
+
};
|
|
378
|
+
var u = o.format;
|
|
379
|
+
o.format = function(e) {
|
|
380
|
+
var t = e || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
381
|
+
return u.call(this, t);
|
|
382
|
+
}, o.valueOf = function() {
|
|
383
|
+
var e = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
384
|
+
return this.$d.valueOf() - 6e4 * e;
|
|
385
|
+
}, o.isUTC = function() {
|
|
386
|
+
return !!this.$u;
|
|
387
|
+
}, o.toISOString = function() {
|
|
388
|
+
return this.toDate().toISOString();
|
|
389
|
+
}, o.toString = function() {
|
|
390
|
+
return this.toDate().toUTCString();
|
|
391
|
+
};
|
|
392
|
+
var d = o.toDate;
|
|
393
|
+
o.toDate = function(e) {
|
|
394
|
+
return e === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : d.call(this);
|
|
395
|
+
};
|
|
396
|
+
var f = o.diff;
|
|
397
|
+
o.diff = function(e, t, n) {
|
|
398
|
+
if (e && this.$u === e.$u) return f.call(this, e, t, n);
|
|
399
|
+
var r = this.local(), i = a(e).local();
|
|
400
|
+
return f.call(r, i, t, n);
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
}));
|
|
404
|
+
})), g = /* @__PURE__ */ o(((e, t) => {
|
|
405
|
+
(function(n, r) {
|
|
406
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_timezone = r();
|
|
407
|
+
})(e, (function() {
|
|
408
|
+
var e = {
|
|
409
|
+
year: 0,
|
|
410
|
+
month: 1,
|
|
411
|
+
day: 2,
|
|
412
|
+
hour: 3,
|
|
413
|
+
minute: 4,
|
|
414
|
+
second: 5
|
|
415
|
+
}, t = {};
|
|
416
|
+
return function(n, r, i) {
|
|
417
|
+
var a, o = function(e, n, r) {
|
|
418
|
+
r === void 0 && (r = {});
|
|
419
|
+
var i = new Date(e);
|
|
420
|
+
return function(e, n) {
|
|
421
|
+
n === void 0 && (n = {});
|
|
422
|
+
var r = n.timeZoneName || "short", i = e + "|" + r, a = t[i];
|
|
423
|
+
return a || (a = new Intl.DateTimeFormat("en-US", {
|
|
424
|
+
hour12: !1,
|
|
425
|
+
timeZone: e,
|
|
426
|
+
year: "numeric",
|
|
427
|
+
month: "2-digit",
|
|
428
|
+
day: "2-digit",
|
|
429
|
+
hour: "2-digit",
|
|
430
|
+
minute: "2-digit",
|
|
431
|
+
second: "2-digit",
|
|
432
|
+
timeZoneName: r
|
|
433
|
+
}), t[i] = a), a;
|
|
434
|
+
}(n, r).formatToParts(i);
|
|
435
|
+
}, s = function(t, n) {
|
|
436
|
+
for (var r = o(t, n), a = [], s = 0; s < r.length; s += 1) {
|
|
437
|
+
var c = r[s], l = c.type, u = c.value, d = e[l];
|
|
438
|
+
d >= 0 && (a[d] = parseInt(u, 10));
|
|
439
|
+
}
|
|
440
|
+
var f = a[3], p = f === 24 ? 0 : f, m = a[0] + "-" + a[1] + "-" + a[2] + " " + p + ":" + a[4] + ":" + a[5] + ":000", h = +t;
|
|
441
|
+
return (i.utc(m).valueOf() - (h -= h % 1e3)) / 6e4;
|
|
442
|
+
}, c = r.prototype;
|
|
443
|
+
c.tz = function(e, t) {
|
|
444
|
+
e === void 0 && (e = a);
|
|
445
|
+
var n, r = this.utcOffset(), o = this.toDate(), s = o.toLocaleString("en-US", { timeZone: e }), c = Math.round((o - new Date(s)) / 1e3 / 60), l = 15 * -Math.round(o.getTimezoneOffset() / 15) - c;
|
|
446
|
+
if (!Number(l)) n = this.utcOffset(0, t);
|
|
447
|
+
else if (n = i(s, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(l, !0), t) {
|
|
448
|
+
var u = n.utcOffset();
|
|
449
|
+
n = n.add(r - u, "minute");
|
|
450
|
+
}
|
|
451
|
+
return n.$x.$timezone = e, n;
|
|
452
|
+
}, c.offsetName = function(e) {
|
|
453
|
+
var t = this.$x.$timezone || i.tz.guess(), n = o(this.valueOf(), t, { timeZoneName: e }).find((function(e) {
|
|
454
|
+
return e.type.toLowerCase() === "timezonename";
|
|
455
|
+
}));
|
|
456
|
+
return n && n.value;
|
|
457
|
+
};
|
|
458
|
+
var l = c.startOf;
|
|
459
|
+
c.startOf = function(e, t) {
|
|
460
|
+
if (!this.$x || !this.$x.$timezone) return l.call(this, e, t);
|
|
461
|
+
var n = i(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
462
|
+
return l.call(n, e, t).tz(this.$x.$timezone, !0);
|
|
463
|
+
}, i.tz = function(e, t, n) {
|
|
464
|
+
var r = n && t, o = n || t || a, c = s(+i(), o);
|
|
465
|
+
if (typeof e != "string") return i(e).tz(o);
|
|
466
|
+
var l = function(e, t, n) {
|
|
467
|
+
var r = e - 60 * t * 1e3, i = s(r, n);
|
|
468
|
+
if (t === i) return [r, t];
|
|
469
|
+
var a = s(r -= 60 * (i - t) * 1e3, n);
|
|
470
|
+
return i === a ? [r, i] : [e - 60 * Math.min(i, a) * 1e3, Math.max(i, a)];
|
|
471
|
+
}(i.utc(e, r).valueOf(), c, o), u = l[0], d = l[1], f = i(u).utcOffset(d);
|
|
472
|
+
return f.$x.$timezone = o, f;
|
|
473
|
+
}, i.tz.guess = function() {
|
|
474
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
475
|
+
}, i.tz.setDefault = function(e) {
|
|
476
|
+
a = e;
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
}));
|
|
480
|
+
})), _ = /* @__PURE__ */ c(m(), 1), v = /* @__PURE__ */ c(h(), 1), y = /* @__PURE__ */ c(g(), 1);
|
|
481
|
+
_.default.extend(v.default), _.default.extend(y.default);
|
|
482
|
+
var b = (e) => {
|
|
483
|
+
if (typeof e == "string") {
|
|
484
|
+
let t = parseInt(e, 10);
|
|
485
|
+
return t = t < 0 ? 0 : t, isNaN(t) ? void 0 : t < 10 ? `0${t}` : `${t}`;
|
|
486
|
+
} else {
|
|
487
|
+
let t = e < 0 ? 0 : e;
|
|
488
|
+
return Number.isInteger(t) || (t = Math.trunc(t)), t < 10 ? `0${t}` : `${t}`;
|
|
489
|
+
}
|
|
490
|
+
}, x = (e, t) => (0, _.default)(e).format(t), S = (e) => x(e, p.DefaultDate), C = (e) => x(e, p.FileDate), w = (e) => x(e, p.BookedDate), T = (e) => x(e, p.BookedTime), E = (e) => x(e, p.BookedSlot), D = (e) => x(e, p.AmPm), O = (e) => x(e, p.SlotTime), k = (e) => x(e, p.BookedFullDate), A = (e) => x(e, p.SummaryDate), j = (e) => {
|
|
491
|
+
let t = Math.floor(e / 3600), n = Math.floor((e - t * 3600) / 60), r = e - t * 3600 - n * 60, i = n.toString().padStart(2, "0"), a = r.toString().padStart(2, "0");
|
|
492
|
+
return t > 0 ? `${t.toString().padStart(2, "0")}:${i}:${a}` : `${i}:${a}`;
|
|
493
|
+
}, M = (e, t) => (0, _.default)(e).isSame((0, _.default)(t), "day"), N = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
494
|
+
(function(n, r) {
|
|
495
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_duration = r();
|
|
496
|
+
})(e, (function() {
|
|
497
|
+
var e, t, n = 1e3, r = 6e4, i = 36e5, a = 864e5, o = 31536e6, s = 2628e6, c = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, l = /\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g, u = {
|
|
498
|
+
years: o,
|
|
499
|
+
months: s,
|
|
500
|
+
days: a,
|
|
501
|
+
hours: i,
|
|
502
|
+
minutes: r,
|
|
503
|
+
seconds: n,
|
|
504
|
+
milliseconds: 1,
|
|
505
|
+
weeks: 6048e5
|
|
506
|
+
}, d = function(e) {
|
|
507
|
+
return e instanceof v;
|
|
508
|
+
}, f = function(e, t, n) {
|
|
509
|
+
return new v(e, n, t.$l);
|
|
510
|
+
}, p = function(e) {
|
|
511
|
+
return t.p(e) + "s";
|
|
512
|
+
}, m = function(e) {
|
|
513
|
+
return e < 0;
|
|
514
|
+
}, h = function(e) {
|
|
515
|
+
return m(e) ? Math.ceil(e) : Math.floor(e);
|
|
516
|
+
}, g = function(e) {
|
|
517
|
+
return Math.abs(e);
|
|
518
|
+
}, _ = function(e, t) {
|
|
519
|
+
return e ? m(e) ? {
|
|
520
|
+
negative: !0,
|
|
521
|
+
format: "" + g(e) + t
|
|
522
|
+
} : {
|
|
523
|
+
negative: !1,
|
|
524
|
+
format: "" + e + t
|
|
525
|
+
} : {
|
|
526
|
+
negative: !1,
|
|
527
|
+
format: ""
|
|
528
|
+
};
|
|
529
|
+
}, v = function() {
|
|
530
|
+
function m(e, t, n) {
|
|
531
|
+
var r = this;
|
|
532
|
+
if (this.$d = {}, this.$l = n, e === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), t) return f(e * u[p(t)], this);
|
|
533
|
+
if (typeof e == "number") return this.$ms = e, this.parseFromMilliseconds(), this;
|
|
534
|
+
if (typeof e == "object") return Object.keys(e).forEach((function(t) {
|
|
535
|
+
r.$d[p(t)] = e[t];
|
|
536
|
+
})), this.calMilliseconds(), this;
|
|
537
|
+
if (typeof e == "string") {
|
|
538
|
+
var i = e.match(c);
|
|
539
|
+
if (i) {
|
|
540
|
+
var a = i.slice(2).map((function(e) {
|
|
541
|
+
return e == null ? 0 : Number(e);
|
|
542
|
+
}));
|
|
543
|
+
return this.$d.years = a[0], this.$d.months = a[1], this.$d.weeks = a[2], this.$d.days = a[3], this.$d.hours = a[4], this.$d.minutes = a[5], this.$d.seconds = a[6], this.calMilliseconds(), this;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
var g = m.prototype;
|
|
549
|
+
return g.calMilliseconds = function() {
|
|
550
|
+
var e = this;
|
|
551
|
+
this.$ms = Object.keys(this.$d).reduce((function(t, n) {
|
|
552
|
+
return t + (e.$d[n] || 0) * u[n];
|
|
553
|
+
}), 0);
|
|
554
|
+
}, g.parseFromMilliseconds = function() {
|
|
555
|
+
var e = this.$ms;
|
|
556
|
+
this.$d.years = h(e / o), e %= o, this.$d.months = h(e / s), e %= s, this.$d.days = h(e / a), e %= a, this.$d.hours = h(e / i), e %= i, this.$d.minutes = h(e / r), e %= r, this.$d.seconds = h(e / n), e %= n, this.$d.milliseconds = e;
|
|
557
|
+
}, g.toISOString = function() {
|
|
558
|
+
var e = _(this.$d.years, "Y"), t = _(this.$d.months, "M"), n = +this.$d.days || 0;
|
|
559
|
+
this.$d.weeks && (n += 7 * this.$d.weeks);
|
|
560
|
+
var r = _(n, "D"), i = _(this.$d.hours, "H"), a = _(this.$d.minutes, "M"), o = this.$d.seconds || 0;
|
|
561
|
+
this.$d.milliseconds && (o += this.$d.milliseconds / 1e3, o = Math.round(1e3 * o) / 1e3);
|
|
562
|
+
var s = _(o, "S"), c = e.negative || t.negative || r.negative || i.negative || a.negative || s.negative, l = i.format || a.format || s.format ? "T" : "", u = (c ? "-" : "") + "P" + e.format + t.format + r.format + l + i.format + a.format + s.format;
|
|
563
|
+
return u === "P" || u === "-P" ? "P0D" : u;
|
|
564
|
+
}, g.toJSON = function() {
|
|
565
|
+
return this.toISOString();
|
|
566
|
+
}, g.format = function(e) {
|
|
567
|
+
var n = e || "YYYY-MM-DDTHH:mm:ss", r = {
|
|
568
|
+
Y: this.$d.years,
|
|
569
|
+
YY: t.s(this.$d.years, 2, "0"),
|
|
570
|
+
YYYY: t.s(this.$d.years, 4, "0"),
|
|
571
|
+
M: this.$d.months,
|
|
572
|
+
MM: t.s(this.$d.months, 2, "0"),
|
|
573
|
+
D: this.$d.days,
|
|
574
|
+
DD: t.s(this.$d.days, 2, "0"),
|
|
575
|
+
H: this.$d.hours,
|
|
576
|
+
HH: t.s(this.$d.hours, 2, "0"),
|
|
577
|
+
m: this.$d.minutes,
|
|
578
|
+
mm: t.s(this.$d.minutes, 2, "0"),
|
|
579
|
+
s: this.$d.seconds,
|
|
580
|
+
ss: t.s(this.$d.seconds, 2, "0"),
|
|
581
|
+
SSS: t.s(this.$d.milliseconds, 3, "0")
|
|
582
|
+
};
|
|
583
|
+
return n.replace(l, (function(e, t) {
|
|
584
|
+
return t || String(r[e]);
|
|
585
|
+
}));
|
|
586
|
+
}, g.as = function(e) {
|
|
587
|
+
return this.$ms / u[p(e)];
|
|
588
|
+
}, g.get = function(e) {
|
|
589
|
+
var t = this.$ms, n = p(e);
|
|
590
|
+
return n === "milliseconds" ? t %= 1e3 : t = n === "weeks" ? h(t / u[n]) : this.$d[n], t || 0;
|
|
591
|
+
}, g.add = function(e, t, n) {
|
|
592
|
+
var r;
|
|
593
|
+
return r = t ? e * u[p(t)] : d(e) ? e.$ms : f(e, this).$ms, f(this.$ms + r * (n ? -1 : 1), this);
|
|
594
|
+
}, g.subtract = function(e, t) {
|
|
595
|
+
return this.add(e, t, !0);
|
|
596
|
+
}, g.locale = function(e) {
|
|
597
|
+
var t = this.clone();
|
|
598
|
+
return t.$l = e, t;
|
|
599
|
+
}, g.clone = function() {
|
|
600
|
+
return f(this.$ms, this);
|
|
601
|
+
}, g.humanize = function(t) {
|
|
602
|
+
return e().add(this.$ms, "ms").locale(this.$l).fromNow(!t);
|
|
603
|
+
}, g.valueOf = function() {
|
|
604
|
+
return this.asMilliseconds();
|
|
605
|
+
}, g.milliseconds = function() {
|
|
606
|
+
return this.get("milliseconds");
|
|
607
|
+
}, g.asMilliseconds = function() {
|
|
608
|
+
return this.as("milliseconds");
|
|
609
|
+
}, g.seconds = function() {
|
|
610
|
+
return this.get("seconds");
|
|
611
|
+
}, g.asSeconds = function() {
|
|
612
|
+
return this.as("seconds");
|
|
613
|
+
}, g.minutes = function() {
|
|
614
|
+
return this.get("minutes");
|
|
615
|
+
}, g.asMinutes = function() {
|
|
616
|
+
return this.as("minutes");
|
|
617
|
+
}, g.hours = function() {
|
|
618
|
+
return this.get("hours");
|
|
619
|
+
}, g.asHours = function() {
|
|
620
|
+
return this.as("hours");
|
|
621
|
+
}, g.days = function() {
|
|
622
|
+
return this.get("days");
|
|
623
|
+
}, g.asDays = function() {
|
|
624
|
+
return this.as("days");
|
|
625
|
+
}, g.weeks = function() {
|
|
626
|
+
return this.get("weeks");
|
|
627
|
+
}, g.asWeeks = function() {
|
|
628
|
+
return this.as("weeks");
|
|
629
|
+
}, g.months = function() {
|
|
630
|
+
return this.get("months");
|
|
631
|
+
}, g.asMonths = function() {
|
|
632
|
+
return this.as("months");
|
|
633
|
+
}, g.years = function() {
|
|
634
|
+
return this.get("years");
|
|
635
|
+
}, g.asYears = function() {
|
|
636
|
+
return this.as("years");
|
|
637
|
+
}, m;
|
|
638
|
+
}(), y = function(e, t, n) {
|
|
639
|
+
return e.add(t.years() * n, "y").add(t.months() * n, "M").add(t.days() * n, "d").add(t.hours() * n, "h").add(t.minutes() * n, "m").add(t.seconds() * n, "s").add(t.milliseconds() * n, "ms");
|
|
640
|
+
};
|
|
641
|
+
return function(n, r, i) {
|
|
642
|
+
e = i, t = i().$utils(), i.duration = function(e, t) {
|
|
643
|
+
return f(e, { $l: i.locale() }, t);
|
|
644
|
+
}, i.isDuration = d;
|
|
645
|
+
var a = r.prototype.add, o = r.prototype.subtract;
|
|
646
|
+
r.prototype.add = function(e, t) {
|
|
647
|
+
return d(e) ? y(this, e, 1) : a.bind(this)(e, t);
|
|
648
|
+
}, r.prototype.subtract = function(e, t) {
|
|
649
|
+
return d(e) ? y(this, e, -1) : o.bind(this)(e, t);
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
}));
|
|
653
|
+
})))(), 1);
|
|
654
|
+
_.default.extend(v.default), _.default.extend(y.default), _.default.extend(N.default);
|
|
655
|
+
var P = (e, t) => {
|
|
656
|
+
let n = (0, _.default)(e), r = (0, _.default)(t || 0), i = _.default.duration(n.diff(r));
|
|
657
|
+
return {
|
|
658
|
+
milliseconds: i.asMilliseconds(),
|
|
659
|
+
hours: i.asHours(),
|
|
660
|
+
minutes: i.asMinutes()
|
|
661
|
+
};
|
|
662
|
+
}, F = (e) => typeof e == "number" ? e > 0 : typeof e == "string" ? e.trim() !== "" : !1, I = (e) => typeof e == "object" && !!e && !Array.isArray(e), L = (e, t) => I(e) && Object.hasOwn(e, t), R = (e) => typeof e == "function", z = (e) => {
|
|
663
|
+
let t = {};
|
|
664
|
+
for (let n of Object.keys(e)) e[n] && (t[n] = e[n]);
|
|
665
|
+
return t;
|
|
666
|
+
}, B = (e, t) => {
|
|
667
|
+
let n = new Set(t);
|
|
668
|
+
return Object.fromEntries(Object.entries(e).filter(([e]) => !n.has(e)));
|
|
669
|
+
}, V = (e, t) => {
|
|
670
|
+
let n = new Set(t);
|
|
671
|
+
return Object.fromEntries(Object.entries(e).filter(([e]) => n.has(e)));
|
|
672
|
+
}, H = (e, t = 2, n = "USD", r = "en-US") => {
|
|
673
|
+
let i = {
|
|
674
|
+
style: "currency",
|
|
675
|
+
currency: n,
|
|
676
|
+
minimumFractionDigits: t
|
|
677
|
+
};
|
|
678
|
+
return new Intl.NumberFormat(r, i).format(e / 100);
|
|
679
|
+
}, U = (e) => {
|
|
680
|
+
let t = Math.floor(e), n = Math.floor(t / 100), r = t % 100 != 0, i = t % 100 == 0 ? "00" : String(t % 100).padStart(2, "0");
|
|
681
|
+
return {
|
|
682
|
+
dollar: n,
|
|
683
|
+
isCent: r,
|
|
684
|
+
cent: i,
|
|
685
|
+
full: `${n}${r ? `.${i}` : ""}`,
|
|
686
|
+
fullCent: `${n}.${i}`
|
|
687
|
+
};
|
|
688
|
+
}, W = (e, t = "round") => "$" + Math[t](e / 100), G = (e) => new URLSearchParams(window.location.search).get(e), K = () => {
|
|
689
|
+
let e = new URLSearchParams(window.location.search), t = {};
|
|
690
|
+
for (let [n, r] of e.entries()) Object.hasOwn(t, n) || (t[n] = r);
|
|
691
|
+
return t;
|
|
692
|
+
}, q = (e, t) => {
|
|
693
|
+
let n = e.match(/\[([^\]]+)]/g);
|
|
694
|
+
if (!n) return e;
|
|
695
|
+
for (let e of n) {
|
|
696
|
+
let n = t[e.slice(1, -1)];
|
|
697
|
+
if (n == null || n === "") return null;
|
|
698
|
+
}
|
|
699
|
+
return e.replace(/\[([^\]]+)]/g, (e, n) => String(t[n]));
|
|
700
|
+
}, J = (e, t, n) => {
|
|
701
|
+
try {
|
|
702
|
+
let r = n * 60 * 1e3, i = {
|
|
703
|
+
value: t,
|
|
704
|
+
expiration: (/* @__PURE__ */ new Date()).getTime() + r
|
|
705
|
+
};
|
|
706
|
+
localStorage.setItem(e, JSON.stringify(i));
|
|
707
|
+
} catch {}
|
|
708
|
+
}, Y = (e) => {
|
|
709
|
+
try {
|
|
710
|
+
let t = localStorage.getItem(e);
|
|
711
|
+
if (!t) return null;
|
|
712
|
+
let n = JSON.parse(t);
|
|
713
|
+
return (/* @__PURE__ */ new Date()).getTime() > n.expiration ? (localStorage.removeItem(e), null) : n.value;
|
|
714
|
+
} catch {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
}, X = (e) => typeof e == "string" && e !== "", Z = (e, t, n = "...", r = "end") => {
|
|
718
|
+
if (e.length <= t) return e;
|
|
719
|
+
let i = n.length;
|
|
720
|
+
if (r === "center") {
|
|
721
|
+
let r = Math.floor((t - i) / 2), a = t - r - i;
|
|
722
|
+
return e.substring(0, r) + n + e.substring(e.length - a);
|
|
723
|
+
} else return e.substring(0, t - i) + n;
|
|
724
|
+
}, Q = (e = "--vh") => {
|
|
725
|
+
document.documentElement.style.setProperty(e, `${window.innerHeight * .01}px`);
|
|
726
|
+
};
|
|
727
|
+
//#endregion
|
|
728
|
+
export { z as compactTruthy, f as convertBytes, V as filterObjectByKeys, w as formatBookedDate, k as formatBookedFullDate, E as formatBookedSlot, T as formatBookedTime, x as formatDate, S as formatDefaultDate, C as formatFileDate, H as formatPrice, j as formatSecondsToClockTimer, O as formatSlotTime, A as formatSummaryDate, D as formatTimeAmPm, W as formatWholePrice, d as getAxiosErrorMessage, b as getClockNumber, P as getDiffBetweenDates, Y as getLocalstorageWithExpiration, K as getQueryParamsObject, G as getQuerySearchParam, L as hasProp, l as isFullArray, R as isFunc, I as isObject, F as isPositiveNumberOrNonEmptyString, X as isString, M as isToday, u as mergeArrays, B as removeObjectKeys, q as resolveUrl, J as setLocalstorageWithExpiration, Q as setVHStyleProperty, U as slicePrice, Z as truncate };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertBytes: (value: number) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DateFormat } from '@brighterly/lib-core-types/date/enums';
|
|
2
|
+
export declare const getClockNumber: (num: string | number) => string | undefined;
|
|
3
|
+
export declare const formatDate: (v: string, format: DateFormat) => string;
|
|
4
|
+
export declare const formatDefaultDate: (v: string) => string;
|
|
5
|
+
export declare const formatFileDate: (v: string) => string;
|
|
6
|
+
export declare const formatBookedDate: (v: string) => string;
|
|
7
|
+
export declare const formatBookedTime: (v: string) => string;
|
|
8
|
+
export declare const formatBookedSlot: (v: string) => string;
|
|
9
|
+
export declare const formatTimeAmPm: (v: string) => string;
|
|
10
|
+
export declare const formatSlotTime: (v: string) => string;
|
|
11
|
+
export declare const formatBookedFullDate: (v: string) => string;
|
|
12
|
+
export declare const formatSummaryDate: (v: string) => string;
|
|
13
|
+
export declare const formatSecondsToClockTimer: (seconds: number) => string;
|
|
14
|
+
export declare const isToday: (date: string, currentTime: string) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './array';
|
|
2
|
+
export * from './axios';
|
|
3
|
+
export * from './bytes';
|
|
4
|
+
export * from './date';
|
|
5
|
+
export * from './diff-between-dates';
|
|
6
|
+
export * from './number';
|
|
7
|
+
export * from './object';
|
|
8
|
+
export * from './price';
|
|
9
|
+
export * from './query';
|
|
10
|
+
export * from './resolve-url';
|
|
11
|
+
export * from './storage';
|
|
12
|
+
export * from './string';
|
|
13
|
+
export * from './viewport';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPositiveNumberOrNonEmptyString: (value: unknown) => value is number | string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
2
|
+
export declare const hasProp: (obj: unknown, prop: PropertyKey) => boolean;
|
|
3
|
+
export declare const isFunc: (value: unknown) => value is (...args: unknown[]) => unknown;
|
|
4
|
+
export declare const compactTruthy: <T extends Record<string, unknown>>(obj: T) => Partial<T>;
|
|
5
|
+
export declare const removeObjectKeys: <T extends Record<string, unknown>>(obj: T, keysToRemove: string[]) => Partial<T>;
|
|
6
|
+
export declare const filterObjectByKeys: <T extends Record<string, unknown>>(obj: T, keys: string[]) => Partial<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const formatPrice: (price: number, minimumFractionDigits?: number, currency?: string, locale?: string) => string;
|
|
2
|
+
export interface SlicePriceOptions {
|
|
3
|
+
dollar: number;
|
|
4
|
+
isCent: boolean;
|
|
5
|
+
cent: string;
|
|
6
|
+
full: string;
|
|
7
|
+
fullCent: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const slicePrice: (price: number) => SlicePriceOptions;
|
|
10
|
+
export declare const formatWholePrice: (price: number, method?: "round" | "floor" | "ceil") => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveUrl: (path: string, options: Record<string, string | number | null | undefined>) => string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setVHStyleProperty: (property?: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './helpers';
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brighterly/lib-core-functions",
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"description": "Official Brighterly lib-core-functions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@vueuse/components": "^14.3.0",
|
|
17
|
+
"@vueuse/core": "^14.3.0",
|
|
18
|
+
"axios": "^1.17.0",
|
|
19
|
+
"vue": "^3.5.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@eslint/js": "^10.0.1",
|
|
23
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
24
|
+
"@types/node": "^25.9.0",
|
|
25
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
26
|
+
"@vitest/coverage-v8": "^3.2.6",
|
|
27
|
+
"axios": "^1.17.0",
|
|
28
|
+
"eslint": "^10.4.0",
|
|
29
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
30
|
+
"globals": "^17.6.0",
|
|
31
|
+
"happy-dom": "^18.0.1",
|
|
32
|
+
"tsx": "^4.22.3",
|
|
33
|
+
"typescript": "~6.0.3",
|
|
34
|
+
"typescript-eslint": "^8.59.4",
|
|
35
|
+
"vite": "^8.0.13",
|
|
36
|
+
"vite-plugin-dts": "^5.0.1",
|
|
37
|
+
"vitest": "^3.2.6",
|
|
38
|
+
"vue": "^3.5.34",
|
|
39
|
+
"vue-tsc": "^3.3.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@brighterly/lib-core-types": "^0.15.2",
|
|
43
|
+
"dayjs": "^1.11.21"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "vite",
|
|
47
|
+
"build": "vite build",
|
|
48
|
+
"lint": "eslint",
|
|
49
|
+
"lint:fix": "eslint --fix",
|
|
50
|
+
"typecheck": "vue-tsc",
|
|
51
|
+
"typecheck:watch": "vue-tsc --watch",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"test:coverage": "vitest run --coverage"
|
|
55
|
+
}
|
|
56
|
+
}
|