Flash Toolkit - Version 1.1.1

Version Description

  • Fix - Updated select2.js to 4.0.3
Download this release

Release Info

Developer ThemeGrill
Plugin Icon 128x128 Flash Toolkit
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

assets/css/_select2.scss CHANGED
@@ -1,662 +1,484 @@
1
- /*
2
- Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
3
- */
4
  .select2-container {
5
- margin: 0;
6
- position: relative;
7
- display: block !important;
8
- zoom: 1;
9
- *display: inline;
10
- vertical-align: middle;
11
- }
12
-
13
- .select2-container,
14
- .select2-drop,
15
- .select2-search,
16
- .select2-search input {
17
- /*
18
- Force border-box so that % widths fit the parent
19
- container without overlap because of margin/padding.
20
- More Info : http://www.quirksmode.org/css/box.html
21
- */
22
- -webkit-box-sizing: border-box; /* webkit */
23
- -moz-box-sizing: border-box; /* firefox */
24
- box-sizing: border-box; /* css3 */
25
- }
26
-
27
- .select2-container .select2-choice {
28
  display: block;
29
- padding: 0 0 0 8px;
30
- overflow: hidden;
31
- position: relative;
32
-
33
- border: 1px solid #ccc;
34
- white-space: nowrap;
35
- color: #444;
36
- text-decoration: none;
37
-
38
- border-radius: 3px;
39
-
40
- background-clip: padding-box;
41
-
42
- -webkit-touch-callout: none;
43
- -webkit-user-select: none;
44
- -moz-user-select: none;
45
- -ms-user-select: none;
46
- user-select: none;
47
-
48
- background-color: #fff;
49
- font-weight: 400;
50
- }
51
-
52
- html[dir="rtl"] .select2-container .select2-choice {
53
- padding: 0 8px 0 0;
54
- }
55
-
56
- .select2-container.select2-drop-above .select2-choice {
57
- border-bottom-color: #ccc;
58
-
59
- border-radius: 0 0 4px 4px;
60
- }
61
-
62
- .select2-container.select2-allowclear .select2-choice .select2-chosen {
63
- margin-right: 42px;
64
- }
65
-
66
- .select2-container .select2-choice > .select2-chosen {
67
- margin-right: 26px;
68
  display: block;
69
- overflow: hidden;
70
-
71
- white-space: nowrap;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- text-overflow: ellipsis;
74
- float: none;
75
- width: auto;
76
- }
77
-
78
- html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
79
- margin-left: 26px;
80
- margin-right: 0;
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- .select2-container .select2-choice abbr {
84
- display: none;
85
- width: 12px;
86
- height: 12px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  position: absolute;
88
- right: 24px;
89
- top: 5px;
90
-
91
- font-size: 1px;
92
- text-decoration: none;
93
-
94
- border: 0;
95
- background: url('../images/select2.png') right top no-repeat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  cursor: pointer;
97
- outline: 0;
98
- }
99
-
100
- .select2-container.select2-allowclear .select2-choice abbr {
101
- display: inline-block;
102
- }
103
-
104
- .select2-container .select2-choice abbr:hover {
105
- background-position: right -11px;
 
 
 
 
 
 
106
  cursor: pointer;
107
- }
108
-
109
- .select2-drop-mask {
110
- border: 0;
111
- margin: 0;
112
- padding: 0;
113
- position: fixed;
114
- left: 0;
115
- top: 0;
116
- min-height: 100%;
117
- min-width: 100%;
118
- height: auto;
119
- width: auto;
120
- opacity: 0;
121
- z-index: 9998;
122
- /* styles required for IE to work */
123
- background-color: #fff;
124
- filter: alpha(opacity=0);
125
- }
126
-
127
- .select2-drop {
128
- width: 100%;
129
- margin-top: -1px;
130
- position: absolute;
131
- z-index: 9999;
132
- top: 100%;
133
-
134
- background: #fff;
135
- color: #000;
136
- border: 1px solid #ccc;
137
- border-top: 0;
138
-
139
- border-radius: 0 0 3px 3px;
140
- }
141
-
142
- .select2-drop.select2-drop-above {
143
- margin-top: 1px;
144
- border-top: 1px solid #ccc;
145
- border-bottom: 0;
146
-
147
- border-radius: 3px 3px 0 0;
148
-
149
- //-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
150
- // box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
151
- }
152
-
153
- .select2-drop-active {
154
- border: 1px solid #666;
155
- border-top: none;
156
- }
157
-
158
- .select2-drop.select2-drop-above.select2-drop-active {
159
- border-top: 1px solid #666;
160
- }
161
-
162
- .select2-drop-auto-width {
163
- border-top: 1px solid #ccc;
164
- width: auto;
165
- }
166
-
167
- .select2-drop-auto-width .select2-search {
168
- padding-top: 4px;
169
- }
170
-
171
- .select2-container .select2-choice .select2-arrow {
172
  display: inline-block;
173
- width: 18px;
174
- height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  position: absolute;
176
- right: 0;
177
- top: 0;
178
-
179
- border-radius: 0 3px 3px 0;
180
-
181
- background-clip: padding-box;
182
- }
183
-
184
- html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
185
- left: 0;
186
- right: auto;
187
-
188
- border-radius: 3px 0 0 3px;
189
- }
190
-
191
- .select2-container .select2-choice .select2-arrow b {
192
- display: block;
193
- width: 100%;
194
- height: 100%;
195
- //background: url('../images/select2.png') no-repeat 0 1px;
196
- position: relative;
197
-
198
- &:after {
199
- position: absolute;
200
- display: block;
201
- content: "";
202
- top: 50%;
203
  left: 50%;
204
- border: 4px solid transparent;
205
- border-top-color: #666;
206
- margin-left: -7px;
207
  margin-top: -2px;
208
- }
209
- }
210
-
211
- html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
212
- //background-position: 2px 1px;
213
- }
214
-
215
- .select2-search {
216
- display: inline-block;
217
- width: 100%;
218
- margin: 0;
219
- padding-left: 4px;
220
- padding-right: 4px;
221
-
222
- position: relative;
223
- z-index: 10000;
224
-
225
- white-space: nowrap;
226
-
227
- //box-shadow: 0 1px 2px rgba(0,0,0,0.2);
228
- padding-bottom: 4px;
229
- }
230
-
231
- .select2-search input {
232
- width: 100%;
233
- height: auto !important;
234
- padding: 4px 20px 4px 5px !important;
235
- margin: 0;
236
-
237
- outline: 0;
238
- font-family: sans-serif;
239
- font-size: 1em;
240
-
241
- border: 1px solid #ccc;
242
-
243
- -webkit-box-shadow: none;
244
- box-shadow: none;
245
-
246
- background: #fff url('../images/select2.png') no-repeat 100% -22px;
247
- }
248
-
249
- html[dir="rtl"] .select2-search input {
250
- padding: 4px 5px 4px 20px;
251
-
252
- background: #fff url('../images/select2.png') no-repeat -37px -22px;
253
- }
254
-
255
- .select2-drop.select2-drop-above .select2-search input {
256
- margin-top: 4px;
257
- }
258
-
259
- .select2-search input.select2-active {
260
- background: #fff url('../images/select2-spinner.gif') no-repeat 100%;
261
- }
262
-
263
- .select2-container-active .select2-choice,
264
- .select2-container-active .select2-choices {
265
- border: 1px solid #666;
266
- outline: none;
267
- }
268
-
269
- .select2-dropdown-open .select2-choice {
270
- border-bottom-color: transparent;
271
- -webkit-box-shadow: 0 1px 0 #fff inset;
272
- box-shadow: 0 1px 0 #fff inset;
273
-
274
- border-bottom-left-radius: 0;
275
- border-bottom-right-radius: 0;
276
-
277
- .select2-arrow {
278
- b {
279
- &:after {
280
- border-top-color: transparent;
281
- border-bottom-color: #666;
282
- margin-top: -6px;
283
- }
284
- }
285
- }
286
- }
287
-
288
- .select2-dropdown-open.select2-drop-above .select2-choice,
289
- .select2-dropdown-open.select2-drop-above .select2-choices {
290
- border: 1px solid #666;
291
- border-top-color: transparent;
292
- }
293
-
294
- .select2-dropdown-open .select2-choice .select2-arrow {
295
  background: transparent;
296
- border-left: none;
297
- filter: none;
298
- }
299
- html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
300
- border-right: none;
301
- }
302
-
303
- .select2-dropdown-open .select2-choice .select2-arrow b {
304
- background-position: -18px 1px;
305
- }
306
-
307
- html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
308
- background-position: -16px 1px;
309
- }
310
-
311
- .select2-hidden-accessible {
312
- border: 0;
313
- clip: rect(0 0 0 0);
314
- height: 1px;
315
- margin: -1px;
316
- overflow: hidden;
317
- padding: 0;
318
- position: absolute;
319
- width: 1px;
320
- }
321
-
322
- /* results */
323
- .select2-results {
324
- max-height: 200px;
325
- padding: 4px;
326
- margin: 0;
327
- position: relative;
328
- overflow-x: hidden;
329
- overflow-y: auto;
330
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
331
- background: #fafafa;
332
- }
333
-
334
- html[dir="rtl"] .select2-results {
335
- padding: 0 4px 0 0;
336
- margin: 4px 0 4px 4px;
337
- }
338
-
339
- .select2-results ul.select2-result-sub {
340
- margin: 0;
341
- padding-left: 0;
342
- }
343
-
344
- .select2-results li {
345
  list-style: none;
346
- display: list-item;
347
- background-image: none;
348
- margin: 3px 0;
349
- }
350
-
351
- .select2-results li.select2-result-with-children > .select2-result-label {
352
- font-weight: bold;
353
- }
354
-
355
- .select2-results .select2-result-label {
356
- padding: 5px 7px;
357
  margin: 0;
358
- cursor: pointer;
359
-
360
- min-height: 1em;
361
-
362
- -webkit-touch-callout: none;
363
- -webkit-user-select: none;
364
- -moz-user-select: none;
365
- -ms-user-select: none;
366
- user-select: none;
367
- }
368
-
369
- .select2-results-dept-1 .select2-result-label { padding-left: 20px }
370
- .select2-results-dept-2 .select2-result-label { padding-left: 40px }
371
- .select2-results-dept-3 .select2-result-label { padding-left: 60px }
372
- .select2-results-dept-4 .select2-result-label { padding-left: 80px }
373
- .select2-results-dept-5 .select2-result-label { padding-left: 100px }
374
- .select2-results-dept-6 .select2-result-label { padding-left: 110px }
375
- .select2-results-dept-7 .select2-result-label { padding-left: 120px }
376
-
377
- .select2-results .select2-highlighted {
378
- background: #f1f1f1;
379
- color: #000;
380
- border-radius: 3px;
381
- }
382
-
383
- .select2-results li em {
384
- background: #feffde;
385
- font-style: normal;
386
- }
387
-
388
- .select2-results .select2-highlighted em {
389
- background: transparent;
390
- }
391
-
392
- .select2-results .select2-highlighted ul {
393
- background: #fff;
394
- color: #000;
395
- }
396
-
397
- .select2-results .select2-no-results,
398
- .select2-results .select2-searching,
399
- .select2-results .select2-ajax-error,
400
- .select2-results .select2-selection-limit {
401
- background: #f4f4f4;
402
- display: list-item;
403
- padding-left: 5px;
404
- }
405
-
406
- /*
407
- disabled look for disabled choices in the results dropdown
408
- */
409
- .select2-results .select2-disabled.select2-highlighted {
410
- color: #666;
411
- background: #f4f4f4;
412
- display: list-item;
413
- cursor: default;
414
- }
415
- .select2-results .select2-disabled {
416
- background: #f4f4f4;
417
- display: list-item;
418
- cursor: default;
419
- }
420
-
421
- .select2-results .select2-selected {
422
- display: none;
423
- }
424
-
425
- .select2-more-results.select2-active {
426
- background: #f4f4f4 url('../images/select2-spinner.gif') no-repeat 100%;
427
- }
428
-
429
- .select2-results .select2-ajax-error {
430
- background: rgba(255, 50, 50, .2);
431
- }
432
-
433
- .select2-more-results {
434
- background: #f4f4f4;
435
- display: list-item;
436
- }
437
-
438
- /* disabled styles */
439
-
440
- .select2-container.select2-container-disabled .select2-choice {
441
- background-color: #f4f4f4;
442
- background-image: none;
443
- border: 1px solid #ddd;
444
  cursor: default;
445
- }
 
 
 
 
 
 
 
 
 
 
 
446
 
447
- .select2-container.select2-container-disabled .select2-choice .select2-arrow {
448
- background-color: #f4f4f4;
449
- background-image: none;
450
- border-left: 0;
451
- }
452
 
453
- .select2-container.select2-container-disabled .select2-choice abbr {
454
- display: none;
455
- }
456
 
 
 
 
457
 
458
- /* multiselect */
 
459
 
460
- .select2-container-multi .select2-choices {
461
- height: auto !important;
462
- height: 1%;
463
- margin: 0;
464
- padding: 0 5px 0 0;
465
- position: relative;
466
 
467
- border: 1px solid #ccc;
468
- cursor: text;
469
- overflow: hidden;
 
470
 
471
- background-color: #fff;
472
- }
 
473
 
474
- html[dir="rtl"] .select2-container-multi .select2-choices {
475
- padding: 0 0 0 5px;
476
- }
477
 
478
- .select2-locked {
479
- padding: 3px 5px 3px 5px !important;
480
- }
481
 
482
- .select2-container-multi .select2-choices {
483
- min-height: 26px;
484
- }
485
 
486
- .select2-container-multi.select2-container-active .select2-choices {
487
- border: 1px solid #666;
488
- outline: none;
489
 
490
- //-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
491
- // box-shadow: 0 0 5px rgba(0, 0, 0, .3);
492
- }
493
- .select2-container-multi .select2-choices li {
494
- float: left;
495
- list-style: none;
496
- }
497
- html[dir="rtl"] .select2-container-multi .select2-choices li
498
- {
499
- float: right;
500
- }
501
- .select2-container-multi .select2-choices .select2-search-field {
502
- margin: 0;
503
- padding: 0;
504
- white-space: nowrap;
505
- }
506
 
507
- .select2-container-multi .select2-choices .select2-search-field:first-child {
508
- width: 100%;
509
- }
510
-
511
- .select2-container-multi .select2-choices .select2-search-field input {
512
- padding: 5px;
513
- margin: 1px 0;
514
- font-family: sans-serif;
515
- outline: 0;
516
- border: 0;
517
- -webkit-box-shadow: none;
518
- box-shadow: none;
519
- background: transparent !important;
520
- }
521
-
522
- .select2-container-multi .select2-choices .select2-search-field input.select2-active {
523
- background: #fff url('../images/select2-spinner.gif') no-repeat 100% !important;
524
- }
525
-
526
- .select2-default {
527
- color: #999 !important;
528
- }
529
-
530
- .select2-container-multi .select2-choices .select2-search-choice {
531
- padding: 5px 8px 5px 24px;
532
- margin: 3px 0 3px 5px;
533
- position: relative;
534
-
535
- line-height: 15px;
536
- color: #333;
537
- cursor: default;
538
- border-radius: 2px;
539
 
540
- background-clip: padding-box;
 
541
 
542
- -webkit-touch-callout: none;
543
- -webkit-user-select: none;
544
- -moz-user-select: none;
545
- -ms-user-select: none;
546
- user-select: none;
547
 
548
- background-color: #e4e4e4;
549
- }
550
- html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice {
551
- margin: 3px 5px 3px 0;
552
- padding: 5px 24px 5px 8px;
553
- }
554
- .select2-container-multi .ui-sortable .select2-search-choice {
555
- cursor: move;
556
- }
557
- .select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
558
- cursor: default;
559
- }
560
- .select2-container-multi .select2-choices .select2-search-choice-focus {
561
- background: #d4d4d4;
562
- }
563
 
564
- .select2-search-choice-close {
565
- display: block;
566
- width: 12px;
567
- height: 13px;
568
- position: absolute;
569
- right: 7px;
570
- top: 6px;
571
-
572
- font-size: 1px;
573
- outline: none;
574
- background: url('../images/select2.png') right top no-repeat;
575
- }
576
- html[dir="rtl"] .select2-search-choice-close {
577
- right: auto;
578
- left: 7px;
579
- }
580
-
581
- .select2-container-multi .select2-search-choice-close {
582
- left: 7px;
583
- }
584
-
585
- html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
586
- left: auto;
587
- right: 7px;
588
- }
589
-
590
- .select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
591
- background-position: right -11px;
592
- }
593
- .select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
594
- background-position: right -11px;
595
- }
596
-
597
- /* disabled styles */
598
- .select2-container-multi.select2-container-disabled .select2-choices {
599
- background-color: #f4f4f4;
600
- background-image: none;
601
- border: 1px solid #ddd;
602
- cursor: default;
603
- }
604
-
605
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
606
- padding: 3px 5px 3px 5px;
607
- border: 1px solid #ddd;
608
- background-image: none;
609
- background-color: #f4f4f4;
610
- }
611
-
612
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
613
- background: none;
614
- }
615
- /* end multiselect */
616
-
617
-
618
- .select2-result-selectable .select2-match,
619
- .select2-result-unselectable .select2-match {
620
- text-decoration: underline;
621
- }
622
-
623
- .select2-offscreen, .select2-offscreen:focus {
624
- clip: rect(0 0 0 0) !important;
625
- width: 1px !important;
626
- height: 1px !important;
627
- border: 0 !important;
628
- margin: 0 !important;
629
- padding: 0 !important;
630
- overflow: hidden !important;
631
- position: absolute !important;
632
- outline: 0 !important;
633
- left: 0px !important;
634
- top: 0px !important;
635
- }
636
-
637
- .select2-display-none {
638
- display: none;
639
- }
640
-
641
- .select2-measure-scrollbar {
642
- position: absolute;
643
- top: -10000px;
644
- left: -10000px;
645
- width: 100px;
646
- height: 100px;
647
- overflow: scroll;
648
- }
649
-
650
- /* Retina-ize icons */
651
-
652
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
653
- .select2-search input {
654
- background-image: url('../images/select2x2.png') !important;
655
- background-repeat: no-repeat !important;
656
- background-size: 60px 40px !important;
657
- }
658
-
659
- .select2-search input {
660
- background-position: 100% -21px !important;
661
- }
662
- }
 
 
 
1
  .select2-container {
2
+ box-sizing: border-box;
3
+ display: inline-block;
4
+ margin: 0;
5
+ position: relative;
6
+ vertical-align: middle; }
7
+ .select2-container .select2-selection--single {
8
+ box-sizing: border-box;
9
+ cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  display: block;
11
+ height: 28px;
12
+ user-select: none;
13
+ -webkit-user-select: none; }
14
+ .select2-container .select2-selection--single .select2-selection__rendered {
15
+ display: block;
16
+ padding-left: 8px;
17
+ padding-right: 20px;
18
+ overflow: hidden;
19
+ text-overflow: ellipsis;
20
+ white-space: nowrap; }
21
+ .select2-container .select2-selection--single .select2-selection__clear {
22
+ position: relative; }
23
+ .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
+ padding-right: 8px;
25
+ padding-left: 20px; }
26
+ .select2-container .select2-selection--multiple {
27
+ box-sizing: border-box;
28
+ cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  display: block;
30
+ min-height: 32px;
31
+ user-select: none;
32
+ -webkit-user-select: none; }
33
+ .select2-container .select2-selection--multiple .select2-selection__rendered {
34
+ display: inline-block;
35
+ overflow: hidden;
36
+ padding-left: 8px;
37
+ text-overflow: ellipsis;
38
+ white-space: nowrap; }
39
+ .select2-container .select2-search--inline {
40
+ float: left; }
41
+ .select2-container .select2-search--inline .select2-search__field {
42
+ box-sizing: border-box;
43
+ border: none;
44
+ font-size: 100%;
45
+ margin-top: 5px;
46
+ padding: 0; }
47
+ .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
+ -webkit-appearance: none; }
49
+
50
+ .select2-dropdown {
51
+ background-color: white;
52
+ border: 1px solid #aaa;
53
+ border-radius: 4px;
54
+ box-sizing: border-box;
55
+ display: block;
56
+ position: absolute;
57
+ left: -100000px;
58
+ width: 100%;
59
+ z-index: 1051; }
60
 
61
+ .select2-results {
62
+ display: block; }
63
+
64
+ .select2-results__options {
65
+ list-style: none;
66
+ margin: 0;
67
+ padding: 0; }
68
+
69
+ .select2-results__option {
70
+ padding: 6px;
71
+ user-select: none;
72
+ -webkit-user-select: none; }
73
+ .select2-results__option[aria-selected] {
74
+ cursor: pointer; }
75
+
76
+ .select2-container--open .select2-dropdown {
77
+ left: 0; }
78
+
79
+ .select2-container--open .select2-dropdown--above {
80
+ border-bottom: none;
81
+ border-bottom-left-radius: 0;
82
+ border-bottom-right-radius: 0; }
83
+
84
+ .select2-container--open .select2-dropdown--below {
85
+ border-top: none;
86
+ border-top-left-radius: 0;
87
+ border-top-right-radius: 0; }
88
+
89
+ .select2-search--dropdown {
90
+ display: block;
91
+ padding: 4px; }
92
+ .select2-search--dropdown .select2-search__field {
93
+ padding: 4px;
94
+ width: 100%;
95
+ box-sizing: border-box; }
96
+ .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
97
+ -webkit-appearance: none; }
98
+ .select2-search--dropdown.select2-search--hide {
99
+ display: none; }
100
+
101
+ .select2-close-mask {
102
+ border: 0;
103
+ margin: 0;
104
+ padding: 0;
105
+ display: block;
106
+ position: fixed;
107
+ left: 0;
108
+ top: 0;
109
+ min-height: 100%;
110
+ min-width: 100%;
111
+ height: auto;
112
+ width: auto;
113
+ opacity: 0;
114
+ z-index: 99;
115
+ background-color: #fff;
116
+ filter: alpha(opacity=0); }
117
 
118
+ .select2-hidden-accessible {
119
+ border: 0 !important;
120
+ clip: rect(0 0 0 0) !important;
121
+ height: 1px !important;
122
+ margin: -1px !important;
123
+ overflow: hidden !important;
124
+ padding: 0 !important;
125
+ position: absolute !important;
126
+ width: 1px !important; }
127
+
128
+ .select2-container--default .select2-selection--single {
129
+ background-color: #fff;
130
+ border: 1px solid #aaa;
131
+ border-radius: 4px; }
132
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
133
+ color: #444;
134
+ line-height: 28px; }
135
+ .select2-container--default .select2-selection--single .select2-selection__clear {
136
+ cursor: pointer;
137
+ float: right;
138
+ font-weight: bold; }
139
+ .select2-container--default .select2-selection--single .select2-selection__placeholder {
140
+ color: #999; }
141
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
142
+ height: 26px;
143
  position: absolute;
144
+ top: 1px;
145
+ right: 1px;
146
+ width: 20px; }
147
+ .select2-container--default .select2-selection--single .select2-selection__arrow b {
148
+ border-color: #888 transparent transparent transparent;
149
+ border-style: solid;
150
+ border-width: 5px 4px 0 4px;
151
+ height: 0;
152
+ left: 50%;
153
+ margin-left: -4px;
154
+ margin-top: -2px;
155
+ position: absolute;
156
+ top: 50%;
157
+ width: 0; }
158
+
159
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
160
+ float: left; }
161
+
162
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
163
+ left: 1px;
164
+ right: auto; }
165
+
166
+ .select2-container--default.select2-container--disabled .select2-selection--single {
167
+ background-color: #eee;
168
+ cursor: default; }
169
+ .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
170
+ display: none; }
171
+
172
+ .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
173
+ border-color: transparent transparent #888 transparent;
174
+ border-width: 0 4px 5px 4px; }
175
+
176
+ .select2-container--default .select2-selection--multiple {
177
+ background-color: white;
178
+ border: 1px solid #aaa;
179
+ border-radius: 4px;
180
+ cursor: text; }
181
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered {
182
+ box-sizing: border-box;
183
+ list-style: none;
184
+ margin: 0;
185
+ padding: 0 5px;
186
+ width: 100%; }
187
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
188
+ list-style: none; }
189
+ .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
190
+ color: #999;
191
+ margin-top: 5px;
192
+ float: left; }
193
+ .select2-container--default .select2-selection--multiple .select2-selection__clear {
194
  cursor: pointer;
195
+ float: right;
196
+ font-weight: bold;
197
+ margin-top: 5px;
198
+ margin-right: 10px; }
199
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
200
+ background-color: #e4e4e4;
201
+ border: 1px solid #aaa;
202
+ border-radius: 4px;
203
+ cursor: default;
204
+ float: left;
205
+ margin-right: 5px;
206
+ margin-top: 5px;
207
+ padding: 0 5px; }
208
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
209
+ color: #999;
210
  cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  display: inline-block;
212
+ font-weight: bold;
213
+ margin-right: 2px; }
214
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
215
+ color: #333; }
216
+
217
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
218
+ float: right; }
219
+
220
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
221
+ margin-left: 5px;
222
+ margin-right: auto; }
223
+
224
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
225
+ margin-left: 2px;
226
+ margin-right: auto; }
227
+
228
+ .select2-container--default.select2-container--focus .select2-selection--multiple {
229
+ border: solid black 1px;
230
+ outline: 0; }
231
+
232
+ .select2-container--default.select2-container--disabled .select2-selection--multiple {
233
+ background-color: #eee;
234
+ cursor: default; }
235
+
236
+ .select2-container--default.select2-container--disabled .select2-selection__choice__remove {
237
+ display: none; }
238
+
239
+ .select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
240
+ border-top-left-radius: 0;
241
+ border-top-right-radius: 0; }
242
+
243
+ .select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
244
+ border-bottom-left-radius: 0;
245
+ border-bottom-right-radius: 0; }
246
+
247
+ .select2-container--default .select2-search--dropdown .select2-search__field {
248
+ border: 1px solid #aaa; }
249
+
250
+ .select2-container--default .select2-search--inline .select2-search__field {
251
+ background: transparent;
252
+ border: none;
253
+ outline: 0;
254
+ box-shadow: none;
255
+ -webkit-appearance: textfield; }
256
+
257
+ .select2-container--default .select2-results > .select2-results__options {
258
+ max-height: 200px;
259
+ overflow-y: auto; }
260
+
261
+ .select2-container--default .select2-results__option[role=group] {
262
+ padding: 0; }
263
+
264
+ .select2-container--default .select2-results__option[aria-disabled=true] {
265
+ color: #999; }
266
+
267
+ .select2-container--default .select2-results__option[aria-selected=true] {
268
+ background-color: #ddd; }
269
+
270
+ .select2-container--default .select2-results__option .select2-results__option {
271
+ padding-left: 1em; }
272
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
273
+ padding-left: 0; }
274
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
275
+ margin-left: -1em;
276
+ padding-left: 2em; }
277
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
278
+ margin-left: -2em;
279
+ padding-left: 3em; }
280
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
281
+ margin-left: -3em;
282
+ padding-left: 4em; }
283
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
284
+ margin-left: -4em;
285
+ padding-left: 5em; }
286
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
287
+ margin-left: -5em;
288
+ padding-left: 6em; }
289
+
290
+ .select2-container--default .select2-results__option--highlighted[aria-selected] {
291
+ background-color: #5897fb;
292
+ color: white; }
293
+
294
+ .select2-container--default .select2-results__group {
295
+ cursor: default;
296
+ display: block;
297
+ padding: 6px; }
298
+
299
+ .select2-container--classic .select2-selection--single {
300
+ background-color: #f7f7f7;
301
+ border: 1px solid #aaa;
302
+ border-radius: 4px;
303
+ outline: 0;
304
+ background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
305
+ background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
306
+ background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
307
+ background-repeat: repeat-x;
308
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
309
+ .select2-container--classic .select2-selection--single:focus {
310
+ border: 1px solid #5897fb; }
311
+ .select2-container--classic .select2-selection--single .select2-selection__rendered {
312
+ color: #444;
313
+ line-height: 28px; }
314
+ .select2-container--classic .select2-selection--single .select2-selection__clear {
315
+ cursor: pointer;
316
+ float: right;
317
+ font-weight: bold;
318
+ margin-right: 10px; }
319
+ .select2-container--classic .select2-selection--single .select2-selection__placeholder {
320
+ color: #999; }
321
+ .select2-container--classic .select2-selection--single .select2-selection__arrow {
322
+ background-color: #ddd;
323
+ border: none;
324
+ border-left: 1px solid #aaa;
325
+ border-top-right-radius: 4px;
326
+ border-bottom-right-radius: 4px;
327
+ height: 26px;
328
  position: absolute;
329
+ top: 1px;
330
+ right: 1px;
331
+ width: 20px;
332
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
333
+ background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
334
+ background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
335
+ background-repeat: repeat-x;
336
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
337
+ .select2-container--classic .select2-selection--single .select2-selection__arrow b {
338
+ border-color: #888 transparent transparent transparent;
339
+ border-style: solid;
340
+ border-width: 5px 4px 0 4px;
341
+ height: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  left: 50%;
343
+ margin-left: -4px;
 
 
344
  margin-top: -2px;
345
+ position: absolute;
346
+ top: 50%;
347
+ width: 0; }
348
+
349
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
350
+ float: left; }
351
+
352
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
353
+ border: none;
354
+ border-right: 1px solid #aaa;
355
+ border-radius: 0;
356
+ border-top-left-radius: 4px;
357
+ border-bottom-left-radius: 4px;
358
+ left: 1px;
359
+ right: auto; }
360
+
361
+ .select2-container--classic.select2-container--open .select2-selection--single {
362
+ border: 1px solid #5897fb; }
363
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  background: transparent;
365
+ border: none; }
366
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
367
+ border-color: transparent transparent #888 transparent;
368
+ border-width: 0 4px 5px 4px; }
369
+
370
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
371
+ border-top: none;
372
+ border-top-left-radius: 0;
373
+ border-top-right-radius: 0;
374
+ background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
375
+ background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
376
+ background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
377
+ background-repeat: repeat-x;
378
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
379
+
380
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
381
+ border-bottom: none;
382
+ border-bottom-left-radius: 0;
383
+ border-bottom-right-radius: 0;
384
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
385
+ background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
386
+ background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
387
+ background-repeat: repeat-x;
388
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
389
+
390
+ .select2-container--classic .select2-selection--multiple {
391
+ background-color: white;
392
+ border: 1px solid #aaa;
393
+ border-radius: 4px;
394
+ cursor: text;
395
+ outline: 0; }
396
+ .select2-container--classic .select2-selection--multiple:focus {
397
+ border: 1px solid #5897fb; }
398
+ .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  list-style: none;
 
 
 
 
 
 
 
 
 
 
 
400
  margin: 0;
401
+ padding: 0 5px; }
402
+ .select2-container--classic .select2-selection--multiple .select2-selection__clear {
403
+ display: none; }
404
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice {
405
+ background-color: #e4e4e4;
406
+ border: 1px solid #aaa;
407
+ border-radius: 4px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  cursor: default;
409
+ float: left;
410
+ margin-right: 5px;
411
+ margin-top: 5px;
412
+ padding: 0 5px; }
413
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
414
+ color: #888;
415
+ cursor: pointer;
416
+ display: inline-block;
417
+ font-weight: bold;
418
+ margin-right: 2px; }
419
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
420
+ color: #555; }
421
 
422
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
423
+ float: right; }
 
 
 
424
 
425
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
426
+ margin-left: 5px;
427
+ margin-right: auto; }
428
 
429
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
430
+ margin-left: 2px;
431
+ margin-right: auto; }
432
 
433
+ .select2-container--classic.select2-container--open .select2-selection--multiple {
434
+ border: 1px solid #5897fb; }
435
 
436
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
437
+ border-top: none;
438
+ border-top-left-radius: 0;
439
+ border-top-right-radius: 0; }
 
 
440
 
441
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
442
+ border-bottom: none;
443
+ border-bottom-left-radius: 0;
444
+ border-bottom-right-radius: 0; }
445
 
446
+ .select2-container--classic .select2-search--dropdown .select2-search__field {
447
+ border: 1px solid #aaa;
448
+ outline: 0; }
449
 
450
+ .select2-container--classic .select2-search--inline .select2-search__field {
451
+ outline: 0;
452
+ box-shadow: none; }
453
 
454
+ .select2-container--classic .select2-dropdown {
455
+ background-color: white;
456
+ border: 1px solid transparent; }
457
 
458
+ .select2-container--classic .select2-dropdown--above {
459
+ border-bottom: none; }
 
460
 
461
+ .select2-container--classic .select2-dropdown--below {
462
+ border-top: none; }
 
463
 
464
+ .select2-container--classic .select2-results > .select2-results__options {
465
+ max-height: 200px;
466
+ overflow-y: auto; }
 
 
 
 
 
 
 
 
 
 
 
 
 
467
 
468
+ .select2-container--classic .select2-results__option[role=group] {
469
+ padding: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
 
471
+ .select2-container--classic .select2-results__option[aria-disabled=true] {
472
+ color: grey; }
473
 
474
+ .select2-container--classic .select2-results__option--highlighted[aria-selected] {
475
+ background-color: #3875d7;
476
+ color: white; }
 
 
477
 
478
+ .select2-container--classic .select2-results__group {
479
+ cursor: default;
480
+ display: block;
481
+ padding: 6px; }
 
 
 
 
 
 
 
 
 
 
 
482
 
483
+ .select2-container--classic.select2-container--open .select2-dropdown {
484
+ border-color: #5897fb; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/admin.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.select2-container .select2-choice,.select2-results .select2-result-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-touch-callout:none}.select2-container{margin:0;position:relative;display:block!important;zoom:1;vertical-align:middle}.select2-container,.select2-drop,.select2-search,.select2-search input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.select2-container .select2-choice{display:block;padding:0 0 0 8px;overflow:hidden;position:relative;border:1px solid #ccc;white-space:nowrap;color:#444;text-decoration:none;border-radius:3px;background-clip:padding-box;user-select:none;background-color:#fff;font-weight:400}html[dir=rtl] .select2-container .select2-choice{padding:0 8px 0 0}.select2-container.select2-drop-above .select2-choice{border-bottom-color:#ccc;border-radius:0 0 4px 4px}.select2-container.select2-allowclear .select2-choice .select2-chosen{margin-right:42px}.select2-container .select2-choice>.select2-chosen{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;float:none;width:auto}html[dir=rtl] .select2-container .select2-choice>.select2-chosen{margin-left:26px;margin-right:0}.select2-container .select2-choice abbr{display:none;width:12px;height:12px;position:absolute;right:24px;top:5px;font-size:1px;text-decoration:none;border:0;background:url(../images/select2.png) right top no-repeat;cursor:pointer;outline:0}.select2-container.select2-allowclear .select2-choice abbr{display:inline-block}.select2-container .select2-choice abbr:hover{background-position:right -11px;cursor:pointer}.select2-drop-mask{border:0;margin:0;padding:0;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:9998;background-color:#fff;filter:alpha(opacity=0)}.select2-drop{width:100%;margin-top:-1px;position:absolute;top:100%;background:#fff;color:#000;border:1px solid #ccc;border-top:0;border-radius:0 0 3px 3px}.select2-drop.select2-drop-above{margin-top:1px;border-top:1px solid #ccc;border-bottom:0;border-radius:3px 3px 0 0}.select2-drop-active{border:1px solid #666;border-top:none}.select2-drop.select2-drop-above.select2-drop-active{border-top:1px solid #666}.select2-drop-auto-width{border-top:1px solid #ccc;width:auto}.select2-drop-auto-width .select2-search{padding-top:4px}.select2-container .select2-choice .select2-arrow{display:inline-block;width:18px;height:100%;position:absolute;right:0;top:0;border-radius:0 3px 3px 0;background-clip:padding-box}html[dir=rtl] .select2-container .select2-choice .select2-arrow{left:0;right:auto;border-radius:3px 0 0 3px}.select2-container .select2-choice .select2-arrow b{display:block;width:100%;height:100%;position:relative}.select2-container .select2-choice .select2-arrow b:after{position:absolute;display:block;content:"";top:50%;left:50%;border:4px solid transparent;border-top-color:#666;margin-left:-7px;margin-top:-2px}.select2-search{display:inline-block;width:100%;margin:0;padding-left:4px;padding-right:4px;position:relative;z-index:10000;white-space:nowrap;padding-bottom:4px}.select2-search input{width:100%;height:auto!important;padding:4px 20px 4px 5px!important;margin:0;outline:0;font-family:sans-serif;font-size:1em;border:1px solid #ccc;-webkit-box-shadow:none;box-shadow:none;background:url(../images/select2.png) 100% -22px no-repeat #fff}html[dir=rtl] .select2-search input{padding:4px 5px 4px 20px;background:url(../images/select2.png) -37px -22px no-repeat #fff}.select2-drop.select2-drop-above .select2-search input{margin-top:4px}.select2-search input.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #fff}.select2-container-active .select2-choice,.select2-container-active .select2-choices{border:1px solid #666;outline:0}.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-dropdown-open .select2-choice .select2-arrow b:after{border-top-color:transparent;border-bottom-color:#666;margin-top:-6px}.select2-dropdown-open.select2-drop-above .select2-choice,.select2-dropdown-open.select2-drop-above .select2-choices{border:1px solid #666;border-top-color:transparent}.select2-dropdown-open .select2-choice .select2-arrow{background:0 0;border-left:none;filter:none}html[dir=rtl] .select2-dropdown-open .select2-choice .select2-arrow{border-right:none}.select2-dropdown-open .select2-choice .select2-arrow b{background-position:-18px 1px}html[dir=rtl] .select2-dropdown-open .select2-choice .select2-arrow b{background-position:-16px 1px}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.select2-results{max-height:200px;padding:4px;margin:0;position:relative;overflow-x:hidden;overflow-y:auto;-webkit-tap-highlight-color:transparent;background:#fafafa}html[dir=rtl] .select2-results{padding:0 4px 0 0;margin:4px 0 4px 4px}.select2-results ul.select2-result-sub{margin:0;padding-left:0}.select2-results li{list-style:none;display:list-item;background-image:none;margin:3px 0}.select2-results li.select2-result-with-children>.select2-result-label{font-weight:700}.select2-results .select2-result-label{padding:5px 7px;margin:0;cursor:pointer;min-height:1em;user-select:none}.select2-results-dept-1 .select2-result-label{padding-left:20px}.select2-results-dept-2 .select2-result-label{padding-left:40px}.select2-results-dept-3 .select2-result-label{padding-left:60px}.select2-results-dept-4 .select2-result-label{padding-left:80px}.select2-results-dept-5 .select2-result-label{padding-left:100px}.select2-results-dept-6 .select2-result-label{padding-left:110px}.select2-results-dept-7 .select2-result-label{padding-left:120px}.select2-results .select2-highlighted{background:#f1f1f1;color:#000;border-radius:3px}.select2-results li em{background:#feffde;font-style:normal}.select2-results .select2-highlighted em{background:0 0}.select2-results .select2-highlighted ul{background:#fff;color:#000}.select2-results .select2-ajax-error,.select2-results .select2-no-results,.select2-results .select2-searching,.select2-results .select2-selection-limit{background:#f4f4f4;display:list-item;padding-left:5px}.select2-results .select2-disabled.select2-highlighted{color:#666;background:#f4f4f4;display:list-item;cursor:default}.select2-results .select2-disabled{background:#f4f4f4;display:list-item;cursor:default}.select2-results .select2-selected{display:none}.select2-more-results.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #f4f4f4}.select2-results .select2-ajax-error{background:rgba(255,50,50,.2)}.select2-more-results{background:#f4f4f4;display:list-item}.select2-container.select2-container-disabled .select2-choice{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container.select2-container-disabled .select2-choice .select2-arrow{background-color:#f4f4f4;background-image:none;border-left:0}.select2-container.select2-container-disabled .select2-choice abbr{display:none}.select2-container-multi .select2-choices{height:auto!important;height:1%;margin:0;padding:0 5px 0 0;position:relative;border:1px solid #ccc;cursor:text;overflow:hidden;background-color:#fff;min-height:26px}html[dir=rtl] .select2-container-multi .select2-choices{padding:0 0 0 5px}.select2-locked{padding:3px 5px!important}.select2-container-multi.select2-container-active .select2-choices{border:1px solid #666;outline:0}.select2-container-multi .select2-choices li{float:left;list-style:none}html[dir=rtl] .select2-container-multi .select2-choices li{float:right}.select2-container-multi .select2-choices .select2-search-field{margin:0;padding:0;white-space:nowrap}.select2-container-multi .select2-choices .select2-search-field:first-child{width:100%}.select2-container-multi .select2-choices .select2-search-field input{margin:1px 0;outline:0;border:0;-webkit-box-shadow:none;box-shadow:none;background:0 0!important}.select2-container-multi .select2-choices .select2-search-field input.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #fff!important}.select2-default{color:#999!important}.select2-container-multi .select2-choices .select2-search-choice{padding:5px 8px 5px 24px;margin:3px 0 3px 5px;position:relative;line-height:15px;color:#333;cursor:default;border-radius:2px;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#e4e4e4}html[dir=rtl] .select2-container-multi .select2-choices .select2-search-choice{margin:3px 5px 3px 0;padding:5px 24px 5px 8px}.select2-container-multi .ui-sortable .select2-search-choice{cursor:move}.select2-container-multi .select2-choices .select2-search-choice .select2-chosen{cursor:default}.select2-container-multi .select2-choices .select2-search-choice-focus{background:#d4d4d4}.select2-search-choice-close{display:block;width:12px;height:13px;position:absolute;right:7px;top:6px;font-size:1px;outline:0;background:url(../images/select2.png) right top no-repeat}html[dir=rtl] .select2-search-choice-close{right:auto;left:7px}.select2-container-multi .select2-search-choice-close{left:7px}html[dir=rtl] .select2-container-multi .select2-search-choice-close{left:auto;right:7px}.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover,.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close{background-position:right -11px}.select2-container-multi.select2-container-disabled .select2-choices{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice{padding:3px 5px;border:1px solid #ddd;background-image:none;background-color:#f4f4f4}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close{display:none;background:0 0}.select2-result-selectable .select2-match,.select2-result-unselectable .select2-match{text-decoration:underline}.select2-offscreen,.select2-offscreen:focus{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.select2-display-none{display:none}.select2-measure-scrollbar{position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:2dppx){.select2-search input{background-image:url(../images/select2x2.png)!important;background-repeat:no-repeat!important;background-size:60px 40px!important;background-position:100% -21px!important}}#flash-toolkit-portfolio-data .panel-wrap,.flash-toolkit .panel-wrap{overflow:hidden}#flash-toolkit-portfolio-data ul.ft-tabs,.flash-toolkit ul.ft-tabs{margin:0;width:20%;float:left;line-height:1em;padding:0 0 10px;position:relative;background-color:#fafafa;border-right:1px solid #eee;box-sizing:border-box}#flash-toolkit-portfolio-data ul.ft-tabs:after,.flash-toolkit ul.ft-tabs:after{content:"";display:block;width:100%;height:9999em;position:absolute;bottom:-9999em;left:0;background-color:#fafafa;border-right:1px solid #eee}#flash-toolkit-portfolio-data ul.ft-tabs li,.flash-toolkit ul.ft-tabs li{margin:0;padding:0;display:block;position:relative}#flash-toolkit-portfolio-data ul.ft-tabs li a,.flash-toolkit ul.ft-tabs li a{margin:0;padding:10px;display:block;box-shadow:none;text-decoration:none;line-height:20px!important;border-bottom:1px solid #eee}#flash-toolkit-portfolio-data ul.ft-tabs li a:before,.flash-toolkit ul.ft-tabs li a:before{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:.618em;content:"";text-decoration:none}#flash-toolkit-portfolio-data ul.ft-tabs li.general_options a:before,.flash-toolkit ul.ft-tabs li.general_options a:before{content:"\f107"}#flash-toolkit-portfolio-data ul.ft-tabs li.description_options a::before,.flash-toolkit ul.ft-tabs li.description_options a::before{content:'\f103'}#flash-toolkit-portfolio-data ul.ft-tabs li.active a,.flash-toolkit ul.ft-tabs li.active a{color:#555;position:relative;background-color:#eee}#flash-toolkit-portfolio-data .inside{margin:0;padding:0}.flash_toolkit_options_panel,.panel{padding:0;color:#555}.flash_toolkit_options_panel .form-field .flash-toolkit-help-tip,.panel .form-field .flash-toolkit-help-tip{font-size:1.4em}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p{margin:0 0 9px;font-size:12px;padding:5px 9px;line-height:24px}.flash_toolkit_options_panel fieldset.form-field:after,.flash_toolkit_options_panel p:after{content:".";display:block;height:0;clear:both;visibility:hidden}.flash_toolkit_options_panel .checkbox{width:auto;margin:3px 0;vertical-align:middle}.flash_toolkit_options_panel{min-height:175px;box-sizing:border-box}.flash_toolkit_options_panel p{margin:9px 0}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p.form-field{padding:5px 20px 5px 162px!important}.flash_toolkit_options_panel label,.flash_toolkit_options_panel legend{float:left;width:150px;padding:0;margin:0 0 0 -150px}.flash_toolkit_options_panel label .req,.flash_toolkit_options_panel legend .req{font-weight:700;font-style:normal;color:red}.flash_toolkit_options_panel .description{padding:0;margin:0 0 0 7px;clear:none;display:inline}.flash_toolkit_options_panel .description-block{margin-left:0;display:block}.flash_toolkit_options_panel input,.flash_toolkit_options_panel select,.flash_toolkit_options_panel textarea{margin:0}.flash_toolkit_options_panel textarea{height:3.5em;line-height:1.5em;vertical-align:top}.flash_toolkit_options_panel input[type=number],.flash_toolkit_options_panel input[type=password],.flash_toolkit_options_panel input[type=text],.flash_toolkit_options_panel input[type=email]{width:50%;float:left}.flash_toolkit_options_panel input.button{width:auto;margin-left:8px}.flash_toolkit_options_panel select{float:left}.flash_toolkit_options_panel .short,.flash_toolkit_options_panel input[type=number].short,.flash_toolkit_options_panel input[type=password].short,.flash_toolkit_options_panel input[type=text].short,.flash_toolkit_options_panel input[type=email].short{width:50%}.flash_toolkit_options_panel .sized{width:auto!important;margin-right:6px}.flash_toolkit_options_panel .options_group{border-top:1px solid #fff;border-bottom:1px solid #eee}.flash_toolkit_options_panel .options_group:first-child{border-top:0}.flash_toolkit_options_panel .options_group:last-child{border-bottom:0}.flash_toolkit_options_panel .options_group fieldset{margin:9px 0;font-size:12px;padding:5px 9px;line-height:24px}.flash_toolkit_options_panel .options_group fieldset label{width:auto;float:none}.flash_toolkit_options_panel .options_group fieldset ul{float:left;width:50%;margin:0;padding:0}.flash_toolkit_options_panel .options_group fieldset ul li{margin:0;width:auto}.flash_toolkit_options_panel .options_group fieldset ul li input{width:auto;float:none;margin-right:4px}.flash_toolkit_options_panel .options_group fieldset ul.ft-radios label{margin-left:0}.flash_toolkit_options_panel.padded{padding:1em}.flash_toolkit_options_panel .select2-container{float:left}#flash-toolkit-portfolio-data .panel-wrap{background:#fff}#flash-toolkit-portfolio-data .flash_toolkit_options_panel{float:left;width:80%}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios{display:block;float:left;margin:0}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios li{display:block;padding:0 0 10px}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios li input{width:auto}img.help_tip{margin:0 0 0 9px;vertical-align:middle}.postbox img.help_tip{margin-top:0}.postbox .flash-toolkit-help-tip{margin:0 0 0 9px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;position:absolute;top:0;left:0;z-index:9999999}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#333}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#333}#tiptip_content,.ft_error_tip{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code,.ft_error_tip code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}.ft_error_tip{max-width:20em;line-height:1.8em;position:absolute;white-space:normal;background:#d82223;margin:1.5em 1px 0 -1em;z-index:9999999}.ft_error_tip::after{content:'';display:block;border:8px solid #d82223;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent;position:absolute;top:-3px;left:50%;margin:-1em 0 0 -3px}.flash-toolkit-help-tip{color:#666;display:inline-block;font-size:1.1em;font-style:normal;height:16px;line-height:16px;position:relative;vertical-align:middle;width:16px}.flash-toolkit-help-tip:after{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";cursor:help}@media only screen and (max-width:1280px){.flash_toolkit_options_panel .description{display:block;clear:both;margin-left:0}.flash_toolkit_options_panel .dimensions_field .wrap,.flash_toolkit_options_panel .short,.flash_toolkit_options_panel input[type=password].short,.flash_toolkit_options_panel input[type=email].short,.flash_toolkit_options_panel input[type=number].short,.flash_toolkit_options_panel input[type=text].short{width:80%}}@media only screen and (max-width:900px){#flash-toolkit-portfolio-data ul.portfolio_data_tabs{width:10%}#flash-toolkit-portfolio-data .flash_toolkit_options_panel{width:90%}#flash-toolkit-portfolio-data ul.portfolio_data_tabs li a{position:relative;text-indent:-999px;padding:10px}#flash-toolkit-portfolio-data ul.portfolio_data_tabs li a:before{position:absolute;top:0;right:0;bottom:0;left:0;text-indent:0;text-align:center;line-height:40px;width:100%;height:40px}}@media only screen and (max-width:782px){#flash-toolkit-portfolio-data .checkbox{width:25px}}@media only screen and (max-width:500px){.flash_toolkit_options_panel label,.flash_toolkit_options_panel legend{float:none;width:auto;display:block;margin:0}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p.form-field{padding:5px 20px!important}}.select2-drop{z-index:999999!important}.select2-container-multi .select2-choices .select2-search-field input{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 5px;width:100%!important}.select2-container{line-height:1.85em;font-size:14px}
1
+ @charset "UTF-8";.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--classic .select2-results>.select2-results__options,.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:0 0;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top,#fff 50%,#eee 100%);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:4px 0 0 4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top,#fff 0,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top,#eee 50%,#fff 100%);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}#flash-toolkit-portfolio-data .panel-wrap,.flash-toolkit .panel-wrap{overflow:hidden}#flash-toolkit-portfolio-data ul.ft-tabs,.flash-toolkit ul.ft-tabs{margin:0;width:20%;float:left;line-height:1em;padding:0 0 10px;position:relative;background-color:#fafafa;border-right:1px solid #eee;box-sizing:border-box}#flash-toolkit-portfolio-data ul.ft-tabs:after,.flash-toolkit ul.ft-tabs:after{content:"";display:block;width:100%;height:9999em;position:absolute;bottom:-9999em;left:0;background-color:#fafafa;border-right:1px solid #eee}#flash-toolkit-portfolio-data ul.ft-tabs li,.flash-toolkit ul.ft-tabs li{margin:0;padding:0;display:block;position:relative}#flash-toolkit-portfolio-data ul.ft-tabs li a,.flash-toolkit ul.ft-tabs li a{margin:0;padding:10px;display:block;box-shadow:none;text-decoration:none;line-height:20px!important;border-bottom:1px solid #eee}#flash-toolkit-portfolio-data ul.ft-tabs li a:before,.flash-toolkit ul.ft-tabs li a:before{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:.618em;content:"";text-decoration:none}#flash-toolkit-portfolio-data ul.ft-tabs li.general_options a:before,.flash-toolkit ul.ft-tabs li.general_options a:before{content:"\f107"}#flash-toolkit-portfolio-data ul.ft-tabs li.description_options a::before,.flash-toolkit ul.ft-tabs li.description_options a::before{content:'\f103'}#flash-toolkit-portfolio-data ul.ft-tabs li.active a,.flash-toolkit ul.ft-tabs li.active a{color:#555;position:relative;background-color:#eee}#flash-toolkit-portfolio-data .inside{margin:0;padding:0}.flash_toolkit_options_panel,.panel{padding:0;color:#555}.flash_toolkit_options_panel .form-field .flash-toolkit-help-tip,.panel .form-field .flash-toolkit-help-tip{font-size:1.4em}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p{margin:0 0 9px;font-size:12px;padding:5px 9px;line-height:24px}.flash_toolkit_options_panel fieldset.form-field:after,.flash_toolkit_options_panel p:after{content:".";display:block;height:0;clear:both;visibility:hidden}.flash_toolkit_options_panel .checkbox{width:auto;margin:3px 0;vertical-align:middle}.flash_toolkit_options_panel{min-height:175px;box-sizing:border-box}.flash_toolkit_options_panel p{margin:9px 0}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p.form-field{padding:5px 20px 5px 162px!important}.flash_toolkit_options_panel label,.flash_toolkit_options_panel legend{float:left;width:150px;padding:0;margin:0 0 0 -150px}.flash_toolkit_options_panel label .req,.flash_toolkit_options_panel legend .req{font-weight:700;font-style:normal;color:red}.flash_toolkit_options_panel .description{padding:0;margin:0 0 0 7px;clear:none;display:inline}.flash_toolkit_options_panel .description-block{margin-left:0;display:block}.flash_toolkit_options_panel input,.flash_toolkit_options_panel select,.flash_toolkit_options_panel textarea{margin:0}.flash_toolkit_options_panel textarea{height:3.5em;line-height:1.5em;vertical-align:top}.flash_toolkit_options_panel input[type=text],.flash_toolkit_options_panel input[type=email],.flash_toolkit_options_panel input[type=number],.flash_toolkit_options_panel input[type=password]{width:50%;float:left}.flash_toolkit_options_panel input.button{width:auto;margin-left:8px}.flash_toolkit_options_panel select{float:left}.flash_toolkit_options_panel .short,.flash_toolkit_options_panel input[type=text].short,.flash_toolkit_options_panel input[type=email].short,.flash_toolkit_options_panel input[type=number].short,.flash_toolkit_options_panel input[type=password].short{width:50%}.flash_toolkit_options_panel .sized{width:auto!important;margin-right:6px}.flash_toolkit_options_panel .options_group{border-top:1px solid #fff;border-bottom:1px solid #eee}.flash_toolkit_options_panel .options_group:first-child{border-top:0}.flash_toolkit_options_panel .options_group:last-child{border-bottom:0}.flash_toolkit_options_panel .options_group fieldset{margin:9px 0;font-size:12px;padding:5px 9px;line-height:24px}.flash_toolkit_options_panel .options_group fieldset label{width:auto;float:none}.flash_toolkit_options_panel .options_group fieldset ul{float:left;width:50%;margin:0;padding:0}.flash_toolkit_options_panel .options_group fieldset ul li{margin:0;width:auto}.flash_toolkit_options_panel .options_group fieldset ul li input{width:auto;float:none;margin-right:4px}.flash_toolkit_options_panel .options_group fieldset ul.ft-radios label{margin-left:0}.flash_toolkit_options_panel.padded{padding:1em}.flash_toolkit_options_panel .select2-container{float:left}#flash-toolkit-portfolio-data .panel-wrap{background:#fff}#flash-toolkit-portfolio-data .flash_toolkit_options_panel{float:left;width:80%}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios{display:block;float:left;margin:0}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios li{display:block;padding:0 0 10px}#flash-toolkit-portfolio-data .flash_toolkit_options_panel .flash-toolkit-radios li input{width:auto}img.help_tip{margin:0 0 0 9px;vertical-align:middle}.postbox img.help_tip{margin-top:0}.postbox .flash-toolkit-help-tip{margin:0 0 0 9px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;position:absolute;top:0;left:0;z-index:9999999}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#333}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#333}#tiptip_content,.ft_error_tip{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code,.ft_error_tip code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}.ft_error_tip{max-width:20em;line-height:1.8em;position:absolute;white-space:normal;background:#d82223;margin:1.5em 1px 0 -1em;z-index:9999999}.ft_error_tip::after{content:'';display:block;border:8px solid #d82223;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent;position:absolute;top:-3px;left:50%;margin:-1em 0 0 -3px}.flash-toolkit-help-tip{color:#666;display:inline-block;font-size:1.1em;font-style:normal;height:16px;line-height:16px;position:relative;vertical-align:middle;width:16px}.flash-toolkit-help-tip:after{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";cursor:help}@media only screen and (max-width:1280px){.flash_toolkit_options_panel .description{display:block;clear:both;margin-left:0}.flash_toolkit_options_panel .dimensions_field .wrap,.flash_toolkit_options_panel .short,.flash_toolkit_options_panel input[type=password].short,.flash_toolkit_options_panel input[type=email].short,.flash_toolkit_options_panel input[type=number].short,.flash_toolkit_options_panel input[type=text].short{width:80%}}@media only screen and (max-width:900px){#flash-toolkit-portfolio-data ul.portfolio_data_tabs{width:10%}#flash-toolkit-portfolio-data .flash_toolkit_options_panel{width:90%}#flash-toolkit-portfolio-data ul.portfolio_data_tabs li a{position:relative;text-indent:-999px;padding:10px}#flash-toolkit-portfolio-data ul.portfolio_data_tabs li a:before{position:absolute;top:0;right:0;bottom:0;left:0;text-indent:0;text-align:center;line-height:40px;width:100%;height:40px}}@media only screen and (max-width:782px){#flash-toolkit-portfolio-data .checkbox{width:25px}}@media only screen and (max-width:500px){.flash_toolkit_options_panel label,.flash_toolkit_options_panel legend{float:none;width:auto;display:block;margin:0}.flash_toolkit_options_panel fieldset.form-field,.flash_toolkit_options_panel p.form-field{padding:5px 20px!important}}.select2-drop{z-index:999999!important}.select2-container-multi .select2-choices .select2-search-field input{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 5px;width:100%!important}.select2-container{line-height:1.85em;font-size:14px}
assets/css/jquery-ui-timepicker-addon.css ADDED
@@ -0,0 +1 @@
 
1
+ .ui-timepicker-div .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:none;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input{background:0 0;color:inherit;border:none;outline:0;border-bottom:solid 1px #555;width:95%}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus{border-bottom-color:#aaa}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}
assets/css/widgets.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.select2-container{margin:0;position:relative;display:block!important;zoom:1;vertical-align:middle}.select2-container,.select2-drop,.select2-search,.select2-search input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.select2-container .select2-choice{display:block;padding:0 0 0 8px;overflow:hidden;position:relative;border:1px solid #ccc;white-space:nowrap;color:#444;text-decoration:none;border-radius:3px;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff;font-weight:400}html[dir=rtl] .select2-container .select2-choice{padding:0 8px 0 0}.select2-container.select2-drop-above .select2-choice{border-bottom-color:#ccc;border-radius:0 0 4px 4px}.select2-container.select2-allowclear .select2-choice .select2-chosen{margin-right:42px}.select2-container .select2-choice>.select2-chosen{margin-right:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;float:none;width:auto}html[dir=rtl] .select2-container .select2-choice>.select2-chosen{margin-left:26px;margin-right:0}.select2-container .select2-choice abbr{display:none;width:12px;height:12px;position:absolute;right:24px;top:5px;font-size:1px;text-decoration:none;border:0;background:url(../images/select2.png) right top no-repeat;cursor:pointer;outline:0}.select2-container.select2-allowclear .select2-choice abbr{display:inline-block}.select2-container .select2-choice abbr:hover{background-position:right -11px;cursor:pointer}.select2-drop-mask{border:0;margin:0;padding:0;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:9998;background-color:#fff;filter:alpha(opacity=0)}.select2-drop{width:100%;margin-top:-1px;position:absolute;top:100%;background:#fff;color:#000;border:1px solid #ccc;border-top:0;border-radius:0 0 3px 3px}.select2-drop.select2-drop-above{margin-top:1px;border-top:1px solid #ccc;border-bottom:0;border-radius:3px 3px 0 0}.select2-drop-active{border:1px solid #666;border-top:none}.select2-drop.select2-drop-above.select2-drop-active{border-top:1px solid #666}.select2-drop-auto-width{border-top:1px solid #ccc;width:auto}.select2-drop-auto-width .select2-search{padding-top:4px}.select2-container .select2-choice .select2-arrow{display:inline-block;width:18px;height:100%;position:absolute;right:0;top:0;border-radius:0 3px 3px 0;background-clip:padding-box}html[dir=rtl] .select2-container .select2-choice .select2-arrow{left:0;right:auto;border-radius:3px 0 0 3px}.select2-container .select2-choice .select2-arrow b{display:block;width:100%;height:100%;position:relative}.select2-container .select2-choice .select2-arrow b:after{position:absolute;display:block;content:"";top:50%;left:50%;border:4px solid transparent;border-top-color:#666;margin-left:-7px;margin-top:-2px}.select2-search{display:inline-block;width:100%;margin:0;padding-left:4px;padding-right:4px;position:relative;z-index:10000;white-space:nowrap;padding-bottom:4px}.select2-search input{width:100%;height:auto!important;padding:4px 20px 4px 5px!important;margin:0;outline:0;font-family:sans-serif;font-size:1em;border:1px solid #ccc;-webkit-box-shadow:none;box-shadow:none;background:url(../images/select2.png) 100% -22px no-repeat #fff}html[dir=rtl] .select2-search input{padding:4px 5px 4px 20px;background:url(../images/select2.png) -37px -22px no-repeat #fff}.select2-drop.select2-drop-above .select2-search input{margin-top:4px}.select2-search input.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #fff}.select2-container-active .select2-choice,.select2-container-active .select2-choices{border:1px solid #666;outline:0}.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-dropdown-open .select2-choice .select2-arrow b:after{border-top-color:transparent;border-bottom-color:#666;margin-top:-6px}.select2-dropdown-open.select2-drop-above .select2-choice,.select2-dropdown-open.select2-drop-above .select2-choices{border:1px solid #666;border-top-color:transparent}.select2-dropdown-open .select2-choice .select2-arrow{background:0 0;border-left:none;filter:none}html[dir=rtl] .select2-dropdown-open .select2-choice .select2-arrow{border-right:none}.select2-dropdown-open .select2-choice .select2-arrow b{background-position:-18px 1px}html[dir=rtl] .select2-dropdown-open .select2-choice .select2-arrow b{background-position:-16px 1px}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.select2-results{max-height:200px;padding:4px;margin:0;position:relative;overflow-x:hidden;overflow-y:auto;-webkit-tap-highlight-color:transparent;background:#fafafa}html[dir=rtl] .select2-results{padding:0 4px 0 0;margin:4px 0 4px 4px}.select2-results ul.select2-result-sub{margin:0;padding-left:0}.select2-results li{list-style:none;display:list-item;background-image:none;margin:3px 0}.select2-results li.select2-result-with-children>.select2-result-label{font-weight:700}.select2-results .select2-result-label{padding:5px 7px;margin:0;cursor:pointer;min-height:1em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.select2-results-dept-1 .select2-result-label{padding-left:20px}.select2-results-dept-2 .select2-result-label{padding-left:40px}.select2-results-dept-3 .select2-result-label{padding-left:60px}.select2-results-dept-4 .select2-result-label{padding-left:80px}.select2-results-dept-5 .select2-result-label{padding-left:100px}.select2-results-dept-6 .select2-result-label{padding-left:110px}.select2-results-dept-7 .select2-result-label{padding-left:120px}.select2-results .select2-highlighted{background:#f1f1f1;color:#000;border-radius:3px}.select2-results li em{background:#feffde;font-style:normal}.select2-results .select2-highlighted em{background:0 0}.select2-results .select2-highlighted ul{background:#fff;color:#000}.select2-results .select2-ajax-error,.select2-results .select2-no-results,.select2-results .select2-searching,.select2-results .select2-selection-limit{background:#f4f4f4;display:list-item;padding-left:5px}.select2-results .select2-disabled.select2-highlighted{color:#666;background:#f4f4f4;display:list-item;cursor:default}.select2-results .select2-disabled{background:#f4f4f4;display:list-item;cursor:default}.select2-results .select2-selected{display:none}.select2-more-results.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #f4f4f4}.select2-results .select2-ajax-error{background:rgba(255,50,50,.2)}.select2-more-results{background:#f4f4f4;display:list-item}.select2-container.select2-container-disabled .select2-choice{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container.select2-container-disabled .select2-choice .select2-arrow{background-color:#f4f4f4;background-image:none;border-left:0}.select2-container.select2-container-disabled .select2-choice abbr{display:none}.select2-container-multi .select2-choices{height:auto!important;height:1%;margin:0;padding:0 5px 0 0;position:relative;border:1px solid #ccc;cursor:text;overflow:hidden;background-color:#fff;min-height:26px}html[dir=rtl] .select2-container-multi .select2-choices{padding:0 0 0 5px}.select2-locked{padding:3px 5px!important}.select2-container-multi.select2-container-active .select2-choices{border:1px solid #666;outline:0}.select2-container-multi .select2-choices li{float:left;list-style:none}html[dir=rtl] .select2-container-multi .select2-choices li{float:right}.select2-container-multi .select2-choices .select2-search-field{margin:0;padding:0;white-space:nowrap}.select2-container-multi .select2-choices .select2-search-field:first-child{width:100%}.select2-container-multi .select2-choices .select2-search-field input{margin:1px 0;outline:0;border:0;-webkit-box-shadow:none;box-shadow:none;background:0 0!important}.select2-container-multi .select2-choices .select2-search-field input.select2-active{background:url(../images/select2-spinner.gif) 100% no-repeat #fff!important}.select2-default{color:#999!important}.select2-container-multi .select2-choices .select2-search-choice{padding:5px 8px 5px 24px;margin:3px 0 3px 5px;position:relative;line-height:15px;color:#333;cursor:default;border-radius:2px;background-clip:padding-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#e4e4e4}html[dir=rtl] .select2-container-multi .select2-choices .select2-search-choice{margin:3px 5px 3px 0;padding:5px 24px 5px 8px}.select2-container-multi .ui-sortable .select2-search-choice{cursor:move}.select2-container-multi .select2-choices .select2-search-choice .select2-chosen{cursor:default}.select2-container-multi .select2-choices .select2-search-choice-focus{background:#d4d4d4}.select2-search-choice-close{display:block;width:12px;height:13px;position:absolute;right:7px;top:6px;font-size:1px;outline:0;background:url(../images/select2.png) right top no-repeat}html[dir=rtl] .select2-search-choice-close{right:auto;left:7px}.select2-container-multi .select2-search-choice-close{left:7px}html[dir=rtl] .select2-container-multi .select2-search-choice-close{left:auto;right:7px}.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover,.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close{background-position:right -11px}.select2-container-multi.select2-container-disabled .select2-choices{background-color:#f4f4f4;background-image:none;border:1px solid #ddd;cursor:default}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice{padding:3px 5px;border:1px solid #ddd;background-image:none;background-color:#f4f4f4}.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close{display:none;background:0 0}.select2-result-selectable .select2-match,.select2-result-unselectable .select2-match{text-decoration:underline}.select2-offscreen,.select2-offscreen:focus{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.select2-display-none{display:none}.select2-measure-scrollbar{position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow:scroll}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:2dppx){.select2-search input{background-image:url(../images/select2x2.png)!important;background-repeat:no-repeat!important;background-size:60px 40px!important;background-position:100% -21px!important}}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item{margin:0 auto;position:relative;box-sizing:border-box}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside,ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-title{border:1px solid #e5e5e5;border-top:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top{cursor:move;font-size:13px;font-weight:600;line-height:1.4em;background:#fafafa}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title h3{margin:0;padding:10px;font-size:1em;line-height:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title .in-accordion-title{color:#666}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action{float:right;padding:0 8px;cursor:pointer;position:relative}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action a.accordion-action{color:#555;outline:0;display:block;box-shadow:none;text-decoration:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action a.accordion-action:after{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:20px;line-height:1.7em;position:relative}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside{display:none;padding:1px 15px 15px}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside .accordion-control-actions a{box-shadow:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside .accordion-control-actions a.accordion-control-remove:hover{color:red}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-top .accordion-title{box-shadow:0 1px 1px rgba(0,0,0,.04)}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-top .accordion-title-action a.accordion-action:after{content:"\f142"}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-inside{display:block}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item:first-child .accordion-title{border-top:1px solid #e5e5e5}ul.tg-widget-repeater-field-items li.tg-widget-sortable-placeholder{margin:0;width:100%;height:35px;box-sizing:border-box;border:1px dashed #b4b9be}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state{margin:0;overflow:hidden;position:relative;text-align:center;padding:2.5em 7.5%;background:#fafafa;border:1px solid #e5e5e5}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-message::before{content:'\f456';font-family:dashicons;color:#ddd;font-size:4em;display:block;position:relative!important;top:auto;left:auto;line-height:1em;margin:0 0 .1875em}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-cta{font-size:1.2em;padding:.5em 1.5em;height:auto}.tg-widget-repeater-field-button .tg-widget-repeater-field-add{width:100%;margin:3px 0 0;text-align:center}#tg-widget-image-uploader .tg-media-preview{display:none;height:auto;margin-top:10px;border:1px solid #ddd;padding:4px;position:relative}#tg-widget-image-uploader .tg-media-preview:hover .tg-media-remove{opacity:1}#tg-widget-image-uploader .tg-media-preview img{max-width:100%;height:auto;display:block}#tg-widget-image-uploader .tg-media-remove{height:32px;width:32px;position:absolute;top:4px;right:4px;background:rgba(0,0,0,.3);cursor:pointer;color:#fff;border:none;opacity:.6}#tg-widget-image-uploader .tg-media-remove:hover{background:rgba(0,0,0,.6)}#tg-widget-image-uploader .tg-media-remove:active,#tg-widget-image-uploader .tg-media-remove:focus{outline:0}.flash-toolkit-add-sidebar{padding:10px;max-width:900px;text-align:center;background-color:#fff;border:1px solid #e5e5e5;box-shadow:0,1px 0,0,rgba(0,0,0,.04)}.flash-toolkit-add-sidebar input[type=text]{max-width:25em;margin:0 0 15px;padding:5px 10px;line-height:19px;vertical-align:top}.flash-toolkit-delete-sidebar{color:#aaa;z-index:100;position:absolute;top:12px;right:45px}.flash-toolkit-delete-sidebar::before{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;content:"";text-decoration:none;font-size:20px;margin-right:0}.flash-toolkit-delete-sidebar:hover{color:#d54e21;cursor:pointer}.select2-drop{z-index:999999!important}.select2-container-multi .select2-choices .select2-search-field input{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 5px}.select2-container{line-height:1.85em;font-size:14px}.widget-content .select2-container{margin-bottom:1em}.select2-results .fa{float:right;position:relative;line-height:20px}
1
+ @charset "UTF-8";.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--classic .select2-results>.select2-results__options,.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:1px solid #000;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:0 0;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top,#fff 50%,#eee 100%);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:4px 0 0 4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top,#fff 0,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top,#eee 50%,#fff 100%);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item{margin:0 auto;position:relative;box-sizing:border-box}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside,ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-title{border:1px solid #e5e5e5;border-top:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top{cursor:move;font-size:13px;font-weight:600;line-height:1.4em;background:#fafafa}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title h3{margin:0;padding:10px;font-size:1em;line-height:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title .in-accordion-title{color:#666}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action{float:right;padding:0 8px;cursor:pointer;position:relative}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action a.accordion-action{color:#555;outline:0;display:block;box-shadow:none;text-decoration:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-top .accordion-title-action a.accordion-action:after{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:20px;line-height:1.7em;position:relative}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside{display:none;padding:1px 15px 15px}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside .accordion-control-actions a{box-shadow:none}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item .accordion-inside .accordion-control-actions a.accordion-control-remove:hover{color:red}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-top .accordion-title{box-shadow:0 1px 1px rgba(0,0,0,.04)}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-top .accordion-title-action a.accordion-action:after{content:"\f142"}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item.open .accordion-inside{display:block}ul.tg-widget-repeater-field-items li.tg-widget-accordion-item:first-child .accordion-title{border-top:1px solid #e5e5e5}ul.tg-widget-repeater-field-items li.tg-widget-sortable-placeholder{margin:0;width:100%;height:35px;box-sizing:border-box;border:1px dashed #b4b9be}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state{margin:0;overflow:hidden;position:relative;text-align:center;padding:2.5em 7.5%;background:#fafafa;border:1px solid #e5e5e5}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-message::before{content:'\f456';font-family:dashicons;color:#ddd;font-size:4em;display:block;position:relative!important;top:auto;left:auto;line-height:1em;margin:0 0 .1875em}ul.tg-widget-repeater-field-items li.tg-widget-repeater-field-blank-state .tg-widget-repeater-field-BlankState-cta{font-size:1.2em;padding:.5em 1.5em;height:auto}.tg-widget-repeater-field-button .tg-widget-repeater-field-add{width:100%;margin:3px 0 0;text-align:center}#tg-widget-image-uploader .tg-media-preview{display:none;height:auto;margin-top:10px;border:1px solid #ddd;padding:4px;position:relative}#tg-widget-image-uploader .tg-media-preview:hover .tg-media-remove{opacity:1}#tg-widget-image-uploader .tg-media-preview img{max-width:100%;height:auto;display:block}#tg-widget-image-uploader .tg-media-remove{height:32px;width:32px;position:absolute;top:4px;right:4px;background:rgba(0,0,0,.3);cursor:pointer;color:#fff;border:none;opacity:.6}#tg-widget-image-uploader .tg-media-remove:hover{background:rgba(0,0,0,.6)}#tg-widget-image-uploader .tg-media-remove:active,#tg-widget-image-uploader .tg-media-remove:focus{outline:0}.flash-toolkit-add-sidebar{padding:10px;max-width:900px;text-align:center;background-color:#fff;border:1px solid #e5e5e5;box-shadow:0,1px 0,0,rgba(0,0,0,.04)}.flash-toolkit-add-sidebar input[type=text]{max-width:25em;margin:0 0 15px;padding:5px 10px;line-height:19px;vertical-align:top}.flash-toolkit-delete-sidebar{color:#aaa;z-index:100;position:absolute;top:12px;right:45px}.flash-toolkit-delete-sidebar::before{font-family:Dashicons;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;content:"";text-decoration:none;font-size:20px;margin-right:0}.flash-toolkit-delete-sidebar:hover{color:#d54e21;cursor:pointer}.select2-dropdown{z-index:999999!important}.select2-container-multi .select2-choices .select2-search-field input{font-family:inherit;font-size:inherit;font-weight:inherit;padding:3px 5px}.select2-container{line-height:1.25em;font-size:14px}.widget-content .select2-container{margin-bottom:1em}.select2-results .fa{float:right;position:relative;line-height:20px}.select2-results__option{margin-bottom:0}.select2-container--default .select2-selection--single .select2-selection__rendered{line-height:23px}
assets/css/widgets.scss CHANGED
@@ -255,7 +255,7 @@ ul.tg-widget-repeater-field-items {
255
  /**
256
  * Select2
257
  */
258
- .select2-drop {
259
  z-index: 999999 !important;
260
  }
261
  .select2-container-multi .select2-choices .select2-search-field input {
@@ -265,7 +265,7 @@ ul.tg-widget-repeater-field-items {
265
  padding: 3px 5px;
266
  }
267
  .select2-container {
268
- line-height: 1.85em;
269
  font-size: 14px;
270
  }
271
  .widget-content {
@@ -278,3 +278,9 @@ ul.tg-widget-repeater-field-items {
278
  position: relative;
279
  line-height: 20px;
280
  }
 
 
 
 
 
 
255
  /**
256
  * Select2
257
  */
258
+ .select2-dropdown {
259
  z-index: 999999 !important;
260
  }
261
  .select2-container-multi .select2-choices .select2-search-field input {
265
  padding: 3px 5px;
266
  }
267
  .select2-container {
268
+ line-height: 1.25em;
269
  font-size: 14px;
270
  }
271
  .widget-content {
278
  position: relative;
279
  line-height: 20px;
280
  }
281
+ .select2-results__option {
282
+ margin-bottom: 0;
283
+ }
284
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
285
+ line-height: 23px;
286
+ }
assets/js/admin/enhanced-select.js CHANGED
@@ -64,33 +64,13 @@ jQuery( function( $ ) {
64
 
65
  .on( 'flash-enhanced-select-init', function() {
66
 
67
- // Regular select boxes
68
- $( ':input.flash-enhanced-select' ).filter( ':not(.enhanced)' ).each( function() {
69
- var select2_args = $.extend({
70
- minimumResultsForSearch: 10,
71
- allowClear: $( this ).data( 'allow_clear' ) ? true : false,
72
- placeholder: $( this ).data( 'placeholder' )
73
- }, getEnhancedSelectFormatString() );
74
-
75
- $( this ).select2( select2_args ).addClass( 'enhanced' );
76
- });
77
-
78
- $( ':input.flash-enhanced-select-nostd' ).filter( ':not(.enhanced)' ).each( function() {
79
- var select2_args = $.extend({
80
- minimumResultsForSearch: 10,
81
- allowClear: true,
82
- placeholder: $( this ).data( 'placeholder' )
83
- }, getEnhancedSelectFormatString() );
84
-
85
- $( this ).select2( select2_args ).addClass( 'enhanced' );
86
- });
87
-
88
  $( ':input.flash-enhanced-select-icons' ).filter( ':not(.enhanced)' ).each( function() {
89
  var select2_args = $.extend({
90
  minimumResultsForSearch: 10,
91
  allowClear: true,
 
92
  placeholder: $( this ).data( 'placeholder' ),
93
- formatResult: getEnhancedSelectFormatResult
94
  }, getEnhancedSelectFormatString() );
95
 
96
  $( this ).select2( select2_args ).addClass( 'enhanced' );
64
 
65
  .on( 'flash-enhanced-select-init', function() {
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  $( ':input.flash-enhanced-select-icons' ).filter( ':not(.enhanced)' ).each( function() {
68
  var select2_args = $.extend({
69
  minimumResultsForSearch: 10,
70
  allowClear: true,
71
+ escapeMarkup: function (m) {return m;},
72
  placeholder: $( this ).data( 'placeholder' ),
73
+ templateResult: getEnhancedSelectFormatResult
74
  }, getEnhancedSelectFormatString() );
75
 
76
  $( this ).select2( select2_args ).addClass( 'enhanced' );
assets/js/admin/enhanced-select.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?flash_enhanced_select_params.i18n_matches_1:flash_enhanced_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return flash_enhanced_select_params.i18n_no_matches},formatAjaxError:function(){return flash_enhanced_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?flash_enhanced_select_params.i18n_input_too_short_1:flash_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?flash_enhanced_select_params.i18n_input_too_long_1:flash_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?flash_enhanced_select_params.i18n_selection_too_long_1:flash_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return flash_enhanced_select_params.i18n_load_more},formatSearching:function(){return flash_enhanced_select_params.i18n_searching}};return a}function c(b){return b.id&&a(b.element).data("icon")?'<i class="fa '+a(b.element).data("icon")+'"></i> '+b.text:b.text}a(document.body).on("flash-enhanced-select-init",function(){a(":input.flash-enhanced-select").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.flash-enhanced-select-nostd").filter(":not(.enhanced)").each(function(){var c=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},b());a(this).select2(c).addClass("enhanced")}),a(":input.flash-enhanced-select-icons").filter(":not(.enhanced)").each(function(){var d=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder"),formatResult:c},b());a(this).select2(d).addClass("enhanced")})}).trigger("flash-enhanced-select-init")});
1
+ jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?flash_enhanced_select_params.i18n_matches_1:flash_enhanced_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return flash_enhanced_select_params.i18n_no_matches},formatAjaxError:function(){return flash_enhanced_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?flash_enhanced_select_params.i18n_input_too_short_1:flash_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?flash_enhanced_select_params.i18n_input_too_long_1:flash_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?flash_enhanced_select_params.i18n_selection_too_long_1:flash_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return flash_enhanced_select_params.i18n_load_more},formatSearching:function(){return flash_enhanced_select_params.i18n_searching}};return a}function c(b){return b.id&&a(b.element).data("icon")?'<i class="fa '+a(b.element).data("icon")+'"></i> '+b.text:b.text}a(document.body).on("flash-enhanced-select-init",function(){a(":input.flash-enhanced-select-icons").filter(":not(.enhanced)").each(function(){var d=a.extend({minimumResultsForSearch:10,allowClear:!0,escapeMarkup:function(a){return a},placeholder:a(this).data("placeholder"),templateResult:c},b());a(this).select2(d).addClass("enhanced")})}).trigger("flash-enhanced-select-init")});
assets/js/admin/jquery-ui-timepicker-addon.js ADDED
@@ -0,0 +1,2291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
2
+ * http://trentrichardson.com/examples/timepicker
3
+ * Copyright (c) 2016 Trent Richardson; Licensed MIT */
4
+ (function (factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ define(['jquery', 'jquery-ui'], factory);
7
+ } else {
8
+ factory(jQuery);
9
+ }
10
+ }(function ($) {
11
+
12
+ /*
13
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
14
+ */
15
+ $.ui.timepicker = $.ui.timepicker || {};
16
+ if ($.ui.timepicker.version) {
17
+ return;
18
+ }
19
+
20
+ /*
21
+ * Extend jQueryUI, get it started with our version number
22
+ */
23
+ $.extend($.ui, {
24
+ timepicker: {
25
+ version: "1.6.3"
26
+ }
27
+ });
28
+
29
+ /*
30
+ * Timepicker manager.
31
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
32
+ * Settings for (groups of) time pickers are maintained in an instance object,
33
+ * allowing multiple different settings on the same page.
34
+ */
35
+ var Timepicker = function () {
36
+ this.regional = []; // Available regional settings, indexed by language code
37
+ this.regional[''] = { // Default regional settings
38
+ currentText: 'Now',
39
+ closeText: 'Done',
40
+ amNames: ['AM', 'A'],
41
+ pmNames: ['PM', 'P'],
42
+ timeFormat: 'HH:mm',
43
+ timeSuffix: '',
44
+ timeOnlyTitle: 'Choose Time',
45
+ timeText: 'Time',
46
+ hourText: 'Hour',
47
+ minuteText: 'Minute',
48
+ secondText: 'Second',
49
+ millisecText: 'Millisecond',
50
+ microsecText: 'Microsecond',
51
+ timezoneText: 'Time Zone',
52
+ isRTL: false
53
+ };
54
+ this._defaults = { // Global defaults for all the datetime picker instances
55
+ showButtonPanel: true,
56
+ timeOnly: false,
57
+ timeOnlyShowDate: false,
58
+ showHour: null,
59
+ showMinute: null,
60
+ showSecond: null,
61
+ showMillisec: null,
62
+ showMicrosec: null,
63
+ showTimezone: null,
64
+ showTime: true,
65
+ stepHour: 1,
66
+ stepMinute: 1,
67
+ stepSecond: 1,
68
+ stepMillisec: 1,
69
+ stepMicrosec: 1,
70
+ hour: 0,
71
+ minute: 0,
72
+ second: 0,
73
+ millisec: 0,
74
+ microsec: 0,
75
+ timezone: null,
76
+ hourMin: 0,
77
+ minuteMin: 0,
78
+ secondMin: 0,
79
+ millisecMin: 0,
80
+ microsecMin: 0,
81
+ hourMax: 23,
82
+ minuteMax: 59,
83
+ secondMax: 59,
84
+ millisecMax: 999,
85
+ microsecMax: 999,
86
+ minDateTime: null,
87
+ maxDateTime: null,
88
+ maxTime: null,
89
+ minTime: null,
90
+ onSelect: null,
91
+ hourGrid: 0,
92
+ minuteGrid: 0,
93
+ secondGrid: 0,
94
+ millisecGrid: 0,
95
+ microsecGrid: 0,
96
+ alwaysSetTime: true,
97
+ separator: ' ',
98
+ altFieldTimeOnly: true,
99
+ altTimeFormat: null,
100
+ altSeparator: null,
101
+ altTimeSuffix: null,
102
+ altRedirectFocus: true,
103
+ pickerTimeFormat: null,
104
+ pickerTimeSuffix: null,
105
+ showTimepicker: true,
106
+ timezoneList: null,
107
+ addSliderAccess: false,
108
+ sliderAccessArgs: null,
109
+ controlType: 'slider',
110
+ oneLine: false,
111
+ defaultValue: null,
112
+ parse: 'strict',
113
+ afterInject: null
114
+ };
115
+ $.extend(this._defaults, this.regional['']);
116
+ };
117
+
118
+ $.extend(Timepicker.prototype, {
119
+ $input: null,
120
+ $altInput: null,
121
+ $timeObj: null,
122
+ inst: null,
123
+ hour_slider: null,
124
+ minute_slider: null,
125
+ second_slider: null,
126
+ millisec_slider: null,
127
+ microsec_slider: null,
128
+ timezone_select: null,
129
+ maxTime: null,
130
+ minTime: null,
131
+ hour: 0,
132
+ minute: 0,
133
+ second: 0,
134
+ millisec: 0,
135
+ microsec: 0,
136
+ timezone: null,
137
+ hourMinOriginal: null,
138
+ minuteMinOriginal: null,
139
+ secondMinOriginal: null,
140
+ millisecMinOriginal: null,
141
+ microsecMinOriginal: null,
142
+ hourMaxOriginal: null,
143
+ minuteMaxOriginal: null,
144
+ secondMaxOriginal: null,
145
+ millisecMaxOriginal: null,
146
+ microsecMaxOriginal: null,
147
+ ampm: '',
148
+ formattedDate: '',
149
+ formattedTime: '',
150
+ formattedDateTime: '',
151
+ timezoneList: null,
152
+ units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
153
+ support: {},
154
+ control: null,
155
+
156
+ /*
157
+ * Override the default settings for all instances of the time picker.
158
+ * @param {Object} settings object - the new settings to use as defaults (anonymous object)
159
+ * @return {Object} the manager object
160
+ */
161
+ setDefaults: function (settings) {
162
+ extendRemove(this._defaults, settings || {});
163
+ return this;
164
+ },
165
+
166
+ /*
167
+ * Create a new Timepicker instance
168
+ */
169
+ _newInst: function ($input, opts) {
170
+ var tp_inst = new Timepicker(),
171
+ inlineSettings = {},
172
+ fns = {},
173
+ overrides, i;
174
+
175
+ for (var attrName in this._defaults) {
176
+ if (this._defaults.hasOwnProperty(attrName)) {
177
+ var attrValue = $input.attr('time:' + attrName);
178
+ if (attrValue) {
179
+ try {
180
+ inlineSettings[attrName] = eval(attrValue);
181
+ } catch (err) {
182
+ inlineSettings[attrName] = attrValue;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ overrides = {
189
+ beforeShow: function (input, dp_inst) {
190
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
191
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
192
+ }
193
+ },
194
+ onChangeMonthYear: function (year, month, dp_inst) {
195
+ // Update the time as well : this prevents the time from disappearing from the $input field.
196
+ // tp_inst._updateDateTime(dp_inst);
197
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
198
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
199
+ }
200
+ },
201
+ onClose: function (dateText, dp_inst) {
202
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
203
+ tp_inst._updateDateTime(dp_inst);
204
+ }
205
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
206
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
207
+ }
208
+ }
209
+ };
210
+ for (i in overrides) {
211
+ if (overrides.hasOwnProperty(i)) {
212
+ fns[i] = opts[i] || this._defaults[i] || null;
213
+ }
214
+ }
215
+
216
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
217
+ evnts: fns,
218
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
219
+ });
220
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
221
+ return val.toUpperCase();
222
+ });
223
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
224
+ return val.toUpperCase();
225
+ });
226
+
227
+ // detect which units are supported
228
+ tp_inst.support = detectSupport(
229
+ tp_inst._defaults.timeFormat +
230
+ (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
231
+ (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
232
+
233
+ // controlType is string - key to our this._controls
234
+ if (typeof(tp_inst._defaults.controlType) === 'string') {
235
+ if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
236
+ tp_inst._defaults.controlType = 'select';
237
+ }
238
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
239
+ }
240
+ // controlType is an object and must implement create, options, value methods
241
+ else {
242
+ tp_inst.control = tp_inst._defaults.controlType;
243
+ }
244
+
245
+ // prep the timezone options
246
+ var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
247
+ 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
248
+ if (tp_inst._defaults.timezoneList !== null) {
249
+ timezoneList = tp_inst._defaults.timezoneList;
250
+ }
251
+ var tzl = timezoneList.length, tzi = 0, tzv = null;
252
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
253
+ for (; tzi < tzl; tzi++) {
254
+ tzv = timezoneList[tzi];
255
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
256
+ }
257
+ }
258
+ tp_inst._defaults.timezoneList = timezoneList;
259
+
260
+ // set the default units
261
+ tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
262
+ ((new Date()).getTimezoneOffset() * -1);
263
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
264
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
265
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
266
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
267
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
268
+ tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
269
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
270
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
271
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
272
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
273
+ tp_inst.ampm = '';
274
+ tp_inst.$input = $input;
275
+
276
+ if (tp_inst._defaults.altField) {
277
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
278
+ if (tp_inst._defaults.altRedirectFocus === true) {
279
+ tp_inst.$altInput.css({
280
+ cursor: 'pointer'
281
+ }).focus(function () {
282
+ $input.trigger("focus");
283
+ });
284
+ }
285
+ }
286
+
287
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
288
+ tp_inst._defaults.minDate = new Date();
289
+ }
290
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
291
+ tp_inst._defaults.maxDate = new Date();
292
+ }
293
+
294
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
295
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
296
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
297
+ }
298
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
299
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
300
+ }
301
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
302
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
303
+ }
304
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
305
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
306
+ }
307
+ tp_inst.$input.bind('focus', function () {
308
+ tp_inst._onFocus();
309
+ });
310
+
311
+ return tp_inst;
312
+ },
313
+
314
+ /*
315
+ * add our sliders to the calendar
316
+ */
317
+ _addTimePicker: function (dp_inst) {
318
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
319
+
320
+ this.timeDefined = this._parseTime(currDT);
321
+ this._limitMinMaxDateTime(dp_inst, false);
322
+ this._injectTimePicker();
323
+ this._afterInject();
324
+ },
325
+
326
+ /*
327
+ * parse the time string from input value or _setTime
328
+ */
329
+ _parseTime: function (timeString, withDate) {
330
+ if (!this.inst) {
331
+ this.inst = $.datepicker._getInst(this.$input[0]);
332
+ }
333
+
334
+ if (withDate || !this._defaults.timeOnly) {
335
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
336
+ try {
337
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
338
+ if (!parseRes.timeObj) {
339
+ return false;
340
+ }
341
+ $.extend(this, parseRes.timeObj);
342
+ } catch (err) {
343
+ $.timepicker.log("Error parsing the date/time string: " + err +
344
+ "\ndate/time string = " + timeString +
345
+ "\ntimeFormat = " + this._defaults.timeFormat +
346
+ "\ndateFormat = " + dp_dateFormat);
347
+ return false;
348
+ }
349
+ return true;
350
+ } else {
351
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
352
+ if (!timeObj) {
353
+ return false;
354
+ }
355
+ $.extend(this, timeObj);
356
+ return true;
357
+ }
358
+ },
359
+
360
+ /*
361
+ * Handle callback option after injecting timepicker
362
+ */
363
+ _afterInject: function() {
364
+ var o = this.inst.settings;
365
+ if ($.isFunction(o.afterInject)) {
366
+ o.afterInject.call(this);
367
+ }
368
+ },
369
+
370
+ /*
371
+ * generate and inject html for timepicker into ui datepicker
372
+ */
373
+ _injectTimePicker: function () {
374
+ var $dp = this.inst.dpDiv,
375
+ o = this.inst.settings,
376
+ tp_inst = this,
377
+ litem = '',
378
+ uitem = '',
379
+ show = null,
380
+ max = {},
381
+ gridSize = {},
382
+ size = null,
383
+ i = 0,
384
+ l = 0;
385
+
386
+ // Prevent displaying twice
387
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
388
+ var noDisplay = ' ui_tpicker_unit_hide',
389
+ html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + (o.oneLine && o.controlType === 'select' ? ' ui-timepicker-oneLine' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label' + ((o.showTime) ? '' : noDisplay) + '">' + o.timeText + '</dt>' +
390
+ '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"><input class="ui_tpicker_time_input" ' + (o.timeInput ? '' : 'disabled') + '/></dd>';
391
+
392
+ // Create the markup
393
+ for (i = 0, l = this.units.length; i < l; i++) {
394
+ litem = this.units[i];
395
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
396
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
397
+
398
+ // Added by Peter Medeiros:
399
+ // - Figure out what the hour/minute/second max should be based on the step values.
400
+ // - Example: if stepMinute is 15, then minMax is 45.
401
+ max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
402
+ gridSize[litem] = 0;
403
+
404
+ html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' +
405
+ '<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>';
406
+
407
+ if (show && o[litem + 'Grid'] > 0) {
408
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
409
+
410
+ if (litem === 'hour') {
411
+ for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
412
+ gridSize[litem]++;
413
+ var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
414
+ html += '<td data-for="' + litem + '">' + tmph + '</td>';
415
+ }
416
+ }
417
+ else {
418
+ for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
419
+ gridSize[litem]++;
420
+ html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
421
+ }
422
+ }
423
+
424
+ html += '</tr></table></div>';
425
+ }
426
+ html += '</dd>';
427
+ }
428
+
429
+ // Timezone
430
+ var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
431
+ html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>';
432
+ html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>';
433
+
434
+ // Create the elements from string
435
+ html += '</dl></div>';
436
+ var $tp = $(html);
437
+
438
+ // if we only want time picker...
439
+ if (o.timeOnly === true) {
440
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
441
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
442
+ }
443
+
444
+ // add sliders, adjust grids, add events
445
+ for (i = 0, l = tp_inst.units.length; i < l; i++) {
446
+ litem = tp_inst.units[i];
447
+ uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
448
+ show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
449
+
450
+ // add the slider
451
+ tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
452
+
453
+ // adjust the grid and add click event
454
+ if (show && o[litem + 'Grid'] > 0) {
455
+ size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
456
+ $tp.find('.ui_tpicker_' + litem + ' table').css({
457
+ width: size + "%",
458
+ marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
459
+ marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
460
+ borderCollapse: 'collapse'
461
+ }).find("td").click(function (e) {
462
+ var $t = $(this),
463
+ h = $t.html(),
464
+ n = parseInt(h.replace(/[^0-9]/g), 10),
465
+ ap = h.replace(/[^apm]/ig),
466
+ f = $t.data('for'); // loses scope, so we use data-for
467
+
468
+ if (f === 'hour') {
469
+ if (ap.indexOf('p') !== -1 && n < 12) {
470
+ n += 12;
471
+ }
472
+ else {
473
+ if (ap.indexOf('a') !== -1 && n === 12) {
474
+ n = 0;
475
+ }
476
+ }
477
+ }
478
+
479
+ tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
480
+
481
+ tp_inst._onTimeChange();
482
+ tp_inst._onSelectHandler();
483
+ }).css({
484
+ cursor: 'pointer',
485
+ width: (100 / gridSize[litem]) + '%',
486
+ textAlign: 'center',
487
+ overflow: 'hidden'
488
+ });
489
+ } // end if grid > 0
490
+ } // end for loop
491
+
492
+ // Add timezone options
493
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
494
+ $.fn.append.apply(this.timezone_select,
495
+ $.map(o.timezoneList, function (val, idx) {
496
+ return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
497
+ }));
498
+ if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
499
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
500
+ if (local_timezone === this.timezone) {
501
+ selectLocalTimezone(tp_inst);
502
+ } else {
503
+ this.timezone_select.val(this.timezone);
504
+ }
505
+ } else {
506
+ if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
507
+ this.timezone_select.val(o.timezone);
508
+ } else {
509
+ selectLocalTimezone(tp_inst);
510
+ }
511
+ }
512
+ this.timezone_select.change(function () {
513
+ tp_inst._onTimeChange();
514
+ tp_inst._onSelectHandler();
515
+ tp_inst._afterInject();
516
+ });
517
+ // End timezone options
518
+
519
+ // inject timepicker into datepicker
520
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
521
+ if ($buttonPanel.length) {
522
+ $buttonPanel.before($tp);
523
+ } else {
524
+ $dp.append($tp);
525
+ }
526
+
527
+ this.$timeObj = $tp.find('.ui_tpicker_time_input');
528
+ this.$timeObj.change(function () {
529
+ var timeFormat = tp_inst.inst.settings.timeFormat;
530
+ var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
531
+ var update = new Date();
532
+ if (parsedTime) {
533
+ update.setHours(parsedTime.hour);
534
+ update.setMinutes(parsedTime.minute);
535
+ update.setSeconds(parsedTime.second);
536
+ $.datepicker._setTime(tp_inst.inst, update);
537
+ } else {
538
+ this.value = tp_inst.formattedTime;
539
+ this.blur();
540
+ }
541
+ });
542
+
543
+ if (this.inst !== null) {
544
+ var timeDefined = this.timeDefined;
545
+ this._onTimeChange();
546
+ this.timeDefined = timeDefined;
547
+ }
548
+
549
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
550
+ if (this._defaults.addSliderAccess) {
551
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
552
+ rtl = this._defaults.isRTL;
553
+ sliderAccessArgs.isRTL = rtl;
554
+
555
+ setTimeout(function () { // fix for inline mode
556
+ if ($tp.find('.ui-slider-access').length === 0) {
557
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
558
+
559
+ // fix any grids since sliders are shorter
560
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
561
+ if (sliderAccessWidth) {
562
+ $tp.find('table:visible').each(function () {
563
+ var $g = $(this),
564
+ oldWidth = $g.outerWidth(),
565
+ oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
566
+ newWidth = oldWidth - sliderAccessWidth,
567
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
568
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
569
+ css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
570
+ $g.css(css);
571
+ });
572
+ }
573
+ }
574
+ }, 10);
575
+ }
576
+ // end slideAccess integration
577
+
578
+ tp_inst._limitMinMaxDateTime(this.inst, true);
579
+ }
580
+ },
581
+
582
+ /*
583
+ * This function tries to limit the ability to go outside the
584
+ * min/max date range
585
+ */
586
+ _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
587
+ var o = this._defaults,
588
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
589
+
590
+ if (!this._defaults.showTimepicker) {
591
+ return;
592
+ } // No time so nothing to check here
593
+
594
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
595
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
596
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
597
+
598
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
599
+ this.hourMinOriginal = o.hourMin;
600
+ this.minuteMinOriginal = o.minuteMin;
601
+ this.secondMinOriginal = o.secondMin;
602
+ this.millisecMinOriginal = o.millisecMin;
603
+ this.microsecMinOriginal = o.microsecMin;
604
+ }
605
+
606
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
607
+ this._defaults.hourMin = minDateTime.getHours();
608
+ if (this.hour <= this._defaults.hourMin) {
609
+ this.hour = this._defaults.hourMin;
610
+ this._defaults.minuteMin = minDateTime.getMinutes();
611
+ if (this.minute <= this._defaults.minuteMin) {
612
+ this.minute = this._defaults.minuteMin;
613
+ this._defaults.secondMin = minDateTime.getSeconds();
614
+ if (this.second <= this._defaults.secondMin) {
615
+ this.second = this._defaults.secondMin;
616
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
617
+ if (this.millisec <= this._defaults.millisecMin) {
618
+ this.millisec = this._defaults.millisecMin;
619
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
620
+ } else {
621
+ if (this.microsec < this._defaults.microsecMin) {
622
+ this.microsec = this._defaults.microsecMin;
623
+ }
624
+ this._defaults.microsecMin = this.microsecMinOriginal;
625
+ }
626
+ } else {
627
+ this._defaults.millisecMin = this.millisecMinOriginal;
628
+ this._defaults.microsecMin = this.microsecMinOriginal;
629
+ }
630
+ } else {
631
+ this._defaults.secondMin = this.secondMinOriginal;
632
+ this._defaults.millisecMin = this.millisecMinOriginal;
633
+ this._defaults.microsecMin = this.microsecMinOriginal;
634
+ }
635
+ } else {
636
+ this._defaults.minuteMin = this.minuteMinOriginal;
637
+ this._defaults.secondMin = this.secondMinOriginal;
638
+ this._defaults.millisecMin = this.millisecMinOriginal;
639
+ this._defaults.microsecMin = this.microsecMinOriginal;
640
+ }
641
+ } else {
642
+ this._defaults.hourMin = this.hourMinOriginal;
643
+ this._defaults.minuteMin = this.minuteMinOriginal;
644
+ this._defaults.secondMin = this.secondMinOriginal;
645
+ this._defaults.millisecMin = this.millisecMinOriginal;
646
+ this._defaults.microsecMin = this.microsecMinOriginal;
647
+ }
648
+ }
649
+
650
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
651
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
652
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
653
+
654
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
655
+ this.hourMaxOriginal = o.hourMax;
656
+ this.minuteMaxOriginal = o.minuteMax;
657
+ this.secondMaxOriginal = o.secondMax;
658
+ this.millisecMaxOriginal = o.millisecMax;
659
+ this.microsecMaxOriginal = o.microsecMax;
660
+ }
661
+
662
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
663
+ this._defaults.hourMax = maxDateTime.getHours();
664
+ if (this.hour >= this._defaults.hourMax) {
665
+ this.hour = this._defaults.hourMax;
666
+ this._defaults.minuteMax = maxDateTime.getMinutes();
667
+ if (this.minute >= this._defaults.minuteMax) {
668
+ this.minute = this._defaults.minuteMax;
669
+ this._defaults.secondMax = maxDateTime.getSeconds();
670
+ if (this.second >= this._defaults.secondMax) {
671
+ this.second = this._defaults.secondMax;
672
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
673
+ if (this.millisec >= this._defaults.millisecMax) {
674
+ this.millisec = this._defaults.millisecMax;
675
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
676
+ } else {
677
+ if (this.microsec > this._defaults.microsecMax) {
678
+ this.microsec = this._defaults.microsecMax;
679
+ }
680
+ this._defaults.microsecMax = this.microsecMaxOriginal;
681
+ }
682
+ } else {
683
+ this._defaults.millisecMax = this.millisecMaxOriginal;
684
+ this._defaults.microsecMax = this.microsecMaxOriginal;
685
+ }
686
+ } else {
687
+ this._defaults.secondMax = this.secondMaxOriginal;
688
+ this._defaults.millisecMax = this.millisecMaxOriginal;
689
+ this._defaults.microsecMax = this.microsecMaxOriginal;
690
+ }
691
+ } else {
692
+ this._defaults.minuteMax = this.minuteMaxOriginal;
693
+ this._defaults.secondMax = this.secondMaxOriginal;
694
+ this._defaults.millisecMax = this.millisecMaxOriginal;
695
+ this._defaults.microsecMax = this.microsecMaxOriginal;
696
+ }
697
+ } else {
698
+ this._defaults.hourMax = this.hourMaxOriginal;
699
+ this._defaults.minuteMax = this.minuteMaxOriginal;
700
+ this._defaults.secondMax = this.secondMaxOriginal;
701
+ this._defaults.millisecMax = this.millisecMaxOriginal;
702
+ this._defaults.microsecMax = this.microsecMaxOriginal;
703
+ }
704
+ }
705
+
706
+ if (dp_inst.settings.minTime!==null) {
707
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
708
+ if (this.hour<tempMinTime.getHours()) {
709
+ this.hour=this._defaults.hourMin=tempMinTime.getHours();
710
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
711
+ } else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) {
712
+ this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
713
+ } else {
714
+ if (this._defaults.hourMin<tempMinTime.getHours()) {
715
+ this._defaults.hourMin=tempMinTime.getHours();
716
+ this._defaults.minuteMin=tempMinTime.getMinutes();
717
+ } else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) {
718
+ this._defaults.minuteMin=tempMinTime.getMinutes();
719
+ } else {
720
+ this._defaults.minuteMin=0;
721
+ }
722
+ }
723
+ }
724
+
725
+ if (dp_inst.settings.maxTime!==null) {
726
+ var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime);
727
+ if (this.hour>tempMaxTime.getHours()) {
728
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
729
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
730
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
731
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
732
+ } else {
733
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
734
+ this._defaults.hourMax=tempMaxTime.getHours();
735
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
736
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
737
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
738
+ } else {
739
+ this._defaults.minuteMax=59;
740
+ }
741
+ }
742
+ }
743
+
744
+ if (adjustSliders !== undefined && adjustSliders === true) {
745
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
746
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
747
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
748
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
749
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
750
+
751
+ if (this.hour_slider) {
752
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
753
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
754
+ }
755
+ if (this.minute_slider) {
756
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
757
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
758
+ }
759
+ if (this.second_slider) {
760
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
761
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
762
+ }
763
+ if (this.millisec_slider) {
764
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
765
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
766
+ }
767
+ if (this.microsec_slider) {
768
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
769
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
770
+ }
771
+ }
772
+
773
+ },
774
+
775
+ /*
776
+ * when a slider moves, set the internal time...
777
+ * on time change is also called when the time is updated in the text field
778
+ */
779
+ _onTimeChange: function () {
780
+ if (!this._defaults.showTimepicker) {
781
+ return;
782
+ }
783
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
784
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
785
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
786
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
787
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
788
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
789
+ o = this._defaults,
790
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
791
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
792
+
793
+ if (typeof(hour) === 'object') {
794
+ hour = false;
795
+ }
796
+ if (typeof(minute) === 'object') {
797
+ minute = false;
798
+ }
799
+ if (typeof(second) === 'object') {
800
+ second = false;
801
+ }
802
+ if (typeof(millisec) === 'object') {
803
+ millisec = false;
804
+ }
805
+ if (typeof(microsec) === 'object') {
806
+ microsec = false;
807
+ }
808
+ if (typeof(timezone) === 'object') {
809
+ timezone = false;
810
+ }
811
+
812
+ if (hour !== false) {
813
+ hour = parseInt(hour, 10);
814
+ }
815
+ if (minute !== false) {
816
+ minute = parseInt(minute, 10);
817
+ }
818
+ if (second !== false) {
819
+ second = parseInt(second, 10);
820
+ }
821
+ if (millisec !== false) {
822
+ millisec = parseInt(millisec, 10);
823
+ }
824
+ if (microsec !== false) {
825
+ microsec = parseInt(microsec, 10);
826
+ }
827
+ if (timezone !== false) {
828
+ timezone = timezone.toString();
829
+ }
830
+
831
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
832
+
833
+ // If the update was done in the input field, the input field should not be updated.
834
+ // If the update was done using the sliders, update the input field.
835
+ var hasChanged = (
836
+ hour !== parseInt(this.hour,10) || // sliders should all be numeric
837
+ minute !== parseInt(this.minute,10) ||
838
+ second !== parseInt(this.second,10) ||
839
+ millisec !== parseInt(this.millisec,10) ||
840
+ microsec !== parseInt(this.microsec,10) ||
841
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
842
+ (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
843
+ );
844
+
845
+ if (hasChanged) {
846
+
847
+ if (hour !== false) {
848
+ this.hour = hour;
849
+ }
850
+ if (minute !== false) {
851
+ this.minute = minute;
852
+ }
853
+ if (second !== false) {
854
+ this.second = second;
855
+ }
856
+ if (millisec !== false) {
857
+ this.millisec = millisec;
858
+ }
859
+ if (microsec !== false) {
860
+ this.microsec = microsec;
861
+ }
862
+ if (timezone !== false) {
863
+ this.timezone = timezone;
864
+ }
865
+
866
+ if (!this.inst) {
867
+ this.inst = $.datepicker._getInst(this.$input[0]);
868
+ }
869
+
870
+ this._limitMinMaxDateTime(this.inst, true);
871
+ }
872
+ if (this.support.ampm) {
873
+ this.ampm = ampm;
874
+ }
875
+
876
+ // Updates the time within the timepicker
877
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
878
+ if (this.$timeObj) {
879
+ if (pickerTimeFormat === o.timeFormat) {
880
+ this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
881
+ }
882
+ else {
883
+ this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
884
+ }
885
+ if (this.$timeObj[0].setSelectionRange) {
886
+ var sPos = this.$timeObj[0].selectionStart;
887
+ var ePos = this.$timeObj[0].selectionEnd;
888
+ this.$timeObj[0].setSelectionRange(sPos, ePos);
889
+ }
890
+ }
891
+
892
+ this.timeDefined = true;
893
+ if (hasChanged) {
894
+ this._updateDateTime();
895
+ //this.$input.focus(); // may automatically open the picker on setDate
896
+ }
897
+ },
898
+
899
+ /*
900
+ * call custom onSelect.
901
+ * bind to sliders slidestop, and grid click.
902
+ */
903
+ _onSelectHandler: function () {
904
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
905
+ var inputEl = this.$input ? this.$input[0] : null;
906
+ if (onSelect && inputEl) {
907
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
908
+ }
909
+ },
910
+
911
+ /*
912
+ * update our input with the new date time..
913
+ */
914
+ _updateDateTime: function (dp_inst) {
915
+ dp_inst = this.inst || dp_inst;
916
+ var dtTmp = (dp_inst.currentYear > 0?
917
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
918
+ new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
919
+ dt = $.datepicker._daylightSavingAdjust(dtTmp),
920
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
921
+ //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
922
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
923
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
924
+ timeAvailable = dt !== null && this.timeDefined;
925
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
926
+ var formattedDateTime = this.formattedDate;
927
+
928
+ // if a slider was changed but datepicker doesn't have a value yet, set it
929
+ if (dp_inst.lastVal === "") {
930
+ dp_inst.currentYear = dp_inst.selectedYear;
931
+ dp_inst.currentMonth = dp_inst.selectedMonth;
932
+ dp_inst.currentDay = dp_inst.selectedDay;
933
+ }
934
+
935
+ /*
936
+ * remove following lines to force every changes in date picker to change the input value
937
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
938
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
939
+ */
940
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
941
+ // return;
942
+ //}
943
+
944
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
945
+ formattedDateTime = this.formattedTime;
946
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
947
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
948
+ }
949
+
950
+ this.formattedDateTime = formattedDateTime;
951
+
952
+ if (!this._defaults.showTimepicker) {
953
+ this.$input.val(this.formattedDate);
954
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
955
+ this.$altInput.val(this.formattedTime);
956
+ this.$input.val(this.formattedDate);
957
+ } else if (this.$altInput) {
958
+ this.$input.val(formattedDateTime);
959
+ var altFormattedDateTime = '',
960
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
961
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
962
+
963
+ if (!this._defaults.timeOnly) {
964
+ if (this._defaults.altFormat) {
965
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
966
+ }
967
+ else {
968
+ altFormattedDateTime = this.formattedDate;
969
+ }
970
+
971
+ if (altFormattedDateTime) {
972
+ altFormattedDateTime += altSeparator;
973
+ }
974
+ }
975
+
976
+ if (this._defaults.altTimeFormat !== null) {
977
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
978
+ }
979
+ else {
980
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
981
+ }
982
+ this.$altInput.val(altFormattedDateTime);
983
+ } else {
984
+ this.$input.val(formattedDateTime);
985
+ }
986
+
987
+ this.$input.trigger("change");
988
+ },
989
+
990
+ _onFocus: function () {
991
+ if (!this.$input.val() && this._defaults.defaultValue) {
992
+ this.$input.val(this._defaults.defaultValue);
993
+ var inst = $.datepicker._getInst(this.$input.get(0)),
994
+ tp_inst = $.datepicker._get(inst, 'timepicker');
995
+ if (tp_inst) {
996
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
997
+ try {
998
+ $.datepicker._updateDatepicker(inst);
999
+ } catch (err) {
1000
+ $.timepicker.log(err);
1001
+ }
1002
+ }
1003
+ }
1004
+ }
1005
+ },
1006
+
1007
+ /*
1008
+ * Small abstraction to control types
1009
+ * We can add more, just be sure to follow the pattern: create, options, value
1010
+ */
1011
+ _controls: {
1012
+ // slider methods
1013
+ slider: {
1014
+ create: function (tp_inst, obj, unit, val, min, max, step) {
1015
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
1016
+ return obj.prop('slide', null).slider({
1017
+ orientation: "horizontal",
1018
+ value: rtl ? val * -1 : val,
1019
+ min: rtl ? max * -1 : min,
1020
+ max: rtl ? min * -1 : max,
1021
+ step: step,
1022
+ slide: function (event, ui) {
1023
+ tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
1024
+ tp_inst._onTimeChange();
1025
+ },
1026
+ stop: function (event, ui) {
1027
+ tp_inst._onSelectHandler();
1028
+ }
1029
+ });
1030
+ },
1031
+ options: function (tp_inst, obj, unit, opts, val) {
1032
+ if (tp_inst._defaults.isRTL) {
1033
+ if (typeof(opts) === 'string') {
1034
+ if (opts === 'min' || opts === 'max') {
1035
+ if (val !== undefined) {
1036
+ return obj.slider(opts, val * -1);
1037
+ }
1038
+ return Math.abs(obj.slider(opts));
1039
+ }
1040
+ return obj.slider(opts);
1041
+ }
1042
+ var min = opts.min,
1043
+ max = opts.max;
1044
+ opts.min = opts.max = null;
1045
+ if (min !== undefined) {
1046
+ opts.max = min * -1;
1047
+ }
1048
+ if (max !== undefined) {
1049
+ opts.min = max * -1;
1050
+ }
1051
+ return obj.slider(opts);
1052
+ }
1053
+ if (typeof(opts) === 'string' && val !== undefined) {
1054
+ return obj.slider(opts, val);
1055
+ }
1056
+ return obj.slider(opts);
1057
+ },
1058
+ value: function (tp_inst, obj, unit, val) {
1059
+ if (tp_inst._defaults.isRTL) {
1060
+ if (val !== undefined) {
1061
+ return obj.slider('value', val * -1);
1062
+ }
1063
+ return Math.abs(obj.slider('value'));
1064
+ }
1065
+ if (val !== undefined) {
1066
+ return obj.slider('value', val);
1067
+ }
1068
+ return obj.slider('value');
1069
+ }
1070
+ },
1071
+ // select methods
1072
+ select: {
1073
+ create: function (tp_inst, obj, unit, val, min, max, step) {
1074
+ var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
1075
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
1076
+
1077
+ for (var i = min; i <= max; i += step) {
1078
+ sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
1079
+ if (unit === 'hour') {
1080
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
1081
+ }
1082
+ else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
1083
+ else {sel += '0' + i.toString(); }
1084
+ sel += '</option>';
1085
+ }
1086
+ sel += '</select>';
1087
+
1088
+ obj.children('select').remove();
1089
+
1090
+ $(sel).appendTo(obj).change(function (e) {
1091
+ tp_inst._onTimeChange();
1092
+ tp_inst._onSelectHandler();
1093
+ tp_inst._afterInject();
1094
+ });
1095
+
1096
+ return obj;
1097
+ },
1098
+ options: function (tp_inst, obj, unit, opts, val) {
1099
+ var o = {},
1100
+ $t = obj.children('select');
1101
+ if (typeof(opts) === 'string') {
1102
+ if (val === undefined) {
1103
+ return $t.data(opts);
1104
+ }
1105
+ o[opts] = val;
1106
+ }
1107
+ else { o = opts; }
1108
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1109
+ },
1110
+ value: function (tp_inst, obj, unit, val) {
1111
+ var $t = obj.children('select');
1112
+ if (val !== undefined) {
1113
+ return $t.val(val);
1114
+ }
1115
+ return $t.val();
1116
+ }
1117
+ }
1118
+ } // end _controls
1119
+
1120
+ });
1121
+
1122
+ $.fn.extend({
1123
+ /*
1124
+ * shorthand just to use timepicker.
1125
+ */
1126
+ timepicker: function (o) {
1127
+ o = o || {};
1128
+ var tmp_args = Array.prototype.slice.call(arguments);
1129
+
1130
+ if (typeof o === 'object') {
1131
+ tmp_args[0] = $.extend(o, {
1132
+ timeOnly: true
1133
+ });
1134
+ }
1135
+
1136
+ return $(this).each(function () {
1137
+ $.fn.datetimepicker.apply($(this), tmp_args);
1138
+ });
1139
+ },
1140
+
1141
+ /*
1142
+ * extend timepicker to datepicker
1143
+ */
1144
+ datetimepicker: function (o) {
1145
+ o = o || {};
1146
+ var tmp_args = arguments;
1147
+
1148
+ if (typeof(o) === 'string') {
1149
+ if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
1150
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
1151
+ } else {
1152
+ return this.each(function () {
1153
+ var $t = $(this);
1154
+ $t.datepicker.apply($t, tmp_args);
1155
+ });
1156
+ }
1157
+ } else {
1158
+ return this.each(function () {
1159
+ var $t = $(this);
1160
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
1161
+ });
1162
+ }
1163
+ }
1164
+ });
1165
+
1166
+ /*
1167
+ * Public Utility to parse date and time
1168
+ */
1169
+ $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1170
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1171
+ if (parseRes.timeObj) {
1172
+ var t = parseRes.timeObj;
1173
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1174
+ parseRes.date.setMicroseconds(t.microsec);
1175
+ }
1176
+
1177
+ return parseRes.date;
1178
+ };
1179
+
1180
+ /*
1181
+ * Public utility to parse time
1182
+ */
1183
+ $.datepicker.parseTime = function (timeFormat, timeString, options) {
1184
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1185
+ iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
1186
+
1187
+ // Strict parse requires the timeString to match the timeFormat exactly
1188
+ var strictParse = function (f, s, o) {
1189
+
1190
+ // pattern for standard and localized AM/PM markers
1191
+ var getPatternAmpm = function (amNames, pmNames) {
1192
+ var markers = [];
1193
+ if (amNames) {
1194
+ $.merge(markers, amNames);
1195
+ }
1196
+ if (pmNames) {
1197
+ $.merge(markers, pmNames);
1198
+ }
1199
+ markers = $.map(markers, function (val) {
1200
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1201
+ });
1202
+ return '(' + markers.join('|') + ')?';
1203
+ };
1204
+
1205
+ // figure out position of time elements.. cause js cant do named captures
1206
+ var getFormatPositions = function (timeFormat) {
1207
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1208
+ orders = {
1209
+ h: -1,
1210
+ m: -1,
1211
+ s: -1,
1212
+ l: -1,
1213
+ c: -1,
1214
+ t: -1,
1215
+ z: -1
1216
+ };
1217
+
1218
+ if (finds) {
1219
+ for (var i = 0; i < finds.length; i++) {
1220
+ if (orders[finds[i].toString().charAt(0)] === -1) {
1221
+ orders[finds[i].toString().charAt(0)] = i + 1;
1222
+ }
1223
+ }
1224
+ }
1225
+ return orders;
1226
+ };
1227
+
1228
+ var regstr = '^' + f.toString()
1229
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1230
+ var ml = match.length;
1231
+ switch (match.charAt(0).toLowerCase()) {
1232
+ case 'h':
1233
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1234
+ case 'm':
1235
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1236
+ case 's':
1237
+ return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1238
+ case 'l':
1239
+ return '(\\d?\\d?\\d)';
1240
+ case 'c':
1241
+ return '(\\d?\\d?\\d)';
1242
+ case 'z':
1243
+ return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1244
+ case 't':
1245
+ return getPatternAmpm(o.amNames, o.pmNames);
1246
+ default: // literal escaped in quotes
1247
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1248
+ }
1249
+ })
1250
+ .replace(/\s/g, '\\s?') +
1251
+ o.timeSuffix + '$',
1252
+ order = getFormatPositions(f),
1253
+ ampm = '',
1254
+ treg;
1255
+
1256
+ treg = s.match(new RegExp(regstr, 'i'));
1257
+
1258
+ var resTime = {
1259
+ hour: 0,
1260
+ minute: 0,
1261
+ second: 0,
1262
+ millisec: 0,
1263
+ microsec: 0
1264
+ };
1265
+
1266
+ if (treg) {
1267
+ if (order.t !== -1) {
1268
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1269
+ ampm = '';
1270
+ resTime.ampm = '';
1271
+ } else {
1272
+ ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
1273
+ resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
1274
+ }
1275
+ }
1276
+
1277
+ if (order.h !== -1) {
1278
+ if (ampm === 'AM' && treg[order.h] === '12') {
1279
+ resTime.hour = 0; // 12am = 0 hour
1280
+ } else {
1281
+ if (ampm === 'PM' && treg[order.h] !== '12') {
1282
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1283
+ } else {
1284
+ resTime.hour = Number(treg[order.h]);
1285
+ }
1286
+ }
1287
+ }
1288
+
1289
+ if (order.m !== -1) {
1290
+ resTime.minute = Number(treg[order.m]);
1291
+ }
1292
+ if (order.s !== -1) {
1293
+ resTime.second = Number(treg[order.s]);
1294
+ }
1295
+ if (order.l !== -1) {
1296
+ resTime.millisec = Number(treg[order.l]);
1297
+ }
1298
+ if (order.c !== -1) {
1299
+ resTime.microsec = Number(treg[order.c]);
1300
+ }
1301
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1302
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1303
+ }
1304
+
1305
+
1306
+ return resTime;
1307
+ }
1308
+ return false;
1309
+ };// end strictParse
1310
+
1311
+ // First try JS Date, if that fails, use strictParse
1312
+ var looseParse = function (f, s, o) {
1313
+ try {
1314
+ var d = new Date('2012-01-01 ' + s);
1315
+ if (isNaN(d.getTime())) {
1316
+ d = new Date('2012-01-01T' + s);
1317
+ if (isNaN(d.getTime())) {
1318
+ d = new Date('01/01/2012 ' + s);
1319
+ if (isNaN(d.getTime())) {
1320
+ throw "Unable to parse time with native Date: " + s;
1321
+ }
1322
+ }
1323
+ }
1324
+
1325
+ return {
1326
+ hour: d.getHours(),
1327
+ minute: d.getMinutes(),
1328
+ second: d.getSeconds(),
1329
+ millisec: d.getMilliseconds(),
1330
+ microsec: d.getMicroseconds(),
1331
+ timezone: d.getTimezoneOffset() * -1
1332
+ };
1333
+ }
1334
+ catch (err) {
1335
+ try {
1336
+ return strictParse(f, s, o);
1337
+ }
1338
+ catch (err2) {
1339
+ $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
1340
+ }
1341
+ }
1342
+ return false;
1343
+ }; // end looseParse
1344
+
1345
+ if (typeof o.parse === "function") {
1346
+ return o.parse(timeFormat, timeString, o);
1347
+ }
1348
+ if (o.parse === 'loose') {
1349
+ return looseParse(timeFormat, timeString, o);
1350
+ }
1351
+ return strictParse(timeFormat, timeString, o);
1352
+ };
1353
+
1354
+ /**
1355
+ * Public utility to format the time
1356
+ * @param {string} format format of the time
1357
+ * @param {Object} time Object not a Date for timezones
1358
+ * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
1359
+ * @returns {string} the formatted time
1360
+ */
1361
+ $.datepicker.formatTime = function (format, time, options) {
1362
+ options = options || {};
1363
+ options = $.extend({}, $.timepicker._defaults, options);
1364
+ time = $.extend({
1365
+ hour: 0,
1366
+ minute: 0,
1367
+ second: 0,
1368
+ millisec: 0,
1369
+ microsec: 0,
1370
+ timezone: null
1371
+ }, time);
1372
+
1373
+ var tmptime = format,
1374
+ ampmName = options.amNames[0],
1375
+ hour = parseInt(time.hour, 10);
1376
+
1377
+ if (hour > 11) {
1378
+ ampmName = options.pmNames[0];
1379
+ }
1380
+
1381
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1382
+ switch (match) {
1383
+ case 'HH':
1384
+ return ('0' + hour).slice(-2);
1385
+ case 'H':
1386
+ return hour;
1387
+ case 'hh':
1388
+ return ('0' + convert24to12(hour)).slice(-2);
1389
+ case 'h':
1390
+ return convert24to12(hour);
1391
+ case 'mm':
1392
+ return ('0' + time.minute).slice(-2);
1393
+ case 'm':
1394
+ return time.minute;
1395
+ case 'ss':
1396
+ return ('0' + time.second).slice(-2);
1397
+ case 's':
1398
+ return time.second;
1399
+ case 'l':
1400
+ return ('00' + time.millisec).slice(-3);
1401
+ case 'c':
1402
+ return ('00' + time.microsec).slice(-3);
1403
+ case 'z':
1404
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
1405
+ case 'Z':
1406
+ return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
1407
+ case 'T':
1408
+ return ampmName.charAt(0).toUpperCase();
1409
+ case 'TT':
1410
+ return ampmName.toUpperCase();
1411
+ case 't':
1412
+ return ampmName.charAt(0).toLowerCase();
1413
+ case 'tt':
1414
+ return ampmName.toLowerCase();
1415
+ default:
1416
+ return match.replace(/'/g, "");
1417
+ }
1418
+ });
1419
+
1420
+ return tmptime;
1421
+ };
1422
+
1423
+ /*
1424
+ * the bad hack :/ override datepicker so it doesn't close on select
1425
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1426
+ */
1427
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1428
+ $.datepicker._selectDate = function (id, dateStr) {
1429
+ var inst = this._getInst($(id)[0]),
1430
+ tp_inst = this._get(inst, 'timepicker'),
1431
+ was_inline;
1432
+
1433
+ if (tp_inst && inst.settings.showTimepicker) {
1434
+ tp_inst._limitMinMaxDateTime(inst, true);
1435
+ was_inline = inst.inline;
1436
+ inst.inline = inst.stay_open = true;
1437
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1438
+ this._base_selectDate(id, dateStr);
1439
+ inst.inline = was_inline;
1440
+ inst.stay_open = false;
1441
+ this._notifyChange(inst);
1442
+ this._updateDatepicker(inst);
1443
+ } else {
1444
+ this._base_selectDate(id, dateStr);
1445
+ }
1446
+ };
1447
+
1448
+ /*
1449
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1450
+ * and does not redraw the datepicker on every selectDate event
1451
+ */
1452
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1453
+ $.datepicker._updateDatepicker = function (inst) {
1454
+
1455
+ // don't popup the datepicker if there is another instance already opened
1456
+ var input = inst.input[0];
1457
+ if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
1458
+ return;
1459
+ }
1460
+
1461
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1462
+
1463
+ this._base_updateDatepicker(inst);
1464
+
1465
+ // Reload the time control when changing something in the input text field.
1466
+ var tp_inst = this._get(inst, 'timepicker');
1467
+ if (tp_inst) {
1468
+ tp_inst._addTimePicker(inst);
1469
+ }
1470
+ }
1471
+ };
1472
+
1473
+ /*
1474
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1475
+ */
1476
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1477
+ $.datepicker._doKeyPress = function (event) {
1478
+ var inst = $.datepicker._getInst(event.target),
1479
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1480
+
1481
+ if (tp_inst) {
1482
+ if ($.datepicker._get(inst, 'constrainInput')) {
1483
+ var ampm = tp_inst.support.ampm,
1484
+ tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1485
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1486
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1487
+ .replace(/[hms]/g, '')
1488
+ .replace(/TT/g, ampm ? 'APM' : '')
1489
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1490
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1491
+ .replace(/T/g, ampm ? 'AP' : '')
1492
+ .replace(/tt/g, ampm ? 'apm' : '')
1493
+ .replace(/t/g, ampm ? 'ap' : '') +
1494
+ " " + tp_inst._defaults.separator +
1495
+ tp_inst._defaults.timeSuffix +
1496
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1497
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1498
+ dateChars,
1499
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1500
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1501
+ }
1502
+ }
1503
+
1504
+ return $.datepicker._base_doKeyPress(event);
1505
+ };
1506
+
1507
+ /*
1508
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1509
+ * Update any alternate field to synchronise with the main field.
1510
+ */
1511
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1512
+ $.datepicker._updateAlternate = function (inst) {
1513
+ var tp_inst = this._get(inst, 'timepicker');
1514
+ if (tp_inst) {
1515
+ var altField = tp_inst._defaults.altField;
1516
+ if (altField) { // update alternate field too
1517
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1518
+ date = this._getDate(inst),
1519
+ formatCfg = $.datepicker._getFormatConfig(inst),
1520
+ altFormattedDateTime = '',
1521
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1522
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1523
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1524
+
1525
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1526
+ if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
1527
+ if (tp_inst._defaults.altFormat) {
1528
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1529
+ }
1530
+ else {
1531
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1532
+ }
1533
+ }
1534
+ $(altField).val( inst.input.val() ? altFormattedDateTime : "");
1535
+ }
1536
+ }
1537
+ else {
1538
+ $.datepicker._base_updateAlternate(inst);
1539
+ }
1540
+ };
1541
+
1542
+ /*
1543
+ * Override key up event to sync manual input changes.
1544
+ */
1545
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1546
+ $.datepicker._doKeyUp = function (event) {
1547
+ var inst = $.datepicker._getInst(event.target),
1548
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1549
+
1550
+ if (tp_inst) {
1551
+ if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
1552
+ try {
1553
+ $.datepicker._updateDatepicker(inst);
1554
+ } catch (err) {
1555
+ $.timepicker.log(err);
1556
+ }
1557
+ }
1558
+ }
1559
+
1560
+ return $.datepicker._base_doKeyUp(event);
1561
+ };
1562
+
1563
+ /*
1564
+ * override "Today" button to also grab the time and set it to input field.
1565
+ */
1566
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1567
+ $.datepicker._gotoToday = function (id) {
1568
+ var inst = this._getInst($(id)[0]);
1569
+ this._base_gotoToday(id);
1570
+ var tp_inst = this._get(inst, 'timepicker');
1571
+ if (!tp_inst) {
1572
+ return;
1573
+ }
1574
+
1575
+ var tzoffset = $.timepicker.timezoneOffsetNumber(tp_inst.timezone);
1576
+ var now = new Date();
1577
+ now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + parseInt(tzoffset, 10));
1578
+ this._setTime(inst, now);
1579
+ this._setDate(inst, now);
1580
+ tp_inst._onSelectHandler();
1581
+ };
1582
+
1583
+ /*
1584
+ * Disable & enable the Time in the datetimepicker
1585
+ */
1586
+ $.datepicker._disableTimepickerDatepicker = function (target) {
1587
+ var inst = this._getInst(target);
1588
+ if (!inst) {
1589
+ return;
1590
+ }
1591
+
1592
+ var tp_inst = this._get(inst, 'timepicker');
1593
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1594
+ if (tp_inst) {
1595
+ inst.settings.showTimepicker = false;
1596
+ tp_inst._defaults.showTimepicker = false;
1597
+ tp_inst._updateDateTime(inst);
1598
+ }
1599
+ };
1600
+
1601
+ $.datepicker._enableTimepickerDatepicker = function (target) {
1602
+ var inst = this._getInst(target);
1603
+ if (!inst) {
1604
+ return;
1605
+ }
1606
+
1607
+ var tp_inst = this._get(inst, 'timepicker');
1608
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1609
+ if (tp_inst) {
1610
+ inst.settings.showTimepicker = true;
1611
+ tp_inst._defaults.showTimepicker = true;
1612
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1613
+ tp_inst._updateDateTime(inst);
1614
+ }
1615
+ };
1616
+
1617
+ /*
1618
+ * Create our own set time function
1619
+ */
1620
+ $.datepicker._setTime = function (inst, date) {
1621
+ var tp_inst = this._get(inst, 'timepicker');
1622
+ if (tp_inst) {
1623
+ var defaults = tp_inst._defaults;
1624
+
1625
+ // calling _setTime with no date sets time to defaults
1626
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1627
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1628
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1629
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1630
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1631
+
1632
+ //check if within min/max times..
1633
+ tp_inst._limitMinMaxDateTime(inst, true);
1634
+
1635
+ tp_inst._onTimeChange();
1636
+ tp_inst._updateDateTime(inst);
1637
+ }
1638
+ };
1639
+
1640
+ /*
1641
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1642
+ */
1643
+ $.datepicker._setTimeDatepicker = function (target, date, withDate) {
1644
+ var inst = this._getInst(target);
1645
+ if (!inst) {
1646
+ return;
1647
+ }
1648
+
1649
+ var tp_inst = this._get(inst, 'timepicker');
1650
+
1651
+ if (tp_inst) {
1652
+ this._setDateFromField(inst);
1653
+ var tp_date;
1654
+ if (date) {
1655
+ if (typeof date === "string") {
1656
+ tp_inst._parseTime(date, withDate);
1657
+ tp_date = new Date();
1658
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1659
+ tp_date.setMicroseconds(tp_inst.microsec);
1660
+ } else {
1661
+ tp_date = new Date(date.getTime());
1662
+ tp_date.setMicroseconds(date.getMicroseconds());
1663
+ }
1664
+ if (tp_date.toString() === 'Invalid Date') {
1665
+ tp_date = undefined;
1666
+ }
1667
+ this._setTime(inst, tp_date);
1668
+ }
1669
+ }
1670
+
1671
+ };
1672
+
1673
+ /*
1674
+ * override setDate() to allow setting time too within Date object
1675
+ */
1676
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1677
+ $.datepicker._setDateDatepicker = function (target, _date) {
1678
+ var inst = this._getInst(target);
1679
+ var date = _date;
1680
+ if (!inst) {
1681
+ return;
1682
+ }
1683
+
1684
+ if (typeof(_date) === 'string') {
1685
+ date = new Date(_date);
1686
+ if (!date.getTime()) {
1687
+ this._base_setDateDatepicker.apply(this, arguments);
1688
+ date = $(target).datepicker('getDate');
1689
+ }
1690
+ }
1691
+
1692
+ var tp_inst = this._get(inst, 'timepicker');
1693
+ var tp_date;
1694
+ if (date instanceof Date) {
1695
+ tp_date = new Date(date.getTime());
1696
+ tp_date.setMicroseconds(date.getMicroseconds());
1697
+ } else {
1698
+ tp_date = date;
1699
+ }
1700
+
1701
+ // This is important if you are using the timezone option, javascript's Date
1702
+ // object will only return the timezone offset for the current locale, so we
1703
+ // adjust it accordingly. If not using timezone option this won't matter..
1704
+ // If a timezone is different in tp, keep the timezone as is
1705
+ if (tp_inst && tp_date) {
1706
+ // look out for DST if tz wasn't specified
1707
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1708
+ tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
1709
+ }
1710
+ date = $.timepicker.timezoneAdjust(date, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()), tp_inst.timezone);
1711
+ tp_date = $.timepicker.timezoneAdjust(tp_date, $.timepicker.timezoneOffsetString(-tp_date.getTimezoneOffset()), tp_inst.timezone);
1712
+ }
1713
+
1714
+ this._updateDatepicker(inst);
1715
+ this._base_setDateDatepicker.apply(this, arguments);
1716
+ this._setTimeDatepicker(target, tp_date, true);
1717
+ };
1718
+
1719
+ /*
1720
+ * override getDate() to allow getting time too within Date object
1721
+ */
1722
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1723
+ $.datepicker._getDateDatepicker = function (target, noDefault) {
1724
+ var inst = this._getInst(target);
1725
+ if (!inst) {
1726
+ return;
1727
+ }
1728
+
1729
+ var tp_inst = this._get(inst, 'timepicker');
1730
+
1731
+ if (tp_inst) {
1732
+ // if it hasn't yet been defined, grab from field
1733
+ if (inst.lastVal === undefined) {
1734
+ this._setDateFromField(inst, noDefault);
1735
+ }
1736
+
1737
+ var date = this._getDate(inst);
1738
+
1739
+ var currDT = null;
1740
+
1741
+ if (tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) {
1742
+ currDT = tp_inst.$input.val() + ' ' + tp_inst.$altInput.val();
1743
+ }
1744
+ else if (tp_inst.$input.get(0).tagName !== 'INPUT' && tp_inst.$altInput) {
1745
+ /**
1746
+ * in case the datetimepicker has been applied to a non-input tag for inline UI,
1747
+ * and the user has not configured the plugin to display only time in altInput,
1748
+ * pick current date time from the altInput (and hope for the best, for now, until "ER1" is applied)
1749
+ *
1750
+ * @todo ER1. Since altInput can have a totally difference format, convert it to standard format by reading input format from "altFormat" and "altTimeFormat" option values
1751
+ */
1752
+ currDT = tp_inst.$altInput.val();
1753
+ }
1754
+ else {
1755
+ currDT = tp_inst.$input.val();
1756
+ }
1757
+
1758
+ if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
1759
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1760
+ date.setMicroseconds(tp_inst.microsec);
1761
+
1762
+ // This is important if you are using the timezone option, javascript's Date
1763
+ // object will only return the timezone offset for the current locale, so we
1764
+ // adjust it accordingly. If not using timezone option this won't matter..
1765
+ if (tp_inst.timezone != null) {
1766
+ // look out for DST if tz wasn't specified
1767
+ if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1768
+ tp_inst.timezone = date.getTimezoneOffset() * -1;
1769
+ }
1770
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()));
1771
+ }
1772
+ }
1773
+ return date;
1774
+ }
1775
+ return this._base_getDateDatepicker(target, noDefault);
1776
+ };
1777
+
1778
+ /*
1779
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1780
+ * An option in datapicker to ignore extra format characters would be nicer.
1781
+ */
1782
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1783
+ $.datepicker.parseDate = function (format, value, settings) {
1784
+ var date;
1785
+ try {
1786
+ date = this._base_parseDate(format, value, settings);
1787
+ } catch (err) {
1788
+ // Hack! The error message ends with a colon, a space, and
1789
+ // the "extra" characters. We rely on that instead of
1790
+ // attempting to perfectly reproduce the parsing algorithm.
1791
+ if (err.indexOf(":") >= 0) {
1792
+ date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1793
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1794
+ } else {
1795
+ throw err;
1796
+ }
1797
+ }
1798
+ return date;
1799
+ };
1800
+
1801
+ /*
1802
+ * override formatDate to set date with time to the input
1803
+ */
1804
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1805
+ $.datepicker._formatDate = function (inst, day, month, year) {
1806
+ var tp_inst = this._get(inst, 'timepicker');
1807
+ if (tp_inst) {
1808
+ tp_inst._updateDateTime(inst);
1809
+ return tp_inst.$input.val();
1810
+ }
1811
+ return this._base_formatDate(inst);
1812
+ };
1813
+
1814
+ /*
1815
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1816
+ */
1817
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1818
+ $.datepicker._optionDatepicker = function (target, name, value) {
1819
+ var inst = this._getInst(target),
1820
+ name_clone;
1821
+ if (!inst) {
1822
+ return null;
1823
+ }
1824
+
1825
+ var tp_inst = this._get(inst, 'timepicker');
1826
+ if (tp_inst) {
1827
+ var min = null,
1828
+ max = null,
1829
+ onselect = null,
1830
+ overrides = tp_inst._defaults.evnts,
1831
+ fns = {},
1832
+ prop,
1833
+ ret,
1834
+ oldVal,
1835
+ $target;
1836
+ if (typeof name === 'string') { // if min/max was set with the string
1837
+ if (name === 'minDate' || name === 'minDateTime') {
1838
+ min = value;
1839
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1840
+ max = value;
1841
+ } else if (name === 'onSelect') {
1842
+ onselect = value;
1843
+ } else if (overrides.hasOwnProperty(name)) {
1844
+ if (typeof (value) === 'undefined') {
1845
+ return overrides[name];
1846
+ }
1847
+ fns[name] = value;
1848
+ name_clone = {}; //empty results in exiting function after overrides updated
1849
+ }
1850
+ } else if (typeof name === 'object') { //if min/max was set with the JSON
1851
+ if (name.minDate) {
1852
+ min = name.minDate;
1853
+ } else if (name.minDateTime) {
1854
+ min = name.minDateTime;
1855
+ } else if (name.maxDate) {
1856
+ max = name.maxDate;
1857
+ } else if (name.maxDateTime) {
1858
+ max = name.maxDateTime;
1859
+ }
1860
+ for (prop in overrides) {
1861
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1862
+ fns[prop] = name[prop];
1863
+ }
1864
+ }
1865
+ }
1866
+ for (prop in fns) {
1867
+ if (fns.hasOwnProperty(prop)) {
1868
+ overrides[prop] = fns[prop];
1869
+ if (!name_clone) { name_clone = $.extend({}, name); }
1870
+ delete name_clone[prop];
1871
+ }
1872
+ }
1873
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1874
+ if (min) { //if min was set
1875
+ if (min === 0) {
1876
+ min = new Date();
1877
+ } else {
1878
+ min = new Date(min);
1879
+ }
1880
+ tp_inst._defaults.minDate = min;
1881
+ tp_inst._defaults.minDateTime = min;
1882
+ } else if (max) { //if max was set
1883
+ if (max === 0) {
1884
+ max = new Date();
1885
+ } else {
1886
+ max = new Date(max);
1887
+ }
1888
+ tp_inst._defaults.maxDate = max;
1889
+ tp_inst._defaults.maxDateTime = max;
1890
+ } else if (onselect) {
1891
+ tp_inst._defaults.onSelect = onselect;
1892
+ }
1893
+
1894
+ // Datepicker will override our date when we call _base_optionDatepicker when
1895
+ // calling minDate/maxDate, so we will first grab the value, call
1896
+ // _base_optionDatepicker, then set our value back.
1897
+ if(min || max){
1898
+ $target = $(target);
1899
+ oldVal = $target.datetimepicker('getDate');
1900
+ ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1901
+ $target.datetimepicker('setDate', oldVal);
1902
+ return ret;
1903
+ }
1904
+ }
1905
+ if (value === undefined) {
1906
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1907
+ }
1908
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1909
+ };
1910
+
1911
+ /*
1912
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1913
+ * it will return false for all objects
1914
+ */
1915
+ var isEmptyObject = function (obj) {
1916
+ var prop;
1917
+ for (prop in obj) {
1918
+ if (obj.hasOwnProperty(prop)) {
1919
+ return false;
1920
+ }
1921
+ }
1922
+ return true;
1923
+ };
1924
+
1925
+ /*
1926
+ * jQuery extend now ignores nulls!
1927
+ */
1928
+ var extendRemove = function (target, props) {
1929
+ $.extend(target, props);
1930
+ for (var name in props) {
1931
+ if (props[name] === null || props[name] === undefined) {
1932
+ target[name] = props[name];
1933
+ }
1934
+ }
1935
+ return target;
1936
+ };
1937
+
1938
+ /*
1939
+ * Determine by the time format which units are supported
1940
+ * Returns an object of booleans for each unit
1941
+ */
1942
+ var detectSupport = function (timeFormat) {
1943
+ var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1944
+ isIn = function (f, t) { // does the format contain the token?
1945
+ return f.indexOf(t) !== -1 ? true : false;
1946
+ };
1947
+ return {
1948
+ hour: isIn(tf, 'h'),
1949
+ minute: isIn(tf, 'm'),
1950
+ second: isIn(tf, 's'),
1951
+ millisec: isIn(tf, 'l'),
1952
+ microsec: isIn(tf, 'c'),
1953
+ timezone: isIn(tf, 'z'),
1954
+ ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1955
+ iso8601: isIn(timeFormat, 'Z')
1956
+ };
1957
+ };
1958
+
1959
+ /*
1960
+ * Converts 24 hour format into 12 hour
1961
+ * Returns 12 hour without leading 0
1962
+ */
1963
+ var convert24to12 = function (hour) {
1964
+ hour %= 12;
1965
+
1966
+ if (hour === 0) {
1967
+ hour = 12;
1968
+ }
1969
+
1970
+ return String(hour);
1971
+ };
1972
+
1973
+ var computeEffectiveSetting = function (settings, property) {
1974
+ return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1975
+ };
1976
+
1977
+ /*
1978
+ * Splits datetime string into date and time substrings.
1979
+ * Throws exception when date can't be parsed
1980
+ * Returns {dateString: dateString, timeString: timeString}
1981
+ */
1982
+ var splitDateTime = function (dateTimeString, timeSettings) {
1983
+ // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1984
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1985
+ var separator = computeEffectiveSetting(timeSettings, 'separator'),
1986
+ format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1987
+ timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1988
+ timePartsLen = timeParts.length,
1989
+ allParts = dateTimeString.split(separator),
1990
+ allPartsLen = allParts.length;
1991
+
1992
+ if (allPartsLen > 1) {
1993
+ return {
1994
+ dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1995
+ timeString: allParts.splice(0, timePartsLen).join(separator)
1996
+ };
1997
+ }
1998
+
1999
+ return {
2000
+ dateString: dateTimeString,
2001
+ timeString: ''
2002
+ };
2003
+ };
2004
+
2005
+ /*
2006
+ * Internal function to parse datetime interval
2007
+ * Returns: {date: Date, timeObj: Object}, where
2008
+ * date - parsed date without time (type Date)
2009
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
2010
+ */
2011
+ var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
2012
+ var date,
2013
+ parts,
2014
+ parsedTime;
2015
+
2016
+ parts = splitDateTime(dateTimeString, timeSettings);
2017
+ date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
2018
+
2019
+ if (parts.timeString === '') {
2020
+ return {
2021
+ date: date
2022
+ };
2023
+ }
2024
+
2025
+ parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
2026
+
2027
+ if (!parsedTime) {
2028
+ throw 'Wrong time format';
2029
+ }
2030
+
2031
+ return {
2032
+ date: date,
2033
+ timeObj: parsedTime
2034
+ };
2035
+ };
2036
+
2037
+ /*
2038
+ * Internal function to set timezone_select to the local timezone
2039
+ */
2040
+ var selectLocalTimezone = function (tp_inst, date) {
2041
+ if (tp_inst && tp_inst.timezone_select) {
2042
+ var now = date || new Date();
2043
+ tp_inst.timezone_select.val(-now.getTimezoneOffset());
2044
+ }
2045
+ };
2046
+
2047
+ /*
2048
+ * Create a Singleton Instance
2049
+ */
2050
+ $.timepicker = new Timepicker();
2051
+
2052
+ /**
2053
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
2054
+ * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
2055
+ * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
2056
+ * @return {string}
2057
+ */
2058
+ $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
2059
+ if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
2060
+ return tzMinutes;
2061
+ }
2062
+
2063
+ var off = tzMinutes,
2064
+ minutes = off % 60,
2065
+ hours = (off - minutes) / 60,
2066
+ iso = iso8601 ? ':' : '',
2067
+ tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
2068
+
2069
+ if (tz === '+00:00') {
2070
+ return 'Z';
2071
+ }
2072
+ return tz;
2073
+ };
2074
+
2075
+ /**
2076
+ * Get the number in minutes that represents a timezone string
2077
+ * @param {string} tzString formatted like "+0500", "-1245", "Z"
2078
+ * @return {number} the offset minutes or the original string if it doesn't match expectations
2079
+ */
2080
+ $.timepicker.timezoneOffsetNumber = function (tzString) {
2081
+ var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
2082
+
2083
+ if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
2084
+ return 0;
2085
+ }
2086
+
2087
+ if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
2088
+ return parseInt(tzString, 10);
2089
+ }
2090
+
2091
+ return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
2092
+ ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
2093
+ parseInt(normalized.substr(3, 2), 10))); // minutes
2094
+ };
2095
+
2096
+ /**
2097
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
2098
+ * @param {Date} date
2099
+ * @param {string} fromTimezone formatted like "+0500", "-1245"
2100
+ * @param {string} toTimezone formatted like "+0500", "-1245"
2101
+ * @return {Date}
2102
+ */
2103
+ $.timepicker.timezoneAdjust = function (date, fromTimezone, toTimezone) {
2104
+ var fromTz = $.timepicker.timezoneOffsetNumber(fromTimezone);
2105
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
2106
+ if (!isNaN(toTz)) {
2107
+ date.setMinutes(date.getMinutes() + (-fromTz) - (-toTz));
2108
+ }
2109
+ return date;
2110
+ };
2111
+
2112
+ /**
2113
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
2114
+ * enforce date range limits.
2115
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
2116
+ * @param {Element} startTime
2117
+ * @param {Element} endTime
2118
+ * @param {Object} options Options for the timepicker() call
2119
+ * @return {jQuery}
2120
+ */
2121
+ $.timepicker.timeRange = function (startTime, endTime, options) {
2122
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
2123
+ };
2124
+
2125
+ /**
2126
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
2127
+ * enforce date range limits.
2128
+ * @param {Element} startTime
2129
+ * @param {Element} endTime
2130
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2131
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2132
+ * @param {string} method Can be used to specify the type of picker to be added
2133
+ * @return {jQuery}
2134
+ */
2135
+ $.timepicker.datetimeRange = function (startTime, endTime, options) {
2136
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2137
+ };
2138
+
2139
+ /**
2140
+ * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
2141
+ * enforce date range limits.
2142
+ * @param {Element} startTime
2143
+ * @param {Element} endTime
2144
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2145
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2146
+ * @return {jQuery}
2147
+ */
2148
+ $.timepicker.dateRange = function (startTime, endTime, options) {
2149
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
2150
+ };
2151
+
2152
+ /**
2153
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2154
+ * enforce date range limits.
2155
+ * @param {string} method Can be used to specify the type of picker to be added
2156
+ * @param {Element} startTime
2157
+ * @param {Element} endTime
2158
+ * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2159
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2160
+ * @return {jQuery}
2161
+ */
2162
+ $.timepicker.handleRange = function (method, startTime, endTime, options) {
2163
+ options = $.extend({}, {
2164
+ minInterval: 0, // min allowed interval in milliseconds
2165
+ maxInterval: 0, // max allowed interval in milliseconds
2166
+ start: {}, // options for start picker
2167
+ end: {} // options for end picker
2168
+ }, options);
2169
+
2170
+ // for the mean time this fixes an issue with calling getDate with timepicker()
2171
+ var timeOnly = false;
2172
+ if(method === 'timepicker'){
2173
+ timeOnly = true;
2174
+ method = 'datetimepicker';
2175
+ }
2176
+
2177
+ function checkDates(changed, other) {
2178
+ var startdt = startTime[method]('getDate'),
2179
+ enddt = endTime[method]('getDate'),
2180
+ changeddt = changed[method]('getDate');
2181
+
2182
+ if (startdt !== null) {
2183
+ var minDate = new Date(startdt.getTime()),
2184
+ maxDate = new Date(startdt.getTime());
2185
+
2186
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2187
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2188
+
2189
+ if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2190
+ endTime[method]('setDate', minDate);
2191
+ }
2192
+ else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2193
+ endTime[method]('setDate', maxDate);
2194
+ }
2195
+ else if (startdt > enddt) {
2196
+ other[method]('setDate', changeddt);
2197
+ }
2198
+ }
2199
+ }
2200
+
2201
+ function selected(changed, other, option) {
2202
+ if (!changed.val()) {
2203
+ return;
2204
+ }
2205
+ var date = changed[method].call(changed, 'getDate');
2206
+ if (date !== null && options.minInterval > 0) {
2207
+ if (option === 'minDate') {
2208
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2209
+ }
2210
+ if (option === 'maxDate') {
2211
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2212
+ }
2213
+ }
2214
+
2215
+ if (date.getTime) {
2216
+ other[method].call(other, 'option', option, date);
2217
+ }
2218
+ }
2219
+
2220
+ $.fn[method].call(startTime, $.extend({
2221
+ timeOnly: timeOnly,
2222
+ onClose: function (dateText, inst) {
2223
+ checkDates($(this), endTime);
2224
+ },
2225
+ onSelect: function (selectedDateTime) {
2226
+ selected($(this), endTime, 'minDate');
2227
+ }
2228
+ }, options, options.start));
2229
+ $.fn[method].call(endTime, $.extend({
2230
+ timeOnly: timeOnly,
2231
+ onClose: function (dateText, inst) {
2232
+ checkDates($(this), startTime);
2233
+ },
2234
+ onSelect: function (selectedDateTime) {
2235
+ selected($(this), startTime, 'maxDate');
2236
+ }
2237
+ }, options, options.end));
2238
+
2239
+ checkDates(startTime, endTime);
2240
+
2241
+ selected(startTime, endTime, 'minDate');
2242
+ selected(endTime, startTime, 'maxDate');
2243
+
2244
+ return $([startTime.get(0), endTime.get(0)]);
2245
+ };
2246
+
2247
+ /**
2248
+ * Log error or data to the console during error or debugging
2249
+ * @param {Object} err pass any type object to log to the console during error or debugging
2250
+ * @return {void}
2251
+ */
2252
+ $.timepicker.log = function () {
2253
+ // Older IE (9, maybe 10) throw error on accessing `window.console.log.apply`, so check first.
2254
+ if (window.console && window.console.log && window.console.log.apply) {
2255
+ window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
2256
+ }
2257
+ };
2258
+
2259
+ /*
2260
+ * Add util object to allow access to private methods for testability.
2261
+ */
2262
+ $.timepicker._util = {
2263
+ _extendRemove: extendRemove,
2264
+ _isEmptyObject: isEmptyObject,
2265
+ _convert24to12: convert24to12,
2266
+ _detectSupport: detectSupport,
2267
+ _selectLocalTimezone: selectLocalTimezone,
2268
+ _computeEffectiveSetting: computeEffectiveSetting,
2269
+ _splitDateTime: splitDateTime,
2270
+ _parseDateTimeInternal: parseDateTimeInternal
2271
+ };
2272
+
2273
+ /*
2274
+ * Microsecond support
2275
+ */
2276
+ if (!Date.prototype.getMicroseconds) {
2277
+ Date.prototype.microseconds = 0;
2278
+ Date.prototype.getMicroseconds = function () { return this.microseconds; };
2279
+ Date.prototype.setMicroseconds = function (m) {
2280
+ this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2281
+ this.microseconds = m % 1000;
2282
+ return this;
2283
+ };
2284
+ }
2285
+
2286
+ /*
2287
+ * Keep up with the version
2288
+ */
2289
+ $.timepicker.version = "1.6.3";
2290
+
2291
+ }));
assets/js/admin/jquery-ui-timepicker-addon.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
2
+ * http://trentrichardson.com/examples/timepicker
3
+ * Copyright (c) 2016 Trent Richardson; Licensed MIT */
4
+ !function(a){"function"==typeof define&&define.amd?define(["jquery","jquery-ui"],a):a(jQuery)}(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.3"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(a){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(a,b){if($.isFunction(tp_inst._defaults.evnts.beforeShow))return tp_inst._defaults.evnts.beforeShow.call($input[0],a,b,tp_inst)},onChangeMonthYear:function(a,b,c){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],a,b,c,tp_inst)},onClose:function(a,b){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(b),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],a,b,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(a){return a.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(a){return a.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzi<tzl;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):(new Date).getTimezoneOffset()*-1,tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),tp_inst._defaults.altRedirectFocus===!0&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),0!==tp_inst._defaults.minDate&&0!==tp_inst._defaults.minDateTime||(tp_inst._defaults.minDate=new Date),0!==tp_inst._defaults.maxDate&&0!==tp_inst._defaults.maxDateTime||(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(a){var b=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(b),this._limitMinMaxDateTime(a,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(a,b){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),b||!this._defaults.timeOnly){var c=$.datepicker._get(this.inst,"dateFormat");try{var d=parseDateTimeInternal(c,this._defaults.timeFormat,a,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!d.timeObj)return!1;$.extend(this,d.timeObj)}catch(b){return $.timepicker.log("Error parsing the date/time string: "+b+"\ndate/time string = "+a+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+c),!1}return!0}var e=$.datepicker.parseTime(this._defaults.timeFormat,a,this._defaults);return!!e&&($.extend(this,e),!0)},_afterInject:function(){var a=this.inst.settings;$.isFunction(a.afterInject)&&a.afterInject.call(this)},_injectTimePicker:function(){var a=this.inst.dpDiv,b=this.inst.settings,c=this,d="",e="",f=null,g={},h={},i=null,j=0,k=0;if(0===a.find("div.ui-timepicker-div").length&&b.showTimepicker){var l=" ui_tpicker_unit_hide",m='<div class="ui-timepicker-div'+(b.isRTL?" ui-timepicker-rtl":"")+(b.oneLine&&"select"===b.controlType?" ui-timepicker-oneLine":"")+'"><dl><dt class="ui_tpicker_time_label'+(b.showTime?"":l)+'">'+b.timeText+'</dt><dd class="ui_tpicker_time '+(b.showTime?"":l)+'"><input class="ui_tpicker_time_input" '+(b.timeInput?"":"disabled")+"/></dd>";for(j=0,k=this.units.length;j<k;j++){if(d=this.units[j],e=d.substr(0,1).toUpperCase()+d.substr(1),f=null!==b["show"+e]?b["show"+e]:this.support[d],g[d]=parseInt(b[d+"Max"]-(b[d+"Max"]-b[d+"Min"])%b["step"+e],10),h[d]=0,m+='<dt class="ui_tpicker_'+d+"_label"+(f?"":l)+'">'+b[d+"Text"]+'</dt><dd class="ui_tpicker_'+d+(f?"":l)+'"><div class="ui_tpicker_'+d+"_slider"+(f?"":l)+'"></div>',f&&b[d+"Grid"]>0){if(m+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===d)for(var n=b[d+"Min"];n<=g[d];n+=parseInt(b[d+"Grid"],10)){h[d]++;var o=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:n},b);m+='<td data-for="'+d+'">'+o+"</td>"}else for(var p=b[d+"Min"];p<=g[d];p+=parseInt(b[d+"Grid"],10))h[d]++,m+='<td data-for="'+d+'">'+(p<10?"0":"")+p+"</td>";m+="</tr></table></div>"}m+="</dd>"}var q=null!==b.showTimezone?b.showTimezone:this.support.timezone;m+='<dt class="ui_tpicker_timezone_label'+(q?"":l)+'">'+b.timezoneText+"</dt>",m+='<dd class="ui_tpicker_timezone'+(q?"":l)+'"></dd>',m+="</dl></div>";var r=$(m);for(b.timeOnly===!0&&(r.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+b.timeOnlyTitle+"</div></div>"),a.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),j=0,k=c.units.length;j<k;j++)d=c.units[j],e=d.substr(0,1).toUpperCase()+d.substr(1),f=null!==b["show"+e]?b["show"+e]:this.support[d],c[d+"_slider"]=c.control.create(c,r.find(".ui_tpicker_"+d+"_slider"),d,c[d],b[d+"Min"],g[d],b["step"+e]),f&&b[d+"Grid"]>0&&(i=100*h[d]*b[d+"Grid"]/(g[d]-b[d+"Min"]),r.find(".ui_tpicker_"+d+" table").css({width:i+"%",marginLeft:b.isRTL?"0":i/(-2*h[d])+"%",marginRight:b.isRTL?i/(-2*h[d])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(a){var b=$(this),e=b.html(),f=parseInt(e.replace(/[^0-9]/g),10),g=e.replace(/[^apm]/gi),h=b.data("for");"hour"===h&&(g.indexOf("p")!==-1&&f<12?f+=12:g.indexOf("a")!==-1&&12===f&&(f=0)),c.control.value(c,c[h+"_slider"],d,f),c._onTimeChange(),c._onSelectHandler()}).css({cursor:"pointer",width:100/h[d]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=r.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(b.timezoneList,function(a,b){return $("<option />").val("object"==typeof a?a.value:a).text("object"==typeof a?a.label:a)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var s=new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset()*-1;s===this.timezone?selectLocalTimezone(c):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(b.timezone):selectLocalTimezone(c);this.timezone_select.change(function(){c._onTimeChange(),c._onSelectHandler(),c._afterInject()});var t=a.find(".ui-datepicker-buttonpane");if(t.length?t.before(r):a.append(r),this.$timeObj=r.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var a=c.inst.settings.timeFormat,b=$.datepicker.parseTime(a,this.value),d=new Date;b?(d.setHours(b.hour),d.setMinutes(b.minute),d.setSeconds(b.second),$.datepicker._setTime(c.inst,d)):(this.value=c.formattedTime,this.blur())}),null!==this.inst){var u=this.timeDefined;this._onTimeChange(),this.timeDefined=u}if(this._defaults.addSliderAccess){var v=this._defaults.sliderAccessArgs,w=this._defaults.isRTL;v.isRTL=w,setTimeout(function(){if(0===r.find(".ui-slider-access").length){r.find(".ui-slider:visible").sliderAccess(v);var a=r.find(".ui-slider-access:eq(0)").outerWidth(!0);a&&r.find("table:visible").each(function(){var b=$(this),c=b.outerWidth(),d=b.css(w?"marginRight":"marginLeft").toString().replace("%",""),e=c-a,f=d*e/c+"%",g={width:e,marginRight:0,marginLeft:0};g[w?"marginRight":"marginLeft"]=f,b.css(g)})}},10)}c._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(a,b){var c=this._defaults,d=new Date(a.selectedYear,a.selectedMonth,a.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(a,"minDateTime")&&void 0!==$.datepicker._get(a,"minDateTime")&&d){var e=$.datepicker._get(a,"minDateTime"),f=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0);null!==this.hourMinOriginal&&null!==this.minuteMinOriginal&&null!==this.secondMinOriginal&&null!==this.millisecMinOriginal&&null!==this.microsecMinOriginal||(this.hourMinOriginal=c.hourMin,this.minuteMinOriginal=c.minuteMin,this.secondMinOriginal=c.secondMin,this.millisecMinOriginal=c.millisecMin,this.microsecMinOriginal=c.microsecMin),a.settings.timeOnly||f.getTime()===d.getTime()?(this._defaults.hourMin=e.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=e.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=e.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=e.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=e.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(a,"maxDateTime")&&void 0!==$.datepicker._get(a,"maxDateTime")&&d){var g=$.datepicker._get(a,"maxDateTime"),h=new Date(g.getFullYear(),g.getMonth(),g.getDate(),0,0,0,0);null!==this.hourMaxOriginal&&null!==this.minuteMaxOriginal&&null!==this.secondMaxOriginal&&null!==this.millisecMaxOriginal||(this.hourMaxOriginal=c.hourMax,this.minuteMaxOriginal=c.minuteMax,this.secondMaxOriginal=c.secondMax,this.millisecMaxOriginal=c.millisecMax,this.microsecMaxOriginal=c.microsecMax),a.settings.timeOnly||h.getTime()===d.getTime()?(this._defaults.hourMax=g.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=g.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=g.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=g.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=g.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==a.settings.minTime){var i=new Date("01/01/1970 "+a.settings.minTime);this.hour<i.getHours()?(this.hour=this._defaults.hourMin=i.getHours(),this.minute=this._defaults.minuteMin=i.getMinutes()):this.hour===i.getHours()&&this.minute<i.getMinutes()?this.minute=this._defaults.minuteMin=i.getMinutes():this._defaults.hourMin<i.getHours()?(this._defaults.hourMin=i.getHours(),this._defaults.minuteMin=i.getMinutes()):this._defaults.hourMin===i.getHours()===this.hour&&this._defaults.minuteMin<i.getMinutes()?this._defaults.minuteMin=i.getMinutes():this._defaults.minuteMin=0}if(null!==a.settings.maxTime){var j=new Date("01/01/1970 "+a.settings.maxTime);this.hour>j.getHours()?(this.hour=this._defaults.hourMax=j.getHours(),this.minute=this._defaults.minuteMax=j.getMinutes()):this.hour===j.getHours()&&this.minute>j.getMinutes()?this.minute=this._defaults.minuteMax=j.getMinutes():this._defaults.hourMax>j.getHours()?(this._defaults.hourMax=j.getHours(),this._defaults.minuteMax=j.getMinutes()):this._defaults.hourMax===j.getHours()===this.hour&&this._defaults.minuteMax>j.getMinutes()?this._defaults.minuteMax=j.getMinutes():this._defaults.minuteMax=59}if(void 0!==b&&b===!0){var k=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),l=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),m=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),n=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),o=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:k,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:l,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:m,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:n,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:o,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var a=!!this.hour_slider&&this.control.value(this,this.hour_slider,"hour"),b=!!this.minute_slider&&this.control.value(this,this.minute_slider,"minute"),c=!!this.second_slider&&this.control.value(this,this.second_slider,"second"),d=!!this.millisec_slider&&this.control.value(this,this.millisec_slider,"millisec"),e=!!this.microsec_slider&&this.control.value(this,this.microsec_slider,"microsec"),f=!!this.timezone_select&&this.timezone_select.val(),g=this._defaults,h=g.pickerTimeFormat||g.timeFormat,i=g.pickerTimeSuffix||g.timeSuffix;"object"==typeof a&&(a=!1),"object"==typeof b&&(b=!1),"object"==typeof c&&(c=!1),"object"==typeof d&&(d=!1),"object"==typeof e&&(e=!1),"object"==typeof f&&(f=!1),a!==!1&&(a=parseInt(a,10)),b!==!1&&(b=parseInt(b,10)),c!==!1&&(c=parseInt(c,10)),d!==!1&&(d=parseInt(d,10)),e!==!1&&(e=parseInt(e,10)),f!==!1&&(f=f.toString());var j=g[a<12?"amNames":"pmNames"][0],k=a!==parseInt(this.hour,10)||b!==parseInt(this.minute,10)||c!==parseInt(this.second,10)||d!==parseInt(this.millisec,10)||e!==parseInt(this.microsec,10)||this.ampm.length>0&&a<12!=($.inArray(this.ampm.toUpperCase(),this.amNames)!==-1)||null!==this.timezone&&f!==this.timezone.toString();if(k&&(a!==!1&&(this.hour=a),b!==!1&&(this.minute=b),c!==!1&&(this.second=c),d!==!1&&(this.millisec=d),e!==!1&&(this.microsec=e),f!==!1&&(this.timezone=f),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=j),this.formattedTime=$.datepicker.formatTime(g.timeFormat,this,g),this.$timeObj&&(h===g.timeFormat?this.$timeObj.val(this.formattedTime+i):this.$timeObj.val($.datepicker.formatTime(h,this,g)+i),this.$timeObj[0].setSelectionRange)){var l=this.$timeObj[0].selectionStart,m=this.$timeObj[0].selectionEnd;this.$timeObj[0].setSelectionRange(l,m)}this.timeDefined=!0,k&&this._updateDateTime()}},_onSelectHandler:function(){var a=this._defaults.onSelect||this.inst.settings.onSelect,b=this.$input?this.$input[0]:null;a&&b&&a.apply(b,[this.formattedDateTime,this])},_updateDateTime:function(a){a=this.inst||a;var b=a.currentYear>0?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(a.selectedYear,a.selectedMonth,a.selectedDay),c=$.datepicker._daylightSavingAdjust(b),d=$.datepicker._get(a,"dateFormat"),e=$.datepicker._getFormatConfig(a),f=null!==c&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(d,null===c?new Date:c,e);var g=this.formattedDate;if(""===a.lastVal&&(a.currentYear=a.selectedYear,a.currentMonth=a.selectedMonth,a.currentDay=a.selectedDay),this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!1?g=this.formattedTime:(this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||f)||this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!0)&&(g+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=g,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(g);var h="",i=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,j=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(h=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===c?new Date:c,e):this.formattedDate,h&&(h+=i)),h+=null!==this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+j:this.formattedTime+j,this.$altInput.val(h)}else this.$input.val(g);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var a=$.datepicker._getInst(this.$input.get(0)),b=$.datepicker._get(a,"timepicker");if(b&&b._defaults.timeOnly&&a.input.val()!==a.lastVal)try{$.datepicker._updateDatepicker(a)}catch(a){$.timepicker.log(a)}}},_controls:{slider:{create:function(a,b,c,d,e,f,g){var h=a._defaults.isRTL;return b.prop("slide",null).slider({orientation:"horizontal",value:h?d*-1:d,min:h?f*-1:e,max:h?e*-1:f,step:g,slide:function(b,d){a.control.value(a,$(this),c,h?d.value*-1:d.value),a._onTimeChange()},stop:function(b,c){a._onSelectHandler()}})},options:function(a,b,c,d,e){if(a._defaults.isRTL){if("string"==typeof d)return"min"===d||"max"===d?void 0!==e?b.slider(d,e*-1):Math.abs(b.slider(d)):b.slider(d);var f=d.min,g=d.max;return d.min=d.max=null,void 0!==f&&(d.max=f*-1),void 0!==g&&(d.min=g*-1),b.slider(d)}return"string"==typeof d&&void 0!==e?b.slider(d,e):b.slider(d)},value:function(a,b,c,d){return a._defaults.isRTL?void 0!==d?b.slider("value",d*-1):Math.abs(b.slider("value")):void 0!==d?b.slider("value",d):b.slider("value")}},select:{create:function(a,b,c,d,e,f,g){for(var h='<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="'+c+'" data-min="'+e+'" data-max="'+f+'" data-step="'+g+'">',i=a._defaults.pickerTimeFormat||a._defaults.timeFormat,j=e;j<=f;j+=g)h+='<option value="'+j+'"'+(j===d?" selected":"")+">",h+="hour"===c?$.datepicker.formatTime($.trim(i.replace(/[^ht ]/gi,"")),{hour:j},a._defaults):"millisec"===c||"microsec"===c||j>=10?j:"0"+j.toString(),h+="</option>";return h+="</select>",b.children("select").remove(),$(h).appendTo(b).change(function(b){a._onTimeChange(),a._onSelectHandler(),a._afterInject()}),b},options:function(a,b,c,d,e){var f={},g=b.children("select");if("string"==typeof d){if(void 0===e)return g.data(d);f[d]=e}else f=d;return a.control.create(a,b,g.data("unit"),g.val(),f.min>=0?f.min:g.data("min"),f.max||g.data("max"),f.step||g.data("step"))},value:function(a,b,c,d){var e=b.children("select");return void 0!==d?e.val(d):e.val()}}}}),$.fn.extend({timepicker:function(a){a=a||{};var b=Array.prototype.slice.call(arguments);return"object"==typeof a&&(b[0]=$.extend(a,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),b)})},datetimepicker:function(a){a=a||{};var b=arguments;return"string"==typeof a?"getDate"===a||"option"===a&&2===b.length&&"string"==typeof b[1]?$.fn.datepicker.apply($(this[0]),b):this.each(function(){var a=$(this);a.datepicker.apply(a,b)}):this.each(function(){var b=$(this);b.datepicker($.timepicker._newInst(b,a)._defaults)})}}),$.datepicker.parseDateTime=function(a,b,c,d,e){var f=parseDateTimeInternal(a,b,c,d,e);if(f.timeObj){var g=f.timeObj;f.date.setHours(g.hour,g.minute,g.second,g.millisec),f.date.setMicroseconds(g.microsec)}return f.date},$.datepicker.parseTime=function(a,b,c){var d=extendRemove(extendRemove({},$.timepicker._defaults),c||{}),e=(a.replace(/\'.*?\'/g,"").indexOf("Z")!==-1,function(a,b,c){var d,e=function(a,b){var c=[];return a&&$.merge(c,a),b&&$.merge(c,b),c=$.map(c,function(a){return a.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+c.join("|")+")?"},f=function(a){var b=a.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),c={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(b)for(var d=0;d<b.length;d++)c[b[d].toString().charAt(0)]===-1&&(c[b[d].toString().charAt(0)]=d+1);return c},g="^"+a.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(a){var b=a.length;switch(a.charAt(0).toLowerCase()){case"h":return 1===b?"(\\d?\\d)":"(\\d{"+b+"})";case"m":return 1===b?"(\\d?\\d)":"(\\d{"+b+"})";case"s":return 1===b?"(\\d?\\d)":"(\\d{"+b+"})";case"l":return"(\\d?\\d?\\d)";case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return e(c.amNames,c.pmNames);default:return"("+a.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(a){return"\\"+a})+")?"}}).replace(/\s/g,"\\s?")+c.timeSuffix+"$",h=f(a),i="";d=b.match(new RegExp(g,"i"));var j={hour:0,minute:0,second:0,millisec:0,microsec:0};return!!d&&(h.t!==-1&&(void 0===d[h.t]||0===d[h.t].length?(i="",j.ampm=""):(i=$.inArray(d[h.t].toUpperCase(),$.map(c.amNames,function(a,b){return a.toUpperCase()}))!==-1?"AM":"PM",j.ampm=c["AM"===i?"amNames":"pmNames"][0])),h.h!==-1&&("AM"===i&&"12"===d[h.h]?j.hour=0:"PM"===i&&"12"!==d[h.h]?j.hour=parseInt(d[h.h],10)+12:j.hour=Number(d[h.h])),h.m!==-1&&(j.minute=Number(d[h.m])),h.s!==-1&&(j.second=Number(d[h.s])),h.l!==-1&&(j.millisec=Number(d[h.l])),h.c!==-1&&(j.microsec=Number(d[h.c])),h.z!==-1&&void 0!==d[h.z]&&(j.timezone=$.timepicker.timezoneOffsetNumber(d[h.z])),j)}),f=function(a,b,c){try{var d=new Date("2012-01-01 "+b);if(isNaN(d.getTime())&&(d=new Date("2012-01-01T"+b),isNaN(d.getTime())&&(d=new Date("01/01/2012 "+b),isNaN(d.getTime()))))throw"Unable to parse time with native Date: "+b;return{hour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),millisec:d.getMilliseconds(),microsec:d.getMicroseconds(),timezone:d.getTimezoneOffset()*-1}}catch(d){try{return e(a,b,c)}catch(c){$.timepicker.log("Unable to parse \ntimeString: "+b+"\ntimeFormat: "+a)}}return!1};return"function"==typeof d.parse?d.parse(a,b,d):"loose"===d.parse?f(a,b,d):e(a,b,d)},$.datepicker.formatTime=function(a,b,c){c=c||{},c=$.extend({},$.timepicker._defaults,c),b=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},b);var d=a,e=c.amNames[0],f=parseInt(b.hour,10);return f>11&&(e=c.pmNames[0]),d=d.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(a){switch(a){case"HH":return("0"+f).slice(-2);case"H":return f;case"hh":return("0"+convert24to12(f)).slice(-2);case"h":return convert24to12(f);case"mm":return("0"+b.minute).slice(-2);case"m":return b.minute;case"ss":return("0"+b.second).slice(-2);case"s":return b.second;case"l":return("00"+b.millisec).slice(-3);case"c":return("00"+b.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===b.timezone?c.timezone:b.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===b.timezone?c.timezone:b.timezone,!0);case"T":return e.charAt(0).toUpperCase();case"TT":return e.toUpperCase();case"t":return e.charAt(0).toLowerCase();case"tt":return e.toLowerCase();default:return a.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(a,b){var c,d=this._getInst($(a)[0]),e=this._get(d,"timepicker");e&&d.settings.showTimepicker?(e._limitMinMaxDateTime(d,!0),c=d.inline,d.inline=d.stay_open=!0,this._base_selectDate(a,b),d.inline=c,d.stay_open=!1,this._notifyChange(d),this._updateDatepicker(d)):this._base_selectDate(a,b)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(a){var b=a.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==a&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==b||"boolean"==typeof a.stay_open&&a.stay_open!==!1)){this._base_updateDatepicker(a);var c=this._get(a,"timepicker");c&&c._addTimePicker(a)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");if(c&&$.datepicker._get(b,"constrainInput")){var d=c.support.ampm,e=null!==c._defaults.showTimezone?c._defaults.showTimezone:c.support.timezone,f=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),g=c._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,d?"APM":"").replace(/Tt/g,d?"AaPpMm":"").replace(/tT/g,d?"AaPpMm":"").replace(/T/g,d?"AP":"").replace(/tt/g,d?"apm":"").replace(/t/g,d?"ap":"")+" "+c._defaults.separator+c._defaults.timeSuffix+(e?c._defaults.timezoneList.join(""):"")+c._defaults.amNames.join("")+c._defaults.pmNames.join("")+f,h=String.fromCharCode(void 0===a.charCode?a.keyCode:a.charCode);return a.ctrlKey||h<" "||!f||g.indexOf(h)>-1}return $.datepicker._base_doKeyPress(a)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(a){var b=this._get(a,"timepicker");if(b){var c=b._defaults.altField;if(c){var d=(b._defaults.altFormat||b._defaults.dateFormat,this._getDate(a)),e=$.datepicker._getFormatConfig(a),f="",g=b._defaults.altSeparator?b._defaults.altSeparator:b._defaults.separator,h=b._defaults.altTimeSuffix?b._defaults.altTimeSuffix:b._defaults.timeSuffix,i=null!==b._defaults.altTimeFormat?b._defaults.altTimeFormat:b._defaults.timeFormat;f+=$.datepicker.formatTime(i,b,b._defaults)+h,b._defaults.timeOnly||b._defaults.altFieldTimeOnly||null===d||(f=b._defaults.altFormat?$.datepicker.formatDate(b._defaults.altFormat,d,e)+g+f:b.formattedDate+g+f),$(c).val(a.input.val()?f:"")}}else $.datepicker._base_updateAlternate(a)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");
5
+ if(c&&c._defaults.timeOnly&&b.input.val()!==b.lastVal)try{$.datepicker._updateDatepicker(b)}catch(a){$.timepicker.log(a)}return $.datepicker._base_doKeyUp(a)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(a){var b=this._getInst($(a)[0]);this._base_gotoToday(a);var c=this._get(b,"timepicker");if(c){var d=$.timepicker.timezoneOffsetNumber(c.timezone),e=new Date;e.setMinutes(e.getMinutes()+e.getTimezoneOffset()+parseInt(d,10)),this._setTime(b,e),this._setDate(b,e),c._onSelectHandler()}},$.datepicker._disableTimepickerDatepicker=function(a){var b=this._getInst(a);if(b){var c=this._get(b,"timepicker");$(a).datepicker("getDate"),c&&(b.settings.showTimepicker=!1,c._defaults.showTimepicker=!1,c._updateDateTime(b))}},$.datepicker._enableTimepickerDatepicker=function(a){var b=this._getInst(a);if(b){var c=this._get(b,"timepicker");$(a).datepicker("getDate"),c&&(b.settings.showTimepicker=!0,c._defaults.showTimepicker=!0,c._addTimePicker(b),c._updateDateTime(b))}},$.datepicker._setTime=function(a,b){var c=this._get(a,"timepicker");if(c){var d=c._defaults;c.hour=b?b.getHours():d.hour,c.minute=b?b.getMinutes():d.minute,c.second=b?b.getSeconds():d.second,c.millisec=b?b.getMilliseconds():d.millisec,c.microsec=b?b.getMicroseconds():d.microsec,c._limitMinMaxDateTime(a,!0),c._onTimeChange(),c._updateDateTime(a)}},$.datepicker._setTimeDatepicker=function(a,b,c){var d=this._getInst(a);if(d){var e=this._get(d,"timepicker");if(e){this._setDateFromField(d);var f;b&&("string"==typeof b?(e._parseTime(b,c),f=new Date,f.setHours(e.hour,e.minute,e.second,e.millisec),f.setMicroseconds(e.microsec)):(f=new Date(b.getTime()),f.setMicroseconds(b.getMicroseconds())),"Invalid Date"===f.toString()&&(f=void 0),this._setTime(d,f))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(a,b){var c=this._getInst(a),d=b;if(c){"string"==typeof b&&(d=new Date(b),d.getTime()||(this._base_setDateDatepicker.apply(this,arguments),d=$(a).datepicker("getDate")));var e,f=this._get(c,"timepicker");d instanceof Date?(e=new Date(d.getTime()),e.setMicroseconds(d.getMicroseconds())):e=d,f&&e&&(f.support.timezone||null!==f._defaults.timezone||(f.timezone=e.getTimezoneOffset()*-1),d=$.timepicker.timezoneAdjust(d,$.timepicker.timezoneOffsetString(-d.getTimezoneOffset()),f.timezone),e=$.timepicker.timezoneAdjust(e,$.timepicker.timezoneOffsetString(-e.getTimezoneOffset()),f.timezone)),this._updateDatepicker(c),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(a,e,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(a,b){var c=this._getInst(a);if(c){var d=this._get(c,"timepicker");if(d){void 0===c.lastVal&&this._setDateFromField(c,b);var e=this._getDate(c),f=null;return f=d.$altInput&&d._defaults.altFieldTimeOnly?d.$input.val()+" "+d.$altInput.val():"INPUT"!==d.$input.get(0).tagName&&d.$altInput?d.$altInput.val():d.$input.val(),e&&d._parseTime(f,!c.settings.timeOnly)&&(e.setHours(d.hour,d.minute,d.second,d.millisec),e.setMicroseconds(d.microsec),null!=d.timezone&&(d.support.timezone||null!==d._defaults.timezone||(d.timezone=e.getTimezoneOffset()*-1),e=$.timepicker.timezoneAdjust(e,d.timezone,$.timepicker.timezoneOffsetString(-e.getTimezoneOffset())))),e}return this._base_getDateDatepicker(a,b)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(a,b,c){var d;try{d=this._base_parseDate(a,b,c)}catch(e){if(!(e.indexOf(":")>=0))throw e;d=this._base_parseDate(a,b.substring(0,b.length-(e.length-e.indexOf(":")-2)),c),$.timepicker.log("Error parsing the date string: "+e+"\ndate string = "+b+"\ndate format = "+a)}return d},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(a,b,c,d){var e=this._get(a,"timepicker");return e?(e._updateDateTime(a),e.$input.val()):this._base_formatDate(a)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(a,b,c){var d,e=this._getInst(a);if(!e)return null;var f=this._get(e,"timepicker");if(f){var g,h,i,j,k=null,l=null,m=null,n=f._defaults.evnts,o={};if("string"==typeof b){if("minDate"===b||"minDateTime"===b)k=c;else if("maxDate"===b||"maxDateTime"===b)l=c;else if("onSelect"===b)m=c;else if(n.hasOwnProperty(b)){if("undefined"==typeof c)return n[b];o[b]=c,d={}}}else if("object"==typeof b){b.minDate?k=b.minDate:b.minDateTime?k=b.minDateTime:b.maxDate?l=b.maxDate:b.maxDateTime&&(l=b.maxDateTime);for(g in n)n.hasOwnProperty(g)&&b[g]&&(o[g]=b[g])}for(g in o)o.hasOwnProperty(g)&&(n[g]=o[g],d||(d=$.extend({},b)),delete d[g]);if(d&&isEmptyObject(d))return;if(k?(k=0===k?new Date:new Date(k),f._defaults.minDate=k,f._defaults.minDateTime=k):l?(l=0===l?new Date:new Date(l),f._defaults.maxDate=l,f._defaults.maxDateTime=l):m&&(f._defaults.onSelect=m),k||l)return j=$(a),i=j.datetimepicker("getDate"),h=this._base_optionDatepicker.call($.datepicker,a,d||b,c),j.datetimepicker("setDate",i),h}return void 0===c?this._base_optionDatepicker.call($.datepicker,a,b):this._base_optionDatepicker.call($.datepicker,a,d||b,c)};var isEmptyObject=function(a){var b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0},extendRemove=function(a,b){$.extend(a,b);for(var c in b)null!==b[c]&&void 0!==b[c]||(a[c]=b[c]);return a},detectSupport=function(a){var b=a.replace(/'.*?'/g,"").toLowerCase(),c=function(a,b){return a.indexOf(b)!==-1};return{hour:c(b,"h"),minute:c(b,"m"),second:c(b,"s"),millisec:c(b,"l"),microsec:c(b,"c"),timezone:c(b,"z"),ampm:c(b,"t")&&c(a,"h"),iso8601:c(a,"Z")}},convert24to12=function(a){return a%=12,0===a&&(a=12),String(a)},computeEffectiveSetting=function(a,b){return a&&a[b]?a[b]:$.timepicker._defaults[b]},splitDateTime=function(a,b){var c=computeEffectiveSetting(b,"separator"),d=computeEffectiveSetting(b,"timeFormat"),e=d.split(c),f=e.length,g=a.split(c),h=g.length;return h>1?{dateString:g.splice(0,h-f).join(c),timeString:g.splice(0,f).join(c)}:{dateString:a,timeString:""}},parseDateTimeInternal=function(a,b,c,d,e){var f,g,h;if(g=splitDateTime(c,e),f=$.datepicker._base_parseDate(a,g.dateString,d),""===g.timeString)return{date:f};if(h=$.datepicker.parseTime(b,g.timeString,e),!h)throw"Wrong time format";return{date:f,timeObj:h}},selectLocalTimezone=function(a,b){if(a&&a.timezone_select){var c=b||new Date;a.timezone_select.val(-c.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(a,b){if(isNaN(a)||a>840||a<-720)return a;var c=a,d=c%60,e=(c-d)/60,f=b?":":"",g=(c>=0?"+":"-")+("0"+Math.abs(e)).slice(-2)+f+("0"+Math.abs(d)).slice(-2);return"+00:00"===g?"Z":g},$.timepicker.timezoneOffsetNumber=function(a){var b=a.toString().replace(":","");return"Z"===b.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(b)?("-"===b.substr(0,1)?-1:1)*(60*parseInt(b.substr(1,2),10)+parseInt(b.substr(3,2),10)):parseInt(a,10)},$.timepicker.timezoneAdjust=function(a,b,c){var d=$.timepicker.timezoneOffsetNumber(b),e=$.timepicker.timezoneOffsetNumber(c);return isNaN(e)||a.setMinutes(a.getMinutes()+-d- -e),a},$.timepicker.timeRange=function(a,b,c){return $.timepicker.handleRange("timepicker",a,b,c)},$.timepicker.datetimeRange=function(a,b,c){$.timepicker.handleRange("datetimepicker",a,b,c)},$.timepicker.dateRange=function(a,b,c){$.timepicker.handleRange("datepicker",a,b,c)},$.timepicker.handleRange=function(a,b,c,d){function e(e,f){var g=b[a]("getDate"),h=c[a]("getDate"),i=e[a]("getDate");if(null!==g){var j=new Date(g.getTime()),k=new Date(g.getTime());j.setMilliseconds(j.getMilliseconds()+d.minInterval),k.setMilliseconds(k.getMilliseconds()+d.maxInterval),d.minInterval>0&&j>h?c[a]("setDate",j):d.maxInterval>0&&k<h?c[a]("setDate",k):g>h&&f[a]("setDate",i)}}function f(b,c,e){if(b.val()){var f=b[a].call(b,"getDate");null!==f&&d.minInterval>0&&("minDate"===e&&f.setMilliseconds(f.getMilliseconds()+d.minInterval),"maxDate"===e&&f.setMilliseconds(f.getMilliseconds()-d.minInterval)),f.getTime&&c[a].call(c,"option",e,f)}}d=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},d);var g=!1;return"timepicker"===a&&(g=!0,a="datetimepicker"),$.fn[a].call(b,$.extend({timeOnly:g,onClose:function(a,b){e($(this),c)},onSelect:function(a){f($(this),c,"minDate")}},d,d.start)),$.fn[a].call(c,$.extend({timeOnly:g,onClose:function(a,c){e($(this),b)},onSelect:function(a){f($(this),b,"maxDate")}},d,d.end)),e(b,c),f(b,c,"minDate"),f(c,b,"maxDate"),$([b.get(0),c.get(0)])},$.timepicker.log=function(){window.console&&window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(a){return this.setMilliseconds(this.getMilliseconds()+Math.floor(a/1e3)),this.microseconds=a%1e3,this}),$.timepicker.version="1.6.3"}});
assets/js/admin/widgets.js CHANGED
@@ -65,6 +65,16 @@ jQuery( function ( $ ) {
65
  });
66
  }).trigger( 'flash-toolkit-init-media-preview' );
67
 
 
 
 
 
 
 
 
 
 
 
68
  // Availability options.
69
  $( document.body ).on( 'flash-toolkit-init-availability', function() {
70
  $( 'select.icon_chooser' ).change( function() {
65
  });
66
  }).trigger( 'flash-toolkit-init-media-preview' );
67
 
68
+ $( document.body ).on( 'panelsopen', function() {
69
+
70
+ $( 'input.flash-datetime-picker' ).each( function() {
71
+ $('input.flash-datetime-picker').datetimepicker({
72
+ dateFormat: 'yy-mm-dd ',
73
+ timeFormat: 'HH:mm'
74
+ });
75
+ });
76
+ });
77
+
78
  // Availability options.
79
  $( document.body ).on( 'flash-toolkit-init-availability', function() {
80
  $( 'select.icon_chooser' ).change( function() {
assets/js/admin/widgets.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){function b(a){var b=a.find(".tg-widget-repeater-field-items"),c=b.find("li.tg-widget-accordion-item"),d=wp.template("tg-widget-repeater-field-blank");c.length?(a.find(".tg-widget-repeater-field-button").show(),c.length<flashToolkitLocalizeScript.i18n_max_field_entries&&a.find(".tg-widget-repeater-field-button a").removeClass("disabled")):(a.find(".tg-widget-repeater-field-button").hide(),a.find(".tg-widget-repeater-field-blank-state").remove(),b.append(d))}function c(b){b.find(".tg-widget-repeater-field-items").sortable({items:"> li",handle:"> .accordion-top > .accordion-title",cursor:"move",axis:"y",distance:2,opacity:.65,scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,placeholder:"tg-widget-sortable-placeholder",start:function(b,c){var d=c.item.children(".accordion-inside");"block"===d.css("display")&&(c.item.removeClass("open"),d.hide(),a(this).sortable("refreshPositions"))},stop:function(a,b){b.item.removeAttr("style")}})}var d;a(document.body).on("click",".tg-image-upload",function(b){var c=a(this),e=c.parent().find(".tg-media-input"),f=c.parent().parent().find(".tg-media-preview");b.preventDefault(),d=wp.media.frames.media_file=wp.media({title:c.data("choose"),button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),library:wp.media.query({type:"image"})})]}),d.on("select",function(){var a=d.state().get("selection").first().toJSON();e.val(a.url),f.css({display:"none"}).find("img").remove(),f.css({display:"block"}).append('<img src="'+a.url+'">')}),d.open()}),a(document.body).on("click",".tg-media-remove",function(){var b=a(this).closest(".media-uploader");return b.find(".tg-media-input").val(""),b.find(".tg-media-preview").css({display:"none"}).find("img").remove(),!1}),a(document.body).on("flash-toolkit-init-media-preview",function(){a("input.tg-media-input").each(function(){var b=a(this).val(),c=a(this).parent().siblings(".tg-media-preview");""!==b&&(c.find("img.tg-media-preview-default").remove(),c.css({display:"block"}).append('<img src="'+b+'">'))})}).trigger("flash-toolkit-init-media-preview"),a(document.body).on("flash-toolkit-init-availability",function(){a("select.icon_chooser").change(function(){"image"===a(this).val()?(a(this).closest("p").next(".show_if_icon").hide(),a(this).closest("p").next().next(".show_if_image").show()):(a(this).closest("p").next(".show_if_icon").show(),a(this).closest("p").next().next(".show_if_image").hide())}).change(),a("select.media_chooser").change(function(){"image"===a(this).val()?(a(this).closest(".widget-content").find(".show_if_image").show(),a(this).closest(".widget-content").find(".show_if_video").closest("p").hide()):(a(this).closest(".widget-content").find(".show_if_image").hide(),a(this).closest(".widget-content").find(".show_if_video").closest("p").show())}).change(),a("select.filter_availability").change(function(){"0"===a(this).val()?a(this).closest(".widget-content").find(".show_if_all_category").closest("p").show():a(this).closest(".widget-content").find(".show_if_all_category").closest("p").hide()}).change(),a("select.availability").change(function(){"latest"===a(this).val()?a(this).closest("p").next("p").hide():a(this).closest("p").next("p").show()}).change(),a("input.availability").change(function(){a(this).is(":checked")?a(this).closest("p").next("p").hide():a(this).closest("p").next("p").show()}).change()}).trigger("flash-toolkit-init-availability"),a(document.body).on("flash-toolkit-init-accordion-title",function(){a(".tg-widget-repeater-field-items").children("li").each(function(){var b=a('input[id*="-title"]',this).val()||"";b&&(b=": "+b.replace(/<[^<>]+>/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;")),a(this).children(".accordion-top").children(".accordion-title").children().children(".in-accordion-title").html(b)})}).trigger("flash-toolkit-init-accordion-title"),a(document.body).on("click",".tg-widget-repeater-field-add",function(b){if(b.preventDefault(),a(this).is(".disabled"))return void window.alert(flashToolkitLocalizeScript.i18n_max_field_message);var c=a(this).parents(".widget-content"),d=c.find("li.tg-widget-accordion-item").length+1,e=c.find(".tg-widget-repeater-field-items").data("widget_id"),f=wp.template("tg-widget-repeater-field-"+e);c.find("li.tg-widget-accordion-item").each(function(b,c){d===parseInt(a(c).data("id").replace(/[^0-9\.]/g,""),10)&&d++}),c.find(".tg-widget-repeater-field-button").show(),c.find(".tg-widget-repeater-field-blank-state").remove(),c.find(".tg-widget-repeater-field-items").append(f({field_id:d})),d>=flashToolkitLocalizeScript.i18n_max_field_entries&&c.find(".tg-widget-repeater-field-button a").addClass("disabled")}),a(document.body).on("click.accordion-toggle",function(c){var d,e,f,g=a(c.target);g.parents(".accordion-top").length&&!g.parents("#available-fields").length?(d=g.closest("li.tg-widget-accordion-item"),e=d.children(".accordion-inside"),e.is(":hidden")?(d.addClass("open"),e.slideDown("fast")):e.slideUp("fast",function(){d.attr("style",""),d.removeClass("open")}),c.preventDefault()):g.hasClass("accordion-control-close")?(d=g.closest("li.tg-widget-accordion-item"),d.children(".accordion-inside").slideUp("fast",function(){d.attr("style",""),d.removeClass("open")}),c.preventDefault()):g.hasClass("accordion-control-remove")&&(d=g.closest("li.tg-widget-accordion-item"),f=g.parents(".widget[id*=themegrill_flash], .widget-content"),d.remove(),b(f),c.preventDefault())}),a(document.body).on("panelsopen",function(d){var e=a(d.target);return!!e.has(".tg-widget-repeater-field-items")&&(e.addClass("widget-content"),b(e),c(e),a(document.body).trigger("flash-enhanced-select-init"),a(document.body).trigger("flash-toolkit-init-availability"),a(document.body).trigger("flash-toolkit-init-media-preview"),void a(document.body).trigger("flash-toolkit-init-accordion-title"))}),a(document.body).on("click",".so-close",function(){a(document.body).trigger("flash-toolkit-init-accordion-title")}),a(document.body).on("click","div.widget[id*=themegrill_flash] .widget-title, div.widget[id*=themegrill_flash] .widget-title-action",function(){a(this).parents("#available-widgets").length||(b(a(this).parents(".widget[id*=themegrill_flash]")),c(a(this).parents(".widget[id*=themegrill_flash]")))}),a(document).on("widget-added widget-updated",function(d,e){e.is("[id*=themegrill_flash]")&&(d.preventDefault(),b(e),c(e),a(document.body).trigger("flash-enhanced-select-init"),a(document.body).trigger("flash-toolkit-init-availability"),a(document.body).trigger("flash-toolkit-init-media-preview"),a(document.body).trigger("flash-toolkit-init-accordion-title"))})});
1
+ jQuery(function(a){function b(a){var b=a.find(".tg-widget-repeater-field-items"),c=b.find("li.tg-widget-accordion-item"),d=wp.template("tg-widget-repeater-field-blank");c.length?(a.find(".tg-widget-repeater-field-button").show(),c.length<flashToolkitLocalizeScript.i18n_max_field_entries&&a.find(".tg-widget-repeater-field-button a").removeClass("disabled")):(a.find(".tg-widget-repeater-field-button").hide(),a.find(".tg-widget-repeater-field-blank-state").remove(),b.append(d))}function c(b){b.find(".tg-widget-repeater-field-items").sortable({items:"> li",handle:"> .accordion-top > .accordion-title",cursor:"move",axis:"y",distance:2,opacity:.65,scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,placeholder:"tg-widget-sortable-placeholder",start:function(b,c){var d=c.item.children(".accordion-inside");"block"===d.css("display")&&(c.item.removeClass("open"),d.hide(),a(this).sortable("refreshPositions"))},stop:function(a,b){b.item.removeAttr("style")}})}var d;a(document.body).on("click",".tg-image-upload",function(b){var c=a(this),e=c.parent().find(".tg-media-input"),f=c.parent().parent().find(".tg-media-preview");b.preventDefault(),d=wp.media.frames.media_file=wp.media({title:c.data("choose"),button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),library:wp.media.query({type:"image"})})]}),d.on("select",function(){var a=d.state().get("selection").first().toJSON();e.val(a.url),f.css({display:"none"}).find("img").remove(),f.css({display:"block"}).append('<img src="'+a.url+'">')}),d.open()}),a(document.body).on("click",".tg-media-remove",function(){var b=a(this).closest(".media-uploader");return b.find(".tg-media-input").val(""),b.find(".tg-media-preview").css({display:"none"}).find("img").remove(),!1}),a(document.body).on("flash-toolkit-init-media-preview",function(){a("input.tg-media-input").each(function(){var b=a(this).val(),c=a(this).parent().siblings(".tg-media-preview");""!==b&&(c.find("img.tg-media-preview-default").remove(),c.css({display:"block"}).append('<img src="'+b+'">'))})}).trigger("flash-toolkit-init-media-preview"),a(document.body).on("panelsopen",function(){a("input.flash-datetime-picker").each(function(){a("input.flash-datetime-picker").datetimepicker({dateFormat:"yy-mm-dd ",timeFormat:"HH:mm"})})}),a(document.body).on("flash-toolkit-init-availability",function(){a("select.icon_chooser").change(function(){"image"===a(this).val()?(a(this).closest("p").next(".show_if_icon").hide(),a(this).closest("p").next().next(".show_if_image").show()):(a(this).closest("p").next(".show_if_icon").show(),a(this).closest("p").next().next(".show_if_image").hide())}).change(),a("select.media_chooser").change(function(){"image"===a(this).val()?(a(this).closest(".widget-content").find(".show_if_image").show(),a(this).closest(".widget-content").find(".show_if_video").closest("p").hide()):(a(this).closest(".widget-content").find(".show_if_image").hide(),a(this).closest(".widget-content").find(".show_if_video").closest("p").show())}).change(),a("select.filter_availability").change(function(){"0"===a(this).val()?a(this).closest(".widget-content").find(".show_if_all_category").closest("p").show():a(this).closest(".widget-content").find(".show_if_all_category").closest("p").hide()}).change(),a("select.availability").change(function(){"latest"===a(this).val()?a(this).closest("p").next("p").hide():a(this).closest("p").next("p").show()}).change(),a("input.availability").change(function(){a(this).is(":checked")?a(this).closest("p").next("p").hide():a(this).closest("p").next("p").show()}).change()}).trigger("flash-toolkit-init-availability"),a(document.body).on("flash-toolkit-init-accordion-title",function(){a(".tg-widget-repeater-field-items").children("li").each(function(){var b=a('input[id*="-title"]',this).val()||"";b&&(b=": "+b.replace(/<[^<>]+>/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;")),a(this).children(".accordion-top").children(".accordion-title").children().children(".in-accordion-title").html(b)})}).trigger("flash-toolkit-init-accordion-title"),a(document.body).on("click",".tg-widget-repeater-field-add",function(b){if(b.preventDefault(),a(this).is(".disabled"))return void window.alert(flashToolkitLocalizeScript.i18n_max_field_message);var c=a(this).parents(".widget-content"),d=c.find("li.tg-widget-accordion-item").length+1,e=c.find(".tg-widget-repeater-field-items").data("widget_id"),f=wp.template("tg-widget-repeater-field-"+e);c.find("li.tg-widget-accordion-item").each(function(b,c){d===parseInt(a(c).data("id").replace(/[^0-9\.]/g,""),10)&&d++}),c.find(".tg-widget-repeater-field-button").show(),c.find(".tg-widget-repeater-field-blank-state").remove(),c.find(".tg-widget-repeater-field-items").append(f({field_id:d})),d>=flashToolkitLocalizeScript.i18n_max_field_entries&&c.find(".tg-widget-repeater-field-button a").addClass("disabled")}),a(document.body).on("click.accordion-toggle",function(c){var d,e,f,g=a(c.target);g.parents(".accordion-top").length&&!g.parents("#available-fields").length?(d=g.closest("li.tg-widget-accordion-item"),e=d.children(".accordion-inside"),e.is(":hidden")?(d.addClass("open"),e.slideDown("fast")):e.slideUp("fast",function(){d.attr("style",""),d.removeClass("open")}),c.preventDefault()):g.hasClass("accordion-control-close")?(d=g.closest("li.tg-widget-accordion-item"),d.children(".accordion-inside").slideUp("fast",function(){d.attr("style",""),d.removeClass("open")}),c.preventDefault()):g.hasClass("accordion-control-remove")&&(d=g.closest("li.tg-widget-accordion-item"),f=g.parents(".widget[id*=themegrill_flash], .widget-content"),d.remove(),b(f),c.preventDefault())}),a(document.body).on("panelsopen",function(d){var e=a(d.target);return!!e.has(".tg-widget-repeater-field-items")&&(e.addClass("widget-content"),b(e),c(e),a(document.body).trigger("flash-enhanced-select-init"),a(document.body).trigger("flash-toolkit-init-availability"),a(document.body).trigger("flash-toolkit-init-media-preview"),void a(document.body).trigger("flash-toolkit-init-accordion-title"))}),a(document.body).on("click",".so-close",function(){a(document.body).trigger("flash-toolkit-init-accordion-title")}),a(document.body).on("click","div.widget[id*=themegrill_flash] .widget-title, div.widget[id*=themegrill_flash] .widget-title-action",function(){a(this).parents("#available-widgets").length||(b(a(this).parents(".widget[id*=themegrill_flash]")),c(a(this).parents(".widget[id*=themegrill_flash]")))}),a(document).on("widget-added widget-updated",function(d,e){e.is("[id*=themegrill_flash]")&&(d.preventDefault(),b(e),c(e),a(document.body).trigger("flash-enhanced-select-init"),a(document.body).trigger("flash-toolkit-init-availability"),a(document.body).trigger("flash-toolkit-init-media-preview"),a(document.body).trigger("flash-toolkit-init-accordion-title"))})});
assets/js/select2/select2.js CHANGED
@@ -1,3748 +1,5725 @@
1
- /*
2
- Copyright 2012 Igor Vaynberg
3
-
4
- Version: 3.5.4 Timestamp: Sun Aug 30 13:30:32 EDT 2015
5
-
6
- This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
- General Public License version 2 (the "GPL License"). You may choose either license to govern your
8
- use of this software only upon the condition that you accept all of the terms of either the Apache
9
- License or the GPL License.
10
-
11
- You may obtain a copy of the Apache License and the GPL License at:
12
-
13
- http://www.apache.org/licenses/LICENSE-2.0
14
- http://www.gnu.org/licenses/gpl-2.0.html
15
-
16
- Unless required by applicable law or agreed to in writing, software distributed under the
17
- Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
18
- CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
19
- the specific language governing permissions and limitations under the Apache License and the GPL License.
20
- */
21
- (function ($) {
22
- if(typeof $.fn.each2 == "undefined") {
23
- $.extend($.fn, {
24
- /*
25
- * 4-10 times faster .each replacement
26
- * use it carefully, as it overrides jQuery context of element on each iteration
27
- */
28
- each2 : function (c) {
29
- var j = $([0]), i = -1, l = this.length;
30
- while (
31
- ++i < l
32
- && (j.context = j[0] = this[i])
33
- && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
34
- );
35
- return this;
36
- }
37
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
39
- })(jQuery);
40
 
41
- (function ($, undefined) {
42
- "use strict";
43
- /*global document, window, jQuery, console */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- if (window.Select2 !== undefined) {
46
- return;
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- var AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
50
- lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
51
-
52
- KEY = {
53
- TAB: 9,
54
- ENTER: 13,
55
- ESC: 27,
56
- SPACE: 32,
57
- LEFT: 37,
58
- UP: 38,
59
- RIGHT: 39,
60
- DOWN: 40,
61
- SHIFT: 16,
62
- CTRL: 17,
63
- ALT: 18,
64
- PAGE_UP: 33,
65
- PAGE_DOWN: 34,
66
- HOME: 36,
67
- END: 35,
68
- BACKSPACE: 8,
69
- DELETE: 46,
70
- isArrow: function (k) {
71
- k = k.which ? k.which : k;
72
- switch (k) {
73
- case KEY.LEFT:
74
- case KEY.RIGHT:
75
- case KEY.UP:
76
- case KEY.DOWN:
77
- return true;
78
- }
79
- return false;
80
- },
81
- isControl: function (e) {
82
- var k = e.which;
83
- switch (k) {
84
- case KEY.SHIFT:
85
- case KEY.CTRL:
86
- case KEY.ALT:
87
- return true;
88
  }
89
-
90
- if (e.metaKey) return true;
91
-
92
- return false;
93
- },
94
- isFunctionKey: function (k) {
95
- k = k.which ? k.which : k;
96
- return k >= 112 && k <= 123;
97
  }
98
- },
99
- MEASURE_SCROLLBAR_TEMPLATE = "<div class='select2-measure-scrollbar'></div>",
100
-
101
- DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};
102
-
103
- $document = $(document);
104
 
105
- nextUid=(function() { var counter=1; return function() { return counter++; }; }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
 
 
 
107
 
108
- function reinsertElement(element) {
109
- var placeholder = $(document.createTextNode(''));
 
 
 
 
 
 
110
 
111
- element.before(placeholder);
112
- placeholder.before(element);
113
- placeholder.remove();
114
- }
115
 
116
- function stripDiacritics(str) {
117
- // Used 'uni range + named function' from http://jsperf.com/diacritics/18
118
- function match(a) {
119
- return DIACRITICS[a] || a;
120
  }
121
 
122
- return str.replace(/[^\u0000-\u007E]/g, match);
123
  }
124
 
125
- function indexOf(value, array) {
126
- var i = 0, l = array.length;
127
- for (; i < l; i = i + 1) {
128
- if (equal(value, array[i])) return i;
129
- }
130
- return -1;
 
 
 
 
 
 
 
 
 
131
  }
132
 
133
- function measureScrollbar () {
134
- var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
135
- $template.appendTo(document.body);
 
 
136
 
137
- var dim = {
138
- width: $template.width() - $template[0].clientWidth,
139
- height: $template.height() - $template[0].clientHeight
140
  };
141
- $template.remove();
 
 
 
 
 
 
 
 
142
 
143
- return dim;
 
 
 
144
  }
145
 
146
- /**
147
- * Compares equality of a and b
148
- * @param a
149
- * @param b
150
- */
151
- function equal(a, b) {
152
- if (a === b) return true;
153
- if (a === undefined || b === undefined) return false;
154
- if (a === null || b === null) return false;
155
- // Check whether 'a' or 'b' is a string (primitive or object).
156
- // The concatenation of an empty string (+'') converts its argument to a string's primitive.
157
- if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
158
- if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
159
- return false;
160
  }
161
 
162
  /**
163
- * Splits the string into an array of values, transforming each value. An empty array is returned for nulls or empty
164
- * strings
165
- * @param string
166
- * @param separator
167
  */
168
- function splitVal(string, separator, transform) {
169
- var val, i, l;
170
- if (string === null || string.length < 1) return [];
171
- val = string.split(separator);
172
- for (i = 0, l = val.length; i < l; i = i + 1) val[i] = transform(val[i]);
173
- return val;
174
- }
175
 
176
- function getSideBorderPadding(element) {
177
- return element.outerWidth(false) - element.width();
178
- }
 
 
 
179
 
180
- function installKeyUpChangeEvent(element) {
181
- var key="keyup-change-value";
182
- element.on("keydown", function () {
183
- if ($.data(element, key) === undefined) {
184
- $.data(element, key, element.val());
 
185
  }
186
- });
187
- element.on("keyup", function () {
188
- var val= $.data(element, key);
189
- if (val !== undefined && element.val() !== val) {
190
- $.removeData(element, key);
191
- element.trigger("keyup-change");
 
192
  }
193
- });
194
- }
195
-
196
 
197
- /**
198
- * filters mouse events so an event is fired only if the mouse moved.
199
- *
200
- * filters out mouse events that occur when mouse is stationary but
201
- * the elements under the pointer are scrolled.
202
- */
203
- function installFilteredMouseMove(element) {
204
- element.on("mousemove", function (e) {
205
- var lastpos = lastMousePosition;
206
- if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
207
- $(e.target).trigger("mousemove-filtered", e);
208
- }
209
- });
210
- }
211
 
212
- /**
213
- * Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
214
- * within the last quietMillis milliseconds.
215
- *
216
- * @param quietMillis number of milliseconds to wait before invoking fn
217
- * @param fn function to be debounced
218
- * @param ctx object to be used as this reference within fn
219
- * @return debounced version of fn
220
- */
221
- function debounce(quietMillis, fn, ctx) {
222
- ctx = ctx || undefined;
223
- var timeout;
224
  return function () {
225
- var args = arguments;
226
- window.clearTimeout(timeout);
227
- timeout = window.setTimeout(function() {
228
- fn.apply(ctx, args);
229
- }, quietMillis);
230
  };
231
  }
232
 
233
- function installDebouncedScroll(threshold, element) {
234
- var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
235
- element.on("scroll", function (e) {
236
- if (indexOf(e.target, element.get()) >= 0) notify(e);
237
- });
238
- }
239
-
240
- function focus($el) {
241
- if ($el[0] === document.activeElement) return;
242
-
243
- /* set the focus in a 0 timeout - that way the focus is set after the processing
244
- of the current event has finished - which seems like the only reliable way
245
- to set focus */
246
- window.setTimeout(function() {
247
- var el=$el[0], pos=$el.val().length, range;
248
-
249
- $el.focus();
250
-
251
- /* make sure el received focus so we do not error out when trying to manipulate the caret.
252
- sometimes modals or others listeners may steal it after its set */
253
- var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
254
- if (isVisible && el === document.activeElement) {
255
-
256
- /* after the focus is set move the caret to the end, necessary when we val()
257
- just before setting focus */
258
- if(el.setSelectionRange)
259
- {
260
- el.setSelectionRange(pos, pos);
261
- }
262
- else if (el.createTextRange) {
263
- range = el.createTextRange();
264
- range.collapse(false);
265
- range.select();
266
- }
267
  }
268
- }, 0);
269
- }
270
-
271
- function getCursorInfo(el) {
272
- el = $(el)[0];
273
- var offset = 0;
274
- var length = 0;
275
- if ('selectionStart' in el) {
276
- offset = el.selectionStart;
277
- length = el.selectionEnd - offset;
278
- } else if ('selection' in document) {
279
- el.focus();
280
- var sel = document.selection.createRange();
281
- length = document.selection.createRange().text.length;
282
- sel.moveStart('character', -el.value.length);
283
- offset = sel.text.length - length;
284
- }
285
- return { offset: offset, length: length };
286
- }
287
-
288
- function killEvent(event) {
289
- event.preventDefault();
290
- event.stopPropagation();
291
- }
292
- function killEventImmediately(event) {
293
- event.preventDefault();
294
- event.stopImmediatePropagation();
295
- }
296
-
297
- function measureTextWidth(e) {
298
- if (!sizer){
299
- var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
300
- sizer = $(document.createElement("div")).css({
301
- position: "absolute",
302
- left: "-10000px",
303
- top: "-10000px",
304
- display: "none",
305
- fontSize: style.fontSize,
306
- fontFamily: style.fontFamily,
307
- fontStyle: style.fontStyle,
308
- fontWeight: style.fontWeight,
309
- letterSpacing: style.letterSpacing,
310
- textTransform: style.textTransform,
311
- whiteSpace: "nowrap"
312
- });
313
- sizer.attr("class","select2-sizer");
314
- $(document.body).append(sizer);
315
  }
316
- sizer.text(e.val());
317
- return sizer.width();
318
- }
319
-
320
- function syncCssClasses(dest, src, adapter) {
321
- var classes, replacements = [], adapted;
322
-
323
- classes = $.trim(dest.attr("class"));
324
-
325
- if (classes) {
326
- classes = '' + classes; // for IE which returns object
327
 
328
- $(classes.split(/\s+/)).each2(function() {
329
- if (this.indexOf("select2-") === 0) {
330
- replacements.push(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
332
- });
333
- }
334
-
335
- classes = $.trim(src.attr("class"));
336
-
337
- if (classes) {
338
- classes = '' + classes; // for IE which returns object
339
 
340
- $(classes.split(/\s+/)).each2(function() {
341
- if (this.indexOf("select2-") !== 0) {
342
- adapted = adapter(this);
343
 
344
- if (adapted) {
345
- replacements.push(adapted);
346
- }
 
 
 
 
 
 
 
347
  }
348
- });
 
 
 
 
349
  }
 
350
 
351
- dest.attr("class", replacements.join(" "));
352
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
 
 
 
 
 
 
 
 
 
 
 
354
 
355
- function markMatch(text, term, markup, escapeMarkup) {
356
- var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),
357
- tl=term.length;
358
 
359
- if (match<0) {
360
- markup.push(escapeMarkup(text));
361
- return;
 
 
362
  }
363
 
364
- markup.push(escapeMarkup(text.substring(0, match)));
365
- markup.push("<span class='select2-match'>");
366
- markup.push(escapeMarkup(text.substring(match, match + tl)));
367
- markup.push("</span>");
368
- markup.push(escapeMarkup(text.substring(match + tl, text.length)));
369
- }
370
-
371
- function defaultEscapeMarkup(markup) {
372
- var replace_map = {
373
- '\\': '&#92;',
374
- '&': '&amp;',
375
- '<': '&lt;',
376
- '>': '&gt;',
377
- '"': '&quot;',
378
- "'": '&#39;',
379
- "/": '&#47;'
380
- };
381
 
382
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
383
- return replace_map[match];
384
- });
385
- }
386
 
387
  /**
388
- * Produces an ajax-based query function
389
- *
390
- * @param options object containing configuration parameters
391
- * @param options.params parameter map for the transport ajax call, can contain such options as cache, jsonpCallback, etc. see $.ajax
392
- * @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
393
- * @param options.url url for the data
394
- * @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
395
- * @param options.dataType request data type: ajax, jsonp, other datatypes supported by jQuery's $.ajax function or the transport function if specified
396
- * @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
397
- * @param options.results a function(remoteData, pageNumber, query) that converts data returned form the remote request to the format expected by Select2.
398
- * The expected format is an object containing the following keys:
399
- * results array of objects that will be used as choices
400
- * more (optional) boolean indicating whether there are more results available
401
- * Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
402
  */
403
- function ajax(options) {
404
- var timeout, // current scheduled but not yet executed request
405
- handler = null,
406
- quietMillis = options.quietMillis || 100,
407
- ajaxUrl = options.url,
408
- self = this;
409
-
410
- return function (query) {
411
- window.clearTimeout(timeout);
412
- timeout = window.setTimeout(function () {
413
- var data = options.data, // ajax data function
414
- url = ajaxUrl, // ajax url string or function
415
- transport = options.transport || $.fn.select2.ajaxDefaults.transport,
416
- // deprecated - to be removed in 4.0 - use params instead
417
- deprecated = {
418
- type: options.type || 'GET', // set type of request (GET or POST)
419
- cache: options.cache || false,
420
- jsonpCallback: options.jsonpCallback||undefined,
421
- dataType: options.dataType||"json"
422
- },
423
- params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
424
-
425
- data = data ? data.call(self, query.term, query.page, query.context) : null;
426
- url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
427
-
428
- if (handler && typeof handler.abort === "function") { handler.abort(); }
429
-
430
- if (options.params) {
431
- if ($.isFunction(options.params)) {
432
- $.extend(params, options.params.call(self));
433
- } else {
434
- $.extend(params, options.params);
435
- }
436
- }
437
-
438
- $.extend(params, {
439
- url: url,
440
- dataType: options.dataType,
441
- data: data,
442
- success: function (data) {
443
- // TODO - replace query.page with query so users have access to term, page, etc.
444
- // added query as third paramter to keep backwards compatibility
445
- var results = options.results(data, query.page, query);
446
- query.callback(results);
447
- },
448
- error: function(jqXHR, textStatus, errorThrown){
449
- var results = {
450
- hasError: true,
451
- jqXHR: jqXHR,
452
- textStatus: textStatus,
453
- errorThrown: errorThrown
454
- };
455
-
456
- query.callback(results);
457
- }
458
- });
459
- handler = transport.call(self, params);
460
- }, quietMillis);
461
- };
462
- }
463
 
464
  /**
465
- * Produces a query function that works with a local array
466
- *
467
- * @param options object containing configuration parameters. The options parameter can either be an array or an
468
- * object.
469
- *
470
- * If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
471
- *
472
- * If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
473
- * an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
474
- * key can either be a String in which case it is expected that each element in the 'data' array has a key with the
475
- * value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
476
- * the text.
477
  */
478
- function local(options) {
479
- var data = options, // data elements
480
- dataText,
481
- tmp,
482
- text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
483
-
484
- if ($.isArray(data)) {
485
- tmp = data;
486
- data = { results: tmp };
487
- }
488
 
489
- if ($.isFunction(data) === false) {
490
- tmp = data;
491
- data = function() { return tmp; };
492
  }
493
 
494
- var dataItem = data();
495
- if (dataItem.text) {
496
- text = dataItem.text;
497
- // if text is not a function we assume it to be a key name
498
- if (!$.isFunction(text)) {
499
- dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
500
- text = function (item) { return item[dataText]; };
501
- }
502
  }
503
 
504
- return function (query) {
505
- var t = query.term, filtered = { results: [] }, process;
506
- if (t === "") {
507
- query.callback(data());
508
- return;
509
- }
510
-
511
- process = function(datum, collection) {
512
- var group, attr;
513
- datum = datum[0];
514
- if (datum.children) {
515
- group = {};
516
- for (attr in datum) {
517
- if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
518
- }
519
- group.children=[];
520
- $(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
521
- if (group.children.length || query.matcher(t, text(group), datum)) {
522
- collection.push(group);
523
- }
524
- } else {
525
- if (query.matcher(t, text(datum), datum)) {
526
- collection.push(datum);
527
- }
528
- }
529
- };
530
-
531
- $(data().results).each2(function(i, datum) { process(datum, filtered.results); });
532
- query.callback(filtered);
533
- };
534
- }
535
 
536
- // TODO javadoc
537
- function tags(data) {
538
- var isFunc = $.isFunction(data);
539
- return function (query) {
540
- var t = query.term, filtered = {results: []};
541
- var result = isFunc ? data(query) : data;
542
- if ($.isArray(result)) {
543
- $(result).each(function () {
544
- var isObject = this.text !== undefined,
545
- text = isObject ? this.text : this;
546
- if (t === "" || query.matcher(t, text)) {
547
- filtered.results.push(isObject ? this : {id: this, text: this});
548
- }
549
- });
550
- query.callback(filtered);
551
- }
552
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  }
554
 
555
- /**
556
- * Checks if the formatter function should be used.
557
- *
558
- * Throws an error if it is not a function. Returns true if it should be used,
559
- * false if no formatting should be performed.
560
- *
561
- * @param formatter
562
- */
563
- function checkFormatter(formatter, formatterName) {
564
- if ($.isFunction(formatter)) return true;
565
- if (!formatter) return false;
566
- if (typeof(formatter) === 'string') return true;
567
- throw new Error(formatterName +" must be a string, function, or falsy value");
568
  }
569
 
570
- /**
571
- * Returns a given value
572
- * If given a function, returns its output
573
- *
574
- * @param val string|function
575
- * @param context value of "this" to be passed to function
576
- * @returns {*}
577
- */
578
- function evaluate(val, context) {
579
- if ($.isFunction(val)) {
580
- var args = Array.prototype.slice.call(arguments, 2);
581
- return val.apply(context, args);
582
- }
583
- return val;
584
- }
585
 
586
- function countResults(results) {
587
- var count = 0;
588
- $.each(results, function(i, item) {
589
- if (item.children) {
590
- count += countResults(item.children);
591
- } else {
592
- count++;
593
- }
594
- });
595
- return count;
596
- }
597
 
598
- /**
599
- * Default tokenizer. This function uses breaks the input on substring match of any string from the
600
- * opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
601
- * two options have to be defined in order for the tokenizer to work.
602
- *
603
- * @param input text user has typed so far or pasted into the search field
604
- * @param selection currently selected choices
605
- * @param selectCallback function(choice) callback tho add the choice to selection
606
- * @param opts select2's opts
607
- * @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
608
- */
609
- function defaultTokenizer(input, selection, selectCallback, opts) {
610
- var original = input, // store the original so we can compare and know if we need to tell the search to update its text
611
- dupe = false, // check for whether a token we extracted represents a duplicate selected choice
612
- token, // token
613
- index, // position at which the separator was found
614
- i, l, // looping variables
615
- separator; // the matched separator
616
-
617
- if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
618
-
619
- while (true) {
620
- index = -1;
621
-
622
- for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
623
- separator = opts.tokenSeparators[i];
624
- index = input.indexOf(separator);
625
- if (index >= 0) break;
626
- }
627
 
628
- if (index < 0) break; // did not find any token separator in the input string, bail
629
 
630
- token = input.substring(0, index);
631
- input = input.substring(index + separator.length);
632
 
633
- if (token.length > 0) {
634
- token = opts.createSearchChoice.call(this, token, selection);
635
- if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
636
- dupe = false;
637
- for (i = 0, l = selection.length; i < l; i++) {
638
- if (equal(opts.id(token), opts.id(selection[i]))) {
639
- dupe = true; break;
640
- }
641
- }
642
 
643
- if (!dupe) selectCallback(token);
644
- }
645
- }
646
- }
647
 
648
- if (original!==input) return input;
649
  }
650
 
651
- function cleanupJQueryElements() {
652
- var self = this;
653
 
654
- $.each(arguments, function (i, element) {
655
- self[element].remove();
656
- self[element] = null;
657
- });
658
- }
659
 
660
- /**
661
- * Creates a new class
662
- *
663
- * @param superClass
664
- * @param methods
665
- */
666
- function clazz(SuperClass, methods) {
667
- var constructor = function () {};
668
- constructor.prototype = new SuperClass;
669
- constructor.prototype.constructor = constructor;
670
- constructor.prototype.parent = SuperClass.prototype;
671
- constructor.prototype = $.extend(constructor.prototype, methods);
672
- return constructor;
673
- }
674
-
675
- AbstractSelect2 = clazz(Object, {
676
-
677
- // abstract
678
- bind: function (func) {
679
- var self = this;
680
- return function () {
681
- func.apply(self, arguments);
682
- };
683
- },
684
 
685
- // abstract
686
- init: function (opts) {
687
- var results, search, resultsSelector = ".select2-results";
688
 
689
- // prepare options
690
- this.opts = opts = this.prepareOpts(opts);
691
 
692
- this.id=opts.id;
 
693
 
694
- // destroy if called on an existing component
695
- if (opts.element.data("select2") !== undefined &&
696
- opts.element.data("select2") !== null) {
697
- opts.element.data("select2").destroy();
698
- }
699
 
700
- this.container = this.createContainer();
 
701
 
702
- this.liveRegion = $('.select2-hidden-accessible');
703
- if (this.liveRegion.length == 0) {
704
- this.liveRegion = $("<span>", {
705
- role: "status",
706
- "aria-live": "polite"
707
- })
708
- .addClass("select2-hidden-accessible")
709
- .appendTo(document.body);
710
- }
711
 
712
- this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
713
- this.containerEventName= this.containerId
714
- .replace(/([.])/g, '_')
715
- .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
716
- this.container.attr("id", this.containerId);
717
 
718
- this.container.attr("title", opts.element.attr("title"));
719
 
720
- this.body = $(document.body);
 
721
 
722
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
 
 
723
 
724
- this.container.attr("style", opts.element.attr("style"));
725
- this.container.css(evaluate(opts.containerCss, this.opts.element));
726
- this.container.addClass(evaluate(opts.containerCssClass, this.opts.element));
727
 
728
- this.elementTabIndex = this.opts.element.attr("tabindex");
 
 
729
 
730
- // swap container for the element
731
- this.opts.element
732
- .data("select2", this)
733
- .attr("tabindex", "-1")
734
- .before(this.container)
735
- .on("click.select2", killEvent); // do not leak click events
736
 
737
- this.container.data("select2", this);
 
738
 
739
- this.dropdown = this.container.find(".select2-drop");
740
 
741
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
 
 
742
 
743
- this.dropdown.addClass(evaluate(opts.dropdownCssClass, this.opts.element));
744
- this.dropdown.data("select2", this);
745
- this.dropdown.on("click", killEvent);
746
 
747
- this.results = results = this.container.find(resultsSelector);
748
- this.search = search = this.container.find("input.select2-input");
749
 
750
- this.queryCount = 0;
751
- this.resultsPage = 0;
752
- this.context = null;
753
 
754
- // initialize the container
755
- this.initContainer();
 
756
 
757
- this.container.on("click", killEvent);
 
758
 
759
- installFilteredMouseMove(this.results);
 
 
 
 
 
760
 
761
- this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
762
- this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
763
- this._touchEvent = true;
764
- this.highlightUnderEvent(event);
765
- }));
766
- this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
767
- this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
768
 
769
- // Waiting for a click event on touch devices to select option and hide dropdown
770
- // otherwise click will be triggered on an underlying element
771
- this.dropdown.on('click', this.bind(function (event) {
772
- if (this._touchEvent) {
773
- this._touchEvent = false;
774
- this.selectHighlighted();
775
- }
776
- }));
777
-
778
- installDebouncedScroll(80, this.results);
779
- this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
780
-
781
- // do not propagate change event from the search field out of the component
782
- $(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
783
- $(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
784
-
785
- // if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
786
- if ($.fn.mousewheel) {
787
- results.mousewheel(function (e, delta, deltaX, deltaY) {
788
- var top = results.scrollTop();
789
- if (deltaY > 0 && top - deltaY <= 0) {
790
- results.scrollTop(0);
791
- killEvent(e);
792
- } else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
793
- results.scrollTop(results.get(0).scrollHeight - results.height());
794
- killEvent(e);
795
- }
796
- });
797
- }
798
 
799
- installKeyUpChangeEvent(search);
800
- search.on("keyup-change input paste", this.bind(this.updateResults));
801
- search.on("focus", function () { search.addClass("select2-focused"); });
802
- search.on("blur", function () { search.removeClass("select2-focused");});
803
 
804
- this.dropdown.on("mouseup", resultsSelector, this.bind(function (e) {
805
- if ($(e.target).closest(".select2-result-selectable").length > 0) {
806
- this.highlightUnderEvent(e);
807
- this.selectHighlighted(e);
808
- }
809
- }));
810
 
811
- // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
812
- // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
813
- // dom it will trigger the popup close, which is not what we want
814
- // focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
815
- this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
816
 
817
- this.lastSearchTerm = undefined;
 
 
818
 
819
- if ($.isFunction(this.opts.initSelection)) {
820
- // initialize selection based on the current value of the source element
821
- this.initSelection();
 
822
 
823
- // if the user has provided a function that can set selection based on the value of the source element
824
- // we monitor the change event on the element and trigger it, allowing for two way synchronization
825
- this.monitorSource();
826
- }
 
827
 
828
- if (opts.maximumInputLength !== null) {
829
- this.search.attr("maxlength", opts.maximumInputLength);
830
- }
831
 
832
- var disabled = opts.element.prop("disabled");
833
- if (disabled === undefined) disabled = false;
834
- this.enable(!disabled);
835
 
836
- var readonly = opts.element.prop("readonly");
837
- if (readonly === undefined) readonly = false;
838
- this.readonly(readonly);
 
839
 
840
- // Calculate size of scrollbar
841
- scrollBarDimensions = scrollBarDimensions || measureScrollbar();
842
 
843
- this.autofocus = opts.element.prop("autofocus");
844
- opts.element.prop("autofocus", false);
845
- if (this.autofocus) this.focus();
 
 
846
 
847
- this.search.attr("placeholder", opts.searchInputPlaceholder);
848
- },
 
849
 
850
- // abstract
851
- destroy: function () {
852
- var element=this.opts.element, select2 = element.data("select2"), self = this;
853
 
854
- this.close();
 
 
855
 
856
- if (element.length && element[0].detachEvent && self._sync) {
857
- element.each(function () {
858
- if (self._sync) {
859
- this.detachEvent("onpropertychange", self._sync);
860
- }
861
- });
862
- }
863
- if (this.propertyObserver) {
864
- this.propertyObserver.disconnect();
865
- this.propertyObserver = null;
866
- }
867
- this._sync = null;
868
-
869
- if (select2 !== undefined) {
870
- select2.container.remove();
871
- select2.liveRegion.remove();
872
- select2.dropdown.remove();
873
- element.removeData("select2")
874
- .off(".select2");
875
- if (!element.is("input[type='hidden']")) {
876
- element
877
- .show()
878
- .prop("autofocus", this.autofocus || false);
879
- if (this.elementTabIndex) {
880
- element.attr({tabindex: this.elementTabIndex});
881
- } else {
882
- element.removeAttr("tabindex");
883
- }
884
- element.show();
885
- } else {
886
- element.css("display", "");
887
- }
888
- }
889
 
890
- cleanupJQueryElements.call(this,
891
- "container",
892
- "liveRegion",
893
- "dropdown",
894
- "results",
895
- "search"
896
- );
897
- },
898
 
899
- // abstract
900
- optionToData: function(element) {
901
- if (element.is("option")) {
902
- return {
903
- id:element.prop("value"),
904
- text:element.text(),
905
- element: element.get(),
906
- css: element.attr("class"),
907
- disabled: element.prop("disabled"),
908
- locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
909
- };
910
- } else if (element.is("optgroup")) {
911
- return {
912
- text:element.attr("label"),
913
- children:[],
914
- element: element.get(),
915
- css: element.attr("class")
916
- };
917
- }
918
- },
919
 
920
- // abstract
921
- prepareOpts: function (opts) {
922
- var element, select, idKey, ajaxUrl, self = this;
923
 
924
- element = opts.element;
 
925
 
926
- if (element.get(0).tagName.toLowerCase() === "select") {
927
- this.select = select = opts.element;
928
- }
929
 
930
- if (select) {
931
- // these options are not allowed when attached to a select because they are picked up off the element itself
932
- $.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
933
- if (this in opts) {
934
- throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.");
935
- }
936
- });
937
- }
938
 
939
- opts.debug = opts.debug || $.fn.select2.defaults.debug;
940
-
941
- // Warnings for options renamed/removed in Select2 4.0.0
942
- // Only when it's enabled through debug mode
943
- if (opts.debug && console && console.warn) {
944
- // id was removed
945
- if (opts.id != null) {
946
- console.warn(
947
- 'Select2: The `id` option has been removed in Select2 4.0.0, ' +
948
- 'consider renaming your `id` property or mapping the property before your data makes it to Select2. ' +
949
- 'You can read more at https://select2.github.io/announcements-4.0.html#changed-id'
950
- );
951
- }
952
 
953
- // text was removed
954
- if (opts.text != null) {
955
- console.warn(
956
- 'Select2: The `text` option has been removed in Select2 4.0.0, ' +
957
- 'consider renaming your `text` property or mapping the property before your data makes it to Select2. ' +
958
- 'You can read more at https://select2.github.io/announcements-4.0.html#changed-id'
959
- );
960
- }
961
 
962
- // sortResults was renamed to results
963
- if (opts.sortResults != null) {
964
- console.warn(
965
- 'Select2: the `sortResults` option has been renamed to `sorter` in Select2 4.0.0. '
966
- );
967
- }
968
 
969
- // selectOnBlur was renamed to selectOnClose
970
- if (opts.selectOnBlur != null) {
971
- console.warn(
972
- 'Select2: The `selectOnBlur` option has been renamed to `selectOnClose` in Select2 4.0.0.'
973
- );
974
- }
975
 
976
- // ajax.results was renamed to ajax.processResults
977
- if (opts.ajax != null && opts.ajax.results != null) {
978
- console.warn(
979
- 'Select2: The `ajax.results` option has been renamed to `ajax.processResults` in Select2 4.0.0.'
980
- );
981
- }
 
 
 
 
 
 
 
 
982
 
983
- // format* options were renamed to language.*
984
- if (opts.formatNoResults != null) {
985
- console.warn(
986
- 'Select2: The `formatNoResults` option has been renamed to `language.noResults` in Select2 4.0.0.'
987
- );
988
- }
989
- if (opts.formatSearching != null) {
990
- console.warn(
991
- 'Select2: The `formatSearching` option has been renamed to `language.searching` in Select2 4.0.0.'
992
- );
993
- }
994
- if (opts.formatInputTooShort != null) {
995
- console.warn(
996
- 'Select2: The `formatInputTooShort` option has been renamed to `language.inputTooShort` in Select2 4.0.0.'
997
- );
998
- }
999
- if (opts.formatInputTooLong != null) {
1000
- console.warn(
1001
- 'Select2: The `formatInputTooLong` option has been renamed to `language.inputTooLong` in Select2 4.0.0.'
1002
- );
1003
- }
1004
- if (opts.formatLoading != null) {
1005
- console.warn(
1006
- 'Select2: The `formatLoading` option has been renamed to `language.loadingMore` in Select2 4.0.0.'
1007
- );
1008
- }
1009
- if (opts.formatSelectionTooBig != null) {
1010
- console.warn(
1011
- 'Select2: The `formatSelectionTooBig` option has been renamed to `language.maximumSelected` in Select2 4.0.0.'
1012
- );
1013
- }
1014
 
1015
- if (opts.element.data('select2Tags')) {
1016
- console.warn(
1017
- 'Select2: The `data-select2-tags` attribute has been renamed to `data-tags` in Select2 4.0.0.'
1018
- );
1019
- }
1020
- }
1021
 
1022
- // Aliasing options renamed in Select2 4.0.0
 
 
 
 
 
1023
 
1024
- // data-select2-tags -> data-tags
1025
- if (opts.element.data('tags') != null) {
1026
- var elemTags = opts.element.data('tags');
1027
 
1028
- // data-tags should actually be a boolean
1029
- if (!$.isArray(elemTags)) {
1030
- elemTags = [];
1031
- }
1032
 
1033
- opts.element.data('select2Tags', elemTags);
1034
- }
1035
 
1036
- // sortResults -> sorter
1037
- if (opts.sorter != null) {
1038
- opts.sortResults = opts.sorter;
1039
- }
1040
 
1041
- // selectOnBlur -> selectOnClose
1042
- if (opts.selectOnClose != null) {
1043
- opts.selectOnBlur = opts.selectOnClose;
1044
- }
 
 
 
 
1045
 
1046
- // ajax.results -> ajax.processResults
1047
- if (opts.ajax != null) {
1048
- if ($.isFunction(opts.ajax.processResults)) {
1049
- opts.ajax.results = opts.ajax.processResults;
1050
- }
1051
- }
1052
 
1053
- // Formatters/language options
1054
- if (opts.language != null) {
1055
- var lang = opts.language;
1056
 
1057
- // formatNoMatches -> language.noMatches
1058
- if ($.isFunction(lang.noMatches)) {
1059
- opts.formatNoMatches = lang.noMatches;
1060
- }
1061
 
1062
- // formatSearching -> language.searching
1063
- if ($.isFunction(lang.searching)) {
1064
- opts.formatSearching = lang.searching;
1065
- }
1066
 
1067
- // formatInputTooShort -> language.inputTooShort
1068
- if ($.isFunction(lang.inputTooShort)) {
1069
- opts.formatInputTooShort = lang.inputTooShort;
1070
- }
1071
 
1072
- // formatInputTooLong -> language.inputTooLong
1073
- if ($.isFunction(lang.inputTooLong)) {
1074
- opts.formatInputTooLong = lang.inputTooLong;
1075
- }
1076
 
1077
- // formatLoading -> language.loadingMore
1078
- if ($.isFunction(lang.loadingMore)) {
1079
- opts.formatLoading = lang.loadingMore;
1080
- }
1081
 
1082
- // formatSelectionTooBig -> language.maximumSelected
1083
- if ($.isFunction(lang.maximumSelected)) {
1084
- opts.formatSelectionTooBig = lang.maximumSelected;
1085
- }
1086
- }
1087
 
1088
- opts = $.extend({}, {
1089
- populateResults: function(container, results, query) {
1090
- var populate, id=this.opts.id, liveRegion=this.liveRegion;
1091
 
1092
- populate=function(results, container, depth) {
 
 
 
1093
 
1094
- var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted;
1095
 
1096
- results = opts.sortResults(results, container, query);
 
 
 
 
1097
 
1098
- // collect the created nodes for bulk append
1099
- var nodes = [];
1100
- for (i = 0, l = results.length; i < l; i = i + 1) {
1101
 
1102
- result=results[i];
 
1103
 
1104
- disabled = (result.disabled === true);
1105
- selectable = (!disabled) && (id(result) !== undefined);
 
1106
 
1107
- compound=result.children && result.children.length > 0;
 
1108
 
1109
- node=$("<li></li>");
1110
- node.addClass("select2-results-dept-"+depth);
1111
- node.addClass("select2-result");
1112
- node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
1113
- if (disabled) { node.addClass("select2-disabled"); }
1114
- if (compound) { node.addClass("select2-result-with-children"); }
1115
- node.addClass(self.opts.formatResultCssClass(result));
1116
- node.attr("role", "presentation");
1117
 
1118
- label=$(document.createElement("div"));
1119
- label.addClass("select2-result-label");
1120
- label.attr("id", "select2-result-label-" + nextUid());
1121
- label.attr("role", "option");
 
 
1122
 
1123
- formatted=opts.formatResult(result, label, query, self.opts.escapeMarkup);
1124
- if (formatted!==undefined) {
1125
- label.html(formatted);
1126
- node.append(label);
1127
- }
1128
 
 
1129
 
1130
- if (compound) {
1131
- innerContainer=$("<ul></ul>");
1132
- innerContainer.addClass("select2-result-sub");
1133
- populate(result.children, innerContainer, depth+1);
1134
- node.append(innerContainer);
1135
- }
1136
 
1137
- node.data("select2-data", result);
1138
- nodes.push(node[0]);
1139
- }
1140
 
1141
- // bulk append the created nodes
1142
- container.append(nodes);
1143
- liveRegion.text(opts.formatMatches(results.length));
1144
- };
1145
 
1146
- populate(results, container, 0);
1147
- }
1148
- }, $.fn.select2.defaults, opts);
1149
 
1150
- if (typeof(opts.id) !== "function") {
1151
- idKey = opts.id;
1152
- opts.id = function (e) { return e[idKey]; };
1153
- }
1154
 
1155
- if ($.isArray(opts.element.data("select2Tags"))) {
1156
- if ("tags" in opts) {
1157
- throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
1158
- }
1159
- opts.tags=opts.element.data("select2Tags");
1160
- }
1161
 
1162
- if (select) {
1163
- opts.query = this.bind(function (query) {
1164
- var data = { results: [], more: false },
1165
- term = query.term,
1166
- children, placeholderOption, process;
1167
-
1168
- process=function(element, collection) {
1169
- var group;
1170
- if (element.is("option")) {
1171
- if (query.matcher(term, element.text(), element)) {
1172
- collection.push(self.optionToData(element));
1173
- }
1174
- } else if (element.is("optgroup")) {
1175
- group=self.optionToData(element);
1176
- element.children().each2(function(i, elm) { process(elm, group.children); });
1177
- if (group.children.length>0) {
1178
- collection.push(group);
1179
- }
1180
- }
1181
- };
1182
 
1183
- children=element.children();
 
 
1184
 
1185
- // ignore the placeholder option if there is one
1186
- if (this.getPlaceholder() !== undefined && children.length > 0) {
1187
- placeholderOption = this.getPlaceholderOption();
1188
- if (placeholderOption) {
1189
- children=children.not(placeholderOption);
1190
- }
1191
- }
1192
 
1193
- children.each2(function(i, elm) { process(elm, data.results); });
 
 
 
 
 
 
 
 
1194
 
1195
- query.callback(data);
1196
- });
1197
- // this is needed because inside val() we construct choices from options and their id is hardcoded
1198
- opts.id=function(e) { return e.id; };
1199
- } else {
1200
- if (!("query" in opts)) {
1201
- if ("ajax" in opts) {
1202
- ajaxUrl = opts.element.data("ajax-url");
1203
- if (ajaxUrl && ajaxUrl.length > 0) {
1204
- opts.ajax.url = ajaxUrl;
1205
- }
1206
- opts.query = ajax.call(opts.element, opts.ajax);
1207
- } else if ("data" in opts) {
1208
- opts.query = local(opts.data);
1209
- } else if ("tags" in opts) {
1210
- opts.query = tags(opts.tags);
1211
- if (opts.createSearchChoice === undefined) {
1212
- opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
1213
- }
1214
- if (opts.initSelection === undefined) {
1215
- opts.initSelection = function (element, callback) {
1216
- var data = [];
1217
- $(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
1218
- var obj = { id: this, text: this },
1219
- tags = opts.tags;
1220
- if ($.isFunction(tags)) tags=tags();
1221
- $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
1222
- data.push(obj);
1223
- });
1224
-
1225
- callback(data);
1226
- };
1227
- }
1228
- }
1229
- }
1230
- }
1231
- if (typeof(opts.query) !== "function") {
1232
- throw "query function not defined for Select2 " + opts.element.attr("id");
1233
- }
1234
 
1235
- if (opts.createSearchChoicePosition === 'top') {
1236
- opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
1237
- }
1238
- else if (opts.createSearchChoicePosition === 'bottom') {
1239
- opts.createSearchChoicePosition = function(list, item) { list.push(item); };
1240
- }
1241
- else if (typeof(opts.createSearchChoicePosition) !== "function") {
1242
- throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
1243
- }
1244
 
1245
- return opts;
1246
- },
 
 
1247
 
1248
- /**
1249
- * Monitor the original element for changes and update select2 accordingly
1250
- */
1251
- // abstract
1252
- monitorSource: function () {
1253
- var el = this.opts.element, observer, self = this;
1254
 
1255
- el.on("change.select2", this.bind(function (e) {
1256
- if (this.opts.element.data("select2-change-triggered") !== true) {
1257
- this.initSelection();
1258
- }
1259
- }));
1260
 
1261
- this._sync = this.bind(function () {
1262
 
1263
- // sync enabled state
1264
- var disabled = el.prop("disabled");
1265
- if (disabled === undefined) disabled = false;
1266
- this.enable(!disabled);
1267
 
1268
- var readonly = el.prop("readonly");
1269
- if (readonly === undefined) readonly = false;
1270
- this.readonly(readonly);
 
 
 
 
1271
 
1272
- if (this.container) {
1273
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
1274
- this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
1275
- }
1276
 
1277
- if (this.dropdown) {
1278
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
1279
- this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
1280
- }
1281
 
1282
- });
1283
 
1284
- // IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
1285
- if (el.length && el[0].attachEvent) {
1286
- el.each(function() {
1287
- this.attachEvent("onpropertychange", self._sync);
1288
- });
1289
- }
 
1290
 
1291
- // safari, chrome, firefox, IE11
1292
- observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
1293
- if (observer !== undefined) {
1294
- if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
1295
- this.propertyObserver = new observer(function (mutations) {
1296
- $.each(mutations, self._sync);
1297
- });
1298
- this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
1299
- }
1300
- },
1301
 
1302
- // abstract
1303
- triggerSelect: function(data) {
1304
- var evt = $.Event("select2-selecting", { val: this.id(data), object: data, choice: data });
1305
- this.opts.element.trigger(evt);
1306
- return !evt.isDefaultPrevented();
1307
- },
1308
 
1309
- /**
1310
- * Triggers the change event on the source element
1311
- */
1312
- // abstract
1313
- triggerChange: function (details) {
1314
-
1315
- details = details || {};
1316
- details= $.extend({}, details, { type: "change", val: this.val() });
1317
- // prevents recursive triggering
1318
- this.opts.element.data("select2-change-triggered", true);
1319
- this.opts.element.trigger(details);
1320
- this.opts.element.data("select2-change-triggered", false);
1321
-
1322
- // some validation frameworks ignore the change event and listen instead to keyup, click for selects
1323
- // so here we trigger the click event manually
1324
- this.opts.element.click();
1325
-
1326
- // ValidationEngine ignores the change event and listens instead to blur
1327
- // so here we trigger the blur event manually if so desired
1328
- if (this.opts.blurOnChange)
1329
- this.opts.element.blur();
1330
- },
1331
 
1332
- //abstract
1333
- isInterfaceEnabled: function()
1334
- {
1335
- return this.enabledInterface === true;
1336
- },
1337
 
1338
- // abstract
1339
- enableInterface: function() {
1340
- var enabled = this._enabled && !this._readonly,
1341
- disabled = !enabled;
1342
 
1343
- if (enabled === this.enabledInterface) return false;
 
 
1344
 
1345
- this.container.toggleClass("select2-container-disabled", disabled);
1346
- this.close();
1347
- this.enabledInterface = enabled;
1348
 
1349
- return true;
1350
- },
 
1351
 
1352
- // abstract
1353
- enable: function(enabled) {
1354
- if (enabled === undefined) enabled = true;
1355
- if (this._enabled === enabled) return;
1356
- this._enabled = enabled;
1357
 
1358
- this.opts.element.prop("disabled", !enabled);
1359
- this.enableInterface();
1360
- },
1361
 
1362
- // abstract
1363
- disable: function() {
1364
- this.enable(false);
1365
- },
1366
 
1367
- // abstract
1368
- readonly: function(enabled) {
1369
- if (enabled === undefined) enabled = false;
1370
- if (this._readonly === enabled) return;
1371
- this._readonly = enabled;
1372
 
1373
- this.opts.element.prop("readonly", enabled);
1374
- this.enableInterface();
1375
- },
1376
 
1377
- // abstract
1378
- opened: function () {
1379
- return (this.container) ? this.container.hasClass("select2-dropdown-open") : false;
1380
- },
1381
 
1382
- // abstract
1383
- positionDropdown: function() {
1384
- var $dropdown = this.dropdown,
1385
- container = this.container,
1386
- offset = container.offset(),
1387
- height = container.outerHeight(false),
1388
- width = container.outerWidth(false),
1389
- dropHeight = $dropdown.outerHeight(false),
1390
- $window = $(window),
1391
- windowWidth = $window.width(),
1392
- windowHeight = $window.height(),
1393
- viewPortRight = $window.scrollLeft() + windowWidth,
1394
- viewportBottom = $window.scrollTop() + windowHeight,
1395
- dropTop = offset.top + height,
1396
- dropLeft = offset.left,
1397
- enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
1398
- enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
1399
- dropWidth = $dropdown.outerWidth(false),
1400
- enoughRoomOnRight = function() {
1401
- return dropLeft + dropWidth <= viewPortRight;
1402
- },
1403
- enoughRoomOnLeft = function() {
1404
- return offset.left + viewPortRight + container.outerWidth(false) > dropWidth;
1405
- },
1406
- aboveNow = $dropdown.hasClass("select2-drop-above"),
1407
- bodyOffset,
1408
- above,
1409
- changeDirection,
1410
- css,
1411
- resultsListNode;
1412
-
1413
- // always prefer the current above/below alignment, unless there is not enough room
1414
- if (aboveNow) {
1415
- above = true;
1416
- if (!enoughRoomAbove && enoughRoomBelow) {
1417
- changeDirection = true;
1418
- above = false;
1419
- }
1420
- } else {
1421
- above = false;
1422
- if (!enoughRoomBelow && enoughRoomAbove) {
1423
- changeDirection = true;
1424
- above = true;
1425
- }
1426
- }
1427
 
1428
- //if we are changing direction we need to get positions when dropdown is hidden;
1429
- if (changeDirection) {
1430
- $dropdown.hide();
1431
- offset = this.container.offset();
1432
- height = this.container.outerHeight(false);
1433
- width = this.container.outerWidth(false);
1434
- dropHeight = $dropdown.outerHeight(false);
1435
- viewPortRight = $window.scrollLeft() + windowWidth;
1436
- viewportBottom = $window.scrollTop() + windowHeight;
1437
- dropTop = offset.top + height;
1438
- dropLeft = offset.left;
1439
- dropWidth = $dropdown.outerWidth(false);
1440
- $dropdown.show();
1441
-
1442
- // fix so the cursor does not move to the left within the search-textbox in IE
1443
- this.focusSearch();
1444
- }
1445
 
1446
- if (this.opts.dropdownAutoWidth) {
1447
- resultsListNode = $('.select2-results', $dropdown)[0];
1448
- $dropdown.addClass('select2-drop-auto-width');
1449
- $dropdown.css('width', '');
1450
- // Add scrollbar width to dropdown if vertical scrollbar is present
1451
- dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
1452
- dropWidth > width ? width = dropWidth : dropWidth = width;
1453
- dropHeight = $dropdown.outerHeight(false);
1454
- }
1455
- else {
1456
- this.container.removeClass('select2-drop-auto-width');
1457
- }
1458
 
1459
- //console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
1460
- //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body.scrollTop(), "enough?", enoughRoomAbove);
1461
 
1462
- // fix positioning when body has an offset and is not position: static
1463
- if (this.body.css('position') !== 'static') {
1464
- bodyOffset = this.body.offset();
1465
- dropTop -= bodyOffset.top;
1466
- dropLeft -= bodyOffset.left;
1467
- }
1468
 
1469
- if (!enoughRoomOnRight() && enoughRoomOnLeft()) {
1470
- dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
1471
- }
1472
 
1473
- css = {
1474
- left: dropLeft,
1475
- width: width
1476
- };
 
1477
 
1478
- if (above) {
1479
- this.container.addClass("select2-drop-above");
1480
- $dropdown.addClass("select2-drop-above");
1481
- dropHeight = $dropdown.outerHeight(false);
1482
- css.top = offset.top - dropHeight;
1483
- css.bottom = 'auto';
1484
- }
1485
- else {
1486
- css.top = dropTop;
1487
- css.bottom = 'auto';
1488
- this.container.removeClass("select2-drop-above");
1489
- $dropdown.removeClass("select2-drop-above");
1490
- }
1491
- css = $.extend(css, evaluate(this.opts.dropdownCss, this.opts.element));
1492
 
1493
- $dropdown.css(css);
1494
- },
1495
 
1496
- // abstract
1497
- shouldOpen: function() {
1498
- var event;
1499
 
1500
- if (this.opened()) return false;
1501
 
1502
- if (this._enabled === false || this._readonly === true) return false;
1503
 
1504
- event = $.Event("select2-opening");
1505
- this.opts.element.trigger(event);
1506
- return !event.isDefaultPrevented();
1507
- },
1508
 
1509
- // abstract
1510
- clearDropdownAlignmentPreference: function() {
1511
- // clear the classes used to figure out the preference of where the dropdown should be opened
1512
- this.container.removeClass("select2-drop-above");
1513
- this.dropdown.removeClass("select2-drop-above");
1514
- },
1515
 
1516
- /**
1517
- * Opens the dropdown
1518
- *
1519
- * @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
1520
- * the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
1521
- */
1522
- // abstract
1523
- open: function () {
1524
 
1525
- if (!this.shouldOpen()) return false;
 
 
 
1526
 
1527
- this.opening();
 
 
 
1528
 
1529
- // Only bind the document mousemove when the dropdown is visible
1530
- $document.on("mousemove.select2Event", function (e) {
1531
- lastMousePosition.x = e.pageX;
1532
- lastMousePosition.y = e.pageY;
1533
- });
1534
 
1535
- return true;
1536
- },
 
1537
 
1538
- /**
1539
- * Performs the opening of the dropdown
1540
- */
1541
- // abstract
1542
- opening: function() {
1543
- var cid = this.containerEventName,
1544
- scroll = "scroll." + cid,
1545
- resize = "resize."+cid,
1546
- orient = "orientationchange."+cid,
1547
- mask;
1548
 
1549
- this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
 
 
1550
 
1551
- this.clearDropdownAlignmentPreference();
 
 
 
1552
 
1553
- if(this.dropdown[0] !== this.body.children().last()[0]) {
1554
- this.dropdown.detach().appendTo(this.body);
1555
- }
1556
 
1557
- // create the dropdown mask if doesn't already exist
1558
- mask = $("#select2-drop-mask");
1559
- if (mask.length === 0) {
1560
- mask = $(document.createElement("div"));
1561
- mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
1562
- mask.hide();
1563
- mask.appendTo(this.body);
1564
- mask.on("mousedown touchstart click", function (e) {
1565
- // Prevent IE from generating a click event on the body
1566
- reinsertElement(mask);
1567
-
1568
- var dropdown = $("#select2-drop"), self;
1569
- if (dropdown.length > 0) {
1570
- self=dropdown.data("select2");
1571
- if (self.opts.selectOnBlur) {
1572
- self.selectHighlighted({noFocus: true});
1573
- }
1574
- self.close();
1575
- e.preventDefault();
1576
- e.stopPropagation();
1577
- }
1578
- });
1579
- }
1580
 
1581
- // ensure the mask is always right before the dropdown
1582
- if (this.dropdown.prev()[0] !== mask[0]) {
1583
- this.dropdown.before(mask);
1584
- }
1585
 
1586
- // move the global id to the correct dropdown
1587
- $("#select2-drop").removeAttr("id");
1588
- this.dropdown.attr("id", "select2-drop");
1589
 
1590
- // show the elements
1591
- mask.show();
1592
 
1593
- this.positionDropdown();
1594
- this.dropdown.show();
1595
- this.positionDropdown();
1596
 
1597
- this.dropdown.addClass("select2-drop-active");
 
 
1598
 
1599
- // attach listeners to events that can change the position of the container and thus require
1600
- // the position of the dropdown to be updated as well so it does not come unglued from the container
1601
- var that = this;
1602
- this.container.parents().add(window).each(function () {
1603
- $(this).on(resize+" "+scroll+" "+orient, function (e) {
1604
- if (that.opened()) that.positionDropdown();
1605
- });
1606
- });
1607
 
 
 
 
 
 
 
 
 
1608
 
1609
- },
 
1610
 
1611
- // abstract
1612
- close: function () {
1613
- if (!this.opened()) return;
1614
 
1615
- var cid = this.containerEventName,
1616
- scroll = "scroll." + cid,
1617
- resize = "resize."+cid,
1618
- orient = "orientationchange."+cid;
1619
 
1620
- // unbind event listeners
1621
- this.container.parents().add(window).each(function () { $(this).off(scroll).off(resize).off(orient); });
 
 
1622
 
1623
- this.clearDropdownAlignmentPreference();
1624
 
1625
- $("#select2-drop-mask").hide();
1626
- this.dropdown.removeAttr("id"); // only the active dropdown has the select2-drop id
1627
- this.dropdown.hide();
1628
- this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
1629
- this.results.empty();
1630
 
1631
- // Now that the dropdown is closed, unbind the global document mousemove event
1632
- $document.off("mousemove.select2Event");
1633
 
1634
- this.clearSearch();
1635
- this.search.removeClass("select2-active");
1636
 
1637
- // Remove the aria active descendant for highlighted element
1638
- this.search.removeAttr("aria-activedescendant");
1639
- this.opts.element.trigger($.Event("select2-close"));
1640
- },
1641
 
1642
- /**
1643
- * Opens control, sets input value, and updates results.
1644
- */
1645
- // abstract
1646
- externalSearch: function (term) {
1647
- this.open();
1648
- this.search.val(term);
1649
- this.updateResults(false);
1650
- },
1651
 
1652
- // abstract
1653
- clearSearch: function () {
1654
 
1655
- },
1656
 
1657
- /**
1658
- * @return {Boolean} Whether or not search value was changed.
1659
- * @private
1660
- */
1661
- prefillNextSearchTerm: function () {
1662
- // initializes search's value with nextSearchTerm (if defined by user)
1663
- // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
1664
- if(this.search.val() !== "") {
1665
- return false;
1666
- }
1667
 
1668
- var nextSearchTerm = this.opts.nextSearchTerm(this.data(), this.lastSearchTerm);
1669
- if(nextSearchTerm !== undefined){
1670
- this.search.val(nextSearchTerm);
1671
- this.search.select();
1672
- return true;
1673
- }
1674
 
1675
- return false;
1676
- },
 
 
1677
 
1678
- //abstract
1679
- getMaximumSelectionSize: function() {
1680
- return evaluate(this.opts.maximumSelectionSize, this.opts.element);
1681
- },
1682
 
1683
- // abstract
1684
- ensureHighlightVisible: function () {
1685
- var results = this.results, children, index, child, hb, rb, y, more, topOffset;
1686
 
1687
- index = this.highlight();
 
 
 
1688
 
1689
- if (index < 0) return;
 
 
 
 
 
1690
 
1691
- if (index == 0) {
 
 
1692
 
1693
- // if the first element is highlighted scroll all the way to the top,
1694
- // that way any unselectable headers above it will also be scrolled
1695
- // into view
1696
 
1697
- results.scrollTop(0);
1698
- return;
1699
- }
1700
 
1701
- children = this.findHighlightableChoices().find('.select2-result-label');
1702
 
1703
- child = $(children[index]);
 
1704
 
1705
- topOffset = (child.offset() || {}).top || 0;
 
1706
 
1707
- hb = topOffset + child.outerHeight(true);
 
 
 
 
 
1708
 
1709
- // if this is the last child lets also make sure select2-more-results is visible
1710
- if (index === children.length - 1) {
1711
- more = results.find("li.select2-more-results");
1712
- if (more.length > 0) {
1713
- hb = more.offset().top + more.outerHeight(true);
1714
- }
1715
- }
1716
 
1717
- rb = results.offset().top + results.outerHeight(false);
1718
- if (hb > rb) {
1719
- results.scrollTop(results.scrollTop() + (hb - rb));
1720
- }
1721
- y = topOffset - results.offset().top;
1722
 
1723
- // make sure the top of the element is visible
1724
- if (y < 0 && child.css('display') != 'none' ) {
1725
- results.scrollTop(results.scrollTop() + y); // y is negative
1726
- }
1727
- },
1728
 
1729
- // abstract
1730
- findHighlightableChoices: function() {
1731
- return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
1732
- },
 
 
 
 
 
1733
 
1734
- // abstract
1735
- moveHighlight: function (delta) {
1736
- var choices = this.findHighlightableChoices(),
1737
- index = this.highlight();
1738
 
1739
- while (index > -1 && index < choices.length) {
1740
- index += delta;
1741
- var choice = $(choices[index]);
1742
- if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled") && !choice.hasClass("select2-selected")) {
1743
- this.highlight(index);
1744
- break;
1745
- }
1746
- }
1747
- },
1748
 
1749
- // abstract
1750
- highlight: function (index) {
1751
- var choices = this.findHighlightableChoices(),
1752
- choice,
1753
- data;
1754
 
1755
- if (arguments.length === 0) {
1756
- return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
1757
- }
1758
 
1759
- if (index >= choices.length) index = choices.length - 1;
1760
- if (index < 0) index = 0;
 
 
 
 
1761
 
1762
- this.removeHighlight();
 
 
1763
 
1764
- choice = $(choices[index]);
1765
- choice.addClass("select2-highlighted");
1766
 
1767
- // ensure assistive technology can determine the active choice
1768
- this.search.attr("aria-activedescendant", choice.find(".select2-result-label").attr("id"));
 
1769
 
1770
- this.ensureHighlightVisible();
 
1771
 
1772
- this.liveRegion.text(choice.text());
 
 
1773
 
1774
- data = choice.data("select2-data");
1775
- if (data) {
1776
- this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
1777
- }
1778
- },
1779
 
1780
- removeHighlight: function() {
1781
- this.results.find(".select2-highlighted").removeClass("select2-highlighted");
1782
- },
1783
 
1784
- touchMoved: function() {
1785
- this._touchMoved = true;
1786
- },
1787
 
1788
- clearTouchMoved: function() {
1789
- this._touchMoved = false;
1790
- },
1791
 
1792
- // abstract
1793
- countSelectableResults: function() {
1794
- return this.findHighlightableChoices().length;
1795
- },
 
 
1796
 
1797
- // abstract
1798
- highlightUnderEvent: function (event) {
1799
- var el = $(event.target).closest(".select2-result-selectable");
1800
- if (el.length > 0 && !el.is(".select2-highlighted")) {
1801
- var choices = this.findHighlightableChoices();
1802
- this.highlight(choices.index(el));
1803
- } else if (el.length == 0) {
1804
- // if we are over an unselectable item remove all highlights
1805
- this.removeHighlight();
1806
- }
1807
- },
1808
 
1809
- // abstract
1810
- loadMoreIfNeeded: function () {
1811
- var results = this.results,
1812
- more = results.find("li.select2-more-results"),
1813
- below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
1814
- page = this.resultsPage + 1,
1815
- self=this,
1816
- term=this.search.val(),
1817
- context=this.context;
1818
-
1819
- if (more.length === 0) return;
1820
- below = more.offset().top - results.offset().top - results.height();
1821
-
1822
- if (below <= this.opts.loadMorePadding) {
1823
- more.addClass("select2-active");
1824
- this.opts.query({
1825
- element: this.opts.element,
1826
- term: term,
1827
- page: page,
1828
- context: context,
1829
- matcher: this.opts.matcher,
1830
- callback: this.bind(function (data) {
1831
-
1832
- // ignore a response if the select2 has been closed before it was received
1833
- if (!self.opened()) return;
1834
-
1835
-
1836
- self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
1837
- self.postprocessResults(data, false, false);
1838
-
1839
- if (data.more===true) {
1840
- more.detach().appendTo(results).html(self.opts.escapeMarkup(evaluate(self.opts.formatLoadMore, self.opts.element, page+1)));
1841
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
1842
- } else {
1843
- more.remove();
1844
- }
1845
- self.positionDropdown();
1846
- self.resultsPage = page;
1847
- self.context = data.context;
1848
- this.opts.element.trigger({ type: "select2-loaded", items: data });
1849
- })});
1850
- }
1851
- },
1852
 
1853
- /**
1854
- * Default tokenizer function which does nothing
1855
- */
1856
- tokenize: function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1857
 
1858
- },
 
1859
 
1860
- /**
1861
- * @param initial whether or not this is the call to this method right after the dropdown has been opened
1862
- */
1863
- // abstract
1864
- updateResults: function (initial) {
1865
- var search = this.search,
1866
- results = this.results,
1867
- opts = this.opts,
1868
- data,
1869
- self = this,
1870
- input,
1871
- term = search.val(),
1872
- lastTerm = $.data(this.container, "select2-last-term"),
1873
- // sequence number used to drop out-of-order responses
1874
- queryNumber;
1875
-
1876
- // prevent duplicate queries against the same term
1877
- if (initial !== true && lastTerm && equal(term, lastTerm)) return;
1878
-
1879
- $.data(this.container, "select2-last-term", term);
1880
-
1881
- // if the search is currently hidden we do not alter the results
1882
- if (initial !== true && (this.showSearchInput === false || !this.opened())) {
1883
- return;
1884
- }
1885
 
1886
- function postRender() {
1887
- search.removeClass("select2-active");
1888
- self.positionDropdown();
1889
- if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
1890
- self.liveRegion.text(results.text());
1891
- }
1892
- else {
1893
- self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
1894
- }
1895
- }
1896
 
1897
- function render(html) {
1898
- results.html(html);
1899
- postRender();
1900
- }
1901
 
1902
- queryNumber = ++this.queryCount;
 
1903
 
1904
- var maxSelSize = this.getMaximumSelectionSize();
1905
- if (maxSelSize >=1) {
1906
- data = this.data();
1907
- if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
1908
- render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
1909
- return;
1910
- }
1911
- }
1912
 
1913
- if (search.val().length < opts.minimumInputLength) {
1914
- if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
1915
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, opts.element, search.val(), opts.minimumInputLength) + "</li>");
1916
- } else {
1917
- render("");
1918
- }
1919
- if (initial && this.showSearch) this.showSearch(true);
1920
- return;
1921
- }
1922
 
1923
- if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
1924
- if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
1925
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, opts.element, search.val(), opts.maximumInputLength) + "</li>");
1926
- } else {
1927
- render("");
1928
- }
1929
- return;
1930
- }
1931
 
1932
- if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
1933
- render("<li class='select2-searching'>" + evaluate(opts.formatSearching, opts.element) + "</li>");
1934
- }
1935
 
1936
- search.addClass("select2-active");
 
 
 
1937
 
1938
- this.removeHighlight();
 
 
1939
 
1940
- // give the tokenizer a chance to pre-process the input
1941
- input = this.tokenize();
1942
- if (input != undefined && input != null) {
1943
- search.val(input);
1944
- }
1945
 
1946
- this.resultsPage = 1;
 
 
 
1947
 
1948
- opts.query({
1949
- element: opts.element,
1950
- term: search.val(),
1951
- page: this.resultsPage,
1952
- context: null,
1953
- matcher: opts.matcher,
1954
- callback: this.bind(function (data) {
1955
- var def; // default choice
1956
 
1957
- // ignore old responses
1958
- if (queryNumber != this.queryCount) {
1959
- return;
1960
- }
 
1961
 
1962
- // ignore a response if the select2 has been closed before it was received
1963
- if (!this.opened()) {
1964
- this.search.removeClass("select2-active");
1965
- return;
1966
- }
1967
 
1968
- // handle ajax error
1969
- if(data.hasError !== undefined && checkFormatter(opts.formatAjaxError, "formatAjaxError")) {
1970
- render("<li class='select2-ajax-error'>" + evaluate(opts.formatAjaxError, opts.element, data.jqXHR, data.textStatus, data.errorThrown) + "</li>");
1971
- return;
1972
- }
1973
 
1974
- // save context, if any
1975
- this.context = (data.context===undefined) ? null : data.context;
1976
- // create a default choice and prepend it to the list
1977
- if (this.opts.createSearchChoice && search.val() !== "") {
1978
- def = this.opts.createSearchChoice.call(self, search.val(), data.results);
1979
- if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
1980
- if ($(data.results).filter(
1981
- function () {
1982
- return equal(self.id(this), self.id(def));
1983
- }).length === 0) {
1984
- this.opts.createSearchChoicePosition(data.results, def);
1985
- }
1986
- }
1987
- }
1988
 
1989
- if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
1990
- render("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, opts.element, search.val()) + "</li>");
1991
- if(this.showSearch){
1992
- this.showSearch(search.val());
1993
- }
1994
- return;
1995
- }
 
 
 
 
 
 
 
 
 
 
 
1996
 
1997
- results.empty();
1998
- self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
 
1999
 
2000
- if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
2001
- results.append("<li class='select2-more-results'>" + opts.escapeMarkup(evaluate(opts.formatLoadMore, opts.element, this.resultsPage)) + "</li>");
2002
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
2003
- }
2004
 
2005
- this.postprocessResults(data, initial);
 
2006
 
2007
- postRender();
2008
 
2009
- this.opts.element.trigger({ type: "select2-loaded", items: data });
2010
- })});
2011
- },
2012
 
2013
- // abstract
2014
- cancel: function () {
2015
- this.close();
2016
- },
2017
 
2018
- // abstract
2019
- blur: function () {
2020
- // if selectOnBlur == true, select the currently highlighted option
2021
- if (this.opts.selectOnBlur)
2022
- this.selectHighlighted({noFocus: true});
2023
-
2024
- this.close();
2025
- this.container.removeClass("select2-container-active");
2026
- // synonymous to .is(':focus'), which is available in jquery >= 1.6
2027
- if (this.search[0] === document.activeElement) { this.search.blur(); }
2028
- this.clearSearch();
2029
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
2030
- },
2031
 
2032
- // abstract
2033
- focusSearch: function () {
2034
- focus(this.search);
2035
- },
2036
 
2037
- // abstract
2038
- selectHighlighted: function (options) {
2039
- if (this._touchMoved) {
2040
- this.clearTouchMoved();
2041
- return;
2042
- }
2043
- var index=this.highlight(),
2044
- highlighted=this.results.find(".select2-highlighted"),
2045
- data = highlighted.closest('.select2-result').data("select2-data");
2046
-
2047
- if (data) {
2048
- this.highlight(index);
2049
- this.onSelect(data, options);
2050
- } else if (options && options.noFocus) {
2051
- this.close();
2052
- }
2053
- },
2054
 
2055
- // abstract
2056
- getPlaceholder: function () {
2057
- var placeholderOption;
2058
- return this.opts.element.attr("placeholder") ||
2059
- this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
2060
- this.opts.element.data("placeholder") ||
2061
- this.opts.placeholder ||
2062
- ((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
2063
- },
2064
 
2065
- // abstract
2066
- getPlaceholderOption: function() {
2067
- if (this.select) {
2068
- var firstOption = this.select.children('option').first();
2069
- if (this.opts.placeholderOption !== undefined ) {
2070
- //Determine the placeholder option based on the specified placeholderOption setting
2071
- return (this.opts.placeholderOption === "first" && firstOption) ||
2072
- (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
2073
- } else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
2074
- //No explicit placeholder option specified, use the first if it's blank
2075
- return firstOption;
2076
- }
2077
- }
2078
- },
2079
 
2080
- /**
2081
- * Get the desired width for the container element. This is
2082
- * derived first from option `width` passed to select2, then
2083
- * the inline 'style' on the original element, and finally
2084
- * falls back to the jQuery calculated element width.
2085
- */
2086
- // abstract
2087
- initContainerWidth: function () {
2088
- function resolveContainerWidth() {
2089
- var style, attrs, matches, i, l, attr;
2090
-
2091
- if (this.opts.width === "off") {
2092
- return null;
2093
- } else if (this.opts.width === "element"){
2094
- return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
2095
- } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
2096
- // check if there is inline style on the element that contains width
2097
- style = this.opts.element.attr('style');
2098
- if (typeof(style) === "string") {
2099
- attrs = style.split(';');
2100
- for (i = 0, l = attrs.length; i < l; i = i + 1) {
2101
- attr = attrs[i].replace(/\s/g, '');
2102
- matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
2103
- if (matches !== null && matches.length >= 1)
2104
- return matches[1];
2105
- }
2106
- }
2107
 
2108
- if (this.opts.width === "resolve") {
2109
- // next check if css('width') can resolve a width that is percent based, this is sometimes possible
2110
- // when attached to input type=hidden or elements hidden via css
2111
- style = this.opts.element.css('width');
2112
- if (style.indexOf("%") > 0) return style;
2113
 
2114
- // finally, fallback on the calculated width of the element
2115
- return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
2116
- }
2117
 
2118
- return null;
2119
- } else if ($.isFunction(this.opts.width)) {
2120
- return this.opts.width();
2121
- } else {
2122
- return this.opts.width;
2123
- }
2124
- };
 
 
2125
 
2126
- var width = resolveContainerWidth.call(this);
2127
- if (width !== null) {
2128
- this.container.css("width", width);
2129
- }
2130
- }
2131
- });
2132
 
2133
- SingleSelect2 = clazz(AbstractSelect2, {
2134
-
2135
- // single
2136
-
2137
- createContainer: function () {
2138
- var container = $(document.createElement("div")).attr({
2139
- "class": "select2-container"
2140
- }).html([
2141
- "<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
2142
- " <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>",
2143
- " <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>",
2144
- "</a>",
2145
- "<label for='' class='select2-offscreen'></label>",
2146
- "<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />",
2147
- "<div class='select2-drop select2-display-none'>",
2148
- " <div class='select2-search'>",
2149
- " <label for='' class='select2-offscreen'></label>",
2150
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'",
2151
- " aria-autocomplete='list' />",
2152
- " </div>",
2153
- " <ul class='select2-results' role='listbox'>",
2154
- " </ul>",
2155
- "</div>"].join(""));
2156
- return container;
2157
- },
2158
 
2159
- // single
2160
- enableInterface: function() {
2161
- if (this.parent.enableInterface.apply(this, arguments)) {
2162
- this.focusser.prop("disabled", !this.isInterfaceEnabled());
2163
- }
2164
- },
2165
 
2166
- // single
2167
- opening: function () {
2168
- var el, range, len;
 
 
 
2169
 
2170
- if (this.opts.minimumResultsForSearch >= 0) {
2171
- this.showSearch(true);
2172
- }
2173
 
2174
- this.parent.opening.apply(this, arguments);
 
2175
 
2176
- if (this.showSearchInput !== false) {
2177
- // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
2178
- // all other browsers handle this just fine
2179
 
2180
- this.search.val(this.focusser.val());
2181
- }
2182
- if (this.opts.shouldFocusInput(this)) {
2183
- this.search.focus();
2184
- // move the cursor to the end after focussing, otherwise it will be at the beginning and
2185
- // new text will appear *before* focusser.val()
2186
- el = this.search.get(0);
2187
- if (el.createTextRange) {
2188
- range = el.createTextRange();
2189
- range.collapse(false);
2190
- range.select();
2191
- } else if (el.setSelectionRange) {
2192
- len = this.search.val().length;
2193
- el.setSelectionRange(len, len);
2194
- }
2195
- }
2196
 
2197
- this.prefillNextSearchTerm();
 
2198
 
2199
- this.focusser.prop("disabled", true).val("");
2200
- this.updateResults(true);
2201
- this.opts.element.trigger($.Event("select2-open"));
2202
- },
 
2203
 
2204
- // single
2205
- close: function () {
2206
- if (!this.opened()) return;
2207
- this.parent.close.apply(this, arguments);
2208
 
2209
- this.focusser.prop("disabled", false);
 
 
2210
 
2211
- if (this.opts.shouldFocusInput(this)) {
2212
- this.focusser.focus();
2213
- }
2214
- },
2215
 
2216
- // single
2217
- focus: function () {
2218
- if (this.opened()) {
2219
- this.close();
2220
- } else {
2221
- this.focusser.prop("disabled", false);
2222
- if (this.opts.shouldFocusInput(this)) {
2223
- this.focusser.focus();
2224
- }
2225
- }
2226
- },
2227
 
2228
- // single
2229
- isFocused: function () {
2230
- return this.container.hasClass("select2-container-active");
2231
- },
2232
 
2233
- // single
2234
- cancel: function () {
2235
- this.parent.cancel.apply(this, arguments);
2236
- this.focusser.prop("disabled", false);
2237
 
2238
- if (this.opts.shouldFocusInput(this)) {
2239
- this.focusser.focus();
2240
- }
2241
- },
2242
 
2243
- // single
2244
- destroy: function() {
2245
- $("label[for='" + this.focusser.attr('id') + "']")
2246
- .attr('for', this.opts.element.attr("id"));
2247
- this.parent.destroy.apply(this, arguments);
2248
 
2249
- cleanupJQueryElements.call(this,
2250
- "selection",
2251
- "focusser"
2252
- );
2253
- },
2254
 
2255
- // single
2256
- initContainer: function () {
 
 
 
2257
 
2258
- var selection,
2259
- container = this.container,
2260
- dropdown = this.dropdown,
2261
- idSuffix = nextUid(),
2262
- elementLabel;
2263
 
2264
- if (this.opts.minimumResultsForSearch < 0) {
2265
- this.showSearch(false);
2266
- } else {
2267
- this.showSearch(true);
2268
- }
2269
 
2270
- this.selection = selection = container.find(".select2-choice");
 
 
2271
 
2272
- this.focusser = container.find(".select2-focusser");
 
2273
 
2274
- // add aria associations
2275
- selection.find(".select2-chosen").attr("id", "select2-chosen-"+idSuffix);
2276
- this.focusser.attr("aria-labelledby", "select2-chosen-"+idSuffix);
2277
- this.results.attr("id", "select2-results-"+idSuffix);
2278
- this.search.attr("aria-owns", "select2-results-"+idSuffix);
 
 
 
2279
 
2280
- // rewrite labels from original element to focusser
2281
- this.focusser.attr("id", "s2id_autogen"+idSuffix);
2282
 
2283
- elementLabel = $("label[for='" + this.opts.element.attr("id") + "']");
2284
- this.opts.element.on('focus.select2', this.bind(function () { this.focus(); }));
2285
 
2286
- this.focusser.prev()
2287
- .text(elementLabel.text())
2288
- .attr('for', this.focusser.attr('id'));
2289
 
2290
- // Ensure the original element retains an accessible name
2291
- var originalTitle = this.opts.element.attr("title");
2292
- this.opts.element.attr("title", (originalTitle || elementLabel.text()));
2293
 
2294
- this.focusser.attr("tabindex", this.elementTabIndex);
 
2295
 
2296
- // write label for search field using the label from the focusser element
2297
- this.search.attr("id", this.focusser.attr('id') + '_search');
2298
 
2299
- this.search.prev()
2300
- .text($("label[for='" + this.focusser.attr('id') + "']").text())
2301
- .attr('for', this.search.attr('id'));
2302
 
2303
- this.search.on("keydown", this.bind(function (e) {
2304
- if (!this.isInterfaceEnabled()) return;
 
 
 
2305
 
2306
- // filter 229 keyCodes (input method editor is processing key input)
2307
- if (229 == e.keyCode) return;
 
 
 
 
 
 
2308
 
2309
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
2310
- // prevent the page from scrolling
2311
- killEvent(e);
2312
- return;
2313
- }
2314
 
2315
- switch (e.which) {
2316
- case KEY.UP:
2317
- case KEY.DOWN:
2318
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
2319
- killEvent(e);
2320
- return;
2321
- case KEY.ENTER:
2322
- this.selectHighlighted();
2323
- killEvent(e);
2324
- return;
2325
- case KEY.TAB:
2326
- this.selectHighlighted({noFocus: true});
2327
- return;
2328
- case KEY.ESC:
2329
- this.cancel(e);
2330
- killEvent(e);
2331
- return;
2332
- }
2333
- }));
2334
-
2335
- this.search.on("blur", this.bind(function(e) {
2336
- // a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
2337
- // without this the search field loses focus which is annoying
2338
- if (document.activeElement === this.body.get(0)) {
2339
- window.setTimeout(this.bind(function() {
2340
- if (this.opened() && this.results && this.results.length > 1) {
2341
- this.search.focus();
2342
- }
2343
- }), 0);
2344
- }
2345
- }));
2346
 
2347
- this.focusser.on("keydown", this.bind(function (e) {
2348
- if (!this.isInterfaceEnabled()) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2349
 
2350
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
2351
- return;
2352
- }
2353
 
2354
- if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
2355
- killEvent(e);
2356
- return;
2357
- }
2358
 
2359
- if (e.which == KEY.DOWN || e.which == KEY.UP
2360
- || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
2361
 
2362
- if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
 
2363
 
2364
- this.open();
2365
- killEvent(e);
2366
- return;
2367
- }
2368
 
2369
- if (e.which == KEY.DELETE || e.which == KEY.BACKSPACE) {
2370
- if (this.opts.allowClear) {
2371
- this.clear();
2372
- }
2373
- killEvent(e);
2374
- return;
2375
- }
2376
- }));
2377
 
 
2378
 
2379
- installKeyUpChangeEvent(this.focusser);
2380
- this.focusser.on("keyup-change input", this.bind(function(e) {
2381
- if (this.opts.minimumResultsForSearch >= 0) {
2382
- e.stopPropagation();
2383
- if (this.opened()) return;
2384
- this.open();
2385
- }
2386
- }));
2387
 
2388
- selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
2389
- if (!this.isInterfaceEnabled()) {
2390
- return;
2391
- }
2392
 
2393
- this.clear();
2394
- killEventImmediately(e);
2395
- this.close();
 
 
2396
 
2397
- if (this.selection) {
2398
- this.selection.focus();
2399
- }
2400
- }));
2401
 
2402
- if(this.supportsTouchEvents) {
2403
- selection.on("mousedown touchstart", this.bind(function (e) {
2404
- // Prevent IE from generating a click event on the body
2405
- reinsertElement(selection);
 
 
 
2406
 
2407
- if (!this.container.hasClass("select2-container-active")) {
2408
- this.opts.element.trigger($.Event("select2-focus"));
2409
- }
2410
 
2411
- if (this.opened()) {
2412
- this.close();
2413
- } else if (this.isInterfaceEnabled()) {
2414
- this.open();
2415
- }
2416
 
2417
- killEvent(e);
2418
- }));
2419
- } else {
2420
- selection.on("mousedown", this.bind(function (e) {
2421
- // Prevent IE from generating a click event on the body
2422
- reinsertElement(selection);
2423
 
2424
- if (!this.container.hasClass("select2-container-active")) {
2425
- this.opts.element.trigger($.Event("select2-focus"));
2426
- }
2427
 
2428
- if (this.opened()) {
2429
- this.close();
2430
- } else if (this.isInterfaceEnabled()) {
2431
- this.open();
2432
- }
2433
 
2434
- killEvent(e);
2435
- }));
2436
- }
2437
 
2438
- dropdown.on("mousedown touchstart", this.bind(function() {
2439
- if (this.opts.shouldFocusInput(this)) {
2440
- this.search.focus();
2441
- }
2442
- }));
2443
 
2444
- selection.on("focus", this.bind(function(e) {
2445
- killEvent(e);
2446
- }));
2447
 
2448
- this.focusser.on("focus", this.bind(function(){
2449
- if (!this.container.hasClass("select2-container-active")) {
2450
- this.opts.element.trigger($.Event("select2-focus"));
2451
- }
2452
- this.container.addClass("select2-container-active");
2453
- })).on("blur", this.bind(function() {
2454
- if (!this.opened()) {
2455
- this.container.removeClass("select2-container-active");
2456
- this.opts.element.trigger($.Event("select2-blur"));
2457
- }
2458
- }));
2459
- this.search.on("focus", this.bind(function(){
2460
- if (!this.container.hasClass("select2-container-active")) {
2461
- this.opts.element.trigger($.Event("select2-focus"));
2462
- }
2463
- this.container.addClass("select2-container-active");
2464
- }));
2465
 
2466
- this.initContainerWidth();
2467
- this.opts.element.hide();
2468
- this.setPlaceholder();
2469
 
2470
- },
 
 
 
 
2471
 
2472
- // single
2473
- clear: function(triggerChange) {
2474
- var data=this.selection.data("select2-data");
2475
- if (data) { // guard against queued quick consecutive clicks
2476
- var evt = $.Event("select2-clearing");
2477
- this.opts.element.trigger(evt);
2478
- if (evt.isDefaultPrevented()) {
2479
- return;
2480
- }
2481
- var placeholderOption = this.getPlaceholderOption();
2482
- this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
2483
- this.selection.find(".select2-chosen").empty();
2484
- this.selection.removeData("select2-data");
2485
- this.setPlaceholder();
2486
-
2487
- if (triggerChange !== false){
2488
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
2489
- this.triggerChange({removed:data});
2490
- }
2491
- }
2492
- },
2493
 
2494
- /**
2495
- * Sets selection based on source element's value
2496
- */
2497
- // single
2498
- initSelection: function () {
2499
- var selected;
2500
- if (this.isPlaceholderOptionSelected()) {
2501
- this.updateSelection(null);
2502
- this.close();
2503
- this.setPlaceholder();
2504
- } else {
2505
- var self = this;
2506
- this.opts.initSelection.call(null, this.opts.element, function(selected){
2507
- if (selected !== undefined && selected !== null) {
2508
- self.updateSelection(selected);
2509
- self.close();
2510
- self.setPlaceholder();
2511
- self.lastSearchTerm = self.search.val();
2512
- }
2513
- });
2514
- }
2515
- },
2516
 
2517
- isPlaceholderOptionSelected: function() {
2518
- var placeholderOption;
2519
- if (this.getPlaceholder() === undefined) return false; // no placeholder specified so no option should be considered
2520
- return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
2521
- || (this.opts.element.val() === "")
2522
- || (this.opts.element.val() === undefined)
2523
- || (this.opts.element.val() === null);
2524
- },
2525
 
2526
- // single
2527
- prepareOpts: function () {
2528
- var opts = this.parent.prepareOpts.apply(this, arguments),
2529
- self=this;
2530
-
2531
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
2532
- // install the selection initializer
2533
- opts.initSelection = function (element, callback) {
2534
- var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
2535
- // a single select box always has a value, no need to null check 'selected'
2536
- callback(self.optionToData(selected));
2537
- };
2538
- } else if ("data" in opts) {
2539
- // install default initSelection when applied to hidden input and data is local
2540
- opts.initSelection = opts.initSelection || function (element, callback) {
2541
- var id = element.val();
2542
- //search in data by id, storing the actual matching item
2543
- var match = null;
2544
- opts.query({
2545
- matcher: function(term, text, el){
2546
- var is_match = equal(id, opts.id(el));
2547
- if (is_match) {
2548
- match = el;
2549
- }
2550
- return is_match;
2551
- },
2552
- callback: !$.isFunction(callback) ? $.noop : function() {
2553
- callback(match);
2554
- }
2555
- });
2556
- };
2557
- }
2558
 
2559
- return opts;
2560
- },
 
 
2561
 
2562
- // single
2563
- getPlaceholder: function() {
2564
- // if a placeholder is specified on a single select without a valid placeholder option ignore it
2565
- if (this.select) {
2566
- if (this.getPlaceholderOption() === undefined) {
2567
- return undefined;
2568
- }
2569
- }
2570
 
2571
- return this.parent.getPlaceholder.apply(this, arguments);
2572
- },
2573
 
2574
- // single
2575
- setPlaceholder: function () {
2576
- var placeholder = this.getPlaceholder();
 
2577
 
2578
- if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
2579
 
2580
- // check for a placeholder option if attached to a select
2581
- if (this.select && this.getPlaceholderOption() === undefined) return;
2582
 
2583
- this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
 
 
 
2584
 
2585
- this.selection.addClass("select2-default");
 
 
2586
 
2587
- this.container.removeClass("select2-allowclear");
2588
- }
2589
- },
 
 
2590
 
2591
- // single
2592
- postprocessResults: function (data, initial, noHighlightUpdate) {
2593
- var selected = 0, self = this, showSearchInput = true;
2594
 
2595
- // find the selected element in the result list
 
2596
 
2597
- this.findHighlightableChoices().each2(function (i, elm) {
2598
- if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
2599
- selected = i;
2600
- return false;
2601
- }
2602
- });
2603
 
2604
- // and highlight it
2605
- if (noHighlightUpdate !== false) {
2606
- if (initial === true && selected >= 0) {
2607
- this.highlight(selected);
2608
- } else {
2609
- this.highlight(0);
2610
- }
2611
- }
2612
 
2613
- // hide the search box if this is the first we got the results and there are enough of them for search
 
2614
 
2615
- if (initial === true) {
2616
- var min = this.opts.minimumResultsForSearch;
2617
- if (min >= 0) {
2618
- this.showSearch(countResults(data.results) >= min);
2619
- }
2620
- }
2621
- },
2622
 
2623
- // single
2624
- showSearch: function(showSearchInput) {
2625
- if (this.showSearchInput === showSearchInput) return;
 
 
 
2626
 
2627
- this.showSearchInput = showSearchInput;
 
2628
 
2629
- this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
2630
- this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !showSearchInput);
2631
- //add "select2-with-searchbox" to the container if search box is shown
2632
- $(this.dropdown, this.container).toggleClass("select2-with-searchbox", showSearchInput);
2633
- },
2634
 
2635
- // single
2636
- onSelect: function (data, options) {
 
 
 
 
 
 
2637
 
2638
- if (!this.triggerSelect(data)) { return; }
 
 
 
 
 
 
 
2639
 
2640
- var old = this.opts.element.val(),
2641
- oldData = this.data();
2642
 
2643
- this.opts.element.val(this.id(data));
2644
- this.updateSelection(data);
2645
 
2646
- this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
2647
 
2648
- this.lastSearchTerm = this.search.val();
2649
- this.close();
2650
 
2651
- if ((!options || !options.noFocus) && this.opts.shouldFocusInput(this)) {
2652
- this.focusser.focus();
2653
- }
2654
 
2655
- if (!equal(old, this.id(data))) {
2656
- this.triggerChange({ added: data, removed: oldData });
2657
- }
2658
- },
2659
 
2660
- // single
2661
- updateSelection: function (data) {
 
2662
 
2663
- var container=this.selection.find(".select2-chosen"), formatted, cssClass;
 
 
 
 
2664
 
2665
- this.selection.data("select2-data", data);
 
2666
 
2667
- container.empty();
2668
- if (data !== null) {
2669
- formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
2670
- }
2671
- if (formatted !== undefined) {
2672
- container.append(formatted);
2673
- }
2674
- cssClass=this.opts.formatSelectionCssClass(data, container);
2675
- if (cssClass !== undefined) {
2676
- container.addClass(cssClass);
2677
- }
2678
 
2679
- this.selection.removeClass("select2-default");
 
 
2680
 
2681
- if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
2682
- this.container.addClass("select2-allowclear");
2683
- }
2684
- },
2685
 
2686
- // single
2687
- val: function () {
2688
- var val,
2689
- triggerChange = false,
2690
- data = null,
2691
- self = this,
2692
- oldData = this.data();
2693
 
2694
- if (arguments.length === 0) {
2695
- return this.opts.element.val();
2696
- }
2697
 
2698
- val = arguments[0];
 
 
2699
 
2700
- if (arguments.length > 1) {
2701
- triggerChange = arguments[1];
2702
 
2703
- if (this.opts.debug && console && console.warn) {
2704
- console.warn(
2705
- 'Select2: The second option to `select2("val")` is not supported in Select2 4.0.0. ' +
2706
- 'The `change` event will always be triggered in 4.0.0.'
2707
- );
2708
- }
2709
- }
2710
 
2711
- if (this.select) {
2712
- if (this.opts.debug && console && console.warn) {
2713
- console.warn(
2714
- 'Select2: Setting the value on a <select> using `select2("val")` is no longer supported in 4.0.0. ' +
2715
- 'You can use the `.val(newValue).trigger("change")` method provided by jQuery instead.'
2716
- );
2717
- }
2718
 
2719
- this.select
2720
- .val(val)
2721
- .find("option").filter(function() { return this.selected }).each2(function (i, elm) {
2722
- data = self.optionToData(elm);
2723
- return false;
2724
- });
2725
- this.updateSelection(data);
2726
- this.setPlaceholder();
2727
- if (triggerChange) {
2728
- this.triggerChange({added: data, removed:oldData});
2729
- }
2730
- } else {
2731
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
2732
- if (!val && val !== 0) {
2733
- this.clear(triggerChange);
2734
- return;
2735
- }
2736
- if (this.opts.initSelection === undefined) {
2737
- throw new Error("cannot call val() if initSelection() is not defined");
2738
- }
2739
- this.opts.element.val(val);
2740
- this.opts.initSelection(this.opts.element, function(data){
2741
- self.opts.element.val(!data ? "" : self.id(data));
2742
- self.updateSelection(data);
2743
- self.setPlaceholder();
2744
- if (triggerChange) {
2745
- self.triggerChange({added: data, removed:oldData});
2746
- }
2747
- });
2748
- }
2749
- },
2750
 
2751
- // single
2752
- clearSearch: function () {
2753
- this.search.val("");
2754
- this.focusser.val("");
2755
- },
2756
 
2757
- // single
2758
- data: function(value) {
2759
- var data,
2760
- triggerChange = false;
2761
 
2762
- if (arguments.length === 0) {
2763
- data = this.selection.data("select2-data");
2764
- if (data == undefined) data = null;
2765
- return data;
2766
- } else {
2767
- if (this.opts.debug && console && console.warn) {
2768
- console.warn(
2769
- 'Select2: The `select2("data")` method can no longer set selected values in 4.0.0, ' +
2770
- 'consider using the `.val()` method instead.'
2771
- );
2772
- }
2773
 
2774
- if (arguments.length > 1) {
2775
- triggerChange = arguments[1];
2776
- }
2777
- if (!value) {
2778
- this.clear(triggerChange);
2779
- } else {
2780
- data = this.data();
2781
- this.opts.element.val(!value ? "" : this.id(value));
2782
- this.updateSelection(value);
2783
- if (triggerChange) {
2784
- this.triggerChange({added: value, removed:data});
2785
- }
2786
- }
2787
- }
2788
  }
 
2789
  });
2790
 
2791
- MultiSelect2 = clazz(AbstractSelect2, {
2792
-
2793
- // multi
2794
- createContainer: function () {
2795
- var container = $(document.createElement("div")).attr({
2796
- "class": "select2-container select2-container-multi"
2797
- }).html([
2798
- "<ul class='select2-choices'>",
2799
- " <li class='select2-search-field'>",
2800
- " <label for='' class='select2-offscreen'></label>",
2801
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>",
2802
- " </li>",
2803
- "</ul>",
2804
- "<div class='select2-drop select2-drop-multi select2-display-none'>",
2805
- " <ul class='select2-results'>",
2806
- " </ul>",
2807
- "</div>"].join(""));
2808
- return container;
2809
- },
 
 
 
2810
 
2811
- // multi
2812
- prepareOpts: function () {
2813
- var opts = this.parent.prepareOpts.apply(this, arguments),
2814
- self=this;
2815
-
2816
- // TODO validate placeholder is a string if specified
2817
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
2818
- // install the selection initializer
2819
- opts.initSelection = function (element, callback) {
2820
-
2821
- var data = [];
2822
-
2823
- element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
2824
- data.push(self.optionToData(elm));
2825
- });
2826
- callback(data);
2827
- };
2828
- } else if ("data" in opts) {
2829
- // install default initSelection when applied to hidden input and data is local
2830
- opts.initSelection = opts.initSelection || function (element, callback) {
2831
- var ids = splitVal(element.val(), opts.separator, opts.transformVal);
2832
- //search in data by array of ids, storing matching items in a list
2833
- var matches = [];
2834
- opts.query({
2835
- matcher: function(term, text, el){
2836
- var is_match = $.grep(ids, function(id) {
2837
- return equal(id, opts.id(el));
2838
- }).length;
2839
- if (is_match) {
2840
- matches.push(el);
2841
- }
2842
- return is_match;
2843
- },
2844
- callback: !$.isFunction(callback) ? $.noop : function() {
2845
- // reorder matches based on the order they appear in the ids array because right now
2846
- // they are in the order in which they appear in data array
2847
- var ordered = [];
2848
- for (var i = 0; i < ids.length; i++) {
2849
- var id = ids[i];
2850
- for (var j = 0; j < matches.length; j++) {
2851
- var match = matches[j];
2852
- if (equal(id, opts.id(match))) {
2853
- ordered.push(match);
2854
- matches.splice(j, 1);
2855
- break;
2856
- }
2857
- }
2858
- }
2859
- callback(ordered);
2860
- }
2861
- });
2862
- };
2863
- }
2864
 
2865
- return opts;
2866
- },
2867
 
2868
- // multi
2869
- selectChoice: function (choice) {
 
 
2870
 
2871
- var selected = this.container.find(".select2-search-choice-focus");
2872
- if (selected.length && choice && choice[0] == selected[0]) {
 
 
2873
 
2874
- } else {
2875
- if (selected.length) {
2876
- this.opts.element.trigger("choice-deselected", selected);
2877
- }
2878
- selected.removeClass("select2-search-choice-focus");
2879
- if (choice && choice.length) {
2880
- this.close();
2881
- choice.addClass("select2-search-choice-focus");
2882
- this.opts.element.trigger("choice-selected", choice);
2883
- }
2884
- }
2885
- },
2886
 
2887
- // multi
2888
- destroy: function() {
2889
- $("label[for='" + this.search.attr('id') + "']")
2890
- .attr('for', this.opts.element.attr("id"));
2891
- this.parent.destroy.apply(this, arguments);
 
 
 
 
 
 
2892
 
2893
- cleanupJQueryElements.call(this,
2894
- "searchContainer",
2895
- "selection"
2896
- );
2897
- },
2898
 
2899
- // multi
2900
- initContainer: function () {
2901
 
2902
- var selector = ".select2-choices", selection;
2903
 
2904
- this.searchContainer = this.container.find(".select2-search-field");
2905
- this.selection = selection = this.container.find(selector);
2906
 
2907
- var _this = this;
2908
- this.selection.on("click", ".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)", function (e) {
2909
- _this.search[0].focus();
2910
- _this.selectChoice($(this));
2911
- });
2912
 
2913
- // rewrite labels from original element to focusser
2914
- this.search.attr("id", "s2id_autogen"+nextUid());
 
 
 
2915
 
2916
- this.search.prev()
2917
- .text($("label[for='" + this.opts.element.attr("id") + "']").text())
2918
- .attr('for', this.search.attr('id'));
2919
- this.opts.element.on('focus.select2', this.bind(function () { this.focus(); }));
2920
 
2921
- this.search.on("input paste", this.bind(function() {
2922
- if (this.search.attr('placeholder') && this.search.val().length == 0) return;
2923
- if (!this.isInterfaceEnabled()) return;
2924
- if (!this.opened()) {
2925
- this.open();
2926
- }
2927
- }));
2928
 
2929
- this.search.attr("tabindex", this.elementTabIndex);
 
 
 
2930
 
2931
- this.keydowns = 0;
2932
- this.search.on("keydown", this.bind(function (e) {
2933
- if (!this.isInterfaceEnabled()) return;
2934
 
2935
- ++this.keydowns;
2936
- var selected = selection.find(".select2-search-choice-focus");
2937
- var prev = selected.prev(".select2-search-choice:not(.select2-locked)");
2938
- var next = selected.next(".select2-search-choice:not(.select2-locked)");
2939
- var pos = getCursorInfo(this.search);
2940
 
2941
- if (selected.length &&
2942
- (e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
2943
- var selectedChoice = selected;
2944
- if (e.which == KEY.LEFT && prev.length) {
2945
- selectedChoice = prev;
2946
- }
2947
- else if (e.which == KEY.RIGHT) {
2948
- selectedChoice = next.length ? next : null;
2949
- }
2950
- else if (e.which === KEY.BACKSPACE) {
2951
- if (this.unselect(selected.first())) {
2952
- this.search.width(10);
2953
- selectedChoice = prev.length ? prev : next;
2954
- }
2955
- } else if (e.which == KEY.DELETE) {
2956
- if (this.unselect(selected.first())) {
2957
- this.search.width(10);
2958
- selectedChoice = next.length ? next : null;
2959
- }
2960
- } else if (e.which == KEY.ENTER) {
2961
- selectedChoice = null;
2962
- }
2963
 
2964
- this.selectChoice(selectedChoice);
2965
- killEvent(e);
2966
- if (!selectedChoice || !selectedChoice.length) {
2967
- this.open();
2968
- }
2969
- return;
2970
- } else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
2971
- || e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
2972
 
2973
- this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last());
2974
- killEvent(e);
2975
- return;
2976
- } else {
2977
- this.selectChoice(null);
2978
- }
2979
 
2980
- if (this.opened()) {
2981
- switch (e.which) {
2982
- case KEY.UP:
2983
- case KEY.DOWN:
2984
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
2985
- killEvent(e);
2986
- return;
2987
- case KEY.ENTER:
2988
- this.selectHighlighted();
2989
- killEvent(e);
2990
- return;
2991
- case KEY.TAB:
2992
- this.selectHighlighted({noFocus:true});
2993
- this.close();
2994
- return;
2995
- case KEY.ESC:
2996
- this.cancel(e);
2997
- killEvent(e);
2998
- return;
2999
- }
3000
- }
3001
 
3002
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
3003
- || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
3004
- return;
3005
- }
3006
 
3007
- if (e.which === KEY.ENTER) {
3008
- if (this.opts.openOnEnter === false) {
3009
- return;
3010
- } else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
3011
- return;
3012
- }
3013
- }
3014
 
3015
- this.open();
 
3016
 
3017
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
3018
- // prevent the page from scrolling
3019
- killEvent(e);
3020
- }
3021
 
3022
- if (e.which === KEY.ENTER) {
3023
- // prevent form from being submitted
3024
- killEvent(e);
3025
- }
 
 
 
 
3026
 
3027
- }));
3028
 
3029
- this.search.on("keyup", this.bind(function (e) {
3030
- this.keydowns = 0;
3031
- this.resizeSearch();
3032
- })
3033
- );
3034
 
3035
- this.search.on("blur", this.bind(function(e) {
3036
- this.container.removeClass("select2-container-active");
3037
- this.search.removeClass("select2-focused");
3038
- this.selectChoice(null);
3039
- if (!this.opened()) this.clearSearch();
3040
- e.stopImmediatePropagation();
3041
- this.opts.element.trigger($.Event("select2-blur"));
3042
- }));
3043
-
3044
- this.container.on("click", selector, this.bind(function (e) {
3045
- if (!this.isInterfaceEnabled()) return;
3046
- if ($(e.target).closest(".select2-search-choice").length > 0) {
3047
- // clicked inside a select2 search choice, do not open
3048
- return;
3049
- }
3050
- this.selectChoice(null);
3051
- this.clearPlaceholder();
3052
- if (!this.container.hasClass("select2-container-active")) {
3053
- this.opts.element.trigger($.Event("select2-focus"));
3054
- }
3055
- this.open();
3056
- this.focusSearch();
3057
- e.preventDefault();
3058
- }));
3059
-
3060
- this.container.on("focus", selector, this.bind(function () {
3061
- if (!this.isInterfaceEnabled()) return;
3062
- if (!this.container.hasClass("select2-container-active")) {
3063
- this.opts.element.trigger($.Event("select2-focus"));
3064
- }
3065
- this.container.addClass("select2-container-active");
3066
- this.dropdown.addClass("select2-drop-active");
3067
- this.clearPlaceholder();
3068
- }));
3069
 
3070
- this.initContainerWidth();
3071
- this.opts.element.hide();
3072
 
3073
- // set the placeholder if necessary
3074
- this.clearSearch();
3075
- },
 
3076
 
3077
- // multi
3078
- enableInterface: function() {
3079
- if (this.parent.enableInterface.apply(this, arguments)) {
3080
- this.search.prop("disabled", !this.isInterfaceEnabled());
3081
- }
3082
- },
3083
 
3084
- // multi
3085
- initSelection: function () {
3086
- var data;
3087
- if (this.opts.element.val() === "" && this.opts.element.text() === "") {
3088
- this.updateSelection([]);
3089
- this.close();
3090
- // set the placeholder if necessary
3091
- this.clearSearch();
3092
- }
3093
- if (this.select || this.opts.element.val() !== "") {
3094
- var self = this;
3095
- this.opts.initSelection.call(null, this.opts.element, function(data){
3096
- if (data !== undefined && data !== null) {
3097
- self.updateSelection(data);
3098
- self.close();
3099
- // set the placeholder if necessary
3100
- self.clearSearch();
3101
- }
3102
- });
3103
- }
3104
- },
3105
 
3106
- // multi
3107
- clearSearch: function () {
3108
- var placeholder = this.getPlaceholder(),
3109
- maxWidth = this.getMaxSearchWidth();
3110
 
3111
- if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
3112
- this.search.val(placeholder).addClass("select2-default");
3113
- // stretch the search box to full width of the container so as much of the placeholder is visible as possible
3114
- // we could call this.resizeSearch(), but we do not because that requires a sizer and we do not want to create one so early because of a firefox bug, see #944
3115
- this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
3116
- } else {
3117
- this.search.val("").width(10);
3118
- }
3119
- },
3120
 
3121
- // multi
3122
- clearPlaceholder: function () {
3123
- if (this.search.hasClass("select2-default")) {
3124
- this.search.val("").removeClass("select2-default");
3125
- }
3126
- },
 
3127
 
3128
- // multi
3129
- opening: function () {
3130
- this.clearPlaceholder(); // should be done before super so placeholder is not used to search
3131
- this.resizeSearch();
3132
 
3133
- this.parent.opening.apply(this, arguments);
 
 
3134
 
3135
- this.focusSearch();
 
 
3136
 
3137
- this.prefillNextSearchTerm();
3138
- this.updateResults(true);
3139
 
3140
- if (this.opts.shouldFocusInput(this)) {
3141
- this.search.focus();
3142
- }
3143
- this.opts.element.trigger($.Event("select2-open"));
3144
- },
3145
 
3146
- // multi
3147
- close: function () {
3148
- if (!this.opened()) return;
3149
- this.parent.close.apply(this, arguments);
3150
- },
3151
 
3152
- // multi
3153
- focus: function () {
3154
- this.close();
3155
- this.search.focus();
3156
- },
3157
 
3158
- // multi
3159
- isFocused: function () {
3160
- return this.search.hasClass("select2-focused");
3161
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3162
 
3163
- // multi
3164
- updateSelection: function (data) {
3165
- var ids = {}, filtered = [], self = this;
3166
 
3167
- // filter out duplicates
3168
- $(data).each(function () {
3169
- if (!(self.id(this) in ids)) {
3170
- ids[self.id(this)] = 0;
3171
- filtered.push(this);
3172
- }
3173
- });
 
3174
 
3175
- this.selection.find(".select2-search-choice").remove();
3176
- this.addSelectedChoice(filtered);
3177
- self.postprocessResults();
3178
- },
3179
 
3180
- // multi
3181
- tokenize: function() {
3182
- var input = this.search.val();
3183
- input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
3184
- if (input != null && input != undefined) {
3185
- this.search.val(input);
3186
- if (input.length > 0) {
3187
- this.open();
3188
- }
3189
- }
3190
 
3191
- },
 
 
3192
 
3193
- // multi
3194
- onSelect: function (data, options) {
3195
 
3196
- if (!this.triggerSelect(data) || data.text === "") { return; }
3197
 
3198
- this.addSelectedChoice(data);
 
3199
 
3200
- this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
 
3201
 
3202
- // keep track of the search's value before it gets cleared
3203
- this.lastSearchTerm = this.search.val();
3204
 
3205
- this.clearSearch();
3206
- this.updateResults();
3207
 
3208
- if (this.select || !this.opts.closeOnSelect) this.postprocessResults(data, false, this.opts.closeOnSelect===true);
 
 
3209
 
3210
- if (this.opts.closeOnSelect) {
3211
- this.close();
3212
- this.search.width(10);
3213
- } else {
3214
- if (this.countSelectableResults()>0) {
3215
- this.search.width(10);
3216
- this.resizeSearch();
3217
- if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
3218
- // if we reached max selection size repaint the results so choices
3219
- // are replaced with the max selection reached message
3220
- this.updateResults(true);
3221
- } else {
3222
- // initializes search's value with nextSearchTerm and update search result
3223
- if (this.prefillNextSearchTerm()) {
3224
- this.updateResults();
3225
- }
3226
- }
3227
- this.positionDropdown();
3228
- } else {
3229
- // if nothing left to select close
3230
- this.close();
3231
- this.search.width(10);
3232
- }
3233
- }
3234
 
3235
- // since its not possible to select an element that has already been
3236
- // added we do not need to check if this is a new element before firing change
3237
- this.triggerChange({ added: data });
3238
 
3239
- if (!options || !options.noFocus)
3240
- this.focusSearch();
3241
- },
3242
 
3243
- // multi
3244
- cancel: function () {
3245
- this.close();
3246
- this.focusSearch();
3247
- },
3248
 
3249
- addSelectedChoice: function (data) {
3250
- var val = this.getVal(), self = this;
3251
- $(data).each(function () {
3252
- val.push(self.createChoice(this));
3253
- });
3254
- this.setVal(val);
3255
- },
3256
 
3257
- createChoice: function (data) {
3258
- var enableChoice = !data.locked,
3259
- enabledItem = $(
3260
- "<li class='select2-search-choice'>" +
3261
- " <div></div>" +
3262
- " <a href='#' class='select2-search-choice-close' tabindex='-1'></a>" +
3263
- "</li>"),
3264
- disabledItem = $(
3265
- "<li class='select2-search-choice select2-locked'>" +
3266
- "<div></div>" +
3267
- "</li>");
3268
- var choice = enableChoice ? enabledItem : disabledItem,
3269
- id = this.id(data),
3270
- formatted,
3271
- cssClass;
3272
-
3273
- formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
3274
- if (formatted != undefined) {
3275
- choice.find("div").replaceWith($("<div></div>").html(formatted));
3276
- }
3277
- cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
3278
- if (cssClass != undefined) {
3279
- choice.addClass(cssClass);
3280
- }
3281
 
3282
- if(enableChoice){
3283
- choice.find(".select2-search-choice-close")
3284
- .on("mousedown", killEvent)
3285
- .on("click dblclick", this.bind(function (e) {
3286
- if (!this.isInterfaceEnabled()) return;
3287
-
3288
- this.unselect($(e.target));
3289
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
3290
- killEvent(e);
3291
- this.close();
3292
- this.focusSearch();
3293
- })).on("focus", this.bind(function () {
3294
- if (!this.isInterfaceEnabled()) return;
3295
- this.container.addClass("select2-container-active");
3296
- this.dropdown.addClass("select2-drop-active");
3297
- }));
3298
- }
3299
 
3300
- choice.data("select2-data", data);
3301
- choice.insertBefore(this.searchContainer);
 
 
3302
 
3303
- return id;
3304
- },
3305
 
3306
- // multi
3307
- unselect: function (selected) {
3308
- var val = this.getVal(),
3309
- data,
3310
- index;
3311
- selected = selected.closest(".select2-search-choice");
3312
 
3313
- if (selected.length === 0) {
3314
- throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
3315
- }
3316
 
3317
- data = selected.data("select2-data");
 
3318
 
3319
- if (!data) {
3320
- // prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
3321
- // and invoked on an element already removed
3322
- return;
3323
- }
3324
 
3325
- var evt = $.Event("select2-removing");
3326
- evt.val = this.id(data);
3327
- evt.choice = data;
3328
- this.opts.element.trigger(evt);
3329
 
3330
- if (evt.isDefaultPrevented()) {
3331
- return false;
3332
- }
3333
 
3334
- while((index = indexOf(this.id(data), val)) >= 0) {
3335
- val.splice(index, 1);
3336
- this.setVal(val);
3337
- if (this.select) this.postprocessResults();
3338
- }
3339
 
3340
- selected.remove();
 
 
 
3341
 
3342
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
3343
- this.triggerChange({ removed: data });
3344
 
3345
- return true;
3346
- },
 
3347
 
3348
- // multi
3349
- postprocessResults: function (data, initial, noHighlightUpdate) {
3350
- var val = this.getVal(),
3351
- choices = this.results.find(".select2-result"),
3352
- compound = this.results.find(".select2-result-with-children"),
3353
- self = this;
3354
-
3355
- choices.each2(function (i, choice) {
3356
- var id = self.id(choice.data("select2-data"));
3357
- if (indexOf(id, val) >= 0) {
3358
- choice.addClass("select2-selected");
3359
- // mark all children of the selected parent as selected
3360
- choice.find(".select2-result-selectable").addClass("select2-selected");
3361
- }
3362
- });
3363
 
3364
- compound.each2(function(i, choice) {
3365
- // hide an optgroup if it doesn't have any selectable children
3366
- if (!choice.is('.select2-result-selectable')
3367
- && choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
3368
- choice.addClass("select2-selected");
3369
- }
3370
- });
3371
 
3372
- if (this.highlight() == -1 && noHighlightUpdate !== false && this.opts.closeOnSelect === true){
3373
- self.highlight(0);
3374
- }
3375
 
3376
- //If all results are chosen render formatNoMatches
3377
- if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
3378
- if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
3379
- if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
3380
- this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.opts.element, self.search.val()) + "</li>");
3381
- }
3382
- }
3383
- }
3384
 
3385
- },
 
 
 
 
 
 
3386
 
3387
- // multi
3388
- getMaxSearchWidth: function() {
3389
- return this.selection.width() - getSideBorderPadding(this.search);
3390
- },
3391
 
3392
- // multi
3393
- resizeSearch: function () {
3394
- var minimumWidth, left, maxWidth, containerLeft, searchWidth,
3395
- sideBorderPadding = getSideBorderPadding(this.search);
3396
 
3397
- minimumWidth = measureTextWidth(this.search) + 10;
 
3398
 
3399
- left = this.search.offset().left;
 
 
3400
 
3401
- maxWidth = this.selection.width();
3402
- containerLeft = this.selection.offset().left;
3403
 
3404
- searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
3405
 
3406
- if (searchWidth < minimumWidth) {
3407
- searchWidth = maxWidth - sideBorderPadding;
3408
- }
 
3409
 
3410
- if (searchWidth < 40) {
3411
- searchWidth = maxWidth - sideBorderPadding;
3412
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3413
 
3414
- if (searchWidth <= 0) {
3415
- searchWidth = minimumWidth;
3416
- }
3417
 
3418
- this.search.width(Math.floor(searchWidth));
3419
- },
 
3420
 
3421
- // multi
3422
- getVal: function () {
3423
- var val;
3424
- if (this.select) {
3425
- val = this.select.val();
3426
- return val === null ? [] : val;
3427
- } else {
3428
- val = this.opts.element.val();
3429
- return splitVal(val, this.opts.separator, this.opts.transformVal);
3430
- }
3431
- },
3432
 
3433
- // multi
3434
- setVal: function (val) {
3435
- if (this.select) {
3436
- this.select.val(val);
3437
- } else {
3438
- var unique = [], valMap = {};
3439
- // filter out duplicates
3440
- $(val).each(function () {
3441
- if (!(this in valMap)) {
3442
- unique.push(this);
3443
- valMap[this] = 0;
3444
- }
3445
- });
3446
- this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
3447
- }
3448
- },
3449
 
3450
- // multi
3451
- buildChangeDetails: function (old, current) {
3452
- var current = current.slice(0),
3453
- old = old.slice(0);
3454
-
3455
- // remove intersection from each array
3456
- for (var i = 0; i < current.length; i++) {
3457
- for (var j = 0; j < old.length; j++) {
3458
- if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
3459
- current.splice(i, 1);
3460
- i--;
3461
- old.splice(j, 1);
3462
- break;
3463
- }
3464
- }
3465
- }
3466
 
3467
- return {added: current, removed: old};
3468
- },
3469
 
 
 
3470
 
3471
- // multi
3472
- val: function (val, triggerChange) {
3473
- var oldData, self=this;
3474
 
3475
- if (arguments.length === 0) {
3476
- return this.getVal();
3477
- }
3478
 
3479
- oldData=this.data();
3480
- if (!oldData.length) oldData=[];
3481
 
3482
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
3483
- if (!val && val !== 0) {
3484
- this.opts.element.val("");
3485
- this.updateSelection([]);
3486
- this.clearSearch();
3487
- if (triggerChange) {
3488
- this.triggerChange({added: this.data(), removed: oldData});
3489
- }
3490
- return;
3491
- }
3492
 
3493
- // val is a list of ids
3494
- this.setVal(val);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3495
 
3496
- if (this.select) {
3497
- this.opts.initSelection(this.select, this.bind(this.updateSelection));
3498
- if (triggerChange) {
3499
- this.triggerChange(this.buildChangeDetails(oldData, this.data()));
3500
- }
3501
- } else {
3502
- if (this.opts.initSelection === undefined) {
3503
- throw new Error("val() cannot be called if initSelection() is not defined");
3504
- }
3505
 
3506
- this.opts.initSelection(this.opts.element, function(data){
3507
- var ids=$.map(data, self.id);
3508
- self.setVal(ids);
3509
- self.updateSelection(data);
3510
- self.clearSearch();
3511
- if (triggerChange) {
3512
- self.triggerChange(self.buildChangeDetails(oldData, self.data()));
3513
- }
3514
- });
3515
- }
3516
- this.clearSearch();
3517
- },
3518
 
3519
- // multi
3520
- onSortStart: function() {
3521
- if (this.select) {
3522
- throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
3523
- }
3524
 
3525
- // collapse search field into 0 width so its container can be collapsed as well
3526
- this.search.width(0);
3527
- // hide the container
3528
- this.searchContainer.hide();
3529
- },
 
 
3530
 
3531
- // multi
3532
- onSortEnd:function() {
 
3533
 
3534
- var val=[], self=this;
 
 
 
3535
 
3536
- // show search and move it to the end of the list
3537
- this.searchContainer.show();
3538
- // make sure the search container is the last item in the list
3539
- this.searchContainer.appendTo(this.searchContainer.parent());
3540
- // since we collapsed the width in dragStarted, we resize it here
3541
- this.resizeSearch();
3542
 
3543
- // update selection
3544
- this.selection.find(".select2-search-choice").each(function() {
3545
- val.push(self.opts.id($(this).data("select2-data")));
3546
- });
3547
- this.setVal(val);
3548
- this.triggerChange();
3549
- },
3550
 
3551
- // multi
3552
- data: function(values, triggerChange) {
3553
- var self=this, ids, old;
3554
- if (arguments.length === 0) {
3555
- return this.selection
3556
- .children(".select2-search-choice")
3557
- .map(function() { return $(this).data("select2-data"); })
3558
- .get();
3559
- } else {
3560
- old = this.data();
3561
- if (!values) { values = []; }
3562
- ids = $.map(values, function(e) { return self.opts.id(e); });
3563
- this.setVal(ids);
3564
- this.updateSelection(values);
3565
- this.clearSearch();
3566
- if (triggerChange) {
3567
- this.triggerChange(this.buildChangeDetails(old, this.data()));
3568
- }
3569
- }
3570
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3571
  });
3572
 
3573
- $.fn.select2 = function () {
 
3574
 
3575
- var args = Array.prototype.slice.call(arguments, 0),
3576
- opts,
3577
- select2,
3578
- method, value, multiple,
3579
- allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
3580
- valueMethods = ["opened", "isFocused", "container", "dropdown"],
3581
- propertyMethods = ["val", "data"],
3582
- methodsMap = { search: "externalSearch" };
3583
 
3584
- this.each(function () {
3585
- if (args.length === 0 || typeof(args[0]) === "object") {
3586
- opts = args.length === 0 ? {} : $.extend({}, args[0]);
3587
- opts.element = $(this);
3588
 
3589
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
3590
- multiple = opts.element.prop("multiple");
3591
- } else {
3592
- multiple = opts.multiple || false;
3593
- if ("tags" in opts) {opts.multiple = multiple = true;}
3594
- }
3595
 
3596
- select2 = multiple ? new window.Select2["class"].multi() : new window.Select2["class"].single();
3597
- select2.init(opts);
3598
- } else if (typeof(args[0]) === "string") {
 
3599
 
3600
- if (indexOf(args[0], allowedMethods) < 0) {
3601
- throw "Unknown method: " + args[0];
3602
- }
3603
 
3604
- value = undefined;
3605
- select2 = $(this).data("select2");
3606
- if (select2 === undefined) return;
 
 
 
3607
 
3608
- method=args[0];
 
3609
 
3610
- if (method === "container") {
3611
- value = select2.container;
3612
- } else if (method === "dropdown") {
3613
- value = select2.dropdown;
3614
- } else {
3615
- if (methodsMap[method]) method = methodsMap[method];
3616
 
3617
- value = select2[method].apply(select2, args.slice(1));
3618
- }
3619
- if (indexOf(args[0], valueMethods) >= 0
3620
- || (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
3621
- return false; // abort the iteration, ready to return first matched value
3622
- }
3623
- } else {
3624
- throw "Invalid arguments to select2 plugin: " + args;
3625
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3626
  });
3627
- return (value === undefined) ? this : value;
 
 
 
 
 
 
 
 
3628
  };
3629
 
3630
- // plugin defaults, accessible to users
3631
- $.fn.select2.defaults = {
3632
- debug: false,
3633
- width: "copy",
3634
- loadMorePadding: 0,
3635
- closeOnSelect: true,
3636
- openOnEnter: true,
3637
- containerCss: {},
3638
- dropdownCss: {},
3639
- containerCssClass: "",
3640
- dropdownCssClass: "",
3641
- formatResult: function(result, container, query, escapeMarkup) {
3642
- var markup=[];
3643
- markMatch(this.text(result), query.term, markup, escapeMarkup);
3644
- return markup.join("");
3645
- },
3646
- transformVal: function(val) {
3647
- return $.trim(val);
3648
- },
3649
- formatSelection: function (data, container, escapeMarkup) {
3650
- return data ? escapeMarkup(this.text(data)) : undefined;
3651
- },
3652
- sortResults: function (results, container, query) {
3653
- return results;
3654
- },
3655
- formatResultCssClass: function(data) {return data.css;},
3656
- formatSelectionCssClass: function(data, container) {return undefined;},
3657
- minimumResultsForSearch: 0,
3658
- minimumInputLength: 0,
3659
- maximumInputLength: null,
3660
- maximumSelectionSize: 0,
3661
- id: function (e) { return e == undefined ? null : e.id; },
3662
- text: function (e) {
3663
- if (e && this.data && this.data.text) {
3664
- if ($.isFunction(this.data.text)) {
3665
- return this.data.text(e);
3666
- } else {
3667
- return e[this.data.text];
3668
- }
3669
- } else {
3670
- return e.text;
3671
- }
3672
- },
3673
- matcher: function(term, text) {
3674
- return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
3675
- },
3676
- separator: ",",
3677
- tokenSeparators: [],
3678
- tokenizer: defaultTokenizer,
3679
- escapeMarkup: defaultEscapeMarkup,
3680
- blurOnChange: false,
3681
- selectOnBlur: false,
3682
- adaptContainerCssClass: function(c) { return c; },
3683
- adaptDropdownCssClass: function(c) { return null; },
3684
- nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
3685
- searchInputPlaceholder: '',
3686
- createSearchChoicePosition: 'top',
3687
- shouldFocusInput: function (instance) {
3688
- // Attempt to detect touch devices
3689
- var supportsTouchEvents = (('ontouchstart' in window) ||
3690
- (navigator.msMaxTouchPoints > 0));
3691
-
3692
- // Only devices which support touch events should be special cased
3693
- if (!supportsTouchEvents) {
3694
- return true;
3695
- }
3696
 
3697
- // Never focus the input if search is disabled
3698
- if (instance.opts.minimumResultsForSearch < 0) {
3699
- return false;
3700
- }
3701
 
3702
- return true;
3703
- }
3704
- };
3705
 
3706
- $.fn.select2.locales = [];
3707
-
3708
- $.fn.select2.locales['en'] = {
3709
- formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; },
3710
- formatNoMatches: function () { return "No matches found"; },
3711
- formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; },
3712
- formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
3713
- formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
3714
- formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
3715
- formatLoadMore: function (pageNumber) { return "Loading more results…"; },
3716
- formatSearching: function () { return "Searching…"; }
3717
- };
3718
 
3719
- $.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
 
 
3720
 
3721
- $.fn.select2.ajaxDefaults = {
3722
- transport: $.ajax,
3723
- params: {
3724
- type: "GET",
3725
- cache: false,
3726
- dataType: "json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3727
  }
3728
- };
3729
 
3730
- // exports
3731
- window.Select2 = {
3732
- query: {
3733
- ajax: ajax,
3734
- local: local,
3735
- tags: tags
3736
- }, util: {
3737
- debounce: debounce,
3738
- markMatch: markMatch,
3739
- escapeMarkup: defaultEscapeMarkup,
3740
- stripDiacritics: stripDiacritics
3741
- }, "class": {
3742
- "abstract": AbstractSelect2,
3743
- "single": SingleSelect2,
3744
- "multi": MultiSelect2
3745
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3746
  };
3747
 
3748
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Select2 4.0.3
3
+ * https://select2.github.io
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/select2/select2/blob/master/LICENSE.md
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if (typeof exports === 'object') {
13
+ // Node/CommonJS
14
+ factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function (jQuery) {
20
+ // This is needed so we can catch the AMD loader configuration and use it
21
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
22
+ // returns the AMD loader references.
23
+ var S2 =
24
+ (function () {
25
+ // Restore the Select2 AMD loader so it can be used
26
+ // Needed mostly in the language files, where the loader is not inserted
27
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
28
+ var S2 = jQuery.fn.select2.amd;
29
+ }
30
+ var S2;(function () { if (!S2 || !S2.requirejs) {
31
+ if (!S2) { S2 = {}; } else { require = S2; }
32
+ /**
33
+ * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
34
+ * Available via the MIT or new BSD license.
35
+ * see: http://github.com/jrburke/almond for details
36
+ */
37
+ //Going sloppy to avoid 'use strict' string cost, but strict practices should
38
+ //be followed.
39
+ /*jslint sloppy: true */
40
+ /*global setTimeout: false */
41
+
42
+ var requirejs, require, define;
43
+ (function (undef) {
44
+ var main, req, makeMap, handlers,
45
+ defined = {},
46
+ waiting = {},
47
+ config = {},
48
+ defining = {},
49
+ hasOwn = Object.prototype.hasOwnProperty,
50
+ aps = [].slice,
51
+ jsSuffixRegExp = /\.js$/;
52
+
53
+ function hasProp(obj, prop) {
54
+ return hasOwn.call(obj, prop);
55
  }
 
56
 
57
+ /**
58
+ * Given a relative module name, like ./something, normalize it to
59
+ * a real name that can be mapped to a path.
60
+ * @param {String} name the relative name
61
+ * @param {String} baseName a real name that the name arg is relative
62
+ * to.
63
+ * @returns {String} normalized name
64
+ */
65
+ function normalize(name, baseName) {
66
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
67
+ foundI, foundStarMap, starI, i, j, part,
68
+ baseParts = baseName && baseName.split("/"),
69
+ map = config.map,
70
+ starMap = (map && map['*']) || {};
71
+
72
+ //Adjust any relative paths.
73
+ if (name && name.charAt(0) === ".") {
74
+ //If have a base name, try to normalize against it,
75
+ //otherwise, assume it is a top-level require that will
76
+ //be relative to baseUrl in the end.
77
+ if (baseName) {
78
+ name = name.split('/');
79
+ lastIndex = name.length - 1;
80
+
81
+ // Node .js allowance:
82
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
83
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
84
+ }
85
 
86
+ //Lop off the last part of baseParts, so that . matches the
87
+ //"directory" and not name of the baseName's module. For instance,
88
+ //baseName of "one/two/three", maps to "one/two/three.js", but we
89
+ //want the directory, "one/two" for this normalization.
90
+ name = baseParts.slice(0, baseParts.length - 1).concat(name);
91
+
92
+ //start trimDots
93
+ for (i = 0; i < name.length; i += 1) {
94
+ part = name[i];
95
+ if (part === ".") {
96
+ name.splice(i, 1);
97
+ i -= 1;
98
+ } else if (part === "..") {
99
+ if (i === 1 && (name[2] === '..' || name[0] === '..')) {
100
+ //End of the line. Keep at least one non-dot
101
+ //path segment at the front so it can be mapped
102
+ //correctly to disk. Otherwise, there is likely
103
+ //no path mapping for a path starting with '..'.
104
+ //This can still fail, but catches the most reasonable
105
+ //uses of ..
106
+ break;
107
+ } else if (i > 0) {
108
+ name.splice(i - 1, 2);
109
+ i -= 2;
110
+ }
111
+ }
112
+ }
113
+ //end trimDots
114
 
115
+ name = name.join("/");
116
+ } else if (name.indexOf('./') === 0) {
117
+ // No baseName, so this is ID is resolved relative
118
+ // to baseUrl, pull off the leading dot.
119
+ name = name.substring(2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
 
 
 
 
 
 
 
 
121
  }
 
 
 
 
 
 
122
 
123
+ //Apply map config if available.
124
+ if ((baseParts || starMap) && map) {
125
+ nameParts = name.split('/');
126
+
127
+ for (i = nameParts.length; i > 0; i -= 1) {
128
+ nameSegment = nameParts.slice(0, i).join("/");
129
+
130
+ if (baseParts) {
131
+ //Find the longest baseName segment match in the config.
132
+ //So, do joins on the biggest to smallest lengths of baseParts.
133
+ for (j = baseParts.length; j > 0; j -= 1) {
134
+ mapValue = map[baseParts.slice(0, j).join('/')];
135
+
136
+ //baseName segment has config, find if it has one for
137
+ //this name.
138
+ if (mapValue) {
139
+ mapValue = mapValue[nameSegment];
140
+ if (mapValue) {
141
+ //Match, update name to the new value.
142
+ foundMap = mapValue;
143
+ foundI = i;
144
+ break;
145
+ }
146
+ }
147
+ }
148
+ }
149
 
150
+ if (foundMap) {
151
+ break;
152
+ }
153
 
154
+ //Check for a star map match, but just hold on to it,
155
+ //if there is a shorter segment match later in a matching
156
+ //config, then favor over this star map.
157
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
158
+ foundStarMap = starMap[nameSegment];
159
+ starI = i;
160
+ }
161
+ }
162
 
163
+ if (!foundMap && foundStarMap) {
164
+ foundMap = foundStarMap;
165
+ foundI = starI;
166
+ }
167
 
168
+ if (foundMap) {
169
+ nameParts.splice(0, foundI, foundMap);
170
+ name = nameParts.join('/');
171
+ }
172
  }
173
 
174
+ return name;
175
  }
176
 
177
+ function makeRequire(relName, forceSync) {
178
+ return function () {
179
+ //A version of a require function that passes a moduleName
180
+ //value for items that may need to
181
+ //look up paths relative to the moduleName
182
+ var args = aps.call(arguments, 0);
183
+
184
+ //If first arg is not require('string'), and there is only
185
+ //one arg, it is the array form without a callback. Insert
186
+ //a null so that the following concat is correct.
187
+ if (typeof args[0] !== 'string' && args.length === 1) {
188
+ args.push(null);
189
+ }
190
+ return req.apply(undef, args.concat([relName, forceSync]));
191
+ };
192
  }
193
 
194
+ function makeNormalize(relName) {
195
+ return function (name) {
196
+ return normalize(name, relName);
197
+ };
198
+ }
199
 
200
+ function makeLoad(depName) {
201
+ return function (value) {
202
+ defined[depName] = value;
203
  };
204
+ }
205
+
206
+ function callDep(name) {
207
+ if (hasProp(waiting, name)) {
208
+ var args = waiting[name];
209
+ delete waiting[name];
210
+ defining[name] = true;
211
+ main.apply(undef, args);
212
+ }
213
 
214
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
215
+ throw new Error('No ' + name);
216
+ }
217
+ return defined[name];
218
  }
219
 
220
+ //Turns a plugin!resource to [plugin, resource]
221
+ //with the plugin being undefined if the name
222
+ //did not have a plugin prefix.
223
+ function splitPrefix(name) {
224
+ var prefix,
225
+ index = name ? name.indexOf('!') : -1;
226
+ if (index > -1) {
227
+ prefix = name.substring(0, index);
228
+ name = name.substring(index + 1, name.length);
229
+ }
230
+ return [prefix, name];
 
 
 
231
  }
232
 
233
  /**
234
+ * Makes a name map, normalizing the name, and using a plugin
235
+ * for normalization if necessary. Grabs a ref to plugin
236
+ * too, as an optimization.
 
237
  */
238
+ makeMap = function (name, relName) {
239
+ var plugin,
240
+ parts = splitPrefix(name),
241
+ prefix = parts[0];
 
 
 
242
 
243
+ name = parts[1];
244
+
245
+ if (prefix) {
246
+ prefix = normalize(prefix, relName);
247
+ plugin = callDep(prefix);
248
+ }
249
 
250
+ //Normalize according
251
+ if (prefix) {
252
+ if (plugin && plugin.normalize) {
253
+ name = plugin.normalize(name, makeNormalize(relName));
254
+ } else {
255
+ name = normalize(name, relName);
256
  }
257
+ } else {
258
+ name = normalize(name, relName);
259
+ parts = splitPrefix(name);
260
+ prefix = parts[0];
261
+ name = parts[1];
262
+ if (prefix) {
263
+ plugin = callDep(prefix);
264
  }
265
+ }
 
 
266
 
267
+ //Using ridiculous property names for space reasons
268
+ return {
269
+ f: prefix ? prefix + '!' + name : name, //fullName
270
+ n: name,
271
+ pr: prefix,
272
+ p: plugin
273
+ };
274
+ };
 
 
 
 
 
 
275
 
276
+ function makeConfig(name) {
 
 
 
 
 
 
 
 
 
 
 
277
  return function () {
278
+ return (config && config.config && config.config[name]) || {};
 
 
 
 
279
  };
280
  }
281
 
282
+ handlers = {
283
+ require: function (name) {
284
+ return makeRequire(name);
285
+ },
286
+ exports: function (name) {
287
+ var e = defined[name];
288
+ if (typeof e !== 'undefined') {
289
+ return e;
290
+ } else {
291
+ return (defined[name] = {});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
+ },
294
+ module: function (name) {
295
+ return {
296
+ id: name,
297
+ uri: '',
298
+ exports: defined[name],
299
+ config: makeConfig(name)
300
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
302
+ };
 
 
 
 
 
 
 
 
 
 
303
 
304
+ main = function (name, deps, callback, relName) {
305
+ var cjsModule, depName, ret, map, i,
306
+ args = [],
307
+ callbackType = typeof callback,
308
+ usingExports;
309
+
310
+ //Use name if no relName
311
+ relName = relName || name;
312
+
313
+ //Call the callback to define the module, if necessary.
314
+ if (callbackType === 'undefined' || callbackType === 'function') {
315
+ //Pull out the defined dependencies and pass the ordered
316
+ //values to the callback.
317
+ //Default to [require, exports, module] if no deps
318
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
319
+ for (i = 0; i < deps.length; i += 1) {
320
+ map = makeMap(deps[i], relName);
321
+ depName = map.f;
322
+
323
+ //Fast path CommonJS standard dependencies.
324
+ if (depName === "require") {
325
+ args[i] = handlers.require(name);
326
+ } else if (depName === "exports") {
327
+ //CommonJS module spec 1.1
328
+ args[i] = handlers.exports(name);
329
+ usingExports = true;
330
+ } else if (depName === "module") {
331
+ //CommonJS module spec 1.1
332
+ cjsModule = args[i] = handlers.module(name);
333
+ } else if (hasProp(defined, depName) ||
334
+ hasProp(waiting, depName) ||
335
+ hasProp(defining, depName)) {
336
+ args[i] = callDep(depName);
337
+ } else if (map.p) {
338
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
339
+ args[i] = defined[depName];
340
+ } else {
341
+ throw new Error(name + ' missing ' + depName);
342
  }
343
+ }
 
 
 
 
 
 
344
 
345
+ ret = callback ? callback.apply(defined[name], args) : undefined;
 
 
346
 
347
+ if (name) {
348
+ //If setting exports via "module" is in play,
349
+ //favor that over return value and exports. After that,
350
+ //favor a non-undefined return value over exports use.
351
+ if (cjsModule && cjsModule.exports !== undef &&
352
+ cjsModule.exports !== defined[name]) {
353
+ defined[name] = cjsModule.exports;
354
+ } else if (ret !== undef || !usingExports) {
355
+ //Use the return value from the function.
356
+ defined[name] = ret;
357
  }
358
+ }
359
+ } else if (name) {
360
+ //May just be an object definition for the module. Only
361
+ //worry about defining if have a module name.
362
+ defined[name] = callback;
363
  }
364
+ };
365
 
366
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
367
+ if (typeof deps === "string") {
368
+ if (handlers[deps]) {
369
+ //callback in this case is really relName
370
+ return handlers[deps](callback);
371
+ }
372
+ //Just return the module wanted. In this scenario, the
373
+ //deps arg is the module name, and second arg (if passed)
374
+ //is just the relName.
375
+ //Normalize module name, if it contains . or ..
376
+ return callDep(makeMap(deps, callback).f);
377
+ } else if (!deps.splice) {
378
+ //deps is a config object, not an array.
379
+ config = deps;
380
+ if (config.deps) {
381
+ req(config.deps, config.callback);
382
+ }
383
+ if (!callback) {
384
+ return;
385
+ }
386
 
387
+ if (callback.splice) {
388
+ //callback is an array, which means it is a dependency list.
389
+ //Adjust args if there are dependencies
390
+ deps = callback;
391
+ callback = relName;
392
+ relName = null;
393
+ } else {
394
+ deps = undef;
395
+ }
396
+ }
397
 
398
+ //Support require(['a'])
399
+ callback = callback || function () {};
 
400
 
401
+ //If relName is a function, it is an errback handler,
402
+ //so remove it.
403
+ if (typeof relName === 'function') {
404
+ relName = forceSync;
405
+ forceSync = alt;
406
  }
407
 
408
+ //Simulate async callback;
409
+ if (forceSync) {
410
+ main(undef, deps, callback, relName);
411
+ } else {
412
+ //Using a non-zero value because of concern for what old browsers
413
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
414
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
415
+ //If want a value immediately, use require('id') instead -- something
416
+ //that works in almond on the global level, but not guaranteed and
417
+ //unlikely to work in other AMD implementations.
418
+ setTimeout(function () {
419
+ main(undef, deps, callback, relName);
420
+ }, 4);
421
+ }
 
 
 
422
 
423
+ return req;
424
+ };
 
 
425
 
426
  /**
427
+ * Just drops the config on the floor, but returns req in case
428
+ * the config return value is used.
 
 
 
 
 
 
 
 
 
 
 
 
429
  */
430
+ req.config = function (cfg) {
431
+ return req(cfg);
432
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
 
434
  /**
435
+ * Expose module registry for debugging and tooling
 
 
 
 
 
 
 
 
 
 
 
436
  */
437
+ requirejs._defined = defined;
 
 
 
 
 
 
 
 
 
438
 
439
+ define = function (name, deps, callback) {
440
+ if (typeof name !== 'string') {
441
+ throw new Error('See almond README: incorrect module build, no module name');
442
  }
443
 
444
+ //This module may not have dependencies
445
+ if (!deps.splice) {
446
+ //deps is not an array, so probably means
447
+ //an object literal or factory function for
448
+ //the value. Adjust args.
449
+ callback = deps;
450
+ deps = [];
 
451
  }
452
 
453
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
454
+ waiting[name] = [name, deps, callback];
455
+ }
456
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
458
+ define.amd = {
459
+ jQuery: true
460
+ };
461
+ }());
462
+
463
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
464
+ }
465
+ }());
466
+ S2.define("almond", function(){});
467
+
468
+ /* global jQuery:false, $:false */
469
+ S2.define('jquery',[],function () {
470
+ var _$ = jQuery || $;
471
+
472
+ if (_$ == null && console && console.error) {
473
+ console.error(
474
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
475
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
476
+ 'web page.'
477
+ );
478
+ }
479
+
480
+ return _$;
481
+ });
482
+
483
+ S2.define('select2/utils',[
484
+ 'jquery'
485
+ ], function ($) {
486
+ var Utils = {};
487
+
488
+ Utils.Extend = function (ChildClass, SuperClass) {
489
+ var __hasProp = {}.hasOwnProperty;
490
+
491
+ function BaseConstructor () {
492
+ this.constructor = ChildClass;
493
  }
494
 
495
+ for (var key in SuperClass) {
496
+ if (__hasProp.call(SuperClass, key)) {
497
+ ChildClass[key] = SuperClass[key];
498
+ }
 
 
 
 
 
 
 
 
 
499
  }
500
 
501
+ BaseConstructor.prototype = SuperClass.prototype;
502
+ ChildClass.prototype = new BaseConstructor();
503
+ ChildClass.__super__ = SuperClass.prototype;
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
+ return ChildClass;
506
+ };
 
 
 
 
 
 
 
 
 
507
 
508
+ function getMethods (theClass) {
509
+ var proto = theClass.prototype;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
 
511
+ var methods = [];
512
 
513
+ for (var methodName in proto) {
514
+ var m = proto[methodName];
515
 
516
+ if (typeof m !== 'function') {
517
+ continue;
518
+ }
 
 
 
 
 
 
519
 
520
+ if (methodName === 'constructor') {
521
+ continue;
522
+ }
 
523
 
524
+ methods.push(methodName);
525
  }
526
 
527
+ return methods;
528
+ }
529
 
530
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
531
+ var decoratedMethods = getMethods(DecoratorClass);
532
+ var superMethods = getMethods(SuperClass);
 
 
533
 
534
+ function DecoratedClass () {
535
+ var unshift = Array.prototype.unshift;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
 
537
+ var argCount = DecoratorClass.prototype.constructor.length;
 
 
538
 
539
+ var calledConstructor = SuperClass.prototype.constructor;
 
540
 
541
+ if (argCount > 0) {
542
+ unshift.call(arguments, SuperClass.prototype.constructor);
543
 
544
+ calledConstructor = DecoratorClass.prototype.constructor;
545
+ }
 
 
 
546
 
547
+ calledConstructor.apply(this, arguments);
548
+ }
549
 
550
+ DecoratorClass.displayName = SuperClass.displayName;
 
 
 
 
 
 
 
 
551
 
552
+ function ctr () {
553
+ this.constructor = DecoratedClass;
554
+ }
 
 
555
 
556
+ DecoratedClass.prototype = new ctr();
557
 
558
+ for (var m = 0; m < superMethods.length; m++) {
559
+ var superMethod = superMethods[m];
560
 
561
+ DecoratedClass.prototype[superMethod] =
562
+ SuperClass.prototype[superMethod];
563
+ }
564
 
565
+ var calledMethod = function (methodName) {
566
+ // Stub out the original method if it's not decorating an actual method
567
+ var originalMethod = function () {};
568
 
569
+ if (methodName in DecoratedClass.prototype) {
570
+ originalMethod = DecoratedClass.prototype[methodName];
571
+ }
572
 
573
+ var decoratedMethod = DecoratorClass.prototype[methodName];
 
 
 
 
 
574
 
575
+ return function () {
576
+ var unshift = Array.prototype.unshift;
577
 
578
+ unshift.call(arguments, originalMethod);
579
 
580
+ return decoratedMethod.apply(this, arguments);
581
+ };
582
+ };
583
 
584
+ for (var d = 0; d < decoratedMethods.length; d++) {
585
+ var decoratedMethod = decoratedMethods[d];
 
586
 
587
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
588
+ }
589
 
590
+ return DecoratedClass;
591
+ };
 
592
 
593
+ var Observable = function () {
594
+ this.listeners = {};
595
+ };
596
 
597
+ Observable.prototype.on = function (event, callback) {
598
+ this.listeners = this.listeners || {};
599
 
600
+ if (event in this.listeners) {
601
+ this.listeners[event].push(callback);
602
+ } else {
603
+ this.listeners[event] = [callback];
604
+ }
605
+ };
606
 
607
+ Observable.prototype.trigger = function (event) {
608
+ var slice = Array.prototype.slice;
609
+ var params = slice.call(arguments, 1);
 
 
 
 
610
 
611
+ this.listeners = this.listeners || {};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
 
613
+ // Params should always come in as an array
614
+ if (params == null) {
615
+ params = [];
616
+ }
617
 
618
+ // If there are no arguments to the event, use a temporary object
619
+ if (params.length === 0) {
620
+ params.push({});
621
+ }
 
 
622
 
623
+ // Set the `_type` of the first object to the event
624
+ params[0]._type = event;
 
 
 
625
 
626
+ if (event in this.listeners) {
627
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
628
+ }
629
 
630
+ if ('*' in this.listeners) {
631
+ this.invoke(this.listeners['*'], arguments);
632
+ }
633
+ };
634
 
635
+ Observable.prototype.invoke = function (listeners, params) {
636
+ for (var i = 0, len = listeners.length; i < len; i++) {
637
+ listeners[i].apply(this, params);
638
+ }
639
+ };
640
 
641
+ Utils.Observable = Observable;
 
 
642
 
643
+ Utils.generateChars = function (length) {
644
+ var chars = '';
 
645
 
646
+ for (var i = 0; i < length; i++) {
647
+ var randomChar = Math.floor(Math.random() * 36);
648
+ chars += randomChar.toString(36);
649
+ }
650
 
651
+ return chars;
652
+ };
653
 
654
+ Utils.bind = function (func, context) {
655
+ return function () {
656
+ func.apply(context, arguments);
657
+ };
658
+ };
659
 
660
+ Utils._convertData = function (data) {
661
+ for (var originalKey in data) {
662
+ var keys = originalKey.split('-');
663
 
664
+ var dataLevel = data;
 
 
665
 
666
+ if (keys.length === 1) {
667
+ continue;
668
+ }
669
 
670
+ for (var k = 0; k < keys.length; k++) {
671
+ var key = keys[k];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
672
 
673
+ // Lowercase the first letter
674
+ // By default, dash-separated becomes camelCase
675
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
 
 
 
 
 
676
 
677
+ if (!(key in dataLevel)) {
678
+ dataLevel[key] = {};
679
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
680
 
681
+ if (k == keys.length - 1) {
682
+ dataLevel[key] = data[originalKey];
683
+ }
684
 
685
+ dataLevel = dataLevel[key];
686
+ }
687
 
688
+ delete data[originalKey];
689
+ }
 
690
 
691
+ return data;
692
+ };
 
 
 
 
 
 
693
 
694
+ Utils.hasScroll = function (index, el) {
695
+ // Adapted from the function created by @ShadowScripter
696
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
697
+ // The original code can be found at
698
+ // http://codereview.stackexchange.com/q/13338
699
+ // and was designed to be used with the Sizzle selector engine.
 
 
 
 
 
 
 
700
 
701
+ var $el = $(el);
702
+ var overflowX = el.style.overflowX;
703
+ var overflowY = el.style.overflowY;
 
 
 
 
 
704
 
705
+ //Check both x and y declarations
706
+ if (overflowX === overflowY &&
707
+ (overflowY === 'hidden' || overflowY === 'visible')) {
708
+ return false;
709
+ }
 
710
 
711
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
712
+ return true;
713
+ }
 
 
 
714
 
715
+ return ($el.innerHeight() < el.scrollHeight ||
716
+ $el.innerWidth() < el.scrollWidth);
717
+ };
718
+
719
+ Utils.escapeMarkup = function (markup) {
720
+ var replaceMap = {
721
+ '\\': '&#92;',
722
+ '&': '&amp;',
723
+ '<': '&lt;',
724
+ '>': '&gt;',
725
+ '"': '&quot;',
726
+ '\'': '&#39;',
727
+ '/': '&#47;'
728
+ };
729
 
730
+ // Do not try to escape the markup if it's not a string
731
+ if (typeof markup !== 'string') {
732
+ return markup;
733
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
 
735
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
736
+ return replaceMap[match];
737
+ });
738
+ };
 
 
739
 
740
+ // Append an array of jQuery nodes to a given element.
741
+ Utils.appendMany = function ($element, $nodes) {
742
+ // jQuery 1.7.x does not support $.fn.append() with an array
743
+ // Fall back to a jQuery object collection using $.fn.add()
744
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
745
+ var $jqNodes = $();
746
 
747
+ $.map($nodes, function (node) {
748
+ $jqNodes = $jqNodes.add(node);
749
+ });
750
 
751
+ $nodes = $jqNodes;
752
+ }
 
 
753
 
754
+ $element.append($nodes);
755
+ };
756
 
757
+ return Utils;
758
+ });
 
 
759
 
760
+ S2.define('select2/results',[
761
+ 'jquery',
762
+ './utils'
763
+ ], function ($, Utils) {
764
+ function Results ($element, options, dataAdapter) {
765
+ this.$element = $element;
766
+ this.data = dataAdapter;
767
+ this.options = options;
768
 
769
+ Results.__super__.constructor.call(this);
770
+ }
 
 
 
 
771
 
772
+ Utils.Extend(Results, Utils.Observable);
 
 
773
 
774
+ Results.prototype.render = function () {
775
+ var $results = $(
776
+ '<ul class="select2-results__options" role="tree"></ul>'
777
+ );
778
 
779
+ if (this.options.get('multiple')) {
780
+ $results.attr('aria-multiselectable', 'true');
781
+ }
 
782
 
783
+ this.$results = $results;
 
 
 
784
 
785
+ return $results;
786
+ };
 
 
787
 
788
+ Results.prototype.clear = function () {
789
+ this.$results.empty();
790
+ };
 
791
 
792
+ Results.prototype.displayMessage = function (params) {
793
+ var escapeMarkup = this.options.get('escapeMarkup');
 
 
 
794
 
795
+ this.clear();
796
+ this.hideLoading();
 
797
 
798
+ var $message = $(
799
+ '<li role="treeitem" aria-live="assertive"' +
800
+ ' class="select2-results__option"></li>'
801
+ );
802
 
803
+ var message = this.options.get('translations').get(params.message);
804
 
805
+ $message.append(
806
+ escapeMarkup(
807
+ message(params.args)
808
+ )
809
+ );
810
 
811
+ $message[0].className += ' select2-results__message';
 
 
812
 
813
+ this.$results.append($message);
814
+ };
815
 
816
+ Results.prototype.hideMessages = function () {
817
+ this.$results.find('.select2-results__message').remove();
818
+ };
819
 
820
+ Results.prototype.append = function (data) {
821
+ this.hideLoading();
822
 
823
+ var $options = [];
 
 
 
 
 
 
 
824
 
825
+ if (data.results == null || data.results.length === 0) {
826
+ if (this.$results.children().length === 0) {
827
+ this.trigger('results:message', {
828
+ message: 'noResults'
829
+ });
830
+ }
831
 
832
+ return;
833
+ }
 
 
 
834
 
835
+ data.results = this.sort(data.results);
836
 
837
+ for (var d = 0; d < data.results.length; d++) {
838
+ var item = data.results[d];
 
 
 
 
839
 
840
+ var $option = this.option(item);
 
 
841
 
842
+ $options.push($option);
843
+ }
 
 
844
 
845
+ this.$results.append($options);
846
+ };
 
847
 
848
+ Results.prototype.position = function ($results, $dropdown) {
849
+ var $resultsContainer = $dropdown.find('.select2-results');
850
+ $resultsContainer.append($results);
851
+ };
852
 
853
+ Results.prototype.sort = function (data) {
854
+ var sorter = this.options.get('sorter');
 
 
 
 
855
 
856
+ return sorter(data);
857
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
858
 
859
+ Results.prototype.highlightFirstItem = function () {
860
+ var $options = this.$results
861
+ .find('.select2-results__option[aria-selected]');
862
 
863
+ var $selected = $options.filter('[aria-selected=true]');
 
 
 
 
 
 
864
 
865
+ // Check if there are any selected options
866
+ if ($selected.length > 0) {
867
+ // If there are selected options, highlight the first
868
+ $selected.first().trigger('mouseenter');
869
+ } else {
870
+ // If there are no selected options, highlight the first option
871
+ // in the dropdown
872
+ $options.first().trigger('mouseenter');
873
+ }
874
 
875
+ this.ensureHighlightVisible();
876
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
 
878
+ Results.prototype.setClasses = function () {
879
+ var self = this;
 
 
 
 
 
 
 
880
 
881
+ this.data.current(function (selected) {
882
+ var selectedIds = $.map(selected, function (s) {
883
+ return s.id.toString();
884
+ });
885
 
886
+ var $options = self.$results
887
+ .find('.select2-results__option[aria-selected]');
 
 
 
 
888
 
889
+ $options.each(function () {
890
+ var $option = $(this);
 
 
 
891
 
892
+ var item = $.data(this, 'data');
893
 
894
+ // id needs to be converted to a string when comparing
895
+ var id = '' + item.id;
 
 
896
 
897
+ if ((item.element != null && item.element.selected) ||
898
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
899
+ $option.attr('aria-selected', 'true');
900
+ } else {
901
+ $option.attr('aria-selected', 'false');
902
+ }
903
+ });
904
 
905
+ });
906
+ };
 
 
907
 
908
+ Results.prototype.showLoading = function (params) {
909
+ this.hideLoading();
 
 
910
 
911
+ var loadingMore = this.options.get('translations').get('searching');
912
 
913
+ var loading = {
914
+ disabled: true,
915
+ loading: true,
916
+ text: loadingMore(params)
917
+ };
918
+ var $loading = this.option(loading);
919
+ $loading.className += ' loading-results';
920
 
921
+ this.$results.prepend($loading);
922
+ };
 
 
 
 
 
 
 
 
923
 
924
+ Results.prototype.hideLoading = function () {
925
+ this.$results.find('.loading-results').remove();
926
+ };
 
 
 
927
 
928
+ Results.prototype.option = function (data) {
929
+ var option = document.createElement('li');
930
+ option.className = 'select2-results__option';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
931
 
932
+ var attrs = {
933
+ 'role': 'treeitem',
934
+ 'aria-selected': 'false'
935
+ };
 
936
 
937
+ if (data.disabled) {
938
+ delete attrs['aria-selected'];
939
+ attrs['aria-disabled'] = 'true';
940
+ }
941
 
942
+ if (data.id == null) {
943
+ delete attrs['aria-selected'];
944
+ }
945
 
946
+ if (data._resultId != null) {
947
+ option.id = data._resultId;
948
+ }
949
 
950
+ if (data.title) {
951
+ option.title = data.title;
952
+ }
953
 
954
+ if (data.children) {
955
+ attrs.role = 'group';
956
+ attrs['aria-label'] = data.text;
957
+ delete attrs['aria-selected'];
958
+ }
959
 
960
+ for (var attr in attrs) {
961
+ var val = attrs[attr];
 
962
 
963
+ option.setAttribute(attr, val);
964
+ }
 
 
965
 
966
+ if (data.children) {
967
+ var $option = $(option);
 
 
 
968
 
969
+ var label = document.createElement('strong');
970
+ label.className = 'select2-results__group';
 
971
 
972
+ var $label = $(label);
973
+ this.template(data, label);
 
 
974
 
975
+ var $children = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
976
 
977
+ for (var c = 0; c < data.children.length; c++) {
978
+ var child = data.children[c];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
 
980
+ var $child = this.option(child);
 
 
 
 
 
 
 
 
 
 
 
981
 
982
+ $children.push($child);
983
+ }
984
 
985
+ var $childrenContainer = $('<ul></ul>', {
986
+ 'class': 'select2-results__options select2-results__options--nested'
987
+ });
 
 
 
988
 
989
+ $childrenContainer.append($children);
 
 
990
 
991
+ $option.append(label);
992
+ $option.append($childrenContainer);
993
+ } else {
994
+ this.template(data, option);
995
+ }
996
 
997
+ $.data(option, 'data', data);
 
 
 
 
 
 
 
 
 
 
 
 
 
998
 
999
+ return option;
1000
+ };
1001
 
1002
+ Results.prototype.bind = function (container, $container) {
1003
+ var self = this;
 
1004
 
1005
+ var id = container.id + '-results';
1006
 
1007
+ this.$results.attr('id', id);
1008
 
1009
+ container.on('results:all', function (params) {
1010
+ self.clear();
1011
+ self.append(params.data);
 
1012
 
1013
+ if (container.isOpen()) {
1014
+ self.setClasses();
1015
+ self.highlightFirstItem();
1016
+ }
1017
+ });
 
1018
 
1019
+ container.on('results:append', function (params) {
1020
+ self.append(params.data);
 
 
 
 
 
 
1021
 
1022
+ if (container.isOpen()) {
1023
+ self.setClasses();
1024
+ }
1025
+ });
1026
 
1027
+ container.on('query', function (params) {
1028
+ self.hideMessages();
1029
+ self.showLoading(params);
1030
+ });
1031
 
1032
+ container.on('select', function () {
1033
+ if (!container.isOpen()) {
1034
+ return;
1035
+ }
 
1036
 
1037
+ self.setClasses();
1038
+ self.highlightFirstItem();
1039
+ });
1040
 
1041
+ container.on('unselect', function () {
1042
+ if (!container.isOpen()) {
1043
+ return;
1044
+ }
 
 
 
 
 
 
1045
 
1046
+ self.setClasses();
1047
+ self.highlightFirstItem();
1048
+ });
1049
 
1050
+ container.on('open', function () {
1051
+ // When the dropdown is open, aria-expended="true"
1052
+ self.$results.attr('aria-expanded', 'true');
1053
+ self.$results.attr('aria-hidden', 'false');
1054
 
1055
+ self.setClasses();
1056
+ self.ensureHighlightVisible();
1057
+ });
1058
 
1059
+ container.on('close', function () {
1060
+ // When the dropdown is closed, aria-expended="false"
1061
+ self.$results.attr('aria-expanded', 'false');
1062
+ self.$results.attr('aria-hidden', 'true');
1063
+ self.$results.removeAttr('aria-activedescendant');
1064
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1065
 
1066
+ container.on('results:toggle', function () {
1067
+ var $highlighted = self.getHighlightedResults();
 
 
1068
 
1069
+ if ($highlighted.length === 0) {
1070
+ return;
1071
+ }
1072
 
1073
+ $highlighted.trigger('mouseup');
1074
+ });
1075
 
1076
+ container.on('results:select', function () {
1077
+ var $highlighted = self.getHighlightedResults();
 
1078
 
1079
+ if ($highlighted.length === 0) {
1080
+ return;
1081
+ }
1082
 
1083
+ var data = $highlighted.data('data');
 
 
 
 
 
 
 
1084
 
1085
+ if ($highlighted.attr('aria-selected') == 'true') {
1086
+ self.trigger('close', {});
1087
+ } else {
1088
+ self.trigger('select', {
1089
+ data: data
1090
+ });
1091
+ }
1092
+ });
1093
 
1094
+ container.on('results:previous', function () {
1095
+ var $highlighted = self.getHighlightedResults();
1096
 
1097
+ var $options = self.$results.find('[aria-selected]');
 
 
1098
 
1099
+ var currentIndex = $options.index($highlighted);
 
 
 
1100
 
1101
+ // If we are already at te top, don't move further
1102
+ if (currentIndex === 0) {
1103
+ return;
1104
+ }
1105
 
1106
+ var nextIndex = currentIndex - 1;
1107
 
1108
+ // If none are highlighted, highlight the first
1109
+ if ($highlighted.length === 0) {
1110
+ nextIndex = 0;
1111
+ }
 
1112
 
1113
+ var $next = $options.eq(nextIndex);
 
1114
 
1115
+ $next.trigger('mouseenter');
 
1116
 
1117
+ var currentOffset = self.$results.offset().top;
1118
+ var nextTop = $next.offset().top;
1119
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
 
1120
 
1121
+ if (nextIndex === 0) {
1122
+ self.$results.scrollTop(0);
1123
+ } else if (nextTop - currentOffset < 0) {
1124
+ self.$results.scrollTop(nextOffset);
1125
+ }
1126
+ });
 
 
 
1127
 
1128
+ container.on('results:next', function () {
1129
+ var $highlighted = self.getHighlightedResults();
1130
 
1131
+ var $options = self.$results.find('[aria-selected]');
1132
 
1133
+ var currentIndex = $options.index($highlighted);
 
 
 
 
 
 
 
 
 
1134
 
1135
+ var nextIndex = currentIndex + 1;
 
 
 
 
 
1136
 
1137
+ // If we are at the last option, stay there
1138
+ if (nextIndex >= $options.length) {
1139
+ return;
1140
+ }
1141
 
1142
+ var $next = $options.eq(nextIndex);
 
 
 
1143
 
1144
+ $next.trigger('mouseenter');
 
 
1145
 
1146
+ var currentOffset = self.$results.offset().top +
1147
+ self.$results.outerHeight(false);
1148
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1149
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1150
 
1151
+ if (nextIndex === 0) {
1152
+ self.$results.scrollTop(0);
1153
+ } else if (nextBottom > currentOffset) {
1154
+ self.$results.scrollTop(nextOffset);
1155
+ }
1156
+ });
1157
 
1158
+ container.on('results:focus', function (params) {
1159
+ params.element.addClass('select2-results__option--highlighted');
1160
+ });
1161
 
1162
+ container.on('results:message', function (params) {
1163
+ self.displayMessage(params);
1164
+ });
1165
 
1166
+ if ($.fn.mousewheel) {
1167
+ this.$results.on('mousewheel', function (e) {
1168
+ var top = self.$results.scrollTop();
1169
 
1170
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1171
 
1172
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1173
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1174
 
1175
+ if (isAtTop) {
1176
+ self.$results.scrollTop(0);
1177
 
1178
+ e.preventDefault();
1179
+ e.stopPropagation();
1180
+ } else if (isAtBottom) {
1181
+ self.$results.scrollTop(
1182
+ self.$results.get(0).scrollHeight - self.$results.height()
1183
+ );
1184
 
1185
+ e.preventDefault();
1186
+ e.stopPropagation();
1187
+ }
1188
+ });
1189
+ }
 
 
1190
 
1191
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1192
+ function (evt) {
1193
+ var $this = $(this);
 
 
1194
 
1195
+ var data = $this.data('data');
 
 
 
 
1196
 
1197
+ if ($this.attr('aria-selected') === 'true') {
1198
+ if (self.options.get('multiple')) {
1199
+ self.trigger('unselect', {
1200
+ originalEvent: evt,
1201
+ data: data
1202
+ });
1203
+ } else {
1204
+ self.trigger('close', {});
1205
+ }
1206
 
1207
+ return;
1208
+ }
 
 
1209
 
1210
+ self.trigger('select', {
1211
+ originalEvent: evt,
1212
+ data: data
1213
+ });
1214
+ });
 
 
 
 
1215
 
1216
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1217
+ function (evt) {
1218
+ var data = $(this).data('data');
 
 
1219
 
1220
+ self.getHighlightedResults()
1221
+ .removeClass('select2-results__option--highlighted');
 
1222
 
1223
+ self.trigger('results:focus', {
1224
+ data: data,
1225
+ element: $(this)
1226
+ });
1227
+ });
1228
+ };
1229
 
1230
+ Results.prototype.getHighlightedResults = function () {
1231
+ var $highlighted = this.$results
1232
+ .find('.select2-results__option--highlighted');
1233
 
1234
+ return $highlighted;
1235
+ };
1236
 
1237
+ Results.prototype.destroy = function () {
1238
+ this.$results.remove();
1239
+ };
1240
 
1241
+ Results.prototype.ensureHighlightVisible = function () {
1242
+ var $highlighted = this.getHighlightedResults();
1243
 
1244
+ if ($highlighted.length === 0) {
1245
+ return;
1246
+ }
1247
 
1248
+ var $options = this.$results.find('[aria-selected]');
 
 
 
 
1249
 
1250
+ var currentIndex = $options.index($highlighted);
 
 
1251
 
1252
+ var currentOffset = this.$results.offset().top;
1253
+ var nextTop = $highlighted.offset().top;
1254
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1255
 
1256
+ var offsetDelta = nextTop - currentOffset;
1257
+ nextOffset -= $highlighted.outerHeight(false) * 2;
 
1258
 
1259
+ if (currentIndex <= 2) {
1260
+ this.$results.scrollTop(0);
1261
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1262
+ this.$results.scrollTop(nextOffset);
1263
+ }
1264
+ };
1265
 
1266
+ Results.prototype.template = function (result, container) {
1267
+ var template = this.options.get('templateResult');
1268
+ var escapeMarkup = this.options.get('escapeMarkup');
 
 
 
 
 
 
 
 
1269
 
1270
+ var content = template(result, container);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1271
 
1272
+ if (content == null) {
1273
+ container.style.display = 'none';
1274
+ } else if (typeof content === 'string') {
1275
+ container.innerHTML = escapeMarkup(content);
1276
+ } else {
1277
+ $(container).append(content);
1278
+ }
1279
+ };
1280
+
1281
+ return Results;
1282
+ });
1283
+
1284
+ S2.define('select2/keys',[
1285
+
1286
+ ], function () {
1287
+ var KEYS = {
1288
+ BACKSPACE: 8,
1289
+ TAB: 9,
1290
+ ENTER: 13,
1291
+ SHIFT: 16,
1292
+ CTRL: 17,
1293
+ ALT: 18,
1294
+ ESC: 27,
1295
+ SPACE: 32,
1296
+ PAGE_UP: 33,
1297
+ PAGE_DOWN: 34,
1298
+ END: 35,
1299
+ HOME: 36,
1300
+ LEFT: 37,
1301
+ UP: 38,
1302
+ RIGHT: 39,
1303
+ DOWN: 40,
1304
+ DELETE: 46
1305
+ };
1306
+
1307
+ return KEYS;
1308
+ });
1309
+
1310
+ S2.define('select2/selection/base',[
1311
+ 'jquery',
1312
+ '../utils',
1313
+ '../keys'
1314
+ ], function ($, Utils, KEYS) {
1315
+ function BaseSelection ($element, options) {
1316
+ this.$element = $element;
1317
+ this.options = options;
1318
+
1319
+ BaseSelection.__super__.constructor.call(this);
1320
+ }
1321
+
1322
+ Utils.Extend(BaseSelection, Utils.Observable);
1323
+
1324
+ BaseSelection.prototype.render = function () {
1325
+ var $selection = $(
1326
+ '<span class="select2-selection" role="combobox" ' +
1327
+ ' aria-haspopup="true" aria-expanded="false">' +
1328
+ '</span>'
1329
+ );
1330
+
1331
+ this._tabindex = 0;
1332
+
1333
+ if (this.$element.data('old-tabindex') != null) {
1334
+ this._tabindex = this.$element.data('old-tabindex');
1335
+ } else if (this.$element.attr('tabindex') != null) {
1336
+ this._tabindex = this.$element.attr('tabindex');
1337
+ }
1338
 
1339
+ $selection.attr('title', this.$element.attr('title'));
1340
+ $selection.attr('tabindex', this._tabindex);
1341
 
1342
+ this.$selection = $selection;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1343
 
1344
+ return $selection;
1345
+ };
 
 
 
 
 
 
 
 
1346
 
1347
+ BaseSelection.prototype.bind = function (container, $container) {
1348
+ var self = this;
 
 
1349
 
1350
+ var id = container.id + '-container';
1351
+ var resultsId = container.id + '-results';
1352
 
1353
+ this.container = container;
 
 
 
 
 
 
 
1354
 
1355
+ this.$selection.on('focus', function (evt) {
1356
+ self.trigger('focus', evt);
1357
+ });
 
 
 
 
 
 
1358
 
1359
+ this.$selection.on('blur', function (evt) {
1360
+ self._handleBlur(evt);
1361
+ });
 
 
 
 
 
1362
 
1363
+ this.$selection.on('keydown', function (evt) {
1364
+ self.trigger('keypress', evt);
 
1365
 
1366
+ if (evt.which === KEYS.SPACE) {
1367
+ evt.preventDefault();
1368
+ }
1369
+ });
1370
 
1371
+ container.on('results:focus', function (params) {
1372
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1373
+ });
1374
 
1375
+ container.on('selection:update', function (params) {
1376
+ self.update(params.data);
1377
+ });
 
 
1378
 
1379
+ container.on('open', function () {
1380
+ // When the dropdown is open, aria-expanded="true"
1381
+ self.$selection.attr('aria-expanded', 'true');
1382
+ self.$selection.attr('aria-owns', resultsId);
1383
 
1384
+ self._attachCloseHandler(container);
1385
+ });
 
 
 
 
 
 
1386
 
1387
+ container.on('close', function () {
1388
+ // When the dropdown is closed, aria-expanded="false"
1389
+ self.$selection.attr('aria-expanded', 'false');
1390
+ self.$selection.removeAttr('aria-activedescendant');
1391
+ self.$selection.removeAttr('aria-owns');
1392
 
1393
+ self.$selection.focus();
 
 
 
 
1394
 
1395
+ self._detachCloseHandler(container);
1396
+ });
 
 
 
1397
 
1398
+ container.on('enable', function () {
1399
+ self.$selection.attr('tabindex', self._tabindex);
1400
+ });
 
 
 
 
 
 
 
 
 
 
 
1401
 
1402
+ container.on('disable', function () {
1403
+ self.$selection.attr('tabindex', '-1');
1404
+ });
1405
+ };
1406
+
1407
+ BaseSelection.prototype._handleBlur = function (evt) {
1408
+ var self = this;
1409
+
1410
+ // This needs to be delayed as the active element is the body when the tab
1411
+ // key is pressed, possibly along with others.
1412
+ window.setTimeout(function () {
1413
+ // Don't trigger `blur` if the focus is still in the selection
1414
+ if (
1415
+ (document.activeElement == self.$selection[0]) ||
1416
+ ($.contains(self.$selection[0], document.activeElement))
1417
+ ) {
1418
+ return;
1419
+ }
1420
 
1421
+ self.trigger('blur', evt);
1422
+ }, 1);
1423
+ };
1424
 
1425
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1426
+ var self = this;
 
 
1427
 
1428
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1429
+ var $target = $(e.target);
1430
 
1431
+ var $select = $target.closest('.select2');
1432
 
1433
+ var $all = $('.select2.select2-container--open');
 
 
1434
 
1435
+ $all.each(function () {
1436
+ var $this = $(this);
 
 
1437
 
1438
+ if (this == $select[0]) {
1439
+ return;
1440
+ }
 
 
 
 
 
 
 
 
 
 
1441
 
1442
+ var $element = $this.data('element');
 
 
 
1443
 
1444
+ $element.select2('close');
1445
+ });
1446
+ });
1447
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
1448
 
1449
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1450
+ $(document.body).off('mousedown.select2.' + container.id);
1451
+ };
 
 
 
 
 
 
1452
 
1453
+ BaseSelection.prototype.position = function ($selection, $container) {
1454
+ var $selectionContainer = $container.find('.selection');
1455
+ $selectionContainer.append($selection);
1456
+ };
 
 
 
 
 
 
 
 
 
 
1457
 
1458
+ BaseSelection.prototype.destroy = function () {
1459
+ this._detachCloseHandler(this.container);
1460
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1461
 
1462
+ BaseSelection.prototype.update = function (data) {
1463
+ throw new Error('The `update` method must be defined in child classes.');
1464
+ };
 
 
1465
 
1466
+ return BaseSelection;
1467
+ });
 
1468
 
1469
+ S2.define('select2/selection/single',[
1470
+ 'jquery',
1471
+ './base',
1472
+ '../utils',
1473
+ '../keys'
1474
+ ], function ($, BaseSelection, Utils, KEYS) {
1475
+ function SingleSelection () {
1476
+ SingleSelection.__super__.constructor.apply(this, arguments);
1477
+ }
1478
 
1479
+ Utils.Extend(SingleSelection, BaseSelection);
 
 
 
 
 
1480
 
1481
+ SingleSelection.prototype.render = function () {
1482
+ var $selection = SingleSelection.__super__.render.call(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1483
 
1484
+ $selection.addClass('select2-selection--single');
 
 
 
 
 
1485
 
1486
+ $selection.html(
1487
+ '<span class="select2-selection__rendered"></span>' +
1488
+ '<span class="select2-selection__arrow" role="presentation">' +
1489
+ '<b role="presentation"></b>' +
1490
+ '</span>'
1491
+ );
1492
 
1493
+ return $selection;
1494
+ };
 
1495
 
1496
+ SingleSelection.prototype.bind = function (container, $container) {
1497
+ var self = this;
1498
 
1499
+ SingleSelection.__super__.bind.apply(this, arguments);
 
 
1500
 
1501
+ var id = container.id + '-container';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1502
 
1503
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1504
+ this.$selection.attr('aria-labelledby', id);
1505
 
1506
+ this.$selection.on('mousedown', function (evt) {
1507
+ // Only respond to left clicks
1508
+ if (evt.which !== 1) {
1509
+ return;
1510
+ }
1511
 
1512
+ self.trigger('toggle', {
1513
+ originalEvent: evt
1514
+ });
1515
+ });
1516
 
1517
+ this.$selection.on('focus', function (evt) {
1518
+ // User focuses on the container
1519
+ });
1520
 
1521
+ this.$selection.on('blur', function (evt) {
1522
+ // User exits the container
1523
+ });
 
1524
 
1525
+ container.on('focus', function (evt) {
1526
+ if (!container.isOpen()) {
1527
+ self.$selection.focus();
1528
+ }
1529
+ });
 
 
 
 
 
 
1530
 
1531
+ container.on('selection:update', function (params) {
1532
+ self.update(params.data);
1533
+ });
1534
+ };
1535
 
1536
+ SingleSelection.prototype.clear = function () {
1537
+ this.$selection.find('.select2-selection__rendered').empty();
1538
+ };
 
1539
 
1540
+ SingleSelection.prototype.display = function (data, container) {
1541
+ var template = this.options.get('templateSelection');
1542
+ var escapeMarkup = this.options.get('escapeMarkup');
 
1543
 
1544
+ return escapeMarkup(template(data, container));
1545
+ };
 
 
 
1546
 
1547
+ SingleSelection.prototype.selectionContainer = function () {
1548
+ return $('<span></span>');
1549
+ };
 
 
1550
 
1551
+ SingleSelection.prototype.update = function (data) {
1552
+ if (data.length === 0) {
1553
+ this.clear();
1554
+ return;
1555
+ }
1556
 
1557
+ var selection = data[0];
 
 
 
 
1558
 
1559
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1560
+ var formatted = this.display(selection, $rendered);
 
 
 
1561
 
1562
+ $rendered.empty().append(formatted);
1563
+ $rendered.prop('title', selection.title || selection.text);
1564
+ };
1565
 
1566
+ return SingleSelection;
1567
+ });
1568
 
1569
+ S2.define('select2/selection/multiple',[
1570
+ 'jquery',
1571
+ './base',
1572
+ '../utils'
1573
+ ], function ($, BaseSelection, Utils) {
1574
+ function MultipleSelection ($element, options) {
1575
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1576
+ }
1577
 
1578
+ Utils.Extend(MultipleSelection, BaseSelection);
 
1579
 
1580
+ MultipleSelection.prototype.render = function () {
1581
+ var $selection = MultipleSelection.__super__.render.call(this);
1582
 
1583
+ $selection.addClass('select2-selection--multiple');
 
 
1584
 
1585
+ $selection.html(
1586
+ '<ul class="select2-selection__rendered"></ul>'
1587
+ );
1588
 
1589
+ return $selection;
1590
+ };
1591
 
1592
+ MultipleSelection.prototype.bind = function (container, $container) {
1593
+ var self = this;
1594
 
1595
+ MultipleSelection.__super__.bind.apply(this, arguments);
 
 
1596
 
1597
+ this.$selection.on('click', function (evt) {
1598
+ self.trigger('toggle', {
1599
+ originalEvent: evt
1600
+ });
1601
+ });
1602
 
1603
+ this.$selection.on(
1604
+ 'click',
1605
+ '.select2-selection__choice__remove',
1606
+ function (evt) {
1607
+ // Ignore the event if it is disabled
1608
+ if (self.options.get('disabled')) {
1609
+ return;
1610
+ }
1611
 
1612
+ var $remove = $(this);
1613
+ var $selection = $remove.parent();
 
 
 
1614
 
1615
+ var data = $selection.data('data');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1616
 
1617
+ self.trigger('unselect', {
1618
+ originalEvent: evt,
1619
+ data: data
1620
+ });
1621
+ }
1622
+ );
1623
+ };
1624
+
1625
+ MultipleSelection.prototype.clear = function () {
1626
+ this.$selection.find('.select2-selection__rendered').empty();
1627
+ };
1628
+
1629
+ MultipleSelection.prototype.display = function (data, container) {
1630
+ var template = this.options.get('templateSelection');
1631
+ var escapeMarkup = this.options.get('escapeMarkup');
1632
+
1633
+ return escapeMarkup(template(data, container));
1634
+ };
1635
+
1636
+ MultipleSelection.prototype.selectionContainer = function () {
1637
+ var $container = $(
1638
+ '<li class="select2-selection__choice">' +
1639
+ '<span class="select2-selection__choice__remove" role="presentation">' +
1640
+ '&times;' +
1641
+ '</span>' +
1642
+ '</li>'
1643
+ );
1644
+
1645
+ return $container;
1646
+ };
1647
+
1648
+ MultipleSelection.prototype.update = function (data) {
1649
+ this.clear();
1650
+
1651
+ if (data.length === 0) {
1652
+ return;
1653
+ }
1654
 
1655
+ var $selections = [];
 
 
1656
 
1657
+ for (var d = 0; d < data.length; d++) {
1658
+ var selection = data[d];
 
 
1659
 
1660
+ var $selection = this.selectionContainer();
1661
+ var formatted = this.display(selection, $selection);
1662
 
1663
+ $selection.append(formatted);
1664
+ $selection.prop('title', selection.title || selection.text);
1665
 
1666
+ $selection.data('data', selection);
 
 
 
1667
 
1668
+ $selections.push($selection);
1669
+ }
 
 
 
 
 
 
1670
 
1671
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1672
 
1673
+ Utils.appendMany($rendered, $selections);
1674
+ };
 
 
 
 
 
 
1675
 
1676
+ return MultipleSelection;
1677
+ });
 
 
1678
 
1679
+ S2.define('select2/selection/placeholder',[
1680
+ '../utils'
1681
+ ], function (Utils) {
1682
+ function Placeholder (decorated, $element, options) {
1683
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1684
 
1685
+ decorated.call(this, $element, options);
1686
+ }
 
 
1687
 
1688
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1689
+ if (typeof placeholder === 'string') {
1690
+ placeholder = {
1691
+ id: '',
1692
+ text: placeholder
1693
+ };
1694
+ }
1695
 
1696
+ return placeholder;
1697
+ };
 
1698
 
1699
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1700
+ var $placeholder = this.selectionContainer();
 
 
 
1701
 
1702
+ $placeholder.html(this.display(placeholder));
1703
+ $placeholder.addClass('select2-selection__placeholder')
1704
+ .removeClass('select2-selection__choice');
 
 
 
1705
 
1706
+ return $placeholder;
1707
+ };
 
1708
 
1709
+ Placeholder.prototype.update = function (decorated, data) {
1710
+ var singlePlaceholder = (
1711
+ data.length == 1 && data[0].id != this.placeholder.id
1712
+ );
1713
+ var multipleSelections = data.length > 1;
1714
 
1715
+ if (multipleSelections || singlePlaceholder) {
1716
+ return decorated.call(this, data);
1717
+ }
1718
 
1719
+ this.clear();
 
 
 
 
1720
 
1721
+ var $placeholder = this.createPlaceholder(this.placeholder);
 
 
1722
 
1723
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1724
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1725
 
1726
+ return Placeholder;
1727
+ });
 
1728
 
1729
+ S2.define('select2/selection/allowClear',[
1730
+ 'jquery',
1731
+ '../keys'
1732
+ ], function ($, KEYS) {
1733
+ function AllowClear () { }
1734
 
1735
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1736
+ var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1737
 
1738
+ decorated.call(this, container, $container);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1739
 
1740
+ if (this.placeholder == null) {
1741
+ if (this.options.get('debug') && window.console && console.error) {
1742
+ console.error(
1743
+ 'Select2: The `allowClear` option should be used in combination ' +
1744
+ 'with the `placeholder` option.'
1745
+ );
1746
+ }
1747
+ }
1748
 
1749
+ this.$selection.on('mousedown', '.select2-selection__clear',
1750
+ function (evt) {
1751
+ self._handleClear(evt);
1752
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1753
 
1754
+ container.on('keypress', function (evt) {
1755
+ self._handleKeyboardClear(evt, container);
1756
+ });
1757
+ };
1758
 
1759
+ AllowClear.prototype._handleClear = function (_, evt) {
1760
+ // Ignore the event if it is disabled
1761
+ if (this.options.get('disabled')) {
1762
+ return;
1763
+ }
 
 
 
1764
 
1765
+ var $clear = this.$selection.find('.select2-selection__clear');
 
1766
 
1767
+ // Ignore the event if nothing has been selected
1768
+ if ($clear.length === 0) {
1769
+ return;
1770
+ }
1771
 
1772
+ evt.stopPropagation();
1773
 
1774
+ var data = $clear.data('data');
 
1775
 
1776
+ for (var d = 0; d < data.length; d++) {
1777
+ var unselectData = {
1778
+ data: data[d]
1779
+ };
1780
 
1781
+ // Trigger the `unselect` event, so people can prevent it from being
1782
+ // cleared.
1783
+ this.trigger('unselect', unselectData);
1784
 
1785
+ // If the event was prevented, don't clear it out.
1786
+ if (unselectData.prevented) {
1787
+ return;
1788
+ }
1789
+ }
1790
 
1791
+ this.$element.val(this.placeholder.id).trigger('change');
 
 
1792
 
1793
+ this.trigger('toggle', {});
1794
+ };
1795
 
1796
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1797
+ if (container.isOpen()) {
1798
+ return;
1799
+ }
 
 
1800
 
1801
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1802
+ this._handleClear(evt);
1803
+ }
1804
+ };
 
 
 
 
1805
 
1806
+ AllowClear.prototype.update = function (decorated, data) {
1807
+ decorated.call(this, data);
1808
 
1809
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1810
+ data.length === 0) {
1811
+ return;
1812
+ }
 
 
 
1813
 
1814
+ var $remove = $(
1815
+ '<span class="select2-selection__clear">' +
1816
+ '&times;' +
1817
+ '</span>'
1818
+ );
1819
+ $remove.data('data', data);
1820
 
1821
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1822
+ };
1823
 
1824
+ return AllowClear;
1825
+ });
 
 
 
1826
 
1827
+ S2.define('select2/selection/search',[
1828
+ 'jquery',
1829
+ '../utils',
1830
+ '../keys'
1831
+ ], function ($, Utils, KEYS) {
1832
+ function Search (decorated, $element, options) {
1833
+ decorated.call(this, $element, options);
1834
+ }
1835
 
1836
+ Search.prototype.render = function (decorated) {
1837
+ var $search = $(
1838
+ '<li class="select2-search select2-search--inline">' +
1839
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
1840
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1841
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1842
+ '</li>'
1843
+ );
1844
 
1845
+ this.$searchContainer = $search;
1846
+ this.$search = $search.find('input');
1847
 
1848
+ var $rendered = decorated.call(this);
 
1849
 
1850
+ this._transferTabIndex();
1851
 
1852
+ return $rendered;
1853
+ };
1854
 
1855
+ Search.prototype.bind = function (decorated, container, $container) {
1856
+ var self = this;
 
1857
 
1858
+ decorated.call(this, container, $container);
 
 
 
1859
 
1860
+ container.on('open', function () {
1861
+ self.$search.trigger('focus');
1862
+ });
1863
 
1864
+ container.on('close', function () {
1865
+ self.$search.val('');
1866
+ self.$search.removeAttr('aria-activedescendant');
1867
+ self.$search.trigger('focus');
1868
+ });
1869
 
1870
+ container.on('enable', function () {
1871
+ self.$search.prop('disabled', false);
1872
 
1873
+ self._transferTabIndex();
1874
+ });
 
 
 
 
 
 
 
 
 
1875
 
1876
+ container.on('disable', function () {
1877
+ self.$search.prop('disabled', true);
1878
+ });
1879
 
1880
+ container.on('focus', function (evt) {
1881
+ self.$search.trigger('focus');
1882
+ });
 
1883
 
1884
+ container.on('results:focus', function (params) {
1885
+ self.$search.attr('aria-activedescendant', params.id);
1886
+ });
 
 
 
 
1887
 
1888
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1889
+ self.trigger('focus', evt);
1890
+ });
1891
 
1892
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1893
+ self._handleBlur(evt);
1894
+ });
1895
 
1896
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1897
+ evt.stopPropagation();
1898
 
1899
+ self.trigger('keypress', evt);
 
 
 
 
 
 
1900
 
1901
+ self._keyUpPrevented = evt.isDefaultPrevented();
 
 
 
 
 
 
1902
 
1903
+ var key = evt.which;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1904
 
1905
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1906
+ var $previousChoice = self.$searchContainer
1907
+ .prev('.select2-selection__choice');
 
 
1908
 
1909
+ if ($previousChoice.length > 0) {
1910
+ var item = $previousChoice.data('data');
 
 
1911
 
1912
+ self.searchRemoveChoice(item);
 
 
 
 
 
 
 
 
 
 
1913
 
1914
+ evt.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
1915
  }
1916
+ }
1917
  });
1918
 
1919
+ // Try to detect the IE version should the `documentMode` property that
1920
+ // is stored on the document. This is only implemented in IE and is
1921
+ // slightly cleaner than doing a user agent check.
1922
+ // This property is not available in Edge, but Edge also doesn't have
1923
+ // this bug.
1924
+ var msie = document.documentMode;
1925
+ var disableInputEvents = msie && msie <= 11;
1926
+
1927
+ // Workaround for browsers which do not support the `input` event
1928
+ // This will prevent double-triggering of events for browsers which support
1929
+ // both the `keyup` and `input` events.
1930
+ this.$selection.on(
1931
+ 'input.searchcheck',
1932
+ '.select2-search--inline',
1933
+ function (evt) {
1934
+ // IE will trigger the `input` event when a placeholder is used on a
1935
+ // search box. To get around this issue, we are forced to ignore all
1936
+ // `input` events in IE and keep using `keyup`.
1937
+ if (disableInputEvents) {
1938
+ self.$selection.off('input.search input.searchcheck');
1939
+ return;
1940
+ }
1941
 
1942
+ // Unbind the duplicated `keyup` event
1943
+ self.$selection.off('keyup.search');
1944
+ }
1945
+ );
1946
+
1947
+ this.$selection.on(
1948
+ 'keyup.search input.search',
1949
+ '.select2-search--inline',
1950
+ function (evt) {
1951
+ // IE will trigger the `input` event when a placeholder is used on a
1952
+ // search box. To get around this issue, we are forced to ignore all
1953
+ // `input` events in IE and keep using `keyup`.
1954
+ if (disableInputEvents && evt.type === 'input') {
1955
+ self.$selection.off('input.search input.searchcheck');
1956
+ return;
1957
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1958
 
1959
+ var key = evt.which;
 
1960
 
1961
+ // We can freely ignore events from modifier keys
1962
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1963
+ return;
1964
+ }
1965
 
1966
+ // Tabbing will be handled during the `keydown` phase
1967
+ if (key == KEYS.TAB) {
1968
+ return;
1969
+ }
1970
 
1971
+ self.handleSearch(evt);
1972
+ }
1973
+ );
1974
+ };
 
 
 
 
 
 
 
 
1975
 
1976
+ /**
1977
+ * This method will transfer the tabindex attribute from the rendered
1978
+ * selection to the search box. This allows for the search box to be used as
1979
+ * the primary focus instead of the selection container.
1980
+ *
1981
+ * @private
1982
+ */
1983
+ Search.prototype._transferTabIndex = function (decorated) {
1984
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
1985
+ this.$selection.attr('tabindex', '-1');
1986
+ };
1987
 
1988
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
1989
+ this.$search.attr('placeholder', placeholder.text);
1990
+ };
 
 
1991
 
1992
+ Search.prototype.update = function (decorated, data) {
1993
+ var searchHadFocus = this.$search[0] == document.activeElement;
1994
 
1995
+ this.$search.attr('placeholder', '');
1996
 
1997
+ decorated.call(this, data);
 
1998
 
1999
+ this.$selection.find('.select2-selection__rendered')
2000
+ .append(this.$searchContainer);
 
 
 
2001
 
2002
+ this.resizeSearch();
2003
+ if (searchHadFocus) {
2004
+ this.$search.focus();
2005
+ }
2006
+ };
2007
 
2008
+ Search.prototype.handleSearch = function () {
2009
+ this.resizeSearch();
 
 
2010
 
2011
+ if (!this._keyUpPrevented) {
2012
+ var input = this.$search.val();
 
 
 
 
 
2013
 
2014
+ this.trigger('query', {
2015
+ term: input
2016
+ });
2017
+ }
2018
 
2019
+ this._keyUpPrevented = false;
2020
+ };
 
2021
 
2022
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2023
+ this.trigger('unselect', {
2024
+ data: item
2025
+ });
 
2026
 
2027
+ this.$search.val(item.text);
2028
+ this.handleSearch();
2029
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2030
 
2031
+ Search.prototype.resizeSearch = function () {
2032
+ this.$search.css('width', '25px');
 
 
 
 
 
 
2033
 
2034
+ var width = '';
 
 
 
 
 
2035
 
2036
+ if (this.$search.attr('placeholder') !== '') {
2037
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2038
+ } else {
2039
+ var minimumWidth = this.$search.val().length + 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2040
 
2041
+ width = (minimumWidth * 0.75) + 'em';
2042
+ }
 
 
2043
 
2044
+ this.$search.css('width', width);
2045
+ };
 
 
 
 
 
2046
 
2047
+ return Search;
2048
+ });
2049
 
2050
+ S2.define('select2/selection/eventRelay',[
2051
+ 'jquery'
2052
+ ], function ($) {
2053
+ function EventRelay () { }
2054
 
2055
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2056
+ var self = this;
2057
+ var relayEvents = [
2058
+ 'open', 'opening',
2059
+ 'close', 'closing',
2060
+ 'select', 'selecting',
2061
+ 'unselect', 'unselecting'
2062
+ ];
2063
 
2064
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2065
 
2066
+ decorated.call(this, container, $container);
 
 
 
 
2067
 
2068
+ container.on('*', function (name, params) {
2069
+ // Ignore events that should not be relayed
2070
+ if ($.inArray(name, relayEvents) === -1) {
2071
+ return;
2072
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2073
 
2074
+ // The parameters should always be an object
2075
+ params = params || {};
2076
 
2077
+ // Generate the jQuery event for the Select2 event
2078
+ var evt = $.Event('select2:' + name, {
2079
+ params: params
2080
+ });
2081
 
2082
+ self.$element.trigger(evt);
 
 
 
 
 
2083
 
2084
+ // Only handle preventable events if it was one
2085
+ if ($.inArray(name, preventableEvents) === -1) {
2086
+ return;
2087
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2088
 
2089
+ params.prevented = evt.isDefaultPrevented();
2090
+ });
2091
+ };
 
2092
 
2093
+ return EventRelay;
2094
+ });
 
 
 
 
 
 
 
2095
 
2096
+ S2.define('select2/translation',[
2097
+ 'jquery',
2098
+ 'require'
2099
+ ], function ($, require) {
2100
+ function Translation (dict) {
2101
+ this.dict = dict || {};
2102
+ }
2103
 
2104
+ Translation.prototype.all = function () {
2105
+ return this.dict;
2106
+ };
 
2107
 
2108
+ Translation.prototype.get = function (key) {
2109
+ return this.dict[key];
2110
+ };
2111
 
2112
+ Translation.prototype.extend = function (translation) {
2113
+ this.dict = $.extend({}, translation.all(), this.dict);
2114
+ };
2115
 
2116
+ // Static functions
 
2117
 
2118
+ Translation._cache = {};
 
 
 
 
2119
 
2120
+ Translation.loadPath = function (path) {
2121
+ if (!(path in Translation._cache)) {
2122
+ var translations = require(path);
 
 
2123
 
2124
+ Translation._cache[path] = translations;
2125
+ }
 
 
 
2126
 
2127
+ return new Translation(Translation._cache[path]);
2128
+ };
2129
+
2130
+ return Translation;
2131
+ });
2132
+
2133
+ S2.define('select2/diacritics',[
2134
+
2135
+ ], function () {
2136
+ var diacritics = {
2137
+ '\u24B6': 'A',
2138
+ '\uFF21': 'A',
2139
+ '\u00C0': 'A',
2140
+ '\u00C1': 'A',
2141
+ '\u00C2': 'A',
2142
+ '\u1EA6': 'A',
2143
+ '\u1EA4': 'A',
2144
+ '\u1EAA': 'A',
2145
+ '\u1EA8': 'A',
2146
+ '\u00C3': 'A',
2147
+ '\u0100': 'A',
2148
+ '\u0102': 'A',
2149
+ '\u1EB0': 'A',
2150
+ '\u1EAE': 'A',
2151
+ '\u1EB4': 'A',
2152
+ '\u1EB2': 'A',
2153
+ '\u0226': 'A',
2154
+ '\u01E0': 'A',
2155
+ '\u00C4': 'A',
2156
+ '\u01DE': 'A',
2157
+ '\u1EA2': 'A',
2158
+ '\u00C5': 'A',
2159
+ '\u01FA': 'A',
2160
+ '\u01CD': 'A',
2161
+ '\u0200': 'A',
2162
+ '\u0202': 'A',
2163
+ '\u1EA0': 'A',
2164
+ '\u1EAC': 'A',
2165
+ '\u1EB6': 'A',
2166
+ '\u1E00': 'A',
2167
+ '\u0104': 'A',
2168
+ '\u023A': 'A',
2169
+ '\u2C6F': 'A',
2170
+ '\uA732': 'AA',
2171
+ '\u00C6': 'AE',
2172
+ '\u01FC': 'AE',
2173
+ '\u01E2': 'AE',
2174
+ '\uA734': 'AO',
2175
+ '\uA736': 'AU',
2176
+ '\uA738': 'AV',
2177
+ '\uA73A': 'AV',
2178
+ '\uA73C': 'AY',
2179
+ '\u24B7': 'B',
2180
+ '\uFF22': 'B',
2181
+ '\u1E02': 'B',
2182
+ '\u1E04': 'B',
2183
+ '\u1E06': 'B',
2184
+ '\u0243': 'B',
2185
+ '\u0182': 'B',
2186
+ '\u0181': 'B',
2187
+ '\u24B8': 'C',
2188
+ '\uFF23': 'C',
2189
+ '\u0106': 'C',
2190
+ '\u0108': 'C',
2191
+ '\u010A': 'C',
2192
+ '\u010C': 'C',
2193
+ '\u00C7': 'C',
2194
+ '\u1E08': 'C',
2195
+ '\u0187': 'C',
2196
+ '\u023B': 'C',
2197
+ '\uA73E': 'C',
2198
+ '\u24B9': 'D',
2199
+ '\uFF24': 'D',
2200
+ '\u1E0A': 'D',
2201
+ '\u010E': 'D',
2202
+ '\u1E0C': 'D',
2203
+ '\u1E10': 'D',
2204
+ '\u1E12': 'D',
2205
+ '\u1E0E': 'D',
2206
+ '\u0110': 'D',
2207
+ '\u018B': 'D',
2208
+ '\u018A': 'D',
2209
+ '\u0189': 'D',
2210
+ '\uA779': 'D',
2211
+ '\u01F1': 'DZ',
2212
+ '\u01C4': 'DZ',
2213
+ '\u01F2': 'Dz',
2214
+ '\u01C5': 'Dz',
2215
+ '\u24BA': 'E',
2216
+ '\uFF25': 'E',
2217
+ '\u00C8': 'E',
2218
+ '\u00C9': 'E',
2219
+ '\u00CA': 'E',
2220
+ '\u1EC0': 'E',
2221
+ '\u1EBE': 'E',
2222
+ '\u1EC4': 'E',
2223
+ '\u1EC2': 'E',
2224
+ '\u1EBC': 'E',
2225
+ '\u0112': 'E',
2226
+ '\u1E14': 'E',
2227
+ '\u1E16': 'E',
2228
+ '\u0114': 'E',
2229
+ '\u0116': 'E',
2230
+ '\u00CB': 'E',
2231
+ '\u1EBA': 'E',
2232
+ '\u011A': 'E',
2233
+ '\u0204': 'E',
2234
+ '\u0206': 'E',
2235
+ '\u1EB8': 'E',
2236
+ '\u1EC6': 'E',
2237
+ '\u0228': 'E',
2238
+ '\u1E1C': 'E',
2239
+ '\u0118': 'E',
2240
+ '\u1E18': 'E',
2241
+ '\u1E1A': 'E',
2242
+ '\u0190': 'E',
2243
+ '\u018E': 'E',
2244
+ '\u24BB': 'F',
2245
+ '\uFF26': 'F',
2246
+ '\u1E1E': 'F',
2247
+ '\u0191': 'F',
2248
+ '\uA77B': 'F',
2249
+ '\u24BC': 'G',
2250
+ '\uFF27': 'G',
2251
+ '\u01F4': 'G',
2252
+ '\u011C': 'G',
2253
+ '\u1E20': 'G',
2254
+ '\u011E': 'G',
2255
+ '\u0120': 'G',
2256
+ '\u01E6': 'G',
2257
+ '\u0122': 'G',
2258
+ '\u01E4': 'G',
2259
+ '\u0193': 'G',
2260
+ '\uA7A0': 'G',
2261
+ '\uA77D': 'G',
2262
+ '\uA77E': 'G',
2263
+ '\u24BD': 'H',
2264
+ '\uFF28': 'H',
2265
+ '\u0124': 'H',
2266
+ '\u1E22': 'H',
2267
+ '\u1E26': 'H',
2268
+ '\u021E': 'H',
2269
+ '\u1E24': 'H',
2270
+ '\u1E28': 'H',
2271
+ '\u1E2A': 'H',
2272
+ '\u0126': 'H',
2273
+ '\u2C67': 'H',
2274
+ '\u2C75': 'H',
2275
+ '\uA78D': 'H',
2276
+ '\u24BE': 'I',
2277
+ '\uFF29': 'I',
2278
+ '\u00CC': 'I',
2279
+ '\u00CD': 'I',
2280
+ '\u00CE': 'I',
2281
+ '\u0128': 'I',
2282
+ '\u012A': 'I',
2283
+ '\u012C': 'I',
2284
+ '\u0130': 'I',
2285
+ '\u00CF': 'I',
2286
+ '\u1E2E': 'I',
2287
+ '\u1EC8': 'I',
2288
+ '\u01CF': 'I',
2289
+ '\u0208': 'I',
2290
+ '\u020A': 'I',
2291
+ '\u1ECA': 'I',
2292
+ '\u012E': 'I',
2293
+ '\u1E2C': 'I',
2294
+ '\u0197': 'I',
2295
+ '\u24BF': 'J',
2296
+ '\uFF2A': 'J',
2297
+ '\u0134': 'J',
2298
+ '\u0248': 'J',
2299
+ '\u24C0': 'K',
2300
+ '\uFF2B': 'K',
2301
+ '\u1E30': 'K',
2302
+ '\u01E8': 'K',
2303
+ '\u1E32': 'K',
2304
+ '\u0136': 'K',
2305
+ '\u1E34': 'K',
2306
+ '\u0198': 'K',
2307
+ '\u2C69': 'K',
2308
+ '\uA740': 'K',
2309
+ '\uA742': 'K',
2310
+ '\uA744': 'K',
2311
+ '\uA7A2': 'K',
2312
+ '\u24C1': 'L',
2313
+ '\uFF2C': 'L',
2314
+ '\u013F': 'L',
2315
+ '\u0139': 'L',
2316
+ '\u013D': 'L',
2317
+ '\u1E36': 'L',
2318
+ '\u1E38': 'L',
2319
+ '\u013B': 'L',
2320
+ '\u1E3C': 'L',
2321
+ '\u1E3A': 'L',
2322
+ '\u0141': 'L',
2323
+ '\u023D': 'L',
2324
+ '\u2C62': 'L',
2325
+ '\u2C60': 'L',
2326
+ '\uA748': 'L',
2327
+ '\uA746': 'L',
2328
+ '\uA780': 'L',
2329
+ '\u01C7': 'LJ',
2330
+ '\u01C8': 'Lj',
2331
+ '\u24C2': 'M',
2332
+ '\uFF2D': 'M',
2333
+ '\u1E3E': 'M',
2334
+ '\u1E40': 'M',
2335
+ '\u1E42': 'M',
2336
+ '\u2C6E': 'M',
2337
+ '\u019C': 'M',
2338
+ '\u24C3': 'N',
2339
+ '\uFF2E': 'N',
2340
+ '\u01F8': 'N',
2341
+ '\u0143': 'N',
2342
+ '\u00D1': 'N',
2343
+ '\u1E44': 'N',
2344
+ '\u0147': 'N',
2345
+ '\u1E46': 'N',
2346
+ '\u0145': 'N',
2347
+ '\u1E4A': 'N',
2348
+ '\u1E48': 'N',
2349
+ '\u0220': 'N',
2350
+ '\u019D': 'N',
2351
+ '\uA790': 'N',
2352
+ '\uA7A4': 'N',
2353
+ '\u01CA': 'NJ',
2354
+ '\u01CB': 'Nj',
2355
+ '\u24C4': 'O',
2356
+ '\uFF2F': 'O',
2357
+ '\u00D2': 'O',
2358
+ '\u00D3': 'O',
2359
+ '\u00D4': 'O',
2360
+ '\u1ED2': 'O',
2361
+ '\u1ED0': 'O',
2362
+ '\u1ED6': 'O',
2363
+ '\u1ED4': 'O',
2364
+ '\u00D5': 'O',
2365
+ '\u1E4C': 'O',
2366
+ '\u022C': 'O',
2367
+ '\u1E4E': 'O',
2368
+ '\u014C': 'O',
2369
+ '\u1E50': 'O',
2370
+ '\u1E52': 'O',
2371
+ '\u014E': 'O',
2372
+ '\u022E': 'O',
2373
+ '\u0230': 'O',
2374
+ '\u00D6': 'O',
2375
+ '\u022A': 'O',
2376
+ '\u1ECE': 'O',
2377
+ '\u0150': 'O',
2378
+ '\u01D1': 'O',
2379
+ '\u020C': 'O',
2380
+ '\u020E': 'O',
2381
+ '\u01A0': 'O',
2382
+ '\u1EDC': 'O',
2383
+ '\u1EDA': 'O',
2384
+ '\u1EE0': 'O',
2385
+ '\u1EDE': 'O',
2386
+ '\u1EE2': 'O',
2387
+ '\u1ECC': 'O',
2388
+ '\u1ED8': 'O',
2389
+ '\u01EA': 'O',
2390
+ '\u01EC': 'O',
2391
+ '\u00D8': 'O',
2392
+ '\u01FE': 'O',
2393
+ '\u0186': 'O',
2394
+ '\u019F': 'O',
2395
+ '\uA74A': 'O',
2396
+ '\uA74C': 'O',
2397
+ '\u01A2': 'OI',
2398
+ '\uA74E': 'OO',
2399
+ '\u0222': 'OU',
2400
+ '\u24C5': 'P',
2401
+ '\uFF30': 'P',
2402
+ '\u1E54': 'P',
2403
+ '\u1E56': 'P',
2404
+ '\u01A4': 'P',
2405
+ '\u2C63': 'P',
2406
+ '\uA750': 'P',
2407
+ '\uA752': 'P',
2408
+ '\uA754': 'P',
2409
+ '\u24C6': 'Q',
2410
+ '\uFF31': 'Q',
2411
+ '\uA756': 'Q',
2412
+ '\uA758': 'Q',
2413
+ '\u024A': 'Q',
2414
+ '\u24C7': 'R',
2415
+ '\uFF32': 'R',
2416
+ '\u0154': 'R',
2417
+ '\u1E58': 'R',
2418
+ '\u0158': 'R',
2419
+ '\u0210': 'R',
2420
+ '\u0212': 'R',
2421
+ '\u1E5A': 'R',
2422
+ '\u1E5C': 'R',
2423
+ '\u0156': 'R',
2424
+ '\u1E5E': 'R',
2425
+ '\u024C': 'R',
2426
+ '\u2C64': 'R',
2427
+ '\uA75A': 'R',
2428
+ '\uA7A6': 'R',
2429
+ '\uA782': 'R',
2430
+ '\u24C8': 'S',
2431
+ '\uFF33': 'S',
2432
+ '\u1E9E': 'S',
2433
+ '\u015A': 'S',
2434
+ '\u1E64': 'S',
2435
+ '\u015C': 'S',
2436
+ '\u1E60': 'S',
2437
+ '\u0160': 'S',
2438
+ '\u1E66': 'S',
2439
+ '\u1E62': 'S',
2440
+ '\u1E68': 'S',
2441
+ '\u0218': 'S',
2442
+ '\u015E': 'S',
2443
+ '\u2C7E': 'S',
2444
+ '\uA7A8': 'S',
2445
+ '\uA784': 'S',
2446
+ '\u24C9': 'T',
2447
+ '\uFF34': 'T',
2448
+ '\u1E6A': 'T',
2449
+ '\u0164': 'T',
2450
+ '\u1E6C': 'T',
2451
+ '\u021A': 'T',
2452
+ '\u0162': 'T',
2453
+ '\u1E70': 'T',
2454
+ '\u1E6E': 'T',
2455
+ '\u0166': 'T',
2456
+ '\u01AC': 'T',
2457
+ '\u01AE': 'T',
2458
+ '\u023E': 'T',
2459
+ '\uA786': 'T',
2460
+ '\uA728': 'TZ',
2461
+ '\u24CA': 'U',
2462
+ '\uFF35': 'U',
2463
+ '\u00D9': 'U',
2464
+ '\u00DA': 'U',
2465
+ '\u00DB': 'U',
2466
+ '\u0168': 'U',
2467
+ '\u1E78': 'U',
2468
+ '\u016A': 'U',
2469
+ '\u1E7A': 'U',
2470
+ '\u016C': 'U',
2471
+ '\u00DC': 'U',
2472
+ '\u01DB': 'U',
2473
+ '\u01D7': 'U',
2474
+ '\u01D5': 'U',
2475
+ '\u01D9': 'U',
2476
+ '\u1EE6': 'U',
2477
+ '\u016E': 'U',
2478
+ '\u0170': 'U',
2479
+ '\u01D3': 'U',
2480
+ '\u0214': 'U',
2481
+ '\u0216': 'U',
2482
+ '\u01AF': 'U',
2483
+ '\u1EEA': 'U',
2484
+ '\u1EE8': 'U',
2485
+ '\u1EEE': 'U',
2486
+ '\u1EEC': 'U',
2487
+ '\u1EF0': 'U',
2488
+ '\u1EE4': 'U',
2489
+ '\u1E72': 'U',
2490
+ '\u0172': 'U',
2491
+ '\u1E76': 'U',
2492
+ '\u1E74': 'U',
2493
+ '\u0244': 'U',
2494
+ '\u24CB': 'V',
2495
+ '\uFF36': 'V',
2496
+ '\u1E7C': 'V',
2497
+ '\u1E7E': 'V',
2498
+ '\u01B2': 'V',
2499
+ '\uA75E': 'V',
2500
+ '\u0245': 'V',
2501
+ '\uA760': 'VY',
2502
+ '\u24CC': 'W',
2503
+ '\uFF37': 'W',
2504
+ '\u1E80': 'W',
2505
+ '\u1E82': 'W',
2506
+ '\u0174': 'W',
2507
+ '\u1E86': 'W',
2508
+ '\u1E84': 'W',
2509
+ '\u1E88': 'W',
2510
+ '\u2C72': 'W',
2511
+ '\u24CD': 'X',
2512
+ '\uFF38': 'X',
2513
+ '\u1E8A': 'X',
2514
+ '\u1E8C': 'X',
2515
+ '\u24CE': 'Y',
2516
+ '\uFF39': 'Y',
2517
+ '\u1EF2': 'Y',
2518
+ '\u00DD': 'Y',
2519
+ '\u0176': 'Y',
2520
+ '\u1EF8': 'Y',
2521
+ '\u0232': 'Y',
2522
+ '\u1E8E': 'Y',
2523
+ '\u0178': 'Y',
2524
+ '\u1EF6': 'Y',
2525
+ '\u1EF4': 'Y',
2526
+ '\u01B3': 'Y',
2527
+ '\u024E': 'Y',
2528
+ '\u1EFE': 'Y',
2529
+ '\u24CF': 'Z',
2530
+ '\uFF3A': 'Z',
2531
+ '\u0179': 'Z',
2532
+ '\u1E90': 'Z',
2533
+ '\u017B': 'Z',
2534
+ '\u017D': 'Z',
2535
+ '\u1E92': 'Z',
2536
+ '\u1E94': 'Z',
2537
+ '\u01B5': 'Z',
2538
+ '\u0224': 'Z',
2539
+ '\u2C7F': 'Z',
2540
+ '\u2C6B': 'Z',
2541
+ '\uA762': 'Z',
2542
+ '\u24D0': 'a',
2543
+ '\uFF41': 'a',
2544
+ '\u1E9A': 'a',
2545
+ '\u00E0': 'a',
2546
+ '\u00E1': 'a',
2547
+ '\u00E2': 'a',
2548
+ '\u1EA7': 'a',
2549
+ '\u1EA5': 'a',
2550
+ '\u1EAB': 'a',
2551
+ '\u1EA9': 'a',
2552
+ '\u00E3': 'a',
2553
+ '\u0101': 'a',
2554
+ '\u0103': 'a',
2555
+ '\u1EB1': 'a',
2556
+ '\u1EAF': 'a',
2557
+ '\u1EB5': 'a',
2558
+ '\u1EB3': 'a',
2559
+ '\u0227': 'a',
2560
+ '\u01E1': 'a',
2561
+ '\u00E4': 'a',
2562
+ '\u01DF': 'a',
2563
+ '\u1EA3': 'a',
2564
+ '\u00E5': 'a',
2565
+ '\u01FB': 'a',
2566
+ '\u01CE': 'a',
2567
+ '\u0201': 'a',
2568
+ '\u0203': 'a',
2569
+ '\u1EA1': 'a',
2570
+ '\u1EAD': 'a',
2571
+ '\u1EB7': 'a',
2572
+ '\u1E01': 'a',
2573
+ '\u0105': 'a',
2574
+ '\u2C65': 'a',
2575
+ '\u0250': 'a',
2576
+ '\uA733': 'aa',
2577
+ '\u00E6': 'ae',
2578
+ '\u01FD': 'ae',
2579
+ '\u01E3': 'ae',
2580
+ '\uA735': 'ao',
2581
+ '\uA737': 'au',
2582
+ '\uA739': 'av',
2583
+ '\uA73B': 'av',
2584
+ '\uA73D': 'ay',
2585
+ '\u24D1': 'b',
2586
+ '\uFF42': 'b',
2587
+ '\u1E03': 'b',
2588
+ '\u1E05': 'b',
2589
+ '\u1E07': 'b',
2590
+ '\u0180': 'b',
2591
+ '\u0183': 'b',
2592
+ '\u0253': 'b',
2593
+ '\u24D2': 'c',
2594
+ '\uFF43': 'c',
2595
+ '\u0107': 'c',
2596
+ '\u0109': 'c',
2597
+ '\u010B': 'c',
2598
+ '\u010D': 'c',
2599
+ '\u00E7': 'c',
2600
+ '\u1E09': 'c',
2601
+ '\u0188': 'c',
2602
+ '\u023C': 'c',
2603
+ '\uA73F': 'c',
2604
+ '\u2184': 'c',
2605
+ '\u24D3': 'd',
2606
+ '\uFF44': 'd',
2607
+ '\u1E0B': 'd',
2608
+ '\u010F': 'd',
2609
+ '\u1E0D': 'd',
2610
+ '\u1E11': 'd',
2611
+ '\u1E13': 'd',
2612
+ '\u1E0F': 'd',
2613
+ '\u0111': 'd',
2614
+ '\u018C': 'd',
2615
+ '\u0256': 'd',
2616
+ '\u0257': 'd',
2617
+ '\uA77A': 'd',
2618
+ '\u01F3': 'dz',
2619
+ '\u01C6': 'dz',
2620
+ '\u24D4': 'e',
2621
+ '\uFF45': 'e',
2622
+ '\u00E8': 'e',
2623
+ '\u00E9': 'e',
2624
+ '\u00EA': 'e',
2625
+ '\u1EC1': 'e',
2626
+ '\u1EBF': 'e',
2627
+ '\u1EC5': 'e',
2628
+ '\u1EC3': 'e',
2629
+ '\u1EBD': 'e',
2630
+ '\u0113': 'e',
2631
+ '\u1E15': 'e',
2632
+ '\u1E17': 'e',
2633
+ '\u0115': 'e',
2634
+ '\u0117': 'e',
2635
+ '\u00EB': 'e',
2636
+ '\u1EBB': 'e',
2637
+ '\u011B': 'e',
2638
+ '\u0205': 'e',
2639
+ '\u0207': 'e',
2640
+ '\u1EB9': 'e',
2641
+ '\u1EC7': 'e',
2642
+ '\u0229': 'e',
2643
+ '\u1E1D': 'e',
2644
+ '\u0119': 'e',
2645
+ '\u1E19': 'e',
2646
+ '\u1E1B': 'e',
2647
+ '\u0247': 'e',
2648
+ '\u025B': 'e',
2649
+ '\u01DD': 'e',
2650
+ '\u24D5': 'f',
2651
+ '\uFF46': 'f',
2652
+ '\u1E1F': 'f',
2653
+ '\u0192': 'f',
2654
+ '\uA77C': 'f',
2655
+ '\u24D6': 'g',
2656
+ '\uFF47': 'g',
2657
+ '\u01F5': 'g',
2658
+ '\u011D': 'g',
2659
+ '\u1E21': 'g',
2660
+ '\u011F': 'g',
2661
+ '\u0121': 'g',
2662
+ '\u01E7': 'g',
2663
+ '\u0123': 'g',
2664
+ '\u01E5': 'g',
2665
+ '\u0260': 'g',
2666
+ '\uA7A1': 'g',
2667
+ '\u1D79': 'g',
2668
+ '\uA77F': 'g',
2669
+ '\u24D7': 'h',
2670
+ '\uFF48': 'h',
2671
+ '\u0125': 'h',
2672
+ '\u1E23': 'h',
2673
+ '\u1E27': 'h',
2674
+ '\u021F': 'h',
2675
+ '\u1E25': 'h',
2676
+ '\u1E29': 'h',
2677
+ '\u1E2B': 'h',
2678
+ '\u1E96': 'h',
2679
+ '\u0127': 'h',
2680
+ '\u2C68': 'h',
2681
+ '\u2C76': 'h',
2682
+ '\u0265': 'h',
2683
+ '\u0195': 'hv',
2684
+ '\u24D8': 'i',
2685
+ '\uFF49': 'i',
2686
+ '\u00EC': 'i',
2687
+ '\u00ED': 'i',
2688
+ '\u00EE': 'i',
2689
+ '\u0129': 'i',
2690
+ '\u012B': 'i',
2691
+ '\u012D': 'i',
2692
+ '\u00EF': 'i',
2693
+ '\u1E2F': 'i',
2694
+ '\u1EC9': 'i',
2695
+ '\u01D0': 'i',
2696
+ '\u0209': 'i',
2697
+ '\u020B': 'i',
2698
+ '\u1ECB': 'i',
2699
+ '\u012F': 'i',
2700
+ '\u1E2D': 'i',
2701
+ '\u0268': 'i',
2702
+ '\u0131': 'i',
2703
+ '\u24D9': 'j',
2704
+ '\uFF4A': 'j',
2705
+ '\u0135': 'j',
2706
+ '\u01F0': 'j',
2707
+ '\u0249': 'j',
2708
+ '\u24DA': 'k',
2709
+ '\uFF4B': 'k',
2710
+ '\u1E31': 'k',
2711
+ '\u01E9': 'k',
2712
+ '\u1E33': 'k',
2713
+ '\u0137': 'k',
2714
+ '\u1E35': 'k',
2715
+ '\u0199': 'k',
2716
+ '\u2C6A': 'k',
2717
+ '\uA741': 'k',
2718
+ '\uA743': 'k',
2719
+ '\uA745': 'k',
2720
+ '\uA7A3': 'k',
2721
+ '\u24DB': 'l',
2722
+ '\uFF4C': 'l',
2723
+ '\u0140': 'l',
2724
+ '\u013A': 'l',
2725
+ '\u013E': 'l',
2726
+ '\u1E37': 'l',
2727
+ '\u1E39': 'l',
2728
+ '\u013C': 'l',
2729
+ '\u1E3D': 'l',
2730
+ '\u1E3B': 'l',
2731
+ '\u017F': 'l',
2732
+ '\u0142': 'l',
2733
+ '\u019A': 'l',
2734
+ '\u026B': 'l',
2735
+ '\u2C61': 'l',
2736
+ '\uA749': 'l',
2737
+ '\uA781': 'l',
2738
+ '\uA747': 'l',
2739
+ '\u01C9': 'lj',
2740
+ '\u24DC': 'm',
2741
+ '\uFF4D': 'm',
2742
+ '\u1E3F': 'm',
2743
+ '\u1E41': 'm',
2744
+ '\u1E43': 'm',
2745
+ '\u0271': 'm',
2746
+ '\u026F': 'm',
2747
+ '\u24DD': 'n',
2748
+ '\uFF4E': 'n',
2749
+ '\u01F9': 'n',
2750
+ '\u0144': 'n',
2751
+ '\u00F1': 'n',
2752
+ '\u1E45': 'n',
2753
+ '\u0148': 'n',
2754
+ '\u1E47': 'n',
2755
+ '\u0146': 'n',
2756
+ '\u1E4B': 'n',
2757
+ '\u1E49': 'n',
2758
+ '\u019E': 'n',
2759
+ '\u0272': 'n',
2760
+ '\u0149': 'n',
2761
+ '\uA791': 'n',
2762
+ '\uA7A5': 'n',
2763
+ '\u01CC': 'nj',
2764
+ '\u24DE': 'o',
2765
+ '\uFF4F': 'o',
2766
+ '\u00F2': 'o',
2767
+ '\u00F3': 'o',
2768
+ '\u00F4': 'o',
2769
+ '\u1ED3': 'o',
2770
+ '\u1ED1': 'o',
2771
+ '\u1ED7': 'o',
2772
+ '\u1ED5': 'o',
2773
+ '\u00F5': 'o',
2774
+ '\u1E4D': 'o',
2775
+ '\u022D': 'o',
2776
+ '\u1E4F': 'o',
2777
+ '\u014D': 'o',
2778
+ '\u1E51': 'o',
2779
+ '\u1E53': 'o',
2780
+ '\u014F': 'o',
2781
+ '\u022F': 'o',
2782
+ '\u0231': 'o',
2783
+ '\u00F6': 'o',
2784
+ '\u022B': 'o',
2785
+ '\u1ECF': 'o',
2786
+ '\u0151': 'o',
2787
+ '\u01D2': 'o',
2788
+ '\u020D': 'o',
2789
+ '\u020F': 'o',
2790
+ '\u01A1': 'o',
2791
+ '\u1EDD': 'o',
2792
+ '\u1EDB': 'o',
2793
+ '\u1EE1': 'o',
2794
+ '\u1EDF': 'o',
2795
+ '\u1EE3': 'o',
2796
+ '\u1ECD': 'o',
2797
+ '\u1ED9': 'o',
2798
+ '\u01EB': 'o',
2799
+ '\u01ED': 'o',
2800
+ '\u00F8': 'o',
2801
+ '\u01FF': 'o',
2802
+ '\u0254': 'o',
2803
+ '\uA74B': 'o',
2804
+ '\uA74D': 'o',
2805
+ '\u0275': 'o',
2806
+ '\u01A3': 'oi',
2807
+ '\u0223': 'ou',
2808
+ '\uA74F': 'oo',
2809
+ '\u24DF': 'p',
2810
+ '\uFF50': 'p',
2811
+ '\u1E55': 'p',
2812
+ '\u1E57': 'p',
2813
+ '\u01A5': 'p',
2814
+ '\u1D7D': 'p',
2815
+ '\uA751': 'p',
2816
+ '\uA753': 'p',
2817
+ '\uA755': 'p',
2818
+ '\u24E0': 'q',
2819
+ '\uFF51': 'q',
2820
+ '\u024B': 'q',
2821
+ '\uA757': 'q',
2822
+ '\uA759': 'q',
2823
+ '\u24E1': 'r',
2824
+ '\uFF52': 'r',
2825
+ '\u0155': 'r',
2826
+ '\u1E59': 'r',
2827
+ '\u0159': 'r',
2828
+ '\u0211': 'r',
2829
+ '\u0213': 'r',
2830
+ '\u1E5B': 'r',
2831
+ '\u1E5D': 'r',
2832
+ '\u0157': 'r',
2833
+ '\u1E5F': 'r',
2834
+ '\u024D': 'r',
2835
+ '\u027D': 'r',
2836
+ '\uA75B': 'r',
2837
+ '\uA7A7': 'r',
2838
+ '\uA783': 'r',
2839
+ '\u24E2': 's',
2840
+ '\uFF53': 's',
2841
+ '\u00DF': 's',
2842
+ '\u015B': 's',
2843
+ '\u1E65': 's',
2844
+ '\u015D': 's',
2845
+ '\u1E61': 's',
2846
+ '\u0161': 's',
2847
+ '\u1E67': 's',
2848
+ '\u1E63': 's',
2849
+ '\u1E69': 's',
2850
+ '\u0219': 's',
2851
+ '\u015F': 's',
2852
+ '\u023F': 's',
2853
+ '\uA7A9': 's',
2854
+ '\uA785': 's',
2855
+ '\u1E9B': 's',
2856
+ '\u24E3': 't',
2857
+ '\uFF54': 't',
2858
+ '\u1E6B': 't',
2859
+ '\u1E97': 't',
2860
+ '\u0165': 't',
2861
+ '\u1E6D': 't',
2862
+ '\u021B': 't',
2863
+ '\u0163': 't',
2864
+ '\u1E71': 't',
2865
+ '\u1E6F': 't',
2866
+ '\u0167': 't',
2867
+ '\u01AD': 't',
2868
+ '\u0288': 't',
2869
+ '\u2C66': 't',
2870
+ '\uA787': 't',
2871
+ '\uA729': 'tz',
2872
+ '\u24E4': 'u',
2873
+ '\uFF55': 'u',
2874
+ '\u00F9': 'u',
2875
+ '\u00FA': 'u',
2876
+ '\u00FB': 'u',
2877
+ '\u0169': 'u',
2878
+ '\u1E79': 'u',
2879
+ '\u016B': 'u',
2880
+ '\u1E7B': 'u',
2881
+ '\u016D': 'u',
2882
+ '\u00FC': 'u',
2883
+ '\u01DC': 'u',
2884
+ '\u01D8': 'u',
2885
+ '\u01D6': 'u',
2886
+ '\u01DA': 'u',
2887
+ '\u1EE7': 'u',
2888
+ '\u016F': 'u',
2889
+ '\u0171': 'u',
2890
+ '\u01D4': 'u',
2891
+ '\u0215': 'u',
2892
+ '\u0217': 'u',
2893
+ '\u01B0': 'u',
2894
+ '\u1EEB': 'u',
2895
+ '\u1EE9': 'u',
2896
+ '\u1EEF': 'u',
2897
+ '\u1EED': 'u',
2898
+ '\u1EF1': 'u',
2899
+ '\u1EE5': 'u',
2900
+ '\u1E73': 'u',
2901
+ '\u0173': 'u',
2902
+ '\u1E77': 'u',
2903
+ '\u1E75': 'u',
2904
+ '\u0289': 'u',
2905
+ '\u24E5': 'v',
2906
+ '\uFF56': 'v',
2907
+ '\u1E7D': 'v',
2908
+ '\u1E7F': 'v',
2909
+ '\u028B': 'v',
2910
+ '\uA75F': 'v',
2911
+ '\u028C': 'v',
2912
+ '\uA761': 'vy',
2913
+ '\u24E6': 'w',
2914
+ '\uFF57': 'w',
2915
+ '\u1E81': 'w',
2916
+ '\u1E83': 'w',
2917
+ '\u0175': 'w',
2918
+ '\u1E87': 'w',
2919
+ '\u1E85': 'w',
2920
+ '\u1E98': 'w',
2921
+ '\u1E89': 'w',
2922
+ '\u2C73': 'w',
2923
+ '\u24E7': 'x',
2924
+ '\uFF58': 'x',
2925
+ '\u1E8B': 'x',
2926
+ '\u1E8D': 'x',
2927
+ '\u24E8': 'y',
2928
+ '\uFF59': 'y',
2929
+ '\u1EF3': 'y',
2930
+ '\u00FD': 'y',
2931
+ '\u0177': 'y',
2932
+ '\u1EF9': 'y',
2933
+ '\u0233': 'y',
2934
+ '\u1E8F': 'y',
2935
+ '\u00FF': 'y',
2936
+ '\u1EF7': 'y',
2937
+ '\u1E99': 'y',
2938
+ '\u1EF5': 'y',
2939
+ '\u01B4': 'y',
2940
+ '\u024F': 'y',
2941
+ '\u1EFF': 'y',
2942
+ '\u24E9': 'z',
2943
+ '\uFF5A': 'z',
2944
+ '\u017A': 'z',
2945
+ '\u1E91': 'z',
2946
+ '\u017C': 'z',
2947
+ '\u017E': 'z',
2948
+ '\u1E93': 'z',
2949
+ '\u1E95': 'z',
2950
+ '\u01B6': 'z',
2951
+ '\u0225': 'z',
2952
+ '\u0240': 'z',
2953
+ '\u2C6C': 'z',
2954
+ '\uA763': 'z',
2955
+ '\u0386': '\u0391',
2956
+ '\u0388': '\u0395',
2957
+ '\u0389': '\u0397',
2958
+ '\u038A': '\u0399',
2959
+ '\u03AA': '\u0399',
2960
+ '\u038C': '\u039F',
2961
+ '\u038E': '\u03A5',
2962
+ '\u03AB': '\u03A5',
2963
+ '\u038F': '\u03A9',
2964
+ '\u03AC': '\u03B1',
2965
+ '\u03AD': '\u03B5',
2966
+ '\u03AE': '\u03B7',
2967
+ '\u03AF': '\u03B9',
2968
+ '\u03CA': '\u03B9',
2969
+ '\u0390': '\u03B9',
2970
+ '\u03CC': '\u03BF',
2971
+ '\u03CD': '\u03C5',
2972
+ '\u03CB': '\u03C5',
2973
+ '\u03B0': '\u03C5',
2974
+ '\u03C9': '\u03C9',
2975
+ '\u03C2': '\u03C3'
2976
+ };
2977
+
2978
+ return diacritics;
2979
+ });
2980
+
2981
+ S2.define('select2/data/base',[
2982
+ '../utils'
2983
+ ], function (Utils) {
2984
+ function BaseAdapter ($element, options) {
2985
+ BaseAdapter.__super__.constructor.call(this);
2986
+ }
2987
+
2988
+ Utils.Extend(BaseAdapter, Utils.Observable);
2989
+
2990
+ BaseAdapter.prototype.current = function (callback) {
2991
+ throw new Error('The `current` method must be defined in child classes.');
2992
+ };
2993
+
2994
+ BaseAdapter.prototype.query = function (params, callback) {
2995
+ throw new Error('The `query` method must be defined in child classes.');
2996
+ };
2997
+
2998
+ BaseAdapter.prototype.bind = function (container, $container) {
2999
+ // Can be implemented in subclasses
3000
+ };
3001
+
3002
+ BaseAdapter.prototype.destroy = function () {
3003
+ // Can be implemented in subclasses
3004
+ };
3005
+
3006
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3007
+ var id = container.id + '-result-';
3008
+
3009
+ id += Utils.generateChars(4);
3010
+
3011
+ if (data.id != null) {
3012
+ id += '-' + data.id.toString();
3013
+ } else {
3014
+ id += '-' + Utils.generateChars(4);
3015
+ }
3016
+ return id;
3017
+ };
3018
 
3019
+ return BaseAdapter;
3020
+ });
 
3021
 
3022
+ S2.define('select2/data/select',[
3023
+ './base',
3024
+ '../utils',
3025
+ 'jquery'
3026
+ ], function (BaseAdapter, Utils, $) {
3027
+ function SelectAdapter ($element, options) {
3028
+ this.$element = $element;
3029
+ this.options = options;
3030
 
3031
+ SelectAdapter.__super__.constructor.call(this);
3032
+ }
 
 
3033
 
3034
+ Utils.Extend(SelectAdapter, BaseAdapter);
 
 
 
 
 
 
 
 
 
3035
 
3036
+ SelectAdapter.prototype.current = function (callback) {
3037
+ var data = [];
3038
+ var self = this;
3039
 
3040
+ this.$element.find(':selected').each(function () {
3041
+ var $option = $(this);
3042
 
3043
+ var option = self.item($option);
3044
 
3045
+ data.push(option);
3046
+ });
3047
 
3048
+ callback(data);
3049
+ };
3050
 
3051
+ SelectAdapter.prototype.select = function (data) {
3052
+ var self = this;
3053
 
3054
+ data.selected = true;
 
3055
 
3056
+ // If data.element is a DOM node, use it instead
3057
+ if ($(data.element).is('option')) {
3058
+ data.element.selected = true;
3059
 
3060
+ this.$element.trigger('change');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3061
 
3062
+ return;
3063
+ }
 
3064
 
3065
+ if (this.$element.prop('multiple')) {
3066
+ this.current(function (currentData) {
3067
+ var val = [];
3068
 
3069
+ data = [data];
3070
+ data.push.apply(data, currentData);
 
 
 
3071
 
3072
+ for (var d = 0; d < data.length; d++) {
3073
+ var id = data[d].id;
 
 
 
 
 
3074
 
3075
+ if ($.inArray(id, val) === -1) {
3076
+ val.push(id);
3077
+ }
3078
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3079
 
3080
+ self.$element.val(val);
3081
+ self.$element.trigger('change');
3082
+ });
3083
+ } else {
3084
+ var val = data.id;
 
 
 
 
 
 
 
 
 
 
 
 
3085
 
3086
+ this.$element.val(val);
3087
+ this.$element.trigger('change');
3088
+ }
3089
+ };
3090
 
3091
+ SelectAdapter.prototype.unselect = function (data) {
3092
+ var self = this;
3093
 
3094
+ if (!this.$element.prop('multiple')) {
3095
+ return;
3096
+ }
 
 
 
3097
 
3098
+ data.selected = false;
 
 
3099
 
3100
+ if ($(data.element).is('option')) {
3101
+ data.element.selected = false;
3102
 
3103
+ this.$element.trigger('change');
 
 
 
 
3104
 
3105
+ return;
3106
+ }
 
 
3107
 
3108
+ this.current(function (currentData) {
3109
+ var val = [];
 
3110
 
3111
+ for (var d = 0; d < currentData.length; d++) {
3112
+ var id = currentData[d].id;
 
 
 
3113
 
3114
+ if (id !== data.id && $.inArray(id, val) === -1) {
3115
+ val.push(id);
3116
+ }
3117
+ }
3118
 
3119
+ self.$element.val(val);
 
3120
 
3121
+ self.$element.trigger('change');
3122
+ });
3123
+ };
3124
 
3125
+ SelectAdapter.prototype.bind = function (container, $container) {
3126
+ var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
3127
 
3128
+ this.container = container;
 
 
 
 
 
 
3129
 
3130
+ container.on('select', function (params) {
3131
+ self.select(params.data);
3132
+ });
3133
 
3134
+ container.on('unselect', function (params) {
3135
+ self.unselect(params.data);
3136
+ });
3137
+ };
 
 
 
 
3138
 
3139
+ SelectAdapter.prototype.destroy = function () {
3140
+ // Remove anything added to child elements
3141
+ this.$element.find('*').each(function () {
3142
+ // Remove any custom data set by Select2
3143
+ $.removeData(this, 'data');
3144
+ });
3145
+ };
3146
 
3147
+ SelectAdapter.prototype.query = function (params, callback) {
3148
+ var data = [];
3149
+ var self = this;
 
3150
 
3151
+ var $options = this.$element.children();
 
 
 
3152
 
3153
+ $options.each(function () {
3154
+ var $option = $(this);
3155
 
3156
+ if (!$option.is('option') && !$option.is('optgroup')) {
3157
+ return;
3158
+ }
3159
 
3160
+ var option = self.item($option);
 
3161
 
3162
+ var matches = self.matches(params, option);
3163
 
3164
+ if (matches !== null) {
3165
+ data.push(matches);
3166
+ }
3167
+ });
3168
 
3169
+ callback({
3170
+ results: data
3171
+ });
3172
+ };
3173
+
3174
+ SelectAdapter.prototype.addOptions = function ($options) {
3175
+ Utils.appendMany(this.$element, $options);
3176
+ };
3177
+
3178
+ SelectAdapter.prototype.option = function (data) {
3179
+ var option;
3180
+
3181
+ if (data.children) {
3182
+ option = document.createElement('optgroup');
3183
+ option.label = data.text;
3184
+ } else {
3185
+ option = document.createElement('option');
3186
+
3187
+ if (option.textContent !== undefined) {
3188
+ option.textContent = data.text;
3189
+ } else {
3190
+ option.innerText = data.text;
3191
+ }
3192
+ }
3193
 
3194
+ if (data.id) {
3195
+ option.value = data.id;
3196
+ }
3197
 
3198
+ if (data.disabled) {
3199
+ option.disabled = true;
3200
+ }
3201
 
3202
+ if (data.selected) {
3203
+ option.selected = true;
3204
+ }
 
 
 
 
 
 
 
 
3205
 
3206
+ if (data.title) {
3207
+ option.title = data.title;
3208
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
3209
 
3210
+ var $option = $(option);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3211
 
3212
+ var normalizedData = this._normalizeItem(data);
3213
+ normalizedData.element = option;
3214
 
3215
+ // Override the option's data with the combined data
3216
+ $.data(option, 'data', normalizedData);
3217
 
3218
+ return $option;
3219
+ };
 
3220
 
3221
+ SelectAdapter.prototype.item = function ($option) {
3222
+ var data = {};
 
3223
 
3224
+ data = $.data($option[0], 'data');
 
3225
 
3226
+ if (data != null) {
3227
+ return data;
3228
+ }
 
 
 
 
 
 
 
3229
 
3230
+ if ($option.is('option')) {
3231
+ data = {
3232
+ id: $option.val(),
3233
+ text: $option.text(),
3234
+ disabled: $option.prop('disabled'),
3235
+ selected: $option.prop('selected'),
3236
+ title: $option.prop('title')
3237
+ };
3238
+ } else if ($option.is('optgroup')) {
3239
+ data = {
3240
+ text: $option.prop('label'),
3241
+ children: [],
3242
+ title: $option.prop('title')
3243
+ };
3244
+
3245
+ var $children = $option.children('option');
3246
+ var children = [];
3247
+
3248
+ for (var c = 0; c < $children.length; c++) {
3249
+ var $child = $($children[c]);
3250
+
3251
+ var child = this.item($child);
3252
+
3253
+ children.push(child);
3254
+ }
3255
+
3256
+ data.children = children;
3257
+ }
3258
 
3259
+ data = this._normalizeItem(data);
3260
+ data.element = $option[0];
 
 
 
 
 
 
 
3261
 
3262
+ $.data($option[0], 'data', data);
 
 
 
 
 
 
 
 
 
 
 
3263
 
3264
+ return data;
3265
+ };
 
 
 
3266
 
3267
+ SelectAdapter.prototype._normalizeItem = function (item) {
3268
+ if (!$.isPlainObject(item)) {
3269
+ item = {
3270
+ id: item,
3271
+ text: item
3272
+ };
3273
+ }
3274
 
3275
+ item = $.extend({}, {
3276
+ text: ''
3277
+ }, item);
3278
 
3279
+ var defaults = {
3280
+ selected: false,
3281
+ disabled: false
3282
+ };
3283
 
3284
+ if (item.id != null) {
3285
+ item.id = item.id.toString();
3286
+ }
 
 
 
3287
 
3288
+ if (item.text != null) {
3289
+ item.text = item.text.toString();
3290
+ }
 
 
 
 
3291
 
3292
+ if (item._resultId == null && item.id && this.container != null) {
3293
+ item._resultId = this.generateResultId(this.container, item);
3294
+ }
3295
+
3296
+ return $.extend({}, defaults, item);
3297
+ };
3298
+
3299
+ SelectAdapter.prototype.matches = function (params, data) {
3300
+ var matcher = this.options.get('matcher');
3301
+
3302
+ return matcher(params, data);
3303
+ };
3304
+
3305
+ return SelectAdapter;
3306
+ });
3307
+
3308
+ S2.define('select2/data/array',[
3309
+ './select',
3310
+ '../utils',
3311
+ 'jquery'
3312
+ ], function (SelectAdapter, Utils, $) {
3313
+ function ArrayAdapter ($element, options) {
3314
+ var data = options.get('data') || [];
3315
+
3316
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3317
+
3318
+ this.addOptions(this.convertToOptions(data));
3319
+ }
3320
+
3321
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3322
+
3323
+ ArrayAdapter.prototype.select = function (data) {
3324
+ var $option = this.$element.find('option').filter(function (i, elm) {
3325
+ return elm.value == data.id.toString();
3326
  });
3327
 
3328
+ if ($option.length === 0) {
3329
+ $option = this.option(data);
3330
 
3331
+ this.addOptions($option);
3332
+ }
 
 
 
 
 
 
3333
 
3334
+ ArrayAdapter.__super__.select.call(this, data);
3335
+ };
 
 
3336
 
3337
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3338
+ var self = this;
 
 
 
 
3339
 
3340
+ var $existing = this.$element.find('option');
3341
+ var existingIds = $existing.map(function () {
3342
+ return self.item($(this)).id;
3343
+ }).get();
3344
 
3345
+ var $options = [];
 
 
3346
 
3347
+ // Filter out all items except for the one passed in the argument
3348
+ function onlyItem (item) {
3349
+ return function () {
3350
+ return $(this).val() == item.id;
3351
+ };
3352
+ }
3353
 
3354
+ for (var d = 0; d < data.length; d++) {
3355
+ var item = this._normalizeItem(data[d]);
3356
 
3357
+ // Skip items which were pre-loaded, only merge the data
3358
+ if ($.inArray(item.id, existingIds) >= 0) {
3359
+ var $existingOption = $existing.filter(onlyItem(item));
 
 
 
3360
 
3361
+ var existingData = this.item($existingOption);
3362
+ var newData = $.extend(true, {}, item, existingData);
3363
+
3364
+ var $newOption = this.option(newData);
3365
+
3366
+ $existingOption.replaceWith($newOption);
3367
+
3368
+ continue;
3369
+ }
3370
+
3371
+ var $option = this.option(item);
3372
+
3373
+ if (item.children) {
3374
+ var $children = this.convertToOptions(item.children);
3375
+
3376
+ Utils.appendMany($option, $children);
3377
+ }
3378
+
3379
+ $options.push($option);
3380
+ }
3381
+
3382
+ return $options;
3383
+ };
3384
+
3385
+ return ArrayAdapter;
3386
+ });
3387
+
3388
+ S2.define('select2/data/ajax',[
3389
+ './array',
3390
+ '../utils',
3391
+ 'jquery'
3392
+ ], function (ArrayAdapter, Utils, $) {
3393
+ function AjaxAdapter ($element, options) {
3394
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3395
+
3396
+ if (this.ajaxOptions.processResults != null) {
3397
+ this.processResults = this.ajaxOptions.processResults;
3398
+ }
3399
+
3400
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3401
+ }
3402
+
3403
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3404
+
3405
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3406
+ var defaults = {
3407
+ data: function (params) {
3408
+ return $.extend({}, params, {
3409
+ q: params.term
3410
  });
3411
+ },
3412
+ transport: function (params, success, failure) {
3413
+ var $request = $.ajax(params);
3414
+
3415
+ $request.then(success);
3416
+ $request.fail(failure);
3417
+
3418
+ return $request;
3419
+ }
3420
  };
3421
 
3422
+ return $.extend({}, defaults, options, true);
3423
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3424
 
3425
+ AjaxAdapter.prototype.processResults = function (results) {
3426
+ return results;
3427
+ };
 
3428
 
3429
+ AjaxAdapter.prototype.query = function (params, callback) {
3430
+ var matches = [];
3431
+ var self = this;
3432
 
3433
+ if (this._request != null) {
3434
+ // JSONP requests cannot always be aborted
3435
+ if ($.isFunction(this._request.abort)) {
3436
+ this._request.abort();
3437
+ }
3438
+
3439
+ this._request = null;
3440
+ }
 
 
 
 
3441
 
3442
+ var options = $.extend({
3443
+ type: 'GET'
3444
+ }, this.ajaxOptions);
3445
 
3446
+ if (typeof options.url === 'function') {
3447
+ options.url = options.url.call(this.$element, params);
3448
+ }
3449
+
3450
+ if (typeof options.data === 'function') {
3451
+ options.data = options.data.call(this.$element, params);
3452
+ }
3453
+
3454
+ function request () {
3455
+ var $request = options.transport(options, function (data) {
3456
+ var results = self.processResults(data, params);
3457
+
3458
+ if (self.options.get('debug') && window.console && console.error) {
3459
+ // Check to make sure that the response included a `results` key.
3460
+ if (!results || !results.results || !$.isArray(results.results)) {
3461
+ console.error(
3462
+ 'Select2: The AJAX results did not return an array in the ' +
3463
+ '`results` key of the response.'
3464
+ );
3465
+ }
3466
  }
 
3467
 
3468
+ callback(results);
3469
+ }, function () {
3470
+ // Attempt to detect if a request was aborted
3471
+ // Only works if the transport exposes a status property
3472
+ if ($request.status && $request.status === '0') {
3473
+ return;
 
 
 
 
 
 
 
 
 
3474
  }
3475
+
3476
+ self.trigger('results:message', {
3477
+ message: 'errorLoading'
3478
+ });
3479
+ });
3480
+
3481
+ self._request = $request;
3482
+ }
3483
+
3484
+ if (this.ajaxOptions.delay && params.term != null) {
3485
+ if (this._queryTimeout) {
3486
+ window.clearTimeout(this._queryTimeout);
3487
+ }
3488
+
3489
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3490
+ } else {
3491
+ request();
3492
+ }
3493
+ };
3494
+
3495
+ return AjaxAdapter;
3496
+ });
3497
+
3498
+ S2.define('select2/data/tags',[
3499
+ 'jquery'
3500
+ ], function ($) {
3501
+ function Tags (decorated, $element, options) {
3502
+ var tags = options.get('tags');
3503
+
3504
+ var createTag = options.get('createTag');
3505
+
3506
+ if (createTag !== undefined) {
3507
+ this.createTag = createTag;
3508
+ }
3509
+
3510
+ var insertTag = options.get('insertTag');
3511
+
3512
+ if (insertTag !== undefined) {
3513
+ this.insertTag = insertTag;
3514
+ }
3515
+
3516
+ decorated.call(this, $element, options);
3517
+
3518
+ if ($.isArray(tags)) {
3519
+ for (var t = 0; t < tags.length; t++) {
3520
+ var tag = tags[t];
3521
+ var item = this._normalizeItem(tag);
3522
+
3523
+ var $option = this.option(item);
3524
+
3525
+ this.$element.append($option);
3526
+ }
3527
+ }
3528
+ }
3529
+
3530
+ Tags.prototype.query = function (decorated, params, callback) {
3531
+ var self = this;
3532
+
3533
+ this._removeOldTags();
3534
+
3535
+ if (params.term == null || params.page != null) {
3536
+ decorated.call(this, params, callback);
3537
+ return;
3538
+ }
3539
+
3540
+ function wrapper (obj, child) {
3541
+ var data = obj.results;
3542
+
3543
+ for (var i = 0; i < data.length; i++) {
3544
+ var option = data[i];
3545
+
3546
+ var checkChildren = (
3547
+ option.children != null &&
3548
+ !wrapper({
3549
+ results: option.children
3550
+ }, true)
3551
+ );
3552
+
3553
+ var checkText = option.text === params.term;
3554
+
3555
+ if (checkText || checkChildren) {
3556
+ if (child) {
3557
+ return false;
3558
+ }
3559
+
3560
+ obj.data = data;
3561
+ callback(obj);
3562
+
3563
+ return;
3564
+ }
3565
+ }
3566
+
3567
+ if (child) {
3568
+ return true;
3569
+ }
3570
+
3571
+ var tag = self.createTag(params);
3572
+
3573
+ if (tag != null) {
3574
+ var $option = self.option(tag);
3575
+ $option.attr('data-select2-tag', true);
3576
+
3577
+ self.addOptions([$option]);
3578
+
3579
+ self.insertTag(data, tag);
3580
+ }
3581
+
3582
+ obj.results = data;
3583
+
3584
+ callback(obj);
3585
+ }
3586
+
3587
+ decorated.call(this, params, wrapper);
3588
+ };
3589
+
3590
+ Tags.prototype.createTag = function (decorated, params) {
3591
+ var term = $.trim(params.term);
3592
+
3593
+ if (term === '') {
3594
+ return null;
3595
+ }
3596
+
3597
+ return {
3598
+ id: term,
3599
+ text: term
3600
+ };
3601
+ };
3602
+
3603
+ Tags.prototype.insertTag = function (_, data, tag) {
3604
+ data.unshift(tag);
3605
+ };
3606
+
3607
+ Tags.prototype._removeOldTags = function (_) {
3608
+ var tag = this._lastTag;
3609
+
3610
+ var $options = this.$element.find('option[data-select2-tag]');
3611
+
3612
+ $options.each(function () {
3613
+ if (this.selected) {
3614
+ return;
3615
+ }
3616
+
3617
+ $(this).remove();
3618
+ });
3619
+ };
3620
+
3621
+ return Tags;
3622
+ });
3623
+
3624
+ S2.define('select2/data/tokenizer',[
3625
+ 'jquery'
3626
+ ], function ($) {
3627
+ function Tokenizer (decorated, $element, options) {
3628
+ var tokenizer = options.get('tokenizer');
3629
+
3630
+ if (tokenizer !== undefined) {
3631
+ this.tokenizer = tokenizer;
3632
+ }
3633
+
3634
+ decorated.call(this, $element, options);
3635
+ }
3636
+
3637
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3638
+ decorated.call(this, container, $container);
3639
+
3640
+ this.$search = container.dropdown.$search || container.selection.$search ||
3641
+ $container.find('.select2-search__field');
3642
+ };
3643
+
3644
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3645
+ var self = this;
3646
+
3647
+ function createAndSelect (data) {
3648
+ // Normalize the data object so we can use it for checks
3649
+ var item = self._normalizeItem(data);
3650
+
3651
+ // Check if the data object already exists as a tag
3652
+ // Select it if it doesn't
3653
+ var $existingOptions = self.$element.find('option').filter(function () {
3654
+ return $(this).val() === item.id;
3655
+ });
3656
+
3657
+ // If an existing option wasn't found for it, create the option
3658
+ if (!$existingOptions.length) {
3659
+ var $option = self.option(item);
3660
+ $option.attr('data-select2-tag', true);
3661
+
3662
+ self._removeOldTags();
3663
+ self.addOptions([$option]);
3664
+ }
3665
+
3666
+ // Select the item, now that we know there is an option for it
3667
+ select(item);
3668
+ }
3669
+
3670
+ function select (data) {
3671
+ self.trigger('select', {
3672
+ data: data
3673
+ });
3674
+ }
3675
+
3676
+ params.term = params.term || '';
3677
+
3678
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3679
+
3680
+ if (tokenData.term !== params.term) {
3681
+ // Replace the search term if we have the search box
3682
+ if (this.$search.length) {
3683
+ this.$search.val(tokenData.term);
3684
+ this.$search.focus();
3685
+ }
3686
+
3687
+ params.term = tokenData.term;
3688
+ }
3689
+
3690
+ decorated.call(this, params, callback);
3691
+ };
3692
+
3693
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3694
+ var separators = options.get('tokenSeparators') || [];
3695
+ var term = params.term;
3696
+ var i = 0;
3697
+
3698
+ var createTag = this.createTag || function (params) {
3699
+ return {
3700
+ id: params.term,
3701
+ text: params.term
3702
+ };
3703
+ };
3704
+
3705
+ while (i < term.length) {
3706
+ var termChar = term[i];
3707
+
3708
+ if ($.inArray(termChar, separators) === -1) {
3709
+ i++;
3710
+
3711
+ continue;
3712
+ }
3713
+
3714
+ var part = term.substr(0, i);
3715
+ var partParams = $.extend({}, params, {
3716
+ term: part
3717
+ });
3718
+
3719
+ var data = createTag(partParams);
3720
+
3721
+ if (data == null) {
3722
+ i++;
3723
+ continue;
3724
+ }
3725
+
3726
+ callback(data);
3727
+
3728
+ // Reset the term to not include the tokenized portion
3729
+ term = term.substr(i + 1) || '';
3730
+ i = 0;
3731
+ }
3732
+
3733
+ return {
3734
+ term: term
3735
+ };
3736
+ };
3737
+
3738
+ return Tokenizer;
3739
+ });
3740
+
3741
+ S2.define('select2/data/minimumInputLength',[
3742
+
3743
+ ], function () {
3744
+ function MinimumInputLength (decorated, $e, options) {
3745
+ this.minimumInputLength = options.get('minimumInputLength');
3746
+
3747
+ decorated.call(this, $e, options);
3748
+ }
3749
+
3750
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3751
+ params.term = params.term || '';
3752
+
3753
+ if (params.term.length < this.minimumInputLength) {
3754
+ this.trigger('results:message', {
3755
+ message: 'inputTooShort',
3756
+ args: {
3757
+ minimum: this.minimumInputLength,
3758
+ input: params.term,
3759
+ params: params
3760
+ }
3761
+ });
3762
+
3763
+ return;
3764
+ }
3765
+
3766
+ decorated.call(this, params, callback);
3767
+ };
3768
+
3769
+ return MinimumInputLength;
3770
+ });
3771
+
3772
+ S2.define('select2/data/maximumInputLength',[
3773
+
3774
+ ], function () {
3775
+ function MaximumInputLength (decorated, $e, options) {
3776
+ this.maximumInputLength = options.get('maximumInputLength');
3777
+
3778
+ decorated.call(this, $e, options);
3779
+ }
3780
+
3781
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3782
+ params.term = params.term || '';
3783
+
3784
+ if (this.maximumInputLength > 0 &&
3785
+ params.term.length > this.maximumInputLength) {
3786
+ this.trigger('results:message', {
3787
+ message: 'inputTooLong',
3788
+ args: {
3789
+ maximum: this.maximumInputLength,
3790
+ input: params.term,
3791
+ params: params
3792
+ }
3793
+ });
3794
+
3795
+ return;
3796
+ }
3797
+
3798
+ decorated.call(this, params, callback);
3799
+ };
3800
+
3801
+ return MaximumInputLength;
3802
+ });
3803
+
3804
+ S2.define('select2/data/maximumSelectionLength',[
3805
+
3806
+ ], function (){
3807
+ function MaximumSelectionLength (decorated, $e, options) {
3808
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3809
+
3810
+ decorated.call(this, $e, options);
3811
+ }
3812
+
3813
+ MaximumSelectionLength.prototype.query =
3814
+ function (decorated, params, callback) {
3815
+ var self = this;
3816
+
3817
+ this.current(function (currentData) {
3818
+ var count = currentData != null ? currentData.length : 0;
3819
+ if (self.maximumSelectionLength > 0 &&
3820
+ count >= self.maximumSelectionLength) {
3821
+ self.trigger('results:message', {
3822
+ message: 'maximumSelected',
3823
+ args: {
3824
+ maximum: self.maximumSelectionLength
3825
+ }
3826
+ });
3827
+ return;
3828
+ }
3829
+ decorated.call(self, params, callback);
3830
+ });
3831
+ };
3832
+
3833
+ return MaximumSelectionLength;
3834
+ });
3835
+
3836
+ S2.define('select2/dropdown',[
3837
+ 'jquery',
3838
+ './utils'
3839
+ ], function ($, Utils) {
3840
+ function Dropdown ($element, options) {
3841
+ this.$element = $element;
3842
+ this.options = options;
3843
+
3844
+ Dropdown.__super__.constructor.call(this);
3845
+ }
3846
+
3847
+ Utils.Extend(Dropdown, Utils.Observable);
3848
+
3849
+ Dropdown.prototype.render = function () {
3850
+ var $dropdown = $(
3851
+ '<span class="select2-dropdown">' +
3852
+ '<span class="select2-results"></span>' +
3853
+ '</span>'
3854
+ );
3855
+
3856
+ $dropdown.attr('dir', this.options.get('dir'));
3857
+
3858
+ this.$dropdown = $dropdown;
3859
+
3860
+ return $dropdown;
3861
+ };
3862
+
3863
+ Dropdown.prototype.bind = function () {
3864
+ // Should be implemented in subclasses
3865
+ };
3866
+
3867
+ Dropdown.prototype.position = function ($dropdown, $container) {
3868
+ // Should be implmented in subclasses
3869
+ };
3870
+
3871
+ Dropdown.prototype.destroy = function () {
3872
+ // Remove the dropdown from the DOM
3873
+ this.$dropdown.remove();
3874
+ };
3875
+
3876
+ return Dropdown;
3877
+ });
3878
+
3879
+ S2.define('select2/dropdown/search',[
3880
+ 'jquery',
3881
+ '../utils'
3882
+ ], function ($, Utils) {
3883
+ function Search () { }
3884
+
3885
+ Search.prototype.render = function (decorated) {
3886
+ var $rendered = decorated.call(this);
3887
+
3888
+ var $search = $(
3889
+ '<span class="select2-search select2-search--dropdown">' +
3890
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
3891
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
3892
+ ' spellcheck="false" role="textbox" />' +
3893
+ '</span>'
3894
+ );
3895
+
3896
+ this.$searchContainer = $search;
3897
+ this.$search = $search.find('input');
3898
+
3899
+ $rendered.prepend($search);
3900
+
3901
+ return $rendered;
3902
+ };
3903
+
3904
+ Search.prototype.bind = function (decorated, container, $container) {
3905
+ var self = this;
3906
+
3907
+ decorated.call(this, container, $container);
3908
+
3909
+ this.$search.on('keydown', function (evt) {
3910
+ self.trigger('keypress', evt);
3911
+
3912
+ self._keyUpPrevented = evt.isDefaultPrevented();
3913
+ });
3914
+
3915
+ // Workaround for browsers which do not support the `input` event
3916
+ // This will prevent double-triggering of events for browsers which support
3917
+ // both the `keyup` and `input` events.
3918
+ this.$search.on('input', function (evt) {
3919
+ // Unbind the duplicated `keyup` event
3920
+ $(this).off('keyup');
3921
+ });
3922
+
3923
+ this.$search.on('keyup input', function (evt) {
3924
+ self.handleSearch(evt);
3925
+ });
3926
+
3927
+ container.on('open', function () {
3928
+ self.$search.attr('tabindex', 0);
3929
+
3930
+ self.$search.focus();
3931
+
3932
+ window.setTimeout(function () {
3933
+ self.$search.focus();
3934
+ }, 0);
3935
+ });
3936
+
3937
+ container.on('close', function () {
3938
+ self.$search.attr('tabindex', -1);
3939
+
3940
+ self.$search.val('');
3941
+ });
3942
+
3943
+ container.on('focus', function () {
3944
+ if (container.isOpen()) {
3945
+ self.$search.focus();
3946
+ }
3947
+ });
3948
+
3949
+ container.on('results:all', function (params) {
3950
+ if (params.query.term == null || params.query.term === '') {
3951
+ var showSearch = self.showSearch(params);
3952
+
3953
+ if (showSearch) {
3954
+ self.$searchContainer.removeClass('select2-search--hide');
3955
+ } else {
3956
+ self.$searchContainer.addClass('select2-search--hide');
3957
+ }
3958
+ }
3959
+ });
3960
+ };
3961
+
3962
+ Search.prototype.handleSearch = function (evt) {
3963
+ if (!this._keyUpPrevented) {
3964
+ var input = this.$search.val();
3965
+
3966
+ this.trigger('query', {
3967
+ term: input
3968
+ });
3969
+ }
3970
+
3971
+ this._keyUpPrevented = false;
3972
+ };
3973
+
3974
+ Search.prototype.showSearch = function (_, params) {
3975
+ return true;
3976
+ };
3977
+
3978
+ return Search;
3979
+ });
3980
+
3981
+ S2.define('select2/dropdown/hidePlaceholder',[
3982
+
3983
+ ], function () {
3984
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
3985
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
3986
+
3987
+ decorated.call(this, $element, options, dataAdapter);
3988
+ }
3989
+
3990
+ HidePlaceholder.prototype.append = function (decorated, data) {
3991
+ data.results = this.removePlaceholder(data.results);
3992
+
3993
+ decorated.call(this, data);
3994
+ };
3995
+
3996
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
3997
+ if (typeof placeholder === 'string') {
3998
+ placeholder = {
3999
+ id: '',
4000
+ text: placeholder
4001
+ };
4002
+ }
4003
+
4004
+ return placeholder;
4005
+ };
4006
+
4007
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4008
+ var modifiedData = data.slice(0);
4009
+
4010
+ for (var d = data.length - 1; d >= 0; d--) {
4011
+ var item = data[d];
4012
+
4013
+ if (this.placeholder.id === item.id) {
4014
+ modifiedData.splice(d, 1);
4015
+ }
4016
+ }
4017
+
4018
+ return modifiedData;
4019
+ };
4020
+
4021
+ return HidePlaceholder;
4022
+ });
4023
+
4024
+ S2.define('select2/dropdown/infiniteScroll',[
4025
+ 'jquery'
4026
+ ], function ($) {
4027
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4028
+ this.lastParams = {};
4029
+
4030
+ decorated.call(this, $element, options, dataAdapter);
4031
+
4032
+ this.$loadingMore = this.createLoadingMore();
4033
+ this.loading = false;
4034
+ }
4035
+
4036
+ InfiniteScroll.prototype.append = function (decorated, data) {
4037
+ this.$loadingMore.remove();
4038
+ this.loading = false;
4039
+
4040
+ decorated.call(this, data);
4041
+
4042
+ if (this.showLoadingMore(data)) {
4043
+ this.$results.append(this.$loadingMore);
4044
+ }
4045
+ };
4046
+
4047
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4048
+ var self = this;
4049
+
4050
+ decorated.call(this, container, $container);
4051
+
4052
+ container.on('query', function (params) {
4053
+ self.lastParams = params;
4054
+ self.loading = true;
4055
+ });
4056
+
4057
+ container.on('query:append', function (params) {
4058
+ self.lastParams = params;
4059
+ self.loading = true;
4060
+ });
4061
+
4062
+ this.$results.on('scroll', function () {
4063
+ var isLoadMoreVisible = $.contains(
4064
+ document.documentElement,
4065
+ self.$loadingMore[0]
4066
+ );
4067
+
4068
+ if (self.loading || !isLoadMoreVisible) {
4069
+ return;
4070
+ }
4071
+
4072
+ var currentOffset = self.$results.offset().top +
4073
+ self.$results.outerHeight(false);
4074
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4075
+ self.$loadingMore.outerHeight(false);
4076
+
4077
+ if (currentOffset + 50 >= loadingMoreOffset) {
4078
+ self.loadMore();
4079
+ }
4080
+ });
4081
+ };
4082
+
4083
+ InfiniteScroll.prototype.loadMore = function () {
4084
+ this.loading = true;
4085
+
4086
+ var params = $.extend({}, {page: 1}, this.lastParams);
4087
+
4088
+ params.page++;
4089
+
4090
+ this.trigger('query:append', params);
4091
+ };
4092
+
4093
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4094
+ return data.pagination && data.pagination.more;
4095
+ };
4096
+
4097
+ InfiniteScroll.prototype.createLoadingMore = function () {
4098
+ var $option = $(
4099
+ '<li ' +
4100
+ 'class="select2-results__option select2-results__option--load-more"' +
4101
+ 'role="treeitem" aria-disabled="true"></li>'
4102
+ );
4103
+
4104
+ var message = this.options.get('translations').get('loadingMore');
4105
+
4106
+ $option.html(message(this.lastParams));
4107
+
4108
+ return $option;
4109
+ };
4110
+
4111
+ return InfiniteScroll;
4112
+ });
4113
+
4114
+ S2.define('select2/dropdown/attachBody',[
4115
+ 'jquery',
4116
+ '../utils'
4117
+ ], function ($, Utils) {
4118
+ function AttachBody (decorated, $element, options) {
4119
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4120
+
4121
+ decorated.call(this, $element, options);
4122
+ }
4123
+
4124
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4125
+ var self = this;
4126
+
4127
+ var setupResultsEvents = false;
4128
+
4129
+ decorated.call(this, container, $container);
4130
+
4131
+ container.on('open', function () {
4132
+ self._showDropdown();
4133
+ self._attachPositioningHandler(container);
4134
+
4135
+ if (!setupResultsEvents) {
4136
+ setupResultsEvents = true;
4137
+
4138
+ container.on('results:all', function () {
4139
+ self._positionDropdown();
4140
+ self._resizeDropdown();
4141
+ });
4142
+
4143
+ container.on('results:append', function () {
4144
+ self._positionDropdown();
4145
+ self._resizeDropdown();
4146
+ });
4147
+ }
4148
+ });
4149
+
4150
+ container.on('close', function () {
4151
+ self._hideDropdown();
4152
+ self._detachPositioningHandler(container);
4153
+ });
4154
+
4155
+ this.$dropdownContainer.on('mousedown', function (evt) {
4156
+ evt.stopPropagation();
4157
+ });
4158
+ };
4159
+
4160
+ AttachBody.prototype.destroy = function (decorated) {
4161
+ decorated.call(this);
4162
+
4163
+ this.$dropdownContainer.remove();
4164
+ };
4165
+
4166
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4167
+ // Clone all of the container classes
4168
+ $dropdown.attr('class', $container.attr('class'));
4169
+
4170
+ $dropdown.removeClass('select2');
4171
+ $dropdown.addClass('select2-container--open');
4172
+
4173
+ $dropdown.css({
4174
+ position: 'absolute',
4175
+ top: -999999
4176
+ });
4177
+
4178
+ this.$container = $container;
4179
+ };
4180
+
4181
+ AttachBody.prototype.render = function (decorated) {
4182
+ var $container = $('<span></span>');
4183
+
4184
+ var $dropdown = decorated.call(this);
4185
+ $container.append($dropdown);
4186
+
4187
+ this.$dropdownContainer = $container;
4188
+
4189
+ return $container;
4190
+ };
4191
+
4192
+ AttachBody.prototype._hideDropdown = function (decorated) {
4193
+ this.$dropdownContainer.detach();
4194
+ };
4195
+
4196
+ AttachBody.prototype._attachPositioningHandler =
4197
+ function (decorated, container) {
4198
+ var self = this;
4199
+
4200
+ var scrollEvent = 'scroll.select2.' + container.id;
4201
+ var resizeEvent = 'resize.select2.' + container.id;
4202
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4203
+
4204
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4205
+ $watchers.each(function () {
4206
+ $(this).data('select2-scroll-position', {
4207
+ x: $(this).scrollLeft(),
4208
+ y: $(this).scrollTop()
4209
+ });
4210
+ });
4211
+
4212
+ $watchers.on(scrollEvent, function (ev) {
4213
+ var position = $(this).data('select2-scroll-position');
4214
+ $(this).scrollTop(position.y);
4215
+ });
4216
+
4217
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4218
+ function (e) {
4219
+ self._positionDropdown();
4220
+ self._resizeDropdown();
4221
+ });
4222
+ };
4223
+
4224
+ AttachBody.prototype._detachPositioningHandler =
4225
+ function (decorated, container) {
4226
+ var scrollEvent = 'scroll.select2.' + container.id;
4227
+ var resizeEvent = 'resize.select2.' + container.id;
4228
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4229
+
4230
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4231
+ $watchers.off(scrollEvent);
4232
+
4233
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4234
+ };
4235
+
4236
+ AttachBody.prototype._positionDropdown = function () {
4237
+ var $window = $(window);
4238
+
4239
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4240
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4241
+
4242
+ var newDirection = null;
4243
+
4244
+ var offset = this.$container.offset();
4245
+
4246
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4247
+
4248
+ var container = {
4249
+ height: this.$container.outerHeight(false)
4250
+ };
4251
+
4252
+ container.top = offset.top;
4253
+ container.bottom = offset.top + container.height;
4254
+
4255
+ var dropdown = {
4256
+ height: this.$dropdown.outerHeight(false)
4257
+ };
4258
+
4259
+ var viewport = {
4260
+ top: $window.scrollTop(),
4261
+ bottom: $window.scrollTop() + $window.height()
4262
+ };
4263
+
4264
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4265
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4266
+
4267
+ var css = {
4268
+ left: offset.left,
4269
+ top: container.bottom
4270
+ };
4271
+
4272
+ // Determine what the parent element is to use for calciulating the offset
4273
+ var $offsetParent = this.$dropdownParent;
4274
+
4275
+ // For statically positoned elements, we need to get the element
4276
+ // that is determining the offset
4277
+ if ($offsetParent.css('position') === 'static') {
4278
+ $offsetParent = $offsetParent.offsetParent();
4279
+ }
4280
+
4281
+ var parentOffset = $offsetParent.offset();
4282
+
4283
+ css.top -= parentOffset.top;
4284
+ css.left -= parentOffset.left;
4285
+
4286
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4287
+ newDirection = 'below';
4288
+ }
4289
+
4290
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4291
+ newDirection = 'above';
4292
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4293
+ newDirection = 'below';
4294
+ }
4295
+
4296
+ if (newDirection == 'above' ||
4297
+ (isCurrentlyAbove && newDirection !== 'below')) {
4298
+ css.top = container.top - parentOffset.top - dropdown.height;
4299
+ }
4300
+
4301
+ if (newDirection != null) {
4302
+ this.$dropdown
4303
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4304
+ .addClass('select2-dropdown--' + newDirection);
4305
+ this.$container
4306
+ .removeClass('select2-container--below select2-container--above')
4307
+ .addClass('select2-container--' + newDirection);
4308
+ }
4309
+
4310
+ this.$dropdownContainer.css(css);
4311
+ };
4312
+
4313
+ AttachBody.prototype._resizeDropdown = function () {
4314
+ var css = {
4315
+ width: this.$container.outerWidth(false) + 'px'
4316
+ };
4317
+
4318
+ if (this.options.get('dropdownAutoWidth')) {
4319
+ css.minWidth = css.width;
4320
+ css.position = 'relative';
4321
+ css.width = 'auto';
4322
+ }
4323
+
4324
+ this.$dropdown.css(css);
4325
+ };
4326
+
4327
+ AttachBody.prototype._showDropdown = function (decorated) {
4328
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4329
+
4330
+ this._positionDropdown();
4331
+ this._resizeDropdown();
4332
+ };
4333
+
4334
+ return AttachBody;
4335
+ });
4336
+
4337
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4338
+
4339
+ ], function () {
4340
+ function countResults (data) {
4341
+ var count = 0;
4342
+
4343
+ for (var d = 0; d < data.length; d++) {
4344
+ var item = data[d];
4345
+
4346
+ if (item.children) {
4347
+ count += countResults(item.children);
4348
+ } else {
4349
+ count++;
4350
+ }
4351
+ }
4352
+
4353
+ return count;
4354
+ }
4355
+
4356
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4357
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4358
+
4359
+ if (this.minimumResultsForSearch < 0) {
4360
+ this.minimumResultsForSearch = Infinity;
4361
+ }
4362
+
4363
+ decorated.call(this, $element, options, dataAdapter);
4364
+ }
4365
+
4366
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4367
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4368
+ return false;
4369
+ }
4370
+
4371
+ return decorated.call(this, params);
4372
+ };
4373
+
4374
+ return MinimumResultsForSearch;
4375
+ });
4376
+
4377
+ S2.define('select2/dropdown/selectOnClose',[
4378
+
4379
+ ], function () {
4380
+ function SelectOnClose () { }
4381
+
4382
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4383
+ var self = this;
4384
+
4385
+ decorated.call(this, container, $container);
4386
+
4387
+ container.on('close', function (params) {
4388
+ self._handleSelectOnClose(params);
4389
+ });
4390
+ };
4391
+
4392
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4393
+ if (params && params.originalSelect2Event != null) {
4394
+ var event = params.originalSelect2Event;
4395
+
4396
+ // Don't select an item if the close event was triggered from a select or
4397
+ // unselect event
4398
+ if (event._type === 'select' || event._type === 'unselect') {
4399
+ return;
4400
+ }
4401
+ }
4402
+
4403
+ var $highlightedResults = this.getHighlightedResults();
4404
+
4405
+ // Only select highlighted results
4406
+ if ($highlightedResults.length < 1) {
4407
+ return;
4408
+ }
4409
+
4410
+ var data = $highlightedResults.data('data');
4411
+
4412
+ // Don't re-select already selected resulte
4413
+ if (
4414
+ (data.element != null && data.element.selected) ||
4415
+ (data.element == null && data.selected)
4416
+ ) {
4417
+ return;
4418
+ }
4419
+
4420
+ this.trigger('select', {
4421
+ data: data
4422
+ });
4423
+ };
4424
+
4425
+ return SelectOnClose;
4426
+ });
4427
+
4428
+ S2.define('select2/dropdown/closeOnSelect',[
4429
+
4430
+ ], function () {
4431
+ function CloseOnSelect () { }
4432
+
4433
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4434
+ var self = this;
4435
+
4436
+ decorated.call(this, container, $container);
4437
+
4438
+ container.on('select', function (evt) {
4439
+ self._selectTriggered(evt);
4440
+ });
4441
+
4442
+ container.on('unselect', function (evt) {
4443
+ self._selectTriggered(evt);
4444
+ });
4445
+ };
4446
+
4447
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4448
+ var originalEvent = evt.originalEvent;
4449
+
4450
+ // Don't close if the control key is being held
4451
+ if (originalEvent && originalEvent.ctrlKey) {
4452
+ return;
4453
+ }
4454
+
4455
+ this.trigger('close', {
4456
+ originalEvent: originalEvent,
4457
+ originalSelect2Event: evt
4458
+ });
4459
+ };
4460
+
4461
+ return CloseOnSelect;
4462
+ });
4463
+
4464
+ S2.define('select2/i18n/en',[],function () {
4465
+ // English
4466
+ return {
4467
+ errorLoading: function () {
4468
+ return 'The results could not be loaded.';
4469
+ },
4470
+ inputTooLong: function (args) {
4471
+ var overChars = args.input.length - args.maximum;
4472
+
4473
+ var message = 'Please delete ' + overChars + ' character';
4474
+
4475
+ if (overChars != 1) {
4476
+ message += 's';
4477
+ }
4478
+
4479
+ return message;
4480
+ },
4481
+ inputTooShort: function (args) {
4482
+ var remainingChars = args.minimum - args.input.length;
4483
+
4484
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4485
+
4486
+ return message;
4487
+ },
4488
+ loadingMore: function () {
4489
+ return 'Loading more results…';
4490
+ },
4491
+ maximumSelected: function (args) {
4492
+ var message = 'You can only select ' + args.maximum + ' item';
4493
+
4494
+ if (args.maximum != 1) {
4495
+ message += 's';
4496
+ }
4497
+
4498
+ return message;
4499
+ },
4500
+ noResults: function () {
4501
+ return 'No results found';
4502
+ },
4503
+ searching: function () {
4504
+ return 'Searching…';
4505
+ }
4506
+ };
4507
+ });
4508
+
4509
+ S2.define('select2/defaults',[
4510
+ 'jquery',
4511
+ 'require',
4512
+
4513
+ './results',
4514
+
4515
+ './selection/single',
4516
+ './selection/multiple',
4517
+ './selection/placeholder',
4518
+ './selection/allowClear',
4519
+ './selection/search',
4520
+ './selection/eventRelay',
4521
+
4522
+ './utils',
4523
+ './translation',
4524
+ './diacritics',
4525
+
4526
+ './data/select',
4527
+ './data/array',
4528
+ './data/ajax',
4529
+ './data/tags',
4530
+ './data/tokenizer',
4531
+ './data/minimumInputLength',
4532
+ './data/maximumInputLength',
4533
+ './data/maximumSelectionLength',
4534
+
4535
+ './dropdown',
4536
+ './dropdown/search',
4537
+ './dropdown/hidePlaceholder',
4538
+ './dropdown/infiniteScroll',
4539
+ './dropdown/attachBody',
4540
+ './dropdown/minimumResultsForSearch',
4541
+ './dropdown/selectOnClose',
4542
+ './dropdown/closeOnSelect',
4543
+
4544
+ './i18n/en'
4545
+ ], function ($, require,
4546
+
4547
+ ResultsList,
4548
+
4549
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4550
+ SelectionSearch, EventRelay,
4551
+
4552
+ Utils, Translation, DIACRITICS,
4553
+
4554
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4555
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4556
+
4557
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4558
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4559
+
4560
+ EnglishTranslation) {
4561
+ function Defaults () {
4562
+ this.reset();
4563
+ }
4564
+
4565
+ Defaults.prototype.apply = function (options) {
4566
+ options = $.extend(true, {}, this.defaults, options);
4567
+
4568
+ if (options.dataAdapter == null) {
4569
+ if (options.ajax != null) {
4570
+ options.dataAdapter = AjaxData;
4571
+ } else if (options.data != null) {
4572
+ options.dataAdapter = ArrayData;
4573
+ } else {
4574
+ options.dataAdapter = SelectData;
4575
+ }
4576
+
4577
+ if (options.minimumInputLength > 0) {
4578
+ options.dataAdapter = Utils.Decorate(
4579
+ options.dataAdapter,
4580
+ MinimumInputLength
4581
+ );
4582
+ }
4583
+
4584
+ if (options.maximumInputLength > 0) {
4585
+ options.dataAdapter = Utils.Decorate(
4586
+ options.dataAdapter,
4587
+ MaximumInputLength
4588
+ );
4589
+ }
4590
+
4591
+ if (options.maximumSelectionLength > 0) {
4592
+ options.dataAdapter = Utils.Decorate(
4593
+ options.dataAdapter,
4594
+ MaximumSelectionLength
4595
+ );
4596
+ }
4597
+
4598
+ if (options.tags) {
4599
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4600
+ }
4601
+
4602
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4603
+ options.dataAdapter = Utils.Decorate(
4604
+ options.dataAdapter,
4605
+ Tokenizer
4606
+ );
4607
+ }
4608
+
4609
+ if (options.query != null) {
4610
+ var Query = require(options.amdBase + 'compat/query');
4611
+
4612
+ options.dataAdapter = Utils.Decorate(
4613
+ options.dataAdapter,
4614
+ Query
4615
+ );
4616
+ }
4617
+
4618
+ if (options.initSelection != null) {
4619
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
4620
+
4621
+ options.dataAdapter = Utils.Decorate(
4622
+ options.dataAdapter,
4623
+ InitSelection
4624
+ );
4625
+ }
4626
+ }
4627
+
4628
+ if (options.resultsAdapter == null) {
4629
+ options.resultsAdapter = ResultsList;
4630
+
4631
+ if (options.ajax != null) {
4632
+ options.resultsAdapter = Utils.Decorate(
4633
+ options.resultsAdapter,
4634
+ InfiniteScroll
4635
+ );
4636
+ }
4637
+
4638
+ if (options.placeholder != null) {
4639
+ options.resultsAdapter = Utils.Decorate(
4640
+ options.resultsAdapter,
4641
+ HidePlaceholder
4642
+ );
4643
+ }
4644
+
4645
+ if (options.selectOnClose) {
4646
+ options.resultsAdapter = Utils.Decorate(
4647
+ options.resultsAdapter,
4648
+ SelectOnClose
4649
+ );
4650
+ }
4651
+ }
4652
+
4653
+ if (options.dropdownAdapter == null) {
4654
+ if (options.multiple) {
4655
+ options.dropdownAdapter = Dropdown;
4656
+ } else {
4657
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4658
+
4659
+ options.dropdownAdapter = SearchableDropdown;
4660
+ }
4661
+
4662
+ if (options.minimumResultsForSearch !== 0) {
4663
+ options.dropdownAdapter = Utils.Decorate(
4664
+ options.dropdownAdapter,
4665
+ MinimumResultsForSearch
4666
+ );
4667
+ }
4668
+
4669
+ if (options.closeOnSelect) {
4670
+ options.dropdownAdapter = Utils.Decorate(
4671
+ options.dropdownAdapter,
4672
+ CloseOnSelect
4673
+ );
4674
+ }
4675
+
4676
+ if (
4677
+ options.dropdownCssClass != null ||
4678
+ options.dropdownCss != null ||
4679
+ options.adaptDropdownCssClass != null
4680
+ ) {
4681
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4682
+
4683
+ options.dropdownAdapter = Utils.Decorate(
4684
+ options.dropdownAdapter,
4685
+ DropdownCSS
4686
+ );
4687
+ }
4688
+
4689
+ options.dropdownAdapter = Utils.Decorate(
4690
+ options.dropdownAdapter,
4691
+ AttachBody
4692
+ );
4693
+ }
4694
+
4695
+ if (options.selectionAdapter == null) {
4696
+ if (options.multiple) {
4697
+ options.selectionAdapter = MultipleSelection;
4698
+ } else {
4699
+ options.selectionAdapter = SingleSelection;
4700
+ }
4701
+
4702
+ // Add the placeholder mixin if a placeholder was specified
4703
+ if (options.placeholder != null) {
4704
+ options.selectionAdapter = Utils.Decorate(
4705
+ options.selectionAdapter,
4706
+ Placeholder
4707
+ );
4708
+ }
4709
+
4710
+ if (options.allowClear) {
4711
+ options.selectionAdapter = Utils.Decorate(
4712
+ options.selectionAdapter,
4713
+ AllowClear
4714
+ );
4715
+ }
4716
+
4717
+ if (options.multiple) {
4718
+ options.selectionAdapter = Utils.Decorate(
4719
+ options.selectionAdapter,
4720
+ SelectionSearch
4721
+ );
4722
+ }
4723
+
4724
+ if (
4725
+ options.containerCssClass != null ||
4726
+ options.containerCss != null ||
4727
+ options.adaptContainerCssClass != null
4728
+ ) {
4729
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4730
+
4731
+ options.selectionAdapter = Utils.Decorate(
4732
+ options.selectionAdapter,
4733
+ ContainerCSS
4734
+ );
4735
+ }
4736
+
4737
+ options.selectionAdapter = Utils.Decorate(
4738
+ options.selectionAdapter,
4739
+ EventRelay
4740
+ );
4741
+ }
4742
+
4743
+ if (typeof options.language === 'string') {
4744
+ // Check if the language is specified with a region
4745
+ if (options.language.indexOf('-') > 0) {
4746
+ // Extract the region information if it is included
4747
+ var languageParts = options.language.split('-');
4748
+ var baseLanguage = languageParts[0];
4749
+
4750
+ options.language = [options.language, baseLanguage];
4751
+ } else {
4752
+ options.language = [options.language];
4753
+ }
4754
+ }
4755
+
4756
+ if ($.isArray(options.language)) {
4757
+ var languages = new Translation();
4758
+ options.language.push('en');
4759
+
4760
+ var languageNames = options.language;
4761
+
4762
+ for (var l = 0; l < languageNames.length; l++) {
4763
+ var name = languageNames[l];
4764
+ var language = {};
4765
+
4766
+ try {
4767
+ // Try to load it with the original name
4768
+ language = Translation.loadPath(name);
4769
+ } catch (e) {
4770
+ try {
4771
+ // If we couldn't load it, check if it wasn't the full path
4772
+ name = this.defaults.amdLanguageBase + name;
4773
+ language = Translation.loadPath(name);
4774
+ } catch (ex) {
4775
+ // The translation could not be loaded at all. Sometimes this is
4776
+ // because of a configuration problem, other times this can be
4777
+ // because of how Select2 helps load all possible translation files.
4778
+ if (options.debug && window.console && console.warn) {
4779
+ console.warn(
4780
+ 'Select2: The language file for "' + name + '" could not be ' +
4781
+ 'automatically loaded. A fallback will be used instead.'
4782
+ );
4783
+ }
4784
+
4785
+ continue;
4786
+ }
4787
+ }
4788
+
4789
+ languages.extend(language);
4790
+ }
4791
+
4792
+ options.translations = languages;
4793
+ } else {
4794
+ var baseTranslation = Translation.loadPath(
4795
+ this.defaults.amdLanguageBase + 'en'
4796
+ );
4797
+ var customTranslation = new Translation(options.language);
4798
+
4799
+ customTranslation.extend(baseTranslation);
4800
+
4801
+ options.translations = customTranslation;
4802
+ }
4803
+
4804
+ return options;
4805
+ };
4806
+
4807
+ Defaults.prototype.reset = function () {
4808
+ function stripDiacritics (text) {
4809
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4810
+ function match(a) {
4811
+ return DIACRITICS[a] || a;
4812
+ }
4813
+
4814
+ return text.replace(/[^\u0000-\u007E]/g, match);
4815
+ }
4816
+
4817
+ function matcher (params, data) {
4818
+ // Always return the object if there is nothing to compare
4819
+ if ($.trim(params.term) === '') {
4820
+ return data;
4821
+ }
4822
+
4823
+ // Do a recursive check for options with children
4824
+ if (data.children && data.children.length > 0) {
4825
+ // Clone the data object if there are children
4826
+ // This is required as we modify the object to remove any non-matches
4827
+ var match = $.extend(true, {}, data);
4828
+
4829
+ // Check each child of the option
4830
+ for (var c = data.children.length - 1; c >= 0; c--) {
4831
+ var child = data.children[c];
4832
+
4833
+ var matches = matcher(params, child);
4834
+
4835
+ // If there wasn't a match, remove the object in the array
4836
+ if (matches == null) {
4837
+ match.children.splice(c, 1);
4838
+ }
4839
+ }
4840
+
4841
+ // If any children matched, return the new object
4842
+ if (match.children.length > 0) {
4843
+ return match;
4844
+ }
4845
+
4846
+ // If there were no matching children, check just the plain object
4847
+ return matcher(params, match);
4848
+ }
4849
+
4850
+ var original = stripDiacritics(data.text).toUpperCase();
4851
+ var term = stripDiacritics(params.term).toUpperCase();
4852
+
4853
+ // Check if the text contains the term
4854
+ if (original.indexOf(term) > -1) {
4855
+ return data;
4856
+ }
4857
+
4858
+ // If it doesn't contain the term, don't return anything
4859
+ return null;
4860
+ }
4861
+
4862
+ this.defaults = {
4863
+ amdBase: './',
4864
+ amdLanguageBase: './i18n/',
4865
+ closeOnSelect: true,
4866
+ debug: false,
4867
+ dropdownAutoWidth: false,
4868
+ escapeMarkup: Utils.escapeMarkup,
4869
+ language: EnglishTranslation,
4870
+ matcher: matcher,
4871
+ minimumInputLength: 0,
4872
+ maximumInputLength: 0,
4873
+ maximumSelectionLength: 0,
4874
+ minimumResultsForSearch: 0,
4875
+ selectOnClose: false,
4876
+ sorter: function (data) {
4877
+ return data;
4878
+ },
4879
+ templateResult: function (result) {
4880
+ return result.text;
4881
+ },
4882
+ templateSelection: function (selection) {
4883
+ return selection.text;
4884
+ },
4885
+ theme: 'default',
4886
+ width: 'resolve'
4887
+ };
4888
+ };
4889
+
4890
+ Defaults.prototype.set = function (key, value) {
4891
+ var camelKey = $.camelCase(key);
4892
+
4893
+ var data = {};
4894
+ data[camelKey] = value;
4895
+
4896
+ var convertedData = Utils._convertData(data);
4897
+
4898
+ $.extend(this.defaults, convertedData);
4899
+ };
4900
+
4901
+ var defaults = new Defaults();
4902
+
4903
+ return defaults;
4904
+ });
4905
+
4906
+ S2.define('select2/options',[
4907
+ 'require',
4908
+ 'jquery',
4909
+ './defaults',
4910
+ './utils'
4911
+ ], function (require, $, Defaults, Utils) {
4912
+ function Options (options, $element) {
4913
+ this.options = options;
4914
+
4915
+ if ($element != null) {
4916
+ this.fromElement($element);
4917
+ }
4918
+
4919
+ this.options = Defaults.apply(this.options);
4920
+
4921
+ if ($element && $element.is('input')) {
4922
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4923
+
4924
+ this.options.dataAdapter = Utils.Decorate(
4925
+ this.options.dataAdapter,
4926
+ InputCompat
4927
+ );
4928
+ }
4929
+ }
4930
+
4931
+ Options.prototype.fromElement = function ($e) {
4932
+ var excludedData = ['select2'];
4933
+
4934
+ if (this.options.multiple == null) {
4935
+ this.options.multiple = $e.prop('multiple');
4936
+ }
4937
+
4938
+ if (this.options.disabled == null) {
4939
+ this.options.disabled = $e.prop('disabled');
4940
+ }
4941
+
4942
+ if (this.options.language == null) {
4943
+ if ($e.prop('lang')) {
4944
+ this.options.language = $e.prop('lang').toLowerCase();
4945
+ } else if ($e.closest('[lang]').prop('lang')) {
4946
+ this.options.language = $e.closest('[lang]').prop('lang');
4947
+ }
4948
+ }
4949
+
4950
+ if (this.options.dir == null) {
4951
+ if ($e.prop('dir')) {
4952
+ this.options.dir = $e.prop('dir');
4953
+ } else if ($e.closest('[dir]').prop('dir')) {
4954
+ this.options.dir = $e.closest('[dir]').prop('dir');
4955
+ } else {
4956
+ this.options.dir = 'ltr';
4957
+ }
4958
+ }
4959
+
4960
+ $e.prop('disabled', this.options.disabled);
4961
+ $e.prop('multiple', this.options.multiple);
4962
+
4963
+ if ($e.data('select2Tags')) {
4964
+ if (this.options.debug && window.console && console.warn) {
4965
+ console.warn(
4966
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
4967
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4968
+ 'removed in future versions of Select2.'
4969
+ );
4970
+ }
4971
+
4972
+ $e.data('data', $e.data('select2Tags'));
4973
+ $e.data('tags', true);
4974
+ }
4975
+
4976
+ if ($e.data('ajaxUrl')) {
4977
+ if (this.options.debug && window.console && console.warn) {
4978
+ console.warn(
4979
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
4980
+ '`data-ajax--url` and support for the old attribute will be removed' +
4981
+ ' in future versions of Select2.'
4982
+ );
4983
+ }
4984
+
4985
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
4986
+ $e.data('ajax--url', $e.data('ajaxUrl'));
4987
+ }
4988
+
4989
+ var dataset = {};
4990
+
4991
+ // Prefer the element's `dataset` attribute if it exists
4992
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
4993
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
4994
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
4995
+ } else {
4996
+ dataset = $e.data();
4997
+ }
4998
+
4999
+ var data = $.extend(true, {}, dataset);
5000
+
5001
+ data = Utils._convertData(data);
5002
+
5003
+ for (var key in data) {
5004
+ if ($.inArray(key, excludedData) > -1) {
5005
+ continue;
5006
+ }
5007
+
5008
+ if ($.isPlainObject(this.options[key])) {
5009
+ $.extend(this.options[key], data[key]);
5010
+ } else {
5011
+ this.options[key] = data[key];
5012
+ }
5013
+ }
5014
+
5015
+ return this;
5016
+ };
5017
+
5018
+ Options.prototype.get = function (key) {
5019
+ return this.options[key];
5020
+ };
5021
+
5022
+ Options.prototype.set = function (key, val) {
5023
+ this.options[key] = val;
5024
+ };
5025
+
5026
+ return Options;
5027
+ });
5028
+
5029
+ S2.define('select2/core',[
5030
+ 'jquery',
5031
+ './options',
5032
+ './utils',
5033
+ './keys'
5034
+ ], function ($, Options, Utils, KEYS) {
5035
+ var Select2 = function ($element, options) {
5036
+ if ($element.data('select2') != null) {
5037
+ $element.data('select2').destroy();
5038
+ }
5039
+
5040
+ this.$element = $element;
5041
+
5042
+ this.id = this._generateId($element);
5043
+
5044
+ options = options || {};
5045
+
5046
+ this.options = new Options(options, $element);
5047
+
5048
+ Select2.__super__.constructor.call(this);
5049
+
5050
+ // Set up the tabindex
5051
+
5052
+ var tabindex = $element.attr('tabindex') || 0;
5053
+ $element.data('old-tabindex', tabindex);
5054
+ $element.attr('tabindex', '-1');
5055
+
5056
+ // Set up containers and adapters
5057
+
5058
+ var DataAdapter = this.options.get('dataAdapter');
5059
+ this.dataAdapter = new DataAdapter($element, this.options);
5060
+
5061
+ var $container = this.render();
5062
+
5063
+ this._placeContainer($container);
5064
+
5065
+ var SelectionAdapter = this.options.get('selectionAdapter');
5066
+ this.selection = new SelectionAdapter($element, this.options);
5067
+ this.$selection = this.selection.render();
5068
+
5069
+ this.selection.position(this.$selection, $container);
5070
+
5071
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5072
+ this.dropdown = new DropdownAdapter($element, this.options);
5073
+ this.$dropdown = this.dropdown.render();
5074
+
5075
+ this.dropdown.position(this.$dropdown, $container);
5076
+
5077
+ var ResultsAdapter = this.options.get('resultsAdapter');
5078
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5079
+ this.$results = this.results.render();
5080
+
5081
+ this.results.position(this.$results, this.$dropdown);
5082
+
5083
+ // Bind events
5084
+
5085
+ var self = this;
5086
+
5087
+ // Bind the container to all of the adapters
5088
+ this._bindAdapters();
5089
+
5090
+ // Register any DOM event handlers
5091
+ this._registerDomEvents();
5092
+
5093
+ // Register any internal event handlers
5094
+ this._registerDataEvents();
5095
+ this._registerSelectionEvents();
5096
+ this._registerDropdownEvents();
5097
+ this._registerResultsEvents();
5098
+ this._registerEvents();
5099
+
5100
+ // Set the initial state
5101
+ this.dataAdapter.current(function (initialData) {
5102
+ self.trigger('selection:update', {
5103
+ data: initialData
5104
+ });
5105
+ });
5106
+
5107
+ // Hide the original select
5108
+ $element.addClass('select2-hidden-accessible');
5109
+ $element.attr('aria-hidden', 'true');
5110
+
5111
+ // Synchronize any monitored attributes
5112
+ this._syncAttributes();
5113
+
5114
+ $element.data('select2', this);
5115
+ };
5116
+
5117
+ Utils.Extend(Select2, Utils.Observable);
5118
+
5119
+ Select2.prototype._generateId = function ($element) {
5120
+ var id = '';
5121
+
5122
+ if ($element.attr('id') != null) {
5123
+ id = $element.attr('id');
5124
+ } else if ($element.attr('name') != null) {
5125
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5126
+ } else {
5127
+ id = Utils.generateChars(4);
5128
+ }
5129
+
5130
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5131
+ id = 'select2-' + id;
5132
+
5133
+ return id;
5134
+ };
5135
+
5136
+ Select2.prototype._placeContainer = function ($container) {
5137
+ $container.insertAfter(this.$element);
5138
+
5139
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5140
+
5141
+ if (width != null) {
5142
+ $container.css('width', width);
5143
+ }
5144
+ };
5145
+
5146
+ Select2.prototype._resolveWidth = function ($element, method) {
5147
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5148
+
5149
+ if (method == 'resolve') {
5150
+ var styleWidth = this._resolveWidth($element, 'style');
5151
+
5152
+ if (styleWidth != null) {
5153
+ return styleWidth;
5154
+ }
5155
+
5156
+ return this._resolveWidth($element, 'element');
5157
+ }
5158
+
5159
+ if (method == 'element') {
5160
+ var elementWidth = $element.outerWidth(false);
5161
+
5162
+ if (elementWidth <= 0) {
5163
+ return 'auto';
5164
+ }
5165
+
5166
+ return elementWidth + 'px';
5167
+ }
5168
+
5169
+ if (method == 'style') {
5170
+ var style = $element.attr('style');
5171
+
5172
+ if (typeof(style) !== 'string') {
5173
+ return null;
5174
+ }
5175
+
5176
+ var attrs = style.split(';');
5177
+
5178
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5179
+ var attr = attrs[i].replace(/\s/g, '');
5180
+ var matches = attr.match(WIDTH);
5181
+
5182
+ if (matches !== null && matches.length >= 1) {
5183
+ return matches[1];
5184
+ }
5185
+ }
5186
+
5187
+ return null;
5188
+ }
5189
+
5190
+ return method;
5191
+ };
5192
+
5193
+ Select2.prototype._bindAdapters = function () {
5194
+ this.dataAdapter.bind(this, this.$container);
5195
+ this.selection.bind(this, this.$container);
5196
+
5197
+ this.dropdown.bind(this, this.$container);
5198
+ this.results.bind(this, this.$container);
5199
+ };
5200
+
5201
+ Select2.prototype._registerDomEvents = function () {
5202
+ var self = this;
5203
+
5204
+ this.$element.on('change.select2', function () {
5205
+ self.dataAdapter.current(function (data) {
5206
+ self.trigger('selection:update', {
5207
+ data: data
5208
+ });
5209
+ });
5210
+ });
5211
+
5212
+ this.$element.on('focus.select2', function (evt) {
5213
+ self.trigger('focus', evt);
5214
+ });
5215
+
5216
+ this._syncA = Utils.bind(this._syncAttributes, this);
5217
+ this._syncS = Utils.bind(this._syncSubtree, this);
5218
+
5219
+ if (this.$element[0].attachEvent) {
5220
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5221
+ }
5222
+
5223
+ var observer = window.MutationObserver ||
5224
+ window.WebKitMutationObserver ||
5225
+ window.MozMutationObserver
5226
+ ;
5227
+
5228
+ if (observer != null) {
5229
+ this._observer = new observer(function (mutations) {
5230
+ $.each(mutations, self._syncA);
5231
+ $.each(mutations, self._syncS);
5232
+ });
5233
+ this._observer.observe(this.$element[0], {
5234
+ attributes: true,
5235
+ childList: true,
5236
+ subtree: false
5237
+ });
5238
+ } else if (this.$element[0].addEventListener) {
5239
+ this.$element[0].addEventListener(
5240
+ 'DOMAttrModified',
5241
+ self._syncA,
5242
+ false
5243
+ );
5244
+ this.$element[0].addEventListener(
5245
+ 'DOMNodeInserted',
5246
+ self._syncS,
5247
+ false
5248
+ );
5249
+ this.$element[0].addEventListener(
5250
+ 'DOMNodeRemoved',
5251
+ self._syncS,
5252
+ false
5253
+ );
5254
+ }
5255
+ };
5256
+
5257
+ Select2.prototype._registerDataEvents = function () {
5258
+ var self = this;
5259
+
5260
+ this.dataAdapter.on('*', function (name, params) {
5261
+ self.trigger(name, params);
5262
+ });
5263
+ };
5264
+
5265
+ Select2.prototype._registerSelectionEvents = function () {
5266
+ var self = this;
5267
+ var nonRelayEvents = ['toggle', 'focus'];
5268
+
5269
+ this.selection.on('toggle', function () {
5270
+ self.toggleDropdown();
5271
+ });
5272
+
5273
+ this.selection.on('focus', function (params) {
5274
+ self.focus(params);
5275
+ });
5276
+
5277
+ this.selection.on('*', function (name, params) {
5278
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5279
+ return;
5280
+ }
5281
+
5282
+ self.trigger(name, params);
5283
+ });
5284
+ };
5285
+
5286
+ Select2.prototype._registerDropdownEvents = function () {
5287
+ var self = this;
5288
+
5289
+ this.dropdown.on('*', function (name, params) {
5290
+ self.trigger(name, params);
5291
+ });
5292
+ };
5293
+
5294
+ Select2.prototype._registerResultsEvents = function () {
5295
+ var self = this;
5296
+
5297
+ this.results.on('*', function (name, params) {
5298
+ self.trigger(name, params);
5299
+ });
5300
+ };
5301
+
5302
+ Select2.prototype._registerEvents = function () {
5303
+ var self = this;
5304
+
5305
+ this.on('open', function () {
5306
+ self.$container.addClass('select2-container--open');
5307
+ });
5308
+
5309
+ this.on('close', function () {
5310
+ self.$container.removeClass('select2-container--open');
5311
+ });
5312
+
5313
+ this.on('enable', function () {
5314
+ self.$container.removeClass('select2-container--disabled');
5315
+ });
5316
+
5317
+ this.on('disable', function () {
5318
+ self.$container.addClass('select2-container--disabled');
5319
+ });
5320
+
5321
+ this.on('blur', function () {
5322
+ self.$container.removeClass('select2-container--focus');
5323
+ });
5324
+
5325
+ this.on('query', function (params) {
5326
+ if (!self.isOpen()) {
5327
+ self.trigger('open', {});
5328
+ }
5329
+
5330
+ this.dataAdapter.query(params, function (data) {
5331
+ self.trigger('results:all', {
5332
+ data: data,
5333
+ query: params
5334
+ });
5335
+ });
5336
+ });
5337
+
5338
+ this.on('query:append', function (params) {
5339
+ this.dataAdapter.query(params, function (data) {
5340
+ self.trigger('results:append', {
5341
+ data: data,
5342
+ query: params
5343
+ });
5344
+ });
5345
+ });
5346
+
5347
+ this.on('keypress', function (evt) {
5348
+ var key = evt.which;
5349
+
5350
+ if (self.isOpen()) {
5351
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5352
+ (key === KEYS.UP && evt.altKey)) {
5353
+ self.close();
5354
+
5355
+ evt.preventDefault();
5356
+ } else if (key === KEYS.ENTER) {
5357
+ self.trigger('results:select', {});
5358
+
5359
+ evt.preventDefault();
5360
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5361
+ self.trigger('results:toggle', {});
5362
+
5363
+ evt.preventDefault();
5364
+ } else if (key === KEYS.UP) {
5365
+ self.trigger('results:previous', {});
5366
+
5367
+ evt.preventDefault();
5368
+ } else if (key === KEYS.DOWN) {
5369
+ self.trigger('results:next', {});
5370
+
5371
+ evt.preventDefault();
5372
+ }
5373
+ } else {
5374
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5375
+ (key === KEYS.DOWN && evt.altKey)) {
5376
+ self.open();
5377
+
5378
+ evt.preventDefault();
5379
+ }
5380
+ }
5381
+ });
5382
+ };
5383
+
5384
+ Select2.prototype._syncAttributes = function () {
5385
+ this.options.set('disabled', this.$element.prop('disabled'));
5386
+
5387
+ if (this.options.get('disabled')) {
5388
+ if (this.isOpen()) {
5389
+ this.close();
5390
+ }
5391
+
5392
+ this.trigger('disable', {});
5393
+ } else {
5394
+ this.trigger('enable', {});
5395
+ }
5396
+ };
5397
+
5398
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5399
+ var changed = false;
5400
+ var self = this;
5401
+
5402
+ // Ignore any mutation events raised for elements that aren't options or
5403
+ // optgroups. This handles the case when the select element is destroyed
5404
+ if (
5405
+ evt && evt.target && (
5406
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5407
+ )
5408
+ ) {
5409
+ return;
5410
+ }
5411
+
5412
+ if (!mutations) {
5413
+ // If mutation events aren't supported, then we can only assume that the
5414
+ // change affected the selections
5415
+ changed = true;
5416
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5417
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5418
+ var node = mutations.addedNodes[n];
5419
+
5420
+ if (node.selected) {
5421
+ changed = true;
5422
+ }
5423
+ }
5424
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5425
+ changed = true;
5426
+ }
5427
+
5428
+ // Only re-pull the data if we think there is a change
5429
+ if (changed) {
5430
+ this.dataAdapter.current(function (currentData) {
5431
+ self.trigger('selection:update', {
5432
+ data: currentData
5433
+ });
5434
+ });
5435
+ }
5436
+ };
5437
+
5438
+ /**
5439
+ * Override the trigger method to automatically trigger pre-events when
5440
+ * there are events that can be prevented.
5441
+ */
5442
+ Select2.prototype.trigger = function (name, args) {
5443
+ var actualTrigger = Select2.__super__.trigger;
5444
+ var preTriggerMap = {
5445
+ 'open': 'opening',
5446
+ 'close': 'closing',
5447
+ 'select': 'selecting',
5448
+ 'unselect': 'unselecting'
5449
  };
5450
 
5451
+ if (args === undefined) {
5452
+ args = {};
5453
+ }
5454
+
5455
+ if (name in preTriggerMap) {
5456
+ var preTriggerName = preTriggerMap[name];
5457
+ var preTriggerArgs = {
5458
+ prevented: false,
5459
+ name: name,
5460
+ args: args
5461
+ };
5462
+
5463
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5464
+
5465
+ if (preTriggerArgs.prevented) {
5466
+ args.prevented = true;
5467
+
5468
+ return;
5469
+ }
5470
+ }
5471
+
5472
+ actualTrigger.call(this, name, args);
5473
+ };
5474
+
5475
+ Select2.prototype.toggleDropdown = function () {
5476
+ if (this.options.get('disabled')) {
5477
+ return;
5478
+ }
5479
+
5480
+ if (this.isOpen()) {
5481
+ this.close();
5482
+ } else {
5483
+ this.open();
5484
+ }
5485
+ };
5486
+
5487
+ Select2.prototype.open = function () {
5488
+ if (this.isOpen()) {
5489
+ return;
5490
+ }
5491
+
5492
+ this.trigger('query', {});
5493
+ };
5494
+
5495
+ Select2.prototype.close = function () {
5496
+ if (!this.isOpen()) {
5497
+ return;
5498
+ }
5499
+
5500
+ this.trigger('close', {});
5501
+ };
5502
+
5503
+ Select2.prototype.isOpen = function () {
5504
+ return this.$container.hasClass('select2-container--open');
5505
+ };
5506
+
5507
+ Select2.prototype.hasFocus = function () {
5508
+ return this.$container.hasClass('select2-container--focus');
5509
+ };
5510
+
5511
+ Select2.prototype.focus = function (data) {
5512
+ // No need to re-trigger focus events if we are already focused
5513
+ if (this.hasFocus()) {
5514
+ return;
5515
+ }
5516
+
5517
+ this.$container.addClass('select2-container--focus');
5518
+ this.trigger('focus', {});
5519
+ };
5520
+
5521
+ Select2.prototype.enable = function (args) {
5522
+ if (this.options.get('debug') && window.console && console.warn) {
5523
+ console.warn(
5524
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5525
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5526
+ ' instead.'
5527
+ );
5528
+ }
5529
+
5530
+ if (args == null || args.length === 0) {
5531
+ args = [true];
5532
+ }
5533
+
5534
+ var disabled = !args[0];
5535
+
5536
+ this.$element.prop('disabled', disabled);
5537
+ };
5538
+
5539
+ Select2.prototype.data = function () {
5540
+ if (this.options.get('debug') &&
5541
+ arguments.length > 0 && window.console && console.warn) {
5542
+ console.warn(
5543
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5544
+ 'should consider setting the value instead using `$element.val()`.'
5545
+ );
5546
+ }
5547
+
5548
+ var data = [];
5549
+
5550
+ this.dataAdapter.current(function (currentData) {
5551
+ data = currentData;
5552
+ });
5553
+
5554
+ return data;
5555
+ };
5556
+
5557
+ Select2.prototype.val = function (args) {
5558
+ if (this.options.get('debug') && window.console && console.warn) {
5559
+ console.warn(
5560
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5561
+ ' removed in later Select2 versions. Use $element.val() instead.'
5562
+ );
5563
+ }
5564
+
5565
+ if (args == null || args.length === 0) {
5566
+ return this.$element.val();
5567
+ }
5568
+
5569
+ var newVal = args[0];
5570
+
5571
+ if ($.isArray(newVal)) {
5572
+ newVal = $.map(newVal, function (obj) {
5573
+ return obj.toString();
5574
+ });
5575
+ }
5576
+
5577
+ this.$element.val(newVal).trigger('change');
5578
+ };
5579
+
5580
+ Select2.prototype.destroy = function () {
5581
+ this.$container.remove();
5582
+
5583
+ if (this.$element[0].detachEvent) {
5584
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5585
+ }
5586
+
5587
+ if (this._observer != null) {
5588
+ this._observer.disconnect();
5589
+ this._observer = null;
5590
+ } else if (this.$element[0].removeEventListener) {
5591
+ this.$element[0]
5592
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5593
+ this.$element[0]
5594
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5595
+ this.$element[0]
5596
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5597
+ }
5598
+
5599
+ this._syncA = null;
5600
+ this._syncS = null;
5601
+
5602
+ this.$element.off('.select2');
5603
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5604
+
5605
+ this.$element.removeClass('select2-hidden-accessible');
5606
+ this.$element.attr('aria-hidden', 'false');
5607
+ this.$element.removeData('select2');
5608
+
5609
+ this.dataAdapter.destroy();
5610
+ this.selection.destroy();
5611
+ this.dropdown.destroy();
5612
+ this.results.destroy();
5613
+
5614
+ this.dataAdapter = null;
5615
+ this.selection = null;
5616
+ this.dropdown = null;
5617
+ this.results = null;
5618
+ };
5619
+
5620
+ Select2.prototype.render = function () {
5621
+ var $container = $(
5622
+ '<span class="select2 select2-container">' +
5623
+ '<span class="selection"></span>' +
5624
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5625
+ '</span>'
5626
+ );
5627
+
5628
+ $container.attr('dir', this.options.get('dir'));
5629
+
5630
+ this.$container = $container;
5631
+
5632
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
5633
+
5634
+ $container.data('element', this.$element);
5635
+
5636
+ return $container;
5637
+ };
5638
+
5639
+ return Select2;
5640
+ });
5641
+
5642
+ S2.define('jquery-mousewheel',[
5643
+ 'jquery'
5644
+ ], function ($) {
5645
+ // Used to shim jQuery.mousewheel for non-full builds.
5646
+ return $;
5647
+ });
5648
+
5649
+ S2.define('jquery.select2',[
5650
+ 'jquery',
5651
+ 'jquery-mousewheel',
5652
+
5653
+ './select2/core',
5654
+ './select2/defaults'
5655
+ ], function ($, _, Select2, Defaults) {
5656
+ if ($.fn.select2 == null) {
5657
+ // All methods that should return the element
5658
+ var thisMethods = ['open', 'close', 'destroy'];
5659
+
5660
+ $.fn.select2 = function (options) {
5661
+ options = options || {};
5662
+
5663
+ if (typeof options === 'object') {
5664
+ this.each(function () {
5665
+ var instanceOptions = $.extend(true, {}, options);
5666
+
5667
+ var instance = new Select2($(this), instanceOptions);
5668
+ });
5669
+
5670
+ return this;
5671
+ } else if (typeof options === 'string') {
5672
+ var ret;
5673
+ var args = Array.prototype.slice.call(arguments, 1);
5674
+
5675
+ this.each(function () {
5676
+ var instance = $(this).data('select2');
5677
+
5678
+ if (instance == null && window.console && console.error) {
5679
+ console.error(
5680
+ 'The select2(\'' + options + '\') method was called on an ' +
5681
+ 'element that is not using Select2.'
5682
+ );
5683
+ }
5684
+
5685
+ ret = instance[options].apply(instance, args);
5686
+ });
5687
+
5688
+ // Check if we should be returning `this`
5689
+ if ($.inArray(options, thisMethods) > -1) {
5690
+ return this;
5691
+ }
5692
+
5693
+ return ret;
5694
+ } else {
5695
+ throw new Error('Invalid arguments for Select2: ' + options);
5696
+ }
5697
+ };
5698
+ }
5699
+
5700
+ if ($.fn.select2.defaults == null) {
5701
+ $.fn.select2.defaults = Defaults;
5702
+ }
5703
+
5704
+ return Select2;
5705
+ });
5706
+
5707
+ // Return the AMD loader configuration so it can be used outside of this file
5708
+ return {
5709
+ define: S2.define,
5710
+ require: S2.require
5711
+ };
5712
+ }());
5713
+
5714
+ // Autoload the jQuery bindings
5715
+ // We know that all of the modules exist above this, so we're safe
5716
+ var select2 = S2.require('jquery.select2');
5717
+
5718
+ // Hold the AMD module references on the jQuery function that was just loaded
5719
+ // This allows Select2 to use the internal loader outside of this file, such
5720
+ // as in the language files.
5721
+ jQuery.fn.select2.amd = S2;
5722
+
5723
+ // Return the Select2 instance for anyone who is importing it.
5724
+ return select2;
5725
+ }));
assets/js/select2/select2.min.js CHANGED
@@ -1,3 +1,10 @@
1
- !function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function c(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function d(a){function b(a){return O[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function e(a,b){for(var c=0,d=b.length;c<d;c+=1)if(g(a,b[c]))return c;return-1}function f(){var b=a(N);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function g(a,c){return a===c||a!==b&&c!==b&&(null!==a&&null!==c&&(a.constructor===String?a+""==c+"":c.constructor===String&&c+""==a+""))}function h(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;e<f;e+=1)d[e]=c(d[e]);return d}function i(a){return a.outerWidth(!1)-a.width()}function j(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function k(c){c.on("mousemove",function(c){var d=L;d!==b&&d.x===c.pageX&&d.y===c.pageY||a(c.target).trigger("mousemove-filtered",c)})}function l(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function m(a,b){var c=l(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){e(a.target,b.get())>=0&&c(a)})}function n(a){a[0]!==document.activeElement&&window.setTimeout(function(){var b,c=a[0],d=a.val().length;a.focus();var e=c.offsetWidth>0||c.offsetHeight>0;e&&c===document.activeElement&&(c.setSelectionRange?c.setSelectionRange(d,d):c.createTextRange&&(b=c.createTextRange(),b.collapse(!1),b.select()))},0)}function o(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function p(a){a.preventDefault(),a.stopPropagation()}function q(a){a.preventDefault(),a.stopImmediatePropagation()}function r(b){if(!I){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);I=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),I.attr("class","select2-sizer"),a(document.body).append(I)}return I.text(b.val()),I.width()}function s(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(f=d(this),f&&g.push(f))})),b.attr("class",g.join(" "))}function t(a,b,c,e){var f=d(a.toUpperCase()).indexOf(d(b.toUpperCase())),g=b.length;return f<0?void c.push(e(a)):(c.push(e(a.substring(0,f))),c.push("<span class='select2-match'>"),c.push(e(a.substring(f,f+g))),c.push("</span>"),void c.push(e(a.substring(f+g,a.length))))}function u(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function v(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function w(b){var c,d,e=b,f=function(a){return""+a.text};a.isArray(e)&&(d=e,e={results:d}),a.isFunction(e)===!1&&(d=e,e=function(){return d});var g=e();return g.text&&(f=g.text,a.isFunction(f)||(c=g.text,f=function(a){return a[c]})),function(b){var c,d=b.term,g={results:[]};return""===d?void b.callback(e()):(c=function(e,g){var h,i;if(e=e[0],e.children){h={};for(i in e)e.hasOwnProperty(i)&&(h[i]=e[i]);h.children=[],a(e.children).each2(function(a,b){c(b,h.children)}),(h.children.length||b.matcher(d,f(h),e))&&g.push(h)}else b.matcher(d,f(e),e)&&g.push(e)},a(e().results).each2(function(a,b){c(b,g.results)}),void b.callback(g))}}function x(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function y(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function z(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function A(b){var c=0;return a.each(b,function(a,b){b.children?c+=A(b.children):c++}),c}function B(a,c,d,e){var f,h,i,j,k,l=a,m=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(h=-1,i=0,j=e.tokenSeparators.length;i<j&&(k=e.tokenSeparators[i],h=a.indexOf(k),!(h>=0));i++);if(h<0)break;if(f=a.substring(0,h),a=a.substring(h+k.length),f.length>0&&(f=e.createSearchChoice.call(this,f,c),f!==b&&null!==f&&e.id(f)!==b&&null!==e.id(f))){for(m=!1,i=0,j=c.length;i<j;i++)if(g(e.id(f),e.id(c[i]))){m=!0;break}m||d(f)}}return l!==a?a:void 0}function C(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function D(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var E,F,G,H,I,J,K,L={x:0,y:0},M={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case M.LEFT:case M.RIGHT:case M.UP:case M.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case M.SHIFT:case M.CTRL:case M.ALT:return!0}return!!a.metaKey},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&a<=123}},N="<div class='select2-measure-scrollbar'></div>",O={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};J=a(document),H=function(){var a=1;return function(){return a++}}(),E=D(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+H()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),s(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(z(c.containerCss,this.opts.element)),this.container.addClass(z(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",p),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),s(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(z(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",p),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",p),k(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(a){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),m(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&f-e<=0?(d.scrollTop(0),p(a)):e<0&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),p(a))}),j(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.lastSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),K=K||f(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.removeData("select2").off(".select2"),a.is("input[type='hidden']")?a.css("display",""):(a.show().prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())),C.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:g(a.attr("locked"),"locked")||g(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,i,j=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c.debug=c.debug||a.fn.select2.defaults.debug,c.debug&&console&&console.warn&&(null!=c.id&&console.warn("Select2: The `id` option has been removed in Select2 4.0.0, consider renaming your `id` property or mapping the property before your data makes it to Select2. You can read more at https://select2.github.io/announcements-4.0.html#changed-id"),null!=c.text&&console.warn("Select2: The `text` option has been removed in Select2 4.0.0, consider renaming your `text` property or mapping the property before your data makes it to Select2. You can read more at https://select2.github.io/announcements-4.0.html#changed-id"),null!=c.sortResults&&console.warn("Select2: the `sortResults` option has been renamed to `sorter` in Select2 4.0.0. "),null!=c.selectOnBlur&&console.warn("Select2: The `selectOnBlur` option has been renamed to `selectOnClose` in Select2 4.0.0."),null!=c.ajax&&null!=c.ajax.results&&console.warn("Select2: The `ajax.results` option has been renamed to `ajax.processResults` in Select2 4.0.0."),null!=c.formatNoResults&&console.warn("Select2: The `formatNoResults` option has been renamed to `language.noResults` in Select2 4.0.0."),null!=c.formatSearching&&console.warn("Select2: The `formatSearching` option has been renamed to `language.searching` in Select2 4.0.0."),null!=c.formatInputTooShort&&console.warn("Select2: The `formatInputTooShort` option has been renamed to `language.inputTooShort` in Select2 4.0.0."),null!=c.formatInputTooLong&&console.warn("Select2: The `formatInputTooLong` option has been renamed to `language.inputTooLong` in Select2 4.0.0."),null!=c.formatLoading&&console.warn("Select2: The `formatLoading` option has been renamed to `language.loadingMore` in Select2 4.0.0."),null!=c.formatSelectionTooBig&&console.warn("Select2: The `formatSelectionTooBig` option has been renamed to `language.maximumSelected` in Select2 4.0.0."),c.element.data("select2Tags")&&console.warn("Select2: The `data-select2-tags` attribute has been renamed to `data-tags` in Select2 4.0.0.")),null!=c.element.data("tags")){var k=c.element.data("tags");a.isArray(k)||(k=[]),c.element.data("select2Tags",k)}if(null!=c.sorter&&(c.sortResults=c.sorter),null!=c.selectOnClose&&(c.selectOnBlur=c.selectOnClose),null!=c.ajax&&a.isFunction(c.ajax.processResults)&&(c.ajax.results=c.ajax.processResults),null!=c.language){var l=c.language;a.isFunction(l.noMatches)&&(c.formatNoMatches=l.noMatches),a.isFunction(l.searching)&&(c.formatSearching=l.searching),a.isFunction(l.inputTooShort)&&(c.formatInputTooShort=l.inputTooShort),a.isFunction(l.inputTooLong)&&(c.formatInputTooLong=l.inputTooLong),a.isFunction(l.loadingMore)&&(c.formatLoading=l.loadingMore),a.isFunction(l.maximumSelected)&&(c.formatSelectionTooBig=l.maximumSelected)}if(c=a.extend({},{populateResults:function(d,e,f){var g,h=this.opts.id,i=this.liveRegion;(g=function(d,e,k){var l,m,n,o,p,q,r,s,t,u;d=c.sortResults(d,e,f);var v=[];for(l=0,m=d.length;l<m;l+=1)n=d[l],p=n.disabled===!0,o=!p&&h(n)!==b,q=n.children&&n.children.length>0,r=a("<li></li>"),r.addClass("select2-results-dept-"+k),r.addClass("select2-result"),r.addClass(o?"select2-result-selectable":"select2-result-unselectable"),p&&r.addClass("select2-disabled"),q&&r.addClass("select2-result-with-children"),r.addClass(j.opts.formatResultCssClass(n)),r.attr("role","presentation"),s=a(document.createElement("div")),s.addClass("select2-result-label"),s.attr("id","select2-result-label-"+H()),s.attr("role","option"),u=c.formatResult(n,s,f,j.opts.escapeMarkup),u!==b&&(s.html(u),r.append(s)),q&&(t=a("<ul></ul>"),t.addClass("select2-result-sub"),g(n.children,t,k+1),r.append(t)),r.data("select2-data",n),v.push(r[0]);e.append(v),i.text(c.formatMatches(d.length))})(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var c,e,f,g={results:[],more:!1},h=a.term;f=function(b,c){var d;b.is("option")?a.matcher(h,b.text(),b)&&c.push(j.optionToData(b)):b.is("optgroup")&&(d=j.optionToData(b),b.children().each2(function(a,b){f(b,d.children)}),d.children.length>0&&c.push(d))},c=d.children(),this.getPlaceholder()!==b&&c.length>0&&(e=this.getPlaceholderOption(),e&&(c=c.not(e))),c.each2(function(a,b){f(b,g.results)}),a.callback(g)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(i=c.element.data("ajax-url"),i&&i.length>0&&(c.ajax.url=i),c.query=v.call(c.element,c.ajax)):"data"in c?c.query=w(c.data):"tags"in c&&(c.query=x(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(h(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){if(g(this.id,b.id))return b=this,!1}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var c,d=this.opts.element,e=this;d.on("change.select2",this.bind(function(a){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=d.prop("disabled");a===b&&(a=!1),this.enable(!a);var c=d.prop("readonly");c===b&&(c=!1),this.readonly(c),this.container&&(s(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(z(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(s(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(z(this.opts.dropdownCssClass,this.opts.element)))}),d.length&&d[0].attachEvent&&d.each(function(){this.attachEvent("onpropertychange",e._sync)}),c=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,c!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new c(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(d.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a!==this.enabledInterface&&(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return!!this.container&&this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var b,c,d,e,f,g=this.dropdown,h=this.container,i=h.offset(),j=h.outerHeight(!1),k=h.outerWidth(!1),l=g.outerHeight(!1),m=a(window),n=m.width(),o=m.height(),p=m.scrollLeft()+n,q=m.scrollTop()+o,r=i.top+j,s=i.left,t=r+l<=q,u=i.top-l>=m.scrollTop(),v=g.outerWidth(!1),w=function(){return s+v<=p},x=function(){return i.left+p+h.outerWidth(!1)>v},y=g.hasClass("select2-drop-above");y?(c=!0,!u&&t&&(d=!0,c=!1)):(c=!1,!t&&u&&(d=!0,c=!0)),d&&(g.hide(),i=this.container.offset(),j=this.container.outerHeight(!1),k=this.container.outerWidth(!1),l=g.outerHeight(!1),p=m.scrollLeft()+n,q=m.scrollTop()+o,r=i.top+j,s=i.left,v=g.outerWidth(!1),g.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(f=a(".select2-results",g)[0],g.addClass("select2-drop-auto-width"),g.css("width",""),v=g.outerWidth(!1)+(f.scrollHeight===f.clientHeight?0:K.width),v>k?k=v:v=k,l=g.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(b=this.body.offset(),r-=b.top,s-=b.left),!w()&&x()&&(s=i.left+this.container.outerWidth(!1)-v),e={left:s,width:k},c?(this.container.addClass("select2-drop-above"),g.addClass("select2-drop-above"),l=g.outerHeight(!1),e.top=i.top-l,e.bottom="auto"):(e.top=r,e.bottom="auto",this.container.removeClass("select2-drop-above"),g.removeClass("select2-drop-above")),e=a.extend(e,z(this.opts.dropdownCss,this.opts.element)),g.css(e)},shouldOpen:function(){var b;return!this.opened()&&(this._enabled!==!1&&this._readonly!==!0&&(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented()))},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return!!this.shouldOpen()&&(this.opening(),J.on("mousemove.select2Event",function(a){L.x=a.pageX,L.y=a.pageY}),!0)},opening:function(){var b,d=this.containerEventName,e="scroll."+d,f="resize."+d,g="orientationchange."+d;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),b=a("#select2-drop-mask"),0===b.length&&(b=a(document.createElement("div")),b.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),b.hide(),b.appendTo(this.body),b.on("mousedown touchstart click",function(d){c(b);var e,f=a("#select2-drop");f.length>0&&(e=f.data("select2"),e.opts.selectOnBlur&&e.selectHighlighted({noFocus:!0}),e.close(),d.preventDefault(),d.stopPropagation())})),this.dropdown.prev()[0]!==b[0]&&this.dropdown.before(b),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),b.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var h=this;this.container.parents().add(window).each(function(){a(this).on(f+" "+e+" "+g,function(a){h.opened()&&h.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),J.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.search.removeAttr("aria-activedescendant"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},prefillNextSearchTerm:function(){if(""!==this.search.val())return!1;var a=this.opts.nextSearchTerm(this.data(),this.lastSearchTerm);return a!==b&&(this.search.val(a),this.search.select(),!0)},getMaximumSelectionSize:function(){return z(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var b,c,d,e,f,g,h,i,j=this.results;if(c=this.highlight(),!(c<0)){if(0==c)return void j.scrollTop(0);b=this.findHighlightableChoices().find(".select2-result-label"),d=a(b[c]),i=(d.offset()||{}).top||0,e=i+d.outerHeight(!0),c===b.length-1&&(h=j.find("li.select2-more-results"),h.length>0&&(e=h.offset().top+h.outerHeight(!0))),f=j.offset().top+j.outerHeight(!1),e>f&&j.scrollTop(j.scrollTop()+(e-f)),g=i-j.offset().top,g<0&&"none"!=d.css("display")&&j.scrollTop(j.scrollTop()+g)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var c,d,f=this.findHighlightableChoices();return 0===arguments.length?e(f.filter(".select2-highlighted")[0],f.get()):(b>=f.length&&(b=f.length-1),b<0&&(b=0),this.removeHighlight(),c=a(f[b]),c.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",c.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(c.text()),d=c.data("select2-data"),void(d&&this.opts.element.trigger({type:"select2-highlight",val:this.id(d),choice:d})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();
2
- this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var a,b=this.results,c=b.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==c.length&&(a=c.offset().top-b.offset().top-b.height(),a<=this.opts.loadMorePadding&&(c.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(a){e.opened()&&(e.opts.populateResults.call(this,b,a.results,{term:f,page:d,context:g}),e.postprocessResults(a,!1,!1),a.more===!0?(c.detach().appendTo(b).html(e.opts.escapeMarkup(z(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):c.remove(),e.positionDropdown(),e.resultsPage=d,e.context=a.context,this.opts.element.trigger({type:"select2-loaded",items:a}))})})))},tokenize:function(){},updateResults:function(c){function d(){j.removeClass("select2-active"),m.positionDropdown(),k.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?m.liveRegion.text(k.text()):m.liveRegion.text(m.opts.formatMatches(k.find('.select2-result-selectable:not(".select2-selected")').length))}function e(a){k.html(a),d()}var f,h,i,j=this.search,k=this.results,l=this.opts,m=this,n=j.val(),o=a.data(this.container,"select2-last-term");if((c===!0||!o||!g(n,o))&&(a.data(this.container,"select2-last-term",n),c===!0||this.showSearchInput!==!1&&this.opened())){i=++this.queryCount;var p=this.getMaximumSelectionSize();if(p>=1&&(f=this.data(),a.isArray(f)&&f.length>=p&&y(l.formatSelectionTooBig,"formatSelectionTooBig")))return void e("<li class='select2-selection-limit'>"+z(l.formatSelectionTooBig,l.element,p)+"</li>");if(j.val().length<l.minimumInputLength)return e(y(l.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+z(l.formatInputTooShort,l.element,j.val(),l.minimumInputLength)+"</li>":""),void(c&&this.showSearch&&this.showSearch(!0));if(l.maximumInputLength&&j.val().length>l.maximumInputLength)return void e(y(l.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+z(l.formatInputTooLong,l.element,j.val(),l.maximumInputLength)+"</li>":"");l.formatSearching&&0===this.findHighlightableChoices().length&&e("<li class='select2-searching'>"+z(l.formatSearching,l.element)+"</li>"),j.addClass("select2-active"),this.removeHighlight(),h=this.tokenize(),h!=b&&null!=h&&j.val(h),this.resultsPage=1,l.query({element:l.element,term:j.val(),page:this.resultsPage,context:null,matcher:l.matcher,callback:this.bind(function(f){var h;if(i==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(f.hasError!==b&&y(l.formatAjaxError,"formatAjaxError"))return void e("<li class='select2-ajax-error'>"+z(l.formatAjaxError,l.element,f.jqXHR,f.textStatus,f.errorThrown)+"</li>");if(this.context=f.context===b?null:f.context,this.opts.createSearchChoice&&""!==j.val()&&(h=this.opts.createSearchChoice.call(m,j.val(),f.results),h!==b&&null!==h&&m.id(h)!==b&&null!==m.id(h)&&0===a(f.results).filter(function(){return g(m.id(this),m.id(h))}).length&&this.opts.createSearchChoicePosition(f.results,h)),0===f.results.length&&y(l.formatNoMatches,"formatNoMatches"))return e("<li class='select2-no-results'>"+z(l.formatNoMatches,l.element,j.val())+"</li>"),void(this.showSearch&&this.showSearch(j.val()));k.empty(),m.opts.populateResults.call(this,k,f.results,{term:j.val(),page:this.resultsPage,context:null}),f.more===!0&&y(l.formatLoadMore,"formatLoadMore")&&(k.append("<li class='select2-more-results'>"+l.escapeMarkup(z(l.formatLoadMore,l.element,this.resultsPage))+"</li>"),window.setTimeout(function(){m.loadMoreIfNeeded()},10)),this.postprocessResults(f,c),d(),this.opts.element.trigger({type:"select2-loaded",items:f})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){n(this.search)},selectHighlighted:function(a){if(this._touchMoved)return void this.clearTouchMoved();var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function b(){var b,c,d,e,f,g;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(b=this.opts.element.attr("style"),"string"==typeof b)for(c=b.split(";"),e=0,f=c.length;e<f;e+=1)if(g=c[e].replace(/\s/g,""),d=g.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==d&&d.length>=1)return d[1];return"resolve"===this.opts.width?(b=this.opts.element.css("width"),b.indexOf("%")>0?b:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var c=b.call(this);null!==c&&this.container.css("width",c)}}),F=D(E,{createContainer:function(){var b=a(document.createElement("div")).attr({class:"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var b,c,d;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),b=this.search.get(0),b.createTextRange?(c=b.createTextRange(),c.collapse(!1),c.select()):b.setSelectionRange&&(d=this.search.val().length,b.setSelectionRange(d,d))),this.prefillNextSearchTerm(),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),C.call(this,"selection","focusser")},initContainer:function(){var b,d,e=this.container,f=this.dropdown,g=H();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=e.find(".select2-choice"),this.focusser=e.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+g),this.focusser.attr("aria-labelledby","select2-chosen-"+g),this.results.attr("id","select2-results-"+g),this.search.attr("aria-owns","select2-results-"+g),this.focusser.attr("id","s2id_autogen"+g),d=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.on("focus.select2",this.bind(function(){this.focus()})),this.focusser.prev().text(d.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||d.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===M.PAGE_UP||a.which===M.PAGE_DOWN)return void p(a);switch(a.which){case M.UP:case M.DOWN:return this.moveHighlight(a.which===M.UP?-1:1),void p(a);case M.ENTER:return this.selectHighlighted(),void p(a);case M.TAB:return void this.selectHighlighted({noFocus:!0});case M.ESC:return this.cancel(a),void p(a)}}})),this.search.on("blur",this.bind(function(a){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.results&&this.results.length>1&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==M.TAB&&!M.isControl(a)&&!M.isFunctionKey(a)&&a.which!==M.ESC){if(this.opts.openOnEnter===!1&&a.which===M.ENTER)return void p(a);if(a.which==M.DOWN||a.which==M.UP||a.which==M.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),void p(a)}return a.which==M.DELETE||a.which==M.BACKSPACE?(this.opts.allowClear&&this.clear(),void p(a)):void 0}})),j(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),q(a),this.close(),this.selection&&this.selection.focus())})),this.supportsTouchEvents?b.on("mousedown touchstart",this.bind(function(d){c(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),p(d)})):b.on("mousedown",this.bind(function(d){c(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),p(d)})),f.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){p(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var a=this;this.opts.initSelection.call(null,this.opts.element,function(c){c!==b&&null!==c&&(a.updateSelection(c),a.close(),a.setPlaceholder(),a.lastSearchTerm=a.search.val())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()!==b&&((a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val())},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var h=g(e,b.id(d));return h&&(f=d),h},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){if(g(e.id(b.data("select2-data")),e.opts.element.val()))return d=a,!1}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var f=this.opts.minimumResultsForSearch;f>=0&&this.showSearch(A(a.results)>=f)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.lastSearchTerm=this.search.val(),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),g(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var c,d,e=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),e.empty(),null!==a&&(c=this.opts.formatSelection(a,e,this.opts.escapeMarkup)),c!==b&&e.append(c),d=this.opts.formatSelectionCssClass(a,e),d!==b&&e.addClass(d),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1],this.opts.debug&&console&&console.warn&&console.warn('Select2: The second option to `select2("val")` is not supported in Select2 4.0.0. The `change` event will always be triggered in 4.0.0.')),this.select)this.opts.debug&&console&&console.warn&&console.warn('Select2: Setting the value on a <select> using `select2("val")` is no longer supported in 4.0.0. You can use the `.val(newValue).trigger("change")` method provided by jQuery instead.'),this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return void this.clear(c);if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(this.opts.debug&&console&&console.warn&&console.warn('Select2: The `select2("data")` method can no longer set selected values in 4.0.0, consider using the `.val()` method instead.'),arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),G=D(E,{createContainer:function(){var b=a(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=h(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,h){var i=a.grep(e,function(a){return g(a,b.id(h))}).length;return i&&f.push(h),i},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var h=e[c],i=0;i<f.length;i++){var j=f[i];if(g(h,b.id(j))){a.push(j),f.splice(i,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),C.call(this,"searchContainer","selection")},initContainer:function(){var b,c=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=b=this.container.find(c);var d=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(b){d.search[0].focus(),d.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+H()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.on("focus.select2",this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var c=b.find(".select2-search-choice-focus"),d=c.prev(".select2-search-choice:not(.select2-locked)"),e=c.next(".select2-search-choice:not(.select2-locked)"),f=o(this.search);if(c.length&&(a.which==M.LEFT||a.which==M.RIGHT||a.which==M.BACKSPACE||a.which==M.DELETE||a.which==M.ENTER)){var g=c;return a.which==M.LEFT&&d.length?g=d:a.which==M.RIGHT?g=e.length?e:null:a.which===M.BACKSPACE?this.unselect(c.first())&&(this.search.width(10),g=d.length?d:e):a.which==M.DELETE?this.unselect(c.first())&&(this.search.width(10),g=e.length?e:null):a.which==M.ENTER&&(g=null),this.selectChoice(g),p(a),void(g&&g.length||this.open())}if((a.which===M.BACKSPACE&&1==this.keydowns||a.which==M.LEFT)&&0==f.offset&&!f.length)return this.selectChoice(b.find(".select2-search-choice:not(.select2-locked)").last()),void p(a);if(this.selectChoice(null),this.opened())switch(a.which){case M.UP:case M.DOWN:return this.moveHighlight(a.which===M.UP?-1:1),void p(a);case M.ENTER:return this.selectHighlighted(),void p(a);case M.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case M.ESC:return this.cancel(a),void p(a)}if(a.which!==M.TAB&&!M.isControl(a)&&!M.isFunctionKey(a)&&a.which!==M.BACKSPACE&&a.which!==M.ESC){if(a.which===M.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),a.which!==M.PAGE_UP&&a.which!==M.PAGE_DOWN||p(a),a.which===M.ENTER&&p(a)}}})),this.search.on("keyup",this.bind(function(a){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",c,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",c,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var a=this;this.opts.initSelection.call(null,this.opts.element,function(c){c!==b&&null!==c&&(a.updateSelection(c),a.close(),a.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.prefillNextSearchTerm(),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c={},d=[],e=this;a(b).each(function(){e.id(this)in c||(c[e.id(this)]=0,d.push(this))}),this.selection.find(".select2-search-choice").remove(),this.addSelectedChoice(d),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.lastSearchTerm=this.search.val(),this.clearSearch(),this.updateResults(),!this.select&&this.opts.closeOnSelect||this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.prefillNextSearchTerm()&&this.updateResults(),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(b){var c=this.getVal(),d=this;a(b).each(function(){c.push(d.createChoice(this))}),this.setVal(c)},createChoice:function(c){var d,e,f=!c.locked,g=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),h=a("<li class='select2-search-choice select2-locked'><div></div></li>"),i=f?g:h,j=this.id(c);return d=this.opts.formatSelection(c,i.find("div"),this.opts.escapeMarkup),d!=b&&i.find("div").replaceWith(a("<div></div>").html(d)),e=this.opts.formatSelectionCssClass(c,i.find("div")),e!=b&&i.addClass(e),f&&i.find(".select2-search-choice-close").on("mousedown",p).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),p(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),i.data("select2-data",c),i.insertBefore(this.searchContainer),j},unselect:function(b){var c,d,f=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(c=b.data("select2-data")){var g=a.Event("select2-removing");if(g.val=this.id(c),g.choice=c,this.opts.element.trigger(g),g.isDefaultPrevented())return!1;for(;(d=e(this.id(c),f))>=0;)f.splice(d,1),this.setVal(f),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),f=this.results.find(".select2-result"),g=this.results.find(".select2-result-with-children"),h=this;f.each2(function(a,b){var c=h.id(b.data("select2-data"));e(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),g.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),this.highlight()==-1&&c!==!1&&this.opts.closeOnSelect===!0&&h.highlight(0),!this.opts.createSearchChoice&&!f.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&y(h.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+z(h.opts.formatNoMatches,h.opts.element,h.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-i(this.search)},resizeSearch:function(){var a,b,c,d,e,f=i(this.search);a=r(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,e<a&&(e=c-f),e<40&&(e=c-f),e<=0&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),h(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){if(this.select)this.select.val(b);else{var c=[],d={};a(b).each(function(){this in d||(c.push(this),d[this]=0)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator))}},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)if(g(this.opts.id(b[c]),this.opts.id(a[d]))){b.splice(c,1),c--,a.splice(d,1);break}return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(d&&this.triggerChange({added:this.data(),removed:e}));if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var d,e,f=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(e=this.data(),b||(b=[]),d=a.map(b,function(a){return f.opts.id(a)}),this.setVal(d),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(e,this.data())),void 0)}}),a.fn.select2=function(){var c,d,f,g,h,i=Array.prototype.slice.call(arguments,0),j=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],k=["opened","isFocused","container","dropdown"],l=["val","data"],m={search:"externalSearch"};return this.each(function(){if(0===i.length||"object"==typeof i[0])c=0===i.length?{}:a.extend({},i[0]),c.element=a(this),"select"===c.element.get(0).tagName.toLowerCase()?h=c.element.prop("multiple"):(h=c.multiple||!1,"tags"in c&&(c.multiple=h=!0)),d=h?new window.Select2.class.multi:new window.Select2.class.single,d.init(c);else{if("string"!=typeof i[0])throw"Invalid arguments to select2 plugin: "+i;if(e(i[0],j)<0)throw"Unknown method: "+i[0];if(g=b,d=a(this).data("select2"),d===b)return;if(f=i[0],"container"===f?g=d.container:"dropdown"===f?g=d.dropdown:(m[f]&&(f=m[f]),g=d[f].apply(d,i.slice(1))),e(i[0],k)>=0||e(i[0],l)>=0&&1==i.length)return!1}}),g===b?this:g},a.fn.select2.defaults={debug:!1,width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return t(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a,b,c){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(a,c){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text},matcher:function(a,b){return d(""+b).toUpperCase().indexOf(d(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:B,escapeMarkup:u,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(a){return null},nextSearchTerm:function(a,c){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){
3
- var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return!b||!(a.opts.minimumResultsForSearch<0)}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(a,b,c){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(a){return"Loading more results…"},formatSearching:function(){return"Searching…"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:v,local:w,tags:x},util:{debounce:l,markMatch:t,escapeMarkup:u,stripDiacritics:d},class:{abstract:E,single:F,multi:G}}}}(jQuery);
 
 
 
 
 
 
 
1
+ /*!
2
+ * Select2 4.0.3
3
+ * https://select2.github.io
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/select2/select2/blob/master/LICENSE.md
7
+ */
8
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(a.inArray(b,f)!==-1){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),a.inArray(b,g)!==-1&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
9
+ if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;c.inArray(g,e)===-1&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&c.inArray(g,e)===-1&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(a.inArray(j,f)!==-1){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){a.inArray(d,c)===-1&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){
10
+ var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
flash-toolkit.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Flash Toolkit
4
  * Plugin URI: http://themegrill.com/theme/flash
5
  * Description: Flash Toolkit is a companion for Flash WordPress theme by ThemeGrill
6
- * Version: 1.1.0
7
  * Author: ThemeGrill
8
  * Author URI: http://themegrill.com
9
  * License: GPLv3 or later
3
  * Plugin Name: Flash Toolkit
4
  * Plugin URI: http://themegrill.com/theme/flash
5
  * Description: Flash Toolkit is a companion for Flash WordPress theme by ThemeGrill
6
+ * Version: 1.1.1
7
  * Author: ThemeGrill
8
  * Author URI: http://themegrill.com
9
  * License: GPLv3 or later
includes/abstracts/abstract-flash-widget.php CHANGED
@@ -182,6 +182,10 @@ abstract class FT_Widget extends WP_Widget {
182
  case 'checkbox' :
183
  $instance[ $key ] = empty( $new_instance[ $key ] ) ? 0 : 1;
184
  break;
 
 
 
 
185
  default:
186
  $instance[ $key ] = isset( $new_instance[ $key ] ) ? flash_clean( $new_instance[ $key ] ) : '';
187
  break;
@@ -235,6 +239,15 @@ abstract class FT_Widget extends WP_Widget {
235
  <?php
236
  break;
237
 
 
 
 
 
 
 
 
 
 
238
  case 'select' :
239
  ?>
240
  <p>
@@ -323,7 +336,7 @@ abstract class FT_Widget extends WP_Widget {
323
  ?>
324
  <div id="tg-widget-icon-picker" class="flash-icon <?php echo esc_attr( $class ); ?>">
325
  <p><label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo esc_html( $setting['label'] ); ?></label></p>
326
- <select class="widefat flash-enhanced-select-icons" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" data-placeholder="<?php esc_attr_e( 'Choose icons&hellip;', 'flash-toolkit' ); ?>" title="<?php esc_attr_e( 'Icon', 'flash-toolkit' ) ?>">
327
  <option value=""></option>
328
  <?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
329
  <option value="<?php echo esc_attr( $option_key ); ?>" data-icon="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
@@ -465,7 +478,7 @@ abstract class FT_Widget extends WP_Widget {
465
  ?>
466
  <div id="tg-widget-icon-picker" class="flash-icon <?php echo esc_attr( $class ); ?>">
467
  <p><label for="<?php echo $field_id; ?>"><?php echo esc_html( $setting['label'] ); ?></label></p>
468
- <select class="widefat flash-enhanced-select-icons" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo $field_name; ?>" data-placeholder="<?php esc_attr_e( 'Choose icons&hellip;', 'flash-toolkit' ); ?>" title="<?php esc_attr_e( 'Icon', 'flash-toolkit' ) ?>">
469
  <option value=""></option>
470
  <?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
471
  <option value="<?php echo esc_attr( $option_key ); ?>" data-icon="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
182
  case 'checkbox' :
183
  $instance[ $key ] = empty( $new_instance[ $key ] ) ? 0 : 1;
184
  break;
185
+ case 'datetimepicker' :
186
+ $sanitized_date = DateTime::createFromFormat( "Y-m-d H:i", $new_instance[ $key ] );
187
+ $instance[ $key ] = $sanitized_date->format("Y-m-d H:i");
188
+ break;
189
  default:
190
  $instance[ $key ] = isset( $new_instance[ $key ] ) ? flash_clean( $new_instance[ $key ] ) : '';
191
  break;
239
  <?php
240
  break;
241
 
242
+ case 'datetimepicker' :
243
+ ?>
244
+ <p>
245
+ <label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo $setting['label']; ?></label>
246
+ <input class="widefat flash-datetime-picker <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
247
+ </p>
248
+ <?php
249
+ break;
250
+
251
  case 'select' :
252
  ?>
253
  <p>
336
  ?>
337
  <div id="tg-widget-icon-picker" class="flash-icon <?php echo esc_attr( $class ); ?>">
338
  <p><label for="<?php echo $this->get_field_id( $key ); ?>"><?php echo esc_html( $setting['label'] ); ?></label></p>
339
+ <select class="widefat flash-enhanced-select-icons" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo $this->get_field_name( $key ); ?>" data-placeholder="<?php esc_attr_e( 'Choose icons&hellip;', 'flash-toolkit' ); ?>" title="<?php esc_attr_e( 'Icon', 'flash-toolkit' ) ?>" style="width: 100%">
340
  <option value=""></option>
341
  <?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
342
  <option value="<?php echo esc_attr( $option_key ); ?>" data-icon="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
478
  ?>
479
  <div id="tg-widget-icon-picker" class="flash-icon <?php echo esc_attr( $class ); ?>">
480
  <p><label for="<?php echo $field_id; ?>"><?php echo esc_html( $setting['label'] ); ?></label></p>
481
+ <select class="widefat flash-enhanced-select-icons" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo $field_name; ?>" data-placeholder="<?php esc_attr_e( 'Choose icons&hellip;', 'flash-toolkit' ); ?>" title="<?php esc_attr_e( 'Icon', 'flash-toolkit' ) ?>" style="width: 100%">
482
  <option value=""></option>
483
  <?php foreach ( $setting['options'] as $option_key => $option_value ) : ?>
484
  <option value="<?php echo esc_attr( $option_key ); ?>" data-icon="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $value ); ?>><?php echo esc_html( $option_value ); ?></option>
includes/admin/class-flash-admin-assets.php CHANGED
@@ -42,6 +42,7 @@ class FT_Admin_Assets {
42
  // Register admin styles.
43
  wp_register_style( 'font-awesome', FT()->plugin_url() . '/assets/css/fontawesome.css', array(), '4.6.3' );
44
  wp_register_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
 
45
  wp_register_style( 'flash-toolkit-menu', FT()->plugin_url() . '/assets/css/menu.css', array(), FT_VERSION );
46
  wp_register_style( 'flash-toolkit-admin', FT()->plugin_url() . '/assets/css/admin.css', array(), FT_VERSION );
47
  wp_register_style( 'flash-toolkit-admin-widgets', FT()->plugin_url() . '/assets/css/widgets.css', array( 'font-awesome' ), FT_VERSION );
@@ -57,6 +58,7 @@ class FT_Admin_Assets {
57
 
58
  // Widgets Specific enqueue.
59
  if ( in_array( $screen_id, array( 'widgets', 'customize' ) ) ) {
 
60
  wp_enqueue_style( 'flash-toolkit-admin-widgets' );
61
  }
62
  }
@@ -70,12 +72,13 @@ class FT_Admin_Assets {
70
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
71
 
72
  // Register admin scripts.
 
73
  wp_register_script( 'flash-toolkit-admin', FT()->plugin_url() . '/assets/js/admin/admin' . $suffix . '.js', array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), FT_VERSION );
74
  wp_register_script( 'flash-toolkit-admin-widgets', FT()->plugin_url() . '/assets/js/admin/widgets' . $suffix . '.js', array( 'jquery', 'jquery-ui-sortable', 'wp-util', 'underscore', 'backbone', 'flash-enhanced-select' ), FT_VERSION );
75
  wp_register_script( 'flash-toolkit-admin-sidebars', FT()->plugin_url() . '/assets/js/admin/sidebars' . $suffix . '.js', array( 'jquery' ), FT_VERSION );
76
  wp_register_script( 'flash-toolkit-admin-meta-boxes', FT()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'jquery-tiptip', 'flash-enhanced-select' ), FT_VERSION );
77
  wp_register_script( 'jquery-tiptip', FT()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), FT_VERSION, true );
78
- wp_register_script( 'select2', FT()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.4' );
79
  wp_register_script( 'flash-enhanced-select', FT()->plugin_url() . '/assets/js/admin/enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), FT_VERSION );
80
  wp_localize_script( 'flash-enhanced-select', 'flash_enhanced_select_params', array(
81
  'i18n_matches_1' => _x( 'One result is available, press enter to select it.', 'enhanced select', 'flash-toolkit' ),
@@ -116,6 +119,7 @@ class FT_Admin_Assets {
116
  // Widgets Specific enqueue.
117
  if ( in_array( $screen_id, array( 'widgets', 'customize' ) ) ) {
118
  wp_enqueue_media();
 
119
  wp_enqueue_script( 'flash-toolkit-admin-widgets' );
120
 
121
  if ( 'widgets' === $screen_id && is_flash_pro_active() ) {
@@ -133,6 +137,8 @@ class FT_Admin_Assets {
133
  * Enqueue siteorigin panel scripts.
134
  */
135
  public function siteorigin_panel_scripts() {
 
 
136
  wp_enqueue_style( 'flash-toolkit-admin-widgets' );
137
  wp_enqueue_script( 'flash-toolkit-admin-widgets' );
138
  }
42
  // Register admin styles.
43
  wp_register_style( 'font-awesome', FT()->plugin_url() . '/assets/css/fontawesome.css', array(), '4.6.3' );
44
  wp_register_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
45
+ wp_register_style( 'jquery-ui-timepicker-addon', FT()->plugin_url() . '/assets/css/jquery-ui-timepicker-addon.css', array( 'jquery-ui-style' ), '1.6.3' );
46
  wp_register_style( 'flash-toolkit-menu', FT()->plugin_url() . '/assets/css/menu.css', array(), FT_VERSION );
47
  wp_register_style( 'flash-toolkit-admin', FT()->plugin_url() . '/assets/css/admin.css', array(), FT_VERSION );
48
  wp_register_style( 'flash-toolkit-admin-widgets', FT()->plugin_url() . '/assets/css/widgets.css', array( 'font-awesome' ), FT_VERSION );
58
 
59
  // Widgets Specific enqueue.
60
  if ( in_array( $screen_id, array( 'widgets', 'customize' ) ) ) {
61
+ wp_enqueue_style( 'jquery-ui-timepicker-addon' );
62
  wp_enqueue_style( 'flash-toolkit-admin-widgets' );
63
  }
64
  }
72
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
73
 
74
  // Register admin scripts.
75
+ wp_register_script( 'jquery-ui-timepicker-addon', FT()->plugin_url() . '/assets/js/admin/jquery-ui-timepicker-addon' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-core' ), '1.6.3' );
76
  wp_register_script( 'flash-toolkit-admin', FT()->plugin_url() . '/assets/js/admin/admin' . $suffix . '.js', array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), FT_VERSION );
77
  wp_register_script( 'flash-toolkit-admin-widgets', FT()->plugin_url() . '/assets/js/admin/widgets' . $suffix . '.js', array( 'jquery', 'jquery-ui-sortable', 'wp-util', 'underscore', 'backbone', 'flash-enhanced-select' ), FT_VERSION );
78
  wp_register_script( 'flash-toolkit-admin-sidebars', FT()->plugin_url() . '/assets/js/admin/sidebars' . $suffix . '.js', array( 'jquery' ), FT_VERSION );
79
  wp_register_script( 'flash-toolkit-admin-meta-boxes', FT()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'jquery-tiptip', 'flash-enhanced-select' ), FT_VERSION );
80
  wp_register_script( 'jquery-tiptip', FT()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), FT_VERSION, true );
81
+ wp_register_script( 'select2', FT()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
82
  wp_register_script( 'flash-enhanced-select', FT()->plugin_url() . '/assets/js/admin/enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), FT_VERSION );
83
  wp_localize_script( 'flash-enhanced-select', 'flash_enhanced_select_params', array(
84
  'i18n_matches_1' => _x( 'One result is available, press enter to select it.', 'enhanced select', 'flash-toolkit' ),
119
  // Widgets Specific enqueue.
120
  if ( in_array( $screen_id, array( 'widgets', 'customize' ) ) ) {
121
  wp_enqueue_media();
122
+ wp_enqueue_script( 'jquery-ui-timepicker-addon' );
123
  wp_enqueue_script( 'flash-toolkit-admin-widgets' );
124
 
125
  if ( 'widgets' === $screen_id && is_flash_pro_active() ) {
137
  * Enqueue siteorigin panel scripts.
138
  */
139
  public function siteorigin_panel_scripts() {
140
+ wp_enqueue_style( 'jquery-ui-timepicker-addon' );
141
+ wp_enqueue_script( 'jquery-ui-timepicker-addon' );
142
  wp_enqueue_style( 'flash-toolkit-admin-widgets' );
143
  wp_enqueue_script( 'flash-toolkit-admin-widgets' );
144
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ThemeGrill, shivapoudel
3
  Tags: theme, flash, toolkit, themegrill
4
  Requires at least: 4.0
5
  Tested up to: 4.6
6
- Stable tag: 1.1.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -32,6 +32,9 @@ Get free support at http://themegrill.com/support-forum/
32
 
33
  == Changelog ==
34
 
 
 
 
35
  = 1.1.0 =
36
  * Feature - Integration with Flash Pro version
37
 
3
  Tags: theme, flash, toolkit, themegrill
4
  Requires at least: 4.0
5
  Tested up to: 4.6
6
+ Stable tag: 1.1.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
32
 
33
  == Changelog ==
34
 
35
+ = 1.1.1 =
36
+ * Fix - Updated select2.js to 4.0.3
37
+
38
  = 1.1.0 =
39
  * Feature - Integration with Flash Pro version
40