@nebula.js/stardust 4.0.0-alpha.8 → 4.0.0-alpha.9

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.0.0-alpha.8
2
+ * @nebula.js/stardust v4.0.0-alpha.9
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -1720,6 +1720,246 @@
1720
1720
  "zh-TW": "不符計算條件"
1721
1721
  }
1722
1722
  };
1723
+ var Object_Listbox_Selected = {
1724
+ id: "Object.Listbox.Selected",
1725
+ locale: {
1726
+ "de-DE": "Ausgewählt",
1727
+ "en-US": "Selected",
1728
+ "es-ES": "Seleccionado",
1729
+ "fr-FR": "Sélectionné",
1730
+ "it-IT": "Selezionato",
1731
+ "ja-JP": "選択済み",
1732
+ "ko-KR": "선택됨",
1733
+ "nl-NL": "Geselecteerd",
1734
+ "pl-PL": "Wybrane",
1735
+ "pt-BR": "Selecionado",
1736
+ "ru-RU": "Выбранные",
1737
+ "sv-SE": "Urval",
1738
+ "tr-TR": "Seçilen",
1739
+ "zh-CN": "已选择",
1740
+ "zh-TW": "已選取"
1741
+ }
1742
+ };
1743
+ var Object_Listbox_Alternative = {
1744
+ id: "Object.Listbox.Alternative",
1745
+ locale: {
1746
+ "de-DE": "Alternative",
1747
+ "en-US": "Alternative",
1748
+ "es-ES": "Alternativo",
1749
+ "fr-FR": "Alternatif",
1750
+ "it-IT": "Alternativo",
1751
+ "ja-JP": "代替",
1752
+ "ko-KR": "대체 항목",
1753
+ "nl-NL": "Alternatief",
1754
+ "pl-PL": "Alternatywne",
1755
+ "pt-BR": "Alternativo",
1756
+ "ru-RU": "Альтернативные",
1757
+ "sv-SE": "Alternativ",
1758
+ "tr-TR": "Alternatif",
1759
+ "zh-CN": "可选",
1760
+ "zh-TW": "替代選項"
1761
+ }
1762
+ };
1763
+ var Object_Listbox_Optional = {
1764
+ id: "Object.Listbox.Optional",
1765
+ locale: {
1766
+ "de-DE": "Optional",
1767
+ "en-US": "Optional",
1768
+ "es-ES": "Opcional",
1769
+ "fr-FR": "Facultatif",
1770
+ "it-IT": "Opzionale",
1771
+ "ja-JP": "オプション",
1772
+ "ko-KR": "선택 사항",
1773
+ "nl-NL": "Optioneel",
1774
+ "pl-PL": "Opcjonalne",
1775
+ "pt-BR": "Opcional",
1776
+ "ru-RU": "Дополнительные",
1777
+ "sv-SE": "Valfritt",
1778
+ "tr-TR": "İsteğe bağlı",
1779
+ "zh-CN": "可选",
1780
+ "zh-TW": "選用"
1781
+ }
1782
+ };
1783
+ var Object_Listbox_SelectedExcluded = {
1784
+ id: "Object.Listbox.SelectedExcluded",
1785
+ locale: {
1786
+ "de-DE": "Ausgeschlossen ausgewählt",
1787
+ "en-US": "Selected excluded",
1788
+ "es-ES": "Seleccionado excluido",
1789
+ "fr-FR": "Sélectionné exclu",
1790
+ "it-IT": "Selezionato escluso",
1791
+ "ja-JP": "選択された除外値",
1792
+ "ko-KR": "제외 항목 선택됨",
1793
+ "nl-NL": "Geselecteerde uitgesloten",
1794
+ "pl-PL": "Wybrane wykluczone",
1795
+ "pt-BR": "Excluído selecionado",
1796
+ "ru-RU": "Выбранные исключенные элементы",
1797
+ "sv-SE": "Urval uteslutet",
1798
+ "tr-TR": "Seçili hariç tutulan",
1799
+ "zh-CN": "已排除选择",
1800
+ "zh-TW": "已選取排除值"
1801
+ }
1802
+ };
1803
+ var Object_Listbox_Locked = {
1804
+ id: "Object.Listbox.Locked",
1805
+ locale: {
1806
+ "de-DE": "Gesperrt",
1807
+ "en-US": "Locked",
1808
+ "es-ES": "Bloqueado",
1809
+ "fr-FR": "Verrouillé",
1810
+ "it-IT": "Bloccato",
1811
+ "ja-JP": "ロック済み",
1812
+ "ko-KR": "잠김",
1813
+ "nl-NL": "Vergrendeld",
1814
+ "pl-PL": "Zablokowane",
1815
+ "pt-BR": "Bloqueado",
1816
+ "ru-RU": "Заблокированные",
1817
+ "sv-SE": "Låst",
1818
+ "tr-TR": "Kilitli",
1819
+ "zh-CN": "已锁定",
1820
+ "zh-TW": "已鎖定"
1821
+ }
1822
+ };
1823
+ var Object_Listbox_Excluded = {
1824
+ id: "Object.Listbox.Excluded",
1825
+ locale: {
1826
+ "de-DE": "Ausgeschlossen",
1827
+ "en-US": "Excluded",
1828
+ "es-ES": "Excluido",
1829
+ "fr-FR": "Exclu",
1830
+ "it-IT": "Escluso",
1831
+ "ja-JP": "除外済み",
1832
+ "ko-KR": "제외됨",
1833
+ "nl-NL": "Uitgesloten",
1834
+ "pl-PL": "Wykluczone",
1835
+ "pt-BR": "Excluído",
1836
+ "ru-RU": "Исключенные",
1837
+ "sv-SE": "Uteslutet",
1838
+ "tr-TR": "Hariç tutulan",
1839
+ "zh-CN": "已排除",
1840
+ "zh-TW": "已排除"
1841
+ }
1842
+ };
1843
+ var Object_Listbox_ExcludedLock = {
1844
+ id: "Object.Listbox.ExcludedLock",
1845
+ locale: {
1846
+ "de-DE": "Ausgeschlossene Sperre",
1847
+ "en-US": "Excluded lock",
1848
+ "es-ES": "Bloqueo excluido",
1849
+ "fr-FR": "Exclu verrouillé",
1850
+ "it-IT": "Blocco escluso",
1851
+ "ja-JP": "除外されたロック",
1852
+ "ko-KR": "제외된 잠금",
1853
+ "nl-NL": "Uitsluitingsvergrendeling",
1854
+ "pl-PL": "Wykluczone zablokowane",
1855
+ "pt-BR": "Bloqueado excluído",
1856
+ "ru-RU": "Блокировать исключенные элементы",
1857
+ "sv-SE": "Uteslutet låst",
1858
+ "tr-TR": "Hariç tutulan kilit",
1859
+ "zh-CN": "已排除锁定",
1860
+ "zh-TW": "已排除鎖定"
1861
+ }
1862
+ };
1863
+ var Listbox_ScreenReader_SelectionMenu_WithAccSelMenu = {
1864
+ id: "Listbox.ScreenReader.SelectionMenu.WithAccSelMenu",
1865
+ locale: {
1866
+ "de-DE": "Drücken Sie gleichzeitig die Umschalt- und die Tabulatortaste, um den Fokus in das Auswahlmenü zu setzen.",
1867
+ "en-US": "Press Shift plus Tab to set focus on the selections menu.",
1868
+ "es-ES": "Pulse Mayús + Tabulador para establecer el foco en el menú de selecciones.",
1869
+ "fr-FR": "Appuyez sur Maj + Tab pour mettre le focus sur le menu de sélections.",
1870
+ "it-IT": "Premere insieme i tasti MAIUSC+TAB per evidenziare il menu di selezione.",
1871
+ "ja-JP": "Shift キー + Tab キーを押して、選択メニューで焦点を設定します。",
1872
+ "ko-KR": "선택 메뉴에 초점을 설정하려면 Shift+Tab을 누르십시오.",
1873
+ "nl-NL": "Druk op Shift + Tab om de focus in te stellen op het selectiemenu.",
1874
+ "pl-PL": "Naciśnij Shift i Tab, aby ustawić ostrość na menu selekcji.",
1875
+ "pt-BR": "Pressione Shift + Tab para definir o foco sobre o menu de seleções.",
1876
+ "ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на меню выбора.",
1877
+ "sv-SE": "Tryck på Skift plus Tabb när du vill ställa in fokus på urvalsmenyn.",
1878
+ "tr-TR": "Odağı seçim menüsüne ayarlamak için Shift ve Sekme tuşlarına birlikte basın.",
1879
+ "zh-CN": "按下 Shift 加 Tab 以将焦点设置在选择菜单上。",
1880
+ "zh-TW": "按下 Shift 加 Tab 以在選項功能表上設定焦點。"
1881
+ }
1882
+ };
1883
+ var Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu = {
1884
+ id: "Listbox.ScreenReader.SearchThenSelectionsMenu.WithAccSelMenu",
1885
+ locale: {
1886
+ "de-DE": "Drücken Sie die Umschalttaste zusammen mit der Tabulatortaste, um den Fokus in die Suchleiste zu setzen, und dann erneut beide Tasten, um den Fokus in das Auswahlmenü zu setzen.",
1887
+ "en-US": "Press Shift plus Tab to set focus on the search bar, then Shift plus Tab again to set focus on the selections menu.",
1888
+ "es-ES": "Pulse Mayús + Tabulador para establecer el foco en la barra de búsqueda, luego Mayús + Tabulador nuevamente para establecer el foco en el menú de selecciones.",
1889
+ "fr-FR": "Appuyez sur Maj + Tab pour définir le focus sur la barre de recherche, puis de nouveau sur Maj + Tab pour définir le focus sur le menu de sélections.",
1890
+ "it-IT": "Premere MAIUSC+TAB per impostare lo stato attivo sulla barra di ricerca, quindi premere nuovamente MAIUSC+TAB per impostare lo stato attivo sul menu selezioni.",
1891
+ "ja-JP": "Shift + Tab を押して検索バーにフォーカスを設定し、Shift + Tab をもう一度押して選択メニューにフォーカスを設定します。",
1892
+ "ko-KR": "Shift+Tab을 눌러 검색 막대에 초점을 맞춘 다음 Shift+Tab을 다시 눌러 선택 메뉴에 초점을 맞추십시오.",
1893
+ "nl-NL": "Druk op Shift + Tab om de focus in te stellen op de zoekbalk, druk vervolgens nogmaals op Shift + Tab om de focus in te stellen op het selectiemenu.",
1894
+ "pl-PL": "Naciśnij Shift i Tab, aby ustawić ostrość na pasek wyszukiwania. Następnie ponownie użyj tej kombinacji klawiszy, aby ustawić ostrość na menu selekcji.",
1895
+ "pt-BR": "Pressione Shift + Tab para definir o foco na barra de pesquisa e Shift + Tab novamente para definir o foco no menu de seleções.",
1896
+ "ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на панель поиска. Затем нажмите сочетание клавиш \"Shift + Tab\" снова, чтобы установить фокус на меню выборки.",
1897
+ "sv-SE": "Tryck på Skift plus Tabb för att ställa in fokus på sökfältet, sedan Skift plus Tabb igen för att ställa in fokus på urvalsmenyn.",
1898
+ "tr-TR": "Odağı arama çubuğuna ayarlamak için Shift ve Sekme tuşlarına birlikte basın, ardından bu tuşlara birlikte tekrar basarak odağı seçim menüsüne ayarlayın.",
1899
+ "zh-CN": "按 Shift+Tab 在搜索栏上设置焦点,然后再次按 Shift+Tab 在“选择”菜单上设置焦点。",
1900
+ "zh-TW": "按下 Shift 加 Tab 鍵以設定搜尋列上的焦點,然後再次按下 Shift 加 Tab 鍵,以設定選項功能表上的焦點。"
1901
+ }
1902
+ };
1903
+ var ScreenReader_ZeroSelected = {
1904
+ id: "ScreenReader.ZeroSelected",
1905
+ locale: {
1906
+ "de-DE": "Es sind keine Werte ausgewählt.",
1907
+ "en-US": "No values are selected.",
1908
+ "es-ES": "No se ha seleccionado ningún valor.",
1909
+ "fr-FR": "Aucune valeur n'a été sélectionnée.",
1910
+ "it-IT": "Nessun valore selezionato.",
1911
+ "ja-JP": "値が選択されていません。",
1912
+ "ko-KR": "선택된 값이 없습니다.",
1913
+ "nl-NL": "Geen waarden geselecteerd.",
1914
+ "pl-PL": "Brak wybranych wartości.",
1915
+ "pt-BR": "Nenhum valor selecionado.",
1916
+ "ru-RU": "Значения не выбраны.",
1917
+ "sv-SE": "Inga värden är valda.",
1918
+ "tr-TR": "Seçilen değer yok.",
1919
+ "zh-CN": "未选择值。",
1920
+ "zh-TW": "沒有選取任何值。"
1921
+ }
1922
+ };
1923
+ var ScreenReader_OneSelected = {
1924
+ id: "ScreenReader.OneSelected",
1925
+ locale: {
1926
+ "de-DE": "Es ist ein Wert ausgewählt.",
1927
+ "en-US": "There is one selected value.",
1928
+ "es-ES": "Hay un valor seleccionado.",
1929
+ "fr-FR": "Une valeur a été sélectionnée.",
1930
+ "it-IT": "È presente un valore selezionato.",
1931
+ "ja-JP": "値が 1 つ選択されています。",
1932
+ "ko-KR": "하나의 값이 선택되었습니다.",
1933
+ "nl-NL": "Er is één waarde geselecteerd.",
1934
+ "pl-PL": "Jest jedna wybrana wartość.",
1935
+ "pt-BR": "Há um valor selecionado.",
1936
+ "ru-RU": "Выбрано одно значение.",
1937
+ "sv-SE": "Ett värde är valt.",
1938
+ "tr-TR": "Seçilen bir değer var.",
1939
+ "zh-CN": "存在一个已选择的值。",
1940
+ "zh-TW": "有一個選取的值。"
1941
+ }
1942
+ };
1943
+ var ScreenReader_ManySelected = {
1944
+ id: "ScreenReader.ManySelected",
1945
+ locale: {
1946
+ "de-DE": "Es sind {0} Werte ausgewählt.",
1947
+ "en-US": "There are {0} selected values.",
1948
+ "es-ES": "Hay {0} valores seleccionados.",
1949
+ "fr-FR": "{0} valeurs ont été sélectionnées.",
1950
+ "it-IT": "Sono presenti {0} valori selezionati.",
1951
+ "ja-JP": "値が {0} つ選択されています。",
1952
+ "ko-KR": "{0}개의 값이 선택되었습니다.",
1953
+ "nl-NL": "Er zijn {0} waarden geselecteerd.",
1954
+ "pl-PL": "Wybranych wartości: {0}",
1955
+ "pt-BR": "Há {0} valores selecionados.",
1956
+ "ru-RU": "Выбраны значения: {0}.",
1957
+ "sv-SE": "{0} värden är valda.",
1958
+ "tr-TR": "Seçilen {0} değer var.",
1959
+ "zh-CN": "存在 {0} 个已选择的值。",
1960
+ "zh-TW": "有 {0} 個選取的值。"
1961
+ }
1962
+ };
1723
1963
  var all = {
1724
1964
  Cancel: Cancel$1,
1725
1965
  CurrentSelections_All: CurrentSelections_All,
@@ -1758,7 +1998,19 @@
1758
1998
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1759
1999
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1760
2000
  Visualization_LayoutError: Visualization_LayoutError,
1761
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2001
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2002
+ Object_Listbox_Selected: Object_Listbox_Selected,
2003
+ Object_Listbox_Alternative: Object_Listbox_Alternative,
2004
+ Object_Listbox_Optional: Object_Listbox_Optional,
2005
+ Object_Listbox_SelectedExcluded: Object_Listbox_SelectedExcluded,
2006
+ Object_Listbox_Locked: Object_Listbox_Locked,
2007
+ Object_Listbox_Excluded: Object_Listbox_Excluded,
2008
+ Object_Listbox_ExcludedLock: Object_Listbox_ExcludedLock,
2009
+ Listbox_ScreenReader_SelectionMenu_WithAccSelMenu: Listbox_ScreenReader_SelectionMenu_WithAccSelMenu,
2010
+ Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu: Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu,
2011
+ ScreenReader_ZeroSelected: ScreenReader_ZeroSelected,
2012
+ ScreenReader_OneSelected: ScreenReader_OneSelected,
2013
+ ScreenReader_ManySelected: ScreenReader_ManySelected
1762
2014
  };
1763
2015
 
1764
2016
  function appLocaleFn(language) {
@@ -4477,7 +4729,7 @@
4477
4729
  return output;
4478
4730
  }
4479
4731
 
4480
- function composeClasses(slots, getUtilityClass, classes) {
4732
+ function composeClasses(slots, getUtilityClass, classes = undefined) {
4481
4733
  const output = {};
4482
4734
  Object.keys(slots).forEach(
4483
4735
  // `Objet.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
@@ -4485,7 +4737,10 @@
4485
4737
  slot => {
4486
4738
  output[slot] = slots[slot].reduce((acc, key) => {
4487
4739
  if (key) {
4488
- acc.push(getUtilityClass(key));
4740
+ const utilityClass = getUtilityClass(key);
4741
+ if (utilityClass !== '') {
4742
+ acc.push(utilityClass);
4743
+ }
4489
4744
  if (classes && classes[key]) {
4490
4745
  acc.push(classes[key]);
4491
4746
  }
@@ -8545,6 +8800,11 @@
8545
8800
  if (val == null) {
8546
8801
  return null;
8547
8802
  }
8803
+ if (themeKey === 'typography' && val === 'inherit') {
8804
+ return {
8805
+ [prop]: val
8806
+ };
8807
+ }
8548
8808
  const themeMapping = getPath$1(theme, themeKey) || {};
8549
8809
  if (style) {
8550
8810
  return style(props);
@@ -9961,7 +10221,14 @@
9961
10221
  body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
9962
10222
  button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
9963
10223
  caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
9964
- overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
10224
+ overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
10225
+ inherit: {
10226
+ fontFamily: 'inherit',
10227
+ fontWeight: 'inherit',
10228
+ fontSize: 'inherit',
10229
+ lineHeight: 'inherit',
10230
+ letterSpacing: 'inherit'
10231
+ }
9965
10232
  };
9966
10233
  return deepmerge(_extends$6({
9967
10234
  htmlFontSize,
@@ -10184,6 +10451,30 @@
10184
10451
  });
10185
10452
  }
10186
10453
 
10454
+ const defaultContextValue = {
10455
+ disableDefaultClasses: false
10456
+ };
10457
+ const ClassNameConfiguratorContext = /*#__PURE__*/reactExports.createContext(defaultContextValue);
10458
+ /**
10459
+ * @ignore - internal hook.
10460
+ *
10461
+ * Wraps the `generateUtilityClass` function and controls how the classes are generated.
10462
+ * Currently it only affects whether the classes are applied or not.
10463
+ *
10464
+ * @returns Function to be called with the `generateUtilityClass` function specific to a component to generate the classes.
10465
+ */
10466
+ function useClassNamesOverride(generateUtilityClass) {
10467
+ const {
10468
+ disableDefaultClasses
10469
+ } = reactExports.useContext(ClassNameConfiguratorContext);
10470
+ return slot => {
10471
+ if (disableDefaultClasses) {
10472
+ return '';
10473
+ }
10474
+ return generateUtilityClass(slot);
10475
+ };
10476
+ }
10477
+
10187
10478
  /**
10188
10479
  * Extracts event handlers from a given object.
10189
10480
  * A prop is considered an event handler if it is a function and its name starts with `on`.
@@ -10805,7 +11096,7 @@
10805
11096
  function getUAString() {
10806
11097
  var uaData = navigator.userAgentData;
10807
11098
 
10808
- if (uaData != null && uaData.brands) {
11099
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
10809
11100
  return uaData.brands.map(function (item) {
10810
11101
  return item.brand + "/" + item.version;
10811
11102
  }).join(' ');
@@ -11124,10 +11415,9 @@
11124
11415
  // Zooming can change the DPR, but it seems to report a value that will
11125
11416
  // cleanly divide the values into the appropriate subpixels.
11126
11417
 
11127
- function roundOffsetsByDPR(_ref) {
11418
+ function roundOffsetsByDPR(_ref, win) {
11128
11419
  var x = _ref.x,
11129
11420
  y = _ref.y;
11130
- var win = window;
11131
11421
  var dpr = win.devicePixelRatio || 1;
11132
11422
  return {
11133
11423
  x: round$1(x * dpr) / dpr || 0,
@@ -11210,7 +11500,7 @@
11210
11500
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
11211
11501
  x: x,
11212
11502
  y: y
11213
- }) : {
11503
+ }, getWindow(popper)) : {
11214
11504
  x: x,
11215
11505
  y: y
11216
11506
  };
@@ -12530,7 +12820,7 @@
12530
12820
  const slots = {
12531
12821
  root: ['root']
12532
12822
  };
12533
- return composeClasses(slots, getPopperUnstyledUtilityClass, {});
12823
+ return composeClasses(slots, useClassNamesOverride(getPopperUnstyledUtilityClass));
12534
12824
  };
12535
12825
  const defaultPopperOptions = {};
12536
12826
  const PopperTooltip = /*#__PURE__*/reactExports.forwardRef(function PopperTooltip(props, ref) {
@@ -12962,7 +13252,7 @@
12962
13252
  root: ['root', !open && exited && 'hidden'],
12963
13253
  backdrop: ['backdrop']
12964
13254
  };
12965
- return composeClasses(slots, getModalUtilityClass, undefined);
13255
+ return composeClasses(slots, useClassNamesOverride(getModalUtilityClass));
12966
13256
  };
12967
13257
  function getContainer(container) {
12968
13258
  return typeof container === 'function' ? container() : container;
@@ -15420,7 +15710,7 @@
15420
15710
  return cache[key];
15421
15711
  }
15422
15712
 
15423
- const NEBULA_VERSION_HASH = "757e" ;
15713
+ const NEBULA_VERSION_HASH = "64ea" ;
15424
15714
  ClassNameGenerator$1.configure(componentName => {
15425
15715
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15426
15716
  });
@@ -15628,7 +15918,7 @@
15628
15918
  const appRef = React.createRef();
15629
15919
  const element = document.createElement('div');
15630
15920
  element.style.display = 'none';
15631
- element.setAttribute('data-nebulajs-version', "4.0.0-alpha.8" );
15921
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.9" );
15632
15922
  element.setAttribute('data-app-id', app.id);
15633
15923
  document.body.appendChild(element);
15634
15924
  const root = client.createRoot(element);
@@ -22125,8 +22415,9 @@
22125
22415
  const c = containerRef.current;
22126
22416
  const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
22127
22417
  const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
22128
- const fieldElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value, .ActionsToolbar-item button');
22129
- const elementToFocus = searchField || lastSelectedRow || fieldElement;
22418
+ const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
22419
+ const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
22420
+ const elementToFocus = searchField || lastSelectedRow || firstRowElement || confirmButton;
22130
22421
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.setAttribute('tabIndex', 0);
22131
22422
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
22132
22423
  },
@@ -22330,7 +22621,7 @@
22330
22621
  // 3. Blur row and focus the listbox container.
22331
22622
  keyboard.blur();
22332
22623
  const c = currentTarget.closest('.listbox-container');
22333
- c.setAttribute('tabIndex', 0);
22624
+ c.setAttribute('tabIndex', -1);
22334
22625
  c === null || c === void 0 ? void 0 : c.focus();
22335
22626
  }
22336
22627
  };
@@ -22538,7 +22829,7 @@
22538
22829
  const iconWidth = 24; // tick and lock icon width in px
22539
22830
 
22540
22831
  const RowColRoot = styled$1('div', {
22541
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
22832
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop)
22542
22833
  })(_ref2 => {
22543
22834
  var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
22544
22835
  let {
@@ -22547,7 +22838,8 @@
22547
22838
  isGridMode,
22548
22839
  isGridCol,
22549
22840
  dense,
22550
- frequencyWidth
22841
+ frequencyWidth,
22842
+ direction
22551
22843
  } = _ref2;
22552
22844
  return {
22553
22845
  '&:focus': {
@@ -22660,7 +22952,7 @@
22660
22952
  justifyContent: 'flex-end'
22661
22953
  }, ellipsis), {}, {
22662
22954
  flex: "0 1 ".concat(frequencyWidth, "px"),
22663
- textAlign: 'right',
22955
+ textAlign: direction === 'rtl' ? 'left' : 'right',
22664
22956
  paddingLeft: '2px'
22665
22957
  }),
22666
22958
  ["&.".concat(rowColClasses.barContainer)]: {
@@ -22693,7 +22985,7 @@
22693
22985
  }
22694
22986
  },
22695
22987
  ["& .".concat(rowColClasses.barWithCheckbox)]: {
22696
- left: barWithCheckboxLeftPadPx,
22988
+ left: direction === 'rtl' ? barPadPx : barWithCheckboxLeftPadPx,
22697
22989
  width: "calc(100% - ".concat(barWithCheckboxLeftPadPx + barPadPx, "px)")
22698
22990
  },
22699
22991
  ["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
@@ -23139,21 +23431,23 @@
23139
23431
  }
23140
23432
 
23141
23433
  const ItemGrid = styled$1(Grid$1, {
23142
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight'].includes(prop)
23434
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop)
23143
23435
  })(_ref => {
23144
23436
  let {
23145
23437
  dataLayout,
23146
23438
  layoutOrder,
23147
23439
  itemPadding,
23148
- cellPaddingRight
23440
+ cellPaddingRight,
23441
+ direction
23149
23442
  } = _ref;
23443
+ const att = "padding".concat(direction === 'rtl' ? 'Left' : 'Right');
23150
23444
  return {
23151
23445
  ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
23152
23446
  dataLayout,
23153
23447
  layoutOrder,
23154
23448
  itemPadding
23155
23449
  })), {}, {
23156
- paddingRight: cellPaddingRight ? '8px' : undefined
23450
+ [att]: cellPaddingRight ? '8px' : undefined
23157
23451
  })
23158
23452
  };
23159
23453
  });
@@ -23422,6 +23716,7 @@
23422
23716
  isGridMode: dataLayout === 'grid',
23423
23717
  dense: dense,
23424
23718
  frequencyWidth: frequencyWidth,
23719
+ direction: direction,
23425
23720
  "data-testid": "listbox.item"
23426
23721
  }, /*#__PURE__*/React.createElement(ItemGrid, {
23427
23722
  role: "row",
@@ -23449,7 +23744,8 @@
23449
23744
  onTouchEnd: onTouchEnd,
23450
23745
  onContextMenu: preventContextMenu,
23451
23746
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
23452
- "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
23747
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber,
23748
+ direction: direction
23453
23749
  }, (cell === null || cell === void 0 ? void 0 : cell.qFrequency) && /*#__PURE__*/React.createElement(Histogram, {
23454
23750
  qFrequency: cell === null || cell === void 0 ? void 0 : cell.qFrequency,
23455
23751
  histogram: histogram,
@@ -26305,13 +26601,16 @@
26305
26601
  } = useActionState(item);
26306
26602
  if (hidden) return null;
26307
26603
  const spacing = Number.parseInt(theme.spacing(0.5), 10);
26308
- const handleKeyDown = item.keyboardAction ? e => ['Enter', ' ', 'Spacebar'].includes(e.key) && item.keyboardAction() : null;
26604
+ const keyboardAction = item.keyboardAction || item.action;
26605
+ const handleKeyDown = keyboardAction ? e => ['Enter'].includes(e.key) && keyboardAction() : null;
26606
+ const handleKeyUp = keyboardAction ? e => [' ', 'Spacebar'].includes(e.key) && keyboardAction() : null;
26309
26607
  const btnId = "actions-toolbar-".concat(item.key);
26310
26608
  return /*#__PURE__*/React.createElement(IconButton$1, {
26311
26609
  ref: !addAnchor ? ref : null,
26312
26610
  title: item.label,
26313
26611
  onClick: item.action,
26314
26612
  onKeyDown: handleKeyDown,
26613
+ onKeyUp: handleKeyUp,
26315
26614
  disabled: disabled,
26316
26615
  style: style,
26317
26616
  className: [ActionElement.className, btnId].join(' '),
@@ -26377,8 +26676,8 @@
26377
26676
  onCancel();
26378
26677
  api.cancel();
26379
26678
  },
26380
- keyboardAction: e => {
26381
- onKeyDeactivate(e);
26679
+ keyboardAction: () => {
26680
+ onKeyDeactivate();
26382
26681
  onCancel();
26383
26682
  api.cancel();
26384
26683
  },
@@ -26392,8 +26691,8 @@
26392
26691
  onConfirm();
26393
26692
  api.confirm();
26394
26693
  },
26395
- keyboardAction: e => {
26396
- onKeyDeactivate(e);
26694
+ keyboardAction: () => {
26695
+ onKeyDeactivate();
26397
26696
  onConfirm();
26398
26697
  api.confirm();
26399
26698
  },
@@ -26423,6 +26722,7 @@
26423
26722
  function MoreItem(_ref2) {
26424
26723
  let {
26425
26724
  item,
26725
+ autoFocus,
26426
26726
  onActionClick = () => {}
26427
26727
  } = _ref2;
26428
26728
  const {
@@ -26435,6 +26735,7 @@
26435
26735
  onActionClick();
26436
26736
  };
26437
26737
  return !hidden ? /*#__PURE__*/React.createElement(MenuItem$1, {
26738
+ autoFocus: autoFocus,
26438
26739
  title: item.label,
26439
26740
  onClick: handleClick,
26440
26741
  disabled: disabled,
@@ -26455,6 +26756,7 @@
26455
26756
  onCloseOrActionClick = () => {}
26456
26757
  } = _ref3;
26457
26758
  const showActions = actions.length > 0;
26759
+ const autoFocusIndex = actions.findIndex(action => !action.disabled);
26458
26760
  return showActions && /*#__PURE__*/React.createElement(StyledPopover$1
26459
26761
  // eslint-disable-next-line react/jsx-props-no-spreading
26460
26762
  , _extends$8({}, popoverProps, {
@@ -26494,6 +26796,7 @@
26494
26796
  React.createElement(MoreItem, {
26495
26797
  key: ix,
26496
26798
  item: item,
26799
+ autoFocus: ix === autoFocusIndex,
26497
26800
  onActionClick: onCloseOrActionClick
26498
26801
  }))));
26499
26802
  });
@@ -26517,7 +26820,8 @@
26517
26820
  let {
26518
26821
  keyboardNavigation,
26519
26822
  focusHandler,
26520
- getEnabledButton
26823
+ getEnabledButton,
26824
+ selections
26521
26825
  } = _ref;
26522
26826
  const handleActionsKeyDown = evt => {
26523
26827
  const {
@@ -26557,6 +26861,14 @@
26557
26861
  }
26558
26862
  }
26559
26863
  break;
26864
+ case KEYS.ESCAPE:
26865
+ if (selections) {
26866
+ selections.onCancel();
26867
+ selections.api.cancel();
26868
+ evt.preventDefault();
26869
+ evt.stopPropagation();
26870
+ }
26871
+ break;
26560
26872
  }
26561
26873
  };
26562
26874
  return handleActionsKeyDown;
@@ -26698,8 +27010,9 @@
26698
27010
  const handleActionsKeyDown = reactExports.useMemo(() => getActionsKeyDownHandler({
26699
27011
  keyboardNavigation,
26700
27012
  focusHandler,
26701
- getEnabledButton
26702
- }), [keyboardNavigation, focusHandler, getEnabledButton]);
27013
+ getEnabledButton,
27014
+ selections
27015
+ }), [keyboardNavigation, focusHandler, getEnabledButton, selections]);
26703
27016
  reactExports.useEffect(() => () => {
26704
27017
  setShowMoreItems(false);
26705
27018
  }, [popover.show, show, selections.show]);
@@ -28881,7 +29194,6 @@
28881
29194
  };
28882
29195
  };
28883
29196
 
28884
- /* eslint-disable no-nested-ternary */
28885
29197
  function showToolbarDetached(_ref) {
28886
29198
  var _containerRef$current, _containerRef$current2, _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
28887
29199
  let {
@@ -28896,11 +29208,7 @@
28896
29208
  const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
28897
29209
  const isTruncated = (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth) > (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current3 = titleRef.current) === null || _titleRef$current3 === void 0 ? void 0 : _titleRef$current3.offsetWidth);
28898
29210
  const isDetached = !!(notSufficientSpace | isTruncated);
28899
- const reasonDetached = isDetached ? notSufficientSpace ? 'noSpace' : 'truncated' : '';
28900
- return {
28901
- isDetached,
28902
- reasonDetached
28903
- };
29211
+ return isDetached;
28904
29212
  }
28905
29213
 
28906
29214
  function getListboxActionProps(_ref) {
@@ -28910,7 +29218,8 @@
28910
29218
  containerRef,
28911
29219
  isLocked,
28912
29220
  listboxSelectionToolbarItems,
28913
- selections
29221
+ selections,
29222
+ keyboard
28914
29223
  } = _ref;
28915
29224
  return {
28916
29225
  show: showToolbar && !isDetached,
@@ -28932,8 +29241,12 @@
28932
29241
  selections: {
28933
29242
  show: showToolbar,
28934
29243
  api: selections,
28935
- onConfirm: () => {},
28936
- onCancel: () => {}
29244
+ onConfirm: () => {
29245
+ keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
29246
+ },
29247
+ onCancel: () => {
29248
+ keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
29249
+ }
28937
29250
  }
28938
29251
  };
28939
29252
  }
@@ -28962,20 +29275,18 @@
28962
29275
  listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
28963
29276
  };
28964
29277
  const StyledGrid$3 = styled$1(Grid$1, {
28965
- shouldForwardProp: p => !['containerPadding', 'hasIcon'].includes(p)
29278
+ shouldForwardProp: p => !['containerPadding'].includes(p)
28966
29279
  })(_ref => {
28967
29280
  var _theme$listBox$backgr, _theme$listBox;
28968
29281
  let {
28969
29282
  theme,
28970
- containerPadding,
28971
- hasIcon
29283
+ containerPadding
28972
29284
  } = _ref;
28973
29285
  return {
28974
29286
  backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
28975
29287
  ["& .".concat(classes$4.listBoxHeader)]: {
28976
29288
  alignSelf: 'center',
28977
- display: 'flex',
28978
- width: "calc(100% - ".concat(hasIcon ? BUTTON_ICON_WIDTH : 0, "px)")
29289
+ display: 'flex'
28979
29290
  },
28980
29291
  ["& .".concat(classes$4.screenReaderOnly)]: {
28981
29292
  position: 'absolute',
@@ -29201,7 +29512,8 @@
29201
29512
  containerRef,
29202
29513
  isLocked,
29203
29514
  listboxSelectionToolbarItems,
29204
- selections
29515
+ selections,
29516
+ keyboard
29205
29517
  });
29206
29518
  const shouldAutoFocus = searchVisible && search === 'toggle';
29207
29519
  const showSearchIcon = searchEnabled !== false && search === 'toggle';
@@ -29210,10 +29522,7 @@
29210
29522
  const iconsWidth = (showSearchOrLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? ICON_WIDTH + ICON_PADDING : 0); // Drill-down icon needs padding right so there is space between the icon and the title
29211
29523
  const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
29212
29524
  const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : 0;
29213
- const {
29214
- isDetached,
29215
- reasonDetached
29216
- } = showToolbarDetached({
29525
+ const isDetached = showToolbarDetached({
29217
29526
  containerRef,
29218
29527
  titleRef,
29219
29528
  iconsWidth
@@ -29278,35 +29587,21 @@
29278
29587
  onKeyDown: handleKeyDown,
29279
29588
  onMouseEnter: handleOnMouseEnter,
29280
29589
  onMouseLeave: handleOnMouseLeave,
29281
- ref: containerRef,
29282
- hasIcon: showIcons
29590
+ ref: containerRef
29283
29591
  }, showToolbarWithTitle && /*#__PURE__*/React.createElement(Grid$1, {
29284
29592
  item: true,
29285
29593
  container: true,
29286
- style: {
29287
- padding: theme.spacing(1),
29288
- paddingLeft: "".concat(headerPaddingLeft, "px"),
29289
- paddingRight: "".concat(headerPaddingRight, "px")
29290
- },
29291
- sx: {
29292
- flexDirection: isRtl ? 'row-reverse' : 'row'
29293
- },
29294
- wrap: "nowrap"
29295
- }, /*#__PURE__*/React.createElement(Grid$1, {
29296
- item: true,
29297
- container: true,
29298
- height: headerHeight,
29299
- sx: {
29300
- flexDirection: isRtl ? 'row-reverse' : 'row'
29301
- },
29594
+ minHeight: headerHeight,
29595
+ flexDirection: isRtl ? 'row-reverse' : 'row',
29596
+ marginY: 1,
29597
+ paddingLeft: "".concat(headerPaddingLeft, "px"),
29598
+ paddingRight: "".concat(headerPaddingRight, "px"),
29302
29599
  wrap: "nowrap"
29303
29600
  }, showIcons && /*#__PURE__*/React.createElement(Grid$1, {
29304
29601
  item: true,
29305
- sx: {
29306
- display: 'flex',
29307
- alignItems: 'center',
29308
- width: iconsWidth
29309
- }
29602
+ container: true,
29603
+ alignItems: "center",
29604
+ width: iconsWidth
29310
29605
  }, isLocked ? lockIconComp : showSearchIcon && searchIconComp, isDrillDown && /*#__PURE__*/React.createElement(DrillDownIcon, {
29311
29606
  tabIndex: -1,
29312
29607
  title: translator.get('Listbox.DrillDown'),
@@ -29316,22 +29611,17 @@
29316
29611
  }
29317
29612
  })), /*#__PURE__*/React.createElement(Grid$1, {
29318
29613
  item: true,
29319
- sx: {
29320
- justifyContent: isRtl ? 'flex-end' : 'flex-start'
29321
- },
29614
+ xs: true,
29615
+ minWidth: 0 // needed to text-overflow see: https://css-tricks.com/flexbox-truncated-text/
29616
+ ,
29617
+ justifyContent: isRtl ? 'flex-end' : 'flex-start',
29322
29618
  className: classes$4.listBoxHeader
29323
29619
  }, /*#__PURE__*/React.createElement(Title, {
29324
29620
  variant: "h6",
29325
- sx: {
29326
- width: isPopover && reasonDetached === 'noSpace' ? '60px' : undefined
29327
- },
29328
29621
  noWrap: true,
29329
29622
  ref: titleRef,
29330
29623
  title: layout.title
29331
- }, layout.title))), /*#__PURE__*/React.createElement(Grid$1, {
29332
- item: true,
29333
- xs: true
29334
- }), /*#__PURE__*/React.createElement(Grid$1, {
29624
+ }, layout.title)), /*#__PURE__*/React.createElement(Grid$1, {
29335
29625
  item: true
29336
29626
  }, /*#__PURE__*/React.createElement(ActionsToolbar, _extends$8({
29337
29627
  direction: direction
@@ -32431,7 +32721,7 @@
32431
32721
  id: model.id,
32432
32722
  /**
32433
32723
  * This visualizations Enigma model, a representation of the generic object.
32434
- * @type {string}
32724
+ * @type {EngineAPI.IGenericObject}
32435
32725
  */
32436
32726
  model,
32437
32727
  /**
@@ -32580,14 +32870,17 @@
32580
32870
  */
32581
32871
 
32582
32872
  /**
32583
- * @interface CreateConfig
32584
- * @description Rendering configuration for creating and rendering a new object
32585
- * @extends BaseConfig
32586
- * @property {string} type
32587
- * @property {string=} version
32588
- * @property {(Field[])=} fields
32589
- * @property {boolean} [extendProperties=false] Whether to deeply extend properties or not. If false then subtrees will be overwritten.
32590
- * @property {EngineAPI.IGenericObjectProperties=} properties
32873
+ * @interface RenderConfig
32874
+ * @description Configuration for rendering a visualisation, either creating or fetching an existing object.
32875
+ * @property {HTMLElement} element Target html element to render in to
32876
+ * @property {object=} options Options passed into the visualisation
32877
+ * @property {Plugin[]} [plugins] plugins passed into the visualisation
32878
+ * @property {string=} id For existing objects: Engine identifier of object to render
32879
+ * @property {string=} type For creating objects: Type of visualisation to render
32880
+ * @property {string=} version For creating objects: Version of visualization to render
32881
+ * @property {(Field[])=} fields For creating objects: Data fields to use
32882
+ * @property {boolean=} [extendProperties=false] For creating objects: Whether to deeply extend properties or not. If false then subtrees will be overwritten.
32883
+ * @property {EngineAPI.IGenericObjectProperties=} properties For creating objects: Explicit properties to set
32591
32884
  * @example
32592
32885
  * // A config for Creating objects:
32593
32886
  * const createConfig = {
@@ -32602,6 +32895,12 @@
32602
32895
  * }
32603
32896
  * };
32604
32897
  * nebbie.render(createConfig);
32898
+ * // A config for rendering an existing object:
32899
+ * const createConfig = {
32900
+ * id: 'jG5LP',
32901
+ * element: document.querySelector('.line'),
32902
+ * };
32903
+ * nebbie.render(createConfig);
32605
32904
  */
32606
32905
  async function createSessionObject(_ref, halo) {
32607
32906
  let {
@@ -32660,6 +32959,71 @@
32660
32959
  }, halo, error, onDestroy);
32661
32960
  }
32662
32961
 
32962
+ /**
32963
+ * @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
32964
+ */
32965
+
32966
+ /**
32967
+ * @interface CreateConfig
32968
+ * @description Rendering configuration for creating and rendering a new object
32969
+ * @property {string} type
32970
+ * @property {string=} version
32971
+ * @property {(Field[])=} fields
32972
+ * @property {EngineAPI.IGenericObjectProperties=} properties
32973
+ */
32974
+
32975
+ async function createObject(_ref, halo, generateOnly) {
32976
+ let {
32977
+ type,
32978
+ version,
32979
+ fields,
32980
+ properties,
32981
+ extendProperties /* , options, plugins, element */
32982
+ } = _ref;
32983
+ let mergedProps = {};
32984
+ // let error;
32985
+ try {
32986
+ const t = halo.types.get({
32987
+ name: type,
32988
+ version
32989
+ });
32990
+ mergedProps = await t.initialProperties(properties, extendProperties);
32991
+ const sn = await t.supernova();
32992
+ if (fields) {
32993
+ populateData({
32994
+ sn,
32995
+ properties: mergedProps,
32996
+ fields
32997
+ }, halo);
32998
+ }
32999
+ if (properties && sn && sn.qae.properties.onChange) {
33000
+ sn.qae.properties.onChange.call({}, mergedProps);
33001
+ }
33002
+ } catch (e) {
33003
+ // error = e;
33004
+ // minimal dummy object properties to allow it to be created
33005
+ // and rendered with the error
33006
+ if (!generateOnly) {
33007
+ mergedProps = {
33008
+ qInfo: {
33009
+ qType: type
33010
+ },
33011
+ visualization: type
33012
+ };
33013
+ } else {
33014
+ mergedProps = null;
33015
+ }
33016
+ // console.error(e); // eslint-disable-line
33017
+ }
33018
+
33019
+ if (!generateOnly) {
33020
+ const model = await halo.app.createObject(mergedProps);
33021
+ modelStore.set(model.id, model);
33022
+ return model;
33023
+ }
33024
+ return mergedProps;
33025
+ }
33026
+
32663
33027
  async function getObject$1(_ref, halo) {
32664
33028
  let {
32665
33029
  id,
@@ -33004,21 +33368,6 @@
33004
33368
  return api;
33005
33369
  }
33006
33370
 
33007
- /**
33008
- * @interface BaseConfig
33009
- * @description Basic rendering configuration for rendering an object
33010
- * @property {HTMLElement} element
33011
- * @property {object=} options
33012
- * @property {Plugin[]} [plugins]
33013
- */
33014
-
33015
- /**
33016
- * @interface GetConfig
33017
- * @description Rendering configuration for rendering an existing object
33018
- * @extends BaseConfig
33019
- * @property {string} id
33020
- */
33021
-
33022
33371
  async function getObject(_ref, halo) {
33023
33372
  let {
33024
33373
  id,
@@ -34458,7 +34807,6 @@
34458
34807
  * @ignore
34459
34808
  * @example
34460
34809
  * import { onContextMenu } from '@nebula.js/stardust';
34461
-
34462
34810
  * onContextMenu((menu, event) => {
34463
34811
  * menu.addItem(item, index);
34464
34812
  * });
@@ -35218,1603 +35566,1350 @@
35218
35566
  };
35219
35567
 
35220
35568
  (function (module, exports) {
35221
- exports = module.exports = SemVer;
35222
-
35223
- var debug;
35224
- /* istanbul ignore next */
35225
- if (typeof process === 'object' &&
35226
- process.env &&
35227
- process.env.NODE_DEBUG &&
35228
- /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
35229
- debug = function () {
35230
- var args = Array.prototype.slice.call(arguments, 0);
35231
- args.unshift('SEMVER');
35232
- console.log.apply(console, args);
35233
- };
35234
- } else {
35235
- debug = function () {};
35236
- }
35237
-
35238
- // Note: this is the semver.org version of the spec that it implements
35239
- // Not necessarily the package version of this code.
35240
- exports.SEMVER_SPEC_VERSION = '2.0.0';
35241
-
35242
- var MAX_LENGTH = 256;
35243
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
35244
- /* istanbul ignore next */ 9007199254740991;
35245
-
35246
- // Max safe segment length for coercion.
35247
- var MAX_SAFE_COMPONENT_LENGTH = 16;
35248
-
35249
- // The actual regexps go on exports.re
35250
- var re = exports.re = [];
35251
- var src = exports.src = [];
35252
- var t = exports.tokens = {};
35253
- var R = 0;
35254
-
35255
- function tok (n) {
35256
- t[n] = R++;
35257
- }
35258
-
35259
- // The following Regular Expressions can be used for tokenizing,
35260
- // validating, and parsing SemVer version strings.
35261
-
35262
- // ## Numeric Identifier
35263
- // A single `0`, or a non-zero digit followed by zero or more digits.
35264
-
35265
- tok('NUMERICIDENTIFIER');
35266
- src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
35267
- tok('NUMERICIDENTIFIERLOOSE');
35268
- src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
35269
-
35270
- // ## Non-numeric Identifier
35271
- // Zero or more digits, followed by a letter or hyphen, and then zero or
35272
- // more letters, digits, or hyphens.
35273
-
35274
- tok('NONNUMERICIDENTIFIER');
35275
- src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
35276
-
35277
- // ## Main Version
35278
- // Three dot-separated numeric identifiers.
35279
-
35280
- tok('MAINVERSION');
35281
- src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
35282
- '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
35283
- '(' + src[t.NUMERICIDENTIFIER] + ')';
35284
-
35285
- tok('MAINVERSIONLOOSE');
35286
- src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
35287
- '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
35288
- '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
35289
-
35290
- // ## Pre-release Version Identifier
35291
- // A numeric identifier, or a non-numeric identifier.
35292
-
35293
- tok('PRERELEASEIDENTIFIER');
35294
- src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
35295
- '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35296
-
35297
- tok('PRERELEASEIDENTIFIERLOOSE');
35298
- src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
35299
- '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35300
-
35301
- // ## Pre-release Version
35302
- // Hyphen, followed by one or more dot-separated pre-release version
35303
- // identifiers.
35304
-
35305
- tok('PRERELEASE');
35306
- src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
35307
- '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
35308
-
35309
- tok('PRERELEASELOOSE');
35310
- src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
35311
- '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
35312
-
35313
- // ## Build Metadata Identifier
35314
- // Any combination of digits, letters, or hyphens.
35315
-
35316
- tok('BUILDIDENTIFIER');
35317
- src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
35318
-
35319
- // ## Build Metadata
35320
- // Plus sign, followed by one or more period-separated build metadata
35321
- // identifiers.
35322
-
35323
- tok('BUILD');
35324
- src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
35325
- '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
35326
-
35327
- // ## Full Version String
35328
- // A main version, followed optionally by a pre-release version and
35329
- // build metadata.
35330
-
35331
- // Note that the only major, minor, patch, and pre-release sections of
35332
- // the version string are capturing groups. The build metadata is not a
35333
- // capturing group, because it should not ever be used in version
35334
- // comparison.
35335
-
35336
- tok('FULL');
35337
- tok('FULLPLAIN');
35338
- src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
35339
- src[t.PRERELEASE] + '?' +
35340
- src[t.BUILD] + '?';
35341
-
35342
- src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
35343
-
35344
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
35345
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
35346
- // common in the npm registry.
35347
- tok('LOOSEPLAIN');
35348
- src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
35349
- src[t.PRERELEASELOOSE] + '?' +
35350
- src[t.BUILD] + '?';
35351
-
35352
- tok('LOOSE');
35353
- src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
35354
-
35355
- tok('GTLT');
35356
- src[t.GTLT] = '((?:<|>)?=?)';
35357
-
35358
- // Something like "2.*" or "1.2.x".
35359
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
35360
- // Only the first item is strictly required.
35361
- tok('XRANGEIDENTIFIERLOOSE');
35362
- src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
35363
- tok('XRANGEIDENTIFIER');
35364
- src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
35365
-
35366
- tok('XRANGEPLAIN');
35367
- src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
35368
- '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
35369
- '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
35370
- '(?:' + src[t.PRERELEASE] + ')?' +
35371
- src[t.BUILD] + '?' +
35372
- ')?)?';
35373
-
35374
- tok('XRANGEPLAINLOOSE');
35375
- src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35376
- '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35377
- '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35378
- '(?:' + src[t.PRERELEASELOOSE] + ')?' +
35379
- src[t.BUILD] + '?' +
35380
- ')?)?';
35381
-
35382
- tok('XRANGE');
35383
- src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
35384
- tok('XRANGELOOSE');
35385
- src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
35386
-
35387
- // Coercion.
35388
- // Extract anything that could conceivably be a part of a valid semver
35389
- tok('COERCE');
35390
- src[t.COERCE] = '(^|[^\\d])' +
35391
- '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
35392
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
35393
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
35394
- '(?:$|[^\\d])';
35395
- tok('COERCERTL');
35396
- re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
35397
-
35398
- // Tilde ranges.
35399
- // Meaning is "reasonably at or greater than"
35400
- tok('LONETILDE');
35401
- src[t.LONETILDE] = '(?:~>?)';
35402
-
35403
- tok('TILDETRIM');
35404
- src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
35405
- re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
35406
- var tildeTrimReplace = '$1~';
35407
-
35408
- tok('TILDE');
35409
- src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
35410
- tok('TILDELOOSE');
35411
- src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
35412
-
35413
- // Caret ranges.
35414
- // Meaning is "at least and backwards compatible with"
35415
- tok('LONECARET');
35416
- src[t.LONECARET] = '(?:\\^)';
35417
-
35418
- tok('CARETTRIM');
35419
- src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
35420
- re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
35421
- var caretTrimReplace = '$1^';
35422
-
35423
- tok('CARET');
35424
- src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
35425
- tok('CARETLOOSE');
35426
- src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
35427
-
35428
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
35429
- tok('COMPARATORLOOSE');
35430
- src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
35431
- tok('COMPARATOR');
35432
- src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
35433
-
35434
- // An expression to strip any whitespace between the gtlt and the thing
35435
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
35436
- tok('COMPARATORTRIM');
35437
- src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
35438
- '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
35439
-
35440
- // this one has to use the /g flag
35441
- re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
35442
- var comparatorTrimReplace = '$1$2$3';
35443
-
35444
- // Something like `1.2.3 - 1.2.4`
35445
- // Note that these all use the loose form, because they'll be
35446
- // checked against either the strict or loose comparator form
35447
- // later.
35448
- tok('HYPHENRANGE');
35449
- src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
35450
- '\\s+-\\s+' +
35451
- '(' + src[t.XRANGEPLAIN] + ')' +
35452
- '\\s*$';
35453
-
35454
- tok('HYPHENRANGELOOSE');
35455
- src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
35456
- '\\s+-\\s+' +
35457
- '(' + src[t.XRANGEPLAINLOOSE] + ')' +
35458
- '\\s*$';
35459
-
35460
- // Star ranges basically just allow anything at all.
35461
- tok('STAR');
35462
- src[t.STAR] = '(<|>)?=?\\s*\\*';
35463
-
35464
- // Compile to actual regexp objects.
35465
- // All are flag-free, unless they were created above with a flag.
35466
- for (var i = 0; i < R; i++) {
35467
- debug(i, src[i]);
35468
- if (!re[i]) {
35469
- re[i] = new RegExp(src[i]);
35470
- }
35471
- }
35472
-
35473
- exports.parse = parse;
35474
- function parse (version, options) {
35475
- if (!options || typeof options !== 'object') {
35476
- options = {
35477
- loose: !!options,
35478
- includePrerelease: false
35479
- };
35480
- }
35481
-
35482
- if (version instanceof SemVer) {
35483
- return version
35484
- }
35485
-
35486
- if (typeof version !== 'string') {
35487
- return null
35488
- }
35489
-
35490
- if (version.length > MAX_LENGTH) {
35491
- return null
35492
- }
35493
-
35494
- var r = options.loose ? re[t.LOOSE] : re[t.FULL];
35495
- if (!r.test(version)) {
35496
- return null
35497
- }
35498
-
35499
- try {
35500
- return new SemVer(version, options)
35501
- } catch (er) {
35502
- return null
35503
- }
35504
- }
35505
-
35506
- exports.valid = valid;
35507
- function valid (version, options) {
35508
- var v = parse(version, options);
35509
- return v ? v.version : null
35510
- }
35511
-
35512
- exports.clean = clean;
35513
- function clean (version, options) {
35514
- var s = parse(version.trim().replace(/^[=v]+/, ''), options);
35515
- return s ? s.version : null
35516
- }
35517
-
35518
- exports.SemVer = SemVer;
35519
-
35520
- function SemVer (version, options) {
35521
- if (!options || typeof options !== 'object') {
35522
- options = {
35523
- loose: !!options,
35524
- includePrerelease: false
35525
- };
35526
- }
35527
- if (version instanceof SemVer) {
35528
- if (version.loose === options.loose) {
35529
- return version
35530
- } else {
35531
- version = version.version;
35532
- }
35533
- } else if (typeof version !== 'string') {
35534
- throw new TypeError('Invalid Version: ' + version)
35535
- }
35536
-
35537
- if (version.length > MAX_LENGTH) {
35538
- throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
35539
- }
35540
-
35541
- if (!(this instanceof SemVer)) {
35542
- return new SemVer(version, options)
35543
- }
35544
-
35545
- debug('SemVer', version, options);
35546
- this.options = options;
35547
- this.loose = !!options.loose;
35548
-
35549
- var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
35550
-
35551
- if (!m) {
35552
- throw new TypeError('Invalid Version: ' + version)
35553
- }
35554
-
35555
- this.raw = version;
35556
-
35557
- // these are actually numbers
35558
- this.major = +m[1];
35559
- this.minor = +m[2];
35560
- this.patch = +m[3];
35561
-
35562
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
35563
- throw new TypeError('Invalid major version')
35564
- }
35565
-
35566
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
35567
- throw new TypeError('Invalid minor version')
35568
- }
35569
-
35570
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
35571
- throw new TypeError('Invalid patch version')
35572
- }
35573
-
35574
- // numberify any prerelease numeric ids
35575
- if (!m[4]) {
35576
- this.prerelease = [];
35577
- } else {
35578
- this.prerelease = m[4].split('.').map(function (id) {
35579
- if (/^[0-9]+$/.test(id)) {
35580
- var num = +id;
35581
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
35582
- return num
35583
- }
35584
- }
35585
- return id
35586
- });
35587
- }
35588
-
35589
- this.build = m[5] ? m[5].split('.') : [];
35590
- this.format();
35591
- }
35592
-
35593
- SemVer.prototype.format = function () {
35594
- this.version = this.major + '.' + this.minor + '.' + this.patch;
35595
- if (this.prerelease.length) {
35596
- this.version += '-' + this.prerelease.join('.');
35597
- }
35598
- return this.version
35599
- };
35600
-
35601
- SemVer.prototype.toString = function () {
35602
- return this.version
35603
- };
35604
-
35605
- SemVer.prototype.compare = function (other) {
35606
- debug('SemVer.compare', this.version, this.options, other);
35607
- if (!(other instanceof SemVer)) {
35608
- other = new SemVer(other, this.options);
35609
- }
35610
-
35611
- return this.compareMain(other) || this.comparePre(other)
35612
- };
35613
-
35614
- SemVer.prototype.compareMain = function (other) {
35615
- if (!(other instanceof SemVer)) {
35616
- other = new SemVer(other, this.options);
35617
- }
35618
-
35619
- return compareIdentifiers(this.major, other.major) ||
35620
- compareIdentifiers(this.minor, other.minor) ||
35621
- compareIdentifiers(this.patch, other.patch)
35622
- };
35623
-
35624
- SemVer.prototype.comparePre = function (other) {
35625
- if (!(other instanceof SemVer)) {
35626
- other = new SemVer(other, this.options);
35627
- }
35628
-
35629
- // NOT having a prerelease is > having one
35630
- if (this.prerelease.length && !other.prerelease.length) {
35631
- return -1
35632
- } else if (!this.prerelease.length && other.prerelease.length) {
35633
- return 1
35634
- } else if (!this.prerelease.length && !other.prerelease.length) {
35635
- return 0
35636
- }
35637
-
35638
- var i = 0;
35639
- do {
35640
- var a = this.prerelease[i];
35641
- var b = other.prerelease[i];
35642
- debug('prerelease compare', i, a, b);
35643
- if (a === undefined && b === undefined) {
35644
- return 0
35645
- } else if (b === undefined) {
35646
- return 1
35647
- } else if (a === undefined) {
35648
- return -1
35649
- } else if (a === b) {
35650
- continue
35651
- } else {
35652
- return compareIdentifiers(a, b)
35653
- }
35654
- } while (++i)
35655
- };
35656
-
35657
- SemVer.prototype.compareBuild = function (other) {
35658
- if (!(other instanceof SemVer)) {
35659
- other = new SemVer(other, this.options);
35660
- }
35661
-
35662
- var i = 0;
35663
- do {
35664
- var a = this.build[i];
35665
- var b = other.build[i];
35666
- debug('prerelease compare', i, a, b);
35667
- if (a === undefined && b === undefined) {
35668
- return 0
35669
- } else if (b === undefined) {
35670
- return 1
35671
- } else if (a === undefined) {
35672
- return -1
35673
- } else if (a === b) {
35674
- continue
35675
- } else {
35676
- return compareIdentifiers(a, b)
35677
- }
35678
- } while (++i)
35679
- };
35680
-
35681
- // preminor will bump the version up to the next minor release, and immediately
35682
- // down to pre-release. premajor and prepatch work the same way.
35683
- SemVer.prototype.inc = function (release, identifier) {
35684
- switch (release) {
35685
- case 'premajor':
35686
- this.prerelease.length = 0;
35687
- this.patch = 0;
35688
- this.minor = 0;
35689
- this.major++;
35690
- this.inc('pre', identifier);
35691
- break
35692
- case 'preminor':
35693
- this.prerelease.length = 0;
35694
- this.patch = 0;
35695
- this.minor++;
35696
- this.inc('pre', identifier);
35697
- break
35698
- case 'prepatch':
35699
- // If this is already a prerelease, it will bump to the next version
35700
- // drop any prereleases that might already exist, since they are not
35701
- // relevant at this point.
35702
- this.prerelease.length = 0;
35703
- this.inc('patch', identifier);
35704
- this.inc('pre', identifier);
35705
- break
35706
- // If the input is a non-prerelease version, this acts the same as
35707
- // prepatch.
35708
- case 'prerelease':
35709
- if (this.prerelease.length === 0) {
35710
- this.inc('patch', identifier);
35711
- }
35712
- this.inc('pre', identifier);
35713
- break
35714
-
35715
- case 'major':
35716
- // If this is a pre-major version, bump up to the same major version.
35717
- // Otherwise increment major.
35718
- // 1.0.0-5 bumps to 1.0.0
35719
- // 1.1.0 bumps to 2.0.0
35720
- if (this.minor !== 0 ||
35721
- this.patch !== 0 ||
35722
- this.prerelease.length === 0) {
35723
- this.major++;
35724
- }
35725
- this.minor = 0;
35726
- this.patch = 0;
35727
- this.prerelease = [];
35728
- break
35729
- case 'minor':
35730
- // If this is a pre-minor version, bump up to the same minor version.
35731
- // Otherwise increment minor.
35732
- // 1.2.0-5 bumps to 1.2.0
35733
- // 1.2.1 bumps to 1.3.0
35734
- if (this.patch !== 0 || this.prerelease.length === 0) {
35735
- this.minor++;
35736
- }
35737
- this.patch = 0;
35738
- this.prerelease = [];
35739
- break
35740
- case 'patch':
35741
- // If this is not a pre-release version, it will increment the patch.
35742
- // If it is a pre-release it will bump up to the same patch version.
35743
- // 1.2.0-5 patches to 1.2.0
35744
- // 1.2.0 patches to 1.2.1
35745
- if (this.prerelease.length === 0) {
35746
- this.patch++;
35747
- }
35748
- this.prerelease = [];
35749
- break
35750
- // This probably shouldn't be used publicly.
35751
- // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
35752
- case 'pre':
35753
- if (this.prerelease.length === 0) {
35754
- this.prerelease = [0];
35755
- } else {
35756
- var i = this.prerelease.length;
35757
- while (--i >= 0) {
35758
- if (typeof this.prerelease[i] === 'number') {
35759
- this.prerelease[i]++;
35760
- i = -2;
35761
- }
35762
- }
35763
- if (i === -1) {
35764
- // didn't increment anything
35765
- this.prerelease.push(0);
35766
- }
35767
- }
35768
- if (identifier) {
35769
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
35770
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
35771
- if (this.prerelease[0] === identifier) {
35772
- if (isNaN(this.prerelease[1])) {
35773
- this.prerelease = [identifier, 0];
35774
- }
35775
- } else {
35776
- this.prerelease = [identifier, 0];
35777
- }
35778
- }
35779
- break
35780
-
35781
- default:
35782
- throw new Error('invalid increment argument: ' + release)
35783
- }
35784
- this.format();
35785
- this.raw = this.version;
35786
- return this
35787
- };
35788
-
35789
- exports.inc = inc;
35790
- function inc (version, release, loose, identifier) {
35791
- if (typeof (loose) === 'string') {
35792
- identifier = loose;
35793
- loose = undefined;
35794
- }
35795
-
35796
- try {
35797
- return new SemVer(version, loose).inc(release, identifier).version
35798
- } catch (er) {
35799
- return null
35800
- }
35801
- }
35802
-
35803
- exports.diff = diff;
35804
- function diff (version1, version2) {
35805
- if (eq(version1, version2)) {
35806
- return null
35807
- } else {
35808
- var v1 = parse(version1);
35809
- var v2 = parse(version2);
35810
- var prefix = '';
35811
- if (v1.prerelease.length || v2.prerelease.length) {
35812
- prefix = 'pre';
35813
- var defaultResult = 'prerelease';
35814
- }
35815
- for (var key in v1) {
35816
- if (key === 'major' || key === 'minor' || key === 'patch') {
35817
- if (v1[key] !== v2[key]) {
35818
- return prefix + key
35819
- }
35820
- }
35821
- }
35822
- return defaultResult // may be undefined
35823
- }
35824
- }
35825
-
35826
- exports.compareIdentifiers = compareIdentifiers;
35827
-
35828
- var numeric = /^[0-9]+$/;
35829
- function compareIdentifiers (a, b) {
35830
- var anum = numeric.test(a);
35831
- var bnum = numeric.test(b);
35832
-
35833
- if (anum && bnum) {
35834
- a = +a;
35835
- b = +b;
35836
- }
35837
-
35838
- return a === b ? 0
35839
- : (anum && !bnum) ? -1
35840
- : (bnum && !anum) ? 1
35841
- : a < b ? -1
35842
- : 1
35843
- }
35844
-
35845
- exports.rcompareIdentifiers = rcompareIdentifiers;
35846
- function rcompareIdentifiers (a, b) {
35847
- return compareIdentifiers(b, a)
35848
- }
35849
-
35850
- exports.major = major;
35851
- function major (a, loose) {
35852
- return new SemVer(a, loose).major
35853
- }
35854
-
35855
- exports.minor = minor;
35856
- function minor (a, loose) {
35857
- return new SemVer(a, loose).minor
35858
- }
35859
-
35860
- exports.patch = patch;
35861
- function patch (a, loose) {
35862
- return new SemVer(a, loose).patch
35863
- }
35864
-
35865
- exports.compare = compare;
35866
- function compare (a, b, loose) {
35867
- return new SemVer(a, loose).compare(new SemVer(b, loose))
35868
- }
35869
-
35870
- exports.compareLoose = compareLoose;
35871
- function compareLoose (a, b) {
35872
- return compare(a, b, true)
35873
- }
35874
-
35875
- exports.compareBuild = compareBuild;
35876
- function compareBuild (a, b, loose) {
35877
- var versionA = new SemVer(a, loose);
35878
- var versionB = new SemVer(b, loose);
35879
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
35880
- }
35881
-
35882
- exports.rcompare = rcompare;
35883
- function rcompare (a, b, loose) {
35884
- return compare(b, a, loose)
35885
- }
35886
-
35887
- exports.sort = sort;
35888
- function sort (list, loose) {
35889
- return list.sort(function (a, b) {
35890
- return exports.compareBuild(a, b, loose)
35891
- })
35892
- }
35893
-
35894
- exports.rsort = rsort;
35895
- function rsort (list, loose) {
35896
- return list.sort(function (a, b) {
35897
- return exports.compareBuild(b, a, loose)
35898
- })
35899
- }
35900
-
35901
- exports.gt = gt;
35902
- function gt (a, b, loose) {
35903
- return compare(a, b, loose) > 0
35904
- }
35905
-
35906
- exports.lt = lt;
35907
- function lt (a, b, loose) {
35908
- return compare(a, b, loose) < 0
35909
- }
35910
-
35911
- exports.eq = eq;
35912
- function eq (a, b, loose) {
35913
- return compare(a, b, loose) === 0
35914
- }
35915
-
35916
- exports.neq = neq;
35917
- function neq (a, b, loose) {
35918
- return compare(a, b, loose) !== 0
35919
- }
35920
-
35921
- exports.gte = gte;
35922
- function gte (a, b, loose) {
35923
- return compare(a, b, loose) >= 0
35924
- }
35925
-
35926
- exports.lte = lte;
35927
- function lte (a, b, loose) {
35928
- return compare(a, b, loose) <= 0
35929
- }
35930
-
35931
- exports.cmp = cmp;
35932
- function cmp (a, op, b, loose) {
35933
- switch (op) {
35934
- case '===':
35935
- if (typeof a === 'object')
35936
- a = a.version;
35937
- if (typeof b === 'object')
35938
- b = b.version;
35939
- return a === b
35940
-
35941
- case '!==':
35942
- if (typeof a === 'object')
35943
- a = a.version;
35944
- if (typeof b === 'object')
35945
- b = b.version;
35946
- return a !== b
35947
-
35948
- case '':
35949
- case '=':
35950
- case '==':
35951
- return eq(a, b, loose)
35952
-
35953
- case '!=':
35954
- return neq(a, b, loose)
35955
-
35956
- case '>':
35957
- return gt(a, b, loose)
35958
-
35959
- case '>=':
35960
- return gte(a, b, loose)
35961
-
35962
- case '<':
35963
- return lt(a, b, loose)
35964
-
35965
- case '<=':
35966
- return lte(a, b, loose)
35967
-
35968
- default:
35969
- throw new TypeError('Invalid operator: ' + op)
35970
- }
35971
- }
35972
-
35973
- exports.Comparator = Comparator;
35974
- function Comparator (comp, options) {
35975
- if (!options || typeof options !== 'object') {
35976
- options = {
35977
- loose: !!options,
35978
- includePrerelease: false
35979
- };
35980
- }
35981
-
35982
- if (comp instanceof Comparator) {
35983
- if (comp.loose === !!options.loose) {
35984
- return comp
35985
- } else {
35986
- comp = comp.value;
35987
- }
35988
- }
35989
-
35990
- if (!(this instanceof Comparator)) {
35991
- return new Comparator(comp, options)
35992
- }
35993
-
35994
- debug('comparator', comp, options);
35995
- this.options = options;
35996
- this.loose = !!options.loose;
35997
- this.parse(comp);
35998
-
35999
- if (this.semver === ANY) {
36000
- this.value = '';
36001
- } else {
36002
- this.value = this.operator + this.semver.version;
36003
- }
36004
-
36005
- debug('comp', this);
36006
- }
36007
-
36008
- var ANY = {};
36009
- Comparator.prototype.parse = function (comp) {
36010
- var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36011
- var m = comp.match(r);
36012
-
36013
- if (!m) {
36014
- throw new TypeError('Invalid comparator: ' + comp)
36015
- }
36016
-
36017
- this.operator = m[1] !== undefined ? m[1] : '';
36018
- if (this.operator === '=') {
36019
- this.operator = '';
36020
- }
36021
-
36022
- // if it literally is just '>' or '' then allow anything.
36023
- if (!m[2]) {
36024
- this.semver = ANY;
36025
- } else {
36026
- this.semver = new SemVer(m[2], this.options.loose);
36027
- }
36028
- };
36029
-
36030
- Comparator.prototype.toString = function () {
36031
- return this.value
36032
- };
36033
-
36034
- Comparator.prototype.test = function (version) {
36035
- debug('Comparator.test', version, this.options.loose);
36036
-
36037
- if (this.semver === ANY || version === ANY) {
36038
- return true
36039
- }
36040
-
36041
- if (typeof version === 'string') {
36042
- try {
36043
- version = new SemVer(version, this.options);
36044
- } catch (er) {
36045
- return false
36046
- }
36047
- }
36048
-
36049
- return cmp(version, this.operator, this.semver, this.options)
36050
- };
36051
-
36052
- Comparator.prototype.intersects = function (comp, options) {
36053
- if (!(comp instanceof Comparator)) {
36054
- throw new TypeError('a Comparator is required')
36055
- }
36056
-
36057
- if (!options || typeof options !== 'object') {
36058
- options = {
36059
- loose: !!options,
36060
- includePrerelease: false
36061
- };
36062
- }
36063
-
36064
- var rangeTmp;
36065
-
36066
- if (this.operator === '') {
36067
- if (this.value === '') {
36068
- return true
36069
- }
36070
- rangeTmp = new Range(comp.value, options);
36071
- return satisfies(this.value, rangeTmp, options)
36072
- } else if (comp.operator === '') {
36073
- if (comp.value === '') {
36074
- return true
36075
- }
36076
- rangeTmp = new Range(this.value, options);
36077
- return satisfies(comp.semver, rangeTmp, options)
36078
- }
36079
-
36080
- var sameDirectionIncreasing =
36081
- (this.operator === '>=' || this.operator === '>') &&
36082
- (comp.operator === '>=' || comp.operator === '>');
36083
- var sameDirectionDecreasing =
36084
- (this.operator === '<=' || this.operator === '<') &&
36085
- (comp.operator === '<=' || comp.operator === '<');
36086
- var sameSemVer = this.semver.version === comp.semver.version;
36087
- var differentDirectionsInclusive =
36088
- (this.operator === '>=' || this.operator === '<=') &&
36089
- (comp.operator === '>=' || comp.operator === '<=');
36090
- var oppositeDirectionsLessThan =
36091
- cmp(this.semver, '<', comp.semver, options) &&
36092
- ((this.operator === '>=' || this.operator === '>') &&
36093
- (comp.operator === '<=' || comp.operator === '<'));
36094
- var oppositeDirectionsGreaterThan =
36095
- cmp(this.semver, '>', comp.semver, options) &&
36096
- ((this.operator === '<=' || this.operator === '<') &&
36097
- (comp.operator === '>=' || comp.operator === '>'));
36098
-
36099
- return sameDirectionIncreasing || sameDirectionDecreasing ||
36100
- (sameSemVer && differentDirectionsInclusive) ||
36101
- oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
36102
- };
36103
-
36104
- exports.Range = Range;
36105
- function Range (range, options) {
36106
- if (!options || typeof options !== 'object') {
36107
- options = {
36108
- loose: !!options,
36109
- includePrerelease: false
36110
- };
36111
- }
36112
-
36113
- if (range instanceof Range) {
36114
- if (range.loose === !!options.loose &&
36115
- range.includePrerelease === !!options.includePrerelease) {
36116
- return range
36117
- } else {
36118
- return new Range(range.raw, options)
36119
- }
36120
- }
36121
-
36122
- if (range instanceof Comparator) {
36123
- return new Range(range.value, options)
36124
- }
36125
-
36126
- if (!(this instanceof Range)) {
36127
- return new Range(range, options)
36128
- }
36129
-
36130
- this.options = options;
36131
- this.loose = !!options.loose;
36132
- this.includePrerelease = !!options.includePrerelease;
36133
-
36134
- // First, split based on boolean or ||
36135
- this.raw = range;
36136
- this.set = range.split(/\s*\|\|\s*/).map(function (range) {
36137
- return this.parseRange(range.trim())
36138
- }, this).filter(function (c) {
36139
- // throw out any that are not relevant for whatever reason
36140
- return c.length
36141
- });
36142
-
36143
- if (!this.set.length) {
36144
- throw new TypeError('Invalid SemVer Range: ' + range)
36145
- }
36146
-
36147
- this.format();
36148
- }
36149
-
36150
- Range.prototype.format = function () {
36151
- this.range = this.set.map(function (comps) {
36152
- return comps.join(' ').trim()
36153
- }).join('||').trim();
36154
- return this.range
36155
- };
36156
-
36157
- Range.prototype.toString = function () {
36158
- return this.range
36159
- };
36160
-
36161
- Range.prototype.parseRange = function (range) {
36162
- var loose = this.options.loose;
36163
- range = range.trim();
36164
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
36165
- var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
36166
- range = range.replace(hr, hyphenReplace);
36167
- debug('hyphen replace', range);
36168
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
36169
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
36170
- debug('comparator trim', range, re[t.COMPARATORTRIM]);
36171
-
36172
- // `~ 1.2.3` => `~1.2.3`
36173
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
36174
-
36175
- // `^ 1.2.3` => `^1.2.3`
36176
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
36177
-
36178
- // normalize spaces
36179
- range = range.split(/\s+/).join(' ');
36180
-
36181
- // At this point, the range is completely trimmed and
36182
- // ready to be split into comparators.
36183
-
36184
- var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36185
- var set = range.split(' ').map(function (comp) {
36186
- return parseComparator(comp, this.options)
36187
- }, this).join(' ').split(/\s+/);
36188
- if (this.options.loose) {
36189
- // in loose mode, throw out any that are not valid comparators
36190
- set = set.filter(function (comp) {
36191
- return !!comp.match(compRe)
36192
- });
36193
- }
36194
- set = set.map(function (comp) {
36195
- return new Comparator(comp, this.options)
36196
- }, this);
36197
-
36198
- return set
36199
- };
36200
-
36201
- Range.prototype.intersects = function (range, options) {
36202
- if (!(range instanceof Range)) {
36203
- throw new TypeError('a Range is required')
36204
- }
36205
-
36206
- return this.set.some(function (thisComparators) {
36207
- return (
36208
- isSatisfiable(thisComparators, options) &&
36209
- range.set.some(function (rangeComparators) {
36210
- return (
36211
- isSatisfiable(rangeComparators, options) &&
36212
- thisComparators.every(function (thisComparator) {
36213
- return rangeComparators.every(function (rangeComparator) {
36214
- return thisComparator.intersects(rangeComparator, options)
36215
- })
36216
- })
36217
- )
36218
- })
36219
- )
36220
- })
36221
- };
36222
-
36223
- // take a set of comparators and determine whether there
36224
- // exists a version which can satisfy it
36225
- function isSatisfiable (comparators, options) {
36226
- var result = true;
36227
- var remainingComparators = comparators.slice();
36228
- var testComparator = remainingComparators.pop();
36229
-
36230
- while (result && remainingComparators.length) {
36231
- result = remainingComparators.every(function (otherComparator) {
36232
- return testComparator.intersects(otherComparator, options)
36233
- });
36234
-
36235
- testComparator = remainingComparators.pop();
36236
- }
36237
-
36238
- return result
36239
- }
36240
-
36241
- // Mostly just for testing and legacy API reasons
36242
- exports.toComparators = toComparators;
36243
- function toComparators (range, options) {
36244
- return new Range(range, options).set.map(function (comp) {
36245
- return comp.map(function (c) {
36246
- return c.value
36247
- }).join(' ').trim().split(' ')
36248
- })
36249
- }
36250
-
36251
- // comprised of xranges, tildes, stars, and gtlt's at this point.
36252
- // already replaced the hyphen ranges
36253
- // turn into a set of JUST comparators.
36254
- function parseComparator (comp, options) {
36255
- debug('comp', comp, options);
36256
- comp = replaceCarets(comp, options);
36257
- debug('caret', comp);
36258
- comp = replaceTildes(comp, options);
36259
- debug('tildes', comp);
36260
- comp = replaceXRanges(comp, options);
36261
- debug('xrange', comp);
36262
- comp = replaceStars(comp, options);
36263
- debug('stars', comp);
36264
- return comp
36265
- }
36266
-
36267
- function isX (id) {
36268
- return !id || id.toLowerCase() === 'x' || id === '*'
36269
- }
36270
-
36271
- // ~, ~> --> * (any, kinda silly)
36272
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
36273
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
36274
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
36275
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
36276
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
36277
- function replaceTildes (comp, options) {
36278
- return comp.trim().split(/\s+/).map(function (comp) {
36279
- return replaceTilde(comp, options)
36280
- }).join(' ')
36281
- }
36282
-
36283
- function replaceTilde (comp, options) {
36284
- var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
36285
- return comp.replace(r, function (_, M, m, p, pr) {
36286
- debug('tilde', comp, _, M, m, p, pr);
36287
- var ret;
36288
-
36289
- if (isX(M)) {
36290
- ret = '';
36291
- } else if (isX(m)) {
36292
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36293
- } else if (isX(p)) {
36294
- // ~1.2 == >=1.2.0 <1.3.0
36295
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36296
- } else if (pr) {
36297
- debug('replaceTilde pr', pr);
36298
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36299
- ' <' + M + '.' + (+m + 1) + '.0';
36300
- } else {
36301
- // ~1.2.3 == >=1.2.3 <1.3.0
36302
- ret = '>=' + M + '.' + m + '.' + p +
36303
- ' <' + M + '.' + (+m + 1) + '.0';
36304
- }
36305
-
36306
- debug('tilde return', ret);
36307
- return ret
36308
- })
36309
- }
36310
-
36311
- // ^ --> * (any, kinda silly)
36312
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
36313
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
36314
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
36315
- // ^1.2.3 --> >=1.2.3 <2.0.0
36316
- // ^1.2.0 --> >=1.2.0 <2.0.0
36317
- function replaceCarets (comp, options) {
36318
- return comp.trim().split(/\s+/).map(function (comp) {
36319
- return replaceCaret(comp, options)
36320
- }).join(' ')
36321
- }
36322
-
36323
- function replaceCaret (comp, options) {
36324
- debug('caret', comp, options);
36325
- var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
36326
- return comp.replace(r, function (_, M, m, p, pr) {
36327
- debug('caret', comp, _, M, m, p, pr);
36328
- var ret;
36329
-
36330
- if (isX(M)) {
36331
- ret = '';
36332
- } else if (isX(m)) {
36333
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36334
- } else if (isX(p)) {
36335
- if (M === '0') {
36336
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36337
- } else {
36338
- ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
36339
- }
36340
- } else if (pr) {
36341
- debug('replaceCaret pr', pr);
36342
- if (M === '0') {
36343
- if (m === '0') {
36344
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36345
- ' <' + M + '.' + m + '.' + (+p + 1);
36346
- } else {
36347
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36348
- ' <' + M + '.' + (+m + 1) + '.0';
36349
- }
36350
- } else {
36351
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36352
- ' <' + (+M + 1) + '.0.0';
36353
- }
36354
- } else {
36355
- debug('no pr');
36356
- if (M === '0') {
36357
- if (m === '0') {
36358
- ret = '>=' + M + '.' + m + '.' + p +
36359
- ' <' + M + '.' + m + '.' + (+p + 1);
36360
- } else {
36361
- ret = '>=' + M + '.' + m + '.' + p +
36362
- ' <' + M + '.' + (+m + 1) + '.0';
36363
- }
36364
- } else {
36365
- ret = '>=' + M + '.' + m + '.' + p +
36366
- ' <' + (+M + 1) + '.0.0';
36367
- }
36368
- }
36369
-
36370
- debug('caret return', ret);
36371
- return ret
36372
- })
36373
- }
36374
-
36375
- function replaceXRanges (comp, options) {
36376
- debug('replaceXRanges', comp, options);
36377
- return comp.split(/\s+/).map(function (comp) {
36378
- return replaceXRange(comp, options)
36379
- }).join(' ')
36380
- }
36381
-
36382
- function replaceXRange (comp, options) {
36383
- comp = comp.trim();
36384
- var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
36385
- return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
36386
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
36387
- var xM = isX(M);
36388
- var xm = xM || isX(m);
36389
- var xp = xm || isX(p);
36390
- var anyX = xp;
36391
-
36392
- if (gtlt === '=' && anyX) {
36393
- gtlt = '';
36394
- }
36395
-
36396
- // if we're including prereleases in the match, then we need
36397
- // to fix this to -0, the lowest possible prerelease value
36398
- pr = options.includePrerelease ? '-0' : '';
36399
-
36400
- if (xM) {
36401
- if (gtlt === '>' || gtlt === '<') {
36402
- // nothing is allowed
36403
- ret = '<0.0.0-0';
36404
- } else {
36405
- // nothing is forbidden
36406
- ret = '*';
36407
- }
36408
- } else if (gtlt && anyX) {
36409
- // we know patch is an x, because we have any x at all.
36410
- // replace X with 0
36411
- if (xm) {
36412
- m = 0;
36413
- }
36414
- p = 0;
36415
-
36416
- if (gtlt === '>') {
36417
- // >1 => >=2.0.0
36418
- // >1.2 => >=1.3.0
36419
- // >1.2.3 => >= 1.2.4
36420
- gtlt = '>=';
36421
- if (xm) {
36422
- M = +M + 1;
36423
- m = 0;
36424
- p = 0;
36425
- } else {
36426
- m = +m + 1;
36427
- p = 0;
36428
- }
36429
- } else if (gtlt === '<=') {
36430
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
36431
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
36432
- gtlt = '<';
36433
- if (xm) {
36434
- M = +M + 1;
36435
- } else {
36436
- m = +m + 1;
36437
- }
36438
- }
36439
-
36440
- ret = gtlt + M + '.' + m + '.' + p + pr;
36441
- } else if (xm) {
36442
- ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
36443
- } else if (xp) {
36444
- ret = '>=' + M + '.' + m + '.0' + pr +
36445
- ' <' + M + '.' + (+m + 1) + '.0' + pr;
36446
- }
36447
-
36448
- debug('xRange return', ret);
36449
-
36450
- return ret
36451
- })
36452
- }
36453
-
36454
- // Because * is AND-ed with everything else in the comparator,
36455
- // and '' means "any version", just remove the *s entirely.
36456
- function replaceStars (comp, options) {
36457
- debug('replaceStars', comp, options);
36458
- // Looseness is ignored here. star is always as loose as it gets!
36459
- return comp.trim().replace(re[t.STAR], '')
36460
- }
36461
-
36462
- // This function is passed to string.replace(re[t.HYPHENRANGE])
36463
- // M, m, patch, prerelease, build
36464
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
36465
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
36466
- // 1.2 - 3.4 => >=1.2.0 <3.5.0
36467
- function hyphenReplace ($0,
36468
- from, fM, fm, fp, fpr, fb,
36469
- to, tM, tm, tp, tpr, tb) {
36470
- if (isX(fM)) {
36471
- from = '';
36472
- } else if (isX(fm)) {
36473
- from = '>=' + fM + '.0.0';
36474
- } else if (isX(fp)) {
36475
- from = '>=' + fM + '.' + fm + '.0';
36476
- } else {
36477
- from = '>=' + from;
36478
- }
36479
-
36480
- if (isX(tM)) {
36481
- to = '';
36482
- } else if (isX(tm)) {
36483
- to = '<' + (+tM + 1) + '.0.0';
36484
- } else if (isX(tp)) {
36485
- to = '<' + tM + '.' + (+tm + 1) + '.0';
36486
- } else if (tpr) {
36487
- to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
36488
- } else {
36489
- to = '<=' + to;
36490
- }
36491
-
36492
- return (from + ' ' + to).trim()
36493
- }
36494
-
36495
- // if ANY of the sets match ALL of its comparators, then pass
36496
- Range.prototype.test = function (version) {
36497
- if (!version) {
36498
- return false
36499
- }
36500
-
36501
- if (typeof version === 'string') {
36502
- try {
36503
- version = new SemVer(version, this.options);
36504
- } catch (er) {
36505
- return false
36506
- }
36507
- }
36508
-
36509
- for (var i = 0; i < this.set.length; i++) {
36510
- if (testSet(this.set[i], version, this.options)) {
36511
- return true
36512
- }
36513
- }
36514
- return false
36515
- };
36516
-
36517
- function testSet (set, version, options) {
36518
- for (var i = 0; i < set.length; i++) {
36519
- if (!set[i].test(version)) {
36520
- return false
36521
- }
36522
- }
36523
-
36524
- if (version.prerelease.length && !options.includePrerelease) {
36525
- // Find the set of versions that are allowed to have prereleases
36526
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
36527
- // That should allow `1.2.3-pr.2` to pass.
36528
- // However, `1.2.4-alpha.notready` should NOT be allowed,
36529
- // even though it's within the range set by the comparators.
36530
- for (i = 0; i < set.length; i++) {
36531
- debug(set[i].semver);
36532
- if (set[i].semver === ANY) {
36533
- continue
36534
- }
36535
-
36536
- if (set[i].semver.prerelease.length > 0) {
36537
- var allowed = set[i].semver;
36538
- if (allowed.major === version.major &&
36539
- allowed.minor === version.minor &&
36540
- allowed.patch === version.patch) {
36541
- return true
36542
- }
36543
- }
36544
- }
36545
-
36546
- // Version has a -pre, but it's not one of the ones we like.
36547
- return false
36548
- }
36549
-
36550
- return true
36551
- }
36552
-
36553
- exports.satisfies = satisfies;
36554
- function satisfies (version, range, options) {
36555
- try {
36556
- range = new Range(range, options);
36557
- } catch (er) {
36558
- return false
36559
- }
36560
- return range.test(version)
36561
- }
35569
+ exports = module.exports = SemVer;
35570
+ var debug;
35571
+ /* istanbul ignore next */
35572
+ if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
35573
+ debug = function () {
35574
+ var args = Array.prototype.slice.call(arguments, 0);
35575
+ args.unshift('SEMVER');
35576
+ console.log.apply(console, args);
35577
+ };
35578
+ } else {
35579
+ debug = function () {};
35580
+ }
36562
35581
 
36563
- exports.maxSatisfying = maxSatisfying;
36564
- function maxSatisfying (versions, range, options) {
36565
- var max = null;
36566
- var maxSV = null;
36567
- try {
36568
- var rangeObj = new Range(range, options);
36569
- } catch (er) {
36570
- return null
36571
- }
36572
- versions.forEach(function (v) {
36573
- if (rangeObj.test(v)) {
36574
- // satisfies(v, range, options)
36575
- if (!max || maxSV.compare(v) === -1) {
36576
- // compare(max, v, true)
36577
- max = v;
36578
- maxSV = new SemVer(max, options);
36579
- }
36580
- }
36581
- });
36582
- return max
36583
- }
35582
+ // Note: this is the semver.org version of the spec that it implements
35583
+ // Not necessarily the package version of this code.
35584
+ exports.SEMVER_SPEC_VERSION = '2.0.0';
35585
+ var MAX_LENGTH = 256;
35586
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
35587
+
35588
+ // Max safe segment length for coercion.
35589
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
35590
+
35591
+ // The actual regexps go on exports.re
35592
+ var re = exports.re = [];
35593
+ var src = exports.src = [];
35594
+ var t = exports.tokens = {};
35595
+ var R = 0;
35596
+ function tok(n) {
35597
+ t[n] = R++;
35598
+ }
35599
+
35600
+ // The following Regular Expressions can be used for tokenizing,
35601
+ // validating, and parsing SemVer version strings.
35602
+
35603
+ // ## Numeric Identifier
35604
+ // A single `0`, or a non-zero digit followed by zero or more digits.
35605
+
35606
+ tok('NUMERICIDENTIFIER');
35607
+ src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
35608
+ tok('NUMERICIDENTIFIERLOOSE');
35609
+ src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
35610
+
35611
+ // ## Non-numeric Identifier
35612
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
35613
+ // more letters, digits, or hyphens.
35614
+
35615
+ tok('NONNUMERICIDENTIFIER');
35616
+ src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
35617
+
35618
+ // ## Main Version
35619
+ // Three dot-separated numeric identifiers.
35620
+
35621
+ tok('MAINVERSION');
35622
+ src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')';
35623
+ tok('MAINVERSIONLOOSE');
35624
+ src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
35625
+
35626
+ // ## Pre-release Version Identifier
35627
+ // A numeric identifier, or a non-numeric identifier.
35628
+
35629
+ tok('PRERELEASEIDENTIFIER');
35630
+ src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35631
+ tok('PRERELEASEIDENTIFIERLOOSE');
35632
+ src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35633
+
35634
+ // ## Pre-release Version
35635
+ // Hyphen, followed by one or more dot-separated pre-release version
35636
+ // identifiers.
35637
+
35638
+ tok('PRERELEASE');
35639
+ src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
35640
+ tok('PRERELEASELOOSE');
35641
+ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
35642
+
35643
+ // ## Build Metadata Identifier
35644
+ // Any combination of digits, letters, or hyphens.
35645
+
35646
+ tok('BUILDIDENTIFIER');
35647
+ src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
35648
+
35649
+ // ## Build Metadata
35650
+ // Plus sign, followed by one or more period-separated build metadata
35651
+ // identifiers.
35652
+
35653
+ tok('BUILD');
35654
+ src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
35655
+
35656
+ // ## Full Version String
35657
+ // A main version, followed optionally by a pre-release version and
35658
+ // build metadata.
35659
+
35660
+ // Note that the only major, minor, patch, and pre-release sections of
35661
+ // the version string are capturing groups. The build metadata is not a
35662
+ // capturing group, because it should not ever be used in version
35663
+ // comparison.
35664
+
35665
+ tok('FULL');
35666
+ tok('FULLPLAIN');
35667
+ src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?';
35668
+ src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
35669
+
35670
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
35671
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
35672
+ // common in the npm registry.
35673
+ tok('LOOSEPLAIN');
35674
+ src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?';
35675
+ tok('LOOSE');
35676
+ src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
35677
+ tok('GTLT');
35678
+ src[t.GTLT] = '((?:<|>)?=?)';
35679
+
35680
+ // Something like "2.*" or "1.2.x".
35681
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
35682
+ // Only the first item is strictly required.
35683
+ tok('XRANGEIDENTIFIERLOOSE');
35684
+ src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
35685
+ tok('XRANGEIDENTIFIER');
35686
+ src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
35687
+ tok('XRANGEPLAIN');
35688
+ src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?';
35689
+ tok('XRANGEPLAINLOOSE');
35690
+ src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?';
35691
+ tok('XRANGE');
35692
+ src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
35693
+ tok('XRANGELOOSE');
35694
+ src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
35695
+
35696
+ // Coercion.
35697
+ // Extract anything that could conceivably be a part of a valid semver
35698
+ tok('COERCE');
35699
+ src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
35700
+ tok('COERCERTL');
35701
+ re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
35702
+
35703
+ // Tilde ranges.
35704
+ // Meaning is "reasonably at or greater than"
35705
+ tok('LONETILDE');
35706
+ src[t.LONETILDE] = '(?:~>?)';
35707
+ tok('TILDETRIM');
35708
+ src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
35709
+ re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
35710
+ var tildeTrimReplace = '$1~';
35711
+ tok('TILDE');
35712
+ src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
35713
+ tok('TILDELOOSE');
35714
+ src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
35715
+
35716
+ // Caret ranges.
35717
+ // Meaning is "at least and backwards compatible with"
35718
+ tok('LONECARET');
35719
+ src[t.LONECARET] = '(?:\\^)';
35720
+ tok('CARETTRIM');
35721
+ src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
35722
+ re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
35723
+ var caretTrimReplace = '$1^';
35724
+ tok('CARET');
35725
+ src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
35726
+ tok('CARETLOOSE');
35727
+ src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
35728
+
35729
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
35730
+ tok('COMPARATORLOOSE');
35731
+ src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
35732
+ tok('COMPARATOR');
35733
+ src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
35734
+
35735
+ // An expression to strip any whitespace between the gtlt and the thing
35736
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
35737
+ tok('COMPARATORTRIM');
35738
+ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
35739
+
35740
+ // this one has to use the /g flag
35741
+ re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
35742
+ var comparatorTrimReplace = '$1$2$3';
35743
+
35744
+ // Something like `1.2.3 - 1.2.4`
35745
+ // Note that these all use the loose form, because they'll be
35746
+ // checked against either the strict or loose comparator form
35747
+ // later.
35748
+ tok('HYPHENRANGE');
35749
+ src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$';
35750
+ tok('HYPHENRANGELOOSE');
35751
+ src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$';
35752
+
35753
+ // Star ranges basically just allow anything at all.
35754
+ tok('STAR');
35755
+ src[t.STAR] = '(<|>)?=?\\s*\\*';
35756
+
35757
+ // Compile to actual regexp objects.
35758
+ // All are flag-free, unless they were created above with a flag.
35759
+ for (var i = 0; i < R; i++) {
35760
+ debug(i, src[i]);
35761
+ if (!re[i]) {
35762
+ re[i] = new RegExp(src[i]);
35763
+ }
35764
+ }
35765
+ exports.parse = parse;
35766
+ function parse(version, options) {
35767
+ if (!options || typeof options !== 'object') {
35768
+ options = {
35769
+ loose: !!options,
35770
+ includePrerelease: false
35771
+ };
35772
+ }
35773
+ if (version instanceof SemVer) {
35774
+ return version;
35775
+ }
35776
+ if (typeof version !== 'string') {
35777
+ return null;
35778
+ }
35779
+ if (version.length > MAX_LENGTH) {
35780
+ return null;
35781
+ }
35782
+ var r = options.loose ? re[t.LOOSE] : re[t.FULL];
35783
+ if (!r.test(version)) {
35784
+ return null;
35785
+ }
35786
+ try {
35787
+ return new SemVer(version, options);
35788
+ } catch (er) {
35789
+ return null;
35790
+ }
35791
+ }
35792
+ exports.valid = valid;
35793
+ function valid(version, options) {
35794
+ var v = parse(version, options);
35795
+ return v ? v.version : null;
35796
+ }
35797
+ exports.clean = clean;
35798
+ function clean(version, options) {
35799
+ var s = parse(version.trim().replace(/^[=v]+/, ''), options);
35800
+ return s ? s.version : null;
35801
+ }
35802
+ exports.SemVer = SemVer;
35803
+ function SemVer(version, options) {
35804
+ if (!options || typeof options !== 'object') {
35805
+ options = {
35806
+ loose: !!options,
35807
+ includePrerelease: false
35808
+ };
35809
+ }
35810
+ if (version instanceof SemVer) {
35811
+ if (version.loose === options.loose) {
35812
+ return version;
35813
+ } else {
35814
+ version = version.version;
35815
+ }
35816
+ } else if (typeof version !== 'string') {
35817
+ throw new TypeError('Invalid Version: ' + version);
35818
+ }
35819
+ if (version.length > MAX_LENGTH) {
35820
+ throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
35821
+ }
35822
+ if (!(this instanceof SemVer)) {
35823
+ return new SemVer(version, options);
35824
+ }
35825
+ debug('SemVer', version, options);
35826
+ this.options = options;
35827
+ this.loose = !!options.loose;
35828
+ var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
35829
+ if (!m) {
35830
+ throw new TypeError('Invalid Version: ' + version);
35831
+ }
35832
+ this.raw = version;
36584
35833
 
36585
- exports.minSatisfying = minSatisfying;
36586
- function minSatisfying (versions, range, options) {
36587
- var min = null;
36588
- var minSV = null;
36589
- try {
36590
- var rangeObj = new Range(range, options);
36591
- } catch (er) {
36592
- return null
36593
- }
36594
- versions.forEach(function (v) {
36595
- if (rangeObj.test(v)) {
36596
- // satisfies(v, range, options)
36597
- if (!min || minSV.compare(v) === 1) {
36598
- // compare(min, v, true)
36599
- min = v;
36600
- minSV = new SemVer(min, options);
36601
- }
36602
- }
36603
- });
36604
- return min
36605
- }
35834
+ // these are actually numbers
35835
+ this.major = +m[1];
35836
+ this.minor = +m[2];
35837
+ this.patch = +m[3];
35838
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
35839
+ throw new TypeError('Invalid major version');
35840
+ }
35841
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
35842
+ throw new TypeError('Invalid minor version');
35843
+ }
35844
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
35845
+ throw new TypeError('Invalid patch version');
35846
+ }
36606
35847
 
36607
- exports.minVersion = minVersion;
36608
- function minVersion (range, loose) {
36609
- range = new Range(range, loose);
35848
+ // numberify any prerelease numeric ids
35849
+ if (!m[4]) {
35850
+ this.prerelease = [];
35851
+ } else {
35852
+ this.prerelease = m[4].split('.').map(function (id) {
35853
+ if (/^[0-9]+$/.test(id)) {
35854
+ var num = +id;
35855
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
35856
+ return num;
35857
+ }
35858
+ }
35859
+ return id;
35860
+ });
35861
+ }
35862
+ this.build = m[5] ? m[5].split('.') : [];
35863
+ this.format();
35864
+ }
35865
+ SemVer.prototype.format = function () {
35866
+ this.version = this.major + '.' + this.minor + '.' + this.patch;
35867
+ if (this.prerelease.length) {
35868
+ this.version += '-' + this.prerelease.join('.');
35869
+ }
35870
+ return this.version;
35871
+ };
35872
+ SemVer.prototype.toString = function () {
35873
+ return this.version;
35874
+ };
35875
+ SemVer.prototype.compare = function (other) {
35876
+ debug('SemVer.compare', this.version, this.options, other);
35877
+ if (!(other instanceof SemVer)) {
35878
+ other = new SemVer(other, this.options);
35879
+ }
35880
+ return this.compareMain(other) || this.comparePre(other);
35881
+ };
35882
+ SemVer.prototype.compareMain = function (other) {
35883
+ if (!(other instanceof SemVer)) {
35884
+ other = new SemVer(other, this.options);
35885
+ }
35886
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
35887
+ };
35888
+ SemVer.prototype.comparePre = function (other) {
35889
+ if (!(other instanceof SemVer)) {
35890
+ other = new SemVer(other, this.options);
35891
+ }
36610
35892
 
36611
- var minver = new SemVer('0.0.0');
36612
- if (range.test(minver)) {
36613
- return minver
36614
- }
35893
+ // NOT having a prerelease is > having one
35894
+ if (this.prerelease.length && !other.prerelease.length) {
35895
+ return -1;
35896
+ } else if (!this.prerelease.length && other.prerelease.length) {
35897
+ return 1;
35898
+ } else if (!this.prerelease.length && !other.prerelease.length) {
35899
+ return 0;
35900
+ }
35901
+ var i = 0;
35902
+ do {
35903
+ var a = this.prerelease[i];
35904
+ var b = other.prerelease[i];
35905
+ debug('prerelease compare', i, a, b);
35906
+ if (a === undefined && b === undefined) {
35907
+ return 0;
35908
+ } else if (b === undefined) {
35909
+ return 1;
35910
+ } else if (a === undefined) {
35911
+ return -1;
35912
+ } else if (a === b) {
35913
+ continue;
35914
+ } else {
35915
+ return compareIdentifiers(a, b);
35916
+ }
35917
+ } while (++i);
35918
+ };
35919
+ SemVer.prototype.compareBuild = function (other) {
35920
+ if (!(other instanceof SemVer)) {
35921
+ other = new SemVer(other, this.options);
35922
+ }
35923
+ var i = 0;
35924
+ do {
35925
+ var a = this.build[i];
35926
+ var b = other.build[i];
35927
+ debug('prerelease compare', i, a, b);
35928
+ if (a === undefined && b === undefined) {
35929
+ return 0;
35930
+ } else if (b === undefined) {
35931
+ return 1;
35932
+ } else if (a === undefined) {
35933
+ return -1;
35934
+ } else if (a === b) {
35935
+ continue;
35936
+ } else {
35937
+ return compareIdentifiers(a, b);
35938
+ }
35939
+ } while (++i);
35940
+ };
36615
35941
 
36616
- minver = new SemVer('0.0.0-0');
36617
- if (range.test(minver)) {
36618
- return minver
36619
- }
35942
+ // preminor will bump the version up to the next minor release, and immediately
35943
+ // down to pre-release. premajor and prepatch work the same way.
35944
+ SemVer.prototype.inc = function (release, identifier) {
35945
+ switch (release) {
35946
+ case 'premajor':
35947
+ this.prerelease.length = 0;
35948
+ this.patch = 0;
35949
+ this.minor = 0;
35950
+ this.major++;
35951
+ this.inc('pre', identifier);
35952
+ break;
35953
+ case 'preminor':
35954
+ this.prerelease.length = 0;
35955
+ this.patch = 0;
35956
+ this.minor++;
35957
+ this.inc('pre', identifier);
35958
+ break;
35959
+ case 'prepatch':
35960
+ // If this is already a prerelease, it will bump to the next version
35961
+ // drop any prereleases that might already exist, since they are not
35962
+ // relevant at this point.
35963
+ this.prerelease.length = 0;
35964
+ this.inc('patch', identifier);
35965
+ this.inc('pre', identifier);
35966
+ break;
35967
+ // If the input is a non-prerelease version, this acts the same as
35968
+ // prepatch.
35969
+ case 'prerelease':
35970
+ if (this.prerelease.length === 0) {
35971
+ this.inc('patch', identifier);
35972
+ }
35973
+ this.inc('pre', identifier);
35974
+ break;
35975
+ case 'major':
35976
+ // If this is a pre-major version, bump up to the same major version.
35977
+ // Otherwise increment major.
35978
+ // 1.0.0-5 bumps to 1.0.0
35979
+ // 1.1.0 bumps to 2.0.0
35980
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
35981
+ this.major++;
35982
+ }
35983
+ this.minor = 0;
35984
+ this.patch = 0;
35985
+ this.prerelease = [];
35986
+ break;
35987
+ case 'minor':
35988
+ // If this is a pre-minor version, bump up to the same minor version.
35989
+ // Otherwise increment minor.
35990
+ // 1.2.0-5 bumps to 1.2.0
35991
+ // 1.2.1 bumps to 1.3.0
35992
+ if (this.patch !== 0 || this.prerelease.length === 0) {
35993
+ this.minor++;
35994
+ }
35995
+ this.patch = 0;
35996
+ this.prerelease = [];
35997
+ break;
35998
+ case 'patch':
35999
+ // If this is not a pre-release version, it will increment the patch.
36000
+ // If it is a pre-release it will bump up to the same patch version.
36001
+ // 1.2.0-5 patches to 1.2.0
36002
+ // 1.2.0 patches to 1.2.1
36003
+ if (this.prerelease.length === 0) {
36004
+ this.patch++;
36005
+ }
36006
+ this.prerelease = [];
36007
+ break;
36008
+ // This probably shouldn't be used publicly.
36009
+ // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
36010
+ case 'pre':
36011
+ if (this.prerelease.length === 0) {
36012
+ this.prerelease = [0];
36013
+ } else {
36014
+ var i = this.prerelease.length;
36015
+ while (--i >= 0) {
36016
+ if (typeof this.prerelease[i] === 'number') {
36017
+ this.prerelease[i]++;
36018
+ i = -2;
36019
+ }
36020
+ }
36021
+ if (i === -1) {
36022
+ // didn't increment anything
36023
+ this.prerelease.push(0);
36024
+ }
36025
+ }
36026
+ if (identifier) {
36027
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
36028
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
36029
+ if (this.prerelease[0] === identifier) {
36030
+ if (isNaN(this.prerelease[1])) {
36031
+ this.prerelease = [identifier, 0];
36032
+ }
36033
+ } else {
36034
+ this.prerelease = [identifier, 0];
36035
+ }
36036
+ }
36037
+ break;
36038
+ default:
36039
+ throw new Error('invalid increment argument: ' + release);
36040
+ }
36041
+ this.format();
36042
+ this.raw = this.version;
36043
+ return this;
36044
+ };
36045
+ exports.inc = inc;
36046
+ function inc(version, release, loose, identifier) {
36047
+ if (typeof loose === 'string') {
36048
+ identifier = loose;
36049
+ loose = undefined;
36050
+ }
36051
+ try {
36052
+ return new SemVer(version, loose).inc(release, identifier).version;
36053
+ } catch (er) {
36054
+ return null;
36055
+ }
36056
+ }
36057
+ exports.diff = diff;
36058
+ function diff(version1, version2) {
36059
+ if (eq(version1, version2)) {
36060
+ return null;
36061
+ } else {
36062
+ var v1 = parse(version1);
36063
+ var v2 = parse(version2);
36064
+ var prefix = '';
36065
+ if (v1.prerelease.length || v2.prerelease.length) {
36066
+ prefix = 'pre';
36067
+ var defaultResult = 'prerelease';
36068
+ }
36069
+ for (var key in v1) {
36070
+ if (key === 'major' || key === 'minor' || key === 'patch') {
36071
+ if (v1[key] !== v2[key]) {
36072
+ return prefix + key;
36073
+ }
36074
+ }
36075
+ }
36076
+ return defaultResult; // may be undefined
36077
+ }
36078
+ }
36620
36079
 
36621
- minver = null;
36622
- for (var i = 0; i < range.set.length; ++i) {
36623
- var comparators = range.set[i];
36624
-
36625
- comparators.forEach(function (comparator) {
36626
- // Clone to avoid manipulating the comparator's semver object.
36627
- var compver = new SemVer(comparator.semver.version);
36628
- switch (comparator.operator) {
36629
- case '>':
36630
- if (compver.prerelease.length === 0) {
36631
- compver.patch++;
36632
- } else {
36633
- compver.prerelease.push(0);
36634
- }
36635
- compver.raw = compver.format();
36636
- /* fallthrough */
36637
- case '':
36638
- case '>=':
36639
- if (!minver || gt(minver, compver)) {
36640
- minver = compver;
36641
- }
36642
- break
36643
- case '<':
36644
- case '<=':
36645
- /* Ignore maximum versions */
36646
- break
36647
- /* istanbul ignore next */
36648
- default:
36649
- throw new Error('Unexpected operation: ' + comparator.operator)
36650
- }
36651
- });
36652
- }
36080
+ exports.compareIdentifiers = compareIdentifiers;
36081
+ var numeric = /^[0-9]+$/;
36082
+ function compareIdentifiers(a, b) {
36083
+ var anum = numeric.test(a);
36084
+ var bnum = numeric.test(b);
36085
+ if (anum && bnum) {
36086
+ a = +a;
36087
+ b = +b;
36088
+ }
36089
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
36090
+ }
36091
+ exports.rcompareIdentifiers = rcompareIdentifiers;
36092
+ function rcompareIdentifiers(a, b) {
36093
+ return compareIdentifiers(b, a);
36094
+ }
36095
+ exports.major = major;
36096
+ function major(a, loose) {
36097
+ return new SemVer(a, loose).major;
36098
+ }
36099
+ exports.minor = minor;
36100
+ function minor(a, loose) {
36101
+ return new SemVer(a, loose).minor;
36102
+ }
36103
+ exports.patch = patch;
36104
+ function patch(a, loose) {
36105
+ return new SemVer(a, loose).patch;
36106
+ }
36107
+ exports.compare = compare;
36108
+ function compare(a, b, loose) {
36109
+ return new SemVer(a, loose).compare(new SemVer(b, loose));
36110
+ }
36111
+ exports.compareLoose = compareLoose;
36112
+ function compareLoose(a, b) {
36113
+ return compare(a, b, true);
36114
+ }
36115
+ exports.compareBuild = compareBuild;
36116
+ function compareBuild(a, b, loose) {
36117
+ var versionA = new SemVer(a, loose);
36118
+ var versionB = new SemVer(b, loose);
36119
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
36120
+ }
36121
+ exports.rcompare = rcompare;
36122
+ function rcompare(a, b, loose) {
36123
+ return compare(b, a, loose);
36124
+ }
36125
+ exports.sort = sort;
36126
+ function sort(list, loose) {
36127
+ return list.sort(function (a, b) {
36128
+ return exports.compareBuild(a, b, loose);
36129
+ });
36130
+ }
36131
+ exports.rsort = rsort;
36132
+ function rsort(list, loose) {
36133
+ return list.sort(function (a, b) {
36134
+ return exports.compareBuild(b, a, loose);
36135
+ });
36136
+ }
36137
+ exports.gt = gt;
36138
+ function gt(a, b, loose) {
36139
+ return compare(a, b, loose) > 0;
36140
+ }
36141
+ exports.lt = lt;
36142
+ function lt(a, b, loose) {
36143
+ return compare(a, b, loose) < 0;
36144
+ }
36145
+ exports.eq = eq;
36146
+ function eq(a, b, loose) {
36147
+ return compare(a, b, loose) === 0;
36148
+ }
36149
+ exports.neq = neq;
36150
+ function neq(a, b, loose) {
36151
+ return compare(a, b, loose) !== 0;
36152
+ }
36153
+ exports.gte = gte;
36154
+ function gte(a, b, loose) {
36155
+ return compare(a, b, loose) >= 0;
36156
+ }
36157
+ exports.lte = lte;
36158
+ function lte(a, b, loose) {
36159
+ return compare(a, b, loose) <= 0;
36160
+ }
36161
+ exports.cmp = cmp;
36162
+ function cmp(a, op, b, loose) {
36163
+ switch (op) {
36164
+ case '===':
36165
+ if (typeof a === 'object') a = a.version;
36166
+ if (typeof b === 'object') b = b.version;
36167
+ return a === b;
36168
+ case '!==':
36169
+ if (typeof a === 'object') a = a.version;
36170
+ if (typeof b === 'object') b = b.version;
36171
+ return a !== b;
36172
+ case '':
36173
+ case '=':
36174
+ case '==':
36175
+ return eq(a, b, loose);
36176
+ case '!=':
36177
+ return neq(a, b, loose);
36178
+ case '>':
36179
+ return gt(a, b, loose);
36180
+ case '>=':
36181
+ return gte(a, b, loose);
36182
+ case '<':
36183
+ return lt(a, b, loose);
36184
+ case '<=':
36185
+ return lte(a, b, loose);
36186
+ default:
36187
+ throw new TypeError('Invalid operator: ' + op);
36188
+ }
36189
+ }
36190
+ exports.Comparator = Comparator;
36191
+ function Comparator(comp, options) {
36192
+ if (!options || typeof options !== 'object') {
36193
+ options = {
36194
+ loose: !!options,
36195
+ includePrerelease: false
36196
+ };
36197
+ }
36198
+ if (comp instanceof Comparator) {
36199
+ if (comp.loose === !!options.loose) {
36200
+ return comp;
36201
+ } else {
36202
+ comp = comp.value;
36203
+ }
36204
+ }
36205
+ if (!(this instanceof Comparator)) {
36206
+ return new Comparator(comp, options);
36207
+ }
36208
+ debug('comparator', comp, options);
36209
+ this.options = options;
36210
+ this.loose = !!options.loose;
36211
+ this.parse(comp);
36212
+ if (this.semver === ANY) {
36213
+ this.value = '';
36214
+ } else {
36215
+ this.value = this.operator + this.semver.version;
36216
+ }
36217
+ debug('comp', this);
36218
+ }
36219
+ var ANY = {};
36220
+ Comparator.prototype.parse = function (comp) {
36221
+ var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36222
+ var m = comp.match(r);
36223
+ if (!m) {
36224
+ throw new TypeError('Invalid comparator: ' + comp);
36225
+ }
36226
+ this.operator = m[1] !== undefined ? m[1] : '';
36227
+ if (this.operator === '=') {
36228
+ this.operator = '';
36229
+ }
36653
36230
 
36654
- if (minver && range.test(minver)) {
36655
- return minver
36656
- }
36231
+ // if it literally is just '>' or '' then allow anything.
36232
+ if (!m[2]) {
36233
+ this.semver = ANY;
36234
+ } else {
36235
+ this.semver = new SemVer(m[2], this.options.loose);
36236
+ }
36237
+ };
36238
+ Comparator.prototype.toString = function () {
36239
+ return this.value;
36240
+ };
36241
+ Comparator.prototype.test = function (version) {
36242
+ debug('Comparator.test', version, this.options.loose);
36243
+ if (this.semver === ANY || version === ANY) {
36244
+ return true;
36245
+ }
36246
+ if (typeof version === 'string') {
36247
+ try {
36248
+ version = new SemVer(version, this.options);
36249
+ } catch (er) {
36250
+ return false;
36251
+ }
36252
+ }
36253
+ return cmp(version, this.operator, this.semver, this.options);
36254
+ };
36255
+ Comparator.prototype.intersects = function (comp, options) {
36256
+ if (!(comp instanceof Comparator)) {
36257
+ throw new TypeError('a Comparator is required');
36258
+ }
36259
+ if (!options || typeof options !== 'object') {
36260
+ options = {
36261
+ loose: !!options,
36262
+ includePrerelease: false
36263
+ };
36264
+ }
36265
+ var rangeTmp;
36266
+ if (this.operator === '') {
36267
+ if (this.value === '') {
36268
+ return true;
36269
+ }
36270
+ rangeTmp = new Range(comp.value, options);
36271
+ return satisfies(this.value, rangeTmp, options);
36272
+ } else if (comp.operator === '') {
36273
+ if (comp.value === '') {
36274
+ return true;
36275
+ }
36276
+ rangeTmp = new Range(this.value, options);
36277
+ return satisfies(comp.semver, rangeTmp, options);
36278
+ }
36279
+ var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
36280
+ var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
36281
+ var sameSemVer = this.semver.version === comp.semver.version;
36282
+ var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
36283
+ var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
36284
+ var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
36285
+ return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
36286
+ };
36287
+ exports.Range = Range;
36288
+ function Range(range, options) {
36289
+ if (!options || typeof options !== 'object') {
36290
+ options = {
36291
+ loose: !!options,
36292
+ includePrerelease: false
36293
+ };
36294
+ }
36295
+ if (range instanceof Range) {
36296
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
36297
+ return range;
36298
+ } else {
36299
+ return new Range(range.raw, options);
36300
+ }
36301
+ }
36302
+ if (range instanceof Comparator) {
36303
+ return new Range(range.value, options);
36304
+ }
36305
+ if (!(this instanceof Range)) {
36306
+ return new Range(range, options);
36307
+ }
36308
+ this.options = options;
36309
+ this.loose = !!options.loose;
36310
+ this.includePrerelease = !!options.includePrerelease;
36657
36311
 
36658
- return null
36659
- }
36312
+ // First, split based on boolean or ||
36313
+ this.raw = range;
36314
+ this.set = range.split(/\s*\|\|\s*/).map(function (range) {
36315
+ return this.parseRange(range.trim());
36316
+ }, this).filter(function (c) {
36317
+ // throw out any that are not relevant for whatever reason
36318
+ return c.length;
36319
+ });
36320
+ if (!this.set.length) {
36321
+ throw new TypeError('Invalid SemVer Range: ' + range);
36322
+ }
36323
+ this.format();
36324
+ }
36325
+ Range.prototype.format = function () {
36326
+ this.range = this.set.map(function (comps) {
36327
+ return comps.join(' ').trim();
36328
+ }).join('||').trim();
36329
+ return this.range;
36330
+ };
36331
+ Range.prototype.toString = function () {
36332
+ return this.range;
36333
+ };
36334
+ Range.prototype.parseRange = function (range) {
36335
+ var loose = this.options.loose;
36336
+ range = range.trim();
36337
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
36338
+ var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
36339
+ range = range.replace(hr, hyphenReplace);
36340
+ debug('hyphen replace', range);
36341
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
36342
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
36343
+ debug('comparator trim', range, re[t.COMPARATORTRIM]);
36344
+
36345
+ // `~ 1.2.3` => `~1.2.3`
36346
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
36347
+
36348
+ // `^ 1.2.3` => `^1.2.3`
36349
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
36350
+
36351
+ // normalize spaces
36352
+ range = range.split(/\s+/).join(' ');
36353
+
36354
+ // At this point, the range is completely trimmed and
36355
+ // ready to be split into comparators.
36356
+
36357
+ var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36358
+ var set = range.split(' ').map(function (comp) {
36359
+ return parseComparator(comp, this.options);
36360
+ }, this).join(' ').split(/\s+/);
36361
+ if (this.options.loose) {
36362
+ // in loose mode, throw out any that are not valid comparators
36363
+ set = set.filter(function (comp) {
36364
+ return !!comp.match(compRe);
36365
+ });
36366
+ }
36367
+ set = set.map(function (comp) {
36368
+ return new Comparator(comp, this.options);
36369
+ }, this);
36370
+ return set;
36371
+ };
36372
+ Range.prototype.intersects = function (range, options) {
36373
+ if (!(range instanceof Range)) {
36374
+ throw new TypeError('a Range is required');
36375
+ }
36376
+ return this.set.some(function (thisComparators) {
36377
+ return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) {
36378
+ return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) {
36379
+ return rangeComparators.every(function (rangeComparator) {
36380
+ return thisComparator.intersects(rangeComparator, options);
36381
+ });
36382
+ });
36383
+ });
36384
+ });
36385
+ };
36660
36386
 
36661
- exports.validRange = validRange;
36662
- function validRange (range, options) {
36663
- try {
36664
- // Return '*' instead of '' so that truthiness works.
36665
- // This will throw if it's invalid anyway
36666
- return new Range(range, options).range || '*'
36667
- } catch (er) {
36668
- return null
36669
- }
36670
- }
36387
+ // take a set of comparators and determine whether there
36388
+ // exists a version which can satisfy it
36389
+ function isSatisfiable(comparators, options) {
36390
+ var result = true;
36391
+ var remainingComparators = comparators.slice();
36392
+ var testComparator = remainingComparators.pop();
36393
+ while (result && remainingComparators.length) {
36394
+ result = remainingComparators.every(function (otherComparator) {
36395
+ return testComparator.intersects(otherComparator, options);
36396
+ });
36397
+ testComparator = remainingComparators.pop();
36398
+ }
36399
+ return result;
36400
+ }
36671
36401
 
36672
- // Determine if version is less than all the versions possible in the range
36673
- exports.ltr = ltr;
36674
- function ltr (version, range, options) {
36675
- return outside(version, range, '<', options)
36676
- }
36402
+ // Mostly just for testing and legacy API reasons
36403
+ exports.toComparators = toComparators;
36404
+ function toComparators(range, options) {
36405
+ return new Range(range, options).set.map(function (comp) {
36406
+ return comp.map(function (c) {
36407
+ return c.value;
36408
+ }).join(' ').trim().split(' ');
36409
+ });
36410
+ }
36677
36411
 
36678
- // Determine if version is greater than all the versions possible in the range.
36679
- exports.gtr = gtr;
36680
- function gtr (version, range, options) {
36681
- return outside(version, range, '>', options)
36682
- }
36412
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
36413
+ // already replaced the hyphen ranges
36414
+ // turn into a set of JUST comparators.
36415
+ function parseComparator(comp, options) {
36416
+ debug('comp', comp, options);
36417
+ comp = replaceCarets(comp, options);
36418
+ debug('caret', comp);
36419
+ comp = replaceTildes(comp, options);
36420
+ debug('tildes', comp);
36421
+ comp = replaceXRanges(comp, options);
36422
+ debug('xrange', comp);
36423
+ comp = replaceStars(comp, options);
36424
+ debug('stars', comp);
36425
+ return comp;
36426
+ }
36427
+ function isX(id) {
36428
+ return !id || id.toLowerCase() === 'x' || id === '*';
36429
+ }
36430
+
36431
+ // ~, ~> --> * (any, kinda silly)
36432
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
36433
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
36434
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
36435
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
36436
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
36437
+ function replaceTildes(comp, options) {
36438
+ return comp.trim().split(/\s+/).map(function (comp) {
36439
+ return replaceTilde(comp, options);
36440
+ }).join(' ');
36441
+ }
36442
+ function replaceTilde(comp, options) {
36443
+ var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
36444
+ return comp.replace(r, function (_, M, m, p, pr) {
36445
+ debug('tilde', comp, _, M, m, p, pr);
36446
+ var ret;
36447
+ if (isX(M)) {
36448
+ ret = '';
36449
+ } else if (isX(m)) {
36450
+ ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36451
+ } else if (isX(p)) {
36452
+ // ~1.2 == >=1.2.0 <1.3.0
36453
+ ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36454
+ } else if (pr) {
36455
+ debug('replaceTilde pr', pr);
36456
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
36457
+ } else {
36458
+ // ~1.2.3 == >=1.2.3 <1.3.0
36459
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
36460
+ }
36461
+ debug('tilde return', ret);
36462
+ return ret;
36463
+ });
36464
+ }
36683
36465
 
36684
- exports.outside = outside;
36685
- function outside (version, range, hilo, options) {
36686
- version = new SemVer(version, options);
36687
- range = new Range(range, options);
36688
-
36689
- var gtfn, ltefn, ltfn, comp, ecomp;
36690
- switch (hilo) {
36691
- case '>':
36692
- gtfn = gt;
36693
- ltefn = lte;
36694
- ltfn = lt;
36695
- comp = '>';
36696
- ecomp = '>=';
36697
- break
36698
- case '<':
36699
- gtfn = lt;
36700
- ltefn = gte;
36701
- ltfn = gt;
36702
- comp = '<';
36703
- ecomp = '<=';
36704
- break
36705
- default:
36706
- throw new TypeError('Must provide a hilo val of "<" or ">"')
36707
- }
36466
+ // ^ --> * (any, kinda silly)
36467
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
36468
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
36469
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
36470
+ // ^1.2.3 --> >=1.2.3 <2.0.0
36471
+ // ^1.2.0 --> >=1.2.0 <2.0.0
36472
+ function replaceCarets(comp, options) {
36473
+ return comp.trim().split(/\s+/).map(function (comp) {
36474
+ return replaceCaret(comp, options);
36475
+ }).join(' ');
36476
+ }
36477
+ function replaceCaret(comp, options) {
36478
+ debug('caret', comp, options);
36479
+ var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
36480
+ return comp.replace(r, function (_, M, m, p, pr) {
36481
+ debug('caret', comp, _, M, m, p, pr);
36482
+ var ret;
36483
+ if (isX(M)) {
36484
+ ret = '';
36485
+ } else if (isX(m)) {
36486
+ ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36487
+ } else if (isX(p)) {
36488
+ if (M === '0') {
36489
+ ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36490
+ } else {
36491
+ ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
36492
+ }
36493
+ } else if (pr) {
36494
+ debug('replaceCaret pr', pr);
36495
+ if (M === '0') {
36496
+ if (m === '0') {
36497
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
36498
+ } else {
36499
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
36500
+ }
36501
+ } else {
36502
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
36503
+ }
36504
+ } else {
36505
+ debug('no pr');
36506
+ if (M === '0') {
36507
+ if (m === '0') {
36508
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
36509
+ } else {
36510
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
36511
+ }
36512
+ } else {
36513
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
36514
+ }
36515
+ }
36516
+ debug('caret return', ret);
36517
+ return ret;
36518
+ });
36519
+ }
36520
+ function replaceXRanges(comp, options) {
36521
+ debug('replaceXRanges', comp, options);
36522
+ return comp.split(/\s+/).map(function (comp) {
36523
+ return replaceXRange(comp, options);
36524
+ }).join(' ');
36525
+ }
36526
+ function replaceXRange(comp, options) {
36527
+ comp = comp.trim();
36528
+ var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
36529
+ return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
36530
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
36531
+ var xM = isX(M);
36532
+ var xm = xM || isX(m);
36533
+ var xp = xm || isX(p);
36534
+ var anyX = xp;
36535
+ if (gtlt === '=' && anyX) {
36536
+ gtlt = '';
36537
+ }
36538
+
36539
+ // if we're including prereleases in the match, then we need
36540
+ // to fix this to -0, the lowest possible prerelease value
36541
+ pr = options.includePrerelease ? '-0' : '';
36542
+ if (xM) {
36543
+ if (gtlt === '>' || gtlt === '<') {
36544
+ // nothing is allowed
36545
+ ret = '<0.0.0-0';
36546
+ } else {
36547
+ // nothing is forbidden
36548
+ ret = '*';
36549
+ }
36550
+ } else if (gtlt && anyX) {
36551
+ // we know patch is an x, because we have any x at all.
36552
+ // replace X with 0
36553
+ if (xm) {
36554
+ m = 0;
36555
+ }
36556
+ p = 0;
36557
+ if (gtlt === '>') {
36558
+ // >1 => >=2.0.0
36559
+ // >1.2 => >=1.3.0
36560
+ // >1.2.3 => >= 1.2.4
36561
+ gtlt = '>=';
36562
+ if (xm) {
36563
+ M = +M + 1;
36564
+ m = 0;
36565
+ p = 0;
36566
+ } else {
36567
+ m = +m + 1;
36568
+ p = 0;
36569
+ }
36570
+ } else if (gtlt === '<=') {
36571
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
36572
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
36573
+ gtlt = '<';
36574
+ if (xm) {
36575
+ M = +M + 1;
36576
+ } else {
36577
+ m = +m + 1;
36578
+ }
36579
+ }
36580
+ ret = gtlt + M + '.' + m + '.' + p + pr;
36581
+ } else if (xm) {
36582
+ ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
36583
+ } else if (xp) {
36584
+ ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr;
36585
+ }
36586
+ debug('xRange return', ret);
36587
+ return ret;
36588
+ });
36589
+ }
36708
36590
 
36709
- // If it satisifes the range it is not outside
36710
- if (satisfies(version, range, options)) {
36711
- return false
36712
- }
36591
+ // Because * is AND-ed with everything else in the comparator,
36592
+ // and '' means "any version", just remove the *s entirely.
36593
+ function replaceStars(comp, options) {
36594
+ debug('replaceStars', comp, options);
36595
+ // Looseness is ignored here. star is always as loose as it gets!
36596
+ return comp.trim().replace(re[t.STAR], '');
36597
+ }
36598
+
36599
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
36600
+ // M, m, patch, prerelease, build
36601
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
36602
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
36603
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0
36604
+ function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
36605
+ if (isX(fM)) {
36606
+ from = '';
36607
+ } else if (isX(fm)) {
36608
+ from = '>=' + fM + '.0.0';
36609
+ } else if (isX(fp)) {
36610
+ from = '>=' + fM + '.' + fm + '.0';
36611
+ } else {
36612
+ from = '>=' + from;
36613
+ }
36614
+ if (isX(tM)) {
36615
+ to = '';
36616
+ } else if (isX(tm)) {
36617
+ to = '<' + (+tM + 1) + '.0.0';
36618
+ } else if (isX(tp)) {
36619
+ to = '<' + tM + '.' + (+tm + 1) + '.0';
36620
+ } else if (tpr) {
36621
+ to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
36622
+ } else {
36623
+ to = '<=' + to;
36624
+ }
36625
+ return (from + ' ' + to).trim();
36626
+ }
36713
36627
 
36714
- // From now on, variable terms are as if we're in "gtr" mode.
36715
- // but note that everything is flipped for the "ltr" function.
36716
-
36717
- for (var i = 0; i < range.set.length; ++i) {
36718
- var comparators = range.set[i];
36719
-
36720
- var high = null;
36721
- var low = null;
36722
-
36723
- comparators.forEach(function (comparator) {
36724
- if (comparator.semver === ANY) {
36725
- comparator = new Comparator('>=0.0.0');
36726
- }
36727
- high = high || comparator;
36728
- low = low || comparator;
36729
- if (gtfn(comparator.semver, high.semver, options)) {
36730
- high = comparator;
36731
- } else if (ltfn(comparator.semver, low.semver, options)) {
36732
- low = comparator;
36733
- }
36734
- });
36735
-
36736
- // If the edge version comparator has a operator then our version
36737
- // isn't outside it
36738
- if (high.operator === comp || high.operator === ecomp) {
36739
- return false
36740
- }
36741
-
36742
- // If the lowest version comparator has an operator and our version
36743
- // is less than it then it isn't higher than the range
36744
- if ((!low.operator || low.operator === comp) &&
36745
- ltefn(version, low.semver)) {
36746
- return false
36747
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
36748
- return false
36749
- }
36750
- }
36751
- return true
36752
- }
36628
+ // if ANY of the sets match ALL of its comparators, then pass
36629
+ Range.prototype.test = function (version) {
36630
+ if (!version) {
36631
+ return false;
36632
+ }
36633
+ if (typeof version === 'string') {
36634
+ try {
36635
+ version = new SemVer(version, this.options);
36636
+ } catch (er) {
36637
+ return false;
36638
+ }
36639
+ }
36640
+ for (var i = 0; i < this.set.length; i++) {
36641
+ if (testSet(this.set[i], version, this.options)) {
36642
+ return true;
36643
+ }
36644
+ }
36645
+ return false;
36646
+ };
36647
+ function testSet(set, version, options) {
36648
+ for (var i = 0; i < set.length; i++) {
36649
+ if (!set[i].test(version)) {
36650
+ return false;
36651
+ }
36652
+ }
36653
+ if (version.prerelease.length && !options.includePrerelease) {
36654
+ // Find the set of versions that are allowed to have prereleases
36655
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
36656
+ // That should allow `1.2.3-pr.2` to pass.
36657
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
36658
+ // even though it's within the range set by the comparators.
36659
+ for (i = 0; i < set.length; i++) {
36660
+ debug(set[i].semver);
36661
+ if (set[i].semver === ANY) {
36662
+ continue;
36663
+ }
36664
+ if (set[i].semver.prerelease.length > 0) {
36665
+ var allowed = set[i].semver;
36666
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
36667
+ return true;
36668
+ }
36669
+ }
36670
+ }
36753
36671
 
36754
- exports.prerelease = prerelease;
36755
- function prerelease (version, options) {
36756
- var parsed = parse(version, options);
36757
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
36758
- }
36672
+ // Version has a -pre, but it's not one of the ones we like.
36673
+ return false;
36674
+ }
36675
+ return true;
36676
+ }
36677
+ exports.satisfies = satisfies;
36678
+ function satisfies(version, range, options) {
36679
+ try {
36680
+ range = new Range(range, options);
36681
+ } catch (er) {
36682
+ return false;
36683
+ }
36684
+ return range.test(version);
36685
+ }
36686
+ exports.maxSatisfying = maxSatisfying;
36687
+ function maxSatisfying(versions, range, options) {
36688
+ var max = null;
36689
+ var maxSV = null;
36690
+ try {
36691
+ var rangeObj = new Range(range, options);
36692
+ } catch (er) {
36693
+ return null;
36694
+ }
36695
+ versions.forEach(function (v) {
36696
+ if (rangeObj.test(v)) {
36697
+ // satisfies(v, range, options)
36698
+ if (!max || maxSV.compare(v) === -1) {
36699
+ // compare(max, v, true)
36700
+ max = v;
36701
+ maxSV = new SemVer(max, options);
36702
+ }
36703
+ }
36704
+ });
36705
+ return max;
36706
+ }
36707
+ exports.minSatisfying = minSatisfying;
36708
+ function minSatisfying(versions, range, options) {
36709
+ var min = null;
36710
+ var minSV = null;
36711
+ try {
36712
+ var rangeObj = new Range(range, options);
36713
+ } catch (er) {
36714
+ return null;
36715
+ }
36716
+ versions.forEach(function (v) {
36717
+ if (rangeObj.test(v)) {
36718
+ // satisfies(v, range, options)
36719
+ if (!min || minSV.compare(v) === 1) {
36720
+ // compare(min, v, true)
36721
+ min = v;
36722
+ minSV = new SemVer(min, options);
36723
+ }
36724
+ }
36725
+ });
36726
+ return min;
36727
+ }
36728
+ exports.minVersion = minVersion;
36729
+ function minVersion(range, loose) {
36730
+ range = new Range(range, loose);
36731
+ var minver = new SemVer('0.0.0');
36732
+ if (range.test(minver)) {
36733
+ return minver;
36734
+ }
36735
+ minver = new SemVer('0.0.0-0');
36736
+ if (range.test(minver)) {
36737
+ return minver;
36738
+ }
36739
+ minver = null;
36740
+ for (var i = 0; i < range.set.length; ++i) {
36741
+ var comparators = range.set[i];
36742
+ comparators.forEach(function (comparator) {
36743
+ // Clone to avoid manipulating the comparator's semver object.
36744
+ var compver = new SemVer(comparator.semver.version);
36745
+ switch (comparator.operator) {
36746
+ case '>':
36747
+ if (compver.prerelease.length === 0) {
36748
+ compver.patch++;
36749
+ } else {
36750
+ compver.prerelease.push(0);
36751
+ }
36752
+ compver.raw = compver.format();
36753
+ /* fallthrough */
36754
+ case '':
36755
+ case '>=':
36756
+ if (!minver || gt(minver, compver)) {
36757
+ minver = compver;
36758
+ }
36759
+ break;
36760
+ case '<':
36761
+ case '<=':
36762
+ /* Ignore maximum versions */
36763
+ break;
36764
+ /* istanbul ignore next */
36765
+ default:
36766
+ throw new Error('Unexpected operation: ' + comparator.operator);
36767
+ }
36768
+ });
36769
+ }
36770
+ if (minver && range.test(minver)) {
36771
+ return minver;
36772
+ }
36773
+ return null;
36774
+ }
36775
+ exports.validRange = validRange;
36776
+ function validRange(range, options) {
36777
+ try {
36778
+ // Return '*' instead of '' so that truthiness works.
36779
+ // This will throw if it's invalid anyway
36780
+ return new Range(range, options).range || '*';
36781
+ } catch (er) {
36782
+ return null;
36783
+ }
36784
+ }
36759
36785
 
36760
- exports.intersects = intersects;
36761
- function intersects (r1, r2, options) {
36762
- r1 = new Range(r1, options);
36763
- r2 = new Range(r2, options);
36764
- return r1.intersects(r2)
36765
- }
36786
+ // Determine if version is less than all the versions possible in the range
36787
+ exports.ltr = ltr;
36788
+ function ltr(version, range, options) {
36789
+ return outside(version, range, '<', options);
36790
+ }
36766
36791
 
36767
- exports.coerce = coerce;
36768
- function coerce (version, options) {
36769
- if (version instanceof SemVer) {
36770
- return version
36771
- }
36792
+ // Determine if version is greater than all the versions possible in the range.
36793
+ exports.gtr = gtr;
36794
+ function gtr(version, range, options) {
36795
+ return outside(version, range, '>', options);
36796
+ }
36797
+ exports.outside = outside;
36798
+ function outside(version, range, hilo, options) {
36799
+ version = new SemVer(version, options);
36800
+ range = new Range(range, options);
36801
+ var gtfn, ltefn, ltfn, comp, ecomp;
36802
+ switch (hilo) {
36803
+ case '>':
36804
+ gtfn = gt;
36805
+ ltefn = lte;
36806
+ ltfn = lt;
36807
+ comp = '>';
36808
+ ecomp = '>=';
36809
+ break;
36810
+ case '<':
36811
+ gtfn = lt;
36812
+ ltefn = gte;
36813
+ ltfn = gt;
36814
+ comp = '<';
36815
+ ecomp = '<=';
36816
+ break;
36817
+ default:
36818
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
36819
+ }
36772
36820
 
36773
- if (typeof version === 'number') {
36774
- version = String(version);
36775
- }
36821
+ // If it satisifes the range it is not outside
36822
+ if (satisfies(version, range, options)) {
36823
+ return false;
36824
+ }
36776
36825
 
36777
- if (typeof version !== 'string') {
36778
- return null
36779
- }
36826
+ // From now on, variable terms are as if we're in "gtr" mode.
36827
+ // but note that everything is flipped for the "ltr" function.
36780
36828
 
36781
- options = options || {};
36782
-
36783
- var match = null;
36784
- if (!options.rtl) {
36785
- match = version.match(re[t.COERCE]);
36786
- } else {
36787
- // Find the right-most coercible string that does not share
36788
- // a terminus with a more left-ward coercible string.
36789
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
36790
- //
36791
- // Walk through the string checking with a /g regexp
36792
- // Manually set the index so as to pick up overlapping matches.
36793
- // Stop when we get a match that ends at the string end, since no
36794
- // coercible string can be more right-ward without the same terminus.
36795
- var next;
36796
- while ((next = re[t.COERCERTL].exec(version)) &&
36797
- (!match || match.index + match[0].length !== version.length)
36798
- ) {
36799
- if (!match ||
36800
- next.index + next[0].length !== match.index + match[0].length) {
36801
- match = next;
36802
- }
36803
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
36804
- }
36805
- // leave it in a clean state
36806
- re[t.COERCERTL].lastIndex = -1;
36807
- }
36829
+ for (var i = 0; i < range.set.length; ++i) {
36830
+ var comparators = range.set[i];
36831
+ var high = null;
36832
+ var low = null;
36833
+ comparators.forEach(function (comparator) {
36834
+ if (comparator.semver === ANY) {
36835
+ comparator = new Comparator('>=0.0.0');
36836
+ }
36837
+ high = high || comparator;
36838
+ low = low || comparator;
36839
+ if (gtfn(comparator.semver, high.semver, options)) {
36840
+ high = comparator;
36841
+ } else if (ltfn(comparator.semver, low.semver, options)) {
36842
+ low = comparator;
36843
+ }
36844
+ });
36808
36845
 
36809
- if (match === null) {
36810
- return null
36811
- }
36846
+ // If the edge version comparator has a operator then our version
36847
+ // isn't outside it
36848
+ if (high.operator === comp || high.operator === ecomp) {
36849
+ return false;
36850
+ }
36812
36851
 
36813
- return parse(match[2] +
36814
- '.' + (match[3] || '0') +
36815
- '.' + (match[4] || '0'), options)
36816
- }
36817
- } (semver, semverExports));
36852
+ // If the lowest version comparator has an operator and our version
36853
+ // is less than it then it isn't higher than the range
36854
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
36855
+ return false;
36856
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
36857
+ return false;
36858
+ }
36859
+ }
36860
+ return true;
36861
+ }
36862
+ exports.prerelease = prerelease;
36863
+ function prerelease(version, options) {
36864
+ var parsed = parse(version, options);
36865
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
36866
+ }
36867
+ exports.intersects = intersects;
36868
+ function intersects(r1, r2, options) {
36869
+ r1 = new Range(r1, options);
36870
+ r2 = new Range(r2, options);
36871
+ return r1.intersects(r2);
36872
+ }
36873
+ exports.coerce = coerce;
36874
+ function coerce(version, options) {
36875
+ if (version instanceof SemVer) {
36876
+ return version;
36877
+ }
36878
+ if (typeof version === 'number') {
36879
+ version = String(version);
36880
+ }
36881
+ if (typeof version !== 'string') {
36882
+ return null;
36883
+ }
36884
+ options = options || {};
36885
+ var match = null;
36886
+ if (!options.rtl) {
36887
+ match = version.match(re[t.COERCE]);
36888
+ } else {
36889
+ // Find the right-most coercible string that does not share
36890
+ // a terminus with a more left-ward coercible string.
36891
+ // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
36892
+ //
36893
+ // Walk through the string checking with a /g regexp
36894
+ // Manually set the index so as to pick up overlapping matches.
36895
+ // Stop when we get a match that ends at the string end, since no
36896
+ // coercible string can be more right-ward without the same terminus.
36897
+ var next;
36898
+ while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
36899
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
36900
+ match = next;
36901
+ }
36902
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
36903
+ }
36904
+ // leave it in a clean state
36905
+ re[t.COERCERTL].lastIndex = -1;
36906
+ }
36907
+ if (match === null) {
36908
+ return null;
36909
+ }
36910
+ return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options);
36911
+ }
36912
+ })(semver, semverExports);
36818
36913
 
36819
36914
  const LOADED = {};
36820
36915
 
@@ -37238,8 +37333,9 @@
37238
37333
  const api = /** @lends Embed# */{
37239
37334
  /**
37240
37335
  * Renders a visualization or sheet into an HTMLElement.
37336
+ * Visualizations can either be existing objects or created on the fly.
37241
37337
  * Support for sense sheets is experimental.
37242
- * @param {CreateConfig | GetConfig} cfg - The render configuration.
37338
+ * @param {RenderConfig} cfg The render configuration.
37243
37339
  * @returns {Promise<Viz|Sheet>} A controller to the rendered visualization or sheet.
37244
37340
  * @example
37245
37341
  * // render from existing object
@@ -37262,6 +37358,37 @@
37262
37358
  }
37263
37359
  return createSessionObject(cfg, halo);
37264
37360
  },
37361
+ /**
37362
+ * Creates a visualization model
37363
+ * @param {CreateConfig} cfg The create configuration.
37364
+ * @experimental
37365
+ * @returns {Promise<EngineAPI.IGenericObject>} An engima model
37366
+ * @example
37367
+ * // create a barchart in the app and return the model
37368
+ * const model = await n.create({
37369
+ * type: 'barchart',
37370
+ * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
37371
+ * properties: { showTitle: true }
37372
+ * }
37373
+ * );
37374
+ */
37375
+ create: async cfg => createObject(cfg, halo, false),
37376
+ /**
37377
+ * Generates properties for a visualization object
37378
+ * @param {CreateConfig} cfg The create configuration.
37379
+ * @experimental
37380
+ * @returns {Promise<object>} The objects properties
37381
+ * @example
37382
+ * // generate properties for a barchart
37383
+ * const properties = await n.create({
37384
+ * type: 'barchart',
37385
+ * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
37386
+ * properties: { showTitle: true }
37387
+ * },
37388
+ * true
37389
+ * );
37390
+ */
37391
+ generateProperties: async cfg => createObject(cfg, halo, true),
37265
37392
  /**
37266
37393
  * Updates the current context of this embed instance.
37267
37394
  * Use this when you want to change some part of the current context, like theme.