overview-components 1.0.92 → 1.0.95

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.
Files changed (117) hide show
  1. package/dist/_virtual/FileSaver.min.js +4 -0
  2. package/dist/_virtual/___vite-browser-external.js +6 -0
  3. package/dist/_virtual/__vite-browser-external.js +4 -0
  4. package/dist/_virtual/_commonjs-dynamic-modules.js +6 -0
  5. package/dist/_virtual/_commonjsHelpers.js +28 -0
  6. package/dist/_virtual/index.js +4 -0
  7. package/dist/_virtual/lodash.js +4 -0
  8. package/dist/_virtual/pdf.js +4 -0
  9. package/dist/_virtual/react.production.js +4 -0
  10. package/dist/assets/generated/locales/de.js +73 -0
  11. package/dist/assets/generated/locales/en.js +73 -0
  12. package/dist/assets/generated/locales/fr.js +73 -0
  13. package/dist/assets/generated/locales/hr.js +73 -0
  14. package/dist/assets/generated/locales/it.js +73 -0
  15. package/dist/assets/generated/locales/pl.js +73 -0
  16. package/dist/assets/generated/locales/ro.js +73 -0
  17. package/dist/assets/generated/locales/sk.js +73 -0
  18. package/dist/assets/generated/locales/sr.js +73 -0
  19. package/dist/components/lit-attachments-tab.js +519 -0
  20. package/dist/components/lit-badge.js +100 -0
  21. package/dist/components/lit-case-variables-tab.js +727 -0
  22. package/dist/components/lit-chart.js +395 -0
  23. package/dist/components/lit-data-grid-tanstack.js +1733 -0
  24. package/dist/components/lit-filter-modal.js +312 -0
  25. package/dist/components/lit-multiselect-item.js +530 -0
  26. package/dist/components/lit-section-tab.js +133 -0
  27. package/dist/components/lit-tabs-overview.js +304 -0
  28. package/dist/components/react-wrappers/attachments-tab.js +14 -0
  29. package/dist/components/react-wrappers/badge.js +14 -0
  30. package/dist/components/react-wrappers/button.js +14 -0
  31. package/dist/components/react-wrappers/case-variables-tab.js +14 -0
  32. package/dist/components/react-wrappers/chart.js +14 -0
  33. package/dist/components/react-wrappers/data-grid-tanstack.js +14 -0
  34. package/dist/components/react-wrappers/filter-modal.js +14 -0
  35. package/dist/components/react-wrappers/progress-bar.js +14 -0
  36. package/dist/components/react-wrappers/section-tab.js +14 -0
  37. package/dist/components/react-wrappers/tabs-overview.js +14 -0
  38. package/dist/index.js +42 -0
  39. package/dist/libs/xlsx.mini.min.js +10 -0
  40. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +432 -0
  41. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +306 -0
  42. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +127 -0
  43. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +127 -0
  44. package/dist/node_modules/@kurkle/color/dist/color.esm.js +448 -0
  45. package/dist/node_modules/@lit/localize/init/install.js +11 -0
  46. package/dist/node_modules/@lit/localize/init/runtime.js +42 -0
  47. package/dist/node_modules/@lit/localize/internal/default-msg.js +10 -0
  48. package/dist/node_modules/@lit/localize/internal/deferred.js +21 -0
  49. package/dist/node_modules/@lit/localize/internal/fnv1a64.js +17 -0
  50. package/dist/node_modules/@lit/localize/internal/id-generation.js +14 -0
  51. package/dist/node_modules/@lit/localize/internal/locale-status-event.js +9 -0
  52. package/dist/node_modules/@lit/localize/internal/runtime-msg.js +42 -0
  53. package/dist/node_modules/@lit/localize/internal/str-tag.js +15 -0
  54. package/dist/node_modules/@lit/react/create-component.js +35 -0
  55. package/dist/node_modules/@lit/reactive-element/css-tag.js +50 -0
  56. package/dist/node_modules/@lit/reactive-element/decorators/base.js +9 -0
  57. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +13 -0
  58. package/dist/node_modules/@lit/reactive-element/decorators/property.js +37 -0
  59. package/dist/node_modules/@lit/reactive-element/decorators/query.js +20 -0
  60. package/dist/node_modules/@lit/reactive-element/decorators/state.js +12 -0
  61. package/dist/node_modules/@lit/reactive-element/reactive-element.js +250 -0
  62. package/dist/node_modules/@tanstack/lit-table/build/lib/index.js +104 -0
  63. package/dist/node_modules/@tanstack/lit-virtual/dist/esm/index.js +40 -0
  64. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1956 -0
  65. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +490 -0
  66. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
  67. package/dist/node_modules/chart.js/dist/chart.js +7122 -0
  68. package/dist/node_modules/chart.js/dist/chunks/helpers.segment.js +1691 -0
  69. package/dist/node_modules/file-saver/dist/FileSaver.min.js +74 -0
  70. package/dist/node_modules/lit-element/lit-element.js +51 -0
  71. package/dist/node_modules/lit-html/async-directive.js +69 -0
  72. package/dist/node_modules/lit-html/directive-helpers.js +45 -0
  73. package/dist/node_modules/lit-html/directive.js +27 -0
  74. package/dist/node_modules/lit-html/directives/ref.js +42 -0
  75. package/dist/node_modules/lit-html/directives/repeat.js +61 -0
  76. package/dist/node_modules/lit-html/directives/style-map.js +36 -0
  77. package/dist/node_modules/lit-html/directives/unsafe-html.js +27 -0
  78. package/dist/node_modules/lit-html/lit-html.js +243 -0
  79. package/dist/node_modules/lodash/lodash.js +3678 -0
  80. package/dist/node_modules/luxon/src/datetime.js +1793 -0
  81. package/dist/node_modules/luxon/src/duration.js +723 -0
  82. package/dist/node_modules/luxon/src/errors.js +40 -0
  83. package/dist/node_modules/luxon/src/impl/conversions.js +92 -0
  84. package/dist/node_modules/luxon/src/impl/diff.js +36 -0
  85. package/dist/node_modules/luxon/src/impl/digits.js +74 -0
  86. package/dist/node_modules/luxon/src/impl/english.js +138 -0
  87. package/dist/node_modules/luxon/src/impl/formats.js +150 -0
  88. package/dist/node_modules/luxon/src/impl/formatter.js +245 -0
  89. package/dist/node_modules/luxon/src/impl/invalid.js +11 -0
  90. package/dist/node_modules/luxon/src/impl/locale.js +282 -0
  91. package/dist/node_modules/luxon/src/impl/regexParser.js +202 -0
  92. package/dist/node_modules/luxon/src/impl/tokenParser.js +329 -0
  93. package/dist/node_modules/luxon/src/impl/util.js +206 -0
  94. package/dist/node_modules/luxon/src/impl/zoneUtil.js +19 -0
  95. package/dist/node_modules/luxon/src/info.js +180 -0
  96. package/dist/node_modules/luxon/src/interval.js +466 -0
  97. package/dist/node_modules/luxon/src/settings.js +150 -0
  98. package/dist/node_modules/luxon/src/zone.js +88 -0
  99. package/dist/node_modules/luxon/src/zones/IANAZone.js +178 -0
  100. package/dist/node_modules/luxon/src/zones/fixedOffsetZone.js +125 -0
  101. package/dist/node_modules/luxon/src/zones/invalidZone.js +41 -0
  102. package/dist/node_modules/luxon/src/zones/systemZone.js +47 -0
  103. package/dist/node_modules/pdfjs-dist/build/pdf.js +10310 -0
  104. package/dist/node_modules/react/cjs/react.production.js +417 -0
  105. package/dist/node_modules/react/index.js +10 -0
  106. package/dist/node_modules/sortablejs/modular/sortable.esm.js +1261 -0
  107. package/dist/shared/lit-button.js +142 -0
  108. package/dist/shared/lit-progress-bar.js +83 -0
  109. package/dist/shared/simple-tooltip.js +174 -0
  110. package/dist/shared/styles/button-shared-styles.js +205 -0
  111. package/dist/utils/currency.js +13 -0
  112. package/dist/utils/custom-filters.js +50 -0
  113. package/dist/utils/date.js +15 -0
  114. package/dist/utils/getOperatorByType.js +52 -0
  115. package/dist/utils/localization.js +30 -0
  116. package/dist/vite.svg +1 -0
  117. package/package.json +76 -74
@@ -0,0 +1,466 @@
1
+ import c, { friendlyDateTime as f } from "./datetime.js";
2
+ import h from "./duration.js";
3
+ import S from "./settings.js";
4
+ import { InvalidArgumentError as v, InvalidIntervalError as p } from "./errors.js";
5
+ import V from "./impl/invalid.js";
6
+ import O from "./impl/formatter.js";
7
+ import { DATE_SHORT as D } from "./impl/formats.js";
8
+ const d = "Invalid Interval";
9
+ function I(m, t) {
10
+ return !m || !m.isValid ? a.invalid("missing or invalid start") : !t || !t.isValid ? a.invalid("missing or invalid end") : t < m ? a.invalid(
11
+ "end before start",
12
+ `The end of an interval must be after its start, but you had start=${m.toISO()} and end=${t.toISO()}`
13
+ ) : null;
14
+ }
15
+ class a {
16
+ /**
17
+ * @private
18
+ */
19
+ constructor(t) {
20
+ this.s = t.start, this.e = t.end, this.invalid = t.invalid || null, this.isLuxonInterval = !0;
21
+ }
22
+ /**
23
+ * Create an invalid Interval.
24
+ * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent
25
+ * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
26
+ * @return {Interval}
27
+ */
28
+ static invalid(t, i = null) {
29
+ if (!t)
30
+ throw new v("need to specify a reason the Interval is invalid");
31
+ const e = t instanceof V ? t : new V(t, i);
32
+ if (S.throwOnInvalid)
33
+ throw new p(e);
34
+ return new a({ invalid: e });
35
+ }
36
+ /**
37
+ * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
38
+ * @param {DateTime|Date|Object} start
39
+ * @param {DateTime|Date|Object} end
40
+ * @return {Interval}
41
+ */
42
+ static fromDateTimes(t, i) {
43
+ const e = f(t), s = f(i), r = I(e, s);
44
+ return r ?? new a({
45
+ start: e,
46
+ end: s
47
+ });
48
+ }
49
+ /**
50
+ * Create an Interval from a start DateTime and a Duration to extend to.
51
+ * @param {DateTime|Date|Object} start
52
+ * @param {Duration|Object|number} duration - the length of the Interval.
53
+ * @return {Interval}
54
+ */
55
+ static after(t, i) {
56
+ const e = h.fromDurationLike(i), s = f(t);
57
+ return a.fromDateTimes(s, s.plus(e));
58
+ }
59
+ /**
60
+ * Create an Interval from an end DateTime and a Duration to extend backwards to.
61
+ * @param {DateTime|Date|Object} end
62
+ * @param {Duration|Object|number} duration - the length of the Interval.
63
+ * @return {Interval}
64
+ */
65
+ static before(t, i) {
66
+ const e = h.fromDurationLike(i), s = f(t);
67
+ return a.fromDateTimes(s.minus(e), s);
68
+ }
69
+ /**
70
+ * Create an Interval from an ISO 8601 string.
71
+ * Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats.
72
+ * @param {string} text - the ISO string to parse
73
+ * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}
74
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
75
+ * @return {Interval}
76
+ */
77
+ static fromISO(t, i) {
78
+ const [e, s] = (t || "").split("/", 2);
79
+ if (e && s) {
80
+ let r, n;
81
+ try {
82
+ r = c.fromISO(e, i), n = r.isValid;
83
+ } catch {
84
+ n = !1;
85
+ }
86
+ let u, l;
87
+ try {
88
+ u = c.fromISO(s, i), l = u.isValid;
89
+ } catch {
90
+ l = !1;
91
+ }
92
+ if (n && l)
93
+ return a.fromDateTimes(r, u);
94
+ if (n) {
95
+ const o = h.fromISO(s, i);
96
+ if (o.isValid)
97
+ return a.after(r, o);
98
+ } else if (l) {
99
+ const o = h.fromISO(e, i);
100
+ if (o.isValid)
101
+ return a.before(u, o);
102
+ }
103
+ }
104
+ return a.invalid("unparsable", `the input "${t}" can't be parsed as ISO 8601`);
105
+ }
106
+ /**
107
+ * Check if an object is an Interval. Works across context boundaries
108
+ * @param {object} o
109
+ * @return {boolean}
110
+ */
111
+ static isInterval(t) {
112
+ return t && t.isLuxonInterval || !1;
113
+ }
114
+ /**
115
+ * Returns the start of the Interval
116
+ * @type {DateTime}
117
+ */
118
+ get start() {
119
+ return this.isValid ? this.s : null;
120
+ }
121
+ /**
122
+ * Returns the end of the Interval
123
+ * @type {DateTime}
124
+ */
125
+ get end() {
126
+ return this.isValid ? this.e : null;
127
+ }
128
+ /**
129
+ * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
130
+ * @type {boolean}
131
+ */
132
+ get isValid() {
133
+ return this.invalidReason === null;
134
+ }
135
+ /**
136
+ * Returns an error code if this Interval is invalid, or null if the Interval is valid
137
+ * @type {string}
138
+ */
139
+ get invalidReason() {
140
+ return this.invalid ? this.invalid.reason : null;
141
+ }
142
+ /**
143
+ * Returns an explanation of why this Interval became invalid, or null if the Interval is valid
144
+ * @type {string}
145
+ */
146
+ get invalidExplanation() {
147
+ return this.invalid ? this.invalid.explanation : null;
148
+ }
149
+ /**
150
+ * Returns the length of the Interval in the specified unit.
151
+ * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.
152
+ * @return {number}
153
+ */
154
+ length(t = "milliseconds") {
155
+ return this.isValid ? this.toDuration(t).get(t) : NaN;
156
+ }
157
+ /**
158
+ * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.
159
+ * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
160
+ * asks 'what dates are included in this interval?', not 'how many days long is this interval?'
161
+ * @param {string} [unit='milliseconds'] - the unit of time to count.
162
+ * @param {Object} opts - options
163
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
164
+ * @return {number}
165
+ */
166
+ count(t = "milliseconds", i) {
167
+ if (!this.isValid) return NaN;
168
+ const e = this.start.startOf(t, i);
169
+ let s;
170
+ return i != null && i.useLocaleWeeks ? s = this.end.reconfigure({ locale: e.locale }) : s = this.end, s = s.startOf(t, i), Math.floor(s.diff(e, t).get(t)) + (s.valueOf() !== this.end.valueOf());
171
+ }
172
+ /**
173
+ * Returns whether this Interval's start and end are both in the same unit of time
174
+ * @param {string} unit - the unit of time to check sameness on
175
+ * @return {boolean}
176
+ */
177
+ hasSame(t) {
178
+ return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, t) : !1;
179
+ }
180
+ /**
181
+ * Return whether this Interval has the same start and end DateTimes.
182
+ * @return {boolean}
183
+ */
184
+ isEmpty() {
185
+ return this.s.valueOf() === this.e.valueOf();
186
+ }
187
+ /**
188
+ * Return whether this Interval's start is after the specified DateTime.
189
+ * @param {DateTime} dateTime
190
+ * @return {boolean}
191
+ */
192
+ isAfter(t) {
193
+ return this.isValid ? this.s > t : !1;
194
+ }
195
+ /**
196
+ * Return whether this Interval's end is before the specified DateTime.
197
+ * @param {DateTime} dateTime
198
+ * @return {boolean}
199
+ */
200
+ isBefore(t) {
201
+ return this.isValid ? this.e <= t : !1;
202
+ }
203
+ /**
204
+ * Return whether this Interval contains the specified DateTime.
205
+ * @param {DateTime} dateTime
206
+ * @return {boolean}
207
+ */
208
+ contains(t) {
209
+ return this.isValid ? this.s <= t && this.e > t : !1;
210
+ }
211
+ /**
212
+ * "Sets" the start and/or end dates. Returns a newly-constructed Interval.
213
+ * @param {Object} values - the values to set
214
+ * @param {DateTime} values.start - the starting DateTime
215
+ * @param {DateTime} values.end - the ending DateTime
216
+ * @return {Interval}
217
+ */
218
+ set({ start: t, end: i } = {}) {
219
+ return this.isValid ? a.fromDateTimes(t || this.s, i || this.e) : this;
220
+ }
221
+ /**
222
+ * Split this Interval at each of the specified DateTimes
223
+ * @param {...DateTime} dateTimes - the unit of time to count.
224
+ * @return {Array}
225
+ */
226
+ splitAt(...t) {
227
+ if (!this.isValid) return [];
228
+ const i = t.map(f).filter((n) => this.contains(n)).sort((n, u) => n.toMillis() - u.toMillis()), e = [];
229
+ let { s } = this, r = 0;
230
+ for (; s < this.e; ) {
231
+ const n = i[r] || this.e, u = +n > +this.e ? this.e : n;
232
+ e.push(a.fromDateTimes(s, u)), s = u, r += 1;
233
+ }
234
+ return e;
235
+ }
236
+ /**
237
+ * Split this Interval into smaller Intervals, each of the specified length.
238
+ * Left over time is grouped into a smaller interval
239
+ * @param {Duration|Object|number} duration - The length of each resulting interval.
240
+ * @return {Array}
241
+ */
242
+ splitBy(t) {
243
+ const i = h.fromDurationLike(t);
244
+ if (!this.isValid || !i.isValid || i.as("milliseconds") === 0)
245
+ return [];
246
+ let { s: e } = this, s = 1, r;
247
+ const n = [];
248
+ for (; e < this.e; ) {
249
+ const u = this.start.plus(i.mapUnits((l) => l * s));
250
+ r = +u > +this.e ? this.e : u, n.push(a.fromDateTimes(e, r)), e = r, s += 1;
251
+ }
252
+ return n;
253
+ }
254
+ /**
255
+ * Split this Interval into the specified number of smaller intervals.
256
+ * @param {number} numberOfParts - The number of Intervals to divide the Interval into.
257
+ * @return {Array}
258
+ */
259
+ divideEqually(t) {
260
+ return this.isValid ? this.splitBy(this.length() / t).slice(0, t) : [];
261
+ }
262
+ /**
263
+ * Return whether this Interval overlaps with the specified Interval
264
+ * @param {Interval} other
265
+ * @return {boolean}
266
+ */
267
+ overlaps(t) {
268
+ return this.e > t.s && this.s < t.e;
269
+ }
270
+ /**
271
+ * Return whether this Interval's end is adjacent to the specified Interval's start.
272
+ * @param {Interval} other
273
+ * @return {boolean}
274
+ */
275
+ abutsStart(t) {
276
+ return this.isValid ? +this.e == +t.s : !1;
277
+ }
278
+ /**
279
+ * Return whether this Interval's start is adjacent to the specified Interval's end.
280
+ * @param {Interval} other
281
+ * @return {boolean}
282
+ */
283
+ abutsEnd(t) {
284
+ return this.isValid ? +t.e == +this.s : !1;
285
+ }
286
+ /**
287
+ * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.
288
+ * @param {Interval} other
289
+ * @return {boolean}
290
+ */
291
+ engulfs(t) {
292
+ return this.isValid ? this.s <= t.s && this.e >= t.e : !1;
293
+ }
294
+ /**
295
+ * Return whether this Interval has the same start and end as the specified Interval.
296
+ * @param {Interval} other
297
+ * @return {boolean}
298
+ */
299
+ equals(t) {
300
+ return !this.isValid || !t.isValid ? !1 : this.s.equals(t.s) && this.e.equals(t.e);
301
+ }
302
+ /**
303
+ * Return an Interval representing the intersection of this Interval and the specified Interval.
304
+ * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.
305
+ * Returns null if the intersection is empty, meaning, the intervals don't intersect.
306
+ * @param {Interval} other
307
+ * @return {Interval}
308
+ */
309
+ intersection(t) {
310
+ if (!this.isValid) return this;
311
+ const i = this.s > t.s ? this.s : t.s, e = this.e < t.e ? this.e : t.e;
312
+ return i >= e ? null : a.fromDateTimes(i, e);
313
+ }
314
+ /**
315
+ * Return an Interval representing the union of this Interval and the specified Interval.
316
+ * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.
317
+ * @param {Interval} other
318
+ * @return {Interval}
319
+ */
320
+ union(t) {
321
+ if (!this.isValid) return this;
322
+ const i = this.s < t.s ? this.s : t.s, e = this.e > t.e ? this.e : t.e;
323
+ return a.fromDateTimes(i, e);
324
+ }
325
+ /**
326
+ * Merge an array of Intervals into a equivalent minimal set of Intervals.
327
+ * Combines overlapping and adjacent Intervals.
328
+ * @param {Array} intervals
329
+ * @return {Array}
330
+ */
331
+ static merge(t) {
332
+ const [i, e] = t.sort((s, r) => s.s - r.s).reduce(
333
+ ([s, r], n) => r ? r.overlaps(n) || r.abutsStart(n) ? [s, r.union(n)] : [s.concat([r]), n] : [s, n],
334
+ [[], null]
335
+ );
336
+ return e && i.push(e), i;
337
+ }
338
+ /**
339
+ * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.
340
+ * @param {Array} intervals
341
+ * @return {Array}
342
+ */
343
+ static xor(t) {
344
+ let i = null, e = 0;
345
+ const s = [], r = t.map((l) => [
346
+ { time: l.s, type: "s" },
347
+ { time: l.e, type: "e" }
348
+ ]), n = Array.prototype.concat(...r), u = n.sort((l, o) => l.time - o.time);
349
+ for (const l of u)
350
+ e += l.type === "s" ? 1 : -1, e === 1 ? i = l.time : (i && +i != +l.time && s.push(a.fromDateTimes(i, l.time)), i = null);
351
+ return a.merge(s);
352
+ }
353
+ /**
354
+ * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.
355
+ * @param {...Interval} intervals
356
+ * @return {Array}
357
+ */
358
+ difference(...t) {
359
+ return a.xor([this].concat(t)).map((i) => this.intersection(i)).filter((i) => i && !i.isEmpty());
360
+ }
361
+ /**
362
+ * Returns a string representation of this Interval appropriate for debugging.
363
+ * @return {string}
364
+ */
365
+ toString() {
366
+ return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : d;
367
+ }
368
+ /**
369
+ * Returns a string representation of this Interval appropriate for the REPL.
370
+ * @return {string}
371
+ */
372
+ [Symbol.for("nodejs.util.inspect.custom")]() {
373
+ return this.isValid ? `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }` : `Interval { Invalid, reason: ${this.invalidReason} }`;
374
+ }
375
+ /**
376
+ * Returns a localized string representing this Interval. Accepts the same options as the
377
+ * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
378
+ * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method
379
+ * is browser-specific, but in general it will return an appropriate representation of the
380
+ * Interval in the assigned locale. Defaults to the system's locale if no locale has been
381
+ * specified.
382
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
383
+ * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or
384
+ * Intl.DateTimeFormat constructor options.
385
+ * @param {Object} opts - Options to override the configuration of the start DateTime.
386
+ * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022
387
+ * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022
388
+ * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022
389
+ * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM
390
+ * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p
391
+ * @return {string}
392
+ */
393
+ toLocaleString(t = D, i = {}) {
394
+ return this.isValid ? O.create(this.s.loc.clone(i), t).formatInterval(this) : d;
395
+ }
396
+ /**
397
+ * Returns an ISO 8601-compliant string representation of this Interval.
398
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
399
+ * @param {Object} opts - The same options as {@link DateTime#toISO}
400
+ * @return {string}
401
+ */
402
+ toISO(t) {
403
+ return this.isValid ? `${this.s.toISO(t)}/${this.e.toISO(t)}` : d;
404
+ }
405
+ /**
406
+ * Returns an ISO 8601-compliant string representation of date of this Interval.
407
+ * The time components are ignored.
408
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
409
+ * @return {string}
410
+ */
411
+ toISODate() {
412
+ return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : d;
413
+ }
414
+ /**
415
+ * Returns an ISO 8601-compliant string representation of time of this Interval.
416
+ * The date components are ignored.
417
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
418
+ * @param {Object} opts - The same options as {@link DateTime#toISO}
419
+ * @return {string}
420
+ */
421
+ toISOTime(t) {
422
+ return this.isValid ? `${this.s.toISOTime(t)}/${this.e.toISOTime(t)}` : d;
423
+ }
424
+ /**
425
+ * Returns a string representation of this Interval formatted according to the specified format
426
+ * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible
427
+ * formatting tool.
428
+ * @param {string} dateFormat - The format string. This string formats the start and end time.
429
+ * See {@link DateTime#toFormat} for details.
430
+ * @param {Object} opts - Options.
431
+ * @param {string} [opts.separator = ' – '] - A separator to place between the start and end
432
+ * representations.
433
+ * @return {string}
434
+ */
435
+ toFormat(t, { separator: i = " – " } = {}) {
436
+ return this.isValid ? `${this.s.toFormat(t)}${i}${this.e.toFormat(t)}` : d;
437
+ }
438
+ /**
439
+ * Return a Duration representing the time spanned by this interval.
440
+ * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.
441
+ * @param {Object} opts - options that affect the creation of the Duration
442
+ * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
443
+ * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }
444
+ * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }
445
+ * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }
446
+ * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }
447
+ * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }
448
+ * @return {Duration}
449
+ */
450
+ toDuration(t, i) {
451
+ return this.isValid ? this.e.diff(this.s, t, i) : h.invalid(this.invalidReason);
452
+ }
453
+ /**
454
+ * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes
455
+ * @param {function} mapFn
456
+ * @return {Interval}
457
+ * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())
458
+ * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))
459
+ */
460
+ mapEndpoints(t) {
461
+ return a.fromDateTimes(t(this.s), t(this.e));
462
+ }
463
+ }
464
+ export {
465
+ a as default
466
+ };
@@ -0,0 +1,150 @@
1
+ import l from "./zones/systemZone.js";
2
+ import f from "./zones/IANAZone.js";
3
+ import c from "./impl/locale.js";
4
+ import m from "./datetime.js";
5
+ import { normalizeZone as d } from "./impl/zoneUtil.js";
6
+ import { validateWeekSettings as g } from "./impl/util.js";
7
+ import { resetDigitRegexCache as p } from "./impl/digits.js";
8
+ let e = () => Date.now(), a = "system", r = null, i = null, s = null, n = 60, u, o = null;
9
+ class k {
10
+ /**
11
+ * Get the callback for returning the current timestamp.
12
+ * @type {function}
13
+ */
14
+ static get now() {
15
+ return e;
16
+ }
17
+ /**
18
+ * Set the callback for returning the current timestamp.
19
+ * The function should return a number, which will be interpreted as an Epoch millisecond count
20
+ * @type {function}
21
+ * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
22
+ * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
23
+ */
24
+ static set now(t) {
25
+ e = t;
26
+ }
27
+ /**
28
+ * Set the default time zone to create DateTimes in. Does not affect existing instances.
29
+ * Use the value "system" to reset this value to the system's time zone.
30
+ * @type {string}
31
+ */
32
+ static set defaultZone(t) {
33
+ a = t;
34
+ }
35
+ /**
36
+ * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
37
+ * The default value is the system's time zone (the one set on the machine that runs this code).
38
+ * @type {Zone}
39
+ */
40
+ static get defaultZone() {
41
+ return d(a, l.instance);
42
+ }
43
+ /**
44
+ * Get the default locale to create DateTimes with. Does not affect existing instances.
45
+ * @type {string}
46
+ */
47
+ static get defaultLocale() {
48
+ return r;
49
+ }
50
+ /**
51
+ * Set the default locale to create DateTimes with. Does not affect existing instances.
52
+ * @type {string}
53
+ */
54
+ static set defaultLocale(t) {
55
+ r = t;
56
+ }
57
+ /**
58
+ * Get the default numbering system to create DateTimes with. Does not affect existing instances.
59
+ * @type {string}
60
+ */
61
+ static get defaultNumberingSystem() {
62
+ return i;
63
+ }
64
+ /**
65
+ * Set the default numbering system to create DateTimes with. Does not affect existing instances.
66
+ * @type {string}
67
+ */
68
+ static set defaultNumberingSystem(t) {
69
+ i = t;
70
+ }
71
+ /**
72
+ * Get the default output calendar to create DateTimes with. Does not affect existing instances.
73
+ * @type {string}
74
+ */
75
+ static get defaultOutputCalendar() {
76
+ return s;
77
+ }
78
+ /**
79
+ * Set the default output calendar to create DateTimes with. Does not affect existing instances.
80
+ * @type {string}
81
+ */
82
+ static set defaultOutputCalendar(t) {
83
+ s = t;
84
+ }
85
+ /**
86
+ * @typedef {Object} WeekSettings
87
+ * @property {number} firstDay
88
+ * @property {number} minimalDays
89
+ * @property {number[]} weekend
90
+ */
91
+ /**
92
+ * @return {WeekSettings|null}
93
+ */
94
+ static get defaultWeekSettings() {
95
+ return o;
96
+ }
97
+ /**
98
+ * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
99
+ * how many days are required in the first week of a year.
100
+ * Does not affect existing instances.
101
+ *
102
+ * @param {WeekSettings|null} weekSettings
103
+ */
104
+ static set defaultWeekSettings(t) {
105
+ o = g(t);
106
+ }
107
+ /**
108
+ * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
109
+ * @type {number}
110
+ */
111
+ static get twoDigitCutoffYear() {
112
+ return n;
113
+ }
114
+ /**
115
+ * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
116
+ * @type {number}
117
+ * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century
118
+ * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century
119
+ * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950
120
+ * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
121
+ * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
122
+ */
123
+ static set twoDigitCutoffYear(t) {
124
+ n = t % 100;
125
+ }
126
+ /**
127
+ * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
128
+ * @type {boolean}
129
+ */
130
+ static get throwOnInvalid() {
131
+ return u;
132
+ }
133
+ /**
134
+ * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
135
+ * @type {boolean}
136
+ */
137
+ static set throwOnInvalid(t) {
138
+ u = t;
139
+ }
140
+ /**
141
+ * Reset Luxon's global caches. Should only be necessary in testing scenarios.
142
+ * @return {void}
143
+ */
144
+ static resetCaches() {
145
+ c.resetCache(), f.resetCache(), m.resetCache(), p();
146
+ }
147
+ }
148
+ export {
149
+ k as default
150
+ };
@@ -0,0 +1,88 @@
1
+ import { ZoneIsAbstractError as t } from "./errors.js";
2
+ class n {
3
+ /**
4
+ * The type of zone
5
+ * @abstract
6
+ * @type {string}
7
+ */
8
+ get type() {
9
+ throw new t();
10
+ }
11
+ /**
12
+ * The name of this zone.
13
+ * @abstract
14
+ * @type {string}
15
+ */
16
+ get name() {
17
+ throw new t();
18
+ }
19
+ /**
20
+ * The IANA name of this zone.
21
+ * Defaults to `name` if not overwritten by a subclass.
22
+ * @abstract
23
+ * @type {string}
24
+ */
25
+ get ianaName() {
26
+ return this.name;
27
+ }
28
+ /**
29
+ * Returns whether the offset is known to be fixed for the whole year.
30
+ * @abstract
31
+ * @type {boolean}
32
+ */
33
+ get isUniversal() {
34
+ throw new t();
35
+ }
36
+ /**
37
+ * Returns the offset's common name (such as EST) at the specified timestamp
38
+ * @abstract
39
+ * @param {number} ts - Epoch milliseconds for which to get the name
40
+ * @param {Object} opts - Options to affect the format
41
+ * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
42
+ * @param {string} opts.locale - What locale to return the offset name in.
43
+ * @return {string}
44
+ */
45
+ offsetName(e, o) {
46
+ throw new t();
47
+ }
48
+ /**
49
+ * Returns the offset's value as a string
50
+ * @abstract
51
+ * @param {number} ts - Epoch milliseconds for which to get the offset
52
+ * @param {string} format - What style of offset to return.
53
+ * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
54
+ * @return {string}
55
+ */
56
+ formatOffset(e, o) {
57
+ throw new t();
58
+ }
59
+ /**
60
+ * Return the offset in minutes for this zone at the specified timestamp.
61
+ * @abstract
62
+ * @param {number} ts - Epoch milliseconds for which to compute the offset
63
+ * @return {number}
64
+ */
65
+ offset(e) {
66
+ throw new t();
67
+ }
68
+ /**
69
+ * Return whether this Zone is equal to another zone
70
+ * @abstract
71
+ * @param {Zone} otherZone - the zone to compare
72
+ * @return {boolean}
73
+ */
74
+ equals(e) {
75
+ throw new t();
76
+ }
77
+ /**
78
+ * Return whether this Zone is valid.
79
+ * @abstract
80
+ * @type {boolean}
81
+ */
82
+ get isValid() {
83
+ throw new t();
84
+ }
85
+ }
86
+ export {
87
+ n as default
88
+ };