@bpmn-io/form-js-playground 1.4.1 → 1.5.0

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.
@@ -2877,6 +2877,17 @@
2877
2877
  return sysLocaleCache;
2878
2878
  }
2879
2879
  }
2880
+ let weekInfoCache = {};
2881
+ function getCachedWeekInfo(locString) {
2882
+ let data = weekInfoCache[locString];
2883
+ if (!data) {
2884
+ const locale = new Intl.Locale(locString);
2885
+ // browsers currently implement this as a property, but spec says it should be a getter function
2886
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
2887
+ weekInfoCache[locString] = data;
2888
+ }
2889
+ return data;
2890
+ }
2880
2891
  function parseLocaleString(localeStr) {
2881
2892
  // I really want to avoid writing a BCP 47 parser
2882
2893
  // see, e.g. https://github.com/wooorm/bcp-47
@@ -2933,7 +2944,7 @@
2933
2944
  function mapMonths(f) {
2934
2945
  const ms = [];
2935
2946
  for (let i = 1; i <= 12; i++) {
2936
- const dt = DateTime.utc(2016, i, 1);
2947
+ const dt = DateTime.utc(2009, i, 1);
2937
2948
  ms.push(f(dt));
2938
2949
  }
2939
2950
  return ms;
@@ -2946,8 +2957,8 @@
2946
2957
  }
2947
2958
  return ms;
2948
2959
  }
2949
- function listStuff(loc, length, defaultOK, englishFn, intlFn) {
2950
- const mode = loc.listingMode(defaultOK);
2960
+ function listStuff(loc, length, englishFn, intlFn) {
2961
+ const mode = loc.listingMode();
2951
2962
  if (mode === "error") {
2952
2963
  return null;
2953
2964
  } else if (mode === "en") {
@@ -3005,8 +3016,12 @@
3005
3016
  class PolyDateFormatter {
3006
3017
  constructor(dt, intl, opts) {
3007
3018
  this.opts = opts;
3019
+ this.originalZone = undefined;
3008
3020
  let z = undefined;
3009
- if (dt.zone.isUniversal) {
3021
+ if (this.opts.timeZone) {
3022
+ // Don't apply any workarounds if a timeZone is explicitly provided in opts
3023
+ this.dt = dt;
3024
+ } else if (dt.zone.type === "fixed") {
3010
3025
  // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.
3011
3026
  // That is why fixed-offset TZ is set to that unless it is:
3012
3027
  // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.
@@ -3019,25 +3034,27 @@
3019
3034
  z = offsetZ;
3020
3035
  this.dt = dt;
3021
3036
  } else {
3022
- // Not all fixed-offset zones like Etc/+4:30 are present in tzdata.
3023
- // So we have to make do. Two cases:
3024
- // 1. The format options tell us to show the zone. We can't do that, so the best
3025
- // we can do is format the date in UTC.
3026
- // 2. The format options don't tell us to show the zone. Then we can adjust them
3027
- // the time and tell the formatter to show it to us in UTC, so that the time is right
3028
- // and the bad zone doesn't show up.
3037
+ // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so
3038
+ // we manually apply the offset and substitute the zone as needed.
3029
3039
  z = "UTC";
3030
- if (opts.timeZoneName) {
3031
- this.dt = dt;
3032
- } else {
3033
- this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
3034
- }
3040
+ this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
3041
+ minutes: dt.offset
3042
+ });
3043
+ this.originalZone = dt.zone;
3035
3044
  }
3036
3045
  } else if (dt.zone.type === "system") {
3037
3046
  this.dt = dt;
3038
- } else {
3047
+ } else if (dt.zone.type === "iana") {
3039
3048
  this.dt = dt;
3040
3049
  z = dt.zone.name;
3050
+ } else {
3051
+ // Custom zones can have any offset / offsetName so we just manually
3052
+ // apply the offset and substitute the zone as needed.
3053
+ z = "UTC";
3054
+ this.dt = dt.setZone("UTC").plus({
3055
+ minutes: dt.offset
3056
+ });
3057
+ this.originalZone = dt.zone;
3041
3058
  }
3042
3059
  const intlOpts = {
3043
3060
  ...this.opts
@@ -3046,10 +3063,34 @@
3046
3063
  this.dtf = getCachedDTF(intl, intlOpts);
3047
3064
  }
3048
3065
  format() {
3066
+ if (this.originalZone) {
3067
+ // If we have to substitute in the actual zone name, we have to use
3068
+ // formatToParts so that the timezone can be replaced.
3069
+ return this.formatToParts().map(({
3070
+ value
3071
+ }) => value).join("");
3072
+ }
3049
3073
  return this.dtf.format(this.dt.toJSDate());
3050
3074
  }
3051
3075
  formatToParts() {
3052
- return this.dtf.formatToParts(this.dt.toJSDate());
3076
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
3077
+ if (this.originalZone) {
3078
+ return parts.map(part => {
3079
+ if (part.type === "timeZoneName") {
3080
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
3081
+ locale: this.dt.locale,
3082
+ format: this.opts.timeZoneName
3083
+ });
3084
+ return {
3085
+ ...part,
3086
+ value: offsetName
3087
+ };
3088
+ } else {
3089
+ return part;
3090
+ }
3091
+ });
3092
+ }
3093
+ return parts;
3053
3094
  }
3054
3095
  resolvedOptions() {
3055
3096
  return this.dtf.resolvedOptions();
@@ -3084,6 +3125,11 @@
3084
3125
  }
3085
3126
  }
3086
3127
  }
3128
+ const fallbackWeekSettings = {
3129
+ firstDay: 1,
3130
+ minimalDays: 4,
3131
+ weekend: [6, 7]
3132
+ };
3087
3133
 
3088
3134
  /**
3089
3135
  * @private
@@ -3091,15 +3137,16 @@
3091
3137
 
3092
3138
  class Locale {
3093
3139
  static fromOpts(opts) {
3094
- return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
3140
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
3095
3141
  }
3096
- static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
3142
+ static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
3097
3143
  const specifiedLocale = locale || Settings.defaultLocale;
3098
3144
  // the system locale is useful for human readable strings but annoying for parsing/formatting known formats
3099
3145
  const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
3100
3146
  const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
3101
3147
  const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
3102
- return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
3148
+ const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
3149
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
3103
3150
  }
3104
3151
  static resetCache() {
3105
3152
  sysLocaleCache = null;
@@ -3110,15 +3157,17 @@
3110
3157
  static fromObject({
3111
3158
  locale,
3112
3159
  numberingSystem,
3113
- outputCalendar
3160
+ outputCalendar,
3161
+ weekSettings
3114
3162
  } = {}) {
3115
- return Locale.create(locale, numberingSystem, outputCalendar);
3163
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
3116
3164
  }
3117
- constructor(locale, numbering, outputCalendar, specifiedLocale) {
3165
+ constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
3118
3166
  const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
3119
3167
  this.locale = parsedLocale;
3120
3168
  this.numberingSystem = numbering || parsedNumberingSystem || null;
3121
3169
  this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
3170
+ this.weekSettings = weekSettings;
3122
3171
  this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
3123
3172
  this.weekdaysCache = {
3124
3173
  format: {},
@@ -3148,7 +3197,7 @@
3148
3197
  if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
3149
3198
  return this;
3150
3199
  } else {
3151
- return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
3200
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
3152
3201
  }
3153
3202
  }
3154
3203
  redefaultToEN(alts = {}) {
@@ -3163,8 +3212,8 @@
3163
3212
  defaultToEN: false
3164
3213
  });
3165
3214
  }
3166
- months(length, format = false, defaultOK = true) {
3167
- return listStuff(this, length, defaultOK, months, () => {
3215
+ months(length, format = false) {
3216
+ return listStuff(this, length, months, () => {
3168
3217
  const intl = format ? {
3169
3218
  month: length,
3170
3219
  day: "numeric"
@@ -3178,8 +3227,8 @@
3178
3227
  return this.monthsCache[formatStr][length];
3179
3228
  });
3180
3229
  }
3181
- weekdays(length, format = false, defaultOK = true) {
3182
- return listStuff(this, length, defaultOK, weekdays, () => {
3230
+ weekdays(length, format = false) {
3231
+ return listStuff(this, length, weekdays, () => {
3183
3232
  const intl = format ? {
3184
3233
  weekday: length,
3185
3234
  year: "numeric",
@@ -3195,8 +3244,8 @@
3195
3244
  return this.weekdaysCache[formatStr][length];
3196
3245
  });
3197
3246
  }
3198
- meridiems(defaultOK = true) {
3199
- return listStuff(this, undefined, defaultOK, () => meridiems, () => {
3247
+ meridiems() {
3248
+ return listStuff(this, undefined, () => meridiems, () => {
3200
3249
  // In theory there could be aribitrary day periods. We're gonna assume there are exactly two
3201
3250
  // for AM and PM. This is probably wrong, but it's makes parsing way easier.
3202
3251
  if (!this.meridiemCache) {
@@ -3209,8 +3258,8 @@
3209
3258
  return this.meridiemCache;
3210
3259
  });
3211
3260
  }
3212
- eras(length, defaultOK = true) {
3213
- return listStuff(this, length, defaultOK, eras, () => {
3261
+ eras(length) {
3262
+ return listStuff(this, length, eras, () => {
3214
3263
  const intl = {
3215
3264
  era: length
3216
3265
  };
@@ -3246,6 +3295,24 @@
3246
3295
  isEnglish() {
3247
3296
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
3248
3297
  }
3298
+ getWeekSettings() {
3299
+ if (this.weekSettings) {
3300
+ return this.weekSettings;
3301
+ } else if (!hasLocaleWeekInfo()) {
3302
+ return fallbackWeekSettings;
3303
+ } else {
3304
+ return getCachedWeekInfo(this.locale);
3305
+ }
3306
+ }
3307
+ getStartOfWeek() {
3308
+ return this.getWeekSettings().firstDay;
3309
+ }
3310
+ getMinDaysInFirstWeek() {
3311
+ return this.getWeekSettings().minimalDays;
3312
+ }
3313
+ getWeekendDays() {
3314
+ return this.getWeekSettings().weekend;
3315
+ }
3249
3316
  equals(other) {
3250
3317
  return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
3251
3318
  }
@@ -3414,7 +3481,7 @@
3414
3481
  if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
3415
3482
  } else if (isNumber$2(input)) {
3416
3483
  return FixedOffsetZone.instance(input);
3417
- } else if (typeof input === "object" && input.offset && typeof input.offset === "number") {
3484
+ } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
3418
3485
  // This is dumb, but the instanceof check above doesn't seem to really work
3419
3486
  // so we're duck checking it
3420
3487
  return input;
@@ -3429,7 +3496,8 @@
3429
3496
  defaultNumberingSystem = null,
3430
3497
  defaultOutputCalendar = null,
3431
3498
  twoDigitCutoffYear = 60,
3432
- throwOnInvalid;
3499
+ throwOnInvalid,
3500
+ defaultWeekSettings = null;
3433
3501
 
3434
3502
  /**
3435
3503
  * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
@@ -3520,6 +3588,31 @@
3520
3588
  defaultOutputCalendar = outputCalendar;
3521
3589
  }
3522
3590
 
3591
+ /**
3592
+ * @typedef {Object} WeekSettings
3593
+ * @property {number} firstDay
3594
+ * @property {number} minimalDays
3595
+ * @property {number[]} weekend
3596
+ */
3597
+
3598
+ /**
3599
+ * @return {WeekSettings|null}
3600
+ */
3601
+ static get defaultWeekSettings() {
3602
+ return defaultWeekSettings;
3603
+ }
3604
+
3605
+ /**
3606
+ * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
3607
+ * how many days are required in the first week of a year.
3608
+ * Does not affect existing instances.
3609
+ *
3610
+ * @param {WeekSettings|null} weekSettings
3611
+ */
3612
+ static set defaultWeekSettings(weekSettings) {
3613
+ defaultWeekSettings = validateWeekSettings(weekSettings);
3614
+ }
3615
+
3523
3616
  /**
3524
3617
  * Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
3525
3618
  * @type {number}
@@ -3531,10 +3624,10 @@
3531
3624
  /**
3532
3625
  * Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
3533
3626
  * @type {number}
3534
- * @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpretted as current century
3627
+ * @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpreted as current century
3535
3628
  * @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
3536
- * @example Settings.twoDigitCutoffYear = 1950 // interpretted as 50
3537
- * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpretted as 50
3629
+ * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
3630
+ * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
3538
3631
  */
3539
3632
  static set twoDigitCutoffYear(cutoffYear) {
3540
3633
  twoDigitCutoffYear = cutoffYear % 100;
@@ -3566,6 +3659,224 @@
3566
3659
  }
3567
3660
  }
3568
3661
 
3662
+ class Invalid {
3663
+ constructor(reason, explanation) {
3664
+ this.reason = reason;
3665
+ this.explanation = explanation;
3666
+ }
3667
+ toMessage() {
3668
+ if (this.explanation) {
3669
+ return `${this.reason}: ${this.explanation}`;
3670
+ } else {
3671
+ return this.reason;
3672
+ }
3673
+ }
3674
+ }
3675
+
3676
+ const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
3677
+ leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
3678
+ function unitOutOfRange(unit, value) {
3679
+ return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
3680
+ }
3681
+ function dayOfWeek(year, month, day) {
3682
+ const d = new Date(Date.UTC(year, month - 1, day));
3683
+ if (year < 100 && year >= 0) {
3684
+ d.setUTCFullYear(d.getUTCFullYear() - 1900);
3685
+ }
3686
+ const js = d.getUTCDay();
3687
+ return js === 0 ? 7 : js;
3688
+ }
3689
+ function computeOrdinal(year, month, day) {
3690
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
3691
+ }
3692
+ function uncomputeOrdinal(year, ordinal) {
3693
+ const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
3694
+ month0 = table.findIndex(i => i < ordinal),
3695
+ day = ordinal - table[month0];
3696
+ return {
3697
+ month: month0 + 1,
3698
+ day
3699
+ };
3700
+ }
3701
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
3702
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
3703
+ }
3704
+
3705
+ /**
3706
+ * @private
3707
+ */
3708
+
3709
+ function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
3710
+ const {
3711
+ year,
3712
+ month,
3713
+ day
3714
+ } = gregObj,
3715
+ ordinal = computeOrdinal(year, month, day),
3716
+ weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
3717
+ let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
3718
+ weekYear;
3719
+ if (weekNumber < 1) {
3720
+ weekYear = year - 1;
3721
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
3722
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
3723
+ weekYear = year + 1;
3724
+ weekNumber = 1;
3725
+ } else {
3726
+ weekYear = year;
3727
+ }
3728
+ return {
3729
+ weekYear,
3730
+ weekNumber,
3731
+ weekday,
3732
+ ...timeObject(gregObj)
3733
+ };
3734
+ }
3735
+ function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
3736
+ const {
3737
+ weekYear,
3738
+ weekNumber,
3739
+ weekday
3740
+ } = weekData,
3741
+ weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
3742
+ yearInDays = daysInYear(weekYear);
3743
+ let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
3744
+ year;
3745
+ if (ordinal < 1) {
3746
+ year = weekYear - 1;
3747
+ ordinal += daysInYear(year);
3748
+ } else if (ordinal > yearInDays) {
3749
+ year = weekYear + 1;
3750
+ ordinal -= daysInYear(weekYear);
3751
+ } else {
3752
+ year = weekYear;
3753
+ }
3754
+ const {
3755
+ month,
3756
+ day
3757
+ } = uncomputeOrdinal(year, ordinal);
3758
+ return {
3759
+ year,
3760
+ month,
3761
+ day,
3762
+ ...timeObject(weekData)
3763
+ };
3764
+ }
3765
+ function gregorianToOrdinal(gregData) {
3766
+ const {
3767
+ year,
3768
+ month,
3769
+ day
3770
+ } = gregData;
3771
+ const ordinal = computeOrdinal(year, month, day);
3772
+ return {
3773
+ year,
3774
+ ordinal,
3775
+ ...timeObject(gregData)
3776
+ };
3777
+ }
3778
+ function ordinalToGregorian(ordinalData) {
3779
+ const {
3780
+ year,
3781
+ ordinal
3782
+ } = ordinalData;
3783
+ const {
3784
+ month,
3785
+ day
3786
+ } = uncomputeOrdinal(year, ordinal);
3787
+ return {
3788
+ year,
3789
+ month,
3790
+ day,
3791
+ ...timeObject(ordinalData)
3792
+ };
3793
+ }
3794
+
3795
+ /**
3796
+ * Check if local week units like localWeekday are used in obj.
3797
+ * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
3798
+ * Modifies obj in-place!
3799
+ * @param obj the object values
3800
+ */
3801
+ function usesLocalWeekValues(obj, loc) {
3802
+ const hasLocaleWeekData = !isUndefined$1(obj.localWeekday) || !isUndefined$1(obj.localWeekNumber) || !isUndefined$1(obj.localWeekYear);
3803
+ if (hasLocaleWeekData) {
3804
+ const hasIsoWeekData = !isUndefined$1(obj.weekday) || !isUndefined$1(obj.weekNumber) || !isUndefined$1(obj.weekYear);
3805
+ if (hasIsoWeekData) {
3806
+ throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
3807
+ }
3808
+ if (!isUndefined$1(obj.localWeekday)) obj.weekday = obj.localWeekday;
3809
+ if (!isUndefined$1(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
3810
+ if (!isUndefined$1(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
3811
+ delete obj.localWeekday;
3812
+ delete obj.localWeekNumber;
3813
+ delete obj.localWeekYear;
3814
+ return {
3815
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
3816
+ startOfWeek: loc.getStartOfWeek()
3817
+ };
3818
+ } else {
3819
+ return {
3820
+ minDaysInFirstWeek: 4,
3821
+ startOfWeek: 1
3822
+ };
3823
+ }
3824
+ }
3825
+ function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
3826
+ const validYear = isInteger(obj.weekYear),
3827
+ validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
3828
+ validWeekday = integerBetween(obj.weekday, 1, 7);
3829
+ if (!validYear) {
3830
+ return unitOutOfRange("weekYear", obj.weekYear);
3831
+ } else if (!validWeek) {
3832
+ return unitOutOfRange("week", obj.weekNumber);
3833
+ } else if (!validWeekday) {
3834
+ return unitOutOfRange("weekday", obj.weekday);
3835
+ } else return false;
3836
+ }
3837
+ function hasInvalidOrdinalData(obj) {
3838
+ const validYear = isInteger(obj.year),
3839
+ validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
3840
+ if (!validYear) {
3841
+ return unitOutOfRange("year", obj.year);
3842
+ } else if (!validOrdinal) {
3843
+ return unitOutOfRange("ordinal", obj.ordinal);
3844
+ } else return false;
3845
+ }
3846
+ function hasInvalidGregorianData(obj) {
3847
+ const validYear = isInteger(obj.year),
3848
+ validMonth = integerBetween(obj.month, 1, 12),
3849
+ validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
3850
+ if (!validYear) {
3851
+ return unitOutOfRange("year", obj.year);
3852
+ } else if (!validMonth) {
3853
+ return unitOutOfRange("month", obj.month);
3854
+ } else if (!validDay) {
3855
+ return unitOutOfRange("day", obj.day);
3856
+ } else return false;
3857
+ }
3858
+ function hasInvalidTimeData(obj) {
3859
+ const {
3860
+ hour,
3861
+ minute,
3862
+ second,
3863
+ millisecond
3864
+ } = obj;
3865
+ const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
3866
+ validMinute = integerBetween(minute, 0, 59),
3867
+ validSecond = integerBetween(second, 0, 59),
3868
+ validMillisecond = integerBetween(millisecond, 0, 999);
3869
+ if (!validHour) {
3870
+ return unitOutOfRange("hour", hour);
3871
+ } else if (!validMinute) {
3872
+ return unitOutOfRange("minute", minute);
3873
+ } else if (!validSecond) {
3874
+ return unitOutOfRange("second", second);
3875
+ } else if (!validMillisecond) {
3876
+ return unitOutOfRange("millisecond", millisecond);
3877
+ } else return false;
3878
+ }
3879
+
3569
3880
  /*
3570
3881
  This is just a junk drawer, containing anything used across multiple classes.
3571
3882
  Because Luxon is small(ish), this should stay small and we won't worry about splitting
@@ -3603,6 +3914,13 @@
3603
3914
  return false;
3604
3915
  }
3605
3916
  }
3917
+ function hasLocaleWeekInfo() {
3918
+ try {
3919
+ return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
3920
+ } catch (e) {
3921
+ return false;
3922
+ }
3923
+ }
3606
3924
 
3607
3925
  // OBJECTS AND ARRAYS
3608
3926
 
@@ -3633,6 +3951,22 @@
3633
3951
  function hasOwnProperty(obj, prop) {
3634
3952
  return Object.prototype.hasOwnProperty.call(obj, prop);
3635
3953
  }
3954
+ function validateWeekSettings(settings) {
3955
+ if (settings == null) {
3956
+ return null;
3957
+ } else if (typeof settings !== "object") {
3958
+ throw new InvalidArgumentError("Week settings must be an object");
3959
+ } else {
3960
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(v => !integerBetween(v, 1, 7))) {
3961
+ throw new InvalidArgumentError("Invalid week settings");
3962
+ }
3963
+ return {
3964
+ firstDay: settings.firstDay,
3965
+ minimalDays: settings.minimalDays,
3966
+ weekend: Array.from(settings.weekend)
3967
+ };
3968
+ }
3969
+ }
3636
3970
 
3637
3971
  // NUMBERS AND STRINGS
3638
3972
 
@@ -3701,22 +4035,30 @@
3701
4035
  }
3702
4036
  }
3703
4037
 
3704
- // covert a calendar object to a local timestamp (epoch, but with the offset baked in)
4038
+ // convert a calendar object to a local timestamp (epoch, but with the offset baked in)
3705
4039
  function objToLocalTS(obj) {
3706
4040
  let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
3707
4041
 
3708
4042
  // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that
3709
4043
  if (obj.year < 100 && obj.year >= 0) {
3710
4044
  d = new Date(d);
3711
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
4045
+ // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not
4046
+ // so if obj.year is in 99, but obj.day makes it roll over into year 100,
4047
+ // the calculations done by Date.UTC are using year 2000 - which is incorrect
4048
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
3712
4049
  }
3713
4050
  return +d;
3714
4051
  }
3715
- function weeksInWeekYear(weekYear) {
3716
- const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7,
3717
- last = weekYear - 1,
3718
- p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
3719
- return p1 === 4 || p2 === 3 ? 53 : 52;
4052
+
4053
+ // adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
4054
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
4055
+ const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
4056
+ return -fwdlw + minDaysInFirstWeek - 1;
4057
+ }
4058
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
4059
+ const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
4060
+ const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
4061
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
3720
4062
  }
3721
4063
  function untruncateYear(year) {
3722
4064
  if (year > 99) {
@@ -3940,6 +4282,9 @@
3940
4282
  return new Formatter(locale, opts);
3941
4283
  }
3942
4284
  static parseFormat(fmt) {
4285
+ // white-space is always considered a literal in user-provided formats
4286
+ // the " " token has a special meaning (see unitForToken)
4287
+
3943
4288
  let current = null,
3944
4289
  currentFull = "",
3945
4290
  bracketed = false;
@@ -3949,7 +4294,7 @@
3949
4294
  if (c === "'") {
3950
4295
  if (currentFull.length > 0) {
3951
4296
  splits.push({
3952
- literal: bracketed,
4297
+ literal: bracketed || /^\s+$/.test(currentFull),
3953
4298
  val: currentFull
3954
4299
  });
3955
4300
  }
@@ -3963,7 +4308,7 @@
3963
4308
  } else {
3964
4309
  if (currentFull.length > 0) {
3965
4310
  splits.push({
3966
- literal: false,
4311
+ literal: /^\s+$/.test(currentFull),
3967
4312
  val: currentFull
3968
4313
  });
3969
4314
  }
@@ -3973,7 +4318,7 @@
3973
4318
  }
3974
4319
  if (currentFull.length > 0) {
3975
4320
  splits.push({
3976
- literal: bracketed,
4321
+ literal: bracketed || /^\s+$/.test(currentFull),
3977
4322
  val: currentFull
3978
4323
  });
3979
4324
  }
@@ -3997,33 +4342,24 @@
3997
4342
  });
3998
4343
  return df.format();
3999
4344
  }
4000
- formatDateTime(dt, opts = {}) {
4001
- const df = this.loc.dtFormatter(dt, {
4345
+ dtFormatter(dt, opts = {}) {
4346
+ return this.loc.dtFormatter(dt, {
4002
4347
  ...this.opts,
4003
4348
  ...opts
4004
4349
  });
4005
- return df.format();
4006
4350
  }
4007
- formatDateTimeParts(dt, opts = {}) {
4008
- const df = this.loc.dtFormatter(dt, {
4009
- ...this.opts,
4010
- ...opts
4011
- });
4012
- return df.formatToParts();
4351
+ formatDateTime(dt, opts) {
4352
+ return this.dtFormatter(dt, opts).format();
4013
4353
  }
4014
- formatInterval(interval, opts = {}) {
4015
- const df = this.loc.dtFormatter(interval.start, {
4016
- ...this.opts,
4017
- ...opts
4018
- });
4354
+ formatDateTimeParts(dt, opts) {
4355
+ return this.dtFormatter(dt, opts).formatToParts();
4356
+ }
4357
+ formatInterval(interval, opts) {
4358
+ const df = this.dtFormatter(interval.start, opts);
4019
4359
  return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
4020
4360
  }
4021
- resolvedOptions(dt, opts = {}) {
4022
- const df = this.loc.dtFormatter(dt, {
4023
- ...this.opts,
4024
- ...opts
4025
- });
4026
- return df.resolvedOptions();
4361
+ resolvedOptions(dt, opts) {
4362
+ return this.dtFormatter(dt, opts).resolvedOptions();
4027
4363
  }
4028
4364
  num(n, p = 0) {
4029
4365
  // we get some perf out of doing this here, annoyingly
@@ -4077,7 +4413,7 @@
4077
4413
  era: length
4078
4414
  }, "era"),
4079
4415
  tokenToString = token => {
4080
- // Where possible: http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles
4416
+ // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols
4081
4417
  switch (token) {
4082
4418
  // ms
4083
4419
  case "S":
@@ -4263,6 +4599,14 @@
4263
4599
  return this.num(dt.weekNumber);
4264
4600
  case "WW":
4265
4601
  return this.num(dt.weekNumber, 2);
4602
+ case "n":
4603
+ return this.num(dt.localWeekNumber);
4604
+ case "nn":
4605
+ return this.num(dt.localWeekNumber, 2);
4606
+ case "ii":
4607
+ return this.num(dt.localWeekYear.toString().slice(-2), 2);
4608
+ case "iiii":
4609
+ return this.num(dt.localWeekYear, 4);
4266
4610
  case "o":
4267
4611
  return this.num(dt.ordinal);
4268
4612
  case "ooo":
@@ -4324,20 +4668,6 @@
4324
4668
  }
4325
4669
  }
4326
4670
 
4327
- class Invalid {
4328
- constructor(reason, explanation) {
4329
- this.reason = reason;
4330
- this.explanation = explanation;
4331
- }
4332
- toMessage() {
4333
- if (this.explanation) {
4334
- return `${this.reason}: ${this.explanation}`;
4335
- } else {
4336
- return this.reason;
4337
- }
4338
- }
4339
- }
4340
-
4341
4671
  /*
4342
4672
  * This file handles parsing for well-specified formats. Here's how it works:
4343
4673
  * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
@@ -4666,27 +4996,60 @@
4666
4996
  };
4667
4997
  return new Duration(conf);
4668
4998
  }
4669
- function antiTrunc(n) {
4670
- return n < 0 ? Math.floor(n) : Math.ceil(n);
4671
- }
4672
-
4673
- // NB: mutates parameters
4674
- function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
4675
- const conv = matrix[toUnit][fromUnit],
4676
- raw = fromMap[fromUnit] / conv,
4677
- sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),
4678
- // ok, so this is wild, but see the matrix in the tests
4679
- added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
4680
- toMap[toUnit] += added;
4681
- fromMap[fromUnit] -= added * conv;
4999
+ function durationToMillis(matrix, vals) {
5000
+ let sum = vals.milliseconds ?? 0;
5001
+ for (const unit of reverseUnits.slice(1)) {
5002
+ if (vals[unit]) {
5003
+ sum += vals[unit] * matrix[unit]["milliseconds"];
5004
+ }
5005
+ }
5006
+ return sum;
4682
5007
  }
4683
5008
 
4684
5009
  // NB: mutates parameters
4685
5010
  function normalizeValues(matrix, vals) {
4686
- reverseUnits.reduce((previous, current) => {
5011
+ // the logic below assumes the overall value of the duration is positive
5012
+ // if this is not the case, factor is used to make it so
5013
+ const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
5014
+ orderedUnits$1.reduceRight((previous, current) => {
4687
5015
  if (!isUndefined$1(vals[current])) {
4688
5016
  if (previous) {
4689
- convert(matrix, vals, previous, vals, current);
5017
+ const previousVal = vals[previous] * factor;
5018
+ const conv = matrix[current][previous];
5019
+
5020
+ // if (previousVal < 0):
5021
+ // lower order unit is negative (e.g. { years: 2, days: -2 })
5022
+ // normalize this by reducing the higher order unit by the appropriate amount
5023
+ // and increasing the lower order unit
5024
+ // this can never make the higher order unit negative, because this function only operates
5025
+ // on positive durations, so the amount of time represented by the lower order unit cannot
5026
+ // be larger than the higher order unit
5027
+ // else:
5028
+ // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })
5029
+ // in this case we attempt to convert as much as possible from the lower order unit into
5030
+ // the higher order one
5031
+ //
5032
+ // Math.floor takes care of both of these cases, rounding away from 0
5033
+ // if previousVal < 0 it makes the absolute value larger
5034
+ // if previousVal >= it makes the absolute value smaller
5035
+ const rollUp = Math.floor(previousVal / conv);
5036
+ vals[current] += rollUp * factor;
5037
+ vals[previous] -= rollUp * conv * factor;
5038
+ }
5039
+ return current;
5040
+ } else {
5041
+ return previous;
5042
+ }
5043
+ }, null);
5044
+
5045
+ // try to convert any decimals into smaller units if possible
5046
+ // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }
5047
+ orderedUnits$1.reduce((previous, current) => {
5048
+ if (!isUndefined$1(vals[current])) {
5049
+ if (previous) {
5050
+ const fraction = vals[previous] % 1;
5051
+ vals[previous] -= fraction;
5052
+ vals[current] += fraction * matrix[previous][current];
4690
5053
  }
4691
5054
  return current;
4692
5055
  } else {
@@ -4980,9 +5343,10 @@
4980
5343
 
4981
5344
  /**
4982
5345
  * Returns a string representation of a Duration with all units included.
4983
- * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
4984
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
4985
- * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.
5346
+ * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
5347
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
5348
+ * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
5349
+ * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
4986
5350
  * @example
4987
5351
  * ```js
4988
5352
  * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
@@ -4992,6 +5356,7 @@
4992
5356
  * ```
4993
5357
  */
4994
5358
  toHuman(opts = {}) {
5359
+ if (!this.isValid) return INVALID$3;
4995
5360
  const l = orderedUnits$1.map(unit => {
4996
5361
  const val = this.values[unit];
4997
5362
  if (isUndefined$1(val)) {
@@ -5077,21 +5442,13 @@
5077
5442
  suppressSeconds: false,
5078
5443
  includePrefix: false,
5079
5444
  format: "extended",
5080
- ...opts
5445
+ ...opts,
5446
+ includeOffset: false
5081
5447
  };
5082
- const value = this.shiftTo("hours", "minutes", "seconds", "milliseconds");
5083
- let fmt = opts.format === "basic" ? "hhmm" : "hh:mm";
5084
- if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {
5085
- fmt += opts.format === "basic" ? "ss" : ":ss";
5086
- if (!opts.suppressMilliseconds || value.milliseconds !== 0) {
5087
- fmt += ".SSS";
5088
- }
5089
- }
5090
- let str = value.toFormat(fmt);
5091
- if (opts.includePrefix) {
5092
- str = "T" + str;
5093
- }
5094
- return str;
5448
+ const dateTime = DateTime.fromMillis(millis, {
5449
+ zone: "UTC"
5450
+ });
5451
+ return dateTime.toISOTime(opts);
5095
5452
  }
5096
5453
 
5097
5454
  /**
@@ -5110,12 +5467,25 @@
5110
5467
  return this.toISO();
5111
5468
  }
5112
5469
 
5470
+ /**
5471
+ * Returns a string representation of this Duration appropriate for the REPL.
5472
+ * @return {string}
5473
+ */
5474
+ [Symbol.for("nodejs.util.inspect.custom")]() {
5475
+ if (this.isValid) {
5476
+ return `Duration { values: ${JSON.stringify(this.values)} }`;
5477
+ } else {
5478
+ return `Duration { Invalid, reason: ${this.invalidReason} }`;
5479
+ }
5480
+ }
5481
+
5113
5482
  /**
5114
5483
  * Returns an milliseconds value of this Duration.
5115
5484
  * @return {number}
5116
5485
  */
5117
5486
  toMillis() {
5118
- return this.as("milliseconds");
5487
+ if (!this.isValid) return NaN;
5488
+ return durationToMillis(this.matrix, this.values);
5119
5489
  }
5120
5490
 
5121
5491
  /**
@@ -5241,8 +5611,17 @@
5241
5611
 
5242
5612
  /**
5243
5613
  * Reduce this Duration to its canonical representation in its current units.
5614
+ * Assuming the overall value of the Duration is positive, this means:
5615
+ * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
5616
+ * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
5617
+ * the overall value would be negative, see third example)
5618
+ * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
5619
+ *
5620
+ * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
5244
5621
  * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
5622
+ * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
5245
5623
  * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
5624
+ * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
5246
5625
  * @return {Duration}
5247
5626
  */
5248
5627
  normalize() {
@@ -5297,16 +5676,13 @@
5297
5676
  if (isNumber$2(vals[k])) {
5298
5677
  own += vals[k];
5299
5678
  }
5679
+
5680
+ // only keep the integer part for now in the hopes of putting any decimal part
5681
+ // into a smaller unit later
5300
5682
  const i = Math.trunc(own);
5301
5683
  built[k] = i;
5302
5684
  accumulated[k] = (own * 1000 - i * 1000) / 1000;
5303
5685
 
5304
- // plus anything further down the chain that should be rolled up in to this
5305
- for (const down in vals) {
5306
- if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
5307
- convert(this.matrix, vals, down, built, k);
5308
- }
5309
- }
5310
5686
  // otherwise, keep it in the wings to boil it later
5311
5687
  } else if (isNumber$2(vals[k])) {
5312
5688
  accumulated[k] = vals[k];
@@ -5320,9 +5696,10 @@
5320
5696
  built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
5321
5697
  }
5322
5698
  }
5699
+ normalizeValues(this.matrix, built);
5323
5700
  return clone$2(this, {
5324
5701
  values: built
5325
- }, true).normalize();
5702
+ }, true);
5326
5703
  }
5327
5704
 
5328
5705
  /**
@@ -5695,13 +6072,23 @@
5695
6072
  * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
5696
6073
  * asks 'what dates are included in this interval?', not 'how many days long is this interval?'
5697
6074
  * @param {string} [unit='milliseconds'] - the unit of time to count.
6075
+ * @param {Object} opts - options
6076
+ * @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
5698
6077
  * @return {number}
5699
6078
  */
5700
- count(unit = "milliseconds") {
6079
+ count(unit = "milliseconds", opts) {
5701
6080
  if (!this.isValid) return NaN;
5702
- const start = this.start.startOf(unit),
5703
- end = this.end.startOf(unit);
5704
- return Math.floor(end.diff(start, unit).get(unit)) + 1;
6081
+ const start = this.start.startOf(unit, opts);
6082
+ let end;
6083
+ if (opts?.useLocaleWeeks) {
6084
+ end = this.end.reconfigure({
6085
+ locale: start.locale
6086
+ });
6087
+ } else {
6088
+ end = this.end;
6089
+ }
6090
+ end = end.startOf(unit, opts);
6091
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
5705
6092
  }
5706
6093
 
5707
6094
  /**
@@ -5773,7 +6160,7 @@
5773
6160
  */
5774
6161
  splitAt(...dateTimes) {
5775
6162
  if (!this.isValid) return [];
5776
- const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort(),
6163
+ const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()),
5777
6164
  results = [];
5778
6165
  let {
5779
6166
  s
@@ -5980,6 +6367,18 @@
5980
6367
  return `[${this.s.toISO()} – ${this.e.toISO()})`;
5981
6368
  }
5982
6369
 
6370
+ /**
6371
+ * Returns a string representation of this Interval appropriate for the REPL.
6372
+ * @return {string}
6373
+ */
6374
+ [Symbol.for("nodejs.util.inspect.custom")]() {
6375
+ if (this.isValid) {
6376
+ return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
6377
+ } else {
6378
+ return `Interval { Invalid, reason: ${this.invalidReason} }`;
6379
+ }
6380
+ }
6381
+
5983
6382
  /**
5984
6383
  * Returns a localized string representing this Interval. Accepts the same options as the
5985
6384
  * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
@@ -6130,6 +6529,50 @@
6130
6529
  return normalizeZone(input, Settings.defaultZone);
6131
6530
  }
6132
6531
 
6532
+ /**
6533
+ * Get the weekday on which the week starts according to the given locale.
6534
+ * @param {Object} opts - options
6535
+ * @param {string} [opts.locale] - the locale code
6536
+ * @param {string} [opts.locObj=null] - an existing locale object to use
6537
+ * @returns {number} the start of the week, 1 for Monday through 7 for Sunday
6538
+ */
6539
+ static getStartOfWeek({
6540
+ locale = null,
6541
+ locObj = null
6542
+ } = {}) {
6543
+ return (locObj || Locale.create(locale)).getStartOfWeek();
6544
+ }
6545
+
6546
+ /**
6547
+ * Get the minimum number of days necessary in a week before it is considered part of the next year according
6548
+ * to the given locale.
6549
+ * @param {Object} opts - options
6550
+ * @param {string} [opts.locale] - the locale code
6551
+ * @param {string} [opts.locObj=null] - an existing locale object to use
6552
+ * @returns {number}
6553
+ */
6554
+ static getMinimumDaysInFirstWeek({
6555
+ locale = null,
6556
+ locObj = null
6557
+ } = {}) {
6558
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
6559
+ }
6560
+
6561
+ /**
6562
+ * Get the weekdays, which are considered the weekend according to the given locale
6563
+ * @param {Object} opts - options
6564
+ * @param {string} [opts.locale] - the locale code
6565
+ * @param {string} [opts.locObj=null] - an existing locale object to use
6566
+ * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
6567
+ */
6568
+ static getWeekendWeekdays({
6569
+ locale = null,
6570
+ locObj = null
6571
+ } = {}) {
6572
+ // copy the array, because we cache it internally
6573
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
6574
+ }
6575
+
6133
6576
  /**
6134
6577
  * Return an array of standalone month names.
6135
6578
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
@@ -6255,12 +6698,14 @@
6255
6698
  * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
6256
6699
  * Keys:
6257
6700
  * * `relative`: whether this environment supports relative time formatting
6258
- * @example Info.features() //=> { relative: false }
6701
+ * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
6702
+ * @example Info.features() //=> { relative: false, localeWeek: true }
6259
6703
  * @return {Object}
6260
6704
  */
6261
6705
  static features() {
6262
6706
  return {
6263
- relative: hasRelative()
6707
+ relative: hasRelative(),
6708
+ localeWeek: hasLocaleWeekInfo()
6264
6709
  };
6265
6710
  }
6266
6711
  }
@@ -6280,14 +6725,35 @@
6280
6725
  const results = {};
6281
6726
  const earlier = cursor;
6282
6727
  let lowestOrder, highWater;
6728
+
6729
+ /* This loop tries to diff using larger units first.
6730
+ If we overshoot, we backtrack and try the next smaller unit.
6731
+ "cursor" starts out at the earlier timestamp and moves closer and closer to "later"
6732
+ as we use smaller and smaller units.
6733
+ highWater keeps track of where we would be if we added one more of the smallest unit,
6734
+ this is used later to potentially convert any difference smaller than the smallest higher order unit
6735
+ into a fraction of that smallest higher order unit
6736
+ */
6283
6737
  for (const [unit, differ] of differs) {
6284
6738
  if (units.indexOf(unit) >= 0) {
6285
6739
  lowestOrder = unit;
6286
6740
  results[unit] = differ(cursor, later);
6287
6741
  highWater = earlier.plus(results);
6288
6742
  if (highWater > later) {
6743
+ // we overshot the end point, backtrack cursor by 1
6289
6744
  results[unit]--;
6290
6745
  cursor = earlier.plus(results);
6746
+
6747
+ // if we are still overshooting now, we need to backtrack again
6748
+ // this happens in certain situations when diffing times in different zones,
6749
+ // because this calculation ignores time zones
6750
+ if (cursor > later) {
6751
+ // keep the "overshot by 1" around as highWater
6752
+ highWater = cursor;
6753
+ // backtrack cursor by 1
6754
+ results[unit]--;
6755
+ cursor = earlier.plus(results);
6756
+ }
6291
6757
  } else {
6292
6758
  cursor = highWater;
6293
6759
  }
@@ -6436,6 +6902,11 @@
6436
6902
  function escapeToken(value) {
6437
6903
  return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
6438
6904
  }
6905
+
6906
+ /**
6907
+ * @param token
6908
+ * @param {Locale} loc
6909
+ */
6439
6910
  function unitForToken(token, loc) {
6440
6911
  const one = digitRegex(loc),
6441
6912
  two = digitRegex(loc, "{2}"),
@@ -6460,9 +6931,9 @@
6460
6931
  switch (t.val) {
6461
6932
  // era
6462
6933
  case "G":
6463
- return oneOf(loc.eras("short", false), 0);
6934
+ return oneOf(loc.eras("short"), 0);
6464
6935
  case "GG":
6465
- return oneOf(loc.eras("long", false), 0);
6936
+ return oneOf(loc.eras("long"), 0);
6466
6937
  // years
6467
6938
  case "y":
6468
6939
  return intUnit(oneToSix);
@@ -6480,17 +6951,17 @@
6480
6951
  case "MM":
6481
6952
  return intUnit(two);
6482
6953
  case "MMM":
6483
- return oneOf(loc.months("short", true, false), 1);
6954
+ return oneOf(loc.months("short", true), 1);
6484
6955
  case "MMMM":
6485
- return oneOf(loc.months("long", true, false), 1);
6956
+ return oneOf(loc.months("long", true), 1);
6486
6957
  case "L":
6487
6958
  return intUnit(oneOrTwo);
6488
6959
  case "LL":
6489
6960
  return intUnit(two);
6490
6961
  case "LLL":
6491
- return oneOf(loc.months("short", false, false), 1);
6962
+ return oneOf(loc.months("short", false), 1);
6492
6963
  case "LLLL":
6493
- return oneOf(loc.months("long", false, false), 1);
6964
+ return oneOf(loc.months("long", false), 1);
6494
6965
  // dates
6495
6966
  case "d":
6496
6967
  return intUnit(oneOrTwo);
@@ -6550,13 +7021,13 @@
6550
7021
  case "c":
6551
7022
  return intUnit(one);
6552
7023
  case "EEE":
6553
- return oneOf(loc.weekdays("short", false, false), 1);
7024
+ return oneOf(loc.weekdays("short", false), 1);
6554
7025
  case "EEEE":
6555
- return oneOf(loc.weekdays("long", false, false), 1);
7026
+ return oneOf(loc.weekdays("long", false), 1);
6556
7027
  case "ccc":
6557
- return oneOf(loc.weekdays("short", true, false), 1);
7028
+ return oneOf(loc.weekdays("short", true), 1);
6558
7029
  case "cccc":
6559
- return oneOf(loc.weekdays("long", true, false), 1);
7030
+ return oneOf(loc.weekdays("long", true), 1);
6560
7031
  // offset/zone
6561
7032
  case "Z":
6562
7033
  case "ZZ":
@@ -6567,6 +7038,10 @@
6567
7038
  // because we don't have any way to figure out what they are
6568
7039
  case "z":
6569
7040
  return simple(/[a-z_+-/]{1,256}?/i);
7041
+ // this special-case "token" represents a place where a macro-token expanded into a white-space literal
7042
+ // in this case we accept any non-newline white-space
7043
+ case " ":
7044
+ return simple(/[^\S\n\r]/);
6570
7045
  default:
6571
7046
  return literal(t);
6572
7047
  }
@@ -6598,10 +7073,14 @@
6598
7073
  },
6599
7074
  dayperiod: "a",
6600
7075
  dayPeriod: "a",
6601
- hour: {
7076
+ hour12: {
6602
7077
  numeric: "h",
6603
7078
  "2-digit": "hh"
6604
7079
  },
7080
+ hour24: {
7081
+ numeric: "H",
7082
+ "2-digit": "HH"
7083
+ },
6605
7084
  minute: {
6606
7085
  numeric: "m",
6607
7086
  "2-digit": "mm"
@@ -6615,19 +7094,40 @@
6615
7094
  short: "ZZZ"
6616
7095
  }
6617
7096
  };
6618
- function tokenForPart(part, formatOpts) {
7097
+ function tokenForPart(part, formatOpts, resolvedOpts) {
6619
7098
  const {
6620
7099
  type,
6621
7100
  value
6622
7101
  } = part;
6623
7102
  if (type === "literal") {
7103
+ const isSpace = /^\s+$/.test(value);
6624
7104
  return {
6625
- literal: true,
6626
- val: value
7105
+ literal: !isSpace,
7106
+ val: isSpace ? " " : value
6627
7107
  };
6628
7108
  }
6629
7109
  const style = formatOpts[type];
6630
- let val = partTypeStyleToTokenVal[type];
7110
+
7111
+ // The user might have explicitly specified hour12 or hourCycle
7112
+ // if so, respect their decision
7113
+ // if not, refer back to the resolvedOpts, which are based on the locale
7114
+ let actualType = type;
7115
+ if (type === "hour") {
7116
+ if (formatOpts.hour12 != null) {
7117
+ actualType = formatOpts.hour12 ? "hour12" : "hour24";
7118
+ } else if (formatOpts.hourCycle != null) {
7119
+ if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
7120
+ actualType = "hour12";
7121
+ } else {
7122
+ actualType = "hour24";
7123
+ }
7124
+ } else {
7125
+ // tokens only differentiate between 24 hours or not,
7126
+ // so we do not need to check hourCycle here, which is less supported anyways
7127
+ actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
7128
+ }
7129
+ }
7130
+ let val = partTypeStyleToTokenVal[actualType];
6631
7131
  if (typeof val === "object") {
6632
7132
  val = val[style];
6633
7133
  }
@@ -6803,178 +7303,10 @@
6803
7303
  return null;
6804
7304
  }
6805
7305
  const formatter = Formatter.create(locale, formatOpts);
6806
- const parts = formatter.formatDateTimeParts(getDummyDateTime());
6807
- return parts.map(p => tokenForPart(p, formatOpts));
6808
- }
6809
-
6810
- const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
6811
- leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
6812
- function unitOutOfRange(unit, value) {
6813
- return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
6814
- }
6815
- function dayOfWeek(year, month, day) {
6816
- const d = new Date(Date.UTC(year, month - 1, day));
6817
- if (year < 100 && year >= 0) {
6818
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
6819
- }
6820
- const js = d.getUTCDay();
6821
- return js === 0 ? 7 : js;
6822
- }
6823
- function computeOrdinal(year, month, day) {
6824
- return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
6825
- }
6826
- function uncomputeOrdinal(year, ordinal) {
6827
- const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
6828
- month0 = table.findIndex(i => i < ordinal),
6829
- day = ordinal - table[month0];
6830
- return {
6831
- month: month0 + 1,
6832
- day
6833
- };
6834
- }
6835
-
6836
- /**
6837
- * @private
6838
- */
6839
-
6840
- function gregorianToWeek(gregObj) {
6841
- const {
6842
- year,
6843
- month,
6844
- day
6845
- } = gregObj,
6846
- ordinal = computeOrdinal(year, month, day),
6847
- weekday = dayOfWeek(year, month, day);
6848
- let weekNumber = Math.floor((ordinal - weekday + 10) / 7),
6849
- weekYear;
6850
- if (weekNumber < 1) {
6851
- weekYear = year - 1;
6852
- weekNumber = weeksInWeekYear(weekYear);
6853
- } else if (weekNumber > weeksInWeekYear(year)) {
6854
- weekYear = year + 1;
6855
- weekNumber = 1;
6856
- } else {
6857
- weekYear = year;
6858
- }
6859
- return {
6860
- weekYear,
6861
- weekNumber,
6862
- weekday,
6863
- ...timeObject(gregObj)
6864
- };
6865
- }
6866
- function weekToGregorian(weekData) {
6867
- const {
6868
- weekYear,
6869
- weekNumber,
6870
- weekday
6871
- } = weekData,
6872
- weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
6873
- yearInDays = daysInYear(weekYear);
6874
- let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
6875
- year;
6876
- if (ordinal < 1) {
6877
- year = weekYear - 1;
6878
- ordinal += daysInYear(year);
6879
- } else if (ordinal > yearInDays) {
6880
- year = weekYear + 1;
6881
- ordinal -= daysInYear(weekYear);
6882
- } else {
6883
- year = weekYear;
6884
- }
6885
- const {
6886
- month,
6887
- day
6888
- } = uncomputeOrdinal(year, ordinal);
6889
- return {
6890
- year,
6891
- month,
6892
- day,
6893
- ...timeObject(weekData)
6894
- };
6895
- }
6896
- function gregorianToOrdinal(gregData) {
6897
- const {
6898
- year,
6899
- month,
6900
- day
6901
- } = gregData;
6902
- const ordinal = computeOrdinal(year, month, day);
6903
- return {
6904
- year,
6905
- ordinal,
6906
- ...timeObject(gregData)
6907
- };
6908
- }
6909
- function ordinalToGregorian(ordinalData) {
6910
- const {
6911
- year,
6912
- ordinal
6913
- } = ordinalData;
6914
- const {
6915
- month,
6916
- day
6917
- } = uncomputeOrdinal(year, ordinal);
6918
- return {
6919
- year,
6920
- month,
6921
- day,
6922
- ...timeObject(ordinalData)
6923
- };
6924
- }
6925
- function hasInvalidWeekData(obj) {
6926
- const validYear = isInteger(obj.weekYear),
6927
- validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
6928
- validWeekday = integerBetween(obj.weekday, 1, 7);
6929
- if (!validYear) {
6930
- return unitOutOfRange("weekYear", obj.weekYear);
6931
- } else if (!validWeek) {
6932
- return unitOutOfRange("week", obj.week);
6933
- } else if (!validWeekday) {
6934
- return unitOutOfRange("weekday", obj.weekday);
6935
- } else return false;
6936
- }
6937
- function hasInvalidOrdinalData(obj) {
6938
- const validYear = isInteger(obj.year),
6939
- validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
6940
- if (!validYear) {
6941
- return unitOutOfRange("year", obj.year);
6942
- } else if (!validOrdinal) {
6943
- return unitOutOfRange("ordinal", obj.ordinal);
6944
- } else return false;
6945
- }
6946
- function hasInvalidGregorianData(obj) {
6947
- const validYear = isInteger(obj.year),
6948
- validMonth = integerBetween(obj.month, 1, 12),
6949
- validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
6950
- if (!validYear) {
6951
- return unitOutOfRange("year", obj.year);
6952
- } else if (!validMonth) {
6953
- return unitOutOfRange("month", obj.month);
6954
- } else if (!validDay) {
6955
- return unitOutOfRange("day", obj.day);
6956
- } else return false;
6957
- }
6958
- function hasInvalidTimeData(obj) {
6959
- const {
6960
- hour,
6961
- minute,
6962
- second,
6963
- millisecond
6964
- } = obj;
6965
- const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
6966
- validMinute = integerBetween(minute, 0, 59),
6967
- validSecond = integerBetween(second, 0, 59),
6968
- validMillisecond = integerBetween(millisecond, 0, 999);
6969
- if (!validHour) {
6970
- return unitOutOfRange("hour", hour);
6971
- } else if (!validMinute) {
6972
- return unitOutOfRange("minute", minute);
6973
- } else if (!validSecond) {
6974
- return unitOutOfRange("second", second);
6975
- } else if (!validMillisecond) {
6976
- return unitOutOfRange("millisecond", millisecond);
6977
- } else return false;
7306
+ const df = formatter.dtFormatter(getDummyDateTime());
7307
+ const parts = df.formatToParts();
7308
+ const resolvedOpts = df.resolvedOptions();
7309
+ return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts));
6978
7310
  }
6979
7311
 
6980
7312
  const INVALID$1 = "Invalid DateTime";
@@ -6984,6 +7316,9 @@
6984
7316
  }
6985
7317
 
6986
7318
  // we cache week data on the DT object and this intermediates the cache
7319
+ /**
7320
+ * @param {DateTime} dt
7321
+ */
6987
7322
  function possiblyCachedWeekData(dt) {
6988
7323
  if (dt.weekData === null) {
6989
7324
  dt.weekData = gregorianToWeek(dt.c);
@@ -6991,6 +7326,16 @@
6991
7326
  return dt.weekData;
6992
7327
  }
6993
7328
 
7329
+ /**
7330
+ * @param {DateTime} dt
7331
+ */
7332
+ function possiblyCachedLocalWeekData(dt) {
7333
+ if (dt.localWeekData === null) {
7334
+ dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
7335
+ }
7336
+ return dt.localWeekData;
7337
+ }
7338
+
6994
7339
  // clone really means, "make a new object with these modifications". all "setters" really use this
6995
7340
  // to create a new object while only changing some of the properties
6996
7341
  function clone$1(inst, alts) {
@@ -7098,7 +7443,7 @@
7098
7443
  setZone,
7099
7444
  zone
7100
7445
  } = opts;
7101
- if (parsed && Object.keys(parsed).length !== 0) {
7446
+ if (parsed && Object.keys(parsed).length !== 0 || parsedZone) {
7102
7447
  const interpretationZone = parsedZone || zone,
7103
7448
  inst = DateTime.fromObject(parsed, {
7104
7449
  ...opts,
@@ -7140,13 +7485,13 @@
7140
7485
  if (extended) {
7141
7486
  c += ":";
7142
7487
  c += padStart(o.c.minute);
7143
- if (o.c.second !== 0 || !suppressSeconds) {
7488
+ if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
7144
7489
  c += ":";
7145
7490
  }
7146
7491
  } else {
7147
7492
  c += padStart(o.c.minute);
7148
7493
  }
7149
- if (o.c.second !== 0 || !suppressSeconds) {
7494
+ if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
7150
7495
  c += padStart(o.c.second);
7151
7496
  if (o.c.millisecond !== 0 || !suppressMilliseconds) {
7152
7497
  c += ".";
@@ -7235,6 +7580,21 @@
7235
7580
  if (!normalized) throw new InvalidUnitError(unit);
7236
7581
  return normalized;
7237
7582
  }
7583
+ function normalizeUnitWithLocalWeeks(unit) {
7584
+ switch (unit.toLowerCase()) {
7585
+ case "localweekday":
7586
+ case "localweekdays":
7587
+ return "localWeekday";
7588
+ case "localweeknumber":
7589
+ case "localweeknumbers":
7590
+ return "localWeekNumber";
7591
+ case "localweekyear":
7592
+ case "localweekyears":
7593
+ return "localWeekYear";
7594
+ default:
7595
+ return normalizeUnit(unit);
7596
+ }
7597
+ }
7238
7598
 
7239
7599
  // this is a dumbed down version of fromObject() that runs about 60% faster
7240
7600
  // but doesn't do any validation, makes a bunch of assumptions about what units
@@ -7369,6 +7729,10 @@
7369
7729
  * @access private
7370
7730
  */
7371
7731
  this.weekData = null;
7732
+ /**
7733
+ * @access private
7734
+ */
7735
+ this.localWeekData = null;
7372
7736
  /**
7373
7737
  * @access private
7374
7738
  */
@@ -7550,13 +7914,16 @@
7550
7914
  * @param {number} obj.weekYear - an ISO week year
7551
7915
  * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
7552
7916
  * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
7917
+ * @param {number} obj.localWeekYear - a week year, according to the locale
7918
+ * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
7919
+ * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
7553
7920
  * @param {number} obj.hour - hour of the day, 0-23
7554
7921
  * @param {number} obj.minute - minute of the hour, 0-59
7555
7922
  * @param {number} obj.second - second of the minute, 0-59
7556
7923
  * @param {number} obj.millisecond - millisecond of the second, 0-999
7557
7924
  * @param {Object} opts - options for creating this DateTime
7558
7925
  * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
7559
- * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
7926
+ * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
7560
7927
  * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
7561
7928
  * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
7562
7929
  * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
@@ -7566,6 +7933,7 @@
7566
7933
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
7567
7934
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
7568
7935
  * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
7936
+ * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
7569
7937
  * @return {DateTime}
7570
7938
  */
7571
7939
  static fromObject(obj, opts = {}) {
@@ -7574,15 +7942,19 @@
7574
7942
  if (!zoneToUse.isValid) {
7575
7943
  return DateTime.invalid(unsupportedZone(zoneToUse));
7576
7944
  }
7945
+ const loc = Locale.fromObject(opts);
7946
+ const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
7947
+ const {
7948
+ minDaysInFirstWeek,
7949
+ startOfWeek
7950
+ } = usesLocalWeekValues(normalized, loc);
7577
7951
  const tsNow = Settings.now(),
7578
7952
  offsetProvis = !isUndefined$1(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
7579
- normalized = normalizeObject(obj, normalizeUnit),
7580
7953
  containsOrdinal = !isUndefined$1(normalized.ordinal),
7581
7954
  containsGregorYear = !isUndefined$1(normalized.year),
7582
7955
  containsGregorMD = !isUndefined$1(normalized.month) || !isUndefined$1(normalized.day),
7583
7956
  containsGregor = containsGregorYear || containsGregorMD,
7584
- definiteWeekDef = normalized.weekYear || normalized.weekNumber,
7585
- loc = Locale.fromObject(opts);
7957
+ definiteWeekDef = normalized.weekYear || normalized.weekNumber;
7586
7958
 
7587
7959
  // cases:
7588
7960
  // just a weekday -> this week's instance of that weekday, no worries
@@ -7605,7 +7977,7 @@
7605
7977
  if (useWeekData) {
7606
7978
  units = orderedWeekUnits;
7607
7979
  defaultValues = defaultWeekUnitValues;
7608
- objNow = gregorianToWeek(objNow);
7980
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
7609
7981
  } else if (containsOrdinal) {
7610
7982
  units = orderedOrdinalUnits;
7611
7983
  defaultValues = defaultOrdinalUnitValues;
@@ -7629,14 +8001,14 @@
7629
8001
  }
7630
8002
 
7631
8003
  // make sure the values we have are in range
7632
- const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
8004
+ const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
7633
8005
  invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
7634
8006
  if (invalid) {
7635
8007
  return DateTime.invalid(invalid);
7636
8008
  }
7637
8009
 
7638
8010
  // compute the actual time
7639
- const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
8011
+ const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
7640
8012
  [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),
7641
8013
  inst = new DateTime({
7642
8014
  ts: tsFinal,
@@ -7780,7 +8152,7 @@
7780
8152
 
7781
8153
  /**
7782
8154
  * Create an invalid DateTime.
7783
- * @param {DateTime} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent
8155
+ * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
7784
8156
  * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
7785
8157
  * @return {DateTime}
7786
8158
  */
@@ -8015,6 +8387,43 @@
8015
8387
  return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
8016
8388
  }
8017
8389
 
8390
+ /**
8391
+ * Returns true if this date is on a weekend according to the locale, false otherwise
8392
+ * @returns {boolean}
8393
+ */
8394
+ get isWeekend() {
8395
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
8396
+ }
8397
+
8398
+ /**
8399
+ * Get the day of the week according to the locale.
8400
+ * 1 is the first day of the week and 7 is the last day of the week.
8401
+ * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
8402
+ * @returns {number}
8403
+ */
8404
+ get localWeekday() {
8405
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
8406
+ }
8407
+
8408
+ /**
8409
+ * Get the week number of the week year according to the locale. Different locales assign week numbers differently,
8410
+ * because the week can start on different days of the week (see localWeekday) and because a different number of days
8411
+ * is required for a week to count as the first week of a year.
8412
+ * @returns {number}
8413
+ */
8414
+ get localWeekNumber() {
8415
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
8416
+ }
8417
+
8418
+ /**
8419
+ * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
8420
+ * differently, see localWeekNumber.
8421
+ * @returns {number}
8422
+ */
8423
+ get localWeekYear() {
8424
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
8425
+ }
8426
+
8018
8427
  /**
8019
8428
  * Get the ordinal (meaning the day of the year)
8020
8429
  * @example DateTime.local(2017, 5, 25).ordinal //=> 145
@@ -8139,6 +8548,41 @@
8139
8548
  }
8140
8549
  }
8141
8550
 
8551
+ /**
8552
+ * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
8553
+ * in this DateTime's zone. During DST changes local time can be ambiguous, for example
8554
+ * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
8555
+ * This method will return both possible DateTimes if this DateTime's local time is ambiguous.
8556
+ * @returns {DateTime[]}
8557
+ */
8558
+ getPossibleOffsets() {
8559
+ if (!this.isValid || this.isOffsetFixed) {
8560
+ return [this];
8561
+ }
8562
+ const dayMs = 86400000;
8563
+ const minuteMs = 60000;
8564
+ const localTS = objToLocalTS(this.c);
8565
+ const oEarlier = this.zone.offset(localTS - dayMs);
8566
+ const oLater = this.zone.offset(localTS + dayMs);
8567
+ const o1 = this.zone.offset(localTS - oEarlier * minuteMs);
8568
+ const o2 = this.zone.offset(localTS - oLater * minuteMs);
8569
+ if (o1 === o2) {
8570
+ return [this];
8571
+ }
8572
+ const ts1 = localTS - o1 * minuteMs;
8573
+ const ts2 = localTS - o2 * minuteMs;
8574
+ const c1 = tsToObj(ts1, o1);
8575
+ const c2 = tsToObj(ts2, o2);
8576
+ if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
8577
+ return [clone$1(this, {
8578
+ ts: ts1
8579
+ }), clone$1(this, {
8580
+ ts: ts2
8581
+ })];
8582
+ }
8583
+ return [this];
8584
+ }
8585
+
8142
8586
  /**
8143
8587
  * Returns true if this DateTime is in a leap year, false otherwise
8144
8588
  * @example DateTime.local(2016).isInLeapYear //=> true
@@ -8180,6 +8624,16 @@
8180
8624
  return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
8181
8625
  }
8182
8626
 
8627
+ /**
8628
+ * Returns the number of weeks in this DateTime's local week year
8629
+ * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
8630
+ * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
8631
+ * @type {number}
8632
+ */
8633
+ get weeksInLocalWeekYear() {
8634
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
8635
+ }
8636
+
8183
8637
  /**
8184
8638
  * Returns the resolved Intl options for this DateTime.
8185
8639
  * This is useful in understanding the behavior of formatting methods
@@ -8291,6 +8745,9 @@
8291
8745
  /**
8292
8746
  * "Set" the values of specified units. Returns a newly-constructed DateTime.
8293
8747
  * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
8748
+ *
8749
+ * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
8750
+ * They cannot be mixed with ISO-week units like `weekday`.
8294
8751
  * @param {Object} values - a mapping of units to numbers
8295
8752
  * @example dt.set({ year: 2017 })
8296
8753
  * @example dt.set({ hour: 8, minute: 30 })
@@ -8300,8 +8757,12 @@
8300
8757
  */
8301
8758
  set(values) {
8302
8759
  if (!this.isValid) return this;
8303
- const normalized = normalizeObject(values, normalizeUnit),
8304
- settingWeekStuff = !isUndefined$1(normalized.weekYear) || !isUndefined$1(normalized.weekNumber) || !isUndefined$1(normalized.weekday),
8760
+ const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
8761
+ const {
8762
+ minDaysInFirstWeek,
8763
+ startOfWeek
8764
+ } = usesLocalWeekValues(normalized, this.loc);
8765
+ const settingWeekStuff = !isUndefined$1(normalized.weekYear) || !isUndefined$1(normalized.weekNumber) || !isUndefined$1(normalized.weekday),
8305
8766
  containsOrdinal = !isUndefined$1(normalized.ordinal),
8306
8767
  containsGregorYear = !isUndefined$1(normalized.year),
8307
8768
  containsGregorMD = !isUndefined$1(normalized.month) || !isUndefined$1(normalized.day),
@@ -8316,9 +8777,9 @@
8316
8777
  let mixed;
8317
8778
  if (settingWeekStuff) {
8318
8779
  mixed = weekToGregorian({
8319
- ...gregorianToWeek(this.c),
8780
+ ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
8320
8781
  ...normalized
8321
- });
8782
+ }, minDaysInFirstWeek, startOfWeek);
8322
8783
  } else if (!isUndefined$1(normalized.ordinal)) {
8323
8784
  mixed = ordinalToGregorian({
8324
8785
  ...gregorianToOrdinal(this.c),
@@ -8377,6 +8838,8 @@
8377
8838
  /**
8378
8839
  * "Set" this DateTime to the beginning of a unit of time.
8379
8840
  * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
8841
+ * @param {Object} opts - options
8842
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
8380
8843
  * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
8381
8844
  * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
8382
8845
  * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
@@ -8384,7 +8847,9 @@
8384
8847
  * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
8385
8848
  * @return {DateTime}
8386
8849
  */
8387
- startOf(unit) {
8850
+ startOf(unit, {
8851
+ useLocaleWeeks = false
8852
+ } = {}) {
8388
8853
  if (!this.isValid) return this;
8389
8854
  const o = {},
8390
8855
  normalizedUnit = Duration.normalizeUnit(unit);
@@ -8413,7 +8878,18 @@
8413
8878
  }
8414
8879
 
8415
8880
  if (normalizedUnit === "weeks") {
8416
- o.weekday = 1;
8881
+ if (useLocaleWeeks) {
8882
+ const startOfWeek = this.loc.getStartOfWeek();
8883
+ const {
8884
+ weekday
8885
+ } = this;
8886
+ if (weekday < startOfWeek) {
8887
+ o.weekNumber = this.weekNumber - 1;
8888
+ }
8889
+ o.weekday = startOfWeek;
8890
+ } else {
8891
+ o.weekday = 1;
8892
+ }
8417
8893
  }
8418
8894
  if (normalizedUnit === "quarters") {
8419
8895
  const q = Math.ceil(this.month / 3);
@@ -8425,6 +8901,8 @@
8425
8901
  /**
8426
8902
  * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
8427
8903
  * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
8904
+ * @param {Object} opts - options
8905
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
8428
8906
  * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
8429
8907
  * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
8430
8908
  * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
@@ -8432,10 +8910,10 @@
8432
8910
  * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
8433
8911
  * @return {DateTime}
8434
8912
  */
8435
- endOf(unit) {
8913
+ endOf(unit, opts) {
8436
8914
  return this.isValid ? this.plus({
8437
8915
  [unit]: 1
8438
- }).startOf(unit).minus(1) : this;
8916
+ }).startOf(unit, opts).minus(1) : this;
8439
8917
  }
8440
8918
 
8441
8919
  // OUTPUT
@@ -8675,6 +9153,18 @@
8675
9153
  return this.isValid ? this.toISO() : INVALID$1;
8676
9154
  }
8677
9155
 
9156
+ /**
9157
+ * Returns a string representation of this DateTime appropriate for the REPL.
9158
+ * @return {string}
9159
+ */
9160
+ [Symbol.for("nodejs.util.inspect.custom")]() {
9161
+ if (this.isValid) {
9162
+ return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
9163
+ } else {
9164
+ return `DateTime { Invalid, reason: ${this.invalidReason} }`;
9165
+ }
9166
+ }
9167
+
8678
9168
  /**
8679
9169
  * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
8680
9170
  * @return {number}
@@ -8812,16 +9302,18 @@
8812
9302
  * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
8813
9303
  * @param {DateTime} otherDateTime - the other DateTime
8814
9304
  * @param {string} unit - the unit of time to check sameness on
9305
+ * @param {Object} opts - options
9306
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
8815
9307
  * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
8816
9308
  * @return {boolean}
8817
9309
  */
8818
- hasSame(otherDateTime, unit) {
9310
+ hasSame(otherDateTime, unit, opts) {
8819
9311
  if (!this.isValid) return false;
8820
9312
  const inputMs = otherDateTime.valueOf();
8821
9313
  const adjustedToZone = this.setZone(otherDateTime.zone, {
8822
9314
  keepLocalTime: true
8823
9315
  });
8824
- return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
9316
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
8825
9317
  }
8826
9318
 
8827
9319
  /**
@@ -14929,7 +15421,7 @@
14929
15421
  function isString$1(obj) {
14930
15422
  return typeof obj === 'string';
14931
15423
  }
14932
- function equals(a, b) {
15424
+ function equals(a, b, strict = false) {
14933
15425
  if (a === null && b !== null || a !== null && b === null) {
14934
15426
  return false;
14935
15427
  }
@@ -14941,6 +15433,23 @@
14941
15433
  }
14942
15434
  const aType = getType(a);
14943
15435
  const bType = getType(b);
15436
+ const temporalTypes = ['date time', 'time', 'date'];
15437
+ if (temporalTypes.includes(aType)) {
15438
+ if (!temporalTypes.includes(bType)) {
15439
+ return null;
15440
+ }
15441
+ if (aType === 'time' && bType !== 'time') {
15442
+ return null;
15443
+ }
15444
+ if (bType === 'time' && aType !== 'time') {
15445
+ return null;
15446
+ }
15447
+ if (strict || a.zone === SystemZone.instance || b.zone === SystemZone.instance) {
15448
+ return a.equals(b);
15449
+ } else {
15450
+ return a.toUTC().valueOf() === b.toUTC().valueOf();
15451
+ }
15452
+ }
14944
15453
  if (aType !== bType) {
14945
15454
  return null;
14946
15455
  }
@@ -14953,9 +15462,6 @@
14953
15462
  }
14954
15463
  return a.every((element, idx) => equals(element, b[idx]));
14955
15464
  }
14956
- if (aType === 'date time' || aType === 'time' || aType === 'date') {
14957
- return a.toUTC().valueOf() === b.toUTC().valueOf();
14958
- }
14959
15465
  if (aType === 'duration') {
14960
15466
  // years and months duration -> months
14961
15467
  if (Math.abs(a.as('days')) > 180) {
@@ -14992,8 +15498,35 @@
14992
15498
  let params;
14993
15499
  if (isArray$2(contextOrArgs)) {
14994
15500
  params = contextOrArgs;
15501
+ // reject
15502
+ if (params.length > this.parameterNames.length) {
15503
+ const lastParam = this.parameterNames[this.parameterNames.length - 1];
15504
+ // strictly check for parameter count provided
15505
+ // for non var-args functions
15506
+ if (!lastParam || !lastParam.startsWith('...')) {
15507
+ return null;
15508
+ }
15509
+ }
14995
15510
  } else {
14996
- params = this.parameterNames.map(n => contextOrArgs[n]);
15511
+ // strictly check for required parameter names,
15512
+ // and fail on wrong parameter name
15513
+ if (Object.keys(contextOrArgs).some(key => !this.parameterNames.includes(key) && !this.parameterNames.includes(`...${key}`))) {
15514
+ return null;
15515
+ }
15516
+ params = this.parameterNames.reduce((params, name) => {
15517
+ if (name.startsWith('...')) {
15518
+ name = name.slice(3);
15519
+ const value = contextOrArgs[name];
15520
+ if (!value) {
15521
+ return params;
15522
+ } else {
15523
+ // ensure that single arg provided for var args named
15524
+ // parameter is wrapped in a list
15525
+ return [...params, ...(isArray$2(value) ? value : [value])];
15526
+ }
15527
+ }
15528
+ return [...params, contextOrArgs[name]];
15529
+ }, []);
14997
15530
  }
14998
15531
  return this.fn.call(null, ...params);
14999
15532
  }
@@ -15050,7 +15583,7 @@
15050
15583
  if (str) {
15051
15584
  throw new Error('<str> and <time> provided');
15052
15585
  }
15053
- return date(`1900-01-01T${time}`);
15586
+ return date(`1900-01-01T${time}`, null);
15054
15587
  }
15055
15588
  if (typeof str === 'string') {
15056
15589
  if (str.startsWith('-')) {
@@ -15058,7 +15591,7 @@
15058
15591
  }
15059
15592
  if (!str.includes('T')) {
15060
15593
  // raw dates are in UTC time zone
15061
- return date(str + 'T00:00:00.000Z');
15594
+ return date(str + 'T00:00:00', null, zone || FixedOffsetZone.utcInstance);
15062
15595
  }
15063
15596
  if (str.includes('@')) {
15064
15597
  if (zone) {
@@ -15078,11 +15611,25 @@
15078
15611
  // 10.3.4 Built-in functions
15079
15612
  const builtins$1 = {
15080
15613
  // 10.3.4.1 Conversion functions
15081
- 'number': function () {
15082
- throw notImplemented('number');
15083
- },
15614
+ 'number': fn(function (from, groupingSeparator, decimalSeparator) {
15615
+ // must always provide three arguments
15616
+ if (arguments.length !== 3) {
15617
+ return null;
15618
+ }
15619
+ if (groupingSeparator) {
15620
+ from = from.split(groupingSeparator).join('');
15621
+ }
15622
+ if (decimalSeparator && decimalSeparator !== '.') {
15623
+ from = from.split('.').join('#').split(decimalSeparator).join('.');
15624
+ }
15625
+ const number = +from;
15626
+ if (isNaN(number)) {
15627
+ return null;
15628
+ }
15629
+ return number;
15630
+ }, ['string', 'string?', 'string?'], ['from', 'grouping separator', 'decimal separator']),
15084
15631
  'string': fn(function (from) {
15085
- if (arguments.length !== 1) {
15632
+ if (from === null) {
15086
15633
  return null;
15087
15634
  }
15088
15635
  return toString$3(from);
@@ -15116,10 +15663,11 @@
15116
15663
  'date and time': fn(function (d, time, from) {
15117
15664
  let dt;
15118
15665
  if (isDateTime(d) && isDateTime(time)) {
15666
+ const dLocal = d.toLocal();
15119
15667
  dt = time.set({
15120
- year: d.year,
15121
- month: d.month,
15122
- day: d.day
15668
+ year: dLocal.year,
15669
+ month: dLocal.month,
15670
+ day: dLocal.day
15123
15671
  });
15124
15672
  }
15125
15673
  if (isString$1(d)) {
@@ -15127,7 +15675,7 @@
15127
15675
  d = null;
15128
15676
  }
15129
15677
  if (isString$1(from)) {
15130
- dt = date(from);
15678
+ dt = date(from, null, from.includes('@') ? null : SystemZone.instance);
15131
15679
  }
15132
15680
  return dt && ifValid(dt) || null;
15133
15681
  }, ['any?', 'time?', 'string?'], ['date', 'time', 'from']),
@@ -15230,6 +15778,10 @@
15230
15778
  'contains': fn(function (string, match) {
15231
15779
  return string.includes(match);
15232
15780
  }, ['string', 'string']),
15781
+ // eslint-disable-next-line
15782
+ 'matches': fn(function (input, pattern, flags) {
15783
+ throw notImplemented('matches');
15784
+ }, ['string', 'string', 'string?']),
15233
15785
  'starts with': fn(function (string, match) {
15234
15786
  return string.startsWith(match);
15235
15787
  }, ['string', 'string']),
@@ -15239,27 +15791,42 @@
15239
15791
  'split': fn(function (string, delimiter) {
15240
15792
  return string.split(new RegExp(delimiter, 'u'));
15241
15793
  }, ['string', 'string']),
15794
+ 'string join': fn(function (list, delimiter) {
15795
+ if (list.some(e => !isString$1(e) && e !== null)) {
15796
+ return null;
15797
+ }
15798
+ return list.filter(l => l !== null).join(delimiter || '');
15799
+ }, ['list', 'string?']),
15242
15800
  // 10.3.4.4 List functions
15243
15801
  'list contains': fn(function (list, element) {
15244
15802
  return list.some(el => matches$2(el, element));
15245
15803
  }, ['list', 'any?']),
15804
+ // list replace(list, position, newItem)
15805
+ // list replace(list, match, newItem)
15806
+ 'list replace': fn(function (list, position, newItem, match) {
15807
+ const matcher = position || match;
15808
+ if (!['number', 'function'].includes(getType(matcher))) {
15809
+ return null;
15810
+ }
15811
+ return listReplace(list, position || match, newItem);
15812
+ }, ['list', 'any?', 'any', 'function?']),
15246
15813
  'count': fn(function (list) {
15247
15814
  return list.length;
15248
15815
  }, ['list']),
15249
- 'min': listFn(function (list) {
15816
+ 'min': listFn(function (...list) {
15250
15817
  return list.reduce((min, el) => min === null ? el : Math.min(min, el), null);
15251
15818
  }, 'number'),
15252
- 'max': listFn(function (list) {
15819
+ 'max': listFn(function (...list) {
15253
15820
  return list.reduce((max, el) => max === null ? el : Math.max(max, el), null);
15254
15821
  }, 'number'),
15255
- 'sum': listFn(function (list) {
15822
+ 'sum': listFn(function (...list) {
15256
15823
  return sum(list);
15257
15824
  }, 'number'),
15258
- 'mean': listFn(function (list) {
15825
+ 'mean': listFn(function (...list) {
15259
15826
  const s = sum(list);
15260
15827
  return s === null ? s : s / list.length;
15261
15828
  }, 'number'),
15262
- 'all': listFn(function (list) {
15829
+ 'all': listFn(function (...list) {
15263
15830
  let nonBool = false;
15264
15831
  for (const o of list) {
15265
15832
  if (o === false) {
@@ -15271,7 +15838,7 @@
15271
15838
  }
15272
15839
  return nonBool ? null : true;
15273
15840
  }, 'any?'),
15274
- 'any': listFn(function (list) {
15841
+ 'any': listFn(function (...list) {
15275
15842
  let nonBool = false;
15276
15843
  for (const o of list) {
15277
15844
  if (o === true) {
@@ -15312,7 +15879,7 @@
15312
15879
  return result;
15313
15880
  }, []);
15314
15881
  }, ['list', 'any']),
15315
- 'union': listFn(function (lists) {
15882
+ 'union': listFn(function (...lists) {
15316
15883
  return lists.reduce((result, list) => {
15317
15884
  return list.reduce((result, e) => {
15318
15885
  if (!result.some(r => equals(e, r))) {
@@ -15333,7 +15900,7 @@
15333
15900
  'flatten': fn(function (list) {
15334
15901
  return flatten$1(list);
15335
15902
  }, ['list']),
15336
- 'product': listFn(function (list) {
15903
+ 'product': listFn(function (...list) {
15337
15904
  if (list.length === 0) {
15338
15905
  return null;
15339
15906
  }
@@ -15341,19 +15908,19 @@
15341
15908
  return result * n;
15342
15909
  }, 1);
15343
15910
  }, 'number'),
15344
- 'median': listFn(function (list) {
15911
+ 'median': listFn(function (...list) {
15345
15912
  if (list.length === 0) {
15346
15913
  return null;
15347
15914
  }
15348
15915
  return median(list);
15349
15916
  }, 'number'),
15350
- 'stddev': listFn(function (list) {
15917
+ 'stddev': listFn(function (...list) {
15351
15918
  if (list.length < 2) {
15352
15919
  return null;
15353
15920
  }
15354
15921
  return stddev(list);
15355
15922
  }, 'number'),
15356
- 'mode': listFn(function (list) {
15923
+ 'mode': listFn(function (...list) {
15357
15924
  return mode(list);
15358
15925
  }, 'number'),
15359
15926
  // 10.3.4.5 Numeric functions
@@ -15364,18 +15931,42 @@
15364
15931
  const offset = Math.pow(10, scale);
15365
15932
  return round$1(n * offset) / offset;
15366
15933
  }, ['number', 'number']),
15367
- 'floor': fn(function (n) {
15368
- return Math.floor(n);
15369
- }, ['number']),
15370
- 'ceiling': fn(function (n) {
15371
- return Math.ceil(n) + 0;
15372
- }, ['number']),
15934
+ 'floor': fn(function (n, scale = 0) {
15935
+ if (scale === null) {
15936
+ return null;
15937
+ }
15938
+ const adjust = Math.pow(10, scale);
15939
+ return Math.floor(n * adjust) / adjust;
15940
+ }, ['number', 'number?']),
15941
+ 'ceiling': fn(function (n, scale = 0) {
15942
+ if (scale === null) {
15943
+ return null;
15944
+ }
15945
+ const adjust = Math.pow(10, scale);
15946
+ return Math.ceil(n * adjust) / adjust;
15947
+ }, ['number', 'number?']),
15373
15948
  'abs': fn(function (n) {
15374
15949
  if (typeof n !== 'number') {
15375
15950
  return null;
15376
15951
  }
15377
15952
  return Math.abs(n);
15378
15953
  }, ['number']),
15954
+ // eslint-disable-next-line
15955
+ 'round up': fn(function (n, scale) {
15956
+ throw notImplemented('round up');
15957
+ }, ['number', 'number']),
15958
+ // eslint-disable-next-line
15959
+ 'round down': fn(function (n, scale) {
15960
+ throw notImplemented('round down');
15961
+ }, ['number', 'number']),
15962
+ // eslint-disable-next-line
15963
+ 'round half up': fn(function (n, scale) {
15964
+ throw notImplemented('round half up');
15965
+ }, ['number', 'number']),
15966
+ // eslint-disable-next-line
15967
+ 'round half down': fn(function (n, scale) {
15968
+ throw notImplemented('round half down');
15969
+ }, ['number', 'number']),
15379
15970
  'modulo': fn(function (dividend, divisor) {
15380
15971
  if (!divisor) {
15381
15972
  return null;
@@ -15413,7 +16004,7 @@
15413
16004
  if (typeof value1 === 'undefined' || typeof value2 === 'undefined') {
15414
16005
  return false;
15415
16006
  }
15416
- return equals(value1, value2);
16007
+ return equals(value1, value2, true);
15417
16008
  }, ['any?', 'any?']),
15418
16009
  // 10.3.4.7 Range Functions
15419
16010
  'before': fn(function (a, b) {
@@ -15423,14 +16014,14 @@
15423
16014
  return before(b, a);
15424
16015
  }, ['any', 'any']),
15425
16016
  'meets': fn(function (a, b) {
15426
- return meets(a, b);
16017
+ return meetsRange(a, b);
15427
16018
  }, ['range', 'range']),
15428
16019
  'met by': fn(function (a, b) {
15429
- return meets(b, a);
16020
+ return meetsRange(b, a);
16021
+ }, ['range', 'range']),
16022
+ 'overlaps': fn(function (range1, range2) {
16023
+ return !before(range1, range2) && !before(range2, range1);
15430
16024
  }, ['range', 'range']),
15431
- 'overlaps': fn(function () {
15432
- throw notImplemented('overlaps');
15433
- }, ['any?']),
15434
16025
  'overlaps before': fn(function () {
15435
16026
  throw notImplemented('overlaps before');
15436
16027
  }, ['any?']),
@@ -15459,22 +16050,22 @@
15459
16050
  throw notImplemented('coincides');
15460
16051
  }, ['any?']),
15461
16052
  // 10.3.4.8 Temporal built-in functions
15462
- 'day of year': fn(function () {
15463
- throw notImplemented('day of year');
15464
- }, ['any?']),
15465
- 'day of week': fn(function () {
15466
- throw notImplemented('day of week');
15467
- }, ['any?']),
15468
- 'month of year': fn(function () {
15469
- throw notImplemented('month of year');
15470
- }, ['any?']),
15471
- 'week of year': fn(function () {
15472
- throw notImplemented('week of year');
15473
- }, ['any?']),
16053
+ 'day of year': fn(function (date) {
16054
+ return date.ordinal;
16055
+ }, ['date time']),
16056
+ 'day of week': fn(function (date) {
16057
+ return date.weekdayLong;
16058
+ }, ['date time']),
16059
+ 'month of year': fn(function (date) {
16060
+ return date.monthLong;
16061
+ }, ['date time']),
16062
+ 'week of year': fn(function (date) {
16063
+ return date.weekNumber;
16064
+ }, ['date time']),
15474
16065
  // 10.3.4.9 Sort
15475
- 'sort': function () {
15476
- throw notImplemented('sort');
15477
- },
16066
+ 'sort': fn(function (list, precedes) {
16067
+ return Array.from(list).sort((a, b) => precedes.invoke([a, b]) ? -1 : 1);
16068
+ }, ['list', 'function']),
15478
16069
  // 10.3.4.10 Context function
15479
16070
  'get value': fn(function (m, key) {
15480
16071
  return getFromContext(key, m);
@@ -15491,16 +16082,60 @@
15491
16082
  value
15492
16083
  }));
15493
16084
  }, ['context']),
15494
- 'context': listFn(function (_contexts) {
15495
- throw notImplemented('context');
16085
+ 'context': listFn(function (...entries) {
16086
+ const context = entries.reduce((context, entry) => {
16087
+ if (context === FALSE || !['key', 'value'].every(e => e in entry)) {
16088
+ return FALSE;
16089
+ }
16090
+ const key = entry.key;
16091
+ if (key === null) {
16092
+ return FALSE;
16093
+ }
16094
+ if (key in context) {
16095
+ return FALSE;
16096
+ }
16097
+ return Object.assign(Object.assign({}, context), {
16098
+ [entry.key]: entry.value
16099
+ });
16100
+ }, {});
16101
+ if (context === FALSE) {
16102
+ return null;
16103
+ }
16104
+ return context;
15496
16105
  }, 'context'),
15497
- 'context merge': listFn(function (_contexts) {
15498
- throw notImplemented('context merge');
16106
+ 'context merge': listFn(function (...contexts) {
16107
+ return Object.assign({}, ...contexts);
15499
16108
  }, 'context'),
15500
- 'context put': fn(function (_context, _keys, _value) {
15501
- throw notImplemented('context put');
15502
- }, ['context', 'list', 'any'])
16109
+ 'context put': fn(function (context, keys, value, key) {
16110
+ if (typeof keys === 'undefined' && typeof key === 'undefined') {
16111
+ return null;
16112
+ }
16113
+ return contextPut(context, keys || [key], value);
16114
+ }, ['context', 'list?', 'any', 'string?'], ['context', 'keys', 'value', 'key'])
15503
16115
  };
16116
+ /**
16117
+ * @param {Object} context
16118
+ * @param {string[]} keys
16119
+ * @param {any} value
16120
+ */
16121
+ function contextPut(context, keys, value) {
16122
+ const [key, ...remainingKeys] = keys;
16123
+ if (getType(key) !== 'string') {
16124
+ return null;
16125
+ }
16126
+ if (getType(context) === 'nil') {
16127
+ return null;
16128
+ }
16129
+ if (remainingKeys.length) {
16130
+ value = contextPut(context[key], remainingKeys, value);
16131
+ if (value === null) {
16132
+ return null;
16133
+ }
16134
+ }
16135
+ return Object.assign(Object.assign({}, context), {
16136
+ [key]: value
16137
+ });
16138
+ }
15504
16139
  function matches$2(a, b) {
15505
16140
  return a === b;
15506
16141
  }
@@ -15515,23 +16150,20 @@
15515
16150
  return obj;
15516
16151
  } else {
15517
16152
  // implicit conversion obj => [ obj ]
15518
- return [obj];
16153
+ return obj === null ? FALSE : [obj];
15519
16154
  }
15520
16155
  }
15521
16156
  if (type !== 'any' && arr && obj.length === 1) {
15522
16157
  // implicit conversion [ obj ] => obj
15523
16158
  obj = obj[0];
15524
16159
  }
15525
- if (type === 'range') {
15526
- return obj instanceof Range$1 ? obj : FALSE;
15527
- }
15528
16160
  const objType = getType(obj);
16161
+ if (type === 'any' || type === objType) {
16162
+ return optional ? obj : typeof obj !== 'undefined' ? obj : FALSE;
16163
+ }
15529
16164
  if (objType === 'nil') {
15530
16165
  return optional ? obj : FALSE;
15531
16166
  }
15532
- if (type === 'any' || type === objType) {
15533
- return obj;
15534
- }
15535
16167
  return typeCast(obj, type) || FALSE;
15536
16168
  };
15537
16169
  }
@@ -15575,7 +16207,7 @@
15575
16207
  if (!args.every(arg => tester(arg) !== FALSE)) {
15576
16208
  return null;
15577
16209
  }
15578
- return fnDefinition(args);
16210
+ return fnDefinition(...args);
15579
16211
  };
15580
16212
  wrappedFn.$args = parameterNames || parseParameterNames(fnDefinition);
15581
16213
  return wrappedFn;
@@ -15600,9 +16232,17 @@
15600
16232
  wrappedFn.$args = parameterNames;
15601
16233
  return wrappedFn;
15602
16234
  }
15603
- function meets(a, b) {
16235
+ /**
16236
+ * @param {Range} a
16237
+ * @param {Range} b
16238
+ */
16239
+ function meetsRange(a, b) {
15604
16240
  return [a.end === b.start, a['end included'] === true, b['start included'] === true].every(v => v);
15605
16241
  }
16242
+ /**
16243
+ * @param {Range|number} a
16244
+ * @param {Range|number} b
16245
+ */
15606
16246
  function before(a, b) {
15607
16247
  if (a instanceof Range$1 && b instanceof Range$1) {
15608
16248
  return a.end < b.start || (!a['end included'] || !b['start included']) && a.end == b.start;
@@ -15657,6 +16297,12 @@
15657
16297
  return obj.shiftTo('years', 'months', 'days', 'hours', 'minutes', 'seconds').normalize().toISO();
15658
16298
  }
15659
16299
  if (type === 'date time') {
16300
+ if (obj.zone === SystemZone.instance) {
16301
+ return obj.toISO({
16302
+ suppressMilliseconds: true,
16303
+ includeOffset: false
16304
+ });
16305
+ }
15660
16306
  if ((_a = obj.zone) === null || _a === void 0 ? void 0 : _a.zoneName) {
15661
16307
  return obj.toISO({
15662
16308
  suppressMilliseconds: true,
@@ -15674,6 +16320,12 @@
15674
16320
  return '<range>';
15675
16321
  }
15676
16322
  if (type === 'time') {
16323
+ if (obj.zone === SystemZone.instance) {
16324
+ return obj.toISOTime({
16325
+ suppressMilliseconds: true,
16326
+ includeOffset: false
16327
+ });
16328
+ }
15677
16329
  if ((_c = obj.zone) === null || _c === void 0 ? void 0 : _c.zoneName) {
15678
16330
  return obj.toISOTime({
15679
16331
  suppressMilliseconds: true,
@@ -15707,6 +16359,18 @@
15707
16359
  const mean = array.reduce((a, b) => a + b) / n;
15708
16360
  return Math.sqrt(array.map(x => Math.pow(x - mean, 2)).reduce((a, b) => a + b) / (n - 1));
15709
16361
  }
16362
+ function listReplace(list, matcher, newItem) {
16363
+ if (isNumber$1(matcher)) {
16364
+ return [...list.slice(0, matcher - 1), newItem, ...list.slice(matcher)];
16365
+ }
16366
+ return list.map((item, _idx) => {
16367
+ if (matcher.invoke([item, newItem])) {
16368
+ return newItem;
16369
+ } else {
16370
+ return item;
16371
+ }
16372
+ });
16373
+ }
15710
16374
  function median(array) {
15711
16375
  const n = array.length;
15712
16376
  const sorted = array.slice().sort();
@@ -15840,16 +16504,51 @@
15840
16504
  }
15841
16505
  const leftType = getType(left);
15842
16506
  const rightType = getType(right);
15843
- if (leftType !== rightType || !types.includes(leftType)) {
16507
+ const temporal = ['date', 'time', 'date time', 'duration'];
16508
+ if (temporal.includes(leftType)) {
16509
+ if (!temporal.includes(rightType)) {
16510
+ return null;
16511
+ }
16512
+ } else if (leftType !== rightType || !types.includes(leftType)) {
15844
16513
  return null;
15845
16514
  }
15846
16515
  return op(left, right);
15847
16516
  };
15848
16517
  switch (input) {
15849
16518
  case '+':
15850
- return nullable((a, b) => a + b, ['string', 'number']);
16519
+ return nullable((a, b) => {
16520
+ if (isType(a, 'time') && isDuration(b)) {
16521
+ return a.plus(b).set({
16522
+ year: 1900,
16523
+ month: 1,
16524
+ day: 1
16525
+ });
16526
+ } else if (isDateTime(a) && isDateTime(b)) {
16527
+ return null;
16528
+ } else if (isDateTime(a) && isDuration(b)) {
16529
+ return a.plus(b);
16530
+ } else if (isDuration(a) && isDuration(b)) {
16531
+ return a.plus(b);
16532
+ }
16533
+ return a + b;
16534
+ }, ['string', 'number', 'date', 'time', 'duration', 'date time']);
15851
16535
  case '-':
15852
- return nullable((a, b) => a - b);
16536
+ return nullable((a, b) => {
16537
+ if (isType(a, 'time') && isDuration(b)) {
16538
+ return a.minus(b).set({
16539
+ year: 1900,
16540
+ month: 1,
16541
+ day: 1
16542
+ });
16543
+ } else if (isDateTime(a) && isDateTime(b)) {
16544
+ return a.diff(b);
16545
+ } else if (isDateTime(a) && isDuration(b)) {
16546
+ return a.minus(b);
16547
+ } else if (isDuration(a) && isDuration(b)) {
16548
+ return a.minus(b);
16549
+ }
16550
+ return a - b;
16551
+ }, ['number', 'date', 'time', 'duration', 'date time']);
15853
16552
  case '*':
15854
16553
  return nullable((a, b) => a * b);
15855
16554
  case '/':
@@ -16330,7 +17029,7 @@
16330
17029
  return createNumberRange(start, end, startIncluded, endIncluded);
16331
17030
  }
16332
17031
  if (isTyped('duration', [start, end])) {
16333
- throw notImplemented('range<duration>');
17032
+ return createDurationRange(start, end, startIncluded, endIncluded);
16334
17033
  }
16335
17034
  if (isTyped('time', [start, end])) {
16336
17035
  return createDateTimeRange(start, end, startIncluded, endIncluded);
@@ -16390,7 +17089,7 @@
16390
17089
  return value => n > value;
16391
17090
  }
16392
17091
  }
16393
- function anyIncludes(start, end, startIncluded, endIncluded) {
17092
+ function anyIncludes(start, end, startIncluded, endIncluded, conversion = v => v) {
16394
17093
  let tests = [];
16395
17094
  if (start === null && end === null) {
16396
17095
  return () => null;
@@ -16406,7 +17105,7 @@
16406
17105
  } else if (start !== null) {
16407
17106
  tests = [includesStart(start, startIncluded)];
16408
17107
  }
16409
- return value => value === null ? null : tests.every(t => t(value));
17108
+ return value => value === null ? null : tests.every(t => t(conversion(value)));
16410
17109
  }
16411
17110
  function createStringRange(start, end, startIncluded = true, endIncluded = true) {
16412
17111
  if (start !== null && !chars.includes(start)) {
@@ -16451,6 +17150,25 @@
16451
17150
  includes
16452
17151
  });
16453
17152
  }
17153
+ /**
17154
+ * @param {Duration} start
17155
+ * @param {Duration} end
17156
+ * @param {boolean} startIncluded
17157
+ * @param {boolean} endIncluded
17158
+ */
17159
+ function createDurationRange(start, end, startIncluded, endIncluded) {
17160
+ const toMillis = d => d ? Duration.fromDurationLike(d).toMillis() : null;
17161
+ const map = noopMap();
17162
+ const includes = anyIncludes(toMillis(start), toMillis(end), startIncluded, endIncluded, toMillis);
17163
+ return new Range$1({
17164
+ start,
17165
+ end,
17166
+ 'start included': startIncluded,
17167
+ 'end included': endIncluded,
17168
+ map,
17169
+ includes
17170
+ });
17171
+ }
16454
17172
  function createDateTimeRange(start, end, startIncluded, endIncluded) {
16455
17173
  const map = noopMap();
16456
17174
  const includes = anyIncludes(start, end, startIncluded, endIncluded);
@@ -30129,7 +30847,7 @@
30129
30847
  /**
30130
30848
  Get the active tooltip view for a given tooltip, if available.
30131
30849
  */
30132
- function getTooltip(view, tooltip) {
30850
+ function getTooltip$1(view, tooltip) {
30133
30851
  let plugin = view.plugin(tooltipPlugin);
30134
30852
  if (!plugin) return null;
30135
30853
  let found = plugin.manager.tooltips.indexOf(tooltip);
@@ -33597,7 +34315,7 @@
33597
34315
  if (!cState || !cState.open || cState.open.disabled || Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay) return false;
33598
34316
  let step = 1,
33599
34317
  tooltip;
33600
- if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip))) step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
34318
+ if (by == "page" && (tooltip = getTooltip$1(view, cState.open.tooltip))) step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
33601
34319
  let {
33602
34320
  length
33603
34321
  } = cState.open.options;
@@ -33768,7 +34486,7 @@
33768
34486
  blur(event) {
33769
34487
  let state = this.view.state.field(completionState, false);
33770
34488
  if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
33771
- let dialog = state.open && getTooltip(this.view, state.open.tooltip);
34489
+ let dialog = state.open && getTooltip$1(this.view, state.open.tooltip);
33772
34490
  if (!dialog || !dialog.dom.contains(event.relatedTarget)) this.view.dispatch({
33773
34491
  effects: closeCompletionEffect.of(null)
33774
34492
  });
@@ -39618,18 +40336,18 @@
39618
40336
  return stack[0].children[0];
39619
40337
  }
39620
40338
 
39621
- /**
39622
- * @typedef {object} EvaluationOptions
39623
- * @property {boolean} [debug=false] - whether to enable debug mode, which displays errors inline instead of throwing them
39624
- * @property {function} [buildDebugString=(e) => `{{ ${e.message.toLowerCase()} }}`] - function that takes an error and returns the string to display in debug mode
39625
- * @property {boolean} [strict=false] - whether to expect strict data types out of our FEEL expression, e.g. boolean for conditionals
40339
+ /**
40340
+ * @typedef {object} EvaluationOptions
40341
+ * @property {boolean} [debug=false] - whether to enable debug mode, which displays errors inline instead of throwing them
40342
+ * @property {function} [buildDebugString=(e) => `{{ ${e.message.toLowerCase()} }}`] - function that takes an error and returns the string to display in debug mode
40343
+ * @property {boolean} [strict=false] - whether to expect strict data types out of our FEEL expression, e.g. boolean for conditionals
39626
40344
  */
39627
40345
 
39628
- /**
39629
- * @param {string} templateString - the template string to evaluate
39630
- * @param {object} [context={}] - the context object to evaluate the template string against
39631
- * @param {EvaluationOptions} [options={}] - options to configure the evaluation
39632
- * @return {string} the evaluated template string
40346
+ /**
40347
+ * @param {string} templateString - the template string to evaluate
40348
+ * @param {object} [context={}] - the context object to evaluate the template string against
40349
+ * @param {EvaluationOptions} [options={}] - options to configure the evaluation
40350
+ * @return {string} the evaluated template string
39633
40351
  */
39634
40352
  const evaluate = (templateString, context = {}, options = {}) => {
39635
40353
  const {
@@ -39657,7 +40375,7 @@
39657
40375
  {
39658
40376
  const feel = node.children[0].content;
39659
40377
  try {
39660
- return evaluate$1(feel, context);
40378
+ return evaluate$1(`string(${feel})`, context);
39661
40379
  } catch {
39662
40380
  return errorHandler(new Error(`FEEL expression ${feel} couldn't be evaluated`));
39663
40381
  }
@@ -39667,10 +40385,11 @@
39667
40385
  case 'Feel':
39668
40386
  case 'FeelBlock':
39669
40387
  {
40388
+ const feel = node.content;
39670
40389
  try {
39671
- return evaluate$1(node.content, context);
39672
- } catch {
39673
- return errorHandler(new Error(`FEEL expression ${node.content} couldn't be evaluated`));
40390
+ return evaluate$1(`string(${feel})`, context);
40391
+ } catch (e) {
40392
+ return errorHandler(new Error(`FEEL expression ${feel} couldn't be evaluated`));
39674
40393
  }
39675
40394
  }
39676
40395
  case 'Feelers':
@@ -39785,11 +40504,11 @@
39785
40504
  }
39786
40505
  const createFeelersLanguageSupport = hostLanguageParser => new LanguageSupport(createMixedLanguage(hostLanguageParser), []);
39787
40506
 
39788
- /**
39789
- * Create warnings for empty inserts in the given tree.
39790
- *
39791
- * @param {Tree} syntaxTree
39792
- * @returns {LintMessage[]} array of syntax errors
40507
+ /**
40508
+ * Create warnings for empty inserts in the given tree.
40509
+ *
40510
+ * @param {Tree} syntaxTree
40511
+ * @returns {LintMessage[]} array of syntax errors
39793
40512
  */
39794
40513
  function lintEmptyInserts(syntaxTree) {
39795
40514
  const lintMessages = [];
@@ -39809,22 +40528,22 @@
39809
40528
  return lintMessages;
39810
40529
  }
39811
40530
 
39812
- /**
39813
- * Generates lint messages for the given syntax tree.
39814
- *
39815
- * @param {Tree} syntaxTree
39816
- * @returns {LintMessage[]} array of all lint messages
40531
+ /**
40532
+ * Generates lint messages for the given syntax tree.
40533
+ *
40534
+ * @param {Tree} syntaxTree
40535
+ * @returns {LintMessage[]} array of all lint messages
39817
40536
  */
39818
40537
  function lintAll(syntaxTree) {
39819
40538
  const lintMessages = [...lintEmptyInserts(syntaxTree)];
39820
40539
  return lintMessages;
39821
40540
  }
39822
40541
 
39823
- /**
39824
- * CodeMirror extension that provides linting for FEEL expressions.
39825
- *
39826
- * @param {EditorView} editorView
39827
- * @returns {Source} CodeMirror linting source
40542
+ /**
40543
+ * CodeMirror extension that provides linting for FEEL expressions.
40544
+ *
40545
+ * @param {EditorView} editorView
40546
+ * @returns {Source} CodeMirror linting source
39828
40547
  */
39829
40548
  function cmFeelersLinter() {
39830
40549
  const lintFeel = cmFeelLinter();
@@ -39845,24 +40564,24 @@
39845
40564
  }
39846
40565
  var lint = linter$1(cmFeelersLinter());
39847
40566
 
39848
- /**
39849
- * Creates a Feelers editor in the supplied container.
39850
- *
39851
- * @param {Object} config Configuration options for the Feelers editor.
39852
- * @param {DOMNode} [config.container] The DOM node that will contain the editor.
39853
- * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
39854
- * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
39855
- * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
39856
- * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
39857
- * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
39858
- * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
39859
- * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
39860
- * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
39861
- * @param {String} [config.value] Initial value of the editor.
39862
- * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
39863
- * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
39864
- *
39865
- * @returns {Object} editor An instance of the FeelersEditor class.
40567
+ /**
40568
+ * Creates a Feelers editor in the supplied container.
40569
+ *
40570
+ * @param {Object} config Configuration options for the Feelers editor.
40571
+ * @param {DOMNode} [config.container] The DOM node that will contain the editor.
40572
+ * @param {DOMNode|String} [config.tooltipContainer] The DOM node or CSS selector string for the tooltip container.
40573
+ * @param {String} [config.hostLanguage] The host language for the editor (e.g., 'markdown').
40574
+ * @param {Object} [config.hostLanguageParser] A custom parser for the host language.
40575
+ * @param {Function} [config.onChange] Callback function that is called when the editor's content changes.
40576
+ * @param {Function} [config.onKeyDown] Callback function that is called when a key is pressed within the editor.
40577
+ * @param {Function} [config.onLint] Callback function that is called when linting messages are available.
40578
+ * @param {Object} [config.contentAttributes] Additional attributes to set on the editor's content element.
40579
+ * @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
40580
+ * @param {String} [config.value] Initial value of the editor.
40581
+ * @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
40582
+ * @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
40583
+ *
40584
+ * @returns {Object} editor An instance of the FeelersEditor class.
39866
40585
  */
39867
40586
  function FeelersEditor({
39868
40587
  container,
@@ -39933,10 +40652,10 @@
39933
40652
  return this;
39934
40653
  }
39935
40654
 
39936
- /**
39937
- * Replaces the content of the Editor
39938
- *
39939
- * @param {String} value
40655
+ /**
40656
+ * Replaces the content of the Editor
40657
+ *
40658
+ * @param {String} value
39940
40659
  */
39941
40660
  FeelersEditor.prototype.setValue = function (value) {
39942
40661
  this._cmEditor.dispatch({
@@ -39948,8 +40667,8 @@
39948
40667
  });
39949
40668
  };
39950
40669
 
39951
- /**
39952
- * Sets the focus in the editor.
40670
+ /**
40671
+ * Sets the focus in the editor.
39953
40672
  */
39954
40673
  FeelersEditor.prototype.focus = function (position) {
39955
40674
  const cmEditor = this._cmEditor;
@@ -39968,12 +40687,12 @@
39968
40687
  }
39969
40688
  };
39970
40689
 
39971
- /**
39972
- * Returns the current selection ranges. If no text is selected, a single
39973
- * range with the start and end index at the cursor position will be returned.
39974
- *
39975
- * @returns {Object} selection
39976
- * @returns {Array} selection.ranges
40690
+ /**
40691
+ * Returns the current selection ranges. If no text is selected, a single
40692
+ * range with the start and end index at the cursor position will be returned.
40693
+ *
40694
+ * @returns {Object} selection
40695
+ * @returns {Array} selection.ranges
39977
40696
  */
39978
40697
  FeelersEditor.prototype.getSelection = function () {
39979
40698
  return this._cmEditor.state.selection;
@@ -48040,7 +48759,7 @@
48040
48759
  }
48041
48760
  return `fjs-form-${id}`;
48042
48761
  }
48043
- const type$d = 'button';
48762
+ const type$e = 'button';
48044
48763
  function Button(props) {
48045
48764
  const {
48046
48765
  disabled,
@@ -48052,7 +48771,7 @@
48052
48771
  action = 'submit'
48053
48772
  } = field;
48054
48773
  return e$1("div", {
48055
- class: formFieldClasses(type$d),
48774
+ class: formFieldClasses(type$e),
48056
48775
  children: e$1("button", {
48057
48776
  class: "fjs-button",
48058
48777
  type: action,
@@ -48064,7 +48783,7 @@
48064
48783
  });
48065
48784
  }
48066
48785
  Button.config = {
48067
- type: type$d,
48786
+ type: type$e,
48068
48787
  keyed: false,
48069
48788
  label: 'Button',
48070
48789
  group: 'action',
@@ -48354,7 +49073,7 @@
48354
49073
  })]
48355
49074
  });
48356
49075
  }
48357
- const type$c = 'checkbox';
49076
+ const type$d = 'checkbox';
48358
49077
  function Checkbox$1(props) {
48359
49078
  const {
48360
49079
  disabled,
@@ -48387,7 +49106,7 @@
48387
49106
  } = F$1(FormContext$1);
48388
49107
  const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
48389
49108
  return e$1("div", {
48390
- class: classNames(formFieldClasses(type$c, {
49109
+ class: classNames(formFieldClasses(type$d, {
48391
49110
  errors,
48392
49111
  disabled,
48393
49112
  readonly
@@ -48419,7 +49138,7 @@
48419
49138
  });
48420
49139
  }
48421
49140
  Checkbox$1.config = {
48422
- type: type$c,
49141
+ type: type$d,
48423
49142
  keyed: true,
48424
49143
  label: 'Checkbox',
48425
49144
  group: 'selection',
@@ -48433,54 +49152,54 @@
48433
49152
  };
48434
49153
 
48435
49154
  // parses the options data from the provided form field and form data
48436
- function getValuesData(formField, formData) {
49155
+ function getOptionsData(formField, formData) {
48437
49156
  const {
48438
- valuesKey,
48439
- values
49157
+ valuesKey: optionsKey,
49158
+ values: staticOptions
48440
49159
  } = formField;
48441
- return valuesKey ? get$1(formData, [valuesKey]) : values;
49160
+ return optionsKey ? get$1(formData, [optionsKey]) : staticOptions;
48442
49161
  }
48443
49162
 
48444
49163
  // transforms the provided options into a normalized format, trimming invalid options
48445
- function normalizeValuesData(valuesData) {
48446
- return valuesData.filter(_isValueSomething).map(v => _normalizeValueData(v)).filter(v => v);
49164
+ function normalizeOptionsData(optionsData) {
49165
+ return optionsData.filter(_isOptionSomething).map(v => _normalizeOptionsData(v)).filter(v => v);
48447
49166
  }
48448
- function _normalizeValueData(valueData) {
48449
- if (_isAllowedValue(valueData)) {
49167
+ function _normalizeOptionsData(optionData) {
49168
+ if (_isAllowedOption(optionData)) {
48450
49169
  // if a primitive is provided, use it as label and value
48451
49170
  return {
48452
- value: valueData,
48453
- label: `${valueData}`
49171
+ value: optionData,
49172
+ label: `${optionData}`
48454
49173
  };
48455
49174
  }
48456
- if (typeof valueData === 'object') {
48457
- if (!valueData.label && _isAllowedValue(valueData.value)) {
49175
+ if (typeof optionData === 'object') {
49176
+ if (!optionData.label && _isAllowedOption(optionData.value)) {
48458
49177
  // if no label is provided, use the value as label
48459
49178
  return {
48460
- value: valueData.value,
48461
- label: `${valueData.value}`
49179
+ value: optionData.value,
49180
+ label: `${optionData.value}`
48462
49181
  };
48463
49182
  }
48464
- if (_isValueSomething(valueData.value) && _isAllowedValue(valueData.label)) {
49183
+ if (_isOptionSomething(optionData.value) && _isAllowedOption(optionData.label)) {
48465
49184
  // if both value and label are provided, use them as is, in this scenario, the value may also be an object
48466
- return valueData;
49185
+ return optionData;
48467
49186
  }
48468
49187
  }
48469
49188
  return null;
48470
49189
  }
48471
- function _isAllowedValue(value) {
48472
- return _isReadableType(value) && _isValueSomething(value);
49190
+ function _isAllowedOption(option) {
49191
+ return _isReadableType(option) && _isOptionSomething(option);
48473
49192
  }
48474
- function _isReadableType(value) {
48475
- return ['number', 'string', 'boolean'].includes(typeof value);
49193
+ function _isReadableType(option) {
49194
+ return ['number', 'string', 'boolean'].includes(typeof option);
48476
49195
  }
48477
- function _isValueSomething(value) {
48478
- return value || value === 0 || value === false;
49196
+ function _isOptionSomething(option) {
49197
+ return option || option === 0 || option === false;
48479
49198
  }
48480
49199
  function createEmptyOptions(options = {}) {
48481
49200
  const defaults = {};
48482
49201
 
48483
- // provide default values if valuesKey and valuesExpression are not set
49202
+ // provide default options if valuesKey and valuesExpression are not set
48484
49203
  if (!options.valuesKey && !options.valuesExpression) {
48485
49204
  defaults.values = [{
48486
49205
  label: 'Value',
@@ -48503,71 +49222,94 @@
48503
49222
  };
48504
49223
 
48505
49224
  /**
48506
- * @typedef {Object} ValuesGetter
48507
- * @property {Object[]} values - The values data
48508
- * @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
49225
+ * @typedef {Object} OptionsGetter
49226
+ * @property {Object[]} options - The options data
49227
+ * @property {(LOAD_STATES)} loadState - The options data's loading state, to use for conditional rendering
48509
49228
  */
48510
49229
 
48511
49230
  /**
48512
- * A hook to load values for single and multiselect components.
49231
+ * A hook to load options for single and multiselect components.
48513
49232
  *
48514
- * @param {Object} field - The form field to handle values for
48515
- * @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
49233
+ * @param {Object} field - The form field to handle options for
49234
+ * @return {OptionsGetter} optionsGetter - A options getter object providing loading state and options
48516
49235
  */
48517
- function useValuesAsync(field) {
49236
+ function useOptionsAsync(field) {
48518
49237
  const {
48519
- valuesExpression,
48520
- valuesKey,
48521
- values: staticValues
49238
+ valuesExpression: optionsExpression,
49239
+ valuesKey: optionsKey,
49240
+ values: staticOptions
48522
49241
  } = field;
48523
- const [valuesGetter, setValuesGetter] = l$2({
48524
- values: [],
49242
+ const [optionsGetter, setOptionsGetter] = l$2({
49243
+ options: [],
48525
49244
  error: undefined,
48526
- state: LOAD_STATES.LOADING
49245
+ loadState: LOAD_STATES.LOADING
48527
49246
  });
48528
49247
  const initialData = useService$2('form')._getState().initialData;
48529
- const expressionEvaluation = useExpressionEvaluation(valuesExpression);
48530
- const evaluatedValues = useDeepCompareState(expressionEvaluation || [], []);
49248
+ const expressionEvaluation = useExpressionEvaluation(optionsExpression);
49249
+ const evaluatedOptions = useDeepCompareState(expressionEvaluation || [], []);
48531
49250
  y(() => {
48532
- let values = [];
49251
+ let options = [];
48533
49252
 
48534
- // dynamic values
48535
- if (valuesKey !== undefined) {
48536
- const keyedValues = (initialData || {})[valuesKey];
48537
- if (keyedValues && Array.isArray(keyedValues)) {
48538
- values = keyedValues;
49253
+ // dynamic options
49254
+ if (optionsKey !== undefined) {
49255
+ const keyedOptions = (initialData || {})[optionsKey];
49256
+ if (keyedOptions && Array.isArray(keyedOptions)) {
49257
+ options = keyedOptions;
48539
49258
  }
48540
49259
 
48541
- // static values
48542
- } else if (staticValues !== undefined) {
48543
- values = Array.isArray(staticValues) ? staticValues : [];
49260
+ // static options
49261
+ } else if (staticOptions !== undefined) {
49262
+ options = Array.isArray(staticOptions) ? staticOptions : [];
48544
49263
 
48545
49264
  // expression
48546
- } else if (valuesExpression) {
48547
- if (evaluatedValues && Array.isArray(evaluatedValues)) {
48548
- values = evaluatedValues;
49265
+ } else if (optionsExpression) {
49266
+ if (evaluatedOptions && Array.isArray(evaluatedOptions)) {
49267
+ options = evaluatedOptions;
48549
49268
  }
48550
49269
  } else {
48551
- setValuesGetter(buildErrorState('No values source defined in the form definition'));
49270
+ setOptionsGetter(buildErrorState('No options source defined in the form definition'));
48552
49271
  return;
48553
49272
  }
48554
49273
 
48555
49274
  // normalize data to support primitives and partially defined objects
48556
- values = normalizeValuesData(values);
48557
- setValuesGetter(buildLoadedState(values));
48558
- }, [valuesKey, staticValues, initialData, valuesExpression, evaluatedValues]);
48559
- return valuesGetter;
49275
+ options = normalizeOptionsData(options);
49276
+ setOptionsGetter(buildLoadedState(options));
49277
+ }, [optionsKey, staticOptions, initialData, optionsExpression, evaluatedOptions]);
49278
+ return optionsGetter;
48560
49279
  }
48561
49280
  const buildErrorState = error => ({
48562
- values: [],
49281
+ options: [],
48563
49282
  error,
48564
- state: LOAD_STATES.ERROR
49283
+ loadState: LOAD_STATES.ERROR
48565
49284
  });
48566
- const buildLoadedState = values => ({
48567
- values,
49285
+ const buildLoadedState = options => ({
49286
+ options,
48568
49287
  error: undefined,
48569
- state: LOAD_STATES.LOADED
49288
+ loadState: LOAD_STATES.LOADED
48570
49289
  });
49290
+ function useCleanupMultiSelectValues(props) {
49291
+ const {
49292
+ field,
49293
+ options,
49294
+ loadState,
49295
+ onChange,
49296
+ values
49297
+ } = props;
49298
+
49299
+ // Ensures that the values are always a subset of the possible options
49300
+ y(() => {
49301
+ if (loadState !== LOAD_STATES.LOADED) {
49302
+ return;
49303
+ }
49304
+ const hasValuesNotInOptions = values.some(v => !options.map(o => o.value).includes(v));
49305
+ if (hasValuesNotInOptions) {
49306
+ onChange({
49307
+ field,
49308
+ value: values.filter(v => options.map(o => o.value).includes(v))
49309
+ });
49310
+ }
49311
+ }, [field, options, onChange, JSON.stringify(values), loadState]);
49312
+ }
48571
49313
 
48572
49314
  // config ///////////////////
48573
49315
 
@@ -48780,7 +49522,7 @@
48780
49522
  value
48781
49523
  } = options;
48782
49524
  try {
48783
- const validValues = normalizeValuesData(getValuesData(formField, data)).map(v => v.value);
49525
+ const validValues = normalizeOptionsData(getOptionsData(formField, data)).map(v => v.value);
48784
49526
  return validValues.includes(value) ? value : null;
48785
49527
  } catch (error) {
48786
49528
  // use default value in case of formatting error
@@ -48795,7 +49537,7 @@
48795
49537
  value
48796
49538
  } = options;
48797
49539
  try {
48798
- const validValues = normalizeValuesData(getValuesData(formField, data)).map(v => v.value);
49540
+ const validValues = normalizeOptionsData(getOptionsData(formField, data)).map(v => v.value);
48799
49541
  return value.filter(v => validValues.includes(v));
48800
49542
  } catch (error) {
48801
49543
  // use default value in case of formatting error
@@ -48803,7 +49545,7 @@
48803
49545
  return [];
48804
49546
  }
48805
49547
  }
48806
- const type$b = 'checklist';
49548
+ const type$c = 'checklist';
48807
49549
  function Checklist(props) {
48808
49550
  const {
48809
49551
  disabled,
@@ -48812,7 +49554,7 @@
48812
49554
  onFocus,
48813
49555
  field,
48814
49556
  readonly,
48815
- value = []
49557
+ value: values = []
48816
49558
  } = props;
48817
49559
  const {
48818
49560
  description,
@@ -48825,7 +49567,7 @@
48825
49567
  required
48826
49568
  } = validate;
48827
49569
  const toggleCheckbox = v => {
48828
- let newValue = [...value];
49570
+ let newValue = [...values];
48829
49571
  if (!newValue.includes(v)) {
48830
49572
  newValue.push(v);
48831
49573
  } else {
@@ -48849,15 +49591,22 @@
48849
49591
  onFocus && onFocus();
48850
49592
  };
48851
49593
  const {
48852
- state: loadState,
48853
- values: options
48854
- } = useValuesAsync(field);
49594
+ loadState,
49595
+ options
49596
+ } = useOptionsAsync(field);
49597
+ useCleanupMultiSelectValues({
49598
+ field,
49599
+ loadState,
49600
+ options,
49601
+ values,
49602
+ onChange: props.onChange
49603
+ });
48855
49604
  const {
48856
49605
  formId
48857
49606
  } = F$1(FormContext$1);
48858
49607
  const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
48859
49608
  return e$1("div", {
48860
- class: classNames(formFieldClasses(type$b, {
49609
+ class: classNames(formFieldClasses(type$c, {
48861
49610
  errors,
48862
49611
  disabled,
48863
49612
  readonly
@@ -48871,11 +49620,11 @@
48871
49620
  id: prefixId$2(`${id}-${index}`, formId),
48872
49621
  label: v.label,
48873
49622
  class: classNames({
48874
- 'fjs-checked': value.includes(v.value)
49623
+ 'fjs-checked': values.includes(v.value)
48875
49624
  }),
48876
49625
  required: false,
48877
49626
  children: e$1("input", {
48878
- checked: value.includes(v.value),
49627
+ checked: values.includes(v.value),
48879
49628
  class: "fjs-input",
48880
49629
  disabled: disabled,
48881
49630
  readOnly: readonly,
@@ -48896,9 +49645,9 @@
48896
49645
  });
48897
49646
  }
48898
49647
  Checklist.config = {
48899
- type: type$b,
49648
+ type: type$c,
48900
49649
  keyed: true,
48901
- label: 'Checklist',
49650
+ label: 'Checkbox group',
48902
49651
  group: 'selection',
48903
49652
  emptyValue: [],
48904
49653
  sanitizeValue: sanitizeMultiSelectValue,
@@ -49044,9 +49793,9 @@
49044
49793
  ...options
49045
49794
  })
49046
49795
  };
49047
- var _path$i;
49048
- function _extends$l() {
49049
- _extends$l = Object.assign ? Object.assign.bind() : function (target) {
49796
+ var _path$k;
49797
+ function _extends$m() {
49798
+ _extends$m = Object.assign ? Object.assign.bind() : function (target) {
49050
49799
  for (var i = 1; i < arguments.length; i++) {
49051
49800
  var source = arguments[i];
49052
49801
  for (var key in source) {
@@ -49057,16 +49806,16 @@
49057
49806
  }
49058
49807
  return target;
49059
49808
  };
49060
- return _extends$l.apply(this, arguments);
49809
+ return _extends$m.apply(this, arguments);
49061
49810
  }
49062
49811
  var SvgCalendar = function SvgCalendar(props) {
49063
- return /*#__PURE__*/v$1("svg", _extends$l({
49812
+ return /*#__PURE__*/v$1("svg", _extends$m({
49064
49813
  xmlns: "http://www.w3.org/2000/svg",
49065
49814
  width: 14,
49066
49815
  height: 15,
49067
49816
  fill: "none",
49068
49817
  viewBox: "0 0 28 30"
49069
- }, props), _path$i || (_path$i = /*#__PURE__*/v$1("path", {
49818
+ }, props), _path$k || (_path$k = /*#__PURE__*/v$1("path", {
49070
49819
  fill: "currentColor",
49071
49820
  fillRule: "evenodd",
49072
49821
  d: "M19 2H9V0H7v2H2a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-5V0h-2v2ZM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7Zm-5 4v17h24V11H2Z",
@@ -49326,9 +50075,9 @@
49326
50075
  })]
49327
50076
  });
49328
50077
  }
49329
- var _path$h, _path2$3;
49330
- function _extends$k() {
49331
- _extends$k = Object.assign ? Object.assign.bind() : function (target) {
50078
+ var _path$j, _path2$4;
50079
+ function _extends$l() {
50080
+ _extends$l = Object.assign ? Object.assign.bind() : function (target) {
49332
50081
  for (var i = 1; i < arguments.length; i++) {
49333
50082
  var source = arguments[i];
49334
50083
  for (var key in source) {
@@ -49339,19 +50088,19 @@
49339
50088
  }
49340
50089
  return target;
49341
50090
  };
49342
- return _extends$k.apply(this, arguments);
50091
+ return _extends$l.apply(this, arguments);
49343
50092
  }
49344
50093
  var SvgClock = function SvgClock(props) {
49345
- return /*#__PURE__*/v$1("svg", _extends$k({
50094
+ return /*#__PURE__*/v$1("svg", _extends$l({
49346
50095
  xmlns: "http://www.w3.org/2000/svg",
49347
50096
  width: 16,
49348
50097
  height: 16,
49349
50098
  fill: "none",
49350
50099
  viewBox: "0 0 28 29"
49351
- }, props), _path$h || (_path$h = /*#__PURE__*/v$1("path", {
50100
+ }, props), _path$j || (_path$j = /*#__PURE__*/v$1("path", {
49352
50101
  fill: "currentColor",
49353
50102
  d: "M13 14.41 18.59 20 20 18.59l-5-5.01V5h-2v9.41Z"
49354
- })), _path2$3 || (_path2$3 = /*#__PURE__*/v$1("path", {
50103
+ })), _path2$4 || (_path2$4 = /*#__PURE__*/v$1("path", {
49355
50104
  fill: "currentColor",
49356
50105
  fillRule: "evenodd",
49357
50106
  d: "M6.222 25.64A14 14 0 1 0 21.778 2.36 14 14 0 0 0 6.222 25.64ZM7.333 4.023a12 12 0 1 1 13.334 19.955A12 12 0 0 1 7.333 4.022Z",
@@ -49620,7 +50369,7 @@
49620
50369
  })]
49621
50370
  });
49622
50371
  }
49623
- const type$a = 'datetime';
50372
+ const type$b = 'datetime';
49624
50373
  function Datetime(props) {
49625
50374
  const {
49626
50375
  disabled,
@@ -49792,7 +50541,7 @@
49792
50541
  'aria-describedby': errorMessageId
49793
50542
  };
49794
50543
  return e$1("div", {
49795
- class: formFieldClasses(type$a, {
50544
+ class: formFieldClasses(type$b, {
49796
50545
  errors: allErrors,
49797
50546
  disabled,
49798
50547
  readonly
@@ -49816,7 +50565,7 @@
49816
50565
  });
49817
50566
  }
49818
50567
  Datetime.config = {
49819
- type: type$a,
50568
+ type: type$b,
49820
50569
  keyed: true,
49821
50570
  label: 'Date time',
49822
50571
  group: 'basic-input',
@@ -49994,7 +50743,7 @@
49994
50743
  type: 'group',
49995
50744
  pathed: true,
49996
50745
  label: 'Group',
49997
- group: 'presentation',
50746
+ group: 'container',
49998
50747
  create: (options = {}) => ({
49999
50748
  components: [],
50000
50749
  showOutline: true,
@@ -50007,6 +50756,7 @@
50007
50756
  const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src'];
50008
50757
  const ALLOWED_URI_PATTERN = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
50009
50758
  const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
50759
+ const ALLOWED_IFRAME_SRC_PATTERN = /^(https):\/\/*/i; // eslint-disable-line no-useless-escape
50010
50760
  const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g; // eslint-disable-line no-control-regex
50011
50761
 
50012
50762
  const FORM_ELEMENT = document.createElement('form');
@@ -50047,6 +50797,18 @@
50047
50797
  return valid ? src : '';
50048
50798
  }
50049
50799
 
50800
+ /**
50801
+ * Sanitizes an iframe source to ensure we only allow for links
50802
+ * that start with http(s).
50803
+ *
50804
+ * @param {string} src
50805
+ * @returns {string}
50806
+ */
50807
+ function sanitizeIFrameSource(src) {
50808
+ const valid = ALLOWED_IFRAME_SRC_PATTERN.test(src);
50809
+ return valid ? src : '';
50810
+ }
50811
+
50050
50812
  /**
50051
50813
  * Recursively sanitize a HTML node, potentially
50052
50814
  * removing it, its children or attributes.
@@ -50127,8 +50889,75 @@
50127
50889
  }
50128
50890
  return true;
50129
50891
  }
50130
- function _extends$j() {
50131
- _extends$j = Object.assign ? Object.assign.bind() : function (target) {
50892
+ const type$a = 'iframe';
50893
+ const DEFAULT_HEIGHT = 300;
50894
+ function IFrame(props) {
50895
+ const {
50896
+ field,
50897
+ disabled,
50898
+ readonly
50899
+ } = props;
50900
+ const {
50901
+ height = DEFAULT_HEIGHT,
50902
+ id,
50903
+ label,
50904
+ url
50905
+ } = field;
50906
+ const evaluatedUrl = useSingleLineTemplateEvaluation(url, {
50907
+ debug: true
50908
+ });
50909
+ const safeUrl = d(() => sanitizeIFrameSource(evaluatedUrl), [evaluatedUrl]);
50910
+ const evaluatedLabel = useSingleLineTemplateEvaluation(label, {
50911
+ debug: true
50912
+ });
50913
+ const {
50914
+ formId
50915
+ } = F$1(FormContext$1);
50916
+ return e$1("div", {
50917
+ class: formFieldClasses(type$a, {
50918
+ disabled,
50919
+ readonly
50920
+ }),
50921
+ children: [e$1(Label$2, {
50922
+ id: prefixId$2(id, formId),
50923
+ label: evaluatedLabel
50924
+ }), !evaluatedUrl && e$1(IFramePlaceholder, {
50925
+ text: "No content to show."
50926
+ }), evaluatedUrl && safeUrl && e$1("iframe", {
50927
+ src: safeUrl,
50928
+ title: evaluatedLabel,
50929
+ height: height,
50930
+ class: "fjs-iframe",
50931
+ id: prefixId$2(id, formId),
50932
+ sandbox: ""
50933
+ }), evaluatedUrl && !safeUrl && e$1(IFramePlaceholder, {
50934
+ text: "External content couldn't be loaded."
50935
+ })]
50936
+ });
50937
+ }
50938
+ function IFramePlaceholder(props) {
50939
+ const {
50940
+ text = 'iFrame'
50941
+ } = props;
50942
+ return e$1("div", {
50943
+ class: "fjs-iframe-placeholder",
50944
+ children: e$1("p", {
50945
+ class: "fjs-iframe-placeholder-text",
50946
+ children: text
50947
+ })
50948
+ });
50949
+ }
50950
+ IFrame.config = {
50951
+ type: type$a,
50952
+ keyed: false,
50953
+ label: 'iFrame',
50954
+ group: 'container',
50955
+ create: (options = {}) => ({
50956
+ ...options
50957
+ })
50958
+ };
50959
+ function _extends$k() {
50960
+ _extends$k = Object.assign ? Object.assign.bind() : function (target) {
50132
50961
  for (var i = 1; i < arguments.length; i++) {
50133
50962
  var source = arguments[i];
50134
50963
  for (var key in source) {
@@ -50139,10 +50968,10 @@
50139
50968
  }
50140
50969
  return target;
50141
50970
  };
50142
- return _extends$j.apply(this, arguments);
50971
+ return _extends$k.apply(this, arguments);
50143
50972
  }
50144
50973
  var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
50145
- return /*#__PURE__*/v$1("svg", _extends$j({
50974
+ return /*#__PURE__*/v$1("svg", _extends$k({
50146
50975
  xmlns: "http://www.w3.org/2000/svg",
50147
50976
  xmlSpace: "preserve",
50148
50977
  width: 64,
@@ -50244,9 +51073,9 @@
50244
51073
  post: evaluatedPost
50245
51074
  });
50246
51075
  }
50247
- var _path$g;
50248
- function _extends$i() {
50249
- _extends$i = Object.assign ? Object.assign.bind() : function (target) {
51076
+ var _path$i;
51077
+ function _extends$j() {
51078
+ _extends$j = Object.assign ? Object.assign.bind() : function (target) {
50250
51079
  for (var i = 1; i < arguments.length; i++) {
50251
51080
  var source = arguments[i];
50252
51081
  for (var key in source) {
@@ -50257,14 +51086,14 @@
50257
51086
  }
50258
51087
  return target;
50259
51088
  };
50260
- return _extends$i.apply(this, arguments);
51089
+ return _extends$j.apply(this, arguments);
50261
51090
  }
50262
51091
  var SvgAngelDown = function SvgAngelDown(props) {
50263
- return /*#__PURE__*/v$1("svg", _extends$i({
51092
+ return /*#__PURE__*/v$1("svg", _extends$j({
50264
51093
  xmlns: "http://www.w3.org/2000/svg",
50265
51094
  width: 8,
50266
51095
  height: 8
50267
- }, props), _path$g || (_path$g = /*#__PURE__*/v$1("path", {
51096
+ }, props), _path$i || (_path$i = /*#__PURE__*/v$1("path", {
50268
51097
  fill: "currentColor",
50269
51098
  fillRule: "evenodd",
50270
51099
  stroke: "currentColor",
@@ -50274,9 +51103,9 @@
50274
51103
  })));
50275
51104
  };
50276
51105
  var AngelDownIcon = SvgAngelDown;
50277
- var _path$f;
50278
- function _extends$h() {
50279
- _extends$h = Object.assign ? Object.assign.bind() : function (target) {
51106
+ var _path$h;
51107
+ function _extends$i() {
51108
+ _extends$i = Object.assign ? Object.assign.bind() : function (target) {
50280
51109
  for (var i = 1; i < arguments.length; i++) {
50281
51110
  var source = arguments[i];
50282
51111
  for (var key in source) {
@@ -50287,14 +51116,14 @@
50287
51116
  }
50288
51117
  return target;
50289
51118
  };
50290
- return _extends$h.apply(this, arguments);
51119
+ return _extends$i.apply(this, arguments);
50291
51120
  }
50292
51121
  var SvgAngelUp = function SvgAngelUp(props) {
50293
- return /*#__PURE__*/v$1("svg", _extends$h({
51122
+ return /*#__PURE__*/v$1("svg", _extends$i({
50294
51123
  xmlns: "http://www.w3.org/2000/svg",
50295
51124
  width: 8,
50296
51125
  height: 8
50297
- }, props), _path$f || (_path$f = /*#__PURE__*/v$1("path", {
51126
+ }, props), _path$h || (_path$h = /*#__PURE__*/v$1("path", {
50298
51127
  fill: "currentColor",
50299
51128
  fillRule: "evenodd",
50300
51129
  stroke: "currentColor",
@@ -50550,19 +51379,39 @@
50550
51379
  value,
50551
51380
  formField
50552
51381
  }) => {
50553
- // null state is allowed
50554
- if (isNullEquivalentValue(value)) return null;
50555
-
50556
- // if data cannot be parsed as a valid number, go into invalid NaN state
50557
- if (!isValidNumber$1(value)) return 'NaN';
51382
+ // invalid value types are sanitized to null
51383
+ if (isNullEquivalentValue(value) || !isValidNumber$1(value)) return null;
50558
51384
 
50559
- // otherwise parse to formatting type
51385
+ // otherwise, we return a string or a number depending on the form field configuration
50560
51386
  return formField.serializeToString ? value.toString() : Number(value);
50561
51387
  },
50562
51388
  create: (options = {}) => ({
50563
51389
  ...options
50564
51390
  })
50565
51391
  };
51392
+ function useCleanupSingleSelectValue(props) {
51393
+ const {
51394
+ field,
51395
+ options,
51396
+ loadState,
51397
+ onChange,
51398
+ value
51399
+ } = props;
51400
+
51401
+ // Ensures that the value is always one of the possible options
51402
+ y(() => {
51403
+ if (loadState !== LOAD_STATES.LOADED) {
51404
+ return;
51405
+ }
51406
+ const hasValueNotInOptions = value && !options.map(o => o.value).includes(value);
51407
+ if (hasValueNotInOptions) {
51408
+ onChange({
51409
+ field,
51410
+ value: null
51411
+ });
51412
+ }
51413
+ }, [field, options, onChange, value, loadState]);
51414
+ }
50566
51415
  const type$7 = 'radio';
50567
51416
  function Radio(props) {
50568
51417
  const {
@@ -50603,9 +51452,16 @@
50603
51452
  onFocus && onFocus();
50604
51453
  };
50605
51454
  const {
50606
- state: loadState,
50607
- values: options
50608
- } = useValuesAsync(field);
51455
+ loadState,
51456
+ options
51457
+ } = useOptionsAsync(field);
51458
+ useCleanupSingleSelectValue({
51459
+ field,
51460
+ loadState,
51461
+ options,
51462
+ value,
51463
+ onChange: props.onChange
51464
+ });
50609
51465
  const {
50610
51466
  formId
50611
51467
  } = F$1(FormContext$1);
@@ -50652,15 +51508,15 @@
50652
51508
  Radio.config = {
50653
51509
  type: type$7,
50654
51510
  keyed: true,
50655
- label: 'Radio',
51511
+ label: 'Radio group',
50656
51512
  group: 'selection',
50657
51513
  emptyValue: null,
50658
51514
  sanitizeValue: sanitizeSingleSelectValue,
50659
51515
  create: createEmptyOptions
50660
51516
  };
50661
- var _path$e;
50662
- function _extends$g() {
50663
- _extends$g = Object.assign ? Object.assign.bind() : function (target) {
51517
+ var _path$g;
51518
+ function _extends$h() {
51519
+ _extends$h = Object.assign ? Object.assign.bind() : function (target) {
50664
51520
  for (var i = 1; i < arguments.length; i++) {
50665
51521
  var source = arguments[i];
50666
51522
  for (var key in source) {
@@ -50671,14 +51527,14 @@
50671
51527
  }
50672
51528
  return target;
50673
51529
  };
50674
- return _extends$g.apply(this, arguments);
51530
+ return _extends$h.apply(this, arguments);
50675
51531
  }
50676
51532
  var SvgXMark = function SvgXMark(props) {
50677
- return /*#__PURE__*/v$1("svg", _extends$g({
51533
+ return /*#__PURE__*/v$1("svg", _extends$h({
50678
51534
  xmlns: "http://www.w3.org/2000/svg",
50679
51535
  width: 8,
50680
51536
  height: 8
50681
- }, props), _path$e || (_path$e = /*#__PURE__*/v$1("path", {
51537
+ }, props), _path$g || (_path$g = /*#__PURE__*/v$1("path", {
50682
51538
  fill: "currentColor",
50683
51539
  fillRule: "evenodd",
50684
51540
  stroke: "currentColor",
@@ -50709,9 +51565,16 @@
50709
51565
  const searchbarRef = s$1();
50710
51566
  const eventBus = useService$2('eventBus');
50711
51567
  const {
50712
- state: loadState,
50713
- values: options
50714
- } = useValuesAsync(field);
51568
+ loadState,
51569
+ options
51570
+ } = useOptionsAsync(field);
51571
+ useCleanupSingleSelectValue({
51572
+ field,
51573
+ loadState,
51574
+ options,
51575
+ value,
51576
+ onChange: props.onChange
51577
+ });
50715
51578
 
50716
51579
  // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
50717
51580
  const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
@@ -50868,10 +51731,18 @@
50868
51731
  } = F$1(FormContext$1);
50869
51732
  const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
50870
51733
  const selectRef = s$1();
51734
+ const inputRef = s$1();
50871
51735
  const {
50872
- state: loadState,
50873
- values: options
50874
- } = useValuesAsync(field);
51736
+ loadState,
51737
+ options
51738
+ } = useOptionsAsync(field);
51739
+ useCleanupSingleSelectValue({
51740
+ field,
51741
+ loadState,
51742
+ options,
51743
+ value,
51744
+ onChange: props.onChange
51745
+ });
50875
51746
 
50876
51747
  // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
50877
51748
  const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
@@ -50892,12 +51763,12 @@
50892
51763
  return ds;
50893
51764
  }, [disabled, isDropdownExpanded, loadState, value]);
50894
51765
  const onMouseDown = A$1(e => {
50895
- const select = selectRef.current;
51766
+ const input = inputRef.current;
50896
51767
  setIsDropdownExpanded(!isDropdownExpanded);
50897
51768
  if (isDropdownExpanded) {
50898
- select.blur();
51769
+ input.blur();
50899
51770
  } else {
50900
- select.focus();
51771
+ input.focus();
50901
51772
  }
50902
51773
  e.preventDefault();
50903
51774
  }, [isDropdownExpanded]);
@@ -50934,6 +51805,7 @@
50934
51805
  id: prefixId$2(`${id}-display`, formId),
50935
51806
  children: valueLabel || 'Select'
50936
51807
  }), !disabled && e$1("input", {
51808
+ ref: inputRef,
50937
51809
  id: prefixId$2(`${id}-search`, formId),
50938
51810
  class: "fjs-select-hidden-input",
50939
51811
  value: valueLabel,
@@ -51127,34 +51999,36 @@
51127
51999
  } = F$1(FormContext$1);
51128
52000
  const errorMessageId = errors.length === 0 ? undefined : `${prefixId$2(id, formId)}-error-message`;
51129
52001
  const [filter, setFilter] = l$2('');
51130
- const [filteredOptions, setFilteredOptions] = l$2([]);
51131
52002
  const [isDropdownExpanded, setIsDropdownExpanded] = l$2(false);
51132
- const [hasOptionsLeft, setHasOptionsLeft] = l$2(true);
51133
52003
  const [isEscapeClosed, setIsEscapeClose] = l$2(false);
51134
52004
  const focusScopeRef = s$1();
51135
52005
  const inputRef = s$1();
51136
52006
  const eventBus = useService$2('eventBus');
51137
52007
  const {
51138
- state: loadState,
51139
- values: options
51140
- } = useValuesAsync(field);
52008
+ loadState,
52009
+ options
52010
+ } = useOptionsAsync(field);
52011
+ useCleanupMultiSelectValues({
52012
+ field,
52013
+ loadState,
52014
+ options,
52015
+ values,
52016
+ onChange: props.onChange
52017
+ });
51141
52018
 
51142
52019
  // We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
51143
52020
  const valueToOptionMap = d(() => Object.assign({}, ...options.map((o, x) => ({
51144
52021
  [o.value]: options[x]
51145
52022
  }))), [options]);
52023
+ const hasOptionsLeft = d(() => options.length > values.length, [options.length, values.length]);
51146
52024
 
51147
52025
  // Usage of stringify is necessary here because we want this effect to only trigger when there is a value change to the array
51148
- y(() => {
51149
- if (loadState === LOAD_STATES.LOADED) {
51150
- setFilteredOptions(options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase()) && !values.includes(o.value)));
51151
- } else {
51152
- setFilteredOptions([]);
52026
+ const filteredOptions = d(() => {
52027
+ if (loadState !== LOAD_STATES.LOADED) {
52028
+ return [];
51153
52029
  }
51154
- }, [filter, JSON.stringify(values), options, loadState]);
51155
- y(() => {
51156
- setHasOptionsLeft(options.length > values.length);
51157
- }, [options.length, values.length]);
52030
+ return options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase()) && !values.includes(o.value));
52031
+ }, [filter, options, JSON.stringify(values), loadState]);
51158
52032
  const selectValue = value => {
51159
52033
  if (filter) {
51160
52034
  setFilter('');
@@ -51281,7 +52155,7 @@
51281
52155
  onMouseDown: e => e.preventDefault(),
51282
52156
  children: [e$1("span", {
51283
52157
  class: "fjs-taglist-tag-label",
51284
- children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
52158
+ children: valueToOptionMap[v] ? valueToOptionMap[v].label : undefined
51285
52159
  }), !disabled && !readonly && e$1("button", {
51286
52160
  type: "button",
51287
52161
  title: "Remove tag",
@@ -51500,7 +52374,7 @@
51500
52374
  sanitizeValue: ({
51501
52375
  value
51502
52376
  }) => {
51503
- if (isArray$3(value) || isObject$1(value)) {
52377
+ if (isArray$3(value) || isObject$1(value) || isNil$1(value)) {
51504
52378
  return '';
51505
52379
  }
51506
52380
 
@@ -51590,7 +52464,7 @@
51590
52464
  emptyValue: '',
51591
52465
  sanitizeValue: ({
51592
52466
  value
51593
- }) => isArray$3(value) || isObject$1(value) ? '' : String(value),
52467
+ }) => isArray$3(value) || isObject$1(value) || isNil$1(value) ? '' : String(value),
51594
52468
  create: (options = {}) => ({
51595
52469
  ...options
51596
52470
  })
@@ -51613,9 +52487,9 @@
51613
52487
  // Overflow is hidden by default to hide scrollbar flickering
51614
52488
  textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
51615
52489
  };
51616
- var _path$d;
51617
- function _extends$f() {
51618
- _extends$f = Object.assign ? Object.assign.bind() : function (target) {
52490
+ var _path$f;
52491
+ function _extends$g() {
52492
+ _extends$g = Object.assign ? Object.assign.bind() : function (target) {
51619
52493
  for (var i = 1; i < arguments.length; i++) {
51620
52494
  var source = arguments[i];
51621
52495
  for (var key in source) {
@@ -51626,23 +52500,23 @@
51626
52500
  }
51627
52501
  return target;
51628
52502
  };
51629
- return _extends$f.apply(this, arguments);
52503
+ return _extends$g.apply(this, arguments);
51630
52504
  }
51631
52505
  var SvgButton = function SvgButton(props) {
51632
- return /*#__PURE__*/v$1("svg", _extends$f({
52506
+ return /*#__PURE__*/v$1("svg", _extends$g({
51633
52507
  xmlns: "http://www.w3.org/2000/svg",
51634
52508
  width: 54,
51635
52509
  height: 54,
51636
52510
  fill: "currentcolor"
51637
- }, props), _path$d || (_path$d = /*#__PURE__*/v$1("path", {
52511
+ }, props), _path$f || (_path$f = /*#__PURE__*/v$1("path", {
51638
52512
  fillRule: "evenodd",
51639
52513
  d: "M45 17a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V20a3 3 0 0 1 3-3h36zm-9 8.889H18v2.222h18v-2.222z"
51640
52514
  })));
51641
52515
  };
51642
52516
  var ButtonIcon = SvgButton;
51643
- var _path$c;
51644
- function _extends$e() {
51645
- _extends$e = Object.assign ? Object.assign.bind() : function (target) {
52517
+ var _path$e;
52518
+ function _extends$f() {
52519
+ _extends$f = Object.assign ? Object.assign.bind() : function (target) {
51646
52520
  for (var i = 1; i < arguments.length; i++) {
51647
52521
  var source = arguments[i];
51648
52522
  for (var key in source) {
@@ -51653,22 +52527,22 @@
51653
52527
  }
51654
52528
  return target;
51655
52529
  };
51656
- return _extends$e.apply(this, arguments);
52530
+ return _extends$f.apply(this, arguments);
51657
52531
  }
51658
52532
  var SvgCheckbox = function SvgCheckbox(props) {
51659
- return /*#__PURE__*/v$1("svg", _extends$e({
52533
+ return /*#__PURE__*/v$1("svg", _extends$f({
51660
52534
  xmlns: "http://www.w3.org/2000/svg",
51661
52535
  width: 54,
51662
52536
  height: 54,
51663
52537
  fill: "currentcolor"
51664
- }, props), _path$c || (_path$c = /*#__PURE__*/v$1("path", {
52538
+ }, props), _path$e || (_path$e = /*#__PURE__*/v$1("path", {
51665
52539
  d: "M34 18H20a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V20a2 2 0 0 0-2-2zm-9 14-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
51666
52540
  })));
51667
52541
  };
51668
52542
  var CheckboxIcon = SvgCheckbox;
51669
- var _g, _use, _use2, _use3, _defs;
51670
- function _extends$d() {
51671
- _extends$d = Object.assign ? Object.assign.bind() : function (target) {
52543
+ var _path$d;
52544
+ function _extends$e() {
52545
+ _extends$e = Object.assign ? Object.assign.bind() : function (target) {
51672
52546
  for (var i = 1; i < arguments.length; i++) {
51673
52547
  var source = arguments[i];
51674
52548
  for (var key in source) {
@@ -51679,45 +52553,25 @@
51679
52553
  }
51680
52554
  return target;
51681
52555
  };
51682
- return _extends$d.apply(this, arguments);
52556
+ return _extends$e.apply(this, arguments);
51683
52557
  }
51684
52558
  var SvgChecklist = function SvgChecklist(props) {
51685
- return /*#__PURE__*/v$1("svg", _extends$d({
52559
+ return /*#__PURE__*/v$1("svg", _extends$e({
51686
52560
  xmlns: "http://www.w3.org/2000/svg",
51687
- xmlnsXlink: "http://www.w3.org/1999/xlink",
51688
52561
  width: 54,
51689
52562
  height: 54,
51690
- fill: "currentcolor"
51691
- }, props), _g || (_g = /*#__PURE__*/v$1("g", {
51692
- fillRule: "evenodd"
51693
- }, /*#__PURE__*/v$1("use", {
51694
- xlinkHref: "#Checklist_svg__a"
51695
- }), /*#__PURE__*/v$1("use", {
51696
- xlinkHref: "#Checklist_svg__a",
51697
- y: 24
51698
- }), /*#__PURE__*/v$1("use", {
51699
- xlinkHref: "#Checklist_svg__a",
51700
- y: 12
51701
- }))), _use || (_use = /*#__PURE__*/v$1("use", {
51702
- xlinkHref: "#Checklist_svg__b"
51703
- })), _use2 || (_use2 = /*#__PURE__*/v$1("use", {
51704
- xlinkHref: "#Checklist_svg__b",
51705
- y: 12
51706
- })), _use3 || (_use3 = /*#__PURE__*/v$1("use", {
51707
- xlinkHref: "#Checklist_svg__b",
51708
- y: 24
51709
- })), _defs || (_defs = /*#__PURE__*/v$1("defs", null, /*#__PURE__*/v$1("path", {
51710
- id: "Checklist_svg__a",
51711
- d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-6z"
51712
- }), /*#__PURE__*/v$1("path", {
51713
- id: "Checklist_svg__b",
51714
- d: "M23 14.5a1 1 0 0 1 1-1h19a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1v-1z"
51715
- }))));
52563
+ fill: "none"
52564
+ }, props), _path$d || (_path$d = /*#__PURE__*/v$1("path", {
52565
+ fill: "currentColor",
52566
+ fillRule: "evenodd",
52567
+ d: "M14.35 24.75H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 37.05H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414ZM14.35 12.45H19v4.65h-4.65v-4.65Zm-1.414-1.414a2 2 0 0 1 1.414-.586H19a2 2 0 0 1 2 2v4.65a2 2 0 0 1-2 2h-4.65a2 2 0 0 1-2-2v-4.65a2 2 0 0 1 .586-1.414Zm12.007 14.977a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0 12.3a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Zm0-24.6a1 1 0 0 0-.293.707v.65a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-.65a1 1 0 0 0-1-1h-15a1 1 0 0 0-.707.293Z",
52568
+ clipRule: "evenodd"
52569
+ })));
51716
52570
  };
51717
52571
  var ChecklistIcon = SvgChecklist;
51718
- var _path$b, _path2$2, _path3$1;
51719
- function _extends$c() {
51720
- _extends$c = Object.assign ? Object.assign.bind() : function (target) {
52572
+ var _path$c, _path2$3, _path3$1;
52573
+ function _extends$d() {
52574
+ _extends$d = Object.assign ? Object.assign.bind() : function (target) {
51721
52575
  for (var i = 1; i < arguments.length; i++) {
51722
52576
  var source = arguments[i];
51723
52577
  for (var key in source) {
@@ -51728,18 +52582,18 @@
51728
52582
  }
51729
52583
  return target;
51730
52584
  };
51731
- return _extends$c.apply(this, arguments);
52585
+ return _extends$d.apply(this, arguments);
51732
52586
  }
51733
52587
  var SvgDatetime = function SvgDatetime(props) {
51734
- return /*#__PURE__*/v$1("svg", _extends$c({
52588
+ return /*#__PURE__*/v$1("svg", _extends$d({
51735
52589
  xmlns: "http://www.w3.org/2000/svg",
51736
52590
  width: 54,
51737
52591
  height: 54,
51738
52592
  fill: "currentcolor"
51739
- }, props), _path$b || (_path$b = /*#__PURE__*/v$1("path", {
52593
+ }, props), _path$c || (_path$c = /*#__PURE__*/v$1("path", {
51740
52594
  fillRule: "evenodd",
51741
52595
  d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36a2.07 2.07 0 0 0-2.06 2.06v23.549a2.07 2.07 0 0 0 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 0 1-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592a.71.71 0 0 1 .707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z"
51742
- })), _path2$2 || (_path2$2 = /*#__PURE__*/v$1("path", {
52596
+ })), _path2$3 || (_path2$3 = /*#__PURE__*/v$1("path", {
51743
52597
  d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
51744
52598
  })), _path3$1 || (_path3$1 = /*#__PURE__*/v$1("path", {
51745
52599
  fillRule: "evenodd",
@@ -51747,9 +52601,9 @@
51747
52601
  })));
51748
52602
  };
51749
52603
  var DatetimeIcon = SvgDatetime;
51750
- var _path$a, _path2$1$1;
51751
- function _extends$b() {
51752
- _extends$b = Object.assign ? Object.assign.bind() : function (target) {
52604
+ var _path$b, _path2$2;
52605
+ function _extends$c() {
52606
+ _extends$c = Object.assign ? Object.assign.bind() : function (target) {
51753
52607
  for (var i = 1; i < arguments.length; i++) {
51754
52608
  var source = arguments[i];
51755
52609
  for (var key in source) {
@@ -51760,25 +52614,25 @@
51760
52614
  }
51761
52615
  return target;
51762
52616
  };
51763
- return _extends$b.apply(this, arguments);
52617
+ return _extends$c.apply(this, arguments);
51764
52618
  }
51765
52619
  var SvgTaglist = function SvgTaglist(props) {
51766
- return /*#__PURE__*/v$1("svg", _extends$b({
52620
+ return /*#__PURE__*/v$1("svg", _extends$c({
51767
52621
  xmlns: "http://www.w3.org/2000/svg",
51768
52622
  width: 54,
51769
52623
  height: 54,
51770
52624
  fill: "currentcolor"
51771
- }, props), _path$a || (_path$a = /*#__PURE__*/v$1("path", {
52625
+ }, props), _path$b || (_path$b = /*#__PURE__*/v$1("path", {
51772
52626
  fillRule: "evenodd",
51773
52627
  d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36Zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1Z"
51774
- })), _path2$1$1 || (_path2$1$1 = /*#__PURE__*/v$1("path", {
52628
+ })), _path2$2 || (_path2$2 = /*#__PURE__*/v$1("path", {
51775
52629
  d: "M11 22a1 1 0 0 1 1-1h19a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H12a1 1 0 0 1-1-1V22Z"
51776
52630
  })));
51777
52631
  };
51778
52632
  var TaglistIcon = SvgTaglist;
51779
52633
  var _rect$1, _rect2, _rect3;
51780
- function _extends$a() {
51781
- _extends$a = Object.assign ? Object.assign.bind() : function (target) {
52634
+ function _extends$b() {
52635
+ _extends$b = Object.assign ? Object.assign.bind() : function (target) {
51782
52636
  for (var i = 1; i < arguments.length; i++) {
51783
52637
  var source = arguments[i];
51784
52638
  for (var key in source) {
@@ -51789,10 +52643,10 @@
51789
52643
  }
51790
52644
  return target;
51791
52645
  };
51792
- return _extends$a.apply(this, arguments);
52646
+ return _extends$b.apply(this, arguments);
51793
52647
  }
51794
52648
  var SvgForm = function SvgForm(props) {
51795
- return /*#__PURE__*/v$1("svg", _extends$a({
52649
+ return /*#__PURE__*/v$1("svg", _extends$b({
51796
52650
  xmlns: "http://www.w3.org/2000/svg",
51797
52651
  width: 54,
51798
52652
  height: 54
@@ -51817,6 +52671,33 @@
51817
52671
  })));
51818
52672
  };
51819
52673
  var FormIcon = SvgForm;
52674
+ var _path$a;
52675
+ function _extends$a() {
52676
+ _extends$a = Object.assign ? Object.assign.bind() : function (target) {
52677
+ for (var i = 1; i < arguments.length; i++) {
52678
+ var source = arguments[i];
52679
+ for (var key in source) {
52680
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
52681
+ target[key] = source[key];
52682
+ }
52683
+ }
52684
+ }
52685
+ return target;
52686
+ };
52687
+ return _extends$a.apply(this, arguments);
52688
+ }
52689
+ var SvgGroup = function SvgGroup(props) {
52690
+ return /*#__PURE__*/v$1("svg", _extends$a({
52691
+ xmlns: "http://www.w3.org/2000/svg",
52692
+ width: 54,
52693
+ height: 54,
52694
+ fill: "currentcolor"
52695
+ }, props), _path$a || (_path$a = /*#__PURE__*/v$1("path", {
52696
+ fillRule: "evenodd",
52697
+ d: "M8 33v5a1 1 0 0 0 1 1h4v2H9a3 3 0 0 1-3-3v-5h2Zm18 6v2H15v-2h11Zm13 0v2H28v-2h11Zm9-6v5a3 3 0 0 1-3 3h-4v-2h4a1 1 0 0 0 .993-.883L46 38v-5h2ZM8 22v9H6v-9h2Zm40 0v9h-2v-9h2Zm-35-9v2H9a1 1 0 0 0-.993.883L8 16v4H6v-4a3 3 0 0 1 3-3h4Zm32 0a3 3 0 0 1 3 3v4h-2v-4a1 1 0 0 0-.883-.993L45 15h-4v-2h4Zm-6 0v2H28v-2h11Zm-13 0v2H15v-2h11Z"
52698
+ })));
52699
+ };
52700
+ var GroupIcon = SvgGroup;
51820
52701
  var _path$9;
51821
52702
  function _extends$9() {
51822
52703
  _extends$9 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51832,7 +52713,7 @@
51832
52713
  };
51833
52714
  return _extends$9.apply(this, arguments);
51834
52715
  }
51835
- var SvgGroup = function SvgGroup(props) {
52716
+ var SvgNumber = function SvgNumber(props) {
51836
52717
  return /*#__PURE__*/v$1("svg", _extends$9({
51837
52718
  xmlns: "http://www.w3.org/2000/svg",
51838
52719
  width: 54,
@@ -51840,10 +52721,10 @@
51840
52721
  fill: "currentcolor"
51841
52722
  }, props), _path$9 || (_path$9 = /*#__PURE__*/v$1("path", {
51842
52723
  fillRule: "evenodd",
51843
- d: "M8 33v5a1 1 0 0 0 1 1h4v2H9a3 3 0 0 1-3-3v-5h2Zm18 6v2H15v-2h11Zm13 0v2H28v-2h11Zm9-6v5a3 3 0 0 1-3 3h-4v-2h4a1 1 0 0 0 .993-.883L46 38v-5h2ZM8 22v9H6v-9h2Zm40 0v9h-2v-9h2Zm-35-9v2H9a1 1 0 0 0-.993.883L8 16v4H6v-4a3 3 0 0 1 3-3h4Zm32 0a3 3 0 0 1 3 3v4h-2v-4a1 1 0 0 0-.883-.993L45 15h-4v-2h4Zm-6 0v2H28v-2h11Zm-13 0v2H15v-2h11Z"
52724
+ d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
51844
52725
  })));
51845
52726
  };
51846
- var GroupIcon = SvgGroup;
52727
+ var NumberIcon = SvgNumber;
51847
52728
  var _path$8;
51848
52729
  function _extends$8() {
51849
52730
  _extends$8 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51859,18 +52740,17 @@
51859
52740
  };
51860
52741
  return _extends$8.apply(this, arguments);
51861
52742
  }
51862
- var SvgNumber = function SvgNumber(props) {
52743
+ var SvgRadio = function SvgRadio(props) {
51863
52744
  return /*#__PURE__*/v$1("svg", _extends$8({
51864
52745
  xmlns: "http://www.w3.org/2000/svg",
51865
52746
  width: 54,
51866
52747
  height: 54,
51867
52748
  fill: "currentcolor"
51868
52749
  }, props), _path$8 || (_path$8 = /*#__PURE__*/v$1("path", {
51869
- fillRule: "evenodd",
51870
- d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
52750
+ d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18a8 8 0 1 1 0-16 8 8 0 1 1 0 16z"
51871
52751
  })));
51872
52752
  };
51873
- var NumberIcon = SvgNumber;
52753
+ var RadioIcon = SvgRadio;
51874
52754
  var _path$7;
51875
52755
  function _extends$7() {
51876
52756
  _extends$7 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51886,17 +52766,18 @@
51886
52766
  };
51887
52767
  return _extends$7.apply(this, arguments);
51888
52768
  }
51889
- var SvgRadio = function SvgRadio(props) {
52769
+ var SvgSelect = function SvgSelect(props) {
51890
52770
  return /*#__PURE__*/v$1("svg", _extends$7({
51891
52771
  xmlns: "http://www.w3.org/2000/svg",
51892
52772
  width: 54,
51893
52773
  height: 54,
51894
52774
  fill: "currentcolor"
51895
52775
  }, props), _path$7 || (_path$7 = /*#__PURE__*/v$1("path", {
51896
- d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18a8 8 0 1 1 0-16 8 8 0 1 1 0 16z"
52776
+ fillRule: "evenodd",
52777
+ d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-12 7h9l-4.5 6-4.5-6z"
51897
52778
  })));
51898
52779
  };
51899
- var RadioIcon = SvgRadio;
52780
+ var SelectIcon = SvgSelect;
51900
52781
  var _path$6;
51901
52782
  function _extends$6() {
51902
52783
  _extends$6 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51912,18 +52793,18 @@
51912
52793
  };
51913
52794
  return _extends$6.apply(this, arguments);
51914
52795
  }
51915
- var SvgSelect = function SvgSelect(props) {
52796
+ var SvgSeparator = function SvgSeparator(props) {
51916
52797
  return /*#__PURE__*/v$1("svg", _extends$6({
51917
52798
  xmlns: "http://www.w3.org/2000/svg",
51918
52799
  width: 54,
51919
52800
  height: 54,
51920
- fill: "currentcolor"
52801
+ fill: "none"
51921
52802
  }, props), _path$6 || (_path$6 = /*#__PURE__*/v$1("path", {
51922
- fillRule: "evenodd",
51923
- d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-12 7h9l-4.5 6-4.5-6z"
52803
+ fill: "currentColor",
52804
+ d: "M26.293 16.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 18.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4ZM9 26h36v2H9v-2Zm13.293 7.707 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 35.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
51924
52805
  })));
51925
52806
  };
51926
- var SelectIcon = SvgSelect;
52807
+ var SeparatorIcon = SvgSeparator;
51927
52808
  var _path$5;
51928
52809
  function _extends$5() {
51929
52810
  _extends$5 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51939,7 +52820,7 @@
51939
52820
  };
51940
52821
  return _extends$5.apply(this, arguments);
51941
52822
  }
51942
- var SvgSeparator = function SvgSeparator(props) {
52823
+ var SvgSpacer = function SvgSpacer(props) {
51943
52824
  return /*#__PURE__*/v$1("svg", _extends$5({
51944
52825
  xmlns: "http://www.w3.org/2000/svg",
51945
52826
  width: 54,
@@ -51947,10 +52828,10 @@
51947
52828
  fill: "none"
51948
52829
  }, props), _path$5 || (_path$5 = /*#__PURE__*/v$1("path", {
51949
52830
  fill: "currentColor",
51950
- d: "M26.293 16.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 18.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4ZM9 26h36v2H9v-2Zm13.293 7.707 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 35.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
52831
+ d: "M9 15v2h36v-2H9Zm0 22v2h36v-2H9Zm17.293-17.707a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 21.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4Zm-4 11.414 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 32.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
51951
52832
  })));
51952
52833
  };
51953
- var SeparatorIcon = SvgSeparator;
52834
+ var SpacerIcon = SvgSpacer;
51954
52835
  var _path$4$1;
51955
52836
  function _extends$4$1() {
51956
52837
  _extends$4$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51966,18 +52847,17 @@
51966
52847
  };
51967
52848
  return _extends$4$1.apply(this, arguments);
51968
52849
  }
51969
- var SvgSpacer = function SvgSpacer(props) {
52850
+ var SvgText = function SvgText(props) {
51970
52851
  return /*#__PURE__*/v$1("svg", _extends$4$1({
51971
52852
  xmlns: "http://www.w3.org/2000/svg",
51972
52853
  width: 54,
51973
52854
  height: 54,
51974
- fill: "none"
52855
+ fill: "currentcolor"
51975
52856
  }, props), _path$4$1 || (_path$4$1 = /*#__PURE__*/v$1("path", {
51976
- fill: "currentColor",
51977
- d: "M9 15v2h36v-2H9Zm0 22v2h36v-2H9Zm17.293-17.707a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 21.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4Zm-4 11.414 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 32.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
52857
+ d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 0 1 2.4.14 3.42 3.42 0 0 1 1.41.55 3.47 3.47 0 0 1 1 1.14 3 3 0 0 1 .42 1.58 3.26 3.26 0 0 1-1.91 2.94 3.63 3.63 0 0 1 1.91 1.22 3.28 3.28 0 0 1 .66 2 4 4 0 0 1-.43 1.8 3.63 3.63 0 0 1-1.09 1.4 3.89 3.89 0 0 1-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 0 0 1.1-.49 1.41 1.41 0 0 0 .41-1 1.49 1.49 0 0 0-.35-1 1.54 1.54 0 0 0-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 0 0 1.88-.09 1.65 1.65 0 0 0 1-.54 1.6 1.6 0 0 0 .38-1.14 1.75 1.75 0 0 0-.29-1 1.69 1.69 0 0 0-.86-.62 9.28 9.28 0 0 0-2.41-.23zm19.62.92 2.65.84a5.94 5.94 0 0 1-2 3.29A5.74 5.74 0 0 1 41.38 34a5.87 5.87 0 0 1-4.44-1.84 7.09 7.09 0 0 1-1.73-5A7.43 7.43 0 0 1 37 21.87 6 6 0 0 1 41.54 20a5.64 5.64 0 0 1 4 1.47A5.33 5.33 0 0 1 47 24l-2.7.65a2.8 2.8 0 0 0-2.86-2.27A3.09 3.09 0 0 0 39 23.42a5.31 5.31 0 0 0-.93 3.5 5.62 5.62 0 0 0 .93 3.65 3 3 0 0 0 2.4 1.09 2.72 2.72 0 0 0 1.82-.66 4 4 0 0 0 1.13-2.21z"
51978
52858
  })));
51979
52859
  };
51980
- var SpacerIcon = SvgSpacer;
52860
+ var TextIcon = SvgText;
51981
52861
  var _path$3$1;
51982
52862
  function _extends$3$1() {
51983
52863
  _extends$3$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -51993,17 +52873,18 @@
51993
52873
  };
51994
52874
  return _extends$3$1.apply(this, arguments);
51995
52875
  }
51996
- var SvgText = function SvgText(props) {
52876
+ var SvgTextfield = function SvgTextfield(props) {
51997
52877
  return /*#__PURE__*/v$1("svg", _extends$3$1({
51998
52878
  xmlns: "http://www.w3.org/2000/svg",
51999
52879
  width: 54,
52000
52880
  height: 54,
52001
52881
  fill: "currentcolor"
52002
52882
  }, props), _path$3$1 || (_path$3$1 = /*#__PURE__*/v$1("path", {
52003
- d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 0 1 2.4.14 3.42 3.42 0 0 1 1.41.55 3.47 3.47 0 0 1 1 1.14 3 3 0 0 1 .42 1.58 3.26 3.26 0 0 1-1.91 2.94 3.63 3.63 0 0 1 1.91 1.22 3.28 3.28 0 0 1 .66 2 4 4 0 0 1-.43 1.8 3.63 3.63 0 0 1-1.09 1.4 3.89 3.89 0 0 1-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 0 0 1.1-.49 1.41 1.41 0 0 0 .41-1 1.49 1.49 0 0 0-.35-1 1.54 1.54 0 0 0-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 0 0 1.88-.09 1.65 1.65 0 0 0 1-.54 1.6 1.6 0 0 0 .38-1.14 1.75 1.75 0 0 0-.29-1 1.69 1.69 0 0 0-.86-.62 9.28 9.28 0 0 0-2.41-.23zm19.62.92 2.65.84a5.94 5.94 0 0 1-2 3.29A5.74 5.74 0 0 1 41.38 34a5.87 5.87 0 0 1-4.44-1.84 7.09 7.09 0 0 1-1.73-5A7.43 7.43 0 0 1 37 21.87 6 6 0 0 1 41.54 20a5.64 5.64 0 0 1 4 1.47A5.33 5.33 0 0 1 47 24l-2.7.65a2.8 2.8 0 0 0-2.86-2.27A3.09 3.09 0 0 0 39 23.42a5.31 5.31 0 0 0-.93 3.5 5.62 5.62 0 0 0 .93 3.65 3 3 0 0 0 2.4 1.09 2.72 2.72 0 0 0 1.82-.66 4 4 0 0 0 1.13-2.21z"
52883
+ fillRule: "evenodd",
52884
+ d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-32 4v10h-2V22h2z"
52004
52885
  })));
52005
52886
  };
52006
- var TextIcon = SvgText;
52887
+ var TextfieldIcon = SvgTextfield;
52007
52888
  var _path$2$1;
52008
52889
  function _extends$2$1() {
52009
52890
  _extends$2$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -52019,7 +52900,7 @@
52019
52900
  };
52020
52901
  return _extends$2$1.apply(this, arguments);
52021
52902
  }
52022
- var SvgTextfield = function SvgTextfield(props) {
52903
+ var SvgTextarea = function SvgTextarea(props) {
52023
52904
  return /*#__PURE__*/v$1("svg", _extends$2$1({
52024
52905
  xmlns: "http://www.w3.org/2000/svg",
52025
52906
  width: 54,
@@ -52027,11 +52908,11 @@
52027
52908
  fill: "currentcolor"
52028
52909
  }, props), _path$2$1 || (_path$2$1 = /*#__PURE__*/v$1("path", {
52029
52910
  fillRule: "evenodd",
52030
- d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-32 4v10h-2V22h2z"
52911
+ d: "M45 13a3 3 0 0 1 3 3v22a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V16a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v22a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V16a1 1 0 0 0-1-1zm-1.136 15.5.849.849-6.364 6.364-.849-.849 6.364-6.364zm.264 3.5.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
52031
52912
  })));
52032
52913
  };
52033
- var TextfieldIcon = SvgTextfield;
52034
- var _path$1$1;
52914
+ var TextareaIcon = SvgTextarea;
52915
+ var _path$1$1, _path2$1$1;
52035
52916
  function _extends$1$1() {
52036
52917
  _extends$1$1 = Object.assign ? Object.assign.bind() : function (target) {
52037
52918
  for (var i = 1; i < arguments.length; i++) {
@@ -52046,21 +52927,26 @@
52046
52927
  };
52047
52928
  return _extends$1$1.apply(this, arguments);
52048
52929
  }
52049
- var SvgTextarea = function SvgTextarea(props) {
52930
+ var SvgIFrame = function SvgIFrame(props) {
52050
52931
  return /*#__PURE__*/v$1("svg", _extends$1$1({
52051
52932
  xmlns: "http://www.w3.org/2000/svg",
52052
52933
  width: 54,
52053
52934
  height: 54,
52054
- fill: "currentcolor"
52935
+ fill: "none"
52055
52936
  }, props), _path$1$1 || (_path$1$1 = /*#__PURE__*/v$1("path", {
52937
+ fill: "currentcolor",
52938
+ d: "M34.467 37.3 41 31l-6.533-6.3-1.32 1.273L38.36 31l-5.213 5.027 1.32 1.273ZM19.533 24.7 13 31l6.533 6.3 1.32-1.273L15.64 31l5.214-5.027-1.32-1.273Zm4.127 14.832 1.805.468 4.875-17.532L28.535 22 23.66 39.532Z"
52939
+ })), _path2$1$1 || (_path2$1$1 = /*#__PURE__*/v$1("path", {
52940
+ fill: "currentcolor",
52056
52941
  fillRule: "evenodd",
52057
- d: "M45 13a3 3 0 0 1 3 3v22a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V16a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v22a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V16a1 1 0 0 0-1-1zm-1.136 15.5.849.849-6.364 6.364-.849-.849 6.364-6.364zm.264 3.5.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
52942
+ d: "M46 9a3 3 0 0 1 3 3v30a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V12a3 3 0 0 1 3-3h38Zm0 2H8a1 1 0 0 0-1 1v4h40v-4a1 1 0 0 0-1-1ZM7 42V18h40v24a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1Z",
52943
+ clipRule: "evenodd"
52058
52944
  })));
52059
52945
  };
52060
- var TextareaIcon = SvgTextarea;
52061
- var _path$j, _path2$4;
52062
- function _extends$m() {
52063
- _extends$m = Object.assign ? Object.assign.bind() : function (target) {
52946
+ var IFrameIcon = SvgIFrame;
52947
+ var _path$l, _path2$5;
52948
+ function _extends$n() {
52949
+ _extends$n = Object.assign ? Object.assign.bind() : function (target) {
52064
52950
  for (var i = 1; i < arguments.length; i++) {
52065
52951
  var source = arguments[i];
52066
52952
  for (var key in source) {
@@ -52071,19 +52957,19 @@
52071
52957
  }
52072
52958
  return target;
52073
52959
  };
52074
- return _extends$m.apply(this, arguments);
52960
+ return _extends$n.apply(this, arguments);
52075
52961
  }
52076
52962
  var SvgImage = function SvgImage(props) {
52077
- return /*#__PURE__*/v$1("svg", _extends$m({
52963
+ return /*#__PURE__*/v$1("svg", _extends$n({
52078
52964
  xmlns: "http://www.w3.org/2000/svg",
52079
52965
  width: 54,
52080
52966
  height: 54,
52081
52967
  fill: "currentcolor"
52082
- }, props), _path$j || (_path$j = /*#__PURE__*/v$1("path", {
52968
+ }, props), _path$l || (_path$l = /*#__PURE__*/v$1("path", {
52083
52969
  fillRule: "evenodd",
52084
52970
  d: "M34.636 21.91A3.818 3.818 0 1 1 27 21.908a3.818 3.818 0 0 1 7.636 0Zm-2 0A1.818 1.818 0 1 1 29 21.908a1.818 1.818 0 0 1 3.636 0Z",
52085
52971
  clipRule: "evenodd"
52086
- })), _path2$4 || (_path2$4 = /*#__PURE__*/v$1("path", {
52972
+ })), _path2$5 || (_path2$5 = /*#__PURE__*/v$1("path", {
52087
52973
  fillRule: "evenodd",
52088
52974
  d: "M15 13a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V15a2 2 0 0 0-2-2H15Zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 0 1 2.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 0 1 2.411.239L39 32.73V15ZM15 39v-8.754a.975.975 0 0 0 .168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 0 0 2.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15Z",
52089
52975
  clipRule: "evenodd"
@@ -52098,6 +52984,7 @@
52098
52984
  columns: GroupIcon,
52099
52985
  datetime: DatetimeIcon,
52100
52986
  group: GroupIcon,
52987
+ iframe: IFrameIcon,
52101
52988
  image: ImageIcon,
52102
52989
  number: NumberIcon,
52103
52990
  radio: RadioIcon,
@@ -52111,7 +52998,7 @@
52111
52998
  default: FormIcon
52112
52999
  }[type];
52113
53000
  };
52114
- const formFields = [Button, Checkbox$1, Checklist, FormComponent$1, Group$1, Image$1, Numberfield, Datetime, Radio, Select$1, Spacer, Separator, Taglist, Text$1, Textfield$1, Textarea];
53001
+ const formFields = [Button, Checkbox$1, Checklist, FormComponent$1, Group$1, IFrame, Image$1, Numberfield, Datetime, Radio, Select$1, Spacer, Separator, Taglist, Text$1, Textfield$1, Textarea];
52115
53002
  class FormFields {
52116
53003
  constructor() {
52117
53004
  this._formFields = {};
@@ -52180,8 +53067,8 @@
52180
53067
  container.classList.add(`${prefix}-container`);
52181
53068
  return container;
52182
53069
  }
52183
- const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression'];
52184
- const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text'];
53070
+ const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url'];
53071
+ const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
52185
53072
 
52186
53073
  /**
52187
53074
  * @template T
@@ -54636,7 +55523,7 @@
54636
55523
  }, data);
54637
55524
  }
54638
55525
  }
54639
- const schemaVersion = 12;
55526
+ const schemaVersion = 13;
54640
55527
 
54641
55528
  /**
54642
55529
  * Flatten array, one level deep.
@@ -59808,6 +60695,24 @@
59808
60695
  function calculateMaxColumnsWithAuto(autoCols) {
59809
60696
  return MAX_COLUMNS_PER_ROW - autoCols * 2;
59810
60697
  }
60698
+ function EditorIFrame(props) {
60699
+ const {
60700
+ field
60701
+ } = props;
60702
+ const Icon = iconsByType(field.type);
60703
+ return e$1("div", {
60704
+ class: "fjs-iframe-placeholder",
60705
+ children: e$1("p", {
60706
+ class: "fjs-iframe-placeholder-text",
60707
+ children: [e$1(Icon, {
60708
+ width: "32",
60709
+ height: "24",
60710
+ viewBox: "0 0 56 56"
60711
+ }), "iFrame"]
60712
+ })
60713
+ });
60714
+ }
60715
+ EditorIFrame.config = IFrame.config;
59811
60716
  const emptyImage = createEmptyImage();
59812
60717
  function editorFormFieldClasses(type, {
59813
60718
  disabled = false
@@ -60178,7 +61083,7 @@
60178
61083
  });
60179
61084
  }
60180
61085
  EditorText.config = Text$1.config;
60181
- const editorFormFields = [EditorText];
61086
+ const editorFormFields = [EditorIFrame, EditorText];
60182
61087
  class EditorFormFields extends FormFields {
60183
61088
  constructor() {
60184
61089
  super();
@@ -60468,6 +61373,9 @@
60468
61373
  }, {
60469
61374
  label: 'Presentation',
60470
61375
  id: 'presentation'
61376
+ }, {
61377
+ label: 'Containers',
61378
+ id: 'container'
60471
61379
  }, {
60472
61380
  label: 'Action',
60473
61381
  id: 'action'
@@ -62470,11 +63378,13 @@
62470
63378
  * @param { import('../../../FormEditor').default } formEditor
62471
63379
  * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
62472
63380
  * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
63381
+ * @param { import('@bpmn-io/form-js-viewer').FormLayouter } formLayouter
62473
63382
  */
62474
- constructor(formEditor, formFieldRegistry, pathRegistry) {
63383
+ constructor(formEditor, formFieldRegistry, pathRegistry, formLayouter) {
62475
63384
  this._formEditor = formEditor;
62476
63385
  this._formFieldRegistry = formFieldRegistry;
62477
63386
  this._pathRegistry = pathRegistry;
63387
+ this._formLayouter = formLayouter;
62478
63388
  }
62479
63389
  execute(context) {
62480
63390
  this.moveFormField(context);
@@ -62521,8 +63431,8 @@
62521
63431
  }
62522
63432
  const formField = get(schema, [...sourcePath, sourceIndex]);
62523
63433
 
62524
- // (1) Add to row
62525
- updateRow(formField, targetRow ? targetRow.id : null);
63434
+ // (1) Add to row or create new one
63435
+ updateRow(formField, targetRow ? targetRow.id : this._formLayouter.nextRowId());
62526
63436
 
62527
63437
  // (2) Move form field
62528
63438
  mutate(get(schema, sourcePath), sourceIndex, targetIndex);
@@ -62547,8 +63457,8 @@
62547
63457
  get(schema, sourcePath).forEach((formField, index) => updatePath(this._formFieldRegistry, formField, index));
62548
63458
  const targetPath = [...targetFormField._path, 'components'];
62549
63459
 
62550
- // (4) Add to row
62551
- updateRow(formField, targetRow ? targetRow.id : null);
63460
+ // (4) Add to row or create new one
63461
+ updateRow(formField, targetRow ? targetRow.id : this._formLayouter.nextRowId());
62552
63462
 
62553
63463
  // (5) Add form field
62554
63464
  arrayAdd$1(get(schema, targetPath), targetIndex, formField);
@@ -62571,7 +63481,7 @@
62571
63481
  });
62572
63482
  }
62573
63483
  }
62574
- MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry', 'pathRegistry'];
63484
+ MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry', 'pathRegistry', 'formLayouter'];
62575
63485
  class RemoveFormFieldHandler {
62576
63486
  /**
62577
63487
  * @constructor
@@ -63155,12 +64065,21 @@
63155
64065
  const {
63156
64066
  schema
63157
64067
  } = this._formEditor._getState();
64068
+ const setRowIds = parent => {
64069
+ if (!parent.components || !parent.components.length) {
64070
+ return;
64071
+ }
64072
+ parent.components.forEach(formField => {
64073
+ const row = this._formLayouter.getRowForField(formField);
64074
+ updateRow(formField, row.id);
64075
+
64076
+ // handle children recursively
64077
+ setRowIds(formField);
64078
+ });
64079
+ };
63158
64080
 
63159
64081
  // make sure rows are persisted in schema (e.g. for migration case)
63160
- schema.components.forEach(formField => {
63161
- const row = this._formLayouter.getRowForField(formField);
63162
- updateRow(formField, row.id);
63163
- });
64082
+ setRowIds(schema);
63164
64083
  }
63165
64084
  }
63166
64085
  FormLayoutUpdater.$inject = ['eventBus', 'formLayouter', 'modeling', 'formEditor'];
@@ -68676,6 +69595,8 @@
68676
69595
  description,
68677
69596
  path,
68678
69597
  props,
69598
+ getValue,
69599
+ setValue,
68679
69600
  isDefaultVisible
68680
69601
  } = options;
68681
69602
  const {
@@ -68690,8 +69611,10 @@
68690
69611
  editField,
68691
69612
  description,
68692
69613
  component: SimpleBoolComponent,
68693
- isEdited: isEdited$5,
68694
- isDefaultVisible
69614
+ isEdited: isEdited$8,
69615
+ isDefaultVisible,
69616
+ getValue,
69617
+ setValue
68695
69618
  };
68696
69619
  }
68697
69620
  const SimpleBoolComponent = props => {
@@ -68701,16 +69624,17 @@
68701
69624
  path,
68702
69625
  field,
68703
69626
  editField,
69627
+ getValue = () => get(field, path, ''),
69628
+ setValue = value => editField(field, path, value || false),
68704
69629
  description
68705
69630
  } = props;
68706
- const getValue = () => get(field, path, '');
68707
- const setValue = value => editField(field, path, value || false);
68708
- return CheckboxEntry({
69631
+ return ToggleSwitchEntry({
68709
69632
  element: field,
68710
69633
  getValue,
68711
69634
  id,
68712
69635
  label,
68713
69636
  setValue,
69637
+ inline: true,
68714
69638
  description
68715
69639
  });
68716
69640
  };
@@ -68764,7 +69688,7 @@
68764
69688
  editField,
68765
69689
  field,
68766
69690
  isEdited: isEdited$6,
68767
- isDefaultVisible: field => INPUTS.includes(field.type) || field.type === 'button' || field.type === 'group'
69691
+ isDefaultVisible: field => INPUTS.includes(field.type) || field.type === 'button' || field.type === 'group' || field.type === 'iframe'
68768
69692
  });
68769
69693
  return entries;
68770
69694
  }
@@ -68785,7 +69709,7 @@
68785
69709
  const setValue = value => {
68786
69710
  return editField(field, path, value || '');
68787
69711
  };
68788
- const label = field.type === 'group' ? 'Group label' : 'Field label';
69712
+ const label = getLabelText(field);
68789
69713
  return FeelTemplatingEntry({
68790
69714
  debounce,
68791
69715
  element: field,
@@ -68853,6 +69777,162 @@
68853
69777
  variables
68854
69778
  });
68855
69779
  }
69780
+
69781
+ // helpers //////////
69782
+
69783
+ function getLabelText(field) {
69784
+ const {
69785
+ type
69786
+ } = field;
69787
+ if (type === 'group') {
69788
+ return 'Group label';
69789
+ }
69790
+ if (type === 'iframe') {
69791
+ return 'Title';
69792
+ }
69793
+ return 'Field label';
69794
+ }
69795
+ function HeightEntry(props) {
69796
+ const {
69797
+ editField,
69798
+ field,
69799
+ id,
69800
+ description,
69801
+ isDefaultVisible,
69802
+ defaultValue
69803
+ } = props;
69804
+ const entries = [];
69805
+ entries.push({
69806
+ id: id + '-height',
69807
+ component: Height,
69808
+ description,
69809
+ isEdited: isEdited$7,
69810
+ editField,
69811
+ field,
69812
+ defaultValue,
69813
+ isDefaultVisible: field => {
69814
+ if (isFunction(isDefaultVisible)) {
69815
+ return isDefaultVisible(field);
69816
+ }
69817
+ return field.type === 'spacer';
69818
+ }
69819
+ });
69820
+ return entries;
69821
+ }
69822
+ function Height(props) {
69823
+ const {
69824
+ description,
69825
+ editField,
69826
+ field,
69827
+ id,
69828
+ defaultValue = 60 // default value for spacer
69829
+ } = props;
69830
+ const debounce = useService('debounce');
69831
+ const getValue = e => get(field, ['height'], defaultValue);
69832
+ const setValue = (value, error) => {
69833
+ if (error) {
69834
+ return;
69835
+ }
69836
+ editField(field, ['height'], value);
69837
+ };
69838
+ return NumberFieldEntry({
69839
+ debounce,
69840
+ description,
69841
+ label: 'Height',
69842
+ element: field,
69843
+ id,
69844
+ getValue,
69845
+ setValue,
69846
+ validate: value => {
69847
+ if (value === undefined || value === null) return;
69848
+ if (value < 1) return 'Should be greater than zero.';
69849
+ if (!Number.isInteger(value)) return 'Should be an integer.';
69850
+ }
69851
+ });
69852
+ }
69853
+ function IFrameHeightEntry(props) {
69854
+ return [...HeightEntry({
69855
+ ...props,
69856
+ defaultValue: 300,
69857
+ description: 'Height of the container in pixels.',
69858
+ isDefaultVisible: field => field.type === 'iframe'
69859
+ })];
69860
+ }
69861
+ const HTTPS_PATTERN = /^(https):\/\/*/i; // eslint-disable-line no-useless-escape
69862
+
69863
+ function IFrameUrlEntry(props) {
69864
+ const {
69865
+ editField,
69866
+ field
69867
+ } = props;
69868
+ const entries = [];
69869
+ entries.push({
69870
+ id: 'url',
69871
+ component: Url,
69872
+ editField: editField,
69873
+ field: field,
69874
+ isEdited: isEdited$6,
69875
+ isDefaultVisible: field => field.type === 'iframe'
69876
+ });
69877
+ return entries;
69878
+ }
69879
+ function Url(props) {
69880
+ const {
69881
+ editField,
69882
+ field,
69883
+ id
69884
+ } = props;
69885
+ const debounce = useService('debounce');
69886
+ const variables = useVariables().map(name => ({
69887
+ name
69888
+ }));
69889
+ const path = ['url'];
69890
+ const getValue = () => {
69891
+ return get(field, path, '');
69892
+ };
69893
+ const setValue = value => {
69894
+ return editField(field, path, value);
69895
+ };
69896
+ const validate = value => {
69897
+ if (!value) {
69898
+ return;
69899
+ }
69900
+ if (!HTTPS_PATTERN.test(value)) {
69901
+ return 'For security reasons the URL must start with "https".';
69902
+ }
69903
+ };
69904
+ return FeelTemplatingEntry({
69905
+ debounce,
69906
+ element: field,
69907
+ feel: 'optional',
69908
+ getValue,
69909
+ id,
69910
+ label: 'URL',
69911
+ setValue,
69912
+ singleLine: true,
69913
+ tooltip: getTooltip(),
69914
+ validate,
69915
+ variables
69916
+ });
69917
+ }
69918
+
69919
+ // helper //////////////////////
69920
+
69921
+ function getTooltip() {
69922
+ return e$1(d$1, {
69923
+ children: [e$1("p", {
69924
+ children: "Enter a HTTPS URL to a source or populate it dynamically via a template or an expression (e.g., to pass a value from the variable)."
69925
+ }), e$1("p", {
69926
+ children: "Please make sure that the URL is safe as it might impose security risks."
69927
+ }), e$1("p", {
69928
+ children: ["Not all external sources can be displayed in the iFrame. Read more about it in the ", e$1("a", {
69929
+ target: "_blank",
69930
+ href: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options",
69931
+ children: "X-FRAME-OPTIONS documentation"
69932
+ }), "."]
69933
+ })]
69934
+ });
69935
+ }
68856
69936
  function SourceEntry(props) {
68857
69937
  const {
68858
69938
  editField,
@@ -68963,51 +70043,6 @@
68963
70043
  variables
68964
70044
  });
68965
70045
  }
68966
- function SpacerEntry(props) {
68967
- const {
68968
- editField,
68969
- field,
68970
- id
68971
- } = props;
68972
- const entries = [];
68973
- entries.push({
68974
- id: id + '-height',
68975
- component: SpacerHeight,
68976
- isEdited: isEdited$7,
68977
- editField,
68978
- field,
68979
- isDefaultVisible: field => field.type === 'spacer'
68980
- });
68981
- return entries;
68982
- }
68983
- function SpacerHeight(props) {
68984
- const {
68985
- editField,
68986
- field,
68987
- id
68988
- } = props;
68989
- const debounce = useService('debounce');
68990
- const getValue = e => get(field, ['height']);
68991
- const setValue = (value, error) => {
68992
- if (error) {
68993
- return;
68994
- }
68995
- editField(field, ['height'], value);
68996
- };
68997
- return NumberFieldEntry({
68998
- debounce,
68999
- label: 'Height',
69000
- element: field,
69001
- id,
69002
- getValue,
69003
- setValue,
69004
- validate: value => {
69005
- if (value === undefined || value === null) return;
69006
- if (value < 1) return 'Should be greater than zero.';
69007
- if (!Number.isInteger(value)) return 'Should be an integer.';
69008
- }
69009
- });
69010
- }
69011
70046
  function NumberEntries(props) {
69012
70047
  const {
69013
70048
  editField,
@@ -70062,7 +71097,13 @@
70062
71097
  field,
70063
71098
  editField,
70064
71099
  getService
70065
- }), ...SpacerEntry({
71100
+ }), ...IFrameUrlEntry({
71101
+ field,
71102
+ editField
71103
+ }), ...IFrameHeightEntry({
71104
+ field,
71105
+ editField
71106
+ }), ...HeightEntry({
70066
71107
  field,
70067
71108
  editField
70068
71109
  }), ...NumberEntries({
@@ -72822,7 +73863,8 @@
72822
73863
  const dataEditor = dataEditorRef.current = new JSONEditor({
72823
73864
  value: toString(data),
72824
73865
  contentAttributes: {
72825
- 'aria-label': 'Form Input'
73866
+ 'aria-label': 'Form Input',
73867
+ tabIndex: 0
72826
73868
  },
72827
73869
  placeholder: createDataEditorPlaceholder()
72828
73870
  });
@@ -72830,7 +73872,8 @@
72830
73872
  readonly: true,
72831
73873
  value: toString(resultData),
72832
73874
  contentAttributes: {
72833
- 'aria-label': 'Form Output'
73875
+ 'aria-label': 'Form Output',
73876
+ tabIndex: 0
72834
73877
  }
72835
73878
  });
72836
73879
  const form = formRef.current = new Form({