@ng-select/ng-select 2.20.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +3 -3
  2. package/bundles/ng-select-ng-select.umd.js +4525 -0
  3. package/bundles/ng-select-ng-select.umd.js.map +1 -0
  4. package/bundles/ng-select-ng-select.umd.min.js +2 -0
  5. package/bundles/ng-select-ng-select.umd.min.js.map +1 -0
  6. package/esm2015/lib/config.service.js +40 -0
  7. package/esm2015/lib/console.service.js +20 -0
  8. package/esm2015/lib/id.js +21 -0
  9. package/esm2015/lib/items-list.js +661 -0
  10. package/esm2015/lib/ng-dropdown-panel.component.js +661 -0
  11. package/esm2015/lib/ng-dropdown-panel.service.js +127 -0
  12. package/esm2015/lib/ng-option.component.js +74 -0
  13. package/esm2015/lib/ng-select.component.js +1384 -0
  14. package/esm2015/lib/ng-select.module.js +57 -0
  15. package/esm2015/lib/ng-select.types.js +48 -0
  16. package/esm2015/{ng-select → lib}/ng-templates.directive.js +2 -3
  17. package/esm2015/lib/search-helper.js +862 -0
  18. package/esm2015/lib/selection-model.js +166 -0
  19. package/esm2015/lib/value-utils.js +33 -0
  20. package/esm2015/ng-select-ng-select.js +15 -0
  21. package/esm2015/public-api.js +11 -0
  22. package/esm5/lib/config.service.js +42 -0
  23. package/esm5/lib/console.service.js +28 -0
  24. package/esm5/lib/id.js +21 -0
  25. package/esm5/lib/items-list.js +888 -0
  26. package/esm5/lib/ng-dropdown-panel.component.js +770 -0
  27. package/esm5/lib/ng-dropdown-panel.service.js +150 -0
  28. package/esm5/lib/ng-option.component.js +86 -0
  29. package/esm5/lib/ng-select.component.js +1637 -0
  30. package/esm5/lib/ng-select.module.js +61 -0
  31. package/esm5/lib/ng-select.types.js +48 -0
  32. package/esm5/{ng-select → lib}/ng-templates.directive.js +2 -3
  33. package/esm5/lib/search-helper.js +862 -0
  34. package/esm5/{ng-select → lib}/selection-model.js +69 -22
  35. package/esm5/lib/value-utils.js +33 -0
  36. package/esm5/ng-select-ng-select.js +15 -0
  37. package/esm5/public-api.js +11 -0
  38. package/fesm2015/ng-select-ng-select.js +3804 -0
  39. package/fesm2015/ng-select-ng-select.js.map +1 -0
  40. package/fesm5/ng-select-ng-select.js +4442 -0
  41. package/fesm5/ng-select-ng-select.js.map +1 -0
  42. package/{ng-select → lib}/config.service.d.ts +0 -0
  43. package/{ng-select → lib}/console.service.d.ts +0 -0
  44. package/{ng-select → lib}/id.d.ts +0 -0
  45. package/{ng-select → lib}/items-list.d.ts +1 -1
  46. package/{ng-select → lib}/ng-dropdown-panel.component.d.ts +0 -0
  47. package/{ng-select → lib}/ng-dropdown-panel.service.d.ts +0 -0
  48. package/{ng-select → lib}/ng-option.component.d.ts +0 -0
  49. package/{ng-select → lib}/ng-select.component.d.ts +9 -9
  50. package/{ng-select → lib}/ng-select.module.d.ts +0 -0
  51. package/{ng-select → lib}/ng-select.types.d.ts +0 -0
  52. package/{ng-select → lib}/ng-templates.directive.d.ts +0 -0
  53. package/{ng-select → lib}/search-helper.d.ts +0 -0
  54. package/{ng-select → lib}/selection-model.d.ts +0 -0
  55. package/{ng-select → lib}/value-utils.d.ts +0 -0
  56. package/ng-select-ng-select.d.ts +10 -0
  57. package/ng-select-ng-select.metadata.json +1 -0
  58. package/package.json +13 -14
  59. package/public-api.d.ts +5 -0
  60. package/scss/material.theme.scss +1 -1
  61. package/themes/material.theme.css +1 -1
  62. package/bundles/ng-select.umd.js +0 -4283
  63. package/bundles/ng-select.umd.js.map +0 -1
  64. package/bundles/ng-select.umd.min.js +0 -2
  65. package/bundles/ng-select.umd.min.js.map +0 -1
  66. package/esm2015/index.js +0 -9
  67. package/esm2015/ng-select/config.service.js +0 -41
  68. package/esm2015/ng-select/console.service.js +0 -21
  69. package/esm2015/ng-select/id.js +0 -17
  70. package/esm2015/ng-select/items-list.js +0 -542
  71. package/esm2015/ng-select/ng-dropdown-panel.component.js +0 -562
  72. package/esm2015/ng-select/ng-dropdown-panel.service.js +0 -121
  73. package/esm2015/ng-select/ng-option-highlight.directive.js +0 -98
  74. package/esm2015/ng-select/ng-option.component.js +0 -71
  75. package/esm2015/ng-select/ng-select.component.js +0 -1214
  76. package/esm2015/ng-select/ng-select.module.js +0 -61
  77. package/esm2015/ng-select/ng-select.types.js +0 -49
  78. package/esm2015/ng-select/search-helper.js +0 -859
  79. package/esm2015/ng-select/selection-model.js +0 -122
  80. package/esm2015/ng-select/value-utils.js +0 -34
  81. package/esm2015/ng-select.js +0 -17
  82. package/esm5/index.js +0 -9
  83. package/esm5/ng-select/config.service.js +0 -43
  84. package/esm5/ng-select/console.service.js +0 -29
  85. package/esm5/ng-select/id.js +0 -17
  86. package/esm5/ng-select/items-list.js +0 -761
  87. package/esm5/ng-select/ng-dropdown-panel.component.js +0 -654
  88. package/esm5/ng-select/ng-dropdown-panel.service.js +0 -144
  89. package/esm5/ng-select/ng-option-highlight.directive.js +0 -113
  90. package/esm5/ng-select/ng-option.component.js +0 -82
  91. package/esm5/ng-select/ng-select.component.js +0 -1430
  92. package/esm5/ng-select/ng-select.module.js +0 -65
  93. package/esm5/ng-select/ng-select.types.js +0 -49
  94. package/esm5/ng-select/search-helper.js +0 -859
  95. package/esm5/ng-select/value-utils.js +0 -34
  96. package/esm5/ng-select.js +0 -17
  97. package/fesm2015/ng-select.js +0 -3559
  98. package/fesm2015/ng-select.js.map +0 -1
  99. package/fesm5/ng-select.js +0 -4145
  100. package/fesm5/ng-select.js.map +0 -1
  101. package/index.d.ts +0 -5
  102. package/ng-select/ng-option-highlight.directive.d.ts +0 -14
  103. package/ng-select.d.ts +0 -11
  104. package/ng-select.metadata.json +0 -1
@@ -0,0 +1,4525 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('rxjs'), require('@angular/common')) :
3
+ typeof define === 'function' && define.amd ? define('@ng-select/ng-select', ['exports', '@angular/core', '@angular/forms', 'rxjs/operators', 'rxjs', '@angular/common'], factory) :
4
+ (global = global || self, factory((global['ng-select'] = global['ng-select'] || {}, global['ng-select']['ng-select'] = {}), global.ng.core, global.ng.forms, global.rxjs.operators, global.rxjs, global.ng.common));
5
+ }(this, function (exports, core, forms, operators, rxjs, common) { 'use strict';
6
+
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation. All rights reserved.
9
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
+ this file except in compliance with the License. You may obtain a copy of the
11
+ License at http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
+ MERCHANTABLITY OR NON-INFRINGEMENT.
17
+
18
+ See the Apache Version 2.0 License for specific language governing permissions
19
+ and limitations under the License.
20
+ ***************************************************************************** */
21
+
22
+ var __assign = function() {
23
+ __assign = Object.assign || function __assign(t) {
24
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25
+ s = arguments[i];
26
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27
+ }
28
+ return t;
29
+ };
30
+ return __assign.apply(this, arguments);
31
+ };
32
+
33
+ function __values(o) {
34
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
35
+ if (m) return m.call(o);
36
+ return {
37
+ next: function () {
38
+ if (o && i >= o.length) o = void 0;
39
+ return { value: o && o[i++], done: !o };
40
+ }
41
+ };
42
+ }
43
+
44
+ function __read(o, n) {
45
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
46
+ if (!m) return o;
47
+ var i = m.call(o), r, ar = [], e;
48
+ try {
49
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
50
+ }
51
+ catch (error) { e = { error: error }; }
52
+ finally {
53
+ try {
54
+ if (r && !r.done && (m = i["return"])) m.call(i);
55
+ }
56
+ finally { if (e) throw e.error; }
57
+ }
58
+ return ar;
59
+ }
60
+
61
+ function __spread() {
62
+ for (var ar = [], i = 0; i < arguments.length; i++)
63
+ ar = ar.concat(__read(arguments[i]));
64
+ return ar;
65
+ }
66
+
67
+ /**
68
+ * @fileoverview added by tsickle
69
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
70
+ */
71
+ var NgOptionTemplateDirective = /** @class */ (function () {
72
+ function NgOptionTemplateDirective(template) {
73
+ this.template = template;
74
+ }
75
+ NgOptionTemplateDirective.decorators = [
76
+ { type: core.Directive, args: [{ selector: '[ng-option-tmp]' },] }
77
+ ];
78
+ /** @nocollapse */
79
+ NgOptionTemplateDirective.ctorParameters = function () { return [
80
+ { type: core.TemplateRef }
81
+ ]; };
82
+ return NgOptionTemplateDirective;
83
+ }());
84
+ var NgOptgroupTemplateDirective = /** @class */ (function () {
85
+ function NgOptgroupTemplateDirective(template) {
86
+ this.template = template;
87
+ }
88
+ NgOptgroupTemplateDirective.decorators = [
89
+ { type: core.Directive, args: [{ selector: '[ng-optgroup-tmp]' },] }
90
+ ];
91
+ /** @nocollapse */
92
+ NgOptgroupTemplateDirective.ctorParameters = function () { return [
93
+ { type: core.TemplateRef }
94
+ ]; };
95
+ return NgOptgroupTemplateDirective;
96
+ }());
97
+ var NgLabelTemplateDirective = /** @class */ (function () {
98
+ function NgLabelTemplateDirective(template) {
99
+ this.template = template;
100
+ }
101
+ NgLabelTemplateDirective.decorators = [
102
+ { type: core.Directive, args: [{ selector: '[ng-label-tmp]' },] }
103
+ ];
104
+ /** @nocollapse */
105
+ NgLabelTemplateDirective.ctorParameters = function () { return [
106
+ { type: core.TemplateRef }
107
+ ]; };
108
+ return NgLabelTemplateDirective;
109
+ }());
110
+ var NgMultiLabelTemplateDirective = /** @class */ (function () {
111
+ function NgMultiLabelTemplateDirective(template) {
112
+ this.template = template;
113
+ }
114
+ NgMultiLabelTemplateDirective.decorators = [
115
+ { type: core.Directive, args: [{ selector: '[ng-multi-label-tmp]' },] }
116
+ ];
117
+ /** @nocollapse */
118
+ NgMultiLabelTemplateDirective.ctorParameters = function () { return [
119
+ { type: core.TemplateRef }
120
+ ]; };
121
+ return NgMultiLabelTemplateDirective;
122
+ }());
123
+ var NgHeaderTemplateDirective = /** @class */ (function () {
124
+ function NgHeaderTemplateDirective(template) {
125
+ this.template = template;
126
+ }
127
+ NgHeaderTemplateDirective.decorators = [
128
+ { type: core.Directive, args: [{ selector: '[ng-header-tmp]' },] }
129
+ ];
130
+ /** @nocollapse */
131
+ NgHeaderTemplateDirective.ctorParameters = function () { return [
132
+ { type: core.TemplateRef }
133
+ ]; };
134
+ return NgHeaderTemplateDirective;
135
+ }());
136
+ var NgFooterTemplateDirective = /** @class */ (function () {
137
+ function NgFooterTemplateDirective(template) {
138
+ this.template = template;
139
+ }
140
+ NgFooterTemplateDirective.decorators = [
141
+ { type: core.Directive, args: [{ selector: '[ng-footer-tmp]' },] }
142
+ ];
143
+ /** @nocollapse */
144
+ NgFooterTemplateDirective.ctorParameters = function () { return [
145
+ { type: core.TemplateRef }
146
+ ]; };
147
+ return NgFooterTemplateDirective;
148
+ }());
149
+ var NgNotFoundTemplateDirective = /** @class */ (function () {
150
+ function NgNotFoundTemplateDirective(template) {
151
+ this.template = template;
152
+ }
153
+ NgNotFoundTemplateDirective.decorators = [
154
+ { type: core.Directive, args: [{ selector: '[ng-notfound-tmp]' },] }
155
+ ];
156
+ /** @nocollapse */
157
+ NgNotFoundTemplateDirective.ctorParameters = function () { return [
158
+ { type: core.TemplateRef }
159
+ ]; };
160
+ return NgNotFoundTemplateDirective;
161
+ }());
162
+ var NgTypeToSearchTemplateDirective = /** @class */ (function () {
163
+ function NgTypeToSearchTemplateDirective(template) {
164
+ this.template = template;
165
+ }
166
+ NgTypeToSearchTemplateDirective.decorators = [
167
+ { type: core.Directive, args: [{ selector: '[ng-typetosearch-tmp]' },] }
168
+ ];
169
+ /** @nocollapse */
170
+ NgTypeToSearchTemplateDirective.ctorParameters = function () { return [
171
+ { type: core.TemplateRef }
172
+ ]; };
173
+ return NgTypeToSearchTemplateDirective;
174
+ }());
175
+ var NgLoadingTextTemplateDirective = /** @class */ (function () {
176
+ function NgLoadingTextTemplateDirective(template) {
177
+ this.template = template;
178
+ }
179
+ NgLoadingTextTemplateDirective.decorators = [
180
+ { type: core.Directive, args: [{ selector: '[ng-loadingtext-tmp]' },] }
181
+ ];
182
+ /** @nocollapse */
183
+ NgLoadingTextTemplateDirective.ctorParameters = function () { return [
184
+ { type: core.TemplateRef }
185
+ ]; };
186
+ return NgLoadingTextTemplateDirective;
187
+ }());
188
+ var NgTagTemplateDirective = /** @class */ (function () {
189
+ function NgTagTemplateDirective(template) {
190
+ this.template = template;
191
+ }
192
+ NgTagTemplateDirective.decorators = [
193
+ { type: core.Directive, args: [{ selector: '[ng-tag-tmp]' },] }
194
+ ];
195
+ /** @nocollapse */
196
+ NgTagTemplateDirective.ctorParameters = function () { return [
197
+ { type: core.TemplateRef }
198
+ ]; };
199
+ return NgTagTemplateDirective;
200
+ }());
201
+ var NgLoadingSpinnerTemplateDirective = /** @class */ (function () {
202
+ function NgLoadingSpinnerTemplateDirective(template) {
203
+ this.template = template;
204
+ }
205
+ NgLoadingSpinnerTemplateDirective.decorators = [
206
+ { type: core.Directive, args: [{ selector: '[ng-loadingspinner-tmp]' },] }
207
+ ];
208
+ /** @nocollapse */
209
+ NgLoadingSpinnerTemplateDirective.ctorParameters = function () { return [
210
+ { type: core.TemplateRef }
211
+ ]; };
212
+ return NgLoadingSpinnerTemplateDirective;
213
+ }());
214
+
215
+ /**
216
+ * @fileoverview added by tsickle
217
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
218
+ */
219
+ var ConsoleService = /** @class */ (function () {
220
+ function ConsoleService() {
221
+ }
222
+ /**
223
+ * @param {?} message
224
+ * @return {?}
225
+ */
226
+ ConsoleService.prototype.warn = /**
227
+ * @param {?} message
228
+ * @return {?}
229
+ */
230
+ function (message) {
231
+ console.warn(message);
232
+ };
233
+ ConsoleService.decorators = [
234
+ { type: core.Injectable, args: [{ providedIn: 'root' },] }
235
+ ];
236
+ /** @nocollapse */ ConsoleService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
237
+ return ConsoleService;
238
+ }());
239
+
240
+ /**
241
+ * @fileoverview added by tsickle
242
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
243
+ */
244
+ /**
245
+ * @param {?} value
246
+ * @return {?}
247
+ */
248
+ function isDefined(value) {
249
+ return value !== undefined && value !== null;
250
+ }
251
+ /**
252
+ * @param {?} value
253
+ * @return {?}
254
+ */
255
+ function isObject(value) {
256
+ return typeof value === 'object' && isDefined(value);
257
+ }
258
+ /**
259
+ * @param {?} value
260
+ * @return {?}
261
+ */
262
+ function isPromise(value) {
263
+ return value instanceof Promise;
264
+ }
265
+ /**
266
+ * @param {?} value
267
+ * @return {?}
268
+ */
269
+ function isFunction(value) {
270
+ return value instanceof Function;
271
+ }
272
+
273
+ /**
274
+ * @fileoverview added by tsickle
275
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
276
+ */
277
+ /**
278
+ * @return {?}
279
+ */
280
+ function newId() {
281
+ // First character is an 'a', it's good practice to tag id to begin with a letter
282
+ return 'axxxxxxxxxxx'.replace(/[x]/g, (/**
283
+ * @param {?} _
284
+ * @return {?}
285
+ */
286
+ function (_) {
287
+ // tslint:disable-next-line:no-bitwise
288
+ /** @type {?} */
289
+ var val = Math.random() * 16 | 0;
290
+ return val.toString(16);
291
+ }));
292
+ }
293
+
294
+ /**
295
+ * @fileoverview added by tsickle
296
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
297
+ */
298
+ /** @type {?} */
299
+ var diacritics = {
300
+ '\u24B6': 'A',
301
+ '\uFF21': 'A',
302
+ '\u00C0': 'A',
303
+ '\u00C1': 'A',
304
+ '\u00C2': 'A',
305
+ '\u1EA6': 'A',
306
+ '\u1EA4': 'A',
307
+ '\u1EAA': 'A',
308
+ '\u1EA8': 'A',
309
+ '\u00C3': 'A',
310
+ '\u0100': 'A',
311
+ '\u0102': 'A',
312
+ '\u1EB0': 'A',
313
+ '\u1EAE': 'A',
314
+ '\u1EB4': 'A',
315
+ '\u1EB2': 'A',
316
+ '\u0226': 'A',
317
+ '\u01E0': 'A',
318
+ '\u00C4': 'A',
319
+ '\u01DE': 'A',
320
+ '\u1EA2': 'A',
321
+ '\u00C5': 'A',
322
+ '\u01FA': 'A',
323
+ '\u01CD': 'A',
324
+ '\u0200': 'A',
325
+ '\u0202': 'A',
326
+ '\u1EA0': 'A',
327
+ '\u1EAC': 'A',
328
+ '\u1EB6': 'A',
329
+ '\u1E00': 'A',
330
+ '\u0104': 'A',
331
+ '\u023A': 'A',
332
+ '\u2C6F': 'A',
333
+ '\uA732': 'AA',
334
+ '\u00C6': 'AE',
335
+ '\u01FC': 'AE',
336
+ '\u01E2': 'AE',
337
+ '\uA734': 'AO',
338
+ '\uA736': 'AU',
339
+ '\uA738': 'AV',
340
+ '\uA73A': 'AV',
341
+ '\uA73C': 'AY',
342
+ '\u24B7': 'B',
343
+ '\uFF22': 'B',
344
+ '\u1E02': 'B',
345
+ '\u1E04': 'B',
346
+ '\u1E06': 'B',
347
+ '\u0243': 'B',
348
+ '\u0182': 'B',
349
+ '\u0181': 'B',
350
+ '\u24B8': 'C',
351
+ '\uFF23': 'C',
352
+ '\u0106': 'C',
353
+ '\u0108': 'C',
354
+ '\u010A': 'C',
355
+ '\u010C': 'C',
356
+ '\u00C7': 'C',
357
+ '\u1E08': 'C',
358
+ '\u0187': 'C',
359
+ '\u023B': 'C',
360
+ '\uA73E': 'C',
361
+ '\u24B9': 'D',
362
+ '\uFF24': 'D',
363
+ '\u1E0A': 'D',
364
+ '\u010E': 'D',
365
+ '\u1E0C': 'D',
366
+ '\u1E10': 'D',
367
+ '\u1E12': 'D',
368
+ '\u1E0E': 'D',
369
+ '\u0110': 'D',
370
+ '\u018B': 'D',
371
+ '\u018A': 'D',
372
+ '\u0189': 'D',
373
+ '\uA779': 'D',
374
+ '\u01F1': 'DZ',
375
+ '\u01C4': 'DZ',
376
+ '\u01F2': 'Dz',
377
+ '\u01C5': 'Dz',
378
+ '\u24BA': 'E',
379
+ '\uFF25': 'E',
380
+ '\u00C8': 'E',
381
+ '\u00C9': 'E',
382
+ '\u00CA': 'E',
383
+ '\u1EC0': 'E',
384
+ '\u1EBE': 'E',
385
+ '\u1EC4': 'E',
386
+ '\u1EC2': 'E',
387
+ '\u1EBC': 'E',
388
+ '\u0112': 'E',
389
+ '\u1E14': 'E',
390
+ '\u1E16': 'E',
391
+ '\u0114': 'E',
392
+ '\u0116': 'E',
393
+ '\u00CB': 'E',
394
+ '\u1EBA': 'E',
395
+ '\u011A': 'E',
396
+ '\u0204': 'E',
397
+ '\u0206': 'E',
398
+ '\u1EB8': 'E',
399
+ '\u1EC6': 'E',
400
+ '\u0228': 'E',
401
+ '\u1E1C': 'E',
402
+ '\u0118': 'E',
403
+ '\u1E18': 'E',
404
+ '\u1E1A': 'E',
405
+ '\u0190': 'E',
406
+ '\u018E': 'E',
407
+ '\u24BB': 'F',
408
+ '\uFF26': 'F',
409
+ '\u1E1E': 'F',
410
+ '\u0191': 'F',
411
+ '\uA77B': 'F',
412
+ '\u24BC': 'G',
413
+ '\uFF27': 'G',
414
+ '\u01F4': 'G',
415
+ '\u011C': 'G',
416
+ '\u1E20': 'G',
417
+ '\u011E': 'G',
418
+ '\u0120': 'G',
419
+ '\u01E6': 'G',
420
+ '\u0122': 'G',
421
+ '\u01E4': 'G',
422
+ '\u0193': 'G',
423
+ '\uA7A0': 'G',
424
+ '\uA77D': 'G',
425
+ '\uA77E': 'G',
426
+ '\u24BD': 'H',
427
+ '\uFF28': 'H',
428
+ '\u0124': 'H',
429
+ '\u1E22': 'H',
430
+ '\u1E26': 'H',
431
+ '\u021E': 'H',
432
+ '\u1E24': 'H',
433
+ '\u1E28': 'H',
434
+ '\u1E2A': 'H',
435
+ '\u0126': 'H',
436
+ '\u2C67': 'H',
437
+ '\u2C75': 'H',
438
+ '\uA78D': 'H',
439
+ '\u24BE': 'I',
440
+ '\uFF29': 'I',
441
+ '\u00CC': 'I',
442
+ '\u00CD': 'I',
443
+ '\u00CE': 'I',
444
+ '\u0128': 'I',
445
+ '\u012A': 'I',
446
+ '\u012C': 'I',
447
+ '\u0130': 'I',
448
+ '\u00CF': 'I',
449
+ '\u1E2E': 'I',
450
+ '\u1EC8': 'I',
451
+ '\u01CF': 'I',
452
+ '\u0208': 'I',
453
+ '\u020A': 'I',
454
+ '\u1ECA': 'I',
455
+ '\u012E': 'I',
456
+ '\u1E2C': 'I',
457
+ '\u0197': 'I',
458
+ '\u24BF': 'J',
459
+ '\uFF2A': 'J',
460
+ '\u0134': 'J',
461
+ '\u0248': 'J',
462
+ '\u24C0': 'K',
463
+ '\uFF2B': 'K',
464
+ '\u1E30': 'K',
465
+ '\u01E8': 'K',
466
+ '\u1E32': 'K',
467
+ '\u0136': 'K',
468
+ '\u1E34': 'K',
469
+ '\u0198': 'K',
470
+ '\u2C69': 'K',
471
+ '\uA740': 'K',
472
+ '\uA742': 'K',
473
+ '\uA744': 'K',
474
+ '\uA7A2': 'K',
475
+ '\u24C1': 'L',
476
+ '\uFF2C': 'L',
477
+ '\u013F': 'L',
478
+ '\u0139': 'L',
479
+ '\u013D': 'L',
480
+ '\u1E36': 'L',
481
+ '\u1E38': 'L',
482
+ '\u013B': 'L',
483
+ '\u1E3C': 'L',
484
+ '\u1E3A': 'L',
485
+ '\u0141': 'L',
486
+ '\u023D': 'L',
487
+ '\u2C62': 'L',
488
+ '\u2C60': 'L',
489
+ '\uA748': 'L',
490
+ '\uA746': 'L',
491
+ '\uA780': 'L',
492
+ '\u01C7': 'LJ',
493
+ '\u01C8': 'Lj',
494
+ '\u24C2': 'M',
495
+ '\uFF2D': 'M',
496
+ '\u1E3E': 'M',
497
+ '\u1E40': 'M',
498
+ '\u1E42': 'M',
499
+ '\u2C6E': 'M',
500
+ '\u019C': 'M',
501
+ '\u24C3': 'N',
502
+ '\uFF2E': 'N',
503
+ '\u01F8': 'N',
504
+ '\u0143': 'N',
505
+ '\u00D1': 'N',
506
+ '\u1E44': 'N',
507
+ '\u0147': 'N',
508
+ '\u1E46': 'N',
509
+ '\u0145': 'N',
510
+ '\u1E4A': 'N',
511
+ '\u1E48': 'N',
512
+ '\u0220': 'N',
513
+ '\u019D': 'N',
514
+ '\uA790': 'N',
515
+ '\uA7A4': 'N',
516
+ '\u01CA': 'NJ',
517
+ '\u01CB': 'Nj',
518
+ '\u24C4': 'O',
519
+ '\uFF2F': 'O',
520
+ '\u00D2': 'O',
521
+ '\u00D3': 'O',
522
+ '\u00D4': 'O',
523
+ '\u1ED2': 'O',
524
+ '\u1ED0': 'O',
525
+ '\u1ED6': 'O',
526
+ '\u1ED4': 'O',
527
+ '\u00D5': 'O',
528
+ '\u1E4C': 'O',
529
+ '\u022C': 'O',
530
+ '\u1E4E': 'O',
531
+ '\u014C': 'O',
532
+ '\u1E50': 'O',
533
+ '\u1E52': 'O',
534
+ '\u014E': 'O',
535
+ '\u022E': 'O',
536
+ '\u0230': 'O',
537
+ '\u00D6': 'O',
538
+ '\u022A': 'O',
539
+ '\u1ECE': 'O',
540
+ '\u0150': 'O',
541
+ '\u01D1': 'O',
542
+ '\u020C': 'O',
543
+ '\u020E': 'O',
544
+ '\u01A0': 'O',
545
+ '\u1EDC': 'O',
546
+ '\u1EDA': 'O',
547
+ '\u1EE0': 'O',
548
+ '\u1EDE': 'O',
549
+ '\u1EE2': 'O',
550
+ '\u1ECC': 'O',
551
+ '\u1ED8': 'O',
552
+ '\u01EA': 'O',
553
+ '\u01EC': 'O',
554
+ '\u00D8': 'O',
555
+ '\u01FE': 'O',
556
+ '\u0186': 'O',
557
+ '\u019F': 'O',
558
+ '\uA74A': 'O',
559
+ '\uA74C': 'O',
560
+ '\u01A2': 'OI',
561
+ '\uA74E': 'OO',
562
+ '\u0222': 'OU',
563
+ '\u24C5': 'P',
564
+ '\uFF30': 'P',
565
+ '\u1E54': 'P',
566
+ '\u1E56': 'P',
567
+ '\u01A4': 'P',
568
+ '\u2C63': 'P',
569
+ '\uA750': 'P',
570
+ '\uA752': 'P',
571
+ '\uA754': 'P',
572
+ '\u24C6': 'Q',
573
+ '\uFF31': 'Q',
574
+ '\uA756': 'Q',
575
+ '\uA758': 'Q',
576
+ '\u024A': 'Q',
577
+ '\u24C7': 'R',
578
+ '\uFF32': 'R',
579
+ '\u0154': 'R',
580
+ '\u1E58': 'R',
581
+ '\u0158': 'R',
582
+ '\u0210': 'R',
583
+ '\u0212': 'R',
584
+ '\u1E5A': 'R',
585
+ '\u1E5C': 'R',
586
+ '\u0156': 'R',
587
+ '\u1E5E': 'R',
588
+ '\u024C': 'R',
589
+ '\u2C64': 'R',
590
+ '\uA75A': 'R',
591
+ '\uA7A6': 'R',
592
+ '\uA782': 'R',
593
+ '\u24C8': 'S',
594
+ '\uFF33': 'S',
595
+ '\u1E9E': 'S',
596
+ '\u015A': 'S',
597
+ '\u1E64': 'S',
598
+ '\u015C': 'S',
599
+ '\u1E60': 'S',
600
+ '\u0160': 'S',
601
+ '\u1E66': 'S',
602
+ '\u1E62': 'S',
603
+ '\u1E68': 'S',
604
+ '\u0218': 'S',
605
+ '\u015E': 'S',
606
+ '\u2C7E': 'S',
607
+ '\uA7A8': 'S',
608
+ '\uA784': 'S',
609
+ '\u24C9': 'T',
610
+ '\uFF34': 'T',
611
+ '\u1E6A': 'T',
612
+ '\u0164': 'T',
613
+ '\u1E6C': 'T',
614
+ '\u021A': 'T',
615
+ '\u0162': 'T',
616
+ '\u1E70': 'T',
617
+ '\u1E6E': 'T',
618
+ '\u0166': 'T',
619
+ '\u01AC': 'T',
620
+ '\u01AE': 'T',
621
+ '\u023E': 'T',
622
+ '\uA786': 'T',
623
+ '\uA728': 'TZ',
624
+ '\u24CA': 'U',
625
+ '\uFF35': 'U',
626
+ '\u00D9': 'U',
627
+ '\u00DA': 'U',
628
+ '\u00DB': 'U',
629
+ '\u0168': 'U',
630
+ '\u1E78': 'U',
631
+ '\u016A': 'U',
632
+ '\u1E7A': 'U',
633
+ '\u016C': 'U',
634
+ '\u00DC': 'U',
635
+ '\u01DB': 'U',
636
+ '\u01D7': 'U',
637
+ '\u01D5': 'U',
638
+ '\u01D9': 'U',
639
+ '\u1EE6': 'U',
640
+ '\u016E': 'U',
641
+ '\u0170': 'U',
642
+ '\u01D3': 'U',
643
+ '\u0214': 'U',
644
+ '\u0216': 'U',
645
+ '\u01AF': 'U',
646
+ '\u1EEA': 'U',
647
+ '\u1EE8': 'U',
648
+ '\u1EEE': 'U',
649
+ '\u1EEC': 'U',
650
+ '\u1EF0': 'U',
651
+ '\u1EE4': 'U',
652
+ '\u1E72': 'U',
653
+ '\u0172': 'U',
654
+ '\u1E76': 'U',
655
+ '\u1E74': 'U',
656
+ '\u0244': 'U',
657
+ '\u24CB': 'V',
658
+ '\uFF36': 'V',
659
+ '\u1E7C': 'V',
660
+ '\u1E7E': 'V',
661
+ '\u01B2': 'V',
662
+ '\uA75E': 'V',
663
+ '\u0245': 'V',
664
+ '\uA760': 'VY',
665
+ '\u24CC': 'W',
666
+ '\uFF37': 'W',
667
+ '\u1E80': 'W',
668
+ '\u1E82': 'W',
669
+ '\u0174': 'W',
670
+ '\u1E86': 'W',
671
+ '\u1E84': 'W',
672
+ '\u1E88': 'W',
673
+ '\u2C72': 'W',
674
+ '\u24CD': 'X',
675
+ '\uFF38': 'X',
676
+ '\u1E8A': 'X',
677
+ '\u1E8C': 'X',
678
+ '\u24CE': 'Y',
679
+ '\uFF39': 'Y',
680
+ '\u1EF2': 'Y',
681
+ '\u00DD': 'Y',
682
+ '\u0176': 'Y',
683
+ '\u1EF8': 'Y',
684
+ '\u0232': 'Y',
685
+ '\u1E8E': 'Y',
686
+ '\u0178': 'Y',
687
+ '\u1EF6': 'Y',
688
+ '\u1EF4': 'Y',
689
+ '\u01B3': 'Y',
690
+ '\u024E': 'Y',
691
+ '\u1EFE': 'Y',
692
+ '\u24CF': 'Z',
693
+ '\uFF3A': 'Z',
694
+ '\u0179': 'Z',
695
+ '\u1E90': 'Z',
696
+ '\u017B': 'Z',
697
+ '\u017D': 'Z',
698
+ '\u1E92': 'Z',
699
+ '\u1E94': 'Z',
700
+ '\u01B5': 'Z',
701
+ '\u0224': 'Z',
702
+ '\u2C7F': 'Z',
703
+ '\u2C6B': 'Z',
704
+ '\uA762': 'Z',
705
+ '\u24D0': 'a',
706
+ '\uFF41': 'a',
707
+ '\u1E9A': 'a',
708
+ '\u00E0': 'a',
709
+ '\u00E1': 'a',
710
+ '\u00E2': 'a',
711
+ '\u1EA7': 'a',
712
+ '\u1EA5': 'a',
713
+ '\u1EAB': 'a',
714
+ '\u1EA9': 'a',
715
+ '\u00E3': 'a',
716
+ '\u0101': 'a',
717
+ '\u0103': 'a',
718
+ '\u1EB1': 'a',
719
+ '\u1EAF': 'a',
720
+ '\u1EB5': 'a',
721
+ '\u1EB3': 'a',
722
+ '\u0227': 'a',
723
+ '\u01E1': 'a',
724
+ '\u00E4': 'a',
725
+ '\u01DF': 'a',
726
+ '\u1EA3': 'a',
727
+ '\u00E5': 'a',
728
+ '\u01FB': 'a',
729
+ '\u01CE': 'a',
730
+ '\u0201': 'a',
731
+ '\u0203': 'a',
732
+ '\u1EA1': 'a',
733
+ '\u1EAD': 'a',
734
+ '\u1EB7': 'a',
735
+ '\u1E01': 'a',
736
+ '\u0105': 'a',
737
+ '\u2C65': 'a',
738
+ '\u0250': 'a',
739
+ '\uA733': 'aa',
740
+ '\u00E6': 'ae',
741
+ '\u01FD': 'ae',
742
+ '\u01E3': 'ae',
743
+ '\uA735': 'ao',
744
+ '\uA737': 'au',
745
+ '\uA739': 'av',
746
+ '\uA73B': 'av',
747
+ '\uA73D': 'ay',
748
+ '\u24D1': 'b',
749
+ '\uFF42': 'b',
750
+ '\u1E03': 'b',
751
+ '\u1E05': 'b',
752
+ '\u1E07': 'b',
753
+ '\u0180': 'b',
754
+ '\u0183': 'b',
755
+ '\u0253': 'b',
756
+ '\u24D2': 'c',
757
+ '\uFF43': 'c',
758
+ '\u0107': 'c',
759
+ '\u0109': 'c',
760
+ '\u010B': 'c',
761
+ '\u010D': 'c',
762
+ '\u00E7': 'c',
763
+ '\u1E09': 'c',
764
+ '\u0188': 'c',
765
+ '\u023C': 'c',
766
+ '\uA73F': 'c',
767
+ '\u2184': 'c',
768
+ '\u24D3': 'd',
769
+ '\uFF44': 'd',
770
+ '\u1E0B': 'd',
771
+ '\u010F': 'd',
772
+ '\u1E0D': 'd',
773
+ '\u1E11': 'd',
774
+ '\u1E13': 'd',
775
+ '\u1E0F': 'd',
776
+ '\u0111': 'd',
777
+ '\u018C': 'd',
778
+ '\u0256': 'd',
779
+ '\u0257': 'd',
780
+ '\uA77A': 'd',
781
+ '\u01F3': 'dz',
782
+ '\u01C6': 'dz',
783
+ '\u24D4': 'e',
784
+ '\uFF45': 'e',
785
+ '\u00E8': 'e',
786
+ '\u00E9': 'e',
787
+ '\u00EA': 'e',
788
+ '\u1EC1': 'e',
789
+ '\u1EBF': 'e',
790
+ '\u1EC5': 'e',
791
+ '\u1EC3': 'e',
792
+ '\u1EBD': 'e',
793
+ '\u0113': 'e',
794
+ '\u1E15': 'e',
795
+ '\u1E17': 'e',
796
+ '\u0115': 'e',
797
+ '\u0117': 'e',
798
+ '\u00EB': 'e',
799
+ '\u1EBB': 'e',
800
+ '\u011B': 'e',
801
+ '\u0205': 'e',
802
+ '\u0207': 'e',
803
+ '\u1EB9': 'e',
804
+ '\u1EC7': 'e',
805
+ '\u0229': 'e',
806
+ '\u1E1D': 'e',
807
+ '\u0119': 'e',
808
+ '\u1E19': 'e',
809
+ '\u1E1B': 'e',
810
+ '\u0247': 'e',
811
+ '\u025B': 'e',
812
+ '\u01DD': 'e',
813
+ '\u24D5': 'f',
814
+ '\uFF46': 'f',
815
+ '\u1E1F': 'f',
816
+ '\u0192': 'f',
817
+ '\uA77C': 'f',
818
+ '\u24D6': 'g',
819
+ '\uFF47': 'g',
820
+ '\u01F5': 'g',
821
+ '\u011D': 'g',
822
+ '\u1E21': 'g',
823
+ '\u011F': 'g',
824
+ '\u0121': 'g',
825
+ '\u01E7': 'g',
826
+ '\u0123': 'g',
827
+ '\u01E5': 'g',
828
+ '\u0260': 'g',
829
+ '\uA7A1': 'g',
830
+ '\u1D79': 'g',
831
+ '\uA77F': 'g',
832
+ '\u24D7': 'h',
833
+ '\uFF48': 'h',
834
+ '\u0125': 'h',
835
+ '\u1E23': 'h',
836
+ '\u1E27': 'h',
837
+ '\u021F': 'h',
838
+ '\u1E25': 'h',
839
+ '\u1E29': 'h',
840
+ '\u1E2B': 'h',
841
+ '\u1E96': 'h',
842
+ '\u0127': 'h',
843
+ '\u2C68': 'h',
844
+ '\u2C76': 'h',
845
+ '\u0265': 'h',
846
+ '\u0195': 'hv',
847
+ '\u24D8': 'i',
848
+ '\uFF49': 'i',
849
+ '\u00EC': 'i',
850
+ '\u00ED': 'i',
851
+ '\u00EE': 'i',
852
+ '\u0129': 'i',
853
+ '\u012B': 'i',
854
+ '\u012D': 'i',
855
+ '\u00EF': 'i',
856
+ '\u1E2F': 'i',
857
+ '\u1EC9': 'i',
858
+ '\u01D0': 'i',
859
+ '\u0209': 'i',
860
+ '\u020B': 'i',
861
+ '\u1ECB': 'i',
862
+ '\u012F': 'i',
863
+ '\u1E2D': 'i',
864
+ '\u0268': 'i',
865
+ '\u0131': 'i',
866
+ '\u24D9': 'j',
867
+ '\uFF4A': 'j',
868
+ '\u0135': 'j',
869
+ '\u01F0': 'j',
870
+ '\u0249': 'j',
871
+ '\u24DA': 'k',
872
+ '\uFF4B': 'k',
873
+ '\u1E31': 'k',
874
+ '\u01E9': 'k',
875
+ '\u1E33': 'k',
876
+ '\u0137': 'k',
877
+ '\u1E35': 'k',
878
+ '\u0199': 'k',
879
+ '\u2C6A': 'k',
880
+ '\uA741': 'k',
881
+ '\uA743': 'k',
882
+ '\uA745': 'k',
883
+ '\uA7A3': 'k',
884
+ '\u24DB': 'l',
885
+ '\uFF4C': 'l',
886
+ '\u0140': 'l',
887
+ '\u013A': 'l',
888
+ '\u013E': 'l',
889
+ '\u1E37': 'l',
890
+ '\u1E39': 'l',
891
+ '\u013C': 'l',
892
+ '\u1E3D': 'l',
893
+ '\u1E3B': 'l',
894
+ '\u017F': 'l',
895
+ '\u0142': 'l',
896
+ '\u019A': 'l',
897
+ '\u026B': 'l',
898
+ '\u2C61': 'l',
899
+ '\uA749': 'l',
900
+ '\uA781': 'l',
901
+ '\uA747': 'l',
902
+ '\u01C9': 'lj',
903
+ '\u24DC': 'm',
904
+ '\uFF4D': 'm',
905
+ '\u1E3F': 'm',
906
+ '\u1E41': 'm',
907
+ '\u1E43': 'm',
908
+ '\u0271': 'm',
909
+ '\u026F': 'm',
910
+ '\u24DD': 'n',
911
+ '\uFF4E': 'n',
912
+ '\u01F9': 'n',
913
+ '\u0144': 'n',
914
+ '\u00F1': 'n',
915
+ '\u1E45': 'n',
916
+ '\u0148': 'n',
917
+ '\u1E47': 'n',
918
+ '\u0146': 'n',
919
+ '\u1E4B': 'n',
920
+ '\u1E49': 'n',
921
+ '\u019E': 'n',
922
+ '\u0272': 'n',
923
+ '\u0149': 'n',
924
+ '\uA791': 'n',
925
+ '\uA7A5': 'n',
926
+ '\u01CC': 'nj',
927
+ '\u24DE': 'o',
928
+ '\uFF4F': 'o',
929
+ '\u00F2': 'o',
930
+ '\u00F3': 'o',
931
+ '\u00F4': 'o',
932
+ '\u1ED3': 'o',
933
+ '\u1ED1': 'o',
934
+ '\u1ED7': 'o',
935
+ '\u1ED5': 'o',
936
+ '\u00F5': 'o',
937
+ '\u1E4D': 'o',
938
+ '\u022D': 'o',
939
+ '\u1E4F': 'o',
940
+ '\u014D': 'o',
941
+ '\u1E51': 'o',
942
+ '\u1E53': 'o',
943
+ '\u014F': 'o',
944
+ '\u022F': 'o',
945
+ '\u0231': 'o',
946
+ '\u00F6': 'o',
947
+ '\u022B': 'o',
948
+ '\u1ECF': 'o',
949
+ '\u0151': 'o',
950
+ '\u01D2': 'o',
951
+ '\u020D': 'o',
952
+ '\u020F': 'o',
953
+ '\u01A1': 'o',
954
+ '\u1EDD': 'o',
955
+ '\u1EDB': 'o',
956
+ '\u1EE1': 'o',
957
+ '\u1EDF': 'o',
958
+ '\u1EE3': 'o',
959
+ '\u1ECD': 'o',
960
+ '\u1ED9': 'o',
961
+ '\u01EB': 'o',
962
+ '\u01ED': 'o',
963
+ '\u00F8': 'o',
964
+ '\u01FF': 'o',
965
+ '\u0254': 'o',
966
+ '\uA74B': 'o',
967
+ '\uA74D': 'o',
968
+ '\u0275': 'o',
969
+ '\u01A3': 'oi',
970
+ '\u0223': 'ou',
971
+ '\uA74F': 'oo',
972
+ '\u24DF': 'p',
973
+ '\uFF50': 'p',
974
+ '\u1E55': 'p',
975
+ '\u1E57': 'p',
976
+ '\u01A5': 'p',
977
+ '\u1D7D': 'p',
978
+ '\uA751': 'p',
979
+ '\uA753': 'p',
980
+ '\uA755': 'p',
981
+ '\u24E0': 'q',
982
+ '\uFF51': 'q',
983
+ '\u024B': 'q',
984
+ '\uA757': 'q',
985
+ '\uA759': 'q',
986
+ '\u24E1': 'r',
987
+ '\uFF52': 'r',
988
+ '\u0155': 'r',
989
+ '\u1E59': 'r',
990
+ '\u0159': 'r',
991
+ '\u0211': 'r',
992
+ '\u0213': 'r',
993
+ '\u1E5B': 'r',
994
+ '\u1E5D': 'r',
995
+ '\u0157': 'r',
996
+ '\u1E5F': 'r',
997
+ '\u024D': 'r',
998
+ '\u027D': 'r',
999
+ '\uA75B': 'r',
1000
+ '\uA7A7': 'r',
1001
+ '\uA783': 'r',
1002
+ '\u24E2': 's',
1003
+ '\uFF53': 's',
1004
+ '\u00DF': 's',
1005
+ '\u015B': 's',
1006
+ '\u1E65': 's',
1007
+ '\u015D': 's',
1008
+ '\u1E61': 's',
1009
+ '\u0161': 's',
1010
+ '\u1E67': 's',
1011
+ '\u1E63': 's',
1012
+ '\u1E69': 's',
1013
+ '\u0219': 's',
1014
+ '\u015F': 's',
1015
+ '\u023F': 's',
1016
+ '\uA7A9': 's',
1017
+ '\uA785': 's',
1018
+ '\u1E9B': 's',
1019
+ '\u24E3': 't',
1020
+ '\uFF54': 't',
1021
+ '\u1E6B': 't',
1022
+ '\u1E97': 't',
1023
+ '\u0165': 't',
1024
+ '\u1E6D': 't',
1025
+ '\u021B': 't',
1026
+ '\u0163': 't',
1027
+ '\u1E71': 't',
1028
+ '\u1E6F': 't',
1029
+ '\u0167': 't',
1030
+ '\u01AD': 't',
1031
+ '\u0288': 't',
1032
+ '\u2C66': 't',
1033
+ '\uA787': 't',
1034
+ '\uA729': 'tz',
1035
+ '\u24E4': 'u',
1036
+ '\uFF55': 'u',
1037
+ '\u00F9': 'u',
1038
+ '\u00FA': 'u',
1039
+ '\u00FB': 'u',
1040
+ '\u0169': 'u',
1041
+ '\u1E79': 'u',
1042
+ '\u016B': 'u',
1043
+ '\u1E7B': 'u',
1044
+ '\u016D': 'u',
1045
+ '\u00FC': 'u',
1046
+ '\u01DC': 'u',
1047
+ '\u01D8': 'u',
1048
+ '\u01D6': 'u',
1049
+ '\u01DA': 'u',
1050
+ '\u1EE7': 'u',
1051
+ '\u016F': 'u',
1052
+ '\u0171': 'u',
1053
+ '\u01D4': 'u',
1054
+ '\u0215': 'u',
1055
+ '\u0217': 'u',
1056
+ '\u01B0': 'u',
1057
+ '\u1EEB': 'u',
1058
+ '\u1EE9': 'u',
1059
+ '\u1EEF': 'u',
1060
+ '\u1EED': 'u',
1061
+ '\u1EF1': 'u',
1062
+ '\u1EE5': 'u',
1063
+ '\u1E73': 'u',
1064
+ '\u0173': 'u',
1065
+ '\u1E77': 'u',
1066
+ '\u1E75': 'u',
1067
+ '\u0289': 'u',
1068
+ '\u24E5': 'v',
1069
+ '\uFF56': 'v',
1070
+ '\u1E7D': 'v',
1071
+ '\u1E7F': 'v',
1072
+ '\u028B': 'v',
1073
+ '\uA75F': 'v',
1074
+ '\u028C': 'v',
1075
+ '\uA761': 'vy',
1076
+ '\u24E6': 'w',
1077
+ '\uFF57': 'w',
1078
+ '\u1E81': 'w',
1079
+ '\u1E83': 'w',
1080
+ '\u0175': 'w',
1081
+ '\u1E87': 'w',
1082
+ '\u1E85': 'w',
1083
+ '\u1E98': 'w',
1084
+ '\u1E89': 'w',
1085
+ '\u2C73': 'w',
1086
+ '\u24E7': 'x',
1087
+ '\uFF58': 'x',
1088
+ '\u1E8B': 'x',
1089
+ '\u1E8D': 'x',
1090
+ '\u24E8': 'y',
1091
+ '\uFF59': 'y',
1092
+ '\u1EF3': 'y',
1093
+ '\u00FD': 'y',
1094
+ '\u0177': 'y',
1095
+ '\u1EF9': 'y',
1096
+ '\u0233': 'y',
1097
+ '\u1E8F': 'y',
1098
+ '\u00FF': 'y',
1099
+ '\u1EF7': 'y',
1100
+ '\u1E99': 'y',
1101
+ '\u1EF5': 'y',
1102
+ '\u01B4': 'y',
1103
+ '\u024F': 'y',
1104
+ '\u1EFF': 'y',
1105
+ '\u24E9': 'z',
1106
+ '\uFF5A': 'z',
1107
+ '\u017A': 'z',
1108
+ '\u1E91': 'z',
1109
+ '\u017C': 'z',
1110
+ '\u017E': 'z',
1111
+ '\u1E93': 'z',
1112
+ '\u1E95': 'z',
1113
+ '\u01B6': 'z',
1114
+ '\u0225': 'z',
1115
+ '\u0240': 'z',
1116
+ '\u2C6C': 'z',
1117
+ '\uA763': 'z',
1118
+ '\u0386': '\u0391',
1119
+ '\u0388': '\u0395',
1120
+ '\u0389': '\u0397',
1121
+ '\u038A': '\u0399',
1122
+ '\u03AA': '\u0399',
1123
+ '\u038C': '\u039F',
1124
+ '\u038E': '\u03A5',
1125
+ '\u03AB': '\u03A5',
1126
+ '\u038F': '\u03A9',
1127
+ '\u03AC': '\u03B1',
1128
+ '\u03AD': '\u03B5',
1129
+ '\u03AE': '\u03B7',
1130
+ '\u03AF': '\u03B9',
1131
+ '\u03CA': '\u03B9',
1132
+ '\u0390': '\u03B9',
1133
+ '\u03CC': '\u03BF',
1134
+ '\u03CD': '\u03C5',
1135
+ '\u03CB': '\u03C5',
1136
+ '\u03B0': '\u03C5',
1137
+ '\u03C9': '\u03C9',
1138
+ '\u03C2': '\u03C3'
1139
+ };
1140
+ /**
1141
+ * @param {?} text
1142
+ * @return {?}
1143
+ */
1144
+ function stripSpecialChars(text) {
1145
+ /** @type {?} */
1146
+ var match = (/**
1147
+ * @param {?} a
1148
+ * @return {?}
1149
+ */
1150
+ function (a) {
1151
+ return diacritics[a] || a;
1152
+ });
1153
+ return text.replace(/[^\u0000-\u007E]/g, match);
1154
+ }
1155
+
1156
+ /**
1157
+ * @fileoverview added by tsickle
1158
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1159
+ */
1160
+ var ItemsList = /** @class */ (function () {
1161
+ function ItemsList(_ngSelect, _selectionModel) {
1162
+ this._ngSelect = _ngSelect;
1163
+ this._selectionModel = _selectionModel;
1164
+ this._items = [];
1165
+ this._filteredItems = [];
1166
+ this._markedIndex = -1;
1167
+ }
1168
+ Object.defineProperty(ItemsList.prototype, "items", {
1169
+ get: /**
1170
+ * @return {?}
1171
+ */
1172
+ function () {
1173
+ return this._items;
1174
+ },
1175
+ enumerable: true,
1176
+ configurable: true
1177
+ });
1178
+ Object.defineProperty(ItemsList.prototype, "filteredItems", {
1179
+ get: /**
1180
+ * @return {?}
1181
+ */
1182
+ function () {
1183
+ return this._filteredItems;
1184
+ },
1185
+ enumerable: true,
1186
+ configurable: true
1187
+ });
1188
+ Object.defineProperty(ItemsList.prototype, "markedIndex", {
1189
+ get: /**
1190
+ * @return {?}
1191
+ */
1192
+ function () {
1193
+ return this._markedIndex;
1194
+ },
1195
+ enumerable: true,
1196
+ configurable: true
1197
+ });
1198
+ Object.defineProperty(ItemsList.prototype, "selectedItems", {
1199
+ get: /**
1200
+ * @return {?}
1201
+ */
1202
+ function () {
1203
+ return this._selectionModel.value;
1204
+ },
1205
+ enumerable: true,
1206
+ configurable: true
1207
+ });
1208
+ Object.defineProperty(ItemsList.prototype, "markedItem", {
1209
+ get: /**
1210
+ * @return {?}
1211
+ */
1212
+ function () {
1213
+ return this._filteredItems[this._markedIndex];
1214
+ },
1215
+ enumerable: true,
1216
+ configurable: true
1217
+ });
1218
+ Object.defineProperty(ItemsList.prototype, "noItemsToSelect", {
1219
+ get: /**
1220
+ * @return {?}
1221
+ */
1222
+ function () {
1223
+ return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1224
+ },
1225
+ enumerable: true,
1226
+ configurable: true
1227
+ });
1228
+ Object.defineProperty(ItemsList.prototype, "maxItemsSelected", {
1229
+ get: /**
1230
+ * @return {?}
1231
+ */
1232
+ function () {
1233
+ return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1234
+ },
1235
+ enumerable: true,
1236
+ configurable: true
1237
+ });
1238
+ Object.defineProperty(ItemsList.prototype, "lastSelectedItem", {
1239
+ get: /**
1240
+ * @return {?}
1241
+ */
1242
+ function () {
1243
+ /** @type {?} */
1244
+ var i = this.selectedItems.length - 1;
1245
+ for (; i >= 0; i--) {
1246
+ /** @type {?} */
1247
+ var item = this.selectedItems[i];
1248
+ if (!item.disabled) {
1249
+ return item;
1250
+ }
1251
+ }
1252
+ return null;
1253
+ },
1254
+ enumerable: true,
1255
+ configurable: true
1256
+ });
1257
+ /**
1258
+ * @param {?} items
1259
+ * @return {?}
1260
+ */
1261
+ ItemsList.prototype.setItems = /**
1262
+ * @param {?} items
1263
+ * @return {?}
1264
+ */
1265
+ function (items) {
1266
+ var _this = this;
1267
+ this._items = items.map((/**
1268
+ * @param {?} item
1269
+ * @param {?} index
1270
+ * @return {?}
1271
+ */
1272
+ function (item, index) { return _this.mapItem(item, index); }));
1273
+ if (this._ngSelect.groupBy) {
1274
+ this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1275
+ this._items = this._flatten(this._groups);
1276
+ }
1277
+ else {
1278
+ this._groups = new Map();
1279
+ this._groups.set(undefined, this._items);
1280
+ }
1281
+ this._filteredItems = __spread(this._items);
1282
+ };
1283
+ /**
1284
+ * @param {?} item
1285
+ * @return {?}
1286
+ */
1287
+ ItemsList.prototype.select = /**
1288
+ * @param {?} item
1289
+ * @return {?}
1290
+ */
1291
+ function (item) {
1292
+ if (item.selected || this.maxItemsSelected) {
1293
+ return;
1294
+ }
1295
+ /** @type {?} */
1296
+ var multiple = this._ngSelect.multiple;
1297
+ if (!multiple) {
1298
+ this.clearSelected();
1299
+ }
1300
+ this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1301
+ if (this._ngSelect.hideSelected) {
1302
+ this._hideSelected(item);
1303
+ }
1304
+ };
1305
+ /**
1306
+ * @param {?} item
1307
+ * @return {?}
1308
+ */
1309
+ ItemsList.prototype.unselect = /**
1310
+ * @param {?} item
1311
+ * @return {?}
1312
+ */
1313
+ function (item) {
1314
+ if (!item.selected) {
1315
+ return;
1316
+ }
1317
+ this._selectionModel.unselect(item, this._ngSelect.multiple);
1318
+ if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1319
+ this._showSelected(item);
1320
+ }
1321
+ };
1322
+ /**
1323
+ * @param {?} value
1324
+ * @return {?}
1325
+ */
1326
+ ItemsList.prototype.findItem = /**
1327
+ * @param {?} value
1328
+ * @return {?}
1329
+ */
1330
+ function (value) {
1331
+ var _this = this;
1332
+ /** @type {?} */
1333
+ var findBy;
1334
+ if (this._ngSelect.compareWith) {
1335
+ findBy = (/**
1336
+ * @param {?} item
1337
+ * @return {?}
1338
+ */
1339
+ function (item) { return _this._ngSelect.compareWith(item.value, value); });
1340
+ }
1341
+ else if (this._ngSelect.bindValue) {
1342
+ findBy = (/**
1343
+ * @param {?} item
1344
+ * @return {?}
1345
+ */
1346
+ function (item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; });
1347
+ }
1348
+ else {
1349
+ findBy = (/**
1350
+ * @param {?} item
1351
+ * @return {?}
1352
+ */
1353
+ function (item) { return item.value === value ||
1354
+ !item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); });
1355
+ }
1356
+ return this._items.find((/**
1357
+ * @param {?} item
1358
+ * @return {?}
1359
+ */
1360
+ function (item) { return findBy(item); }));
1361
+ };
1362
+ /**
1363
+ * @param {?} item
1364
+ * @return {?}
1365
+ */
1366
+ ItemsList.prototype.addItem = /**
1367
+ * @param {?} item
1368
+ * @return {?}
1369
+ */
1370
+ function (item) {
1371
+ /** @type {?} */
1372
+ var option = this.mapItem(item, this._items.length);
1373
+ this._items.push(option);
1374
+ this._filteredItems.push(option);
1375
+ return option;
1376
+ };
1377
+ /**
1378
+ * @param {?=} keepDisabled
1379
+ * @return {?}
1380
+ */
1381
+ ItemsList.prototype.clearSelected = /**
1382
+ * @param {?=} keepDisabled
1383
+ * @return {?}
1384
+ */
1385
+ function (keepDisabled) {
1386
+ if (keepDisabled === void 0) { keepDisabled = false; }
1387
+ this._selectionModel.clear(keepDisabled);
1388
+ this._items.forEach((/**
1389
+ * @param {?} item
1390
+ * @return {?}
1391
+ */
1392
+ function (item) {
1393
+ item.selected = keepDisabled && item.selected && item.disabled;
1394
+ item.marked = false;
1395
+ }));
1396
+ if (this._ngSelect.hideSelected) {
1397
+ this.resetFilteredItems();
1398
+ }
1399
+ };
1400
+ /**
1401
+ * @param {?} term
1402
+ * @return {?}
1403
+ */
1404
+ ItemsList.prototype.findByLabel = /**
1405
+ * @param {?} term
1406
+ * @return {?}
1407
+ */
1408
+ function (term) {
1409
+ term = stripSpecialChars(term).toLocaleLowerCase();
1410
+ return this.filteredItems.find((/**
1411
+ * @param {?} item
1412
+ * @return {?}
1413
+ */
1414
+ function (item) {
1415
+ /** @type {?} */
1416
+ var label = stripSpecialChars(item.label).toLocaleLowerCase();
1417
+ return label.substr(0, term.length) === term;
1418
+ }));
1419
+ };
1420
+ /**
1421
+ * @param {?} term
1422
+ * @return {?}
1423
+ */
1424
+ ItemsList.prototype.filter = /**
1425
+ * @param {?} term
1426
+ * @return {?}
1427
+ */
1428
+ function (term) {
1429
+ var e_1, _a;
1430
+ if (!term) {
1431
+ this.resetFilteredItems();
1432
+ return;
1433
+ }
1434
+ this._filteredItems = [];
1435
+ term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1436
+ /** @type {?} */
1437
+ var match = this._ngSelect.searchFn || this._defaultSearchFn;
1438
+ /** @type {?} */
1439
+ var hideSelected = this._ngSelect.hideSelected;
1440
+ var _loop_1 = function (key) {
1441
+ var e_2, _a, _b;
1442
+ /** @type {?} */
1443
+ var matchedItems = [];
1444
+ try {
1445
+ for (var _c = __values(this_1._groups.get(key)), _d = _c.next(); !_d.done; _d = _c.next()) {
1446
+ var item = _d.value;
1447
+ if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
1448
+ continue;
1449
+ }
1450
+ /** @type {?} */
1451
+ var searchItem = this_1._ngSelect.searchFn ? item.value : item;
1452
+ if (match(term, searchItem)) {
1453
+ matchedItems.push(item);
1454
+ }
1455
+ }
1456
+ }
1457
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1458
+ finally {
1459
+ try {
1460
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1461
+ }
1462
+ finally { if (e_2) throw e_2.error; }
1463
+ }
1464
+ if (matchedItems.length > 0) {
1465
+ var _e = __read(matchedItems.slice(-1), 1), last_1 = _e[0];
1466
+ if (last_1.parent) {
1467
+ /** @type {?} */
1468
+ var head = this_1._items.find((/**
1469
+ * @param {?} x
1470
+ * @return {?}
1471
+ */
1472
+ function (x) { return x === last_1.parent; }));
1473
+ this_1._filteredItems.push(head);
1474
+ }
1475
+ (_b = this_1._filteredItems).push.apply(_b, __spread(matchedItems));
1476
+ }
1477
+ };
1478
+ var this_1 = this;
1479
+ try {
1480
+ for (var _b = __values(Array.from(this._groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1481
+ var key = _c.value;
1482
+ _loop_1(key);
1483
+ }
1484
+ }
1485
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1486
+ finally {
1487
+ try {
1488
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1489
+ }
1490
+ finally { if (e_1) throw e_1.error; }
1491
+ }
1492
+ };
1493
+ /**
1494
+ * @return {?}
1495
+ */
1496
+ ItemsList.prototype.resetFilteredItems = /**
1497
+ * @return {?}
1498
+ */
1499
+ function () {
1500
+ if (this._filteredItems.length === this._items.length) {
1501
+ return;
1502
+ }
1503
+ if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1504
+ this._filteredItems = this._items.filter((/**
1505
+ * @param {?} x
1506
+ * @return {?}
1507
+ */
1508
+ function (x) { return !x.selected; }));
1509
+ }
1510
+ else {
1511
+ this._filteredItems = this._items;
1512
+ }
1513
+ };
1514
+ /**
1515
+ * @return {?}
1516
+ */
1517
+ ItemsList.prototype.unmarkItem = /**
1518
+ * @return {?}
1519
+ */
1520
+ function () {
1521
+ this._markedIndex = -1;
1522
+ };
1523
+ /**
1524
+ * @return {?}
1525
+ */
1526
+ ItemsList.prototype.markNextItem = /**
1527
+ * @return {?}
1528
+ */
1529
+ function () {
1530
+ this._stepToItem(+1);
1531
+ };
1532
+ /**
1533
+ * @return {?}
1534
+ */
1535
+ ItemsList.prototype.markPreviousItem = /**
1536
+ * @return {?}
1537
+ */
1538
+ function () {
1539
+ this._stepToItem(-1);
1540
+ };
1541
+ /**
1542
+ * @param {?} item
1543
+ * @return {?}
1544
+ */
1545
+ ItemsList.prototype.markItem = /**
1546
+ * @param {?} item
1547
+ * @return {?}
1548
+ */
1549
+ function (item) {
1550
+ this._markedIndex = this._filteredItems.indexOf(item);
1551
+ };
1552
+ /**
1553
+ * @param {?=} markDefault
1554
+ * @return {?}
1555
+ */
1556
+ ItemsList.prototype.markSelectedOrDefault = /**
1557
+ * @param {?=} markDefault
1558
+ * @return {?}
1559
+ */
1560
+ function (markDefault) {
1561
+ if (this._filteredItems.length === 0) {
1562
+ return;
1563
+ }
1564
+ /** @type {?} */
1565
+ var lastMarkedIndex = this._getLastMarkedIndex();
1566
+ if (lastMarkedIndex > -1) {
1567
+ this._markedIndex = lastMarkedIndex;
1568
+ }
1569
+ else {
1570
+ this._markedIndex = markDefault ? this.filteredItems.findIndex((/**
1571
+ * @param {?} x
1572
+ * @return {?}
1573
+ */
1574
+ function (x) { return !x.disabled; })) : -1;
1575
+ }
1576
+ };
1577
+ /**
1578
+ * @param {?} option
1579
+ * @param {?} key
1580
+ * @return {?}
1581
+ */
1582
+ ItemsList.prototype.resolveNested = /**
1583
+ * @param {?} option
1584
+ * @param {?} key
1585
+ * @return {?}
1586
+ */
1587
+ function (option, key) {
1588
+ if (!isObject(option)) {
1589
+ return option;
1590
+ }
1591
+ if (key.indexOf('.') === -1) {
1592
+ return option[key];
1593
+ }
1594
+ else {
1595
+ /** @type {?} */
1596
+ var keys = key.split('.');
1597
+ /** @type {?} */
1598
+ var value = option;
1599
+ for (var i = 0, len = keys.length; i < len; ++i) {
1600
+ if (value == null) {
1601
+ return null;
1602
+ }
1603
+ value = value[keys[i]];
1604
+ }
1605
+ return value;
1606
+ }
1607
+ };
1608
+ /**
1609
+ * @param {?} item
1610
+ * @param {?} index
1611
+ * @return {?}
1612
+ */
1613
+ ItemsList.prototype.mapItem = /**
1614
+ * @param {?} item
1615
+ * @param {?} index
1616
+ * @return {?}
1617
+ */
1618
+ function (item, index) {
1619
+ /** @type {?} */
1620
+ var label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
1621
+ /** @type {?} */
1622
+ var value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1623
+ return {
1624
+ index: index,
1625
+ label: isDefined(label) ? label.toString() : '',
1626
+ value: value,
1627
+ disabled: item.disabled,
1628
+ htmlId: this._ngSelect.dropdownId + "-" + index,
1629
+ };
1630
+ };
1631
+ /**
1632
+ * @return {?}
1633
+ */
1634
+ ItemsList.prototype.mapSelectedItems = /**
1635
+ * @return {?}
1636
+ */
1637
+ function () {
1638
+ var _this = this;
1639
+ var e_3, _a;
1640
+ /** @type {?} */
1641
+ var multiple = this._ngSelect.multiple;
1642
+ try {
1643
+ for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
1644
+ var selected = _c.value;
1645
+ /** @type {?} */
1646
+ var value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
1647
+ /** @type {?} */
1648
+ var item = isDefined(value) ? this.findItem(value) : null;
1649
+ this._selectionModel.unselect(selected, multiple);
1650
+ this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1651
+ }
1652
+ }
1653
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1654
+ finally {
1655
+ try {
1656
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1657
+ }
1658
+ finally { if (e_3) throw e_3.error; }
1659
+ }
1660
+ if (this._ngSelect.hideSelected) {
1661
+ this._filteredItems = this.filteredItems.filter((/**
1662
+ * @param {?} x
1663
+ * @return {?}
1664
+ */
1665
+ function (x) { return _this.selectedItems.indexOf(x) === -1; }));
1666
+ }
1667
+ };
1668
+ /**
1669
+ * @private
1670
+ * @param {?} item
1671
+ * @return {?}
1672
+ */
1673
+ ItemsList.prototype._showSelected = /**
1674
+ * @private
1675
+ * @param {?} item
1676
+ * @return {?}
1677
+ */
1678
+ function (item) {
1679
+ var e_4, _a;
1680
+ this._filteredItems.push(item);
1681
+ if (item.parent) {
1682
+ /** @type {?} */
1683
+ var parent_1 = item.parent;
1684
+ /** @type {?} */
1685
+ var parentExists = this._filteredItems.find((/**
1686
+ * @param {?} x
1687
+ * @return {?}
1688
+ */
1689
+ function (x) { return x === parent_1; }));
1690
+ if (!parentExists) {
1691
+ this._filteredItems.push(parent_1);
1692
+ }
1693
+ }
1694
+ else if (item.children) {
1695
+ try {
1696
+ for (var _b = __values(item.children), _c = _b.next(); !_c.done; _c = _b.next()) {
1697
+ var child = _c.value;
1698
+ child.selected = false;
1699
+ this._filteredItems.push(child);
1700
+ }
1701
+ }
1702
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1703
+ finally {
1704
+ try {
1705
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1706
+ }
1707
+ finally { if (e_4) throw e_4.error; }
1708
+ }
1709
+ }
1710
+ this._filteredItems = __spread(this._filteredItems.sort((/**
1711
+ * @param {?} a
1712
+ * @param {?} b
1713
+ * @return {?}
1714
+ */
1715
+ function (a, b) { return (a.index - b.index); })));
1716
+ };
1717
+ /**
1718
+ * @private
1719
+ * @param {?} item
1720
+ * @return {?}
1721
+ */
1722
+ ItemsList.prototype._hideSelected = /**
1723
+ * @private
1724
+ * @param {?} item
1725
+ * @return {?}
1726
+ */
1727
+ function (item) {
1728
+ this._filteredItems = this._filteredItems.filter((/**
1729
+ * @param {?} x
1730
+ * @return {?}
1731
+ */
1732
+ function (x) { return x !== item; }));
1733
+ if (item.parent) {
1734
+ /** @type {?} */
1735
+ var children = item.parent.children;
1736
+ if (children.every((/**
1737
+ * @param {?} x
1738
+ * @return {?}
1739
+ */
1740
+ function (x) { return x.selected; }))) {
1741
+ this._filteredItems = this._filteredItems.filter((/**
1742
+ * @param {?} x
1743
+ * @return {?}
1744
+ */
1745
+ function (x) { return x !== item.parent; }));
1746
+ }
1747
+ }
1748
+ else if (item.children) {
1749
+ this._filteredItems = this.filteredItems.filter((/**
1750
+ * @param {?} x
1751
+ * @return {?}
1752
+ */
1753
+ function (x) { return x.parent !== item; }));
1754
+ }
1755
+ };
1756
+ /**
1757
+ * @private
1758
+ * @param {?} search
1759
+ * @param {?} opt
1760
+ * @return {?}
1761
+ */
1762
+ ItemsList.prototype._defaultSearchFn = /**
1763
+ * @private
1764
+ * @param {?} search
1765
+ * @param {?} opt
1766
+ * @return {?}
1767
+ */
1768
+ function (search, opt) {
1769
+ /** @type {?} */
1770
+ var label = stripSpecialChars(opt.label).toLocaleLowerCase();
1771
+ return label.indexOf(search) > -1;
1772
+ };
1773
+ /**
1774
+ * @private
1775
+ * @param {?} steps
1776
+ * @return {?}
1777
+ */
1778
+ ItemsList.prototype._getNextItemIndex = /**
1779
+ * @private
1780
+ * @param {?} steps
1781
+ * @return {?}
1782
+ */
1783
+ function (steps) {
1784
+ if (steps > 0) {
1785
+ return (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
1786
+ }
1787
+ return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
1788
+ };
1789
+ /**
1790
+ * @private
1791
+ * @param {?} steps
1792
+ * @return {?}
1793
+ */
1794
+ ItemsList.prototype._stepToItem = /**
1795
+ * @private
1796
+ * @param {?} steps
1797
+ * @return {?}
1798
+ */
1799
+ function (steps) {
1800
+ if (this._filteredItems.length === 0 || this._filteredItems.every((/**
1801
+ * @param {?} x
1802
+ * @return {?}
1803
+ */
1804
+ function (x) { return x.disabled; }))) {
1805
+ return;
1806
+ }
1807
+ this._markedIndex = this._getNextItemIndex(steps);
1808
+ if (this.markedItem.disabled) {
1809
+ this._stepToItem(steps);
1810
+ }
1811
+ };
1812
+ /**
1813
+ * @private
1814
+ * @return {?}
1815
+ */
1816
+ ItemsList.prototype._getLastMarkedIndex = /**
1817
+ * @private
1818
+ * @return {?}
1819
+ */
1820
+ function () {
1821
+ if (this._ngSelect.hideSelected) {
1822
+ return -1;
1823
+ }
1824
+ if (this._markedIndex > -1 && this.markedItem === undefined) {
1825
+ return -1;
1826
+ }
1827
+ /** @type {?} */
1828
+ var selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1829
+ if (this.lastSelectedItem && selectedIndex < 0) {
1830
+ return -1;
1831
+ }
1832
+ return Math.max(this.markedIndex, selectedIndex);
1833
+ };
1834
+ /**
1835
+ * @private
1836
+ * @param {?} items
1837
+ * @param {?} prop
1838
+ * @return {?}
1839
+ */
1840
+ ItemsList.prototype._groupBy = /**
1841
+ * @private
1842
+ * @param {?} items
1843
+ * @param {?} prop
1844
+ * @return {?}
1845
+ */
1846
+ function (items, prop) {
1847
+ var _this = this;
1848
+ var e_5, _a, e_6, _b;
1849
+ /** @type {?} */
1850
+ var groups = new Map();
1851
+ if (items.length === 0) {
1852
+ return groups;
1853
+ }
1854
+ // Check if items are already grouped by given key.
1855
+ if (Array.isArray(items[0].value[(/** @type {?} */ (prop))])) {
1856
+ try {
1857
+ for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
1858
+ var item = items_1_1.value;
1859
+ /** @type {?} */
1860
+ var children = (item.value[(/** @type {?} */ (prop))] || []).map((/**
1861
+ * @param {?} x
1862
+ * @param {?} index
1863
+ * @return {?}
1864
+ */
1865
+ function (x, index) { return _this.mapItem(x, index); }));
1866
+ groups.set(item, children);
1867
+ }
1868
+ }
1869
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1870
+ finally {
1871
+ try {
1872
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
1873
+ }
1874
+ finally { if (e_5) throw e_5.error; }
1875
+ }
1876
+ return groups;
1877
+ }
1878
+ /** @type {?} */
1879
+ var isFnKey = isFunction(this._ngSelect.groupBy);
1880
+ /** @type {?} */
1881
+ var keyFn = (/**
1882
+ * @param {?} item
1883
+ * @return {?}
1884
+ */
1885
+ function (item) {
1886
+ /** @type {?} */
1887
+ var key = isFnKey ? ((/** @type {?} */ (prop)))(item.value) : item.value[(/** @type {?} */ (prop))];
1888
+ return isDefined(key) ? key : undefined;
1889
+ });
1890
+ try {
1891
+ // Group items by key.
1892
+ for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
1893
+ var item = items_2_1.value;
1894
+ /** @type {?} */
1895
+ var key = keyFn(item);
1896
+ /** @type {?} */
1897
+ var group = groups.get(key);
1898
+ if (group) {
1899
+ group.push(item);
1900
+ }
1901
+ else {
1902
+ groups.set(key, [item]);
1903
+ }
1904
+ }
1905
+ }
1906
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1907
+ finally {
1908
+ try {
1909
+ if (items_2_1 && !items_2_1.done && (_b = items_2.return)) _b.call(items_2);
1910
+ }
1911
+ finally { if (e_6) throw e_6.error; }
1912
+ }
1913
+ return groups;
1914
+ };
1915
+ /**
1916
+ * @private
1917
+ * @param {?} groups
1918
+ * @return {?}
1919
+ */
1920
+ ItemsList.prototype._flatten = /**
1921
+ * @private
1922
+ * @param {?} groups
1923
+ * @return {?}
1924
+ */
1925
+ function (groups) {
1926
+ var e_7, _a;
1927
+ /** @type {?} */
1928
+ var isGroupByFn = isFunction(this._ngSelect.groupBy);
1929
+ /** @type {?} */
1930
+ var items = [];
1931
+ var _loop_2 = function (key) {
1932
+ /** @type {?} */
1933
+ var i = items.length;
1934
+ if (key === undefined) {
1935
+ /** @type {?} */
1936
+ var withoutGroup = groups.get(undefined) || [];
1937
+ items.push.apply(items, __spread(withoutGroup.map((/**
1938
+ * @param {?} x
1939
+ * @return {?}
1940
+ */
1941
+ function (x) { return (__assign({}, x, { index: i++ })); }))));
1942
+ return "continue";
1943
+ }
1944
+ /** @type {?} */
1945
+ var isObjectKey = isObject(key);
1946
+ /** @type {?} */
1947
+ var parent_2 = {
1948
+ label: isObjectKey ? '' : String(key),
1949
+ children: undefined,
1950
+ parent: null,
1951
+ index: i++,
1952
+ disabled: !this_2._ngSelect.selectableGroup,
1953
+ htmlId: newId(),
1954
+ };
1955
+ /** @type {?} */
1956
+ var groupKey = isGroupByFn ? this_2._ngSelect.bindLabel : (/** @type {?} */ (this_2._ngSelect.groupBy));
1957
+ /** @type {?} */
1958
+ var groupValue = this_2._ngSelect.groupValue || ((/**
1959
+ * @return {?}
1960
+ */
1961
+ function () {
1962
+ var _a;
1963
+ if (isObjectKey) {
1964
+ return ((/** @type {?} */ (key))).value;
1965
+ }
1966
+ return _a = {}, _a[groupKey] = key, _a;
1967
+ }));
1968
+ /** @type {?} */
1969
+ var children = groups.get(key).map((/**
1970
+ * @param {?} x
1971
+ * @return {?}
1972
+ */
1973
+ function (x) {
1974
+ x.parent = parent_2;
1975
+ x.children = undefined;
1976
+ x.index = i++;
1977
+ return x;
1978
+ }));
1979
+ parent_2.children = children;
1980
+ parent_2.value = groupValue(key, children.map((/**
1981
+ * @param {?} x
1982
+ * @return {?}
1983
+ */
1984
+ function (x) { return x.value; })));
1985
+ items.push(parent_2);
1986
+ items.push.apply(items, __spread(children));
1987
+ };
1988
+ var this_2 = this;
1989
+ try {
1990
+ for (var _b = __values(Array.from(groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1991
+ var key = _c.value;
1992
+ _loop_2(key);
1993
+ }
1994
+ }
1995
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1996
+ finally {
1997
+ try {
1998
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1999
+ }
2000
+ finally { if (e_7) throw e_7.error; }
2001
+ }
2002
+ return items;
2003
+ };
2004
+ return ItemsList;
2005
+ }());
2006
+
2007
+ /**
2008
+ * @fileoverview added by tsickle
2009
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2010
+ */
2011
+ /** @enum {number} */
2012
+ var KeyCode = {
2013
+ Tab: 9,
2014
+ Enter: 13,
2015
+ Esc: 27,
2016
+ Space: 32,
2017
+ ArrowUp: 38,
2018
+ ArrowDown: 40,
2019
+ Backspace: 8,
2020
+ };
2021
+ KeyCode[KeyCode.Tab] = 'Tab';
2022
+ KeyCode[KeyCode.Enter] = 'Enter';
2023
+ KeyCode[KeyCode.Esc] = 'Esc';
2024
+ KeyCode[KeyCode.Space] = 'Space';
2025
+ KeyCode[KeyCode.ArrowUp] = 'ArrowUp';
2026
+ KeyCode[KeyCode.ArrowDown] = 'ArrowDown';
2027
+ KeyCode[KeyCode.Backspace] = 'Backspace';
2028
+
2029
+ /**
2030
+ * @fileoverview added by tsickle
2031
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2032
+ */
2033
+ var NgDropdownPanelService = /** @class */ (function () {
2034
+ function NgDropdownPanelService() {
2035
+ this._dimensions = {
2036
+ itemHeight: 0,
2037
+ panelHeight: 0,
2038
+ itemsPerViewport: 0
2039
+ };
2040
+ }
2041
+ Object.defineProperty(NgDropdownPanelService.prototype, "dimensions", {
2042
+ get: /**
2043
+ * @return {?}
2044
+ */
2045
+ function () {
2046
+ return this._dimensions;
2047
+ },
2048
+ enumerable: true,
2049
+ configurable: true
2050
+ });
2051
+ /**
2052
+ * @param {?} scrollPos
2053
+ * @param {?} itemsLength
2054
+ * @param {?} buffer
2055
+ * @return {?}
2056
+ */
2057
+ NgDropdownPanelService.prototype.calculateItems = /**
2058
+ * @param {?} scrollPos
2059
+ * @param {?} itemsLength
2060
+ * @param {?} buffer
2061
+ * @return {?}
2062
+ */
2063
+ function (scrollPos, itemsLength, buffer) {
2064
+ /** @type {?} */
2065
+ var d = this._dimensions;
2066
+ /** @type {?} */
2067
+ var scrollHeight = d.itemHeight * itemsLength;
2068
+ /** @type {?} */
2069
+ var scrollTop = Math.max(0, scrollPos);
2070
+ /** @type {?} */
2071
+ var indexByScrollTop = scrollTop / scrollHeight * itemsLength;
2072
+ /** @type {?} */
2073
+ var end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
2074
+ /** @type {?} */
2075
+ var maxStartEnd = end;
2076
+ /** @type {?} */
2077
+ var maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
2078
+ /** @type {?} */
2079
+ var start = Math.min(maxStart, Math.floor(indexByScrollTop));
2080
+ /** @type {?} */
2081
+ var topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
2082
+ topPadding = !isNaN(topPadding) ? topPadding : 0;
2083
+ start = !isNaN(start) ? start : -1;
2084
+ end = !isNaN(end) ? end : -1;
2085
+ start -= buffer;
2086
+ start = Math.max(0, start);
2087
+ end += buffer;
2088
+ end = Math.min(itemsLength, end);
2089
+ return {
2090
+ topPadding: topPadding,
2091
+ scrollHeight: scrollHeight,
2092
+ start: start,
2093
+ end: end
2094
+ };
2095
+ };
2096
+ /**
2097
+ * @param {?} itemHeight
2098
+ * @param {?} panelHeight
2099
+ * @return {?}
2100
+ */
2101
+ NgDropdownPanelService.prototype.setDimensions = /**
2102
+ * @param {?} itemHeight
2103
+ * @param {?} panelHeight
2104
+ * @return {?}
2105
+ */
2106
+ function (itemHeight, panelHeight) {
2107
+ /** @type {?} */
2108
+ var itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
2109
+ this._dimensions = {
2110
+ itemHeight: itemHeight,
2111
+ panelHeight: panelHeight,
2112
+ itemsPerViewport: itemsPerViewport
2113
+ };
2114
+ };
2115
+ /**
2116
+ * @param {?} itemTop
2117
+ * @param {?} itemHeight
2118
+ * @param {?} lastScroll
2119
+ * @return {?}
2120
+ */
2121
+ NgDropdownPanelService.prototype.getScrollTo = /**
2122
+ * @param {?} itemTop
2123
+ * @param {?} itemHeight
2124
+ * @param {?} lastScroll
2125
+ * @return {?}
2126
+ */
2127
+ function (itemTop, itemHeight, lastScroll) {
2128
+ /** @type {?} */
2129
+ var itemBottom = itemTop + itemHeight;
2130
+ /** @type {?} */
2131
+ var top = lastScroll;
2132
+ /** @type {?} */
2133
+ var bottom = top + this.dimensions.panelHeight;
2134
+ if (itemBottom > bottom) {
2135
+ return top + itemBottom - bottom;
2136
+ }
2137
+ else if (itemTop <= top) {
2138
+ return itemTop;
2139
+ }
2140
+ return null;
2141
+ };
2142
+ return NgDropdownPanelService;
2143
+ }());
2144
+
2145
+ /**
2146
+ * @fileoverview added by tsickle
2147
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2148
+ */
2149
+ /** @type {?} */
2150
+ var TOP_CSS_CLASS = 'ng-select-top';
2151
+ /** @type {?} */
2152
+ var BOTTOM_CSS_CLASS = 'ng-select-bottom';
2153
+ /** @type {?} */
2154
+ var SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? rxjs.animationFrameScheduler : rxjs.asapScheduler;
2155
+ var NgDropdownPanelComponent = /** @class */ (function () {
2156
+ function NgDropdownPanelComponent(_renderer, _zone, _panelService, _elementRef, _document) {
2157
+ this._renderer = _renderer;
2158
+ this._zone = _zone;
2159
+ this._panelService = _panelService;
2160
+ this._document = _document;
2161
+ this.items = [];
2162
+ this.position = 'auto';
2163
+ this.virtualScroll = false;
2164
+ this.filterValue = null;
2165
+ this.update = new core.EventEmitter();
2166
+ this.scroll = new core.EventEmitter();
2167
+ this.scrollToEnd = new core.EventEmitter();
2168
+ this.outsideClick = new core.EventEmitter();
2169
+ this._destroy$ = new rxjs.Subject();
2170
+ this._scrollToEndFired = false;
2171
+ this._updateScrollHeight = false;
2172
+ this._lastScrollPosition = 0;
2173
+ this._dropdown = _elementRef.nativeElement;
2174
+ }
2175
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "currentPosition", {
2176
+ get: /**
2177
+ * @return {?}
2178
+ */
2179
+ function () {
2180
+ return this._currentPosition;
2181
+ },
2182
+ enumerable: true,
2183
+ configurable: true
2184
+ });
2185
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "itemsLength", {
2186
+ get: /**
2187
+ * @private
2188
+ * @return {?}
2189
+ */
2190
+ function () {
2191
+ return this._itemsLength;
2192
+ },
2193
+ set: /**
2194
+ * @private
2195
+ * @param {?} value
2196
+ * @return {?}
2197
+ */
2198
+ function (value) {
2199
+ if (value !== this._itemsLength) {
2200
+ this._itemsLength = value;
2201
+ this._onItemsLengthChanged();
2202
+ }
2203
+ },
2204
+ enumerable: true,
2205
+ configurable: true
2206
+ });
2207
+ /**
2208
+ * @param {?} $event
2209
+ * @return {?}
2210
+ */
2211
+ NgDropdownPanelComponent.prototype.handleMousedown = /**
2212
+ * @param {?} $event
2213
+ * @return {?}
2214
+ */
2215
+ function ($event) {
2216
+ /** @type {?} */
2217
+ var target = (/** @type {?} */ ($event.target));
2218
+ if (target.tagName === 'INPUT') {
2219
+ return;
2220
+ }
2221
+ $event.preventDefault();
2222
+ };
2223
+ /**
2224
+ * @return {?}
2225
+ */
2226
+ NgDropdownPanelComponent.prototype.ngOnInit = /**
2227
+ * @return {?}
2228
+ */
2229
+ function () {
2230
+ this._select = this._dropdown.parentElement;
2231
+ this._virtualPadding = this.paddingElementRef.nativeElement;
2232
+ this._scrollablePanel = this.scrollElementRef.nativeElement;
2233
+ this._contentPanel = this.contentElementRef.nativeElement;
2234
+ this._handleScroll();
2235
+ this._handleOutsideClick();
2236
+ this._appendDropdown();
2237
+ };
2238
+ /**
2239
+ * @param {?} changes
2240
+ * @return {?}
2241
+ */
2242
+ NgDropdownPanelComponent.prototype.ngOnChanges = /**
2243
+ * @param {?} changes
2244
+ * @return {?}
2245
+ */
2246
+ function (changes) {
2247
+ if (changes.items) {
2248
+ /** @type {?} */
2249
+ var change = changes.items;
2250
+ this._onItemsChange(change.currentValue, change.firstChange);
2251
+ }
2252
+ };
2253
+ /**
2254
+ * @return {?}
2255
+ */
2256
+ NgDropdownPanelComponent.prototype.ngOnDestroy = /**
2257
+ * @return {?}
2258
+ */
2259
+ function () {
2260
+ this._destroy$.next();
2261
+ this._destroy$.complete();
2262
+ this._destroy$.unsubscribe();
2263
+ if (this.appendTo) {
2264
+ this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
2265
+ }
2266
+ };
2267
+ /**
2268
+ * @param {?} option
2269
+ * @param {?=} startFromOption
2270
+ * @return {?}
2271
+ */
2272
+ NgDropdownPanelComponent.prototype.scrollTo = /**
2273
+ * @param {?} option
2274
+ * @param {?=} startFromOption
2275
+ * @return {?}
2276
+ */
2277
+ function (option, startFromOption) {
2278
+ if (startFromOption === void 0) { startFromOption = false; }
2279
+ if (!option) {
2280
+ return;
2281
+ }
2282
+ /** @type {?} */
2283
+ var index = this.items.indexOf(option);
2284
+ if (index < 0 || index >= this.itemsLength) {
2285
+ return;
2286
+ }
2287
+ /** @type {?} */
2288
+ var scrollTo;
2289
+ if (this.virtualScroll) {
2290
+ /** @type {?} */
2291
+ var itemHeight = this._panelService.dimensions.itemHeight;
2292
+ scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
2293
+ }
2294
+ else {
2295
+ /** @type {?} */
2296
+ var item = this._dropdown.querySelector("#" + option.htmlId);
2297
+ /** @type {?} */
2298
+ var lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
2299
+ scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
2300
+ }
2301
+ if (isDefined(scrollTo)) {
2302
+ this._scrollablePanel.scrollTop = scrollTo;
2303
+ }
2304
+ };
2305
+ /**
2306
+ * @return {?}
2307
+ */
2308
+ NgDropdownPanelComponent.prototype.scrollToTag = /**
2309
+ * @return {?}
2310
+ */
2311
+ function () {
2312
+ /** @type {?} */
2313
+ var panel = this._scrollablePanel;
2314
+ panel.scrollTop = panel.scrollHeight - panel.clientHeight;
2315
+ };
2316
+ /**
2317
+ * @return {?}
2318
+ */
2319
+ NgDropdownPanelComponent.prototype.adjustPosition = /**
2320
+ * @return {?}
2321
+ */
2322
+ function () {
2323
+ /** @type {?} */
2324
+ var parent = this._parent.getBoundingClientRect();
2325
+ /** @type {?} */
2326
+ var select = this._select.getBoundingClientRect();
2327
+ this._setOffset(parent, select);
2328
+ };
2329
+ /**
2330
+ * @private
2331
+ * @return {?}
2332
+ */
2333
+ NgDropdownPanelComponent.prototype._handleDropdownPosition = /**
2334
+ * @private
2335
+ * @return {?}
2336
+ */
2337
+ function () {
2338
+ this._currentPosition = this._calculateCurrentPosition(this._dropdown);
2339
+ if (this._currentPosition === 'top') {
2340
+ this._renderer.addClass(this._dropdown, TOP_CSS_CLASS);
2341
+ this._renderer.removeClass(this._dropdown, BOTTOM_CSS_CLASS);
2342
+ this._renderer.addClass(this._select, TOP_CSS_CLASS);
2343
+ this._renderer.removeClass(this._select, BOTTOM_CSS_CLASS);
2344
+ }
2345
+ else {
2346
+ this._renderer.addClass(this._dropdown, BOTTOM_CSS_CLASS);
2347
+ this._renderer.removeClass(this._dropdown, TOP_CSS_CLASS);
2348
+ this._renderer.addClass(this._select, BOTTOM_CSS_CLASS);
2349
+ this._renderer.removeClass(this._select, TOP_CSS_CLASS);
2350
+ }
2351
+ if (this.appendTo) {
2352
+ this._updatePosition();
2353
+ }
2354
+ this._dropdown.style.opacity = '1';
2355
+ };
2356
+ /**
2357
+ * @private
2358
+ * @return {?}
2359
+ */
2360
+ NgDropdownPanelComponent.prototype._handleScroll = /**
2361
+ * @private
2362
+ * @return {?}
2363
+ */
2364
+ function () {
2365
+ var _this = this;
2366
+ this._zone.runOutsideAngular((/**
2367
+ * @return {?}
2368
+ */
2369
+ function () {
2370
+ rxjs.fromEvent(_this.scrollElementRef.nativeElement, 'scroll')
2371
+ .pipe(operators.takeUntil(_this._destroy$), operators.auditTime(0, SCROLL_SCHEDULER))
2372
+ .subscribe((/**
2373
+ * @param {?} e
2374
+ * @return {?}
2375
+ */
2376
+ function (e) { return _this._onContentScrolled(e.target.scrollTop); }));
2377
+ }));
2378
+ };
2379
+ /**
2380
+ * @private
2381
+ * @return {?}
2382
+ */
2383
+ NgDropdownPanelComponent.prototype._handleOutsideClick = /**
2384
+ * @private
2385
+ * @return {?}
2386
+ */
2387
+ function () {
2388
+ var _this = this;
2389
+ if (!this._document) {
2390
+ return;
2391
+ }
2392
+ this._zone.runOutsideAngular((/**
2393
+ * @return {?}
2394
+ */
2395
+ function () {
2396
+ rxjs.merge(rxjs.fromEvent(_this._document, 'touchstart', { capture: true }), rxjs.fromEvent(_this._document, 'mousedown', { capture: true })).pipe(operators.takeUntil(_this._destroy$))
2397
+ .subscribe((/**
2398
+ * @param {?} $event
2399
+ * @return {?}
2400
+ */
2401
+ function ($event) { return _this._checkToClose($event); }));
2402
+ }));
2403
+ };
2404
+ /**
2405
+ * @private
2406
+ * @param {?} $event
2407
+ * @return {?}
2408
+ */
2409
+ NgDropdownPanelComponent.prototype._checkToClose = /**
2410
+ * @private
2411
+ * @param {?} $event
2412
+ * @return {?}
2413
+ */
2414
+ function ($event) {
2415
+ if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
2416
+ return;
2417
+ }
2418
+ /** @type {?} */
2419
+ var path = $event.path || ($event.composedPath && $event.composedPath());
2420
+ if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
2421
+ return;
2422
+ }
2423
+ this.outsideClick.emit();
2424
+ };
2425
+ /**
2426
+ * @private
2427
+ * @param {?} items
2428
+ * @param {?} firstChange
2429
+ * @return {?}
2430
+ */
2431
+ NgDropdownPanelComponent.prototype._onItemsChange = /**
2432
+ * @private
2433
+ * @param {?} items
2434
+ * @param {?} firstChange
2435
+ * @return {?}
2436
+ */
2437
+ function (items, firstChange) {
2438
+ this.items = items || [];
2439
+ this._scrollToEndFired = false;
2440
+ this.itemsLength = items.length;
2441
+ if (this.virtualScroll) {
2442
+ this._updateItemsRange(firstChange);
2443
+ }
2444
+ else {
2445
+ this._updateItems(firstChange);
2446
+ }
2447
+ };
2448
+ /**
2449
+ * @private
2450
+ * @param {?} firstChange
2451
+ * @return {?}
2452
+ */
2453
+ NgDropdownPanelComponent.prototype._updateItems = /**
2454
+ * @private
2455
+ * @param {?} firstChange
2456
+ * @return {?}
2457
+ */
2458
+ function (firstChange) {
2459
+ var _this = this;
2460
+ this.update.emit(this.items);
2461
+ if (firstChange === false) {
2462
+ return;
2463
+ }
2464
+ this._zone.runOutsideAngular((/**
2465
+ * @return {?}
2466
+ */
2467
+ function () {
2468
+ Promise.resolve().then((/**
2469
+ * @return {?}
2470
+ */
2471
+ function () {
2472
+ /** @type {?} */
2473
+ var panelHeight = _this._scrollablePanel.clientHeight;
2474
+ _this._panelService.setDimensions(0, panelHeight);
2475
+ _this._handleDropdownPosition();
2476
+ _this.scrollTo(_this.markedItem, firstChange);
2477
+ }));
2478
+ }));
2479
+ };
2480
+ /**
2481
+ * @private
2482
+ * @param {?} firstChange
2483
+ * @return {?}
2484
+ */
2485
+ NgDropdownPanelComponent.prototype._updateItemsRange = /**
2486
+ * @private
2487
+ * @param {?} firstChange
2488
+ * @return {?}
2489
+ */
2490
+ function (firstChange) {
2491
+ var _this = this;
2492
+ this._zone.runOutsideAngular((/**
2493
+ * @return {?}
2494
+ */
2495
+ function () {
2496
+ _this._measureDimensions().then((/**
2497
+ * @return {?}
2498
+ */
2499
+ function () {
2500
+ if (firstChange) {
2501
+ _this._renderItemsRange(_this._startOffset);
2502
+ _this._handleDropdownPosition();
2503
+ }
2504
+ else {
2505
+ _this._renderItemsRange();
2506
+ }
2507
+ }));
2508
+ }));
2509
+ };
2510
+ /**
2511
+ * @private
2512
+ * @param {?} scrollTop
2513
+ * @return {?}
2514
+ */
2515
+ NgDropdownPanelComponent.prototype._onContentScrolled = /**
2516
+ * @private
2517
+ * @param {?} scrollTop
2518
+ * @return {?}
2519
+ */
2520
+ function (scrollTop) {
2521
+ if (this.virtualScroll) {
2522
+ this._renderItemsRange(scrollTop);
2523
+ }
2524
+ this._lastScrollPosition = scrollTop;
2525
+ this._fireScrollToEnd(scrollTop);
2526
+ };
2527
+ /**
2528
+ * @private
2529
+ * @param {?} height
2530
+ * @return {?}
2531
+ */
2532
+ NgDropdownPanelComponent.prototype._updateVirtualHeight = /**
2533
+ * @private
2534
+ * @param {?} height
2535
+ * @return {?}
2536
+ */
2537
+ function (height) {
2538
+ if (this._updateScrollHeight) {
2539
+ this._virtualPadding.style.height = height + "px";
2540
+ this._updateScrollHeight = false;
2541
+ }
2542
+ };
2543
+ /**
2544
+ * @private
2545
+ * @return {?}
2546
+ */
2547
+ NgDropdownPanelComponent.prototype._onItemsLengthChanged = /**
2548
+ * @private
2549
+ * @return {?}
2550
+ */
2551
+ function () {
2552
+ this._updateScrollHeight = true;
2553
+ };
2554
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "_startOffset", {
2555
+ get: /**
2556
+ * @private
2557
+ * @return {?}
2558
+ */
2559
+ function () {
2560
+ if (this.markedItem) {
2561
+ return this.markedItem.index * this._panelService.dimensions.itemHeight;
2562
+ }
2563
+ return 0;
2564
+ },
2565
+ enumerable: true,
2566
+ configurable: true
2567
+ });
2568
+ /**
2569
+ * @private
2570
+ * @param {?=} scrollTop
2571
+ * @return {?}
2572
+ */
2573
+ NgDropdownPanelComponent.prototype._renderItemsRange = /**
2574
+ * @private
2575
+ * @param {?=} scrollTop
2576
+ * @return {?}
2577
+ */
2578
+ function (scrollTop) {
2579
+ var _this = this;
2580
+ if (scrollTop === void 0) { scrollTop = null; }
2581
+ if (scrollTop && this._lastScrollPosition === scrollTop) {
2582
+ return;
2583
+ }
2584
+ scrollTop = scrollTop || this._scrollablePanel.scrollTop;
2585
+ /** @type {?} */
2586
+ var range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
2587
+ this._updateVirtualHeight(range.scrollHeight);
2588
+ this._contentPanel.style.transform = "translateY(" + range.topPadding + "px)";
2589
+ this._zone.run((/**
2590
+ * @return {?}
2591
+ */
2592
+ function () {
2593
+ _this.update.emit(_this.items.slice(range.start, range.end));
2594
+ _this.scroll.emit({ start: range.start, end: range.end });
2595
+ }));
2596
+ if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
2597
+ this._scrollablePanel.scrollTop = scrollTop;
2598
+ this._lastScrollPosition = scrollTop;
2599
+ }
2600
+ };
2601
+ /**
2602
+ * @private
2603
+ * @return {?}
2604
+ */
2605
+ NgDropdownPanelComponent.prototype._measureDimensions = /**
2606
+ * @private
2607
+ * @return {?}
2608
+ */
2609
+ function () {
2610
+ var _this = this;
2611
+ if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
2612
+ return Promise.resolve(this._panelService.dimensions);
2613
+ }
2614
+ var _a = __read(this.items, 1), first = _a[0];
2615
+ this.update.emit([first]);
2616
+ return Promise.resolve().then((/**
2617
+ * @return {?}
2618
+ */
2619
+ function () {
2620
+ /** @type {?} */
2621
+ var option = _this._dropdown.querySelector("#" + first.htmlId);
2622
+ /** @type {?} */
2623
+ var optionHeight = option.clientHeight;
2624
+ _this._virtualPadding.style.height = optionHeight * _this.itemsLength + "px";
2625
+ /** @type {?} */
2626
+ var panelHeight = _this._scrollablePanel.clientHeight;
2627
+ _this._panelService.setDimensions(optionHeight, panelHeight);
2628
+ return _this._panelService.dimensions;
2629
+ }));
2630
+ };
2631
+ /**
2632
+ * @private
2633
+ * @param {?} scrollTop
2634
+ * @return {?}
2635
+ */
2636
+ NgDropdownPanelComponent.prototype._fireScrollToEnd = /**
2637
+ * @private
2638
+ * @param {?} scrollTop
2639
+ * @return {?}
2640
+ */
2641
+ function (scrollTop) {
2642
+ var _this = this;
2643
+ if (this._scrollToEndFired || scrollTop === 0) {
2644
+ return;
2645
+ }
2646
+ /** @type {?} */
2647
+ var padding = this.virtualScroll ?
2648
+ this._virtualPadding :
2649
+ this._contentPanel;
2650
+ if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight) {
2651
+ this._zone.run((/**
2652
+ * @return {?}
2653
+ */
2654
+ function () { return _this.scrollToEnd.emit(); }));
2655
+ this._scrollToEndFired = true;
2656
+ }
2657
+ };
2658
+ /**
2659
+ * @private
2660
+ * @param {?} dropdownEl
2661
+ * @return {?}
2662
+ */
2663
+ NgDropdownPanelComponent.prototype._calculateCurrentPosition = /**
2664
+ * @private
2665
+ * @param {?} dropdownEl
2666
+ * @return {?}
2667
+ */
2668
+ function (dropdownEl) {
2669
+ if (this.position !== 'auto') {
2670
+ return this.position;
2671
+ }
2672
+ /** @type {?} */
2673
+ var selectRect = this._select.getBoundingClientRect();
2674
+ /** @type {?} */
2675
+ var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
2676
+ /** @type {?} */
2677
+ var offsetTop = selectRect.top + window.pageYOffset;
2678
+ /** @type {?} */
2679
+ var height = selectRect.height;
2680
+ /** @type {?} */
2681
+ var dropdownHeight = dropdownEl.getBoundingClientRect().height;
2682
+ if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
2683
+ return 'top';
2684
+ }
2685
+ else {
2686
+ return 'bottom';
2687
+ }
2688
+ };
2689
+ /**
2690
+ * @private
2691
+ * @return {?}
2692
+ */
2693
+ NgDropdownPanelComponent.prototype._appendDropdown = /**
2694
+ * @private
2695
+ * @return {?}
2696
+ */
2697
+ function () {
2698
+ if (!this.appendTo) {
2699
+ return;
2700
+ }
2701
+ this._parent = document.querySelector(this.appendTo);
2702
+ if (!parent) {
2703
+ throw new Error("appendTo selector " + this.appendTo + " did not found any parent element");
2704
+ }
2705
+ this._parent.appendChild(this._dropdown);
2706
+ };
2707
+ /**
2708
+ * @private
2709
+ * @return {?}
2710
+ */
2711
+ NgDropdownPanelComponent.prototype._updatePosition = /**
2712
+ * @private
2713
+ * @return {?}
2714
+ */
2715
+ function () {
2716
+ /** @type {?} */
2717
+ var select = this._select.getBoundingClientRect();
2718
+ /** @type {?} */
2719
+ var parent = this._parent.getBoundingClientRect();
2720
+ /** @type {?} */
2721
+ var offsetLeft = select.left - parent.left;
2722
+ this._setOffset(parent, select);
2723
+ this._dropdown.style.left = offsetLeft + 'px';
2724
+ this._dropdown.style.width = select.width + 'px';
2725
+ this._dropdown.style.minWidth = select.width + 'px';
2726
+ };
2727
+ /**
2728
+ * @private
2729
+ * @param {?} parent
2730
+ * @param {?} select
2731
+ * @return {?}
2732
+ */
2733
+ NgDropdownPanelComponent.prototype._setOffset = /**
2734
+ * @private
2735
+ * @param {?} parent
2736
+ * @param {?} select
2737
+ * @return {?}
2738
+ */
2739
+ function (parent, select) {
2740
+ /** @type {?} */
2741
+ var delta = select.height;
2742
+ if (this._currentPosition === 'top') {
2743
+ /** @type {?} */
2744
+ var offsetBottom = parent.bottom - select.bottom;
2745
+ this._dropdown.style.bottom = offsetBottom + delta + 'px';
2746
+ this._dropdown.style.top = 'auto';
2747
+ }
2748
+ else if (this._currentPosition === 'bottom') {
2749
+ /** @type {?} */
2750
+ var offsetTop = select.top - parent.top;
2751
+ this._dropdown.style.top = offsetTop + delta + 'px';
2752
+ this._dropdown.style.bottom = 'auto';
2753
+ }
2754
+ };
2755
+ NgDropdownPanelComponent.decorators = [
2756
+ { type: core.Component, args: [{
2757
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2758
+ encapsulation: core.ViewEncapsulation.None,
2759
+ selector: 'ng-dropdown-panel',
2760
+ template: "\n <div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n <div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n <div #padding [class.total-padding]=\"virtualScroll\"></div>\n <div #content [class.scrollable-content]=\"virtualScroll && items.length\">\n <ng-content></ng-content>\n </div>\n </div>\n <div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n "
2761
+ }] }
2762
+ ];
2763
+ /** @nocollapse */
2764
+ NgDropdownPanelComponent.ctorParameters = function () { return [
2765
+ { type: core.Renderer2 },
2766
+ { type: core.NgZone },
2767
+ { type: NgDropdownPanelService },
2768
+ { type: core.ElementRef },
2769
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
2770
+ ]; };
2771
+ NgDropdownPanelComponent.propDecorators = {
2772
+ items: [{ type: core.Input }],
2773
+ markedItem: [{ type: core.Input }],
2774
+ position: [{ type: core.Input }],
2775
+ appendTo: [{ type: core.Input }],
2776
+ bufferAmount: [{ type: core.Input }],
2777
+ virtualScroll: [{ type: core.Input }],
2778
+ headerTemplate: [{ type: core.Input }],
2779
+ footerTemplate: [{ type: core.Input }],
2780
+ filterValue: [{ type: core.Input }],
2781
+ update: [{ type: core.Output }],
2782
+ scroll: [{ type: core.Output }],
2783
+ scrollToEnd: [{ type: core.Output }],
2784
+ outsideClick: [{ type: core.Output }],
2785
+ contentElementRef: [{ type: core.ViewChild, args: ['content', { read: core.ElementRef, static: true },] }],
2786
+ scrollElementRef: [{ type: core.ViewChild, args: ['scroll', { read: core.ElementRef, static: true },] }],
2787
+ paddingElementRef: [{ type: core.ViewChild, args: ['padding', { read: core.ElementRef, static: true },] }],
2788
+ handleMousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }]
2789
+ };
2790
+ return NgDropdownPanelComponent;
2791
+ }());
2792
+
2793
+ /**
2794
+ * @fileoverview added by tsickle
2795
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2796
+ */
2797
+ var NgOptionComponent = /** @class */ (function () {
2798
+ function NgOptionComponent(elementRef) {
2799
+ this.elementRef = elementRef;
2800
+ this.stateChange$ = new rxjs.Subject();
2801
+ this._disabled = false;
2802
+ }
2803
+ Object.defineProperty(NgOptionComponent.prototype, "disabled", {
2804
+ get: /**
2805
+ * @return {?}
2806
+ */
2807
+ function () { return this._disabled; },
2808
+ set: /**
2809
+ * @param {?} value
2810
+ * @return {?}
2811
+ */
2812
+ function (value) { this._disabled = this._isDisabled(value); },
2813
+ enumerable: true,
2814
+ configurable: true
2815
+ });
2816
+ /**
2817
+ * @param {?} changes
2818
+ * @return {?}
2819
+ */
2820
+ NgOptionComponent.prototype.ngOnChanges = /**
2821
+ * @param {?} changes
2822
+ * @return {?}
2823
+ */
2824
+ function (changes) {
2825
+ if (changes.disabled) {
2826
+ this.stateChange$.next({
2827
+ value: this.value,
2828
+ disabled: this._disabled
2829
+ });
2830
+ }
2831
+ };
2832
+ /**
2833
+ * @private
2834
+ * @param {?} value
2835
+ * @return {?}
2836
+ */
2837
+ NgOptionComponent.prototype._isDisabled = /**
2838
+ * @private
2839
+ * @param {?} value
2840
+ * @return {?}
2841
+ */
2842
+ function (value) {
2843
+ return value != null && "" + value !== 'false';
2844
+ };
2845
+ NgOptionComponent.decorators = [
2846
+ { type: core.Component, args: [{
2847
+ selector: 'ng-option',
2848
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2849
+ template: "<ng-content></ng-content>"
2850
+ }] }
2851
+ ];
2852
+ /** @nocollapse */
2853
+ NgOptionComponent.ctorParameters = function () { return [
2854
+ { type: core.ElementRef }
2855
+ ]; };
2856
+ NgOptionComponent.propDecorators = {
2857
+ value: [{ type: core.Input }],
2858
+ disabled: [{ type: core.Input }]
2859
+ };
2860
+ return NgOptionComponent;
2861
+ }());
2862
+
2863
+ /**
2864
+ * @fileoverview added by tsickle
2865
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2866
+ */
2867
+ var NgSelectConfig = /** @class */ (function () {
2868
+ function NgSelectConfig() {
2869
+ this.notFoundText = 'No items found';
2870
+ this.typeToSearchText = 'Type to search';
2871
+ this.addTagText = 'Add item';
2872
+ this.loadingText = 'Loading...';
2873
+ this.clearAllText = 'Clear all';
2874
+ this.disableVirtualScroll = true;
2875
+ this.openOnEnter = true;
2876
+ }
2877
+ NgSelectConfig.decorators = [
2878
+ { type: core.Injectable, args: [{ providedIn: 'root' },] }
2879
+ ];
2880
+ /** @nocollapse */ NgSelectConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgSelectConfig_Factory() { return new NgSelectConfig(); }, token: NgSelectConfig, providedIn: "root" });
2881
+ return NgSelectConfig;
2882
+ }());
2883
+
2884
+ /**
2885
+ * @fileoverview added by tsickle
2886
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2887
+ */
2888
+ /** @type {?} */
2889
+ var SELECTION_MODEL_FACTORY = new core.InjectionToken('ng-select-selection-model');
2890
+ var NgSelectComponent = /** @class */ (function () {
2891
+ function NgSelectComponent(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
2892
+ var _this = this;
2893
+ this.classes = classes;
2894
+ this.autoFocus = autoFocus;
2895
+ this._cd = _cd;
2896
+ this._console = _console;
2897
+ this.markFirst = true;
2898
+ this.dropdownPosition = 'auto';
2899
+ this.loading = false;
2900
+ this.closeOnSelect = true;
2901
+ this.hideSelected = false;
2902
+ this.selectOnTab = false;
2903
+ this.bufferAmount = 4;
2904
+ this.selectableGroup = false;
2905
+ this.selectableGroupAsModel = true;
2906
+ this.searchFn = null;
2907
+ this.trackByFn = null;
2908
+ this.clearOnBackspace = true;
2909
+ this.labelForId = null;
2910
+ this.inputAttrs = {};
2911
+ this.multiple = false;
2912
+ this.addTag = false;
2913
+ this.searchable = true;
2914
+ this.clearable = true;
2915
+ this.isOpen = false;
2916
+ // output events
2917
+ this.blurEvent = new core.EventEmitter();
2918
+ this.focusEvent = new core.EventEmitter();
2919
+ this.changeEvent = new core.EventEmitter();
2920
+ this.openEvent = new core.EventEmitter();
2921
+ this.closeEvent = new core.EventEmitter();
2922
+ this.searchEvent = new core.EventEmitter();
2923
+ this.clearEvent = new core.EventEmitter();
2924
+ this.addEvent = new core.EventEmitter();
2925
+ this.removeEvent = new core.EventEmitter();
2926
+ this.scroll = new core.EventEmitter();
2927
+ this.scrollToEnd = new core.EventEmitter();
2928
+ this.disabled = false;
2929
+ this.viewPortItems = [];
2930
+ this.searchTerm = null;
2931
+ this.dropdownId = newId();
2932
+ this._items = [];
2933
+ this._defaultLabel = 'label';
2934
+ this._pressedKeys = [];
2935
+ this._destroy$ = new rxjs.Subject();
2936
+ this._keyPress$ = new rxjs.Subject();
2937
+ this._onChange = (/**
2938
+ * @param {?} _
2939
+ * @return {?}
2940
+ */
2941
+ function (_) { });
2942
+ this._onTouched = (/**
2943
+ * @return {?}
2944
+ */
2945
+ function () { });
2946
+ this.clearItem = (/**
2947
+ * @param {?} item
2948
+ * @return {?}
2949
+ */
2950
+ function (item) {
2951
+ /** @type {?} */
2952
+ var option = _this.selectedItems.find((/**
2953
+ * @param {?} x
2954
+ * @return {?}
2955
+ */
2956
+ function (x) { return x.value === item; }));
2957
+ _this.unselect(option);
2958
+ });
2959
+ this.trackByOption = (/**
2960
+ * @param {?} _
2961
+ * @param {?} item
2962
+ * @return {?}
2963
+ */
2964
+ function (_, item) {
2965
+ if (_this.trackByFn) {
2966
+ return _this.trackByFn(item.value);
2967
+ }
2968
+ return item.htmlId;
2969
+ });
2970
+ this._mergeGlobalConfig(config);
2971
+ this.itemsList = new ItemsList(this, newSelectionModel());
2972
+ this.element = _elementRef.nativeElement;
2973
+ }
2974
+ Object.defineProperty(NgSelectComponent.prototype, "items", {
2975
+ get: /**
2976
+ * @return {?}
2977
+ */
2978
+ function () { return this._items; },
2979
+ set: /**
2980
+ * @param {?} value
2981
+ * @return {?}
2982
+ */
2983
+ function (value) {
2984
+ this._itemsAreUsed = true;
2985
+ this._items = value;
2986
+ },
2987
+ enumerable: true,
2988
+ configurable: true
2989
+ });
2990
+ Object.defineProperty(NgSelectComponent.prototype, "compareWith", {
2991
+ get: /**
2992
+ * @return {?}
2993
+ */
2994
+ function () { return this._compareWith; },
2995
+ set: /**
2996
+ * @param {?} fn
2997
+ * @return {?}
2998
+ */
2999
+ function (fn) {
3000
+ if (!isFunction(fn)) {
3001
+ throw Error('`compareWith` must be a function.');
3002
+ }
3003
+ this._compareWith = fn;
3004
+ },
3005
+ enumerable: true,
3006
+ configurable: true
3007
+ });
3008
+ Object.defineProperty(NgSelectComponent.prototype, "clearSearchOnAdd", {
3009
+ get: /**
3010
+ * @return {?}
3011
+ */
3012
+ function () { return isDefined(this._clearSearchOnAdd) ? this._clearSearchOnAdd : this.closeOnSelect; },
3013
+ set: /**
3014
+ * @param {?} value
3015
+ * @return {?}
3016
+ */
3017
+ function (value) {
3018
+ this._clearSearchOnAdd = value;
3019
+ },
3020
+ enumerable: true,
3021
+ configurable: true
3022
+ });
3023
+ Object.defineProperty(NgSelectComponent.prototype, "filtered", {
3024
+ get: /**
3025
+ * @return {?}
3026
+ */
3027
+ function () { return !!this.searchTerm && this.searchable; },
3028
+ enumerable: true,
3029
+ configurable: true
3030
+ });
3031
+ Object.defineProperty(NgSelectComponent.prototype, "selectedItems", {
3032
+ get: /**
3033
+ * @return {?}
3034
+ */
3035
+ function () {
3036
+ return this.itemsList.selectedItems;
3037
+ },
3038
+ enumerable: true,
3039
+ configurable: true
3040
+ });
3041
+ Object.defineProperty(NgSelectComponent.prototype, "selectedValues", {
3042
+ get: /**
3043
+ * @return {?}
3044
+ */
3045
+ function () {
3046
+ return this.selectedItems.map((/**
3047
+ * @param {?} x
3048
+ * @return {?}
3049
+ */
3050
+ function (x) { return x.value; }));
3051
+ },
3052
+ enumerable: true,
3053
+ configurable: true
3054
+ });
3055
+ Object.defineProperty(NgSelectComponent.prototype, "hasValue", {
3056
+ get: /**
3057
+ * @return {?}
3058
+ */
3059
+ function () {
3060
+ return this.selectedItems.length > 0;
3061
+ },
3062
+ enumerable: true,
3063
+ configurable: true
3064
+ });
3065
+ Object.defineProperty(NgSelectComponent.prototype, "currentPanelPosition", {
3066
+ get: /**
3067
+ * @return {?}
3068
+ */
3069
+ function () {
3070
+ if (this.dropdownPanel) {
3071
+ return this.dropdownPanel.currentPosition;
3072
+ }
3073
+ return undefined;
3074
+ },
3075
+ enumerable: true,
3076
+ configurable: true
3077
+ });
3078
+ /**
3079
+ * @return {?}
3080
+ */
3081
+ NgSelectComponent.prototype.ngOnInit = /**
3082
+ * @return {?}
3083
+ */
3084
+ function () {
3085
+ this._handleKeyPresses();
3086
+ this._setInputAttributes();
3087
+ };
3088
+ /**
3089
+ * @param {?} changes
3090
+ * @return {?}
3091
+ */
3092
+ NgSelectComponent.prototype.ngOnChanges = /**
3093
+ * @param {?} changes
3094
+ * @return {?}
3095
+ */
3096
+ function (changes) {
3097
+ if (changes.multiple) {
3098
+ this.itemsList.clearSelected();
3099
+ }
3100
+ if (changes.items) {
3101
+ this._setItems(changes.items.currentValue || []);
3102
+ }
3103
+ if (changes.isOpen) {
3104
+ this._manualOpen = isDefined(changes.isOpen.currentValue);
3105
+ }
3106
+ };
3107
+ /**
3108
+ * @return {?}
3109
+ */
3110
+ NgSelectComponent.prototype.ngAfterViewInit = /**
3111
+ * @return {?}
3112
+ */
3113
+ function () {
3114
+ if (!this._itemsAreUsed) {
3115
+ this._setItemsFromNgOptions();
3116
+ }
3117
+ if (isDefined(this.autoFocus)) {
3118
+ this.focus();
3119
+ }
3120
+ };
3121
+ /**
3122
+ * @return {?}
3123
+ */
3124
+ NgSelectComponent.prototype.ngOnDestroy = /**
3125
+ * @return {?}
3126
+ */
3127
+ function () {
3128
+ this._destroy$.next();
3129
+ this._destroy$.complete();
3130
+ };
3131
+ /**
3132
+ * @param {?} $event
3133
+ * @return {?}
3134
+ */
3135
+ NgSelectComponent.prototype.handleKeyDown = /**
3136
+ * @param {?} $event
3137
+ * @return {?}
3138
+ */
3139
+ function ($event) {
3140
+ if (KeyCode[$event.which]) {
3141
+ switch ($event.which) {
3142
+ case KeyCode.ArrowDown:
3143
+ this._handleArrowDown($event);
3144
+ break;
3145
+ case KeyCode.ArrowUp:
3146
+ this._handleArrowUp($event);
3147
+ break;
3148
+ case KeyCode.Space:
3149
+ this._handleSpace($event);
3150
+ break;
3151
+ case KeyCode.Enter:
3152
+ this._handleEnter($event);
3153
+ break;
3154
+ case KeyCode.Tab:
3155
+ this._handleTab($event);
3156
+ break;
3157
+ case KeyCode.Esc:
3158
+ this.close();
3159
+ $event.preventDefault();
3160
+ break;
3161
+ case KeyCode.Backspace:
3162
+ this._handleBackspace();
3163
+ break;
3164
+ }
3165
+ }
3166
+ else if ($event.key && $event.key.length === 1) {
3167
+ this._keyPress$.next($event.key.toLocaleLowerCase());
3168
+ }
3169
+ };
3170
+ /**
3171
+ * @param {?} $event
3172
+ * @return {?}
3173
+ */
3174
+ NgSelectComponent.prototype.handleMousedown = /**
3175
+ * @param {?} $event
3176
+ * @return {?}
3177
+ */
3178
+ function ($event) {
3179
+ /** @type {?} */
3180
+ var target = (/** @type {?} */ ($event.target));
3181
+ if (target.tagName !== 'INPUT') {
3182
+ $event.preventDefault();
3183
+ }
3184
+ if (target.classList.contains('ng-clear-wrapper')) {
3185
+ this.handleClearClick();
3186
+ return;
3187
+ }
3188
+ if (target.classList.contains('ng-arrow-wrapper')) {
3189
+ this.handleArrowClick();
3190
+ return;
3191
+ }
3192
+ if (target.classList.contains('ng-value-icon')) {
3193
+ return;
3194
+ }
3195
+ if (!this.focused) {
3196
+ this.focus();
3197
+ }
3198
+ if (this.searchable) {
3199
+ this.open();
3200
+ }
3201
+ else {
3202
+ this.toggle();
3203
+ }
3204
+ };
3205
+ /**
3206
+ * @return {?}
3207
+ */
3208
+ NgSelectComponent.prototype.handleArrowClick = /**
3209
+ * @return {?}
3210
+ */
3211
+ function () {
3212
+ if (this.isOpen) {
3213
+ this.close();
3214
+ }
3215
+ else {
3216
+ this.open();
3217
+ }
3218
+ };
3219
+ /**
3220
+ * @return {?}
3221
+ */
3222
+ NgSelectComponent.prototype.handleClearClick = /**
3223
+ * @return {?}
3224
+ */
3225
+ function () {
3226
+ if (this.hasValue) {
3227
+ this.itemsList.clearSelected(true);
3228
+ this._updateNgModel();
3229
+ }
3230
+ this._clearSearch();
3231
+ this.focus();
3232
+ if (this._isTypeahead) {
3233
+ this.typeahead.next(null);
3234
+ }
3235
+ this.clearEvent.emit();
3236
+ this._onSelectionChanged();
3237
+ };
3238
+ /**
3239
+ * @return {?}
3240
+ */
3241
+ NgSelectComponent.prototype.clearModel = /**
3242
+ * @return {?}
3243
+ */
3244
+ function () {
3245
+ if (!this.clearable) {
3246
+ return;
3247
+ }
3248
+ this.itemsList.clearSelected();
3249
+ this._updateNgModel();
3250
+ };
3251
+ /**
3252
+ * @param {?} value
3253
+ * @return {?}
3254
+ */
3255
+ NgSelectComponent.prototype.writeValue = /**
3256
+ * @param {?} value
3257
+ * @return {?}
3258
+ */
3259
+ function (value) {
3260
+ this.itemsList.clearSelected();
3261
+ this._handleWriteValue(value);
3262
+ this._cd.markForCheck();
3263
+ };
3264
+ /**
3265
+ * @param {?} fn
3266
+ * @return {?}
3267
+ */
3268
+ NgSelectComponent.prototype.registerOnChange = /**
3269
+ * @param {?} fn
3270
+ * @return {?}
3271
+ */
3272
+ function (fn) {
3273
+ this._onChange = fn;
3274
+ };
3275
+ /**
3276
+ * @param {?} fn
3277
+ * @return {?}
3278
+ */
3279
+ NgSelectComponent.prototype.registerOnTouched = /**
3280
+ * @param {?} fn
3281
+ * @return {?}
3282
+ */
3283
+ function (fn) {
3284
+ this._onTouched = fn;
3285
+ };
3286
+ /**
3287
+ * @param {?} isDisabled
3288
+ * @return {?}
3289
+ */
3290
+ NgSelectComponent.prototype.setDisabledState = /**
3291
+ * @param {?} isDisabled
3292
+ * @return {?}
3293
+ */
3294
+ function (isDisabled) {
3295
+ this.disabled = isDisabled;
3296
+ this._cd.markForCheck();
3297
+ };
3298
+ /**
3299
+ * @return {?}
3300
+ */
3301
+ NgSelectComponent.prototype.toggle = /**
3302
+ * @return {?}
3303
+ */
3304
+ function () {
3305
+ if (!this.isOpen) {
3306
+ this.open();
3307
+ }
3308
+ else {
3309
+ this.close();
3310
+ }
3311
+ };
3312
+ /**
3313
+ * @return {?}
3314
+ */
3315
+ NgSelectComponent.prototype.open = /**
3316
+ * @return {?}
3317
+ */
3318
+ function () {
3319
+ if (this.disabled || this.isOpen || this.itemsList.maxItemsSelected || this._manualOpen) {
3320
+ return;
3321
+ }
3322
+ if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {
3323
+ return;
3324
+ }
3325
+ this.isOpen = true;
3326
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3327
+ this.openEvent.emit();
3328
+ if (!this.searchTerm) {
3329
+ this.focus();
3330
+ }
3331
+ this.detectChanges();
3332
+ };
3333
+ /**
3334
+ * @return {?}
3335
+ */
3336
+ NgSelectComponent.prototype.close = /**
3337
+ * @return {?}
3338
+ */
3339
+ function () {
3340
+ if (!this.isOpen || this._manualOpen) {
3341
+ return;
3342
+ }
3343
+ this.isOpen = false;
3344
+ this._clearSearch();
3345
+ this.itemsList.unmarkItem();
3346
+ this._onTouched();
3347
+ this.closeEvent.emit();
3348
+ this._cd.markForCheck();
3349
+ };
3350
+ /**
3351
+ * @param {?} item
3352
+ * @return {?}
3353
+ */
3354
+ NgSelectComponent.prototype.toggleItem = /**
3355
+ * @param {?} item
3356
+ * @return {?}
3357
+ */
3358
+ function (item) {
3359
+ if (!item || item.disabled || this.disabled) {
3360
+ return;
3361
+ }
3362
+ if (this.multiple && item.selected) {
3363
+ this.unselect(item);
3364
+ }
3365
+ else {
3366
+ this.select(item);
3367
+ }
3368
+ this._onSelectionChanged();
3369
+ };
3370
+ /**
3371
+ * @param {?} item
3372
+ * @return {?}
3373
+ */
3374
+ NgSelectComponent.prototype.select = /**
3375
+ * @param {?} item
3376
+ * @return {?}
3377
+ */
3378
+ function (item) {
3379
+ if (!item.selected) {
3380
+ this.itemsList.select(item);
3381
+ if (this.clearSearchOnAdd) {
3382
+ this._clearSearch();
3383
+ }
3384
+ this._updateNgModel();
3385
+ if (this.multiple) {
3386
+ this.addEvent.emit(item.value);
3387
+ }
3388
+ }
3389
+ if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
3390
+ this.close();
3391
+ }
3392
+ };
3393
+ /**
3394
+ * @return {?}
3395
+ */
3396
+ NgSelectComponent.prototype.focus = /**
3397
+ * @return {?}
3398
+ */
3399
+ function () {
3400
+ this.searchInput.nativeElement.focus();
3401
+ };
3402
+ /**
3403
+ * @return {?}
3404
+ */
3405
+ NgSelectComponent.prototype.blur = /**
3406
+ * @return {?}
3407
+ */
3408
+ function () {
3409
+ this.searchInput.nativeElement.blur();
3410
+ };
3411
+ /**
3412
+ * @param {?} item
3413
+ * @return {?}
3414
+ */
3415
+ NgSelectComponent.prototype.unselect = /**
3416
+ * @param {?} item
3417
+ * @return {?}
3418
+ */
3419
+ function (item) {
3420
+ if (!item) {
3421
+ return;
3422
+ }
3423
+ this.itemsList.unselect(item);
3424
+ this.focus();
3425
+ this._updateNgModel();
3426
+ this.removeEvent.emit(item);
3427
+ };
3428
+ /**
3429
+ * @return {?}
3430
+ */
3431
+ NgSelectComponent.prototype.selectTag = /**
3432
+ * @return {?}
3433
+ */
3434
+ function () {
3435
+ var _this = this;
3436
+ var _a;
3437
+ /** @type {?} */
3438
+ var tag;
3439
+ if (isFunction(this.addTag)) {
3440
+ tag = ((/** @type {?} */ (this.addTag)))(this.searchTerm);
3441
+ }
3442
+ else {
3443
+ tag = this._primitive ? this.searchTerm : (_a = {}, _a[this.bindLabel] = this.searchTerm, _a);
3444
+ }
3445
+ /** @type {?} */
3446
+ var handleTag = (/**
3447
+ * @param {?} item
3448
+ * @return {?}
3449
+ */
3450
+ function (item) { return _this._isTypeahead || !_this.isOpen ? _this.itemsList.mapItem(item, null) : _this.itemsList.addItem(item); });
3451
+ if (isPromise(tag)) {
3452
+ tag.then((/**
3453
+ * @param {?} item
3454
+ * @return {?}
3455
+ */
3456
+ function (item) { return _this.select(handleTag(item)); })).catch((/**
3457
+ * @return {?}
3458
+ */
3459
+ function () { }));
3460
+ }
3461
+ else if (tag) {
3462
+ this.select(handleTag(tag));
3463
+ }
3464
+ };
3465
+ /**
3466
+ * @return {?}
3467
+ */
3468
+ NgSelectComponent.prototype.showClear = /**
3469
+ * @return {?}
3470
+ */
3471
+ function () {
3472
+ return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
3473
+ };
3474
+ Object.defineProperty(NgSelectComponent.prototype, "showAddTag", {
3475
+ get: /**
3476
+ * @return {?}
3477
+ */
3478
+ function () {
3479
+ if (!this.searchTerm) {
3480
+ return false;
3481
+ }
3482
+ /** @type {?} */
3483
+ var term = this.searchTerm.toLowerCase();
3484
+ return this.addTag &&
3485
+ (!this.itemsList.filteredItems.some((/**
3486
+ * @param {?} x
3487
+ * @return {?}
3488
+ */
3489
+ function (x) { return x.label.toLowerCase() === term; })) &&
3490
+ (!this.hideSelected && this.isOpen || !this.selectedItems.some((/**
3491
+ * @param {?} x
3492
+ * @return {?}
3493
+ */
3494
+ function (x) { return x.label.toLowerCase() === term; })))) &&
3495
+ !this.loading;
3496
+ },
3497
+ enumerable: true,
3498
+ configurable: true
3499
+ });
3500
+ /**
3501
+ * @return {?}
3502
+ */
3503
+ NgSelectComponent.prototype.showNoItemsFound = /**
3504
+ * @return {?}
3505
+ */
3506
+ function () {
3507
+ /** @type {?} */
3508
+ var empty = this.itemsList.filteredItems.length === 0;
3509
+ return ((empty && !this._isTypeahead && !this.loading) ||
3510
+ (empty && this._isTypeahead && this.searchTerm && !this.loading)) &&
3511
+ !this.showAddTag;
3512
+ };
3513
+ /**
3514
+ * @return {?}
3515
+ */
3516
+ NgSelectComponent.prototype.showTypeToSearch = /**
3517
+ * @return {?}
3518
+ */
3519
+ function () {
3520
+ /** @type {?} */
3521
+ var empty = this.itemsList.filteredItems.length === 0;
3522
+ return empty && this._isTypeahead && !this.searchTerm && !this.loading;
3523
+ };
3524
+ /**
3525
+ * @param {?} term
3526
+ * @return {?}
3527
+ */
3528
+ NgSelectComponent.prototype.filter = /**
3529
+ * @param {?} term
3530
+ * @return {?}
3531
+ */
3532
+ function (term) {
3533
+ this.searchTerm = term;
3534
+ if (this._isTypeahead) {
3535
+ this.typeahead.next(this.searchTerm);
3536
+ }
3537
+ else {
3538
+ this.itemsList.filter(this.searchTerm);
3539
+ if (this.isOpen) {
3540
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3541
+ }
3542
+ }
3543
+ this.searchEvent.emit({ term: term, items: this.itemsList.filteredItems.map((/**
3544
+ * @param {?} x
3545
+ * @return {?}
3546
+ */
3547
+ function (x) { return x.value; })) });
3548
+ this.open();
3549
+ };
3550
+ /**
3551
+ * @param {?} $event
3552
+ * @return {?}
3553
+ */
3554
+ NgSelectComponent.prototype.onInputFocus = /**
3555
+ * @param {?} $event
3556
+ * @return {?}
3557
+ */
3558
+ function ($event) {
3559
+ if (this.focused) {
3560
+ return;
3561
+ }
3562
+ this.element.classList.add('ng-select-focused');
3563
+ this.focusEvent.emit($event);
3564
+ this.focused = true;
3565
+ };
3566
+ /**
3567
+ * @param {?} $event
3568
+ * @return {?}
3569
+ */
3570
+ NgSelectComponent.prototype.onInputBlur = /**
3571
+ * @param {?} $event
3572
+ * @return {?}
3573
+ */
3574
+ function ($event) {
3575
+ this.element.classList.remove('ng-select-focused');
3576
+ this.blurEvent.emit($event);
3577
+ if (!this.isOpen && !this.disabled) {
3578
+ this._onTouched();
3579
+ }
3580
+ this.focused = false;
3581
+ };
3582
+ /**
3583
+ * @param {?} item
3584
+ * @return {?}
3585
+ */
3586
+ NgSelectComponent.prototype.onItemHover = /**
3587
+ * @param {?} item
3588
+ * @return {?}
3589
+ */
3590
+ function (item) {
3591
+ if (item.disabled) {
3592
+ return;
3593
+ }
3594
+ this.itemsList.markItem(item);
3595
+ };
3596
+ /**
3597
+ * @return {?}
3598
+ */
3599
+ NgSelectComponent.prototype.detectChanges = /**
3600
+ * @return {?}
3601
+ */
3602
+ function () {
3603
+ if (!((/** @type {?} */ (this._cd))).destroyed) {
3604
+ this._cd.detectChanges();
3605
+ }
3606
+ };
3607
+ /**
3608
+ * @private
3609
+ * @param {?} items
3610
+ * @return {?}
3611
+ */
3612
+ NgSelectComponent.prototype._setItems = /**
3613
+ * @private
3614
+ * @param {?} items
3615
+ * @return {?}
3616
+ */
3617
+ function (items) {
3618
+ /** @type {?} */
3619
+ var firstItem = items[0];
3620
+ this.bindLabel = this.bindLabel || this._defaultLabel;
3621
+ this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
3622
+ this.itemsList.setItems(items);
3623
+ if (items.length > 0 && this.hasValue) {
3624
+ this.itemsList.mapSelectedItems();
3625
+ }
3626
+ if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {
3627
+ this.itemsList.filter(this.searchTerm);
3628
+ }
3629
+ if (this._isTypeahead || this.isOpen) {
3630
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3631
+ }
3632
+ };
3633
+ /**
3634
+ * @private
3635
+ * @return {?}
3636
+ */
3637
+ NgSelectComponent.prototype._setItemsFromNgOptions = /**
3638
+ * @private
3639
+ * @return {?}
3640
+ */
3641
+ function () {
3642
+ var _this = this;
3643
+ /** @type {?} */
3644
+ var handleNgOptions = (/**
3645
+ * @param {?} options
3646
+ * @return {?}
3647
+ */
3648
+ function (options) {
3649
+ _this.items = options.map((/**
3650
+ * @param {?} option
3651
+ * @return {?}
3652
+ */
3653
+ function (option) { return ({
3654
+ $ngOptionValue: option.value,
3655
+ $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
3656
+ disabled: option.disabled
3657
+ }); }));
3658
+ _this.itemsList.setItems(_this.items);
3659
+ if (_this.hasValue) {
3660
+ _this.itemsList.mapSelectedItems();
3661
+ }
3662
+ _this.detectChanges();
3663
+ });
3664
+ /** @type {?} */
3665
+ var handleOptionChange = (/**
3666
+ * @return {?}
3667
+ */
3668
+ function () {
3669
+ /** @type {?} */
3670
+ var changedOrDestroyed = rxjs.merge(_this.ngOptions.changes, _this._destroy$);
3671
+ rxjs.merge.apply(void 0, __spread(_this.ngOptions.map((/**
3672
+ * @param {?} option
3673
+ * @return {?}
3674
+ */
3675
+ function (option) { return option.stateChange$; })))).pipe(operators.takeUntil(changedOrDestroyed))
3676
+ .subscribe((/**
3677
+ * @param {?} option
3678
+ * @return {?}
3679
+ */
3680
+ function (option) {
3681
+ /** @type {?} */
3682
+ var item = _this.itemsList.findItem(option.value);
3683
+ item.disabled = option.disabled;
3684
+ _this._cd.markForCheck();
3685
+ }));
3686
+ });
3687
+ this.ngOptions.changes
3688
+ .pipe(operators.startWith(this.ngOptions), operators.takeUntil(this._destroy$))
3689
+ .subscribe((/**
3690
+ * @param {?} options
3691
+ * @return {?}
3692
+ */
3693
+ function (options) {
3694
+ _this.bindLabel = _this._defaultLabel;
3695
+ handleNgOptions(options);
3696
+ handleOptionChange();
3697
+ }));
3698
+ };
3699
+ /**
3700
+ * @private
3701
+ * @param {?} value
3702
+ * @return {?}
3703
+ */
3704
+ NgSelectComponent.prototype._isValidWriteValue = /**
3705
+ * @private
3706
+ * @param {?} value
3707
+ * @return {?}
3708
+ */
3709
+ function (value) {
3710
+ var _this = this;
3711
+ if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
3712
+ return false;
3713
+ }
3714
+ /** @type {?} */
3715
+ var validateBinding = (/**
3716
+ * @param {?} item
3717
+ * @return {?}
3718
+ */
3719
+ function (item) {
3720
+ if (!isDefined(_this.compareWith) && isObject(item) && _this.bindValue) {
3721
+ _this._console.warn("Binding object(" + JSON.stringify(item) + ") with bindValue is not allowed.");
3722
+ return false;
3723
+ }
3724
+ return true;
3725
+ });
3726
+ if (this.multiple) {
3727
+ if (!Array.isArray(value)) {
3728
+ this._console.warn('Multiple select ngModel should be array.');
3729
+ return false;
3730
+ }
3731
+ return value.every((/**
3732
+ * @param {?} item
3733
+ * @return {?}
3734
+ */
3735
+ function (item) { return validateBinding(item); }));
3736
+ }
3737
+ else {
3738
+ return validateBinding(value);
3739
+ }
3740
+ };
3741
+ /**
3742
+ * @private
3743
+ * @param {?} ngModel
3744
+ * @return {?}
3745
+ */
3746
+ NgSelectComponent.prototype._handleWriteValue = /**
3747
+ * @private
3748
+ * @param {?} ngModel
3749
+ * @return {?}
3750
+ */
3751
+ function (ngModel) {
3752
+ var _this = this;
3753
+ if (!this._isValidWriteValue(ngModel)) {
3754
+ return;
3755
+ }
3756
+ /** @type {?} */
3757
+ var select = (/**
3758
+ * @param {?} val
3759
+ * @return {?}
3760
+ */
3761
+ function (val) {
3762
+ var _a;
3763
+ /** @type {?} */
3764
+ var item = _this.itemsList.findItem(val);
3765
+ if (item) {
3766
+ _this.itemsList.select(item);
3767
+ }
3768
+ else {
3769
+ /** @type {?} */
3770
+ var isValObject = isObject(val);
3771
+ /** @type {?} */
3772
+ var isPrimitive = !isValObject && !_this.bindValue;
3773
+ if ((isValObject || isPrimitive)) {
3774
+ _this.itemsList.select(_this.itemsList.mapItem(val, null));
3775
+ }
3776
+ else if (_this.bindValue) {
3777
+ item = (_a = {},
3778
+ _a[_this.bindLabel] = null,
3779
+ _a[_this.bindValue] = val,
3780
+ _a);
3781
+ _this.itemsList.select(_this.itemsList.mapItem(item, null));
3782
+ }
3783
+ }
3784
+ });
3785
+ if (this.multiple) {
3786
+ ((/** @type {?} */ (ngModel))).forEach((/**
3787
+ * @param {?} item
3788
+ * @return {?}
3789
+ */
3790
+ function (item) { return select(item); }));
3791
+ }
3792
+ else {
3793
+ select(ngModel);
3794
+ }
3795
+ };
3796
+ /**
3797
+ * @private
3798
+ * @return {?}
3799
+ */
3800
+ NgSelectComponent.prototype._handleKeyPresses = /**
3801
+ * @private
3802
+ * @return {?}
3803
+ */
3804
+ function () {
3805
+ var _this = this;
3806
+ if (this.searchable) {
3807
+ return;
3808
+ }
3809
+ this._keyPress$
3810
+ .pipe(operators.takeUntil(this._destroy$), operators.tap((/**
3811
+ * @param {?} letter
3812
+ * @return {?}
3813
+ */
3814
+ function (letter) { return _this._pressedKeys.push(letter); })), operators.debounceTime(200), operators.filter((/**
3815
+ * @return {?}
3816
+ */
3817
+ function () { return _this._pressedKeys.length > 0; })), operators.map((/**
3818
+ * @return {?}
3819
+ */
3820
+ function () { return _this._pressedKeys.join(''); })))
3821
+ .subscribe((/**
3822
+ * @param {?} term
3823
+ * @return {?}
3824
+ */
3825
+ function (term) {
3826
+ /** @type {?} */
3827
+ var item = _this.itemsList.findByLabel(term);
3828
+ if (item) {
3829
+ if (_this.isOpen) {
3830
+ _this.itemsList.markItem(item);
3831
+ _this._cd.markForCheck();
3832
+ }
3833
+ else {
3834
+ _this.select(item);
3835
+ }
3836
+ }
3837
+ _this._pressedKeys = [];
3838
+ }));
3839
+ };
3840
+ /**
3841
+ * @private
3842
+ * @return {?}
3843
+ */
3844
+ NgSelectComponent.prototype._setInputAttributes = /**
3845
+ * @private
3846
+ * @return {?}
3847
+ */
3848
+ function () {
3849
+ var e_1, _a;
3850
+ /** @type {?} */
3851
+ var input = this.searchInput.nativeElement;
3852
+ /** @type {?} */
3853
+ var attributes = __assign({ type: 'text', autocorrect: 'off', autocapitalize: 'off', autocomplete: this.labelForId ? 'off' : this.dropdownId }, this.inputAttrs);
3854
+ try {
3855
+ for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
3856
+ var key = _c.value;
3857
+ input.setAttribute(key, attributes[key]);
3858
+ }
3859
+ }
3860
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3861
+ finally {
3862
+ try {
3863
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3864
+ }
3865
+ finally { if (e_1) throw e_1.error; }
3866
+ }
3867
+ };
3868
+ /**
3869
+ * @private
3870
+ * @return {?}
3871
+ */
3872
+ NgSelectComponent.prototype._updateNgModel = /**
3873
+ * @private
3874
+ * @return {?}
3875
+ */
3876
+ function () {
3877
+ var e_2, _a;
3878
+ /** @type {?} */
3879
+ var model = [];
3880
+ try {
3881
+ for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
3882
+ var item = _c.value;
3883
+ if (this.bindValue) {
3884
+ /** @type {?} */
3885
+ var value = null;
3886
+ if (item.children) {
3887
+ /** @type {?} */
3888
+ var groupKey = this.groupValue ? this.bindValue : (/** @type {?} */ (this.groupBy));
3889
+ value = item.value[groupKey || (/** @type {?} */ (this.groupBy))];
3890
+ }
3891
+ else {
3892
+ value = this.itemsList.resolveNested(item.value, this.bindValue);
3893
+ }
3894
+ model.push(value);
3895
+ }
3896
+ else {
3897
+ model.push(item.value);
3898
+ }
3899
+ }
3900
+ }
3901
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3902
+ finally {
3903
+ try {
3904
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3905
+ }
3906
+ finally { if (e_2) throw e_2.error; }
3907
+ }
3908
+ /** @type {?} */
3909
+ var selected = this.selectedItems.map((/**
3910
+ * @param {?} x
3911
+ * @return {?}
3912
+ */
3913
+ function (x) { return x.value; }));
3914
+ if (this.multiple) {
3915
+ this._onChange(model);
3916
+ this.changeEvent.emit(selected);
3917
+ }
3918
+ else {
3919
+ this._onChange(isDefined(model[0]) ? model[0] : null);
3920
+ this.changeEvent.emit(selected[0]);
3921
+ }
3922
+ this._cd.markForCheck();
3923
+ };
3924
+ /**
3925
+ * @private
3926
+ * @return {?}
3927
+ */
3928
+ NgSelectComponent.prototype._clearSearch = /**
3929
+ * @private
3930
+ * @return {?}
3931
+ */
3932
+ function () {
3933
+ if (!this.searchTerm) {
3934
+ return;
3935
+ }
3936
+ this.searchTerm = null;
3937
+ this.itemsList.resetFilteredItems();
3938
+ };
3939
+ /**
3940
+ * @private
3941
+ * @return {?}
3942
+ */
3943
+ NgSelectComponent.prototype._scrollToMarked = /**
3944
+ * @private
3945
+ * @return {?}
3946
+ */
3947
+ function () {
3948
+ if (!this.isOpen || !this.dropdownPanel) {
3949
+ return;
3950
+ }
3951
+ this.dropdownPanel.scrollTo(this.itemsList.markedItem);
3952
+ };
3953
+ /**
3954
+ * @private
3955
+ * @return {?}
3956
+ */
3957
+ NgSelectComponent.prototype._scrollToTag = /**
3958
+ * @private
3959
+ * @return {?}
3960
+ */
3961
+ function () {
3962
+ if (!this.isOpen || !this.dropdownPanel) {
3963
+ return;
3964
+ }
3965
+ this.dropdownPanel.scrollToTag();
3966
+ };
3967
+ /**
3968
+ * @private
3969
+ * @return {?}
3970
+ */
3971
+ NgSelectComponent.prototype._onSelectionChanged = /**
3972
+ * @private
3973
+ * @return {?}
3974
+ */
3975
+ function () {
3976
+ if (this.isOpen && this.multiple && this.appendTo) {
3977
+ // Make sure items are rendered.
3978
+ this._cd.detectChanges();
3979
+ this.dropdownPanel.adjustPosition();
3980
+ }
3981
+ };
3982
+ /**
3983
+ * @private
3984
+ * @param {?} $event
3985
+ * @return {?}
3986
+ */
3987
+ NgSelectComponent.prototype._handleTab = /**
3988
+ * @private
3989
+ * @param {?} $event
3990
+ * @return {?}
3991
+ */
3992
+ function ($event) {
3993
+ if (this.isOpen === false && !this.addTag) {
3994
+ return;
3995
+ }
3996
+ if (this.selectOnTab) {
3997
+ if (this.itemsList.markedItem) {
3998
+ this.toggleItem(this.itemsList.markedItem);
3999
+ $event.preventDefault();
4000
+ }
4001
+ else if (this.showAddTag) {
4002
+ this.selectTag();
4003
+ $event.preventDefault();
4004
+ }
4005
+ else {
4006
+ this.close();
4007
+ }
4008
+ }
4009
+ else {
4010
+ this.close();
4011
+ }
4012
+ };
4013
+ /**
4014
+ * @private
4015
+ * @param {?} $event
4016
+ * @return {?}
4017
+ */
4018
+ NgSelectComponent.prototype._handleEnter = /**
4019
+ * @private
4020
+ * @param {?} $event
4021
+ * @return {?}
4022
+ */
4023
+ function ($event) {
4024
+ if (this.isOpen || this._manualOpen) {
4025
+ if (this.itemsList.markedItem) {
4026
+ this.toggleItem(this.itemsList.markedItem);
4027
+ }
4028
+ else if (this.showAddTag) {
4029
+ this.selectTag();
4030
+ }
4031
+ }
4032
+ else if (this.openOnEnter) {
4033
+ this.open();
4034
+ }
4035
+ else {
4036
+ return;
4037
+ }
4038
+ $event.preventDefault();
4039
+ };
4040
+ /**
4041
+ * @private
4042
+ * @param {?} $event
4043
+ * @return {?}
4044
+ */
4045
+ NgSelectComponent.prototype._handleSpace = /**
4046
+ * @private
4047
+ * @param {?} $event
4048
+ * @return {?}
4049
+ */
4050
+ function ($event) {
4051
+ if (this.isOpen || this._manualOpen) {
4052
+ return;
4053
+ }
4054
+ this.open();
4055
+ $event.preventDefault();
4056
+ };
4057
+ /**
4058
+ * @private
4059
+ * @param {?} $event
4060
+ * @return {?}
4061
+ */
4062
+ NgSelectComponent.prototype._handleArrowDown = /**
4063
+ * @private
4064
+ * @param {?} $event
4065
+ * @return {?}
4066
+ */
4067
+ function ($event) {
4068
+ if (this._nextItemIsTag(+1)) {
4069
+ this.itemsList.unmarkItem();
4070
+ this._scrollToTag();
4071
+ }
4072
+ else {
4073
+ this.itemsList.markNextItem();
4074
+ this._scrollToMarked();
4075
+ }
4076
+ this.open();
4077
+ $event.preventDefault();
4078
+ };
4079
+ /**
4080
+ * @private
4081
+ * @param {?} $event
4082
+ * @return {?}
4083
+ */
4084
+ NgSelectComponent.prototype._handleArrowUp = /**
4085
+ * @private
4086
+ * @param {?} $event
4087
+ * @return {?}
4088
+ */
4089
+ function ($event) {
4090
+ if (!this.isOpen) {
4091
+ return;
4092
+ }
4093
+ if (this._nextItemIsTag(-1)) {
4094
+ this.itemsList.unmarkItem();
4095
+ this._scrollToTag();
4096
+ }
4097
+ else {
4098
+ this.itemsList.markPreviousItem();
4099
+ this._scrollToMarked();
4100
+ }
4101
+ $event.preventDefault();
4102
+ };
4103
+ /**
4104
+ * @private
4105
+ * @param {?} nextStep
4106
+ * @return {?}
4107
+ */
4108
+ NgSelectComponent.prototype._nextItemIsTag = /**
4109
+ * @private
4110
+ * @param {?} nextStep
4111
+ * @return {?}
4112
+ */
4113
+ function (nextStep) {
4114
+ /** @type {?} */
4115
+ var nextIndex = this.itemsList.markedIndex + nextStep;
4116
+ return this.addTag && this.searchTerm
4117
+ && this.itemsList.markedItem
4118
+ && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
4119
+ };
4120
+ /**
4121
+ * @private
4122
+ * @return {?}
4123
+ */
4124
+ NgSelectComponent.prototype._handleBackspace = /**
4125
+ * @private
4126
+ * @return {?}
4127
+ */
4128
+ function () {
4129
+ if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
4130
+ return;
4131
+ }
4132
+ if (this.multiple) {
4133
+ this.unselect(this.itemsList.lastSelectedItem);
4134
+ }
4135
+ else {
4136
+ this.clearModel();
4137
+ }
4138
+ };
4139
+ Object.defineProperty(NgSelectComponent.prototype, "_isTypeahead", {
4140
+ get: /**
4141
+ * @private
4142
+ * @return {?}
4143
+ */
4144
+ function () {
4145
+ return this.typeahead && this.typeahead.observers.length > 0;
4146
+ },
4147
+ enumerable: true,
4148
+ configurable: true
4149
+ });
4150
+ /**
4151
+ * @private
4152
+ * @param {?} config
4153
+ * @return {?}
4154
+ */
4155
+ NgSelectComponent.prototype._mergeGlobalConfig = /**
4156
+ * @private
4157
+ * @param {?} config
4158
+ * @return {?}
4159
+ */
4160
+ function (config) {
4161
+ this.placeholder = this.placeholder || config.placeholder;
4162
+ this.notFoundText = this.notFoundText || config.notFoundText;
4163
+ this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;
4164
+ this.addTagText = this.addTagText || config.addTagText;
4165
+ this.loadingText = this.loadingText || config.loadingText;
4166
+ this.clearAllText = this.clearAllText || config.clearAllText;
4167
+ this.virtualScroll = isDefined(this.virtualScroll)
4168
+ ? this.virtualScroll
4169
+ : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
4170
+ this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
4171
+ };
4172
+ NgSelectComponent.decorators = [
4173
+ { type: core.Component, args: [{
4174
+ selector: 'ng-select',
4175
+ template: "<div (mousedown)=\"handleMousedown($event)\" [class.ng-has-value]=\"hasValue\" class=\"ng-select-container\">\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"!multiLabelTemplate && selectedItems.length > 0\">\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\" *ngFor=\"let item of selectedItems; trackBy: trackByOption\">\n <ng-template #defaultLabelTemplate>\n <span class=\"ng-value-icon left\" (click)=\"unselect(item);\" aria-hidden=\"true\">\u00D7</span>\n <span class=\"ng-value-label\">{{item.label}}</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-template *ngIf=\"multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\">\n <input #searchInput\n [attr.id]=\"labelForId\"\n [attr.tabindex]=\"tabIndex\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [disabled]=\"disabled\"\n [value]=\"searchTerm ? searchTerm : ''\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-owns]=\"isOpen ? dropdownId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\">\n </div>\n </div>\n\n <ng-container *ngIf=\"loading\">\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\">\n </ng-template>\n </ng-container>\n\n <span *ngIf=\"showClear()\" class=\"ng-clear-wrapper\" title=\"{{clearAllText}}\">\n <span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n </span>\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n</div>\n\n<ng-dropdown-panel *ngIf=\"isOpen\"\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"dropdownPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n [class.ng-select-multiple]=\"multiple\"\n [ngClass]=\"appendTo ? classes : null\"\n [id]=\"dropdownId\">\n\n <ng-container>\n <div class=\"ng-option\" [attr.role]=\"item.children ? 'group' : 'option'\" (click)=\"toggleItem(item)\" (mouseover)=\"onItemHover(item)\"\n *ngFor=\"let item of viewPortItems; trackBy: trackByOption\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.aria-selected]=\"item.selected\"\n [attr.id]=\"item?.htmlId\">\n\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\">{{item.label}}</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"item.children ? (optgroupTemplate || defaultOptionTemplate) : (optionTemplate || defaultOptionTemplate)\"\n [ngTemplateOutletContext]=\"{ item: item.value, item$:item, index: item.index, searchTerm: searchTerm }\">\n </ng-template>\n </div>\n\n <div class=\"ng-option\" [class.ng-option-marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag\">\n <ng-template #defaultTagTemplate>\n <span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{searchTerm}}\"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"showNoItemsFound()\">\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{notFoundText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"showTypeToSearch()\">\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{typeToSearchText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loading && itemsList.filteredItems.length === 0\">\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{loadingText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n",
4176
+ providers: [{
4177
+ provide: forms.NG_VALUE_ACCESSOR,
4178
+ useExisting: core.forwardRef((/**
4179
+ * @return {?}
4180
+ */
4181
+ function () { return NgSelectComponent; })),
4182
+ multi: true
4183
+ }, NgDropdownPanelService],
4184
+ encapsulation: core.ViewEncapsulation.None,
4185
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
4186
+ host: {
4187
+ 'role': 'listbox',
4188
+ 'class': 'ng-select',
4189
+ '[class.ng-select-single]': '!multiple',
4190
+ },
4191
+ styles: [".ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{color:#333;cursor:default;display:-webkit-box;display:flex;outline:0;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:-webkit-box;display:flex;-webkit-box-flex:1;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none;border:0;box-shadow:none;outline:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{-webkit-box-flex:1;flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute;z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:.8s linear infinite load8;animation:.8s linear infinite load8}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}"]
4192
+ }] }
4193
+ ];
4194
+ /** @nocollapse */
4195
+ NgSelectComponent.ctorParameters = function () { return [
4196
+ { type: String, decorators: [{ type: core.Attribute, args: ['class',] }] },
4197
+ { type: undefined, decorators: [{ type: core.Attribute, args: ['autofocus',] }] },
4198
+ { type: NgSelectConfig },
4199
+ { type: undefined, decorators: [{ type: core.Inject, args: [SELECTION_MODEL_FACTORY,] }] },
4200
+ { type: core.ElementRef },
4201
+ { type: core.ChangeDetectorRef },
4202
+ { type: ConsoleService }
4203
+ ]; };
4204
+ NgSelectComponent.propDecorators = {
4205
+ bindLabel: [{ type: core.Input }],
4206
+ bindValue: [{ type: core.Input }],
4207
+ markFirst: [{ type: core.Input }],
4208
+ placeholder: [{ type: core.Input }],
4209
+ notFoundText: [{ type: core.Input }],
4210
+ typeToSearchText: [{ type: core.Input }],
4211
+ addTagText: [{ type: core.Input }],
4212
+ loadingText: [{ type: core.Input }],
4213
+ clearAllText: [{ type: core.Input }],
4214
+ dropdownPosition: [{ type: core.Input }],
4215
+ appendTo: [{ type: core.Input }],
4216
+ loading: [{ type: core.Input }],
4217
+ closeOnSelect: [{ type: core.Input }],
4218
+ hideSelected: [{ type: core.Input }],
4219
+ selectOnTab: [{ type: core.Input }],
4220
+ openOnEnter: [{ type: core.Input }],
4221
+ maxSelectedItems: [{ type: core.Input }],
4222
+ groupBy: [{ type: core.Input }],
4223
+ groupValue: [{ type: core.Input }],
4224
+ bufferAmount: [{ type: core.Input }],
4225
+ virtualScroll: [{ type: core.Input }],
4226
+ selectableGroup: [{ type: core.Input }],
4227
+ selectableGroupAsModel: [{ type: core.Input }],
4228
+ searchFn: [{ type: core.Input }],
4229
+ trackByFn: [{ type: core.Input }],
4230
+ clearOnBackspace: [{ type: core.Input }],
4231
+ labelForId: [{ type: core.Input }],
4232
+ inputAttrs: [{ type: core.Input }],
4233
+ tabIndex: [{ type: core.Input }],
4234
+ typeahead: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-typeahead',] }],
4235
+ multiple: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-multiple',] }],
4236
+ addTag: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-taggable',] }],
4237
+ searchable: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-searchable',] }],
4238
+ clearable: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-clearable',] }],
4239
+ isOpen: [{ type: core.Input }, { type: core.HostBinding, args: ['class.ng-select-opened',] }],
4240
+ items: [{ type: core.Input }],
4241
+ compareWith: [{ type: core.Input }],
4242
+ clearSearchOnAdd: [{ type: core.Input }],
4243
+ blurEvent: [{ type: core.Output, args: ['blur',] }],
4244
+ focusEvent: [{ type: core.Output, args: ['focus',] }],
4245
+ changeEvent: [{ type: core.Output, args: ['change',] }],
4246
+ openEvent: [{ type: core.Output, args: ['open',] }],
4247
+ closeEvent: [{ type: core.Output, args: ['close',] }],
4248
+ searchEvent: [{ type: core.Output, args: ['search',] }],
4249
+ clearEvent: [{ type: core.Output, args: ['clear',] }],
4250
+ addEvent: [{ type: core.Output, args: ['add',] }],
4251
+ removeEvent: [{ type: core.Output, args: ['remove',] }],
4252
+ scroll: [{ type: core.Output, args: ['scroll',] }],
4253
+ scrollToEnd: [{ type: core.Output, args: ['scrollToEnd',] }],
4254
+ optionTemplate: [{ type: core.ContentChild, args: [NgOptionTemplateDirective, { read: core.TemplateRef, static: true },] }],
4255
+ optgroupTemplate: [{ type: core.ContentChild, args: [NgOptgroupTemplateDirective, { read: core.TemplateRef, static: true },] }],
4256
+ labelTemplate: [{ type: core.ContentChild, args: [NgLabelTemplateDirective, { read: core.TemplateRef, static: true },] }],
4257
+ multiLabelTemplate: [{ type: core.ContentChild, args: [NgMultiLabelTemplateDirective, { read: core.TemplateRef, static: true },] }],
4258
+ headerTemplate: [{ type: core.ContentChild, args: [NgHeaderTemplateDirective, { read: core.TemplateRef, static: true },] }],
4259
+ footerTemplate: [{ type: core.ContentChild, args: [NgFooterTemplateDirective, { read: core.TemplateRef, static: true },] }],
4260
+ notFoundTemplate: [{ type: core.ContentChild, args: [NgNotFoundTemplateDirective, { read: core.TemplateRef, static: true },] }],
4261
+ typeToSearchTemplate: [{ type: core.ContentChild, args: [NgTypeToSearchTemplateDirective, { read: core.TemplateRef, static: true },] }],
4262
+ loadingTextTemplate: [{ type: core.ContentChild, args: [NgLoadingTextTemplateDirective, { read: core.TemplateRef, static: true },] }],
4263
+ tagTemplate: [{ type: core.ContentChild, args: [NgTagTemplateDirective, { read: core.TemplateRef, static: true },] }],
4264
+ loadingSpinnerTemplate: [{ type: core.ContentChild, args: [NgLoadingSpinnerTemplateDirective, { read: core.TemplateRef, static: true },] }],
4265
+ dropdownPanel: [{ type: core.ViewChild, args: [core.forwardRef((/**
4266
+ * @return {?}
4267
+ */
4268
+ function () { return NgDropdownPanelComponent; })), { static: false },] }],
4269
+ searchInput: [{ type: core.ViewChild, args: ['searchInput', { static: true },] }],
4270
+ ngOptions: [{ type: core.ContentChildren, args: [NgOptionComponent, { descendants: true },] }],
4271
+ disabled: [{ type: core.HostBinding, args: ['class.ng-select-disabled',] }],
4272
+ filtered: [{ type: core.HostBinding, args: ['class.ng-select-filtered',] }],
4273
+ handleKeyDown: [{ type: core.HostListener, args: ['keydown', ['$event'],] }]
4274
+ };
4275
+ return NgSelectComponent;
4276
+ }());
4277
+
4278
+ /**
4279
+ * @fileoverview added by tsickle
4280
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4281
+ */
4282
+ /**
4283
+ * @return {?}
4284
+ */
4285
+ function DefaultSelectionModelFactory() {
4286
+ return new DefaultSelectionModel();
4287
+ }
4288
+ var DefaultSelectionModel = /** @class */ (function () {
4289
+ function DefaultSelectionModel() {
4290
+ this._selected = [];
4291
+ }
4292
+ Object.defineProperty(DefaultSelectionModel.prototype, "value", {
4293
+ get: /**
4294
+ * @return {?}
4295
+ */
4296
+ function () {
4297
+ return this._selected;
4298
+ },
4299
+ enumerable: true,
4300
+ configurable: true
4301
+ });
4302
+ /**
4303
+ * @param {?} item
4304
+ * @param {?} multiple
4305
+ * @param {?} groupAsModel
4306
+ * @return {?}
4307
+ */
4308
+ DefaultSelectionModel.prototype.select = /**
4309
+ * @param {?} item
4310
+ * @param {?} multiple
4311
+ * @param {?} groupAsModel
4312
+ * @return {?}
4313
+ */
4314
+ function (item, multiple, groupAsModel) {
4315
+ item.selected = true;
4316
+ if (groupAsModel || !item.children) {
4317
+ this._selected.push(item);
4318
+ }
4319
+ if (multiple) {
4320
+ if (item.parent) {
4321
+ /** @type {?} */
4322
+ var childrenCount = item.parent.children.length;
4323
+ /** @type {?} */
4324
+ var selectedCount = item.parent.children.filter((/**
4325
+ * @param {?} x
4326
+ * @return {?}
4327
+ */
4328
+ function (x) { return x.selected; })).length;
4329
+ item.parent.selected = childrenCount === selectedCount;
4330
+ }
4331
+ else if (item.children) {
4332
+ this._setChildrenSelectedState(item.children, true);
4333
+ this._removeChildren(item);
4334
+ if (!groupAsModel) {
4335
+ this._selected = __spread(this._selected, item.children);
4336
+ }
4337
+ }
4338
+ }
4339
+ };
4340
+ /**
4341
+ * @param {?} item
4342
+ * @param {?} multiple
4343
+ * @return {?}
4344
+ */
4345
+ DefaultSelectionModel.prototype.unselect = /**
4346
+ * @param {?} item
4347
+ * @param {?} multiple
4348
+ * @return {?}
4349
+ */
4350
+ function (item, multiple) {
4351
+ var _a;
4352
+ this._selected = this._selected.filter((/**
4353
+ * @param {?} x
4354
+ * @return {?}
4355
+ */
4356
+ function (x) { return x !== item; }));
4357
+ item.selected = false;
4358
+ if (multiple) {
4359
+ if (item.parent && item.parent.selected) {
4360
+ /** @type {?} */
4361
+ var children = item.parent.children;
4362
+ this._removeParent(item.parent);
4363
+ this._removeChildren(item.parent);
4364
+ (_a = this._selected).push.apply(_a, __spread(children.filter((/**
4365
+ * @param {?} x
4366
+ * @return {?}
4367
+ */
4368
+ function (x) { return x !== item; }))));
4369
+ item.parent.selected = false;
4370
+ }
4371
+ else if (item.children) {
4372
+ this._setChildrenSelectedState(item.children, false);
4373
+ this._removeChildren(item);
4374
+ }
4375
+ }
4376
+ };
4377
+ /**
4378
+ * @param {?} keepDisabled
4379
+ * @return {?}
4380
+ */
4381
+ DefaultSelectionModel.prototype.clear = /**
4382
+ * @param {?} keepDisabled
4383
+ * @return {?}
4384
+ */
4385
+ function (keepDisabled) {
4386
+ this._selected = keepDisabled ? this._selected.filter((/**
4387
+ * @param {?} x
4388
+ * @return {?}
4389
+ */
4390
+ function (x) { return x.disabled; })) : [];
4391
+ };
4392
+ /**
4393
+ * @private
4394
+ * @param {?} children
4395
+ * @param {?} selected
4396
+ * @return {?}
4397
+ */
4398
+ DefaultSelectionModel.prototype._setChildrenSelectedState = /**
4399
+ * @private
4400
+ * @param {?} children
4401
+ * @param {?} selected
4402
+ * @return {?}
4403
+ */
4404
+ function (children, selected) {
4405
+ children.forEach((/**
4406
+ * @param {?} x
4407
+ * @return {?}
4408
+ */
4409
+ function (x) { return x.selected = selected; }));
4410
+ };
4411
+ /**
4412
+ * @private
4413
+ * @param {?} parent
4414
+ * @return {?}
4415
+ */
4416
+ DefaultSelectionModel.prototype._removeChildren = /**
4417
+ * @private
4418
+ * @param {?} parent
4419
+ * @return {?}
4420
+ */
4421
+ function (parent) {
4422
+ this._selected = this._selected.filter((/**
4423
+ * @param {?} x
4424
+ * @return {?}
4425
+ */
4426
+ function (x) { return x.parent !== parent; }));
4427
+ };
4428
+ /**
4429
+ * @private
4430
+ * @param {?} parent
4431
+ * @return {?}
4432
+ */
4433
+ DefaultSelectionModel.prototype._removeParent = /**
4434
+ * @private
4435
+ * @param {?} parent
4436
+ * @return {?}
4437
+ */
4438
+ function (parent) {
4439
+ this._selected = this._selected.filter((/**
4440
+ * @param {?} x
4441
+ * @return {?}
4442
+ */
4443
+ function (x) { return x !== parent; }));
4444
+ };
4445
+ return DefaultSelectionModel;
4446
+ }());
4447
+
4448
+ /**
4449
+ * @fileoverview added by tsickle
4450
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4451
+ */
4452
+ var ɵ0 = DefaultSelectionModelFactory;
4453
+ var NgSelectModule = /** @class */ (function () {
4454
+ function NgSelectModule() {
4455
+ }
4456
+ NgSelectModule.decorators = [
4457
+ { type: core.NgModule, args: [{
4458
+ declarations: [
4459
+ NgDropdownPanelComponent,
4460
+ NgOptionComponent,
4461
+ NgSelectComponent,
4462
+ NgOptgroupTemplateDirective,
4463
+ NgOptionTemplateDirective,
4464
+ NgLabelTemplateDirective,
4465
+ NgMultiLabelTemplateDirective,
4466
+ NgHeaderTemplateDirective,
4467
+ NgFooterTemplateDirective,
4468
+ NgNotFoundTemplateDirective,
4469
+ NgTypeToSearchTemplateDirective,
4470
+ NgLoadingTextTemplateDirective,
4471
+ NgTagTemplateDirective,
4472
+ NgLoadingSpinnerTemplateDirective
4473
+ ],
4474
+ imports: [
4475
+ common.CommonModule
4476
+ ],
4477
+ exports: [
4478
+ NgSelectComponent,
4479
+ NgOptionComponent,
4480
+ NgOptgroupTemplateDirective,
4481
+ NgOptionTemplateDirective,
4482
+ NgLabelTemplateDirective,
4483
+ NgMultiLabelTemplateDirective,
4484
+ NgHeaderTemplateDirective,
4485
+ NgFooterTemplateDirective,
4486
+ NgNotFoundTemplateDirective,
4487
+ NgTypeToSearchTemplateDirective,
4488
+ NgLoadingTextTemplateDirective,
4489
+ NgTagTemplateDirective,
4490
+ NgLoadingSpinnerTemplateDirective
4491
+ ],
4492
+ providers: [
4493
+ { provide: SELECTION_MODEL_FACTORY, useValue: ɵ0 }
4494
+ ]
4495
+ },] }
4496
+ ];
4497
+ return NgSelectModule;
4498
+ }());
4499
+
4500
+ exports.NgSelectComponent = NgSelectComponent;
4501
+ exports.NgSelectConfig = NgSelectConfig;
4502
+ exports.NgSelectModule = NgSelectModule;
4503
+ exports.SELECTION_MODEL_FACTORY = SELECTION_MODEL_FACTORY;
4504
+ exports.ɵb = DefaultSelectionModelFactory;
4505
+ exports.ɵc = DefaultSelectionModel;
4506
+ exports.ɵd = NgDropdownPanelService;
4507
+ exports.ɵe = NgOptionTemplateDirective;
4508
+ exports.ɵf = NgOptgroupTemplateDirective;
4509
+ exports.ɵg = NgLabelTemplateDirective;
4510
+ exports.ɵh = NgMultiLabelTemplateDirective;
4511
+ exports.ɵi = NgHeaderTemplateDirective;
4512
+ exports.ɵj = NgFooterTemplateDirective;
4513
+ exports.ɵk = NgNotFoundTemplateDirective;
4514
+ exports.ɵl = NgTypeToSearchTemplateDirective;
4515
+ exports.ɵm = NgLoadingTextTemplateDirective;
4516
+ exports.ɵn = NgTagTemplateDirective;
4517
+ exports.ɵo = NgLoadingSpinnerTemplateDirective;
4518
+ exports.ɵp = NgDropdownPanelComponent;
4519
+ exports.ɵq = NgOptionComponent;
4520
+ exports.ɵr = ConsoleService;
4521
+
4522
+ Object.defineProperty(exports, '__esModule', { value: true });
4523
+
4524
+ }));
4525
+ //# sourceMappingURL=ng-select-ng-select.umd.js.map