@esri/solutions-components 0.6.13 → 0.6.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/dist/assets/t9n/layer-table/resources.json +1 -1
  2. package/dist/assets/t9n/layer-table/resources_en.json +1 -1
  3. package/dist/assets/t9n/map-layer-picker/resources.json +4 -0
  4. package/dist/assets/t9n/map-layer-picker/resources_en.json +4 -0
  5. package/dist/cjs/basemap-gallery_6.cjs.entry.js +20 -5
  6. package/dist/cjs/buffer-tools_4.cjs.entry.js +1 -1
  7. package/dist/cjs/calcite-chip_3.cjs.entry.js +803 -0
  8. package/dist/cjs/calcite-combobox_6.cjs.entry.js +76 -28
  9. package/dist/cjs/card-manager_3.cjs.entry.js +112 -54
  10. package/dist/cjs/crowdsource-manager.cjs.entry.js +18 -5
  11. package/dist/cjs/{downloadUtils-fb4744e0.js → downloadUtils-34a515ad.js} +2 -2
  12. package/dist/cjs/edit-card_2.cjs.entry.js +29 -18
  13. package/dist/cjs/{index.es-372e33de.js → index.es-0ba11065.js} +2 -2
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  16. package/dist/cjs/{mapViewUtils-a4dd36ec.js → mapViewUtils-a2884698.js} +39 -55
  17. package/dist/cjs/public-notification.cjs.entry.js +3 -3
  18. package/dist/cjs/{publicNotificationStore-b69862af.js → publicNotificationStore-610bd880.js} +0 -4
  19. package/dist/cjs/solutions-components.cjs.js +1 -1
  20. package/dist/collection/components/basemap-gallery/basemap-gallery.js +23 -1
  21. package/dist/collection/components/card-manager/card-manager.js +2 -2
  22. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +171 -5
  23. package/dist/collection/components/edit-card/edit-card.js +44 -21
  24. package/dist/collection/components/layer-table/layer-table.js +127 -47
  25. package/dist/collection/components/map-card/map-card.js +115 -5
  26. package/dist/collection/components/map-layer-picker/map-layer-picker.css +6 -0
  27. package/dist/collection/components/map-layer-picker/map-layer-picker.js +107 -27
  28. package/dist/collection/components/map-picker/map-picker.css +5 -1
  29. package/dist/collection/components/map-picker/map-picker.js +3 -3
  30. package/dist/collection/components/map-tools/map-tools.js +104 -1
  31. package/dist/collection/demos/crowdsource-manager.html +2 -2
  32. package/dist/collection/demos/new-public-notification.html +3 -3
  33. package/dist/collection/utils/interfaces.ts +12 -1
  34. package/dist/collection/utils/mapViewUtils.js +38 -52
  35. package/dist/collection/utils/mapViewUtils.ts +41 -57
  36. package/dist/collection/utils/publicNotificationStore.js +0 -4
  37. package/dist/collection/utils/publicNotificationStore.ts +0 -4
  38. package/dist/components/basemap-gallery2.js +2 -0
  39. package/dist/components/card-manager2.js +2 -2
  40. package/dist/components/crowdsource-manager.js +27 -6
  41. package/dist/components/edit-card2.js +29 -18
  42. package/dist/components/layer-table2.js +136 -78
  43. package/dist/components/map-card2.js +17 -5
  44. package/dist/components/map-layer-picker2.js +114 -52
  45. package/dist/components/map-picker2.js +4 -4
  46. package/dist/components/map-select-tools2.js +55 -43
  47. package/dist/components/map-tools2.js +20 -1
  48. package/dist/components/mapViewUtils.js +39 -53
  49. package/dist/components/public-notification.js +1 -1
  50. package/dist/components/publicNotificationStore.js +0 -4
  51. package/dist/components/refine-selection2.js +61 -49
  52. package/dist/esm/basemap-gallery_6.entry.js +20 -5
  53. package/dist/esm/buffer-tools_4.entry.js +1 -1
  54. package/dist/esm/calcite-chip_3.entry.js +797 -0
  55. package/dist/esm/calcite-combobox_6.entry.js +76 -28
  56. package/dist/esm/card-manager_3.entry.js +112 -54
  57. package/dist/esm/crowdsource-manager.entry.js +18 -5
  58. package/dist/esm/{downloadUtils-67c7a6c8.js → downloadUtils-ac67a786.js} +2 -2
  59. package/dist/esm/edit-card_2.entry.js +29 -18
  60. package/dist/esm/{index.es-59a67d3d.js → index.es-f553598f.js} +2 -2
  61. package/dist/esm/loader.js +1 -1
  62. package/dist/esm/map-select-tools_3.entry.js +3 -3
  63. package/dist/esm/{mapViewUtils-00a04d52.js → mapViewUtils-8141d8c1.js} +39 -53
  64. package/dist/esm/polyfills/core-js.js +11 -0
  65. package/dist/esm/polyfills/dom.js +79 -0
  66. package/dist/esm/polyfills/es5-html-element.js +1 -0
  67. package/dist/esm/polyfills/index.js +34 -0
  68. package/dist/esm/polyfills/system.js +6 -0
  69. package/dist/esm/public-notification.entry.js +3 -3
  70. package/dist/esm/{publicNotificationStore-90a6a274.js → publicNotificationStore-dcf39a55.js} +0 -4
  71. package/dist/esm/solutions-components.js +1 -1
  72. package/dist/solutions-components/demos/crowdsource-manager.html +2 -2
  73. package/dist/solutions-components/demos/new-public-notification.html +3 -3
  74. package/dist/solutions-components/p-08b52ed8.entry.js +6 -0
  75. package/dist/solutions-components/p-16362eb4.js +36 -0
  76. package/dist/solutions-components/{p-3691a072.js → p-1ab414e0.js} +2 -2
  77. package/dist/solutions-components/{p-73ab9d9a.entry.js → p-3d7aa1b2.entry.js} +1 -1
  78. package/dist/solutions-components/{p-9a8c51bf.entry.js → p-57cf6784.entry.js} +1 -1
  79. package/dist/solutions-components/p-64b22d57.entry.js +6 -0
  80. package/dist/solutions-components/p-654dd5df.entry.js +6 -0
  81. package/dist/solutions-components/{p-0219a1a9.entry.js → p-83a52f9e.entry.js} +6 -6
  82. package/dist/solutions-components/{p-f9166fcb.js → p-a26711e8.js} +1 -1
  83. package/dist/solutions-components/{p-b892e595.entry.js → p-b9d29f30.entry.js} +1 -1
  84. package/dist/solutions-components/{p-1b41181b.js → p-c8d0ce92.js} +2 -2
  85. package/dist/solutions-components/p-ee7e2f00.entry.js +34 -0
  86. package/dist/solutions-components/p-ef6ec812.entry.js +6 -0
  87. package/dist/solutions-components/solutions-components.esm.js +1 -1
  88. package/dist/solutions-components/utils/interfaces.ts +12 -1
  89. package/dist/solutions-components/utils/mapViewUtils.ts +41 -57
  90. package/dist/solutions-components/utils/publicNotificationStore.ts +0 -4
  91. package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +5 -0
  92. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +37 -1
  93. package/dist/types/components/edit-card/edit-card.d.ts +10 -9
  94. package/dist/types/components/layer-table/layer-table.d.ts +40 -0
  95. package/dist/types/components/map-card/map-card.d.ts +25 -1
  96. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +50 -3
  97. package/dist/types/components/map-picker/map-picker.d.ts +2 -2
  98. package/dist/types/components/map-tools/map-tools.d.ts +21 -1
  99. package/dist/types/components.d.ts +182 -2
  100. package/dist/types/preact.d.ts +6 -3
  101. package/dist/types/utils/interfaces.d.ts +10 -1
  102. package/dist/types/utils/mapViewUtils.d.ts +8 -24
  103. package/dist/types/utils/publicNotificationStore.d.ts +0 -2
  104. package/package.json +1 -1
  105. package/dist/cjs/calcite-chip.cjs.entry.js +0 -259
  106. package/dist/cjs/calcite-notice.cjs.entry.js +0 -139
  107. package/dist/cjs/calcite-tooltip.cjs.entry.js +0 -439
  108. package/dist/esm/calcite-chip.entry.js +0 -255
  109. package/dist/esm/calcite-notice.entry.js +0 -135
  110. package/dist/esm/calcite-tooltip.entry.js +0 -435
  111. package/dist/solutions-components/p-2cff8331.entry.js +0 -6
  112. package/dist/solutions-components/p-3a6c8fc3.entry.js +0 -6
  113. package/dist/solutions-components/p-3b1fc7a2.entry.js +0 -6
  114. package/dist/solutions-components/p-767002cd.js +0 -36
  115. package/dist/solutions-components/p-a776b7e6.entry.js +0 -6
  116. package/dist/solutions-components/p-be36d5ed.entry.js +0 -22
  117. package/dist/solutions-components/p-c644edf5.entry.js +0 -11
  118. package/dist/solutions-components/p-cfd88a2f.entry.js +0 -11
@@ -24,9 +24,11 @@ const utils = require('./utils-852fe124.js');
24
24
  const debounce = require('./debounce-30afab47.js');
25
25
  const conditionalSlot = require('./conditionalSlot-f10611d3.js');
26
26
  const key = require('./key-8de93212.js');
27
- const mapViewUtils = require('./mapViewUtils-a4dd36ec.js');
28
- const publicNotificationStore = require('./publicNotificationStore-b69862af.js');
27
+ const locale$1 = require('./locale-67f5f6b6.js');
28
+ const mapViewUtils = require('./mapViewUtils-a2884698.js');
29
+ const publicNotificationStore = require('./publicNotificationStore-610bd880.js');
29
30
  require('./resources-993f6faf.js');
31
+ require('./_commonjsHelpers-384729db.js');
30
32
  require('./interfaces-000be6de.js');
31
33
  require('./index-feeb7b6a.js');
32
34
 
@@ -1679,23 +1681,27 @@ const DropdownItem = class {
1679
1681
  };
1680
1682
  DropdownItem.style = dropdownItemCss;
1681
1683
 
1682
- const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}";
1684
+ const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%;height:100%}.map-layer-picker{position:relative;width:100%;display:inline-block;height:100%}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}";
1683
1685
 
1684
1686
  const MapLayerPicker = class {
1685
1687
  constructor(hostRef) {
1686
1688
  index.registerInstance(this, hostRef);
1689
+ this.noLayersFound = index.createEvent(this, "noLayersFound", 7);
1687
1690
  this.layerSelectionChange = index.createEvent(this, "layerSelectionChange", 7);
1688
1691
  this.appearance = "transparent";
1689
1692
  this.enabledLayerIds = [];
1690
1693
  this.enabledTableIds = [];
1691
1694
  this.mapView = undefined;
1695
+ this.onlyShowUpdatableLayers = undefined;
1692
1696
  this.placeholderIcon = "";
1693
1697
  this.selectedIds = [];
1694
1698
  this.scale = "m";
1695
1699
  this.showTables = true;
1696
1700
  this.type = "select";
1701
+ this._hasValidLayers = true;
1697
1702
  this.ids = [];
1698
1703
  this.selectedName = "";
1704
+ this._translations = undefined;
1699
1705
  }
1700
1706
  //--------------------------------------------------------------------------
1701
1707
  //
@@ -1708,10 +1714,13 @@ const MapLayerPicker = class {
1708
1714
  */
1709
1715
  async mapViewWatchHandler() {
1710
1716
  await this._setLayers();
1711
- const hasLayers = Object.keys(publicNotificationStore.state.layerNameHash).length > 0;
1712
- const hasTables = Object.keys(publicNotificationStore.state.tableNameHash).length > 0 && this.showTables;
1713
- if (hasLayers || hasTables) {
1714
- this._setSelectedLayer(this.ids[0], hasLayers ? "layer" : "table");
1717
+ if (this.ids.length > 0) {
1718
+ this._hasValidLayers = true;
1719
+ this._setSelectedLayer(this.ids[0]);
1720
+ }
1721
+ else {
1722
+ this._hasValidLayers = false;
1723
+ this.noLayersFound.emit();
1715
1724
  }
1716
1725
  }
1717
1726
  //--------------------------------------------------------------------------
@@ -1723,6 +1732,7 @@ const MapLayerPicker = class {
1723
1732
  * StencilJS: Called once just after the component is first connected to the DOM.
1724
1733
  */
1725
1734
  async componentWillLoad() {
1735
+ await this._getTranslations();
1726
1736
  await this._setLayers();
1727
1737
  if (this.ids.length > 0 || this.selectedIds.length === 1) {
1728
1738
  this.layerSelectionChange.emit(this.selectedIds.length === 1 ? [this.selectedIds[0]] : [this.ids[0]]);
@@ -1732,7 +1742,7 @@ const MapLayerPicker = class {
1732
1742
  * Renders the component.
1733
1743
  */
1734
1744
  render() {
1735
- return (index.h(index.Host, null, index.h("div", { class: "map-layer-picker-container" }, index.h("div", { class: "map-layer-picker" }, this.type === "combobox" ? this._getCombobox() :
1745
+ return (index.h(index.Host, null, index.h("div", { class: "map-layer-picker-container" }, index.h("div", { class: "map-layer-picker" }, !this._hasValidLayers ? this._getInvalidPlaceholder() : this.type === "combobox" ? this._getCombobox() :
1736
1746
  this.type === "select" ? this._getSelect() : this._getDropdown()))));
1737
1747
  }
1738
1748
  /**
@@ -1745,9 +1755,9 @@ const MapLayerPicker = class {
1745
1755
  this._layerElement.value = id;
1746
1756
  }
1747
1757
  else if (this.type === "dropdown") {
1748
- this.selectedName = Object.keys(publicNotificationStore.state.layerNameHash).indexOf(id) > -1 ?
1749
- publicNotificationStore.state.layerNameHash[id] : Object.keys(publicNotificationStore.state.tableNameHash).indexOf(id) > -1 ?
1750
- publicNotificationStore.state.tableNameHash[id] : "";
1758
+ this.selectedName = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1759
+ this._layerNameHash[id].name : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1760
+ this._tableNameHash[id].name : "";
1751
1761
  }
1752
1762
  }
1753
1763
  }
@@ -1756,6 +1766,14 @@ const MapLayerPicker = class {
1756
1766
  // Functions (protected)
1757
1767
  //
1758
1768
  //--------------------------------------------------------------------------
1769
+ /**
1770
+ * Create a notice to inform the user that no layers were found
1771
+ *
1772
+ * @returns Calcite Notice component with the message
1773
+ */
1774
+ _getInvalidPlaceholder() {
1775
+ return (index.h("div", null, index.h("calcite-notice", { class: "height-100", icon: "exclamation-mark-triangle", id: "no-valid-layers", kind: "danger", open: true }, index.h("div", { slot: "message" }, this._translations.noLayersFound)), index.h("calcite-tooltip", { label: this._translations.enableEditUpdate, placement: "bottom", "reference-element": "no-valid-layers" }, index.h("span", null, this._translations.enableEditUpdate))));
1776
+ }
1759
1777
  /**
1760
1778
  * Create a list of layers from the map
1761
1779
  *
@@ -1806,16 +1824,21 @@ const MapLayerPicker = class {
1806
1824
  * @returns A dom node with the name of the layer or table
1807
1825
  */
1808
1826
  _getItem(id, itemType) {
1809
- const name = itemType === "layer" ? publicNotificationStore.state.layerNameHash[id] : publicNotificationStore.state.tableNameHash[id];
1810
- return this.type === "combobox" ? (index.h("calcite-combobox-item", { textLabel: name, value: id })) :
1811
- this.type === "select" ? (index.h("calcite-option", { label: name, value: id })) :
1812
- (index.h("calcite-dropdown-item", { onClick: () => void this._setSelectedLayer(id, itemType) }, name));
1827
+ const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
1828
+ const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
1829
+ const name = item.name;
1830
+ return this.type === "combobox" ? (index.h("calcite-combobox-item", { disabled: disabled, textLabel: name, value: id })) :
1831
+ this.type === "select" ? (index.h("calcite-option", { disabled: disabled, label: name, value: id })) :
1832
+ (index.h("calcite-dropdown-item", { disabled: disabled, onClick: disabled ? undefined : () => void this._setSelectedLayer(id) }, name));
1813
1833
  }
1814
1834
  /**
1815
1835
  * Store the layer name based on the user selection
1816
1836
  */
1817
- _setSelectedLayer(id, type) {
1818
- this.selectedName = type === "layer" ? publicNotificationStore.state.layerNameHash[id] : publicNotificationStore.state.tableNameHash[id];
1837
+ _setSelectedLayer(id) {
1838
+ const item = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1839
+ this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1840
+ this._tableNameHash[id] : undefined;
1841
+ this.selectedName = item === null || item === void 0 ? void 0 : item.name;
1819
1842
  this.selectedIds = [id];
1820
1843
  this.layerSelectionChange.emit(this.selectedIds);
1821
1844
  }
@@ -1826,25 +1849,38 @@ const MapLayerPicker = class {
1826
1849
  */
1827
1850
  async _setLayers() {
1828
1851
  if (this.mapView) {
1829
- const mapLayerIds = await mapViewUtils.getMapLayerIds(this.mapView);
1830
- const mapTableIds = this.showTables ? await mapViewUtils.getMapTableIds(this.mapView) : [];
1852
+ await this._initLayerTableHash();
1853
+ const mapLayerIds = this.onlyShowUpdatableLayers ?
1854
+ this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
1855
+ const mapTableIds = this.showTables ? this.onlyShowUpdatableLayers ?
1856
+ this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
1831
1857
  this.ids = [
1832
1858
  ...mapLayerIds.filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.indexOf(n) > -1 : true; }),
1833
1859
  ...mapTableIds.filter(n => { var _a; return ((_a = this.enabledTableIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledTableIds.indexOf(n) > -1 : true; }),
1834
1860
  ];
1835
- await this._initStateHash();
1836
1861
  }
1837
1862
  }
1863
+ /**
1864
+ * Fetch the ids of all layers that support edits with the update capability
1865
+ *
1866
+ * @returns array of layer ids
1867
+ */
1868
+ _getEditableIds(hash) {
1869
+ return Object.keys(hash).reduce((prev, cur) => {
1870
+ if (hash[cur].supportsUpdate) {
1871
+ prev.push(cur);
1872
+ }
1873
+ return prev;
1874
+ }, []);
1875
+ }
1838
1876
  /**
1839
1877
  * Create a layer id:title hash for layer name display
1840
1878
  *
1841
1879
  * @returns Promise when the operation has completed
1842
1880
  */
1843
- async _initStateHash() {
1844
- if (this.mapView) {
1845
- publicNotificationStore.state.layerNameHash = await mapViewUtils.getMapLayerHash(this.mapView);
1846
- publicNotificationStore.state.tableNameHash = this.showTables ? await mapViewUtils.getMapTableHash(this.mapView) : {};
1847
- }
1881
+ async _initLayerTableHash() {
1882
+ this._layerNameHash = await mapViewUtils.getMapLayerHash(this.mapView, this.onlyShowUpdatableLayers);
1883
+ this._tableNameHash = this.showTables ? await mapViewUtils.getMapTableHash(this.mapView, this.onlyShowUpdatableLayers) : {};
1848
1884
  }
1849
1885
  /**
1850
1886
  * Evaluate if the id exists in the current hash and verify if it should be excluded
@@ -1852,9 +1888,10 @@ const MapLayerPicker = class {
1852
1888
  * @returns boolean when true the layer will be used in the current layer picker type
1853
1889
  */
1854
1890
  _validLayer(id) {
1855
- const name = publicNotificationStore.state.layerNameHash[id];
1891
+ var _a;
1892
+ const name = (_a = this._layerNameHash[id]) === null || _a === void 0 ? void 0 : _a.name;
1856
1893
  return name && publicNotificationStore.state.managedLayers.indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
1857
- this.enabledLayerIds.indexOf(id) > -1 : name);
1894
+ this.enabledLayerIds.indexOf(id) > -1 : true);
1858
1895
  }
1859
1896
  /**
1860
1897
  * Evaluate if the id exists in the current hash and verify if it should be excluded
@@ -1862,7 +1899,8 @@ const MapLayerPicker = class {
1862
1899
  * @returns boolean when true the table will be used in the current layer picker type
1863
1900
  */
1864
1901
  _validTable(id) {
1865
- const name = publicNotificationStore.state.tableNameHash[id];
1902
+ var _a;
1903
+ const name = (_a = this._tableNameHash[id]) === null || _a === void 0 ? void 0 : _a.name;
1866
1904
  const validName = name && this.showTables;
1867
1905
  return validName ? publicNotificationStore.state.managedTables.indexOf(name) < 0 &&
1868
1906
  (this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
@@ -1879,6 +1917,16 @@ const MapLayerPicker = class {
1879
1917
  this.layerSelectionChange.emit(this.selectedIds);
1880
1918
  }
1881
1919
  }
1920
+ /**
1921
+ * Fetches the component's translations
1922
+ *
1923
+ * @returns Promise when complete
1924
+ * @protected
1925
+ */
1926
+ async _getTranslations() {
1927
+ const messages = await locale$1.getLocaleComponentStrings(this.el);
1928
+ this._translations = messages[0];
1929
+ }
1882
1930
  get el() { return index.getElement(this); }
1883
1931
  static get watchers() { return {
1884
1932
  "mapView": ["mapViewWatchHandler"]
@@ -9,9 +9,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  const index = require('./index-ee37804b.js');
11
11
  const locale = require('./locale-67f5f6b6.js');
12
- const mapViewUtils = require('./mapViewUtils-a4dd36ec.js');
12
+ const mapViewUtils = require('./mapViewUtils-a2884698.js');
13
13
  const loadModules = require('./loadModules-f6df8d6a.js');
14
- const downloadUtils = require('./downloadUtils-fb4744e0.js');
14
+ const downloadUtils = require('./downloadUtils-34a515ad.js');
15
15
  require('./_commonjsHelpers-384729db.js');
16
16
  require('./interfaces-000be6de.js');
17
17
  require('./clean-url-d5326abb.js');
@@ -59,7 +59,7 @@ const CardManager = class {
59
59
  */
60
60
  async layerSelectionChange(evt) {
61
61
  const id = evt.detail[0];
62
- this.layer = await mapViewUtils.getLayer(this.mapView, id);
62
+ this.layer = await mapViewUtils.getLayerOrTable(this.mapView, id);
63
63
  }
64
64
  //--------------------------------------------------------------------------
65
65
  //
@@ -131,6 +131,7 @@ const LayerTable = class {
131
131
  this.enableInlineEdit = undefined;
132
132
  this.mapInfo = undefined;
133
133
  this.mapView = undefined;
134
+ this.onlyShowUpdatableLayers = undefined;
134
135
  this.showNewestFirst = undefined;
135
136
  this.zoomAndScrollToSelected = undefined;
136
137
  this._alertOpen = false;
@@ -151,13 +152,12 @@ const LayerTable = class {
151
152
  * watch for changes in map view and get the first layer
152
153
  */
153
154
  async mapViewWatchHandler() {
154
- this._fetchingData = true;
155
- const mapLayerIds = await mapViewUtils.getMapLayerIds(this.mapView);
156
- this._layer = await mapViewUtils.getLayer(this.mapView, mapLayerIds[0]);
157
- this.reactiveUtils.on(() => this.mapView, "click", (event) => {
155
+ if (this._mapClickHandle) {
156
+ this._mapClickHandle.remove();
157
+ }
158
+ this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
158
159
  void this._mapClicked(event);
159
160
  });
160
- this._fetchingData = false;
161
161
  }
162
162
  /**
163
163
  * watch for changes in layer view and verify if it has editing enabled
@@ -214,6 +214,22 @@ const LayerTable = class {
214
214
  }
215
215
  }
216
216
  }
217
+ /**
218
+ * Refresh the table when edits are completed
219
+ *
220
+ */
221
+ editsComplete() {
222
+ this._refresh();
223
+ }
224
+ /**
225
+ * Refresh the table when edits are completed
226
+ *
227
+ */
228
+ noLayersFound() {
229
+ this._layer = undefined;
230
+ this._allIds = [];
231
+ this._clearSelection();
232
+ }
217
233
  //--------------------------------------------------------------------------
218
234
  //
219
235
  // Functions (lifecycle)
@@ -232,9 +248,6 @@ const LayerTable = class {
232
248
  * Renders the component.
233
249
  */
234
250
  render() {
235
- if (!this._layer) {
236
- return null;
237
- }
238
251
  const tableNodeClass = this._fetchingData ? "display-none" : "";
239
252
  const loadingClass = this._fetchingData ? "" : "display-none";
240
253
  const total = this._allIds.length.toString();
@@ -272,9 +285,37 @@ const LayerTable = class {
272
285
  */
273
286
  _getTableControlRow(slot) {
274
287
  const featuresSelected = this._selectedIndexes.length > 0;
275
- return (index.h("div", { class: "display-flex table-border height-51", slot: slot }, index.h("calcite-action-bar", { expandDisabled: true, expanded: true, layout: "horizontal" }, index.h("div", { class: "border-end" }, index.h("map-layer-picker", { appearance: "transparent", mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), placeholderIcon: "layers", scale: "l", type: "dropdown" })), index.h("calcite-action", { appearance: "solid", disabled: !featuresSelected, icon: "magnifying-glass", id: "magnifying-glass", label: this._translations.zoom, onClick: () => this._zoom(), text: this._translations.zoom, textEnabled: true }), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "magnifying-glass" }, index.h("span", null, this._translations.zoom)), index.h("calcite-action", { appearance: "solid", icon: "filter", id: "filter", onClick: () => this._filter(), text: this._translations.filters, "text-enabled": "true", textEnabled: true }), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "filter" }, index.h("span", null, this._translations.filters)), index.h("calcite-action", { appearance: "solid", disabled: !featuresSelected, id: "trash", onClick: () => this._delete(), text: "" }, index.h("calcite-button", { appearance: "transparent", iconStart: "trash", kind: "danger" }, this._translations.delete)), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "trash" }, index.h("span", null, this._translations.delete)), index.h("calcite-action", { appearance: "solid", disabled: !featuresSelected, icon: "erase", id: "erase", onClick: () => this._clearSelection(), text: this._translations.clearSelection, "text-enabled": "true", textEnabled: true }), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "erase" }, index.h("span", null, this._translations.clearSelection))), index.h("calcite-dropdown", null, index.h("calcite-action", { appearance: "solid", label: "", slot: "trigger", text: "" }, index.h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), index.h("calcite-dropdown-group", { "selection-mode": "none" }, index.h("calcite-dropdown-item", { iconStart: "list-check-all", onClick: () => this._selectAll() }, this._translations.selectAll), index.h("calcite-dropdown-item", { iconStart: "selected-items-filter", onClick: () => this._toggleShowSelected() }, this._showOnlySelected ? this._translations.showAll :
288
+ return (index.h("div", { class: "display-flex table-border height-51", slot: slot }, index.h("calcite-action-bar", { expandDisabled: true, expanded: true, layout: "horizontal" }, index.h("div", { class: "border-end" }, index.h("map-layer-picker", { appearance: "transparent", mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", type: "dropdown" })), this._getAction("zoom-to-object", this._translations.zoom, () => this._zoom(), !featuresSelected), this._getAction("filter", this._translations.filters, () => this._filter(), false), this._deleteEnabled ? this._getDangerAction("trash", this._translations.delete, () => this._delete(), !featuresSelected) : undefined, this._getAction("erase", this._translations.clearSelection, () => this._clearSelection(), !featuresSelected)), index.h("calcite-dropdown", { disabled: this._layer === undefined }, index.h("calcite-action", { appearance: "solid", label: "", slot: "trigger", text: "" }, index.h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), index.h("calcite-dropdown-group", { "selection-mode": "none" }, index.h("calcite-dropdown-item", { iconStart: "list-check-all", onClick: () => this._selectAll() }, this._translations.selectAll), index.h("calcite-dropdown-item", { iconStart: "selected-items-filter", onClick: () => this._toggleShowSelected() }, this._showOnlySelected ? this._translations.showAll :
276
289
  this._translations.showSelected), index.h("calcite-dropdown-item", { iconStart: "compare", onClick: () => this._switchSelected() }, this._translations.switchSelected), index.h("calcite-dropdown-item", { iconStart: "refresh", onClick: () => this._refresh() }, this._translations.refresh), index.h("calcite-dropdown-item", { iconStart: "export", onClick: () => void this._exportToCSV() }, this._translations.exportCSV)))));
277
290
  }
291
+ /**
292
+ * Get an action and tooltip
293
+ *
294
+ * @param icon string the name of the icon to display, will also be used as the id
295
+ * @param label string the text to display and label the action
296
+ * @param func any the function to execute
297
+ * @param disabled boolean when true the user will not be able to interact with the action
298
+ *
299
+ * @returns VNode The node representing the DOM element that will contain the action
300
+ */
301
+ _getAction(icon, label, func, disabled) {
302
+ const _disabled = this._layer === undefined ? true : disabled;
303
+ return (index.h("div", { class: "display-flex" }, index.h("calcite-action", { appearance: "solid", disabled: _disabled, icon: icon, id: icon, label: label, onClick: func, text: label, textEnabled: true }), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, index.h("span", null, label))));
304
+ }
305
+ /**
306
+ * Get an action with danger color icon and text
307
+ *
308
+ * @param icon string the name of the icon to display, will also be used as the id
309
+ * @param label string the text to display and label the action
310
+ * @param func any the function to execute
311
+ * @param disabled boolean when true the user will not be able to interact with the action
312
+ *
313
+ * @returns VNode The node representing the DOM element that will contain the action
314
+ */
315
+ _getDangerAction(icon, label, func, disabled) {
316
+ const _disabled = this._layer === undefined ? true : disabled;
317
+ return (index.h("div", { class: "display-flex" }, index.h("calcite-action", { appearance: "solid", disabled: _disabled, id: icon, onClick: func, text: "" }, index.h("calcite-button", { appearance: "transparent", iconStart: icon, kind: "danger" }, label)), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, index.h("span", null, label))));
318
+ }
278
319
  /**
279
320
  * Initialize the FeatureTable
280
321
  *
@@ -284,7 +325,7 @@ const LayerTable = class {
284
325
  */
285
326
  async _getTable(node, columnTemplates) {
286
327
  if (this._layer) {
287
- await this._layer.when(async () => {
328
+ await this._layer.when(() => {
288
329
  this._table = new this.FeatureTable({
289
330
  autoRefreshEnabled: this.enableAutoRefresh,
290
331
  layer: this._layer,
@@ -301,25 +342,25 @@ const LayerTable = class {
301
342
  },
302
343
  container: node
303
344
  });
304
- this._checkEditEnabled();
305
- await this._table.when(async () => {
306
- this._table.highlightIds.on("change", () => {
307
- this._selectedIndexes = this._table.highlightIds.toArray();
308
- if (this._showOnlySelected) {
309
- if (this._selectedIndexes.length > 0) {
310
- this._table.filterBySelection();
311
- }
312
- else {
313
- this._toggleShowSelected();
314
- }
345
+ });
346
+ this._checkEditEnabled();
347
+ await this._table.when(() => {
348
+ this._table.highlightIds.on("change", () => {
349
+ this._selectedIndexes = this._table.highlightIds.toArray();
350
+ if (this._showOnlySelected) {
351
+ if (this._selectedIndexes.length > 0) {
352
+ this._table.filterBySelection();
353
+ }
354
+ else {
355
+ this._toggleShowSelected();
315
356
  }
316
- this.featureSelectionChange.emit(this._selectedIndexes);
317
- });
318
- this.reactiveUtils.watch(() => this._table.activeSortOrders, (sortOrders) => {
319
- var _a, _b, _c, _d;
320
- this._sortActive = (sortOrders.length > 0 && ((_a = sortOrders[0]) === null || _a === void 0 ? void 0 : _a.direction) === "asc" || ((_b = sortOrders[0]) === null || _b === void 0 ? void 0 : _b.direction) === "desc") ||
321
- ((_c = sortOrders[0]) === null || _c === void 0 ? void 0 : _c.direction) === null && ((_d = sortOrders[0]) === null || _d === void 0 ? void 0 : _d.fieldName) === this._layer.objectIdField;
322
- });
357
+ }
358
+ this.featureSelectionChange.emit(this._selectedIndexes);
359
+ });
360
+ this.reactiveUtils.watch(() => this._table.activeSortOrders, (sortOrders) => {
361
+ var _a, _b, _c, _d;
362
+ this._sortActive = this._layer ? (sortOrders.length > 0 && ((_a = sortOrders[0]) === null || _a === void 0 ? void 0 : _a.direction) === "asc" || ((_b = sortOrders[0]) === null || _b === void 0 ? void 0 : _b.direction) === "desc") ||
363
+ ((_c = sortOrders[0]) === null || _c === void 0 ? void 0 : _c.direction) === null && ((_d = sortOrders[0]) === null || _d === void 0 ? void 0 : _d.fieldName) === this._layer.objectIdField : false;
323
364
  });
324
365
  });
325
366
  }
@@ -330,20 +371,30 @@ const LayerTable = class {
330
371
  * @returns void
331
372
  */
332
373
  async _resetTable() {
333
- if (this._layer && this._table) {
374
+ if (this._table) {
334
375
  this._clearSelection();
335
376
  this._allIds = [];
336
377
  this.featureSelectionChange.emit(this._selectedIndexes);
337
- const columnTemplates = this._getColumnTemplates(this._layer.id);
338
- this._table.layer = this._layer;
339
- this._table.tableTemplate.columnTemplates = columnTemplates;
340
- this._checkEditEnabled();
341
- this._table.view = this.mapView;
342
- this._table.editingEnabled = this._editEnabled;
343
- this._table.clearSelectionFilter();
344
- this._showOnlySelected = false;
345
- this._sortActive = false;
346
- await this._sortTable();
378
+ if (this._layer) {
379
+ await this._layer.when(() => {
380
+ const columnTemplates = this._getColumnTemplates(this._layer.id);
381
+ this._table.layer = this._layer;
382
+ this._table.tableTemplate.columnTemplates = columnTemplates;
383
+ this._table.view = this.mapView;
384
+ this._checkEditEnabled();
385
+ this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
386
+ });
387
+ await this._table.when(() => {
388
+ this._table.clearSelectionFilter();
389
+ });
390
+ this._showOnlySelected = false;
391
+ this._sortActive = false;
392
+ await this._sortTable();
393
+ }
394
+ else {
395
+ this._table.view = this.mapView;
396
+ this._table.layer = this._layer;
397
+ }
347
398
  }
348
399
  }
349
400
  /**
@@ -364,11 +415,10 @@ const LayerTable = class {
364
415
  if (this._table && this._layer && !this._sortActive) {
365
416
  if (!this._tableSorting && this.showNewestFirst) {
366
417
  this._tableSorting = true;
367
- await this._table.when(async () => {
368
- await this._layer.when(async () => {
369
- this._table.sortColumn(this._layer.objectIdField, "desc");
370
- this._tableSorting = false;
371
- });
418
+ await this._table.when();
419
+ await this._layer.when(() => {
420
+ this._table.sortColumn(this._layer.objectIdField, "desc");
421
+ this._tableSorting = false;
372
422
  });
373
423
  }
374
424
  }
@@ -566,11 +616,12 @@ const LayerTable = class {
566
616
  * @returns a promise that will resolve when the operation is complete
567
617
  */
568
618
  async _layerSelectionChanged(evt) {
619
+ var _a;
569
620
  const id = evt.detail[0];
570
- if (id !== this._layer.id || this._allIds.length === 0) {
621
+ if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._allIds.length === 0) {
571
622
  this._fetchingData = true;
572
623
  const columnTemplates = this._getColumnTemplates(id);
573
- this._layer = await mapViewUtils.getLayer(this.mapView, id);
624
+ this._layer = await mapViewUtils.getLayerOrTable(this.mapView, id);
574
625
  this._allIds = await mapViewUtils.queryAllIds(this._layer);
575
626
  if (!this._table) {
576
627
  await this._getTable(this._tableNode, columnTemplates);
@@ -632,10 +683,16 @@ const MapCard = class {
632
683
  constructor(hostRef) {
633
684
  index.registerInstance(this, hostRef);
634
685
  this.mapChanged = index.createEvent(this, "mapChanged", 7);
686
+ this.beforeMapChanged = index.createEvent(this, "beforeMapChanged", 7);
635
687
  /**
636
688
  * string: the id of map currently displayed
637
689
  */
638
690
  this._loadedId = "";
691
+ this.enableLegend = undefined;
692
+ this.enableFullscreen = undefined;
693
+ this.enableSearch = undefined;
694
+ this.enableBasemap = undefined;
695
+ this.basemapConfig = undefined;
639
696
  this.mapInfos = [];
640
697
  this.mapView = undefined;
641
698
  this._searchConfiguration = undefined;
@@ -662,7 +719,7 @@ const MapCard = class {
662
719
  * Renders the component.
663
720
  */
664
721
  render() {
665
- return (index.h(index.Host, null, index.h("map-picker", { mapInfos: this.mapInfos }), index.h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) }), index.h("map-tools", { class: "box-shadow", mapView: this.mapView, ref: (el) => this._mapTools = el, searchConfiguration: this._searchConfiguration })));
722
+ return (index.h(index.Host, null, index.h("map-picker", { mapInfos: this.mapInfos }), index.h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) }), index.h("map-tools", { basemapConfig: this.basemapConfig, class: "box-shadow", enableBasemap: this.enableBasemap, enableFullscreen: this.enableFullscreen, enableLegend: this.enableLegend, enableSearch: this.enableSearch, mapView: this.mapView, ref: (el) => this._mapTools = el, searchConfiguration: this._searchConfiguration })));
666
723
  }
667
724
  //--------------------------------------------------------------------------
668
725
  //
@@ -712,16 +769,17 @@ const MapCard = class {
712
769
  });
713
770
  this._loadedId = id;
714
771
  this._searchConfiguration = this._webMapInfo.searchConfiguration;
715
- this.mapChanged.emit({
716
- id: id,
717
- mapView: this.mapView
718
- });
772
+ this.beforeMapChanged.emit();
719
773
  await this.mapView.when(() => {
720
774
  const home = new this.Home({
721
775
  view: this.mapView
722
776
  });
723
777
  this.mapView.ui.add(home, { position: "top-left", index: 3 });
724
778
  this.mapView.ui.add(this._mapTools, { position: "top-right", index: 0 });
779
+ this.mapChanged.emit({
780
+ id: id,
781
+ mapView: this.mapView
782
+ });
725
783
  });
726
784
  }
727
785
  }
@@ -24,10 +24,18 @@ const CrowdsourceManager = class {
24
24
  this._shouldSetMapView = false;
25
25
  this.classicGrid = false;
26
26
  this.enableAutoRefresh = true;
27
+ this.enableFullscreen = true;
27
28
  this.enableInlineEdit = false;
29
+ this.enableLegend = true;
30
+ this.enableSearch = true;
31
+ this.enableHome = true;
32
+ this.enableZoom = true;
33
+ this.enableBasemap = true;
34
+ this.basemapConfig = undefined;
28
35
  this.showNewestFirst = true;
29
36
  this.hideMap = false;
30
37
  this.mapInfos = [];
38
+ this.onlyShowUpdatableLayers = true;
31
39
  this.searchConfiguration = undefined;
32
40
  this.zoomAndScrollToSelected = false;
33
41
  this._expandPopup = false;
@@ -62,13 +70,18 @@ const CrowdsourceManager = class {
62
70
  */
63
71
  async mapChanged(evt) {
64
72
  this._mapChange = evt.detail;
73
+ await this._mapChange.mapView.when(() => {
74
+ this._setMapView();
75
+ });
76
+ }
77
+ /**
78
+ * Listen for beforeMapChanged and minimize the popup if it's expanded
79
+ */
80
+ async beforeMapChanged() {
65
81
  if (this._expandPopup) {
66
82
  this._shouldSetMapView = true;
67
83
  this._expandPopup = false;
68
84
  }
69
- else {
70
- this._setMapView();
71
- }
72
85
  }
73
86
  //--------------------------------------------------------------------------
74
87
  //
@@ -227,7 +240,7 @@ const CrowdsourceManager = class {
227
240
  const mapDisplayClass = this.classicGrid && layoutMode === interfaces.ELayoutMode.GRID ? "display-flex height-full width-1-2" :
228
241
  layoutMode === interfaces.ELayoutMode.GRID && !hideMap ? "" : "display-none";
229
242
  const mapContainerClass = this.classicGrid && layoutMode === interfaces.ELayoutMode.GRID ? "width-full" : this._expandPopup ? "height-50-px" : "adjusted-height-50";
230
- return (index.h("div", { class: `${mapContainerClass} overflow-hidden ${mapDisplayClass}` }, index.h("map-card", { class: "width-full", mapInfos: this.mapInfos })));
243
+ return (index.h("div", { class: `${mapContainerClass} overflow-hidden ${mapDisplayClass}` }, index.h("map-card", { basemapConfig: this.basemapConfig, class: "width-full", enableBasemap: this.enableBasemap, enableFullscreen: this.enableFullscreen, enableLegend: this.enableLegend, enableSearch: this.enableSearch, mapInfos: this.mapInfos })));
231
244
  }
232
245
  /**
233
246
  * Get the expand node for the popup information
@@ -281,7 +294,7 @@ const CrowdsourceManager = class {
281
294
  const toggleSlot = this.classicGrid && layoutMode !== interfaces.ELayoutMode.VERTICAL ? "footer" :
282
295
  this.classicGrid && layoutMode === interfaces.ELayoutMode.VERTICAL ? "panel-end" :
283
296
  layoutMode === interfaces.ELayoutMode.HORIZONTAL ? "header" : "panel-start";
284
- return (index.h("calcite-shell", { class: tableSizeClass + " border-bottom" }, index.h("calcite-action-bar", { class: "border", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, index.h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), index.h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, index.h("span", null, tooltip))), index.h("div", { class: "width-full height-full position-relative" }, index.h("layer-table", { enableAutoRefresh: this.enableAutoRefresh, enableInlineEdit: this.enableInlineEdit, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
297
+ return (index.h("calcite-shell", { class: tableSizeClass + " border-bottom" }, index.h("calcite-action-bar", { class: "border", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, index.h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), index.h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, index.h("span", null, tooltip))), index.h("div", { class: "width-full height-full position-relative" }, index.h("layer-table", { enableAutoRefresh: this.enableAutoRefresh, enableInlineEdit: this.enableInlineEdit, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
285
298
  }
286
299
  /**
287
300
  * Open/Close the appropriate panel.
@@ -8,7 +8,7 @@
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
9
9
  const index = require('./index-ee37804b.js');
10
10
  const loadModules = require('./loadModules-f6df8d6a.js');
11
- const mapViewUtils = require('./mapViewUtils-a4dd36ec.js');
11
+ const mapViewUtils = require('./mapViewUtils-a2884698.js');
12
12
  const cleanUrl = require('./clean-url-d5326abb.js');
13
13
 
14
14
  /** @license
@@ -1508,7 +1508,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1508
1508
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1509
1509
  * ====================================================================
1510
1510
  */
1511
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-372e33de.js'); })).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
1511
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-0ba11065.js'); })).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
1512
1512
  /** ====================================================================
1513
1513
  * @license
1514
1514
  * jsPDF XMP metadata plugin