tinacms 2.7.9 → 2.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4578,28 +4578,28 @@ var __publicField = (obj, key, value) => {
4578
4578
  }
4579
4579
  renderNavigation() {
4580
4580
  const date = this.props.viewDate;
4581
- const locale = date.localeData();
4581
+ const locale2 = date.localeData();
4582
4582
  return /* @__PURE__ */ React.createElement(
4583
4583
  ViewNavigation,
4584
4584
  {
4585
4585
  onClickPrev: () => this.props.navigate(-1, "months"),
4586
4586
  onClickSwitch: () => this.props.showView("months"),
4587
4587
  onClickNext: () => this.props.navigate(1, "months"),
4588
- switchContent: locale.months(date) + " " + date.year(),
4588
+ switchContent: locale2.months(date) + " " + date.year(),
4589
4589
  switchColSpan: 5,
4590
4590
  switchProps: { "data-value": this.props.viewDate.month() }
4591
4591
  }
4592
4592
  );
4593
4593
  }
4594
4594
  renderDayHeaders() {
4595
- const locale = this.props.viewDate.localeData();
4596
- const dayItems = getDaysOfWeek(locale).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
4595
+ const locale2 = this.props.viewDate.localeData();
4596
+ const dayItems = getDaysOfWeek(locale2).map((day, index) => /* @__PURE__ */ React.createElement("th", { key: day + index, className: "dow" }, day));
4597
4597
  return /* @__PURE__ */ React.createElement("tr", null, dayItems);
4598
4598
  }
4599
4599
  renderDays() {
4600
4600
  const date = this.props.viewDate;
4601
4601
  const startOfMonth = date.clone().startOf("month");
4602
- const endOfMonth = date.clone().endOf("month");
4602
+ const endOfMonth2 = date.clone().endOf("month");
4603
4603
  const rows = [[], [], [], [], [], []];
4604
4604
  const startDate = date.clone().subtract(1, "months");
4605
4605
  startDate.date(startDate.daysInMonth()).startOf("week");
@@ -4607,12 +4607,12 @@ var __publicField = (obj, key, value) => {
4607
4607
  let i = 0;
4608
4608
  while (startDate.isBefore(endDate)) {
4609
4609
  const row = getRow$2(rows, i++);
4610
- row.push(this.renderDay(startDate, startOfMonth, endOfMonth));
4610
+ row.push(this.renderDay(startDate, startOfMonth, endOfMonth2));
4611
4611
  startDate.add(1, "d");
4612
4612
  }
4613
4613
  return rows.map((r, i2) => /* @__PURE__ */ React.createElement("tr", { key: `${endDate.month()}_${i2}` }, r));
4614
4614
  }
4615
- renderDay(date, startOfMonth, endOfMonth) {
4615
+ renderDay(date, startOfMonth, endOfMonth2) {
4616
4616
  const selectedDate = this.props.selectedDate;
4617
4617
  const dayProps = {
4618
4618
  key: date.format("M_D"),
@@ -4623,7 +4623,7 @@ var __publicField = (obj, key, value) => {
4623
4623
  let className = "rdtDay";
4624
4624
  if (date.isBefore(startOfMonth)) {
4625
4625
  className += " rdtOld";
4626
- } else if (date.isAfter(endOfMonth)) {
4626
+ } else if (date.isAfter(endOfMonth2)) {
4627
4627
  className += " rdtNew";
4628
4628
  }
4629
4629
  if (selectedDate && date.isSame(selectedDate, "day")) {
@@ -4666,11 +4666,11 @@ var __publicField = (obj, key, value) => {
4666
4666
  function getRow$2(rows, day) {
4667
4667
  return rows[Math.floor(day / 7)];
4668
4668
  }
4669
- function getDaysOfWeek(locale) {
4670
- const first = locale.firstDayOfWeek();
4669
+ function getDaysOfWeek(locale2) {
4670
+ const first = locale2.firstDayOfWeek();
4671
4671
  const dow = [];
4672
4672
  let i = 0;
4673
- locale._weekdaysMin.forEach(function(day) {
4673
+ locale2._weekdaysMin.forEach(function(day) {
4674
4674
  dow[(7 + i++ - first) % 7] = day;
4675
4675
  });
4676
4676
  return dow;
@@ -5403,19 +5403,19 @@ var __publicField = (obj, key, value) => {
5403
5403
  ).localeData();
5404
5404
  }
5405
5405
  getDateFormat() {
5406
- const locale = this.getLocaleData();
5406
+ const locale2 = this.getLocaleData();
5407
5407
  const format2 = this.props.dateFormat;
5408
5408
  if (format2 === true)
5409
- return locale.longDateFormat("L");
5409
+ return locale2.longDateFormat("L");
5410
5410
  if (format2)
5411
5411
  return format2;
5412
5412
  return "";
5413
5413
  }
5414
5414
  getTimeFormat() {
5415
- const locale = this.getLocaleData();
5415
+ const locale2 = this.getLocaleData();
5416
5416
  const format2 = this.props.timeFormat;
5417
5417
  if (format2 === true) {
5418
- return locale.longDateFormat("LT");
5418
+ return locale2.longDateFormat("LT");
5419
5419
  }
5420
5420
  return format2 || "";
5421
5421
  }
@@ -8618,10 +8618,723 @@ var __publicField = (obj, key, value) => {
8618
8618
  function VscNewFile(props) {
8619
8619
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z" }, "child": [] }] })(props);
8620
8620
  }
8621
- const version = "2.7.9";
8622
8621
  function cn(...inputs) {
8623
8622
  return tailwindMerge.twMerge(clsx.clsx(inputs));
8624
8623
  }
8624
+ var defaultOptions = {};
8625
+ function getDefaultOptions() {
8626
+ return defaultOptions;
8627
+ }
8628
+ function _typeof(o) {
8629
+ "@babel/helpers - typeof";
8630
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
8631
+ return typeof o2;
8632
+ } : function(o2) {
8633
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
8634
+ }, _typeof(o);
8635
+ }
8636
+ function requiredArgs(required, args) {
8637
+ if (args.length < required) {
8638
+ throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
8639
+ }
8640
+ }
8641
+ function toDate(argument) {
8642
+ requiredArgs(1, arguments);
8643
+ var argStr = Object.prototype.toString.call(argument);
8644
+ if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") {
8645
+ return new Date(argument.getTime());
8646
+ } else if (typeof argument === "number" || argStr === "[object Number]") {
8647
+ return new Date(argument);
8648
+ } else {
8649
+ if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
8650
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
8651
+ console.warn(new Error().stack);
8652
+ }
8653
+ return /* @__PURE__ */ new Date(NaN);
8654
+ }
8655
+ }
8656
+ function compareAsc(dirtyDateLeft, dirtyDateRight) {
8657
+ requiredArgs(2, arguments);
8658
+ var dateLeft = toDate(dirtyDateLeft);
8659
+ var dateRight = toDate(dirtyDateRight);
8660
+ var diff = dateLeft.getTime() - dateRight.getTime();
8661
+ if (diff < 0) {
8662
+ return -1;
8663
+ } else if (diff > 0) {
8664
+ return 1;
8665
+ } else {
8666
+ return diff;
8667
+ }
8668
+ }
8669
+ function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
8670
+ requiredArgs(2, arguments);
8671
+ var dateLeft = toDate(dirtyDateLeft);
8672
+ var dateRight = toDate(dirtyDateRight);
8673
+ var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
8674
+ var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
8675
+ return yearDiff * 12 + monthDiff;
8676
+ }
8677
+ function endOfDay(dirtyDate) {
8678
+ requiredArgs(1, arguments);
8679
+ var date = toDate(dirtyDate);
8680
+ date.setHours(23, 59, 59, 999);
8681
+ return date;
8682
+ }
8683
+ function endOfMonth(dirtyDate) {
8684
+ requiredArgs(1, arguments);
8685
+ var date = toDate(dirtyDate);
8686
+ var month = date.getMonth();
8687
+ date.setFullYear(date.getFullYear(), month + 1, 0);
8688
+ date.setHours(23, 59, 59, 999);
8689
+ return date;
8690
+ }
8691
+ function isLastDayOfMonth(dirtyDate) {
8692
+ requiredArgs(1, arguments);
8693
+ var date = toDate(dirtyDate);
8694
+ return endOfDay(date).getTime() === endOfMonth(date).getTime();
8695
+ }
8696
+ function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
8697
+ requiredArgs(2, arguments);
8698
+ var dateLeft = toDate(dirtyDateLeft);
8699
+ var dateRight = toDate(dirtyDateRight);
8700
+ var sign = compareAsc(dateLeft, dateRight);
8701
+ var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
8702
+ var result;
8703
+ if (difference < 1) {
8704
+ result = 0;
8705
+ } else {
8706
+ if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
8707
+ dateLeft.setDate(30);
8708
+ }
8709
+ dateLeft.setMonth(dateLeft.getMonth() - sign * difference);
8710
+ var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;
8711
+ if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
8712
+ isLastMonthNotFull = false;
8713
+ }
8714
+ result = sign * (difference - Number(isLastMonthNotFull));
8715
+ }
8716
+ return result === 0 ? 0 : result;
8717
+ }
8718
+ function differenceInMilliseconds(dateLeft, dateRight) {
8719
+ requiredArgs(2, arguments);
8720
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
8721
+ }
8722
+ var roundingMap = {
8723
+ ceil: Math.ceil,
8724
+ round: Math.round,
8725
+ floor: Math.floor,
8726
+ trunc: function trunc(value) {
8727
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
8728
+ }
8729
+ // Math.trunc is not supported by IE
8730
+ };
8731
+ var defaultRoundingMethod = "trunc";
8732
+ function getRoundingMethod(method) {
8733
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
8734
+ }
8735
+ function differenceInSeconds(dateLeft, dateRight, options) {
8736
+ requiredArgs(2, arguments);
8737
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / 1e3;
8738
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
8739
+ }
8740
+ var formatDistanceLocale = {
8741
+ lessThanXSeconds: {
8742
+ one: "less than a second",
8743
+ other: "less than {{count}} seconds"
8744
+ },
8745
+ xSeconds: {
8746
+ one: "1 second",
8747
+ other: "{{count}} seconds"
8748
+ },
8749
+ halfAMinute: "half a minute",
8750
+ lessThanXMinutes: {
8751
+ one: "less than a minute",
8752
+ other: "less than {{count}} minutes"
8753
+ },
8754
+ xMinutes: {
8755
+ one: "1 minute",
8756
+ other: "{{count}} minutes"
8757
+ },
8758
+ aboutXHours: {
8759
+ one: "about 1 hour",
8760
+ other: "about {{count}} hours"
8761
+ },
8762
+ xHours: {
8763
+ one: "1 hour",
8764
+ other: "{{count}} hours"
8765
+ },
8766
+ xDays: {
8767
+ one: "1 day",
8768
+ other: "{{count}} days"
8769
+ },
8770
+ aboutXWeeks: {
8771
+ one: "about 1 week",
8772
+ other: "about {{count}} weeks"
8773
+ },
8774
+ xWeeks: {
8775
+ one: "1 week",
8776
+ other: "{{count}} weeks"
8777
+ },
8778
+ aboutXMonths: {
8779
+ one: "about 1 month",
8780
+ other: "about {{count}} months"
8781
+ },
8782
+ xMonths: {
8783
+ one: "1 month",
8784
+ other: "{{count}} months"
8785
+ },
8786
+ aboutXYears: {
8787
+ one: "about 1 year",
8788
+ other: "about {{count}} years"
8789
+ },
8790
+ xYears: {
8791
+ one: "1 year",
8792
+ other: "{{count}} years"
8793
+ },
8794
+ overXYears: {
8795
+ one: "over 1 year",
8796
+ other: "over {{count}} years"
8797
+ },
8798
+ almostXYears: {
8799
+ one: "almost 1 year",
8800
+ other: "almost {{count}} years"
8801
+ }
8802
+ };
8803
+ var formatDistance$1 = function formatDistance2(token, count, options) {
8804
+ var result;
8805
+ var tokenValue = formatDistanceLocale[token];
8806
+ if (typeof tokenValue === "string") {
8807
+ result = tokenValue;
8808
+ } else if (count === 1) {
8809
+ result = tokenValue.one;
8810
+ } else {
8811
+ result = tokenValue.other.replace("{{count}}", count.toString());
8812
+ }
8813
+ if (options !== null && options !== void 0 && options.addSuffix) {
8814
+ if (options.comparison && options.comparison > 0) {
8815
+ return "in " + result;
8816
+ } else {
8817
+ return result + " ago";
8818
+ }
8819
+ }
8820
+ return result;
8821
+ };
8822
+ const formatDistance$2 = formatDistance$1;
8823
+ function buildFormatLongFn(args) {
8824
+ return function() {
8825
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8826
+ var width = options.width ? String(options.width) : args.defaultWidth;
8827
+ var format2 = args.formats[width] || args.formats[args.defaultWidth];
8828
+ return format2;
8829
+ };
8830
+ }
8831
+ var dateFormats = {
8832
+ full: "EEEE, MMMM do, y",
8833
+ long: "MMMM do, y",
8834
+ medium: "MMM d, y",
8835
+ short: "MM/dd/yyyy"
8836
+ };
8837
+ var timeFormats = {
8838
+ full: "h:mm:ss a zzzz",
8839
+ long: "h:mm:ss a z",
8840
+ medium: "h:mm:ss a",
8841
+ short: "h:mm a"
8842
+ };
8843
+ var dateTimeFormats = {
8844
+ full: "{{date}} 'at' {{time}}",
8845
+ long: "{{date}} 'at' {{time}}",
8846
+ medium: "{{date}}, {{time}}",
8847
+ short: "{{date}}, {{time}}"
8848
+ };
8849
+ var formatLong = {
8850
+ date: buildFormatLongFn({
8851
+ formats: dateFormats,
8852
+ defaultWidth: "full"
8853
+ }),
8854
+ time: buildFormatLongFn({
8855
+ formats: timeFormats,
8856
+ defaultWidth: "full"
8857
+ }),
8858
+ dateTime: buildFormatLongFn({
8859
+ formats: dateTimeFormats,
8860
+ defaultWidth: "full"
8861
+ })
8862
+ };
8863
+ const formatLong$1 = formatLong;
8864
+ var formatRelativeLocale = {
8865
+ lastWeek: "'last' eeee 'at' p",
8866
+ yesterday: "'yesterday at' p",
8867
+ today: "'today at' p",
8868
+ tomorrow: "'tomorrow at' p",
8869
+ nextWeek: "eeee 'at' p",
8870
+ other: "P"
8871
+ };
8872
+ var formatRelative = function formatRelative2(token, _date, _baseDate, _options) {
8873
+ return formatRelativeLocale[token];
8874
+ };
8875
+ const formatRelative$1 = formatRelative;
8876
+ function buildLocalizeFn(args) {
8877
+ return function(dirtyIndex, options) {
8878
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
8879
+ var valuesArray;
8880
+ if (context === "formatting" && args.formattingValues) {
8881
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
8882
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
8883
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
8884
+ } else {
8885
+ var _defaultWidth = args.defaultWidth;
8886
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
8887
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
8888
+ }
8889
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
8890
+ return valuesArray[index];
8891
+ };
8892
+ }
8893
+ var eraValues = {
8894
+ narrow: ["B", "A"],
8895
+ abbreviated: ["BC", "AD"],
8896
+ wide: ["Before Christ", "Anno Domini"]
8897
+ };
8898
+ var quarterValues = {
8899
+ narrow: ["1", "2", "3", "4"],
8900
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
8901
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
8902
+ };
8903
+ var monthValues = {
8904
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
8905
+ abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
8906
+ wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
8907
+ };
8908
+ var dayValues = {
8909
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
8910
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
8911
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
8912
+ wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
8913
+ };
8914
+ var dayPeriodValues = {
8915
+ narrow: {
8916
+ am: "a",
8917
+ pm: "p",
8918
+ midnight: "mi",
8919
+ noon: "n",
8920
+ morning: "morning",
8921
+ afternoon: "afternoon",
8922
+ evening: "evening",
8923
+ night: "night"
8924
+ },
8925
+ abbreviated: {
8926
+ am: "AM",
8927
+ pm: "PM",
8928
+ midnight: "midnight",
8929
+ noon: "noon",
8930
+ morning: "morning",
8931
+ afternoon: "afternoon",
8932
+ evening: "evening",
8933
+ night: "night"
8934
+ },
8935
+ wide: {
8936
+ am: "a.m.",
8937
+ pm: "p.m.",
8938
+ midnight: "midnight",
8939
+ noon: "noon",
8940
+ morning: "morning",
8941
+ afternoon: "afternoon",
8942
+ evening: "evening",
8943
+ night: "night"
8944
+ }
8945
+ };
8946
+ var formattingDayPeriodValues = {
8947
+ narrow: {
8948
+ am: "a",
8949
+ pm: "p",
8950
+ midnight: "mi",
8951
+ noon: "n",
8952
+ morning: "in the morning",
8953
+ afternoon: "in the afternoon",
8954
+ evening: "in the evening",
8955
+ night: "at night"
8956
+ },
8957
+ abbreviated: {
8958
+ am: "AM",
8959
+ pm: "PM",
8960
+ midnight: "midnight",
8961
+ noon: "noon",
8962
+ morning: "in the morning",
8963
+ afternoon: "in the afternoon",
8964
+ evening: "in the evening",
8965
+ night: "at night"
8966
+ },
8967
+ wide: {
8968
+ am: "a.m.",
8969
+ pm: "p.m.",
8970
+ midnight: "midnight",
8971
+ noon: "noon",
8972
+ morning: "in the morning",
8973
+ afternoon: "in the afternoon",
8974
+ evening: "in the evening",
8975
+ night: "at night"
8976
+ }
8977
+ };
8978
+ var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
8979
+ var number = Number(dirtyNumber);
8980
+ var rem100 = number % 100;
8981
+ if (rem100 > 20 || rem100 < 10) {
8982
+ switch (rem100 % 10) {
8983
+ case 1:
8984
+ return number + "st";
8985
+ case 2:
8986
+ return number + "nd";
8987
+ case 3:
8988
+ return number + "rd";
8989
+ }
8990
+ }
8991
+ return number + "th";
8992
+ };
8993
+ var localize = {
8994
+ ordinalNumber,
8995
+ era: buildLocalizeFn({
8996
+ values: eraValues,
8997
+ defaultWidth: "wide"
8998
+ }),
8999
+ quarter: buildLocalizeFn({
9000
+ values: quarterValues,
9001
+ defaultWidth: "wide",
9002
+ argumentCallback: function argumentCallback(quarter) {
9003
+ return quarter - 1;
9004
+ }
9005
+ }),
9006
+ month: buildLocalizeFn({
9007
+ values: monthValues,
9008
+ defaultWidth: "wide"
9009
+ }),
9010
+ day: buildLocalizeFn({
9011
+ values: dayValues,
9012
+ defaultWidth: "wide"
9013
+ }),
9014
+ dayPeriod: buildLocalizeFn({
9015
+ values: dayPeriodValues,
9016
+ defaultWidth: "wide",
9017
+ formattingValues: formattingDayPeriodValues,
9018
+ defaultFormattingWidth: "wide"
9019
+ })
9020
+ };
9021
+ const localize$1 = localize;
9022
+ function buildMatchFn(args) {
9023
+ return function(string) {
9024
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9025
+ var width = options.width;
9026
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
9027
+ var matchResult = string.match(matchPattern);
9028
+ if (!matchResult) {
9029
+ return null;
9030
+ }
9031
+ var matchedString = matchResult[0];
9032
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
9033
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
9034
+ return pattern.test(matchedString);
9035
+ }) : findKey(parsePatterns, function(pattern) {
9036
+ return pattern.test(matchedString);
9037
+ });
9038
+ var value;
9039
+ value = args.valueCallback ? args.valueCallback(key) : key;
9040
+ value = options.valueCallback ? options.valueCallback(value) : value;
9041
+ var rest = string.slice(matchedString.length);
9042
+ return {
9043
+ value,
9044
+ rest
9045
+ };
9046
+ };
9047
+ }
9048
+ function findKey(object, predicate) {
9049
+ for (var key in object) {
9050
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
9051
+ return key;
9052
+ }
9053
+ }
9054
+ return void 0;
9055
+ }
9056
+ function findIndex(array, predicate) {
9057
+ for (var key = 0; key < array.length; key++) {
9058
+ if (predicate(array[key])) {
9059
+ return key;
9060
+ }
9061
+ }
9062
+ return void 0;
9063
+ }
9064
+ function buildMatchPatternFn(args) {
9065
+ return function(string) {
9066
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9067
+ var matchResult = string.match(args.matchPattern);
9068
+ if (!matchResult)
9069
+ return null;
9070
+ var matchedString = matchResult[0];
9071
+ var parseResult = string.match(args.parsePattern);
9072
+ if (!parseResult)
9073
+ return null;
9074
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
9075
+ value = options.valueCallback ? options.valueCallback(value) : value;
9076
+ var rest = string.slice(matchedString.length);
9077
+ return {
9078
+ value,
9079
+ rest
9080
+ };
9081
+ };
9082
+ }
9083
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
9084
+ var parseOrdinalNumberPattern = /\d+/i;
9085
+ var matchEraPatterns = {
9086
+ narrow: /^(b|a)/i,
9087
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
9088
+ wide: /^(before christ|before common era|anno domini|common era)/i
9089
+ };
9090
+ var parseEraPatterns = {
9091
+ any: [/^b/i, /^(a|c)/i]
9092
+ };
9093
+ var matchQuarterPatterns = {
9094
+ narrow: /^[1234]/i,
9095
+ abbreviated: /^q[1234]/i,
9096
+ wide: /^[1234](th|st|nd|rd)? quarter/i
9097
+ };
9098
+ var parseQuarterPatterns = {
9099
+ any: [/1/i, /2/i, /3/i, /4/i]
9100
+ };
9101
+ var matchMonthPatterns = {
9102
+ narrow: /^[jfmasond]/i,
9103
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
9104
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
9105
+ };
9106
+ var parseMonthPatterns = {
9107
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
9108
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
9109
+ };
9110
+ var matchDayPatterns = {
9111
+ narrow: /^[smtwf]/i,
9112
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
9113
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
9114
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
9115
+ };
9116
+ var parseDayPatterns = {
9117
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
9118
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
9119
+ };
9120
+ var matchDayPeriodPatterns = {
9121
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
9122
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
9123
+ };
9124
+ var parseDayPeriodPatterns = {
9125
+ any: {
9126
+ am: /^a/i,
9127
+ pm: /^p/i,
9128
+ midnight: /^mi/i,
9129
+ noon: /^no/i,
9130
+ morning: /morning/i,
9131
+ afternoon: /afternoon/i,
9132
+ evening: /evening/i,
9133
+ night: /night/i
9134
+ }
9135
+ };
9136
+ var match = {
9137
+ ordinalNumber: buildMatchPatternFn({
9138
+ matchPattern: matchOrdinalNumberPattern,
9139
+ parsePattern: parseOrdinalNumberPattern,
9140
+ valueCallback: function valueCallback(value) {
9141
+ return parseInt(value, 10);
9142
+ }
9143
+ }),
9144
+ era: buildMatchFn({
9145
+ matchPatterns: matchEraPatterns,
9146
+ defaultMatchWidth: "wide",
9147
+ parsePatterns: parseEraPatterns,
9148
+ defaultParseWidth: "any"
9149
+ }),
9150
+ quarter: buildMatchFn({
9151
+ matchPatterns: matchQuarterPatterns,
9152
+ defaultMatchWidth: "wide",
9153
+ parsePatterns: parseQuarterPatterns,
9154
+ defaultParseWidth: "any",
9155
+ valueCallback: function valueCallback(index) {
9156
+ return index + 1;
9157
+ }
9158
+ }),
9159
+ month: buildMatchFn({
9160
+ matchPatterns: matchMonthPatterns,
9161
+ defaultMatchWidth: "wide",
9162
+ parsePatterns: parseMonthPatterns,
9163
+ defaultParseWidth: "any"
9164
+ }),
9165
+ day: buildMatchFn({
9166
+ matchPatterns: matchDayPatterns,
9167
+ defaultMatchWidth: "wide",
9168
+ parsePatterns: parseDayPatterns,
9169
+ defaultParseWidth: "any"
9170
+ }),
9171
+ dayPeriod: buildMatchFn({
9172
+ matchPatterns: matchDayPeriodPatterns,
9173
+ defaultMatchWidth: "any",
9174
+ parsePatterns: parseDayPeriodPatterns,
9175
+ defaultParseWidth: "any"
9176
+ })
9177
+ };
9178
+ const match$1 = match;
9179
+ var locale = {
9180
+ code: "en-US",
9181
+ formatDistance: formatDistance$2,
9182
+ formatLong: formatLong$1,
9183
+ formatRelative: formatRelative$1,
9184
+ localize: localize$1,
9185
+ match: match$1,
9186
+ options: {
9187
+ weekStartsOn: 0,
9188
+ firstWeekContainsDate: 1
9189
+ }
9190
+ };
9191
+ const defaultLocale = locale;
9192
+ function assign(target, object) {
9193
+ if (target == null) {
9194
+ throw new TypeError("assign requires that input parameter not be null or undefined");
9195
+ }
9196
+ for (var property in object) {
9197
+ if (Object.prototype.hasOwnProperty.call(object, property)) {
9198
+ target[property] = object[property];
9199
+ }
9200
+ }
9201
+ return target;
9202
+ }
9203
+ function cloneObject(object) {
9204
+ return assign({}, object);
9205
+ }
9206
+ function getTimezoneOffsetInMilliseconds(date) {
9207
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
9208
+ utcDate.setUTCFullYear(date.getFullYear());
9209
+ return date.getTime() - utcDate.getTime();
9210
+ }
9211
+ var MINUTES_IN_DAY = 1440;
9212
+ var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
9213
+ var MINUTES_IN_MONTH = 43200;
9214
+ var MINUTES_IN_TWO_MONTHS = 86400;
9215
+ function formatDistance(dirtyDate, dirtyBaseDate, options) {
9216
+ var _ref, _options$locale;
9217
+ requiredArgs(2, arguments);
9218
+ var defaultOptions2 = getDefaultOptions();
9219
+ var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
9220
+ if (!locale2.formatDistance) {
9221
+ throw new RangeError("locale must contain formatDistance property");
9222
+ }
9223
+ var comparison = compareAsc(dirtyDate, dirtyBaseDate);
9224
+ if (isNaN(comparison)) {
9225
+ throw new RangeError("Invalid time value");
9226
+ }
9227
+ var localizeOptions = assign(cloneObject(options), {
9228
+ addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
9229
+ comparison
9230
+ });
9231
+ var dateLeft;
9232
+ var dateRight;
9233
+ if (comparison > 0) {
9234
+ dateLeft = toDate(dirtyBaseDate);
9235
+ dateRight = toDate(dirtyDate);
9236
+ } else {
9237
+ dateLeft = toDate(dirtyDate);
9238
+ dateRight = toDate(dirtyBaseDate);
9239
+ }
9240
+ var seconds = differenceInSeconds(dateRight, dateLeft);
9241
+ var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3;
9242
+ var minutes = Math.round((seconds - offsetInSeconds) / 60);
9243
+ var months;
9244
+ if (minutes < 2) {
9245
+ if (options !== null && options !== void 0 && options.includeSeconds) {
9246
+ if (seconds < 5) {
9247
+ return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions);
9248
+ } else if (seconds < 10) {
9249
+ return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions);
9250
+ } else if (seconds < 20) {
9251
+ return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions);
9252
+ } else if (seconds < 40) {
9253
+ return locale2.formatDistance("halfAMinute", 0, localizeOptions);
9254
+ } else if (seconds < 60) {
9255
+ return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
9256
+ } else {
9257
+ return locale2.formatDistance("xMinutes", 1, localizeOptions);
9258
+ }
9259
+ } else {
9260
+ if (minutes === 0) {
9261
+ return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
9262
+ } else {
9263
+ return locale2.formatDistance("xMinutes", minutes, localizeOptions);
9264
+ }
9265
+ }
9266
+ } else if (minutes < 45) {
9267
+ return locale2.formatDistance("xMinutes", minutes, localizeOptions);
9268
+ } else if (minutes < 90) {
9269
+ return locale2.formatDistance("aboutXHours", 1, localizeOptions);
9270
+ } else if (minutes < MINUTES_IN_DAY) {
9271
+ var hours = Math.round(minutes / 60);
9272
+ return locale2.formatDistance("aboutXHours", hours, localizeOptions);
9273
+ } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
9274
+ return locale2.formatDistance("xDays", 1, localizeOptions);
9275
+ } else if (minutes < MINUTES_IN_MONTH) {
9276
+ var days = Math.round(minutes / MINUTES_IN_DAY);
9277
+ return locale2.formatDistance("xDays", days, localizeOptions);
9278
+ } else if (minutes < MINUTES_IN_TWO_MONTHS) {
9279
+ months = Math.round(minutes / MINUTES_IN_MONTH);
9280
+ return locale2.formatDistance("aboutXMonths", months, localizeOptions);
9281
+ }
9282
+ months = differenceInMonths(dateRight, dateLeft);
9283
+ if (months < 12) {
9284
+ var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
9285
+ return locale2.formatDistance("xMonths", nearestMonth, localizeOptions);
9286
+ } else {
9287
+ var monthsSinceStartOfYear = months % 12;
9288
+ var years = Math.floor(months / 12);
9289
+ if (monthsSinceStartOfYear < 3) {
9290
+ return locale2.formatDistance("aboutXYears", years, localizeOptions);
9291
+ } else if (monthsSinceStartOfYear < 9) {
9292
+ return locale2.formatDistance("overXYears", years, localizeOptions);
9293
+ } else {
9294
+ return locale2.formatDistance("almostXYears", years + 1, localizeOptions);
9295
+ }
9296
+ }
9297
+ }
9298
+ function formatDistanceToNow(dirtyDate, options) {
9299
+ requiredArgs(1, arguments);
9300
+ return formatDistance(dirtyDate, Date.now(), options);
9301
+ }
9302
+ const currentVersion = "1.0";
9303
+ const VersionInfo = () => {
9304
+ const cms = useCMS();
9305
+ const [isLoading, setIsLoading] = React.useState(true);
9306
+ const [latestVersionInfo, setLatestVersionInfo] = React.useState(null);
9307
+ React.useEffect(() => {
9308
+ const fetchVersionInfo = async () => {
9309
+ try {
9310
+ const latestVersion = await cms.api.tina.getLatestVersion();
9311
+ setLatestVersionInfo(latestVersion);
9312
+ } catch {
9313
+ }
9314
+ setIsLoading(false);
9315
+ };
9316
+ fetchVersionInfo();
9317
+ }, [cms]);
9318
+ return /* @__PURE__ */ React.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-4 text-gray-500" }, "TinaCMS v", currentVersion + " ", isLoading ? /* @__PURE__ */ React.createElement(lucideReact.LoaderCircle, { className: "animate-spin w-4 h-4 inline-block mb-px" }) : /* @__PURE__ */ React.createElement(LatestVersionWarning, { latestVersionInfo }));
9319
+ };
9320
+ const LatestVersionWarning = ({
9321
+ latestVersionInfo
9322
+ }) => {
9323
+ var _a, _b, _c;
9324
+ if (!latestVersionInfo)
9325
+ return null;
9326
+ const latestVersion = (_a = latestVersionInfo["tinacms"]) == null ? void 0 : _a.version;
9327
+ const relativePublishedAt = ((_b = latestVersionInfo.tinacms) == null ? void 0 : _b.publishedAt) ? formatDistanceToNow(new Date((_c = latestVersionInfo.tinacms) == null ? void 0 : _c.publishedAt), {
9328
+ addSuffix: true
9329
+ }) : "";
9330
+ if (!latestVersion) {
9331
+ return null;
9332
+ }
9333
+ if (latestVersion === currentVersion) {
9334
+ return /* @__PURE__ */ React.createElement(lucideReact.Check, { className: "w-4 h-4 inline-block mb-px text-green-500" });
9335
+ }
9336
+ return /* @__PURE__ */ React.createElement("span", { className: "text-yellow-700" }, /* @__PURE__ */ React.createElement(lucideReact.TriangleAlert, { className: "w-4 h-4 inline-block mb-px" }), /* @__PURE__ */ React.createElement("br", null), "v", latestVersion, " published ", relativePublishedAt);
9337
+ };
8625
9338
  function TbLogs(props) {
8626
9339
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 12h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 18h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 12h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 6h2" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 6h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 12h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 18h6" }, "child": [] }] })(props);
8627
9340
  }
@@ -8870,7 +9583,7 @@ var __publicField = (obj, key, value) => {
8870
9583
  className: "text-lg py-2 first:pt-3 last:pb-3 whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400",
8871
9584
  cms
8872
9585
  }
8873
- ), /* @__PURE__ */ React__namespace.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-4 text-gray-500" }, "TinaCMS v", version))
9586
+ ), /* @__PURE__ */ React__namespace.createElement(VersionInfo, null))
8874
9587
  ), eventsOpen && /* @__PURE__ */ React__namespace.createElement(
8875
9588
  SyncStatusModal,
8876
9589
  {
@@ -30996,6 +31709,22 @@ mutation addPendingDocumentMutation(
30996
31709
  throw error;
30997
31710
  }
30998
31711
  }
31712
+ async getLatestVersion() {
31713
+ const url = "https://content.tinajs.io/latest-version";
31714
+ try {
31715
+ const res = await fetch(url, {
31716
+ method: "GET"
31717
+ });
31718
+ if (!res.ok) {
31719
+ throw new Error(`Failed to fetch latest version: ${res.statusText}`);
31720
+ }
31721
+ const data = await res.json();
31722
+ return data;
31723
+ } catch (error) {
31724
+ console.error("Error fetching latest version:", error);
31725
+ throw error;
31726
+ }
31727
+ }
30999
31728
  }
31000
31729
  const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
31001
31730
  class LocalClient extends Client {
@@ -32679,11 +33408,11 @@ This will work when developing locally but NOT when deployed to production.
32679
33408
  });
32680
33409
  const loc = reactRouterDom.useLocation();
32681
33410
  React.useEffect(() => {
32682
- const match = loc.pathname.match(folderRegex);
32683
- const folderName = match ? decodeURIComponent(match[1]) : "";
33411
+ const match2 = loc.pathname.match(folderRegex);
33412
+ const folderName = match2 ? decodeURIComponent(match2[1]) : "";
32684
33413
  const update = {
32685
33414
  name: folderName,
32686
- fullyQualifiedName: match ? folderName ? `~/${folderName}` : "~" : "",
33415
+ fullyQualifiedName: match2 ? folderName ? `~/${folderName}` : "~" : "",
32687
33416
  loading: false,
32688
33417
  parentName: ""
32689
33418
  };
@@ -33938,11 +34667,11 @@ This will work when developing locally but NOT when deployed to production.
33938
34667
  }
33939
34668
  if (((_a2 = schemaCollection.match) == null ? void 0 : _a2.exclude) || ((_b2 = schemaCollection.match) == null ? void 0 : _b2.include)) {
33940
34669
  const filePath = `${schemaTools.normalizePath(schemaCollection.path)}/${value}.${schemaCollection.format || "md"}`;
33941
- const match = schema == null ? void 0 : schema.matchFiles({
34670
+ const match2 = schema == null ? void 0 : schema.matchFiles({
33942
34671
  files: [filePath],
33943
34672
  collection: schemaCollection
33944
34673
  });
33945
- if ((match == null ? void 0 : match.length) === 0) {
34674
+ if ((match2 == null ? void 0 : match2.length) === 0) {
33946
34675
  return `The filename "${value}" is not allowed for this collection.`;
33947
34676
  }
33948
34677
  }