@theseam/ui-common 0.3.1 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/bundles/theseam-ui-common-dynamic.umd.js +1 -0
  2. package/bundles/theseam-ui-common-dynamic.umd.js.map +1 -1
  3. package/bundles/theseam-ui-common-form-field.umd.js +1 -1
  4. package/bundles/theseam-ui-common-form-field.umd.js.map +1 -1
  5. package/bundles/theseam-ui-common-google-maps.umd.js +2202 -0
  6. package/bundles/theseam-ui-common-google-maps.umd.js.map +1 -0
  7. package/bundles/theseam-ui-common-menu.umd.js +1 -0
  8. package/bundles/theseam-ui-common-menu.umd.js.map +1 -1
  9. package/bundles/theseam-ui-common-modal.umd.js +21 -1
  10. package/bundles/theseam-ui-common-modal.umd.js.map +1 -1
  11. package/bundles/theseam-ui-common-utils.umd.js +610 -136
  12. package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
  13. package/bundles/theseam-ui-common-widget.umd.js +3 -1
  14. package/bundles/theseam-ui-common-widget.umd.js.map +1 -1
  15. package/esm2015/dynamic/evaluators/jexl-evaluator/jexl-evaluator.js +2 -1
  16. package/esm2015/form-field/input.directive.js +2 -2
  17. package/esm2015/google-maps/google-maps/google-maps.component.js +261 -0
  18. package/esm2015/google-maps/google-maps-contextmenu.js +113 -0
  19. package/esm2015/google-maps/google-maps-controls.service.js +70 -0
  20. package/esm2015/google-maps/google-maps-feature-helpers.js +177 -0
  21. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.js +195 -0
  22. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.js +163 -0
  23. package/esm2015/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.js +57 -0
  24. package/esm2015/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.js +119 -0
  25. package/esm2015/google-maps/google-maps.module.js +45 -0
  26. package/esm2015/google-maps/google-maps.service.js +344 -0
  27. package/esm2015/google-maps/map-control.component.js +65 -0
  28. package/esm2015/google-maps/map-controls-service.js +4 -0
  29. package/esm2015/google-maps/map-file-drop/map-file-drop.component.js +135 -0
  30. package/esm2015/google-maps/map-value-manager.service.js +46 -0
  31. package/esm2015/google-maps/public-api.js +14 -0
  32. package/esm2015/google-maps/theseam-ui-common-google-maps.js +6 -0
  33. package/esm2015/menu/menu-toggle.directive.js +2 -1
  34. package/esm2015/modal/modal-ref.js +22 -2
  35. package/esm2015/utils/geo-json/coerce-feature-collection.js +44 -0
  36. package/esm2015/utils/geo-json/geo-json-to-area.js +11 -0
  37. package/esm2015/utils/geo-json/is-feature-collection.validator.js +21 -0
  38. package/esm2015/utils/geo-json/is-only-geometry-types.js +23 -0
  39. package/esm2015/utils/geo-json/is-only-geometry-types.validator.js +32 -0
  40. package/esm2015/utils/geo-json/merge-polygons.js +35 -0
  41. package/esm2015/utils/geo-json/no-inner-rings.validator.js +63 -0
  42. package/esm2015/utils/geo-json/no-kinks.validator.js +39 -0
  43. package/esm2015/utils/geo-json/read-geo-file.js +99 -0
  44. package/esm2015/utils/geo-json/split-multi-polygons.js +29 -0
  45. package/esm2015/utils/is-null-or-undefined.js +1 -1
  46. package/esm2015/utils/public-api.js +11 -1
  47. package/esm2015/widget/widget-content-components/widget-tile/widget-tile.component.js +4 -2
  48. package/fesm2015/theseam-ui-common-dynamic.js +1 -0
  49. package/fesm2015/theseam-ui-common-dynamic.js.map +1 -1
  50. package/fesm2015/theseam-ui-common-form-field.js +1 -1
  51. package/fesm2015/theseam-ui-common-form-field.js.map +1 -1
  52. package/fesm2015/theseam-ui-common-google-maps.js +1729 -0
  53. package/fesm2015/theseam-ui-common-google-maps.js.map +1 -0
  54. package/fesm2015/theseam-ui-common-menu.js +1 -0
  55. package/fesm2015/theseam-ui-common-menu.js.map +1 -1
  56. package/fesm2015/theseam-ui-common-modal.js +21 -1
  57. package/fesm2015/theseam-ui-common-modal.js.map +1 -1
  58. package/fesm2015/theseam-ui-common-utils.js +477 -94
  59. package/fesm2015/theseam-ui-common-utils.js.map +1 -1
  60. package/fesm2015/theseam-ui-common-widget.js +3 -1
  61. package/fesm2015/theseam-ui-common-widget.js.map +1 -1
  62. package/form-field/theseam-ui-common-form-field.metadata.json +1 -1
  63. package/google-maps/google-maps/google-maps.component.d.ts +89 -0
  64. package/google-maps/google-maps-contextmenu.d.ts +15 -0
  65. package/google-maps/google-maps-controls.service.d.ts +23 -0
  66. package/google-maps/google-maps-feature-helpers.d.ts +37 -0
  67. package/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.d.ts +104 -0
  68. package/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.d.ts +80 -0
  69. package/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.d.ts +21 -0
  70. package/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.d.ts +34 -0
  71. package/google-maps/google-maps.module.d.ts +2 -0
  72. package/google-maps/google-maps.service.d.ts +53 -0
  73. package/google-maps/map-control.component.d.ts +20 -0
  74. package/google-maps/map-controls-service.d.ts +13 -0
  75. package/google-maps/map-file-drop/map-file-drop.component.d.ts +34 -0
  76. package/google-maps/map-value-manager.service.d.ts +18 -0
  77. package/google-maps/package.json +11 -0
  78. package/google-maps/public-api.d.ts +13 -0
  79. package/google-maps/theseam-ui-common-google-maps.d.ts +5 -0
  80. package/google-maps/theseam-ui-common-google-maps.metadata.json +1 -0
  81. package/modal/modal-ref.d.ts +1 -0
  82. package/modal/theseam-ui-common-modal.metadata.json +1 -1
  83. package/package.json +17 -10
  84. package/utils/geo-json/coerce-feature-collection.d.ts +2 -0
  85. package/utils/geo-json/geo-json-to-area.d.ts +6 -0
  86. package/utils/geo-json/is-feature-collection.validator.d.ts +3 -0
  87. package/utils/geo-json/is-only-geometry-types.d.ts +5 -0
  88. package/utils/geo-json/is-only-geometry-types.validator.d.ts +4 -0
  89. package/utils/geo-json/merge-polygons.d.ts +9 -0
  90. package/utils/geo-json/no-inner-rings.validator.d.ts +10 -0
  91. package/utils/geo-json/no-kinks.validator.d.ts +3 -0
  92. package/utils/geo-json/read-geo-file.d.ts +7 -0
  93. package/utils/geo-json/split-multi-polygons.d.ts +8 -0
  94. package/utils/is-null-or-undefined.d.ts +1 -1
  95. package/utils/public-api.d.ts +10 -0
  96. package/utils/theseam-ui-common-utils.metadata.json +1 -1
  97. package/widget/styles/_variables.scss +1 -0
  98. package/widget/theseam-ui-common-widget.metadata.json +1 -1
  99. package/widget/widget-content-components/widget-tile/widget-tile.component.d.ts +2 -0
  100. package/widget/widget-content-components/widget-tile/widget-tile.component.scss +1 -1
@@ -0,0 +1,2202 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/core'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@agm/core'), require('@fortawesome/free-solid-svg-icons'), require('@theseam/ui-common/core'), require('@theseam/ui-common/menu'), require('@theseam/ui-common/utils'), require('@angular/cdk/keycodes'), require('@turf/boolean-contains'), require('@turf/helpers'), require('@angular/cdk/observers'), require('@angular/common'), require('@theseam/ui-common/form-field'), require('@theseam/ui-common/icon'), require('@theseam/ui-common/shared')) :
3
+ typeof define === 'function' && define.amd ? define('@theseam/ui-common/google-maps', ['exports', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/core', '@angular/forms', 'rxjs', 'rxjs/operators', '@agm/core', '@fortawesome/free-solid-svg-icons', '@theseam/ui-common/core', '@theseam/ui-common/menu', '@theseam/ui-common/utils', '@angular/cdk/keycodes', '@turf/boolean-contains', '@turf/helpers', '@angular/cdk/observers', '@angular/common', '@theseam/ui-common/form-field', '@theseam/ui-common/icon', '@theseam/ui-common/shared'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.theseam = global.theseam || {}, global.theseam["ui-common"] = global.theseam["ui-common"] || {}, global.theseam["ui-common"]["google-maps"] = {}), global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.core, global.ng.forms, global.rxjs, global.rxjs.operators, global.core$2, global.freeSolidSvgIcons, global.theseam["ui-common"].core, global.theseam["ui-common"].menu, global.theseam["ui-common"].utils, global.ng.cdk.keycodes, global.booleanContains, global.helpers, global.ng.cdk.observers, global.ng.common, global.theseam["ui-common"]["form-field"], global.theseam["ui-common"].icon, global.theseam["ui-common"].shared));
5
+ })(this, (function (exports, a11y, coercion, core, forms, rxjs, operators, core$2, freeSolidSvgIcons, core$1, menu, utils, keycodes, booleanContains, helpers, observers, common, formField, icon, shared) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var booleanContains__default = /*#__PURE__*/_interopDefaultLegacy(booleanContains);
10
+
11
+ /*! *****************************************************************************
12
+ Copyright (c) Microsoft Corporation.
13
+
14
+ Permission to use, copy, modify, and/or distribute this software for any
15
+ purpose with or without fee is hereby granted.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
+ PERFORMANCE OF THIS SOFTWARE.
24
+ ***************************************************************************** */
25
+ /* global Reflect, Promise */
26
+ var extendStatics = function (d, b) {
27
+ extendStatics = Object.setPrototypeOf ||
28
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29
+ function (d, b) { for (var p in b)
30
+ if (Object.prototype.hasOwnProperty.call(b, p))
31
+ d[p] = b[p]; };
32
+ return extendStatics(d, b);
33
+ };
34
+ function __extends(d, b) {
35
+ if (typeof b !== "function" && b !== null)
36
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
+ extendStatics(d, b);
38
+ function __() { this.constructor = d; }
39
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
+ }
41
+ var __assign = function () {
42
+ __assign = Object.assign || function __assign(t) {
43
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
44
+ s = arguments[i];
45
+ for (var p in s)
46
+ if (Object.prototype.hasOwnProperty.call(s, p))
47
+ t[p] = s[p];
48
+ }
49
+ return t;
50
+ };
51
+ return __assign.apply(this, arguments);
52
+ };
53
+ function __rest(s, e) {
54
+ var t = {};
55
+ for (var p in s)
56
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57
+ t[p] = s[p];
58
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
59
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
61
+ t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ }
65
+ function __decorate(decorators, target, key, desc) {
66
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
68
+ r = Reflect.decorate(decorators, target, key, desc);
69
+ else
70
+ for (var i = decorators.length - 1; i >= 0; i--)
71
+ if (d = decorators[i])
72
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
73
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
74
+ }
75
+ function __param(paramIndex, decorator) {
76
+ return function (target, key) { decorator(target, key, paramIndex); };
77
+ }
78
+ function __metadata(metadataKey, metadataValue) {
79
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
80
+ return Reflect.metadata(metadataKey, metadataValue);
81
+ }
82
+ function __awaiter(thisArg, _arguments, P, generator) {
83
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
84
+ return new (P || (P = Promise))(function (resolve, reject) {
85
+ function fulfilled(value) { try {
86
+ step(generator.next(value));
87
+ }
88
+ catch (e) {
89
+ reject(e);
90
+ } }
91
+ function rejected(value) { try {
92
+ step(generator["throw"](value));
93
+ }
94
+ catch (e) {
95
+ reject(e);
96
+ } }
97
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
98
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
99
+ });
100
+ }
101
+ function __generator(thisArg, body) {
102
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
103
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
104
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
105
+ function verb(n) { return function (v) { return step([n, v]); }; }
106
+ function step(op) {
107
+ if (f)
108
+ throw new TypeError("Generator is already executing.");
109
+ while (_)
110
+ try {
111
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
112
+ return t;
113
+ if (y = 0, t)
114
+ op = [op[0] & 2, t.value];
115
+ switch (op[0]) {
116
+ case 0:
117
+ case 1:
118
+ t = op;
119
+ break;
120
+ case 4:
121
+ _.label++;
122
+ return { value: op[1], done: false };
123
+ case 5:
124
+ _.label++;
125
+ y = op[1];
126
+ op = [0];
127
+ continue;
128
+ case 7:
129
+ op = _.ops.pop();
130
+ _.trys.pop();
131
+ continue;
132
+ default:
133
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
134
+ _ = 0;
135
+ continue;
136
+ }
137
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
138
+ _.label = op[1];
139
+ break;
140
+ }
141
+ if (op[0] === 6 && _.label < t[1]) {
142
+ _.label = t[1];
143
+ t = op;
144
+ break;
145
+ }
146
+ if (t && _.label < t[2]) {
147
+ _.label = t[2];
148
+ _.ops.push(op);
149
+ break;
150
+ }
151
+ if (t[2])
152
+ _.ops.pop();
153
+ _.trys.pop();
154
+ continue;
155
+ }
156
+ op = body.call(thisArg, _);
157
+ }
158
+ catch (e) {
159
+ op = [6, e];
160
+ y = 0;
161
+ }
162
+ finally {
163
+ f = t = 0;
164
+ }
165
+ if (op[0] & 5)
166
+ throw op[1];
167
+ return { value: op[0] ? op[1] : void 0, done: true };
168
+ }
169
+ }
170
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
171
+ if (k2 === undefined)
172
+ k2 = k;
173
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
174
+ }) : (function (o, m, k, k2) {
175
+ if (k2 === undefined)
176
+ k2 = k;
177
+ o[k2] = m[k];
178
+ });
179
+ function __exportStar(m, o) {
180
+ for (var p in m)
181
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
182
+ __createBinding(o, m, p);
183
+ }
184
+ function __values(o) {
185
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
186
+ if (m)
187
+ return m.call(o);
188
+ if (o && typeof o.length === "number")
189
+ return {
190
+ next: function () {
191
+ if (o && i >= o.length)
192
+ o = void 0;
193
+ return { value: o && o[i++], done: !o };
194
+ }
195
+ };
196
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
197
+ }
198
+ function __read(o, n) {
199
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
200
+ if (!m)
201
+ return o;
202
+ var i = m.call(o), r, ar = [], e;
203
+ try {
204
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
205
+ ar.push(r.value);
206
+ }
207
+ catch (error) {
208
+ e = { error: error };
209
+ }
210
+ finally {
211
+ try {
212
+ if (r && !r.done && (m = i["return"]))
213
+ m.call(i);
214
+ }
215
+ finally {
216
+ if (e)
217
+ throw e.error;
218
+ }
219
+ }
220
+ return ar;
221
+ }
222
+ /** @deprecated */
223
+ function __spread() {
224
+ for (var ar = [], i = 0; i < arguments.length; i++)
225
+ ar = ar.concat(__read(arguments[i]));
226
+ return ar;
227
+ }
228
+ /** @deprecated */
229
+ function __spreadArrays() {
230
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
231
+ s += arguments[i].length;
232
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
233
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
234
+ r[k] = a[j];
235
+ return r;
236
+ }
237
+ function __spreadArray(to, from, pack) {
238
+ if (pack || arguments.length === 2)
239
+ for (var i = 0, l = from.length, ar; i < l; i++) {
240
+ if (ar || !(i in from)) {
241
+ if (!ar)
242
+ ar = Array.prototype.slice.call(from, 0, i);
243
+ ar[i] = from[i];
244
+ }
245
+ }
246
+ return to.concat(ar || Array.prototype.slice.call(from));
247
+ }
248
+ function __await(v) {
249
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
250
+ }
251
+ function __asyncGenerator(thisArg, _arguments, generator) {
252
+ if (!Symbol.asyncIterator)
253
+ throw new TypeError("Symbol.asyncIterator is not defined.");
254
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
255
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
256
+ function verb(n) { if (g[n])
257
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
258
+ function resume(n, v) { try {
259
+ step(g[n](v));
260
+ }
261
+ catch (e) {
262
+ settle(q[0][3], e);
263
+ } }
264
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
265
+ function fulfill(value) { resume("next", value); }
266
+ function reject(value) { resume("throw", value); }
267
+ function settle(f, v) { if (f(v), q.shift(), q.length)
268
+ resume(q[0][0], q[0][1]); }
269
+ }
270
+ function __asyncDelegator(o) {
271
+ var i, p;
272
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
273
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
274
+ }
275
+ function __asyncValues(o) {
276
+ if (!Symbol.asyncIterator)
277
+ throw new TypeError("Symbol.asyncIterator is not defined.");
278
+ var m = o[Symbol.asyncIterator], i;
279
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
280
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
281
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
282
+ }
283
+ function __makeTemplateObject(cooked, raw) {
284
+ if (Object.defineProperty) {
285
+ Object.defineProperty(cooked, "raw", { value: raw });
286
+ }
287
+ else {
288
+ cooked.raw = raw;
289
+ }
290
+ return cooked;
291
+ }
292
+ ;
293
+ var __setModuleDefault = Object.create ? (function (o, v) {
294
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
295
+ }) : function (o, v) {
296
+ o["default"] = v;
297
+ };
298
+ function __importStar(mod) {
299
+ if (mod && mod.__esModule)
300
+ return mod;
301
+ var result = {};
302
+ if (mod != null)
303
+ for (var k in mod)
304
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
305
+ __createBinding(result, mod, k);
306
+ __setModuleDefault(result, mod);
307
+ return result;
308
+ }
309
+ function __importDefault(mod) {
310
+ return (mod && mod.__esModule) ? mod : { default: mod };
311
+ }
312
+ function __classPrivateFieldGet(receiver, state, kind, f) {
313
+ if (kind === "a" && !f)
314
+ throw new TypeError("Private accessor was defined without a getter");
315
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
316
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
317
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
318
+ }
319
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
320
+ if (kind === "m")
321
+ throw new TypeError("Private method is not writable");
322
+ if (kind === "a" && !f)
323
+ throw new TypeError("Private accessor was defined without a setter");
324
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
325
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
326
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
327
+ }
328
+
329
+ exports.AppFeaturePropertyName = void 0;
330
+ (function (AppFeaturePropertyName) {
331
+ AppFeaturePropertyName["IsSelected"] = "__app__isSelected";
332
+ })(exports.AppFeaturePropertyName || (exports.AppFeaturePropertyName = {}));
333
+ function isAppFeatureProperty(propertyName) {
334
+ return Object.values(exports.AppFeaturePropertyName)
335
+ .findIndex(function (value) { return value === propertyName; }) !== -1;
336
+ }
337
+ function isFeatureSelected(feature) {
338
+ var isSelected = feature.getProperty(exports.AppFeaturePropertyName.IsSelected);
339
+ return coercion.coerceBooleanProperty(isSelected);
340
+ }
341
+ function setFeatureSelected(feature, isSelected) {
342
+ feature.setProperty(exports.AppFeaturePropertyName.IsSelected, isSelected);
343
+ }
344
+ // TODO: Check performance of cloning a google.maps.Data instance, so the
345
+ // properties can be removed with the google maps api, instead of on the
346
+ // resulting json.
347
+ function stripAppFeaturePropertiesFromJson(json) {
348
+ var e_1, _a, e_2, _b;
349
+ if (utils.notNullOrUndefined(json) && Array.isArray(json === null || json === void 0 ? void 0 : json.features)) {
350
+ try {
351
+ for (var _c = __values(json.features), _d = _c.next(); !_d.done; _d = _c.next()) {
352
+ var feature = _d.value;
353
+ if (utils.notNullOrUndefined(feature === null || feature === void 0 ? void 0 : feature.properties)) {
354
+ try {
355
+ for (var _e = (e_2 = void 0, __values(Object.keys(feature.properties))), _f = _e.next(); !_f.done; _f = _e.next()) {
356
+ var k = _f.value;
357
+ if (isAppFeatureProperty(k)) {
358
+ feature.properties[k] = undefined;
359
+ delete feature.properties[k];
360
+ }
361
+ }
362
+ }
363
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
364
+ finally {
365
+ try {
366
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
367
+ }
368
+ finally { if (e_2) throw e_2.error; }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
374
+ finally {
375
+ try {
376
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
377
+ }
378
+ finally { if (e_1) throw e_1.error; }
379
+ }
380
+ }
381
+ }
382
+ /**
383
+ * Searches for a Feature in Data that contains the provided Feature and can use
384
+ * it as a cutout area.
385
+ */
386
+ function getPossibleExteriorFeature(data, feature) {
387
+ var exteriorPolygonFeature;
388
+ data.forEach(function (f) {
389
+ if (f !== feature && (f.getGeometry().getType() === 'Polygon' && featureContains(f, feature))) {
390
+ exteriorPolygonFeature = f;
391
+ }
392
+ });
393
+ return exteriorPolygonFeature;
394
+ }
395
+ function addInnerFeatureCutoutToExteriorFeature(exteriorFeature, innerFeature) {
396
+ // NOTE: Other geometries may support cutouts, but our map shapes editor only
397
+ // supports polygons currently, so we will need to handle other geometry types
398
+ // here if we start allowing users to draw shapes other than polygon.
399
+ if (exteriorFeature.getGeometry().getType() !== 'Polygon' || innerFeature.getGeometry().getType() !== 'Polygon') {
400
+ throw Error("Inner cutout is only supported by Polygon gemoetry.");
401
+ }
402
+ var featurePolygon = innerFeature.getGeometry();
403
+ var exteriorPolygon = exteriorFeature.getGeometry();
404
+ exteriorFeature.setGeometry(new google.maps.Data.Polygon(__spreadArray(__spreadArray([], __read(exteriorPolygon.getArray())), [
405
+ featurePolygon.getAt(0).getArray().reverse()
406
+ ])));
407
+ }
408
+ /**
409
+ * Google maps paths don't always start and stop at the exact same position, so
410
+ * this will fix that for turfjs.
411
+ */
412
+ function fixPathDifferentStartingAndEndingPoint(coordinates) {
413
+ if (coordinates.length <= 1) {
414
+ return;
415
+ }
416
+ var start = coordinates[0];
417
+ var end = coordinates[coordinates.length - 1];
418
+ if (start[0] === end[0] && start[1] === end[1]) {
419
+ return;
420
+ }
421
+ coordinates.push(coordinates[0]);
422
+ }
423
+ function polygonCoordinates(polygon) {
424
+ return polygon.getArray().map(function (linRing) {
425
+ var coords = linRing.getArray().map(function (x) { return [x.lng(), x.lat()]; });
426
+ fixPathDifferentStartingAndEndingPoint(coords);
427
+ return coords;
428
+ });
429
+ }
430
+ function multiPolygonCoordinates(multiPolygon) {
431
+ return multiPolygon.getArray().map(function (x) { return polygonCoordinates(x); });
432
+ }
433
+ function toTurfJsPolygon(polygon) {
434
+ return helpers.polygon(polygonCoordinates(polygon));
435
+ }
436
+ function toTurfJsMultiPolygon(multiPolygon) {
437
+ return helpers.multiPolygon(multiPolygonCoordinates(multiPolygon));
438
+ }
439
+ function toTurfJsFeature(googleFeature) {
440
+ if (googleFeature.getGeometry().getType() === 'Polygon') {
441
+ return toTurfJsPolygon(googleFeature.getGeometry());
442
+ }
443
+ else if (googleFeature.getGeometry().getType() === 'MultiPolygon') {
444
+ return toTurfJsMultiPolygon(googleFeature.getGeometry());
445
+ }
446
+ throw Error("Unexpected geometry.");
447
+ }
448
+ function featureContains(featureA, featureB) {
449
+ var polygonA = toTurfJsFeature(featureA);
450
+ var polygonB = toTurfJsFeature(featureB);
451
+ return booleanContains__default["default"](polygonA, polygonB);
452
+ }
453
+ function createDataFeatureFromPolygon(polygon) {
454
+ var arr = polygon.getPath().getArray();
455
+ return new google.maps.Data.Feature({
456
+ geometry: new google.maps.Data.Polygon([arr])
457
+ });
458
+ }
459
+ function getBoundsWithAllFeatures(data) {
460
+ var bounds = new google.maps.LatLngBounds();
461
+ data.forEach(function (feature) {
462
+ var geometry = feature.getGeometry();
463
+ geometry.forEachLatLng(function (latLng) {
464
+ bounds.extend(latLng);
465
+ });
466
+ });
467
+ return bounds;
468
+ }
469
+ function getFeatureBounds(feature) {
470
+ var bounds = new google.maps.LatLngBounds();
471
+ var geometry = feature.getGeometry();
472
+ geometry.forEachLatLng(function (latLng) {
473
+ bounds.extend(latLng);
474
+ });
475
+ return bounds;
476
+ }
477
+ function getFeatureCenter(feature) {
478
+ return getFeatureBounds(feature).getCenter();
479
+ }
480
+ function removeAllFeatures(data) {
481
+ data.forEach(function (f) { return data.remove(f); });
482
+ }
483
+ function getFeaturesCount(data) {
484
+ var count = 0;
485
+ data.forEach(function () { return count++; });
486
+ return count;
487
+ }
488
+ /**
489
+ * NOTE: Original events are not emitted, because filtering may omit events.
490
+ */
491
+ function createFeatureChangeObservable(data, ngZone) {
492
+ return new rxjs.Observable(function (subscriber) {
493
+ var listeners = [];
494
+ ngZone.runOutsideAngular(function () {
495
+ listeners.push(data.addListener('setgeometry', function (event) {
496
+ ngZone.run(function () { subscriber.next(undefined); });
497
+ }));
498
+ listeners.push(data.addListener('addfeature', function (event) {
499
+ ngZone.run(function () { subscriber.next(undefined); });
500
+ }));
501
+ listeners.push(data.addListener('removefeature', function (event) {
502
+ ngZone.run(function () { subscriber.next(undefined); });
503
+ }));
504
+ listeners.push(data.addListener('setproperty', function (event) {
505
+ if (!isAppFeatureProperty(event.name)) {
506
+ ngZone.run(function () { subscriber.next(undefined); });
507
+ }
508
+ }));
509
+ listeners.push(data.addListener('removeproperty', function (event) {
510
+ if (!isAppFeatureProperty(event.name)) {
511
+ ngZone.run(function () { subscriber.next(undefined); });
512
+ }
513
+ }));
514
+ });
515
+ return function () {
516
+ listeners.forEach(google.maps.event.removeListener);
517
+ };
518
+ });
519
+ }
520
+
521
+ // TODO: Close on map losing focus.
522
+ var GoogleMapsContextMenu = /** @class */ (function () {
523
+ function GoogleMapsContextMenu(_map, _menu, _position, _vcr, _ngZone, _data, _feature) {
524
+ var _this = this;
525
+ this._map = _map;
526
+ this._menu = _menu;
527
+ this._vcr = _vcr;
528
+ this._ngZone = _ngZone;
529
+ this._data = _data;
530
+ this._feature = _feature;
531
+ var tplRef = this._menu.templateRef;
532
+ if (tplRef === undefined || tplRef === null) {
533
+ throw Error("Menu template is not defined.");
534
+ }
535
+ var ref = this._vcr.createEmbeddedView(tplRef);
536
+ ref.detectChanges();
537
+ var listeners = [];
538
+ var ngUnsubscribe = new rxjs.Subject();
539
+ // TODO: Fix the initial focus. setTimeout avoids the wrong contextmenu
540
+ // getting triggered, but the first item flashes and looks off this way.
541
+ setTimeout(function () {
542
+ _this._menu.focusFirstItem('program');
543
+ });
544
+ this._menu.closed.pipe(operators.takeUntil(ngUnsubscribe)).subscribe(function (v) {
545
+ _this.close();
546
+ });
547
+ rxjs.fromEvent(document, 'keydown').pipe(operators.takeUntil(ngUnsubscribe)).subscribe(function (event) {
548
+ if (event.keyCode === keycodes.ESCAPE) {
549
+ _this.close();
550
+ }
551
+ });
552
+ var __cleanup = function () { return _this._cleanupFn(); };
553
+ var GoogleMapsContextMenuOverlayView = /** @class */ (function (_super) {
554
+ __extends(GoogleMapsContextMenuOverlayView, _super);
555
+ function GoogleMapsContextMenuOverlayView(position, content) {
556
+ var _this = _super.call(this) || this;
557
+ _this.position = position;
558
+ _this.position = position;
559
+ _this.containerDiv = document.createElement('div');
560
+ _this.containerDiv.style.cursor = 'auto';
561
+ _this.containerDiv.style.height = '0',
562
+ _this.containerDiv.style.position = 'absolute';
563
+ _this.containerDiv.appendChild(content);
564
+ // Optionally stop clicks, etc., from bubbling up to the map.
565
+ GoogleMapsContextMenuOverlayView.preventMapHitsAndGesturesFrom(_this.containerDiv);
566
+ return _this;
567
+ }
568
+ /** Called when the view is added to the map. */
569
+ GoogleMapsContextMenuOverlayView.prototype.onAdd = function () {
570
+ // tslint:disable-next-line: no-non-null-assertion
571
+ this.getPanes().floatPane.appendChild(this.containerDiv);
572
+ };
573
+ /** Called when the view is removed from the map. */
574
+ GoogleMapsContextMenuOverlayView.prototype.onRemove = function () {
575
+ if (this.containerDiv.parentElement) {
576
+ this.containerDiv.parentElement.removeChild(this.containerDiv);
577
+ }
578
+ __cleanup();
579
+ };
580
+ /** Called each frame when the view needs to draw itself. */
581
+ GoogleMapsContextMenuOverlayView.prototype.draw = function () {
582
+ // tslint:disable-next-line: no-non-null-assertion
583
+ var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
584
+ // Hide the popup when it is far out of view.
585
+ var display = Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000
586
+ ? 'block'
587
+ : 'none';
588
+ if (display === 'block') {
589
+ this.containerDiv.style.left = divPosition.x + 'px';
590
+ this.containerDiv.style.top = divPosition.y + 'px';
591
+ }
592
+ if (this.containerDiv.style.display !== display) {
593
+ this.containerDiv.style.display = display;
594
+ }
595
+ };
596
+ return GoogleMapsContextMenuOverlayView;
597
+ }(google.maps.OverlayView));
598
+ this._overlayView = new GoogleMapsContextMenuOverlayView(_position, ref.rootNodes[0]);
599
+ this._overlayView.setMap(this._map);
600
+ this._ngZone.runOutsideAngular(function () {
601
+ listeners.push(_this._data.addListener('removefeature', function (event) {
602
+ if (event.feature === _this._feature) {
603
+ _this._ngZone.run(function () { _this.close(); });
604
+ }
605
+ }));
606
+ listeners.push(_this._data.addListener('setproperty', function (event) {
607
+ if (event.feature === _this._feature && !isFeatureSelected(_this._feature)) {
608
+ _this._ngZone.run(function () { _this.close(); });
609
+ }
610
+ }));
611
+ listeners.push(_this._data.addListener('removeproperty', function (event) {
612
+ if (event.feature === _this._feature && !isFeatureSelected(_this._feature)) {
613
+ _this._ngZone.run(function () { _this.close(); });
614
+ }
615
+ }));
616
+ listeners.push(_this._map.addListener('click', function (event) {
617
+ _this._ngZone.run(function () { _this.close(); });
618
+ }));
619
+ listeners.push(_this._data.addListener('click', function (event) {
620
+ _this._ngZone.run(function () { _this.close(); });
621
+ }));
622
+ });
623
+ this._cleanupFn = function () {
624
+ ngUnsubscribe.next();
625
+ ngUnsubscribe.complete();
626
+ listeners.forEach(google.maps.event.removeListener);
627
+ };
628
+ }
629
+ GoogleMapsContextMenu.prototype.close = function () {
630
+ this._overlayView.setMap(null);
631
+ };
632
+ return GoogleMapsContextMenu;
633
+ }());
634
+
635
+ exports.MapValueSource = void 0;
636
+ (function (MapValueSource) {
637
+ MapValueSource["Input"] = "input";
638
+ MapValueSource["FeatureChange"] = "featurechange";
639
+ })(exports.MapValueSource || (exports.MapValueSource = {}));
640
+ var MapValueManagerService = /** @class */ (function () {
641
+ function MapValueManagerService() {
642
+ this._valueChangedSubject = new rxjs.Subject();
643
+ this.valueChanged = this._valueChangedSubject.asObservable();
644
+ }
645
+ MapValueManagerService.prototype.setValue = function (value, source) {
646
+ if (value === this._value) {
647
+ return false;
648
+ }
649
+ if (value === null || value === undefined) {
650
+ this._value = value;
651
+ var _change = {
652
+ source: source,
653
+ value: this._value,
654
+ };
655
+ this._valueChangedSubject.next(_change);
656
+ return true;
657
+ }
658
+ if (JSON.stringify(value) === JSON.stringify(this._value)) {
659
+ return true;
660
+ }
661
+ // TODO: Validate object is valid geojson.
662
+ this._value = value;
663
+ var change = {
664
+ source: source,
665
+ value: this._value,
666
+ };
667
+ this._valueChangedSubject.next(change);
668
+ return true;
669
+ };
670
+ Object.defineProperty(MapValueManagerService.prototype, "value", {
671
+ get: function () {
672
+ return this._value;
673
+ },
674
+ enumerable: false,
675
+ configurable: true
676
+ });
677
+ return MapValueManagerService;
678
+ }());
679
+ MapValueManagerService.decorators = [
680
+ { type: core.Injectable }
681
+ ];
682
+ MapValueManagerService.ctorParameters = function () { return []; };
683
+
684
+ var DEFAULT_POLYGON_OPTIONS = {
685
+ clickable: true,
686
+ draggable: true,
687
+ editable: true,
688
+ // fillColor: 'rgba(60,150,60,1)',
689
+ // strokeColor: 'rgba(155,255,0,1)'
690
+ };
691
+ var DEFAULT_DRAWING_MANAGER_OPTIONS = function () { return ({
692
+ drawingControl: true,
693
+ drawingControlOptions: {
694
+ drawingModes: [
695
+ google.maps.drawing.OverlayType.POLYGON
696
+ ]
697
+ },
698
+ polygonOptions: DEFAULT_POLYGON_OPTIONS,
699
+ drawingMode: null
700
+ }); };
701
+ var ɵ0 = DEFAULT_DRAWING_MANAGER_OPTIONS;
702
+ var FEATURE_STYLE_OPTIONS_DEFAULT = {
703
+ clickable: true,
704
+ visible: true,
705
+ // zIndex?: number;
706
+ // cursor?: string;
707
+ draggable: false,
708
+ editable: false,
709
+ fillColor: 'teal',
710
+ fillOpacity: 0.3,
711
+ strokeColor: 'blue',
712
+ strokeOpacity: 1,
713
+ strokeWeight: 2,
714
+ };
715
+ var FEATURE_STYLE_OPTIONS_SELECTED = Object.assign(Object.assign({}, FEATURE_STYLE_OPTIONS_DEFAULT), { draggable: true, editable: true, fillColor: 'green', fillOpacity: 0.7, strokeColor: 'limegreen', strokeOpacity: 1, strokeWeight: 2 });
716
+ var GoogleMapsService = /** @class */ (function () {
717
+ function GoogleMapsService(_mapValueManager, _ngZone, _vcr) {
718
+ this._mapValueManager = _mapValueManager;
719
+ this._ngZone = _ngZone;
720
+ this._vcr = _vcr;
721
+ this._ngUnsubscribe = new rxjs.Subject();
722
+ this._mapReadySubject = new rxjs.BehaviorSubject(false);
723
+ this._featureContextMenu = null;
724
+ this._activeContextMenu = null;
725
+ this._allowDrawingHoleInPolygon = false;
726
+ this.mapReady$ = this._mapReadySubject.asObservable();
727
+ }
728
+ Object.defineProperty(GoogleMapsService.prototype, "mapReady", {
729
+ get: function () { return this._mapReadySubject.value; },
730
+ enumerable: false,
731
+ configurable: true
732
+ });
733
+ GoogleMapsService.prototype.ngOnDestroy = function () {
734
+ this._ngUnsubscribe.next();
735
+ this._ngUnsubscribe.complete();
736
+ };
737
+ GoogleMapsService.prototype.setMap = function (map) {
738
+ this.googleMap = map;
739
+ this._mapReadySubject.next(true);
740
+ this._initDrawingManager();
741
+ this._initFeatureStyling();
742
+ this._initFeatureChangeListeners();
743
+ };
744
+ GoogleMapsService.prototype.setBaseLatLng = function (lat, lng) {
745
+ this._baseLatLng = { lat: lat, lng: lng };
746
+ };
747
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
748
+ GoogleMapsService.prototype.setFeatureContextMenu = function (menu) {
749
+ this._featureContextMenu = menu;
750
+ };
751
+ GoogleMapsService.prototype.getDiv = function () {
752
+ this._assertInitialized();
753
+ return this.googleMap.getDiv();
754
+ };
755
+ GoogleMapsService.prototype.fitBounds = function (bounds, padding) {
756
+ this._assertInitialized();
757
+ this.googleMap.fitBounds(bounds, padding);
758
+ };
759
+ /**
760
+ * Iterates the map's features and removes any that are selected.
761
+ */
762
+ GoogleMapsService.prototype.deleteSelection = function () {
763
+ this._assertInitialized();
764
+ var mapData = this.googleMap.data;
765
+ mapData.forEach(function (f) {
766
+ if (isFeatureSelected(f)) {
767
+ mapData.remove(f);
768
+ }
769
+ });
770
+ };
771
+ /**
772
+ * Stops the current drawing.
773
+ */
774
+ GoogleMapsService.prototype.stopDrawing = function () {
775
+ var _this = this;
776
+ this._ngZone.runOutsideAngular(function () {
777
+ if (utils.isNullOrUndefined(_this._drawingManager) || _this._drawingManager.getDrawingMode() === null) {
778
+ return;
779
+ }
780
+ // Listening for the completion event of the overlay currently being drawn
781
+ // and removing it. I haven't found a way to cancel the current drawing,
782
+ // without this hack that assumes our listeners will not run into a race
783
+ // condition.
784
+ var listener = google.maps.event.addListener(_this._drawingManager, 'overlaycomplete', function (event) {
785
+ event.overlay.setMap(null);
786
+ listener.remove();
787
+ });
788
+ // To fake canceling the current drawing, without disabling the drawing
789
+ // mode, the drawin mode is being unset then immediately set back. When
790
+ // the mode is unset the 'overlaycomplete' event will fire, which will
791
+ // give a reference to the current overlay to remove, then it is set back
792
+ // to the mode the user was using. To the user is should just seem like
793
+ // the current drawing was canceled and they can start drawing again.
794
+ var mode = _this._drawingManager.getDrawingMode();
795
+ _this._drawingManager.setDrawingMode(null);
796
+ _this._drawingManager.setDrawingMode(mode);
797
+ // 'overlaycomplete' should fire immediately, unless an overlay hadn't
798
+ // started drawing. This timeout will make sure the listener gets removed.
799
+ setTimeout(function () {
800
+ listener.remove();
801
+ });
802
+ });
803
+ };
804
+ GoogleMapsService.prototype._initDrawingManager = function () {
805
+ var _this = this;
806
+ if (utils.notNullOrUndefined(this._drawingManager)) {
807
+ throw Error("DrawingManager is already initialized.");
808
+ }
809
+ this._assertInitialized();
810
+ var options = DEFAULT_DRAWING_MANAGER_OPTIONS();
811
+ var drawingManager = new google.maps.drawing.DrawingManager(options);
812
+ drawingManager.setMap(this.googleMap);
813
+ this._drawingManager = drawingManager;
814
+ this._drawingManager.addListener('drawingmode_changed', function (event) {
815
+ var _a;
816
+ if (((_a = _this._drawingManager) === null || _a === void 0 ? void 0 : _a.getDrawingMode()) !== null) {
817
+ _this._assertInitialized();
818
+ _this.googleMap.data.forEach(function (f) {
819
+ if (isFeatureSelected(f)) {
820
+ setFeatureSelected(f, false);
821
+ }
822
+ });
823
+ }
824
+ });
825
+ };
826
+ GoogleMapsService.prototype.addControl = function (element, position) {
827
+ this._assertInitialized();
828
+ this.googleMap.controls[position].push(element);
829
+ };
830
+ GoogleMapsService.prototype.setData = function (data) {
831
+ return __awaiter(this, void 0, void 0, function () {
832
+ return __generator(this, function (_b) {
833
+ this._assertInitialized();
834
+ removeAllFeatures(this.googleMap.data);
835
+ this.googleMap.data.addGeoJson(data);
836
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
837
+ return [2 /*return*/];
838
+ });
839
+ });
840
+ };
841
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
842
+ GoogleMapsService.prototype.reCenterOnFeatures = function () {
843
+ this._assertInitialized();
844
+ if (getFeaturesCount(this.googleMap.data) === 0) {
845
+ if (!this._baseLatLng) {
846
+ return;
847
+ }
848
+ this.googleMap.panTo(this._baseLatLng);
849
+ return;
850
+ }
851
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
852
+ // TODO: Fix to pan to center. Currently fitBounds results in the expected
853
+ // result, but pantToBounds animates.
854
+ // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))
855
+ };
856
+ GoogleMapsService.prototype.allowDrawingHoleInPolygon = function (allow) {
857
+ this._allowDrawingHoleInPolygon = allow;
858
+ };
859
+ GoogleMapsService.prototype.setFileInputHandler = function (handler) {
860
+ this._fileInputHandler;
861
+ };
862
+ GoogleMapsService.prototype.getFileInputHandler = function () {
863
+ return this._fileInputHandler;
864
+ };
865
+ GoogleMapsService.prototype._initFeatureStyling = function () {
866
+ var _this = this;
867
+ this._assertInitialized();
868
+ // Disable any selection when clicking the map.
869
+ //
870
+ // TODO: There may be a better way to do this that would be more accurate or
871
+ // additional events that should be listened to, such as the disabling
872
+ // selection when the map looses focus.
873
+ this.googleMap.addListener('click', function (even) {
874
+ _this._assertInitialized();
875
+ _this.googleMap.data.forEach(function (f) { return setFeatureSelected(f, false); });
876
+ });
877
+ // Determine what the style of the features are.
878
+ this.googleMap.data.setStyle(function (feature) {
879
+ if (isFeatureSelected(feature)) {
880
+ return FEATURE_STYLE_OPTIONS_SELECTED;
881
+ }
882
+ return FEATURE_STYLE_OPTIONS_DEFAULT;
883
+ });
884
+ // Select a feature when clicked.
885
+ this.googleMap.data.addListener('click', function (event) {
886
+ _this._assertInitialized();
887
+ setFeatureSelected(event.feature, true);
888
+ _this.googleMap.data.forEach(function (f) {
889
+ if (f !== event.feature && isFeatureSelected(f)) {
890
+ setFeatureSelected(f, false);
891
+ }
892
+ });
893
+ });
894
+ // Set a style on hovered features that can be selected.
895
+ this.googleMap.data.addListener('mouseover', function (event) {
896
+ _this._assertInitialized();
897
+ _this.googleMap.data.revertStyle();
898
+ if (!_this.isDrawing() && !isFeatureSelected(event.feature)) {
899
+ _this.googleMap.data.overrideStyle(event.feature, { strokeWeight: 4 });
900
+ }
901
+ });
902
+ // Remove any hover styles when mouse moves away.
903
+ this.googleMap.data.addListener('mouseout', function (event) {
904
+ _this._assertInitialized();
905
+ _this.googleMap.data.revertStyle();
906
+ });
907
+ };
908
+ GoogleMapsService.prototype._initFeatureChangeListeners = function () {
909
+ var _this = this;
910
+ this._assertInitialized();
911
+ createFeatureChangeObservable(this.googleMap.data, this._ngZone).pipe(operators.switchMap(function () { return rxjs.from(_this.getGeoJson()).pipe(operators.tap(function (geoJson) { return _this._mapValueManager.setValue(geoJson, exports.MapValueSource.FeatureChange); })); }), operators.takeUntil(this._ngUnsubscribe)).subscribe();
912
+ this.googleMap.data.addListener('contextmenu', function (event) {
913
+ if (!isFeatureSelected(event.feature)) {
914
+ return;
915
+ }
916
+ _this._openContextMenuForFeature(event.feature, event.latLng);
917
+ });
918
+ if (utils.notNullOrUndefined(this._drawingManager)) {
919
+ google.maps.event.addListener(this._drawingManager, 'polygoncomplete', function (polygon) {
920
+ var _a;
921
+ // The DrawingManager doesn't seem to have a way to access the overlays,
922
+ // so if the map is not set then it shouldn'y be considered a successful
923
+ // completion. I am canceling the active drawing by disabling drawing
924
+ // mode and setting the map null in the 'overlaycomplete' event, which
925
+ // fires before the 'polygoncomplete' event.
926
+ if (utils.isNullOrUndefined(polygon.getMap())) {
927
+ return;
928
+ }
929
+ _this._assertInitialized();
930
+ // Create a map feature of the drawn polygon.
931
+ var feature = createDataFeatureFromPolygon(polygon);
932
+ // Remove the drawn polygon.
933
+ polygon.setMap(null);
934
+ // Stop drawing.
935
+ (_a = _this._drawingManager) === null || _a === void 0 ? void 0 : _a.setDrawingMode(null);
936
+ // Check if the feature should be used as a cutout to an existing
937
+ // feature or added as it's own feature.
938
+ var exteriorPolygonFeature = _this._allowDrawingHoleInPolygon
939
+ ? getPossibleExteriorFeature(_this.googleMap.data, feature)
940
+ : undefined;
941
+ if (exteriorPolygonFeature) {
942
+ addInnerFeatureCutoutToExteriorFeature(exteriorPolygonFeature, feature);
943
+ setFeatureSelected(exteriorPolygonFeature, true);
944
+ }
945
+ else {
946
+ _this.googleMap.data.add(feature);
947
+ setFeatureSelected(feature, true);
948
+ }
949
+ });
950
+ }
951
+ };
952
+ GoogleMapsService.prototype.isDrawing = function () {
953
+ if (utils.isNullOrUndefined(this._drawingManager)) {
954
+ return true;
955
+ }
956
+ return this._drawingManager.getDrawingMode() !== null;
957
+ };
958
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
959
+ GoogleMapsService.prototype.hasSelectedFeature = function () {
960
+ this._assertInitialized();
961
+ var isSelected = false;
962
+ this.googleMap.data.forEach(function (f) {
963
+ if (isFeatureSelected(f)) {
964
+ isSelected = true;
965
+ }
966
+ });
967
+ return isSelected;
968
+ };
969
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
970
+ GoogleMapsService.prototype.getSelectedFeature = function () {
971
+ this._assertInitialized();
972
+ var feature = null;
973
+ this.googleMap.data.forEach(function (f) {
974
+ if (isFeatureSelected(f)) {
975
+ feature = f;
976
+ }
977
+ });
978
+ return feature;
979
+ };
980
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
981
+ GoogleMapsService.prototype.openContextMenu = function () {
982
+ var feature = this.getSelectedFeature();
983
+ if (feature) {
984
+ this._openContextMenuForFeature(feature);
985
+ }
986
+ };
987
+ // TODO: Refactor out of the service meant to just wrap the google maps api.
988
+ GoogleMapsService.prototype._openContextMenuForFeature = function (feature, position) {
989
+ if (this._activeContextMenu) {
990
+ this._activeContextMenu.close();
991
+ this._activeContextMenu = null;
992
+ }
993
+ this._assertInitialized();
994
+ var _position = position;
995
+ if (!_position) {
996
+ _position = getFeatureCenter(feature);
997
+ }
998
+ if (this._featureContextMenu) {
999
+ this._activeContextMenu = new GoogleMapsContextMenu(this.googleMap, this._featureContextMenu, _position, this._vcr, this._ngZone, this.googleMap.data, feature);
1000
+ }
1001
+ };
1002
+ GoogleMapsService.prototype.getGeoJson = function (removeAppProperties) {
1003
+ var _this = this;
1004
+ if (removeAppProperties === void 0) { removeAppProperties = true; }
1005
+ return new Promise(function (resolve, reject) {
1006
+ _this._assertInitialized();
1007
+ _this.googleMap.data.toGeoJson(function (f) {
1008
+ if (removeAppProperties) {
1009
+ stripAppFeaturePropertiesFromJson(f);
1010
+ }
1011
+ resolve(f);
1012
+ });
1013
+ });
1014
+ };
1015
+ /** Asserts that the map has been initialized. */
1016
+ GoogleMapsService.prototype._assertInitialized = function () {
1017
+ if (!this.googleMap && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1018
+ throw Error('Cannot access Google Map information before the API has been initialized. ' +
1019
+ 'Please wait for the API to load before trying to interact with it.');
1020
+ }
1021
+ };
1022
+ return GoogleMapsService;
1023
+ }());
1024
+ GoogleMapsService.decorators = [
1025
+ { type: core.Injectable }
1026
+ ];
1027
+ GoogleMapsService.ctorParameters = function () { return [
1028
+ { type: MapValueManagerService },
1029
+ { type: core.NgZone },
1030
+ { type: core.ViewContainerRef }
1031
+ ]; };
1032
+
1033
+ var MAP_CONTROLS_SERVICE = new core.InjectionToken('MAP_CONTROLS_SERVICE');
1034
+ var MAP_CONTROL_DATA = new core.InjectionToken('MAP_CONTROL_DATA');
1035
+
1036
+ var MapControlRef = /** @class */ (function () {
1037
+ function MapControlRef(_googleMaps, _componentFactoryResolver, _injector, _controlDef) {
1038
+ var _a;
1039
+ this._googleMaps = _googleMaps;
1040
+ this._componentFactoryResolver = _componentFactoryResolver;
1041
+ this._injector = _injector;
1042
+ this._controlDef = _controlDef;
1043
+ this._destroyedSubject = new rxjs.Subject();
1044
+ this.destroyed = this._destroyedSubject.asObservable();
1045
+ var component = this._controlDef.component;
1046
+ var factory = this._componentFactoryResolver.resolveComponentFactory(component);
1047
+ var providers = [];
1048
+ if (this._controlDef.data) {
1049
+ providers.push({
1050
+ provide: MAP_CONTROL_DATA,
1051
+ useValue: this._controlDef.data
1052
+ });
1053
+ }
1054
+ var injector = core.Injector.create({
1055
+ providers: providers,
1056
+ parent: this._injector,
1057
+ });
1058
+ this._componentRef = factory.create(injector);
1059
+ this._componentRef.changeDetectorRef.detectChanges();
1060
+ var position = (_a = this._controlDef.position) !== null && _a !== void 0 ? _a : google.maps.ControlPosition.LEFT_BOTTOM;
1061
+ this._googleMaps.addControl(this._componentRef.location.nativeElement, position);
1062
+ this._addedAtPosition = position;
1063
+ }
1064
+ MapControlRef.prototype.destroy = function () {
1065
+ var _this = this;
1066
+ var googleMaps = this._googleMaps.googleMap;
1067
+ if (googleMaps !== undefined) {
1068
+ var idx_1 = -1;
1069
+ googleMaps.controls[this._addedAtPosition].forEach(function (elem, index) {
1070
+ if (elem === _this._componentRef.location.nativeElement) {
1071
+ idx_1 = index;
1072
+ }
1073
+ });
1074
+ if (idx_1 === -1) {
1075
+ throw Error("Unable to destroy control. Control not found.");
1076
+ }
1077
+ googleMaps.controls[this._addedAtPosition].removeAt(idx_1);
1078
+ }
1079
+ this._componentRef.destroy();
1080
+ this._destroyedSubject.next();
1081
+ this._destroyedSubject.complete();
1082
+ };
1083
+ return MapControlRef;
1084
+ }());
1085
+ var GoogleMapsControlsService = /** @class */ (function () {
1086
+ function GoogleMapsControlsService(_googleMaps, _componentFactoryResolver, _injector) {
1087
+ this._googleMaps = _googleMaps;
1088
+ this._componentFactoryResolver = _componentFactoryResolver;
1089
+ this._injector = _injector;
1090
+ }
1091
+ GoogleMapsControlsService.prototype.add = function (control) {
1092
+ return new MapControlRef(this._googleMaps, this._componentFactoryResolver, this._injector, control);
1093
+ };
1094
+ return GoogleMapsControlsService;
1095
+ }());
1096
+ GoogleMapsControlsService.decorators = [
1097
+ { type: core.Injectable }
1098
+ ];
1099
+ GoogleMapsControlsService.ctorParameters = function () { return [
1100
+ { type: GoogleMapsService },
1101
+ { type: core.ComponentFactoryResolver },
1102
+ { type: core.Injector }
1103
+ ]; };
1104
+
1105
+ /**
1106
+ *
1107
+ */
1108
+ var TheSeamGoogleMapsRecenterButtonControlComponent = /** @class */ (function () {
1109
+ function TheSeamGoogleMapsRecenterButtonControlComponent(_googleMaps, _data) {
1110
+ this._googleMaps = _googleMaps;
1111
+ this._ngUnsubscribe = new rxjs.Subject();
1112
+ this._listeners = [];
1113
+ if (_data) {
1114
+ if (_data.hasOwnProperty('label')) {
1115
+ this.label = _data.label;
1116
+ }
1117
+ if (_data.hasOwnProperty('icon')) {
1118
+ this.icon = _data.icon;
1119
+ }
1120
+ }
1121
+ }
1122
+ TheSeamGoogleMapsRecenterButtonControlComponent.prototype._onClick = function (event) {
1123
+ this._googleMaps.reCenterOnFeatures();
1124
+ };
1125
+ /** @ignore */
1126
+ TheSeamGoogleMapsRecenterButtonControlComponent.prototype.ngOnDestroy = function () {
1127
+ this._listeners.forEach(function (l) { return l(); });
1128
+ this._ngUnsubscribe.next();
1129
+ this._ngUnsubscribe.complete();
1130
+ };
1131
+ return TheSeamGoogleMapsRecenterButtonControlComponent;
1132
+ }());
1133
+ TheSeamGoogleMapsRecenterButtonControlComponent.decorators = [
1134
+ { type: core.Component, args: [{
1135
+ // tslint:disable-next-line: component-selector
1136
+ selector: 'button[seam-google-maps-recenter-button-control]',
1137
+ template: "<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n",
1138
+ host: {
1139
+ '[attr.draggable]': 'false',
1140
+ '[attr.aria-label]': 'label',
1141
+ '[attr.title]': 'label',
1142
+ 'type': 'button',
1143
+ 'class': 'gmnoprint gm-control-active'
1144
+ },
1145
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1146
+ styles: [":host{background:none white;border:0px;margin:10px;padding:11px;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:absolute;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:2px;height:40px;width:40px;box-shadow:#0000004d 0 1px 4px -1px;overflow:hidden}\n"]
1147
+ },] }
1148
+ ];
1149
+ TheSeamGoogleMapsRecenterButtonControlComponent.ctorParameters = function () { return [
1150
+ { type: GoogleMapsService },
1151
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAP_CONTROL_DATA,] }] }
1152
+ ]; };
1153
+ TheSeamGoogleMapsRecenterButtonControlComponent.propDecorators = {
1154
+ label: [{ type: core.Input }],
1155
+ icon: [{ type: core.Input }],
1156
+ _onClick: [{ type: core.HostListener, args: ['click', ['event'],] }]
1157
+ };
1158
+
1159
+ /**
1160
+ *
1161
+ */
1162
+ var TheSeamGoogleMapsUploadButtonControlComponent = /** @class */ (function () {
1163
+ function TheSeamGoogleMapsUploadButtonControlComponent(_elementRef, _mapValueManager, _renderer, _googleMaps, _data) {
1164
+ this._elementRef = _elementRef;
1165
+ this._mapValueManager = _mapValueManager;
1166
+ this._renderer = _renderer;
1167
+ this._googleMaps = _googleMaps;
1168
+ this._ngUnsubscribe = new rxjs.Subject();
1169
+ this._listeners = [];
1170
+ if (_data) {
1171
+ if (_data.hasOwnProperty('label')) {
1172
+ this.label = _data.label;
1173
+ }
1174
+ if (_data.hasOwnProperty('icon')) {
1175
+ this.icon = _data.icon;
1176
+ }
1177
+ }
1178
+ this._fileInputElement = this._createHiddenInput();
1179
+ this._renderer.appendChild(this._elementRef.nativeElement, this._fileInputElement);
1180
+ }
1181
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._onClick = function (event) {
1182
+ this._fileInputElement.click();
1183
+ };
1184
+ /** @ignore */
1185
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype.ngOnDestroy = function () {
1186
+ this._listeners.forEach(function (l) { return l(); });
1187
+ this._ngUnsubscribe.next();
1188
+ this._ngUnsubscribe.complete();
1189
+ };
1190
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._getFile = function (throwIfInvalidFiles) {
1191
+ if (throwIfInvalidFiles === void 0) { throwIfInvalidFiles = true; }
1192
+ var files = this._fileInputElement.files;
1193
+ if (files === null || files.length === 0) {
1194
+ return null;
1195
+ }
1196
+ if (throwIfInvalidFiles) {
1197
+ if (files.length > 1) {
1198
+ throw Error("Only one file can be imported at a time.");
1199
+ }
1200
+ }
1201
+ return files[0];
1202
+ };
1203
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._importFile = function (file) {
1204
+ return __awaiter(this, void 0, void 0, function () {
1205
+ var json;
1206
+ return __generator(this, function (_a) {
1207
+ switch (_a.label) {
1208
+ case 0: return [4 /*yield*/, utils.readGeoFile(file)];
1209
+ case 1:
1210
+ json = _a.sent();
1211
+ this._mapValueManager.setValue(json, exports.MapValueSource.Input);
1212
+ this._resetInput();
1213
+ return [2 /*return*/];
1214
+ }
1215
+ });
1216
+ });
1217
+ };
1218
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._createHiddenInput = function () {
1219
+ var _this = this;
1220
+ var fileInputElement = this._renderer.createElement('input');
1221
+ this._renderer.setAttribute(fileInputElement, 'type', 'file');
1222
+ this._renderer.setAttribute(fileInputElement, 'hidden', '');
1223
+ this._renderer.setAttribute(fileInputElement, 'accept', '.json,.geojson,.shp,.zip');
1224
+ this._listeners.push(this._renderer.listen(fileInputElement, 'change', function (event) {
1225
+ var file = _this._getFile();
1226
+ if (file === null) {
1227
+ return;
1228
+ }
1229
+ var fileImportHandler = _this._googleMaps.getFileInputHandler();
1230
+ if (fileImportHandler) {
1231
+ fileImportHandler(file);
1232
+ }
1233
+ else {
1234
+ _this._importFile(file);
1235
+ }
1236
+ }));
1237
+ return fileInputElement;
1238
+ };
1239
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._createTemporaryFormElement = function () {
1240
+ return this._renderer.createElement('form');
1241
+ };
1242
+ /**
1243
+ * Reset input element, so that the same file can be added again.
1244
+ */
1245
+ TheSeamGoogleMapsUploadButtonControlComponent.prototype._resetInput = function () {
1246
+ var formElement = this._createTemporaryFormElement();
1247
+ this._renderer.appendChild(formElement, this._fileInputElement);
1248
+ formElement.reset();
1249
+ this._renderer.appendChild(this._elementRef.nativeElement, this._fileInputElement);
1250
+ };
1251
+ return TheSeamGoogleMapsUploadButtonControlComponent;
1252
+ }());
1253
+ TheSeamGoogleMapsUploadButtonControlComponent.decorators = [
1254
+ { type: core.Component, args: [{
1255
+ // tslint:disable-next-line: component-selector
1256
+ selector: 'button[seam-google-maps-upload-button-control]',
1257
+ template: "<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n",
1258
+ host: {
1259
+ '[attr.draggable]': 'false',
1260
+ '[attr.aria-label]': 'label',
1261
+ '[attr.title]': 'label',
1262
+ 'type': 'button',
1263
+ 'class': 'gmnoprint gm-control-active'
1264
+ },
1265
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1266
+ styles: [":host{background:none white;border:0px;margin:10px;padding:11px;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:absolute;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:2px;height:40px;width:40px;box-shadow:#0000004d 0 1px 4px -1px;overflow:hidden}\n"]
1267
+ },] }
1268
+ ];
1269
+ TheSeamGoogleMapsUploadButtonControlComponent.ctorParameters = function () { return [
1270
+ { type: core.ElementRef },
1271
+ { type: MapValueManagerService },
1272
+ { type: core.Renderer2 },
1273
+ { type: GoogleMapsService },
1274
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAP_CONTROL_DATA,] }] }
1275
+ ]; };
1276
+ TheSeamGoogleMapsUploadButtonControlComponent.propDecorators = {
1277
+ label: [{ type: core.Input }],
1278
+ icon: [{ type: core.Input }],
1279
+ _onClick: [{ type: core.HostListener, args: ['click', ['event'],] }]
1280
+ };
1281
+
1282
+ var TheSeamGoogleMapsComponentBase = /** @class */ (function () {
1283
+ function TheSeamGoogleMapsComponentBase(_elementRef) {
1284
+ this._elementRef = _elementRef;
1285
+ }
1286
+ return TheSeamGoogleMapsComponentBase;
1287
+ }());
1288
+ var _TheSeamGoogleMapsMixinBase = core$1.mixinDisabled(TheSeamGoogleMapsComponentBase);
1289
+ /**
1290
+ * A wrapper for googlemap.
1291
+ */
1292
+ var TheSeamGoogleMapsComponent = /** @class */ (function (_super) {
1293
+ __extends(TheSeamGoogleMapsComponent, _super);
1294
+ function TheSeamGoogleMapsComponent(elementRef, _focusMonitor, _googleMaps, _mapValueManager) {
1295
+ var _this = _super.call(this, elementRef) || this;
1296
+ _this._focusMonitor = _focusMonitor;
1297
+ _this._googleMaps = _googleMaps;
1298
+ _this._mapValueManager = _mapValueManager;
1299
+ _this._ngUnsubscribe = new rxjs.Subject();
1300
+ _this._fileUploadControlDef = {
1301
+ component: TheSeamGoogleMapsUploadButtonControlComponent,
1302
+ data: { label: 'Import Geo File', icon: freeSolidSvgIcons.faFileImport },
1303
+ position: 6 /* google.maps.ControlPosition.LEFT_BOTTOM */,
1304
+ };
1305
+ _this._reCenterControlDef = {
1306
+ component: TheSeamGoogleMapsRecenterButtonControlComponent,
1307
+ data: { label: 'Center on Field', icon: freeSolidSvgIcons.faCrosshairs },
1308
+ position: 9 /* google.maps.ControlPosition.RIGHT_BOTTOM */,
1309
+ };
1310
+ _this._focusOrigin = null;
1311
+ /**
1312
+ * Set the tab index to `-1` to allow the root element of the
1313
+ * component to receive `focus` event from javascript, but not get focused by
1314
+ * keyboard navigation.
1315
+ */
1316
+ _this._tabIndex = -1;
1317
+ _this.fileDropEnabled = true;
1318
+ _this.fileUploadControlEnabled = false;
1319
+ _this.fullscreenControlEnabled = true;
1320
+ _this.reCenterControlEnabled = true;
1321
+ _this.mapTypeControlEnabled = true;
1322
+ _this.streetViewControlEnabled = false;
1323
+ _this.allowDrawingHoleInPolygon = false;
1324
+ _this.zoom = 14;
1325
+ _this.longitude = -98.570209;
1326
+ _this.latitude = 37.633814;
1327
+ _this.mapReady = new core.EventEmitter();
1328
+ _this._focusMonitor.monitor(_this._elementRef, true).pipe(operators.tap(function (origin) { return _this._focusOrigin = origin; }), operators.takeUntil(_this._ngUnsubscribe)).subscribe();
1329
+ _this._mapValueManager.valueChanged.pipe(operators.tap(function (change) {
1330
+ if (_this.onChange) {
1331
+ _this.onChange(change.value);
1332
+ }
1333
+ if (_this.onTouched) {
1334
+ _this.onTouched();
1335
+ }
1336
+ }), operators.tap(function (changed) {
1337
+ if (_this._googleMaps.mapReady && changed.source !== exports.MapValueSource.FeatureChange) {
1338
+ _this._googleMaps.setData(changed.value);
1339
+ }
1340
+ }), operators.takeUntil(_this._ngUnsubscribe)).subscribe();
1341
+ _this._googleMaps.setBaseLatLng(_this.latitude, _this.longitude);
1342
+ return _this;
1343
+ }
1344
+ Object.defineProperty(TheSeamGoogleMapsComponent.prototype, "value", {
1345
+ get: function () {
1346
+ return this._mapValueManager.value;
1347
+ },
1348
+ set: function (value) {
1349
+ this._mapValueManager.setValue(value, exports.MapValueSource.Input);
1350
+ },
1351
+ enumerable: false,
1352
+ configurable: true
1353
+ });
1354
+ Object.defineProperty(TheSeamGoogleMapsComponent.prototype, "tabIndex", {
1355
+ get: function () { return this._tabIndex; },
1356
+ set: function (value) { this._tabIndex = coercion.coerceNumberProperty(value); },
1357
+ enumerable: false,
1358
+ configurable: true
1359
+ });
1360
+ Object.defineProperty(TheSeamGoogleMapsComponent.prototype, "fileImportHandler", {
1361
+ set: function (value) {
1362
+ this._googleMaps.setFileInputHandler(value);
1363
+ },
1364
+ enumerable: false,
1365
+ configurable: true
1366
+ });
1367
+ Object.defineProperty(TheSeamGoogleMapsComponent.prototype, "_attrDisabled", {
1368
+ get: function () { return this.disabled || null; },
1369
+ enumerable: false,
1370
+ configurable: true
1371
+ });
1372
+ Object.defineProperty(TheSeamGoogleMapsComponent.prototype, "_attrTabIndex", {
1373
+ get: function () { return this.disabled ? -1 : (this.tabIndex || 0); },
1374
+ enumerable: false,
1375
+ configurable: true
1376
+ });
1377
+ /** @ignore */
1378
+ TheSeamGoogleMapsComponent.prototype.ngOnInit = function () {
1379
+ var _this = this;
1380
+ this._googleMaps.setFeatureContextMenu(this.featureContextMenu);
1381
+ rxjs.fromEvent(window, 'keydown').pipe(operators.tap(function (event) {
1382
+ switch (event.code) {
1383
+ case 'Delete':
1384
+ _this._googleMaps.deleteSelection();
1385
+ event.preventDefault();
1386
+ event.stopPropagation();
1387
+ break;
1388
+ case 'Escape':
1389
+ _this._googleMaps.stopDrawing();
1390
+ event.preventDefault();
1391
+ event.stopPropagation();
1392
+ break;
1393
+ case 'ContextMenu':
1394
+ _this._googleMaps.openContextMenu();
1395
+ event.preventDefault();
1396
+ event.stopPropagation();
1397
+ break;
1398
+ }
1399
+ }), operators.takeUntil(this._ngUnsubscribe)).subscribe();
1400
+ };
1401
+ /** @ignore */
1402
+ TheSeamGoogleMapsComponent.prototype.ngOnDestroy = function () {
1403
+ this._focusMonitor.stopMonitoring(this._elementRef);
1404
+ this._ngUnsubscribe.next();
1405
+ this._ngUnsubscribe.complete();
1406
+ };
1407
+ /** @ignore */
1408
+ TheSeamGoogleMapsComponent.prototype.ngAfterViewInit = function () { };
1409
+ TheSeamGoogleMapsComponent.prototype.ngOnChanges = function (changes) {
1410
+ var updateBase = false;
1411
+ if (changes.hasOwnProperty('latitude')) {
1412
+ this.latitude = changes['latitude'].currentValue;
1413
+ updateBase = true;
1414
+ }
1415
+ if (changes.hasOwnProperty('longitude')) {
1416
+ this.longitude = changes['longitude'].currentValue;
1417
+ updateBase = true;
1418
+ }
1419
+ if (updateBase) {
1420
+ this._googleMaps.setBaseLatLng(this.latitude, this.longitude);
1421
+ }
1422
+ if (changes.hasOwnProperty('allowDrawingHoleInPolygon')) {
1423
+ this._googleMaps.allowDrawingHoleInPolygon(this.allowDrawingHoleInPolygon);
1424
+ }
1425
+ };
1426
+ TheSeamGoogleMapsComponent.prototype.writeValue = function (value) {
1427
+ this.value = value;
1428
+ };
1429
+ TheSeamGoogleMapsComponent.prototype.registerOnChange = function (fn) {
1430
+ this.onChange = fn;
1431
+ };
1432
+ TheSeamGoogleMapsComponent.prototype.registerOnTouched = function (fn) {
1433
+ this.onTouched = fn;
1434
+ };
1435
+ TheSeamGoogleMapsComponent.prototype.setDisabledState = function (isDisabled) {
1436
+ this.disabled = isDisabled;
1437
+ };
1438
+ TheSeamGoogleMapsComponent.prototype.fitBounds = function (bounds, padding) {
1439
+ this._googleMaps.fitBounds(bounds, padding);
1440
+ };
1441
+ TheSeamGoogleMapsComponent.prototype.getGeoJson = function () {
1442
+ return this._googleMaps.getGeoJson();
1443
+ };
1444
+ TheSeamGoogleMapsComponent.prototype.hasFocus = function () {
1445
+ return this._focusOrigin !== null && this._focusOrigin !== undefined;
1446
+ };
1447
+ /** Focuses the button. */
1448
+ TheSeamGoogleMapsComponent.prototype.focus = function () {
1449
+ this._getHostElement().focus();
1450
+ };
1451
+ TheSeamGoogleMapsComponent.prototype._getHostElement = function () {
1452
+ return this._elementRef.nativeElement;
1453
+ };
1454
+ TheSeamGoogleMapsComponent.prototype._onMapReady = function (theMap) {
1455
+ var _a;
1456
+ this._googleMaps.setMap(theMap);
1457
+ this._googleMaps.setData(this._mapValueManager.value);
1458
+ // NOTE: AgmMap has a race condition problem that causes the input latitude,
1459
+ // longitude, and zoom to get ignored, before googlemaps emits
1460
+ // 'center_changed'. This should avoid the issue, until we stop using AgmMap
1461
+ // or upgrade to a more recent version that may not have the issue anymore.
1462
+ this._googleMaps.reCenterOnFeatures();
1463
+ (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.setZoom(this.zoom);
1464
+ };
1465
+ TheSeamGoogleMapsComponent.prototype._onClickDeleteFeature = function () {
1466
+ this._googleMaps.deleteSelection();
1467
+ };
1468
+ return TheSeamGoogleMapsComponent;
1469
+ }(_TheSeamGoogleMapsMixinBase));
1470
+ TheSeamGoogleMapsComponent.decorators = [
1471
+ { type: core.Component, args: [{
1472
+ selector: 'seam-google-maps',
1473
+ template: "<agm-map\n [latitude]=\"latitude\"\n [longitude]=\"longitude\"\n [zoom]=\"zoom\"\n [mapTypeControl]=\"true\"\n mapTypeId=\"hybrid\"\n [streetViewControl]=\"false\"\n (mapReady)=\"_onMapReady($event)\"\n [fullscreenControl]=\"$any(fullscreenControlEnabled)\">\n</agm-map>\n<seam-menu #featureContextMenu>\n <button seamMenuItem (click)=\"_onClickDeleteFeature()\">Delete</button>\n</seam-menu>\n<seam-map-file-drop *ngIf=\"fileDropEnabled\"></seam-map-file-drop>\n\n<seam-map-control *ngIf=\"fileUploadControlEnabled\" [def]=\"_fileUploadControlDef\"></seam-map-control>\n<seam-map-control *ngIf=\"reCenterControlEnabled\" [def]=\"_reCenterControlDef\"></seam-map-control>\n",
1474
+ inputs: [
1475
+ 'disabled'
1476
+ ],
1477
+ providers: [
1478
+ MapValueManagerService,
1479
+ GoogleMapsService,
1480
+ { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },
1481
+ {
1482
+ provide: forms.NG_VALUE_ACCESSOR,
1483
+ // tslint:disable-next-line: no-use-before-declare
1484
+ useExisting: core.forwardRef(function () { return TheSeamGoogleMapsComponent; }),
1485
+ multi: true
1486
+ }
1487
+ ],
1488
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1489
+ exportAs: 'seamGoogleMaps',
1490
+ styles: [":host{display:block;position:relative;height:400px;width:100%}:host.show-focus-border.cdk-focused{outline:0;box-shadow:0 0 0 .2rem #357ebd40}:host.show-focus-border[disabled]{opacity:.65}agm-map{height:inherit;width:inherit}\n"]
1491
+ },] }
1492
+ ];
1493
+ TheSeamGoogleMapsComponent.ctorParameters = function () { return [
1494
+ { type: core.ElementRef },
1495
+ { type: a11y.FocusMonitor },
1496
+ { type: GoogleMapsService },
1497
+ { type: MapValueManagerService }
1498
+ ]; };
1499
+ TheSeamGoogleMapsComponent.propDecorators = {
1500
+ value: [{ type: core.Input }],
1501
+ tabIndex: [{ type: core.Input }],
1502
+ fileDropEnabled: [{ type: core.Input }],
1503
+ fileUploadControlEnabled: [{ type: core.Input }],
1504
+ fullscreenControlEnabled: [{ type: core.Input }],
1505
+ reCenterControlEnabled: [{ type: core.Input }],
1506
+ mapTypeControlEnabled: [{ type: core.Input }],
1507
+ streetViewControlEnabled: [{ type: core.Input }],
1508
+ allowDrawingHoleInPolygon: [{ type: core.Input }],
1509
+ fileImportHandler: [{ type: core.Input }],
1510
+ _attrDisabled: [{ type: core.HostBinding, args: ['attr.disabled',] }],
1511
+ _attrTabIndex: [{ type: core.HostBinding, args: ['attr.tabindex',] }],
1512
+ zoom: [{ type: core.Input }],
1513
+ longitude: [{ type: core.Input }],
1514
+ latitude: [{ type: core.Input }],
1515
+ mapReady: [{ type: core.Output }],
1516
+ agmMap: [{ type: core.ViewChild, args: [core$2.AgmMap, { static: true },] }],
1517
+ featureContextMenu: [{ type: core.ViewChild, args: ['featureContextMenu', { static: true, read: menu.MenuComponent },] }],
1518
+ agmMapTpl: [{ type: core.ViewChild, args: [core$2.AgmMap, { static: true, read: core.ElementRef },] }]
1519
+ };
1520
+ __decorate([
1521
+ core$1.InputBoolean()
1522
+ ], TheSeamGoogleMapsComponent.prototype, "fileDropEnabled", void 0);
1523
+ __decorate([
1524
+ core$1.InputBoolean()
1525
+ ], TheSeamGoogleMapsComponent.prototype, "fileUploadControlEnabled", void 0);
1526
+ __decorate([
1527
+ core$1.InputBoolean()
1528
+ ], TheSeamGoogleMapsComponent.prototype, "fullscreenControlEnabled", void 0);
1529
+ __decorate([
1530
+ core$1.InputBoolean()
1531
+ ], TheSeamGoogleMapsComponent.prototype, "reCenterControlEnabled", void 0);
1532
+ __decorate([
1533
+ core$1.InputBoolean()
1534
+ ], TheSeamGoogleMapsComponent.prototype, "mapTypeControlEnabled", void 0);
1535
+ __decorate([
1536
+ core$1.InputBoolean()
1537
+ ], TheSeamGoogleMapsComponent.prototype, "streetViewControlEnabled", void 0);
1538
+ __decorate([
1539
+ core$1.InputBoolean()
1540
+ ], TheSeamGoogleMapsComponent.prototype, "allowDrawingHoleInPolygon", void 0);
1541
+ __decorate([
1542
+ core$1.InputNumber()
1543
+ ], TheSeamGoogleMapsComponent.prototype, "zoom", void 0);
1544
+ __decorate([
1545
+ core$1.InputNumber()
1546
+ ], TheSeamGoogleMapsComponent.prototype, "longitude", void 0);
1547
+ __decorate([
1548
+ core$1.InputNumber()
1549
+ ], TheSeamGoogleMapsComponent.prototype, "latitude", void 0);
1550
+
1551
+ var SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS = {
1552
+ componentRestrictions: { country: 'US' }
1553
+ };
1554
+ var TheSeamGoogleMapsPlacesAutocompleteDirective = /** @class */ (function () {
1555
+ function TheSeamGoogleMapsPlacesAutocompleteDirective(_elementRef, _ngZone) {
1556
+ var _this = this;
1557
+ this._elementRef = _elementRef;
1558
+ this._ngZone = _ngZone;
1559
+ this._autoCompleteReadySubject = new rxjs.Subject();
1560
+ this._ngUnsubscribe = new rxjs.Subject();
1561
+ this._placeChangedPending = [];
1562
+ this._listeners = [];
1563
+ this._options = SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS;
1564
+ this._attrType = 'text';
1565
+ this.placeChanged = this._autoCompleteReadySubject.pipe(operators.startWith(undefined), operators.switchMap(function () { return _this._createPlaceChangedObservable(); }));
1566
+ }
1567
+ Object.defineProperty(TheSeamGoogleMapsPlacesAutocompleteDirective.prototype, "options", {
1568
+ set: function (value) {
1569
+ this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS;
1570
+ },
1571
+ enumerable: false,
1572
+ configurable: true
1573
+ });
1574
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.ngOnInit = function () {
1575
+ var _this = this;
1576
+ this._ngZone.runOutsideAngular(function () {
1577
+ _this._untilGoogleMapsApiLoaded().pipe(operators.takeUntil(_this._ngUnsubscribe)).subscribe(function () {
1578
+ _this.autoComplete = new google.maps.places.Autocomplete(_this.getHostElement(), _this._options);
1579
+ _this._placeChangedPending.forEach(function (pending) { return pending.observable.subscribe(pending.subscriber); });
1580
+ _this._autoCompleteReadySubject.next();
1581
+ });
1582
+ });
1583
+ };
1584
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.ngOnDestroy = function () {
1585
+ this._listeners.forEach(function (l) { return l.remove(); });
1586
+ this._listeners = [];
1587
+ this._ngUnsubscribe.next();
1588
+ this._ngUnsubscribe.complete();
1589
+ };
1590
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.ngOnChanges = function (changes) {
1591
+ if (this.autoComplete && changes['options']) {
1592
+ this.autoComplete.setOptions(this._options);
1593
+ }
1594
+ };
1595
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype._untilGoogleMapsApiLoaded = function () {
1596
+ return rxjs.interval(500).pipe(operators.filter(function () { return !!(window.google && window.google.maps && window.google.maps.version); }), operators.take(1), operators.mapTo(undefined));
1597
+ };
1598
+ /**
1599
+ * Returns the bounds to which predictions are biased.
1600
+ */
1601
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.getBounds = function () {
1602
+ this._assertInitialized();
1603
+ return this.autoComplete.getBounds();
1604
+ };
1605
+ /**
1606
+ * Returns the fields to be included for the Place in the details response
1607
+ * when the details are successfully retrieved. For a list of fields see
1608
+ * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).
1609
+ */
1610
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.getFields = function () {
1611
+ this._assertInitialized();
1612
+ return this.autoComplete.getFields();
1613
+ };
1614
+ /**
1615
+ * Returns the details of the Place selected by user if the details were
1616
+ * successfully retrieved. Otherwise returns a stub Place object, with the
1617
+ * name property set to the current value of the input field.
1618
+ */
1619
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.getPlace = function () {
1620
+ this._assertInitialized();
1621
+ return this.autoComplete.getPlace();
1622
+ };
1623
+ /**
1624
+ * Sets the preferred area within which to return Place results. Results are
1625
+ * biased towards, but not restricted to, this area.
1626
+ */
1627
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.setBounds = function (bounds) {
1628
+ this._assertInitialized();
1629
+ // tslint:disable-next-line: no-non-null-assertion
1630
+ return this.autoComplete.setBounds(bounds);
1631
+ };
1632
+ /**
1633
+ * Sets the component restrictions. Component restrictions are used to
1634
+ * restrict predictions to only those within the parent component. For
1635
+ * example, the country.
1636
+ */
1637
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.setComponentRestrictions = function (restrictions) {
1638
+ this._assertInitialized();
1639
+ // tslint:disable-next-line: no-non-null-assertion
1640
+ return this.autoComplete.setComponentRestrictions(restrictions);
1641
+ };
1642
+ /**
1643
+ * Sets the fields to be included for the Place in the details response when
1644
+ * the details are successfully retrieved. For a list of fields see
1645
+ * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).
1646
+ */
1647
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.setFields = function (fields) {
1648
+ this._assertInitialized();
1649
+ // tslint:disable-next-line: no-non-null-assertion
1650
+ return this.autoComplete.setFields(fields);
1651
+ };
1652
+ /** */
1653
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.setOptions = function (options) {
1654
+ this._assertInitialized();
1655
+ // tslint:disable-next-line: no-non-null-assertion
1656
+ return this.autoComplete.setOptions(options);
1657
+ };
1658
+ /**
1659
+ * Sets the types of predictions to be returned. For supported types, see the
1660
+ * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).
1661
+ * If no types are specified, all types will be returned.
1662
+ */
1663
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.setTypes = function (types) {
1664
+ this._assertInitialized();
1665
+ // tslint:disable-next-line: no-non-null-assertion
1666
+ return this.autoComplete.setTypes(types);
1667
+ };
1668
+ /** Focuses the input. */
1669
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.focus = function () {
1670
+ this._elementRef.nativeElement.focus();
1671
+ };
1672
+ /** Unfocuses the input. */
1673
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.blur = function () {
1674
+ this._elementRef.nativeElement.blur();
1675
+ };
1676
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype.getHostElement = function () {
1677
+ return this._elementRef.nativeElement;
1678
+ };
1679
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype._createPlaceChangedObservable = function () {
1680
+ var _this = this;
1681
+ var observable = new rxjs.Observable(function (subscriber) {
1682
+ if (!_this.autoComplete) {
1683
+ _this._placeChangedPending.push({ observable: observable, subscriber: subscriber });
1684
+ return undefined;
1685
+ }
1686
+ var listener = _this.autoComplete.addListener('place_changed', function (event) {
1687
+ _this._ngZone.run(function () { return subscriber.next(event); });
1688
+ });
1689
+ _this._listeners.push(listener);
1690
+ return function () { return listener.remove(); };
1691
+ });
1692
+ return observable;
1693
+ };
1694
+ /** Asserts that the map has been initialized. */
1695
+ TheSeamGoogleMapsPlacesAutocompleteDirective.prototype._assertInitialized = function () {
1696
+ if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1697
+ throw Error('Cannot access Google Map Places information before the API has been initialized. ' +
1698
+ 'Please wait for the API to load before trying to interact with it.');
1699
+ }
1700
+ };
1701
+ return TheSeamGoogleMapsPlacesAutocompleteDirective;
1702
+ }());
1703
+ TheSeamGoogleMapsPlacesAutocompleteDirective.decorators = [
1704
+ { type: core.Directive, args: [{
1705
+ selector: 'input[seamGoogleMapsPlacesAutocomplete]',
1706
+ exportAs: 'seamGoogleMapsPlacesAutocomplete'
1707
+ },] }
1708
+ ];
1709
+ TheSeamGoogleMapsPlacesAutocompleteDirective.ctorParameters = function () { return [
1710
+ { type: core.ElementRef },
1711
+ { type: core.NgZone }
1712
+ ]; };
1713
+ TheSeamGoogleMapsPlacesAutocompleteDirective.propDecorators = {
1714
+ options: [{ type: core.Input }],
1715
+ placeChanged: [{ type: core.Output }],
1716
+ _attrType: [{ type: core.HostBinding, args: ['attr.type',] }]
1717
+ };
1718
+
1719
+ /**
1720
+ *
1721
+ */
1722
+ var TheSeamGoogleMapsPlacesAutoCompleteComponent = /** @class */ (function () {
1723
+ function TheSeamGoogleMapsPlacesAutoCompleteComponent(_elementRef) {
1724
+ var _this = this;
1725
+ this._elementRef = _elementRef;
1726
+ this._ngUnsubscribe = new rxjs.Subject();
1727
+ this._autoCompleteReadySubject = new rxjs.Subject();
1728
+ this._placeChangedPending = [];
1729
+ this.label = 'Search by address, place or name';
1730
+ this.icon = freeSolidSvgIcons.faSearchLocation;
1731
+ this.disabled = false;
1732
+ this.placeholder = 'Enter address, place or name';
1733
+ this.autocorrect = 'off';
1734
+ this.autocapitalize = 'off';
1735
+ this._tabIndex = -1;
1736
+ this._options = SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS;
1737
+ this.placeChanged = this._autoCompleteReadySubject.pipe(operators.startWith(undefined), operators.switchMap(function () { return _this._createPlaceChangedObservable(); }));
1738
+ }
1739
+ Object.defineProperty(TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "tabIndex", {
1740
+ get: function () { return this._tabIndex; },
1741
+ /**
1742
+ * Set the tab index to `-1` to allow the root element of the
1743
+ * component to receive `focus` event from javascript, but not get focused by
1744
+ * keyboard navigation.
1745
+ */
1746
+ set: function (value) { this._tabIndex = coercion.coerceNumberProperty(value); },
1747
+ enumerable: false,
1748
+ configurable: true
1749
+ });
1750
+ Object.defineProperty(TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "options", {
1751
+ set: function (value) {
1752
+ this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS;
1753
+ },
1754
+ enumerable: false,
1755
+ configurable: true
1756
+ });
1757
+ Object.defineProperty(TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "__autocompleteDirective", {
1758
+ set: function (value) {
1759
+ var _this = this;
1760
+ this._autoCompleteDirective = value;
1761
+ this._untilAutoCompleteReady().pipe(operators.takeUntil(this._ngUnsubscribe)).subscribe(function () {
1762
+ _this.autoComplete = _this._autoCompleteDirective.autoComplete;
1763
+ _this._placeChangedPending.forEach(function (pending) { return pending.observable.subscribe(pending.subscriber); });
1764
+ _this._placeChangedPending = [];
1765
+ });
1766
+ },
1767
+ enumerable: false,
1768
+ configurable: true
1769
+ });
1770
+ Object.defineProperty(TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "_attrTabIndex", {
1771
+ get: function () { return this.disabled ? -1 : (this.tabIndex || 0); },
1772
+ enumerable: false,
1773
+ configurable: true
1774
+ });
1775
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype._onClick = function (event) {
1776
+ this._inputDirective.focus();
1777
+ };
1778
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype._onFocus = function () {
1779
+ var _a;
1780
+ (_a = this._inputDirective) === null || _a === void 0 ? void 0 : _a.focus();
1781
+ };
1782
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.ngOnInit = function () { };
1783
+ /** @ignore */
1784
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.ngOnDestroy = function () {
1785
+ this._ngUnsubscribe.next();
1786
+ this._ngUnsubscribe.complete();
1787
+ };
1788
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype._untilAutoCompleteReady = function () {
1789
+ var _this = this;
1790
+ return rxjs.interval(500).pipe(operators.filter(function () { return !!_this._autoCompleteDirective.autoComplete; }), operators.take(1), operators.mapTo(undefined));
1791
+ };
1792
+ /**
1793
+ * Returns the bounds to which predictions are biased.
1794
+ */
1795
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.getBounds = function () {
1796
+ this._assertInitialized();
1797
+ return this.autoComplete.getBounds();
1798
+ };
1799
+ /**
1800
+ * Returns the fields to be included for the Place in the details response
1801
+ * when the details are successfully retrieved. For a list of fields see
1802
+ * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).
1803
+ */
1804
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.getFields = function () {
1805
+ this._assertInitialized();
1806
+ return this.autoComplete.getFields();
1807
+ };
1808
+ /**
1809
+ * Returns the details of the Place selected by user if the details were
1810
+ * successfully retrieved. Otherwise returns a stub Place object, with the
1811
+ * name property set to the current value of the input field.
1812
+ */
1813
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.getPlace = function () {
1814
+ this._assertInitialized();
1815
+ return this.autoComplete.getPlace();
1816
+ };
1817
+ /**
1818
+ * Sets the preferred area within which to return Place results. Results are
1819
+ * biased towards, but not restricted to, this area.
1820
+ */
1821
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.setBounds = function (bounds) {
1822
+ this._assertInitialized();
1823
+ // tslint:disable-next-line: no-non-null-assertion
1824
+ return this.autoComplete.setBounds(bounds);
1825
+ };
1826
+ /**
1827
+ * Sets the component restrictions. Component restrictions are used to
1828
+ * restrict predictions to only those within the parent component. For
1829
+ * example, the country.
1830
+ */
1831
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.setComponentRestrictions = function (restrictions) {
1832
+ this._assertInitialized();
1833
+ // tslint:disable-next-line: no-non-null-assertion
1834
+ return this.autoComplete.setComponentRestrictions(restrictions);
1835
+ };
1836
+ /**
1837
+ * Sets the fields to be included for the Place in the details response when
1838
+ * the details are successfully retrieved. For a list of fields see
1839
+ * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).
1840
+ */
1841
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.setFields = function (fields) {
1842
+ this._assertInitialized();
1843
+ // tslint:disable-next-line: no-non-null-assertion
1844
+ return this.autoComplete.setFields(fields);
1845
+ };
1846
+ /** */
1847
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.setOptions = function (options) {
1848
+ this._assertInitialized();
1849
+ // tslint:disable-next-line: no-non-null-assertion
1850
+ return this.autoComplete.setOptions(options);
1851
+ };
1852
+ /**
1853
+ * Sets the types of predictions to be returned. For supported types, see the
1854
+ * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).
1855
+ * If no types are specified, all types will be returned.
1856
+ */
1857
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.setTypes = function (types) {
1858
+ this._assertInitialized();
1859
+ // tslint:disable-next-line: no-non-null-assertion
1860
+ return this.autoComplete.setTypes(types);
1861
+ };
1862
+ /** Focuses the input. */
1863
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.focus = function () {
1864
+ this._elementRef.nativeElement.focus();
1865
+ };
1866
+ /** Unfocuses the input. */
1867
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.blur = function () {
1868
+ this._elementRef.nativeElement.blur();
1869
+ };
1870
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype.getHostElement = function () {
1871
+ return this._elementRef.nativeElement;
1872
+ };
1873
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype._createPlaceChangedObservable = function () {
1874
+ var _this = this;
1875
+ var observable = new rxjs.Observable(function (subscriber) {
1876
+ if (!_this.autoComplete) {
1877
+ _this._placeChangedPending.push({ observable: observable, subscriber: subscriber });
1878
+ return undefined;
1879
+ }
1880
+ var sub = _this._autoCompleteDirective.placeChanged.subscribe(subscriber);
1881
+ return function () { return sub.unsubscribe(); };
1882
+ });
1883
+ return observable;
1884
+ };
1885
+ /** Asserts that the map has been initialized. */
1886
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype._assertInitialized = function () {
1887
+ if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1888
+ throw Error('Cannot access Google Map Places information before the API has been initialized. ' +
1889
+ 'Please wait for the API to load before trying to interact with it.');
1890
+ }
1891
+ };
1892
+ return TheSeamGoogleMapsPlacesAutoCompleteComponent;
1893
+ }());
1894
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.decorators = [
1895
+ { type: core.Component, args: [{
1896
+ selector: 'seam-google-maps-places-autocomplete',
1897
+ template: "<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\n</div>\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{ label || placeholder }}</label>\n<input #inp=\"seamInput\"\n seamInput\n seamGoogleMapsPlacesAutocomplete\n [disabled]=\"disabled\"\n [attr.placeholder]=\"placeholder\"\n [attr.autocorrect]=\"autocorrect\"\n [attr.autocapitalize]=\"autocapitalize\"\n [options]=\"_options\"\n/>\n",
1898
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1899
+ exportAs: 'seamGoogleMapsPlacesAutoComplete',
1900
+ styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0px}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"]
1901
+ },] }
1902
+ ];
1903
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.ctorParameters = function () { return [
1904
+ { type: core.ElementRef }
1905
+ ]; };
1906
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.propDecorators = {
1907
+ label: [{ type: core.Input }],
1908
+ icon: [{ type: core.Input }],
1909
+ disabled: [{ type: core.Input }],
1910
+ placeholder: [{ type: core.Input }],
1911
+ autocorrect: [{ type: core.Input }],
1912
+ autocapitalize: [{ type: core.Input }],
1913
+ tabIndex: [{ type: core.Input }],
1914
+ options: [{ type: core.Input }],
1915
+ placeChanged: [{ type: core.Output }],
1916
+ _inputDirective: [{ type: core.ViewChild, args: ['inp', { read: formField.InputDirective, static: true },] }],
1917
+ __autocompleteDirective: [{ type: core.ViewChild, args: [TheSeamGoogleMapsPlacesAutocompleteDirective, { static: true },] }],
1918
+ _attrTabIndex: [{ type: core.HostBinding, args: ['attr.tabindex',] }],
1919
+ _onClick: [{ type: core.HostListener, args: ['click', ['event'],] }],
1920
+ _onFocus: [{ type: core.HostListener, args: ['focus', ['$event'],] }]
1921
+ };
1922
+ __decorate([
1923
+ core$1.InputBoolean()
1924
+ ], TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "disabled", void 0);
1925
+
1926
+ var TheSeamMapsControlComponent = /** @class */ (function () {
1927
+ function TheSeamMapsControlComponent(_googleMaps, _googleMapsControls) {
1928
+ this._googleMaps = _googleMaps;
1929
+ this._googleMapsControls = _googleMapsControls;
1930
+ this._ngUnsubscribe = new rxjs.Subject();
1931
+ }
1932
+ Object.defineProperty(TheSeamMapsControlComponent.prototype, "def", {
1933
+ set: function (value) {
1934
+ if (value !== this._def) {
1935
+ this._remove();
1936
+ this._def = value;
1937
+ }
1938
+ },
1939
+ enumerable: false,
1940
+ configurable: true
1941
+ });
1942
+ /** @ignore */
1943
+ TheSeamMapsControlComponent.prototype.ngOnInit = function () {
1944
+ var _this = this;
1945
+ this._googleMaps.mapReady$.pipe(operators.tap(function (ready) {
1946
+ if (ready) {
1947
+ _this._add();
1948
+ }
1949
+ else {
1950
+ _this._remove();
1951
+ }
1952
+ }), operators.takeUntil(this._ngUnsubscribe)).subscribe();
1953
+ };
1954
+ /** @ignore */
1955
+ TheSeamMapsControlComponent.prototype.ngOnDestroy = function () {
1956
+ this._remove();
1957
+ this._ngUnsubscribe.next();
1958
+ this._ngUnsubscribe.complete();
1959
+ };
1960
+ TheSeamMapsControlComponent.prototype._add = function () {
1961
+ if (this._controlRef) {
1962
+ return;
1963
+ }
1964
+ if (this._def === null || this._def === undefined) {
1965
+ return;
1966
+ }
1967
+ this._controlRef = this._googleMapsControls.add(this._def);
1968
+ };
1969
+ TheSeamMapsControlComponent.prototype._remove = function () {
1970
+ var _a;
1971
+ (_a = this._controlRef) === null || _a === void 0 ? void 0 : _a.destroy();
1972
+ this._controlRef = undefined;
1973
+ };
1974
+ return TheSeamMapsControlComponent;
1975
+ }());
1976
+ TheSeamMapsControlComponent.decorators = [
1977
+ { type: core.Component, args: [{
1978
+ selector: 'seam-map-control',
1979
+ template: '',
1980
+ changeDetection: core.ChangeDetectionStrategy.OnPush
1981
+ },] }
1982
+ ];
1983
+ TheSeamMapsControlComponent.ctorParameters = function () { return [
1984
+ { type: GoogleMapsService },
1985
+ { type: GoogleMapsControlsService, decorators: [{ type: core.Inject, args: [MAP_CONTROLS_SERVICE,] }] }
1986
+ ]; };
1987
+ TheSeamMapsControlComponent.propDecorators = {
1988
+ def: [{ type: core.Input }]
1989
+ };
1990
+
1991
+ /**
1992
+ *
1993
+ */
1994
+ var TheSeamMapFileDropComponent = /** @class */ (function () {
1995
+ function TheSeamMapFileDropComponent(_elementRef, _ngZone, _googleMaps, _mapValueManager, _renderer) {
1996
+ var _this = this;
1997
+ this._elementRef = _elementRef;
1998
+ this._ngZone = _ngZone;
1999
+ this._googleMaps = _googleMaps;
2000
+ this._mapValueManager = _mapValueManager;
2001
+ this._renderer = _renderer;
2002
+ this._ngUnsubscribe = new rxjs.Subject();
2003
+ this._listeners = [];
2004
+ this._globalDragInProgress = false;
2005
+ this._handleDragOverEvent = function (event) {
2006
+ if (!_this._dropAllowed()) {
2007
+ return;
2008
+ }
2009
+ if (!_this._isSupportedDataTransferTypes(event.dataTransfer)) {
2010
+ return;
2011
+ }
2012
+ event.preventDefault();
2013
+ event.dataTransfer.dropEffect = 'copy';
2014
+ };
2015
+ this._handleDropEvent = function (event) {
2016
+ if (!_this._dropAllowed()) {
2017
+ return;
2018
+ }
2019
+ event.preventDefault();
2020
+ event.stopPropagation();
2021
+ _this._renderer.setStyle(_this._elementRef.nativeElement, 'display', 'none');
2022
+ // TODO: Show error if multiple files?
2023
+ if (!_this._isSupportedDataTransfer(event.dataTransfer)) {
2024
+ return;
2025
+ }
2026
+ var item = event.dataTransfer.items[0];
2027
+ var file = item.getAsFile();
2028
+ utils.readGeoFile(file).then(function (json) {
2029
+ _this._mapValueManager.setValue(json, exports.MapValueSource.Input);
2030
+ });
2031
+ };
2032
+ this._handleDragEnterEvent = function (event) {
2033
+ if (!_this._dropAllowed()) {
2034
+ return;
2035
+ }
2036
+ if (!_this._isSupportedDataTransferTypes(event.dataTransfer)) {
2037
+ return;
2038
+ }
2039
+ _this._renderer.setStyle(_this._elementRef.nativeElement, 'display', 'block');
2040
+ };
2041
+ this._handleDragLeaveEvent = function (event) {
2042
+ if (!_this._dropAllowed()) {
2043
+ return;
2044
+ }
2045
+ _this._renderer.setStyle(_this._elementRef.nativeElement, 'display', 'none');
2046
+ };
2047
+ }
2048
+ /** @ignore */
2049
+ TheSeamMapFileDropComponent.prototype.ngOnInit = function () {
2050
+ var _this = this;
2051
+ this._googleMaps.mapReady$.pipe(operators.tap(function (ready) {
2052
+ if (ready) {
2053
+ _this._enableFileDrop();
2054
+ }
2055
+ else {
2056
+ _this._disableFileDrop();
2057
+ }
2058
+ }), operators.takeUntil(this._ngUnsubscribe)).subscribe();
2059
+ };
2060
+ /** @ignore */
2061
+ TheSeamMapFileDropComponent.prototype.ngOnDestroy = function () {
2062
+ this._disableFileDrop();
2063
+ this._ngUnsubscribe.next();
2064
+ this._ngUnsubscribe.complete();
2065
+ };
2066
+ TheSeamMapFileDropComponent.prototype._enableFileDrop = function () {
2067
+ var _this = this;
2068
+ var divElement = this._googleMaps.getDiv();
2069
+ if (this._mapDiv === divElement) {
2070
+ return;
2071
+ }
2072
+ if (this._mapDiv !== undefined) {
2073
+ // Disable file drop on previous map div.
2074
+ this._disableFileDrop();
2075
+ }
2076
+ this._mapDiv = divElement;
2077
+ this._ngZone.runOutsideAngular(function () {
2078
+ _this._listeners.push(_this._renderer.listen('document', 'dragstart', function (event) {
2079
+ _this._globalDragInProgress = true;
2080
+ }));
2081
+ _this._listeners.push(_this._renderer.listen('document', 'dragend', function (event) {
2082
+ _this._globalDragInProgress = false;
2083
+ }));
2084
+ _this._listeners.push(_this._renderer.listen(divElement, 'dragover', _this._handleDragOverEvent));
2085
+ _this._listeners.push(_this._renderer.listen(_this._elementRef.nativeElement, 'dragover', _this._handleDragOverEvent));
2086
+ _this._listeners.push(_this._renderer.listen(_this._elementRef.nativeElement, 'drop', _this._handleDropEvent));
2087
+ _this._listeners.push(_this._renderer.listen(divElement, 'dragenter', _this._handleDragEnterEvent));
2088
+ _this._listeners.push(_this._renderer.listen(_this._elementRef.nativeElement, 'dragleave', _this._handleDragLeaveEvent));
2089
+ });
2090
+ };
2091
+ TheSeamMapFileDropComponent.prototype._disableFileDrop = function () {
2092
+ if (this._listeners.length > 0) {
2093
+ this._listeners.forEach(function (l) { return l(); });
2094
+ this._listeners = [];
2095
+ }
2096
+ };
2097
+ TheSeamMapFileDropComponent.prototype._dropAllowed = function () {
2098
+ return !this._globalDragInProgress;
2099
+ };
2100
+ TheSeamMapFileDropComponent.prototype._isSupportedDataTransfer = function (dataTransfer) {
2101
+ return dataTransfer.files.length === 1 && dataTransfer.types[0] === 'Files';
2102
+ };
2103
+ TheSeamMapFileDropComponent.prototype._isSupportedDataTransferTypes = function (dataTransfer) {
2104
+ return dataTransfer.types[0] === 'Files';
2105
+ };
2106
+ return TheSeamMapFileDropComponent;
2107
+ }());
2108
+ TheSeamMapFileDropComponent.decorators = [
2109
+ { type: core.Component, args: [{
2110
+ selector: 'seam-map-file-drop',
2111
+ template: "",
2112
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2113
+ styles: [":host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:9999!important;background-color:#1e1e1eb3}\n"]
2114
+ },] }
2115
+ ];
2116
+ TheSeamMapFileDropComponent.ctorParameters = function () { return [
2117
+ { type: core.ElementRef },
2118
+ { type: core.NgZone },
2119
+ { type: GoogleMapsService },
2120
+ { type: MapValueManagerService },
2121
+ { type: core.Renderer2 }
2122
+ ]; };
2123
+
2124
+ var TheSeamGoogleMapsModule = /** @class */ (function () {
2125
+ function TheSeamGoogleMapsModule() {
2126
+ }
2127
+ return TheSeamGoogleMapsModule;
2128
+ }());
2129
+ TheSeamGoogleMapsModule.decorators = [
2130
+ { type: core.NgModule, args: [{
2131
+ declarations: [
2132
+ TheSeamGoogleMapsComponent,
2133
+ TheSeamMapFileDropComponent,
2134
+ TheSeamGoogleMapsUploadButtonControlComponent,
2135
+ TheSeamGoogleMapsRecenterButtonControlComponent,
2136
+ TheSeamMapsControlComponent,
2137
+ TheSeamGoogleMapsPlacesAutocompleteDirective,
2138
+ TheSeamGoogleMapsPlacesAutoCompleteComponent,
2139
+ ],
2140
+ imports: [
2141
+ common.CommonModule,
2142
+ observers.ObserversModule,
2143
+ shared.TheSeamSharedModule,
2144
+ menu.TheSeamMenuModule,
2145
+ icon.TheSeamIconModule,
2146
+ formField.TheSeamFormFieldModule,
2147
+ core$2.AgmCoreModule,
2148
+ ],
2149
+ exports: [
2150
+ TheSeamGoogleMapsComponent,
2151
+ TheSeamGoogleMapsPlacesAutocompleteDirective,
2152
+ TheSeamGoogleMapsPlacesAutoCompleteComponent
2153
+ ]
2154
+ },] }
2155
+ ];
2156
+
2157
+ /**
2158
+ * Generated bundle index. Do not edit.
2159
+ */
2160
+
2161
+ exports.GoogleMapsContextMenu = GoogleMapsContextMenu;
2162
+ exports.GoogleMapsControlsService = GoogleMapsControlsService;
2163
+ exports.GoogleMapsService = GoogleMapsService;
2164
+ exports.MapControlRef = MapControlRef;
2165
+ exports.MapValueManagerService = MapValueManagerService;
2166
+ exports.SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS = SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS;
2167
+ exports.TheSeamGoogleMapsComponent = TheSeamGoogleMapsComponent;
2168
+ exports.TheSeamGoogleMapsModule = TheSeamGoogleMapsModule;
2169
+ exports.TheSeamGoogleMapsPlacesAutoCompleteComponent = TheSeamGoogleMapsPlacesAutoCompleteComponent;
2170
+ exports.TheSeamGoogleMapsPlacesAutocompleteDirective = TheSeamGoogleMapsPlacesAutocompleteDirective;
2171
+ exports.TheSeamGoogleMapsRecenterButtonControlComponent = TheSeamGoogleMapsRecenterButtonControlComponent;
2172
+ exports.TheSeamGoogleMapsUploadButtonControlComponent = TheSeamGoogleMapsUploadButtonControlComponent;
2173
+ exports.TheSeamMapFileDropComponent = TheSeamMapFileDropComponent;
2174
+ exports.TheSeamMapsControlComponent = TheSeamMapsControlComponent;
2175
+ exports.addInnerFeatureCutoutToExteriorFeature = addInnerFeatureCutoutToExteriorFeature;
2176
+ exports.createDataFeatureFromPolygon = createDataFeatureFromPolygon;
2177
+ exports.createFeatureChangeObservable = createFeatureChangeObservable;
2178
+ exports.featureContains = featureContains;
2179
+ exports.fixPathDifferentStartingAndEndingPoint = fixPathDifferentStartingAndEndingPoint;
2180
+ exports.getBoundsWithAllFeatures = getBoundsWithAllFeatures;
2181
+ exports.getFeatureBounds = getFeatureBounds;
2182
+ exports.getFeatureCenter = getFeatureCenter;
2183
+ exports.getFeaturesCount = getFeaturesCount;
2184
+ exports.getPossibleExteriorFeature = getPossibleExteriorFeature;
2185
+ exports.isAppFeatureProperty = isAppFeatureProperty;
2186
+ exports.isFeatureSelected = isFeatureSelected;
2187
+ exports.multiPolygonCoordinates = multiPolygonCoordinates;
2188
+ exports.polygonCoordinates = polygonCoordinates;
2189
+ exports.removeAllFeatures = removeAllFeatures;
2190
+ exports.setFeatureSelected = setFeatureSelected;
2191
+ exports.stripAppFeaturePropertiesFromJson = stripAppFeaturePropertiesFromJson;
2192
+ exports.toTurfJsFeature = toTurfJsFeature;
2193
+ exports.toTurfJsMultiPolygon = toTurfJsMultiPolygon;
2194
+ exports.toTurfJsPolygon = toTurfJsPolygon;
2195
+ exports["ɵ0"] = ɵ0;
2196
+ exports["ɵb"] = MAP_CONTROLS_SERVICE;
2197
+ exports["ɵc"] = MAP_CONTROL_DATA;
2198
+
2199
+ Object.defineProperty(exports, '__esModule', { value: true });
2200
+
2201
+ }));
2202
+ //# sourceMappingURL=theseam-ui-common-google-maps.umd.js.map