@ng-select/ng-select 7.2.0 → 8.1.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 (55) hide show
  1. package/README.md +2 -1
  2. package/esm2020/lib/config.service.mjs +21 -0
  3. package/esm2020/lib/console.service.mjs +14 -0
  4. package/{esm2015/lib/id.js → esm2020/lib/id.mjs} +3 -3
  5. package/esm2020/lib/items-list.mjs +356 -0
  6. package/esm2020/lib/ng-dropdown-panel.component.mjs +403 -0
  7. package/esm2020/lib/ng-dropdown-panel.service.mjs +68 -0
  8. package/esm2020/lib/ng-option.component.mjs +54 -0
  9. package/esm2020/lib/ng-select.component.mjs +991 -0
  10. package/esm2020/lib/ng-select.module.mjs +87 -0
  11. package/{esm2015/lib/ng-select.types.js → esm2020/lib/ng-select.types.mjs} +1 -1
  12. package/esm2020/lib/ng-templates.directive.mjs +157 -0
  13. package/{esm2015/lib/search-helper.js → esm2020/lib/search-helper.mjs} +2 -4
  14. package/{esm2015/lib/selection-model.js → esm2020/lib/selection-model.mjs} +0 -0
  15. package/{esm2015/lib/value-utils.js → esm2020/lib/value-utils.mjs} +5 -5
  16. package/esm2020/ng-select-ng-select.mjs +5 -0
  17. package/esm2020/public-api.mjs +9 -0
  18. package/fesm2015/{ng-select-ng-select.js → ng-select-ng-select.mjs} +531 -315
  19. package/fesm2015/ng-select-ng-select.mjs.map +1 -0
  20. package/fesm2020/ng-select-ng-select.mjs +3088 -0
  21. package/fesm2020/ng-select-ng-select.mjs.map +1 -0
  22. package/lib/config.service.d.ts +4 -0
  23. package/lib/console.service.d.ts +3 -0
  24. package/lib/ng-dropdown-panel.component.d.ts +5 -1
  25. package/lib/ng-dropdown-panel.service.d.ts +3 -0
  26. package/lib/ng-option.component.d.ts +3 -0
  27. package/lib/ng-select.component.d.ts +12 -8
  28. package/lib/ng-select.module.d.ts +9 -0
  29. package/lib/ng-select.types.d.ts +2 -1
  30. package/lib/ng-templates.directive.d.ts +25 -0
  31. package/lib/value-utils.d.ts +1 -1
  32. package/ng-select-ng-select.d.ts +1 -6
  33. package/package.json +24 -12
  34. package/public-api.d.ts +4 -2
  35. package/scss/ant.design.theme.scss +15 -2
  36. package/scss/default.theme.scss +64 -15
  37. package/scss/material.theme.scss +13 -2
  38. package/themes/ant.design.theme.css +1 -1
  39. package/themes/default.theme.css +1 -1
  40. package/themes/material.theme.css +1 -1
  41. package/bundles/ng-select-ng-select.umd.js +0 -3497
  42. package/bundles/ng-select-ng-select.umd.js.map +0 -1
  43. package/esm2015/lib/config.service.js +0 -19
  44. package/esm2015/lib/console.service.js +0 -12
  45. package/esm2015/lib/items-list.js +0 -356
  46. package/esm2015/lib/ng-dropdown-panel.component.js +0 -367
  47. package/esm2015/lib/ng-dropdown-panel.service.js +0 -65
  48. package/esm2015/lib/ng-option.component.js +0 -53
  49. package/esm2015/lib/ng-select.component.js +0 -852
  50. package/esm2015/lib/ng-select.module.js +0 -54
  51. package/esm2015/lib/ng-templates.directive.js +0 -145
  52. package/esm2015/ng-select-ng-select.js +0 -11
  53. package/esm2015/public-api.js +0 -7
  54. package/fesm2015/ng-select-ng-select.js.map +0 -1
  55. package/ng-select-ng-select.metadata.json +0 -1
@@ -0,0 +1,3088 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, Input, Injectable, EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Optional, Inject, Output, ViewChild, InjectionToken, forwardRef, TemplateRef, Attribute, HostBinding, ContentChild, ContentChildren, HostListener, NgModule } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
+ import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
5
+ import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
6
+ import * as i4 from '@angular/common';
7
+ import { DOCUMENT, CommonModule } from '@angular/common';
8
+
9
+ const unescapedHTMLExp = /[&<>"']/g;
10
+ const hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
11
+ const htmlEscapes = {
12
+ '&': '&amp;',
13
+ '<': '&lt;',
14
+ '>': '&gt;',
15
+ '"': '&quot;',
16
+ '\'': '&#39;'
17
+ };
18
+ function escapeHTML(value) {
19
+ return (value && hasUnescapedHTMLExp.test(value)) ?
20
+ value.replace(unescapedHTMLExp, chr => htmlEscapes[chr]) :
21
+ value;
22
+ }
23
+ function isDefined(value) {
24
+ return value !== undefined && value !== null;
25
+ }
26
+ function isObject(value) {
27
+ return typeof value === 'object' && isDefined(value);
28
+ }
29
+ function isPromise(value) {
30
+ return value instanceof Promise;
31
+ }
32
+ function isFunction(value) {
33
+ return value instanceof Function;
34
+ }
35
+
36
+ class NgItemLabelDirective {
37
+ constructor(element) {
38
+ this.element = element;
39
+ this.escape = true;
40
+ }
41
+ ngOnChanges(changes) {
42
+ this.element.nativeElement.innerHTML = this.escape ?
43
+ escapeHTML(this.ngItemLabel) :
44
+ this.ngItemLabel;
45
+ }
46
+ }
47
+ NgItemLabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgItemLabelDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
48
+ NgItemLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgItemLabelDirective, selector: "[ngItemLabel]", inputs: { ngItemLabel: "ngItemLabel", escape: "escape" }, usesOnChanges: true, ngImport: i0 });
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgItemLabelDirective, decorators: [{
50
+ type: Directive,
51
+ args: [{ selector: '[ngItemLabel]' }]
52
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { ngItemLabel: [{
53
+ type: Input
54
+ }], escape: [{
55
+ type: Input
56
+ }] } });
57
+ // eslint-disable-next-line @angular-eslint/directive-selector
58
+ class NgOptionTemplateDirective {
59
+ constructor(template) {
60
+ this.template = template;
61
+ }
62
+ }
63
+ NgOptionTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptionTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
64
+ NgOptionTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgOptionTemplateDirective, selector: "[ng-option-tmp]", ngImport: i0 });
65
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptionTemplateDirective, decorators: [{
66
+ type: Directive,
67
+ args: [{ selector: '[ng-option-tmp]' }]
68
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
69
+ // eslint-disable-next-line @angular-eslint/directive-selector
70
+ class NgOptgroupTemplateDirective {
71
+ constructor(template) {
72
+ this.template = template;
73
+ }
74
+ }
75
+ NgOptgroupTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptgroupTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
76
+ NgOptgroupTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgOptgroupTemplateDirective, selector: "[ng-optgroup-tmp]", ngImport: i0 });
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptgroupTemplateDirective, decorators: [{
78
+ type: Directive,
79
+ args: [{ selector: '[ng-optgroup-tmp]' }]
80
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
81
+ // eslint-disable-next-line @angular-eslint/directive-selector
82
+ class NgLabelTemplateDirective {
83
+ constructor(template) {
84
+ this.template = template;
85
+ }
86
+ }
87
+ NgLabelTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLabelTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
88
+ NgLabelTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgLabelTemplateDirective, selector: "[ng-label-tmp]", ngImport: i0 });
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLabelTemplateDirective, decorators: [{
90
+ type: Directive,
91
+ args: [{ selector: '[ng-label-tmp]' }]
92
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
93
+ // eslint-disable-next-line @angular-eslint/directive-selector
94
+ class NgMultiLabelTemplateDirective {
95
+ constructor(template) {
96
+ this.template = template;
97
+ }
98
+ }
99
+ NgMultiLabelTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgMultiLabelTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
100
+ NgMultiLabelTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgMultiLabelTemplateDirective, selector: "[ng-multi-label-tmp]", ngImport: i0 });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgMultiLabelTemplateDirective, decorators: [{
102
+ type: Directive,
103
+ args: [{ selector: '[ng-multi-label-tmp]' }]
104
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
105
+ // eslint-disable-next-line @angular-eslint/directive-selector
106
+ class NgHeaderTemplateDirective {
107
+ constructor(template) {
108
+ this.template = template;
109
+ }
110
+ }
111
+ NgHeaderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgHeaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
112
+ NgHeaderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgHeaderTemplateDirective, selector: "[ng-header-tmp]", ngImport: i0 });
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgHeaderTemplateDirective, decorators: [{
114
+ type: Directive,
115
+ args: [{ selector: '[ng-header-tmp]' }]
116
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
117
+ // eslint-disable-next-line @angular-eslint/directive-selector
118
+ class NgFooterTemplateDirective {
119
+ constructor(template) {
120
+ this.template = template;
121
+ }
122
+ }
123
+ NgFooterTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgFooterTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
124
+ NgFooterTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgFooterTemplateDirective, selector: "[ng-footer-tmp]", ngImport: i0 });
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgFooterTemplateDirective, decorators: [{
126
+ type: Directive,
127
+ args: [{ selector: '[ng-footer-tmp]' }]
128
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
129
+ // eslint-disable-next-line @angular-eslint/directive-selector
130
+ class NgNotFoundTemplateDirective {
131
+ constructor(template) {
132
+ this.template = template;
133
+ }
134
+ }
135
+ NgNotFoundTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgNotFoundTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
136
+ NgNotFoundTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgNotFoundTemplateDirective, selector: "[ng-notfound-tmp]", ngImport: i0 });
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgNotFoundTemplateDirective, decorators: [{
138
+ type: Directive,
139
+ args: [{ selector: '[ng-notfound-tmp]' }]
140
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
141
+ // eslint-disable-next-line @angular-eslint/directive-selector
142
+ class NgTypeToSearchTemplateDirective {
143
+ constructor(template) {
144
+ this.template = template;
145
+ }
146
+ }
147
+ NgTypeToSearchTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgTypeToSearchTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
148
+ NgTypeToSearchTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgTypeToSearchTemplateDirective, selector: "[ng-typetosearch-tmp]", ngImport: i0 });
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgTypeToSearchTemplateDirective, decorators: [{
150
+ type: Directive,
151
+ args: [{ selector: '[ng-typetosearch-tmp]' }]
152
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
153
+ // eslint-disable-next-line @angular-eslint/directive-selector
154
+ class NgLoadingTextTemplateDirective {
155
+ constructor(template) {
156
+ this.template = template;
157
+ }
158
+ }
159
+ NgLoadingTextTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLoadingTextTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
160
+ NgLoadingTextTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgLoadingTextTemplateDirective, selector: "[ng-loadingtext-tmp]", ngImport: i0 });
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLoadingTextTemplateDirective, decorators: [{
162
+ type: Directive,
163
+ args: [{ selector: '[ng-loadingtext-tmp]' }]
164
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
165
+ // eslint-disable-next-line @angular-eslint/directive-selector
166
+ class NgTagTemplateDirective {
167
+ constructor(template) {
168
+ this.template = template;
169
+ }
170
+ }
171
+ NgTagTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgTagTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
172
+ NgTagTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgTagTemplateDirective, selector: "[ng-tag-tmp]", ngImport: i0 });
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgTagTemplateDirective, decorators: [{
174
+ type: Directive,
175
+ args: [{ selector: '[ng-tag-tmp]' }]
176
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
177
+ // eslint-disable-next-line @angular-eslint/directive-selector
178
+ class NgLoadingSpinnerTemplateDirective {
179
+ constructor(template) {
180
+ this.template = template;
181
+ }
182
+ }
183
+ NgLoadingSpinnerTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
184
+ NgLoadingSpinnerTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: NgLoadingSpinnerTemplateDirective, selector: "[ng-loadingspinner-tmp]", ngImport: i0 });
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, decorators: [{
186
+ type: Directive,
187
+ args: [{ selector: '[ng-loadingspinner-tmp]' }]
188
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
189
+
190
+ function newId() {
191
+ // First character is an 'a', it's good practice to tag id to begin with a letter
192
+ return 'axxxxxxxxxxx'.replace(/[x]/g, () => {
193
+ // eslint-disable-next-line no-bitwise
194
+ const val = Math.random() * 16 | 0;
195
+ return val.toString(16);
196
+ });
197
+ }
198
+
199
+ const diacritics = {
200
+ '\u24B6': 'A',
201
+ '\uFF21': 'A',
202
+ '\u00C0': 'A',
203
+ '\u00C1': 'A',
204
+ '\u00C2': 'A',
205
+ '\u1EA6': 'A',
206
+ '\u1EA4': 'A',
207
+ '\u1EAA': 'A',
208
+ '\u1EA8': 'A',
209
+ '\u00C3': 'A',
210
+ '\u0100': 'A',
211
+ '\u0102': 'A',
212
+ '\u1EB0': 'A',
213
+ '\u1EAE': 'A',
214
+ '\u1EB4': 'A',
215
+ '\u1EB2': 'A',
216
+ '\u0226': 'A',
217
+ '\u01E0': 'A',
218
+ '\u00C4': 'A',
219
+ '\u01DE': 'A',
220
+ '\u1EA2': 'A',
221
+ '\u00C5': 'A',
222
+ '\u01FA': 'A',
223
+ '\u01CD': 'A',
224
+ '\u0200': 'A',
225
+ '\u0202': 'A',
226
+ '\u1EA0': 'A',
227
+ '\u1EAC': 'A',
228
+ '\u1EB6': 'A',
229
+ '\u1E00': 'A',
230
+ '\u0104': 'A',
231
+ '\u023A': 'A',
232
+ '\u2C6F': 'A',
233
+ '\uA732': 'AA',
234
+ '\u00C6': 'AE',
235
+ '\u01FC': 'AE',
236
+ '\u01E2': 'AE',
237
+ '\uA734': 'AO',
238
+ '\uA736': 'AU',
239
+ '\uA738': 'AV',
240
+ '\uA73A': 'AV',
241
+ '\uA73C': 'AY',
242
+ '\u24B7': 'B',
243
+ '\uFF22': 'B',
244
+ '\u1E02': 'B',
245
+ '\u1E04': 'B',
246
+ '\u1E06': 'B',
247
+ '\u0243': 'B',
248
+ '\u0182': 'B',
249
+ '\u0181': 'B',
250
+ '\u24B8': 'C',
251
+ '\uFF23': 'C',
252
+ '\u0106': 'C',
253
+ '\u0108': 'C',
254
+ '\u010A': 'C',
255
+ '\u010C': 'C',
256
+ '\u00C7': 'C',
257
+ '\u1E08': 'C',
258
+ '\u0187': 'C',
259
+ '\u023B': 'C',
260
+ '\uA73E': 'C',
261
+ '\u24B9': 'D',
262
+ '\uFF24': 'D',
263
+ '\u1E0A': 'D',
264
+ '\u010E': 'D',
265
+ '\u1E0C': 'D',
266
+ '\u1E10': 'D',
267
+ '\u1E12': 'D',
268
+ '\u1E0E': 'D',
269
+ '\u0110': 'D',
270
+ '\u018B': 'D',
271
+ '\u018A': 'D',
272
+ '\u0189': 'D',
273
+ '\uA779': 'D',
274
+ '\u01F1': 'DZ',
275
+ '\u01C4': 'DZ',
276
+ '\u01F2': 'Dz',
277
+ '\u01C5': 'Dz',
278
+ '\u24BA': 'E',
279
+ '\uFF25': 'E',
280
+ '\u00C8': 'E',
281
+ '\u00C9': 'E',
282
+ '\u00CA': 'E',
283
+ '\u1EC0': 'E',
284
+ '\u1EBE': 'E',
285
+ '\u1EC4': 'E',
286
+ '\u1EC2': 'E',
287
+ '\u1EBC': 'E',
288
+ '\u0112': 'E',
289
+ '\u1E14': 'E',
290
+ '\u1E16': 'E',
291
+ '\u0114': 'E',
292
+ '\u0116': 'E',
293
+ '\u00CB': 'E',
294
+ '\u1EBA': 'E',
295
+ '\u011A': 'E',
296
+ '\u0204': 'E',
297
+ '\u0206': 'E',
298
+ '\u1EB8': 'E',
299
+ '\u1EC6': 'E',
300
+ '\u0228': 'E',
301
+ '\u1E1C': 'E',
302
+ '\u0118': 'E',
303
+ '\u1E18': 'E',
304
+ '\u1E1A': 'E',
305
+ '\u0190': 'E',
306
+ '\u018E': 'E',
307
+ '\u24BB': 'F',
308
+ '\uFF26': 'F',
309
+ '\u1E1E': 'F',
310
+ '\u0191': 'F',
311
+ '\uA77B': 'F',
312
+ '\u24BC': 'G',
313
+ '\uFF27': 'G',
314
+ '\u01F4': 'G',
315
+ '\u011C': 'G',
316
+ '\u1E20': 'G',
317
+ '\u011E': 'G',
318
+ '\u0120': 'G',
319
+ '\u01E6': 'G',
320
+ '\u0122': 'G',
321
+ '\u01E4': 'G',
322
+ '\u0193': 'G',
323
+ '\uA7A0': 'G',
324
+ '\uA77D': 'G',
325
+ '\uA77E': 'G',
326
+ '\u24BD': 'H',
327
+ '\uFF28': 'H',
328
+ '\u0124': 'H',
329
+ '\u1E22': 'H',
330
+ '\u1E26': 'H',
331
+ '\u021E': 'H',
332
+ '\u1E24': 'H',
333
+ '\u1E28': 'H',
334
+ '\u1E2A': 'H',
335
+ '\u0126': 'H',
336
+ '\u2C67': 'H',
337
+ '\u2C75': 'H',
338
+ '\uA78D': 'H',
339
+ '\u24BE': 'I',
340
+ '\uFF29': 'I',
341
+ '\u00CC': 'I',
342
+ '\u00CD': 'I',
343
+ '\u00CE': 'I',
344
+ '\u0128': 'I',
345
+ '\u012A': 'I',
346
+ '\u012C': 'I',
347
+ '\u0130': 'I',
348
+ '\u00CF': 'I',
349
+ '\u1E2E': 'I',
350
+ '\u1EC8': 'I',
351
+ '\u01CF': 'I',
352
+ '\u0208': 'I',
353
+ '\u020A': 'I',
354
+ '\u1ECA': 'I',
355
+ '\u012E': 'I',
356
+ '\u1E2C': 'I',
357
+ '\u0197': 'I',
358
+ '\u24BF': 'J',
359
+ '\uFF2A': 'J',
360
+ '\u0134': 'J',
361
+ '\u0248': 'J',
362
+ '\u24C0': 'K',
363
+ '\uFF2B': 'K',
364
+ '\u1E30': 'K',
365
+ '\u01E8': 'K',
366
+ '\u1E32': 'K',
367
+ '\u0136': 'K',
368
+ '\u1E34': 'K',
369
+ '\u0198': 'K',
370
+ '\u2C69': 'K',
371
+ '\uA740': 'K',
372
+ '\uA742': 'K',
373
+ '\uA744': 'K',
374
+ '\uA7A2': 'K',
375
+ '\u24C1': 'L',
376
+ '\uFF2C': 'L',
377
+ '\u013F': 'L',
378
+ '\u0139': 'L',
379
+ '\u013D': 'L',
380
+ '\u1E36': 'L',
381
+ '\u1E38': 'L',
382
+ '\u013B': 'L',
383
+ '\u1E3C': 'L',
384
+ '\u1E3A': 'L',
385
+ '\u0141': 'L',
386
+ '\u023D': 'L',
387
+ '\u2C62': 'L',
388
+ '\u2C60': 'L',
389
+ '\uA748': 'L',
390
+ '\uA746': 'L',
391
+ '\uA780': 'L',
392
+ '\u01C7': 'LJ',
393
+ '\u01C8': 'Lj',
394
+ '\u24C2': 'M',
395
+ '\uFF2D': 'M',
396
+ '\u1E3E': 'M',
397
+ '\u1E40': 'M',
398
+ '\u1E42': 'M',
399
+ '\u2C6E': 'M',
400
+ '\u019C': 'M',
401
+ '\u24C3': 'N',
402
+ '\uFF2E': 'N',
403
+ '\u01F8': 'N',
404
+ '\u0143': 'N',
405
+ '\u00D1': 'N',
406
+ '\u1E44': 'N',
407
+ '\u0147': 'N',
408
+ '\u1E46': 'N',
409
+ '\u0145': 'N',
410
+ '\u1E4A': 'N',
411
+ '\u1E48': 'N',
412
+ '\u0220': 'N',
413
+ '\u019D': 'N',
414
+ '\uA790': 'N',
415
+ '\uA7A4': 'N',
416
+ '\u01CA': 'NJ',
417
+ '\u01CB': 'Nj',
418
+ '\u24C4': 'O',
419
+ '\uFF2F': 'O',
420
+ '\u00D2': 'O',
421
+ '\u00D3': 'O',
422
+ '\u00D4': 'O',
423
+ '\u1ED2': 'O',
424
+ '\u1ED0': 'O',
425
+ '\u1ED6': 'O',
426
+ '\u1ED4': 'O',
427
+ '\u00D5': 'O',
428
+ '\u1E4C': 'O',
429
+ '\u022C': 'O',
430
+ '\u1E4E': 'O',
431
+ '\u014C': 'O',
432
+ '\u1E50': 'O',
433
+ '\u1E52': 'O',
434
+ '\u014E': 'O',
435
+ '\u022E': 'O',
436
+ '\u0230': 'O',
437
+ '\u00D6': 'O',
438
+ '\u022A': 'O',
439
+ '\u1ECE': 'O',
440
+ '\u0150': 'O',
441
+ '\u01D1': 'O',
442
+ '\u020C': 'O',
443
+ '\u020E': 'O',
444
+ '\u01A0': 'O',
445
+ '\u1EDC': 'O',
446
+ '\u1EDA': 'O',
447
+ '\u1EE0': 'O',
448
+ '\u1EDE': 'O',
449
+ '\u1EE2': 'O',
450
+ '\u1ECC': 'O',
451
+ '\u1ED8': 'O',
452
+ '\u01EA': 'O',
453
+ '\u01EC': 'O',
454
+ '\u00D8': 'O',
455
+ '\u01FE': 'O',
456
+ '\u0186': 'O',
457
+ '\u019F': 'O',
458
+ '\uA74A': 'O',
459
+ '\uA74C': 'O',
460
+ '\u01A2': 'OI',
461
+ '\uA74E': 'OO',
462
+ '\u0222': 'OU',
463
+ '\u24C5': 'P',
464
+ '\uFF30': 'P',
465
+ '\u1E54': 'P',
466
+ '\u1E56': 'P',
467
+ '\u01A4': 'P',
468
+ '\u2C63': 'P',
469
+ '\uA750': 'P',
470
+ '\uA752': 'P',
471
+ '\uA754': 'P',
472
+ '\u24C6': 'Q',
473
+ '\uFF31': 'Q',
474
+ '\uA756': 'Q',
475
+ '\uA758': 'Q',
476
+ '\u024A': 'Q',
477
+ '\u24C7': 'R',
478
+ '\uFF32': 'R',
479
+ '\u0154': 'R',
480
+ '\u1E58': 'R',
481
+ '\u0158': 'R',
482
+ '\u0210': 'R',
483
+ '\u0212': 'R',
484
+ '\u1E5A': 'R',
485
+ '\u1E5C': 'R',
486
+ '\u0156': 'R',
487
+ '\u1E5E': 'R',
488
+ '\u024C': 'R',
489
+ '\u2C64': 'R',
490
+ '\uA75A': 'R',
491
+ '\uA7A6': 'R',
492
+ '\uA782': 'R',
493
+ '\u24C8': 'S',
494
+ '\uFF33': 'S',
495
+ '\u1E9E': 'S',
496
+ '\u015A': 'S',
497
+ '\u1E64': 'S',
498
+ '\u015C': 'S',
499
+ '\u1E60': 'S',
500
+ '\u0160': 'S',
501
+ '\u1E66': 'S',
502
+ '\u1E62': 'S',
503
+ '\u1E68': 'S',
504
+ '\u0218': 'S',
505
+ '\u015E': 'S',
506
+ '\u2C7E': 'S',
507
+ '\uA7A8': 'S',
508
+ '\uA784': 'S',
509
+ '\u24C9': 'T',
510
+ '\uFF34': 'T',
511
+ '\u1E6A': 'T',
512
+ '\u0164': 'T',
513
+ '\u1E6C': 'T',
514
+ '\u021A': 'T',
515
+ '\u0162': 'T',
516
+ '\u1E70': 'T',
517
+ '\u1E6E': 'T',
518
+ '\u0166': 'T',
519
+ '\u01AC': 'T',
520
+ '\u01AE': 'T',
521
+ '\u023E': 'T',
522
+ '\uA786': 'T',
523
+ '\uA728': 'TZ',
524
+ '\u24CA': 'U',
525
+ '\uFF35': 'U',
526
+ '\u00D9': 'U',
527
+ '\u00DA': 'U',
528
+ '\u00DB': 'U',
529
+ '\u0168': 'U',
530
+ '\u1E78': 'U',
531
+ '\u016A': 'U',
532
+ '\u1E7A': 'U',
533
+ '\u016C': 'U',
534
+ '\u00DC': 'U',
535
+ '\u01DB': 'U',
536
+ '\u01D7': 'U',
537
+ '\u01D5': 'U',
538
+ '\u01D9': 'U',
539
+ '\u1EE6': 'U',
540
+ '\u016E': 'U',
541
+ '\u0170': 'U',
542
+ '\u01D3': 'U',
543
+ '\u0214': 'U',
544
+ '\u0216': 'U',
545
+ '\u01AF': 'U',
546
+ '\u1EEA': 'U',
547
+ '\u1EE8': 'U',
548
+ '\u1EEE': 'U',
549
+ '\u1EEC': 'U',
550
+ '\u1EF0': 'U',
551
+ '\u1EE4': 'U',
552
+ '\u1E72': 'U',
553
+ '\u0172': 'U',
554
+ '\u1E76': 'U',
555
+ '\u1E74': 'U',
556
+ '\u0244': 'U',
557
+ '\u24CB': 'V',
558
+ '\uFF36': 'V',
559
+ '\u1E7C': 'V',
560
+ '\u1E7E': 'V',
561
+ '\u01B2': 'V',
562
+ '\uA75E': 'V',
563
+ '\u0245': 'V',
564
+ '\uA760': 'VY',
565
+ '\u24CC': 'W',
566
+ '\uFF37': 'W',
567
+ '\u1E80': 'W',
568
+ '\u1E82': 'W',
569
+ '\u0174': 'W',
570
+ '\u1E86': 'W',
571
+ '\u1E84': 'W',
572
+ '\u1E88': 'W',
573
+ '\u2C72': 'W',
574
+ '\u24CD': 'X',
575
+ '\uFF38': 'X',
576
+ '\u1E8A': 'X',
577
+ '\u1E8C': 'X',
578
+ '\u24CE': 'Y',
579
+ '\uFF39': 'Y',
580
+ '\u1EF2': 'Y',
581
+ '\u00DD': 'Y',
582
+ '\u0176': 'Y',
583
+ '\u1EF8': 'Y',
584
+ '\u0232': 'Y',
585
+ '\u1E8E': 'Y',
586
+ '\u0178': 'Y',
587
+ '\u1EF6': 'Y',
588
+ '\u1EF4': 'Y',
589
+ '\u01B3': 'Y',
590
+ '\u024E': 'Y',
591
+ '\u1EFE': 'Y',
592
+ '\u24CF': 'Z',
593
+ '\uFF3A': 'Z',
594
+ '\u0179': 'Z',
595
+ '\u1E90': 'Z',
596
+ '\u017B': 'Z',
597
+ '\u017D': 'Z',
598
+ '\u1E92': 'Z',
599
+ '\u1E94': 'Z',
600
+ '\u01B5': 'Z',
601
+ '\u0224': 'Z',
602
+ '\u2C7F': 'Z',
603
+ '\u2C6B': 'Z',
604
+ '\uA762': 'Z',
605
+ '\u24D0': 'a',
606
+ '\uFF41': 'a',
607
+ '\u1E9A': 'a',
608
+ '\u00E0': 'a',
609
+ '\u00E1': 'a',
610
+ '\u00E2': 'a',
611
+ '\u1EA7': 'a',
612
+ '\u1EA5': 'a',
613
+ '\u1EAB': 'a',
614
+ '\u1EA9': 'a',
615
+ '\u00E3': 'a',
616
+ '\u0101': 'a',
617
+ '\u0103': 'a',
618
+ '\u1EB1': 'a',
619
+ '\u1EAF': 'a',
620
+ '\u1EB5': 'a',
621
+ '\u1EB3': 'a',
622
+ '\u0227': 'a',
623
+ '\u01E1': 'a',
624
+ '\u00E4': 'a',
625
+ '\u01DF': 'a',
626
+ '\u1EA3': 'a',
627
+ '\u00E5': 'a',
628
+ '\u01FB': 'a',
629
+ '\u01CE': 'a',
630
+ '\u0201': 'a',
631
+ '\u0203': 'a',
632
+ '\u1EA1': 'a',
633
+ '\u1EAD': 'a',
634
+ '\u1EB7': 'a',
635
+ '\u1E01': 'a',
636
+ '\u0105': 'a',
637
+ '\u2C65': 'a',
638
+ '\u0250': 'a',
639
+ '\uA733': 'aa',
640
+ '\u00E6': 'ae',
641
+ '\u01FD': 'ae',
642
+ '\u01E3': 'ae',
643
+ '\uA735': 'ao',
644
+ '\uA737': 'au',
645
+ '\uA739': 'av',
646
+ '\uA73B': 'av',
647
+ '\uA73D': 'ay',
648
+ '\u24D1': 'b',
649
+ '\uFF42': 'b',
650
+ '\u1E03': 'b',
651
+ '\u1E05': 'b',
652
+ '\u1E07': 'b',
653
+ '\u0180': 'b',
654
+ '\u0183': 'b',
655
+ '\u0253': 'b',
656
+ '\u24D2': 'c',
657
+ '\uFF43': 'c',
658
+ '\u0107': 'c',
659
+ '\u0109': 'c',
660
+ '\u010B': 'c',
661
+ '\u010D': 'c',
662
+ '\u00E7': 'c',
663
+ '\u1E09': 'c',
664
+ '\u0188': 'c',
665
+ '\u023C': 'c',
666
+ '\uA73F': 'c',
667
+ '\u2184': 'c',
668
+ '\u24D3': 'd',
669
+ '\uFF44': 'd',
670
+ '\u1E0B': 'd',
671
+ '\u010F': 'd',
672
+ '\u1E0D': 'd',
673
+ '\u1E11': 'd',
674
+ '\u1E13': 'd',
675
+ '\u1E0F': 'd',
676
+ '\u0111': 'd',
677
+ '\u018C': 'd',
678
+ '\u0256': 'd',
679
+ '\u0257': 'd',
680
+ '\uA77A': 'd',
681
+ '\u01F3': 'dz',
682
+ '\u01C6': 'dz',
683
+ '\u24D4': 'e',
684
+ '\uFF45': 'e',
685
+ '\u00E8': 'e',
686
+ '\u00E9': 'e',
687
+ '\u00EA': 'e',
688
+ '\u1EC1': 'e',
689
+ '\u1EBF': 'e',
690
+ '\u1EC5': 'e',
691
+ '\u1EC3': 'e',
692
+ '\u1EBD': 'e',
693
+ '\u0113': 'e',
694
+ '\u1E15': 'e',
695
+ '\u1E17': 'e',
696
+ '\u0115': 'e',
697
+ '\u0117': 'e',
698
+ '\u00EB': 'e',
699
+ '\u1EBB': 'e',
700
+ '\u011B': 'e',
701
+ '\u0205': 'e',
702
+ '\u0207': 'e',
703
+ '\u1EB9': 'e',
704
+ '\u1EC7': 'e',
705
+ '\u0229': 'e',
706
+ '\u1E1D': 'e',
707
+ '\u0119': 'e',
708
+ '\u1E19': 'e',
709
+ '\u1E1B': 'e',
710
+ '\u0247': 'e',
711
+ '\u025B': 'e',
712
+ '\u01DD': 'e',
713
+ '\u24D5': 'f',
714
+ '\uFF46': 'f',
715
+ '\u1E1F': 'f',
716
+ '\u0192': 'f',
717
+ '\uA77C': 'f',
718
+ '\u24D6': 'g',
719
+ '\uFF47': 'g',
720
+ '\u01F5': 'g',
721
+ '\u011D': 'g',
722
+ '\u1E21': 'g',
723
+ '\u011F': 'g',
724
+ '\u0121': 'g',
725
+ '\u01E7': 'g',
726
+ '\u0123': 'g',
727
+ '\u01E5': 'g',
728
+ '\u0260': 'g',
729
+ '\uA7A1': 'g',
730
+ '\u1D79': 'g',
731
+ '\uA77F': 'g',
732
+ '\u24D7': 'h',
733
+ '\uFF48': 'h',
734
+ '\u0125': 'h',
735
+ '\u1E23': 'h',
736
+ '\u1E27': 'h',
737
+ '\u021F': 'h',
738
+ '\u1E25': 'h',
739
+ '\u1E29': 'h',
740
+ '\u1E2B': 'h',
741
+ '\u1E96': 'h',
742
+ '\u0127': 'h',
743
+ '\u2C68': 'h',
744
+ '\u2C76': 'h',
745
+ '\u0265': 'h',
746
+ '\u0195': 'hv',
747
+ '\u24D8': 'i',
748
+ '\uFF49': 'i',
749
+ '\u00EC': 'i',
750
+ '\u00ED': 'i',
751
+ '\u00EE': 'i',
752
+ '\u0129': 'i',
753
+ '\u012B': 'i',
754
+ '\u012D': 'i',
755
+ '\u00EF': 'i',
756
+ '\u1E2F': 'i',
757
+ '\u1EC9': 'i',
758
+ '\u01D0': 'i',
759
+ '\u0209': 'i',
760
+ '\u020B': 'i',
761
+ '\u1ECB': 'i',
762
+ '\u012F': 'i',
763
+ '\u1E2D': 'i',
764
+ '\u0268': 'i',
765
+ '\u0131': 'i',
766
+ '\u24D9': 'j',
767
+ '\uFF4A': 'j',
768
+ '\u0135': 'j',
769
+ '\u01F0': 'j',
770
+ '\u0249': 'j',
771
+ '\u24DA': 'k',
772
+ '\uFF4B': 'k',
773
+ '\u1E31': 'k',
774
+ '\u01E9': 'k',
775
+ '\u1E33': 'k',
776
+ '\u0137': 'k',
777
+ '\u1E35': 'k',
778
+ '\u0199': 'k',
779
+ '\u2C6A': 'k',
780
+ '\uA741': 'k',
781
+ '\uA743': 'k',
782
+ '\uA745': 'k',
783
+ '\uA7A3': 'k',
784
+ '\u24DB': 'l',
785
+ '\uFF4C': 'l',
786
+ '\u0140': 'l',
787
+ '\u013A': 'l',
788
+ '\u013E': 'l',
789
+ '\u1E37': 'l',
790
+ '\u1E39': 'l',
791
+ '\u013C': 'l',
792
+ '\u1E3D': 'l',
793
+ '\u1E3B': 'l',
794
+ '\u017F': 'l',
795
+ '\u0142': 'l',
796
+ '\u019A': 'l',
797
+ '\u026B': 'l',
798
+ '\u2C61': 'l',
799
+ '\uA749': 'l',
800
+ '\uA781': 'l',
801
+ '\uA747': 'l',
802
+ '\u01C9': 'lj',
803
+ '\u24DC': 'm',
804
+ '\uFF4D': 'm',
805
+ '\u1E3F': 'm',
806
+ '\u1E41': 'm',
807
+ '\u1E43': 'm',
808
+ '\u0271': 'm',
809
+ '\u026F': 'm',
810
+ '\u24DD': 'n',
811
+ '\uFF4E': 'n',
812
+ '\u01F9': 'n',
813
+ '\u0144': 'n',
814
+ '\u00F1': 'n',
815
+ '\u1E45': 'n',
816
+ '\u0148': 'n',
817
+ '\u1E47': 'n',
818
+ '\u0146': 'n',
819
+ '\u1E4B': 'n',
820
+ '\u1E49': 'n',
821
+ '\u019E': 'n',
822
+ '\u0272': 'n',
823
+ '\u0149': 'n',
824
+ '\uA791': 'n',
825
+ '\uA7A5': 'n',
826
+ '\u01CC': 'nj',
827
+ '\u24DE': 'o',
828
+ '\uFF4F': 'o',
829
+ '\u00F2': 'o',
830
+ '\u00F3': 'o',
831
+ '\u00F4': 'o',
832
+ '\u1ED3': 'o',
833
+ '\u1ED1': 'o',
834
+ '\u1ED7': 'o',
835
+ '\u1ED5': 'o',
836
+ '\u00F5': 'o',
837
+ '\u1E4D': 'o',
838
+ '\u022D': 'o',
839
+ '\u1E4F': 'o',
840
+ '\u014D': 'o',
841
+ '\u1E51': 'o',
842
+ '\u1E53': 'o',
843
+ '\u014F': 'o',
844
+ '\u022F': 'o',
845
+ '\u0231': 'o',
846
+ '\u00F6': 'o',
847
+ '\u022B': 'o',
848
+ '\u1ECF': 'o',
849
+ '\u0151': 'o',
850
+ '\u01D2': 'o',
851
+ '\u020D': 'o',
852
+ '\u020F': 'o',
853
+ '\u01A1': 'o',
854
+ '\u1EDD': 'o',
855
+ '\u1EDB': 'o',
856
+ '\u1EE1': 'o',
857
+ '\u1EDF': 'o',
858
+ '\u1EE3': 'o',
859
+ '\u1ECD': 'o',
860
+ '\u1ED9': 'o',
861
+ '\u01EB': 'o',
862
+ '\u01ED': 'o',
863
+ '\u00F8': 'o',
864
+ '\u01FF': 'o',
865
+ '\u0254': 'o',
866
+ '\uA74B': 'o',
867
+ '\uA74D': 'o',
868
+ '\u0275': 'o',
869
+ '\u01A3': 'oi',
870
+ '\u0223': 'ou',
871
+ '\uA74F': 'oo',
872
+ '\u24DF': 'p',
873
+ '\uFF50': 'p',
874
+ '\u1E55': 'p',
875
+ '\u1E57': 'p',
876
+ '\u01A5': 'p',
877
+ '\u1D7D': 'p',
878
+ '\uA751': 'p',
879
+ '\uA753': 'p',
880
+ '\uA755': 'p',
881
+ '\u24E0': 'q',
882
+ '\uFF51': 'q',
883
+ '\u024B': 'q',
884
+ '\uA757': 'q',
885
+ '\uA759': 'q',
886
+ '\u24E1': 'r',
887
+ '\uFF52': 'r',
888
+ '\u0155': 'r',
889
+ '\u1E59': 'r',
890
+ '\u0159': 'r',
891
+ '\u0211': 'r',
892
+ '\u0213': 'r',
893
+ '\u1E5B': 'r',
894
+ '\u1E5D': 'r',
895
+ '\u0157': 'r',
896
+ '\u1E5F': 'r',
897
+ '\u024D': 'r',
898
+ '\u027D': 'r',
899
+ '\uA75B': 'r',
900
+ '\uA7A7': 'r',
901
+ '\uA783': 'r',
902
+ '\u24E2': 's',
903
+ '\uFF53': 's',
904
+ '\u00DF': 's',
905
+ '\u015B': 's',
906
+ '\u1E65': 's',
907
+ '\u015D': 's',
908
+ '\u1E61': 's',
909
+ '\u0161': 's',
910
+ '\u1E67': 's',
911
+ '\u1E63': 's',
912
+ '\u1E69': 's',
913
+ '\u0219': 's',
914
+ '\u015F': 's',
915
+ '\u023F': 's',
916
+ '\uA7A9': 's',
917
+ '\uA785': 's',
918
+ '\u1E9B': 's',
919
+ '\u24E3': 't',
920
+ '\uFF54': 't',
921
+ '\u1E6B': 't',
922
+ '\u1E97': 't',
923
+ '\u0165': 't',
924
+ '\u1E6D': 't',
925
+ '\u021B': 't',
926
+ '\u0163': 't',
927
+ '\u1E71': 't',
928
+ '\u1E6F': 't',
929
+ '\u0167': 't',
930
+ '\u01AD': 't',
931
+ '\u0288': 't',
932
+ '\u2C66': 't',
933
+ '\uA787': 't',
934
+ '\uA729': 'tz',
935
+ '\u24E4': 'u',
936
+ '\uFF55': 'u',
937
+ '\u00F9': 'u',
938
+ '\u00FA': 'u',
939
+ '\u00FB': 'u',
940
+ '\u0169': 'u',
941
+ '\u1E79': 'u',
942
+ '\u016B': 'u',
943
+ '\u1E7B': 'u',
944
+ '\u016D': 'u',
945
+ '\u00FC': 'u',
946
+ '\u01DC': 'u',
947
+ '\u01D8': 'u',
948
+ '\u01D6': 'u',
949
+ '\u01DA': 'u',
950
+ '\u1EE7': 'u',
951
+ '\u016F': 'u',
952
+ '\u0171': 'u',
953
+ '\u01D4': 'u',
954
+ '\u0215': 'u',
955
+ '\u0217': 'u',
956
+ '\u01B0': 'u',
957
+ '\u1EEB': 'u',
958
+ '\u1EE9': 'u',
959
+ '\u1EEF': 'u',
960
+ '\u1EED': 'u',
961
+ '\u1EF1': 'u',
962
+ '\u1EE5': 'u',
963
+ '\u1E73': 'u',
964
+ '\u0173': 'u',
965
+ '\u1E77': 'u',
966
+ '\u1E75': 'u',
967
+ '\u0289': 'u',
968
+ '\u24E5': 'v',
969
+ '\uFF56': 'v',
970
+ '\u1E7D': 'v',
971
+ '\u1E7F': 'v',
972
+ '\u028B': 'v',
973
+ '\uA75F': 'v',
974
+ '\u028C': 'v',
975
+ '\uA761': 'vy',
976
+ '\u24E6': 'w',
977
+ '\uFF57': 'w',
978
+ '\u1E81': 'w',
979
+ '\u1E83': 'w',
980
+ '\u0175': 'w',
981
+ '\u1E87': 'w',
982
+ '\u1E85': 'w',
983
+ '\u1E98': 'w',
984
+ '\u1E89': 'w',
985
+ '\u2C73': 'w',
986
+ '\u24E7': 'x',
987
+ '\uFF58': 'x',
988
+ '\u1E8B': 'x',
989
+ '\u1E8D': 'x',
990
+ '\u24E8': 'y',
991
+ '\uFF59': 'y',
992
+ '\u1EF3': 'y',
993
+ '\u00FD': 'y',
994
+ '\u0177': 'y',
995
+ '\u1EF9': 'y',
996
+ '\u0233': 'y',
997
+ '\u1E8F': 'y',
998
+ '\u00FF': 'y',
999
+ '\u1EF7': 'y',
1000
+ '\u1E99': 'y',
1001
+ '\u1EF5': 'y',
1002
+ '\u01B4': 'y',
1003
+ '\u024F': 'y',
1004
+ '\u1EFF': 'y',
1005
+ '\u24E9': 'z',
1006
+ '\uFF5A': 'z',
1007
+ '\u017A': 'z',
1008
+ '\u1E91': 'z',
1009
+ '\u017C': 'z',
1010
+ '\u017E': 'z',
1011
+ '\u1E93': 'z',
1012
+ '\u1E95': 'z',
1013
+ '\u01B6': 'z',
1014
+ '\u0225': 'z',
1015
+ '\u0240': 'z',
1016
+ '\u2C6C': 'z',
1017
+ '\uA763': 'z',
1018
+ '\u0386': '\u0391',
1019
+ '\u0388': '\u0395',
1020
+ '\u0389': '\u0397',
1021
+ '\u038A': '\u0399',
1022
+ '\u03AA': '\u0399',
1023
+ '\u038C': '\u039F',
1024
+ '\u038E': '\u03A5',
1025
+ '\u03AB': '\u03A5',
1026
+ '\u038F': '\u03A9',
1027
+ '\u03AC': '\u03B1',
1028
+ '\u03AD': '\u03B5',
1029
+ '\u03AE': '\u03B7',
1030
+ '\u03AF': '\u03B9',
1031
+ '\u03CA': '\u03B9',
1032
+ '\u0390': '\u03B9',
1033
+ '\u03CC': '\u03BF',
1034
+ '\u03CD': '\u03C5',
1035
+ '\u03CB': '\u03C5',
1036
+ '\u03B0': '\u03C5',
1037
+ '\u03C9': '\u03C9',
1038
+ '\u03C2': '\u03C3'
1039
+ };
1040
+ function stripSpecialChars(text) {
1041
+ const match = (a) => diacritics[a] || a;
1042
+ return text.replace(/[^\u0000-\u007E]/g, match);
1043
+ }
1044
+
1045
+ class ItemsList {
1046
+ constructor(_ngSelect, _selectionModel) {
1047
+ this._ngSelect = _ngSelect;
1048
+ this._selectionModel = _selectionModel;
1049
+ this._items = [];
1050
+ this._filteredItems = [];
1051
+ this._markedIndex = -1;
1052
+ }
1053
+ get items() {
1054
+ return this._items;
1055
+ }
1056
+ get filteredItems() {
1057
+ return this._filteredItems;
1058
+ }
1059
+ get markedIndex() {
1060
+ return this._markedIndex;
1061
+ }
1062
+ get selectedItems() {
1063
+ return this._selectionModel.value;
1064
+ }
1065
+ get markedItem() {
1066
+ return this._filteredItems[this._markedIndex];
1067
+ }
1068
+ get noItemsToSelect() {
1069
+ return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1070
+ }
1071
+ get maxItemsSelected() {
1072
+ return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1073
+ }
1074
+ get lastSelectedItem() {
1075
+ let i = this.selectedItems.length - 1;
1076
+ for (; i >= 0; i--) {
1077
+ const item = this.selectedItems[i];
1078
+ if (!item.disabled) {
1079
+ return item;
1080
+ }
1081
+ }
1082
+ return null;
1083
+ }
1084
+ setItems(items) {
1085
+ this._items = items.map((item, index) => this.mapItem(item, index));
1086
+ if (this._ngSelect.groupBy) {
1087
+ this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1088
+ this._items = this._flatten(this._groups);
1089
+ }
1090
+ else {
1091
+ this._groups = new Map();
1092
+ this._groups.set(undefined, this._items);
1093
+ }
1094
+ this._filteredItems = [...this._items];
1095
+ }
1096
+ select(item) {
1097
+ if (item.selected || this.maxItemsSelected) {
1098
+ return;
1099
+ }
1100
+ const multiple = this._ngSelect.multiple;
1101
+ if (!multiple) {
1102
+ this.clearSelected();
1103
+ }
1104
+ this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1105
+ if (this._ngSelect.hideSelected) {
1106
+ this._hideSelected(item);
1107
+ }
1108
+ }
1109
+ unselect(item) {
1110
+ if (!item.selected) {
1111
+ return;
1112
+ }
1113
+ this._selectionModel.unselect(item, this._ngSelect.multiple);
1114
+ if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1115
+ this._showSelected(item);
1116
+ }
1117
+ }
1118
+ findItem(value) {
1119
+ let findBy;
1120
+ if (this._ngSelect.compareWith) {
1121
+ findBy = item => this._ngSelect.compareWith(item.value, value);
1122
+ }
1123
+ else if (this._ngSelect.bindValue) {
1124
+ findBy = item => !item.children && this.resolveNested(item.value, this._ngSelect.bindValue) === value;
1125
+ }
1126
+ else {
1127
+ findBy = item => item.value === value ||
1128
+ !item.children && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel);
1129
+ }
1130
+ return this._items.find(item => findBy(item));
1131
+ }
1132
+ addItem(item) {
1133
+ const option = this.mapItem(item, this._items.length);
1134
+ this._items.push(option);
1135
+ this._filteredItems.push(option);
1136
+ return option;
1137
+ }
1138
+ clearSelected(keepDisabled = false) {
1139
+ this._selectionModel.clear(keepDisabled);
1140
+ this._items.forEach(item => {
1141
+ item.selected = keepDisabled && item.selected && item.disabled;
1142
+ item.marked = false;
1143
+ });
1144
+ if (this._ngSelect.hideSelected) {
1145
+ this.resetFilteredItems();
1146
+ }
1147
+ }
1148
+ findByLabel(term) {
1149
+ term = stripSpecialChars(term).toLocaleLowerCase();
1150
+ return this.filteredItems.find(item => {
1151
+ const label = stripSpecialChars(item.label).toLocaleLowerCase();
1152
+ return label.substr(0, term.length) === term;
1153
+ });
1154
+ }
1155
+ filter(term) {
1156
+ if (!term) {
1157
+ this.resetFilteredItems();
1158
+ return;
1159
+ }
1160
+ this._filteredItems = [];
1161
+ term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1162
+ const match = this._ngSelect.searchFn || this._defaultSearchFn;
1163
+ const hideSelected = this._ngSelect.hideSelected;
1164
+ for (const key of Array.from(this._groups.keys())) {
1165
+ const matchedItems = [];
1166
+ for (const item of this._groups.get(key)) {
1167
+ if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
1168
+ continue;
1169
+ }
1170
+ const searchItem = this._ngSelect.searchFn ? item.value : item;
1171
+ if (match(term, searchItem)) {
1172
+ matchedItems.push(item);
1173
+ }
1174
+ }
1175
+ if (matchedItems.length > 0) {
1176
+ const [last] = matchedItems.slice(-1);
1177
+ if (last.parent) {
1178
+ const head = this._items.find(x => x === last.parent);
1179
+ this._filteredItems.push(head);
1180
+ }
1181
+ this._filteredItems.push(...matchedItems);
1182
+ }
1183
+ }
1184
+ }
1185
+ resetFilteredItems() {
1186
+ if (this._filteredItems.length === this._items.length) {
1187
+ return;
1188
+ }
1189
+ if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1190
+ this._filteredItems = this._items.filter(x => !x.selected);
1191
+ }
1192
+ else {
1193
+ this._filteredItems = this._items;
1194
+ }
1195
+ }
1196
+ unmarkItem() {
1197
+ this._markedIndex = -1;
1198
+ }
1199
+ markNextItem() {
1200
+ this._stepToItem(+1);
1201
+ }
1202
+ markPreviousItem() {
1203
+ this._stepToItem(-1);
1204
+ }
1205
+ markItem(item) {
1206
+ this._markedIndex = this._filteredItems.indexOf(item);
1207
+ }
1208
+ markSelectedOrDefault(markDefault) {
1209
+ if (this._filteredItems.length === 0) {
1210
+ return;
1211
+ }
1212
+ const lastMarkedIndex = this._getLastMarkedIndex();
1213
+ if (lastMarkedIndex > -1) {
1214
+ this._markedIndex = lastMarkedIndex;
1215
+ }
1216
+ else {
1217
+ this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;
1218
+ }
1219
+ }
1220
+ resolveNested(option, key) {
1221
+ if (!isObject(option)) {
1222
+ return option;
1223
+ }
1224
+ if (key.indexOf('.') === -1) {
1225
+ return option[key];
1226
+ }
1227
+ else {
1228
+ const keys = key.split('.');
1229
+ let value = option;
1230
+ for (let i = 0, len = keys.length; i < len; ++i) {
1231
+ if (value == null) {
1232
+ return null;
1233
+ }
1234
+ value = value[keys[i]];
1235
+ }
1236
+ return value;
1237
+ }
1238
+ }
1239
+ mapItem(item, index) {
1240
+ const label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
1241
+ const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1242
+ return {
1243
+ index,
1244
+ label: isDefined(label) ? label.toString() : '',
1245
+ value,
1246
+ disabled: item.disabled,
1247
+ htmlId: `${this._ngSelect.dropdownId}-${index}`,
1248
+ };
1249
+ }
1250
+ mapSelectedItems() {
1251
+ const multiple = this._ngSelect.multiple;
1252
+ for (const selected of this.selectedItems) {
1253
+ const value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
1254
+ const item = isDefined(value) ? this.findItem(value) : null;
1255
+ this._selectionModel.unselect(selected, multiple);
1256
+ this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1257
+ }
1258
+ if (this._ngSelect.hideSelected) {
1259
+ this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);
1260
+ }
1261
+ }
1262
+ _showSelected(item) {
1263
+ this._filteredItems.push(item);
1264
+ if (item.parent) {
1265
+ const parent = item.parent;
1266
+ const parentExists = this._filteredItems.find(x => x === parent);
1267
+ if (!parentExists) {
1268
+ this._filteredItems.push(parent);
1269
+ }
1270
+ }
1271
+ else if (item.children) {
1272
+ for (const child of item.children) {
1273
+ child.selected = false;
1274
+ this._filteredItems.push(child);
1275
+ }
1276
+ }
1277
+ this._filteredItems = [...this._filteredItems.sort((a, b) => (a.index - b.index))];
1278
+ }
1279
+ _hideSelected(item) {
1280
+ this._filteredItems = this._filteredItems.filter(x => x !== item);
1281
+ if (item.parent) {
1282
+ const children = item.parent.children;
1283
+ if (children.every(x => x.selected)) {
1284
+ this._filteredItems = this._filteredItems.filter(x => x !== item.parent);
1285
+ }
1286
+ }
1287
+ else if (item.children) {
1288
+ this._filteredItems = this.filteredItems.filter(x => x.parent !== item);
1289
+ }
1290
+ }
1291
+ _defaultSearchFn(search, opt) {
1292
+ const label = stripSpecialChars(opt.label).toLocaleLowerCase();
1293
+ return label.indexOf(search) > -1;
1294
+ }
1295
+ _getNextItemIndex(steps) {
1296
+ if (steps > 0) {
1297
+ return (this._markedIndex >= this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
1298
+ }
1299
+ return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
1300
+ }
1301
+ _stepToItem(steps) {
1302
+ if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {
1303
+ return;
1304
+ }
1305
+ this._markedIndex = this._getNextItemIndex(steps);
1306
+ if (this.markedItem.disabled) {
1307
+ this._stepToItem(steps);
1308
+ }
1309
+ }
1310
+ _getLastMarkedIndex() {
1311
+ if (this._ngSelect.hideSelected) {
1312
+ return -1;
1313
+ }
1314
+ if (this._markedIndex > -1 && this.markedItem === undefined) {
1315
+ return -1;
1316
+ }
1317
+ const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1318
+ if (this.lastSelectedItem && selectedIndex < 0) {
1319
+ return -1;
1320
+ }
1321
+ return Math.max(this.markedIndex, selectedIndex);
1322
+ }
1323
+ _groupBy(items, prop) {
1324
+ const groups = new Map();
1325
+ if (items.length === 0) {
1326
+ return groups;
1327
+ }
1328
+ // Check if items are already grouped by given key.
1329
+ if (Array.isArray(items[0].value[prop])) {
1330
+ for (const item of items) {
1331
+ const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
1332
+ groups.set(item, children);
1333
+ }
1334
+ return groups;
1335
+ }
1336
+ const isFnKey = isFunction(this._ngSelect.groupBy);
1337
+ const keyFn = (item) => {
1338
+ const key = isFnKey ? prop(item.value) : item.value[prop];
1339
+ return isDefined(key) ? key : undefined;
1340
+ };
1341
+ // Group items by key.
1342
+ for (const item of items) {
1343
+ const key = keyFn(item);
1344
+ const group = groups.get(key);
1345
+ if (group) {
1346
+ group.push(item);
1347
+ }
1348
+ else {
1349
+ groups.set(key, [item]);
1350
+ }
1351
+ }
1352
+ return groups;
1353
+ }
1354
+ _flatten(groups) {
1355
+ const isGroupByFn = isFunction(this._ngSelect.groupBy);
1356
+ const items = [];
1357
+ for (const key of Array.from(groups.keys())) {
1358
+ let i = items.length;
1359
+ if (key === undefined) {
1360
+ const withoutGroup = groups.get(undefined) || [];
1361
+ items.push(...withoutGroup.map(x => {
1362
+ x.index = i++;
1363
+ return x;
1364
+ }));
1365
+ continue;
1366
+ }
1367
+ const isObjectKey = isObject(key);
1368
+ const parent = {
1369
+ label: isObjectKey ? '' : String(key),
1370
+ children: undefined,
1371
+ parent: null,
1372
+ index: i++,
1373
+ disabled: !this._ngSelect.selectableGroup,
1374
+ htmlId: newId(),
1375
+ };
1376
+ const groupKey = isGroupByFn ? this._ngSelect.bindLabel : this._ngSelect.groupBy;
1377
+ const groupValue = this._ngSelect.groupValue || (() => {
1378
+ if (isObjectKey) {
1379
+ return key.value;
1380
+ }
1381
+ return { [groupKey]: key };
1382
+ });
1383
+ const children = groups.get(key).map(x => {
1384
+ x.parent = parent;
1385
+ x.children = undefined;
1386
+ x.index = i++;
1387
+ return x;
1388
+ });
1389
+ parent.children = children;
1390
+ parent.value = groupValue(key, children.map(x => x.value));
1391
+ items.push(parent);
1392
+ items.push(...children);
1393
+ }
1394
+ return items;
1395
+ }
1396
+ }
1397
+
1398
+ var KeyCode;
1399
+ (function (KeyCode) {
1400
+ KeyCode[KeyCode["Tab"] = 9] = "Tab";
1401
+ KeyCode[KeyCode["Enter"] = 13] = "Enter";
1402
+ KeyCode[KeyCode["Esc"] = 27] = "Esc";
1403
+ KeyCode[KeyCode["Space"] = 32] = "Space";
1404
+ KeyCode[KeyCode["ArrowUp"] = 38] = "ArrowUp";
1405
+ KeyCode[KeyCode["ArrowDown"] = 40] = "ArrowDown";
1406
+ KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
1407
+ })(KeyCode || (KeyCode = {}));
1408
+
1409
+ class NgDropdownPanelService {
1410
+ constructor() {
1411
+ this._dimensions = {
1412
+ itemHeight: 0,
1413
+ panelHeight: 0,
1414
+ itemsPerViewport: 0
1415
+ };
1416
+ }
1417
+ get dimensions() {
1418
+ return this._dimensions;
1419
+ }
1420
+ calculateItems(scrollPos, itemsLength, buffer) {
1421
+ const d = this._dimensions;
1422
+ const scrollHeight = d.itemHeight * itemsLength;
1423
+ const scrollTop = Math.max(0, scrollPos);
1424
+ const indexByScrollTop = scrollTop / scrollHeight * itemsLength;
1425
+ let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
1426
+ const maxStartEnd = end;
1427
+ const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
1428
+ let start = Math.min(maxStart, Math.floor(indexByScrollTop));
1429
+ let topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
1430
+ topPadding = !isNaN(topPadding) ? topPadding : 0;
1431
+ start = !isNaN(start) ? start : -1;
1432
+ end = !isNaN(end) ? end : -1;
1433
+ start -= buffer;
1434
+ start = Math.max(0, start);
1435
+ end += buffer;
1436
+ end = Math.min(itemsLength, end);
1437
+ return {
1438
+ topPadding,
1439
+ scrollHeight,
1440
+ start,
1441
+ end
1442
+ };
1443
+ }
1444
+ setDimensions(itemHeight, panelHeight) {
1445
+ const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
1446
+ this._dimensions = {
1447
+ itemHeight,
1448
+ panelHeight,
1449
+ itemsPerViewport
1450
+ };
1451
+ }
1452
+ getScrollTo(itemTop, itemHeight, lastScroll) {
1453
+ const { panelHeight } = this.dimensions;
1454
+ const itemBottom = itemTop + itemHeight;
1455
+ const top = lastScroll;
1456
+ const bottom = top + panelHeight;
1457
+ if (panelHeight >= itemBottom && lastScroll === itemTop) {
1458
+ return null;
1459
+ }
1460
+ if (itemBottom > bottom) {
1461
+ return top + itemBottom - bottom;
1462
+ }
1463
+ else if (itemTop <= top) {
1464
+ return itemTop;
1465
+ }
1466
+ return null;
1467
+ }
1468
+ }
1469
+ NgDropdownPanelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgDropdownPanelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1470
+ NgDropdownPanelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgDropdownPanelService });
1471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgDropdownPanelService, decorators: [{
1472
+ type: Injectable
1473
+ }] });
1474
+
1475
+ const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
1476
+ const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
1477
+ class NgDropdownPanelComponent {
1478
+ constructor(_renderer, _zone, _panelService, _elementRef, _document) {
1479
+ this._renderer = _renderer;
1480
+ this._zone = _zone;
1481
+ this._panelService = _panelService;
1482
+ this._document = _document;
1483
+ this.items = [];
1484
+ this.position = 'auto';
1485
+ this.virtualScroll = false;
1486
+ this.filterValue = null;
1487
+ this.update = new EventEmitter();
1488
+ this.scroll = new EventEmitter();
1489
+ this.scrollToEnd = new EventEmitter();
1490
+ this.outsideClick = new EventEmitter();
1491
+ this._destroy$ = new Subject();
1492
+ this._scrollToEndFired = false;
1493
+ this._updateScrollHeight = false;
1494
+ this._lastScrollPosition = 0;
1495
+ this._dropdown = _elementRef.nativeElement;
1496
+ }
1497
+ get currentPosition() {
1498
+ return this._currentPosition;
1499
+ }
1500
+ get itemsLength() {
1501
+ return this._itemsLength;
1502
+ }
1503
+ set itemsLength(value) {
1504
+ if (value !== this._itemsLength) {
1505
+ this._itemsLength = value;
1506
+ this._onItemsLengthChanged();
1507
+ }
1508
+ }
1509
+ get _startOffset() {
1510
+ if (this.markedItem) {
1511
+ const { itemHeight, panelHeight } = this._panelService.dimensions;
1512
+ const offset = this.markedItem.index * itemHeight;
1513
+ return panelHeight > offset ? 0 : offset;
1514
+ }
1515
+ return 0;
1516
+ }
1517
+ ngOnInit() {
1518
+ this._select = this._dropdown.parentElement;
1519
+ this._virtualPadding = this.paddingElementRef.nativeElement;
1520
+ this._scrollablePanel = this.scrollElementRef.nativeElement;
1521
+ this._contentPanel = this.contentElementRef.nativeElement;
1522
+ this._handleScroll();
1523
+ this._handleOutsideClick();
1524
+ this._appendDropdown();
1525
+ this._setupMousedownListener();
1526
+ }
1527
+ ngOnChanges(changes) {
1528
+ if (changes.items) {
1529
+ const change = changes.items;
1530
+ this._onItemsChange(change.currentValue, change.firstChange);
1531
+ }
1532
+ }
1533
+ ngOnDestroy() {
1534
+ this._destroy$.next();
1535
+ this._destroy$.complete();
1536
+ this._destroy$.unsubscribe();
1537
+ if (this.appendTo) {
1538
+ this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
1539
+ }
1540
+ }
1541
+ scrollTo(option, startFromOption = false) {
1542
+ if (!option) {
1543
+ return;
1544
+ }
1545
+ const index = this.items.indexOf(option);
1546
+ if (index < 0 || index >= this.itemsLength) {
1547
+ return;
1548
+ }
1549
+ let scrollTo;
1550
+ if (this.virtualScroll) {
1551
+ const itemHeight = this._panelService.dimensions.itemHeight;
1552
+ scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
1553
+ }
1554
+ else {
1555
+ const item = this._dropdown.querySelector(`#${option.htmlId}`);
1556
+ const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
1557
+ scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
1558
+ }
1559
+ if (isDefined(scrollTo)) {
1560
+ this._scrollablePanel.scrollTop = scrollTo;
1561
+ }
1562
+ }
1563
+ scrollToTag() {
1564
+ const panel = this._scrollablePanel;
1565
+ panel.scrollTop = panel.scrollHeight - panel.clientHeight;
1566
+ }
1567
+ adjustPosition() {
1568
+ this._updateYPosition();
1569
+ }
1570
+ _handleDropdownPosition() {
1571
+ this._currentPosition = this._calculateCurrentPosition(this._dropdown);
1572
+ if (CSS_POSITIONS.includes(this._currentPosition)) {
1573
+ this._updateDropdownClass(this._currentPosition);
1574
+ }
1575
+ else {
1576
+ this._updateDropdownClass('bottom');
1577
+ }
1578
+ if (this.appendTo) {
1579
+ this._updateYPosition();
1580
+ }
1581
+ this._dropdown.style.opacity = '1';
1582
+ }
1583
+ _updateDropdownClass(currentPosition) {
1584
+ CSS_POSITIONS.forEach((position) => {
1585
+ const REMOVE_CSS_CLASS = `ng-select-${position}`;
1586
+ this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
1587
+ this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
1588
+ });
1589
+ const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
1590
+ this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
1591
+ this._renderer.addClass(this._select, ADD_CSS_CLASS);
1592
+ }
1593
+ _handleScroll() {
1594
+ this._zone.runOutsideAngular(() => {
1595
+ fromEvent(this.scrollElementRef.nativeElement, 'scroll')
1596
+ .pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
1597
+ .subscribe((e) => {
1598
+ const path = e.path || (e.composedPath && e.composedPath());
1599
+ const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
1600
+ this._onContentScrolled(scrollTop);
1601
+ });
1602
+ });
1603
+ }
1604
+ _handleOutsideClick() {
1605
+ if (!this._document) {
1606
+ return;
1607
+ }
1608
+ this._zone.runOutsideAngular(() => {
1609
+ merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'mousedown', { capture: true })).pipe(takeUntil(this._destroy$))
1610
+ .subscribe($event => this._checkToClose($event));
1611
+ });
1612
+ }
1613
+ _checkToClose($event) {
1614
+ if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
1615
+ return;
1616
+ }
1617
+ const path = $event.path || ($event.composedPath && $event.composedPath());
1618
+ if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
1619
+ return;
1620
+ }
1621
+ this._zone.run(() => this.outsideClick.emit());
1622
+ }
1623
+ _onItemsChange(items, firstChange) {
1624
+ this.items = items || [];
1625
+ this._scrollToEndFired = false;
1626
+ this.itemsLength = items.length;
1627
+ if (this.virtualScroll) {
1628
+ this._updateItemsRange(firstChange);
1629
+ }
1630
+ else {
1631
+ this._setVirtualHeight();
1632
+ this._updateItems(firstChange);
1633
+ }
1634
+ }
1635
+ _updateItems(firstChange) {
1636
+ this.update.emit(this.items);
1637
+ if (firstChange === false) {
1638
+ return;
1639
+ }
1640
+ this._zone.runOutsideAngular(() => {
1641
+ Promise.resolve().then(() => {
1642
+ const panelHeight = this._scrollablePanel.clientHeight;
1643
+ this._panelService.setDimensions(0, panelHeight);
1644
+ this._handleDropdownPosition();
1645
+ this.scrollTo(this.markedItem, firstChange);
1646
+ });
1647
+ });
1648
+ }
1649
+ _updateItemsRange(firstChange) {
1650
+ this._zone.runOutsideAngular(() => {
1651
+ this._measureDimensions().then(() => {
1652
+ if (firstChange) {
1653
+ this._renderItemsRange(this._startOffset);
1654
+ this._handleDropdownPosition();
1655
+ }
1656
+ else {
1657
+ this._renderItemsRange();
1658
+ }
1659
+ });
1660
+ });
1661
+ }
1662
+ _onContentScrolled(scrollTop) {
1663
+ if (this.virtualScroll) {
1664
+ this._renderItemsRange(scrollTop);
1665
+ }
1666
+ this._lastScrollPosition = scrollTop;
1667
+ this._fireScrollToEnd(scrollTop);
1668
+ }
1669
+ _updateVirtualHeight(height) {
1670
+ if (this._updateScrollHeight) {
1671
+ this._virtualPadding.style.height = `${height}px`;
1672
+ this._updateScrollHeight = false;
1673
+ }
1674
+ }
1675
+ _setVirtualHeight() {
1676
+ if (!this._virtualPadding) {
1677
+ return;
1678
+ }
1679
+ this._virtualPadding.style.height = `0px`;
1680
+ }
1681
+ _onItemsLengthChanged() {
1682
+ this._updateScrollHeight = true;
1683
+ }
1684
+ _renderItemsRange(scrollTop = null) {
1685
+ if (scrollTop && this._lastScrollPosition === scrollTop) {
1686
+ return;
1687
+ }
1688
+ scrollTop = scrollTop || this._scrollablePanel.scrollTop;
1689
+ const range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
1690
+ this._updateVirtualHeight(range.scrollHeight);
1691
+ this._contentPanel.style.transform = `translateY(${range.topPadding}px)`;
1692
+ this._zone.run(() => {
1693
+ this.update.emit(this.items.slice(range.start, range.end));
1694
+ this.scroll.emit({ start: range.start, end: range.end });
1695
+ });
1696
+ if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
1697
+ this._scrollablePanel.scrollTop = scrollTop;
1698
+ this._lastScrollPosition = scrollTop;
1699
+ }
1700
+ }
1701
+ _measureDimensions() {
1702
+ if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
1703
+ return Promise.resolve(this._panelService.dimensions);
1704
+ }
1705
+ const [first] = this.items;
1706
+ this.update.emit([first]);
1707
+ return Promise.resolve().then(() => {
1708
+ const option = this._dropdown.querySelector(`#${first.htmlId}`);
1709
+ const optionHeight = option.clientHeight;
1710
+ this._virtualPadding.style.height = `${optionHeight * this.itemsLength}px`;
1711
+ const panelHeight = this._scrollablePanel.clientHeight;
1712
+ this._panelService.setDimensions(optionHeight, panelHeight);
1713
+ return this._panelService.dimensions;
1714
+ });
1715
+ }
1716
+ _fireScrollToEnd(scrollTop) {
1717
+ if (this._scrollToEndFired || scrollTop === 0) {
1718
+ return;
1719
+ }
1720
+ const padding = this.virtualScroll ?
1721
+ this._virtualPadding :
1722
+ this._contentPanel;
1723
+ if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
1724
+ this._zone.run(() => this.scrollToEnd.emit());
1725
+ this._scrollToEndFired = true;
1726
+ }
1727
+ }
1728
+ _calculateCurrentPosition(dropdownEl) {
1729
+ if (this.position !== 'auto') {
1730
+ return this.position;
1731
+ }
1732
+ const selectRect = this._select.getBoundingClientRect();
1733
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
1734
+ const offsetTop = selectRect.top + window.pageYOffset;
1735
+ const height = selectRect.height;
1736
+ const dropdownHeight = dropdownEl.getBoundingClientRect().height;
1737
+ if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
1738
+ return 'top';
1739
+ }
1740
+ else {
1741
+ return 'bottom';
1742
+ }
1743
+ }
1744
+ _appendDropdown() {
1745
+ if (!this.appendTo) {
1746
+ return;
1747
+ }
1748
+ this._parent = document.querySelector(this.appendTo);
1749
+ if (!this._parent) {
1750
+ throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);
1751
+ }
1752
+ this._updateXPosition();
1753
+ this._parent.appendChild(this._dropdown);
1754
+ }
1755
+ _updateXPosition() {
1756
+ const select = this._select.getBoundingClientRect();
1757
+ const parent = this._parent.getBoundingClientRect();
1758
+ const offsetLeft = select.left - parent.left;
1759
+ this._dropdown.style.left = offsetLeft + 'px';
1760
+ this._dropdown.style.width = select.width + 'px';
1761
+ this._dropdown.style.minWidth = select.width + 'px';
1762
+ }
1763
+ _updateYPosition() {
1764
+ const select = this._select.getBoundingClientRect();
1765
+ const parent = this._parent.getBoundingClientRect();
1766
+ const delta = select.height;
1767
+ if (this._currentPosition === 'top') {
1768
+ const offsetBottom = parent.bottom - select.bottom;
1769
+ this._dropdown.style.bottom = offsetBottom + delta + 'px';
1770
+ this._dropdown.style.top = 'auto';
1771
+ }
1772
+ else if (this._currentPosition === 'bottom') {
1773
+ const offsetTop = select.top - parent.top;
1774
+ this._dropdown.style.top = offsetTop + delta + 'px';
1775
+ this._dropdown.style.bottom = 'auto';
1776
+ }
1777
+ }
1778
+ _setupMousedownListener() {
1779
+ this._zone.runOutsideAngular(() => {
1780
+ fromEvent(this._dropdown, 'mousedown')
1781
+ .pipe(takeUntil(this._destroy$))
1782
+ .subscribe((event) => {
1783
+ const target = event.target;
1784
+ if (target.tagName === 'INPUT') {
1785
+ return;
1786
+ }
1787
+ event.preventDefault();
1788
+ });
1789
+ });
1790
+ }
1791
+ }
1792
+ NgDropdownPanelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgDropdownPanelComponent, deps: [{ token: i0.Renderer2 }, { token: i0.NgZone }, { token: NgDropdownPanelService }, { token: i0.ElementRef }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1793
+ NgDropdownPanelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: NgDropdownPanelComponent, selector: "ng-dropdown-panel", inputs: { items: "items", markedItem: "markedItem", position: "position", appendTo: "appendTo", bufferAmount: "bufferAmount", virtualScroll: "virtualScroll", headerTemplate: "headerTemplate", footerTemplate: "footerTemplate", filterValue: "filterValue" }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }, { propertyName: "scrollElementRef", first: true, predicate: ["scroll"], descendants: true, read: ElementRef, static: true }, { propertyName: "paddingElementRef", first: true, predicate: ["padding"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
1794
+ <div *ngIf="headerTemplate" class="ng-dropdown-header">
1795
+ <ng-container [ngTemplateOutlet]="headerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1796
+ </div>
1797
+ <div #scroll class="ng-dropdown-panel-items scroll-host">
1798
+ <div #padding [class.total-padding]="virtualScroll"></div>
1799
+ <div #content [class.scrollable-content]="virtualScroll && items.length">
1800
+ <ng-content></ng-content>
1801
+ </div>
1802
+ </div>
1803
+ <div *ngIf="footerTemplate" class="ng-dropdown-footer">
1804
+ <ng-container [ngTemplateOutlet]="footerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1805
+ </div>
1806
+ `, isInline: true, directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgDropdownPanelComponent, decorators: [{
1808
+ type: Component,
1809
+ args: [{
1810
+ changeDetection: ChangeDetectionStrategy.OnPush,
1811
+ encapsulation: ViewEncapsulation.None,
1812
+ selector: 'ng-dropdown-panel',
1813
+ template: `
1814
+ <div *ngIf="headerTemplate" class="ng-dropdown-header">
1815
+ <ng-container [ngTemplateOutlet]="headerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1816
+ </div>
1817
+ <div #scroll class="ng-dropdown-panel-items scroll-host">
1818
+ <div #padding [class.total-padding]="virtualScroll"></div>
1819
+ <div #content [class.scrollable-content]="virtualScroll && items.length">
1820
+ <ng-content></ng-content>
1821
+ </div>
1822
+ </div>
1823
+ <div *ngIf="footerTemplate" class="ng-dropdown-footer">
1824
+ <ng-container [ngTemplateOutlet]="footerTemplate" [ngTemplateOutletContext]="{ searchTerm: filterValue }"></ng-container>
1825
+ </div>
1826
+ `
1827
+ }]
1828
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.NgZone }, { type: NgDropdownPanelService }, { type: i0.ElementRef }, { type: undefined, decorators: [{
1829
+ type: Optional
1830
+ }, {
1831
+ type: Inject,
1832
+ args: [DOCUMENT]
1833
+ }] }]; }, propDecorators: { items: [{
1834
+ type: Input
1835
+ }], markedItem: [{
1836
+ type: Input
1837
+ }], position: [{
1838
+ type: Input
1839
+ }], appendTo: [{
1840
+ type: Input
1841
+ }], bufferAmount: [{
1842
+ type: Input
1843
+ }], virtualScroll: [{
1844
+ type: Input
1845
+ }], headerTemplate: [{
1846
+ type: Input
1847
+ }], footerTemplate: [{
1848
+ type: Input
1849
+ }], filterValue: [{
1850
+ type: Input
1851
+ }], update: [{
1852
+ type: Output
1853
+ }], scroll: [{
1854
+ type: Output
1855
+ }], scrollToEnd: [{
1856
+ type: Output
1857
+ }], outsideClick: [{
1858
+ type: Output
1859
+ }], contentElementRef: [{
1860
+ type: ViewChild,
1861
+ args: ['content', { read: ElementRef, static: true }]
1862
+ }], scrollElementRef: [{
1863
+ type: ViewChild,
1864
+ args: ['scroll', { read: ElementRef, static: true }]
1865
+ }], paddingElementRef: [{
1866
+ type: ViewChild,
1867
+ args: ['padding', { read: ElementRef, static: true }]
1868
+ }] } });
1869
+
1870
+ class NgOptionComponent {
1871
+ constructor(elementRef) {
1872
+ this.elementRef = elementRef;
1873
+ this.stateChange$ = new Subject();
1874
+ this._disabled = false;
1875
+ }
1876
+ get disabled() { return this._disabled; }
1877
+ set disabled(value) { this._disabled = this._isDisabled(value); }
1878
+ get label() {
1879
+ return (this.elementRef.nativeElement.textContent || '').trim();
1880
+ }
1881
+ ngOnChanges(changes) {
1882
+ if (changes.disabled) {
1883
+ this.stateChange$.next({
1884
+ value: this.value,
1885
+ disabled: this._disabled
1886
+ });
1887
+ }
1888
+ }
1889
+ ngAfterViewChecked() {
1890
+ if (this.label !== this._previousLabel) {
1891
+ this._previousLabel = this.label;
1892
+ this.stateChange$.next({
1893
+ value: this.value,
1894
+ disabled: this._disabled,
1895
+ label: this.elementRef.nativeElement.innerHTML
1896
+ });
1897
+ }
1898
+ }
1899
+ ngOnDestroy() {
1900
+ this.stateChange$.complete();
1901
+ }
1902
+ _isDisabled(value) {
1903
+ return value != null && `${value}` !== 'false';
1904
+ }
1905
+ }
1906
+ NgOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptionComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1907
+ NgOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: NgOptionComponent, selector: "ng-option", inputs: { value: "value", disabled: "disabled" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1908
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgOptionComponent, decorators: [{
1909
+ type: Component,
1910
+ args: [{
1911
+ selector: 'ng-option',
1912
+ changeDetection: ChangeDetectionStrategy.OnPush,
1913
+ template: `<ng-content></ng-content>`
1914
+ }]
1915
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { value: [{
1916
+ type: Input
1917
+ }], disabled: [{
1918
+ type: Input
1919
+ }] } });
1920
+
1921
+ class NgSelectConfig {
1922
+ constructor() {
1923
+ this.notFoundText = 'No items found';
1924
+ this.typeToSearchText = 'Type to search';
1925
+ this.addTagText = 'Add item';
1926
+ this.loadingText = 'Loading...';
1927
+ this.clearAllText = 'Clear all';
1928
+ this.disableVirtualScroll = true;
1929
+ this.openOnEnter = true;
1930
+ this.appearance = 'underline';
1931
+ }
1932
+ }
1933
+ NgSelectConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1934
+ NgSelectConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectConfig, providedIn: 'root' });
1935
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectConfig, decorators: [{
1936
+ type: Injectable,
1937
+ args: [{ providedIn: 'root' }]
1938
+ }] });
1939
+
1940
+ class ConsoleService {
1941
+ warn(message) {
1942
+ console.warn(message);
1943
+ }
1944
+ }
1945
+ ConsoleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ConsoleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1946
+ ConsoleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ConsoleService, providedIn: 'root' });
1947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ConsoleService, decorators: [{
1948
+ type: Injectable,
1949
+ args: [{ providedIn: 'root' }]
1950
+ }] });
1951
+
1952
+ const SELECTION_MODEL_FACTORY = new InjectionToken('ng-select-selection-model');
1953
+ class NgSelectComponent {
1954
+ constructor(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
1955
+ this.classes = classes;
1956
+ this.autoFocus = autoFocus;
1957
+ this.config = config;
1958
+ this._cd = _cd;
1959
+ this._console = _console;
1960
+ this.markFirst = true;
1961
+ this.dropdownPosition = 'auto';
1962
+ this.loading = false;
1963
+ this.closeOnSelect = true;
1964
+ this.hideSelected = false;
1965
+ this.selectOnTab = false;
1966
+ this.bufferAmount = 4;
1967
+ this.selectableGroup = false;
1968
+ this.selectableGroupAsModel = true;
1969
+ this.searchFn = null;
1970
+ this.trackByFn = null;
1971
+ this.clearOnBackspace = true;
1972
+ this.labelForId = null;
1973
+ this.inputAttrs = {};
1974
+ this.readonly = false;
1975
+ this.searchWhileComposing = true;
1976
+ this.minTermLength = 0;
1977
+ this.editableSearchTerm = false;
1978
+ this.keyDownFn = (_) => true;
1979
+ this.multiple = false;
1980
+ this.addTag = false;
1981
+ this.searchable = true;
1982
+ this.clearable = true;
1983
+ this.isOpen = false;
1984
+ // output events
1985
+ this.blurEvent = new EventEmitter();
1986
+ this.focusEvent = new EventEmitter();
1987
+ this.changeEvent = new EventEmitter();
1988
+ this.openEvent = new EventEmitter();
1989
+ this.closeEvent = new EventEmitter();
1990
+ this.searchEvent = new EventEmitter();
1991
+ this.clearEvent = new EventEmitter();
1992
+ this.addEvent = new EventEmitter();
1993
+ this.removeEvent = new EventEmitter();
1994
+ this.scroll = new EventEmitter();
1995
+ this.scrollToEnd = new EventEmitter();
1996
+ this.useDefaultClass = true;
1997
+ this.viewPortItems = [];
1998
+ this.searchTerm = null;
1999
+ this.dropdownId = newId();
2000
+ this.escapeHTML = true;
2001
+ this._items = [];
2002
+ this._defaultLabel = 'label';
2003
+ this._pressedKeys = [];
2004
+ this._isComposing = false;
2005
+ this._destroy$ = new Subject();
2006
+ this._keyPress$ = new Subject();
2007
+ this._onChange = (_) => { };
2008
+ this._onTouched = () => { };
2009
+ this.clearItem = (item) => {
2010
+ const option = this.selectedItems.find(x => x.value === item);
2011
+ this.unselect(option);
2012
+ };
2013
+ this.trackByOption = (_, item) => {
2014
+ if (this.trackByFn) {
2015
+ return this.trackByFn(item.value);
2016
+ }
2017
+ return item;
2018
+ };
2019
+ this._mergeGlobalConfig(config);
2020
+ this.itemsList = new ItemsList(this, newSelectionModel());
2021
+ this.element = _elementRef.nativeElement;
2022
+ }
2023
+ get items() { return this._items; }
2024
+ ;
2025
+ set items(value) {
2026
+ if (value === null) {
2027
+ value = [];
2028
+ }
2029
+ this._itemsAreUsed = true;
2030
+ this._items = value;
2031
+ }
2032
+ ;
2033
+ get compareWith() { return this._compareWith; }
2034
+ set compareWith(fn) {
2035
+ if (fn !== undefined && fn !== null && !isFunction(fn)) {
2036
+ throw Error('`compareWith` must be a function.');
2037
+ }
2038
+ this._compareWith = fn;
2039
+ }
2040
+ get clearSearchOnAdd() {
2041
+ if (isDefined(this._clearSearchOnAdd)) {
2042
+ return this._clearSearchOnAdd;
2043
+ }
2044
+ else if (isDefined(this.config.clearSearchOnAdd)) {
2045
+ return this.config.clearSearchOnAdd;
2046
+ }
2047
+ return this.closeOnSelect;
2048
+ }
2049
+ ;
2050
+ set clearSearchOnAdd(value) {
2051
+ this._clearSearchOnAdd = value;
2052
+ }
2053
+ ;
2054
+ get disabled() { return this.readonly || this._disabled; }
2055
+ ;
2056
+ get filtered() { return (!!this.searchTerm && this.searchable || this._isComposing); }
2057
+ ;
2058
+ get single() { return !this.multiple; }
2059
+ ;
2060
+ get _editableSearchTerm() {
2061
+ return this.editableSearchTerm && !this.multiple;
2062
+ }
2063
+ get selectedItems() {
2064
+ return this.itemsList.selectedItems;
2065
+ }
2066
+ get selectedValues() {
2067
+ return this.selectedItems.map(x => x.value);
2068
+ }
2069
+ get hasValue() {
2070
+ return this.selectedItems.length > 0;
2071
+ }
2072
+ get currentPanelPosition() {
2073
+ if (this.dropdownPanel) {
2074
+ return this.dropdownPanel.currentPosition;
2075
+ }
2076
+ return undefined;
2077
+ }
2078
+ ngOnInit() {
2079
+ this._handleKeyPresses();
2080
+ this._setInputAttributes();
2081
+ }
2082
+ ngOnChanges(changes) {
2083
+ if (changes.multiple) {
2084
+ this.itemsList.clearSelected();
2085
+ }
2086
+ if (changes.items) {
2087
+ this._setItems(changes.items.currentValue || []);
2088
+ }
2089
+ if (changes.isOpen) {
2090
+ this._manualOpen = isDefined(changes.isOpen.currentValue);
2091
+ }
2092
+ }
2093
+ ngAfterViewInit() {
2094
+ if (!this._itemsAreUsed) {
2095
+ this.escapeHTML = false;
2096
+ this._setItemsFromNgOptions();
2097
+ }
2098
+ if (isDefined(this.autoFocus)) {
2099
+ this.focus();
2100
+ }
2101
+ }
2102
+ ngOnDestroy() {
2103
+ this._destroy$.next();
2104
+ this._destroy$.complete();
2105
+ }
2106
+ handleKeyDown($event) {
2107
+ const keyCode = KeyCode[$event.which];
2108
+ if (keyCode) {
2109
+ if (this.keyDownFn($event) === false) {
2110
+ return;
2111
+ }
2112
+ this.handleKeyCode($event);
2113
+ }
2114
+ else if ($event.key && $event.key.length === 1) {
2115
+ this._keyPress$.next($event.key.toLocaleLowerCase());
2116
+ }
2117
+ }
2118
+ handleKeyCode($event) {
2119
+ switch ($event.which) {
2120
+ case KeyCode.ArrowDown:
2121
+ this._handleArrowDown($event);
2122
+ break;
2123
+ case KeyCode.ArrowUp:
2124
+ this._handleArrowUp($event);
2125
+ break;
2126
+ case KeyCode.Space:
2127
+ this._handleSpace($event);
2128
+ break;
2129
+ case KeyCode.Enter:
2130
+ this._handleEnter($event);
2131
+ break;
2132
+ case KeyCode.Tab:
2133
+ this._handleTab($event);
2134
+ break;
2135
+ case KeyCode.Esc:
2136
+ this.close();
2137
+ $event.preventDefault();
2138
+ break;
2139
+ case KeyCode.Backspace:
2140
+ this._handleBackspace();
2141
+ break;
2142
+ }
2143
+ }
2144
+ handleMousedown($event) {
2145
+ const target = $event.target;
2146
+ if (target.tagName !== 'INPUT') {
2147
+ $event.preventDefault();
2148
+ }
2149
+ if (target.classList.contains('ng-clear-wrapper')) {
2150
+ this.handleClearClick();
2151
+ return;
2152
+ }
2153
+ if (target.classList.contains('ng-arrow-wrapper')) {
2154
+ this.handleArrowClick();
2155
+ return;
2156
+ }
2157
+ if (target.classList.contains('ng-value-icon')) {
2158
+ return;
2159
+ }
2160
+ if (!this.focused) {
2161
+ this.focus();
2162
+ }
2163
+ if (this.searchable) {
2164
+ this.open();
2165
+ }
2166
+ else {
2167
+ this.toggle();
2168
+ }
2169
+ }
2170
+ handleArrowClick() {
2171
+ if (this.isOpen) {
2172
+ this.close();
2173
+ }
2174
+ else {
2175
+ this.open();
2176
+ }
2177
+ }
2178
+ handleClearClick() {
2179
+ if (this.hasValue) {
2180
+ this.itemsList.clearSelected(true);
2181
+ this._updateNgModel();
2182
+ }
2183
+ this._clearSearch();
2184
+ this.focus();
2185
+ this.clearEvent.emit();
2186
+ this._onSelectionChanged();
2187
+ }
2188
+ clearModel() {
2189
+ if (!this.clearable) {
2190
+ return;
2191
+ }
2192
+ this.itemsList.clearSelected();
2193
+ this._updateNgModel();
2194
+ }
2195
+ writeValue(value) {
2196
+ this.itemsList.clearSelected();
2197
+ this._handleWriteValue(value);
2198
+ this._cd.markForCheck();
2199
+ }
2200
+ registerOnChange(fn) {
2201
+ this._onChange = fn;
2202
+ }
2203
+ registerOnTouched(fn) {
2204
+ this._onTouched = fn;
2205
+ }
2206
+ setDisabledState(state) {
2207
+ this._disabled = state;
2208
+ this._cd.markForCheck();
2209
+ }
2210
+ toggle() {
2211
+ if (!this.isOpen) {
2212
+ this.open();
2213
+ }
2214
+ else {
2215
+ this.close();
2216
+ }
2217
+ }
2218
+ open() {
2219
+ if (this.disabled || this.isOpen || this.itemsList.maxItemsSelected || this._manualOpen) {
2220
+ return;
2221
+ }
2222
+ if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {
2223
+ return;
2224
+ }
2225
+ this.isOpen = true;
2226
+ this.itemsList.markSelectedOrDefault(this.markFirst);
2227
+ this.openEvent.emit();
2228
+ if (!this.searchTerm) {
2229
+ this.focus();
2230
+ }
2231
+ this.detectChanges();
2232
+ }
2233
+ close() {
2234
+ if (!this.isOpen || this._manualOpen) {
2235
+ return;
2236
+ }
2237
+ this.isOpen = false;
2238
+ this._isComposing = false;
2239
+ if (!this._editableSearchTerm) {
2240
+ this._clearSearch();
2241
+ }
2242
+ else {
2243
+ this.itemsList.resetFilteredItems();
2244
+ }
2245
+ this.itemsList.unmarkItem();
2246
+ this._onTouched();
2247
+ this.closeEvent.emit();
2248
+ this._cd.markForCheck();
2249
+ }
2250
+ toggleItem(item) {
2251
+ if (!item || item.disabled || this.disabled) {
2252
+ return;
2253
+ }
2254
+ if (this.multiple && item.selected) {
2255
+ this.unselect(item);
2256
+ }
2257
+ else {
2258
+ this.select(item);
2259
+ }
2260
+ if (this._editableSearchTerm) {
2261
+ this._setSearchTermFromItems();
2262
+ }
2263
+ this._onSelectionChanged();
2264
+ }
2265
+ select(item) {
2266
+ if (!item.selected) {
2267
+ this.itemsList.select(item);
2268
+ if (this.clearSearchOnAdd && !this._editableSearchTerm) {
2269
+ this._clearSearch();
2270
+ }
2271
+ this._updateNgModel();
2272
+ if (this.multiple) {
2273
+ this.addEvent.emit(item.value);
2274
+ }
2275
+ }
2276
+ if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
2277
+ this.close();
2278
+ }
2279
+ }
2280
+ focus() {
2281
+ this.searchInput.nativeElement.focus();
2282
+ }
2283
+ blur() {
2284
+ this.searchInput.nativeElement.blur();
2285
+ }
2286
+ unselect(item) {
2287
+ if (!item) {
2288
+ return;
2289
+ }
2290
+ this.itemsList.unselect(item);
2291
+ this.focus();
2292
+ this._updateNgModel();
2293
+ this.removeEvent.emit(item);
2294
+ }
2295
+ selectTag() {
2296
+ let tag;
2297
+ if (isFunction(this.addTag)) {
2298
+ tag = this.addTag(this.searchTerm);
2299
+ }
2300
+ else {
2301
+ tag = this._primitive ? this.searchTerm : { [this.bindLabel]: this.searchTerm };
2302
+ }
2303
+ const handleTag = (item) => this._isTypeahead || !this.isOpen ? this.itemsList.mapItem(item, null) : this.itemsList.addItem(item);
2304
+ if (isPromise(tag)) {
2305
+ tag.then(item => this.select(handleTag(item))).catch(() => { });
2306
+ }
2307
+ else if (tag) {
2308
+ this.select(handleTag(tag));
2309
+ }
2310
+ }
2311
+ showClear() {
2312
+ return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
2313
+ }
2314
+ get showAddTag() {
2315
+ if (!this._validTerm) {
2316
+ return false;
2317
+ }
2318
+ const term = this.searchTerm.toLowerCase().trim();
2319
+ return this.addTag &&
2320
+ (!this.itemsList.filteredItems.some(x => x.label.toLowerCase() === term) &&
2321
+ (!this.hideSelected && this.isOpen || !this.selectedItems.some(x => x.label.toLowerCase() === term))) &&
2322
+ !this.loading;
2323
+ }
2324
+ showNoItemsFound() {
2325
+ const empty = this.itemsList.filteredItems.length === 0;
2326
+ return ((empty && !this._isTypeahead && !this.loading) ||
2327
+ (empty && this._isTypeahead && this._validTerm && !this.loading)) &&
2328
+ !this.showAddTag;
2329
+ }
2330
+ showTypeToSearch() {
2331
+ const empty = this.itemsList.filteredItems.length === 0;
2332
+ return empty && this._isTypeahead && !this._validTerm && !this.loading;
2333
+ }
2334
+ onCompositionStart() {
2335
+ this._isComposing = true;
2336
+ }
2337
+ onCompositionEnd(term) {
2338
+ this._isComposing = false;
2339
+ if (this.searchWhileComposing) {
2340
+ return;
2341
+ }
2342
+ this.filter(term);
2343
+ }
2344
+ filter(term) {
2345
+ if (this._isComposing && !this.searchWhileComposing) {
2346
+ return;
2347
+ }
2348
+ this.searchTerm = term;
2349
+ if (this._isTypeahead && (this._validTerm || this.minTermLength === 0)) {
2350
+ this.typeahead.next(term);
2351
+ }
2352
+ if (!this._isTypeahead) {
2353
+ this.itemsList.filter(this.searchTerm);
2354
+ if (this.isOpen) {
2355
+ this.itemsList.markSelectedOrDefault(this.markFirst);
2356
+ }
2357
+ }
2358
+ this.searchEvent.emit({ term, items: this.itemsList.filteredItems.map(x => x.value) });
2359
+ this.open();
2360
+ }
2361
+ onInputFocus($event) {
2362
+ if (this.focused) {
2363
+ return;
2364
+ }
2365
+ if (this._editableSearchTerm) {
2366
+ this._setSearchTermFromItems();
2367
+ }
2368
+ this.element.classList.add('ng-select-focused');
2369
+ this.focusEvent.emit($event);
2370
+ this.focused = true;
2371
+ }
2372
+ onInputBlur($event) {
2373
+ this.element.classList.remove('ng-select-focused');
2374
+ this.blurEvent.emit($event);
2375
+ if (!this.isOpen && !this.disabled) {
2376
+ this._onTouched();
2377
+ }
2378
+ if (this._editableSearchTerm) {
2379
+ this._setSearchTermFromItems();
2380
+ }
2381
+ this.focused = false;
2382
+ }
2383
+ onItemHover(item) {
2384
+ if (item.disabled) {
2385
+ return;
2386
+ }
2387
+ this.itemsList.markItem(item);
2388
+ }
2389
+ detectChanges() {
2390
+ if (!this._cd.destroyed) {
2391
+ this._cd.detectChanges();
2392
+ }
2393
+ }
2394
+ _setSearchTermFromItems() {
2395
+ const selected = this.selectedItems && this.selectedItems[0];
2396
+ this.searchTerm = (selected && selected.label) || null;
2397
+ }
2398
+ _setItems(items) {
2399
+ const firstItem = items[0];
2400
+ this.bindLabel = this.bindLabel || this._defaultLabel;
2401
+ this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
2402
+ this.itemsList.setItems(items);
2403
+ if (items.length > 0 && this.hasValue) {
2404
+ this.itemsList.mapSelectedItems();
2405
+ }
2406
+ if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {
2407
+ this.itemsList.filter(this.searchTerm);
2408
+ }
2409
+ if (this._isTypeahead || this.isOpen) {
2410
+ this.itemsList.markSelectedOrDefault(this.markFirst);
2411
+ }
2412
+ }
2413
+ _setItemsFromNgOptions() {
2414
+ const mapNgOptions = (options) => {
2415
+ this.items = options.map(option => ({
2416
+ $ngOptionValue: option.value,
2417
+ $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
2418
+ disabled: option.disabled
2419
+ }));
2420
+ this.itemsList.setItems(this.items);
2421
+ if (this.hasValue) {
2422
+ this.itemsList.mapSelectedItems();
2423
+ }
2424
+ this.detectChanges();
2425
+ };
2426
+ const handleOptionChange = () => {
2427
+ const changedOrDestroyed = merge(this.ngOptions.changes, this._destroy$);
2428
+ merge(...this.ngOptions.map(option => option.stateChange$))
2429
+ .pipe(takeUntil(changedOrDestroyed))
2430
+ .subscribe(option => {
2431
+ const item = this.itemsList.findItem(option.value);
2432
+ item.disabled = option.disabled;
2433
+ item.label = option.label || item.label;
2434
+ this._cd.detectChanges();
2435
+ });
2436
+ };
2437
+ this.ngOptions.changes
2438
+ .pipe(startWith(this.ngOptions), takeUntil(this._destroy$))
2439
+ .subscribe(options => {
2440
+ this.bindLabel = this._defaultLabel;
2441
+ mapNgOptions(options);
2442
+ handleOptionChange();
2443
+ });
2444
+ }
2445
+ _isValidWriteValue(value) {
2446
+ if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
2447
+ return false;
2448
+ }
2449
+ const validateBinding = (item) => {
2450
+ if (!isDefined(this.compareWith) && isObject(item) && this.bindValue) {
2451
+ this._console.warn(`Setting object(${JSON.stringify(item)}) as your model with bindValue is not allowed unless [compareWith] is used.`);
2452
+ return false;
2453
+ }
2454
+ return true;
2455
+ };
2456
+ if (this.multiple) {
2457
+ if (!Array.isArray(value)) {
2458
+ this._console.warn('Multiple select ngModel should be array.');
2459
+ return false;
2460
+ }
2461
+ return value.every(item => validateBinding(item));
2462
+ }
2463
+ else {
2464
+ return validateBinding(value);
2465
+ }
2466
+ }
2467
+ _handleWriteValue(ngModel) {
2468
+ if (!this._isValidWriteValue(ngModel)) {
2469
+ return;
2470
+ }
2471
+ const select = (val) => {
2472
+ let item = this.itemsList.findItem(val);
2473
+ if (item) {
2474
+ this.itemsList.select(item);
2475
+ }
2476
+ else {
2477
+ const isValObject = isObject(val);
2478
+ const isPrimitive = !isValObject && !this.bindValue;
2479
+ if ((isValObject || isPrimitive)) {
2480
+ this.itemsList.select(this.itemsList.mapItem(val, null));
2481
+ }
2482
+ else if (this.bindValue) {
2483
+ item = {
2484
+ [this.bindLabel]: null,
2485
+ [this.bindValue]: val
2486
+ };
2487
+ this.itemsList.select(this.itemsList.mapItem(item, null));
2488
+ }
2489
+ }
2490
+ };
2491
+ if (this.multiple) {
2492
+ ngModel.forEach(item => select(item));
2493
+ }
2494
+ else {
2495
+ select(ngModel);
2496
+ }
2497
+ }
2498
+ _handleKeyPresses() {
2499
+ if (this.searchable) {
2500
+ return;
2501
+ }
2502
+ this._keyPress$
2503
+ .pipe(takeUntil(this._destroy$), tap(letter => this._pressedKeys.push(letter)), debounceTime(200), filter(() => this._pressedKeys.length > 0), map(() => this._pressedKeys.join('')))
2504
+ .subscribe(term => {
2505
+ const item = this.itemsList.findByLabel(term);
2506
+ if (item) {
2507
+ if (this.isOpen) {
2508
+ this.itemsList.markItem(item);
2509
+ this._scrollToMarked();
2510
+ this._cd.markForCheck();
2511
+ }
2512
+ else {
2513
+ this.select(item);
2514
+ }
2515
+ }
2516
+ this._pressedKeys = [];
2517
+ });
2518
+ }
2519
+ _setInputAttributes() {
2520
+ const input = this.searchInput.nativeElement;
2521
+ const attributes = {
2522
+ type: 'text',
2523
+ autocorrect: 'off',
2524
+ autocapitalize: 'off',
2525
+ autocomplete: this.labelForId ? 'off' : this.dropdownId,
2526
+ ...this.inputAttrs
2527
+ };
2528
+ for (const key of Object.keys(attributes)) {
2529
+ input.setAttribute(key, attributes[key]);
2530
+ }
2531
+ }
2532
+ _updateNgModel() {
2533
+ const model = [];
2534
+ for (const item of this.selectedItems) {
2535
+ if (this.bindValue) {
2536
+ let value = null;
2537
+ if (item.children) {
2538
+ const groupKey = this.groupValue ? this.bindValue : this.groupBy;
2539
+ value = item.value[groupKey || this.groupBy];
2540
+ }
2541
+ else {
2542
+ value = this.itemsList.resolveNested(item.value, this.bindValue);
2543
+ }
2544
+ model.push(value);
2545
+ }
2546
+ else {
2547
+ model.push(item.value);
2548
+ }
2549
+ }
2550
+ const selected = this.selectedItems.map(x => x.value);
2551
+ if (this.multiple) {
2552
+ this._onChange(model);
2553
+ this.changeEvent.emit(selected);
2554
+ }
2555
+ else {
2556
+ this._onChange(isDefined(model[0]) ? model[0] : null);
2557
+ this.changeEvent.emit(selected[0]);
2558
+ }
2559
+ this._cd.markForCheck();
2560
+ }
2561
+ _clearSearch() {
2562
+ if (!this.searchTerm) {
2563
+ return;
2564
+ }
2565
+ this._changeSearch(null);
2566
+ this.itemsList.resetFilteredItems();
2567
+ }
2568
+ _changeSearch(searchTerm) {
2569
+ this.searchTerm = searchTerm;
2570
+ if (this._isTypeahead) {
2571
+ this.typeahead.next(searchTerm);
2572
+ }
2573
+ }
2574
+ _scrollToMarked() {
2575
+ if (!this.isOpen || !this.dropdownPanel) {
2576
+ return;
2577
+ }
2578
+ this.dropdownPanel.scrollTo(this.itemsList.markedItem);
2579
+ }
2580
+ _scrollToTag() {
2581
+ if (!this.isOpen || !this.dropdownPanel) {
2582
+ return;
2583
+ }
2584
+ this.dropdownPanel.scrollToTag();
2585
+ }
2586
+ _onSelectionChanged() {
2587
+ if (this.isOpen && this.multiple && this.appendTo) {
2588
+ // Make sure items are rendered.
2589
+ this._cd.detectChanges();
2590
+ this.dropdownPanel.adjustPosition();
2591
+ }
2592
+ }
2593
+ _handleTab($event) {
2594
+ if (this.isOpen === false && !this.addTag) {
2595
+ return;
2596
+ }
2597
+ if (this.selectOnTab) {
2598
+ if (this.itemsList.markedItem) {
2599
+ this.toggleItem(this.itemsList.markedItem);
2600
+ $event.preventDefault();
2601
+ }
2602
+ else if (this.showAddTag) {
2603
+ this.selectTag();
2604
+ $event.preventDefault();
2605
+ }
2606
+ else {
2607
+ this.close();
2608
+ }
2609
+ }
2610
+ else {
2611
+ this.close();
2612
+ }
2613
+ }
2614
+ _handleEnter($event) {
2615
+ if (this.isOpen || this._manualOpen) {
2616
+ if (this.itemsList.markedItem) {
2617
+ this.toggleItem(this.itemsList.markedItem);
2618
+ }
2619
+ else if (this.showAddTag) {
2620
+ this.selectTag();
2621
+ }
2622
+ }
2623
+ else if (this.openOnEnter) {
2624
+ this.open();
2625
+ }
2626
+ else {
2627
+ return;
2628
+ }
2629
+ $event.preventDefault();
2630
+ }
2631
+ _handleSpace($event) {
2632
+ if (this.isOpen || this._manualOpen) {
2633
+ return;
2634
+ }
2635
+ this.open();
2636
+ $event.preventDefault();
2637
+ }
2638
+ _handleArrowDown($event) {
2639
+ if (this._nextItemIsTag(+1)) {
2640
+ this.itemsList.unmarkItem();
2641
+ this._scrollToTag();
2642
+ }
2643
+ else {
2644
+ this.itemsList.markNextItem();
2645
+ this._scrollToMarked();
2646
+ }
2647
+ this.open();
2648
+ $event.preventDefault();
2649
+ }
2650
+ _handleArrowUp($event) {
2651
+ if (!this.isOpen) {
2652
+ return;
2653
+ }
2654
+ if (this._nextItemIsTag(-1)) {
2655
+ this.itemsList.unmarkItem();
2656
+ this._scrollToTag();
2657
+ }
2658
+ else {
2659
+ this.itemsList.markPreviousItem();
2660
+ this._scrollToMarked();
2661
+ }
2662
+ $event.preventDefault();
2663
+ }
2664
+ _nextItemIsTag(nextStep) {
2665
+ const nextIndex = this.itemsList.markedIndex + nextStep;
2666
+ return this.addTag && this.searchTerm
2667
+ && this.itemsList.markedItem
2668
+ && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
2669
+ }
2670
+ _handleBackspace() {
2671
+ if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
2672
+ return;
2673
+ }
2674
+ if (this.multiple) {
2675
+ this.unselect(this.itemsList.lastSelectedItem);
2676
+ }
2677
+ else {
2678
+ this.clearModel();
2679
+ }
2680
+ }
2681
+ get _isTypeahead() {
2682
+ return this.typeahead && this.typeahead.observers.length > 0;
2683
+ }
2684
+ get _validTerm() {
2685
+ const term = this.searchTerm && this.searchTerm.trim();
2686
+ return term && term.length >= this.minTermLength;
2687
+ }
2688
+ _mergeGlobalConfig(config) {
2689
+ this.placeholder = this.placeholder || config.placeholder;
2690
+ this.notFoundText = this.notFoundText || config.notFoundText;
2691
+ this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;
2692
+ this.addTagText = this.addTagText || config.addTagText;
2693
+ this.loadingText = this.loadingText || config.loadingText;
2694
+ this.clearAllText = this.clearAllText || config.clearAllText;
2695
+ this.virtualScroll = isDefined(this.virtualScroll)
2696
+ ? this.virtualScroll
2697
+ : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
2698
+ this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
2699
+ this.appendTo = this.appendTo || config.appendTo;
2700
+ this.bindValue = this.bindValue || config.bindValue;
2701
+ this.bindLabel = this.bindLabel || config.bindLabel;
2702
+ this.appearance = this.appearance || config.appearance;
2703
+ }
2704
+ }
2705
+ NgSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectComponent, deps: [{ token: 'class', attribute: true }, { token: 'autofocus', attribute: true }, { token: NgSelectConfig }, { token: SELECTION_MODEL_FACTORY }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: ConsoleService }], target: i0.ɵɵFactoryTarget.Component });
2706
+ NgSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: NgSelectComponent, selector: "ng-select", inputs: { bindLabel: "bindLabel", bindValue: "bindValue", markFirst: "markFirst", placeholder: "placeholder", notFoundText: "notFoundText", typeToSearchText: "typeToSearchText", addTagText: "addTagText", loadingText: "loadingText", clearAllText: "clearAllText", appearance: "appearance", dropdownPosition: "dropdownPosition", appendTo: "appendTo", loading: "loading", closeOnSelect: "closeOnSelect", hideSelected: "hideSelected", selectOnTab: "selectOnTab", openOnEnter: "openOnEnter", maxSelectedItems: "maxSelectedItems", groupBy: "groupBy", groupValue: "groupValue", bufferAmount: "bufferAmount", virtualScroll: "virtualScroll", selectableGroup: "selectableGroup", selectableGroupAsModel: "selectableGroupAsModel", searchFn: "searchFn", trackByFn: "trackByFn", clearOnBackspace: "clearOnBackspace", labelForId: "labelForId", inputAttrs: "inputAttrs", tabIndex: "tabIndex", readonly: "readonly", searchWhileComposing: "searchWhileComposing", minTermLength: "minTermLength", editableSearchTerm: "editableSearchTerm", keyDownFn: "keyDownFn", typeahead: "typeahead", multiple: "multiple", addTag: "addTag", searchable: "searchable", clearable: "clearable", isOpen: "isOpen", items: "items", compareWith: "compareWith", clearSearchOnAdd: "clearSearchOnAdd" }, outputs: { blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select-typeahead": "this.typeahead", "class.ng-select-multiple": "this.multiple", "class.ng-select-taggable": "this.addTag", "class.ng-select-searchable": "this.searchable", "class.ng-select-clearable": "this.clearable", "class.ng-select-opened": "this.isOpen", "class.ng-select": "this.useDefaultClass", "class.ng-select-disabled": "this.disabled", "class.ng-select-filtered": "this.filtered", "class.ng-select-single": "this.single" } }, providers: [{
2707
+ provide: NG_VALUE_ACCESSOR,
2708
+ useExisting: forwardRef(() => NgSelectComponent),
2709
+ multi: true
2710
+ }, NgDropdownPanelService], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgOptionTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "optgroupTemplate", first: true, predicate: NgOptgroupTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "labelTemplate", first: true, predicate: NgLabelTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "multiLabelTemplate", first: true, predicate: NgMultiLabelTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "headerTemplate", first: true, predicate: NgHeaderTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "footerTemplate", first: true, predicate: NgFooterTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "notFoundTemplate", first: true, predicate: NgNotFoundTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgTypeToSearchTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "loadingTextTemplate", first: true, predicate: NgLoadingTextTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "tagTemplate", first: true, predicate: NgTagTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "loadingSpinnerTemplate", first: true, predicate: NgLoadingSpinnerTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "ngOptions", predicate: NgOptionComponent, descendants: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(function () { return NgDropdownPanelComponent; }), descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"(!multiLabelTemplate || !multiple ) && 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\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></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=\"multiple && multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\"\n role=\"combobox\" \n [attr.aria-expanded]=\"isOpen\" \n [attr.aria-owns]=\"isOpen ? dropdownId : null\" \n aria-haspopup=\"listbox\">\n\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 (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen ? dropdownId : 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 role=\"listbox\"\n aria-label=\"Options list\">\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\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></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", styles: ["@charset \"UTF-8\";.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;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{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;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 transparent;border:0 none;box-shadow:none;outline:none;padding: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;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-placeholder{position:absolute}.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{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-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;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-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 .ng-option-label:empty:before{content:\"\\200b\"}.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}\n"], components: [{ type: NgDropdownPanelComponent, selector: "ng-dropdown-panel", inputs: ["items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "headerTemplate", "footerTemplate", "filterValue"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: NgItemLabelDirective, selector: "[ngItemLabel]", inputs: ["ngItemLabel", "escape"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectComponent, decorators: [{
2712
+ type: Component,
2713
+ args: [{ selector: 'ng-select', providers: [{
2714
+ provide: NG_VALUE_ACCESSOR,
2715
+ useExisting: forwardRef(() => NgSelectComponent),
2716
+ multi: true
2717
+ }, NgDropdownPanelService], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n (mousedown)=\"handleMousedown($event)\"\n [class.ng-appearance-outline]=\"appearance === 'outline'\"\n [class.ng-has-value]=\"hasValue\"\n class=\"ng-select-container\">\n\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"(!multiLabelTemplate || !multiple ) && 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\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></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=\"multiple && multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\"\n role=\"combobox\" \n [attr.aria-expanded]=\"isOpen\" \n [attr.aria-owns]=\"isOpen ? dropdownId : null\" \n aria-haspopup=\"listbox\">\n\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 (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen ? dropdownId : 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 role=\"listbox\"\n aria-label=\"Options list\">\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\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></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", styles: ["@charset \"UTF-8\";.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;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{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;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 transparent;border:0 none;box-shadow:none;outline:none;padding: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;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-placeholder{position:absolute}.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{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-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;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@keyframes load8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-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 .ng-option-label:empty:before{content:\"\\200b\"}.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}\n"] }]
2718
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2719
+ type: Attribute,
2720
+ args: ['class']
2721
+ }] }, { type: undefined, decorators: [{
2722
+ type: Attribute,
2723
+ args: ['autofocus']
2724
+ }] }, { type: NgSelectConfig }, { type: undefined, decorators: [{
2725
+ type: Inject,
2726
+ args: [SELECTION_MODEL_FACTORY]
2727
+ }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: ConsoleService }]; }, propDecorators: { bindLabel: [{
2728
+ type: Input
2729
+ }], bindValue: [{
2730
+ type: Input
2731
+ }], markFirst: [{
2732
+ type: Input
2733
+ }], placeholder: [{
2734
+ type: Input
2735
+ }], notFoundText: [{
2736
+ type: Input
2737
+ }], typeToSearchText: [{
2738
+ type: Input
2739
+ }], addTagText: [{
2740
+ type: Input
2741
+ }], loadingText: [{
2742
+ type: Input
2743
+ }], clearAllText: [{
2744
+ type: Input
2745
+ }], appearance: [{
2746
+ type: Input
2747
+ }], dropdownPosition: [{
2748
+ type: Input
2749
+ }], appendTo: [{
2750
+ type: Input
2751
+ }], loading: [{
2752
+ type: Input
2753
+ }], closeOnSelect: [{
2754
+ type: Input
2755
+ }], hideSelected: [{
2756
+ type: Input
2757
+ }], selectOnTab: [{
2758
+ type: Input
2759
+ }], openOnEnter: [{
2760
+ type: Input
2761
+ }], maxSelectedItems: [{
2762
+ type: Input
2763
+ }], groupBy: [{
2764
+ type: Input
2765
+ }], groupValue: [{
2766
+ type: Input
2767
+ }], bufferAmount: [{
2768
+ type: Input
2769
+ }], virtualScroll: [{
2770
+ type: Input
2771
+ }], selectableGroup: [{
2772
+ type: Input
2773
+ }], selectableGroupAsModel: [{
2774
+ type: Input
2775
+ }], searchFn: [{
2776
+ type: Input
2777
+ }], trackByFn: [{
2778
+ type: Input
2779
+ }], clearOnBackspace: [{
2780
+ type: Input
2781
+ }], labelForId: [{
2782
+ type: Input
2783
+ }], inputAttrs: [{
2784
+ type: Input
2785
+ }], tabIndex: [{
2786
+ type: Input
2787
+ }], readonly: [{
2788
+ type: Input
2789
+ }], searchWhileComposing: [{
2790
+ type: Input
2791
+ }], minTermLength: [{
2792
+ type: Input
2793
+ }], editableSearchTerm: [{
2794
+ type: Input
2795
+ }], keyDownFn: [{
2796
+ type: Input
2797
+ }], typeahead: [{
2798
+ type: Input
2799
+ }, {
2800
+ type: HostBinding,
2801
+ args: ['class.ng-select-typeahead']
2802
+ }], multiple: [{
2803
+ type: Input
2804
+ }, {
2805
+ type: HostBinding,
2806
+ args: ['class.ng-select-multiple']
2807
+ }], addTag: [{
2808
+ type: Input
2809
+ }, {
2810
+ type: HostBinding,
2811
+ args: ['class.ng-select-taggable']
2812
+ }], searchable: [{
2813
+ type: Input
2814
+ }, {
2815
+ type: HostBinding,
2816
+ args: ['class.ng-select-searchable']
2817
+ }], clearable: [{
2818
+ type: Input
2819
+ }, {
2820
+ type: HostBinding,
2821
+ args: ['class.ng-select-clearable']
2822
+ }], isOpen: [{
2823
+ type: Input
2824
+ }, {
2825
+ type: HostBinding,
2826
+ args: ['class.ng-select-opened']
2827
+ }], items: [{
2828
+ type: Input
2829
+ }], compareWith: [{
2830
+ type: Input
2831
+ }], clearSearchOnAdd: [{
2832
+ type: Input
2833
+ }], blurEvent: [{
2834
+ type: Output,
2835
+ args: ['blur']
2836
+ }], focusEvent: [{
2837
+ type: Output,
2838
+ args: ['focus']
2839
+ }], changeEvent: [{
2840
+ type: Output,
2841
+ args: ['change']
2842
+ }], openEvent: [{
2843
+ type: Output,
2844
+ args: ['open']
2845
+ }], closeEvent: [{
2846
+ type: Output,
2847
+ args: ['close']
2848
+ }], searchEvent: [{
2849
+ type: Output,
2850
+ args: ['search']
2851
+ }], clearEvent: [{
2852
+ type: Output,
2853
+ args: ['clear']
2854
+ }], addEvent: [{
2855
+ type: Output,
2856
+ args: ['add']
2857
+ }], removeEvent: [{
2858
+ type: Output,
2859
+ args: ['remove']
2860
+ }], scroll: [{
2861
+ type: Output,
2862
+ args: ['scroll']
2863
+ }], scrollToEnd: [{
2864
+ type: Output,
2865
+ args: ['scrollToEnd']
2866
+ }], optionTemplate: [{
2867
+ type: ContentChild,
2868
+ args: [NgOptionTemplateDirective, { read: TemplateRef }]
2869
+ }], optgroupTemplate: [{
2870
+ type: ContentChild,
2871
+ args: [NgOptgroupTemplateDirective, { read: TemplateRef }]
2872
+ }], labelTemplate: [{
2873
+ type: ContentChild,
2874
+ args: [NgLabelTemplateDirective, { read: TemplateRef }]
2875
+ }], multiLabelTemplate: [{
2876
+ type: ContentChild,
2877
+ args: [NgMultiLabelTemplateDirective, { read: TemplateRef }]
2878
+ }], headerTemplate: [{
2879
+ type: ContentChild,
2880
+ args: [NgHeaderTemplateDirective, { read: TemplateRef }]
2881
+ }], footerTemplate: [{
2882
+ type: ContentChild,
2883
+ args: [NgFooterTemplateDirective, { read: TemplateRef }]
2884
+ }], notFoundTemplate: [{
2885
+ type: ContentChild,
2886
+ args: [NgNotFoundTemplateDirective, { read: TemplateRef }]
2887
+ }], typeToSearchTemplate: [{
2888
+ type: ContentChild,
2889
+ args: [NgTypeToSearchTemplateDirective, { read: TemplateRef }]
2890
+ }], loadingTextTemplate: [{
2891
+ type: ContentChild,
2892
+ args: [NgLoadingTextTemplateDirective, { read: TemplateRef }]
2893
+ }], tagTemplate: [{
2894
+ type: ContentChild,
2895
+ args: [NgTagTemplateDirective, { read: TemplateRef }]
2896
+ }], loadingSpinnerTemplate: [{
2897
+ type: ContentChild,
2898
+ args: [NgLoadingSpinnerTemplateDirective, { read: TemplateRef }]
2899
+ }], dropdownPanel: [{
2900
+ type: ViewChild,
2901
+ args: [forwardRef(() => NgDropdownPanelComponent)]
2902
+ }], searchInput: [{
2903
+ type: ViewChild,
2904
+ args: ['searchInput', { static: true }]
2905
+ }], ngOptions: [{
2906
+ type: ContentChildren,
2907
+ args: [NgOptionComponent, { descendants: true }]
2908
+ }], useDefaultClass: [{
2909
+ type: HostBinding,
2910
+ args: ['class.ng-select']
2911
+ }], disabled: [{
2912
+ type: HostBinding,
2913
+ args: ['class.ng-select-disabled']
2914
+ }], filtered: [{
2915
+ type: HostBinding,
2916
+ args: ['class.ng-select-filtered']
2917
+ }], single: [{
2918
+ type: HostBinding,
2919
+ args: ['class.ng-select-single']
2920
+ }], handleKeyDown: [{
2921
+ type: HostListener,
2922
+ args: ['keydown', ['$event']]
2923
+ }] } });
2924
+
2925
+ function DefaultSelectionModelFactory() {
2926
+ return new DefaultSelectionModel();
2927
+ }
2928
+ class DefaultSelectionModel {
2929
+ constructor() {
2930
+ this._selected = [];
2931
+ }
2932
+ get value() {
2933
+ return this._selected;
2934
+ }
2935
+ select(item, multiple, groupAsModel) {
2936
+ item.selected = true;
2937
+ if (!item.children || (!multiple && groupAsModel)) {
2938
+ this._selected.push(item);
2939
+ }
2940
+ if (multiple) {
2941
+ if (item.parent) {
2942
+ const childrenCount = item.parent.children.length;
2943
+ const selectedCount = item.parent.children.filter(x => x.selected).length;
2944
+ item.parent.selected = childrenCount === selectedCount;
2945
+ }
2946
+ else if (item.children) {
2947
+ this._setChildrenSelectedState(item.children, true);
2948
+ this._removeChildren(item);
2949
+ if (groupAsModel && this._activeChildren(item)) {
2950
+ this._selected = [...this._selected.filter(x => x.parent !== item), item];
2951
+ }
2952
+ else {
2953
+ this._selected = [...this._selected, ...item.children.filter(x => !x.disabled)];
2954
+ }
2955
+ }
2956
+ }
2957
+ }
2958
+ unselect(item, multiple) {
2959
+ this._selected = this._selected.filter(x => x !== item);
2960
+ item.selected = false;
2961
+ if (multiple) {
2962
+ if (item.parent && item.parent.selected) {
2963
+ const children = item.parent.children;
2964
+ this._removeParent(item.parent);
2965
+ this._removeChildren(item.parent);
2966
+ this._selected.push(...children.filter(x => x !== item && !x.disabled));
2967
+ item.parent.selected = false;
2968
+ }
2969
+ else if (item.children) {
2970
+ this._setChildrenSelectedState(item.children, false);
2971
+ this._removeChildren(item);
2972
+ }
2973
+ }
2974
+ }
2975
+ clear(keepDisabled) {
2976
+ this._selected = keepDisabled ? this._selected.filter(x => x.disabled) : [];
2977
+ }
2978
+ _setChildrenSelectedState(children, selected) {
2979
+ for (const child of children) {
2980
+ if (child.disabled) {
2981
+ continue;
2982
+ }
2983
+ child.selected = selected;
2984
+ }
2985
+ }
2986
+ _removeChildren(parent) {
2987
+ this._selected = [
2988
+ ...this._selected.filter(x => x.parent !== parent),
2989
+ ...parent.children.filter(x => x.parent === parent && x.disabled && x.selected)
2990
+ ];
2991
+ }
2992
+ _removeParent(parent) {
2993
+ this._selected = this._selected.filter(x => x !== parent);
2994
+ }
2995
+ _activeChildren(item) {
2996
+ return item.children.every(x => !x.disabled || x.selected);
2997
+ }
2998
+ }
2999
+
3000
+ class NgSelectModule {
3001
+ }
3002
+ NgSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3003
+ NgSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectModule, declarations: [NgDropdownPanelComponent,
3004
+ NgOptionComponent,
3005
+ NgSelectComponent,
3006
+ NgOptgroupTemplateDirective,
3007
+ NgOptionTemplateDirective,
3008
+ NgLabelTemplateDirective,
3009
+ NgMultiLabelTemplateDirective,
3010
+ NgHeaderTemplateDirective,
3011
+ NgFooterTemplateDirective,
3012
+ NgNotFoundTemplateDirective,
3013
+ NgTypeToSearchTemplateDirective,
3014
+ NgLoadingTextTemplateDirective,
3015
+ NgTagTemplateDirective,
3016
+ NgLoadingSpinnerTemplateDirective,
3017
+ NgItemLabelDirective], imports: [CommonModule], exports: [NgSelectComponent,
3018
+ NgOptionComponent,
3019
+ NgOptgroupTemplateDirective,
3020
+ NgOptionTemplateDirective,
3021
+ NgLabelTemplateDirective,
3022
+ NgMultiLabelTemplateDirective,
3023
+ NgHeaderTemplateDirective,
3024
+ NgFooterTemplateDirective,
3025
+ NgNotFoundTemplateDirective,
3026
+ NgTypeToSearchTemplateDirective,
3027
+ NgLoadingTextTemplateDirective,
3028
+ NgTagTemplateDirective,
3029
+ NgLoadingSpinnerTemplateDirective] });
3030
+ NgSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectModule, providers: [
3031
+ { provide: SELECTION_MODEL_FACTORY, useValue: DefaultSelectionModelFactory }
3032
+ ], imports: [[
3033
+ CommonModule
3034
+ ]] });
3035
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgSelectModule, decorators: [{
3036
+ type: NgModule,
3037
+ args: [{
3038
+ declarations: [
3039
+ NgDropdownPanelComponent,
3040
+ NgOptionComponent,
3041
+ NgSelectComponent,
3042
+ NgOptgroupTemplateDirective,
3043
+ NgOptionTemplateDirective,
3044
+ NgLabelTemplateDirective,
3045
+ NgMultiLabelTemplateDirective,
3046
+ NgHeaderTemplateDirective,
3047
+ NgFooterTemplateDirective,
3048
+ NgNotFoundTemplateDirective,
3049
+ NgTypeToSearchTemplateDirective,
3050
+ NgLoadingTextTemplateDirective,
3051
+ NgTagTemplateDirective,
3052
+ NgLoadingSpinnerTemplateDirective,
3053
+ NgItemLabelDirective
3054
+ ],
3055
+ imports: [
3056
+ CommonModule
3057
+ ],
3058
+ exports: [
3059
+ NgSelectComponent,
3060
+ NgOptionComponent,
3061
+ NgOptgroupTemplateDirective,
3062
+ NgOptionTemplateDirective,
3063
+ NgLabelTemplateDirective,
3064
+ NgMultiLabelTemplateDirective,
3065
+ NgHeaderTemplateDirective,
3066
+ NgFooterTemplateDirective,
3067
+ NgNotFoundTemplateDirective,
3068
+ NgTypeToSearchTemplateDirective,
3069
+ NgLoadingTextTemplateDirective,
3070
+ NgTagTemplateDirective,
3071
+ NgLoadingSpinnerTemplateDirective
3072
+ ],
3073
+ providers: [
3074
+ { provide: SELECTION_MODEL_FACTORY, useValue: DefaultSelectionModelFactory }
3075
+ ]
3076
+ }]
3077
+ }] });
3078
+
3079
+ /*
3080
+ * Public API Surface of ng-select
3081
+ */
3082
+
3083
+ /**
3084
+ * Generated bundle index. Do not edit.
3085
+ */
3086
+
3087
+ export { NgFooterTemplateDirective, NgHeaderTemplateDirective, NgItemLabelDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectComponent, NgSelectConfig, NgSelectModule, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, SELECTION_MODEL_FACTORY };
3088
+ //# sourceMappingURL=ng-select-ng-select.mjs.map