Customify – A Theme Customizer Booster - Version 1.5.7

Version Description

  • Improved development logic for easier testing
  • Improved and fixed reset settings buttons
  • Fixed a couple of styling inconsistencies regarding the Customizer
Download this release

Release Info

Developer pixelgrade
Plugin Icon Customify – A Theme Customizer Booster
Version 1.5.7
Comparing to
See all releases

Code changes from version 1.5.6 to 1.5.7

+development.rb DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # run compass compiler
4
- puts 'Compass/Sass now running in the background.'
5
- Kernel.exec('sass --watch --compass --sourcemap scss:css --style expanded -E utf-8 2> /dev/null')
 
 
 
 
 
+production.rb DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # change to script
4
- Dir.chdir File.expand_path(File.dirname(__FILE__))
5
- # run compass compiler
6
- Kernel.exec('sass --compass --force --update scss:css --style expanded -E utf-8 2> /dev/null')
 
 
 
 
 
 
README.md DELETED
@@ -1,469 +0,0 @@
1
- Customify [![Build Status](https://travis-ci.org/pixelgrade/customify.svg?branch=wporg)](https://travis-ci.org/pixelgrade/customify) [![Code Climate](https://lima.codeclimate.com/github/pixelgrade/customify/badges/gpa.svg)](https://lima.codeclimate.com/github/pixelgrade/customify) [![Issue Count](https://lima.codeclimate.com/github/pixelgrade/customify/badges/issue_count.svg)](https://lima.codeclimate.com/github/pixelgrade/customify)
2
- ========
3
- **A Theme Customizer Booster**
4
-
5
- With Customify, you can easily add Fonts, Colors, Live CSS Editor and other options to your theme.
6
-
7
- ### How to use it?
8
-
9
- First you need to install and activate the stable version. This will always be on [wordpress.org](https://wordpress.org/plugins/customify/)
10
-
11
- Now go to ‘Appearance -> Customize’ menu and have fun with the new fields.
12
-
13
- ### Make your own customizer
14
-
15
- So this plugin adds some fields in customizer, no big deal right? How about adding your own customizer fields?
16
-
17
- The Customify [$config](#about_config_var) can be filtered by any theme and this is how you do it, include this filter in your theme(probably in functions.php)
18
-
19
- ```
20
- // Advice: change this function's name and make sure it is unique
21
-
22
- add_filter('customify_filter_fields', 'make_this_function_name_unique' );
23
-
24
- function make_this_function_name_unique( $config ) {
25
-
26
- // usually the sections key will be here, but a check won't hurt
27
- if ( ! isset($config['sections']) ) {
28
- $config['sections'] = array();
29
- }
30
-
31
- // this means that we add a new entry named "theme_added_settings" in the sections area
32
- $config['sections']['theme_added_settings'] = array(
33
- 'title' => 'Section added dynamically',
34
- 'settings' => array(
35
-
36
- // this is the field id and it must be unique
37
- 'field_example' => array(
38
- 'type' => 'color', // there is a list of types below
39
- 'label' => 'Body color', // the label is optional but is nice to have one
40
- 'css' => array(
41
-
42
- // the CSS key is the one which controls the output of this field
43
- array(
44
- // a CSS selector
45
- 'selector' => '#logo',
46
- // the CSS property which should be affected by this field
47
- 'property' => 'background-color',
48
- )
49
-
50
- // repeat this as long as you need
51
- array(
52
- 'selector' => 'body',
53
- 'property' => 'color',
54
- )
55
- )
56
- )
57
- )
58
- );
59
-
60
- // when working with filters always return filtered value
61
- return $config;
62
- }
63
- ```
64
-
65
- The Customify plugin also create's its own defaults this way. You can see that in `customify/customify_config.php`
66
- Personally I like to simply copy this file in my child theme and include it in `functions.php` with
67
-
68
- `require 'customify_config.php'`
69
-
70
- And after that the sky is the limit, I can style any elements or group of elements in customizer.
71
-
72
- The intro is over let's get to some advanced stuff.
73
-
74
- # List of fields
75
-
76
- Fields<a name="list_of_fields"></a> | [Live Preview Support!](#live_preview_support) | Description
77
- ------------- | ------------- | -------------
78
- Text | Yes [with classes](#live_preview_with_classes) | A simple text input
79
- Textarea | Yes [with classes](#live_preview_with_classes) | A simple text area input
80
- Ace Editor | Yes [with classes](#live_preview_with_classes) | An ace editor that supports plain_text / css / html / javascript / json / markdown
81
- Color | Yes | A simple color picker
82
- Range | Yes | The default html5 range input
83
- Font | Custom Live Preview | A complete font selector with Live Preview, google fonts, filtrable theme fonts and custom callbacks
84
- Typography | No | This is a font selector but it will be soon depricated, use Font instead
85
- Select | No | The standard HTML select
86
- Radio | No |
87
- Checkbox | No |
88
- Upload | No | This field allows you to upload a file which you can use it later in front-end
89
- Image | No | This is like the upload field, but it accepts only images
90
- Date | No |
91
- Pages select | No | The standard WordPress Page Select
92
- [Select2](https://select2.github.io/) | No | An awesome select
93
- [Presets](#presets_title) | No | An radio input option to select a group of options (inception style ^^)
94
-
95
- # Advanced Things
96
-
97
- ### The $config variable<a name="about_config_var"></a> ###
98
-
99
- This is the array which is processed by the `customify_filter_fields` filter and it contains:
100
- * 'sections' an array with sections(each section holds an array with fields)
101
- * 'panels' an array of panels( each panel holds an array with sections)
102
- * 'opt-name' the option key name which will hold all these options
103
-
104
- ### Media queries<a name="media_query_config"></a>
105
-
106
- The `css` configuration can also hold a `media` parameter which will make the output of the CSS property, to wrap in the specified media query, for example:
107
-
108
- ```
109
- 'site_title_size' => array(
110
- 'type' => 'range',
111
- 'label' => 'Site Title Size',
112
- 'default' => 24,
113
- 'css' => array(
114
- array(
115
- 'property' => 'font-size',
116
- 'selector' => '.site-title',
117
- 'media' => 'screen and (min-width: 1000px)'
118
- )
119
- )
120
- )
121
- ```
122
-
123
- This will make the property take effect only on screens larger than 1000px, because on mobile devices you may not want a bigger logo.
124
-
125
- ### Field callbacks<a name="callback_example"></a>
126
-
127
- Each field can take a 'callback_filter' parameter.This should be a function name which should be called when a field is changed.
128
-
129
- For example let's take this range field:
130
- ```
131
- 'sidebar_width' => array(
132
- 'type' => 'range',
133
- 'label' => 'Sidebar width',
134
- 'input_attrs' => array(
135
- 'min' => 60,
136
- 'max' => 320,
137
- 'step' => 60,
138
- ),
139
- 'css' => array(
140
- array(
141
- 'selector' => 'span.col',
142
- 'property' => 'width',
143
- 'unit' => 'px',
144
- 'callback_filter' => 'this_setting_can_call_this_function'
145
- )
146
- )
147
- )
148
-
149
- ```
150
-
151
- Now let's create a callback which multiplies the effect of this css property
152
- Let's say that we want the sidebar to grow faster in length and double its value when the slider is changed
153
-
154
- ```
155
- function this_setting_can_call_this_function( $value, $selector, $property, $unit ) {
156
-
157
- $this_property_output = $selector . ' { '. $property .': '. ( $value * 2 ) . $unit . "; } \n";
158
-
159
- return $this_property_output;
160
- }
161
-
162
- ```
163
-
164
- HTML field | No | A field which allows you to add custom HTML in customizer and hook into it with javascript later ;)
165
-
166
- ### Live Preview Support<a name="live_preview_support"></a>
167
-
168
- There are a few fields which support this feature for now, but those are awesome.These fields are capable to update the previewer iframe without refreshing the iframe, the preview should be instant.
169
-
170
- This is recommended for color fields because you won't need to stop drag-and-dropping the color select to see what color would be better.
171
-
172
- **Note<a name="live_preview_with_classes"></a>**
173
- All the text fields have support for a **live preview** but they require an array of classes instead of the boolean `true` for the `live` parameter.
174
-
175
- For example a fields which would provide the copyright text from footer whould be like this:
176
- ```
177
- 'footer_copyright' => array(
178
- 'type' => 'text',
179
- 'label' => 'Footer Copyright'
180
- 'default' => 'All contents &copy; Pixelgrade 2011-2015'
181
- 'sanitize_callback' => 'wp_kses_post',
182
- 'live' => array( '.copyright-class' )
183
- )
184
- ```
185
-
186
- For this example the element with the `.copyright-class` class will get the text replaced as soon as the user types a
187
- new text. I bet this is awesome.
188
-
189
-
190
- ### Conditional fields<a name="conditional_fields"></a>
191
-
192
- Once with 1.2.3 version we've added support for conditional fields. This means that you can use the `show_if` argument
193
- to display a field only when another field has a certain value.
194
-
195
- This [gist](https://gist.github.com/andreilupu/3a71618fb6d2ea2c2b1429544c667cd1) shows how this can be done.
196
-
197
- ### Presets<a name="presets_title"></a>
198
-
199
- Since version 1.1.0 we added support for presets options. With this fields, you can pre-define other options.
200
- Here is and example of how to config this.
201
-
202
- ```
203
- 'theme_style' => array(
204
- 'type' => 'preset',
205
- 'label' => __( 'Select a style:', 'customify' ),
206
- 'desc' => __( 'Conveniently change the design of your site with built-in style presets. Easy as pie.', 'customify' ),
207
- 'default' => 'silk',
208
- 'choices_type' => 'select',
209
- 'choices' => array(
210
- 'silk' => array(
211
- 'label' => __( 'Silk', 'customify' ),
212
- 'options' => array(
213
- 'links_color' => '#FAC2A8', //second
214
- 'headings_color' => '#A84469', //main
215
- 'body_color' => '#ffffff', // -
216
- 'headings_font' => 'Playfair Display', //main
217
- 'body_font' => 'Merriweather'
218
- )
219
- ),
220
- 'red' => array(
221
- 'label' => __( 'Urban', 'customify' ),
222
- 'options' => array(
223
- 'links_color' => 'red',
224
- 'headings_color' => 'red',
225
- 'body_color' => 'red',
226
- 'headings_font' => 'Exo',
227
- 'body_font' => 'Pacifico'
228
- )
229
- ),
230
- 'black' => array(
231
- 'label' => __( 'Black', 'customify' ),
232
- 'options' => array(
233
- 'links_color' => '#ebebeb',
234
- 'headings_color' => '#333',
235
- 'body_color' => '#989898',
236
- 'headings_font' => 'Arvo',
237
- 'body_font' => 'Lora'
238
- )
239
- ),
240
- )
241
- )
242
- ```
243
-
244
- The upper example will output a select which will change all the fields setted up in the `options` array.
245
-
246
- If you don't like the select type, at `choices_type` you can choose between `select`, `button` and an `awesome` radio select which allows you not only change de font-end options but also the preview button style.
247
-
248
- Wanna have a preset like this?
249
-
250
- ![img](https://cloud.githubusercontent.com/assets/1893980/6652930/86b7a1aa-ca88-11e4-8997-ba63be1598d8.png)
251
-
252
- Just add this section in your config
253
-
254
- ```
255
- 'presets_section' => array(
256
- 'title' => __( 'Style Presets', 'customify' ),
257
- 'options' => array(
258
- 'theme_style' => array(
259
- 'type' => 'preset',
260
- 'label' => __( 'Select a style:', 'customify' ),
261
- 'desc' => __( 'Conveniently change the design of your site with built-in style presets. Easy as pie.', 'customify' ),
262
- 'default' => 'royal',
263
- 'choices_type' => 'awesome',
264
- 'choices' => array(
265
- 'royal' => array(
266
- 'label' => __( 'Royal', 'customify' ),
267
- 'preview' => array(
268
- 'color-text' => '#ffffff',
269
- 'background-card' => '#615375',
270
- 'background-label' => '#46414c',
271
- 'font-main' => 'Abril Fatface',
272
- 'font-alt' => 'PT Serif',
273
- ),
274
- 'options' => array(
275
- 'links_color' => '#8eb2c5',
276
- 'headings_color' => '#725c92',
277
- 'body_color' => '#6f8089',
278
- 'page_background' => '#615375',
279
- 'headings_font' => 'Abril Fatface',
280
- 'body_font' => 'PT Serif',
281
- )
282
- ),
283
- 'lovely' => array(
284
- 'label' => __( 'Lovely', 'customify' ),
285
- 'preview' => array(
286
- 'color-text' => '#ffffff',
287
- 'background-card' => '#d15c57',
288
- 'background-label' => '#5c374b',
289
- 'font-main' => 'Playfair Display',
290
- 'font-alt' => 'Playfair Display',
291
- ),
292
- 'options' => array(
293
- 'links_color' => '#cc3747',
294
- 'headings_color' => '#d15c57',
295
- 'body_color' => '#5c374b',
296
- 'page_background' => '#d15c57',
297
- 'headings_font' => 'Playfair Display',
298
- 'body_font' => 'Playfair Display',
299
- )
300
- ),
301
- 'queen' => array(
302
- 'label' => __( 'Queen', 'customify' ),
303
- 'preview' => array(
304
- 'color-text' => '#fbedec',
305
- 'background-card' => '#773347',
306
- 'background-label' => '#41212a',
307
- 'font-main' => 'Cinzel Decorative',
308
- 'font-alt' => 'Gentium Basic',
309
- ),
310
- 'options' => array(
311
- 'links_color' => '#cd8085',
312
- 'headings_color' => '#54323c',
313
- 'body_color' => '#cd8085',
314
- 'page_background' => '#fff',
315
- 'headings_font' => 'Cinzel Decorative',
316
- 'body_font' => 'Gentium Basic',
317
- )
318
- ),
319
- 'carrot' => array(
320
- 'label' => __( 'Carrot', 'customify' ),
321
- 'preview' => array(
322
- 'color-text' => '#ffffff',
323
- 'background-card' => '#df421d',
324
- 'background-label' => '#85210a',
325
- 'font-main' => 'Oswald',
326
- 'font-alt' => 'PT Sans Narrow',
327
- ),
328
- 'options' => array(
329
- 'links_color' => '#df421d',
330
- 'headings_color' => '#df421d',
331
- 'body_color' => '#7e7e7e',
332
- 'page_background' => '#fff',
333
- 'headings_font' => 'Oswald',
334
- 'body_font' => 'PT Sans Narrow',
335
- )
336
- ),
337
- 'adler' => array(
338
- 'label' => __( 'Adler', 'customify' ),
339
- 'preview' => array(
340
- 'color-text' => '#fff',
341
- 'background-card' => '#0e364f',
342
- 'background-label' => '#000000',
343
- 'font-main' => 'Permanent Marker',
344
- 'font-alt' => 'Droid Sans Mono',
345
- ),
346
- 'options' => array(
347
- 'links_color' => '#68f3c8',
348
- 'headings_color' => '#0e364f',
349
- 'body_color' => '#45525a',
350
- 'page_background' => '#ffffff',
351
- 'headings_font' => 'Permanent Marker',
352
- 'body_font' => 'Droid Sans Mono'
353
- )
354
- ),
355
- 'velvet' => array(
356
- 'label' => __( 'Velvet', 'customify' ),
357
- 'preview' => array(
358
- 'color-text' => '#ffffff',
359
- 'background-card' => '#282828',
360
- 'background-label' => '#000000',
361
- 'font-main' => 'Pinyon Script',
362
- 'font-alt' => 'Josefin Sans',
363
- ),
364
- 'options' => array(
365
- 'links_color' => '#000000',
366
- 'headings_color' => '#000000',
367
- 'body_color' => '#000000',
368
- 'page_background' => '#000000',
369
- 'headings_font' => 'Pinyon Script',
370
- 'body_font' => 'Josefin Sans',
371
- )
372
- ),
373
- )
374
- ),
375
- )
376
- )
377
- ```
378
-
379
-
380
- ### Font Selector<a name="font_selector"></a>
381
-
382
- In 1.3.0 We introduced the new font selector, it works with live preview only and it has this possible configs:
383
-
384
- ```
385
- 'headings_font' => array(
386
- 'type' => 'font',
387
- 'label' => esc_html__( 'Headings', 'customify' ),
388
- 'desc' => esc_html__( 'o descriere', 'customify' ),
389
- 'selector' => 'h1, h2, h3, h4, .title, .sub-title',
390
-
391
- // Set the defaults
392
- 'default' => array(
393
- 'font-family' => 'Open Sans',
394
- 'font-weight' => '400',
395
- 'font-size' => 24,
396
- 'line-height' => 1.5,
397
- 'letter-spacing' => 1,
398
- 'text-align' => 'initial',
399
- 'text-transform' => 'uppercase',
400
- 'text-decoration' => 'underline'
401
- ),
402
-
403
- //'load_all_weights' => true,
404
-
405
- 'recommended' => $recommended_headings_fonts, // List of recommended fonts defined by theme
406
-
407
- // Sub Fields Configuration (optional)
408
- 'fields' => array(
409
- 'font-size' => array( // Set custom values for a range slider
410
- 'min' => 10,
411
- 'max' => 40,
412
- 'step' => 1,
413
- 'unit' => 'px',
414
- ),
415
- 'line-height' => array(0, 2, 0.1, ''), // Short-hand version
416
- 'letter-spacing' => array(-1, 4, 0.1, 'em'),
417
- 'text-align' => true, // Disable sub-field (False by default)
418
- 'text-transform' => true,
419
- 'text-decoration'=> true,
420
- ),
421
- 'callback' => 'your_custom_callback_function'
422
- ),
423
- ```
424
-
425
- In the above example you can see the callback parameter, it supports a PHP or Javascript function
426
- which should replace the current output of the font
427
-
428
- ```
429
- function your_custom_callback_function( $value, $font ) {
430
- return $combined_css';
431
- }
432
-
433
- function add_javascript_callback_function() { ?>
434
- <script>
435
- function your_custom_callback_function( $values, field ) {
436
- return $combined_css;
437
- }
438
-
439
- </script>
440
- <?php }
441
- add_action( 'customize_preview_init', 'add_javascript_callback_function' );
442
- ```
443
-
444
-
445
- ### Local Fonts
446
-
447
- Also this font selector comes with the ability to add custom fonts from a theme.
448
- If a theme comes with the name of a font and a stylesheet with its fontface it
449
- will be added as the first option of the font selector
450
- ```
451
- function theme_add_customify_theme_fonts ( $fonts ) {
452
- $fonts['Custom Font'] = array(
453
- 'family' => 'Custom Font',
454
- 'src' => get_template_directory_uri() . '/assets/fonts/custom_font/stylesheet.css',
455
- 'variants' => array( '400', '700' )
456
- );
457
- return $fonts;
458
- }
459
- add_filter( 'customify_theme_fonts', 'theme_add_customify_theme_fonts' );
460
- ```
461
-
462
- ## License
463
-
464
- ## Thanks!
465
- This plugin also includes the following libraries:
466
-
467
- * Select 2 - https://select2.github.io/
468
- * Ace Editor - https://ace.c9.io/
469
- * React jQuery Plugin - https://github.com/natedavisolds/jquery-react
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class-pixcustomify.php CHANGED
@@ -163,8 +163,6 @@ class PixCustomifyPlugin {
163
 
164
  /**
165
  * Register our actions and filters
166
- *
167
- * @return null
168
  */
169
  function register_hooks() {
170
  /*
@@ -239,6 +237,17 @@ class PixCustomifyPlugin {
239
  add_filter( 'default_option_sharing-options', array( $this, 'default_jetpack_sharing_options' ), 10, 1 );
240
 
241
  add_action( 'rest_api_init', array( $this, 'add_rest_routes_api' ) );
 
 
 
 
 
 
 
 
 
 
 
242
  }
243
 
244
  /**
@@ -483,7 +492,7 @@ class PixCustomifyPlugin {
483
  }
484
 
485
  function add_rest_routes_api(){
486
- register_rest_route( 'customfiy/v1', '/delete_theme_mod', array(
487
  'methods' => 'POST',
488
  'callback' => array( $this, 'delete_theme_mod' ),
489
  'permission_callback' => array( $this, 'permission_nonce_callback' ),
@@ -491,9 +500,8 @@ class PixCustomifyPlugin {
491
  }
492
 
493
  function delete_theme_mod(){
494
- $user = wp_get_current_user();
495
- if ( ! $user->caps['administrator'] ) {
496
- wp_send_json_error('no admin');
497
  }
498
 
499
  $config = apply_filters('customify_filter_fields', array() );
@@ -506,7 +514,7 @@ class PixCustomifyPlugin {
506
 
507
  remove_theme_mod( $key );
508
 
509
- wp_send_json_success('Bye bye ' . $key . '!');
510
  }
511
 
512
  function permission_nonce_callback() {
@@ -1198,7 +1206,9 @@ class PixCustomifyPlugin {
1198
  if ( $this->plugin_settings['enable_reset_buttons'] ) {
1199
  // create a toolbar section which will be present all the time
1200
  $reset_section_settings = array(
1201
- 'title' => 'Customify toolbar',
 
 
1202
  'options' => array(
1203
  'reset_all_button' => array(
1204
  'type' => 'button',
@@ -1211,10 +1221,7 @@ class PixCustomifyPlugin {
1211
 
1212
  $wp_customize->add_section(
1213
  'customify_toolbar',
1214
- array(
1215
- 'title' => '',
1216
- 'priority' => 999999999
1217
- )
1218
  );
1219
 
1220
  $wp_customize->add_setting(
@@ -1225,7 +1232,7 @@ class PixCustomifyPlugin {
1225
  $wp_customize,
1226
  'reset_customify',
1227
  array(
1228
- 'label' => __( 'Reset Customify to Defaults', 'customify' ),
1229
  'section' => 'customify_toolbar',
1230
  'settings' => 'reset_customify',
1231
  'action' => 'reset_customify',
@@ -1868,8 +1875,13 @@ class PixCustomifyPlugin {
1868
  * @return bool|null|string
1869
  */
1870
  public function get_option( $option, $default = null, $alt_opt_name = null ) {
1871
-
1872
- $return = $this->get_value( $option, $alt_opt_name );
 
 
 
 
 
1873
 
1874
  if ( $return !== null ) {
1875
  return $return;
@@ -2032,6 +2044,47 @@ class PixCustomifyPlugin {
2032
  return true;
2033
  }
2034
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2035
  /**
2036
  * Return an instance of this class.
2037
  * @since 1.0.0
@@ -2049,7 +2102,7 @@ class PixCustomifyPlugin {
2049
  * @param string $version Version.
2050
  *
2051
  * @see PixCustomifyPlugin()
2052
- * @return object Main PixCustomifyPlugin instance
2053
  */
2054
  public static function instance( $file = '', $version = '1.0.0' ) {
2055
  // If the single instance hasn't been set, set it now.
163
 
164
  /**
165
  * Register our actions and filters
 
 
166
  */
167
  function register_hooks() {
168
  /*
237
  add_filter( 'default_option_sharing-options', array( $this, 'default_jetpack_sharing_options' ), 10, 1 );
238
 
239
  add_action( 'rest_api_init', array( $this, 'add_rest_routes_api' ) );
240
+
241
+ /*
242
+ * Development related
243
+ */
244
+ if ( defined( 'CUSTOMIFY_DEV_FORCE_DEFAULTS' ) && true === CUSTOMIFY_DEV_FORCE_DEFAULTS ) {
245
+ // If the development constant CUSTOMIFY_DEV_FORCE_DEFAULTS has been defined we will not save anything in the database
246
+ // Always go with the default
247
+ add_filter( 'customize_changeset_save_data', array( $this, 'prevent_changeset_save_in_devmode' ), 50, 2 );
248
+ // Add a JS to display a notification
249
+ add_action( 'customize_controls_print_footer_scripts', array( $this, 'prevent_changeset_save_in_devmode_notification' ), 100 );
250
+ }
251
  }
252
 
253
  /**
492
  }
493
 
494
  function add_rest_routes_api(){
495
+ register_rest_route( 'customify/v1', '/delete_theme_mod', array(
496
  'methods' => 'POST',
497
  'callback' => array( $this, 'delete_theme_mod' ),
498
  'permission_callback' => array( $this, 'permission_nonce_callback' ),
500
  }
501
 
502
  function delete_theme_mod(){
503
+ if ( ! current_user_can( 'manage_options' ) ) {
504
+ wp_send_json_error('You don\'t have admin privileges.');
 
505
  }
506
 
507
  $config = apply_filters('customify_filter_fields', array() );
514
 
515
  remove_theme_mod( $key );
516
 
517
+ wp_send_json_success('Deleted ' . $key . ' theme mod!');
518
  }
519
 
520
  function permission_nonce_callback() {
1206
  if ( $this->plugin_settings['enable_reset_buttons'] ) {
1207
  // create a toolbar section which will be present all the time
1208
  $reset_section_settings = array(
1209
+ 'title' => 'Customify Toolbox',
1210
+ 'capability' => 'manage_options',
1211
+ 'priority' => 999999999,
1212
  'options' => array(
1213
  'reset_all_button' => array(
1214
  'type' => 'button',
1221
 
1222
  $wp_customize->add_section(
1223
  'customify_toolbar',
1224
+ $reset_section_settings
 
 
 
1225
  );
1226
 
1227
  $wp_customize->add_setting(
1232
  $wp_customize,
1233
  'reset_customify',
1234
  array(
1235
+ 'label' => __( 'Reset All Customify Options to Default', 'customify' ),
1236
  'section' => 'customify_toolbar',
1237
  'settings' => 'reset_customify',
1238
  'action' => 'reset_customify',
1875
  * @return bool|null|string
1876
  */
1877
  public function get_option( $option, $default = null, $alt_opt_name = null ) {
1878
+ // If the development constant CUSTOMIFY_DEV_FORCE_DEFAULTS has been defined we will not retrieve anything from the database
1879
+ // Always go with the default
1880
+ if ( defined( 'CUSTOMIFY_DEV_FORCE_DEFAULTS' ) && true === CUSTOMIFY_DEV_FORCE_DEFAULTS ) {
1881
+ $return = null;
1882
+ } else {
1883
+ $return = $this->get_value( $option, $alt_opt_name );
1884
+ }
1885
 
1886
  if ( $return !== null ) {
1887
  return $return;
2044
  return true;
2045
  }
2046
 
2047
+ /**
2048
+ * Prevent saving of plugin options in the Customizer
2049
+ *
2050
+ * @param array $data The data to save
2051
+ * @param array $filter_context
2052
+ *
2053
+ * @return array
2054
+ */
2055
+ public function prevent_changeset_save_in_devmode( $data, $filter_context ) {
2056
+ // Get the options key
2057
+ $options_key = $this->customizer_config['opt-name'];
2058
+ if ( ! empty( $options_key ) ) {
2059
+ // Remove any Customify data thus preventing it from saving
2060
+ foreach ( $data as $key => $value ) {
2061
+ if ( false !== strpos( $key, $options_key ) ) {
2062
+ unset( $data[$key] );
2063
+ }
2064
+ }
2065
+ }
2066
+
2067
+ return $data;
2068
+ }
2069
+
2070
+ public function prevent_changeset_save_in_devmode_notification() { ?>
2071
+ <script type="application/javascript">
2072
+ (function ( $, exports, wp ) {
2073
+ 'use strict';
2074
+ // when the customizer is ready add our notification
2075
+ wp.customize.bind('ready', function () {
2076
+ wp.customize.notifications.add( 'customify_force_defaults', new wp.customize.Notification(
2077
+ 'customify_force_defaults',
2078
+ {
2079
+ type: 'warning',
2080
+ message: '<strong style="margin-bottom: ">Customify: Development Mode</strong><p>All the options are switched to default. While they are changing in the live preview, they will not be kept when publish.</p>'
2081
+ }
2082
+ ) );
2083
+ });
2084
+ })(jQuery, window, wp);
2085
+ </script>
2086
+ <?php }
2087
+
2088
  /**
2089
  * Return an instance of this class.
2090
  * @since 1.0.0
2102
  * @param string $version Version.
2103
  *
2104
  * @see PixCustomifyPlugin()
2105
+ * @return PixCustomifyPlugin Main PixCustomifyPlugin instance
2106
  */
2107
  public static function instance( $file = '', $version = '1.0.0' ) {
2108
  // If the single instance hasn't been set, set it now.
css/admin.css CHANGED
@@ -1,29 +1,49 @@
1
  /* This stylesheet is used to style the admin option form of the plugin. */
2
- .extendable_options {
3
- height: 0;
4
- overflow: hidden; }
5
-
6
- fieldset.group {
7
- border-left: 1px solid #333;
8
- padding-left: 20px; }
9
-
10
- .postbox h3.hndle {
11
- padding: 7px;
12
- font-size: 15px; }
13
-
14
- .postbox .row {
15
- width: 100%;
16
- display: inline-block;
17
- padding: 5px 0; }
18
- .postbox .row .field {
 
 
 
 
 
 
 
 
19
  width: 100%;
 
 
 
 
20
  display: inline-block;
21
- padding: 5px 0; }
22
- .postbox .row .group {
23
- border: 1px solid rgba(203, 203, 203, 0.2);
24
- background-color: rgba(203, 203, 203, 0.2);
 
 
 
25
  padding-left: 15px;
26
- margin-left: 5px; }
27
 
28
- .postbox .uninstall_area {
29
- margin-top: 15px; }
 
 
 
 
 
 
1
  /* This stylesheet is used to style the admin option form of the plugin. */
2
+ .extendable_options
3
+ {
4
+ overflow: hidden;
5
+
6
+ height: 0;
7
+ }
8
+
9
+ fieldset.group
10
+ {
11
+ padding-left: 20px;
12
+
13
+ border-left: 1px solid #333;
14
+ }
15
+
16
+ .postbox h3.hndle
17
+ {
18
+ font-size: 15px;
19
+
20
+ padding: 7px;
21
+ }
22
+
23
+ .postbox .row
24
+ {
25
+ display: inline-block;
26
+
27
  width: 100%;
28
+ padding: 5px 0;
29
+ }
30
+ .postbox .row .field
31
+ {
32
  display: inline-block;
33
+
34
+ width: 100%;
35
+ padding: 5px 0;
36
+ }
37
+ .postbox .row .group
38
+ {
39
+ margin-left: 5px;
40
  padding-left: 15px;
 
41
 
42
+ border: 1px solid rgba(203, 203, 203, .2);
43
+ background-color: rgba(203, 203, 203, .2);
44
+ }
45
+
46
+ .postbox .uninstall_area
47
+ {
48
+ margin-top: 15px;
49
+ }
css/customizer.css CHANGED
@@ -1,1220 +1,1949 @@
1
- .wp-full-overlay-sidebar * {
2
- box-sizing: border-box; }
3
-
4
- .accordion-section-content {
5
- overflow: visible; }
6
-
7
- .control-section:not(.control-section-themes) .customize-control {
8
- padding: 0px;
9
- width: 100%;
10
- min-height: initial; }
11
-
12
- #customize-header-actions #customize-save-button-wrapper {
13
- margin-top: 7px; }
14
-
15
- .wp-full-overlay-footer .devices button {
16
- float: left;
17
- border-radius: 0; }
18
-
19
- .customize-controls-close {
20
- width: 48px;
21
- height: 44px;
22
- color: #7da9c3;
23
- background: #ffffff;
24
- border-top: none;
25
- border-right-color: #e0e8ef; }
26
- .customize-controls-close:focus, .customize-controls-close:hover {
27
- background: #f5fcff; }
28
- .customize-controls-close:before {
29
- top: 0px; }
30
-
31
- #customize-controls .customize-info {
32
- border-bottom-color: #e0e8ef; }
33
-
34
- .customize-panel-back, .customize-section-back {
35
- height: 74px;
36
- color: #7da9c3;
37
- border-right-color: #e0e8ef; }
38
- .customize-panel-back:hover, .customize-panel-back:focus, .customize-section-back:hover, .customize-section-back:focus {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  border-left-color: #f5fcff;
40
- background: #f5fcff; }
 
41
 
42
- #customize-theme-controls .theme * {
43
- box-sizing: content-box; }
 
 
44
 
45
- #customize-theme-controls .accordion-section-content {
46
- padding: 17px; }
 
 
47
 
48
- #customize-theme-controls .customize-section-title {
49
- margin-top: -17px;
50
- margin-right: -17px; }
 
 
51
 
52
  #customize-theme-controls .control-panel-content .control-section:nth-child(2),
53
- #customize-theme-controls .control-panel-content .control-section:nth-child(3) {
54
- border-top: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
- #customize-theme-controls .control-panel-content .control-section:nth-last-child(2) {
57
- border-bottom: 1px solid #e0e8ef; }
 
 
 
 
58
 
59
- #customize-theme-controls #accordion-section-add_menu {
60
- border-bottom: none; }
61
- #customize-theme-controls #accordion-section-add_menu .add-menu-toggle {
62
- float: none; }
63
 
64
- #customize-theme-controls .customize-pane-child.open {
65
- height: 100%; }
66
 
67
- #customize-controls .description {
68
- margin-bottom: 9px;
69
- font-size: 12px;
70
- font-weight: 300;
71
- font-style: normal;
72
- line-height: 1.6;
73
- color: #4d7b90;
74
- text-indent: 0; }
75
 
76
- .customize-control-description {
77
- margin-top: 6px; }
 
 
78
 
79
- .customize-control {
80
- margin-bottom: 24px; }
 
 
81
 
82
- #accordion-section-themes + .control-section {
83
- border-top: none; }
 
 
84
 
85
- #customize-controls .panel-meta.customize-info .accordion-section-title {
86
- border-top: none;
87
- height: 74px; }
88
 
89
- .button-controls:after {
90
- content: " ";
91
- display: table;
92
- clear: both; }
 
 
 
 
 
 
93
 
94
  .wp-core-ui .button:not(.theme-details):not(.collapse-sidebar):not(.wp-color-result),
95
  .wp-core-ui .button-primary,
96
- .wp-core-ui .button-secondary {
97
- width: auto;
98
- padding-left: 15px;
99
- padding-right: 15px;
100
- font-weight: 400;
101
- color: #F5FCFF;
102
- text-shadow: none;
103
- border: none;
104
- background: #AED2E5;
105
- box-shadow: 0px 2px 0px 0px #8DBED7;
106
- border-radius: 4px;
107
- transition: all 0.1s; }
108
- .wp-core-ui .button:not(.theme-details):not(.collapse-sidebar):not(.wp-color-result):hover,
109
- .wp-core-ui .button-primary:hover,
110
- .wp-core-ui .button-secondary:hover {
 
 
 
 
 
 
111
  color: white;
 
 
112
  text-shadow: none;
113
- background: #98C6DD;
114
- box-shadow: 0px 2px 0px 0px #74A7C2; }
115
-
116
- .wp-core-ui #customize-header-actions .button-primary {
117
- background: #73C5EE;
118
- box-shadow: 0px 2px 0px 0px #57ABD5; }
119
- .wp-core-ui #customize-header-actions .button-primary:hover {
120
- background: #58B0DD;
121
- box-shadow: 0px 2px 0px 0px #3F8AAF; }
122
- .wp-core-ui #customize-header-actions .button-primary.has-next-sibling {
123
- border-right: 1px solid #57ABD5; }
124
- .wp-core-ui #customize-header-actions .button-primary:disabled {
 
 
 
 
 
 
 
125
  color: white !important;
126
- background: #AED2E5 !important;
127
- opacity: 0.7;
128
- box-shadow: 0px 2px 0px 0px #8db5ca !important; }
129
- .wp-core-ui #customize-header-actions .button-primary:disabled.has-next-sibling {
130
- border-right: none; }
 
 
131
 
132
  .wp-core-ui .reset_section,
133
- .wp-core-ui .reset_panel {
134
- width: 100%;
135
- height: 4em;
136
- display: block;
137
- margin: 0px 0 25px; }
138
-
139
- .wp-core-ui .reset_panel {
140
- margin-top: 10px; }
141
-
142
- .separator.label {
143
- display: block;
144
- font-size: 14px;
145
- line-height: 24px;
146
- font-weight: 600; }
147
-
148
- .customize-control-title, .separator.label {
149
- color: #416B7E; }
150
-
151
- .separator.section:before, .separator.sub-section:before {
152
- content: "";
153
- position: absolute;
154
- top: 0;
155
- bottom: 0;
156
- left: -18px;
157
- right: -18px;
158
- z-index: -1; }
159
-
160
- .separator.label {
161
- font-weight: 500; }
162
-
163
- .separator.large {
164
- margin-top: 12px;
165
- font-size: 16px;
166
- color: #39474D; }
167
-
168
- .separator.section {
169
- position: relative;
170
- padding: 14px 0;
171
- margin-bottom: 0;
172
- background: none;
173
- border: none; }
174
- .separator.section[id*="layout"] {
175
- margin-top: 0; }
176
- .separator.section[id*="layout"]:before {
177
- border: none; }
178
- .separator.section:before {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  border: 1px solid #e0e8ef;
180
- background-color: #ffffff;
181
- box-shadow: 0px 1px 0px 0px #DFE8EF; }
 
 
 
 
 
182
 
183
- .separator.sub-section {
184
- position: relative;
185
- padding: 12px 0; }
186
- .separator.sub-section:before {
187
  border-top: 1px solid #e0e8ef;
188
  border-bottom: 1px solid #e0e8ef;
189
- background-color: #f6fbff; }
190
- .separator.sub-section + span {
 
 
 
 
191
  margin-top: 20px;
192
- font-style: normal; }
193
-
194
- .section-navigation-wrapper {
195
- position: relative;
196
- height: 43px;
197
- margin: -15px -12px 0 -12px;
198
- margin-right: -17px;
199
- margin-left: -17px; }
200
-
201
- .section-navigation {
202
- display: -ms-flexbox;
203
- display: flex;
204
- margin-top: -1px;
205
- clear: both;
206
- border-top: 1px solid #e0e8ef; }
207
- .section-navigation a {
208
- -ms-flex: 1 1 auto;
209
- flex: 1 1 auto;
 
 
 
 
 
 
210
  display: block;
 
211
  padding: 12px 0;
212
- color: #3b484e;
213
- background-color: #ffffff;
214
- border-bottom: 1px solid #e0e8ef;
215
- border-right: 1px solid #e0e8ef;
216
  text-align: center;
217
  text-decoration: none;
218
- transition: background-color .15s ease-in-out; }
219
- .section-navigation a:last-child {
220
- border-right: 0; }
 
 
 
 
 
 
 
 
 
 
221
 
222
  #customize-controls .customize-info.is-sticky.is-sticky,
223
- #customize-controls .customize-section-title.is-sticky.is-sticky {
224
- top: 40px; }
 
 
225
 
226
  #customize-controls .customize-info.is-in-view.is-in-view,
227
- #customize-controls .customize-section-title.is-in-view.is-in-view {
228
- box-shadow: none; }
 
 
229
 
230
  #customize-controls .has-nav .customize-info,
231
- #customize-controls .has-nav .customize-section-title {
232
- margin-right: -12px; }
233
-
234
- #customize-controls .customize-section-title.customize-section-title {
235
- border-bottom: 0; }
236
-
237
- .customize-section-description-container.section-meta.has-nav {
238
- margin-bottom: 0; }
239
-
240
- .font-options__wrapper {
241
- position: relative; }
242
- .font-options__wrapper:after {
243
- content: "";
 
 
 
 
 
 
 
 
244
  position: absolute;
 
245
  top: 90%;
246
- left: 0;
247
  right: 0;
248
- z-index: 0;
 
249
  display: block;
250
- height: 100px; }
251
-
252
- .font-options__head {
253
- display: -ms-flexbox;
254
- display: flex;
255
- -ms-flex-pack: justify;
256
- justify-content: space-between; }
257
- .font-options__head.font-options__head {
 
 
 
 
 
 
 
 
 
 
 
258
  -webkit-appearance: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  text-overflow: ellipsis;
260
- white-space: nowrap; }
261
-
262
- .font-options__font-title {
263
- margin-right: 26px;
264
- margin-left: 10px;
265
- font-size: 12px;
266
- line-height: 20px;
267
- font-weight: 300;
268
- color: #98c6dd;
269
- text-overflow: ellipsis;
270
- overflow: hidden;
271
- white-space: nowrap; }
272
-
273
- .font-options__options-list {
274
- position: absolute;
275
- top: calc(100% + 6px);
276
- left: -6px;
277
- right: -6px;
278
- z-index: 2;
279
- display: block;
280
- padding: 10px;
281
- border: 1px solid #dfe8ef;
282
- border-radius: 5px;
283
- background-color: #ffffff;
284
- opacity: 0;
285
- display: none;
286
- transition: opacity .15s linear; }
287
- .font-options__options-list:last-child {
288
- margin-bottom: 0; }
289
- .font-options__options-list:before, .font-options__options-list:after {
290
- content: "";
291
  position: absolute;
 
292
  top: -20px;
293
  right: 25px;
294
- height: 0;
295
  width: 0;
 
 
 
 
296
  border: solid transparent;
297
- z-index: 10; }
298
- .font-options__options-list:before {
299
- border-bottom-color: white;
 
 
300
  border-width: 10px;
301
- z-index: 11; }
302
- .font-options__options-list:after {
303
- border-bottom-color: rgba(0, 0, 0, 0.075);
304
- border-width: 12px;
305
  top: -24px;
306
- right: 23px; }
307
-
308
- .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap:after {
309
- content: "";
310
- position: absolute;
311
- bottom: 100%;
312
- right: 12px;
313
- border-collapse: separate;
314
- width: 0;
315
- height: 0;
316
- border-width: 0 9px 9px 9px;
317
- border-style: solid;
318
- border-color: transparent transparent #fff transparent; }
319
-
320
- .font-options__head, .customize-control input[type=text],
321
- .customize-control input[type=checkbox],
322
- .customize-control input[type=password],
323
- .customize-control input[type=color],
324
- .customize-control input[type=date],
325
- .customize-control input[type=datetime],
326
- .customize-control input[type=datetime-local],
327
- .customize-control input[type=email],
328
- .customize-control input[type=month],
329
- .customize-control input[type=number],
330
- .customize-control input[type=radio],
331
- .customize-control input[type=tel],
332
- .customize-control input[type=time],
333
- .customize-control input[type=url],
334
- .customize-control input[type=week],
335
- .customize-control input[type=search],
336
- .customize-control select,
337
- .customize-control textarea,
338
- .customize-control input[type="number"].range-value, ul.font-options__options-list .select2-container .select2-selection--single, #customize-theme-controls .select2-container .select2-selection--multiple {
339
- width: 100%;
340
- height: 44px;
341
- padding: 10px 14px;
342
- background: #FFFFFF;
343
- border: 2px solid #B8DAEB;
344
- border-radius: 4px;
345
- font-size: 14px;
346
- line-height: 1.5;
347
- color: #416B7E;
348
- outline: 0; }
349
- .font-options__head:focus, .customize-control input[type=text]:focus,
350
- .customize-control input[type=checkbox]:focus,
351
- .customize-control input[type=password]:focus,
352
- .customize-control input[type=color]:focus,
353
- .customize-control input[type=date]:focus,
354
- .customize-control input[type=datetime]:focus,
355
- .customize-control input[type=datetime-local]:focus,
356
- .customize-control input[type=email]:focus,
357
- .customize-control input[type=month]:focus,
358
- .customize-control input[type=number]:focus,
359
- .customize-control input[type=radio]:focus,
360
- .customize-control input[type=tel]:focus,
361
- .customize-control input[type=time]:focus,
362
- .customize-control input[type=url]:focus,
363
- .customize-control input[type=week]:focus,
364
- .customize-control input[type=search]:focus,
365
- .customize-control select:focus,
366
- .customize-control textarea:focus,
367
- .customize-control input[type="number"].range-value:focus, ul.font-options__options-list .select2-container .select2-selection--single:focus, #customize-theme-controls .select2-container .select2-selection--multiple:focus {
368
- border-color: #73C5EE;
369
- box-shadow: none; }
370
-
371
- .font-options__head, .customize-control select, ul.font-options__options-list .select2-container .select2-selection--single, #customize-theme-controls .select2-container .select2-selection--multiple {
372
- width: 100%;
373
- -webkit-appearance: button;
374
- -moz-appearance: none;
375
- font-weight: 600;
376
- background: white url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE1cHgiIGhlaWdodD0iOXB4IiB2aWV3Qm94PSIwIDAgMTUgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJDdXN0b21pZnktQ29weS0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjU2LjAwMDAwMCwgLTM4Ni4wMDAwMDApIiBmaWxsPSIjOThDNkRFIj4KICAgICAgICAgICAgPGcgaWQ9IkhlYWRlciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgNDcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iQ29udGVudCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCA3NS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iVGl0bGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI2LjAwMDAwMCwgMjE5LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iRmllbGQtLS1TZWxlY3QtQ29weSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iU2VsZWN0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgMjcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTI1NC40ODEyLDE4IEwyNTYsMTkuNTE0IEwyNDguNSwyNyBMMjQxLDE5LjUxNCBMMjQyLjUxODgsMTggTDI0OC41LDIzLjk2NzIgTDI1NC40ODEyLDE4IFoiIGlkPSJQYWdlLTEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) no-repeat;
377
- background-position: right 16px top 16px; }
378
- [multiple].font-options__head, .customize-control select[multiple], ul.font-options__options-list .select2-container [multiple].select2-selection--single, #customize-theme-controls .select2-container [multiple].select2-selection--multiple {
379
- background: white; }
380
-
381
- .customize-control input[type=text],
382
- .customize-control textarea {
383
- font-size: 13px; }
384
-
385
- .customize-control textarea {
386
- height: auto; }
387
-
388
- .customize-control input[type=checkbox],
389
- .customize-control input[type=radio] {
390
- width: 22px;
391
- height: 22px; }
392
- .customize-control input[type=checkbox]:checked,
393
- .customize-control input[type=radio]:checked {
394
- background: #73C5EE;
395
- border-color: #5AB9E8; }
396
- .customize-control input[type=checkbox]:checked:before,
397
- .customize-control input[type=radio]:checked:before {
398
- color: white;
399
- margin: -1px 0 0 -2px; }
400
-
401
- .customize-control.customize-control-checkbox label:not(:only-of-type),
402
- .customize-control.customize-control-checkbox > .customize-inside-control-row:not(:only-of-type), .customize-control.customize-control-radio label:not(:only-of-type),
403
- .customize-control.customize-control-radio > .customize-inside-control-row:not(:only-of-type) {
404
- margin-left: 30px;
405
- padding-top: 0;
406
- padding-bottom: 0;
407
- display: inline-block;
408
- width: calc(49% - 30px);
409
- text-indent: -6px; }
410
-
411
- .customize-control.customize-control-checkbox label, .customize-control.customize-control-radio label {
412
- color: #416B7E; }
413
-
414
- [id*="divider"] + .customize-control.customize-control-checkbox, [id*="divider"] + .customize-control.customize-control-radio {
415
- margin-top: 0; }
416
-
417
- .customize-control input[type=radio] {
418
- border-radius: 50%; }
419
- .customize-control input[type=radio]:checked:before {
420
- content: none; }
421
-
422
- .customize-control-html + .customize-control.customize-control-checkbox {
423
- margin-top: -24px; }
424
-
425
- .customize-control.customize-control-radio label,
426
- .customize-control.customize-control-radio .customize-inside-control-row {
427
- margin-top: 12px; }
428
-
429
- .customize-control.customize-control-radio#customize-control-changeset_status .customize-inside-control-row {
430
- margin-top: 0;
431
- text-indent: 0; }
432
-
433
- .customize-control input[type="range"] {
434
- width: 65%; }
435
-
436
- .customize-control input[type="range"] {
437
- position: relative;
438
- -webkit-appearance: none;
439
- width: calc(100% - 55px);
440
- height: 22px;
441
- overflow: hidden;
442
- outline: none;
443
- background: none; }
444
- .customize-control input[type="range"]:before {
445
- content: " ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  position: absolute;
447
  top: 8px;
448
  left: 0;
449
- height: 6px;
450
  width: 100%;
451
- background: #DFE8EF;
452
- box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.3);
453
- border-radius: 10px; }
454
- .customize-control input[type="range"]::-webkit-slider-thumb {
455
- -webkit-appearance: none;
 
 
 
 
 
 
 
 
456
  width: 22px;
457
  height: 22px;
 
 
 
458
  background: #27ae60;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  position: relative;
460
- z-index: 3;
461
- background: #FFFFFF;
462
- border: 2px solid #B8DAEB;
463
- border-radius: 4px; }
464
- .customize-control input[type="range"]::-webkit-slider-thumb:before {
465
- content: "..";
466
- position: absolute;
467
- left: 5px;
468
- top: -5px;
469
- color: #B8DAEB;
470
- font-size: 1em;
471
- letter-spacing: 1px; }
472
- .customize-control input[type="range"]::-webkit-slider-thumb:after {
473
- content: " ";
474
- width: calc(100% - 55px);
475
- height: 6px;
476
- position: absolute;
477
- z-index: 1;
478
- right: 20px;
479
- top: 6px;
480
- background: #73C5EE; }
481
-
482
- .customize-control input[type="number"].range-value {
483
- min-width: 40px;
484
- max-width: 80px;
485
- width: auto;
486
- height: 30px;
487
- top: -5px;
488
- float: right;
489
- padding: 4px 0px 5px 0px;
490
- margin-left: 10px;
491
- font-size: 13px;
492
- line-height: 1;
493
- text-align: center; }
494
-
495
- .customize-control input[type=number]::-webkit-inner-spin-button,
496
- .customize-control input[type=number]::-webkit-outer-spin-button {
497
- -webkit-appearance: none;
498
- margin: 0; }
499
-
500
- .customize-control-color {
501
- display: block; }
502
- .customize-control-color .customize-control-title, .customize-control-color .separator.label {
503
- float: left; }
504
- .customize-control-color .wp-picker-container {
505
- position: relative;
506
  float: right;
507
- top: -3px; }
508
- .customize-control-color .wp-picker-container .wp-picker-holder {
509
- position: relative; }
510
- .customize-control-color .wp-picker-container .iris-picker {
511
- position: absolute;
512
- top: 40px;
513
- right: 0;
514
- z-index: 1000;
515
- width: 275px !important;
516
- border-top: none;
517
- border-color: #DFDFDE;
518
- border-radius: 0 0 3px 3px;
519
- border: none;
520
- background: white; }
521
- .customize-control-color .wp-picker-container .iris-picker, .customize-control-color .wp-picker-container .iris-picker * {
522
- box-sizing: content-box; }
523
- .customize-control-color .wp-picker-container .iris-picker .iris-square {
524
- width: 215px !important;
525
- height: 173px !important;
526
- margin-right: 0; }
527
- .customize-control-color .wp-picker-container .iris-picker .iris-strip {
528
- float: right;
529
- box-shadow: rgba(0, 0, 0, 0.4) 0 1px 1px inset; }
530
- .customize-control-color .wp-picker-container .iris-picker .iris-strip .ui-slider-handle {
531
- border-color: #aaa !important;
532
- opacity: 1;
533
- box-shadow: none; }
534
- .customize-control-color .wp-picker-container .iris-picker .iris-palette {
535
- width: 24px !important;
536
- height: 24px !important;
537
- border-radius: 50px;
538
- box-shadow: rgba(0, 0, 0, 0.4) 0 1px 1px inset; }
539
- .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap {
540
- position: absolute;
541
- z-index: 1000;
542
- top: 35px;
543
- right: 0;
544
- width: 275px;
545
- padding: 9px 12px;
546
- background: white;
547
- border: none;
548
- border-radius: 3px 3px 0 0; }
549
- .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap input.wp-color-picker {
550
- float: left;
551
- width: 100px;
552
- font-size: 13px;
553
- text-align: left;
554
- margin: 0;
555
- padding: 6px 12px;
556
- height: auto; }
557
- .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap input.button {
558
- float: right;
559
- padding: 4px 12px;
560
- height: 30px; }
561
- .customize-control-color .wp-color-result,
562
- .customize-control-color .wp-color-result.button {
563
  top: 0;
564
- height: 30px;
565
  width: 40px;
 
566
  margin: 0;
567
  padding: 0;
 
 
568
  border-radius: 4px;
569
- background: #2ECC71;
570
- border: 2px solid #B8DAEB;
571
- box-shadow: none; }
572
- .customize-control-color .wp-color-result:after,
573
- .customize-control-color .wp-color-result .wp-color-result-text,
574
- .customize-control-color .wp-color-result.button:after,
575
- .customize-control-color .wp-color-result.button .wp-color-result-text {
576
- display: none; }
577
-
578
- .customize-control-font:last-child {
579
- margin-bottom: 150px; }
580
-
581
- #accordion-section-live_css_edit_section .customize-section-title {
582
- margin-top: -13px;
583
- border-bottom: 1px solid #ddd; }
584
-
585
- #accordion-section-live_css_edit_section #css_editor {
586
- top: 70px;
587
- border-top: 10px solid white;
588
- overflow: visible; }
589
- #accordion-section-live_css_edit_section #css_editor:before {
590
- content: "";
591
- width: 48px;
592
- height: 10px;
593
- display: block;
594
- background: #e8e8e8;
595
- top: -10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  position: absolute;
597
  z-index: 10000000;
598
- left: 0; }
 
 
 
 
 
 
599
 
600
- #accordion-section-live_css_edit_section .ace_scroller {
601
- padding-left: 10px; }
602
 
603
- .wp-full-overlay.editor_opened {
604
- margin-left: 500px; }
605
- .wp-full-overlay.editor_opened #customize-controls {
606
- width: 500px; }
607
- .wp-full-overlay.editor_opened.collapsed #customize-controls {
608
- width: 300px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
 
610
  .customize-control-media .current,
611
  .customize-control-site_icon .current,
612
- li#customize-control-site_logo .current {
613
- margin-bottom: 10px;
614
- min-height: 44px;
615
- background: #F5FCFF;
616
- border: 2px solid #B8DAEB;
617
- border-radius: 4px; }
618
- .customize-control-media .current .container, .customize-control-media .current span,
619
- .customize-control-site_icon .current .container,
620
- .customize-control-site_icon .current span,
621
- li#customize-control-site_logo .current .container,
622
- li#customize-control-site_logo .current span {
623
- border: none; }
624
-
625
- .customize-control-media .inner, .customize-control-media .current span,
 
 
 
 
 
 
 
626
  .customize-control-site_icon .inner,
627
  .customize-control-site_icon .current span,
628
  li#customize-control-site_logo .inner,
629
- li#customize-control-site_logo .current span {
630
- font-size: 13px;
631
- color: #98C6DD; }
 
 
 
632
 
633
  .customize-control-media .inner,
634
  .customize-control-site_icon .inner,
635
- li#customize-control-site_logo .inner {
636
- line-height: 1.4; }
 
 
637
 
638
  .customize-control-media .thumbnail-image,
639
  .customize-control-site_icon .thumbnail-image,
640
- li#customize-control-site_logo .thumbnail-image {
641
- padding: 14px;
642
- text-align: center; }
643
- .customize-control-media .thumbnail-image img,
644
- .customize-control-site_icon .thumbnail-image img,
645
- li#customize-control-site_logo .thumbnail-image img {
646
- width: auto; }
 
 
 
 
 
647
 
648
  .customize-control-media .actions,
649
  .customize-control-site_icon .actions,
650
- li#customize-control-site_logo .actions {
651
- margin-bottom: 0; }
652
-
653
- .customize-control-typography select, .customize-control-typography select {
654
- margin-bottom: 10px; }
655
-
656
- .customize-control-typography .description, .customize-control-typography .description {
657
- margin-top: -3px; }
658
-
659
- .customize-control-typography ul li, .customize-control-typography ul li {
660
- width: 100%;
661
- margin: 0; }
662
-
663
- .default-preset-button {
664
- background-color: #F5F6F6;
665
- float: right;
666
- padding: 1px 8px;
667
- border-radius: 3px;
668
- border: 1px solid #CBCBCB;
669
- margin-right: 4px;
670
- font-family: "Open Sans",sans-serif;
671
- font-size: 13px; }
672
-
673
- .customize-control-preset .description {
674
- margin-right: 5px;
675
- font-style: normal; }
676
-
677
- .customify_preset.radio_buttons .customify_radio_button {
678
- border: none;
679
- display: inline-block;
680
- padding: 2px;
681
- margin: 3px;
682
- position: relative;
683
- overflow: hidden;
684
- height: auto; }
685
- .customify_preset.radio_buttons .customify_radio_button input[type="radio"] {
686
- opacity: 0;
687
  width: 100%;
688
- height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  position: absolute;
690
- z-index: 9999; }
691
- .customify_preset.radio_buttons .customify_radio_button input[type="radio"]:checked + label {
692
- background-color: #ebebeb; }
693
- .customify_preset.radio_buttons .customify_radio_button input[type="radio"]:checked + label:before {
694
- content: '>';
695
- color: inherit; }
696
- .customify_preset.radio_buttons .customify_radio_button input[type="radio"]:checked + label:after {
697
- content: '<';
698
- color: inherit; }
699
- .customify_preset.radio_buttons .customify_radio_button input[type="radio"]:checked:before {
700
- opacity: 0; }
701
- .customify_preset.radio_buttons .customify_radio_button label {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  position: relative;
703
  z-index: 999;
704
- border-left: 4px solid; }
705
-
706
- .customify_preset .awesome_preset {
707
- width: 45%;
708
- position: relative;
709
- display: inline-block;
710
- text-align: center;
711
- color: white;
712
- margin-top: 5px;
713
- margin-bottom: 25px;
714
- transition: all 0.2s; }
715
- .customify_preset .awesome_preset:hover {
716
- opacity: 0.9; }
717
- .customify_preset .awesome_preset:before {
718
- content: '';
 
 
 
 
 
 
 
 
 
 
719
  position: absolute;
 
720
  top: 1px;
721
- left: 1px;
722
  right: 1px;
723
  bottom: 1px;
724
- border: 1px solid #FFF;
725
- background: transparent;
 
 
726
  opacity: .5;
 
727
  border-radius: 4px;
728
- z-index: 5; }
729
- .customify_preset .awesome_preset .preset-wrap .preset-color {
 
 
730
  height: 128px;
 
 
731
  border-radius: 4px 4px 0 0;
732
- padding: 17px 0 27px; }
733
- .customify_preset .awesome_preset .preset-wrap .preset-color .first-font {
734
- display: inline-block;
735
- width: 100%;
736
- font-size: 55px;
737
- line-height: 1; }
738
- .customify_preset .awesome_preset .preset-wrap .preset-color .secondary-font {
739
- display: inline-block;
740
- width: 100%;
741
- font-size: 20px;
742
- line-height: 1;
743
- margin-top: 8px; }
744
- .customify_preset .awesome_preset .preset-wrap .preset-name {
745
- position: relative;
 
 
 
 
 
 
 
 
746
  font-size: 11px;
 
 
 
 
 
747
  text-transform: UPPERCASE;
 
748
  border-radius: 0 0 4px 4px;
749
- padding: 1px; }
750
- .customify_preset .awesome_preset .preset-wrap .preset-name:before {
751
- content: '';
752
- position: absolute;
753
- border-color: inherit;
754
- border: 10px solid;
755
- border-left-color: transparent;
756
- border-right-color: transparent;
757
- border-top: transparent;
758
- top: -10px;
759
- border-bottom-color: inherit;
760
- left: 40%; }
761
- .customify_preset .awesome_preset:nth-child(odd) {
762
- margin-right: 7%; }
763
- .customify_preset .awesome_preset input[type=radio] {
764
- height: 100%;
765
- width: 100%;
766
  position: absolute;
767
- border: 0;
768
- box-shadow: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
769
  color: #006505;
770
- background-color: transparent;
771
  border-radius: 0;
772
- margin: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
773
  display: inline-block;
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  top: 0;
 
 
775
  left: 0;
776
- z-index: 10; }
777
- .customify_preset .awesome_preset input[type=radio]:checked:before {
778
- position: absolute;
779
- height: 25px;
780
- width: 25px;
781
- top: -13px;
782
- right: -14px;
783
- background: #FFF;
784
- z-index: 1; }
785
- .customify_preset .awesome_preset input[type=radio]:checked:after {
786
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
787
- filter: alpha(opacity=0);
788
- content: '';
789
- position: absolute;
790
- width: 26px;
791
- height: 26px;
792
- border-radius: 50%;
793
- top: -5px;
794
- right: -5px;
795
- z-index: 10;
796
- background: #73C5EE url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjEzcHgiIGhlaWdodD0iOXB4IiB2aWV3Qm94PSIwIDAgMTMgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJDdXN0b21pZnktQ29weSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgLTQwOC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPGcgaWQ9IkhlYWRlciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgNDcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iQ29udGVudCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCA3NS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iRmllbGQtLS1DaGVja2JveC1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNy4wMDAwMDAsIDI0OS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICAgICAgPGcgaWQ9IkNoZWNrYm94IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgMzAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTAuMDM4NDk1LDE2IEwxNy4xMTYxMzc1LDguOTIxNDg3NiBMMTUuMTk0NjQ5OCw3IEwxMC4wMzg0OTUsMTIuMTU1MDY3NCBMNi45MjE0ODc2LDkuMDM4OTI5OTcgTDUsMTAuOTYwNDE3NiBMMTAuMDM4NDk1LDE2IFoiIGlkPSJQYWdlLTEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) no-repeat;
797
- background-position: center center; }
798
-
799
- .customify_radio_image {
800
- display: inline-block; }
801
- .customify_radio_image label {
802
  display: block;
803
- float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
  margin-right: 10px;
805
- position: relative; }
806
- .customify_radio_image label input[type=radio] {
807
- position: absolute;
808
- top: 0;
809
- bottom: 0;
810
- left: 0;
811
- right: 0;
812
- width: 100%;
813
- height: 100%;
814
- visibility: hidden; }
815
- .customify_radio_image label input[type=radio] img {
816
- cursor: pointer;
817
- border: 2px solid transparent; }
818
- .customify_radio_image label input[type=radio]:checked + img {
819
- border: 3px solid #73C5EE; }
820
-
821
- .customify_ace_editor {
822
- display: block;
823
- min-height: 200px;
824
- border: 1px solid #ddd; }
825
-
826
- .customize-control-custom_background .hide {
827
- display: none; }
828
-
829
- .customize-control-custom_background .upload_button_div {
830
- margin: 10px 0; }
831
- .customize-control-custom_background .upload_button_div > * {
832
- margin-right: 10px; }
833
-
834
- .customize-control-custom_background .preview_screenshot {
835
- text-align: center;
836
- margin: 10px 0; }
837
- .customize-control-custom_background .preview_screenshot img {
838
- border: 2px solid #ccc; }
839
-
840
- #customify_import_demo_data_button {
841
- width: 70%;
842
- text-align: center;
843
- padding: 10px;
844
- display: inline-block;
845
- height: auto;
846
- margin: 0 15% 10% 15%; }
847
-
848
- .import_step_note {
849
- margin: 5px;
850
- width: 100%;
851
- display: inline-block; }
852
- .import_step_note:before {
853
- content: "\1F449"; }
854
- .import_step_note.success:before {
855
- content: "\1F44D"; }
856
- .import_step_note.failed:before {
857
- content: "\274C"; }
858
-
859
- #customize-header-actions {
860
- background: #ffffff;
861
- border-color: #e0e8ef; }
862
 
863
  .wp-full-overlay-sidebar,
864
  .customize-themes-panel,
865
- #customize-sidebar-outer-content {
866
- background: #eaf9fe;
867
- border-right: 1px solid #e0e8ef; }
 
 
868
 
869
  .outer-section-open #customize-controls .wp-full-overlay-sidebar-content,
870
- .attachment-media-view, .media-widget-preview.media_audio, .media-widget-preview.media_image {
871
- background: #eaf9fe; }
872
-
873
- #customize-theme-controls #accordion-section-menu_locations {
874
- border-bottom: 1px solid #e0e8ef; }
875
-
876
- #customize-controls #accordion-section-themes > .accordion-section-title {
877
- font-weight: 600;
878
- border-bottom: 1px solid #e0e8ef; }
879
- #customize-controls #accordion-section-themes > .accordion-section-title:hover {
880
- background: #fff; }
881
-
882
- #customize-controls .panel-meta.customize-info {
883
- border-bottom-color: #e0e8ef; }
884
-
885
- #customize-theme-controls .control-section .accordion-section-title {
886
- font-weight: 400;
887
- border-top: 1px solid #e0e8ef;
888
- border-bottom: none; }
889
-
890
- #customize-theme-controls .control-section:last-of-type > .accordion-section-title {
891
- border-bottom: 1px solid #e0e8ef; }
892
-
893
- #customize-theme-controls .customize-section-title {
894
- border-top: 1px solid #e0e8ef;
895
- border-bottom: 1px solid #e0e8ef; }
896
-
897
- #customize-controls .control-section .accordion-section-title:focus, #customize-controls .control-section .accordion-section-title:hover, #customize-controls .control-section.open .accordion-section-title, #customize-controls .control-section:hover > .accordion-section-title {
898
- color: #056184;
899
- background: #f5fcff;
900
- border-left-color: #f5fcff; }
901
-
902
- .wp-customizer {
903
- /* SECTION: NAV MENUS */ }
904
- .wp-customizer .menu-item-edit-active .menu-item-handle, .wp-customizer .section-open .menu-item-settings, .wp-customizer .menu-item-bar .menu-item-handle:hover {
905
- border-color: #e0e8ef; }
906
- .wp-customizer .section-open .menu-item-settings {
907
- background: #f5fcff; }
908
- .wp-customizer .control-section-nav_menu .menu-location-settings {
909
- border-top-color: #e0e8ef !important; }
910
-
911
- [data-balloon] {
912
- position: relative; }
913
-
914
- [data-balloon]::before {
915
- opacity: 0;
916
- pointer-events: none;
917
- transition: all .18s ease-out;
918
- background: rgba(17, 17, 17, 0.9);
919
- border-radius: 4px;
920
- color: #fff;
921
- content: attr(data-balloon);
922
- font-size: 12px;
923
- padding: .5em 1em;
924
- position: absolute;
925
- white-space: nowrap;
926
- z-index: 10; }
927
-
928
- [data-balloon]::after {
929
- background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="36px" height="12px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(0)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
930
- background-size: 100% auto;
931
- width: 18px;
932
- height: 6px;
933
- opacity: 0;
934
- pointer-events: none;
935
- transition: all .18s ease-out;
936
- content: '';
937
- position: absolute;
938
- z-index: 10; }
939
-
940
- [data-balloon]:hover::before, [data-balloon]:hover::after {
941
- opacity: 1;
942
- pointer-events: auto; }
943
-
944
- [data-balloon][data-balloon-pos="up"]::before {
945
- bottom: 100%;
946
- left: 50%;
947
- margin-bottom: 11px;
948
- -webkit-transform: translate3d(-50%, 10px, 0);
949
- transform: translate3d(-50%, 10px, 0);
950
- -webkit-transform-origin: top;
951
- transform-origin: top; }
952
-
953
- [data-balloon][data-balloon-pos="up"]::after {
954
- bottom: 100%;
955
- left: 50%;
956
- margin-bottom: 5px;
957
- -webkit-transform: translate3d(-50%, 10px, 0);
958
- transform: translate3d(-50%, 10px, 0);
959
- -webkit-transform-origin: top;
960
- transform-origin: top; }
961
-
962
- [data-balloon][data-balloon-pos="up"]:hover::before {
963
- -webkit-transform: translate3d(-50%, 0, 0);
964
- transform: translate3d(-50%, 0, 0); }
965
-
966
- [data-balloon][data-balloon-pos="up"]:hover::after {
967
- -webkit-transform: translate3d(-50%, 0, 0);
968
- transform: translate3d(-50%, 0, 0); }
969
-
970
- [data-balloon][data-balloon-pos='down']::before {
971
- left: 50%;
972
- margin-top: 11px;
973
- top: 100%;
974
- -webkit-transform: translate3d(-50%, -10px, 0);
975
- transform: translate3d(-50%, -10px, 0); }
976
-
977
- [data-balloon][data-balloon-pos='down']::after {
978
- background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="36px" height="12px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(180 18 6)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
979
- background-size: 100% auto;
980
- width: 18px;
981
- height: 6px;
982
- left: 50%;
983
- margin-top: 5px;
984
- top: 100%;
985
- -webkit-transform: translate3d(-50%, -10px, 0);
986
- transform: translate3d(-50%, -10px, 0); }
987
-
988
- [data-balloon][data-balloon-pos='down']:hover::before {
989
- -webkit-transform: translate3d(-50%, 0, 0);
990
- transform: translate3d(-50%, 0, 0); }
991
-
992
- [data-balloon][data-balloon-pos='down']:hover::after {
993
- -webkit-transform: translate3d(-50%, 0, 0);
994
- transform: translate3d(-50%, 0, 0); }
995
-
996
- [data-balloon][data-balloon-pos='left']::before {
997
- margin-right: 11px;
998
- right: 100%;
999
- top: 50%;
1000
- -webkit-transform: translate3d(10px, -50%, 0);
1001
- transform: translate3d(10px, -50%, 0); }
1002
-
1003
- [data-balloon][data-balloon-pos='left']::after {
1004
- background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12px" height="36px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(-90 18 18)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1005
- background-size: 100% auto;
1006
- width: 6px;
1007
- height: 18px;
1008
- margin-right: 5px;
1009
- right: 100%;
1010
- top: 50%;
1011
- -webkit-transform: translate3d(10px, -50%, 0);
1012
- transform: translate3d(10px, -50%, 0); }
1013
-
1014
- [data-balloon][data-balloon-pos='left']:hover::before {
1015
- -webkit-transform: translate3d(0, -50%, 0);
1016
- transform: translate3d(0, -50%, 0); }
1017
-
1018
- [data-balloon][data-balloon-pos='left']:hover::after {
1019
- -webkit-transform: translate3d(0, -50%, 0);
1020
- transform: translate3d(0, -50%, 0); }
1021
-
1022
- [data-balloon][data-balloon-pos='right']::before {
1023
- left: 100%;
1024
- margin-left: 11px;
1025
- top: 50%;
1026
- -webkit-transform: translate3d(-10px, -50%, 0);
1027
- transform: translate3d(-10px, -50%, 0); }
1028
-
1029
- [data-balloon][data-balloon-pos='right']::after {
1030
- background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12px" height="36px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(90 6 6)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1031
- background-size: 100% auto;
1032
- width: 6px;
1033
- height: 18px;
1034
- left: 100%;
1035
- margin-left: 5px;
1036
- top: 50%;
1037
- -webkit-transform: translate3d(-10px, -50%, 0);
1038
- transform: translate3d(-10px, -50%, 0); }
1039
-
1040
- [data-balloon][data-balloon-pos='right']:hover::before {
1041
- -webkit-transform: translate3d(0, -50%, 0);
1042
- transform: translate3d(0, -50%, 0); }
1043
-
1044
- [data-balloon][data-balloon-pos='right']:hover::after {
1045
- -webkit-transform: translate3d(0, -50%, 0);
1046
- transform: translate3d(0, -50%, 0); }
1047
-
1048
- [data-balloon][data-balloon-length='small']::before {
1049
- white-space: normal;
1050
- width: 80px; }
1051
-
1052
- [data-balloon][data-balloon-length='medium']::before {
1053
- white-space: normal;
1054
- width: 150px; }
1055
-
1056
- [data-balloon][data-balloon-length='large']::before {
1057
- white-space: normal;
1058
- width: 260px; }
1059
-
1060
- [data-balloon][data-balloon-length='xlarge']::before {
1061
- white-space: normal;
1062
- width: 380px; }
1063
-
1064
- @media screen and (max-width: 768px) {
1065
- [data-balloon][data-balloon-length='xlarge']::before {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1066
  white-space: normal;
1067
- width: 90vw; } }
1068
 
1069
- [data-balloon][data-balloon-length='fit']::before {
1070
- white-space: normal;
1071
- width: 100%; }
1072
 
1073
- .font-options__wrapper .font-options__options-list {
1074
- border-color: #B8DAEB;
1075
- box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.15); }
1076
 
1077
- .font-options__wrapper .font-options__option {
1078
- margin-bottom: 12px; }
1079
- .font-options__wrapper .font-options__option label {
1080
- display: block;
1081
- margin-bottom: 6px; }
1082
 
1083
- .font-options__wrapper [type=checkbox]:checked ~ .font-options__options-list {
1084
- opacity: 1;
1085
- display: block; }
1086
 
1087
- input.customify_font_tooltip {
1088
- display: none; }
 
1089
 
1090
- ul.font-options__options-list .select2-container {
1091
- width: 100% !important; }
1092
- ul.font-options__options-list .select2-container .select2-selection--single {
1093
- -webkit-appearance: initial; }
1094
- ul.font-options__options-list .select2-container .select2-selection--single .select2-selection__arrow {
1095
- display: none; }
1096
 
1097
- ul.font-options__options-list .select2-container--default .select2-selection--single .select2-selection__rendered {
1098
- color: inherit;
1099
- line-height: initial; }
 
 
1100
 
1101
- .select2-container.select2-container--open {
1102
- z-index: 99999999; }
 
1103
 
1104
- #customize-theme-controls .select2-container {
1105
- width: 100% !important; }
1106
- #customize-theme-controls .select2-container .select2-selection--multiple {
1107
- -webkit-appearance: initial;
1108
- padding: 8px 8px 4px;
1109
- height: auto;
1110
- background: none; }
1111
- #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__arrow {
1112
- display: none; }
1113
- #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__rendered {
1114
- padding: 0; }
1115
- #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
1116
- padding: 3px 7px;
1117
- margin-right: 6px;
1118
- margin-top: 0px;
1119
- border-color: #e0e8ef;
1120
- background-color: #f6fbff; }
1121
- #customize-theme-controls .select2-container .select2-search--inline .select2-search__field {
1122
- height: 24px; }
1123
-
1124
- .select2-container .select2-dropdown {
1125
- border-color: #e0e8ef; }
1126
-
1127
- #customize-theme-controls .widget-content .accordion-container {
1128
- margin-left: -10px;
1129
- margin-right: -10px;
1130
- margin-top: 20px;
1131
- margin-bottom: 10px; }
1132
- #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content {
1133
- position: relative;
1134
- left: 0;
1135
- max-height: 0;
1136
- padding-top: 0;
1137
- padding-bottom: 0;
1138
- overflow: hidden;
1139
- transition: all .4s ease;
1140
- color: #416B7E; }
1141
- #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content p:first-child {
1142
- margin-top: 0; }
1143
- #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content p:last-child {
1144
- margin-bottom: 0; }
1145
- #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-title {
1146
- color: #39474D; }
1147
- #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-title:after {
1148
- content: "\f142";
1149
- -webkit-transform: rotate(180deg);
1150
- transform: rotate(180deg); }
1151
- #customize-theme-controls .widget-content .accordion-container .accordion-section.open {
1152
- border-bottom: none; }
1153
- #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-content {
1154
- max-height: 100%;
1155
- padding-top: 17px;
1156
- padding-bottom: 17px; }
1157
- #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-title {
1158
- border-bottom: 1px solid; }
1159
- #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-title:after {
1160
- -webkit-transform: rotate(0deg);
1161
- transform: rotate(0deg); }
1162
- #customize-theme-controls .widget-content .accordion-container label.customize-control-title, #customize-theme-controls .widget-content .accordion-container label.separator.label {
1163
- cursor: default; }
1164
 
1165
- .widget .widget-content > p input[type=checkbox],
1166
- .widget .widget-content > p input[type=radio] {
1167
- margin-bottom: 3px;
1168
- margin-top: 3px; }
 
 
 
 
 
 
 
 
 
 
 
 
1169
 
1170
- .widget .widget-content small {
1171
- margin-top: 5px;
1172
- display: block; }
1173
 
1174
- #available-widgets [class*=pixelgrade] .widget .widget-title:before,
1175
- #available-widgets [class*=featured-posts] .widget .widget-title:before,
1176
- #available-widgets [class*=categories-image-grid] .widget .widget-title:before {
1177
- content: "\f538";
1178
- color: #9660c6; }
1179
 
1180
- #available-widgets [class*=pixelgrade-featured-posts-slideshow] .widget .widget-title:before {
1181
- content: "\f233"; }
1182
 
1183
- #available-widgets [class*=pixelgrade-featured-posts-carousel] .widget .widget-title:before {
1184
- content: "\f169"; }
 
 
1185
 
1186
- #available-widgets [class*=featured-posts-grid] .widget .widget-title:before {
1187
- content: "\f180"; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
 
1189
- #available-widgets [class*=featured-posts-list] .widget .widget-title:before {
1190
- content: "\f164"; }
1191
 
1192
- #available-widgets [class*=categories-image-grid] .widget .widget-title:before {
1193
- content: "\f163"; }
 
1194
 
1195
- #available-widgets [class*=pixelgrade-promo-box] .widget .widget-title:before {
1196
- content: "\f488"; }
1197
 
1198
- .wp-customizer .widget-conditional .condition-control:after {
1199
- content: " ";
1200
- display: table;
1201
- clear: both; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1202
 
1203
- .wp-customizer .widget-conditional .selection {
1204
- padding-right: 50px;
1205
- padding-left: 28px;
1206
- padding-bottom: 19px;
1207
- margin-left: 0;
1208
- margin-right: 0;
1209
- margin-bottom: 10px;
1210
- border-bottom: 1px solid #cbcfd4; }
1211
 
1212
- .wp-customizer .widget-conditional .condition:last-child .selection {
1213
- border: 0; }
 
1214
 
1215
- .wp-customizer .widget-conditional select {
1216
- max-width: 100%;
1217
- width: 170px; }
1218
 
1219
- .wp-customizer .widget-conditional .condition-top select {
1220
- width: 130px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wp-full-overlay-sidebar *
2
+ {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ .wp-full-overlay-sidebar-content .accordion-section-content
7
+ {
8
+ overflow: visible;
9
+ }
10
+
11
+ .control-section:not(.control-section-themes) .customize-control
12
+ {
13
+ width: 100%;
14
+ min-height: initial;
15
+ padding: 0;
16
+ }
17
+
18
+ #customize-header-actions #customize-save-button-wrapper
19
+ {
20
+ margin-top: 7px;
21
+ }
22
+
23
+ .wp-full-overlay-footer .devices button
24
+ {
25
+ float: left;
26
+
27
+ border-radius: 0;
28
+ }
29
+
30
+ .customize-controls-close
31
+ {
32
+ width: 48px;
33
+ height: 44px;
34
+
35
+ color: #7da9c3;
36
+ border-top: none;
37
+ border-right-color: #e0e8ef;
38
+ background: #fff;
39
+ }
40
+ .customize-controls-close:focus,
41
+ .customize-controls-close:hover
42
+ {
43
+ background: #f5fcff;
44
+ }
45
+ .customize-controls-close:before
46
+ {
47
+ top: 0;
48
+ }
49
+
50
+ #customize-controls .customize-info
51
+ {
52
+ border-bottom-color: #e0e8ef;
53
+ }
54
+
55
+ .customize-panel-back,
56
+ .customize-section-back
57
+ {
58
+ height: 74px;
59
+
60
+ color: #7da9c3;
61
+ border-right-color: #e0e8ef;
62
+ }
63
+ .customize-panel-back:hover,
64
+ .customize-panel-back:focus,
65
+ .customize-section-back:hover,
66
+ .customize-section-back:focus
67
+ {
68
  border-left-color: #f5fcff;
69
+ background: #f5fcff;
70
+ }
71
 
72
+ #customize-theme-controls .theme *
73
+ {
74
+ box-sizing: content-box;
75
+ }
76
 
77
+ #customize-theme-controls .accordion-section-content
78
+ {
79
+ padding: 17px;
80
+ }
81
 
82
+ #customize-theme-controls .customize-section-title
83
+ {
84
+ margin-top: -17px;
85
+ margin-right: -17px;
86
+ }
87
 
88
  #customize-theme-controls .control-panel-content .control-section:nth-child(2),
89
+ #customize-theme-controls .control-panel-content .control-section:nth-child(3)
90
+ {
91
+ border-top: none;
92
+ }
93
+
94
+ #customize-theme-controls .control-panel-content .control-section:nth-last-child(2)
95
+ {
96
+ border-bottom: 1px solid #e0e8ef;
97
+ }
98
+
99
+ #customize-theme-controls #accordion-section-add_menu
100
+ {
101
+ border-bottom: none;
102
+ }
103
+ #customize-theme-controls #accordion-section-add_menu .add-menu-toggle
104
+ {
105
+ float: none;
106
+ }
107
+
108
+ #customize-theme-controls .customize-pane-child.open
109
+ {
110
+ height: 100%;
111
+ }
112
 
113
+ #customize-controls .description
114
+ {
115
+ font-size: 12px;
116
+ font-weight: 300;
117
+ font-style: normal;
118
+ line-height: 1.6;
119
 
120
+ margin-bottom: 9px;
 
 
 
121
 
122
+ text-indent: 0;
 
123
 
124
+ color: #4d7b90;
125
+ }
 
 
 
 
 
 
126
 
127
+ .customize-control-description
128
+ {
129
+ margin-top: 6px;
130
+ }
131
 
132
+ .customize-control
133
+ {
134
+ margin-bottom: 24px;
135
+ }
136
 
137
+ #accordion-section-themes + .control-section
138
+ {
139
+ border-top: none;
140
+ }
141
 
142
+ #customize-controls .panel-meta.customize-info .accordion-section-title
143
+ {
144
+ height: 74px;
145
 
146
+ border-top: none;
147
+ }
148
+
149
+ .button-controls:after
150
+ {
151
+ display: table;
152
+ clear: both;
153
+
154
+ content: ' ';
155
+ }
156
 
157
  .wp-core-ui .button:not(.theme-details):not(.collapse-sidebar):not(.wp-color-result),
158
  .wp-core-ui .button-primary,
159
+ .wp-core-ui .button-secondary
160
+ {
161
+ font-weight: 400;
162
+
163
+ width: auto;
164
+ padding-right: 15px;
165
+ padding-left: 15px;
166
+
167
+ transition: all .1s;
168
+
169
+ color: #f5fcff;
170
+ border: none;
171
+ border-radius: 4px;
172
+ background: #aed2e5;
173
+ box-shadow: 0 2px 0 0 #8dbed7;
174
+ text-shadow: none;
175
+ }
176
+ .wp-core-ui .button:not(.theme-details):not(.collapse-sidebar):not(.wp-color-result):hover,
177
+ .wp-core-ui .button-primary:hover,
178
+ .wp-core-ui .button-secondary:hover
179
+ {
180
  color: white;
181
+ background: #98c6dd;
182
+ box-shadow: 0 2px 0 0 #74a7c2;
183
  text-shadow: none;
184
+ }
185
+
186
+ .wp-core-ui #customize-header-actions .button-primary
187
+ {
188
+ background: #73c5ee;
189
+ box-shadow: 0 2px 0 0 #57abd5;
190
+ }
191
+ .wp-core-ui #customize-header-actions .button-primary:hover
192
+ {
193
+ background: #58b0dd;
194
+ box-shadow: 0 2px 0 0 #3f8aaf;
195
+ }
196
+ .wp-core-ui #customize-header-actions .button-primary.has-next-sibling
197
+ {
198
+ border-right: 1px solid #57abd5;
199
+ }
200
+ .wp-core-ui #customize-header-actions .button-primary:disabled
201
+ {
202
+ opacity: .7;
203
  color: white !important;
204
+ background: #aed2e5 !important;
205
+ box-shadow: 0 2px 0 0 #8db5ca !important;
206
+ }
207
+ .wp-core-ui #customize-header-actions .button-primary:disabled.has-next-sibling
208
+ {
209
+ border-right: none;
210
+ }
211
 
212
  .wp-core-ui .reset_section,
213
+ .wp-core-ui .reset_panel
214
+ {
215
+ display: block;
216
+
217
+ width: 100%;
218
+ height: 4em;
219
+ margin: 0 0 25px;
220
+ }
221
+
222
+ .wp-core-ui .reset_panel
223
+ {
224
+ margin-top: 10px;
225
+ }
226
+
227
+ .separator.label
228
+ {
229
+ font-size: 14px;
230
+ font-weight: 600;
231
+ line-height: 24px;
232
+
233
+ display: block;
234
+ }
235
+
236
+ .customize-control-title,
237
+ .separator.label
238
+ {
239
+ color: #416b7e;
240
+ }
241
+
242
+ .separator.section:before,
243
+ .separator.sub-section:before
244
+ {
245
+ position: absolute;
246
+ z-index: -1;
247
+ top: 0;
248
+ right: -18px;
249
+ bottom: 0;
250
+ left: -18px;
251
+
252
+ content: '';
253
+ }
254
+
255
+ .separator.label
256
+ {
257
+ font-weight: 500;
258
+ }
259
+
260
+ .separator.large
261
+ {
262
+ font-size: 16px;
263
+
264
+ margin-top: 12px;
265
+
266
+ color: #39474d;
267
+ }
268
+
269
+ .separator.section
270
+ {
271
+ position: relative;
272
+
273
+ margin-bottom: 0;
274
+ padding: 14px 0;
275
+
276
+ border: none;
277
+ background: none;
278
+ }
279
+ .separator.section[id*='layout']
280
+ {
281
+ margin-top: 0;
282
+ }
283
+ .separator.section[id*='layout']:before
284
+ {
285
+ border: none;
286
+ }
287
+ .separator.section:before
288
+ {
289
  border: 1px solid #e0e8ef;
290
+ background-color: #fff;
291
+ box-shadow: 0 1px 0 0 #dfe8ef;
292
+ }
293
+
294
+ .separator.sub-section
295
+ {
296
+ position: relative;
297
 
298
+ padding: 12px 0;
299
+ }
300
+ .separator.sub-section:before
301
+ {
302
  border-top: 1px solid #e0e8ef;
303
  border-bottom: 1px solid #e0e8ef;
304
+ background-color: #f6fbff;
305
+ }
306
+ .separator.sub-section + span
307
+ {
308
+ font-style: normal;
309
+
310
  margin-top: 20px;
311
+ }
312
+
313
+ .section-navigation-wrapper
314
+ {
315
+ position: relative;
316
+
317
+ height: 43px;
318
+ margin: -15px -12px 0 -12px;
319
+ margin-right: -17px;
320
+ margin-left: -17px;
321
+ }
322
+
323
+ .section-navigation
324
+ {
325
+ display: -ms-flexbox;
326
+ display: flex;
327
+ clear: both;
328
+
329
+ margin-top: -1px;
330
+
331
+ border-top: 1px solid #e0e8ef;
332
+ }
333
+ .section-navigation a
334
+ {
335
  display: block;
336
+
337
  padding: 12px 0;
338
+
339
+ transition: background-color .15s ease-in-out;
 
 
340
  text-align: center;
341
  text-decoration: none;
342
+
343
+ color: #3b484e;
344
+ border-right: 1px solid #e0e8ef;
345
+ border-bottom: 1px solid #e0e8ef;
346
+ background-color: #fff;
347
+
348
+ -ms-flex: 1 1 auto;
349
+ flex: 1 1 auto;
350
+ }
351
+ .section-navigation a:last-child
352
+ {
353
+ border-right: 0;
354
+ }
355
 
356
  #customize-controls .customize-info.is-sticky.is-sticky,
357
+ #customize-controls .customize-section-title.is-sticky.is-sticky
358
+ {
359
+ top: 40px;
360
+ }
361
 
362
  #customize-controls .customize-info.is-in-view.is-in-view,
363
+ #customize-controls .customize-section-title.is-in-view.is-in-view
364
+ {
365
+ box-shadow: none;
366
+ }
367
 
368
  #customize-controls .has-nav .customize-info,
369
+ #customize-controls .has-nav .customize-section-title
370
+ {
371
+ margin-right: -12px;
372
+ }
373
+
374
+ #customize-controls .customize-section-title.customize-section-title
375
+ {
376
+ border-bottom: 0;
377
+ }
378
+
379
+ .customize-section-description-container.section-meta.has-nav
380
+ {
381
+ margin-bottom: 0;
382
+ }
383
+
384
+ .font-options__wrapper
385
+ {
386
+ position: relative;
387
+ }
388
+ .font-options__wrapper:after
389
+ {
390
  position: absolute;
391
+ z-index: 0;
392
  top: 90%;
 
393
  right: 0;
394
+ left: 0;
395
+
396
  display: block;
397
+
398
+ height: 30px;
399
+
400
+ content: '';
401
+ }
402
+
403
+ .font-options__head
404
+ {
405
+ display: -ms-flexbox;
406
+ display: flex;
407
+
408
+ -ms-flex-pack: justify;
409
+ justify-content: space-between;
410
+ }
411
+ .font-options__head.font-options__head
412
+ {
413
+ white-space: nowrap;
414
+ text-overflow: ellipsis;
415
+
416
  -webkit-appearance: none;
417
+ }
418
+
419
+ .font-options__font-title
420
+ {
421
+ font-size: 12px;
422
+ font-weight: 300;
423
+ line-height: 20px;
424
+
425
+ overflow: hidden;
426
+
427
+ margin-right: 26px;
428
+ margin-left: 10px;
429
+
430
+ white-space: nowrap;
431
  text-overflow: ellipsis;
432
+
433
+ color: #98c6dd;
434
+ }
435
+
436
+ .font-options__options-list
437
+ {
438
+ position: absolute;
439
+ z-index: 2;
440
+ top: calc(100% + 6px);
441
+ right: -6px;
442
+ left: -6px;
443
+
444
+ display: block;
445
+ display: none;
446
+
447
+ padding: 10px;
448
+
449
+ transition: opacity .15s linear;
450
+
451
+ opacity: 0;
452
+ border: 1px solid #dfe8ef;
453
+ border-radius: 5px;
454
+ background-color: #fff;
455
+ }
456
+ .font-options__options-list:last-child
457
+ {
458
+ margin-bottom: 0;
459
+ }
460
+ .font-options__options-list:before,
461
+ .font-options__options-list:after
462
+ {
463
  position: absolute;
464
+ z-index: 10;
465
  top: -20px;
466
  right: 25px;
467
+
468
  width: 0;
469
+ height: 0;
470
+
471
+ content: '';
472
+
473
  border: solid transparent;
474
+ }
475
+ .font-options__options-list:before
476
+ {
477
+ z-index: 11;
478
+
479
  border-width: 10px;
480
+ border-bottom-color: white;
481
+ }
482
+ .font-options__options-list:after
483
+ {
484
  top: -24px;
485
+ right: 23px;
486
+
487
+ border-width: 12px;
488
+ border-bottom-color: rgba(0, 0, 0, .075);
489
+ }
490
+
491
+ .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap:after
492
+ {
493
+ position: absolute;
494
+ right: 12px;
495
+ bottom: 100%;
496
+
497
+ width: 0;
498
+ height: 0;
499
+
500
+ border-collapse: separate;
501
+
502
+ content: '';
503
+
504
+ border-width: 0 9px 9px 9px;
505
+ border-style: solid;
506
+ border-color: transparent transparent #fff transparent;
507
+ }
508
+
509
+ .font-options__head,
510
+ .wp-full-overlay-sidebar-content .customize-control input[type=text]:not(#_customize-input-wpcom_custom_css_content_width_control),
511
+ .wp-full-overlay-sidebar-content .customize-control input[type=checkbox],
512
+ .wp-full-overlay-sidebar-content .customize-control input[type=password],
513
+ .wp-full-overlay-sidebar-content .customize-control input[type=color],
514
+ .wp-full-overlay-sidebar-content .customize-control input[type=date],
515
+ .wp-full-overlay-sidebar-content .customize-control input[type=datetime],
516
+ .wp-full-overlay-sidebar-content .customize-control input[type=datetime-local],
517
+ .wp-full-overlay-sidebar-content .customize-control input[type=email],
518
+ .wp-full-overlay-sidebar-content .customize-control input[type=month],
519
+ .wp-full-overlay-sidebar-content .customize-control input[type=number],
520
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio],
521
+ .wp-full-overlay-sidebar-content .customize-control input[type=tel],
522
+ .wp-full-overlay-sidebar-content .customize-control input[type=time],
523
+ .wp-full-overlay-sidebar-content .customize-control input[type=url],
524
+ .wp-full-overlay-sidebar-content .customize-control input[type=week],
525
+ .wp-full-overlay-sidebar-content .customize-control input[type=search],
526
+ .wp-full-overlay-sidebar-content .customize-control select,
527
+ .wp-full-overlay-sidebar-content .customize-control textarea,
528
+ .wp-full-overlay-sidebar-content .customize-control input[type='number'].range-value,
529
+ ul.font-options__options-list .select2-container .select2-selection--single,
530
+ #customize-theme-controls .select2-container .select2-selection--multiple
531
+ {
532
+ font-size: 14px;
533
+ line-height: 1.5;
534
+
535
+ width: 100%;
536
+ height: 44px;
537
+ padding: 10px 14px;
538
+
539
+ color: #416b7e;
540
+ border: 2px solid #b8daeb;
541
+ border-radius: 4px;
542
+ outline: 0;
543
+ background: #fff;
544
+ }
545
+ .font-options__head:focus,
546
+ .wp-full-overlay-sidebar-content .customize-control input[type=text]:focus:not(#_customize-input-wpcom_custom_css_content_width_control),
547
+ .wp-full-overlay-sidebar-content .customize-control input[type=checkbox]:focus,
548
+ .wp-full-overlay-sidebar-content .customize-control input[type=password]:focus,
549
+ .wp-full-overlay-sidebar-content .customize-control input[type=color]:focus,
550
+ .wp-full-overlay-sidebar-content .customize-control input[type=date]:focus,
551
+ .wp-full-overlay-sidebar-content .customize-control input[type=datetime]:focus,
552
+ .wp-full-overlay-sidebar-content .customize-control input[type=datetime-local]:focus,
553
+ .wp-full-overlay-sidebar-content .customize-control input[type=email]:focus,
554
+ .wp-full-overlay-sidebar-content .customize-control input[type=month]:focus,
555
+ .wp-full-overlay-sidebar-content .customize-control input[type=number]:focus,
556
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]:focus,
557
+ .wp-full-overlay-sidebar-content .customize-control input[type=tel]:focus,
558
+ .wp-full-overlay-sidebar-content .customize-control input[type=time]:focus,
559
+ .wp-full-overlay-sidebar-content .customize-control input[type=url]:focus,
560
+ .wp-full-overlay-sidebar-content .customize-control input[type=week]:focus,
561
+ .wp-full-overlay-sidebar-content .customize-control input[type=search]:focus,
562
+ .wp-full-overlay-sidebar-content .customize-control select:focus,
563
+ .wp-full-overlay-sidebar-content .customize-control textarea:focus,
564
+ .wp-full-overlay-sidebar-content .customize-control input[type='number'].range-value:focus,
565
+ ul.font-options__options-list .select2-container .select2-selection--single:focus,
566
+ #customize-theme-controls .select2-container .select2-selection--multiple:focus
567
+ {
568
+ border-color: #73c5ee;
569
+ box-shadow: none;
570
+ }
571
+
572
+ .font-options__head,
573
+ .wp-full-overlay-sidebar-content .customize-control select,
574
+ ul.font-options__options-list .select2-container .select2-selection--single,
575
+ #customize-theme-controls .select2-container .select2-selection--multiple
576
+ {
577
+ font-weight: 600;
578
+
579
+ width: 100%;
580
+
581
+ background: white url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE1cHgiIGhlaWdodD0iOXB4IiB2aWV3Qm94PSIwIDAgMTUgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJDdXN0b21pZnktQ29weS0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjU2LjAwMDAwMCwgLTM4Ni4wMDAwMDApIiBmaWxsPSIjOThDNkRFIj4KICAgICAgICAgICAgPGcgaWQ9IkhlYWRlciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgNDcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iQ29udGVudCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCA3NS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iVGl0bGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI2LjAwMDAwMCwgMjE5LjAwMDAwMCkiPgogICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iRmllbGQtLS1TZWxlY3QtQ29weSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iU2VsZWN0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgMjcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTI1NC40ODEyLDE4IEwyNTYsMTkuNTE0IEwyNDguNSwyNyBMMjQxLDE5LjUxNCBMMjQyLjUxODgsMTggTDI0OC41LDIzLjk2NzIgTDI1NC40ODEyLDE4IFoiIGlkPSJQYWdlLTEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) no-repeat;
582
+ background-position: right 16px top 16px;
583
+
584
+ -webkit-appearance: button;
585
+ -moz-appearance: none;
586
+ }
587
+ [multiple].font-options__head,
588
+ .wp-full-overlay-sidebar-content .customize-control select[multiple],
589
+ ul.font-options__options-list .select2-container [multiple].select2-selection--single,
590
+ #customize-theme-controls .select2-container [multiple].select2-selection--multiple
591
+ {
592
+ background: white;
593
+ }
594
+
595
+ .wp-full-overlay-sidebar-content .customize-control input[type=text],
596
+ .wp-full-overlay-sidebar-content .customize-control textarea
597
+ {
598
+ font-size: 13px;
599
+ }
600
+
601
+ .wp-full-overlay-sidebar-content .customize-control textarea
602
+ {
603
+ height: auto;
604
+ }
605
+
606
+ .wp-full-overlay-sidebar-content .customize-control input[type=checkbox],
607
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]
608
+ {
609
+ width: 22px;
610
+ height: 22px;
611
+ }
612
+ .wp-full-overlay-sidebar-content .customize-control input[type=checkbox]:checked,
613
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]:checked
614
+ {
615
+ border-color: #5ab9e8;
616
+ background: #73c5ee;
617
+ }
618
+ .wp-full-overlay-sidebar-content .customize-control input[type=checkbox]:checked:before,
619
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]:checked:before
620
+ {
621
+ margin: -1px 0 0 -2px;
622
+
623
+ color: white;
624
+ }
625
+
626
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-checkbox:not(#customize-control-jetpack_css_mode_control) label:not(:only-of-type),
627
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-checkbox:not(#customize-control-jetpack_css_mode_control) > .customize-inside-control-row:not(:only-of-type),
628
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio label:not(:only-of-type),
629
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio > .customize-inside-control-row:not(:only-of-type)
630
+ {
631
+ display: inline-block;
632
+
633
+ width: calc(49% - 30px);
634
+ margin-left: 30px;
635
+ padding-top: 0;
636
+ padding-bottom: 0;
637
+
638
+ text-indent: -6px;
639
+ }
640
+
641
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-checkbox:not(#customize-control-jetpack_css_mode_control) label,
642
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio label
643
+ {
644
+ color: #416b7e;
645
+ }
646
+
647
+ [id*='divider'] + .wp-full-overlay-sidebar-content .customize-control.customize-control-checkbox:not(#customize-control-jetpack_css_mode_control),
648
+ [id*='divider'] + .wp-full-overlay-sidebar-content .customize-control.customize-control-radio
649
+ {
650
+ margin-top: 0;
651
+ }
652
+
653
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]
654
+ {
655
+ border-radius: 50%;
656
+ }
657
+ .wp-full-overlay-sidebar-content .customize-control input[type=radio]:checked:before
658
+ {
659
+ content: none;
660
+ }
661
+
662
+ .customize-control-html + .wp-full-overlay-sidebar-content .customize-control.customize-control-checkbox
663
+ {
664
+ margin-top: -24px;
665
+ }
666
+
667
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio label,
668
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio .customize-inside-control-row
669
+ {
670
+ margin-top: 12px;
671
+ }
672
+
673
+ .wp-full-overlay-sidebar-content .customize-control.customize-control-radio#customize-control-changeset_status .customize-inside-control-row
674
+ {
675
+ margin-top: 0;
676
+
677
+ text-indent: 0;
678
+ }
679
+
680
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']
681
+ {
682
+ width: 65%;
683
+ }
684
+
685
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']
686
+ {
687
+ position: relative;
688
+
689
+ overflow: hidden;
690
+
691
+ width: calc(100% - 55px);
692
+ height: 22px;
693
+
694
+ outline: none;
695
+ background: none;
696
+
697
+ -webkit-appearance: none;
698
+ }
699
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']:before
700
+ {
701
  position: absolute;
702
  top: 8px;
703
  left: 0;
704
+
705
  width: 100%;
706
+ height: 6px;
707
+
708
+ content: ' ';
709
+
710
+ border-radius: 10px;
711
+ background: #dfe8ef;
712
+ box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, .3);
713
+ }
714
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']::-webkit-slider-thumb
715
+ {
716
+ position: relative;
717
+ z-index: 3;
718
+
719
  width: 22px;
720
  height: 22px;
721
+
722
+ border: 2px solid #b8daeb;
723
+ border-radius: 4px;
724
  background: #27ae60;
725
+ background: #fff;
726
+
727
+ -webkit-appearance: none;
728
+ }
729
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']::-webkit-slider-thumb:before
730
+ {
731
+ font-size: 1em;
732
+
733
+ position: absolute;
734
+ top: -5px;
735
+ left: 5px;
736
+
737
+ content: '..';
738
+ letter-spacing: 1px;
739
+
740
+ color: #b8daeb;
741
+ }
742
+ .wp-full-overlay-sidebar-content .customize-control input[type='range']::-webkit-slider-thumb:after
743
+ {
744
+ position: absolute;
745
+ z-index: 1;
746
+ top: 6px;
747
+ right: 20px;
748
+
749
+ width: calc(100% - 55px);
750
+ height: 6px;
751
+
752
+ content: ' ';
753
+
754
+ background: #73c5ee;
755
+ }
756
+
757
+ .wp-full-overlay-sidebar-content .customize-control input[type='number'].range-value
758
+ {
759
+ font-size: 13px;
760
+ line-height: 1;
761
+
762
+ top: -5px;
763
+
764
+ float: right;
765
+
766
+ width: auto;
767
+ min-width: 40px;
768
+ max-width: 80px;
769
+ height: 30px;
770
+ margin-left: 10px;
771
+ padding: 4px 0 5px 0;
772
+
773
+ text-align: center;
774
+ }
775
+
776
+ .wp-full-overlay-sidebar-content .customize-control input[type=number]::-webkit-inner-spin-button,
777
+ .wp-full-overlay-sidebar-content .customize-control input[type=number]::-webkit-outer-spin-button
778
+ {
779
+ margin: 0;
780
+
781
+ -webkit-appearance: none;
782
+ }
783
+
784
+ .customize-control-color
785
+ {
786
+ display: block;
787
+ }
788
+ .customize-control-color .customize-control-title,
789
+ .customize-control-color .separator.label
790
+ {
791
+ float: left;
792
+ }
793
+ .customize-control-color .wp-picker-container
794
+ {
795
  position: relative;
796
+ top: -3px;
797
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  float: right;
799
+ }
800
+ .customize-control-color .wp-picker-container .wp-picker-holder
801
+ {
802
+ position: relative;
803
+ }
804
+ .customize-control-color .wp-picker-container .wp-color-result,
805
+ .customize-control-color .wp-picker-container .wp-color-result.button
806
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
807
  top: 0;
808
+
809
  width: 40px;
810
+ height: 30px;
811
  margin: 0;
812
  padding: 0;
813
+
814
+ border: 2px solid #b8daeb;
815
  border-radius: 4px;
816
+ background: #2ecc71;
817
+ box-shadow: none;
818
+ }
819
+ .customize-control-color .wp-picker-container .wp-color-result:after,
820
+ .customize-control-color .wp-picker-container .wp-color-result .wp-color-result-text,
821
+ .customize-control-color .wp-picker-container .wp-color-result.button:after,
822
+ .customize-control-color .wp-picker-container .wp-color-result.button .wp-color-result-text
823
+ {
824
+ display: none;
825
+ }
826
+ .customize-control-color .wp-picker-container .iris-picker
827
+ {
828
+ position: absolute;
829
+ z-index: 1000;
830
+ top: 40px;
831
+ right: 0;
832
+
833
+ width: 275px !important;
834
+
835
+ border: none;
836
+ border-color: #dfdfde;
837
+ border-top: none;
838
+ border-radius: 0 0 3px 3px;
839
+ background: white;
840
+ }
841
+ .customize-control-color .wp-picker-container .iris-picker,
842
+ .customize-control-color .wp-picker-container .iris-picker *
843
+ {
844
+ box-sizing: content-box;
845
+ }
846
+ .customize-control-color .wp-picker-container .iris-picker .iris-square
847
+ {
848
+ width: 215px !important;
849
+ height: 173px !important;
850
+ margin-right: 0;
851
+ }
852
+ .customize-control-color .wp-picker-container .iris-picker .iris-strip
853
+ {
854
+ float: right;
855
+
856
+ box-shadow: rgba(0, 0, 0, .4) 0 1px 1px inset;
857
+ }
858
+ .customize-control-color .wp-picker-container .iris-picker .iris-strip .ui-slider-handle
859
+ {
860
+ opacity: 1;
861
+ border-color: #aaa !important;
862
+ box-shadow: none;
863
+ }
864
+ .customize-control-color .wp-picker-container .iris-picker .iris-palette
865
+ {
866
+ width: 24px !important;
867
+ height: 24px !important;
868
+
869
+ border-radius: 50px;
870
+ box-shadow: rgba(0, 0, 0, .4) 0 1px 1px inset;
871
+ }
872
+ .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap
873
+ {
874
+ position: absolute;
875
+ z-index: 1000;
876
+ top: 35px;
877
+ right: 0;
878
+
879
+ width: 275px;
880
+ padding: 9px 12px;
881
+
882
+ border: none;
883
+ border-radius: 3px 3px 0 0;
884
+ background: white;
885
+ }
886
+ .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap input.wp-color-picker
887
+ {
888
+ font-size: 13px;
889
+
890
+ float: left;
891
+
892
+ width: 100px;
893
+ height: auto;
894
+ margin: 0;
895
+ padding: 6px 12px;
896
+
897
+ text-align: left;
898
+ }
899
+ .customize-control-color .wp-picker-container .wp-picker-open + .wp-picker-input-wrap input.button
900
+ {
901
+ float: right;
902
+
903
+ height: 30px;
904
+ padding: 4px 12px;
905
+ }
906
+
907
+ .customize-control-font:last-child
908
+ {
909
+ margin-bottom: 150px;
910
+ }
911
+
912
+ #accordion-section-live_css_edit_section .customize-section-title
913
+ {
914
+ margin-top: -13px;
915
+
916
+ border-bottom: 1px solid #ddd;
917
+ }
918
+
919
+ #accordion-section-live_css_edit_section #css_editor
920
+ {
921
+ top: 70px;
922
+
923
+ overflow: visible;
924
+
925
+ border-top: 10px solid white;
926
+ }
927
+ #accordion-section-live_css_edit_section #css_editor:before
928
+ {
929
  position: absolute;
930
  z-index: 10000000;
931
+ top: -10px;
932
+ left: 0;
933
+
934
+ display: block;
935
+
936
+ width: 48px;
937
+ height: 10px;
938
 
939
+ content: '';
 
940
 
941
+ background: #e8e8e8;
942
+ }
943
+
944
+ #accordion-section-live_css_edit_section .ace_scroller
945
+ {
946
+ padding-left: 10px;
947
+ }
948
+
949
+ .wp-full-overlay.editor_opened
950
+ {
951
+ margin-left: 500px;
952
+ }
953
+ .wp-full-overlay.editor_opened #customize-controls
954
+ {
955
+ width: 500px;
956
+ }
957
+ .wp-full-overlay.editor_opened.collapsed #customize-controls
958
+ {
959
+ width: 300px;
960
+ }
961
 
962
  .customize-control-media .current,
963
  .customize-control-site_icon .current,
964
+ li#customize-control-site_logo .current
965
+ {
966
+ min-height: 44px;
967
+ margin-bottom: 10px;
968
+
969
+ border: 2px solid #b8daeb;
970
+ border-radius: 4px;
971
+ background: #f5fcff;
972
+ }
973
+ .customize-control-media .current .container,
974
+ .customize-control-media .current span,
975
+ .customize-control-site_icon .current .container,
976
+ .customize-control-site_icon .current span,
977
+ li#customize-control-site_logo .current .container,
978
+ li#customize-control-site_logo .current span
979
+ {
980
+ border: none;
981
+ }
982
+
983
+ .customize-control-media .inner,
984
+ .customize-control-media .current span,
985
  .customize-control-site_icon .inner,
986
  .customize-control-site_icon .current span,
987
  li#customize-control-site_logo .inner,
988
+ li#customize-control-site_logo .current span
989
+ {
990
+ font-size: 13px;
991
+
992
+ color: #98c6dd;
993
+ }
994
 
995
  .customize-control-media .inner,
996
  .customize-control-site_icon .inner,
997
+ li#customize-control-site_logo .inner
998
+ {
999
+ line-height: 1.4;
1000
+ }
1001
 
1002
  .customize-control-media .thumbnail-image,
1003
  .customize-control-site_icon .thumbnail-image,
1004
+ li#customize-control-site_logo .thumbnail-image
1005
+ {
1006
+ padding: 14px;
1007
+
1008
+ text-align: center;
1009
+ }
1010
+ .customize-control-media .thumbnail-image img,
1011
+ .customize-control-site_icon .thumbnail-image img,
1012
+ li#customize-control-site_logo .thumbnail-image img
1013
+ {
1014
+ width: auto;
1015
+ }
1016
 
1017
  .customize-control-media .actions,
1018
  .customize-control-site_icon .actions,
1019
+ li#customize-control-site_logo .actions
1020
+ {
1021
+ margin-bottom: 0;
1022
+ }
1023
+
1024
+ .customize-control-typography select,
1025
+ .customize-control-typography select
1026
+ {
1027
+ margin-bottom: 10px;
1028
+ }
1029
+
1030
+ .customize-control-typography .description,
1031
+ .customize-control-typography .description
1032
+ {
1033
+ margin-top: -3px;
1034
+ }
1035
+
1036
+ .customize-control-typography ul li,
1037
+ .customize-control-typography ul li
1038
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1039
  width: 100%;
1040
+ margin: 0;
1041
+ }
1042
+
1043
+ .default-preset-button
1044
+ {
1045
+ font-family: 'Open Sans',sans-serif;
1046
+ font-size: 13px;
1047
+
1048
+ float: right;
1049
+
1050
+ margin-right: 4px;
1051
+ padding: 1px 8px;
1052
+
1053
+ border: 1px solid #cbcbcb;
1054
+ border-radius: 3px;
1055
+ background-color: #f5f6f6;
1056
+ }
1057
+
1058
+ .customize-control-preset .description
1059
+ {
1060
+ font-style: normal;
1061
+
1062
+ margin-right: 5px;
1063
+ }
1064
+
1065
+ .customify_preset.radio_buttons .customify_radio_button
1066
+ {
1067
+ position: relative;
1068
+
1069
+ display: inline-block;
1070
+ overflow: hidden;
1071
+
1072
+ height: auto;
1073
+ margin: 3px;
1074
+ padding: 2px;
1075
+
1076
+ border: none;
1077
+ }
1078
+ .customify_preset.radio_buttons .customify_radio_button input[type='radio']
1079
+ {
1080
  position: absolute;
1081
+ z-index: 9999;
1082
+
1083
+ width: 100%;
1084
+ height: 100%;
1085
+
1086
+ opacity: 0;
1087
+ }
1088
+ .customify_preset.radio_buttons .customify_radio_button input[type='radio']:checked + label
1089
+ {
1090
+ background-color: #ebebeb;
1091
+ }
1092
+ .customify_preset.radio_buttons .customify_radio_button input[type='radio']:checked + label:before
1093
+ {
1094
+ content: '>';
1095
+
1096
+ color: inherit;
1097
+ }
1098
+ .customify_preset.radio_buttons .customify_radio_button input[type='radio']:checked + label:after
1099
+ {
1100
+ content: '<';
1101
+
1102
+ color: inherit;
1103
+ }
1104
+ .customify_preset.radio_buttons .customify_radio_button input[type='radio']:checked:before
1105
+ {
1106
+ opacity: 0;
1107
+ }
1108
+ .customify_preset.radio_buttons .customify_radio_button label
1109
+ {
1110
  position: relative;
1111
  z-index: 999;
1112
+
1113
+ border-left: 4px solid;
1114
+ }
1115
+
1116
+ .customify_preset .awesome_preset
1117
+ {
1118
+ position: relative;
1119
+
1120
+ display: inline-block;
1121
+
1122
+ width: 45%;
1123
+ margin-top: 5px;
1124
+ margin-bottom: 25px;
1125
+
1126
+ transition: all .2s;
1127
+ text-align: center;
1128
+
1129
+ color: white;
1130
+ }
1131
+ .customify_preset .awesome_preset:hover
1132
+ {
1133
+ opacity: .9;
1134
+ }
1135
+ .customify_preset .awesome_preset:before
1136
+ {
1137
  position: absolute;
1138
+ z-index: 5;
1139
  top: 1px;
 
1140
  right: 1px;
1141
  bottom: 1px;
1142
+ left: 1px;
1143
+
1144
+ content: '';
1145
+
1146
  opacity: .5;
1147
+ border: 1px solid #fff;
1148
  border-radius: 4px;
1149
+ background: transparent;
1150
+ }
1151
+ .customify_preset .awesome_preset .preset-wrap .preset-color
1152
+ {
1153
  height: 128px;
1154
+ padding: 17px 0 27px;
1155
+
1156
  border-radius: 4px 4px 0 0;
1157
+ }
1158
+ .customify_preset .awesome_preset .preset-wrap .preset-color .first-font
1159
+ {
1160
+ font-size: 55px;
1161
+ line-height: 1;
1162
+
1163
+ display: inline-block;
1164
+
1165
+ width: 100%;
1166
+ }
1167
+ .customify_preset .awesome_preset .preset-wrap .preset-color .secondary-font
1168
+ {
1169
+ font-size: 20px;
1170
+ line-height: 1;
1171
+
1172
+ display: inline-block;
1173
+
1174
+ width: 100%;
1175
+ margin-top: 8px;
1176
+ }
1177
+ .customify_preset .awesome_preset .preset-wrap .preset-name
1178
+ {
1179
  font-size: 11px;
1180
+
1181
+ position: relative;
1182
+
1183
+ padding: 1px;
1184
+
1185
  text-transform: UPPERCASE;
1186
+
1187
  border-radius: 0 0 4px 4px;
1188
+ }
1189
+ .customify_preset .awesome_preset .preset-wrap .preset-name:before
1190
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
  position: absolute;
1192
+ top: -10px;
1193
+ left: 40%;
1194
+
1195
+ content: '';
1196
+
1197
+ border: 10px solid;
1198
+ border-color: inherit;
1199
+ border-top: transparent;
1200
+ border-right-color: transparent;
1201
+ border-bottom-color: inherit;
1202
+ border-left-color: transparent;
1203
+ }
1204
+ .customify_preset .awesome_preset:nth-child(odd)
1205
+ {
1206
+ margin-right: 7%;
1207
+ }
1208
+ .customify_preset .awesome_preset input[type=radio]
1209
+ {
1210
+ position: absolute;
1211
+ z-index: 10;
1212
+ top: 0;
1213
+ left: 0;
1214
+
1215
+ display: inline-block;
1216
+
1217
+ width: 100%;
1218
+ height: 100%;
1219
+ margin: 0;
1220
+
1221
  color: #006505;
1222
+ border: 0;
1223
  border-radius: 0;
1224
+ background-color: transparent;
1225
+ box-shadow: none;
1226
+ }
1227
+ .customify_preset .awesome_preset input[type=radio]:checked:before
1228
+ {
1229
+ position: absolute;
1230
+ z-index: 1;
1231
+ top: -13px;
1232
+ right: -14px;
1233
+
1234
+ width: 25px;
1235
+ height: 25px;
1236
+
1237
+ background: #fff;
1238
+ }
1239
+ .customify_preset .awesome_preset input[type=radio]:checked:after
1240
+ {
1241
+ position: absolute;
1242
+ z-index: 10;
1243
+ top: -5px;
1244
+ right: -5px;
1245
+
1246
+ width: 26px;
1247
+ height: 26px;
1248
+
1249
+ content: '';
1250
+
1251
+ border-radius: 50%;
1252
+ background: #73c5ee url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjEzcHgiIGhlaWdodD0iOXB4IiB2aWV3Qm94PSIwIDAgMTMgOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJDdXN0b21pZnktQ29weSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgLTQwOC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPGcgaWQ9IkhlYWRlciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxLjAwMDAwMCwgNDcuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iQ29udGVudCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCA3NS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iRmllbGQtLS1DaGVja2JveC1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNy4wMDAwMDAsIDI0OS4wMDAwMDApIj4KICAgICAgICAgICAgICAgICAgICAgICAgPGcgaWQ9IkNoZWNrYm94IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgMzAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTAuMDM4NDk1LDE2IEwxNy4xMTYxMzc1LDguOTIxNDg3NiBMMTUuMTk0NjQ5OCw3IEwxMC4wMzg0OTUsMTIuMTU1MDY3NCBMNi45MjE0ODc2LDkuMDM4OTI5OTcgTDUsMTAuOTYwNDE3NiBMMTAuMDM4NDk1LDE2IFoiIGlkPSJQYWdlLTEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) no-repeat;
1253
+ background-position: center center;
1254
+
1255
+ -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
1256
+ filter: alpha(opacity=0);
1257
+ }
1258
+
1259
+ .customify_radio_image
1260
+ {
1261
  display: inline-block;
1262
+ }
1263
+ .customify_radio_image label
1264
+ {
1265
+ position: relative;
1266
+
1267
+ display: block;
1268
+ float: left;
1269
+
1270
+ margin-right: 10px;
1271
+ }
1272
+ .customify_radio_image label input[type=radio]
1273
+ {
1274
+ position: absolute;
1275
  top: 0;
1276
+ right: 0;
1277
+ bottom: 0;
1278
  left: 0;
1279
+
1280
+ visibility: hidden;
1281
+
1282
+ width: 100%;
1283
+ height: 100%;
1284
+ }
1285
+ .customify_radio_image label input[type=radio] img
1286
+ {
1287
+ cursor: pointer;
1288
+
1289
+ border: 2px solid transparent;
1290
+ }
1291
+ .customify_radio_image label input[type=radio]:checked + img
1292
+ {
1293
+ border: 3px solid #73c5ee;
1294
+ }
1295
+
1296
+ .customify_ace_editor
1297
+ {
 
 
 
 
 
 
 
1298
  display: block;
1299
+
1300
+ min-height: 200px;
1301
+
1302
+ border: 1px solid #ddd;
1303
+ }
1304
+
1305
+ .customize-control-custom_background .hide
1306
+ {
1307
+ display: none;
1308
+ }
1309
+
1310
+ .customize-control-custom_background .upload_button_div
1311
+ {
1312
+ margin: 10px 0;
1313
+ }
1314
+ .customize-control-custom_background .upload_button_div > *
1315
+ {
1316
  margin-right: 10px;
1317
+ }
1318
+
1319
+ .customize-control-custom_background .preview_screenshot
1320
+ {
1321
+ margin: 10px 0;
1322
+
1323
+ text-align: center;
1324
+ }
1325
+ .customize-control-custom_background .preview_screenshot img
1326
+ {
1327
+ border: 2px solid #ccc;
1328
+ }
1329
+
1330
+ #customify_import_demo_data_button
1331
+ {
1332
+ display: inline-block;
1333
+
1334
+ width: 70%;
1335
+ height: auto;
1336
+ margin: 0 15% 10% 15%;
1337
+ padding: 10px;
1338
+
1339
+ text-align: center;
1340
+ }
1341
+
1342
+ .import_step_note
1343
+ {
1344
+ display: inline-block;
1345
+
1346
+ width: 100%;
1347
+ margin: 5px;
1348
+ }
1349
+ .import_step_note:before
1350
+ {
1351
+ content: '\1F449';
1352
+ }
1353
+ .import_step_note.success:before
1354
+ {
1355
+ content: '\1F44D';
1356
+ }
1357
+ .import_step_note.failed:before
1358
+ {
1359
+ content: '\274C';
1360
+ }
1361
+
1362
+ #customize-header-actions
1363
+ {
1364
+ border-color: #e0e8ef;
1365
+ background: #fff;
1366
+ }
 
 
 
 
 
 
 
1367
 
1368
  .wp-full-overlay-sidebar,
1369
  .customize-themes-panel,
1370
+ #customize-sidebar-outer-content
1371
+ {
1372
+ border-right: 1px solid #e0e8ef;
1373
+ background: #eaf9fe;
1374
+ }
1375
 
1376
  .outer-section-open #customize-controls .wp-full-overlay-sidebar-content,
1377
+ .attachment-media-view,
1378
+ .media-widget-preview.media_audio,
1379
+ .media-widget-preview.media_image
1380
+ {
1381
+ background: #eaf9fe;
1382
+ }
1383
+
1384
+ #customize-theme-controls #accordion-section-menu_locations
1385
+ {
1386
+ border-bottom: 1px solid #e0e8ef;
1387
+ }
1388
+
1389
+ #customize-controls #accordion-section-themes > .accordion-section-title
1390
+ {
1391
+ font-weight: 600;
1392
+
1393
+ border-bottom: 1px solid #e0e8ef;
1394
+ }
1395
+ #customize-controls #accordion-section-themes > .accordion-section-title:hover
1396
+ {
1397
+ background: #fff;
1398
+ }
1399
+
1400
+ #customize-controls .panel-meta.customize-info
1401
+ {
1402
+ border-bottom-color: #e0e8ef;
1403
+ }
1404
+
1405
+ #customize-theme-controls .control-section .accordion-section-title
1406
+ {
1407
+ font-weight: 400;
1408
+
1409
+ border-top: 1px solid #e0e8ef;
1410
+ border-bottom: none;
1411
+ }
1412
+
1413
+ #customize-theme-controls .control-section:last-of-type > .accordion-section-title
1414
+ {
1415
+ border-bottom: 1px solid #e0e8ef;
1416
+ }
1417
+
1418
+ #customize-theme-controls .customize-section-title
1419
+ {
1420
+ border-top: 1px solid #e0e8ef;
1421
+ border-bottom: 1px solid #e0e8ef;
1422
+ }
1423
+
1424
+ #customize-controls .control-section .accordion-section-title:focus,
1425
+ #customize-controls .control-section .accordion-section-title:hover,
1426
+ #customize-controls .control-section.open .accordion-section-title,
1427
+ #customize-controls .control-section:hover > .accordion-section-title
1428
+ {
1429
+ color: #056184;
1430
+ border-left-color: #f5fcff;
1431
+ background: #f5fcff;
1432
+ }
1433
+
1434
+ .wp-customizer
1435
+ {
1436
+ /* SECTION: NAV MENUS */
1437
+ }
1438
+ .wp-customizer .menu-item-edit-active .menu-item-handle,
1439
+ .wp-customizer .section-open .menu-item-settings,
1440
+ .wp-customizer .menu-item-bar .menu-item-handle:hover
1441
+ {
1442
+ border-color: #e0e8ef;
1443
+ }
1444
+ .wp-customizer .section-open .menu-item-settings
1445
+ {
1446
+ background: #f5fcff;
1447
+ }
1448
+ .wp-customizer .control-section-nav_menu .menu-location-settings
1449
+ {
1450
+ border-top-color: #e0e8ef !important;
1451
+ }
1452
+
1453
+ [data-balloon]
1454
+ {
1455
+ position: relative;
1456
+ }
1457
+
1458
+ [data-balloon]::before
1459
+ {
1460
+ font-size: 12px;
1461
+
1462
+ position: absolute;
1463
+ z-index: 10;
1464
+
1465
+ padding: .5em 1em;
1466
+
1467
+ content: attr(data-balloon);
1468
+ transition: all .18s ease-out;
1469
+ white-space: nowrap;
1470
+ pointer-events: none;
1471
+
1472
+ opacity: 0;
1473
+ color: #fff;
1474
+ border-radius: 4px;
1475
+ background: rgba(17, 17, 17, .9);
1476
+ }
1477
+
1478
+ [data-balloon]::after
1479
+ {
1480
+ position: absolute;
1481
+ z-index: 10;
1482
+
1483
+ width: 18px;
1484
+ height: 6px;
1485
+
1486
+ content: '';
1487
+ transition: all .18s ease-out;
1488
+ pointer-events: none;
1489
+
1490
+ opacity: 0;
1491
+ background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="36px" height="12px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(0)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1492
+ background-size: 100% auto;
1493
+ }
1494
+
1495
+ [data-balloon]:hover::before,
1496
+ [data-balloon]:hover::after
1497
+ {
1498
+ pointer-events: auto;
1499
+
1500
+ opacity: 1;
1501
+ }
1502
+
1503
+ [data-balloon][data-balloon-pos='up']::before
1504
+ {
1505
+ bottom: 100%;
1506
+ left: 50%;
1507
+
1508
+ margin-bottom: 11px;
1509
+
1510
+ -webkit-transform: translate3d(-50%, 10px, 0);
1511
+ transform: translate3d(-50%, 10px, 0);
1512
+ -webkit-transform-origin: top;
1513
+ transform-origin: top;
1514
+ }
1515
+
1516
+ [data-balloon][data-balloon-pos='up']::after
1517
+ {
1518
+ bottom: 100%;
1519
+ left: 50%;
1520
+
1521
+ margin-bottom: 5px;
1522
+
1523
+ -webkit-transform: translate3d(-50%, 10px, 0);
1524
+ transform: translate3d(-50%, 10px, 0);
1525
+ -webkit-transform-origin: top;
1526
+ transform-origin: top;
1527
+ }
1528
+
1529
+ [data-balloon][data-balloon-pos='up']:hover::before
1530
+ {
1531
+ -webkit-transform: translate3d(-50%, 0, 0);
1532
+ transform: translate3d(-50%, 0, 0);
1533
+ }
1534
+
1535
+ [data-balloon][data-balloon-pos='up']:hover::after
1536
+ {
1537
+ -webkit-transform: translate3d(-50%, 0, 0);
1538
+ transform: translate3d(-50%, 0, 0);
1539
+ }
1540
+
1541
+ [data-balloon][data-balloon-pos='down']::before
1542
+ {
1543
+ top: 100%;
1544
+ left: 50%;
1545
+
1546
+ margin-top: 11px;
1547
+
1548
+ -webkit-transform: translate3d(-50%, -10px, 0);
1549
+ transform: translate3d(-50%, -10px, 0);
1550
+ }
1551
+
1552
+ [data-balloon][data-balloon-pos='down']::after
1553
+ {
1554
+ top: 100%;
1555
+ left: 50%;
1556
+
1557
+ width: 18px;
1558
+ height: 6px;
1559
+ margin-top: 5px;
1560
+
1561
+ -webkit-transform: translate3d(-50%, -10px, 0);
1562
+ transform: translate3d(-50%, -10px, 0);
1563
+
1564
+ background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="36px" height="12px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(180 18 6)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1565
+ background-size: 100% auto;
1566
+ }
1567
+
1568
+ [data-balloon][data-balloon-pos='down']:hover::before
1569
+ {
1570
+ -webkit-transform: translate3d(-50%, 0, 0);
1571
+ transform: translate3d(-50%, 0, 0);
1572
+ }
1573
+
1574
+ [data-balloon][data-balloon-pos='down']:hover::after
1575
+ {
1576
+ -webkit-transform: translate3d(-50%, 0, 0);
1577
+ transform: translate3d(-50%, 0, 0);
1578
+ }
1579
+
1580
+ [data-balloon][data-balloon-pos='left']::before
1581
+ {
1582
+ top: 50%;
1583
+ right: 100%;
1584
+
1585
+ margin-right: 11px;
1586
+
1587
+ -webkit-transform: translate3d(10px, -50%, 0);
1588
+ transform: translate3d(10px, -50%, 0);
1589
+ }
1590
+
1591
+ [data-balloon][data-balloon-pos='left']::after
1592
+ {
1593
+ top: 50%;
1594
+ right: 100%;
1595
+
1596
+ width: 6px;
1597
+ height: 18px;
1598
+ margin-right: 5px;
1599
+
1600
+ -webkit-transform: translate3d(10px, -50%, 0);
1601
+ transform: translate3d(10px, -50%, 0);
1602
+
1603
+ background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12px" height="36px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(-90 18 18)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1604
+ background-size: 100% auto;
1605
+ }
1606
+
1607
+ [data-balloon][data-balloon-pos='left']:hover::before
1608
+ {
1609
+ -webkit-transform: translate3d(0, -50%, 0);
1610
+ transform: translate3d(0, -50%, 0);
1611
+ }
1612
+
1613
+ [data-balloon][data-balloon-pos='left']:hover::after
1614
+ {
1615
+ -webkit-transform: translate3d(0, -50%, 0);
1616
+ transform: translate3d(0, -50%, 0);
1617
+ }
1618
+
1619
+ [data-balloon][data-balloon-pos='right']::before
1620
+ {
1621
+ top: 50%;
1622
+ left: 100%;
1623
+
1624
+ margin-left: 11px;
1625
+
1626
+ -webkit-transform: translate3d(-10px, -50%, 0);
1627
+ transform: translate3d(-10px, -50%, 0);
1628
+ }
1629
+
1630
+ [data-balloon][data-balloon-pos='right']::after
1631
+ {
1632
+ top: 50%;
1633
+ left: 100%;
1634
+
1635
+ width: 6px;
1636
+ height: 18px;
1637
+ margin-left: 5px;
1638
+
1639
+ -webkit-transform: translate3d(-10px, -50%, 0);
1640
+ transform: translate3d(-10px, -50%, 0);
1641
+
1642
+ background: no-repeat url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12px" height="36px"><path fill="rgba(17, 17, 17, 0.9)" transform="rotate(90 6 6)" d="M2.658,0.000 C-13.615,0.000 50.938,0.000 34.662,0.000 C28.662,0.000 23.035,12.002 18.660,12.002 C14.285,12.002 8.594,0.000 2.658,0.000 Z"/></svg>');
1643
+ background-size: 100% auto;
1644
+ }
1645
+
1646
+ [data-balloon][data-balloon-pos='right']:hover::before
1647
+ {
1648
+ -webkit-transform: translate3d(0, -50%, 0);
1649
+ transform: translate3d(0, -50%, 0);
1650
+ }
1651
+
1652
+ [data-balloon][data-balloon-pos='right']:hover::after
1653
+ {
1654
+ -webkit-transform: translate3d(0, -50%, 0);
1655
+ transform: translate3d(0, -50%, 0);
1656
+ }
1657
+
1658
+ [data-balloon][data-balloon-length='small']::before
1659
+ {
1660
+ width: 80px;
1661
+
1662
  white-space: normal;
1663
+ }
1664
 
1665
+ [data-balloon][data-balloon-length='medium']::before
1666
+ {
1667
+ width: 150px;
1668
 
1669
+ white-space: normal;
1670
+ }
 
1671
 
1672
+ [data-balloon][data-balloon-length='large']::before
1673
+ {
1674
+ width: 260px;
 
 
1675
 
1676
+ white-space: normal;
1677
+ }
 
1678
 
1679
+ [data-balloon][data-balloon-length='xlarge']::before
1680
+ {
1681
+ width: 380px;
1682
 
1683
+ white-space: normal;
1684
+ }
 
 
 
 
1685
 
1686
+ @media screen and (max-width: 768px)
1687
+ {
1688
+ [data-balloon][data-balloon-length='xlarge']::before
1689
+ {
1690
+ width: 90vw;
1691
 
1692
+ white-space: normal;
1693
+ }
1694
+ }
1695
 
1696
+ [data-balloon][data-balloon-length='fit']::before
1697
+ {
1698
+ width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1699
 
1700
+ white-space: normal;
1701
+ }
1702
+
1703
+ .font-options__wrapper .font-options__options-list
1704
+ {
1705
+ border-color: #b8daeb;
1706
+ box-shadow: 0 10px 20px 0 rgba(0, 0, 0, .15);
1707
+ }
1708
+
1709
+ .font-options__wrapper .font-options__option
1710
+ {
1711
+ margin-bottom: 12px;
1712
+ }
1713
+ .font-options__wrapper .font-options__option label
1714
+ {
1715
+ display: block;
1716
 
1717
+ margin-bottom: 6px;
1718
+ }
 
1719
 
1720
+ .font-options__wrapper [type=checkbox]:checked ~ .font-options__options-list
1721
+ {
1722
+ display: block;
 
 
1723
 
1724
+ opacity: 1;
1725
+ }
1726
 
1727
+ input.customify_font_tooltip
1728
+ {
1729
+ display: none;
1730
+ }
1731
 
1732
+ ul.font-options__options-list .select2-container
1733
+ {
1734
+ width: 100% !important;
1735
+ }
1736
+ ul.font-options__options-list .select2-container .select2-selection--single
1737
+ {
1738
+ -webkit-appearance: initial;
1739
+ }
1740
+ ul.font-options__options-list .select2-container .select2-selection--single .select2-selection__arrow
1741
+ {
1742
+ display: none;
1743
+ }
1744
+
1745
+ ul.font-options__options-list .select2-container--default .select2-selection--single .select2-selection__rendered
1746
+ {
1747
+ line-height: initial;
1748
+
1749
+ color: inherit;
1750
+ }
1751
+
1752
+ .select2-container.select2-container--open
1753
+ {
1754
+ z-index: 99999999;
1755
+ }
1756
+
1757
+ #customize-theme-controls .select2-container
1758
+ {
1759
+ width: 100% !important;
1760
+ }
1761
+ #customize-theme-controls .select2-container .select2-selection--multiple
1762
+ {
1763
+ height: auto;
1764
+ padding: 8px 8px 4px;
1765
+
1766
+ background: none;
1767
+
1768
+ -webkit-appearance: initial;
1769
+ }
1770
+ #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__arrow
1771
+ {
1772
+ display: none;
1773
+ }
1774
+ #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__rendered
1775
+ {
1776
+ padding: 0;
1777
+ }
1778
+ #customize-theme-controls .select2-container .select2-selection--multiple .select2-selection__rendered .select2-selection__choice
1779
+ {
1780
+ margin-top: 0;
1781
+ margin-right: 6px;
1782
+ padding: 3px 7px;
1783
+
1784
+ border-color: #e0e8ef;
1785
+ background-color: #f6fbff;
1786
+ }
1787
+ #customize-theme-controls .select2-container .select2-search--inline .select2-search__field
1788
+ {
1789
+ height: 24px;
1790
+ }
1791
+
1792
+ .select2-container .select2-dropdown
1793
+ {
1794
+ border-color: #e0e8ef;
1795
+ }
1796
+
1797
+ #customize-theme-controls .widget-content .accordion-container
1798
+ {
1799
+ margin-top: 20px;
1800
+ margin-right: -10px;
1801
+ margin-bottom: 10px;
1802
+ margin-left: -10px;
1803
+ }
1804
+ #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content
1805
+ {
1806
+ position: relative;
1807
+ left: 0;
1808
 
1809
+ overflow: hidden;
 
1810
 
1811
+ max-height: 0;
1812
+ padding-top: 0;
1813
+ padding-bottom: 0;
1814
 
1815
+ transition: all .4s ease;
 
1816
 
1817
+ color: #416b7e;
1818
+ }
1819
+ #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content p:first-child
1820
+ {
1821
+ margin-top: 0;
1822
+ }
1823
+ #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-content p:last-child
1824
+ {
1825
+ margin-bottom: 0;
1826
+ }
1827
+ #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-title
1828
+ {
1829
+ color: #39474d;
1830
+ }
1831
+ #customize-theme-controls .widget-content .accordion-container .accordion-section .accordion-section-title:after
1832
+ {
1833
+ content: '\f142';
1834
+ -webkit-transform: rotate(180deg);
1835
+ transform: rotate(180deg);
1836
+ }
1837
+ #customize-theme-controls .widget-content .accordion-container .accordion-section.open
1838
+ {
1839
+ border-bottom: none;
1840
+ }
1841
+ #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-content
1842
+ {
1843
+ max-height: 100%;
1844
+ padding-top: 17px;
1845
+ padding-bottom: 17px;
1846
+ }
1847
+ #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-title
1848
+ {
1849
+ border-bottom: 1px solid;
1850
+ }
1851
+ #customize-theme-controls .widget-content .accordion-container .accordion-section.open .accordion-section-title:after
1852
+ {
1853
+ -webkit-transform: rotate(0deg);
1854
+ transform: rotate(0deg);
1855
+ }
1856
+ #customize-theme-controls .widget-content .accordion-container label.customize-control-title,
1857
+ #customize-theme-controls .widget-content .accordion-container label.separator.label
1858
+ {
1859
+ cursor: default;
1860
+ }
1861
 
1862
+ .widget .widget-content > p input[type=checkbox],
1863
+ .widget .widget-content > p input[type=radio]
1864
+ {
1865
+ margin-top: 3px;
1866
+ margin-bottom: 3px;
1867
+ }
 
 
1868
 
1869
+ .widget .widget-content small
1870
+ {
1871
+ display: block;
1872
 
1873
+ margin-top: 5px;
1874
+ }
 
1875
 
1876
+ #available-widgets [class*=pixelgrade] .widget .widget-title:before,
1877
+ #available-widgets [class*=featured-posts] .widget .widget-title:before,
1878
+ #available-widgets [class*=categories-image-grid] .widget .widget-title:before
1879
+ {
1880
+ content: '\f538';
1881
+
1882
+ color: #9660c6;
1883
+ }
1884
+
1885
+ #available-widgets [class*=pixelgrade-featured-posts-slideshow] .widget .widget-title:before
1886
+ {
1887
+ content: '\f233';
1888
+ }
1889
+
1890
+ #available-widgets [class*=pixelgrade-featured-posts-carousel] .widget .widget-title:before
1891
+ {
1892
+ content: '\f169';
1893
+ }
1894
+
1895
+ #available-widgets [class*=featured-posts-grid] .widget .widget-title:before
1896
+ {
1897
+ content: '\f180';
1898
+ }
1899
+
1900
+ #available-widgets [class*=featured-posts-list] .widget .widget-title:before
1901
+ {
1902
+ content: '\f164';
1903
+ }
1904
+
1905
+ #available-widgets [class*=categories-image-grid] .widget .widget-title:before
1906
+ {
1907
+ content: '\f163';
1908
+ }
1909
+
1910
+ #available-widgets [class*=pixelgrade-promo-box] .widget .widget-title:before
1911
+ {
1912
+ content: '\f488';
1913
+ }
1914
+
1915
+ .wp-customizer .widget-conditional .condition-control:after
1916
+ {
1917
+ display: table;
1918
+ clear: both;
1919
+
1920
+ content: ' ';
1921
+ }
1922
+
1923
+ .wp-customizer .widget-conditional .selection
1924
+ {
1925
+ margin-right: 0;
1926
+ margin-bottom: 10px;
1927
+ margin-left: 0;
1928
+ padding-right: 50px;
1929
+ padding-bottom: 19px;
1930
+ padding-left: 28px;
1931
+
1932
+ border-bottom: 1px solid #cbcfd4;
1933
+ }
1934
+
1935
+ .wp-customizer .widget-conditional .condition:last-child .selection
1936
+ {
1937
+ border: 0;
1938
+ }
1939
+
1940
+ .wp-customizer .widget-conditional select
1941
+ {
1942
+ width: 170px;
1943
+ max-width: 100%;
1944
+ }
1945
+
1946
+ .wp-customizer .widget-conditional .condition-top select
1947
+ {
1948
+ width: 130px;
1949
+ }
customify.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Customify
4
  Plugin URI: https://wordpress.org/plugins/customify/
5
  Description: A Theme Customizer Booster
6
- Version: 1.5.6
7
  Author: Pixelgrade
8
  Author URI: https://pixelgrade.com
9
  Author Email: contact@pixelgrade.com
@@ -14,7 +14,7 @@ Domain Path: /languages/
14
  */
15
 
16
  // If this file is called directly, abort.
17
- if ( ! defined( 'WPINC' ) ) {
18
  die;
19
  }
20
 
@@ -52,9 +52,14 @@ if ( $current_data === false ) {
52
  * @return PixCustomifyPlugin
53
  */
54
  function PixCustomifyPlugin() {
55
-
 
 
 
56
  require_once( plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php' );
57
- $instance = PixCustomifyPlugin::instance( __FILE__, '1.5.5' );
 
 
58
  return $instance;
59
  }
60
 
3
  Plugin Name: Customify
4
  Plugin URI: https://wordpress.org/plugins/customify/
5
  Description: A Theme Customizer Booster
6
+ Version: 1.5.7
7
  Author: Pixelgrade
8
  Author URI: https://pixelgrade.com
9
  Author Email: contact@pixelgrade.com
14
  */
15
 
16
  // If this file is called directly, abort.
17
+ if ( ! defined( 'ABSPATH' ) ) {
18
  die;
19
  }
20
 
52
  * @return PixCustomifyPlugin
53
  */
54
  function PixCustomifyPlugin() {
55
+ /**
56
+ * The core plugin class that is used to define internationalization,
57
+ * admin-specific hooks, and public-facing site hooks.
58
+ */
59
  require_once( plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php' );
60
+
61
+ $instance = PixCustomifyPlugin::instance( __FILE__, '1.5.7' );
62
+
63
  return $instance;
64
  }
65
 
gulpfile.js DELETED
@@ -1,180 +0,0 @@
1
- var plugin = 'customify',
2
- source_SCSS = 'scss/**/*.scss',
3
- dest_CSS = './css/',
4
-
5
- gulp = require('gulp'),
6
- sass = require('gulp-sass'),
7
- prefix = require('gulp-autoprefixer'),
8
- exec = require('gulp-exec'),
9
- replace = require('gulp-replace'),
10
- minify = require('gulp-minify-css'),
11
- concat = require('gulp-concat'),
12
- notify = require('gulp-notify'),
13
- beautify = require('gulp-beautify'),
14
- csscomb = require('gulp-csscomb'),
15
- cmq = require('gulp-combine-media-queries'),
16
- fs = require('fs'),
17
- rtlcss = require('rtlcss'),
18
- postcss = require('gulp-postcss'),
19
- del = require('del'),
20
- rename = require('gulp-rename');
21
-
22
- require('es6-promise').polyfill();
23
-
24
- var jsFiles = [
25
- './assets/js/vendor/*.js',
26
- './assets/js/main/wrapper_start.js',
27
- './assets/js/main/shared_vars.js',
28
- './assets/js/modules/*.js',
29
- './assets/js/main/main.js',
30
- './assets/js/main/functions.js',
31
- './assets/js/main/wrapper_end.js'
32
- ];
33
-
34
-
35
- var options = {
36
- silent: true,
37
- continueOnError: true // default: false
38
- };
39
-
40
- // styles related
41
- gulp.task('styles-dev', function () {
42
- return gulp.src(source_SCSS)
43
- .pipe(sass({'sourcemap': false, style: 'compact'}))
44
- .on('error', function (e) {
45
- console.log(e.message);
46
- })
47
- .pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7"))
48
- .pipe(gulp.dest(dest_CSS));
49
- // .pipe(postcss([
50
- // require('rtlcss')({ /* options */ })
51
- // ]))
52
- // .pipe(rename("rtl.css"))
53
- // .pipe(gulp.dest('./'))
54
- });
55
-
56
- gulp.task('styles', function () {
57
- return gulp.src(source_SCSS)
58
- .pipe(sass({'sourcemap': true, style: 'expanded'}))
59
- .pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7"))
60
- .pipe(csscomb())
61
- .pipe(gulp.dest(dest_CSS, {"mode": "0644"}))
62
- });
63
-
64
- gulp.task('styles-watch', function () {
65
- return gulp.watch(source_SCSS, ['styles']);
66
- });
67
-
68
- // javascript stuff
69
- gulp.task('scripts', function () {
70
- return gulp.src(jsFiles)
71
- .pipe(concat('main.js'))
72
- .pipe(beautify({indentSize: 2}))
73
- .pipe(gulp.dest('./assets/js/', {"mode": "0644"}));
74
- });
75
-
76
- gulp.task('scripts-watch', function () {
77
- return gulp.watch(source_SCSS, ['scripts']);
78
- });
79
-
80
- gulp.task('watch', function () {
81
- gulp.watch(source_SCSS, ['styles-dev']);
82
- // gulp.watch('assets/js/**/*.js', ['scripts']);
83
- });
84
-
85
- // usually there is a default task for lazy people who just wanna type gulp
86
- gulp.task('start', ['styles', 'scripts'], function () {
87
- // silence
88
- });
89
-
90
- gulp.task('server', ['styles', 'scripts'], function () {
91
- console.log('The styles and scripts have been compiled for production! Go and clear the caches!');
92
- });
93
-
94
-
95
- /**
96
- * Create a zip archive out of the cleaned folder and delete the folder
97
- */
98
- gulp.task( 'zip', ['build'], function() {
99
-
100
- return gulp.src( './' )
101
- .pipe( exec( 'cd ./../; rm -rf customify.zip; cd ./build/; zip -r -X ./../customify.zip ./customify; cd ./../; rm -rf build' ) );
102
-
103
- } );
104
-
105
- /**
106
- * Copy theme folder outside in a build folder, recreate styles before that
107
- */
108
- gulp.task( 'copy-folder', function() {
109
-
110
- return gulp.src( './' )
111
- .pipe( exec( 'rm -Rf ./../build; mkdir -p ./../build/customify; cp -Rf ./* ./../build/customify/' ) );
112
- } );
113
-
114
- /**
115
- * Clean the folder of unneeded files and folders
116
- */
117
- gulp.task( 'build', ['copy-folder'], function() {
118
-
119
- // files that should not be present in build zip
120
- files_to_remove = [
121
- '**/codekit-config.json',
122
- 'node_modules',
123
- 'config.rb',
124
- 'gulpfile.js',
125
- 'package.json',
126
- 'pxg.json',
127
- 'build',
128
- '.idea',
129
- '**/*.css.map',
130
- '**/.git*',
131
- '*.sublime-project',
132
- '.DS_Store',
133
- '**/.DS_Store',
134
- '__MACOSX',
135
- '**/__MACOSX',
136
- '+development.rb',
137
- '+production.rb',
138
- 'README.md',
139
- '.labels'
140
- ];
141
-
142
- files_to_remove.forEach( function( e, k ) {
143
- files_to_remove[k] = '../build/customify/' + e;
144
- } );
145
-
146
- return del.sync(files_to_remove, {force: true});
147
- } );
148
-
149
- // usually there is a default task for lazy people who just wanna type gulp
150
- gulp.task('default', ['start'], function () {
151
- // silence
152
- });
153
-
154
- /**
155
- * Short commands help
156
- */
157
-
158
- gulp.task('help', function () {
159
-
160
- var $help = '\nCommands available : \n \n' +
161
- '=== General Commands === \n' +
162
- 'start (default)Compiles all styles and scripts and makes the theme ready to start \n' +
163
- 'zip Generate the zip archive \n' +
164
- 'build Generate the build directory with the cleaned theme \n' +
165
- 'help Print all commands \n' +
166
- '=== Style === \n' +
167
- 'styles Compiles styles in production mode\n' +
168
- 'styles-dev Compiles styles in development mode \n' +
169
- 'styles-admin Compiles admin styles \n' +
170
- '=== Scripts === \n' +
171
- 'scripts Concatenate all js scripts \n' +
172
- 'scripts-dev Concatenate all js scripts \n' +
173
- '=== Watchers === \n' +
174
- 'watch Watches all js and scss files \n' +
175
- 'styles-watch Watch only styles\n' +
176
- 'scripts-watch Watch scripts only \n';
177
-
178
- console.log($help);
179
-
180
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/customizer.js CHANGED
@@ -62,18 +62,10 @@
62
  });
63
 
64
  // for each range input add a value preview output
65
- $('input[type="range"]').each(function () {
66
- var $clone = $(this).clone();
67
 
68
- $clone
69
- .attr('type', 'number')
70
- .attr('class', 'range-value');
71
-
72
- $(this).after($clone);
73
-
74
- $(this).on('input', function () {
75
- $(this).siblings('.range-value').val($(this).val());
76
- });
77
  });
78
 
79
  if ( $('button[data-action="reset_customify"]').length > 0 ) {
@@ -107,11 +99,12 @@
107
  // add a reset button for each panel
108
  $('.panel-meta').each(function ( el, key ) {
109
  var container = $(this).parents('.control-panel'),
110
- id = container.attr('id'),
111
- panel_id = id.replace('accordion-panel-', '');
112
 
113
-
114
- $(this).parent().append('<button class="reset_panel button" data-panel="' + panel_id + '">Panel\'s defaults</button>');
 
 
115
  });
116
 
117
  // reset panel
@@ -152,16 +145,15 @@
152
 
153
  //add reset section
154
  $('.accordion-section-content').each(function ( el, key ) {
155
- var section = $(this).parent(),
156
- section_id = section.attr('id');
157
 
158
  if ( ( ( !_.isUndefined(section_id) ) ? section_id.indexOf(customify_settings.options_name) : -1 ) === -1 ) {
159
  return;
160
  }
161
 
162
- if ( !_.isUndefined(section_id) && section_id.indexOf('accordion-section-') > -1 ) {
163
- var id = section_id.replace('accordion-section-', '');
164
- $(this).prepend('<button class="reset_section button" data-section="' + id + '">Section\'s defaults</button>');
165
  }
166
  });
167
 
@@ -342,10 +334,36 @@
342
  })();
343
  });
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  /**
346
  * This function will search for all the interdependend fields and make a bound between them.
347
  * So whenever a target is changed, it will take actions to the dependent fields.
348
- * @TOOD this is still written in a barbaric way, refactor when needed
349
  */
350
  var customifyFoldingFields = function () {
351
 
@@ -557,6 +575,7 @@
557
  field = $('[data-customize-setting-link="' + setting_id + '"]'),
558
  field_class = $(field).parent().attr('class');
559
 
 
560
  if ( !_.isUndefined(field_class) && field_class === 'customify_typography' ) {
561
 
562
  var family_select = field.siblings('select');
@@ -596,7 +615,40 @@
596
  option.attr('selected', 'selected');
597
  // option.parents('select').trigger('change');
598
  } else if ( _.isObject(value) ) {
599
- // @todo process each font property
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
600
  }
601
 
602
  } else {
@@ -995,7 +1047,7 @@
995
  debug: false
996
  };
997
 
998
- // all this fuss is for the case when the font doesn't come with variants from PHP, lile a theme_font
999
  if ( this.options.length === 0 ) {
1000
  var wraper = $(el).closest('.font-options__wrapper'),
1001
  font = wraper.find('.customify_font_family'),
@@ -1031,7 +1083,7 @@
1031
  .on('change', function ( e ) {
1032
  var wraper = $(e.target).closest('.font-options__wrapper');
1033
  var current_value = update_font_value(wraper);
1034
- // temporary just set the new value and refresh the previewr
1035
  // we may update this with a live version sometime
1036
  var value_holder = wraper.children('.customify_font_values');
1037
  var setting_id = $(value_holder).data('customize-setting-link');
@@ -1094,9 +1146,9 @@
1094
  }
1095
 
1096
  /**
1097
- * This function updates the data in font weight selector from the givin <option> element
1098
  *
1099
- * @param new_option
1100
  * @param wraper
1101
  */
1102
  function update_weight_field( option, wraper ) {
@@ -1139,8 +1191,8 @@
1139
  }
1140
 
1141
  /**
1142
- * This function updates the data in font subset selector from the givin <option> element
1143
- * @param new_option
1144
  * @param wraper
1145
  */
1146
  function update_subset_field( option, wraper ) {
@@ -1225,7 +1277,7 @@
1225
  new_vals['variants'] = maybeJsonParse(variants);
1226
  }
1227
 
1228
- if ( typeof subsets !== "subsets") {
1229
  new_vals['subsets'] = maybeJsonParse(subsets);
1230
  }
1231
  }
62
  });
63
 
64
  // for each range input add a value preview output
65
+ $('.accordion-section-content[id*="' + customify_settings.options_name + '"]').each(function () {
 
66
 
67
+ // Initialize range fields logic
68
+ customifyHandleRangeFields(this);
 
 
 
 
 
 
 
69
  });
70
 
71
  if ( $('button[data-action="reset_customify"]').length > 0 ) {
99
  // add a reset button for each panel
100
  $('.panel-meta').each(function ( el, key ) {
101
  var container = $(this).parents('.control-panel'),
102
+ id = container.attr('id');
 
103
 
104
+ if ( typeof id !== 'undefined' ) {
105
+ var panel_id = id.replace('accordion-panel-', '');
106
+ $(this).parent().append('<button class="reset_panel button" data-panel="' + panel_id + '">Panel\'s defaults</button>');
107
+ }
108
  });
109
 
110
  // reset panel
145
 
146
  //add reset section
147
  $('.accordion-section-content').each(function ( el, key ) {
148
+ var section_id = $(this).attr('id');
 
149
 
150
  if ( ( ( !_.isUndefined(section_id) ) ? section_id.indexOf(customify_settings.options_name) : -1 ) === -1 ) {
151
  return;
152
  }
153
 
154
+ if ( !_.isUndefined(section_id) && section_id.indexOf('sub-accordion-section-') > -1 ) {
155
+ var id = section_id.replace('sub-accordion-section-', '');
156
+ $(this).append('<button class="reset_section button" data-section="' + id + '">Reset All Options for This Section</button>');
157
  }
158
  });
159
 
334
  })();
335
  });
336
 
337
+ var customifyHandleRangeFields = function (el) {
338
+
339
+ // For each range input add a number field (for preview mainly - but it can also be used for input)
340
+ $(el).find('input[type="range"]').each(function () {
341
+ if ( ! $(this).siblings('.range-value').length ) {
342
+ var $clone = $(this).clone();
343
+
344
+ $clone
345
+ .attr('type', 'number')
346
+ .attr('class', 'range-value');
347
+
348
+ $(this).after($clone);
349
+ }
350
+
351
+ // Update the number field when changing the range
352
+ $(this).on('change', function () {
353
+ $(this).siblings('.range-value').val($(this).val());
354
+ });
355
+
356
+ // And the other way around, update the range field when changing the number
357
+ $($clone).on('change', function () {
358
+ $(this).siblings('input[type="range"]').val($(this).val());
359
+ });
360
+ });
361
+ }
362
+
363
  /**
364
  * This function will search for all the interdependend fields and make a bound between them.
365
  * So whenever a target is changed, it will take actions to the dependent fields.
366
+ * @TODO this is still written in a barbaric way, refactor when needed
367
  */
368
  var customifyFoldingFields = function () {
369
 
575
  field = $('[data-customize-setting-link="' + setting_id + '"]'),
576
  field_class = $(field).parent().attr('class');
577
 
578
+ // Legacy field type
579
  if ( !_.isUndefined(field_class) && field_class === 'customify_typography' ) {
580
 
581
  var family_select = field.siblings('select');
615
  option.attr('selected', 'selected');
616
  // option.parents('select').trigger('change');
617
  } else if ( _.isObject(value) ) {
618
+ // Find the options list wrapper
619
+ var optionsList = field.parent().children('.font-options__options-list');
620
+
621
+ if ( optionsList.length ) {
622
+ // We will process each font property and update it
623
+ _.each(value, function (val, key) {
624
+ // We need to map the keys to the data attributes we are using - I know :(
625
+ var mappedKey = key;
626
+ switch (key) {
627
+ case 'font-family':
628
+ mappedKey = 'font_family';
629
+ break;
630
+ case 'font-size':
631
+ mappedKey = 'font_size';
632
+ break;
633
+ case 'font-weight':
634
+ mappedKey = 'selected_variants';
635
+ break;
636
+ case 'letter-spacing':
637
+ mappedKey = 'letter_spacing';
638
+ break;
639
+ case 'text-transform':
640
+ mappedKey = 'text_transform';
641
+ break;
642
+ default:
643
+ break;
644
+ }
645
+ var subField = optionsList.find('[data-field="' + mappedKey + '"]');
646
+ if ( subField.length ) {
647
+ subField.val(val);
648
+ subField.trigger('change');
649
+ }
650
+ });
651
+ }
652
  }
653
 
654
  } else {
1047
  debug: false
1048
  };
1049
 
1050
+ // all this fuss is for the case when the font doesn't come with variants from PHP, like a theme_font
1051
  if ( this.options.length === 0 ) {
1052
  var wraper = $(el).closest('.font-options__wrapper'),
1053
  font = wraper.find('.customify_font_family'),
1083
  .on('change', function ( e ) {
1084
  var wraper = $(e.target).closest('.font-options__wrapper');
1085
  var current_value = update_font_value(wraper);
1086
+ // temporary just set the new value and refresh the previewer
1087
  // we may update this with a live version sometime
1088
  var value_holder = wraper.children('.customify_font_values');
1089
  var setting_id = $(value_holder).data('customize-setting-link');
1146
  }
1147
 
1148
  /**
1149
+ * This function updates the data in font weight selector from the given <option> element
1150
  *
1151
+ * @param option
1152
  * @param wraper
1153
  */
1154
  function update_weight_field( option, wraper ) {
1191
  }
1192
 
1193
  /**
1194
+ * This function updates the data in font subset selector from the given <option> element
1195
+ * @param option
1196
  * @param wraper
1197
  */
1198
  function update_subset_field( option, wraper ) {
1277
  new_vals['variants'] = maybeJsonParse(variants);
1278
  }
1279
 
1280
+ if ( typeof subsets !== "undefined") {
1281
  new_vals['subsets'] = maybeJsonParse(subsets);
1282
  }
1283
  }
js/select2/js/i18n/af.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Verwyders asseblief "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Voer asseblief "+t+" of meer karakters";return n},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var t="Kies asseblief net "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/ar.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum;return"الرجاء حذف "+t+" عناصر"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"الرجاء إضافة "+t+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){return"تستطيع إختيار "+e.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/az.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/bg.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/bs.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bs",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/ca.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/cs.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadejte o jeden znak méně.":n<=4?"Prosím, zadejte o "+e(n,!0)+" znaky méně.":"Prosím, zadejte o "+n+" znaků méně."},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadejte ještě jeden znak.":n<=4?"Prosím, zadejte ještě další "+e(n,!0)+" znaky.":"Prosím, zadejte ještě dalších "+n+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku.":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky.":"Můžete zvolit maximálně "+n+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/da.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Angiv venligst "+t+" tegn mindre"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Angiv venligst "+t+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/de.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/el.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/en.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/es.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/et.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/eu.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/fa.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/fi.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/fr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1)?"s":""},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1)?"s":""},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1)?"s":""},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/gl.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var t=e.input.length-e.maximum;return t===1?"Elimine un carácter":"Elimine "+t+" caracteres"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t===1?"Engada un carácter":"Engada "+t+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return e.maximum===1?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/he.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/hi.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/hr.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/hu.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/hy.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Խնդրում ենք հեռացնել "+t+" նշան";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Խնդրում ենք մուտքագրել "+t+" կամ ավել նշաններ";return n},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(e){var t="Դուք կարող եք ընտրել առավելագույնը "+e.maximum+" կետ";return t},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/id.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/is.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/it.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/ja.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/km.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/ko.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
 
3
  (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
js/select2/js/i18n/lt.js DELETED
@@ -1,3 +0,0 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
-
3
- (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
 
 
 
js/select2/js/select2.full.js CHANGED
@@ -1,6141 +1,6162 @@
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('select2/compat/utils',[
5643
- 'jquery'
5644
- ], function ($) {
5645
- function syncCssClasses ($dest, $src, adapter) {
5646
- var classes, replacements = [], adapted;
5647
 
5648
- classes = $.trim($dest.attr('class'));
 
 
5649
 
5650
- if (classes) {
5651
- classes = '' + classes; // for IE which returns object
5652
 
5653
- $(classes.split(/\s+/)).each(function () {
5654
- // Save all Select2 classes
5655
- if (this.indexOf('select2-') === 0) {
5656
- replacements.push(this);
5657
- }
5658
- });
5659
- }
5660
 
5661
- classes = $.trim($src.attr('class'));
 
 
 
5662
 
5663
- if (classes) {
5664
- classes = '' + classes; // for IE which returns object
5665
 
5666
- $(classes.split(/\s+/)).each(function () {
5667
- // Only adapt non-Select2 classes
5668
- if (this.indexOf('select2-') !== 0) {
5669
- adapted = adapter(this);
5670
 
5671
- if (adapted != null) {
5672
- replacements.push(adapted);
5673
- }
5674
- }
5675
- });
5676
- }
5677
 
5678
- $dest.attr('class', replacements.join(' '));
5679
- }
 
5680
 
5681
- return {
5682
- syncCssClasses: syncCssClasses
5683
- };
5684
- });
5685
 
5686
- S2.define('select2/compat/containerCss',[
5687
- 'jquery',
5688
- './utils'
5689
- ], function ($, CompatUtils) {
5690
- // No-op CSS adapter that discards all classes by default
5691
- function _containerAdapter (clazz) {
5692
- return null;
5693
- }
5694
 
5695
- function ContainerCSS () { }
 
 
5696
 
5697
- ContainerCSS.prototype.render = function (decorated) {
5698
- var $container = decorated.call(this);
5699
 
5700
- var containerCssClass = this.options.get('containerCssClass') || '';
 
 
5701
 
5702
- if ($.isFunction(containerCssClass)) {
5703
- containerCssClass = containerCssClass(this.$element);
5704
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5705
 
5706
- var containerCssAdapter = this.options.get('adaptContainerCssClass');
5707
- containerCssAdapter = containerCssAdapter || _containerAdapter;
5708
 
5709
- if (containerCssClass.indexOf(':all:') !== -1) {
5710
- containerCssClass = containerCssClass.replace(':all:', '');
 
 
5711
 
5712
- var _cssAdapter = containerCssAdapter;
 
 
5713
 
5714
- containerCssAdapter = function (clazz) {
5715
- var adapted = _cssAdapter(clazz);
 
5716
 
5717
- if (adapted != null) {
5718
- // Append the old one along with the adapted one
5719
- return adapted + ' ' + clazz;
5720
- }
5721
 
5722
- return clazz;
5723
- };
5724
- }
 
5725
 
5726
- var containerCss = this.options.get('containerCss') || {};
 
 
5727
 
5728
- if ($.isFunction(containerCss)) {
5729
- containerCss = containerCss(this.$element);
5730
- }
5731
 
5732
- CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
 
 
 
5733
 
5734
- $container.css(containerCss);
5735
- $container.addClass(containerCssClass);
5736
 
5737
- return $container;
5738
- };
 
 
5739
 
5740
- return ContainerCSS;
5741
- });
5742
 
5743
- S2.define('select2/compat/dropdownCss',[
5744
- 'jquery',
5745
- './utils'
5746
- ], function ($, CompatUtils) {
5747
- // No-op CSS adapter that discards all classes by default
5748
- function _dropdownAdapter (clazz) {
5749
- return null;
5750
- }
5751
 
5752
- function DropdownCSS () { }
 
 
5753
 
5754
- DropdownCSS.prototype.render = function (decorated) {
5755
- var $dropdown = decorated.call(this);
 
5756
 
5757
- var dropdownCssClass = this.options.get('dropdownCssClass') || '';
 
 
5758
 
5759
- if ($.isFunction(dropdownCssClass)) {
5760
- dropdownCssClass = dropdownCssClass(this.$element);
5761
- }
5762
 
5763
- var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
5764
- dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
 
 
5765
 
5766
- if (dropdownCssClass.indexOf(':all:') !== -1) {
5767
- dropdownCssClass = dropdownCssClass.replace(':all:', '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5768
 
5769
- var _cssAdapter = dropdownCssAdapter;
 
 
 
 
5770
 
5771
- dropdownCssAdapter = function (clazz) {
5772
- var adapted = _cssAdapter(clazz);
5773
 
5774
- if (adapted != null) {
5775
- // Append the old one along with the adapted one
5776
- return adapted + ' ' + clazz;
5777
- }
5778
 
5779
- return clazz;
5780
- };
5781
- }
 
 
5782
 
5783
- var dropdownCss = this.options.get('dropdownCss') || {};
 
 
 
 
 
 
 
 
 
 
 
 
5784
 
5785
- if ($.isFunction(dropdownCss)) {
5786
- dropdownCss = dropdownCss(this.$element);
5787
- }
 
 
 
 
5788
 
5789
- CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
5790
-
5791
- $dropdown.css(dropdownCss);
5792
- $dropdown.addClass(dropdownCssClass);
5793
-
5794
- return $dropdown;
5795
- };
5796
-
5797
- return DropdownCSS;
5798
- });
5799
-
5800
- S2.define('select2/compat/initSelection',[
5801
- 'jquery'
5802
- ], function ($) {
5803
- function InitSelection (decorated, $element, options) {
5804
- if (options.get('debug') && window.console && console.warn) {
5805
- console.warn(
5806
- 'Select2: The `initSelection` option has been deprecated in favor' +
5807
- ' of a custom data adapter that overrides the `current` method. ' +
5808
- 'This method is now called multiple times instead of a single ' +
5809
- 'time when the instance is initialized. Support will be removed ' +
5810
- 'for the `initSelection` option in future versions of Select2'
5811
- );
5812
- }
5813
 
5814
- this.initSelection = options.get('initSelection');
5815
- this._isInitialized = false;
 
 
 
 
 
 
 
5816
 
5817
- decorated.call(this, $element, options);
5818
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5819
 
5820
- InitSelection.prototype.current = function (decorated, callback) {
5821
- var self = this;
 
 
 
 
 
5822
 
5823
- if (this._isInitialized) {
5824
- decorated.call(this, callback);
5825
 
5826
- return;
5827
- }
5828
 
5829
- this.initSelection.call(null, this.$element, function (data) {
5830
- self._isInitialized = true;
5831
-
5832
- if (!$.isArray(data)) {
5833
- data = [data];
5834
- }
5835
-
5836
- callback(data);
5837
- });
5838
- };
5839
-
5840
- return InitSelection;
5841
- });
5842
-
5843
- S2.define('select2/compat/inputData',[
5844
- 'jquery'
5845
- ], function ($) {
5846
- function InputData (decorated, $element, options) {
5847
- this._currentData = [];
5848
- this._valueSeparator = options.get('valueSeparator') || ',';
5849
-
5850
- if ($element.prop('type') === 'hidden') {
5851
- if (options.get('debug') && console && console.warn) {
5852
- console.warn(
5853
- 'Select2: Using a hidden input with Select2 is no longer ' +
5854
- 'supported and may stop working in the future. It is recommended ' +
5855
- 'to use a `<select>` element instead.'
5856
- );
5857
- }
5858
- }
5859
 
5860
- decorated.call(this, $element, options);
5861
- }
 
 
 
 
5862
 
5863
- InputData.prototype.current = function (_, callback) {
5864
- function getSelected (data, selectedIds) {
5865
- var selected = [];
 
5866
 
5867
- if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
5868
- data.selected = true;
5869
- selected.push(data);
5870
- } else {
5871
- data.selected = false;
5872
- }
5873
 
5874
- if (data.children) {
5875
- selected.push.apply(selected, getSelected(data.children, selectedIds));
5876
- }
 
5877
 
5878
- return selected;
5879
- }
5880
 
5881
- var selected = [];
 
 
5882
 
5883
- for (var d = 0; d < this._currentData.length; d++) {
5884
- var data = this._currentData[d];
 
5885
 
5886
- selected.push.apply(
5887
- selected,
5888
- getSelected(
5889
- data,
5890
- this.$element.val().split(
5891
- this._valueSeparator
5892
- )
5893
- )
5894
- );
5895
- }
 
 
 
 
 
 
 
 
5896
 
5897
- callback(selected);
5898
- };
 
 
 
5899
 
5900
- InputData.prototype.select = function (_, data) {
5901
- if (!this.options.get('multiple')) {
5902
- this.current(function (allData) {
5903
- $.map(allData, function (data) {
5904
- data.selected = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5905
  });
5906
- });
5907
 
5908
- this.$element.val(data.id);
5909
- this.$element.trigger('change');
5910
- } else {
5911
- var value = this.$element.val();
5912
- value += this._valueSeparator + data.id;
5913
 
5914
- this.$element.val(value);
5915
- this.$element.trigger('change');
5916
- }
5917
- };
5918
 
5919
- InputData.prototype.unselect = function (_, data) {
5920
- var self = this;
5921
 
5922
- data.selected = false;
 
 
 
 
 
 
5923
 
5924
- this.current(function (allData) {
5925
- var values = [];
5926
 
5927
- for (var d = 0; d < allData.length; d++) {
5928
- var item = allData[d];
5929
 
5930
- if (data.id == item.id) {
5931
- continue;
5932
- }
 
 
 
 
 
 
 
 
 
 
 
5933
 
5934
- values.push(item.id);
5935
- }
 
 
5936
 
5937
- self.$element.val(values.join(self._valueSeparator));
5938
- self.$element.trigger('change');
5939
- });
5940
- };
 
 
 
 
5941
 
5942
- InputData.prototype.query = function (_, params, callback) {
5943
- var results = [];
5944
 
5945
- for (var d = 0; d < this._currentData.length; d++) {
5946
- var data = this._currentData[d];
5947
 
5948
- var matches = this.matches(params, data);
5949
 
5950
- if (matches !== null) {
5951
- results.push(matches);
5952
- }
5953
- }
5954
 
5955
- callback({
5956
- results: results
5957
- });
5958
- };
5959
-
5960
- InputData.prototype.addOptions = function (_, $options) {
5961
- var options = $.map($options, function ($option) {
5962
- return $.data($option[0], 'data');
5963
- });
5964
-
5965
- this._currentData.push.apply(this._currentData, options);
5966
- };
5967
-
5968
- return InputData;
5969
- });
5970
-
5971
- S2.define('select2/compat/matcher',[
5972
- 'jquery'
5973
- ], function ($) {
5974
- function oldMatcher (matcher) {
5975
- function wrappedMatcher (params, data) {
5976
- var match = $.extend(true, {}, data);
5977
-
5978
- if (params.term == null || $.trim(params.term) === '') {
5979
- return match;
5980
- }
5981
-
5982
- if (data.children) {
5983
- for (var c = data.children.length - 1; c >= 0; c--) {
5984
- var child = data.children[c];
5985
-
5986
- // Check if the child object matches
5987
- // The old matcher returned a boolean true or false
5988
- var doesMatch = matcher(params.term, child.text, child);
5989
-
5990
- // If the child didn't match, pop it off
5991
- if (!doesMatch) {
5992
- match.children.splice(c, 1);
5993
- }
5994
- }
5995
 
5996
- if (match.children.length > 0) {
5997
- return match;
5998
- }
5999
- }
6000
 
6001
- if (matcher(params.term, data.text, data)) {
6002
- return match;
6003
- }
6004
 
6005
- return null;
6006
- }
6007
 
6008
- return wrappedMatcher;
6009
- }
 
 
6010
 
6011
- return oldMatcher;
6012
- });
 
6013
 
6014
- S2.define('select2/compat/query',[
6015
 
6016
- ], function () {
6017
- function Query (decorated, $element, options) {
6018
- if (options.get('debug') && window.console && console.warn) {
6019
- console.warn(
6020
- 'Select2: The `query` option has been deprecated in favor of a ' +
6021
- 'custom data adapter that overrides the `query` method. Support ' +
6022
- 'will be removed for the `query` option in future versions of ' +
6023
- 'Select2.'
6024
- );
6025
- }
6026
 
6027
- decorated.call(this, $element, options);
6028
- }
6029
-
6030
- Query.prototype.query = function (_, params, callback) {
6031
- params.callback = callback;
6032
-
6033
- var query = this.options.get('query');
6034
-
6035
- query.call(null, params);
6036
- };
6037
-
6038
- return Query;
6039
- });
6040
-
6041
- S2.define('select2/dropdown/attachContainer',[
6042
-
6043
- ], function () {
6044
- function AttachContainer (decorated, $element, options) {
6045
- decorated.call(this, $element, options);
6046
- }
6047
-
6048
- AttachContainer.prototype.position =
6049
- function (decorated, $dropdown, $container) {
6050
- var $dropdownContainer = $container.find('.dropdown-wrapper');
6051
- $dropdownContainer.append($dropdown);
6052
-
6053
- $dropdown.addClass('select2-dropdown--below');
6054
- $container.addClass('select2-container--below');
6055
- };
6056
-
6057
- return AttachContainer;
6058
- });
6059
-
6060
- S2.define('select2/dropdown/stopPropagation',[
6061
-
6062
- ], function () {
6063
- function StopPropagation () { }
6064
-
6065
- StopPropagation.prototype.bind = function (decorated, container, $container) {
6066
- decorated.call(this, container, $container);
6067
-
6068
- var stoppedEvents = [
6069
- 'blur',
6070
- 'change',
6071
- 'click',
6072
- 'dblclick',
6073
- 'focus',
6074
- 'focusin',
6075
- 'focusout',
6076
- 'input',
6077
- 'keydown',
6078
- 'keyup',
6079
- 'keypress',
6080
- 'mousedown',
6081
- 'mouseenter',
6082
- 'mouseleave',
6083
- 'mousemove',
6084
- 'mouseover',
6085
- 'mouseup',
6086
- 'search',
6087
- 'touchend',
6088
- 'touchstart'
6089
- ];
6090
-
6091
- this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
6092
- evt.stopPropagation();
6093
- });
6094
- };
6095
-
6096
- return StopPropagation;
6097
- });
6098
-
6099
- S2.define('select2/selection/stopPropagation',[
6100
-
6101
- ], function () {
6102
- function StopPropagation () { }
6103
-
6104
- StopPropagation.prototype.bind = function (decorated, container, $container) {
6105
- decorated.call(this, container, $container);
6106
-
6107
- var stoppedEvents = [
6108
- 'blur',
6109
- 'change',
6110
- 'click',
6111
- 'dblclick',
6112
- 'focus',
6113
- 'focusin',
6114
- 'focusout',
6115
- 'input',
6116
- 'keydown',
6117
- 'keyup',
6118
- 'keypress',
6119
- 'mousedown',
6120
- 'mouseenter',
6121
- 'mouseleave',
6122
- 'mousemove',
6123
- 'mouseover',
6124
- 'mouseup',
6125
- 'search',
6126
- 'touchend',
6127
- 'touchstart'
6128
- ];
6129
-
6130
- this.$selection.on(stoppedEvents.join(' '), function (evt) {
6131
- evt.stopPropagation();
6132
- });
6133
- };
6134
-
6135
- return StopPropagation;
6136
- });
6137
 
6138
- /*!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6139
  * jQuery Mousewheel 3.1.13
6140
  *
6141
  * Copyright jQuery Foundation and other contributors
@@ -6143,294 +6164,294 @@ S2.define('select2/selection/stopPropagation',[
6143
  * http://jquery.org/license
6144
  */
6145
 
6146
- (function (factory) {
6147
- if ( typeof S2.define === 'function' && S2.define.amd ) {
6148
- // AMD. Register as an anonymous module.
6149
- S2.define('jquery-mousewheel',['jquery'], factory);
6150
- } else if (typeof exports === 'object') {
6151
- // Node/CommonJS style for Browserify
6152
- module.exports = factory;
6153
- } else {
6154
- // Browser globals
6155
- factory(jQuery);
6156
- }
6157
- }(function ($) {
6158
 
6159
- var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
6160
- toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
6161
  ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
6162
- slice = Array.prototype.slice,
6163
- nullLowestDeltaTimeout, lowestDelta;
6164
 
6165
- if ( $.event.fixHooks ) {
6166
- for ( var i = toFix.length; i; ) {
6167
- $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
6168
- }
6169
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6170
 
6171
- var special = $.event.special.mousewheel = {
6172
- version: '3.1.12',
 
6173
 
6174
- setup: function() {
6175
- if ( this.addEventListener ) {
6176
- for ( var i = toBind.length; i; ) {
6177
- this.addEventListener( toBind[--i], handler, false );
6178
  }
6179
- } else {
6180
- this.onmousewheel = handler;
6181
- }
6182
- // Store the line height and page height for this particular element
6183
- $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
6184
- $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
6185
- },
6186
 
6187
- teardown: function() {
6188
- if ( this.removeEventListener ) {
6189
- for ( var i = toBind.length; i; ) {
6190
- this.removeEventListener( toBind[--i], handler, false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6191
  }
6192
- } else {
6193
- this.onmousewheel = null;
6194
- }
6195
- // Clean up the data we added to the element
6196
- $.removeData(this, 'mousewheel-line-height');
6197
- $.removeData(this, 'mousewheel-page-height');
6198
- },
6199
-
6200
- getLineHeight: function(elem) {
6201
- var $elem = $(elem),
6202
- $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6203
- if (!$parent.length) {
6204
- $parent = $('body');
6205
- }
6206
- return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6207
- },
6208
 
6209
- getPageHeight: function(elem) {
6210
- return $(elem).height();
6211
- },
6212
 
6213
- settings: {
6214
- adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
6215
- normalizeOffset: true // calls getBoundingClientRect for each event
6216
- }
6217
- };
 
 
 
 
6218
 
6219
- $.fn.extend({
6220
- mousewheel: function(fn) {
6221
- return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
6222
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6223
 
6224
- unmousewheel: function(fn) {
6225
- return this.unbind('mousewheel', fn);
6226
- }
6227
- });
6228
-
6229
-
6230
- function handler(event) {
6231
- var orgEvent = event || window.event,
6232
- args = slice.call(arguments, 1),
6233
- delta = 0,
6234
- deltaX = 0,
6235
- deltaY = 0,
6236
- absDelta = 0,
6237
- offsetX = 0,
6238
- offsetY = 0;
6239
- event = $.event.fix(orgEvent);
6240
- event.type = 'mousewheel';
6241
-
6242
- // Old school scrollwheel delta
6243
- if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
6244
- if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
6245
- if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
6246
- if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
6247
-
6248
- // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
6249
- if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
6250
- deltaX = deltaY * -1;
6251
- deltaY = 0;
6252
- }
6253
 
6254
- // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
6255
- delta = deltaY === 0 ? deltaX : deltaY;
6256
 
6257
- // New school wheel delta (wheel event)
6258
- if ( 'deltaY' in orgEvent ) {
6259
- deltaY = orgEvent.deltaY * -1;
6260
- delta = deltaY;
6261
- }
6262
- if ( 'deltaX' in orgEvent ) {
6263
- deltaX = orgEvent.deltaX;
6264
- if ( deltaY === 0 ) { delta = deltaX * -1; }
6265
- }
6266
 
6267
- // No change actually happened, no reason to go any further
6268
- if ( deltaY === 0 && deltaX === 0 ) { return; }
6269
-
6270
- // Need to convert lines and pages to pixels if we aren't already in pixels
6271
- // There are three delta modes:
6272
- // * deltaMode 0 is by pixels, nothing to do
6273
- // * deltaMode 1 is by lines
6274
- // * deltaMode 2 is by pages
6275
- if ( orgEvent.deltaMode === 1 ) {
6276
- var lineHeight = $.data(this, 'mousewheel-line-height');
6277
- delta *= lineHeight;
6278
- deltaY *= lineHeight;
6279
- deltaX *= lineHeight;
6280
- } else if ( orgEvent.deltaMode === 2 ) {
6281
- var pageHeight = $.data(this, 'mousewheel-page-height');
6282
- delta *= pageHeight;
6283
- deltaY *= pageHeight;
6284
- deltaX *= pageHeight;
6285
- }
6286
 
6287
- // Store lowest absolute delta to normalize the delta values
6288
- absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
 
 
6289
 
6290
- if ( !lowestDelta || absDelta < lowestDelta ) {
6291
- lowestDelta = absDelta;
 
 
 
 
6292
 
6293
- // Adjust older deltas if necessary
6294
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6295
- lowestDelta /= 40;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6296
  }
6297
- }
6298
 
6299
- // Adjust older deltas if necessary
6300
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6301
- // Divide all the things by 40!
6302
- delta /= 40;
6303
- deltaX /= 40;
6304
- deltaY /= 40;
6305
- }
6306
 
6307
- // Get a whole, normalized value for the deltas
6308
- delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
6309
- deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
6310
- deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
 
 
 
 
 
 
6311
 
6312
- // Normalise offsetX and offsetY properties
6313
- if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
6314
- var boundingRect = this.getBoundingClientRect();
6315
- offsetX = event.clientX - boundingRect.left;
6316
- offsetY = event.clientY - boundingRect.top;
6317
- }
6318
 
6319
- // Add information to the event object
6320
- event.deltaX = deltaX;
6321
- event.deltaY = deltaY;
6322
- event.deltaFactor = lowestDelta;
6323
- event.offsetX = offsetX;
6324
- event.offsetY = offsetY;
6325
- // Go ahead and set deltaMode to 0 since we converted to pixels
6326
- // Although this is a little odd since we overwrite the deltaX/Y
6327
- // properties with normalized deltas.
6328
- event.deltaMode = 0;
6329
-
6330
- // Add event and delta to the front of the arguments
6331
- args.unshift(event, delta, deltaX, deltaY);
6332
-
6333
- // Clearout lowestDelta after sometime to better
6334
- // handle multiple device types that give different
6335
- // a different lowestDelta
6336
- // Ex: trackpad = 3 and mouse wheel = 120
6337
- if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
6338
- nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
6339
-
6340
- return ($.event.dispatch || $.event.handle).apply(this, args);
6341
- }
6342
 
6343
- function nullLowestDelta() {
6344
- lowestDelta = null;
6345
- }
 
 
 
6346
 
6347
- function shouldAdjustOldDeltas(orgEvent, absDelta) {
6348
- // If this is an older event and the delta is divisable by 120,
6349
- // then we are assuming that the browser is treating this as an
6350
- // older mouse wheel event and that we should divide the deltas
6351
- // by 40 to try and get a more usable deltaFactor.
6352
- // Side note, this actually impacts the reported scroll distance
6353
- // in older browsers and can cause scrolling to be slower than native.
6354
- // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
6355
- return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
6356
- }
6357
 
6358
- }));
 
 
6359
 
6360
- S2.define('jquery.select2',[
6361
- 'jquery',
6362
- 'jquery-mousewheel',
6363
 
6364
- './select2/core',
6365
- './select2/defaults'
6366
- ], function ($, _, Select2, Defaults) {
6367
- if ($.fn.select2 == null) {
6368
- // All methods that should return the element
6369
- var thisMethods = ['open', 'close', 'destroy'];
6370
 
6371
- $.fn.select2 = function (options) {
6372
- options = options || {};
6373
 
6374
- if (typeof options === 'object') {
6375
- this.each(function () {
6376
- var instanceOptions = $.extend(true, {}, options);
 
 
 
6377
 
6378
- var instance = new Select2($(this), instanceOptions);
6379
- });
6380
 
6381
- return this;
6382
- } else if (typeof options === 'string') {
6383
- var ret;
6384
- var args = Array.prototype.slice.call(arguments, 1);
6385
 
6386
- this.each(function () {
6387
- var instance = $(this).data('select2');
 
 
 
 
6388
 
6389
- if (instance == null && window.console && console.error) {
6390
- console.error(
6391
- 'The select2(\'' + options + '\') method was called on an ' +
6392
- 'element that is not using Select2.'
6393
- );
6394
- }
6395
 
6396
- ret = instance[options].apply(instance, args);
6397
  });
6398
 
6399
- // Check if we should be returning `this`
6400
- if ($.inArray(options, thisMethods) > -1) {
6401
- return this;
6402
- }
 
 
 
 
 
 
 
 
 
 
 
6403
 
6404
- return ret;
6405
- } else {
6406
- throw new Error('Invalid arguments for Select2: ' + options);
6407
- }
6408
- };
6409
- }
6410
-
6411
- if ($.fn.select2.defaults == null) {
6412
- $.fn.select2.defaults = Defaults;
6413
- }
6414
-
6415
- return Select2;
6416
- });
6417
-
6418
- // Return the AMD loader configuration so it can be used outside of this file
6419
- return {
6420
- define: S2.define,
6421
- require: S2.require
6422
- };
6423
- }());
6424
-
6425
- // Autoload the jQuery bindings
6426
- // We know that all of the modules exist above this, so we're safe
6427
- var select2 = S2.require('jquery.select2');
6428
-
6429
- // Hold the AMD module references on the jQuery function that was just loaded
6430
- // This allows Select2 to use the internal loader outside of this file, such
6431
- // as in the language files.
6432
- jQuery.fn.select2.amd = S2;
6433
-
6434
- // Return the Select2 instance for anyone who is importing it.
6435
- return select2;
6436
  }));
1
  /*!
2
+ * Select2 4.0.5
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 module === 'object' && module.exports) {
13
+ // Node/CommonJS
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
+ // require('jQuery') returns a factory that requires window to
17
+ // build a jQuery instance, we normalize how we use modules
18
+ // that require this pattern but the window provided is a noop
19
+ // if it's defined (how jquery works)
20
+ if (typeof window !== 'undefined') {
21
+ jQuery = require('jquery');
22
+ }
23
+ else {
24
+ jQuery = require('jquery')(root);
25
+ }
26
+ }
27
+ factory(jQuery);
28
+ return jQuery;
29
+ };
30
+ } else {
31
+ // Browser globals
32
+ factory(jQuery);
33
+ }
34
+ } (function (jQuery) {
35
+ // This is needed so we can catch the AMD loader configuration and use it
36
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
37
+ // returns the AMD loader references.
38
+ var S2 =(function () {
39
+ // Restore the Select2 AMD loader so it can be used
40
+ // Needed mostly in the language files, where the loader is not inserted
41
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
+ var S2 = jQuery.fn.select2.amd;
43
+ }
44
+ var S2;(function () { if (!S2 || !S2.requirejs) {
45
+ if (!S2) { S2 = {}; } else { require = S2; }
46
+ /**
47
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
+ */
50
  //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
  //be followed.
52
+ /*global setTimeout: false */
53
+
54
+ var requirejs, require, define;
55
+ (function (undef) {
56
+ var main, req, makeMap, handlers,
57
+ defined = {},
58
+ waiting = {},
59
+ config = {},
60
+ defining = {},
61
+ hasOwn = Object.prototype.hasOwnProperty,
62
+ aps = [].slice,
63
+ jsSuffixRegExp = /\.js$/;
64
+
65
+ function hasProp(obj, prop) {
66
+ return hasOwn.call(obj, prop);
67
+ }
68
+
69
+ /**
70
+ * Given a relative module name, like ./something, normalize it to
71
+ * a real name that can be mapped to a path.
72
+ * @param {String} name the relative name
73
+ * @param {String} baseName a real name that the name arg is relative
74
+ * to.
75
+ * @returns {String} normalized name
76
+ */
77
+ function normalize(name, baseName) {
78
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
+ baseParts = baseName && baseName.split("/"),
81
+ map = config.map,
82
+ starMap = (map && map['*']) || {};
83
+
84
+ //Adjust any relative paths.
85
+ if (name) {
86
+ name = name.split('/');
87
+ lastIndex = name.length - 1;
88
+
89
+ // If wanting node ID compatibility, strip .js from end
90
+ // of IDs. Have to do this here, and not in nameToUrl
91
+ // because node allows either .js or non .js to map
92
+ // to same file.
93
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
+ }
96
+
97
+ // Starts with a '.' so need the baseName
98
+ if (name[0].charAt(0) === '.' && baseParts) {
99
+ //Convert baseName to array, and lop off the last part,
100
+ //so that . matches that 'directory' and not name of the baseName's
101
+ //module. For instance, baseName of 'one/two/three', maps to
102
+ //'one/two/three.js', but we want the directory, 'one/two' for
103
+ //this normalization.
104
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
+ name = normalizedBaseParts.concat(name);
106
+ }
107
 
108
+ //start trimDots
109
+ for (i = 0; i < name.length; i++) {
110
+ part = name[i];
111
+ if (part === '.') {
112
+ name.splice(i, 1);
113
+ i -= 1;
114
+ } else if (part === '..') {
115
+ // If at the start, or previous value is still ..,
116
+ // keep them so that when converted to a path it may
117
+ // still work when converted to a path, even though
118
+ // as an ID it is less than ideal. In larger point
119
+ // releases, may be better to just kick out an error.
120
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
+ continue;
122
+ } else if (i > 0) {
123
+ name.splice(i - 1, 2);
124
+ i -= 2;
125
+ }
126
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
+ //end trimDots
129
+
130
+ name = name.join('/');
131
  }
 
 
132
 
133
+ //Apply map config if available.
134
+ if ((baseParts || starMap) && map) {
135
+ nameParts = name.split('/');
136
+
137
+ for (i = nameParts.length; i > 0; i -= 1) {
138
+ nameSegment = nameParts.slice(0, i).join("/");
139
+
140
+ if (baseParts) {
141
+ //Find the longest baseName segment match in the config.
142
+ //So, do joins on the biggest to smallest lengths of baseParts.
143
+ for (j = baseParts.length; j > 0; j -= 1) {
144
+ mapValue = map[baseParts.slice(0, j).join('/')];
145
+
146
+ //baseName segment has config, find if it has one for
147
+ //this name.
148
+ if (mapValue) {
149
+ mapValue = mapValue[nameSegment];
150
+ if (mapValue) {
151
+ //Match, update name to the new value.
152
+ foundMap = mapValue;
153
+ foundI = i;
154
+ break;
155
+ }
156
+ }
157
+ }
158
+ }
159
 
160
+ if (foundMap) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  break;
162
  }
163
+
164
+ //Check for a star map match, but just hold on to it,
165
+ //if there is a shorter segment match later in a matching
166
+ //config, then favor over this star map.
167
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
168
+ foundStarMap = starMap[nameSegment];
169
+ starI = i;
170
+ }
171
+ }
172
+
173
+ if (!foundMap && foundStarMap) {
174
+ foundMap = foundStarMap;
175
+ foundI = starI;
176
+ }
177
+
178
+ if (foundMap) {
179
+ nameParts.splice(0, foundI, foundMap);
180
+ name = nameParts.join('/');
181
  }
182
  }
183
+
184
+ return name;
185
  }
186
 
187
+ function makeRequire(relName, forceSync) {
188
+ return function () {
189
+ //A version of a require function that passes a moduleName
190
+ //value for items that may need to
191
+ //look up paths relative to the moduleName
192
+ var args = aps.call(arguments, 0);
193
+
194
+ //If first arg is not require('string'), and there is only
195
+ //one arg, it is the array form without a callback. Insert
196
+ //a null so that the following concat is correct.
197
+ if (typeof args[0] !== 'string' && args.length === 1) {
198
+ args.push(null);
199
+ }
200
+ return req.apply(undef, args.concat([relName, forceSync]));
201
+ };
202
  }
203
 
204
+ function makeNormalize(relName) {
205
+ return function (name) {
206
+ return normalize(name, relName);
207
+ };
 
 
208
  }
 
209
 
210
+ function makeLoad(depName) {
211
+ return function (value) {
212
+ defined[depName] = value;
213
+ };
214
+ }
215
 
216
+ function callDep(name) {
217
+ if (hasProp(waiting, name)) {
218
+ var args = waiting[name];
219
+ delete waiting[name];
220
+ defining[name] = true;
221
+ main.apply(undef, args);
222
+ }
223
 
224
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
+ throw new Error('No ' + name);
226
+ }
227
+ return defined[name];
228
+ }
229
 
230
+ //Turns a plugin!resource to [plugin, resource]
231
+ //with the plugin being undefined if the name
232
+ //did not have a plugin prefix.
233
+ function splitPrefix(name) {
234
+ var prefix,
235
+ index = name ? name.indexOf('!') : -1;
236
+ if (index > -1) {
237
+ prefix = name.substring(0, index);
238
+ name = name.substring(index + 1, name.length);
239
+ }
240
+ return [prefix, name];
241
+ }
 
 
 
 
242
 
243
+ //Creates a parts array for a relName where first part is plugin ID,
244
+ //second part is resource ID. Assumes relName has already been normalized.
245
+ function makeRelParts(relName) {
246
+ return relName ? splitPrefix(relName) : [];
247
+ }
248
 
249
+ /**
250
+ * Makes a name map, normalizing the name, and using a plugin
251
+ * for normalization if necessary. Grabs a ref to plugin
252
+ * too, as an optimization.
253
+ */
254
+ makeMap = function (name, relParts) {
255
+ var plugin,
256
+ parts = splitPrefix(name),
257
+ prefix = parts[0],
258
+ relResourceName = relParts[1];
259
+
260
+ name = parts[1];
261
+
262
+ if (prefix) {
263
+ prefix = normalize(prefix, relResourceName);
264
+ plugin = callDep(prefix);
265
+ }
266
 
267
+ //Normalize according
268
+ if (prefix) {
269
+ if (plugin && plugin.normalize) {
270
+ name = plugin.normalize(name, makeNormalize(relResourceName));
271
+ } else {
272
+ name = normalize(name, relResourceName);
273
+ }
274
+ } else {
275
+ name = normalize(name, relResourceName);
276
+ parts = splitPrefix(name);
277
+ prefix = parts[0];
278
+ name = parts[1];
279
+ if (prefix) {
280
+ plugin = callDep(prefix);
281
+ }
282
+ }
283
 
284
+ //Using ridiculous property names for space reasons
285
+ return {
286
+ f: prefix ? prefix + '!' + name : name, //fullName
287
+ n: name,
288
+ pr: prefix,
289
+ p: plugin
290
+ };
291
+ };
292
+
293
+ function makeConfig(name) {
294
+ return function () {
295
+ return (config && config.config && config.config[name]) || {};
296
+ };
297
+ }
298
 
299
+ handlers = {
300
+ require: function (name) {
301
+ return makeRequire(name);
302
+ },
303
+ exports: function (name) {
304
+ var e = defined[name];
305
+ if (typeof e !== 'undefined') {
306
+ return e;
307
+ } else {
308
+ return (defined[name] = {});
309
+ }
310
+ },
311
+ module: function (name) {
312
+ return {
313
+ id: name,
314
+ uri: '',
315
+ exports: defined[name],
316
+ config: makeConfig(name)
317
+ };
318
+ }
319
+ };
320
+
321
+ main = function (name, deps, callback, relName) {
322
+ var cjsModule, depName, ret, map, i, relParts,
323
+ args = [],
324
+ callbackType = typeof callback,
325
+ usingExports;
326
+
327
+ //Use name if no relName
328
+ relName = relName || name;
329
+ relParts = makeRelParts(relName);
330
+
331
+ //Call the callback to define the module, if necessary.
332
+ if (callbackType === 'undefined' || callbackType === 'function') {
333
+ //Pull out the defined dependencies and pass the ordered
334
+ //values to the callback.
335
+ //Default to [require, exports, module] if no deps
336
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
+ for (i = 0; i < deps.length; i += 1) {
338
+ map = makeMap(deps[i], relParts);
339
+ depName = map.f;
340
+
341
+ //Fast path CommonJS standard dependencies.
342
+ if (depName === "require") {
343
+ args[i] = handlers.require(name);
344
+ } else if (depName === "exports") {
345
+ //CommonJS module spec 1.1
346
+ args[i] = handlers.exports(name);
347
+ usingExports = true;
348
+ } else if (depName === "module") {
349
+ //CommonJS module spec 1.1
350
+ cjsModule = args[i] = handlers.module(name);
351
+ } else if (hasProp(defined, depName) ||
352
+ hasProp(waiting, depName) ||
353
+ hasProp(defining, depName)) {
354
+ args[i] = callDep(depName);
355
+ } else if (map.p) {
356
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
+ args[i] = defined[depName];
358
+ } else {
359
+ throw new Error(name + ' missing ' + depName);
360
+ }
361
+ }
362
 
363
+ ret = callback ? callback.apply(defined[name], args) : undefined;
364
+
365
+ if (name) {
366
+ //If setting exports via "module" is in play,
367
+ //favor that over return value and exports. After that,
368
+ //favor a non-undefined return value over exports use.
369
+ if (cjsModule && cjsModule.exports !== undef &&
370
+ cjsModule.exports !== defined[name]) {
371
+ defined[name] = cjsModule.exports;
372
+ } else if (ret !== undef || !usingExports) {
373
+ //Use the return value from the function.
374
+ defined[name] = ret;
375
+ }
376
+ }
377
+ } else if (name) {
378
+ //May just be an object definition for the module. Only
379
+ //worry about defining if have a module name.
380
+ defined[name] = callback;
381
+ }
382
+ };
383
 
384
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
+ if (typeof deps === "string") {
386
+ if (handlers[deps]) {
387
+ //callback in this case is really relName
388
+ return handlers[deps](callback);
389
+ }
390
+ //Just return the module wanted. In this scenario, the
391
+ //deps arg is the module name, and second arg (if passed)
392
+ //is just the relName.
393
+ //Normalize module name, if it contains . or ..
394
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
395
+ } else if (!deps.splice) {
396
+ //deps is a config object, not an array.
397
+ config = deps;
398
+ if (config.deps) {
399
+ req(config.deps, config.callback);
400
+ }
401
+ if (!callback) {
402
+ return;
403
+ }
404
 
405
+ if (callback.splice) {
406
+ //callback is an array, which means it is a dependency list.
407
+ //Adjust args if there are dependencies
408
+ deps = callback;
409
+ callback = relName;
410
+ relName = null;
411
+ } else {
412
+ deps = undef;
413
+ }
414
+ }
415
 
416
+ //Support require(['a'])
417
+ callback = callback || function () {};
 
 
 
418
 
419
+ //If relName is a function, it is an errback handler,
420
+ //so remove it.
421
+ if (typeof relName === 'function') {
422
+ relName = forceSync;
423
+ forceSync = alt;
424
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
 
426
+ //Simulate async callback;
427
+ if (forceSync) {
428
+ main(undef, deps, callback, relName);
429
+ } else {
430
+ //Using a non-zero value because of concern for what old browsers
431
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
432
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
+ //If want a value immediately, use require('id') instead -- something
434
+ //that works in almond on the global level, but not guaranteed and
435
+ //unlikely to work in other AMD implementations.
436
+ setTimeout(function () {
437
+ main(undef, deps, callback, relName);
438
+ }, 4);
439
+ }
440
 
441
+ return req;
442
+ };
443
+
444
+ /**
445
+ * Just drops the config on the floor, but returns req in case
446
+ * the config return value is used.
447
+ */
448
+ req.config = function (cfg) {
449
+ return req(cfg);
450
+ };
451
+
452
+ /**
453
+ * Expose module registry for debugging and tooling
454
+ */
455
+ requirejs._defined = defined;
456
+
457
+ define = function (name, deps, callback) {
458
+ if (typeof name !== 'string') {
459
+ throw new Error('See almond README: incorrect module build, no module name');
460
+ }
461
 
462
+ //This module may not have dependencies
463
+ if (!deps.splice) {
464
+ //deps is not an array, so probably means
465
+ //an object literal or factory function for
466
+ //the value. Adjust args.
467
+ callback = deps;
468
+ deps = [];
469
+ }
 
 
 
 
 
 
 
 
 
 
 
 
470
 
471
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
+ waiting[name] = [name, deps, callback];
473
+ }
474
+ };
 
 
 
 
 
 
475
 
476
+ define.amd = {
477
+ jQuery: true
478
+ };
479
+ }());
480
 
481
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
 
 
 
 
482
  }
483
+ }());
484
+ S2.define("almond", function(){});
485
+
486
+ /* global jQuery:false, $:false */
487
+ S2.define('jquery',[],function () {
488
+ var _$ = jQuery || $;
489
+
490
+ if (_$ == null && console && console.error) {
491
+ console.error(
492
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
494
+ 'web page.'
495
+ );
496
+ }
497
 
498
+ return _$;
499
+ });
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
+ S2.define('select2/utils',[
502
+ 'jquery'
503
+ ], function ($) {
504
+ var Utils = {};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
 
506
+ Utils.Extend = function (ChildClass, SuperClass) {
507
+ var __hasProp = {}.hasOwnProperty;
 
 
 
 
 
 
508
 
509
+ function BaseConstructor () {
510
+ this.constructor = ChildClass;
511
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
 
513
+ for (var key in SuperClass) {
514
+ if (__hasProp.call(SuperClass, key)) {
515
+ ChildClass[key] = SuperClass[key];
516
+ }
517
+ }
518
 
519
+ BaseConstructor.prototype = SuperClass.prototype;
520
+ ChildClass.prototype = new BaseConstructor();
521
+ ChildClass.__super__ = SuperClass.prototype;
522
 
523
+ return ChildClass;
524
+ };
525
 
526
+ function getMethods (theClass) {
527
+ var proto = theClass.prototype;
528
 
529
+ var methods = [];
530
 
531
+ for (var methodName in proto) {
532
+ var m = proto[methodName];
533
 
534
+ if (typeof m !== 'function') {
535
+ continue;
536
+ }
537
 
538
+ if (methodName === 'constructor') {
539
+ continue;
540
+ }
541
 
542
+ methods.push(methodName);
543
+ }
544
 
545
+ return methods;
546
+ }
547
 
548
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
549
+ var decoratedMethods = getMethods(DecoratorClass);
550
+ var superMethods = getMethods(SuperClass);
551
 
552
+ function DecoratedClass () {
553
+ var unshift = Array.prototype.unshift;
554
 
555
+ var argCount = DecoratorClass.prototype.constructor.length;
556
 
557
+ var calledConstructor = SuperClass.prototype.constructor;
558
 
559
+ if (argCount > 0) {
560
+ unshift.call(arguments, SuperClass.prototype.constructor);
561
 
562
+ calledConstructor = DecoratorClass.prototype.constructor;
563
+ }
564
 
565
+ calledConstructor.apply(this, arguments);
566
+ }
567
 
568
+ DecoratorClass.displayName = SuperClass.displayName;
569
 
570
+ function ctr () {
571
+ this.constructor = DecoratedClass;
572
+ }
573
 
574
+ DecoratedClass.prototype = new ctr();
575
 
576
+ for (var m = 0; m < superMethods.length; m++) {
577
+ var superMethod = superMethods[m];
578
 
579
+ DecoratedClass.prototype[superMethod] =
580
+ SuperClass.prototype[superMethod];
581
+ }
582
 
583
+ var calledMethod = function (methodName) {
584
+ // Stub out the original method if it's not decorating an actual method
585
+ var originalMethod = function () {};
586
 
587
+ if (methodName in DecoratedClass.prototype) {
588
+ originalMethod = DecoratedClass.prototype[methodName];
589
+ }
590
 
591
+ var decoratedMethod = DecoratorClass.prototype[methodName];
592
 
593
+ return function () {
594
+ var unshift = Array.prototype.unshift;
595
 
596
+ unshift.call(arguments, originalMethod);
597
 
598
+ return decoratedMethod.apply(this, arguments);
599
+ };
600
+ };
601
 
602
+ for (var d = 0; d < decoratedMethods.length; d++) {
603
+ var decoratedMethod = decoratedMethods[d];
604
 
605
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
+ }
607
 
608
+ return DecoratedClass;
609
+ };
610
 
611
+ var Observable = function () {
612
+ this.listeners = {};
613
+ };
614
 
615
+ Observable.prototype.on = function (event, callback) {
616
+ this.listeners = this.listeners || {};
617
 
618
+ if (event in this.listeners) {
619
+ this.listeners[event].push(callback);
620
+ } else {
621
+ this.listeners[event] = [callback];
622
+ }
623
+ };
624
 
625
+ Observable.prototype.trigger = function (event) {
626
+ var slice = Array.prototype.slice;
627
+ var params = slice.call(arguments, 1);
628
 
629
+ this.listeners = this.listeners || {};
630
 
631
+ // Params should always come in as an array
632
+ if (params == null) {
633
+ params = [];
634
+ }
635
 
636
+ // If there are no arguments to the event, use a temporary object
637
+ if (params.length === 0) {
638
+ params.push({});
639
+ }
640
 
641
+ // Set the `_type` of the first object to the event
642
+ params[0]._type = event;
643
 
644
+ if (event in this.listeners) {
645
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
646
+ }
647
 
648
+ if ('*' in this.listeners) {
649
+ this.invoke(this.listeners['*'], arguments);
650
+ }
651
+ };
652
 
653
+ Observable.prototype.invoke = function (listeners, params) {
654
+ for (var i = 0, len = listeners.length; i < len; i++) {
655
+ listeners[i].apply(this, params);
656
+ }
657
+ };
658
 
659
+ Utils.Observable = Observable;
660
 
661
+ Utils.generateChars = function (length) {
662
+ var chars = '';
663
 
664
+ for (var i = 0; i < length; i++) {
665
+ var randomChar = Math.floor(Math.random() * 36);
666
+ chars += randomChar.toString(36);
667
+ }
668
 
669
+ return chars;
670
+ };
671
 
672
+ Utils.bind = function (func, context) {
673
+ return function () {
674
+ func.apply(context, arguments);
675
+ };
676
+ };
677
 
678
+ Utils._convertData = function (data) {
679
+ for (var originalKey in data) {
680
+ var keys = originalKey.split('-');
681
 
682
+ var dataLevel = data;
683
 
684
+ if (keys.length === 1) {
685
+ continue;
686
+ }
687
 
688
+ for (var k = 0; k < keys.length; k++) {
689
+ var key = keys[k];
690
 
691
+ // Lowercase the first letter
692
+ // By default, dash-separated becomes camelCase
693
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
 
695
+ if (!(key in dataLevel)) {
696
+ dataLevel[key] = {};
697
+ }
698
 
699
+ if (k == keys.length - 1) {
700
+ dataLevel[key] = data[originalKey];
701
+ }
702
 
703
+ dataLevel = dataLevel[key];
704
+ }
705
 
706
+ delete data[originalKey];
707
+ }
708
 
709
+ return data;
710
+ };
711
 
712
+ Utils.hasScroll = function (index, el) {
713
+ // Adapted from the function created by @ShadowScripter
714
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
+ // The original code can be found at
716
+ // http://codereview.stackexchange.com/q/13338
717
+ // and was designed to be used with the Sizzle selector engine.
718
+
719
+ var $el = $(el);
720
+ var overflowX = el.style.overflowX;
721
+ var overflowY = el.style.overflowY;
722
+
723
+ //Check both x and y declarations
724
+ if (overflowX === overflowY &&
725
+ (overflowY === 'hidden' || overflowY === 'visible')) {
726
+ return false;
727
+ }
728
 
729
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
730
+ return true;
731
+ }
732
 
733
+ return ($el.innerHeight() < el.scrollHeight ||
734
+ $el.innerWidth() < el.scrollWidth);
735
+ };
 
 
736
 
737
+ Utils.escapeMarkup = function (markup) {
738
+ var replaceMap = {
739
+ '\\': '&#92;',
740
+ '&': '&amp;',
741
+ '<': '&lt;',
742
+ '>': '&gt;',
743
+ '"': '&quot;',
744
+ '\'': '&#39;',
745
+ '/': '&#47;'
746
+ };
747
+
748
+ // Do not try to escape the markup if it's not a string
749
+ if (typeof markup !== 'string') {
750
+ return markup;
751
+ }
752
 
753
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
+ return replaceMap[match];
755
+ });
756
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
 
758
+ // Append an array of jQuery nodes to a given element.
759
+ Utils.appendMany = function ($element, $nodes) {
760
+ // jQuery 1.7.x does not support $.fn.append() with an array
761
+ // Fall back to a jQuery object collection using $.fn.add()
762
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
763
+ var $jqNodes = $();
764
 
765
+ $.map($nodes, function (node) {
766
+ $jqNodes = $jqNodes.add(node);
767
+ });
 
 
 
768
 
769
+ $nodes = $jqNodes;
770
+ }
 
771
 
772
+ $element.append($nodes);
773
+ };
774
 
775
+ return Utils;
776
+ });
777
 
778
+ S2.define('select2/results',[
779
+ 'jquery',
780
+ './utils'
781
+ ], function ($, Utils) {
782
+ function Results ($element, options, dataAdapter) {
783
+ this.$element = $element;
784
+ this.data = dataAdapter;
785
+ this.options = options;
786
 
787
+ Results.__super__.constructor.call(this);
788
+ }
 
 
 
 
 
 
789
 
790
+ Utils.Extend(Results, Utils.Observable);
 
791
 
792
+ Results.prototype.render = function () {
793
+ var $results = $(
794
+ '<ul class="select2-results__options" role="tree"></ul>'
795
+ );
796
 
797
+ if (this.options.get('multiple')) {
798
+ $results.attr('aria-multiselectable', 'true');
799
+ }
 
800
 
801
+ this.$results = $results;
 
 
802
 
803
+ return $results;
804
+ };
805
 
806
+ Results.prototype.clear = function () {
807
+ this.$results.empty();
808
+ };
809
 
810
+ Results.prototype.displayMessage = function (params) {
811
+ var escapeMarkup = this.options.get('escapeMarkup');
 
812
 
813
+ this.clear();
814
+ this.hideLoading();
815
 
816
+ var $message = $(
817
+ '<li role="treeitem" aria-live="assertive"' +
818
+ ' class="select2-results__option"></li>'
819
+ );
820
 
821
+ var message = this.options.get('translations').get(params.message);
 
 
 
822
 
823
+ $message.append(
824
+ escapeMarkup(
825
+ message(params.args)
826
+ )
827
+ );
828
 
829
+ $message[0].className += ' select2-results__message';
 
 
 
 
830
 
831
+ this.$results.append($message);
832
+ };
833
 
834
+ Results.prototype.hideMessages = function () {
835
+ this.$results.find('.select2-results__message').remove();
836
+ };
837
 
838
+ Results.prototype.append = function (data) {
839
+ this.hideLoading();
 
840
 
841
+ var $options = [];
 
842
 
843
+ if (data.results == null || data.results.length === 0) {
844
+ if (this.$results.children().length === 0) {
845
+ this.trigger('results:message', {
846
+ message: 'noResults'
847
+ });
848
+ }
849
 
850
+ return;
851
+ }
 
 
 
 
852
 
853
+ data.results = this.sort(data.results);
 
854
 
855
+ for (var d = 0; d < data.results.length; d++) {
856
+ var item = data.results[d];
857
 
858
+ var $option = this.option(item);
 
859
 
860
+ $options.push($option);
861
+ }
862
 
863
+ this.$results.append($options);
864
+ };
865
 
866
+ Results.prototype.position = function ($results, $dropdown) {
867
+ var $resultsContainer = $dropdown.find('.select2-results');
868
+ $resultsContainer.append($results);
869
+ };
870
 
871
+ Results.prototype.sort = function (data) {
872
+ var sorter = this.options.get('sorter');
 
 
873
 
874
+ return sorter(data);
875
+ };
876
 
877
+ Results.prototype.highlightFirstItem = function () {
878
+ var $options = this.$results
879
+ .find('.select2-results__option[aria-selected]');
880
 
881
+ var $selected = $options.filter('[aria-selected=true]');
 
 
882
 
883
+ // Check if there are any selected options
884
+ if ($selected.length > 0) {
885
+ // If there are selected options, highlight the first
886
+ $selected.first().trigger('mouseenter');
887
+ } else {
888
+ // If there are no selected options, highlight the first option
889
+ // in the dropdown
890
+ $options.first().trigger('mouseenter');
891
+ }
892
 
893
+ this.ensureHighlightVisible();
894
+ };
 
 
 
 
 
 
 
895
 
896
+ Results.prototype.setClasses = function () {
897
+ var self = this;
898
 
899
+ this.data.current(function (selected) {
900
+ var selectedIds = $.map(selected, function (s) {
901
+ return s.id.toString();
902
+ });
903
 
904
+ var $options = self.$results
905
+ .find('.select2-results__option[aria-selected]');
 
 
906
 
907
+ $options.each(function () {
908
+ var $option = $(this);
909
 
910
+ var item = $.data(this, 'data');
 
911
 
912
+ // id needs to be converted to a string when comparing
913
+ var id = '' + item.id;
914
 
915
+ if ((item.element != null && item.element.selected) ||
916
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
917
+ $option.attr('aria-selected', 'true');
918
+ } else {
919
+ $option.attr('aria-selected', 'false');
920
+ }
921
+ });
922
 
923
+ });
924
+ };
 
 
 
 
 
925
 
926
+ Results.prototype.showLoading = function (params) {
927
+ this.hideLoading();
928
 
929
+ var loadingMore = this.options.get('translations').get('searching');
 
930
 
931
+ var loading = {
932
+ disabled: true,
933
+ loading: true,
934
+ text: loadingMore(params)
935
+ };
936
+ var $loading = this.option(loading);
937
+ $loading.className += ' loading-results';
938
 
939
+ this.$results.prepend($loading);
940
+ };
 
 
 
 
 
941
 
942
+ Results.prototype.hideLoading = function () {
943
+ this.$results.find('.loading-results').remove();
944
+ };
945
 
946
+ Results.prototype.option = function (data) {
947
+ var option = document.createElement('li');
948
+ option.className = 'select2-results__option';
949
 
950
+ var attrs = {
951
+ 'role': 'treeitem',
952
+ 'aria-selected': 'false'
953
+ };
954
 
955
+ if (data.disabled) {
956
+ delete attrs['aria-selected'];
957
+ attrs['aria-disabled'] = 'true';
958
+ }
959
 
960
+ if (data.id == null) {
961
+ delete attrs['aria-selected'];
962
+ }
 
963
 
964
+ if (data._resultId != null) {
965
+ option.id = data._resultId;
966
+ }
967
 
968
+ if (data.title) {
969
+ option.title = data.title;
970
+ }
971
 
972
+ if (data.children) {
973
+ attrs.role = 'group';
974
+ attrs['aria-label'] = data.text;
975
+ delete attrs['aria-selected'];
976
+ }
977
 
978
+ for (var attr in attrs) {
979
+ var val = attrs[attr];
 
 
 
980
 
981
+ option.setAttribute(attr, val);
982
+ }
983
 
984
+ if (data.children) {
985
+ var $option = $(option);
986
 
987
+ var label = document.createElement('strong');
988
+ label.className = 'select2-results__group';
989
 
990
+ var $label = $(label);
991
+ this.template(data, label);
992
 
993
+ var $children = [];
 
994
 
995
+ for (var c = 0; c < data.children.length; c++) {
996
+ var child = data.children[c];
997
 
998
+ var $child = this.option(child);
 
999
 
1000
+ $children.push($child);
1001
+ }
1002
 
1003
+ var $childrenContainer = $('<ul></ul>', {
1004
+ 'class': 'select2-results__options select2-results__options--nested'
1005
+ });
1006
 
1007
+ $childrenContainer.append($children);
 
 
1008
 
1009
+ $option.append(label);
1010
+ $option.append($childrenContainer);
1011
+ } else {
1012
+ this.template(data, option);
1013
+ }
1014
 
1015
+ $.data(option, 'data', data);
 
 
 
 
1016
 
1017
+ return option;
1018
+ };
1019
 
1020
+ Results.prototype.bind = function (container, $container) {
1021
+ var self = this;
1022
 
1023
+ var id = container.id + '-results';
 
1024
 
1025
+ this.$results.attr('id', id);
1026
 
1027
+ container.on('results:all', function (params) {
1028
+ self.clear();
1029
+ self.append(params.data);
1030
 
1031
+ if (container.isOpen()) {
1032
+ self.setClasses();
1033
+ self.highlightFirstItem();
1034
+ }
1035
+ });
1036
 
1037
+ container.on('results:append', function (params) {
1038
+ self.append(params.data);
 
 
 
1039
 
1040
+ if (container.isOpen()) {
1041
+ self.setClasses();
1042
+ }
1043
+ });
1044
 
1045
+ container.on('query', function (params) {
1046
+ self.hideMessages();
1047
+ self.showLoading(params);
1048
+ });
1049
 
1050
+ container.on('select', function () {
1051
+ if (!container.isOpen()) {
1052
+ return;
1053
+ }
1054
 
1055
+ self.setClasses();
1056
+ self.highlightFirstItem();
1057
+ });
 
1058
 
1059
+ container.on('unselect', function () {
1060
+ if (!container.isOpen()) {
1061
+ return;
1062
+ }
1063
 
1064
+ self.setClasses();
1065
+ self.highlightFirstItem();
1066
+ });
 
1067
 
1068
+ container.on('open', function () {
1069
+ // When the dropdown is open, aria-expended="true"
1070
+ self.$results.attr('aria-expanded', 'true');
1071
+ self.$results.attr('aria-hidden', 'false');
1072
 
1073
+ self.setClasses();
1074
+ self.ensureHighlightVisible();
1075
+ });
 
1076
 
1077
+ container.on('close', function () {
1078
+ // When the dropdown is closed, aria-expended="false"
1079
+ self.$results.attr('aria-expanded', 'false');
1080
+ self.$results.attr('aria-hidden', 'true');
1081
+ self.$results.removeAttr('aria-activedescendant');
1082
+ });
1083
 
1084
+ container.on('results:toggle', function () {
1085
+ var $highlighted = self.getHighlightedResults();
 
 
 
 
1086
 
1087
+ if ($highlighted.length === 0) {
1088
+ return;
1089
+ }
1090
 
1091
+ $highlighted.trigger('mouseup');
1092
+ });
 
1093
 
1094
+ container.on('results:select', function () {
1095
+ var $highlighted = self.getHighlightedResults();
1096
 
1097
+ if ($highlighted.length === 0) {
1098
+ return;
1099
+ }
1100
 
1101
+ var data = $highlighted.data('data');
 
 
1102
 
1103
+ if ($highlighted.attr('aria-selected') == 'true') {
1104
+ self.trigger('close', {});
1105
+ } else {
1106
+ self.trigger('select', {
1107
+ data: data
1108
+ });
1109
+ }
1110
+ });
1111
 
1112
+ container.on('results:previous', function () {
1113
+ var $highlighted = self.getHighlightedResults();
 
 
 
 
 
 
1114
 
1115
+ var $options = self.$results.find('[aria-selected]');
 
1116
 
1117
+ var currentIndex = $options.index($highlighted);
1118
 
1119
+ // If we are already at te top, don't move further
1120
+ if (currentIndex === 0) {
1121
+ return;
1122
+ }
1123
 
1124
+ var nextIndex = currentIndex - 1;
 
 
 
1125
 
1126
+ // If none are highlighted, highlight the first
1127
+ if ($highlighted.length === 0) {
1128
+ nextIndex = 0;
1129
+ }
1130
 
1131
+ var $next = $options.eq(nextIndex);
 
 
 
1132
 
1133
+ $next.trigger('mouseenter');
1134
 
1135
+ var currentOffset = self.$results.offset().top;
1136
+ var nextTop = $next.offset().top;
1137
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1138
 
1139
+ if (nextIndex === 0) {
1140
+ self.$results.scrollTop(0);
1141
+ } else if (nextTop - currentOffset < 0) {
1142
+ self.$results.scrollTop(nextOffset);
1143
+ }
1144
+ });
1145
 
1146
+ container.on('results:next', function () {
1147
+ var $highlighted = self.getHighlightedResults();
 
 
 
 
1148
 
1149
+ var $options = self.$results.find('[aria-selected]');
 
1150
 
1151
+ var currentIndex = $options.index($highlighted);
1152
 
1153
+ var nextIndex = currentIndex + 1;
1154
 
1155
+ // If we are at the last option, stay there
1156
+ if (nextIndex >= $options.length) {
1157
+ return;
1158
+ }
1159
 
1160
+ var $next = $options.eq(nextIndex);
 
 
 
1161
 
1162
+ $next.trigger('mouseenter');
1163
 
1164
+ var currentOffset = self.$results.offset().top +
1165
+ self.$results.outerHeight(false);
1166
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1167
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1168
 
1169
+ if (nextIndex === 0) {
1170
+ self.$results.scrollTop(0);
1171
+ } else if (nextBottom > currentOffset) {
1172
+ self.$results.scrollTop(nextOffset);
1173
+ }
1174
+ });
1175
 
1176
+ container.on('results:focus', function (params) {
1177
+ params.element.addClass('select2-results__option--highlighted');
1178
+ });
 
 
 
1179
 
1180
+ container.on('results:message', function (params) {
1181
+ self.displayMessage(params);
1182
+ });
1183
 
1184
+ if ($.fn.mousewheel) {
1185
+ this.$results.on('mousewheel', function (e) {
1186
+ var top = self.$results.scrollTop();
1187
 
1188
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
 
 
1189
 
1190
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1191
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1192
 
1193
+ if (isAtTop) {
1194
+ self.$results.scrollTop(0);
1195
 
1196
+ e.preventDefault();
1197
+ e.stopPropagation();
1198
+ } else if (isAtBottom) {
1199
+ self.$results.scrollTop(
1200
+ self.$results.get(0).scrollHeight - self.$results.height()
1201
+ );
1202
 
1203
+ e.preventDefault();
1204
+ e.stopPropagation();
1205
+ }
1206
+ });
1207
+ }
 
1208
 
1209
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1210
+ function (evt) {
1211
+ var $this = $(this);
 
 
1212
 
1213
+ var data = $this.data('data');
 
 
1214
 
1215
+ if ($this.attr('aria-selected') === 'true') {
1216
+ if (self.options.get('multiple')) {
1217
+ self.trigger('unselect', {
1218
+ originalEvent: evt,
1219
+ data: data
1220
+ });
1221
+ } else {
1222
+ self.trigger('close', {});
1223
+ }
1224
 
1225
+ return;
1226
+ }
 
 
 
 
 
 
 
1227
 
1228
+ self.trigger('select', {
1229
+ originalEvent: evt,
1230
+ data: data
1231
+ });
1232
+ });
1233
 
1234
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1235
+ function (evt) {
1236
+ var data = $(this).data('data');
 
 
1237
 
1238
+ self.getHighlightedResults()
1239
+ .removeClass('select2-results__option--highlighted');
 
1240
 
1241
+ self.trigger('results:focus', {
1242
+ data: data,
1243
+ element: $(this)
1244
+ });
1245
+ });
1246
+ };
1247
 
1248
+ Results.prototype.getHighlightedResults = function () {
1249
+ var $highlighted = this.$results
1250
+ .find('.select2-results__option--highlighted');
 
 
 
1251
 
1252
+ return $highlighted;
1253
+ };
 
1254
 
1255
+ Results.prototype.destroy = function () {
1256
+ this.$results.remove();
1257
+ };
1258
 
1259
+ Results.prototype.ensureHighlightVisible = function () {
1260
+ var $highlighted = this.getHighlightedResults();
 
1261
 
1262
+ if ($highlighted.length === 0) {
1263
+ return;
1264
+ }
1265
 
1266
+ var $options = this.$results.find('[aria-selected]');
 
 
1267
 
1268
+ var currentIndex = $options.index($highlighted);
1269
 
1270
+ var currentOffset = this.$results.offset().top;
1271
+ var nextTop = $highlighted.offset().top;
1272
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1273
 
1274
+ var offsetDelta = nextTop - currentOffset;
1275
+ nextOffset -= $highlighted.outerHeight(false) * 2;
 
1276
 
1277
+ if (currentIndex <= 2) {
1278
+ this.$results.scrollTop(0);
1279
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1280
+ this.$results.scrollTop(nextOffset);
1281
+ }
1282
+ };
1283
 
1284
+ Results.prototype.template = function (result, container) {
1285
+ var template = this.options.get('templateResult');
1286
+ var escapeMarkup = this.options.get('escapeMarkup');
 
 
 
1287
 
1288
+ var content = template(result, container);
 
 
1289
 
1290
+ if (content == null) {
1291
+ container.style.display = 'none';
1292
+ } else if (typeof content === 'string') {
1293
+ container.innerHTML = escapeMarkup(content);
1294
+ } else {
1295
+ $(container).append(content);
1296
+ }
1297
+ };
1298
 
1299
+ return Results;
1300
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1301
 
1302
+ S2.define('select2/keys',[
1303
+
1304
+ ], function () {
1305
+ var KEYS = {
1306
+ BACKSPACE: 8,
1307
+ TAB: 9,
1308
+ ENTER: 13,
1309
+ SHIFT: 16,
1310
+ CTRL: 17,
1311
+ ALT: 18,
1312
+ ESC: 27,
1313
+ SPACE: 32,
1314
+ PAGE_UP: 33,
1315
+ PAGE_DOWN: 34,
1316
+ END: 35,
1317
+ HOME: 36,
1318
+ LEFT: 37,
1319
+ UP: 38,
1320
+ RIGHT: 39,
1321
+ DOWN: 40,
1322
+ DELETE: 46
1323
+ };
1324
 
1325
+ return KEYS;
1326
+ });
1327
 
1328
+ S2.define('select2/selection/base',[
1329
+ 'jquery',
1330
+ '../utils',
1331
+ '../keys'
1332
+ ], function ($, Utils, KEYS) {
1333
+ function BaseSelection ($element, options) {
1334
+ this.$element = $element;
1335
+ this.options = options;
1336
 
1337
+ BaseSelection.__super__.constructor.call(this);
1338
+ }
1339
 
1340
+ Utils.Extend(BaseSelection, Utils.Observable);
 
1341
 
1342
+ BaseSelection.prototype.render = function () {
1343
+ var $selection = $(
1344
+ '<span class="select2-selection" role="combobox" ' +
1345
+ ' aria-haspopup="true" aria-expanded="false">' +
1346
+ '</span>'
1347
+ );
1348
 
1349
+ this._tabindex = 0;
 
 
1350
 
1351
+ if (this.$element.data('old-tabindex') != null) {
1352
+ this._tabindex = this.$element.data('old-tabindex');
1353
+ } else if (this.$element.attr('tabindex') != null) {
1354
+ this._tabindex = this.$element.attr('tabindex');
1355
+ }
1356
 
1357
+ $selection.attr('title', this.$element.attr('title'));
1358
+ $selection.attr('tabindex', this._tabindex);
1359
 
1360
+ this.$selection = $selection;
 
 
 
1361
 
1362
+ return $selection;
1363
+ };
 
1364
 
1365
+ BaseSelection.prototype.bind = function (container, $container) {
1366
+ var self = this;
 
1367
 
1368
+ var id = container.id + '-container';
1369
+ var resultsId = container.id + '-results';
 
 
1370
 
1371
+ this.container = container;
 
1372
 
1373
+ this.$selection.on('focus', function (evt) {
1374
+ self.trigger('focus', evt);
1375
+ });
 
 
1376
 
1377
+ this.$selection.on('blur', function (evt) {
1378
+ self._handleBlur(evt);
1379
+ });
1380
 
1381
+ this.$selection.on('keydown', function (evt) {
1382
+ self.trigger('keypress', evt);
1383
 
1384
+ if (evt.which === KEYS.SPACE) {
1385
+ evt.preventDefault();
1386
+ }
1387
+ });
1388
 
1389
+ container.on('results:focus', function (params) {
1390
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1391
+ });
 
1392
 
1393
+ container.on('selection:update', function (params) {
1394
+ self.update(params.data);
1395
+ });
1396
 
1397
+ container.on('open', function () {
1398
+ // When the dropdown is open, aria-expanded="true"
1399
+ self.$selection.attr('aria-expanded', 'true');
1400
+ self.$selection.attr('aria-owns', resultsId);
 
 
 
 
 
 
1401
 
1402
+ self._attachCloseHandler(container);
1403
+ });
 
1404
 
1405
+ container.on('close', function () {
1406
+ // When the dropdown is closed, aria-expanded="false"
1407
+ self.$selection.attr('aria-expanded', 'false');
1408
+ self.$selection.removeAttr('aria-activedescendant');
1409
+ self.$selection.removeAttr('aria-owns');
1410
 
1411
+ self.$selection.focus();
 
1412
 
1413
+ self._detachCloseHandler(container);
1414
+ });
1415
 
1416
+ container.on('enable', function () {
1417
+ self.$selection.attr('tabindex', self._tabindex);
1418
+ });
1419
 
1420
+ container.on('disable', function () {
1421
+ self.$selection.attr('tabindex', '-1');
1422
+ });
1423
+ };
1424
 
1425
+ BaseSelection.prototype._handleBlur = function (evt) {
1426
+ var self = this;
1427
+
1428
+ // This needs to be delayed as the active element is the body when the tab
1429
+ // key is pressed, possibly along with others.
1430
+ window.setTimeout(function () {
1431
+ // Don't trigger `blur` if the focus is still in the selection
1432
+ if (
1433
+ (document.activeElement == self.$selection[0]) ||
1434
+ ($.contains(self.$selection[0], document.activeElement))
1435
+ ) {
1436
+ return;
1437
+ }
1438
 
1439
+ self.trigger('blur', evt);
1440
+ }, 1);
1441
+ };
1442
 
1443
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1444
+ var self = this;
 
 
1445
 
1446
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1447
+ var $target = $(e.target);
 
1448
 
1449
+ var $select = $target.closest('.select2');
 
 
 
1450
 
1451
+ var $all = $('.select2.select2-container--open');
 
 
1452
 
1453
+ $all.each(function () {
1454
+ var $this = $(this);
 
1455
 
1456
+ if (this == $select[0]) {
1457
+ return;
1458
+ }
1459
 
1460
+ var $element = $this.data('element');
 
 
 
 
 
 
 
 
1461
 
1462
+ $element.select2('close');
1463
+ });
1464
+ });
1465
+ };
1466
 
1467
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1468
+ $(document.body).off('mousedown.select2.' + container.id);
1469
+ };
1470
 
1471
+ BaseSelection.prototype.position = function ($selection, $container) {
1472
+ var $selectionContainer = $container.find('.selection');
1473
+ $selectionContainer.append($selection);
1474
+ };
1475
 
1476
+ BaseSelection.prototype.destroy = function () {
1477
+ this._detachCloseHandler(this.container);
1478
+ };
 
 
 
1479
 
1480
+ BaseSelection.prototype.update = function (data) {
1481
+ throw new Error('The `update` method must be defined in child classes.');
1482
+ };
1483
 
1484
+ return BaseSelection;
1485
+ });
1486
 
1487
+ S2.define('select2/selection/single',[
1488
+ 'jquery',
1489
+ './base',
1490
+ '../utils',
1491
+ '../keys'
1492
+ ], function ($, BaseSelection, Utils, KEYS) {
1493
+ function SingleSelection () {
1494
+ SingleSelection.__super__.constructor.apply(this, arguments);
1495
+ }
1496
 
1497
+ Utils.Extend(SingleSelection, BaseSelection);
1498
 
1499
+ SingleSelection.prototype.render = function () {
1500
+ var $selection = SingleSelection.__super__.render.call(this);
1501
 
1502
+ $selection.addClass('select2-selection--single');
 
 
 
 
1503
 
1504
+ $selection.html(
1505
+ '<span class="select2-selection__rendered"></span>' +
1506
+ '<span class="select2-selection__arrow" role="presentation">' +
1507
+ '<b role="presentation"></b>' +
1508
+ '</span>'
1509
+ );
1510
 
1511
+ return $selection;
1512
+ };
 
1513
 
1514
+ SingleSelection.prototype.bind = function (container, $container) {
1515
+ var self = this;
 
1516
 
1517
+ SingleSelection.__super__.bind.apply(this, arguments);
 
 
 
 
1518
 
1519
+ var id = container.id + '-container';
 
 
 
1520
 
1521
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1522
+ this.$selection.attr('aria-labelledby', id);
 
1523
 
1524
+ this.$selection.on('mousedown', function (evt) {
1525
+ // Only respond to left clicks
1526
+ if (evt.which !== 1) {
1527
+ return;
1528
+ }
 
 
 
 
 
 
 
 
 
 
 
1529
 
1530
+ self.trigger('toggle', {
1531
+ originalEvent: evt
1532
+ });
1533
+ });
1534
 
1535
+ this.$selection.on('focus', function (evt) {
1536
+ // User focuses on the container
1537
+ });
1538
 
1539
+ this.$selection.on('blur', function (evt) {
1540
+ // User exits the container
1541
+ });
1542
 
1543
+ container.on('focus', function (evt) {
1544
+ if (!container.isOpen()) {
1545
+ self.$selection.focus();
1546
+ }
1547
+ });
1548
 
1549
+ container.on('selection:update', function (params) {
1550
+ self.update(params.data);
1551
+ });
1552
+ };
 
 
 
 
1553
 
1554
+ SingleSelection.prototype.clear = function () {
1555
+ this.$selection.find('.select2-selection__rendered').empty();
1556
+ };
1557
 
1558
+ SingleSelection.prototype.display = function (data, container) {
1559
+ var template = this.options.get('templateSelection');
1560
+ var escapeMarkup = this.options.get('escapeMarkup');
1561
 
1562
+ return escapeMarkup(template(data, container));
1563
+ };
1564
 
1565
+ SingleSelection.prototype.selectionContainer = function () {
1566
+ return $('<span></span>');
1567
+ };
1568
 
1569
+ SingleSelection.prototype.update = function (data) {
1570
+ if (data.length === 0) {
1571
+ this.clear();
1572
+ return;
1573
+ }
1574
 
1575
+ var selection = data[0];
 
1576
 
1577
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1578
+ var formatted = this.display(selection, $rendered);
1579
 
1580
+ $rendered.empty().append(formatted);
1581
+ $rendered.prop('title', selection.title || selection.text);
1582
+ };
 
 
1583
 
1584
+ return SingleSelection;
1585
+ });
 
 
 
 
 
 
1586
 
1587
+ S2.define('select2/selection/multiple',[
1588
+ 'jquery',
1589
+ './base',
1590
+ '../utils'
1591
+ ], function ($, BaseSelection, Utils) {
1592
+ function MultipleSelection ($element, options) {
1593
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1594
+ }
1595
 
1596
+ Utils.Extend(MultipleSelection, BaseSelection);
1597
 
1598
+ MultipleSelection.prototype.render = function () {
1599
+ var $selection = MultipleSelection.__super__.render.call(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1600
 
1601
+ $selection.addClass('select2-selection--multiple');
1602
 
1603
+ $selection.html(
1604
+ '<ul class="select2-selection__rendered"></ul>'
1605
+ );
1606
 
1607
+ return $selection;
1608
+ };
1609
 
1610
+ MultipleSelection.prototype.bind = function (container, $container) {
1611
+ var self = this;
1612
 
1613
+ MultipleSelection.__super__.bind.apply(this, arguments);
1614
 
1615
+ this.$selection.on('click', function (evt) {
1616
+ self.trigger('toggle', {
1617
+ originalEvent: evt
1618
+ });
1619
+ });
1620
 
1621
+ this.$selection.on(
1622
+ 'click',
1623
+ '.select2-selection__choice__remove',
1624
+ function (evt) {
1625
+ // Ignore the event if it is disabled
1626
+ if (self.options.get('disabled')) {
1627
+ return;
1628
+ }
1629
 
1630
+ var $remove = $(this);
1631
+ var $selection = $remove.parent();
1632
 
1633
+ var data = $selection.data('data');
 
1634
 
1635
+ self.trigger('unselect', {
1636
+ originalEvent: evt,
1637
+ data: data
1638
+ });
1639
+ }
1640
+ );
1641
+ };
1642
 
1643
+ MultipleSelection.prototype.clear = function () {
1644
+ this.$selection.find('.select2-selection__rendered').empty();
1645
+ };
1646
 
1647
+ MultipleSelection.prototype.display = function (data, container) {
1648
+ var template = this.options.get('templateSelection');
1649
+ var escapeMarkup = this.options.get('escapeMarkup');
 
 
 
 
1650
 
1651
+ return escapeMarkup(template(data, container));
1652
+ };
1653
 
1654
+ MultipleSelection.prototype.selectionContainer = function () {
1655
+ var $container = $(
1656
+ '<li class="select2-selection__choice">' +
1657
+ '<span class="select2-selection__choice__remove" role="presentation">' +
1658
+ '&times;' +
1659
+ '</span>' +
1660
+ '</li>'
1661
+ );
1662
 
1663
+ return $container;
1664
+ };
 
1665
 
1666
+ MultipleSelection.prototype.update = function (data) {
1667
+ this.clear();
1668
 
1669
+ if (data.length === 0) {
1670
+ return;
1671
+ }
 
 
1672
 
1673
+ var $selections = [];
 
 
1674
 
1675
+ for (var d = 0; d < data.length; d++) {
1676
+ var selection = data[d];
1677
 
1678
+ var $selection = this.selectionContainer();
1679
+ var formatted = this.display(selection, $selection);
1680
 
1681
+ $selection.append(formatted);
1682
+ $selection.prop('title', selection.title || selection.text);
1683
 
1684
+ $selection.data('data', selection);
 
1685
 
1686
+ $selections.push($selection);
1687
+ }
 
 
 
1688
 
1689
+ var $rendered = this.$selection.find('.select2-selection__rendered');
 
1690
 
1691
+ Utils.appendMany($rendered, $selections);
1692
+ };
1693
 
1694
+ return MultipleSelection;
1695
+ });
 
 
 
 
 
 
1696
 
1697
+ S2.define('select2/selection/placeholder',[
1698
+ '../utils'
1699
+ ], function (Utils) {
1700
+ function Placeholder (decorated, $element, options) {
1701
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1702
 
1703
+ decorated.call(this, $element, options);
1704
+ }
 
 
1705
 
1706
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1707
+ if (typeof placeholder === 'string') {
1708
+ placeholder = {
1709
+ id: '',
1710
+ text: placeholder
1711
+ };
1712
+ }
1713
 
1714
+ return placeholder;
1715
+ };
1716
 
1717
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1718
+ var $placeholder = this.selectionContainer();
 
 
1719
 
1720
+ $placeholder.html(this.display(placeholder));
1721
+ $placeholder.addClass('select2-selection__placeholder')
1722
+ .removeClass('select2-selection__choice');
1723
 
1724
+ return $placeholder;
1725
+ };
1726
 
1727
+ Placeholder.prototype.update = function (decorated, data) {
1728
+ var singlePlaceholder = (
1729
+ data.length == 1 && data[0].id != this.placeholder.id
1730
+ );
1731
+ var multipleSelections = data.length > 1;
1732
 
1733
+ if (multipleSelections || singlePlaceholder) {
1734
+ return decorated.call(this, data);
1735
+ }
1736
 
1737
+ this.clear();
 
 
 
 
1738
 
1739
+ var $placeholder = this.createPlaceholder(this.placeholder);
1740
 
1741
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1742
+ };
1743
 
1744
+ return Placeholder;
1745
+ });
 
 
1746
 
1747
+ S2.define('select2/selection/allowClear',[
1748
+ 'jquery',
1749
+ '../keys'
1750
+ ], function ($, KEYS) {
1751
+ function AllowClear () { }
1752
 
1753
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1754
+ var self = this;
1755
 
1756
+ decorated.call(this, container, $container);
1757
+
1758
+ if (this.placeholder == null) {
1759
+ if (this.options.get('debug') && window.console && console.error) {
1760
+ console.error(
1761
+ 'Select2: The `allowClear` option should be used in combination ' +
1762
+ 'with the `placeholder` option.'
1763
+ );
1764
+ }
1765
+ }
1766
 
1767
+ this.$selection.on('mousedown', '.select2-selection__clear',
1768
+ function (evt) {
1769
+ self._handleClear(evt);
1770
+ });
 
 
1771
 
1772
+ container.on('keypress', function (evt) {
1773
+ self._handleKeyboardClear(evt, container);
1774
+ });
1775
+ };
1776
 
1777
+ AllowClear.prototype._handleClear = function (_, evt) {
1778
+ // Ignore the event if it is disabled
1779
+ if (this.options.get('disabled')) {
1780
+ return;
1781
+ }
1782
 
1783
+ var $clear = this.$selection.find('.select2-selection__clear');
 
 
 
 
 
 
 
1784
 
1785
+ // Ignore the event if nothing has been selected
1786
+ if ($clear.length === 0) {
1787
+ return;
1788
+ }
 
 
 
 
1789
 
1790
+ evt.stopPropagation();
 
1791
 
1792
+ var data = $clear.data('data');
1793
 
1794
+ for (var d = 0; d < data.length; d++) {
1795
+ var unselectData = {
1796
+ data: data[d]
1797
+ };
1798
 
1799
+ // Trigger the `unselect` event, so people can prevent it from being
1800
+ // cleared.
1801
+ this.trigger('unselect', unselectData);
1802
 
1803
+ // If the event was prevented, don't clear it out.
1804
+ if (unselectData.prevented) {
1805
+ return;
1806
+ }
1807
+ }
1808
 
1809
+ this.$element.val(this.placeholder.id).trigger('change');
1810
 
1811
+ this.trigger('toggle', {});
1812
+ };
 
1813
 
1814
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1815
+ if (container.isOpen()) {
1816
+ return;
1817
+ }
 
1818
 
1819
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1820
+ this._handleClear(evt);
1821
+ }
1822
+ };
1823
 
1824
+ AllowClear.prototype.update = function (decorated, data) {
1825
+ decorated.call(this, data);
1826
 
1827
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1828
+ data.length === 0) {
1829
+ return;
1830
+ }
1831
 
1832
+ var $remove = $(
1833
+ '<span class="select2-selection__clear">' +
1834
+ '&times;' +
1835
+ '</span>'
1836
+ );
1837
+ $remove.data('data', data);
1838
 
1839
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1840
+ };
 
1841
 
1842
+ return AllowClear;
1843
+ });
 
1844
 
1845
+ S2.define('select2/selection/search',[
1846
+ 'jquery',
1847
+ '../utils',
1848
+ '../keys'
1849
+ ], function ($, Utils, KEYS) {
1850
+ function Search (decorated, $element, options) {
1851
+ decorated.call(this, $element, options);
1852
+ }
1853
 
1854
+ Search.prototype.render = function (decorated) {
1855
+ var $search = $(
1856
+ '<li class="select2-search select2-search--inline">' +
1857
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
1858
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
1859
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1860
+ '</li>'
1861
+ );
1862
 
1863
+ this.$searchContainer = $search;
1864
+ this.$search = $search.find('input');
1865
 
1866
+ var $rendered = decorated.call(this);
1867
 
1868
+ this._transferTabIndex();
1869
 
1870
+ return $rendered;
1871
+ };
 
1872
 
1873
+ Search.prototype.bind = function (decorated, container, $container) {
1874
+ var self = this;
1875
 
1876
+ decorated.call(this, container, $container);
1877
 
1878
+ container.on('open', function () {
1879
+ self.$search.trigger('focus');
1880
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1881
 
1882
+ container.on('close', function () {
1883
+ self.$search.val('');
1884
+ self.$search.removeAttr('aria-activedescendant');
1885
+ self.$search.trigger('focus');
1886
+ });
 
 
 
 
 
 
 
 
 
 
 
1887
 
1888
+ container.on('enable', function () {
1889
+ self.$search.prop('disabled', false);
1890
 
1891
+ self._transferTabIndex();
1892
+ });
 
 
1893
 
1894
+ container.on('disable', function () {
1895
+ self.$search.prop('disabled', true);
1896
+ });
 
1897
 
1898
+ container.on('focus', function (evt) {
1899
+ self.$search.trigger('focus');
1900
+ });
 
1901
 
1902
+ container.on('results:focus', function (params) {
1903
+ self.$search.attr('aria-activedescendant', params.id);
1904
+ });
 
 
 
 
 
 
 
 
1905
 
1906
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1907
+ self.trigger('focus', evt);
1908
+ });
1909
 
1910
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1911
+ self._handleBlur(evt);
1912
+ });
1913
 
1914
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1915
+ evt.stopPropagation();
1916
 
1917
+ self.trigger('keypress', evt);
1918
 
1919
+ self._keyUpPrevented = evt.isDefaultPrevented();
 
1920
 
1921
+ var key = evt.which;
 
 
 
 
1922
 
1923
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1924
+ var $previousChoice = self.$searchContainer
1925
+ .prev('.select2-selection__choice');
1926
 
1927
+ if ($previousChoice.length > 0) {
1928
+ var item = $previousChoice.data('data');
1929
 
1930
+ self.searchRemoveChoice(item);
 
 
 
1931
 
1932
+ evt.preventDefault();
1933
+ }
1934
+ }
1935
+ });
1936
+
1937
+ // Try to detect the IE version should the `documentMode` property that
1938
+ // is stored on the document. This is only implemented in IE and is
1939
+ // slightly cleaner than doing a user agent check.
1940
+ // This property is not available in Edge, but Edge also doesn't have
1941
+ // this bug.
1942
+ var msie = document.documentMode;
1943
+ var disableInputEvents = msie && msie <= 11;
1944
+
1945
+ // Workaround for browsers which do not support the `input` event
1946
+ // This will prevent double-triggering of events for browsers which support
1947
+ // both the `keyup` and `input` events.
1948
+ this.$selection.on(
1949
+ 'input.searchcheck',
1950
+ '.select2-search--inline',
1951
+ function (evt) {
1952
+ // IE will trigger the `input` event when a placeholder is used on a
1953
+ // search box. To get around this issue, we are forced to ignore all
1954
+ // `input` events in IE and keep using `keyup`.
1955
+ if (disableInputEvents) {
1956
+ self.$selection.off('input.search input.searchcheck');
1957
+ return;
1958
+ }
1959
 
1960
+ // Unbind the duplicated `keyup` event
1961
+ self.$selection.off('keyup.search');
1962
+ }
1963
+ );
1964
+
1965
+ this.$selection.on(
1966
+ 'keyup.search input.search',
1967
+ '.select2-search--inline',
1968
+ function (evt) {
1969
+ // IE will trigger the `input` event when a placeholder is used on a
1970
+ // search box. To get around this issue, we are forced to ignore all
1971
+ // `input` events in IE and keep using `keyup`.
1972
+ if (disableInputEvents && evt.type === 'input') {
1973
+ self.$selection.off('input.search input.searchcheck');
1974
+ return;
1975
+ }
1976
 
1977
+ var key = evt.which;
 
 
1978
 
1979
+ // We can freely ignore events from modifier keys
1980
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1981
+ return;
1982
+ }
1983
 
1984
+ // Tabbing will be handled during the `keydown` phase
1985
+ if (key == KEYS.TAB) {
1986
+ return;
1987
+ }
1988
 
1989
+ self.handleSearch(evt);
1990
+ }
1991
+ );
1992
+ };
1993
 
1994
+ /**
1995
+ * This method will transfer the tabindex attribute from the rendered
1996
+ * selection to the search box. This allows for the search box to be used as
1997
+ * the primary focus instead of the selection container.
1998
+ *
1999
+ * @private
2000
+ */
2001
+ Search.prototype._transferTabIndex = function (decorated) {
2002
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2003
+ this.$selection.attr('tabindex', '-1');
2004
+ };
2005
 
2006
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2007
+ this.$search.attr('placeholder', placeholder.text);
2008
+ };
2009
 
2010
+ Search.prototype.update = function (decorated, data) {
2011
+ var searchHadFocus = this.$search[0] == document.activeElement;
2012
 
2013
+ this.$search.attr('placeholder', '');
 
 
 
2014
 
2015
+ decorated.call(this, data);
 
 
 
 
 
 
 
2016
 
2017
+ this.$selection.find('.select2-selection__rendered')
2018
+ .append(this.$searchContainer);
2019
 
2020
+ this.resizeSearch();
2021
+ if (searchHadFocus) {
2022
+ this.$search.focus();
2023
+ }
2024
+ };
2025
 
2026
+ Search.prototype.handleSearch = function () {
2027
+ this.resizeSearch();
 
 
 
2028
 
2029
+ if (!this._keyUpPrevented) {
2030
+ var input = this.$search.val();
2031
 
2032
+ this.trigger('query', {
2033
+ term: input
2034
+ });
2035
+ }
2036
 
2037
+ this._keyUpPrevented = false;
2038
+ };
2039
 
2040
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2041
+ this.trigger('unselect', {
2042
+ data: item
2043
+ });
2044
 
2045
+ this.$search.val(item.text);
2046
+ this.handleSearch();
2047
+ };
2048
 
2049
+ Search.prototype.resizeSearch = function () {
2050
+ this.$search.css('width', '25px');
2051
 
2052
+ var width = '';
 
 
 
 
 
 
2053
 
2054
+ if (this.$search.attr('placeholder') !== '') {
2055
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2056
+ } else {
2057
+ var minimumWidth = this.$search.val().length + 1;
2058
 
2059
+ width = (minimumWidth * 0.75) + 'em';
2060
+ }
 
2061
 
2062
+ this.$search.css('width', width);
2063
+ };
 
2064
 
2065
+ return Search;
2066
+ });
2067
 
2068
+ S2.define('select2/selection/eventRelay',[
2069
+ 'jquery'
2070
+ ], function ($) {
2071
+ function EventRelay () { }
2072
 
2073
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2074
+ var self = this;
2075
+ var relayEvents = [
2076
+ 'open', 'opening',
2077
+ 'close', 'closing',
2078
+ 'select', 'selecting',
2079
+ 'unselect', 'unselecting'
2080
+ ];
2081
 
2082
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
 
2083
 
2084
+ decorated.call(this, container, $container);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2085
 
2086
+ container.on('*', function (name, params) {
2087
+ // Ignore events that should not be relayed
2088
+ if ($.inArray(name, relayEvents) === -1) {
2089
+ return;
2090
+ }
2091
 
2092
+ // The parameters should always be an object
2093
+ params = params || {};
 
 
 
 
 
 
2094
 
2095
+ // Generate the jQuery event for the Select2 event
2096
+ var evt = $.Event('select2:' + name, {
2097
+ params: params
2098
+ });
2099
 
2100
+ self.$element.trigger(evt);
2101
 
2102
+ // Only handle preventable events if it was one
2103
+ if ($.inArray(name, preventableEvents) === -1) {
2104
+ return;
2105
+ }
2106
 
2107
+ params.prevented = evt.isDefaultPrevented();
2108
+ });
2109
+ };
2110
 
2111
+ return EventRelay;
2112
+ });
2113
 
2114
+ S2.define('select2/translation',[
2115
+ 'jquery',
2116
+ 'require'
2117
+ ], function ($, require) {
2118
+ function Translation (dict) {
2119
+ this.dict = dict || {};
2120
+ }
2121
 
2122
+ Translation.prototype.all = function () {
2123
+ return this.dict;
2124
+ };
2125
 
2126
+ Translation.prototype.get = function (key) {
2127
+ return this.dict[key];
2128
+ };
2129
 
2130
+ Translation.prototype.extend = function (translation) {
2131
+ this.dict = $.extend({}, translation.all(), this.dict);
2132
+ };
2133
 
2134
+ // Static functions
 
 
2135
 
2136
+ Translation._cache = {};
2137
 
2138
+ Translation.loadPath = function (path) {
2139
+ if (!(path in Translation._cache)) {
2140
+ var translations = require(path);
2141
 
2142
+ Translation._cache[path] = translations;
2143
+ }
 
2144
 
2145
+ return new Translation(Translation._cache[path]);
2146
+ };
2147
 
2148
+ return Translation;
2149
+ });
2150
 
2151
+ S2.define('select2/diacritics',[
2152
+
2153
+ ], function () {
2154
+ var diacritics = {
2155
+ '\u24B6': 'A',
2156
+ '\uFF21': 'A',
2157
+ '\u00C0': 'A',
2158
+ '\u00C1': 'A',
2159
+ '\u00C2': 'A',
2160
+ '\u1EA6': 'A',
2161
+ '\u1EA4': 'A',
2162
+ '\u1EAA': 'A',
2163
+ '\u1EA8': 'A',
2164
+ '\u00C3': 'A',
2165
+ '\u0100': 'A',
2166
+ '\u0102': 'A',
2167
+ '\u1EB0': 'A',
2168
+ '\u1EAE': 'A',
2169
+ '\u1EB4': 'A',
2170
+ '\u1EB2': 'A',
2171
+ '\u0226': 'A',
2172
+ '\u01E0': 'A',
2173
+ '\u00C4': 'A',
2174
+ '\u01DE': 'A',
2175
+ '\u1EA2': 'A',
2176
+ '\u00C5': 'A',
2177
+ '\u01FA': 'A',
2178
+ '\u01CD': 'A',
2179
+ '\u0200': 'A',
2180
+ '\u0202': 'A',
2181
+ '\u1EA0': 'A',
2182
+ '\u1EAC': 'A',
2183
+ '\u1EB6': 'A',
2184
+ '\u1E00': 'A',
2185
+ '\u0104': 'A',
2186
+ '\u023A': 'A',
2187
+ '\u2C6F': 'A',
2188
+ '\uA732': 'AA',
2189
+ '\u00C6': 'AE',
2190
+ '\u01FC': 'AE',
2191
+ '\u01E2': 'AE',
2192
+ '\uA734': 'AO',
2193
+ '\uA736': 'AU',
2194
+ '\uA738': 'AV',
2195
+ '\uA73A': 'AV',
2196
+ '\uA73C': 'AY',
2197
+ '\u24B7': 'B',
2198
+ '\uFF22': 'B',
2199
+ '\u1E02': 'B',
2200
+ '\u1E04': 'B',
2201
+ '\u1E06': 'B',
2202
+ '\u0243': 'B',
2203
+ '\u0182': 'B',
2204
+ '\u0181': 'B',
2205
+ '\u24B8': 'C',
2206
+ '\uFF23': 'C',
2207
+ '\u0106': 'C',
2208
+ '\u0108': 'C',
2209
+ '\u010A': 'C',
2210
+ '\u010C': 'C',
2211
+ '\u00C7': 'C',
2212
+ '\u1E08': 'C',
2213
+ '\u0187': 'C',
2214
+ '\u023B': 'C',
2215
+ '\uA73E': 'C',
2216
+ '\u24B9': 'D',
2217
+ '\uFF24': 'D',
2218
+ '\u1E0A': 'D',
2219
+ '\u010E': 'D',
2220
+ '\u1E0C': 'D',
2221
+ '\u1E10': 'D',
2222
+ '\u1E12': 'D',
2223
+ '\u1E0E': 'D',
2224
+ '\u0110': 'D',
2225
+ '\u018B': 'D',
2226
+ '\u018A': 'D',
2227
+ '\u0189': 'D',
2228
+ '\uA779': 'D',
2229
+ '\u01F1': 'DZ',
2230
+ '\u01C4': 'DZ',
2231
+ '\u01F2': 'Dz',
2232
+ '\u01C5': 'Dz',
2233
+ '\u24BA': 'E',
2234
+ '\uFF25': 'E',
2235
+ '\u00C8': 'E',
2236
+ '\u00C9': 'E',
2237
+ '\u00CA': 'E',
2238
+ '\u1EC0': 'E',
2239
+ '\u1EBE': 'E',
2240
+ '\u1EC4': 'E',
2241
+ '\u1EC2': 'E',
2242
+ '\u1EBC': 'E',
2243
+ '\u0112': 'E',
2244
+ '\u1E14': 'E',
2245
+ '\u1E16': 'E',
2246
+ '\u0114': 'E',
2247
+ '\u0116': 'E',
2248
+ '\u00CB': 'E',
2249
+ '\u1EBA': 'E',
2250
+ '\u011A': 'E',
2251
+ '\u0204': 'E',
2252
+ '\u0206': 'E',
2253
+ '\u1EB8': 'E',
2254
+ '\u1EC6': 'E',
2255
+ '\u0228': 'E',
2256
+ '\u1E1C': 'E',
2257
+ '\u0118': 'E',
2258
+ '\u1E18': 'E',
2259
+ '\u1E1A': 'E',
2260
+ '\u0190': 'E',
2261
+ '\u018E': 'E',
2262
+ '\u24BB': 'F',
2263
+ '\uFF26': 'F',
2264
+ '\u1E1E': 'F',
2265
+ '\u0191': 'F',
2266
+ '\uA77B': 'F',
2267
+ '\u24BC': 'G',
2268
+ '\uFF27': 'G',
2269
+ '\u01F4': 'G',
2270
+ '\u011C': 'G',
2271
+ '\u1E20': 'G',
2272
+ '\u011E': 'G',
2273
+ '\u0120': 'G',
2274
+ '\u01E6': 'G',
2275
+ '\u0122': 'G',
2276
+ '\u01E4': 'G',
2277
+ '\u0193': 'G',
2278
+ '\uA7A0': 'G',
2279
+ '\uA77D': 'G',
2280
+ '\uA77E': 'G',
2281
+ '\u24BD': 'H',
2282
+ '\uFF28': 'H',
2283
+ '\u0124': 'H',
2284
+ '\u1E22': 'H',
2285
+ '\u1E26': 'H',
2286
+ '\u021E': 'H',
2287
+ '\u1E24': 'H',
2288
+ '\u1E28': 'H',
2289
+ '\u1E2A': 'H',
2290
+ '\u0126': 'H',
2291
+ '\u2C67': 'H',
2292
+ '\u2C75': 'H',
2293
+ '\uA78D': 'H',
2294
+ '\u24BE': 'I',
2295
+ '\uFF29': 'I',
2296
+ '\u00CC': 'I',
2297
+ '\u00CD': 'I',
2298
+ '\u00CE': 'I',
2299
+ '\u0128': 'I',
2300
+ '\u012A': 'I',
2301
+ '\u012C': 'I',
2302
+ '\u0130': 'I',
2303
+ '\u00CF': 'I',
2304
+ '\u1E2E': 'I',
2305
+ '\u1EC8': 'I',
2306
+ '\u01CF': 'I',
2307
+ '\u0208': 'I',
2308
+ '\u020A': 'I',
2309
+ '\u1ECA': 'I',
2310
+ '\u012E': 'I',
2311
+ '\u1E2C': 'I',
2312
+ '\u0197': 'I',
2313
+ '\u24BF': 'J',
2314
+ '\uFF2A': 'J',
2315
+ '\u0134': 'J',
2316
+ '\u0248': 'J',
2317
+ '\u24C0': 'K',
2318
+ '\uFF2B': 'K',
2319
+ '\u1E30': 'K',
2320
+ '\u01E8': 'K',
2321
+ '\u1E32': 'K',
2322
+ '\u0136': 'K',
2323
+ '\u1E34': 'K',
2324
+ '\u0198': 'K',
2325
+ '\u2C69': 'K',
2326
+ '\uA740': 'K',
2327
+ '\uA742': 'K',
2328
+ '\uA744': 'K',
2329
+ '\uA7A2': 'K',
2330
+ '\u24C1': 'L',
2331
+ '\uFF2C': 'L',
2332
+ '\u013F': 'L',
2333
+ '\u0139': 'L',
2334
+ '\u013D': 'L',
2335
+ '\u1E36': 'L',
2336
+ '\u1E38': 'L',
2337
+ '\u013B': 'L',
2338
+ '\u1E3C': 'L',
2339
+ '\u1E3A': 'L',
2340
+ '\u0141': 'L',
2341
+ '\u023D': 'L',
2342
+ '\u2C62': 'L',
2343
+ '\u2C60': 'L',
2344
+ '\uA748': 'L',
2345
+ '\uA746': 'L',
2346
+ '\uA780': 'L',
2347
+ '\u01C7': 'LJ',
2348
+ '\u01C8': 'Lj',
2349
+ '\u24C2': 'M',
2350
+ '\uFF2D': 'M',
2351
+ '\u1E3E': 'M',
2352
+ '\u1E40': 'M',
2353
+ '\u1E42': 'M',
2354
+ '\u2C6E': 'M',
2355
+ '\u019C': 'M',
2356
+ '\u24C3': 'N',
2357
+ '\uFF2E': 'N',
2358
+ '\u01F8': 'N',
2359
+ '\u0143': 'N',
2360
+ '\u00D1': 'N',
2361
+ '\u1E44': 'N',
2362
+ '\u0147': 'N',
2363
+ '\u1E46': 'N',
2364
+ '\u0145': 'N',
2365
+ '\u1E4A': 'N',
2366
+ '\u1E48': 'N',
2367
+ '\u0220': 'N',
2368
+ '\u019D': 'N',
2369
+ '\uA790': 'N',
2370
+ '\uA7A4': 'N',
2371
+ '\u01CA': 'NJ',
2372
+ '\u01CB': 'Nj',
2373
+ '\u24C4': 'O',
2374
+ '\uFF2F': 'O',
2375
+ '\u00D2': 'O',
2376
+ '\u00D3': 'O',
2377
+ '\u00D4': 'O',
2378
+ '\u1ED2': 'O',
2379
+ '\u1ED0': 'O',
2380
+ '\u1ED6': 'O',
2381
+ '\u1ED4': 'O',
2382
+ '\u00D5': 'O',
2383
+ '\u1E4C': 'O',
2384
+ '\u022C': 'O',
2385
+ '\u1E4E': 'O',
2386
+ '\u014C': 'O',
2387
+ '\u1E50': 'O',
2388
+ '\u1E52': 'O',
2389
+ '\u014E': 'O',
2390
+ '\u022E': 'O',
2391
+ '\u0230': 'O',
2392
+ '\u00D6': 'O',
2393
+ '\u022A': 'O',
2394
+ '\u1ECE': 'O',
2395
+ '\u0150': 'O',
2396
+ '\u01D1': 'O',
2397
+ '\u020C': 'O',
2398
+ '\u020E': 'O',
2399
+ '\u01A0': 'O',
2400
+ '\u1EDC': 'O',
2401
+ '\u1EDA': 'O',
2402
+ '\u1EE0': 'O',
2403
+ '\u1EDE': 'O',
2404
+ '\u1EE2': 'O',
2405
+ '\u1ECC': 'O',
2406
+ '\u1ED8': 'O',
2407
+ '\u01EA': 'O',
2408
+ '\u01EC': 'O',
2409
+ '\u00D8': 'O',
2410
+ '\u01FE': 'O',
2411
+ '\u0186': 'O',
2412
+ '\u019F': 'O',
2413
+ '\uA74A': 'O',
2414
+ '\uA74C': 'O',
2415
+ '\u01A2': 'OI',
2416
+ '\uA74E': 'OO',
2417
+ '\u0222': 'OU',
2418
+ '\u24C5': 'P',
2419
+ '\uFF30': 'P',
2420
+ '\u1E54': 'P',
2421
+ '\u1E56': 'P',
2422
+ '\u01A4': 'P',
2423
+ '\u2C63': 'P',
2424
+ '\uA750': 'P',
2425
+ '\uA752': 'P',
2426
+ '\uA754': 'P',
2427
+ '\u24C6': 'Q',
2428
+ '\uFF31': 'Q',
2429
+ '\uA756': 'Q',
2430
+ '\uA758': 'Q',
2431
+ '\u024A': 'Q',
2432
+ '\u24C7': 'R',
2433
+ '\uFF32': 'R',
2434
+ '\u0154': 'R',
2435
+ '\u1E58': 'R',
2436
+ '\u0158': 'R',
2437
+ '\u0210': 'R',
2438
+ '\u0212': 'R',
2439
+ '\u1E5A': 'R',
2440
+ '\u1E5C': 'R',
2441
+ '\u0156': 'R',
2442
+ '\u1E5E': 'R',
2443
+ '\u024C': 'R',
2444
+ '\u2C64': 'R',
2445
+ '\uA75A': 'R',
2446
+ '\uA7A6': 'R',
2447
+ '\uA782': 'R',
2448
+ '\u24C8': 'S',
2449
+ '\uFF33': 'S',
2450
+ '\u1E9E': 'S',
2451
+ '\u015A': 'S',
2452
+ '\u1E64': 'S',
2453
+ '\u015C': 'S',
2454
+ '\u1E60': 'S',
2455
+ '\u0160': 'S',
2456
+ '\u1E66': 'S',
2457
+ '\u1E62': 'S',
2458
+ '\u1E68': 'S',
2459
+ '\u0218': 'S',
2460
+ '\u015E': 'S',
2461
+ '\u2C7E': 'S',
2462
+ '\uA7A8': 'S',
2463
+ '\uA784': 'S',
2464
+ '\u24C9': 'T',
2465
+ '\uFF34': 'T',
2466
+ '\u1E6A': 'T',
2467
+ '\u0164': 'T',
2468
+ '\u1E6C': 'T',
2469
+ '\u021A': 'T',
2470
+ '\u0162': 'T',
2471
+ '\u1E70': 'T',
2472
+ '\u1E6E': 'T',
2473
+ '\u0166': 'T',
2474
+ '\u01AC': 'T',
2475
+ '\u01AE': 'T',
2476
+ '\u023E': 'T',
2477
+ '\uA786': 'T',
2478
+ '\uA728': 'TZ',
2479
+ '\u24CA': 'U',
2480
+ '\uFF35': 'U',
2481
+ '\u00D9': 'U',
2482
+ '\u00DA': 'U',
2483
+ '\u00DB': 'U',
2484
+ '\u0168': 'U',
2485
+ '\u1E78': 'U',
2486
+ '\u016A': 'U',
2487
+ '\u1E7A': 'U',
2488
+ '\u016C': 'U',
2489
+ '\u00DC': 'U',
2490
+ '\u01DB': 'U',
2491
+ '\u01D7': 'U',
2492
+ '\u01D5': 'U',
2493
+ '\u01D9': 'U',
2494
+ '\u1EE6': 'U',
2495
+ '\u016E': 'U',
2496
+ '\u0170': 'U',
2497
+ '\u01D3': 'U',
2498
+ '\u0214': 'U',
2499
+ '\u0216': 'U',
2500
+ '\u01AF': 'U',
2501
+ '\u1EEA': 'U',
2502
+ '\u1EE8': 'U',
2503
+ '\u1EEE': 'U',
2504
+ '\u1EEC': 'U',
2505
+ '\u1EF0': 'U',
2506
+ '\u1EE4': 'U',
2507
+ '\u1E72': 'U',
2508
+ '\u0172': 'U',
2509
+ '\u1E76': 'U',
2510
+ '\u1E74': 'U',
2511
+ '\u0244': 'U',
2512
+ '\u24CB': 'V',
2513
+ '\uFF36': 'V',
2514
+ '\u1E7C': 'V',
2515
+ '\u1E7E': 'V',
2516
+ '\u01B2': 'V',
2517
+ '\uA75E': 'V',
2518
+ '\u0245': 'V',
2519
+ '\uA760': 'VY',
2520
+ '\u24CC': 'W',
2521
+ '\uFF37': 'W',
2522
+ '\u1E80': 'W',
2523
+ '\u1E82': 'W',
2524
+ '\u0174': 'W',
2525
+ '\u1E86': 'W',
2526
+ '\u1E84': 'W',
2527
+ '\u1E88': 'W',
2528
+ '\u2C72': 'W',
2529
+ '\u24CD': 'X',
2530
+ '\uFF38': 'X',
2531
+ '\u1E8A': 'X',
2532
+ '\u1E8C': 'X',
2533
+ '\u24CE': 'Y',
2534
+ '\uFF39': 'Y',
2535
+ '\u1EF2': 'Y',
2536
+ '\u00DD': 'Y',
2537
+ '\u0176': 'Y',
2538
+ '\u1EF8': 'Y',
2539
+ '\u0232': 'Y',
2540
+ '\u1E8E': 'Y',
2541
+ '\u0178': 'Y',
2542
+ '\u1EF6': 'Y',
2543
+ '\u1EF4': 'Y',
2544
+ '\u01B3': 'Y',
2545
+ '\u024E': 'Y',
2546
+ '\u1EFE': 'Y',
2547
+ '\u24CF': 'Z',
2548
+ '\uFF3A': 'Z',
2549
+ '\u0179': 'Z',
2550
+ '\u1E90': 'Z',
2551
+ '\u017B': 'Z',
2552
+ '\u017D': 'Z',
2553
+ '\u1E92': 'Z',
2554
+ '\u1E94': 'Z',
2555
+ '\u01B5': 'Z',
2556
+ '\u0224': 'Z',
2557
+ '\u2C7F': 'Z',
2558
+ '\u2C6B': 'Z',
2559
+ '\uA762': 'Z',
2560
+ '\u24D0': 'a',
2561
+ '\uFF41': 'a',
2562
+ '\u1E9A': 'a',
2563
+ '\u00E0': 'a',
2564
+ '\u00E1': 'a',
2565
+ '\u00E2': 'a',
2566
+ '\u1EA7': 'a',
2567
+ '\u1EA5': 'a',
2568
+ '\u1EAB': 'a',
2569
+ '\u1EA9': 'a',
2570
+ '\u00E3': 'a',
2571
+ '\u0101': 'a',
2572
+ '\u0103': 'a',
2573
+ '\u1EB1': 'a',
2574
+ '\u1EAF': 'a',
2575
+ '\u1EB5': 'a',
2576
+ '\u1EB3': 'a',
2577
+ '\u0227': 'a',
2578
+ '\u01E1': 'a',
2579
+ '\u00E4': 'a',
2580
+ '\u01DF': 'a',
2581
+ '\u1EA3': 'a',
2582
+ '\u00E5': 'a',
2583
+ '\u01FB': 'a',
2584
+ '\u01CE': 'a',
2585
+ '\u0201': 'a',
2586
+ '\u0203': 'a',
2587
+ '\u1EA1': 'a',
2588
+ '\u1EAD': 'a',
2589
+ '\u1EB7': 'a',
2590
+ '\u1E01': 'a',
2591
+ '\u0105': 'a',
2592
+ '\u2C65': 'a',
2593
+ '\u0250': 'a',
2594
+ '\uA733': 'aa',
2595
+ '\u00E6': 'ae',
2596
+ '\u01FD': 'ae',
2597
+ '\u01E3': 'ae',
2598
+ '\uA735': 'ao',
2599
+ '\uA737': 'au',
2600
+ '\uA739': 'av',
2601
+ '\uA73B': 'av',
2602
+ '\uA73D': 'ay',
2603
+ '\u24D1': 'b',
2604
+ '\uFF42': 'b',
2605
+ '\u1E03': 'b',
2606
+ '\u1E05': 'b',
2607
+ '\u1E07': 'b',
2608
+ '\u0180': 'b',
2609
+ '\u0183': 'b',
2610
+ '\u0253': 'b',
2611
+ '\u24D2': 'c',
2612
+ '\uFF43': 'c',
2613
+ '\u0107': 'c',
2614
+ '\u0109': 'c',
2615
+ '\u010B': 'c',
2616
+ '\u010D': 'c',
2617
+ '\u00E7': 'c',
2618
+ '\u1E09': 'c',
2619
+ '\u0188': 'c',
2620
+ '\u023C': 'c',
2621
+ '\uA73F': 'c',
2622
+ '\u2184': 'c',
2623
+ '\u24D3': 'd',
2624
+ '\uFF44': 'd',
2625
+ '\u1E0B': 'd',
2626
+ '\u010F': 'd',
2627
+ '\u1E0D': 'd',
2628
+ '\u1E11': 'd',
2629
+ '\u1E13': 'd',
2630
+ '\u1E0F': 'd',
2631
+ '\u0111': 'd',
2632
+ '\u018C': 'd',
2633
+ '\u0256': 'd',
2634
+ '\u0257': 'd',
2635
+ '\uA77A': 'd',
2636
+ '\u01F3': 'dz',
2637
+ '\u01C6': 'dz',
2638
+ '\u24D4': 'e',
2639
+ '\uFF45': 'e',
2640
+ '\u00E8': 'e',
2641
+ '\u00E9': 'e',
2642
+ '\u00EA': 'e',
2643
+ '\u1EC1': 'e',
2644
+ '\u1EBF': 'e',
2645
+ '\u1EC5': 'e',
2646
+ '\u1EC3': 'e',
2647
+ '\u1EBD': 'e',
2648
+ '\u0113': 'e',
2649
+ '\u1E15': 'e',
2650
+ '\u1E17': 'e',
2651
+ '\u0115': 'e',
2652
+ '\u0117': 'e',
2653
+ '\u00EB': 'e',
2654
+ '\u1EBB': 'e',
2655
+ '\u011B': 'e',
2656
+ '\u0205': 'e',
2657
+ '\u0207': 'e',
2658
+ '\u1EB9': 'e',
2659
+ '\u1EC7': 'e',
2660
+ '\u0229': 'e',
2661
+ '\u1E1D': 'e',
2662
+ '\u0119': 'e',
2663
+ '\u1E19': 'e',
2664
+ '\u1E1B': 'e',
2665
+ '\u0247': 'e',
2666
+ '\u025B': 'e',
2667
+ '\u01DD': 'e',
2668
+ '\u24D5': 'f',
2669
+ '\uFF46': 'f',
2670
+ '\u1E1F': 'f',
2671
+ '\u0192': 'f',
2672
+ '\uA77C': 'f',
2673
+ '\u24D6': 'g',
2674
+ '\uFF47': 'g',
2675
+ '\u01F5': 'g',
2676
+ '\u011D': 'g',
2677
+ '\u1E21': 'g',
2678
+ '\u011F': 'g',
2679
+ '\u0121': 'g',
2680
+ '\u01E7': 'g',
2681
+ '\u0123': 'g',
2682
+ '\u01E5': 'g',
2683
+ '\u0260': 'g',
2684
+ '\uA7A1': 'g',
2685
+ '\u1D79': 'g',
2686
+ '\uA77F': 'g',
2687
+ '\u24D7': 'h',
2688
+ '\uFF48': 'h',
2689
+ '\u0125': 'h',
2690
+ '\u1E23': 'h',
2691
+ '\u1E27': 'h',
2692
+ '\u021F': 'h',
2693
+ '\u1E25': 'h',
2694
+ '\u1E29': 'h',
2695
+ '\u1E2B': 'h',
2696
+ '\u1E96': 'h',
2697
+ '\u0127': 'h',
2698
+ '\u2C68': 'h',
2699
+ '\u2C76': 'h',
2700
+ '\u0265': 'h',
2701
+ '\u0195': 'hv',
2702
+ '\u24D8': 'i',
2703
+ '\uFF49': 'i',
2704
+ '\u00EC': 'i',
2705
+ '\u00ED': 'i',
2706
+ '\u00EE': 'i',
2707
+ '\u0129': 'i',
2708
+ '\u012B': 'i',
2709
+ '\u012D': 'i',
2710
+ '\u00EF': 'i',
2711
+ '\u1E2F': 'i',
2712
+ '\u1EC9': 'i',
2713
+ '\u01D0': 'i',
2714
+ '\u0209': 'i',
2715
+ '\u020B': 'i',
2716
+ '\u1ECB': 'i',
2717
+ '\u012F': 'i',
2718
+ '\u1E2D': 'i',
2719
+ '\u0268': 'i',
2720
+ '\u0131': 'i',
2721
+ '\u24D9': 'j',
2722
+ '\uFF4A': 'j',
2723
+ '\u0135': 'j',
2724
+ '\u01F0': 'j',
2725
+ '\u0249': 'j',
2726
+ '\u24DA': 'k',
2727
+ '\uFF4B': 'k',
2728
+ '\u1E31': 'k',
2729
+ '\u01E9': 'k',
2730
+ '\u1E33': 'k',
2731
+ '\u0137': 'k',
2732
+ '\u1E35': 'k',
2733
+ '\u0199': 'k',
2734
+ '\u2C6A': 'k',
2735
+ '\uA741': 'k',
2736
+ '\uA743': 'k',
2737
+ '\uA745': 'k',
2738
+ '\uA7A3': 'k',
2739
+ '\u24DB': 'l',
2740
+ '\uFF4C': 'l',
2741
+ '\u0140': 'l',
2742
+ '\u013A': 'l',
2743
+ '\u013E': 'l',
2744
+ '\u1E37': 'l',
2745
+ '\u1E39': 'l',
2746
+ '\u013C': 'l',
2747
+ '\u1E3D': 'l',
2748
+ '\u1E3B': 'l',
2749
+ '\u017F': 'l',
2750
+ '\u0142': 'l',
2751
+ '\u019A': 'l',
2752
+ '\u026B': 'l',
2753
+ '\u2C61': 'l',
2754
+ '\uA749': 'l',
2755
+ '\uA781': 'l',
2756
+ '\uA747': 'l',
2757
+ '\u01C9': 'lj',
2758
+ '\u24DC': 'm',
2759
+ '\uFF4D': 'm',
2760
+ '\u1E3F': 'm',
2761
+ '\u1E41': 'm',
2762
+ '\u1E43': 'm',
2763
+ '\u0271': 'm',
2764
+ '\u026F': 'm',
2765
+ '\u24DD': 'n',
2766
+ '\uFF4E': 'n',
2767
+ '\u01F9': 'n',
2768
+ '\u0144': 'n',
2769
+ '\u00F1': 'n',
2770
+ '\u1E45': 'n',
2771
+ '\u0148': 'n',
2772
+ '\u1E47': 'n',
2773
+ '\u0146': 'n',
2774
+ '\u1E4B': 'n',
2775
+ '\u1E49': 'n',
2776
+ '\u019E': 'n',
2777
+ '\u0272': 'n',
2778
+ '\u0149': 'n',
2779
+ '\uA791': 'n',
2780
+ '\uA7A5': 'n',
2781
+ '\u01CC': 'nj',
2782
+ '\u24DE': 'o',
2783
+ '\uFF4F': 'o',
2784
+ '\u00F2': 'o',
2785
+ '\u00F3': 'o',
2786
+ '\u00F4': 'o',
2787
+ '\u1ED3': 'o',
2788
+ '\u1ED1': 'o',
2789
+ '\u1ED7': 'o',
2790
+ '\u1ED5': 'o',
2791
+ '\u00F5': 'o',
2792
+ '\u1E4D': 'o',
2793
+ '\u022D': 'o',
2794
+ '\u1E4F': 'o',
2795
+ '\u014D': 'o',
2796
+ '\u1E51': 'o',
2797
+ '\u1E53': 'o',
2798
+ '\u014F': 'o',
2799
+ '\u022F': 'o',
2800
+ '\u0231': 'o',
2801
+ '\u00F6': 'o',
2802
+ '\u022B': 'o',
2803
+ '\u1ECF': 'o',
2804
+ '\u0151': 'o',
2805
+ '\u01D2': 'o',
2806
+ '\u020D': 'o',
2807
+ '\u020F': 'o',
2808
+ '\u01A1': 'o',
2809
+ '\u1EDD': 'o',
2810
+ '\u1EDB': 'o',
2811
+ '\u1EE1': 'o',
2812
+ '\u1EDF': 'o',
2813
+ '\u1EE3': 'o',
2814
+ '\u1ECD': 'o',
2815
+ '\u1ED9': 'o',
2816
+ '\u01EB': 'o',
2817
+ '\u01ED': 'o',
2818
+ '\u00F8': 'o',
2819
+ '\u01FF': 'o',
2820
+ '\u0254': 'o',
2821
+ '\uA74B': 'o',
2822
+ '\uA74D': 'o',
2823
+ '\u0275': 'o',
2824
+ '\u01A3': 'oi',
2825
+ '\u0223': 'ou',
2826
+ '\uA74F': 'oo',
2827
+ '\u24DF': 'p',
2828
+ '\uFF50': 'p',
2829
+ '\u1E55': 'p',
2830
+ '\u1E57': 'p',
2831
+ '\u01A5': 'p',
2832
+ '\u1D7D': 'p',
2833
+ '\uA751': 'p',
2834
+ '\uA753': 'p',
2835
+ '\uA755': 'p',
2836
+ '\u24E0': 'q',
2837
+ '\uFF51': 'q',
2838
+ '\u024B': 'q',
2839
+ '\uA757': 'q',
2840
+ '\uA759': 'q',
2841
+ '\u24E1': 'r',
2842
+ '\uFF52': 'r',
2843
+ '\u0155': 'r',
2844
+ '\u1E59': 'r',
2845
+ '\u0159': 'r',
2846
+ '\u0211': 'r',
2847
+ '\u0213': 'r',
2848
+ '\u1E5B': 'r',
2849
+ '\u1E5D': 'r',
2850
+ '\u0157': 'r',
2851
+ '\u1E5F': 'r',
2852
+ '\u024D': 'r',
2853
+ '\u027D': 'r',
2854
+ '\uA75B': 'r',
2855
+ '\uA7A7': 'r',
2856
+ '\uA783': 'r',
2857
+ '\u24E2': 's',
2858
+ '\uFF53': 's',
2859
+ '\u00DF': 's',
2860
+ '\u015B': 's',
2861
+ '\u1E65': 's',
2862
+ '\u015D': 's',
2863
+ '\u1E61': 's',
2864
+ '\u0161': 's',
2865
+ '\u1E67': 's',
2866
+ '\u1E63': 's',
2867
+ '\u1E69': 's',
2868
+ '\u0219': 's',
2869
+ '\u015F': 's',
2870
+ '\u023F': 's',
2871
+ '\uA7A9': 's',
2872
+ '\uA785': 's',
2873
+ '\u1E9B': 's',
2874
+ '\u24E3': 't',
2875
+ '\uFF54': 't',
2876
+ '\u1E6B': 't',
2877
+ '\u1E97': 't',
2878
+ '\u0165': 't',
2879
+ '\u1E6D': 't',
2880
+ '\u021B': 't',
2881
+ '\u0163': 't',
2882
+ '\u1E71': 't',
2883
+ '\u1E6F': 't',
2884
+ '\u0167': 't',
2885
+ '\u01AD': 't',
2886
+ '\u0288': 't',
2887
+ '\u2C66': 't',
2888
+ '\uA787': 't',
2889
+ '\uA729': 'tz',
2890
+ '\u24E4': 'u',
2891
+ '\uFF55': 'u',
2892
+ '\u00F9': 'u',
2893
+ '\u00FA': 'u',
2894
+ '\u00FB': 'u',
2895
+ '\u0169': 'u',
2896
+ '\u1E79': 'u',
2897
+ '\u016B': 'u',
2898
+ '\u1E7B': 'u',
2899
+ '\u016D': 'u',
2900
+ '\u00FC': 'u',
2901
+ '\u01DC': 'u',
2902
+ '\u01D8': 'u',
2903
+ '\u01D6': 'u',
2904
+ '\u01DA': 'u',
2905
+ '\u1EE7': 'u',
2906
+ '\u016F': 'u',
2907
+ '\u0171': 'u',
2908
+ '\u01D4': 'u',
2909
+ '\u0215': 'u',
2910
+ '\u0217': 'u',
2911
+ '\u01B0': 'u',
2912
+ '\u1EEB': 'u',
2913
+ '\u1EE9': 'u',
2914
+ '\u1EEF': 'u',
2915
+ '\u1EED': 'u',
2916
+ '\u1EF1': 'u',
2917
+ '\u1EE5': 'u',
2918
+ '\u1E73': 'u',
2919
+ '\u0173': 'u',
2920
+ '\u1E77': 'u',
2921
+ '\u1E75': 'u',
2922
+ '\u0289': 'u',
2923
+ '\u24E5': 'v',
2924
+ '\uFF56': 'v',
2925
+ '\u1E7D': 'v',
2926
+ '\u1E7F': 'v',
2927
+ '\u028B': 'v',
2928
+ '\uA75F': 'v',
2929
+ '\u028C': 'v',
2930
+ '\uA761': 'vy',
2931
+ '\u24E6': 'w',
2932
+ '\uFF57': 'w',
2933
+ '\u1E81': 'w',
2934
+ '\u1E83': 'w',
2935
+ '\u0175': 'w',
2936
+ '\u1E87': 'w',
2937
+ '\u1E85': 'w',
2938
+ '\u1E98': 'w',
2939
+ '\u1E89': 'w',
2940
+ '\u2C73': 'w',
2941
+ '\u24E7': 'x',
2942
+ '\uFF58': 'x',
2943
+ '\u1E8B': 'x',
2944
+ '\u1E8D': 'x',
2945
+ '\u24E8': 'y',
2946
+ '\uFF59': 'y',
2947
+ '\u1EF3': 'y',
2948
+ '\u00FD': 'y',
2949
+ '\u0177': 'y',
2950
+ '\u1EF9': 'y',
2951
+ '\u0233': 'y',
2952
+ '\u1E8F': 'y',
2953
+ '\u00FF': 'y',
2954
+ '\u1EF7': 'y',
2955
+ '\u1E99': 'y',
2956
+ '\u1EF5': 'y',
2957
+ '\u01B4': 'y',
2958
+ '\u024F': 'y',
2959
+ '\u1EFF': 'y',
2960
+ '\u24E9': 'z',
2961
+ '\uFF5A': 'z',
2962
+ '\u017A': 'z',
2963
+ '\u1E91': 'z',
2964
+ '\u017C': 'z',
2965
+ '\u017E': 'z',
2966
+ '\u1E93': 'z',
2967
+ '\u1E95': 'z',
2968
+ '\u01B6': 'z',
2969
+ '\u0225': 'z',
2970
+ '\u0240': 'z',
2971
+ '\u2C6C': 'z',
2972
+ '\uA763': 'z',
2973
+ '\u0386': '\u0391',
2974
+ '\u0388': '\u0395',
2975
+ '\u0389': '\u0397',
2976
+ '\u038A': '\u0399',
2977
+ '\u03AA': '\u0399',
2978
+ '\u038C': '\u039F',
2979
+ '\u038E': '\u03A5',
2980
+ '\u03AB': '\u03A5',
2981
+ '\u038F': '\u03A9',
2982
+ '\u03AC': '\u03B1',
2983
+ '\u03AD': '\u03B5',
2984
+ '\u03AE': '\u03B7',
2985
+ '\u03AF': '\u03B9',
2986
+ '\u03CA': '\u03B9',
2987
+ '\u0390': '\u03B9',
2988
+ '\u03CC': '\u03BF',
2989
+ '\u03CD': '\u03C5',
2990
+ '\u03CB': '\u03C5',
2991
+ '\u03B0': '\u03C5',
2992
+ '\u03C9': '\u03C9',
2993
+ '\u03C2': '\u03C3'
2994
+ };
2995
 
2996
+ return diacritics;
2997
+ });
 
 
 
2998
 
2999
+ S2.define('select2/data/base',[
3000
+ '../utils'
3001
+ ], function (Utils) {
3002
+ function BaseAdapter ($element, options) {
3003
+ BaseAdapter.__super__.constructor.call(this);
3004
+ }
3005
 
3006
+ Utils.Extend(BaseAdapter, Utils.Observable);
 
3007
 
3008
+ BaseAdapter.prototype.current = function (callback) {
3009
+ throw new Error('The `current` method must be defined in child classes.');
3010
+ };
3011
 
3012
+ BaseAdapter.prototype.query = function (params, callback) {
3013
+ throw new Error('The `query` method must be defined in child classes.');
3014
+ };
3015
 
3016
+ BaseAdapter.prototype.bind = function (container, $container) {
3017
+ // Can be implemented in subclasses
3018
+ };
3019
 
3020
+ BaseAdapter.prototype.destroy = function () {
3021
+ // Can be implemented in subclasses
3022
+ };
3023
 
3024
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3025
+ var id = container.id + '-result-';
3026
 
3027
+ id += Utils.generateChars(4);
 
3028
 
3029
+ if (data.id != null) {
3030
+ id += '-' + data.id.toString();
3031
+ } else {
3032
+ id += '-' + Utils.generateChars(4);
3033
+ }
3034
+ return id;
3035
+ };
3036
 
3037
+ return BaseAdapter;
3038
+ });
 
 
3039
 
3040
+ S2.define('select2/data/select',[
3041
+ './base',
3042
+ '../utils',
3043
+ 'jquery'
3044
+ ], function (BaseAdapter, Utils, $) {
3045
+ function SelectAdapter ($element, options) {
3046
+ this.$element = $element;
3047
+ this.options = options;
3048
 
3049
+ SelectAdapter.__super__.constructor.call(this);
3050
+ }
 
3051
 
3052
+ Utils.Extend(SelectAdapter, BaseAdapter);
 
3053
 
3054
+ SelectAdapter.prototype.current = function (callback) {
3055
+ var data = [];
3056
+ var self = this;
3057
 
3058
+ this.$element.find(':selected').each(function () {
3059
+ var $option = $(this);
 
3060
 
3061
+ var option = self.item($option);
 
 
 
3062
 
3063
+ data.push(option);
3064
+ });
 
 
 
 
 
3065
 
3066
+ callback(data);
3067
+ };
 
3068
 
3069
+ SelectAdapter.prototype.select = function (data) {
3070
+ var self = this;
3071
 
3072
+ data.selected = true;
 
3073
 
3074
+ // If data.element is a DOM node, use it instead
3075
+ if ($(data.element).is('option')) {
3076
+ data.element.selected = true;
3077
 
3078
+ this.$element.trigger('change');
3079
 
3080
+ return;
3081
+ }
3082
 
3083
+ if (this.$element.prop('multiple')) {
3084
+ this.current(function (currentData) {
3085
+ var val = [];
 
3086
 
3087
+ data = [data];
3088
+ data.push.apply(data, currentData);
 
 
3089
 
3090
+ for (var d = 0; d < data.length; d++) {
3091
+ var id = data[d].id;
 
3092
 
3093
+ if ($.inArray(id, val) === -1) {
3094
+ val.push(id);
3095
+ }
3096
+ }
3097
 
3098
+ self.$element.val(val);
3099
+ self.$element.trigger('change');
3100
+ });
3101
+ } else {
3102
+ var val = data.id;
3103
 
3104
+ this.$element.val(val);
3105
+ this.$element.trigger('change');
3106
+ }
3107
+ };
 
 
3108
 
3109
+ SelectAdapter.prototype.unselect = function (data) {
3110
+ var self = this;
 
3111
 
3112
+ if (!this.$element.prop('multiple')) {
3113
+ return;
3114
+ }
3115
 
3116
+ data.selected = false;
 
 
3117
 
3118
+ if ($(data.element).is('option')) {
3119
+ data.element.selected = false;
 
3120
 
3121
+ this.$element.trigger('change');
3122
 
3123
+ return;
3124
+ }
3125
 
3126
+ this.current(function (currentData) {
3127
+ var val = [];
3128
 
3129
+ for (var d = 0; d < currentData.length; d++) {
3130
+ var id = currentData[d].id;
3131
 
3132
+ if (id !== data.id && $.inArray(id, val) === -1) {
3133
+ val.push(id);
3134
+ }
3135
+ }
3136
 
3137
+ self.$element.val(val);
3138
 
3139
+ self.$element.trigger('change');
3140
+ });
3141
+ };
3142
 
3143
+ SelectAdapter.prototype.bind = function (container, $container) {
3144
+ var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3145
 
3146
+ this.container = container;
 
3147
 
3148
+ container.on('select', function (params) {
3149
+ self.select(params.data);
3150
+ });
3151
 
3152
+ container.on('unselect', function (params) {
3153
+ self.unselect(params.data);
3154
+ });
3155
+ };
3156
 
3157
+ SelectAdapter.prototype.destroy = function () {
3158
+ // Remove anything added to child elements
3159
+ this.$element.find('*').each(function () {
3160
+ // Remove any custom data set by Select2
3161
+ $.removeData(this, 'data');
3162
+ });
3163
+ };
3164
 
3165
+ SelectAdapter.prototype.query = function (params, callback) {
3166
+ var data = [];
3167
+ var self = this;
3168
 
3169
+ var $options = this.$element.children();
 
 
 
3170
 
3171
+ $options.each(function () {
3172
+ var $option = $(this);
 
3173
 
3174
+ if (!$option.is('option') && !$option.is('optgroup')) {
3175
+ return;
3176
+ }
3177
 
3178
+ var option = self.item($option);
 
 
3179
 
3180
+ var matches = self.matches(params, option);
 
3181
 
3182
+ if (matches !== null) {
3183
+ data.push(matches);
3184
+ }
3185
+ });
3186
 
3187
+ callback({
3188
+ results: data
3189
+ });
3190
+ };
3191
 
3192
+ SelectAdapter.prototype.addOptions = function ($options) {
3193
+ Utils.appendMany(this.$element, $options);
3194
+ };
3195
 
3196
+ SelectAdapter.prototype.option = function (data) {
3197
+ var option;
 
 
 
 
 
3198
 
3199
+ if (data.children) {
3200
+ option = document.createElement('optgroup');
3201
+ option.label = data.text;
3202
+ } else {
3203
+ option = document.createElement('option');
3204
 
3205
+ if (option.textContent !== undefined) {
3206
+ option.textContent = data.text;
3207
+ } else {
3208
+ option.innerText = data.text;
3209
+ }
3210
+ }
3211
 
3212
+ if (data.id !== undefined) {
3213
+ option.value = data.id;
3214
+ }
3215
 
3216
+ if (data.disabled) {
3217
+ option.disabled = true;
3218
+ }
 
3219
 
3220
+ if (data.selected) {
3221
+ option.selected = true;
3222
+ }
3223
 
3224
+ if (data.title) {
3225
+ option.title = data.title;
3226
+ }
3227
 
3228
+ var $option = $(option);
 
3229
 
3230
+ var normalizedData = this._normalizeItem(data);
3231
+ normalizedData.element = option;
3232
 
3233
+ // Override the option's data with the combined data
3234
+ $.data(option, 'data', normalizedData);
 
 
3235
 
3236
+ return $option;
3237
+ };
3238
 
3239
+ SelectAdapter.prototype.item = function ($option) {
3240
+ var data = {};
 
 
 
 
3241
 
3242
+ data = $.data($option[0], 'data');
 
3243
 
3244
+ if (data != null) {
3245
+ return data;
3246
+ }
3247
 
3248
+ if ($option.is('option')) {
3249
+ data = {
3250
+ id: $option.val(),
3251
+ text: $option.text(),
3252
+ disabled: $option.prop('disabled'),
3253
+ selected: $option.prop('selected'),
3254
+ title: $option.prop('title')
3255
+ };
3256
+ } else if ($option.is('optgroup')) {
3257
+ data = {
3258
+ text: $option.prop('label'),
3259
+ children: [],
3260
+ title: $option.prop('title')
3261
+ };
3262
+
3263
+ var $children = $option.children('option');
3264
+ var children = [];
3265
+
3266
+ for (var c = 0; c < $children.length; c++) {
3267
+ var $child = $($children[c]);
3268
+
3269
+ var child = this.item($child);
3270
+
3271
+ children.push(child);
3272
+ }
3273
 
3274
+ data.children = children;
3275
+ }
3276
 
3277
+ data = this._normalizeItem(data);
3278
+ data.element = $option[0];
3279
 
3280
+ $.data($option[0], 'data', data);
 
3281
 
3282
+ return data;
3283
+ };
3284
 
3285
+ SelectAdapter.prototype._normalizeItem = function (item) {
3286
+ if (!$.isPlainObject(item)) {
3287
+ item = {
3288
+ id: item,
3289
+ text: item
3290
+ };
3291
+ }
3292
 
3293
+ item = $.extend({}, {
3294
+ text: ''
3295
+ }, item);
3296
 
3297
+ var defaults = {
3298
+ selected: false,
3299
+ disabled: false
3300
+ };
3301
 
3302
+ if (item.id != null) {
3303
+ item.id = item.id.toString();
3304
+ }
3305
 
3306
+ if (item.text != null) {
3307
+ item.text = item.text.toString();
3308
+ }
3309
 
3310
+ if (item._resultId == null && item.id && this.container != null) {
3311
+ item._resultId = this.generateResultId(this.container, item);
3312
+ }
 
 
 
 
3313
 
3314
+ return $.extend({}, defaults, item);
3315
+ };
 
3316
 
3317
+ SelectAdapter.prototype.matches = function (params, data) {
3318
+ var matcher = this.options.get('matcher');
3319
 
3320
+ return matcher(params, data);
3321
+ };
3322
 
3323
+ return SelectAdapter;
 
 
 
 
3324
  });
 
 
 
3325
 
3326
+ S2.define('select2/data/array',[
3327
+ './select',
3328
+ '../utils',
3329
+ 'jquery'
3330
+ ], function (SelectAdapter, Utils, $) {
3331
+ function ArrayAdapter ($element, options) {
3332
+ var data = options.get('data') || [];
3333
 
3334
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
 
 
3335
 
3336
+ this.addOptions(this.convertToOptions(data));
3337
+ }
3338
 
3339
+ Utils.Extend(ArrayAdapter, SelectAdapter);
 
 
3340
 
3341
+ ArrayAdapter.prototype.select = function (data) {
3342
+ var $option = this.$element.find('option').filter(function (i, elm) {
3343
+ return elm.value == data.id.toString();
3344
+ });
3345
 
3346
+ if ($option.length === 0) {
3347
+ $option = this.option(data);
 
 
 
3348
 
3349
+ this.addOptions($option);
3350
+ }
3351
 
3352
+ ArrayAdapter.__super__.select.call(this, data);
3353
+ };
 
3354
 
3355
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3356
+ var self = this;
 
3357
 
3358
+ var $existing = this.$element.find('option');
3359
+ var existingIds = $existing.map(function () {
3360
+ return self.item($(this)).id;
3361
+ }).get();
3362
 
3363
+ var $options = [];
 
 
 
 
 
 
 
 
 
 
 
 
3364
 
3365
+ // Filter out all items except for the one passed in the argument
3366
+ function onlyItem (item) {
3367
+ return function () {
3368
+ return $(this).val() == item.id;
3369
+ };
3370
+ }
 
3371
 
3372
+ for (var d = 0; d < data.length; d++) {
3373
+ var item = this._normalizeItem(data[d]);
 
 
3374
 
3375
+ // Skip items which were pre-loaded, only merge the data
3376
+ if ($.inArray(item.id, existingIds) >= 0) {
3377
+ var $existingOption = $existing.filter(onlyItem(item));
3378
 
3379
+ var existingData = this.item($existingOption);
3380
+ var newData = $.extend(true, {}, item, existingData);
 
 
3381
 
3382
+ var $newOption = this.option(newData);
 
 
 
 
3383
 
3384
+ $existingOption.replaceWith($newOption);
 
3385
 
3386
+ continue;
3387
+ }
 
 
 
3388
 
3389
+ var $option = this.option(item);
3390
 
3391
+ if (item.children) {
3392
+ var $children = this.convertToOptions(item.children);
 
3393
 
3394
+ Utils.appendMany($option, $children);
3395
+ }
3396
 
3397
+ $options.push($option);
3398
+ }
 
3399
 
3400
+ return $options;
3401
+ };
3402
 
3403
+ return ArrayAdapter;
3404
+ });
 
 
3405
 
3406
+ S2.define('select2/data/ajax',[
3407
+ './array',
3408
+ '../utils',
3409
+ 'jquery'
3410
+ ], function (ArrayAdapter, Utils, $) {
3411
+ function AjaxAdapter ($element, options) {
3412
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3413
 
3414
+ if (this.ajaxOptions.processResults != null) {
3415
+ this.processResults = this.ajaxOptions.processResults;
3416
+ }
 
3417
 
3418
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3419
+ }
3420
 
3421
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3422
 
3423
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3424
+ var defaults = {
3425
+ data: function (params) {
3426
+ return $.extend({}, params, {
3427
+ q: params.term
3428
+ });
3429
+ },
3430
+ transport: function (params, success, failure) {
3431
+ var $request = $.ajax(params);
3432
 
3433
+ $request.then(success);
3434
+ $request.fail(failure);
3435
 
3436
+ return $request;
3437
+ }
3438
+ };
3439
 
3440
+ return $.extend({}, defaults, options, true);
3441
+ };
 
 
 
 
3442
 
3443
+ AjaxAdapter.prototype.processResults = function (results) {
3444
+ return results;
3445
+ };
3446
 
3447
+ AjaxAdapter.prototype.query = function (params, callback) {
3448
+ var matches = [];
3449
+ var self = this;
 
3450
 
3451
+ if (this._request != null) {
3452
+ // JSONP requests cannot always be aborted
3453
+ if ($.isFunction(this._request.abort)) {
3454
+ this._request.abort();
3455
+ }
3456
 
3457
+ this._request = null;
3458
+ }
 
3459
 
3460
+ var options = $.extend({
3461
+ type: 'GET'
3462
+ }, this.ajaxOptions);
3463
 
3464
+ if (typeof options.url === 'function') {
3465
+ options.url = options.url.call(this.$element, params);
3466
+ }
3467
 
3468
+ if (typeof options.data === 'function') {
3469
+ options.data = options.data.call(this.$element, params);
3470
+ }
3471
 
3472
+ function request () {
3473
+ var $request = options.transport(options, function (data) {
3474
+ var results = self.processResults(data, params);
3475
+
3476
+ if (self.options.get('debug') && window.console && console.error) {
3477
+ // Check to make sure that the response included a `results` key.
3478
+ if (!results || !results.results || !$.isArray(results.results)) {
3479
+ console.error(
3480
+ 'Select2: The AJAX results did not return an array in the ' +
3481
+ '`results` key of the response.'
3482
+ );
3483
+ }
3484
+ }
3485
 
3486
+ callback(results);
3487
+ }, function () {
3488
+ // Attempt to detect if a request was aborted
3489
+ // Only works if the transport exposes a status property
3490
+ if ($request.status && $request.status === '0') {
3491
+ return;
3492
+ }
3493
 
3494
+ self.trigger('results:message', {
3495
+ message: 'errorLoading'
3496
+ });
3497
+ });
3498
 
3499
+ self._request = $request;
3500
+ }
3501
 
3502
+ if (this.ajaxOptions.delay && params.term != null) {
3503
+ if (this._queryTimeout) {
3504
+ window.clearTimeout(this._queryTimeout);
3505
+ }
3506
 
3507
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3508
+ } else {
3509
+ request();
3510
+ }
3511
+ };
3512
 
3513
+ return AjaxAdapter;
3514
+ });
 
3515
 
3516
+ S2.define('select2/data/tags',[
3517
+ 'jquery'
3518
+ ], function ($) {
3519
+ function Tags (decorated, $element, options) {
3520
+ var tags = options.get('tags');
3521
 
3522
+ var createTag = options.get('createTag');
 
 
3523
 
3524
+ if (createTag !== undefined) {
3525
+ this.createTag = createTag;
3526
+ }
3527
 
3528
+ var insertTag = options.get('insertTag');
3529
 
3530
+ if (insertTag !== undefined) {
3531
+ this.insertTag = insertTag;
3532
+ }
 
3533
 
3534
+ decorated.call(this, $element, options);
 
 
3535
 
3536
+ if ($.isArray(tags)) {
3537
+ for (var t = 0; t < tags.length; t++) {
3538
+ var tag = tags[t];
3539
+ var item = this._normalizeItem(tag);
3540
 
3541
+ var $option = this.option(item);
 
 
 
 
3542
 
3543
+ this.$element.append($option);
3544
+ }
3545
+ }
3546
+ }
3547
 
3548
+ Tags.prototype.query = function (decorated, params, callback) {
3549
+ var self = this;
3550
 
3551
+ this._removeOldTags();
 
3552
 
3553
+ if (params.term == null || params.page != null) {
3554
+ decorated.call(this, params, callback);
3555
+ return;
3556
+ }
3557
 
3558
+ function wrapper (obj, child) {
3559
+ var data = obj.results;
3560
 
3561
+ for (var i = 0; i < data.length; i++) {
3562
+ var option = data[i];
 
3563
 
3564
+ var checkChildren = (
3565
+ option.children != null &&
3566
+ !wrapper({
3567
+ results: option.children
3568
+ }, true)
3569
+ );
3570
 
3571
+ var optionText = (option.text || '').toUpperCase();
3572
+ var paramsTerm = (params.term || '').toUpperCase();
 
 
3573
 
3574
+ var checkText = optionText === paramsTerm;
 
 
3575
 
3576
+ if (checkText || checkChildren) {
3577
+ if (child) {
3578
+ return false;
3579
+ }
3580
 
3581
+ obj.data = data;
3582
+ callback(obj);
 
 
 
3583
 
3584
+ return;
3585
+ }
3586
+ }
3587
 
3588
+ if (child) {
3589
+ return true;
3590
+ }
3591
 
3592
+ var tag = self.createTag(params);
 
 
 
 
 
3593
 
3594
+ if (tag != null) {
3595
+ var $option = self.option(tag);
3596
+ $option.attr('data-select2-tag', true);
3597
 
3598
+ self.addOptions([$option]);
 
3599
 
3600
+ self.insertTag(data, tag);
3601
+ }
 
 
3602
 
3603
+ obj.results = data;
 
 
 
 
 
3604
 
3605
+ callback(obj);
3606
+ }
3607
 
3608
+ decorated.call(this, params, wrapper);
3609
+ };
3610
 
3611
+ Tags.prototype.createTag = function (decorated, params) {
3612
+ var term = $.trim(params.term);
3613
 
3614
+ if (term === '') {
3615
+ return null;
3616
+ }
 
3617
 
3618
+ return {
3619
+ id: term,
3620
+ text: term
3621
+ };
3622
+ };
3623
 
3624
+ Tags.prototype.insertTag = function (_, data, tag) {
3625
+ data.unshift(tag);
3626
+ };
 
3627
 
3628
+ Tags.prototype._removeOldTags = function (_) {
3629
+ var tag = this._lastTag;
3630
 
3631
+ var $options = this.$element.find('option[data-select2-tag]');
 
 
 
3632
 
3633
+ $options.each(function () {
3634
+ if (this.selected) {
3635
+ return;
3636
+ }
3637
 
3638
+ $(this).remove();
3639
+ });
3640
+ };
3641
 
3642
+ return Tags;
3643
+ });
3644
 
3645
+ S2.define('select2/data/tokenizer',[
3646
+ 'jquery'
3647
+ ], function ($) {
3648
+ function Tokenizer (decorated, $element, options) {
3649
+ var tokenizer = options.get('tokenizer');
3650
 
3651
+ if (tokenizer !== undefined) {
3652
+ this.tokenizer = tokenizer;
3653
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3654
 
3655
+ decorated.call(this, $element, options);
3656
+ }
3657
 
3658
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3659
+ decorated.call(this, container, $container);
 
3660
 
3661
+ this.$search = container.dropdown.$search || container.selection.$search ||
3662
+ $container.find('.select2-search__field');
3663
+ };
3664
 
3665
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3666
+ var self = this;
3667
 
3668
+ function createAndSelect (data) {
3669
+ // Normalize the data object so we can use it for checks
3670
+ var item = self._normalizeItem(data);
 
 
 
 
 
 
 
3671
 
3672
+ // Check if the data object already exists as a tag
3673
+ // Select it if it doesn't
3674
+ var $existingOptions = self.$element.find('option').filter(function () {
3675
+ return $(this).val() === item.id;
3676
+ });
3677
 
3678
+ // If an existing option wasn't found for it, create the option
3679
+ if (!$existingOptions.length) {
3680
+ var $option = self.option(item);
3681
+ $option.attr('data-select2-tag', true);
3682
 
3683
+ self._removeOldTags();
3684
+ self.addOptions([$option]);
3685
+ }
3686
 
3687
+ // Select the item, now that we know there is an option for it
3688
+ select(item);
3689
+ }
3690
 
3691
+ function select (data) {
3692
+ self.trigger('select', {
3693
+ data: data
3694
+ });
3695
+ }
3696
 
3697
+ params.term = params.term || '';
 
3698
 
3699
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
 
 
3700
 
3701
+ if (tokenData.term !== params.term) {
3702
+ // Replace the search term if we have the search box
3703
+ if (this.$search.length) {
3704
+ this.$search.val(tokenData.term);
3705
+ this.$search.focus();
3706
+ }
 
 
 
 
 
 
 
 
 
3707
 
3708
+ params.term = tokenData.term;
3709
+ }
3710
 
3711
+ decorated.call(this, params, callback);
3712
+ };
 
 
 
 
 
3713
 
3714
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3715
+ var separators = options.get('tokenSeparators') || [];
3716
+ var term = params.term;
3717
+ var i = 0;
3718
 
3719
+ var createTag = this.createTag || function (params) {
3720
+ return {
3721
+ id: params.term,
3722
+ text: params.term
3723
+ };
3724
+ };
3725
 
3726
+ while (i < term.length) {
3727
+ var termChar = term[i];
 
 
 
 
3728
 
3729
+ if ($.inArray(termChar, separators) === -1) {
3730
+ i++;
3731
 
3732
+ continue;
3733
+ }
3734
 
3735
+ var part = term.substr(0, i);
3736
+ var partParams = $.extend({}, params, {
3737
+ term: part
3738
+ });
3739
 
3740
+ var data = createTag(partParams);
 
 
3741
 
3742
+ if (data == null) {
3743
+ i++;
3744
+ continue;
3745
+ }
3746
 
3747
+ callback(data);
 
 
 
3748
 
3749
+ // Reset the term to not include the tokenized portion
3750
+ term = term.substr(i + 1) || '';
3751
+ i = 0;
3752
+ }
3753
 
3754
+ return {
3755
+ term: term
3756
+ };
3757
+ };
 
3758
 
3759
+ return Tokenizer;
3760
+ });
3761
 
3762
+ S2.define('select2/data/minimumInputLength',[
 
 
 
 
 
 
3763
 
3764
+ ], function () {
3765
+ function MinimumInputLength (decorated, $e, options) {
3766
+ this.minimumInputLength = options.get('minimumInputLength');
3767
 
3768
+ decorated.call(this, $e, options);
3769
+ }
3770
 
3771
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3772
+ params.term = params.term || '';
3773
 
3774
+ if (params.term.length < this.minimumInputLength) {
3775
+ this.trigger('results:message', {
3776
+ message: 'inputTooShort',
3777
+ args: {
3778
+ minimum: this.minimumInputLength,
3779
+ input: params.term,
3780
+ params: params
3781
+ }
3782
+ });
3783
 
3784
+ return;
3785
+ }
3786
 
3787
+ decorated.call(this, params, callback);
3788
+ };
3789
 
3790
+ return MinimumInputLength;
3791
+ });
3792
 
3793
+ S2.define('select2/data/maximumInputLength',[
 
 
 
 
 
 
3794
 
3795
+ ], function () {
3796
+ function MaximumInputLength (decorated, $e, options) {
3797
+ this.maximumInputLength = options.get('maximumInputLength');
3798
 
3799
+ decorated.call(this, $e, options);
3800
+ }
3801
 
3802
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3803
+ params.term = params.term || '';
3804
+
3805
+ if (this.maximumInputLength > 0 &&
3806
+ params.term.length > this.maximumInputLength) {
3807
+ this.trigger('results:message', {
3808
+ message: 'inputTooLong',
3809
+ args: {
3810
+ maximum: this.maximumInputLength,
3811
+ input: params.term,
3812
+ params: params
3813
+ }
3814
+ });
3815
 
3816
+ return;
3817
+ }
 
 
3818
 
3819
+ decorated.call(this, params, callback);
3820
+ };
3821
 
3822
+ return MaximumInputLength;
3823
+ });
3824
 
3825
+ S2.define('select2/data/maximumSelectionLength',[
 
 
 
 
3826
 
3827
+ ], function (){
3828
+ function MaximumSelectionLength (decorated, $e, options) {
3829
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3830
 
3831
+ decorated.call(this, $e, options);
3832
+ }
 
 
 
 
 
 
3833
 
3834
+ MaximumSelectionLength.prototype.query =
3835
+ function (decorated, params, callback) {
3836
+ var self = this;
3837
+
3838
+ this.current(function (currentData) {
3839
+ var count = currentData != null ? currentData.length : 0;
3840
+ if (self.maximumSelectionLength > 0 &&
3841
+ count >= self.maximumSelectionLength) {
3842
+ self.trigger('results:message', {
3843
+ message: 'maximumSelected',
3844
+ args: {
3845
+ maximum: self.maximumSelectionLength
3846
+ }
3847
+ });
3848
+ return;
3849
+ }
3850
+ decorated.call(self, params, callback);
3851
+ });
3852
+ };
3853
 
3854
+ return MaximumSelectionLength;
3855
+ });
 
 
3856
 
3857
+ S2.define('select2/dropdown',[
3858
+ 'jquery',
3859
+ './utils'
3860
+ ], function ($, Utils) {
3861
+ function Dropdown ($element, options) {
3862
+ this.$element = $element;
3863
+ this.options = options;
3864
 
3865
+ Dropdown.__super__.constructor.call(this);
3866
+ }
 
3867
 
3868
+ Utils.Extend(Dropdown, Utils.Observable);
 
3869
 
3870
+ Dropdown.prototype.render = function () {
3871
+ var $dropdown = $(
3872
+ '<span class="select2-dropdown">' +
3873
+ '<span class="select2-results"></span>' +
3874
+ '</span>'
3875
+ );
3876
 
3877
+ $dropdown.attr('dir', this.options.get('dir'));
 
 
3878
 
3879
+ this.$dropdown = $dropdown;
 
3880
 
3881
+ return $dropdown;
3882
+ };
3883
 
3884
+ Dropdown.prototype.bind = function () {
3885
+ // Should be implemented in subclasses
3886
+ };
3887
 
3888
+ Dropdown.prototype.position = function ($dropdown, $container) {
3889
+ // Should be implmented in subclasses
3890
+ };
 
 
 
 
3891
 
3892
+ Dropdown.prototype.destroy = function () {
3893
+ // Remove the dropdown from the DOM
3894
+ this.$dropdown.remove();
3895
+ };
3896
 
3897
+ return Dropdown;
3898
+ });
3899
 
3900
+ S2.define('select2/dropdown/search',[
3901
+ 'jquery',
3902
+ '../utils'
3903
+ ], function ($, Utils) {
3904
+ function Search () { }
3905
 
3906
+ Search.prototype.render = function (decorated) {
3907
+ var $rendered = decorated.call(this);
 
 
3908
 
3909
+ var $search = $(
3910
+ '<span class="select2-search select2-search--dropdown">' +
3911
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
3912
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
3913
+ ' spellcheck="false" role="textbox" />' +
3914
+ '</span>'
3915
+ );
3916
 
3917
+ this.$searchContainer = $search;
3918
+ this.$search = $search.find('input');
3919
 
3920
+ $rendered.prepend($search);
 
 
 
 
3921
 
3922
+ return $rendered;
3923
+ };
3924
 
3925
+ Search.prototype.bind = function (decorated, container, $container) {
3926
+ var self = this;
 
3927
 
3928
+ decorated.call(this, container, $container);
 
 
3929
 
3930
+ this.$search.on('keydown', function (evt) {
3931
+ self.trigger('keypress', evt);
3932
 
3933
+ self._keyUpPrevented = evt.isDefaultPrevented();
3934
+ });
 
 
3935
 
3936
+ // Workaround for browsers which do not support the `input` event
3937
+ // This will prevent double-triggering of events for browsers which support
3938
+ // both the `keyup` and `input` events.
3939
+ this.$search.on('input', function (evt) {
3940
+ // Unbind the duplicated `keyup` event
3941
+ $(this).off('keyup');
3942
+ });
3943
 
3944
+ this.$search.on('keyup input', function (evt) {
3945
+ self.handleSearch(evt);
3946
+ });
3947
 
3948
+ container.on('open', function () {
3949
+ self.$search.attr('tabindex', 0);
 
 
3950
 
3951
+ self.$search.focus();
 
 
 
3952
 
3953
+ window.setTimeout(function () {
3954
+ self.$search.focus();
3955
+ }, 0);
3956
+ });
 
3957
 
3958
+ container.on('close', function () {
3959
+ self.$search.attr('tabindex', -1);
 
3960
 
3961
+ self.$search.val('');
3962
+ });
 
 
3963
 
3964
+ container.on('focus', function () {
3965
+ if (!container.isOpen()) {
3966
+ self.$search.focus();
3967
+ }
3968
+ });
3969
 
3970
+ container.on('results:all', function (params) {
3971
+ if (params.query.term == null || params.query.term === '') {
3972
+ var showSearch = self.showSearch(params);
3973
 
3974
+ if (showSearch) {
3975
+ self.$searchContainer.removeClass('select2-search--hide');
3976
+ } else {
3977
+ self.$searchContainer.addClass('select2-search--hide');
3978
+ }
3979
+ }
3980
+ });
3981
+ };
3982
 
3983
+ Search.prototype.handleSearch = function (evt) {
3984
+ if (!this._keyUpPrevented) {
3985
+ var input = this.$search.val();
3986
 
3987
+ this.trigger('query', {
3988
+ term: input
3989
+ });
3990
+ }
3991
 
3992
+ this._keyUpPrevented = false;
3993
+ };
 
3994
 
3995
+ Search.prototype.showSearch = function (_, params) {
3996
+ return true;
3997
+ };
 
 
 
3998
 
3999
+ return Search;
4000
+ });
4001
 
4002
+ S2.define('select2/dropdown/hidePlaceholder',[
4003
 
4004
+ ], function () {
4005
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4006
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4007
 
4008
+ decorated.call(this, $element, options, dataAdapter);
4009
+ }
4010
 
4011
+ HidePlaceholder.prototype.append = function (decorated, data) {
4012
+ data.results = this.removePlaceholder(data.results);
 
 
 
 
4013
 
4014
+ decorated.call(this, data);
4015
+ };
4016
 
4017
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4018
+ if (typeof placeholder === 'string') {
4019
+ placeholder = {
4020
+ id: '',
4021
+ text: placeholder
4022
+ };
4023
+ }
4024
 
4025
+ return placeholder;
4026
+ };
4027
 
4028
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4029
+ var modifiedData = data.slice(0);
4030
 
4031
+ for (var d = data.length - 1; d >= 0; d--) {
4032
+ var item = data[d];
 
4033
 
4034
+ if (this.placeholder.id === item.id) {
4035
+ modifiedData.splice(d, 1);
4036
+ }
4037
+ }
4038
 
4039
+ return modifiedData;
4040
+ };
 
 
4041
 
4042
+ return HidePlaceholder;
 
 
4043
  });
 
 
4044
 
4045
+ S2.define('select2/dropdown/infiniteScroll',[
4046
+ 'jquery'
4047
+ ], function ($) {
4048
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4049
+ this.lastParams = {};
4050
 
4051
+ decorated.call(this, $element, options, dataAdapter);
 
 
 
4052
 
4053
+ this.$loadingMore = this.createLoadingMore();
4054
+ this.loading = false;
4055
+ }
4056
 
4057
+ InfiniteScroll.prototype.append = function (decorated, data) {
4058
+ this.$loadingMore.remove();
4059
+ this.loading = false;
4060
 
4061
+ decorated.call(this, data);
 
 
4062
 
4063
+ if (this.showLoadingMore(data)) {
4064
+ this.$results.append(this.$loadingMore);
4065
+ }
4066
+ };
4067
 
4068
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4069
+ var self = this;
 
 
4070
 
4071
+ decorated.call(this, container, $container);
 
4072
 
4073
+ container.on('query', function (params) {
4074
+ self.lastParams = params;
4075
+ self.loading = true;
4076
+ });
4077
 
4078
+ container.on('query:append', function (params) {
4079
+ self.lastParams = params;
4080
+ self.loading = true;
4081
+ });
4082
 
4083
+ this.$results.on('scroll', function () {
4084
+ var isLoadMoreVisible = $.contains(
4085
+ document.documentElement,
4086
+ self.$loadingMore[0]
4087
+ );
4088
 
4089
+ if (self.loading || !isLoadMoreVisible) {
4090
+ return;
4091
+ }
4092
 
4093
+ var currentOffset = self.$results.offset().top +
4094
+ self.$results.outerHeight(false);
4095
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4096
+ self.$loadingMore.outerHeight(false);
4097
 
4098
+ if (currentOffset + 50 >= loadingMoreOffset) {
4099
+ self.loadMore();
4100
+ }
4101
+ });
4102
+ };
4103
 
4104
+ InfiniteScroll.prototype.loadMore = function () {
4105
+ this.loading = true;
 
4106
 
4107
+ var params = $.extend({}, {page: 1}, this.lastParams);
 
 
 
 
 
 
4108
 
4109
+ params.page++;
 
 
 
4110
 
4111
+ this.trigger('query:append', params);
4112
+ };
 
 
 
 
4113
 
4114
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4115
+ return data.pagination && data.pagination.more;
4116
+ };
 
 
4117
 
4118
+ InfiniteScroll.prototype.createLoadingMore = function () {
4119
+ var $option = $(
4120
+ '<li ' +
4121
+ 'class="select2-results__option select2-results__option--load-more"' +
4122
+ 'role="treeitem" aria-disabled="true"></li>'
4123
+ );
4124
 
4125
+ var message = this.options.get('translations').get('loadingMore');
 
4126
 
4127
+ $option.html(message(this.lastParams));
 
4128
 
4129
+ return $option;
4130
+ };
4131
 
4132
+ return InfiniteScroll;
4133
+ });
4134
 
4135
+ S2.define('select2/dropdown/attachBody',[
4136
+ 'jquery',
4137
+ '../utils'
4138
+ ], function ($, Utils) {
4139
+ function AttachBody (decorated, $element, options) {
4140
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4141
 
4142
+ decorated.call(this, $element, options);
4143
+ }
4144
 
4145
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4146
+ var self = this;
 
4147
 
4148
+ var setupResultsEvents = false;
 
4149
 
4150
+ decorated.call(this, container, $container);
 
 
4151
 
4152
+ container.on('open', function () {
4153
+ self._showDropdown();
4154
+ self._attachPositioningHandler(container);
 
4155
 
4156
+ if (!setupResultsEvents) {
4157
+ setupResultsEvents = true;
4158
 
4159
+ container.on('results:all', function () {
4160
+ self._positionDropdown();
4161
+ self._resizeDropdown();
4162
+ });
4163
 
4164
+ container.on('results:append', function () {
4165
+ self._positionDropdown();
4166
+ self._resizeDropdown();
4167
+ });
4168
+ }
4169
+ });
4170
 
4171
+ container.on('close', function () {
4172
+ self._hideDropdown();
4173
+ self._detachPositioningHandler(container);
4174
+ });
 
4175
 
4176
+ this.$dropdownContainer.on('mousedown', function (evt) {
4177
+ evt.stopPropagation();
4178
+ });
4179
+ };
4180
 
4181
+ AttachBody.prototype.destroy = function (decorated) {
4182
+ decorated.call(this);
4183
 
4184
+ this.$dropdownContainer.remove();
4185
+ };
 
4186
 
4187
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4188
+ // Clone all of the container classes
4189
+ $dropdown.attr('class', $container.attr('class'));
 
 
4190
 
4191
+ $dropdown.removeClass('select2');
4192
+ $dropdown.addClass('select2-container--open');
 
 
4193
 
4194
+ $dropdown.css({
4195
+ position: 'absolute',
4196
+ top: -999999
4197
+ });
 
 
 
 
4198
 
4199
+ this.$container = $container;
4200
+ };
4201
 
4202
+ AttachBody.prototype.render = function (decorated) {
4203
+ var $container = $('<span></span>');
 
 
4204
 
4205
+ var $dropdown = decorated.call(this);
4206
+ $container.append($dropdown);
 
 
 
4207
 
4208
+ this.$dropdownContainer = $container;
 
4209
 
4210
+ return $container;
4211
+ };
4212
 
4213
+ AttachBody.prototype._hideDropdown = function (decorated) {
4214
+ this.$dropdownContainer.detach();
4215
+ };
4216
 
4217
+ AttachBody.prototype._attachPositioningHandler =
4218
+ function (decorated, container) {
4219
+ var self = this;
4220
 
4221
+ var scrollEvent = 'scroll.select2.' + container.id;
4222
+ var resizeEvent = 'resize.select2.' + container.id;
4223
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4224
 
4225
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4226
+ $watchers.each(function () {
4227
+ $(this).data('select2-scroll-position', {
4228
+ x: $(this).scrollLeft(),
4229
+ y: $(this).scrollTop()
4230
+ });
4231
+ });
4232
 
4233
+ $watchers.on(scrollEvent, function (ev) {
4234
+ var position = $(this).data('select2-scroll-position');
4235
+ $(this).scrollTop(position.y);
4236
+ });
4237
 
4238
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4239
+ function (e) {
4240
+ self._positionDropdown();
4241
+ self._resizeDropdown();
4242
+ });
4243
+ };
4244
 
4245
+ AttachBody.prototype._detachPositioningHandler =
4246
+ function (decorated, container) {
4247
+ var scrollEvent = 'scroll.select2.' + container.id;
4248
+ var resizeEvent = 'resize.select2.' + container.id;
4249
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4250
 
4251
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4252
+ $watchers.off(scrollEvent);
4253
 
4254
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4255
+ };
 
4256
 
4257
+ AttachBody.prototype._positionDropdown = function () {
4258
+ var $window = $(window);
4259
 
4260
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4261
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
 
 
4262
 
4263
+ var newDirection = null;
 
4264
 
4265
+ var offset = this.$container.offset();
 
4266
 
4267
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4268
 
4269
+ var container = {
4270
+ height: this.$container.outerHeight(false)
4271
+ };
4272
 
4273
+ container.top = offset.top;
4274
+ container.bottom = offset.top + container.height;
4275
 
4276
+ var dropdown = {
4277
+ height: this.$dropdown.outerHeight(false)
4278
+ };
4279
 
4280
+ var viewport = {
4281
+ top: $window.scrollTop(),
4282
+ bottom: $window.scrollTop() + $window.height()
4283
+ };
4284
 
4285
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4286
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
 
4287
 
4288
+ var css = {
4289
+ left: offset.left,
4290
+ top: container.bottom
4291
+ };
 
 
4292
 
4293
+ // Determine what the parent element is to use for calciulating the offset
4294
+ var $offsetParent = this.$dropdownParent;
4295
 
4296
+ // For statically positoned elements, we need to get the element
4297
+ // that is determining the offset
4298
+ if ($offsetParent.css('position') === 'static') {
4299
+ $offsetParent = $offsetParent.offsetParent();
4300
+ }
4301
 
4302
+ var parentOffset = $offsetParent.offset();
4303
 
4304
+ css.top -= parentOffset.top;
4305
+ css.left -= parentOffset.left;
 
 
 
 
 
4306
 
4307
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4308
+ newDirection = 'below';
4309
+ }
 
4310
 
4311
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4312
+ newDirection = 'above';
4313
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4314
+ newDirection = 'below';
4315
+ }
4316
 
4317
+ if (newDirection == 'above' ||
4318
+ (isCurrentlyAbove && newDirection !== 'below')) {
4319
+ css.top = container.top - parentOffset.top - dropdown.height;
4320
+ }
4321
 
4322
+ if (newDirection != null) {
4323
+ this.$dropdown
4324
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4325
+ .addClass('select2-dropdown--' + newDirection);
4326
+ this.$container
4327
+ .removeClass('select2-container--below select2-container--above')
4328
+ .addClass('select2-container--' + newDirection);
4329
+ }
4330
 
4331
+ this.$dropdownContainer.css(css);
4332
+ };
4333
 
4334
+ AttachBody.prototype._resizeDropdown = function () {
4335
+ var css = {
4336
+ width: this.$container.outerWidth(false) + 'px'
4337
+ };
4338
 
4339
+ if (this.options.get('dropdownAutoWidth')) {
4340
+ css.minWidth = css.width;
4341
+ css.position = 'relative';
4342
+ css.width = 'auto';
4343
+ }
4344
 
4345
+ this.$dropdown.css(css);
4346
+ };
 
 
4347
 
4348
+ AttachBody.prototype._showDropdown = function (decorated) {
4349
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4350
 
4351
+ this._positionDropdown();
4352
+ this._resizeDropdown();
4353
+ };
 
4354
 
4355
+ return AttachBody;
4356
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4357
 
4358
+ S2.define('select2/dropdown/minimumResultsForSearch',[
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4359
 
4360
+ ], function () {
4361
+ function countResults (data) {
4362
+ var count = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4363
 
4364
+ for (var d = 0; d < data.length; d++) {
4365
+ var item = data[d];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4366
 
4367
+ if (item.children) {
4368
+ count += countResults(item.children);
4369
+ } else {
4370
+ count++;
4371
+ }
4372
+ }
 
 
 
 
 
 
4373
 
4374
+ return count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4375
  }
4376
 
4377
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4378
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
 
4379
 
4380
+ if (this.minimumResultsForSearch < 0) {
4381
+ this.minimumResultsForSearch = Infinity;
4382
+ }
4383
 
4384
+ decorated.call(this, $element, options, dataAdapter);
4385
+ }
 
 
 
 
4386
 
4387
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4388
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4389
+ return false;
4390
+ }
4391
 
4392
+ return decorated.call(this, params);
4393
+ };
4394
 
4395
+ return MinimumResultsForSearch;
4396
+ });
4397
 
4398
+ S2.define('select2/dropdown/selectOnClose',[
 
 
 
 
 
4399
 
4400
+ ], function () {
4401
+ function SelectOnClose () { }
4402
 
4403
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4404
+ var self = this;
 
 
 
4405
 
4406
+ decorated.call(this, container, $container);
 
 
 
 
4407
 
4408
+ container.on('close', function (params) {
4409
+ self._handleSelectOnClose(params);
4410
+ });
4411
+ };
4412
 
4413
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4414
+ if (params && params.originalSelect2Event != null) {
4415
+ var event = params.originalSelect2Event;
4416
 
4417
+ // Don't select an item if the close event was triggered from a select or
4418
+ // unselect event
4419
+ if (event._type === 'select' || event._type === 'unselect') {
4420
+ return;
4421
+ }
4422
+ }
4423
 
4424
+ var $highlightedResults = this.getHighlightedResults();
 
 
 
4425
 
4426
+ // Only select highlighted results
4427
+ if ($highlightedResults.length < 1) {
4428
+ return;
4429
+ }
4430
 
4431
+ var data = $highlightedResults.data('data');
 
4432
 
4433
+ // Don't re-select already selected resulte
4434
+ if (
4435
+ (data.element != null && data.element.selected) ||
4436
+ (data.element == null && data.selected)
4437
+ ) {
4438
+ return;
4439
+ }
4440
 
4441
+ this.trigger('select', {
4442
+ data: data
4443
+ });
4444
+ };
4445
 
4446
+ return SelectOnClose;
4447
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4448
 
4449
+ S2.define('select2/dropdown/closeOnSelect',[
4450
 
4451
+ ], function () {
4452
+ function CloseOnSelect () { }
4453
 
4454
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4455
+ var self = this;
 
 
 
 
4456
 
4457
+ decorated.call(this, container, $container);
 
4458
 
4459
+ container.on('select', function (evt) {
4460
+ self._selectTriggered(evt);
4461
+ });
4462
 
4463
+ container.on('unselect', function (evt) {
4464
+ self._selectTriggered(evt);
4465
+ });
4466
+ };
4467
 
4468
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4469
+ var originalEvent = evt.originalEvent;
 
 
 
 
 
4470
 
4471
+ // Don't close if the control key is being held
4472
+ if (originalEvent && originalEvent.ctrlKey) {
4473
+ return;
4474
+ }
 
 
 
 
 
4475
 
4476
+ this.trigger('close', {
4477
+ originalEvent: originalEvent,
4478
+ originalSelect2Event: evt
4479
+ });
4480
+ };
4481
 
4482
+ return CloseOnSelect;
4483
+ });
 
 
 
 
 
 
4484
 
4485
+ S2.define('select2/i18n/en',[],function () {
4486
+ // English
4487
+ return {
4488
+ errorLoading: function () {
4489
+ return 'The results could not be loaded.';
4490
+ },
4491
+ inputTooLong: function (args) {
4492
+ var overChars = args.input.length - args.maximum;
4493
 
4494
+ var message = 'Please delete ' + overChars + ' character';
 
 
 
 
 
 
 
 
 
 
 
4495
 
4496
+ if (overChars != 1) {
4497
+ message += 's';
4498
+ }
4499
 
4500
+ return message;
4501
+ },
4502
+ inputTooShort: function (args) {
4503
+ var remainingChars = args.minimum - args.input.length;
 
 
 
4504
 
4505
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4506
 
4507
+ return message;
4508
+ },
4509
+ loadingMore: function () {
4510
+ return 'Loading more results…';
4511
+ },
4512
+ maximumSelected: function (args) {
4513
+ var message = 'You can only select ' + args.maximum + ' item';
4514
 
4515
+ if (args.maximum != 1) {
4516
+ message += 's';
4517
+ }
 
4518
 
4519
+ return message;
4520
+ },
4521
+ noResults: function () {
4522
+ return 'No results found';
4523
+ },
4524
+ searching: function () {
4525
+ return 'Searching…';
4526
+ }
4527
+ };
4528
+ });
4529
 
4530
+ S2.define('select2/defaults',[
4531
+ 'jquery',
4532
+ 'require',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4533
 
4534
+ './results',
4535
 
4536
+ './selection/single',
4537
+ './selection/multiple',
4538
+ './selection/placeholder',
4539
+ './selection/allowClear',
4540
+ './selection/search',
4541
+ './selection/eventRelay',
4542
 
4543
+ './utils',
4544
+ './translation',
4545
+ './diacritics',
4546
 
4547
+ './data/select',
4548
+ './data/array',
4549
+ './data/ajax',
4550
+ './data/tags',
4551
+ './data/tokenizer',
4552
+ './data/minimumInputLength',
4553
+ './data/maximumInputLength',
4554
+ './data/maximumSelectionLength',
4555
 
4556
+ './dropdown',
4557
+ './dropdown/search',
4558
+ './dropdown/hidePlaceholder',
4559
+ './dropdown/infiniteScroll',
4560
+ './dropdown/attachBody',
4561
+ './dropdown/minimumResultsForSearch',
4562
+ './dropdown/selectOnClose',
4563
+ './dropdown/closeOnSelect',
4564
 
4565
+ './i18n/en'
4566
+ ], function ($, require,
4567
 
4568
+ ResultsList,
 
 
4569
 
4570
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4571
+ SelectionSearch, EventRelay,
4572
 
4573
+ Utils, Translation, DIACRITICS,
 
4574
 
4575
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4576
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4577
 
4578
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4579
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4580
 
4581
+ EnglishTranslation) {
4582
+ function Defaults () {
4583
+ this.reset();
4584
+ }
4585
 
4586
+ Defaults.prototype.apply = function (options) {
4587
+ options = $.extend(true, {}, this.defaults, options);
4588
 
4589
+ if (options.dataAdapter == null) {
4590
+ if (options.ajax != null) {
4591
+ options.dataAdapter = AjaxData;
4592
+ } else if (options.data != null) {
4593
+ options.dataAdapter = ArrayData;
4594
+ } else {
4595
+ options.dataAdapter = SelectData;
4596
+ }
4597
 
4598
+ if (options.minimumInputLength > 0) {
4599
+ options.dataAdapter = Utils.Decorate(
4600
+ options.dataAdapter,
4601
+ MinimumInputLength
4602
+ );
4603
+ }
4604
 
4605
+ if (options.maximumInputLength > 0) {
4606
+ options.dataAdapter = Utils.Decorate(
4607
+ options.dataAdapter,
4608
+ MaximumInputLength
4609
+ );
4610
+ }
4611
 
4612
+ if (options.maximumSelectionLength > 0) {
4613
+ options.dataAdapter = Utils.Decorate(
4614
+ options.dataAdapter,
4615
+ MaximumSelectionLength
4616
+ );
4617
+ }
4618
 
4619
+ if (options.tags) {
4620
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4621
+ }
4622
 
4623
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4624
+ options.dataAdapter = Utils.Decorate(
4625
+ options.dataAdapter,
4626
+ Tokenizer
4627
+ );
4628
+ }
4629
 
4630
+ if (options.query != null) {
4631
+ var Query = require(options.amdBase + 'compat/query');
4632
 
4633
+ options.dataAdapter = Utils.Decorate(
4634
+ options.dataAdapter,
4635
+ Query
4636
+ );
4637
+ }
4638
 
4639
+ if (options.initSelection != null) {
4640
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
 
 
 
 
4641
 
4642
+ options.dataAdapter = Utils.Decorate(
4643
+ options.dataAdapter,
4644
+ InitSelection
4645
+ );
4646
+ }
4647
+ }
4648
 
4649
+ if (options.resultsAdapter == null) {
4650
+ options.resultsAdapter = ResultsList;
 
4651
 
4652
+ if (options.ajax != null) {
4653
+ options.resultsAdapter = Utils.Decorate(
4654
+ options.resultsAdapter,
4655
+ InfiniteScroll
4656
+ );
4657
+ }
4658
 
4659
+ if (options.placeholder != null) {
4660
+ options.resultsAdapter = Utils.Decorate(
4661
+ options.resultsAdapter,
4662
+ HidePlaceholder
4663
+ );
4664
+ }
4665
 
4666
+ if (options.selectOnClose) {
4667
+ options.resultsAdapter = Utils.Decorate(
4668
+ options.resultsAdapter,
4669
+ SelectOnClose
4670
+ );
4671
+ }
4672
+ }
4673
 
4674
+ if (options.dropdownAdapter == null) {
4675
+ if (options.multiple) {
4676
+ options.dropdownAdapter = Dropdown;
4677
+ } else {
4678
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4679
 
4680
+ options.dropdownAdapter = SearchableDropdown;
4681
+ }
 
 
 
 
 
4682
 
4683
+ if (options.minimumResultsForSearch !== 0) {
4684
+ options.dropdownAdapter = Utils.Decorate(
4685
+ options.dropdownAdapter,
4686
+ MinimumResultsForSearch
4687
+ );
4688
+ }
4689
 
4690
+ if (options.closeOnSelect) {
4691
+ options.dropdownAdapter = Utils.Decorate(
4692
+ options.dropdownAdapter,
4693
+ CloseOnSelect
4694
+ );
4695
+ }
4696
 
4697
+ if (
4698
+ options.dropdownCssClass != null ||
4699
+ options.dropdownCss != null ||
4700
+ options.adaptDropdownCssClass != null
4701
+ ) {
4702
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4703
+
4704
+ options.dropdownAdapter = Utils.Decorate(
4705
+ options.dropdownAdapter,
4706
+ DropdownCSS
4707
+ );
4708
+ }
4709
 
4710
+ options.dropdownAdapter = Utils.Decorate(
4711
+ options.dropdownAdapter,
4712
+ AttachBody
4713
+ );
4714
+ }
4715
 
4716
+ if (options.selectionAdapter == null) {
4717
+ if (options.multiple) {
4718
+ options.selectionAdapter = MultipleSelection;
4719
+ } else {
4720
+ options.selectionAdapter = SingleSelection;
4721
+ }
4722
 
4723
+ // Add the placeholder mixin if a placeholder was specified
4724
+ if (options.placeholder != null) {
4725
+ options.selectionAdapter = Utils.Decorate(
4726
+ options.selectionAdapter,
4727
+ Placeholder
4728
+ );
4729
+ }
4730
 
4731
+ if (options.allowClear) {
4732
+ options.selectionAdapter = Utils.Decorate(
4733
+ options.selectionAdapter,
4734
+ AllowClear
4735
+ );
4736
+ }
4737
 
4738
+ if (options.multiple) {
4739
+ options.selectionAdapter = Utils.Decorate(
4740
+ options.selectionAdapter,
4741
+ SelectionSearch
4742
+ );
4743
+ }
4744
 
4745
+ if (
4746
+ options.containerCssClass != null ||
4747
+ options.containerCss != null ||
4748
+ options.adaptContainerCssClass != null
4749
+ ) {
4750
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4751
+
4752
+ options.selectionAdapter = Utils.Decorate(
4753
+ options.selectionAdapter,
4754
+ ContainerCSS
4755
+ );
4756
+ }
4757
 
4758
+ options.selectionAdapter = Utils.Decorate(
4759
+ options.selectionAdapter,
4760
+ EventRelay
4761
+ );
4762
+ }
4763
 
4764
+ if (typeof options.language === 'string') {
4765
+ // Check if the language is specified with a region
4766
+ if (options.language.indexOf('-') > 0) {
4767
+ // Extract the region information if it is included
4768
+ var languageParts = options.language.split('-');
4769
+ var baseLanguage = languageParts[0];
4770
 
4771
+ options.language = [options.language, baseLanguage];
4772
+ } else {
4773
+ options.language = [options.language];
4774
+ }
4775
+ }
4776
 
4777
+ if ($.isArray(options.language)) {
4778
+ var languages = new Translation();
4779
+ options.language.push('en');
4780
+
4781
+ var languageNames = options.language;
4782
+
4783
+ for (var l = 0; l < languageNames.length; l++) {
4784
+ var name = languageNames[l];
4785
+ var language = {};
4786
+
4787
+ try {
4788
+ // Try to load it with the original name
4789
+ language = Translation.loadPath(name);
4790
+ } catch (e) {
4791
+ try {
4792
+ // If we couldn't load it, check if it wasn't the full path
4793
+ name = this.defaults.amdLanguageBase + name;
4794
+ language = Translation.loadPath(name);
4795
+ } catch (ex) {
4796
+ // The translation could not be loaded at all. Sometimes this is
4797
+ // because of a configuration problem, other times this can be
4798
+ // because of how Select2 helps load all possible translation files.
4799
+ if (options.debug && window.console && console.warn) {
4800
+ console.warn(
4801
+ 'Select2: The language file for "' + name + '" could not be ' +
4802
+ 'automatically loaded. A fallback will be used instead.'
4803
+ );
4804
+ }
4805
+
4806
+ continue;
4807
+ }
4808
+ }
4809
 
4810
+ languages.extend(language);
4811
+ }
 
4812
 
4813
+ options.translations = languages;
4814
+ } else {
4815
+ var baseTranslation = Translation.loadPath(
4816
+ this.defaults.amdLanguageBase + 'en'
4817
+ );
4818
+ var customTranslation = new Translation(options.language);
4819
 
4820
+ customTranslation.extend(baseTranslation);
 
 
4821
 
4822
+ options.translations = customTranslation;
4823
+ }
 
 
4824
 
4825
+ return options;
4826
+ };
4827
+
4828
+ Defaults.prototype.reset = function () {
4829
+ function stripDiacritics (text) {
4830
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4831
+ function match(a) {
4832
+ return DIACRITICS[a] || a;
4833
+ }
4834
 
4835
+ return text.replace(/[^\u0000-\u007E]/g, match);
4836
+ }
4837
 
4838
+ function matcher (params, data) {
4839
+ // Always return the object if there is nothing to compare
4840
+ if ($.trim(params.term) === '') {
4841
+ return data;
4842
+ }
4843
 
4844
+ // Do a recursive check for options with children
4845
+ if (data.children && data.children.length > 0) {
4846
+ // Clone the data object if there are children
4847
+ // This is required as we modify the object to remove any non-matches
4848
+ var match = $.extend(true, {}, data);
4849
 
4850
+ // Check each child of the option
4851
+ for (var c = data.children.length - 1; c >= 0; c--) {
4852
+ var child = data.children[c];
4853
 
4854
+ var matches = matcher(params, child);
 
 
 
 
 
 
4855
 
4856
+ // If there wasn't a match, remove the object in the array
4857
+ if (matches == null) {
4858
+ match.children.splice(c, 1);
4859
+ }
4860
+ }
4861
 
4862
+ // If any children matched, return the new object
4863
+ if (match.children.length > 0) {
4864
+ return match;
4865
+ }
4866
 
4867
+ // If there were no matching children, check just the plain object
4868
+ return matcher(params, match);
4869
+ }
4870
 
4871
+ var original = stripDiacritics(data.text).toUpperCase();
4872
+ var term = stripDiacritics(params.term).toUpperCase();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4873
 
4874
+ // Check if the text contains the term
4875
+ if (original.indexOf(term) > -1) {
4876
+ return data;
4877
+ }
4878
 
4879
+ // If it doesn't contain the term, don't return anything
4880
+ return null;
4881
+ }
 
4882
 
4883
+ this.defaults = {
4884
+ amdBase: './',
4885
+ amdLanguageBase: './i18n/',
4886
+ closeOnSelect: true,
4887
+ debug: false,
4888
+ dropdownAutoWidth: false,
4889
+ escapeMarkup: Utils.escapeMarkup,
4890
+ language: EnglishTranslation,
4891
+ matcher: matcher,
4892
+ minimumInputLength: 0,
4893
+ maximumInputLength: 0,
4894
+ maximumSelectionLength: 0,
4895
+ minimumResultsForSearch: 0,
4896
+ selectOnClose: false,
4897
+ sorter: function (data) {
4898
+ return data;
4899
+ },
4900
+ templateResult: function (result) {
4901
+ return result.text;
4902
+ },
4903
+ templateSelection: function (selection) {
4904
+ return selection.text;
4905
+ },
4906
+ theme: 'default',
4907
+ width: 'resolve'
4908
+ };
4909
+ };
4910
 
4911
+ Defaults.prototype.set = function (key, value) {
4912
+ var camelKey = $.camelCase(key);
 
4913
 
4914
+ var data = {};
4915
+ data[camelKey] = value;
 
4916
 
4917
+ var convertedData = Utils._convertData(data);
 
 
 
4918
 
4919
+ $.extend(this.defaults, convertedData);
4920
+ };
 
4921
 
4922
+ var defaults = new Defaults();
 
4923
 
4924
+ return defaults;
4925
+ });
 
 
4926
 
4927
+ S2.define('select2/options',[
4928
+ 'require',
4929
+ 'jquery',
4930
+ './defaults',
4931
+ './utils'
4932
+ ], function (require, $, Defaults, Utils) {
4933
+ function Options (options, $element) {
4934
+ this.options = options;
4935
+
4936
+ if ($element != null) {
4937
+ this.fromElement($element);
4938
+ }
4939
 
4940
+ this.options = Defaults.apply(this.options);
 
 
 
4941
 
4942
+ if ($element && $element.is('input')) {
4943
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4944
 
4945
+ this.options.dataAdapter = Utils.Decorate(
4946
+ this.options.dataAdapter,
4947
+ InputCompat
4948
+ );
4949
+ }
4950
+ }
4951
 
4952
+ Options.prototype.fromElement = function ($e) {
4953
+ var excludedData = ['select2'];
 
4954
 
4955
+ if (this.options.multiple == null) {
4956
+ this.options.multiple = $e.prop('multiple');
4957
+ }
4958
 
4959
+ if (this.options.disabled == null) {
4960
+ this.options.disabled = $e.prop('disabled');
4961
+ }
4962
 
4963
+ if (this.options.language == null) {
4964
+ if ($e.prop('lang')) {
4965
+ this.options.language = $e.prop('lang').toLowerCase();
4966
+ } else if ($e.closest('[lang]').prop('lang')) {
4967
+ this.options.language = $e.closest('[lang]').prop('lang');
4968
+ }
4969
+ }
4970
 
4971
+ if (this.options.dir == null) {
4972
+ if ($e.prop('dir')) {
4973
+ this.options.dir = $e.prop('dir');
4974
+ } else if ($e.closest('[dir]').prop('dir')) {
4975
+ this.options.dir = $e.closest('[dir]').prop('dir');
4976
+ } else {
4977
+ this.options.dir = 'ltr';
4978
+ }
4979
+ }
4980
 
4981
+ $e.prop('disabled', this.options.disabled);
4982
+ $e.prop('multiple', this.options.multiple);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4983
 
4984
+ if ($e.data('select2Tags')) {
4985
+ if (this.options.debug && window.console && console.warn) {
4986
+ console.warn(
4987
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
4988
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4989
+ 'removed in future versions of Select2.'
4990
+ );
4991
+ }
4992
 
4993
+ $e.data('data', $e.data('select2Tags'));
4994
+ $e.data('tags', true);
4995
+ }
 
4996
 
4997
+ if ($e.data('ajaxUrl')) {
4998
+ if (this.options.debug && window.console && console.warn) {
4999
+ console.warn(
5000
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5001
+ '`data-ajax--url` and support for the old attribute will be removed' +
5002
+ ' in future versions of Select2.'
5003
+ );
5004
+ }
5005
 
5006
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
5007
+ $e.data('ajax--url', $e.data('ajaxUrl'));
5008
+ }
5009
 
5010
+ var dataset = {};
 
 
5011
 
5012
+ // Prefer the element's `dataset` attribute if it exists
5013
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5014
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5015
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5016
+ } else {
5017
+ dataset = $e.data();
5018
+ }
5019
 
5020
+ var data = $.extend(true, {}, dataset);
 
 
 
 
 
5021
 
5022
+ data = Utils._convertData(data);
 
 
 
 
5023
 
5024
+ for (var key in data) {
5025
+ if ($.inArray(key, excludedData) > -1) {
5026
+ continue;
5027
+ }
5028
 
5029
+ if ($.isPlainObject(this.options[key])) {
5030
+ $.extend(this.options[key], data[key]);
5031
+ } else {
5032
+ this.options[key] = data[key];
5033
+ }
5034
+ }
5035
 
5036
+ return this;
5037
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5038
 
5039
+ Options.prototype.get = function (key) {
5040
+ return this.options[key];
5041
+ };
 
 
 
 
5042
 
5043
+ Options.prototype.set = function (key, val) {
5044
+ this.options[key] = val;
5045
+ };
 
 
 
 
5046
 
5047
+ return Options;
 
 
 
 
5048
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5049
 
5050
+ S2.define('select2/core',[
5051
+ 'jquery',
5052
+ './options',
5053
+ './utils',
5054
+ './keys'
5055
+ ], function ($, Options, Utils, KEYS) {
5056
+ var Select2 = function ($element, options) {
5057
+ if ($element.data('select2') != null) {
5058
+ $element.data('select2').destroy();
5059
+ }
5060
 
5061
+ this.$element = $element;
5062
 
5063
+ this.id = this._generateId($element);
 
5064
 
5065
+ options = options || {};
 
 
5066
 
5067
+ this.options = new Options(options, $element);
 
5068
 
5069
+ Select2.__super__.constructor.call(this);
 
 
 
5070
 
5071
+ // Set up the tabindex
 
 
 
 
 
5072
 
5073
+ var tabindex = $element.attr('tabindex') || 0;
5074
+ $element.data('old-tabindex', tabindex);
5075
+ $element.attr('tabindex', '-1');
 
5076
 
5077
+ // Set up containers and adapters
 
5078
 
5079
+ var DataAdapter = this.options.get('dataAdapter');
5080
+ this.dataAdapter = new DataAdapter($element, this.options);
 
 
5081
 
5082
+ var $container = this.render();
 
5083
 
5084
+ this._placeContainer($container);
 
 
5085
 
5086
+ var SelectionAdapter = this.options.get('selectionAdapter');
5087
+ this.selection = new SelectionAdapter($element, this.options);
5088
+ this.$selection = this.selection.render();
5089
 
5090
+ this.selection.position(this.$selection, $container);
 
 
 
 
5091
 
5092
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5093
+ this.dropdown = new DropdownAdapter($element, this.options);
5094
+ this.$dropdown = this.dropdown.render();
 
 
 
 
 
 
 
 
 
5095
 
5096
+ this.dropdown.position(this.$dropdown, $container);
 
 
5097
 
5098
+ var ResultsAdapter = this.options.get('resultsAdapter');
5099
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5100
+ this.$results = this.results.render();
5101
 
5102
+ this.results.position(this.$results, this.$dropdown);
 
5103
 
5104
+ // Bind events
 
 
 
 
 
 
 
5105
 
5106
+ var self = this;
5107
 
5108
+ // Bind the container to all of the adapters
5109
+ this._bindAdapters();
 
5110
 
5111
+ // Register any DOM event handlers
5112
+ this._registerDomEvents();
5113
 
5114
+ // Register any internal event handlers
5115
+ this._registerDataEvents();
5116
+ this._registerSelectionEvents();
5117
+ this._registerDropdownEvents();
5118
+ this._registerResultsEvents();
5119
+ this._registerEvents();
 
5120
 
5121
+ // Set the initial state
5122
+ this.dataAdapter.current(function (initialData) {
5123
+ self.trigger('selection:update', {
5124
+ data: initialData
5125
+ });
5126
+ });
5127
 
5128
+ // Hide the original select
5129
+ $element.addClass('select2-hidden-accessible');
5130
+ $element.attr('aria-hidden', 'true');
5131
 
5132
+ // Synchronize any monitored attributes
5133
+ this._syncAttributes();
 
 
 
5134
 
5135
+ $element.data('select2', this);
5136
+ };
5137
 
5138
+ Utils.Extend(Select2, Utils.Observable);
 
5139
 
5140
+ Select2.prototype._generateId = function ($element) {
5141
+ var id = '';
 
5142
 
5143
+ if ($element.attr('id') != null) {
5144
+ id = $element.attr('id');
5145
+ } else if ($element.attr('name') != null) {
5146
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5147
+ } else {
5148
+ id = Utils.generateChars(4);
5149
+ }
 
 
 
 
5150
 
5151
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5152
+ id = 'select2-' + id;
5153
 
5154
+ return id;
5155
+ };
5156
 
5157
+ Select2.prototype._placeContainer = function ($container) {
5158
+ $container.insertAfter(this.$element);
 
5159
 
5160
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
 
 
 
5161
 
5162
+ if (width != null) {
5163
+ $container.css('width', width);
5164
+ }
5165
+ };
 
5166
 
5167
+ Select2.prototype._resolveWidth = function ($element, method) {
5168
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
 
 
 
 
 
5169
 
5170
+ if (method == 'resolve') {
5171
+ var styleWidth = this._resolveWidth($element, 'style');
5172
 
5173
+ if (styleWidth != null) {
5174
+ return styleWidth;
5175
+ }
5176
 
5177
+ return this._resolveWidth($element, 'element');
5178
+ }
5179
 
5180
+ if (method == 'element') {
5181
+ var elementWidth = $element.outerWidth(false);
5182
 
5183
+ if (elementWidth <= 0) {
5184
+ return 'auto';
5185
+ }
5186
 
5187
+ return elementWidth + 'px';
5188
+ }
5189
 
5190
+ if (method == 'style') {
5191
+ var style = $element.attr('style');
 
 
 
5192
 
5193
+ if (typeof(style) !== 'string') {
5194
+ return null;
5195
+ }
5196
 
5197
+ var attrs = style.split(';');
 
5198
 
5199
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5200
+ var attr = attrs[i].replace(/\s/g, '');
5201
+ var matches = attr.match(WIDTH);
 
 
 
 
5202
 
5203
+ if (matches !== null && matches.length >= 1) {
5204
+ return matches[1];
5205
+ }
5206
+ }
5207
 
5208
+ return null;
5209
+ }
5210
 
5211
+ return method;
5212
+ };
 
 
5213
 
5214
+ Select2.prototype._bindAdapters = function () {
5215
+ this.dataAdapter.bind(this, this.$container);
5216
+ this.selection.bind(this, this.$container);
 
 
 
5217
 
5218
+ this.dropdown.bind(this, this.$container);
5219
+ this.results.bind(this, this.$container);
5220
+ };
5221
 
5222
+ Select2.prototype._registerDomEvents = function () {
5223
+ var self = this;
 
 
5224
 
5225
+ this.$element.on('change.select2', function () {
5226
+ self.dataAdapter.current(function (data) {
5227
+ self.trigger('selection:update', {
5228
+ data: data
5229
+ });
5230
+ });
5231
+ });
 
5232
 
5233
+ this.$element.on('focus.select2', function (evt) {
5234
+ self.trigger('focus', evt);
5235
+ });
5236
 
5237
+ this._syncA = Utils.bind(this._syncAttributes, this);
5238
+ this._syncS = Utils.bind(this._syncSubtree, this);
5239
 
5240
+ if (this.$element[0].attachEvent) {
5241
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5242
+ }
5243
 
5244
+ var observer = window.MutationObserver ||
5245
+ window.WebKitMutationObserver ||
5246
+ window.MozMutationObserver
5247
+ ;
5248
+
5249
+ if (observer != null) {
5250
+ this._observer = new observer(function (mutations) {
5251
+ $.each(mutations, self._syncA);
5252
+ $.each(mutations, self._syncS);
5253
+ });
5254
+ this._observer.observe(this.$element[0], {
5255
+ attributes: true,
5256
+ childList: true,
5257
+ subtree: false
5258
+ });
5259
+ } else if (this.$element[0].addEventListener) {
5260
+ this.$element[0].addEventListener(
5261
+ 'DOMAttrModified',
5262
+ self._syncA,
5263
+ false
5264
+ );
5265
+ this.$element[0].addEventListener(
5266
+ 'DOMNodeInserted',
5267
+ self._syncS,
5268
+ false
5269
+ );
5270
+ this.$element[0].addEventListener(
5271
+ 'DOMNodeRemoved',
5272
+ self._syncS,
5273
+ false
5274
+ );
5275
+ }
5276
+ };
5277
 
5278
+ Select2.prototype._registerDataEvents = function () {
5279
+ var self = this;
5280
 
5281
+ this.dataAdapter.on('*', function (name, params) {
5282
+ self.trigger(name, params);
5283
+ });
5284
+ };
5285
 
5286
+ Select2.prototype._registerSelectionEvents = function () {
5287
+ var self = this;
5288
+ var nonRelayEvents = ['toggle', 'focus'];
5289
 
5290
+ this.selection.on('toggle', function () {
5291
+ self.toggleDropdown();
5292
+ });
5293
 
5294
+ this.selection.on('focus', function (params) {
5295
+ self.focus(params);
5296
+ });
 
5297
 
5298
+ this.selection.on('*', function (name, params) {
5299
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5300
+ return;
5301
+ }
5302
 
5303
+ self.trigger(name, params);
5304
+ });
5305
+ };
5306
 
5307
+ Select2.prototype._registerDropdownEvents = function () {
5308
+ var self = this;
 
5309
 
5310
+ this.dropdown.on('*', function (name, params) {
5311
+ self.trigger(name, params);
5312
+ });
5313
+ };
5314
 
5315
+ Select2.prototype._registerResultsEvents = function () {
5316
+ var self = this;
5317
 
5318
+ this.results.on('*', function (name, params) {
5319
+ self.trigger(name, params);
5320
+ });
5321
+ };
5322
 
5323
+ Select2.prototype._registerEvents = function () {
5324
+ var self = this;
5325
 
5326
+ this.on('open', function () {
5327
+ self.$container.addClass('select2-container--open');
5328
+ });
 
 
 
 
 
5329
 
5330
+ this.on('close', function () {
5331
+ self.$container.removeClass('select2-container--open');
5332
+ });
5333
 
5334
+ this.on('enable', function () {
5335
+ self.$container.removeClass('select2-container--disabled');
5336
+ });
5337
 
5338
+ this.on('disable', function () {
5339
+ self.$container.addClass('select2-container--disabled');
5340
+ });
5341
 
5342
+ this.on('blur', function () {
5343
+ self.$container.removeClass('select2-container--focus');
5344
+ });
5345
 
5346
+ this.on('query', function (params) {
5347
+ if (!self.isOpen()) {
5348
+ self.trigger('open', {});
5349
+ }
5350
 
5351
+ this.dataAdapter.query(params, function (data) {
5352
+ self.trigger('results:all', {
5353
+ data: data,
5354
+ query: params
5355
+ });
5356
+ });
5357
+ });
5358
+
5359
+ this.on('query:append', function (params) {
5360
+ this.dataAdapter.query(params, function (data) {
5361
+ self.trigger('results:append', {
5362
+ data: data,
5363
+ query: params
5364
+ });
5365
+ });
5366
+ });
5367
+
5368
+ this.on('keypress', function (evt) {
5369
+ var key = evt.which;
5370
+
5371
+ if (self.isOpen()) {
5372
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5373
+ (key === KEYS.UP && evt.altKey)) {
5374
+ self.close();
5375
+
5376
+ evt.preventDefault();
5377
+ } else if (key === KEYS.ENTER) {
5378
+ self.trigger('results:select', {});
5379
+
5380
+ evt.preventDefault();
5381
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5382
+ self.trigger('results:toggle', {});
5383
+
5384
+ evt.preventDefault();
5385
+ } else if (key === KEYS.UP) {
5386
+ self.trigger('results:previous', {});
5387
+
5388
+ evt.preventDefault();
5389
+ } else if (key === KEYS.DOWN) {
5390
+ self.trigger('results:next', {});
5391
+
5392
+ evt.preventDefault();
5393
+ }
5394
+ } else {
5395
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5396
+ (key === KEYS.DOWN && evt.altKey)) {
5397
+ self.open();
5398
 
5399
+ evt.preventDefault();
5400
+ }
5401
+ }
5402
+ });
5403
+ };
5404
 
5405
+ Select2.prototype._syncAttributes = function () {
5406
+ this.options.set('disabled', this.$element.prop('disabled'));
5407
 
5408
+ if (this.options.get('disabled')) {
5409
+ if (this.isOpen()) {
5410
+ this.close();
5411
+ }
5412
 
5413
+ this.trigger('disable', {});
5414
+ } else {
5415
+ this.trigger('enable', {});
5416
+ }
5417
+ };
5418
 
5419
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5420
+ var changed = false;
5421
+ var self = this;
5422
+
5423
+ // Ignore any mutation events raised for elements that aren't options or
5424
+ // optgroups. This handles the case when the select element is destroyed
5425
+ if (
5426
+ evt && evt.target && (
5427
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5428
+ )
5429
+ ) {
5430
+ return;
5431
+ }
5432
 
5433
+ if (!mutations) {
5434
+ // If mutation events aren't supported, then we can only assume that the
5435
+ // change affected the selections
5436
+ changed = true;
5437
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5438
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5439
+ var node = mutations.addedNodes[n];
5440
 
5441
+ if (node.selected) {
5442
+ changed = true;
5443
+ }
5444
+ }
5445
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5446
+ changed = true;
5447
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5448
 
5449
+ // Only re-pull the data if we think there is a change
5450
+ if (changed) {
5451
+ this.dataAdapter.current(function (currentData) {
5452
+ self.trigger('selection:update', {
5453
+ data: currentData
5454
+ });
5455
+ });
5456
+ }
5457
+ };
5458
 
5459
+ /**
5460
+ * Override the trigger method to automatically trigger pre-events when
5461
+ * there are events that can be prevented.
5462
+ */
5463
+ Select2.prototype.trigger = function (name, args) {
5464
+ var actualTrigger = Select2.__super__.trigger;
5465
+ var preTriggerMap = {
5466
+ 'open': 'opening',
5467
+ 'close': 'closing',
5468
+ 'select': 'selecting',
5469
+ 'unselect': 'unselecting'
5470
+ };
5471
+
5472
+ if (args === undefined) {
5473
+ args = {};
5474
+ }
5475
 
5476
+ if (name in preTriggerMap) {
5477
+ var preTriggerName = preTriggerMap[name];
5478
+ var preTriggerArgs = {
5479
+ prevented: false,
5480
+ name: name,
5481
+ args: args
5482
+ };
5483
 
5484
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
 
5485
 
5486
+ if (preTriggerArgs.prevented) {
5487
+ args.prevented = true;
5488
 
5489
+ return;
5490
+ }
5491
+ }
5492
+
5493
+ actualTrigger.call(this, name, args);
5494
+ };
5495
+
5496
+ Select2.prototype.toggleDropdown = function () {
5497
+ if (this.options.get('disabled')) {
5498
+ return;
5499
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5500
 
5501
+ if (this.isOpen()) {
5502
+ this.close();
5503
+ } else {
5504
+ this.open();
5505
+ }
5506
+ };
5507
 
5508
+ Select2.prototype.open = function () {
5509
+ if (this.isOpen()) {
5510
+ return;
5511
+ }
5512
 
5513
+ this.trigger('query', {});
5514
+ };
 
 
 
 
5515
 
5516
+ Select2.prototype.close = function () {
5517
+ if (!this.isOpen()) {
5518
+ return;
5519
+ }
5520
 
5521
+ this.trigger('close', {});
5522
+ };
5523
 
5524
+ Select2.prototype.isOpen = function () {
5525
+ return this.$container.hasClass('select2-container--open');
5526
+ };
5527
 
5528
+ Select2.prototype.hasFocus = function () {
5529
+ return this.$container.hasClass('select2-container--focus');
5530
+ };
5531
 
5532
+ Select2.prototype.focus = function (data) {
5533
+ // No need to re-trigger focus events if we are already focused
5534
+ if (this.hasFocus()) {
5535
+ return;
5536
+ }
5537
+
5538
+ this.$container.addClass('select2-container--focus');
5539
+ this.trigger('focus', {});
5540
+ };
5541
+
5542
+ Select2.prototype.enable = function (args) {
5543
+ if (this.options.get('debug') && window.console && console.warn) {
5544
+ console.warn(
5545
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5546
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5547
+ ' instead.'
5548
+ );
5549
+ }
5550
 
5551
+ if (args == null || args.length === 0) {
5552
+ args = [true];
5553
+ }
5554
+
5555
+ var disabled = !args[0];
5556
 
5557
+ this.$element.prop('disabled', disabled);
5558
+ };
5559
+
5560
+ Select2.prototype.data = function () {
5561
+ if (this.options.get('debug') &&
5562
+ arguments.length > 0 && window.console && console.warn) {
5563
+ console.warn(
5564
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5565
+ 'should consider setting the value instead using `$element.val()`.'
5566
+ );
5567
+ }
5568
+
5569
+ var data = [];
5570
+
5571
+ this.dataAdapter.current(function (currentData) {
5572
+ data = currentData;
5573
+ });
5574
+
5575
+ return data;
5576
+ };
5577
+
5578
+ Select2.prototype.val = function (args) {
5579
+ if (this.options.get('debug') && window.console && console.warn) {
5580
+ console.warn(
5581
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5582
+ ' removed in later Select2 versions. Use $element.val() instead.'
5583
+ );
5584
+ }
5585
+
5586
+ if (args == null || args.length === 0) {
5587
+ return this.$element.val();
5588
+ }
5589
+
5590
+ var newVal = args[0];
5591
+
5592
+ if ($.isArray(newVal)) {
5593
+ newVal = $.map(newVal, function (obj) {
5594
+ return obj.toString();
5595
+ });
5596
+ }
5597
+
5598
+ this.$element.val(newVal).trigger('change');
5599
+ };
5600
+
5601
+ Select2.prototype.destroy = function () {
5602
+ this.$container.remove();
5603
+
5604
+ if (this.$element[0].detachEvent) {
5605
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5606
+ }
5607
+
5608
+ if (this._observer != null) {
5609
+ this._observer.disconnect();
5610
+ this._observer = null;
5611
+ } else if (this.$element[0].removeEventListener) {
5612
+ this.$element[0]
5613
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5614
+ this.$element[0]
5615
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5616
+ this.$element[0]
5617
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5618
+ }
5619
+
5620
+ this._syncA = null;
5621
+ this._syncS = null;
5622
+
5623
+ this.$element.off('.select2');
5624
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5625
+
5626
+ this.$element.removeClass('select2-hidden-accessible');
5627
+ this.$element.attr('aria-hidden', 'false');
5628
+ this.$element.removeData('select2');
5629
+
5630
+ this.dataAdapter.destroy();
5631
+ this.selection.destroy();
5632
+ this.dropdown.destroy();
5633
+ this.results.destroy();
5634
+
5635
+ this.dataAdapter = null;
5636
+ this.selection = null;
5637
+ this.dropdown = null;
5638
+ this.results = null;
5639
+ };
5640
+
5641
+ Select2.prototype.render = function () {
5642
+ var $container = $(
5643
+ '<span class="select2 select2-container">' +
5644
+ '<span class="selection"></span>' +
5645
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5646
+ '</span>'
5647
+ );
5648
+
5649
+ $container.attr('dir', this.options.get('dir'));
5650
+
5651
+ this.$container = $container;
5652
+
5653
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
5654
+
5655
+ $container.data('element', this.$element);
5656
+
5657
+ return $container;
5658
+ };
5659
+
5660
+ return Select2;
5661
  });
 
5662
 
5663
+ S2.define('select2/compat/utils',[
5664
+ 'jquery'
5665
+ ], function ($) {
5666
+ function syncCssClasses ($dest, $src, adapter) {
5667
+ var classes, replacements = [], adapted;
5668
 
5669
+ classes = $.trim($dest.attr('class'));
 
 
 
5670
 
5671
+ if (classes) {
5672
+ classes = '' + classes; // for IE which returns object
5673
 
5674
+ $(classes.split(/\s+/)).each(function () {
5675
+ // Save all Select2 classes
5676
+ if (this.indexOf('select2-') === 0) {
5677
+ replacements.push(this);
5678
+ }
5679
+ });
5680
+ }
5681
 
5682
+ classes = $.trim($src.attr('class'));
 
5683
 
5684
+ if (classes) {
5685
+ classes = '' + classes; // for IE which returns object
5686
 
5687
+ $(classes.split(/\s+/)).each(function () {
5688
+ // Only adapt non-Select2 classes
5689
+ if (this.indexOf('select2-') !== 0) {
5690
+ adapted = adapter(this);
5691
+
5692
+ if (adapted != null) {
5693
+ replacements.push(adapted);
5694
+ }
5695
+ }
5696
+ });
5697
+ }
5698
+
5699
+ $dest.attr('class', replacements.join(' '));
5700
+ }
5701
 
5702
+ return {
5703
+ syncCssClasses: syncCssClasses
5704
+ };
5705
+ });
5706
 
5707
+ S2.define('select2/compat/containerCss',[
5708
+ 'jquery',
5709
+ './utils'
5710
+ ], function ($, CompatUtils) {
5711
+ // No-op CSS adapter that discards all classes by default
5712
+ function _containerAdapter (clazz) {
5713
+ return null;
5714
+ }
5715
 
5716
+ function ContainerCSS () { }
 
5717
 
5718
+ ContainerCSS.prototype.render = function (decorated) {
5719
+ var $container = decorated.call(this);
5720
 
5721
+ var containerCssClass = this.options.get('containerCssClass') || '';
5722
 
5723
+ if ($.isFunction(containerCssClass)) {
5724
+ containerCssClass = containerCssClass(this.$element);
5725
+ }
 
5726
 
5727
+ var containerCssAdapter = this.options.get('adaptContainerCssClass');
5728
+ containerCssAdapter = containerCssAdapter || _containerAdapter;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5729
 
5730
+ if (containerCssClass.indexOf(':all:') !== -1) {
5731
+ containerCssClass = containerCssClass.replace(':all:', '');
 
 
5732
 
5733
+ var _cssAdapter = containerCssAdapter;
 
 
5734
 
5735
+ containerCssAdapter = function (clazz) {
5736
+ var adapted = _cssAdapter(clazz);
5737
 
5738
+ if (adapted != null) {
5739
+ // Append the old one along with the adapted one
5740
+ return adapted + ' ' + clazz;
5741
+ }
5742
 
5743
+ return clazz;
5744
+ };
5745
+ }
5746
 
5747
+ var containerCss = this.options.get('containerCss') || {};
5748
 
5749
+ if ($.isFunction(containerCss)) {
5750
+ containerCss = containerCss(this.$element);
5751
+ }
 
 
 
 
 
 
 
5752
 
5753
+ CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5754
 
5755
+ $container.css(containerCss);
5756
+ $container.addClass(containerCssClass);
5757
+
5758
+ return $container;
5759
+ };
5760
+
5761
+ return ContainerCSS;
5762
+ });
5763
+
5764
+ S2.define('select2/compat/dropdownCss',[
5765
+ 'jquery',
5766
+ './utils'
5767
+ ], function ($, CompatUtils) {
5768
+ // No-op CSS adapter that discards all classes by default
5769
+ function _dropdownAdapter (clazz) {
5770
+ return null;
5771
+ }
5772
+
5773
+ function DropdownCSS () { }
5774
+
5775
+ DropdownCSS.prototype.render = function (decorated) {
5776
+ var $dropdown = decorated.call(this);
5777
+
5778
+ var dropdownCssClass = this.options.get('dropdownCssClass') || '';
5779
+
5780
+ if ($.isFunction(dropdownCssClass)) {
5781
+ dropdownCssClass = dropdownCssClass(this.$element);
5782
+ }
5783
+
5784
+ var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
5785
+ dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
5786
+
5787
+ if (dropdownCssClass.indexOf(':all:') !== -1) {
5788
+ dropdownCssClass = dropdownCssClass.replace(':all:', '');
5789
+
5790
+ var _cssAdapter = dropdownCssAdapter;
5791
+
5792
+ dropdownCssAdapter = function (clazz) {
5793
+ var adapted = _cssAdapter(clazz);
5794
+
5795
+ if (adapted != null) {
5796
+ // Append the old one along with the adapted one
5797
+ return adapted + ' ' + clazz;
5798
+ }
5799
+
5800
+ return clazz;
5801
+ };
5802
+ }
5803
+
5804
+ var dropdownCss = this.options.get('dropdownCss') || {};
5805
+
5806
+ if ($.isFunction(dropdownCss)) {
5807
+ dropdownCss = dropdownCss(this.$element);
5808
+ }
5809
+
5810
+ CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
5811
+
5812
+ $dropdown.css(dropdownCss);
5813
+ $dropdown.addClass(dropdownCssClass);
5814
+
5815
+ return $dropdown;
5816
+ };
5817
+
5818
+ return DropdownCSS;
5819
+ });
5820
+
5821
+ S2.define('select2/compat/initSelection',[
5822
+ 'jquery'
5823
+ ], function ($) {
5824
+ function InitSelection (decorated, $element, options) {
5825
+ if (options.get('debug') && window.console && console.warn) {
5826
+ console.warn(
5827
+ 'Select2: The `initSelection` option has been deprecated in favor' +
5828
+ ' of a custom data adapter that overrides the `current` method. ' +
5829
+ 'This method is now called multiple times instead of a single ' +
5830
+ 'time when the instance is initialized. Support will be removed ' +
5831
+ 'for the `initSelection` option in future versions of Select2'
5832
+ );
5833
+ }
5834
+
5835
+ this.initSelection = options.get('initSelection');
5836
+ this._isInitialized = false;
5837
+
5838
+ decorated.call(this, $element, options);
5839
+ }
5840
+
5841
+ InitSelection.prototype.current = function (decorated, callback) {
5842
+ var self = this;
5843
+
5844
+ if (this._isInitialized) {
5845
+ decorated.call(this, callback);
5846
+
5847
+ return;
5848
+ }
5849
+
5850
+ this.initSelection.call(null, this.$element, function (data) {
5851
+ self._isInitialized = true;
5852
+
5853
+ if (!$.isArray(data)) {
5854
+ data = [data];
5855
+ }
5856
+
5857
+ callback(data);
5858
+ });
5859
+ };
5860
+
5861
+ return InitSelection;
5862
+ });
5863
+
5864
+ S2.define('select2/compat/inputData',[
5865
+ 'jquery'
5866
+ ], function ($) {
5867
+ function InputData (decorated, $element, options) {
5868
+ this._currentData = [];
5869
+ this._valueSeparator = options.get('valueSeparator') || ',';
5870
+
5871
+ if ($element.prop('type') === 'hidden') {
5872
+ if (options.get('debug') && console && console.warn) {
5873
+ console.warn(
5874
+ 'Select2: Using a hidden input with Select2 is no longer ' +
5875
+ 'supported and may stop working in the future. It is recommended ' +
5876
+ 'to use a `<select>` element instead.'
5877
+ );
5878
+ }
5879
+ }
5880
+
5881
+ decorated.call(this, $element, options);
5882
+ }
5883
+
5884
+ InputData.prototype.current = function (_, callback) {
5885
+ function getSelected (data, selectedIds) {
5886
+ var selected = [];
5887
+
5888
+ if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
5889
+ data.selected = true;
5890
+ selected.push(data);
5891
+ } else {
5892
+ data.selected = false;
5893
+ }
5894
+
5895
+ if (data.children) {
5896
+ selected.push.apply(selected, getSelected(data.children, selectedIds));
5897
+ }
5898
+
5899
+ return selected;
5900
+ }
5901
+
5902
+ var selected = [];
5903
+
5904
+ for (var d = 0; d < this._currentData.length; d++) {
5905
+ var data = this._currentData[d];
5906
+
5907
+ selected.push.apply(
5908
+ selected,
5909
+ getSelected(
5910
+ data,
5911
+ this.$element.val().split(
5912
+ this._valueSeparator
5913
+ )
5914
+ )
5915
+ );
5916
+ }
5917
+
5918
+ callback(selected);
5919
+ };
5920
+
5921
+ InputData.prototype.select = function (_, data) {
5922
+ if (!this.options.get('multiple')) {
5923
+ this.current(function (allData) {
5924
+ $.map(allData, function (data) {
5925
+ data.selected = false;
5926
+ });
5927
+ });
5928
+
5929
+ this.$element.val(data.id);
5930
+ this.$element.trigger('change');
5931
+ } else {
5932
+ var value = this.$element.val();
5933
+ value += this._valueSeparator + data.id;
5934
+
5935
+ this.$element.val(value);
5936
+ this.$element.trigger('change');
5937
+ }
5938
+ };
5939
+
5940
+ InputData.prototype.unselect = function (_, data) {
5941
+ var self = this;
5942
+
5943
+ data.selected = false;
5944
+
5945
+ this.current(function (allData) {
5946
+ var values = [];
5947
+
5948
+ for (var d = 0; d < allData.length; d++) {
5949
+ var item = allData[d];
5950
+
5951
+ if (data.id == item.id) {
5952
+ continue;
5953
+ }
5954
+
5955
+ values.push(item.id);
5956
+ }
5957
+
5958
+ self.$element.val(values.join(self._valueSeparator));
5959
+ self.$element.trigger('change');
5960
+ });
5961
+ };
5962
+
5963
+ InputData.prototype.query = function (_, params, callback) {
5964
+ var results = [];
5965
+
5966
+ for (var d = 0; d < this._currentData.length; d++) {
5967
+ var data = this._currentData[d];
5968
+
5969
+ var matches = this.matches(params, data);
5970
+
5971
+ if (matches !== null) {
5972
+ results.push(matches);
5973
+ }
5974
+ }
5975
+
5976
+ callback({
5977
+ results: results
5978
+ });
5979
+ };
5980
+
5981
+ InputData.prototype.addOptions = function (_, $options) {
5982
+ var options = $.map($options, function ($option) {
5983
+ return $.data($option[0], 'data');
5984
+ });
5985
+
5986
+ this._currentData.push.apply(this._currentData, options);
5987
+ };
5988
+
5989
+ return InputData;
5990
+ });
5991
+
5992
+ S2.define('select2/compat/matcher',[
5993
+ 'jquery'
5994
+ ], function ($) {
5995
+ function oldMatcher (matcher) {
5996
+ function wrappedMatcher (params, data) {
5997
+ var match = $.extend(true, {}, data);
5998
+
5999
+ if (params.term == null || $.trim(params.term) === '') {
6000
+ return match;
6001
+ }
6002
+
6003
+ if (data.children) {
6004
+ for (var c = data.children.length - 1; c >= 0; c--) {
6005
+ var child = data.children[c];
6006
+
6007
+ // Check if the child object matches
6008
+ // The old matcher returned a boolean true or false
6009
+ var doesMatch = matcher(params.term, child.text, child);
6010
+
6011
+ // If the child didn't match, pop it off
6012
+ if (!doesMatch) {
6013
+ match.children.splice(c, 1);
6014
+ }
6015
+ }
6016
+
6017
+ if (match.children.length > 0) {
6018
+ return match;
6019
+ }
6020
+ }
6021
+
6022
+ if (matcher(params.term, data.text, data)) {
6023
+ return match;
6024
+ }
6025
+
6026
+ return null;
6027
+ }
6028
+
6029
+ return wrappedMatcher;
6030
+ }
6031
+
6032
+ return oldMatcher;
6033
+ });
6034
+
6035
+ S2.define('select2/compat/query',[
6036
+
6037
+ ], function () {
6038
+ function Query (decorated, $element, options) {
6039
+ if (options.get('debug') && window.console && console.warn) {
6040
+ console.warn(
6041
+ 'Select2: The `query` option has been deprecated in favor of a ' +
6042
+ 'custom data adapter that overrides the `query` method. Support ' +
6043
+ 'will be removed for the `query` option in future versions of ' +
6044
+ 'Select2.'
6045
+ );
6046
+ }
6047
+
6048
+ decorated.call(this, $element, options);
6049
+ }
6050
+
6051
+ Query.prototype.query = function (_, params, callback) {
6052
+ params.callback = callback;
6053
+
6054
+ var query = this.options.get('query');
6055
+
6056
+ query.call(null, params);
6057
+ };
6058
+
6059
+ return Query;
6060
+ });
6061
+
6062
+ S2.define('select2/dropdown/attachContainer',[
6063
+
6064
+ ], function () {
6065
+ function AttachContainer (decorated, $element, options) {
6066
+ decorated.call(this, $element, options);
6067
+ }
6068
+
6069
+ AttachContainer.prototype.position =
6070
+ function (decorated, $dropdown, $container) {
6071
+ var $dropdownContainer = $container.find('.dropdown-wrapper');
6072
+ $dropdownContainer.append($dropdown);
6073
+
6074
+ $dropdown.addClass('select2-dropdown--below');
6075
+ $container.addClass('select2-container--below');
6076
+ };
6077
+
6078
+ return AttachContainer;
6079
+ });
6080
+
6081
+ S2.define('select2/dropdown/stopPropagation',[
6082
+
6083
+ ], function () {
6084
+ function StopPropagation () { }
6085
+
6086
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6087
+ decorated.call(this, container, $container);
6088
+
6089
+ var stoppedEvents = [
6090
+ 'blur',
6091
+ 'change',
6092
+ 'click',
6093
+ 'dblclick',
6094
+ 'focus',
6095
+ 'focusin',
6096
+ 'focusout',
6097
+ 'input',
6098
+ 'keydown',
6099
+ 'keyup',
6100
+ 'keypress',
6101
+ 'mousedown',
6102
+ 'mouseenter',
6103
+ 'mouseleave',
6104
+ 'mousemove',
6105
+ 'mouseover',
6106
+ 'mouseup',
6107
+ 'search',
6108
+ 'touchend',
6109
+ 'touchstart'
6110
+ ];
6111
+
6112
+ this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
6113
+ evt.stopPropagation();
6114
+ });
6115
+ };
6116
+
6117
+ return StopPropagation;
6118
+ });
6119
+
6120
+ S2.define('select2/selection/stopPropagation',[
6121
+
6122
+ ], function () {
6123
+ function StopPropagation () { }
6124
+
6125
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6126
+ decorated.call(this, container, $container);
6127
+
6128
+ var stoppedEvents = [
6129
+ 'blur',
6130
+ 'change',
6131
+ 'click',
6132
+ 'dblclick',
6133
+ 'focus',
6134
+ 'focusin',
6135
+ 'focusout',
6136
+ 'input',
6137
+ 'keydown',
6138
+ 'keyup',
6139
+ 'keypress',
6140
+ 'mousedown',
6141
+ 'mouseenter',
6142
+ 'mouseleave',
6143
+ 'mousemove',
6144
+ 'mouseover',
6145
+ 'mouseup',
6146
+ 'search',
6147
+ 'touchend',
6148
+ 'touchstart'
6149
+ ];
6150
+
6151
+ this.$selection.on(stoppedEvents.join(' '), function (evt) {
6152
+ evt.stopPropagation();
6153
+ });
6154
+ };
6155
+
6156
+ return StopPropagation;
6157
+ });
6158
+
6159
+ /*!
6160
  * jQuery Mousewheel 3.1.13
6161
  *
6162
  * Copyright jQuery Foundation and other contributors
6164
  * http://jquery.org/license
6165
  */
6166
 
6167
+ (function (factory) {
6168
+ if ( typeof S2.define === 'function' && S2.define.amd ) {
6169
+ // AMD. Register as an anonymous module.
6170
+ S2.define('jquery-mousewheel',['jquery'], factory);
6171
+ } else if (typeof exports === 'object') {
6172
+ // Node/CommonJS style for Browserify
6173
+ module.exports = factory;
6174
+ } else {
6175
+ // Browser globals
6176
+ factory(jQuery);
6177
+ }
6178
+ }(function ($) {
6179
 
6180
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
6181
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
6182
  ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
6183
+ slice = Array.prototype.slice,
6184
+ nullLowestDeltaTimeout, lowestDelta;
6185
 
6186
+ if ( $.event.fixHooks ) {
6187
+ for ( var i = toFix.length; i; ) {
6188
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
6189
+ }
6190
+ }
6191
+
6192
+ var special = $.event.special.mousewheel = {
6193
+ version: '3.1.12',
6194
+
6195
+ setup: function() {
6196
+ if ( this.addEventListener ) {
6197
+ for ( var i = toBind.length; i; ) {
6198
+ this.addEventListener( toBind[--i], handler, false );
6199
+ }
6200
+ } else {
6201
+ this.onmousewheel = handler;
6202
+ }
6203
+ // Store the line height and page height for this particular element
6204
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
6205
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
6206
+ },
6207
+
6208
+ teardown: function() {
6209
+ if ( this.removeEventListener ) {
6210
+ for ( var i = toBind.length; i; ) {
6211
+ this.removeEventListener( toBind[--i], handler, false );
6212
+ }
6213
+ } else {
6214
+ this.onmousewheel = null;
6215
+ }
6216
+ // Clean up the data we added to the element
6217
+ $.removeData(this, 'mousewheel-line-height');
6218
+ $.removeData(this, 'mousewheel-page-height');
6219
+ },
6220
+
6221
+ getLineHeight: function(elem) {
6222
+ var $elem = $(elem),
6223
+ $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6224
+ if (!$parent.length) {
6225
+ $parent = $('body');
6226
+ }
6227
+ return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6228
+ },
6229
 
6230
+ getPageHeight: function(elem) {
6231
+ return $(elem).height();
6232
+ },
6233
 
6234
+ settings: {
6235
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
6236
+ normalizeOffset: true // calls getBoundingClientRect for each event
 
6237
  }
6238
+ };
6239
+
6240
+ $.fn.extend({
6241
+ mousewheel: function(fn) {
6242
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
6243
+ },
 
6244
 
6245
+ unmousewheel: function(fn) {
6246
+ return this.unbind('mousewheel', fn);
6247
+ }
6248
+ });
6249
+
6250
+
6251
+ function handler(event) {
6252
+ var orgEvent = event || window.event,
6253
+ args = slice.call(arguments, 1),
6254
+ delta = 0,
6255
+ deltaX = 0,
6256
+ deltaY = 0,
6257
+ absDelta = 0,
6258
+ offsetX = 0,
6259
+ offsetY = 0;
6260
+ event = $.event.fix(orgEvent);
6261
+ event.type = 'mousewheel';
6262
+
6263
+ // Old school scrollwheel delta
6264
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
6265
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
6266
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
6267
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
6268
+
6269
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
6270
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
6271
+ deltaX = deltaY * -1;
6272
+ deltaY = 0;
6273
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6274
 
6275
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
6276
+ delta = deltaY === 0 ? deltaX : deltaY;
 
6277
 
6278
+ // New school wheel delta (wheel event)
6279
+ if ( 'deltaY' in orgEvent ) {
6280
+ deltaY = orgEvent.deltaY * -1;
6281
+ delta = deltaY;
6282
+ }
6283
+ if ( 'deltaX' in orgEvent ) {
6284
+ deltaX = orgEvent.deltaX;
6285
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
6286
+ }
6287
 
6288
+ // No change actually happened, no reason to go any further
6289
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
6290
+
6291
+ // Need to convert lines and pages to pixels if we aren't already in pixels
6292
+ // There are three delta modes:
6293
+ // * deltaMode 0 is by pixels, nothing to do
6294
+ // * deltaMode 1 is by lines
6295
+ // * deltaMode 2 is by pages
6296
+ if ( orgEvent.deltaMode === 1 ) {
6297
+ var lineHeight = $.data(this, 'mousewheel-line-height');
6298
+ delta *= lineHeight;
6299
+ deltaY *= lineHeight;
6300
+ deltaX *= lineHeight;
6301
+ } else if ( orgEvent.deltaMode === 2 ) {
6302
+ var pageHeight = $.data(this, 'mousewheel-page-height');
6303
+ delta *= pageHeight;
6304
+ deltaY *= pageHeight;
6305
+ deltaX *= pageHeight;
6306
+ }
6307
 
6308
+ // Store lowest absolute delta to normalize the delta values
6309
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6310
 
6311
+ if ( !lowestDelta || absDelta < lowestDelta ) {
6312
+ lowestDelta = absDelta;
6313
 
6314
+ // Adjust older deltas if necessary
6315
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6316
+ lowestDelta /= 40;
6317
+ }
6318
+ }
 
 
 
 
6319
 
6320
+ // Adjust older deltas if necessary
6321
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6322
+ // Divide all the things by 40!
6323
+ delta /= 40;
6324
+ deltaX /= 40;
6325
+ deltaY /= 40;
6326
+ }
 
 
 
 
 
 
 
 
 
 
 
 
6327
 
6328
+ // Get a whole, normalized value for the deltas
6329
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
6330
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
6331
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
6332
 
6333
+ // Normalise offsetX and offsetY properties
6334
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
6335
+ var boundingRect = this.getBoundingClientRect();
6336
+ offsetX = event.clientX - boundingRect.left;
6337
+ offsetY = event.clientY - boundingRect.top;
6338
+ }
6339
 
6340
+ // Add information to the event object
6341
+ event.deltaX = deltaX;
6342
+ event.deltaY = deltaY;
6343
+ event.deltaFactor = lowestDelta;
6344
+ event.offsetX = offsetX;
6345
+ event.offsetY = offsetY;
6346
+ // Go ahead and set deltaMode to 0 since we converted to pixels
6347
+ // Although this is a little odd since we overwrite the deltaX/Y
6348
+ // properties with normalized deltas.
6349
+ event.deltaMode = 0;
6350
+
6351
+ // Add event and delta to the front of the arguments
6352
+ args.unshift(event, delta, deltaX, deltaY);
6353
+
6354
+ // Clearout lowestDelta after sometime to better
6355
+ // handle multiple device types that give different
6356
+ // a different lowestDelta
6357
+ // Ex: trackpad = 3 and mouse wheel = 120
6358
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
6359
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
6360
+
6361
+ return ($.event.dispatch || $.event.handle).apply(this, args);
6362
  }
 
6363
 
6364
+ function nullLowestDelta() {
6365
+ lowestDelta = null;
6366
+ }
 
 
 
 
6367
 
6368
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
6369
+ // If this is an older event and the delta is divisable by 120,
6370
+ // then we are assuming that the browser is treating this as an
6371
+ // older mouse wheel event and that we should divide the deltas
6372
+ // by 40 to try and get a more usable deltaFactor.
6373
+ // Side note, this actually impacts the reported scroll distance
6374
+ // in older browsers and can cause scrolling to be slower than native.
6375
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
6376
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
6377
+ }
6378
 
6379
+ }));
 
 
 
 
 
6380
 
6381
+ S2.define('jquery.select2',[
6382
+ 'jquery',
6383
+ 'jquery-mousewheel',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6384
 
6385
+ './select2/core',
6386
+ './select2/defaults'
6387
+ ], function ($, _, Select2, Defaults) {
6388
+ if ($.fn.select2 == null) {
6389
+ // All methods that should return the element
6390
+ var thisMethods = ['open', 'close', 'destroy'];
6391
 
6392
+ $.fn.select2 = function (options) {
6393
+ options = options || {};
 
 
 
 
 
 
 
 
6394
 
6395
+ if (typeof options === 'object') {
6396
+ this.each(function () {
6397
+ var instanceOptions = $.extend(true, {}, options);
6398
 
6399
+ var instance = new Select2($(this), instanceOptions);
6400
+ });
 
6401
 
6402
+ return this;
6403
+ } else if (typeof options === 'string') {
6404
+ var ret;
6405
+ var args = Array.prototype.slice.call(arguments, 1);
 
 
6406
 
6407
+ this.each(function () {
6408
+ var instance = $(this).data('select2');
6409
 
6410
+ if (instance == null && window.console && console.error) {
6411
+ console.error(
6412
+ 'The select2(\'' + options + '\') method was called on an ' +
6413
+ 'element that is not using Select2.'
6414
+ );
6415
+ }
6416
 
6417
+ ret = instance[options].apply(instance, args);
6418
+ });
6419
 
6420
+ // Check if we should be returning `this`
6421
+ if ($.inArray(options, thisMethods) > -1) {
6422
+ return this;
6423
+ }
6424
 
6425
+ return ret;
6426
+ } else {
6427
+ throw new Error('Invalid arguments for Select2: ' + options);
6428
+ }
6429
+ };
6430
+ }
6431
 
6432
+ if ($.fn.select2.defaults == null) {
6433
+ $.fn.select2.defaults = Defaults;
6434
+ }
 
 
 
6435
 
6436
+ return Select2;
6437
  });
6438
 
6439
+ // Return the AMD loader configuration so it can be used outside of this file
6440
+ return {
6441
+ define: S2.define,
6442
+ require: S2.require
6443
+ };
6444
+ }());
6445
+
6446
+ // Autoload the jQuery bindings
6447
+ // We know that all of the modules exist above this, so we're safe
6448
+ var select2 = S2.require('jquery.select2');
6449
+
6450
+ // Hold the AMD module references on the jQuery function that was just loaded
6451
+ // This allows Select2 to use the internal loader outside of this file, such
6452
+ // as in the language files.
6453
+ jQuery.fn.select2.amd = S2;
6454
 
6455
+ // Return the Select2 instance for anyone who is importing it.
6456
+ return select2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6457
  }));
js/select2/js/select2.js CHANGED
@@ -1,5725 +1,5746 @@
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
  }));
1
  /*!
2
+ * Select2 4.0.5
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 module === 'object' && module.exports) {
13
+ // Node/CommonJS
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
+ // require('jQuery') returns a factory that requires window to
17
+ // build a jQuery instance, we normalize how we use modules
18
+ // that require this pattern but the window provided is a noop
19
+ // if it's defined (how jquery works)
20
+ if (typeof window !== 'undefined') {
21
+ jQuery = require('jquery');
22
+ }
23
+ else {
24
+ jQuery = require('jquery')(root);
25
+ }
26
+ }
27
+ factory(jQuery);
28
+ return jQuery;
29
+ };
30
+ } else {
31
+ // Browser globals
32
+ factory(jQuery);
33
+ }
34
+ } (function (jQuery) {
35
+ // This is needed so we can catch the AMD loader configuration and use it
36
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
37
+ // returns the AMD loader references.
38
+ var S2 =(function () {
39
+ // Restore the Select2 AMD loader so it can be used
40
+ // Needed mostly in the language files, where the loader is not inserted
41
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
+ var S2 = jQuery.fn.select2.amd;
43
+ }
44
+ var S2;(function () { if (!S2 || !S2.requirejs) {
45
+ if (!S2) { S2 = {}; } else { require = S2; }
46
+ /**
47
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
+ */
50
  //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
  //be followed.
52
+ /*global setTimeout: false */
53
+
54
+ var requirejs, require, define;
55
+ (function (undef) {
56
+ var main, req, makeMap, handlers,
57
+ defined = {},
58
+ waiting = {},
59
+ config = {},
60
+ defining = {},
61
+ hasOwn = Object.prototype.hasOwnProperty,
62
+ aps = [].slice,
63
+ jsSuffixRegExp = /\.js$/;
64
+
65
+ function hasProp(obj, prop) {
66
+ return hasOwn.call(obj, prop);
67
+ }
68
+
69
+ /**
70
+ * Given a relative module name, like ./something, normalize it to
71
+ * a real name that can be mapped to a path.
72
+ * @param {String} name the relative name
73
+ * @param {String} baseName a real name that the name arg is relative
74
+ * to.
75
+ * @returns {String} normalized name
76
+ */
77
+ function normalize(name, baseName) {
78
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
+ baseParts = baseName && baseName.split("/"),
81
+ map = config.map,
82
+ starMap = (map && map['*']) || {};
83
+
84
+ //Adjust any relative paths.
85
+ if (name) {
86
+ name = name.split('/');
87
+ lastIndex = name.length - 1;
88
+
89
+ // If wanting node ID compatibility, strip .js from end
90
+ // of IDs. Have to do this here, and not in nameToUrl
91
+ // because node allows either .js or non .js to map
92
+ // to same file.
93
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
+ }
96
+
97
+ // Starts with a '.' so need the baseName
98
+ if (name[0].charAt(0) === '.' && baseParts) {
99
+ //Convert baseName to array, and lop off the last part,
100
+ //so that . matches that 'directory' and not name of the baseName's
101
+ //module. For instance, baseName of 'one/two/three', maps to
102
+ //'one/two/three.js', but we want the directory, 'one/two' for
103
+ //this normalization.
104
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
+ name = normalizedBaseParts.concat(name);
106
+ }
107
 
108
+ //start trimDots
109
+ for (i = 0; i < name.length; i++) {
110
+ part = name[i];
111
+ if (part === '.') {
112
+ name.splice(i, 1);
113
+ i -= 1;
114
+ } else if (part === '..') {
115
+ // If at the start, or previous value is still ..,
116
+ // keep them so that when converted to a path it may
117
+ // still work when converted to a path, even though
118
+ // as an ID it is less than ideal. In larger point
119
+ // releases, may be better to just kick out an error.
120
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
+ continue;
122
+ } else if (i > 0) {
123
+ name.splice(i - 1, 2);
124
+ i -= 2;
125
+ }
126
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
+ //end trimDots
129
+
130
+ name = name.join('/');
131
  }
 
 
132
 
133
+ //Apply map config if available.
134
+ if ((baseParts || starMap) && map) {
135
+ nameParts = name.split('/');
136
+
137
+ for (i = nameParts.length; i > 0; i -= 1) {
138
+ nameSegment = nameParts.slice(0, i).join("/");
139
+
140
+ if (baseParts) {
141
+ //Find the longest baseName segment match in the config.
142
+ //So, do joins on the biggest to smallest lengths of baseParts.
143
+ for (j = baseParts.length; j > 0; j -= 1) {
144
+ mapValue = map[baseParts.slice(0, j).join('/')];
145
+
146
+ //baseName segment has config, find if it has one for
147
+ //this name.
148
+ if (mapValue) {
149
+ mapValue = mapValue[nameSegment];
150
+ if (mapValue) {
151
+ //Match, update name to the new value.
152
+ foundMap = mapValue;
153
+ foundI = i;
154
+ break;
155
+ }
156
+ }
157
+ }
158
+ }
159
 
160
+ if (foundMap) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  break;
162
  }
163
+
164
+ //Check for a star map match, but just hold on to it,
165
+ //if there is a shorter segment match later in a matching
166
+ //config, then favor over this star map.
167
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
168
+ foundStarMap = starMap[nameSegment];
169
+ starI = i;
170
+ }
171
+ }
172
+
173
+ if (!foundMap && foundStarMap) {
174
+ foundMap = foundStarMap;
175
+ foundI = starI;
176
+ }
177
+
178
+ if (foundMap) {
179
+ nameParts.splice(0, foundI, foundMap);
180
+ name = nameParts.join('/');
181
  }
182
  }
183
+
184
+ return name;
185
  }
186
 
187
+ function makeRequire(relName, forceSync) {
188
+ return function () {
189
+ //A version of a require function that passes a moduleName
190
+ //value for items that may need to
191
+ //look up paths relative to the moduleName
192
+ var args = aps.call(arguments, 0);
193
+
194
+ //If first arg is not require('string'), and there is only
195
+ //one arg, it is the array form without a callback. Insert
196
+ //a null so that the following concat is correct.
197
+ if (typeof args[0] !== 'string' && args.length === 1) {
198
+ args.push(null);
199
+ }
200
+ return req.apply(undef, args.concat([relName, forceSync]));
201
+ };
202
  }
203
 
204
+ function makeNormalize(relName) {
205
+ return function (name) {
206
+ return normalize(name, relName);
207
+ };
 
 
208
  }
 
209
 
210
+ function makeLoad(depName) {
211
+ return function (value) {
212
+ defined[depName] = value;
213
+ };
214
+ }
215
 
216
+ function callDep(name) {
217
+ if (hasProp(waiting, name)) {
218
+ var args = waiting[name];
219
+ delete waiting[name];
220
+ defining[name] = true;
221
+ main.apply(undef, args);
222
+ }
223
 
224
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
+ throw new Error('No ' + name);
226
+ }
227
+ return defined[name];
228
+ }
229
 
230
+ //Turns a plugin!resource to [plugin, resource]
231
+ //with the plugin being undefined if the name
232
+ //did not have a plugin prefix.
233
+ function splitPrefix(name) {
234
+ var prefix,
235
+ index = name ? name.indexOf('!') : -1;
236
+ if (index > -1) {
237
+ prefix = name.substring(0, index);
238
+ name = name.substring(index + 1, name.length);
239
+ }
240
+ return [prefix, name];
241
+ }
 
 
 
 
242
 
243
+ //Creates a parts array for a relName where first part is plugin ID,
244
+ //second part is resource ID. Assumes relName has already been normalized.
245
+ function makeRelParts(relName) {
246
+ return relName ? splitPrefix(relName) : [];
247
+ }
248
 
249
+ /**
250
+ * Makes a name map, normalizing the name, and using a plugin
251
+ * for normalization if necessary. Grabs a ref to plugin
252
+ * too, as an optimization.
253
+ */
254
+ makeMap = function (name, relParts) {
255
+ var plugin,
256
+ parts = splitPrefix(name),
257
+ prefix = parts[0],
258
+ relResourceName = relParts[1];
259
+
260
+ name = parts[1];
261
+
262
+ if (prefix) {
263
+ prefix = normalize(prefix, relResourceName);
264
+ plugin = callDep(prefix);
265
+ }
266
 
267
+ //Normalize according
268
+ if (prefix) {
269
+ if (plugin && plugin.normalize) {
270
+ name = plugin.normalize(name, makeNormalize(relResourceName));
271
+ } else {
272
+ name = normalize(name, relResourceName);
273
+ }
274
+ } else {
275
+ name = normalize(name, relResourceName);
276
+ parts = splitPrefix(name);
277
+ prefix = parts[0];
278
+ name = parts[1];
279
+ if (prefix) {
280
+ plugin = callDep(prefix);
281
+ }
282
+ }
283
 
284
+ //Using ridiculous property names for space reasons
285
+ return {
286
+ f: prefix ? prefix + '!' + name : name, //fullName
287
+ n: name,
288
+ pr: prefix,
289
+ p: plugin
290
+ };
291
+ };
292
+
293
+ function makeConfig(name) {
294
+ return function () {
295
+ return (config && config.config && config.config[name]) || {};
296
+ };
297
+ }
298
 
299
+ handlers = {
300
+ require: function (name) {
301
+ return makeRequire(name);
302
+ },
303
+ exports: function (name) {
304
+ var e = defined[name];
305
+ if (typeof e !== 'undefined') {
306
+ return e;
307
+ } else {
308
+ return (defined[name] = {});
309
+ }
310
+ },
311
+ module: function (name) {
312
+ return {
313
+ id: name,
314
+ uri: '',
315
+ exports: defined[name],
316
+ config: makeConfig(name)
317
+ };
318
+ }
319
+ };
320
+
321
+ main = function (name, deps, callback, relName) {
322
+ var cjsModule, depName, ret, map, i, relParts,
323
+ args = [],
324
+ callbackType = typeof callback,
325
+ usingExports;
326
+
327
+ //Use name if no relName
328
+ relName = relName || name;
329
+ relParts = makeRelParts(relName);
330
+
331
+ //Call the callback to define the module, if necessary.
332
+ if (callbackType === 'undefined' || callbackType === 'function') {
333
+ //Pull out the defined dependencies and pass the ordered
334
+ //values to the callback.
335
+ //Default to [require, exports, module] if no deps
336
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
+ for (i = 0; i < deps.length; i += 1) {
338
+ map = makeMap(deps[i], relParts);
339
+ depName = map.f;
340
+
341
+ //Fast path CommonJS standard dependencies.
342
+ if (depName === "require") {
343
+ args[i] = handlers.require(name);
344
+ } else if (depName === "exports") {
345
+ //CommonJS module spec 1.1
346
+ args[i] = handlers.exports(name);
347
+ usingExports = true;
348
+ } else if (depName === "module") {
349
+ //CommonJS module spec 1.1
350
+ cjsModule = args[i] = handlers.module(name);
351
+ } else if (hasProp(defined, depName) ||
352
+ hasProp(waiting, depName) ||
353
+ hasProp(defining, depName)) {
354
+ args[i] = callDep(depName);
355
+ } else if (map.p) {
356
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
+ args[i] = defined[depName];
358
+ } else {
359
+ throw new Error(name + ' missing ' + depName);
360
+ }
361
+ }
362
 
363
+ ret = callback ? callback.apply(defined[name], args) : undefined;
364
+
365
+ if (name) {
366
+ //If setting exports via "module" is in play,
367
+ //favor that over return value and exports. After that,
368
+ //favor a non-undefined return value over exports use.
369
+ if (cjsModule && cjsModule.exports !== undef &&
370
+ cjsModule.exports !== defined[name]) {
371
+ defined[name] = cjsModule.exports;
372
+ } else if (ret !== undef || !usingExports) {
373
+ //Use the return value from the function.
374
+ defined[name] = ret;
375
+ }
376
+ }
377
+ } else if (name) {
378
+ //May just be an object definition for the module. Only
379
+ //worry about defining if have a module name.
380
+ defined[name] = callback;
381
+ }
382
+ };
383
 
384
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
+ if (typeof deps === "string") {
386
+ if (handlers[deps]) {
387
+ //callback in this case is really relName
388
+ return handlers[deps](callback);
389
+ }
390
+ //Just return the module wanted. In this scenario, the
391
+ //deps arg is the module name, and second arg (if passed)
392
+ //is just the relName.
393
+ //Normalize module name, if it contains . or ..
394
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
395
+ } else if (!deps.splice) {
396
+ //deps is a config object, not an array.
397
+ config = deps;
398
+ if (config.deps) {
399
+ req(config.deps, config.callback);
400
+ }
401
+ if (!callback) {
402
+ return;
403
+ }
404
+
405
+ if (callback.splice) {
406
+ //callback is an array, which means it is a dependency list.
407
+ //Adjust args if there are dependencies
408
+ deps = callback;
409
+ callback = relName;
410
+ relName = null;
411
+ } else {
412
+ deps = undef;
413
+ }
414
+ }
415
+
416
+ //Support require(['a'])
417
+ callback = callback || function () {};
418
+
419
+ //If relName is a function, it is an errback handler,
420
+ //so remove it.
421
+ if (typeof relName === 'function') {
422
+ relName = forceSync;
423
+ forceSync = alt;
424
+ }
425
+
426
+ //Simulate async callback;
427
+ if (forceSync) {
428
+ main(undef, deps, callback, relName);
429
+ } else {
430
+ //Using a non-zero value because of concern for what old browsers
431
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
432
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
+ //If want a value immediately, use require('id') instead -- something
434
+ //that works in almond on the global level, but not guaranteed and
435
+ //unlikely to work in other AMD implementations.
436
+ setTimeout(function () {
437
+ main(undef, deps, callback, relName);
438
+ }, 4);
439
+ }
440
+
441
+ return req;
442
+ };
443
+
444
+ /**
445
+ * Just drops the config on the floor, but returns req in case
446
+ * the config return value is used.
447
+ */
448
+ req.config = function (cfg) {
449
+ return req(cfg);
450
+ };
451
+
452
+ /**
453
+ * Expose module registry for debugging and tooling
454
+ */
455
+ requirejs._defined = defined;
456
+
457
+ define = function (name, deps, callback) {
458
+ if (typeof name !== 'string') {
459
+ throw new Error('See almond README: incorrect module build, no module name');
460
+ }
461
+
462
+ //This module may not have dependencies
463
+ if (!deps.splice) {
464
+ //deps is not an array, so probably means
465
+ //an object literal or factory function for
466
+ //the value. Adjust args.
467
+ callback = deps;
468
+ deps = [];
469
+ }
470
+
471
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
+ waiting[name] = [name, deps, callback];
473
+ }
474
+ };
475
+
476
+ define.amd = {
477
+ jQuery: true
478
+ };
479
+ }());
480
+
481
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
482
  }
483
+ }());
484
+ S2.define("almond", function(){});
485
+
486
+ /* global jQuery:false, $:false */
487
+ S2.define('jquery',[],function () {
488
+ var _$ = jQuery || $;
489
+
490
+ if (_$ == null && console && console.error) {
491
+ console.error(
492
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
494
+ 'web page.'
495
+ );
496
+ }
497
 
498
+ return _$;
499
+ });
 
 
 
 
 
 
500
 
501
+ S2.define('select2/utils',[
502
+ 'jquery'
503
+ ], function ($) {
504
+ var Utils = {};
505
+
506
+ Utils.Extend = function (ChildClass, SuperClass) {
507
+ var __hasProp = {}.hasOwnProperty;
508
+
509
+ function BaseConstructor () {
510
+ this.constructor = ChildClass;
511
+ }
512
+
513
+ for (var key in SuperClass) {
514
+ if (__hasProp.call(SuperClass, key)) {
515
+ ChildClass[key] = SuperClass[key];
516
+ }
517
+ }
518
+
519
+ BaseConstructor.prototype = SuperClass.prototype;
520
+ ChildClass.prototype = new BaseConstructor();
521
+ ChildClass.__super__ = SuperClass.prototype;
522
+
523
+ return ChildClass;
524
+ };
525
+
526
+ function getMethods (theClass) {
527
+ var proto = theClass.prototype;
528
+
529
+ var methods = [];
530
 
531
+ for (var methodName in proto) {
532
+ var m = proto[methodName];
533
+
534
+ if (typeof m !== 'function') {
535
+ continue;
536
+ }
537
+
538
+ if (methodName === 'constructor') {
539
+ continue;
540
+ }
541
+
542
+ methods.push(methodName);
543
+ }
544
+
545
+ return methods;
546
  }
547
+
548
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
549
+ var decoratedMethods = getMethods(DecoratorClass);
550
+ var superMethods = getMethods(SuperClass);
551
+
552
+ function DecoratedClass () {
553
+ var unshift = Array.prototype.unshift;
554
+
555
+ var argCount = DecoratorClass.prototype.constructor.length;
556
+
557
+ var calledConstructor = SuperClass.prototype.constructor;
558
+
559
+ if (argCount > 0) {
560
+ unshift.call(arguments, SuperClass.prototype.constructor);
561
+
562
+ calledConstructor = DecoratorClass.prototype.constructor;
563
+ }
564
+
565
+ calledConstructor.apply(this, arguments);
566
+ }
567
+
568
+ DecoratorClass.displayName = SuperClass.displayName;
569
+
570
+ function ctr () {
571
+ this.constructor = DecoratedClass;
572
+ }
573
+
574
+ DecoratedClass.prototype = new ctr();
575
+
576
+ for (var m = 0; m < superMethods.length; m++) {
577
+ var superMethod = superMethods[m];
578
+
579
+ DecoratedClass.prototype[superMethod] =
580
+ SuperClass.prototype[superMethod];
581
+ }
582
+
583
+ var calledMethod = function (methodName) {
584
+ // Stub out the original method if it's not decorating an actual method
585
+ var originalMethod = function () {};
586
+
587
+ if (methodName in DecoratedClass.prototype) {
588
+ originalMethod = DecoratedClass.prototype[methodName];
589
+ }
590
+
591
+ var decoratedMethod = DecoratorClass.prototype[methodName];
592
+
593
+ return function () {
594
+ var unshift = Array.prototype.unshift;
595
+
596
+ unshift.call(arguments, originalMethod);
597
+
598
+ return decoratedMethod.apply(this, arguments);
599
+ };
600
+ };
601
+
602
+ for (var d = 0; d < decoratedMethods.length; d++) {
603
+ var decoratedMethod = decoratedMethods[d];
604
+
605
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
+ }
607
+
608
+ return DecoratedClass;
609
  };
610
+
611
+ var Observable = function () {
612
+ this.listeners = {};
613
+ };
614
+
615
+ Observable.prototype.on = function (event, callback) {
616
+ this.listeners = this.listeners || {};
617
+
618
+ if (event in this.listeners) {
619
+ this.listeners[event].push(callback);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  } else {
621
+ this.listeners[event] = [callback];
622
  }
623
+ };
624
 
625
+ Observable.prototype.trigger = function (event) {
626
+ var slice = Array.prototype.slice;
627
+ var params = slice.call(arguments, 1);
628
 
629
+ this.listeners = this.listeners || {};
630
+
631
+ // Params should always come in as an array
632
+ if (params == null) {
633
+ params = [];
 
 
 
 
 
634
  }
 
 
 
 
 
 
 
635
 
636
+ // If there are no arguments to the event, use a temporary object
637
+ if (params.length === 0) {
638
+ params.push({});
639
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
640
 
641
+ // Set the `_type` of the first object to the event
642
+ params[0]._type = event;
 
 
 
 
 
 
 
 
643
 
644
+ if (event in this.listeners) {
645
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
646
+ }
647
 
648
+ if ('*' in this.listeners) {
649
+ this.invoke(this.listeners['*'], arguments);
650
+ }
651
+ };
 
 
652
 
653
+ Observable.prototype.invoke = function (listeners, params) {
654
+ for (var i = 0, len = listeners.length; i < len; i++) {
655
+ listeners[i].apply(this, params);
656
+ }
657
+ };
 
 
 
 
 
 
 
 
 
658
 
659
+ Utils.Observable = Observable;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
 
661
+ Utils.generateChars = function (length) {
662
+ var chars = '';
 
 
 
 
 
 
663
 
664
+ for (var i = 0; i < length; i++) {
665
+ var randomChar = Math.floor(Math.random() * 36);
666
+ chars += randomChar.toString(36);
667
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
 
669
+ return chars;
670
+ };
 
 
 
671
 
672
+ Utils.bind = function (func, context) {
673
+ return function () {
674
+ func.apply(context, arguments);
675
+ };
676
+ };
677
 
678
+ Utils._convertData = function (data) {
679
+ for (var originalKey in data) {
680
+ var keys = originalKey.split('-');
681
 
682
+ var dataLevel = data;
 
683
 
684
+ if (keys.length === 1) {
685
+ continue;
686
+ }
687
 
688
+ for (var k = 0; k < keys.length; k++) {
689
+ var key = keys[k];
690
 
691
+ // Lowercase the first letter
692
+ // By default, dash-separated becomes camelCase
693
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
 
695
+ if (!(key in dataLevel)) {
696
+ dataLevel[key] = {};
697
+ }
698
 
699
+ if (k == keys.length - 1) {
700
+ dataLevel[key] = data[originalKey];
701
+ }
702
 
703
+ dataLevel = dataLevel[key];
704
+ }
705
 
706
+ delete data[originalKey];
707
+ }
 
708
 
709
+ return data;
710
+ };
711
 
712
+ Utils.hasScroll = function (index, el) {
713
+ // Adapted from the function created by @ShadowScripter
714
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
+ // The original code can be found at
716
+ // http://codereview.stackexchange.com/q/13338
717
+ // and was designed to be used with the Sizzle selector engine.
718
+
719
+ var $el = $(el);
720
+ var overflowX = el.style.overflowX;
721
+ var overflowY = el.style.overflowY;
722
+
723
+ //Check both x and y declarations
724
+ if (overflowX === overflowY &&
725
+ (overflowY === 'hidden' || overflowY === 'visible')) {
726
+ return false;
727
+ }
728
 
729
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
730
+ return true;
731
+ }
732
 
733
+ return ($el.innerHeight() < el.scrollHeight ||
734
+ $el.innerWidth() < el.scrollWidth);
735
+ };
736
 
737
+ Utils.escapeMarkup = function (markup) {
738
+ var replaceMap = {
739
+ '\\': '&#92;',
740
+ '&': '&amp;',
741
+ '<': '&lt;',
742
+ '>': '&gt;',
743
+ '"': '&quot;',
744
+ '\'': '&#39;',
745
+ '/': '&#47;'
746
+ };
747
+
748
+ // Do not try to escape the markup if it's not a string
749
+ if (typeof markup !== 'string') {
750
+ return markup;
751
+ }
752
 
753
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
+ return replaceMap[match];
755
+ });
756
+ };
757
 
758
+ // Append an array of jQuery nodes to a given element.
759
+ Utils.appendMany = function ($element, $nodes) {
760
+ // jQuery 1.7.x does not support $.fn.append() with an array
761
+ // Fall back to a jQuery object collection using $.fn.add()
762
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
763
+ var $jqNodes = $();
764
 
765
+ $.map($nodes, function (node) {
766
+ $jqNodes = $jqNodes.add(node);
767
+ });
768
 
769
+ $nodes = $jqNodes;
770
+ }
771
 
772
+ $element.append($nodes);
773
+ };
774
 
775
+ return Utils;
776
+ });
 
777
 
778
+ S2.define('select2/results',[
779
+ 'jquery',
780
+ './utils'
781
+ ], function ($, Utils) {
782
+ function Results ($element, options, dataAdapter) {
783
+ this.$element = $element;
784
+ this.data = dataAdapter;
785
+ this.options = options;
786
 
787
+ Results.__super__.constructor.call(this);
788
+ }
 
789
 
790
+ Utils.Extend(Results, Utils.Observable);
791
 
792
+ Results.prototype.render = function () {
793
+ var $results = $(
794
+ '<ul class="select2-results__options" role="tree"></ul>'
795
+ );
796
 
797
+ if (this.options.get('multiple')) {
798
+ $results.attr('aria-multiselectable', 'true');
799
+ }
800
 
801
+ this.$results = $results;
 
 
802
 
803
+ return $results;
804
+ };
805
 
806
+ Results.prototype.clear = function () {
807
+ this.$results.empty();
808
+ };
809
 
810
+ Results.prototype.displayMessage = function (params) {
811
+ var escapeMarkup = this.options.get('escapeMarkup');
812
 
813
+ this.clear();
814
+ this.hideLoading();
 
815
 
816
+ var $message = $(
817
+ '<li role="treeitem" aria-live="assertive"' +
818
+ ' class="select2-results__option"></li>'
819
+ );
820
 
821
+ var message = this.options.get('translations').get(params.message);
 
 
 
 
 
822
 
823
+ $message.append(
824
+ escapeMarkup(
825
+ message(params.args)
826
+ )
827
+ );
828
 
829
+ $message[0].className += ' select2-results__message';
830
 
831
+ this.$results.append($message);
832
+ };
 
 
833
 
834
+ Results.prototype.hideMessages = function () {
835
+ this.$results.find('.select2-results__message').remove();
836
+ };
 
837
 
838
+ Results.prototype.append = function (data) {
839
+ this.hideLoading();
840
 
841
+ var $options = [];
 
 
842
 
843
+ if (data.results == null || data.results.length === 0) {
844
+ if (this.$results.children().length === 0) {
845
+ this.trigger('results:message', {
846
+ message: 'noResults'
847
+ });
848
+ }
849
 
850
+ return;
851
+ }
 
 
 
852
 
853
+ data.results = this.sort(data.results);
854
 
855
+ for (var d = 0; d < data.results.length; d++) {
856
+ var item = data.results[d];
857
 
858
+ var $option = this.option(item);
 
 
 
859
 
860
+ $options.push($option);
861
+ }
862
 
863
+ this.$results.append($options);
864
+ };
 
 
 
865
 
866
+ Results.prototype.position = function ($results, $dropdown) {
867
+ var $resultsContainer = $dropdown.find('.select2-results');
868
+ $resultsContainer.append($results);
869
+ };
870
 
871
+ Results.prototype.sort = function (data) {
872
+ var sorter = this.options.get('sorter');
873
 
874
+ return sorter(data);
875
+ };
 
876
 
877
+ Results.prototype.highlightFirstItem = function () {
878
+ var $options = this.$results
879
+ .find('.select2-results__option[aria-selected]');
880
 
881
+ var $selected = $options.filter('[aria-selected=true]');
 
 
882
 
883
+ // Check if there are any selected options
884
+ if ($selected.length > 0) {
885
+ // If there are selected options, highlight the first
886
+ $selected.first().trigger('mouseenter');
887
+ } else {
888
+ // If there are no selected options, highlight the first option
889
+ // in the dropdown
890
+ $options.first().trigger('mouseenter');
891
+ }
892
 
893
+ this.ensureHighlightVisible();
894
+ };
 
895
 
896
+ Results.prototype.setClasses = function () {
897
+ var self = this;
898
 
899
+ this.data.current(function (selected) {
900
+ var selectedIds = $.map(selected, function (s) {
901
+ return s.id.toString();
902
+ });
903
 
904
+ var $options = self.$results
905
+ .find('.select2-results__option[aria-selected]');
906
 
907
+ $options.each(function () {
908
+ var $option = $(this);
 
 
 
 
909
 
910
+ var item = $.data(this, 'data');
 
 
911
 
912
+ // id needs to be converted to a string when comparing
913
+ var id = '' + item.id;
 
 
 
914
 
915
+ if ((item.element != null && item.element.selected) ||
916
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
917
+ $option.attr('aria-selected', 'true');
918
+ } else {
919
+ $option.attr('aria-selected', 'false');
920
+ }
921
+ });
922
 
923
+ });
924
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
925
 
926
+ Results.prototype.showLoading = function (params) {
927
+ this.hideLoading();
 
 
928
 
929
+ var loadingMore = this.options.get('translations').get('searching');
 
 
 
 
 
930
 
931
+ var loading = {
932
+ disabled: true,
933
+ loading: true,
934
+ text: loadingMore(params)
935
+ };
936
+ var $loading = this.option(loading);
937
+ $loading.className += ' loading-results';
938
 
939
+ this.$results.prepend($loading);
940
+ };
941
 
942
+ Results.prototype.hideLoading = function () {
943
+ this.$results.find('.loading-results').remove();
944
+ };
945
 
946
+ Results.prototype.option = function (data) {
947
+ var option = document.createElement('li');
948
+ option.className = 'select2-results__option';
949
 
950
+ var attrs = {
951
+ 'role': 'treeitem',
952
+ 'aria-selected': 'false'
953
+ };
 
 
 
 
954
 
955
+ if (data.disabled) {
956
+ delete attrs['aria-selected'];
957
+ attrs['aria-disabled'] = 'true';
958
+ }
959
 
960
+ if (data.id == null) {
961
+ delete attrs['aria-selected'];
962
+ }
963
 
964
+ if (data._resultId != null) {
965
+ option.id = data._resultId;
966
+ }
 
967
 
968
+ if (data.title) {
969
+ option.title = data.title;
970
+ }
971
 
972
+ if (data.children) {
973
+ attrs.role = 'group';
974
+ attrs['aria-label'] = data.text;
975
+ delete attrs['aria-selected'];
976
+ }
977
 
978
+ for (var attr in attrs) {
979
+ var val = attrs[attr];
980
 
981
+ option.setAttribute(attr, val);
982
+ }
 
983
 
984
+ if (data.children) {
985
+ var $option = $(option);
986
 
987
+ var label = document.createElement('strong');
988
+ label.className = 'select2-results__group';
989
 
990
+ var $label = $(label);
991
+ this.template(data, label);
 
 
992
 
993
+ var $children = [];
994
 
995
+ for (var c = 0; c < data.children.length; c++) {
996
+ var child = data.children[c];
 
 
 
997
 
998
+ var $child = this.option(child);
999
 
1000
+ $children.push($child);
1001
+ }
1002
 
1003
+ var $childrenContainer = $('<ul></ul>', {
1004
+ 'class': 'select2-results__options select2-results__options--nested'
1005
+ });
1006
 
1007
+ $childrenContainer.append($children);
 
1008
 
1009
+ $option.append(label);
1010
+ $option.append($childrenContainer);
1011
+ } else {
1012
+ this.template(data, option);
1013
+ }
1014
 
1015
+ $.data(option, 'data', data);
 
 
 
 
 
1016
 
1017
+ return option;
1018
+ };
1019
 
1020
+ Results.prototype.bind = function (container, $container) {
1021
+ var self = this;
1022
 
1023
+ var id = container.id + '-results';
 
1024
 
1025
+ this.$results.attr('id', id);
1026
 
1027
+ container.on('results:all', function (params) {
1028
+ self.clear();
1029
+ self.append(params.data);
1030
 
1031
+ if (container.isOpen()) {
1032
+ self.setClasses();
1033
+ self.highlightFirstItem();
1034
+ }
1035
+ });
1036
 
1037
+ container.on('results:append', function (params) {
1038
+ self.append(params.data);
 
 
1039
 
1040
+ if (container.isOpen()) {
1041
+ self.setClasses();
1042
+ }
1043
+ });
1044
 
1045
+ container.on('query', function (params) {
1046
+ self.hideMessages();
1047
+ self.showLoading(params);
1048
+ });
1049
 
1050
+ container.on('select', function () {
1051
+ if (!container.isOpen()) {
1052
+ return;
1053
+ }
1054
 
1055
+ self.setClasses();
1056
+ self.highlightFirstItem();
1057
+ });
1058
 
1059
+ container.on('unselect', function () {
1060
+ if (!container.isOpen()) {
1061
+ return;
1062
+ }
 
 
 
 
 
1063
 
1064
+ self.setClasses();
1065
+ self.highlightFirstItem();
1066
+ });
1067
 
1068
+ container.on('open', function () {
1069
+ // When the dropdown is open, aria-expended="true"
1070
+ self.$results.attr('aria-expanded', 'true');
1071
+ self.$results.attr('aria-hidden', 'false');
1072
 
1073
+ self.setClasses();
1074
+ self.ensureHighlightVisible();
1075
+ });
 
1076
 
1077
+ container.on('close', function () {
1078
+ // When the dropdown is closed, aria-expended="false"
1079
+ self.$results.attr('aria-expanded', 'false');
1080
+ self.$results.attr('aria-hidden', 'true');
1081
+ self.$results.removeAttr('aria-activedescendant');
1082
+ });
1083
 
1084
+ container.on('results:toggle', function () {
1085
+ var $highlighted = self.getHighlightedResults();
1086
 
1087
+ if ($highlighted.length === 0) {
1088
+ return;
1089
+ }
1090
 
1091
+ $highlighted.trigger('mouseup');
1092
+ });
1093
 
1094
+ container.on('results:select', function () {
1095
+ var $highlighted = self.getHighlightedResults();
 
 
 
 
 
1096
 
1097
+ if ($highlighted.length === 0) {
1098
+ return;
1099
+ }
1100
 
1101
+ var data = $highlighted.data('data');
 
1102
 
1103
+ if ($highlighted.attr('aria-selected') == 'true') {
1104
+ self.trigger('close', {});
1105
+ } else {
1106
+ self.trigger('select', {
1107
+ data: data
1108
+ });
1109
+ }
1110
+ });
1111
 
1112
+ container.on('results:previous', function () {
1113
+ var $highlighted = self.getHighlightedResults();
 
 
 
 
 
1114
 
1115
+ var $options = self.$results.find('[aria-selected]');
 
1116
 
1117
+ var currentIndex = $options.index($highlighted);
 
 
1118
 
1119
+ // If we are already at te top, don't move further
1120
+ if (currentIndex === 0) {
1121
+ return;
1122
+ }
1123
 
1124
+ var nextIndex = currentIndex - 1;
 
 
 
1125
 
1126
+ // If none are highlighted, highlight the first
1127
+ if ($highlighted.length === 0) {
1128
+ nextIndex = 0;
1129
+ }
1130
 
1131
+ var $next = $options.eq(nextIndex);
 
 
1132
 
1133
+ $next.trigger('mouseenter');
 
 
1134
 
1135
+ var currentOffset = self.$results.offset().top;
1136
+ var nextTop = $next.offset().top;
1137
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1138
 
1139
+ if (nextIndex === 0) {
1140
+ self.$results.scrollTop(0);
1141
+ } else if (nextTop - currentOffset < 0) {
1142
+ self.$results.scrollTop(nextOffset);
1143
+ }
1144
+ });
1145
 
1146
+ container.on('results:next', function () {
1147
+ var $highlighted = self.getHighlightedResults();
1148
 
1149
+ var $options = self.$results.find('[aria-selected]');
 
1150
 
1151
+ var currentIndex = $options.index($highlighted);
 
1152
 
1153
+ var nextIndex = currentIndex + 1;
 
1154
 
1155
+ // If we are at the last option, stay there
1156
+ if (nextIndex >= $options.length) {
1157
+ return;
1158
+ }
1159
 
1160
+ var $next = $options.eq(nextIndex);
1161
 
1162
+ $next.trigger('mouseenter');
 
1163
 
1164
+ var currentOffset = self.$results.offset().top +
1165
+ self.$results.outerHeight(false);
1166
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1167
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1168
 
1169
+ if (nextIndex === 0) {
1170
+ self.$results.scrollTop(0);
1171
+ } else if (nextBottom > currentOffset) {
1172
+ self.$results.scrollTop(nextOffset);
1173
+ }
1174
+ });
1175
 
1176
+ container.on('results:focus', function (params) {
1177
+ params.element.addClass('select2-results__option--highlighted');
1178
+ });
1179
 
1180
+ container.on('results:message', function (params) {
1181
+ self.displayMessage(params);
1182
+ });
1183
 
1184
+ if ($.fn.mousewheel) {
1185
+ this.$results.on('mousewheel', function (e) {
1186
+ var top = self.$results.scrollTop();
 
 
1187
 
1188
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1189
 
1190
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1191
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1192
 
1193
+ if (isAtTop) {
1194
+ self.$results.scrollTop(0);
1195
 
1196
+ e.preventDefault();
1197
+ e.stopPropagation();
1198
+ } else if (isAtBottom) {
1199
+ self.$results.scrollTop(
1200
+ self.$results.get(0).scrollHeight - self.$results.height()
1201
+ );
1202
 
1203
+ e.preventDefault();
1204
+ e.stopPropagation();
1205
+ }
1206
+ });
1207
+ }
1208
 
1209
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1210
+ function (evt) {
1211
+ var $this = $(this);
1212
 
1213
+ var data = $this.data('data');
 
 
 
 
1214
 
1215
+ if ($this.attr('aria-selected') === 'true') {
1216
+ if (self.options.get('multiple')) {
1217
+ self.trigger('unselect', {
1218
+ originalEvent: evt,
1219
+ data: data
1220
+ });
1221
+ } else {
1222
+ self.trigger('close', {});
1223
+ }
1224
 
1225
+ return;
1226
+ }
 
 
1227
 
1228
+ self.trigger('select', {
1229
+ originalEvent: evt,
1230
+ data: data
1231
+ });
1232
+ });
1233
 
1234
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1235
+ function (evt) {
1236
+ var data = $(this).data('data');
 
1237
 
1238
+ self.getHighlightedResults()
1239
+ .removeClass('select2-results__option--highlighted');
 
1240
 
1241
+ self.trigger('results:focus', {
1242
+ data: data,
1243
+ element: $(this)
1244
+ });
1245
+ });
1246
+ };
1247
 
1248
+ Results.prototype.getHighlightedResults = function () {
1249
+ var $highlighted = this.$results
1250
+ .find('.select2-results__option--highlighted');
1251
 
1252
+ return $highlighted;
1253
+ };
 
 
1254
 
1255
+ Results.prototype.destroy = function () {
1256
+ this.$results.remove();
1257
+ };
1258
 
1259
+ Results.prototype.ensureHighlightVisible = function () {
1260
+ var $highlighted = this.getHighlightedResults();
 
 
 
 
1261
 
1262
+ if ($highlighted.length === 0) {
1263
+ return;
1264
+ }
1265
 
1266
+ var $options = this.$results.find('[aria-selected]');
 
 
1267
 
1268
+ var currentIndex = $options.index($highlighted);
 
1269
 
1270
+ var currentOffset = this.$results.offset().top;
1271
+ var nextTop = $highlighted.offset().top;
1272
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1273
 
1274
+ var offsetDelta = nextTop - currentOffset;
1275
+ nextOffset -= $highlighted.outerHeight(false) * 2;
 
1276
 
1277
+ if (currentIndex <= 2) {
1278
+ this.$results.scrollTop(0);
1279
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1280
+ this.$results.scrollTop(nextOffset);
1281
+ }
1282
+ };
1283
+
1284
+ Results.prototype.template = function (result, container) {
1285
+ var template = this.options.get('templateResult');
1286
+ var escapeMarkup = this.options.get('escapeMarkup');
1287
+
1288
+ var content = template(result, container);
1289
+
1290
+ if (content == null) {
1291
+ container.style.display = 'none';
1292
+ } else if (typeof content === 'string') {
1293
+ container.innerHTML = escapeMarkup(content);
1294
+ } else {
1295
+ $(container).append(content);
1296
+ }
1297
+ };
1298
+
1299
+ return Results;
1300
+ });
1301
 
1302
+ S2.define('select2/keys',[
1303
+
1304
+ ], function () {
1305
+ var KEYS = {
1306
+ BACKSPACE: 8,
1307
+ TAB: 9,
1308
+ ENTER: 13,
1309
+ SHIFT: 16,
1310
+ CTRL: 17,
1311
+ ALT: 18,
1312
+ ESC: 27,
1313
+ SPACE: 32,
1314
+ PAGE_UP: 33,
1315
+ PAGE_DOWN: 34,
1316
+ END: 35,
1317
+ HOME: 36,
1318
+ LEFT: 37,
1319
+ UP: 38,
1320
+ RIGHT: 39,
1321
+ DOWN: 40,
1322
+ DELETE: 46
1323
+ };
1324
+
1325
+ return KEYS;
1326
  });
 
 
1327
 
1328
+ S2.define('select2/selection/base',[
1329
+ 'jquery',
1330
+ '../utils',
1331
+ '../keys'
1332
+ ], function ($, Utils, KEYS) {
1333
+ function BaseSelection ($element, options) {
1334
+ this.$element = $element;
1335
+ this.options = options;
1336
+
1337
+ BaseSelection.__super__.constructor.call(this);
1338
+ }
1339
 
1340
+ Utils.Extend(BaseSelection, Utils.Observable);
1341
 
1342
+ BaseSelection.prototype.render = function () {
1343
+ var $selection = $(
1344
+ '<span class="select2-selection" role="combobox" ' +
1345
+ ' aria-haspopup="true" aria-expanded="false">' +
1346
+ '</span>'
1347
+ );
1348
 
1349
+ this._tabindex = 0;
 
 
 
1350
 
1351
+ if (this.$element.data('old-tabindex') != null) {
1352
+ this._tabindex = this.$element.data('old-tabindex');
1353
+ } else if (this.$element.attr('tabindex') != null) {
1354
+ this._tabindex = this.$element.attr('tabindex');
1355
+ }
1356
 
1357
+ $selection.attr('title', this.$element.attr('title'));
1358
+ $selection.attr('tabindex', this._tabindex);
 
 
1359
 
1360
+ this.$selection = $selection;
1361
 
1362
+ return $selection;
1363
+ };
1364
 
1365
+ BaseSelection.prototype.bind = function (container, $container) {
1366
+ var self = this;
 
1367
 
1368
+ var id = container.id + '-container';
1369
+ var resultsId = container.id + '-results';
 
 
 
 
1370
 
1371
+ this.container = container;
 
1372
 
1373
+ this.$selection.on('focus', function (evt) {
1374
+ self.trigger('focus', evt);
1375
+ });
1376
 
1377
+ this.$selection.on('blur', function (evt) {
1378
+ self._handleBlur(evt);
1379
+ });
1380
 
1381
+ this.$selection.on('keydown', function (evt) {
1382
+ self.trigger('keypress', evt);
1383
 
1384
+ if (evt.which === KEYS.SPACE) {
1385
+ evt.preventDefault();
1386
+ }
1387
+ });
1388
 
1389
+ container.on('results:focus', function (params) {
1390
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1391
+ });
1392
 
1393
+ container.on('selection:update', function (params) {
1394
+ self.update(params.data);
1395
+ });
1396
 
1397
+ container.on('open', function () {
1398
+ // When the dropdown is open, aria-expanded="true"
1399
+ self.$selection.attr('aria-expanded', 'true');
1400
+ self.$selection.attr('aria-owns', resultsId);
1401
 
1402
+ self._attachCloseHandler(container);
1403
+ });
 
 
 
 
1404
 
1405
+ container.on('close', function () {
1406
+ // When the dropdown is closed, aria-expanded="false"
1407
+ self.$selection.attr('aria-expanded', 'false');
1408
+ self.$selection.removeAttr('aria-activedescendant');
1409
+ self.$selection.removeAttr('aria-owns');
1410
 
1411
+ self.$selection.focus();
 
 
1412
 
1413
+ self._detachCloseHandler(container);
1414
+ });
 
1415
 
1416
+ container.on('enable', function () {
1417
+ self.$selection.attr('tabindex', self._tabindex);
1418
+ });
1419
 
1420
+ container.on('disable', function () {
1421
+ self.$selection.attr('tabindex', '-1');
1422
+ });
1423
+ };
1424
 
1425
+ BaseSelection.prototype._handleBlur = function (evt) {
1426
+ var self = this;
1427
+
1428
+ // This needs to be delayed as the active element is the body when the tab
1429
+ // key is pressed, possibly along with others.
1430
+ window.setTimeout(function () {
1431
+ // Don't trigger `blur` if the focus is still in the selection
1432
+ if (
1433
+ (document.activeElement == self.$selection[0]) ||
1434
+ ($.contains(self.$selection[0], document.activeElement))
1435
+ ) {
1436
+ return;
1437
+ }
1438
 
1439
+ self.trigger('blur', evt);
1440
+ }, 1);
1441
+ };
 
 
 
1442
 
1443
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1444
+ var self = this;
 
 
 
1445
 
1446
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1447
+ var $target = $(e.target);
 
1448
 
1449
+ var $select = $target.closest('.select2');
1450
 
1451
+ var $all = $('.select2.select2-container--open');
 
 
 
 
 
 
 
 
1452
 
1453
+ $all.each(function () {
1454
+ var $this = $(this);
1455
 
1456
+ if (this == $select[0]) {
1457
+ return;
1458
+ }
 
 
1459
 
1460
+ var $element = $this.data('element');
 
 
1461
 
1462
+ $element.select2('close');
1463
+ });
1464
+ });
1465
+ };
1466
 
1467
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1468
+ $(document.body).off('mousedown.select2.' + container.id);
1469
+ };
 
 
 
1470
 
1471
+ BaseSelection.prototype.position = function ($selection, $container) {
1472
+ var $selectionContainer = $container.find('.selection');
1473
+ $selectionContainer.append($selection);
1474
+ };
1475
 
1476
+ BaseSelection.prototype.destroy = function () {
1477
+ this._detachCloseHandler(this.container);
1478
+ };
1479
 
1480
+ BaseSelection.prototype.update = function (data) {
1481
+ throw new Error('The `update` method must be defined in child classes.');
1482
+ };
1483
 
1484
+ return BaseSelection;
1485
+ });
1486
 
1487
+ S2.define('select2/selection/single',[
1488
+ 'jquery',
1489
+ './base',
1490
+ '../utils',
1491
+ '../keys'
1492
+ ], function ($, BaseSelection, Utils, KEYS) {
1493
+ function SingleSelection () {
1494
+ SingleSelection.__super__.constructor.apply(this, arguments);
1495
+ }
1496
 
1497
+ Utils.Extend(SingleSelection, BaseSelection);
1498
 
1499
+ SingleSelection.prototype.render = function () {
1500
+ var $selection = SingleSelection.__super__.render.call(this);
1501
 
1502
+ $selection.addClass('select2-selection--single');
 
 
1503
 
1504
+ $selection.html(
1505
+ '<span class="select2-selection__rendered"></span>' +
1506
+ '<span class="select2-selection__arrow" role="presentation">' +
1507
+ '<b role="presentation"></b>' +
1508
+ '</span>'
1509
+ );
1510
 
1511
+ return $selection;
1512
+ };
 
 
 
 
1513
 
1514
+ SingleSelection.prototype.bind = function (container, $container) {
1515
+ var self = this;
 
1516
 
1517
+ SingleSelection.__super__.bind.apply(this, arguments);
1518
 
1519
+ var id = container.id + '-container';
1520
+
1521
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1522
+ this.$selection.attr('aria-labelledby', id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1523
 
1524
+ this.$selection.on('mousedown', function (evt) {
1525
+ // Only respond to left clicks
1526
+ if (evt.which !== 1) {
1527
+ return;
1528
+ }
1529
 
1530
+ self.trigger('toggle', {
1531
+ originalEvent: evt
1532
+ });
1533
+ });
1534
 
1535
+ this.$selection.on('focus', function (evt) {
1536
+ // User focuses on the container
1537
+ });
1538
 
1539
+ this.$selection.on('blur', function (evt) {
1540
+ // User exits the container
1541
+ });
1542
 
1543
+ container.on('focus', function (evt) {
1544
+ if (!container.isOpen()) {
1545
+ self.$selection.focus();
1546
+ }
1547
+ });
1548
 
1549
+ container.on('selection:update', function (params) {
1550
+ self.update(params.data);
1551
+ });
1552
+ };
1553
 
1554
+ SingleSelection.prototype.clear = function () {
1555
+ this.$selection.find('.select2-selection__rendered').empty();
1556
+ };
1557
 
1558
+ SingleSelection.prototype.display = function (data, container) {
1559
+ var template = this.options.get('templateSelection');
1560
+ var escapeMarkup = this.options.get('escapeMarkup');
1561
 
1562
+ return escapeMarkup(template(data, container));
1563
+ };
1564
 
1565
+ SingleSelection.prototype.selectionContainer = function () {
1566
+ return $('<span></span>');
1567
+ };
 
1568
 
1569
+ SingleSelection.prototype.update = function (data) {
1570
+ if (data.length === 0) {
1571
+ this.clear();
1572
+ return;
1573
+ }
1574
 
1575
+ var selection = data[0];
 
 
1576
 
1577
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1578
+ var formatted = this.display(selection, $rendered);
 
 
1579
 
1580
+ $rendered.empty().append(formatted);
1581
+ $rendered.prop('title', selection.title || selection.text);
1582
+ };
1583
 
1584
+ return SingleSelection;
1585
+ });
 
 
 
1586
 
1587
+ S2.define('select2/selection/multiple',[
1588
+ 'jquery',
1589
+ './base',
1590
+ '../utils'
1591
+ ], function ($, BaseSelection, Utils) {
1592
+ function MultipleSelection ($element, options) {
1593
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1594
+ }
1595
 
1596
+ Utils.Extend(MultipleSelection, BaseSelection);
 
1597
 
1598
+ MultipleSelection.prototype.render = function () {
1599
+ var $selection = MultipleSelection.__super__.render.call(this);
 
1600
 
1601
+ $selection.addClass('select2-selection--multiple');
 
 
 
1602
 
1603
+ $selection.html(
1604
+ '<ul class="select2-selection__rendered"></ul>'
1605
+ );
1606
 
1607
+ return $selection;
1608
+ };
 
 
 
 
 
 
 
 
1609
 
1610
+ MultipleSelection.prototype.bind = function (container, $container) {
1611
+ var self = this;
 
1612
 
1613
+ MultipleSelection.__super__.bind.apply(this, arguments);
 
1614
 
1615
+ this.$selection.on('click', function (evt) {
1616
+ self.trigger('toggle', {
1617
+ originalEvent: evt
1618
+ });
1619
+ });
1620
 
1621
+ this.$selection.on(
1622
+ 'click',
1623
+ '.select2-selection__choice__remove',
1624
+ function (evt) {
1625
+ // Ignore the event if it is disabled
1626
+ if (self.options.get('disabled')) {
1627
+ return;
1628
+ }
1629
 
1630
+ var $remove = $(this);
1631
+ var $selection = $remove.parent();
1632
 
1633
+ var data = $selection.data('data');
 
1634
 
1635
+ self.trigger('unselect', {
1636
+ originalEvent: evt,
1637
+ data: data
1638
+ });
1639
+ }
1640
+ );
1641
+ };
1642
 
1643
+ MultipleSelection.prototype.clear = function () {
1644
+ this.$selection.find('.select2-selection__rendered').empty();
1645
+ };
1646
 
1647
+ MultipleSelection.prototype.display = function (data, container) {
1648
+ var template = this.options.get('templateSelection');
1649
+ var escapeMarkup = this.options.get('escapeMarkup');
 
1650
 
1651
+ return escapeMarkup(template(data, container));
1652
+ };
 
1653
 
1654
+ MultipleSelection.prototype.selectionContainer = function () {
1655
+ var $container = $(
1656
+ '<li class="select2-selection__choice">' +
1657
+ '<span class="select2-selection__choice__remove" role="presentation">' +
1658
+ '&times;' +
1659
+ '</span>' +
1660
+ '</li>'
1661
+ );
1662
 
1663
+ return $container;
1664
+ };
 
1665
 
1666
+ MultipleSelection.prototype.update = function (data) {
1667
+ this.clear();
 
1668
 
1669
+ if (data.length === 0) {
1670
+ return;
1671
+ }
1672
 
1673
+ var $selections = [];
 
 
 
 
 
 
 
 
1674
 
1675
+ for (var d = 0; d < data.length; d++) {
1676
+ var selection = data[d];
1677
 
1678
+ var $selection = this.selectionContainer();
1679
+ var formatted = this.display(selection, $selection);
1680
 
1681
+ $selection.append(formatted);
1682
+ $selection.prop('title', selection.title || selection.text);
1683
 
1684
+ $selection.data('data', selection);
 
 
 
 
 
1685
 
1686
+ $selections.push($selection);
1687
+ }
1688
 
1689
+ var $rendered = this.$selection.find('.select2-selection__rendered');
 
1690
 
1691
+ Utils.appendMany($rendered, $selections);
1692
+ };
1693
 
1694
+ return MultipleSelection;
1695
+ });
1696
 
1697
+ S2.define('select2/selection/placeholder',[
1698
+ '../utils'
1699
+ ], function (Utils) {
1700
+ function Placeholder (decorated, $element, options) {
1701
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1702
 
1703
+ decorated.call(this, $element, options);
1704
+ }
 
 
 
1705
 
1706
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1707
+ if (typeof placeholder === 'string') {
1708
+ placeholder = {
1709
+ id: '',
1710
+ text: placeholder
1711
+ };
1712
+ }
1713
 
1714
+ return placeholder;
1715
+ };
 
1716
 
1717
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1718
+ var $placeholder = this.selectionContainer();
 
1719
 
1720
+ $placeholder.html(this.display(placeholder));
1721
+ $placeholder.addClass('select2-selection__placeholder')
1722
+ .removeClass('select2-selection__choice');
 
 
1723
 
1724
+ return $placeholder;
1725
+ };
 
 
1726
 
1727
+ Placeholder.prototype.update = function (decorated, data) {
1728
+ var singlePlaceholder = (
1729
+ data.length == 1 && data[0].id != this.placeholder.id
1730
+ );
1731
+ var multipleSelections = data.length > 1;
1732
 
1733
+ if (multipleSelections || singlePlaceholder) {
1734
+ return decorated.call(this, data);
1735
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
1736
 
1737
+ this.clear();
1738
 
1739
+ var $placeholder = this.createPlaceholder(this.placeholder);
 
1740
 
1741
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1742
+ };
 
1743
 
1744
+ return Placeholder;
1745
+ });
1746
 
1747
+ S2.define('select2/selection/allowClear',[
1748
+ 'jquery',
1749
+ '../keys'
1750
+ ], function ($, KEYS) {
1751
+ function AllowClear () { }
 
 
 
1752
 
1753
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1754
+ var self = this;
1755
 
1756
+ decorated.call(this, container, $container);
 
1757
 
1758
+ if (this.placeholder == null) {
1759
+ if (this.options.get('debug') && window.console && console.error) {
1760
+ console.error(
1761
+ 'Select2: The `allowClear` option should be used in combination ' +
1762
+ 'with the `placeholder` option.'
1763
+ );
1764
+ }
1765
+ }
1766
 
1767
+ this.$selection.on('mousedown', '.select2-selection__clear',
1768
+ function (evt) {
1769
+ self._handleClear(evt);
1770
+ });
1771
 
1772
+ container.on('keypress', function (evt) {
1773
+ self._handleKeyboardClear(evt, container);
1774
+ });
1775
+ };
1776
 
1777
+ AllowClear.prototype._handleClear = function (_, evt) {
1778
+ // Ignore the event if it is disabled
1779
+ if (this.options.get('disabled')) {
1780
+ return;
1781
+ }
1782
 
1783
+ var $clear = this.$selection.find('.select2-selection__clear');
1784
 
1785
+ // Ignore the event if nothing has been selected
1786
+ if ($clear.length === 0) {
1787
+ return;
1788
+ }
 
1789
 
1790
+ evt.stopPropagation();
 
 
 
 
 
 
 
1791
 
1792
+ var data = $clear.data('data');
 
1793
 
1794
+ for (var d = 0; d < data.length; d++) {
1795
+ var unselectData = {
1796
+ data: data[d]
1797
+ };
1798
+
1799
+ // Trigger the `unselect` event, so people can prevent it from being
1800
+ // cleared.
1801
+ this.trigger('unselect', unselectData);
1802
+
1803
+ // If the event was prevented, don't clear it out.
1804
+ if (unselectData.prevented) {
1805
+ return;
1806
+ }
1807
+ }
1808
+
1809
+ this.$element.val(this.placeholder.id).trigger('change');
1810
+
1811
+ this.trigger('toggle', {});
1812
+ };
1813
+
1814
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1815
+ if (container.isOpen()) {
1816
+ return;
1817
+ }
1818
+
1819
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1820
+ this._handleClear(evt);
1821
+ }
1822
+ };
1823
+
1824
+ AllowClear.prototype.update = function (decorated, data) {
1825
+ decorated.call(this, data);
1826
+
1827
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1828
+ data.length === 0) {
1829
+ return;
1830
+ }
1831
 
1832
+ var $remove = $(
1833
+ '<span class="select2-selection__clear">' +
1834
+ '&times;' +
1835
+ '</span>'
1836
+ );
1837
+ $remove.data('data', data);
1838
+
1839
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1840
+ };
1841
+
1842
+ return AllowClear;
1843
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1844
 
1845
+ S2.define('select2/selection/search',[
1846
+ 'jquery',
1847
+ '../utils',
1848
+ '../keys'
1849
+ ], function ($, Utils, KEYS) {
1850
+ function Search (decorated, $element, options) {
1851
+ decorated.call(this, $element, options);
1852
+ }
1853
 
1854
+ Search.prototype.render = function (decorated) {
1855
+ var $search = $(
1856
+ '<li class="select2-search select2-search--inline">' +
1857
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
1858
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
1859
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1860
+ '</li>'
1861
+ );
1862
 
1863
+ this.$searchContainer = $search;
1864
+ this.$search = $search.find('input');
1865
 
1866
+ var $rendered = decorated.call(this);
 
1867
 
1868
+ this._transferTabIndex();
1869
 
1870
+ return $rendered;
1871
+ };
1872
 
1873
+ Search.prototype.bind = function (decorated, container, $container) {
1874
+ var self = this;
1875
 
1876
+ decorated.call(this, container, $container);
 
1877
 
1878
+ container.on('open', function () {
1879
+ self.$search.trigger('focus');
1880
+ });
1881
 
1882
+ container.on('close', function () {
1883
+ self.$search.val('');
1884
+ self.$search.removeAttr('aria-activedescendant');
1885
+ self.$search.trigger('focus');
1886
+ });
1887
 
1888
+ container.on('enable', function () {
1889
+ self.$search.prop('disabled', false);
1890
 
1891
+ self._transferTabIndex();
1892
+ });
 
 
 
 
 
1893
 
1894
+ container.on('disable', function () {
1895
+ self.$search.prop('disabled', true);
1896
+ });
1897
 
1898
+ container.on('focus', function (evt) {
1899
+ self.$search.trigger('focus');
1900
+ });
1901
 
1902
+ container.on('results:focus', function (params) {
1903
+ self.$search.attr('aria-activedescendant', params.id);
1904
+ });
1905
 
1906
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1907
+ self.trigger('focus', evt);
1908
+ });
1909
 
1910
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1911
+ self._handleBlur(evt);
1912
+ });
 
 
1913
 
1914
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1915
+ evt.stopPropagation();
1916
+
1917
+ self.trigger('keypress', evt);
1918
+
1919
+ self._keyUpPrevented = evt.isDefaultPrevented();
1920
+
1921
+ var key = evt.which;
1922
+
1923
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1924
+ var $previousChoice = self.$searchContainer
1925
+ .prev('.select2-selection__choice');
1926
+
1927
+ if ($previousChoice.length > 0) {
1928
+ var item = $previousChoice.data('data');
1929
+
1930
+ self.searchRemoveChoice(item);
1931
+
1932
+ evt.preventDefault();
1933
+ }
1934
+ }
1935
+ });
1936
+
1937
+ // Try to detect the IE version should the `documentMode` property that
1938
+ // is stored on the document. This is only implemented in IE and is
1939
+ // slightly cleaner than doing a user agent check.
1940
+ // This property is not available in Edge, but Edge also doesn't have
1941
+ // this bug.
1942
+ var msie = document.documentMode;
1943
+ var disableInputEvents = msie && msie <= 11;
1944
+
1945
+ // Workaround for browsers which do not support the `input` event
1946
+ // This will prevent double-triggering of events for browsers which support
1947
+ // both the `keyup` and `input` events.
1948
+ this.$selection.on(
1949
+ 'input.searchcheck',
1950
+ '.select2-search--inline',
1951
+ function (evt) {
1952
+ // IE will trigger the `input` event when a placeholder is used on a
1953
+ // search box. To get around this issue, we are forced to ignore all
1954
+ // `input` events in IE and keep using `keyup`.
1955
+ if (disableInputEvents) {
1956
+ self.$selection.off('input.search input.searchcheck');
1957
+ return;
1958
+ }
1959
+
1960
+ // Unbind the duplicated `keyup` event
1961
+ self.$selection.off('keyup.search');
1962
+ }
1963
+ );
1964
+
1965
+ this.$selection.on(
1966
+ 'keyup.search input.search',
1967
+ '.select2-search--inline',
1968
+ function (evt) {
1969
+ // IE will trigger the `input` event when a placeholder is used on a
1970
+ // search box. To get around this issue, we are forced to ignore all
1971
+ // `input` events in IE and keep using `keyup`.
1972
+ if (disableInputEvents && evt.type === 'input') {
1973
+ self.$selection.off('input.search input.searchcheck');
1974
+ return;
1975
+ }
1976
+
1977
+ var key = evt.which;
1978
+
1979
+ // We can freely ignore events from modifier keys
1980
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1981
+ return;
1982
+ }
1983
+
1984
+ // Tabbing will be handled during the `keydown` phase
1985
+ if (key == KEYS.TAB) {
1986
+ return;
1987
+ }
1988
+
1989
+ self.handleSearch(evt);
1990
+ }
1991
+ );
1992
+ };
1993
+
1994
+ /**
1995
+ * This method will transfer the tabindex attribute from the rendered
1996
+ * selection to the search box. This allows for the search box to be used as
1997
+ * the primary focus instead of the selection container.
1998
+ *
1999
+ * @private
2000
+ */
2001
+ Search.prototype._transferTabIndex = function (decorated) {
2002
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2003
+ this.$selection.attr('tabindex', '-1');
2004
+ };
2005
+
2006
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2007
+ this.$search.attr('placeholder', placeholder.text);
2008
+ };
2009
+
2010
+ Search.prototype.update = function (decorated, data) {
2011
+ var searchHadFocus = this.$search[0] == document.activeElement;
2012
+
2013
+ this.$search.attr('placeholder', '');
2014
+
2015
+ decorated.call(this, data);
2016
+
2017
+ this.$selection.find('.select2-selection__rendered')
2018
+ .append(this.$searchContainer);
2019
+
2020
+ this.resizeSearch();
2021
+ if (searchHadFocus) {
2022
+ this.$search.focus();
2023
+ }
2024
+ };
2025
+
2026
+ Search.prototype.handleSearch = function () {
2027
+ this.resizeSearch();
2028
+
2029
+ if (!this._keyUpPrevented) {
2030
+ var input = this.$search.val();
2031
+
2032
+ this.trigger('query', {
2033
+ term: input
2034
+ });
2035
+ }
2036
+
2037
+ this._keyUpPrevented = false;
2038
+ };
2039
+
2040
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2041
+ this.trigger('unselect', {
2042
+ data: item
2043
+ });
2044
+
2045
+ this.$search.val(item.text);
2046
+ this.handleSearch();
2047
+ };
2048
 
2049
+ Search.prototype.resizeSearch = function () {
2050
+ this.$search.css('width', '25px');
2051
 
2052
+ var width = '';
2053
 
2054
+ if (this.$search.attr('placeholder') !== '') {
2055
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2056
+ } else {
2057
+ var minimumWidth = this.$search.val().length + 1;
2058
 
2059
+ width = (minimumWidth * 0.75) + 'em';
2060
+ }
2061
 
2062
+ this.$search.css('width', width);
2063
+ };
 
 
 
2064
 
2065
+ return Search;
2066
+ });
2067
 
2068
+ S2.define('select2/selection/eventRelay',[
2069
+ 'jquery'
2070
+ ], function ($) {
2071
+ function EventRelay () { }
2072
 
2073
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2074
+ var self = this;
2075
+ var relayEvents = [
2076
+ 'open', 'opening',
2077
+ 'close', 'closing',
2078
+ 'select', 'selecting',
2079
+ 'unselect', 'unselecting'
2080
+ ];
2081
 
2082
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
 
 
 
2083
 
2084
+ decorated.call(this, container, $container);
 
 
 
2085
 
2086
+ container.on('*', function (name, params) {
2087
+ // Ignore events that should not be relayed
2088
+ if ($.inArray(name, relayEvents) === -1) {
2089
+ return;
2090
+ }
2091
 
2092
+ // The parameters should always be an object
2093
+ params = params || {};
2094
 
2095
+ // Generate the jQuery event for the Select2 event
2096
+ var evt = $.Event('select2:' + name, {
2097
+ params: params
2098
+ });
2099
 
2100
+ self.$element.trigger(evt);
2101
 
2102
+ // Only handle preventable events if it was one
2103
+ if ($.inArray(name, preventableEvents) === -1) {
2104
+ return;
2105
+ }
2106
 
2107
+ params.prevented = evt.isDefaultPrevented();
2108
+ });
2109
+ };
 
2110
 
2111
+ return EventRelay;
2112
+ });
 
2113
 
2114
+ S2.define('select2/translation',[
2115
+ 'jquery',
2116
+ 'require'
2117
+ ], function ($, require) {
2118
+ function Translation (dict) {
2119
+ this.dict = dict || {};
2120
+ }
2121
 
2122
+ Translation.prototype.all = function () {
2123
+ return this.dict;
2124
+ };
2125
 
2126
+ Translation.prototype.get = function (key) {
2127
+ return this.dict[key];
2128
+ };
2129
 
2130
+ Translation.prototype.extend = function (translation) {
2131
+ this.dict = $.extend({}, translation.all(), this.dict);
2132
+ };
 
2133
 
2134
+ // Static functions
 
 
 
2135
 
2136
+ Translation._cache = {};
 
2137
 
2138
+ Translation.loadPath = function (path) {
2139
+ if (!(path in Translation._cache)) {
2140
+ var translations = require(path);
 
2141
 
2142
+ Translation._cache[path] = translations;
2143
+ }
 
 
 
 
2144
 
2145
+ return new Translation(Translation._cache[path]);
2146
+ };
2147
 
2148
+ return Translation;
2149
+ });
2150
 
2151
+ S2.define('select2/diacritics',[
2152
+
2153
+ ], function () {
2154
+ var diacritics = {
2155
+ '\u24B6': 'A',
2156
+ '\uFF21': 'A',
2157
+ '\u00C0': 'A',
2158
+ '\u00C1': 'A',
2159
+ '\u00C2': 'A',
2160
+ '\u1EA6': 'A',
2161
+ '\u1EA4': 'A',
2162
+ '\u1EAA': 'A',
2163
+ '\u1EA8': 'A',
2164
+ '\u00C3': 'A',
2165
+ '\u0100': 'A',
2166
+ '\u0102': 'A',
2167
+ '\u1EB0': 'A',
2168
+ '\u1EAE': 'A',
2169
+ '\u1EB4': 'A',
2170
+ '\u1EB2': 'A',
2171
+ '\u0226': 'A',
2172
+ '\u01E0': 'A',
2173
+ '\u00C4': 'A',
2174
+ '\u01DE': 'A',
2175
+ '\u1EA2': 'A',
2176
+ '\u00C5': 'A',
2177
+ '\u01FA': 'A',
2178
+ '\u01CD': 'A',
2179
+ '\u0200': 'A',
2180
+ '\u0202': 'A',
2181
+ '\u1EA0': 'A',
2182
+ '\u1EAC': 'A',
2183
+ '\u1EB6': 'A',
2184
+ '\u1E00': 'A',
2185
+ '\u0104': 'A',
2186
+ '\u023A': 'A',
2187
+ '\u2C6F': 'A',
2188
+ '\uA732': 'AA',
2189
+ '\u00C6': 'AE',
2190
+ '\u01FC': 'AE',
2191
+ '\u01E2': 'AE',
2192
+ '\uA734': 'AO',
2193
+ '\uA736': 'AU',
2194
+ '\uA738': 'AV',
2195
+ '\uA73A': 'AV',
2196
+ '\uA73C': 'AY',
2197
+ '\u24B7': 'B',
2198
+ '\uFF22': 'B',
2199
+ '\u1E02': 'B',
2200
+ '\u1E04': 'B',
2201
+ '\u1E06': 'B',
2202
+ '\u0243': 'B',
2203
+ '\u0182': 'B',
2204
+ '\u0181': 'B',
2205
+ '\u24B8': 'C',
2206
+ '\uFF23': 'C',
2207
+ '\u0106': 'C',
2208
+ '\u0108': 'C',
2209
+ '\u010A': 'C',
2210
+ '\u010C': 'C',
2211
+ '\u00C7': 'C',
2212
+ '\u1E08': 'C',
2213
+ '\u0187': 'C',
2214
+ '\u023B': 'C',
2215
+ '\uA73E': 'C',
2216
+ '\u24B9': 'D',
2217
+ '\uFF24': 'D',
2218
+ '\u1E0A': 'D',
2219
+ '\u010E': 'D',
2220
+ '\u1E0C': 'D',
2221
+ '\u1E10': 'D',
2222
+ '\u1E12': 'D',
2223
+ '\u1E0E': 'D',
2224
+ '\u0110': 'D',
2225
+ '\u018B': 'D',
2226
+ '\u018A': 'D',
2227
+ '\u0189': 'D',
2228
+ '\uA779': 'D',
2229
+ '\u01F1': 'DZ',
2230
+ '\u01C4': 'DZ',
2231
+ '\u01F2': 'Dz',
2232
+ '\u01C5': 'Dz',
2233
+ '\u24BA': 'E',
2234
+ '\uFF25': 'E',
2235
+ '\u00C8': 'E',
2236
+ '\u00C9': 'E',
2237
+ '\u00CA': 'E',
2238
+ '\u1EC0': 'E',
2239
+ '\u1EBE': 'E',
2240
+ '\u1EC4': 'E',
2241
+ '\u1EC2': 'E',
2242
+ '\u1EBC': 'E',
2243
+ '\u0112': 'E',
2244
+ '\u1E14': 'E',
2245
+ '\u1E16': 'E',
2246
+ '\u0114': 'E',
2247
+ '\u0116': 'E',
2248
+ '\u00CB': 'E',
2249
+ '\u1EBA': 'E',
2250
+ '\u011A': 'E',
2251
+ '\u0204': 'E',
2252
+ '\u0206': 'E',
2253
+ '\u1EB8': 'E',
2254
+ '\u1EC6': 'E',
2255
+ '\u0228': 'E',
2256
+ '\u1E1C': 'E',
2257
+ '\u0118': 'E',
2258
+ '\u1E18': 'E',
2259
+ '\u1E1A': 'E',
2260
+ '\u0190': 'E',
2261
+ '\u018E': 'E',
2262
+ '\u24BB': 'F',
2263
+ '\uFF26': 'F',
2264
+ '\u1E1E': 'F',
2265
+ '\u0191': 'F',
2266
+ '\uA77B': 'F',
2267
+ '\u24BC': 'G',
2268
+ '\uFF27': 'G',
2269
+ '\u01F4': 'G',
2270
+ '\u011C': 'G',
2271
+ '\u1E20': 'G',
2272
+ '\u011E': 'G',
2273
+ '\u0120': 'G',
2274
+ '\u01E6': 'G',
2275
+ '\u0122': 'G',
2276
+ '\u01E4': 'G',
2277
+ '\u0193': 'G',
2278
+ '\uA7A0': 'G',
2279
+ '\uA77D': 'G',
2280
+ '\uA77E': 'G',
2281
+ '\u24BD': 'H',
2282
+ '\uFF28': 'H',
2283
+ '\u0124': 'H',
2284
+ '\u1E22': 'H',
2285
+ '\u1E26': 'H',
2286
+ '\u021E': 'H',
2287
+ '\u1E24': 'H',
2288
+ '\u1E28': 'H',
2289
+ '\u1E2A': 'H',
2290
+ '\u0126': 'H',
2291
+ '\u2C67': 'H',
2292
+ '\u2C75': 'H',
2293
+ '\uA78D': 'H',
2294
+ '\u24BE': 'I',
2295
+ '\uFF29': 'I',
2296
+ '\u00CC': 'I',
2297
+ '\u00CD': 'I',
2298
+ '\u00CE': 'I',
2299
+ '\u0128': 'I',
2300
+ '\u012A': 'I',
2301
+ '\u012C': 'I',
2302
+ '\u0130': 'I',
2303
+ '\u00CF': 'I',
2304
+ '\u1E2E': 'I',
2305
+ '\u1EC8': 'I',
2306
+ '\u01CF': 'I',
2307
+ '\u0208': 'I',
2308
+ '\u020A': 'I',
2309
+ '\u1ECA': 'I',
2310
+ '\u012E': 'I',
2311
+ '\u1E2C': 'I',
2312
+ '\u0197': 'I',
2313
+ '\u24BF': 'J',
2314
+ '\uFF2A': 'J',
2315
+ '\u0134': 'J',
2316
+ '\u0248': 'J',
2317
+ '\u24C0': 'K',
2318
+ '\uFF2B': 'K',
2319
+ '\u1E30': 'K',
2320
+ '\u01E8': 'K',
2321
+ '\u1E32': 'K',
2322
+ '\u0136': 'K',
2323
+ '\u1E34': 'K',
2324
+ '\u0198': 'K',
2325
+ '\u2C69': 'K',
2326
+ '\uA740': 'K',
2327
+ '\uA742': 'K',
2328
+ '\uA744': 'K',
2329
+ '\uA7A2': 'K',
2330
+ '\u24C1': 'L',
2331
+ '\uFF2C': 'L',
2332
+ '\u013F': 'L',
2333
+ '\u0139': 'L',
2334
+ '\u013D': 'L',
2335
+ '\u1E36': 'L',
2336
+ '\u1E38': 'L',
2337
+ '\u013B': 'L',
2338
+ '\u1E3C': 'L',
2339
+ '\u1E3A': 'L',
2340
+ '\u0141': 'L',
2341
+ '\u023D': 'L',
2342
+ '\u2C62': 'L',
2343
+ '\u2C60': 'L',
2344
+ '\uA748': 'L',
2345
+ '\uA746': 'L',
2346
+ '\uA780': 'L',
2347
+ '\u01C7': 'LJ',
2348
+ '\u01C8': 'Lj',
2349
+ '\u24C2': 'M',
2350
+ '\uFF2D': 'M',
2351
+ '\u1E3E': 'M',
2352
+ '\u1E40': 'M',
2353
+ '\u1E42': 'M',
2354
+ '\u2C6E': 'M',
2355
+ '\u019C': 'M',
2356
+ '\u24C3': 'N',
2357
+ '\uFF2E': 'N',
2358
+ '\u01F8': 'N',
2359
+ '\u0143': 'N',
2360
+ '\u00D1': 'N',
2361
+ '\u1E44': 'N',
2362
+ '\u0147': 'N',
2363
+ '\u1E46': 'N',
2364
+ '\u0145': 'N',
2365
+ '\u1E4A': 'N',
2366
+ '\u1E48': 'N',
2367
+ '\u0220': 'N',
2368
+ '\u019D': 'N',
2369
+ '\uA790': 'N',
2370
+ '\uA7A4': 'N',
2371
+ '\u01CA': 'NJ',
2372
+ '\u01CB': 'Nj',
2373
+ '\u24C4': 'O',
2374
+ '\uFF2F': 'O',
2375
+ '\u00D2': 'O',
2376
+ '\u00D3': 'O',
2377
+ '\u00D4': 'O',
2378
+ '\u1ED2': 'O',
2379
+ '\u1ED0': 'O',
2380
+ '\u1ED6': 'O',
2381
+ '\u1ED4': 'O',
2382
+ '\u00D5': 'O',
2383
+ '\u1E4C': 'O',
2384
+ '\u022C': 'O',
2385
+ '\u1E4E': 'O',
2386
+ '\u014C': 'O',
2387
+ '\u1E50': 'O',
2388
+ '\u1E52': 'O',
2389
+ '\u014E': 'O',
2390
+ '\u022E': 'O',
2391
+ '\u0230': 'O',
2392
+ '\u00D6': 'O',
2393
+ '\u022A': 'O',
2394
+ '\u1ECE': 'O',
2395
+ '\u0150': 'O',
2396
+ '\u01D1': 'O',
2397
+ '\u020C': 'O',
2398
+ '\u020E': 'O',
2399
+ '\u01A0': 'O',
2400
+ '\u1EDC': 'O',
2401
+ '\u1EDA': 'O',
2402
+ '\u1EE0': 'O',
2403
+ '\u1EDE': 'O',
2404
+ '\u1EE2': 'O',
2405
+ '\u1ECC': 'O',
2406
+ '\u1ED8': 'O',
2407
+ '\u01EA': 'O',
2408
+ '\u01EC': 'O',
2409
+ '\u00D8': 'O',
2410
+ '\u01FE': 'O',
2411
+ '\u0186': 'O',
2412
+ '\u019F': 'O',
2413
+ '\uA74A': 'O',
2414
+ '\uA74C': 'O',
2415
+ '\u01A2': 'OI',
2416
+ '\uA74E': 'OO',
2417
+ '\u0222': 'OU',
2418
+ '\u24C5': 'P',
2419
+ '\uFF30': 'P',
2420
+ '\u1E54': 'P',
2421
+ '\u1E56': 'P',
2422
+ '\u01A4': 'P',
2423
+ '\u2C63': 'P',
2424
+ '\uA750': 'P',
2425
+ '\uA752': 'P',
2426
+ '\uA754': 'P',
2427
+ '\u24C6': 'Q',
2428
+ '\uFF31': 'Q',
2429
+ '\uA756': 'Q',
2430
+ '\uA758': 'Q',
2431
+ '\u024A': 'Q',
2432
+ '\u24C7': 'R',
2433
+ '\uFF32': 'R',
2434
+ '\u0154': 'R',
2435
+ '\u1E58': 'R',
2436
+ '\u0158': 'R',
2437
+ '\u0210': 'R',
2438
+ '\u0212': 'R',
2439
+ '\u1E5A': 'R',
2440
+ '\u1E5C': 'R',
2441
+ '\u0156': 'R',
2442
+ '\u1E5E': 'R',
2443
+ '\u024C': 'R',
2444
+ '\u2C64': 'R',
2445
+ '\uA75A': 'R',
2446
+ '\uA7A6': 'R',
2447
+ '\uA782': 'R',
2448
+ '\u24C8': 'S',
2449
+ '\uFF33': 'S',
2450
+ '\u1E9E': 'S',
2451
+ '\u015A': 'S',
2452
+ '\u1E64': 'S',
2453
+ '\u015C': 'S',
2454
+ '\u1E60': 'S',
2455
+ '\u0160': 'S',
2456
+ '\u1E66': 'S',
2457
+ '\u1E62': 'S',
2458
+ '\u1E68': 'S',
2459
+ '\u0218': 'S',
2460
+ '\u015E': 'S',
2461
+ '\u2C7E': 'S',
2462
+ '\uA7A8': 'S',
2463
+ '\uA784': 'S',
2464
+ '\u24C9': 'T',
2465
+ '\uFF34': 'T',
2466
+ '\u1E6A': 'T',
2467
+ '\u0164': 'T',
2468
+ '\u1E6C': 'T',
2469
+ '\u021A': 'T',
2470
+ '\u0162': 'T',
2471
+ '\u1E70': 'T',
2472
+ '\u1E6E': 'T',
2473
+ '\u0166': 'T',
2474
+ '\u01AC': 'T',
2475
+ '\u01AE': 'T',
2476
+ '\u023E': 'T',
2477
+ '\uA786': 'T',
2478
+ '\uA728': 'TZ',
2479
+ '\u24CA': 'U',
2480
+ '\uFF35': 'U',
2481
+ '\u00D9': 'U',
2482
+ '\u00DA': 'U',
2483
+ '\u00DB': 'U',
2484
+ '\u0168': 'U',
2485
+ '\u1E78': 'U',
2486
+ '\u016A': 'U',
2487
+ '\u1E7A': 'U',
2488
+ '\u016C': 'U',
2489
+ '\u00DC': 'U',
2490
+ '\u01DB': 'U',
2491
+ '\u01D7': 'U',
2492
+ '\u01D5': 'U',
2493
+ '\u01D9': 'U',
2494
+ '\u1EE6': 'U',
2495
+ '\u016E': 'U',
2496
+ '\u0170': 'U',
2497
+ '\u01D3': 'U',
2498
+ '\u0214': 'U',
2499
+ '\u0216': 'U',
2500
+ '\u01AF': 'U',
2501
+ '\u1EEA': 'U',
2502
+ '\u1EE8': 'U',
2503
+ '\u1EEE': 'U',
2504
+ '\u1EEC': 'U',
2505
+ '\u1EF0': 'U',
2506
+ '\u1EE4': 'U',
2507
+ '\u1E72': 'U',
2508
+ '\u0172': 'U',
2509
+ '\u1E76': 'U',
2510
+ '\u1E74': 'U',
2511
+ '\u0244': 'U',
2512
+ '\u24CB': 'V',
2513
+ '\uFF36': 'V',
2514
+ '\u1E7C': 'V',
2515
+ '\u1E7E': 'V',
2516
+ '\u01B2': 'V',
2517
+ '\uA75E': 'V',
2518
+ '\u0245': 'V',
2519
+ '\uA760': 'VY',
2520
+ '\u24CC': 'W',
2521
+ '\uFF37': 'W',
2522
+ '\u1E80': 'W',
2523
+ '\u1E82': 'W',
2524
+ '\u0174': 'W',
2525
+ '\u1E86': 'W',
2526
+ '\u1E84': 'W',
2527
+ '\u1E88': 'W',
2528
+ '\u2C72': 'W',
2529
+ '\u24CD': 'X',
2530
+ '\uFF38': 'X',
2531
+ '\u1E8A': 'X',
2532
+ '\u1E8C': 'X',
2533
+ '\u24CE': 'Y',
2534
+ '\uFF39': 'Y',
2535
+ '\u1EF2': 'Y',
2536
+ '\u00DD': 'Y',
2537
+ '\u0176': 'Y',
2538
+ '\u1EF8': 'Y',
2539
+ '\u0232': 'Y',
2540
+ '\u1E8E': 'Y',
2541
+ '\u0178': 'Y',
2542
+ '\u1EF6': 'Y',
2543
+ '\u1EF4': 'Y',
2544
+ '\u01B3': 'Y',
2545
+ '\u024E': 'Y',
2546
+ '\u1EFE': 'Y',
2547
+ '\u24CF': 'Z',
2548
+ '\uFF3A': 'Z',
2549
+ '\u0179': 'Z',
2550
+ '\u1E90': 'Z',
2551
+ '\u017B': 'Z',
2552
+ '\u017D': 'Z',
2553
+ '\u1E92': 'Z',
2554
+ '\u1E94': 'Z',
2555
+ '\u01B5': 'Z',
2556
+ '\u0224': 'Z',
2557
+ '\u2C7F': 'Z',
2558
+ '\u2C6B': 'Z',
2559
+ '\uA762': 'Z',
2560
+ '\u24D0': 'a',
2561
+ '\uFF41': 'a',
2562
+ '\u1E9A': 'a',
2563
+ '\u00E0': 'a',
2564
+ '\u00E1': 'a',
2565
+ '\u00E2': 'a',
2566
+ '\u1EA7': 'a',
2567
+ '\u1EA5': 'a',
2568
+ '\u1EAB': 'a',
2569
+ '\u1EA9': 'a',
2570
+ '\u00E3': 'a',
2571
+ '\u0101': 'a',
2572
+ '\u0103': 'a',
2573
+ '\u1EB1': 'a',
2574
+ '\u1EAF': 'a',
2575
+ '\u1EB5': 'a',
2576
+ '\u1EB3': 'a',
2577
+ '\u0227': 'a',
2578
+ '\u01E1': 'a',
2579
+ '\u00E4': 'a',
2580
+ '\u01DF': 'a',
2581
+ '\u1EA3': 'a',
2582
+ '\u00E5': 'a',
2583
+ '\u01FB': 'a',
2584
+ '\u01CE': 'a',
2585
+ '\u0201': 'a',
2586
+ '\u0203': 'a',
2587
+ '\u1EA1': 'a',
2588
+ '\u1EAD': 'a',
2589
+ '\u1EB7': 'a',
2590
+ '\u1E01': 'a',
2591
+ '\u0105': 'a',
2592
+ '\u2C65': 'a',
2593
+ '\u0250': 'a',
2594
+ '\uA733': 'aa',
2595
+ '\u00E6': 'ae',
2596
+ '\u01FD': 'ae',
2597
+ '\u01E3': 'ae',
2598
+ '\uA735': 'ao',
2599
+ '\uA737': 'au',
2600
+ '\uA739': 'av',
2601
+ '\uA73B': 'av',
2602
+ '\uA73D': 'ay',
2603
+ '\u24D1': 'b',
2604
+ '\uFF42': 'b',
2605
+ '\u1E03': 'b',
2606
+ '\u1E05': 'b',
2607
+ '\u1E07': 'b',
2608
+ '\u0180': 'b',
2609
+ '\u0183': 'b',
2610
+ '\u0253': 'b',
2611
+ '\u24D2': 'c',
2612
+ '\uFF43': 'c',
2613
+ '\u0107': 'c',
2614
+ '\u0109': 'c',
2615
+ '\u010B': 'c',
2616
+ '\u010D': 'c',
2617
+ '\u00E7': 'c',
2618
+ '\u1E09': 'c',
2619
+ '\u0188': 'c',
2620
+ '\u023C': 'c',
2621
+ '\uA73F': 'c',
2622
+ '\u2184': 'c',
2623
+ '\u24D3': 'd',
2624
+ '\uFF44': 'd',
2625
+ '\u1E0B': 'd',
2626
+ '\u010F': 'd',
2627
+ '\u1E0D': 'd',
2628
+ '\u1E11': 'd',
2629
+ '\u1E13': 'd',
2630
+ '\u1E0F': 'd',
2631
+ '\u0111': 'd',
2632
+ '\u018C': 'd',
2633
+ '\u0256': 'd',
2634
+ '\u0257': 'd',
2635
+ '\uA77A': 'd',
2636
+ '\u01F3': 'dz',
2637
+ '\u01C6': 'dz',
2638
+ '\u24D4': 'e',
2639
+ '\uFF45': 'e',
2640
+ '\u00E8': 'e',
2641
+ '\u00E9': 'e',
2642
+ '\u00EA': 'e',
2643
+ '\u1EC1': 'e',
2644
+ '\u1EBF': 'e',
2645
+ '\u1EC5': 'e',
2646
+ '\u1EC3': 'e',
2647
+ '\u1EBD': 'e',
2648
+ '\u0113': 'e',
2649
+ '\u1E15': 'e',
2650
+ '\u1E17': 'e',
2651
+ '\u0115': 'e',
2652
+ '\u0117': 'e',
2653
+ '\u00EB': 'e',
2654
+ '\u1EBB': 'e',
2655
+ '\u011B': 'e',
2656
+ '\u0205': 'e',
2657
+ '\u0207': 'e',
2658
+ '\u1EB9': 'e',
2659
+ '\u1EC7': 'e',
2660
+ '\u0229': 'e',
2661
+ '\u1E1D': 'e',
2662
+ '\u0119': 'e',
2663
+ '\u1E19': 'e',
2664
+ '\u1E1B': 'e',
2665
+ '\u0247': 'e',
2666
+ '\u025B': 'e',
2667
+ '\u01DD': 'e',
2668
+ '\u24D5': 'f',
2669
+ '\uFF46': 'f',
2670
+ '\u1E1F': 'f',
2671
+ '\u0192': 'f',
2672
+ '\uA77C': 'f',
2673
+ '\u24D6': 'g',
2674
+ '\uFF47': 'g',
2675
+ '\u01F5': 'g',
2676
+ '\u011D': 'g',
2677
+ '\u1E21': 'g',
2678
+ '\u011F': 'g',
2679
+ '\u0121': 'g',
2680
+ '\u01E7': 'g',
2681
+ '\u0123': 'g',
2682
+ '\u01E5': 'g',
2683
+ '\u0260': 'g',
2684
+ '\uA7A1': 'g',
2685
+ '\u1D79': 'g',
2686
+ '\uA77F': 'g',
2687
+ '\u24D7': 'h',
2688
+ '\uFF48': 'h',
2689
+ '\u0125': 'h',
2690
+ '\u1E23': 'h',
2691
+ '\u1E27': 'h',
2692
+ '\u021F': 'h',
2693
+ '\u1E25': 'h',
2694
+ '\u1E29': 'h',
2695
+ '\u1E2B': 'h',
2696
+ '\u1E96': 'h',
2697
+ '\u0127': 'h',
2698
+ '\u2C68': 'h',
2699
+ '\u2C76': 'h',
2700
+ '\u0265': 'h',
2701
+ '\u0195': 'hv',
2702
+ '\u24D8': 'i',
2703
+ '\uFF49': 'i',
2704
+ '\u00EC': 'i',
2705
+ '\u00ED': 'i',
2706
+ '\u00EE': 'i',
2707
+ '\u0129': 'i',
2708
+ '\u012B': 'i',
2709
+ '\u012D': 'i',
2710
+ '\u00EF': 'i',
2711
+ '\u1E2F': 'i',
2712
+ '\u1EC9': 'i',
2713
+ '\u01D0': 'i',
2714
+ '\u0209': 'i',
2715
+ '\u020B': 'i',
2716
+ '\u1ECB': 'i',
2717
+ '\u012F': 'i',
2718
+ '\u1E2D': 'i',
2719
+ '\u0268': 'i',
2720
+ '\u0131': 'i',
2721
+ '\u24D9': 'j',
2722
+ '\uFF4A': 'j',
2723
+ '\u0135': 'j',
2724
+ '\u01F0': 'j',
2725
+ '\u0249': 'j',
2726
+ '\u24DA': 'k',
2727
+ '\uFF4B': 'k',
2728
+ '\u1E31': 'k',
2729
+ '\u01E9': 'k',
2730
+ '\u1E33': 'k',
2731
+ '\u0137': 'k',
2732
+ '\u1E35': 'k',
2733
+ '\u0199': 'k',
2734
+ '\u2C6A': 'k',
2735
+ '\uA741': 'k',
2736
+ '\uA743': 'k',
2737
+ '\uA745': 'k',
2738
+ '\uA7A3': 'k',
2739
+ '\u24DB': 'l',
2740
+ '\uFF4C': 'l',
2741
+ '\u0140': 'l',
2742
+ '\u013A': 'l',
2743
+ '\u013E': 'l',
2744
+ '\u1E37': 'l',
2745
+ '\u1E39': 'l',
2746
+ '\u013C': 'l',
2747
+ '\u1E3D': 'l',
2748
+ '\u1E3B': 'l',
2749
+ '\u017F': 'l',
2750
+ '\u0142': 'l',
2751
+ '\u019A': 'l',
2752
+ '\u026B': 'l',
2753
+ '\u2C61': 'l',
2754
+ '\uA749': 'l',
2755
+ '\uA781': 'l',
2756
+ '\uA747': 'l',
2757
+ '\u01C9': 'lj',
2758
+ '\u24DC': 'm',
2759
+ '\uFF4D': 'm',
2760
+ '\u1E3F': 'm',
2761
+ '\u1E41': 'm',
2762
+ '\u1E43': 'm',
2763
+ '\u0271': 'm',
2764
+ '\u026F': 'm',
2765
+ '\u24DD': 'n',
2766
+ '\uFF4E': 'n',
2767
+ '\u01F9': 'n',
2768
+ '\u0144': 'n',
2769
+ '\u00F1': 'n',
2770
+ '\u1E45': 'n',
2771
+ '\u0148': 'n',
2772
+ '\u1E47': 'n',
2773
+ '\u0146': 'n',
2774
+ '\u1E4B': 'n',
2775
+ '\u1E49': 'n',
2776
+ '\u019E': 'n',
2777
+ '\u0272': 'n',
2778
+ '\u0149': 'n',
2779
+ '\uA791': 'n',
2780
+ '\uA7A5': 'n',
2781
+ '\u01CC': 'nj',
2782
+ '\u24DE': 'o',
2783
+ '\uFF4F': 'o',
2784
+ '\u00F2': 'o',
2785
+ '\u00F3': 'o',
2786
+ '\u00F4': 'o',
2787
+ '\u1ED3': 'o',
2788
+ '\u1ED1': 'o',
2789
+ '\u1ED7': 'o',
2790
+ '\u1ED5': 'o',
2791
+ '\u00F5': 'o',
2792
+ '\u1E4D': 'o',
2793
+ '\u022D': 'o',
2794
+ '\u1E4F': 'o',
2795
+ '\u014D': 'o',
2796
+ '\u1E51': 'o',
2797
+ '\u1E53': 'o',
2798
+ '\u014F': 'o',
2799
+ '\u022F': 'o',
2800
+ '\u0231': 'o',
2801
+ '\u00F6': 'o',
2802
+ '\u022B': 'o',
2803
+ '\u1ECF': 'o',
2804
+ '\u0151': 'o',
2805
+ '\u01D2': 'o',
2806
+ '\u020D': 'o',
2807
+ '\u020F': 'o',
2808
+ '\u01A1': 'o',
2809
+ '\u1EDD': 'o',
2810
+ '\u1EDB': 'o',
2811
+ '\u1EE1': 'o',
2812
+ '\u1EDF': 'o',
2813
+ '\u1EE3': 'o',
2814
+ '\u1ECD': 'o',
2815
+ '\u1ED9': 'o',
2816
+ '\u01EB': 'o',
2817
+ '\u01ED': 'o',
2818
+ '\u00F8': 'o',
2819
+ '\u01FF': 'o',
2820
+ '\u0254': 'o',
2821
+ '\uA74B': 'o',
2822
+ '\uA74D': 'o',
2823
+ '\u0275': 'o',
2824
+ '\u01A3': 'oi',
2825
+ '\u0223': 'ou',
2826
+ '\uA74F': 'oo',
2827
+ '\u24DF': 'p',
2828
+ '\uFF50': 'p',
2829
+ '\u1E55': 'p',
2830
+ '\u1E57': 'p',
2831
+ '\u01A5': 'p',
2832
+ '\u1D7D': 'p',
2833
+ '\uA751': 'p',
2834
+ '\uA753': 'p',
2835
+ '\uA755': 'p',
2836
+ '\u24E0': 'q',
2837
+ '\uFF51': 'q',
2838
+ '\u024B': 'q',
2839
+ '\uA757': 'q',
2840
+ '\uA759': 'q',
2841
+ '\u24E1': 'r',
2842
+ '\uFF52': 'r',
2843
+ '\u0155': 'r',
2844
+ '\u1E59': 'r',
2845
+ '\u0159': 'r',
2846
+ '\u0211': 'r',
2847
+ '\u0213': 'r',
2848
+ '\u1E5B': 'r',
2849
+ '\u1E5D': 'r',
2850
+ '\u0157': 'r',
2851
+ '\u1E5F': 'r',
2852
+ '\u024D': 'r',
2853
+ '\u027D': 'r',
2854
+ '\uA75B': 'r',
2855
+ '\uA7A7': 'r',
2856
+ '\uA783': 'r',
2857
+ '\u24E2': 's',
2858
+ '\uFF53': 's',
2859
+ '\u00DF': 's',
2860
+ '\u015B': 's',
2861
+ '\u1E65': 's',
2862
+ '\u015D': 's',
2863
+ '\u1E61': 's',
2864
+ '\u0161': 's',
2865
+ '\u1E67': 's',
2866
+ '\u1E63': 's',
2867
+ '\u1E69': 's',
2868
+ '\u0219': 's',
2869
+ '\u015F': 's',
2870
+ '\u023F': 's',
2871
+ '\uA7A9': 's',
2872
+ '\uA785': 's',
2873
+ '\u1E9B': 's',
2874
+ '\u24E3': 't',
2875
+ '\uFF54': 't',
2876
+ '\u1E6B': 't',
2877
+ '\u1E97': 't',
2878
+ '\u0165': 't',
2879
+ '\u1E6D': 't',
2880
+ '\u021B': 't',
2881
+ '\u0163': 't',
2882
+ '\u1E71': 't',
2883
+ '\u1E6F': 't',
2884
+ '\u0167': 't',
2885
+ '\u01AD': 't',
2886
+ '\u0288': 't',
2887
+ '\u2C66': 't',
2888
+ '\uA787': 't',
2889
+ '\uA729': 'tz',
2890
+ '\u24E4': 'u',
2891
+ '\uFF55': 'u',
2892
+ '\u00F9': 'u',
2893
+ '\u00FA': 'u',
2894
+ '\u00FB': 'u',
2895
+ '\u0169': 'u',
2896
+ '\u1E79': 'u',
2897
+ '\u016B': 'u',
2898
+ '\u1E7B': 'u',
2899
+ '\u016D': 'u',
2900
+ '\u00FC': 'u',
2901
+ '\u01DC': 'u',
2902
+ '\u01D8': 'u',
2903
+ '\u01D6': 'u',
2904
+ '\u01DA': 'u',
2905
+ '\u1EE7': 'u',
2906
+ '\u016F': 'u',
2907
+ '\u0171': 'u',
2908
+ '\u01D4': 'u',
2909
+ '\u0215': 'u',
2910
+ '\u0217': 'u',
2911
+ '\u01B0': 'u',
2912
+ '\u1EEB': 'u',
2913
+ '\u1EE9': 'u',
2914
+ '\u1EEF': 'u',
2915
+ '\u1EED': 'u',
2916
+ '\u1EF1': 'u',
2917
+ '\u1EE5': 'u',
2918
+ '\u1E73': 'u',
2919
+ '\u0173': 'u',
2920
+ '\u1E77': 'u',
2921
+ '\u1E75': 'u',
2922
+ '\u0289': 'u',
2923
+ '\u24E5': 'v',
2924
+ '\uFF56': 'v',
2925
+ '\u1E7D': 'v',
2926
+ '\u1E7F': 'v',
2927
+ '\u028B': 'v',
2928
+ '\uA75F': 'v',
2929
+ '\u028C': 'v',
2930
+ '\uA761': 'vy',
2931
+ '\u24E6': 'w',
2932
+ '\uFF57': 'w',
2933
+ '\u1E81': 'w',
2934
+ '\u1E83': 'w',
2935
+ '\u0175': 'w',
2936
+ '\u1E87': 'w',
2937
+ '\u1E85': 'w',
2938
+ '\u1E98': 'w',
2939
+ '\u1E89': 'w',
2940
+ '\u2C73': 'w',
2941
+ '\u24E7': 'x',
2942
+ '\uFF58': 'x',
2943
+ '\u1E8B': 'x',
2944
+ '\u1E8D': 'x',
2945
+ '\u24E8': 'y',
2946
+ '\uFF59': 'y',
2947
+ '\u1EF3': 'y',
2948
+ '\u00FD': 'y',
2949
+ '\u0177': 'y',
2950
+ '\u1EF9': 'y',
2951
+ '\u0233': 'y',
2952
+ '\u1E8F': 'y',
2953
+ '\u00FF': 'y',
2954
+ '\u1EF7': 'y',
2955
+ '\u1E99': 'y',
2956
+ '\u1EF5': 'y',
2957
+ '\u01B4': 'y',
2958
+ '\u024F': 'y',
2959
+ '\u1EFF': 'y',
2960
+ '\u24E9': 'z',
2961
+ '\uFF5A': 'z',
2962
+ '\u017A': 'z',
2963
+ '\u1E91': 'z',
2964
+ '\u017C': 'z',
2965
+ '\u017E': 'z',
2966
+ '\u1E93': 'z',
2967
+ '\u1E95': 'z',
2968
+ '\u01B6': 'z',
2969
+ '\u0225': 'z',
2970
+ '\u0240': 'z',
2971
+ '\u2C6C': 'z',
2972
+ '\uA763': 'z',
2973
+ '\u0386': '\u0391',
2974
+ '\u0388': '\u0395',
2975
+ '\u0389': '\u0397',
2976
+ '\u038A': '\u0399',
2977
+ '\u03AA': '\u0399',
2978
+ '\u038C': '\u039F',
2979
+ '\u038E': '\u03A5',
2980
+ '\u03AB': '\u03A5',
2981
+ '\u038F': '\u03A9',
2982
+ '\u03AC': '\u03B1',
2983
+ '\u03AD': '\u03B5',
2984
+ '\u03AE': '\u03B7',
2985
+ '\u03AF': '\u03B9',
2986
+ '\u03CA': '\u03B9',
2987
+ '\u0390': '\u03B9',
2988
+ '\u03CC': '\u03BF',
2989
+ '\u03CD': '\u03C5',
2990
+ '\u03CB': '\u03C5',
2991
+ '\u03B0': '\u03C5',
2992
+ '\u03C9': '\u03C9',
2993
+ '\u03C2': '\u03C3'
2994
+ };
2995
 
2996
+ return diacritics;
2997
+ });
 
 
 
 
 
 
2998
 
2999
+ S2.define('select2/data/base',[
3000
+ '../utils'
3001
+ ], function (Utils) {
3002
+ function BaseAdapter ($element, options) {
3003
+ BaseAdapter.__super__.constructor.call(this);
3004
+ }
3005
 
3006
+ Utils.Extend(BaseAdapter, Utils.Observable);
3007
 
3008
+ BaseAdapter.prototype.current = function (callback) {
3009
+ throw new Error('The `current` method must be defined in child classes.');
3010
+ };
3011
 
3012
+ BaseAdapter.prototype.query = function (params, callback) {
3013
+ throw new Error('The `query` method must be defined in child classes.');
3014
+ };
3015
 
3016
+ BaseAdapter.prototype.bind = function (container, $container) {
3017
+ // Can be implemented in subclasses
3018
+ };
3019
 
3020
+ BaseAdapter.prototype.destroy = function () {
3021
+ // Can be implemented in subclasses
3022
+ };
3023
 
3024
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3025
+ var id = container.id + '-result-';
 
3026
 
3027
+ id += Utils.generateChars(4);
 
 
 
 
3028
 
3029
+ if (data.id != null) {
3030
+ id += '-' + data.id.toString();
3031
+ } else {
3032
+ id += '-' + Utils.generateChars(4);
3033
+ }
3034
+ return id;
3035
+ };
3036
 
3037
+ return BaseAdapter;
3038
+ });
3039
 
3040
+ S2.define('select2/data/select',[
3041
+ './base',
3042
+ '../utils',
3043
+ 'jquery'
3044
+ ], function (BaseAdapter, Utils, $) {
3045
+ function SelectAdapter ($element, options) {
3046
+ this.$element = $element;
3047
+ this.options = options;
3048
 
3049
+ SelectAdapter.__super__.constructor.call(this);
3050
+ }
 
3051
 
3052
+ Utils.Extend(SelectAdapter, BaseAdapter);
 
 
3053
 
3054
+ SelectAdapter.prototype.current = function (callback) {
3055
+ var data = [];
3056
+ var self = this;
3057
 
3058
+ this.$element.find(':selected').each(function () {
3059
+ var $option = $(this);
 
3060
 
3061
+ var option = self.item($option);
 
3062
 
3063
+ data.push(option);
3064
+ });
3065
 
3066
+ callback(data);
3067
+ };
3068
 
3069
+ SelectAdapter.prototype.select = function (data) {
3070
+ var self = this;
3071
 
3072
+ data.selected = true;
 
 
3073
 
3074
+ // If data.element is a DOM node, use it instead
3075
+ if ($(data.element).is('option')) {
3076
+ data.element.selected = true;
3077
 
3078
+ this.$element.trigger('change');
3079
 
3080
+ return;
3081
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3082
 
3083
+ if (this.$element.prop('multiple')) {
3084
+ this.current(function (currentData) {
3085
+ var val = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
3086
 
3087
+ data = [data];
3088
+ data.push.apply(data, currentData);
3089
 
3090
+ for (var d = 0; d < data.length; d++) {
3091
+ var id = data[d].id;
 
 
3092
 
3093
+ if ($.inArray(id, val) === -1) {
3094
+ val.push(id);
3095
+ }
3096
+ }
3097
 
3098
+ self.$element.val(val);
3099
+ self.$element.trigger('change');
3100
+ });
3101
+ } else {
3102
+ var val = data.id;
3103
 
3104
+ this.$element.val(val);
3105
+ this.$element.trigger('change');
3106
+ }
3107
+ };
 
 
 
 
 
 
 
3108
 
3109
+ SelectAdapter.prototype.unselect = function (data) {
3110
+ var self = this;
 
3111
 
3112
+ if (!this.$element.prop('multiple')) {
3113
+ return;
3114
+ }
3115
 
3116
+ data.selected = false;
3117
 
3118
+ if ($(data.element).is('option')) {
3119
+ data.element.selected = false;
3120
 
3121
+ this.$element.trigger('change');
 
3122
 
3123
+ return;
3124
+ }
 
 
 
3125
 
3126
+ this.current(function (currentData) {
3127
+ var val = [];
3128
 
3129
+ for (var d = 0; d < currentData.length; d++) {
3130
+ var id = currentData[d].id;
3131
 
3132
+ if (id !== data.id && $.inArray(id, val) === -1) {
3133
+ val.push(id);
3134
+ }
3135
+ }
3136
 
3137
+ self.$element.val(val);
 
3138
 
3139
+ self.$element.trigger('change');
3140
+ });
3141
+ };
 
3142
 
3143
+ SelectAdapter.prototype.bind = function (container, $container) {
3144
+ var self = this;
 
3145
 
3146
+ this.container = container;
 
3147
 
3148
+ container.on('select', function (params) {
3149
+ self.select(params.data);
3150
+ });
3151
 
3152
+ container.on('unselect', function (params) {
3153
+ self.unselect(params.data);
3154
+ });
3155
+ };
3156
 
3157
+ SelectAdapter.prototype.destroy = function () {
3158
+ // Remove anything added to child elements
3159
+ this.$element.find('*').each(function () {
3160
+ // Remove any custom data set by Select2
3161
+ $.removeData(this, 'data');
3162
+ });
3163
+ };
3164
 
3165
+ SelectAdapter.prototype.query = function (params, callback) {
3166
+ var data = [];
3167
+ var self = this;
3168
 
3169
+ var $options = this.$element.children();
 
3170
 
3171
+ $options.each(function () {
3172
+ var $option = $(this);
 
 
3173
 
3174
+ if (!$option.is('option') && !$option.is('optgroup')) {
3175
+ return;
3176
+ }
 
 
 
 
 
3177
 
3178
+ var option = self.item($option);
3179
 
3180
+ var matches = self.matches(params, option);
3181
 
3182
+ if (matches !== null) {
3183
+ data.push(matches);
3184
+ }
3185
+ });
 
3186
 
3187
+ callback({
3188
+ results: data
3189
+ });
3190
+ };
3191
 
3192
+ SelectAdapter.prototype.addOptions = function ($options) {
3193
+ Utils.appendMany(this.$element, $options);
3194
+ };
 
3195
 
3196
+ SelectAdapter.prototype.option = function (data) {
3197
+ var option;
3198
 
3199
+ if (data.children) {
3200
+ option = document.createElement('optgroup');
3201
+ option.label = data.text;
3202
+ } else {
3203
+ option = document.createElement('option');
3204
 
3205
+ if (option.textContent !== undefined) {
3206
+ option.textContent = data.text;
3207
+ } else {
3208
+ option.innerText = data.text;
3209
+ }
3210
+ }
3211
 
3212
+ if (data.id !== undefined) {
3213
+ option.value = data.id;
3214
+ }
3215
 
3216
+ if (data.disabled) {
3217
+ option.disabled = true;
3218
+ }
 
 
 
 
3219
 
3220
+ if (data.selected) {
3221
+ option.selected = true;
3222
+ }
3223
 
3224
+ if (data.title) {
3225
+ option.title = data.title;
3226
+ }
3227
 
3228
+ var $option = $(option);
 
 
3229
 
3230
+ var normalizedData = this._normalizeItem(data);
3231
+ normalizedData.element = option;
3232
 
3233
+ // Override the option's data with the combined data
3234
+ $.data(option, 'data', normalizedData);
3235
 
3236
+ return $option;
3237
+ };
 
3238
 
3239
+ SelectAdapter.prototype.item = function ($option) {
3240
+ var data = {};
3241
 
3242
+ data = $.data($option[0], 'data');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3243
 
3244
+ if (data != null) {
3245
+ return data;
3246
+ }
3247
 
3248
+ if ($option.is('option')) {
3249
+ data = {
3250
+ id: $option.val(),
3251
+ text: $option.text(),
3252
+ disabled: $option.prop('disabled'),
3253
+ selected: $option.prop('selected'),
3254
+ title: $option.prop('title')
3255
+ };
3256
+ } else if ($option.is('optgroup')) {
3257
+ data = {
3258
+ text: $option.prop('label'),
3259
+ children: [],
3260
+ title: $option.prop('title')
3261
+ };
3262
+
3263
+ var $children = $option.children('option');
3264
+ var children = [];
3265
+
3266
+ for (var c = 0; c < $children.length; c++) {
3267
+ var $child = $($children[c]);
3268
+
3269
+ var child = this.item($child);
3270
+
3271
+ children.push(child);
3272
+ }
3273
 
3274
+ data.children = children;
3275
+ }
3276
 
3277
+ data = this._normalizeItem(data);
3278
+ data.element = $option[0];
3279
 
3280
+ $.data($option[0], 'data', data);
 
 
3281
 
3282
+ return data;
3283
+ };
3284
 
3285
+ SelectAdapter.prototype._normalizeItem = function (item) {
3286
+ if (!$.isPlainObject(item)) {
3287
+ item = {
3288
+ id: item,
3289
+ text: item
3290
+ };
3291
+ }
3292
 
3293
+ item = $.extend({}, {
3294
+ text: ''
3295
+ }, item);
3296
 
3297
+ var defaults = {
3298
+ selected: false,
3299
+ disabled: false
3300
+ };
3301
 
3302
+ if (item.id != null) {
3303
+ item.id = item.id.toString();
3304
+ }
3305
 
3306
+ if (item.text != null) {
3307
+ item.text = item.text.toString();
3308
+ }
3309
 
3310
+ if (item._resultId == null && item.id && this.container != null) {
3311
+ item._resultId = this.generateResultId(this.container, item);
3312
+ }
3313
 
3314
+ return $.extend({}, defaults, item);
3315
+ };
3316
 
3317
+ SelectAdapter.prototype.matches = function (params, data) {
3318
+ var matcher = this.options.get('matcher');
3319
 
3320
+ return matcher(params, data);
3321
+ };
 
3322
 
3323
+ return SelectAdapter;
3324
+ });
3325
 
3326
+ S2.define('select2/data/array',[
3327
+ './select',
3328
+ '../utils',
3329
+ 'jquery'
3330
+ ], function (SelectAdapter, Utils, $) {
3331
+ function ArrayAdapter ($element, options) {
3332
+ var data = options.get('data') || [];
3333
 
3334
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
 
 
 
3335
 
3336
+ this.addOptions(this.convertToOptions(data));
3337
+ }
 
 
 
3338
 
3339
+ Utils.Extend(ArrayAdapter, SelectAdapter);
 
 
 
3340
 
3341
+ ArrayAdapter.prototype.select = function (data) {
3342
+ var $option = this.$element.find('option').filter(function (i, elm) {
3343
+ return elm.value == data.id.toString();
3344
+ });
3345
 
3346
+ if ($option.length === 0) {
3347
+ $option = this.option(data);
 
3348
 
3349
+ this.addOptions($option);
3350
+ }
3351
 
3352
+ ArrayAdapter.__super__.select.call(this, data);
3353
+ };
3354
 
3355
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3356
+ var self = this;
3357
 
3358
+ var $existing = this.$element.find('option');
3359
+ var existingIds = $existing.map(function () {
3360
+ return self.item($(this)).id;
3361
+ }).get();
3362
 
3363
+ var $options = [];
 
3364
 
3365
+ // Filter out all items except for the one passed in the argument
3366
+ function onlyItem (item) {
3367
+ return function () {
3368
+ return $(this).val() == item.id;
3369
+ };
3370
+ }
3371
 
3372
+ for (var d = 0; d < data.length; d++) {
3373
+ var item = this._normalizeItem(data[d]);
 
 
3374
 
3375
+ // Skip items which were pre-loaded, only merge the data
3376
+ if ($.inArray(item.id, existingIds) >= 0) {
3377
+ var $existingOption = $existing.filter(onlyItem(item));
3378
 
3379
+ var existingData = this.item($existingOption);
3380
+ var newData = $.extend(true, {}, item, existingData);
 
3381
 
3382
+ var $newOption = this.option(newData);
 
3383
 
3384
+ $existingOption.replaceWith($newOption);
3385
 
3386
+ continue;
3387
+ }
 
3388
 
3389
+ var $option = this.option(item);
 
 
 
3390
 
3391
+ if (item.children) {
3392
+ var $children = this.convertToOptions(item.children);
 
 
 
 
 
3393
 
3394
+ Utils.appendMany($option, $children);
3395
+ }
 
3396
 
3397
+ $options.push($option);
3398
+ }
3399
 
3400
+ return $options;
3401
+ };
3402
 
3403
+ return ArrayAdapter;
3404
+ });
 
3405
 
3406
+ S2.define('select2/data/ajax',[
3407
+ './array',
3408
+ '../utils',
3409
+ 'jquery'
3410
+ ], function (ArrayAdapter, Utils, $) {
3411
+ function AjaxAdapter ($element, options) {
3412
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3413
 
3414
+ if (this.ajaxOptions.processResults != null) {
3415
+ this.processResults = this.ajaxOptions.processResults;
3416
+ }
3417
 
3418
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3419
+ }
 
 
3420
 
3421
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
 
 
 
3422
 
3423
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3424
+ var defaults = {
3425
+ data: function (params) {
3426
+ return $.extend({}, params, {
3427
+ q: params.term
3428
+ });
3429
+ },
3430
+ transport: function (params, success, failure) {
3431
+ var $request = $.ajax(params);
3432
 
3433
+ $request.then(success);
3434
+ $request.fail(failure);
3435
 
3436
+ return $request;
3437
+ }
3438
+ };
 
 
3439
 
3440
+ return $.extend({}, defaults, options, true);
3441
+ };
 
 
 
 
3442
 
3443
+ AjaxAdapter.prototype.processResults = function (results) {
3444
+ return results;
3445
+ };
3446
 
3447
+ AjaxAdapter.prototype.query = function (params, callback) {
3448
+ var matches = [];
3449
+ var self = this;
3450
 
3451
+ if (this._request != null) {
3452
+ // JSONP requests cannot always be aborted
3453
+ if ($.isFunction(this._request.abort)) {
3454
+ this._request.abort();
3455
+ }
3456
 
3457
+ this._request = null;
3458
+ }
 
3459
 
3460
+ var options = $.extend({
3461
+ type: 'GET'
3462
+ }, this.ajaxOptions);
3463
 
3464
+ if (typeof options.url === 'function') {
3465
+ options.url = options.url.call(this.$element, params);
3466
+ }
3467
 
3468
+ if (typeof options.data === 'function') {
3469
+ options.data = options.data.call(this.$element, params);
3470
+ }
3471
 
3472
+ function request () {
3473
+ var $request = options.transport(options, function (data) {
3474
+ var results = self.processResults(data, params);
3475
+
3476
+ if (self.options.get('debug') && window.console && console.error) {
3477
+ // Check to make sure that the response included a `results` key.
3478
+ if (!results || !results.results || !$.isArray(results.results)) {
3479
+ console.error(
3480
+ 'Select2: The AJAX results did not return an array in the ' +
3481
+ '`results` key of the response.'
3482
+ );
3483
+ }
3484
+ }
3485
 
3486
+ callback(results);
3487
+ }, function () {
3488
+ // Attempt to detect if a request was aborted
3489
+ // Only works if the transport exposes a status property
3490
+ if ($request.status && $request.status === '0') {
3491
+ return;
3492
+ }
3493
 
3494
+ self.trigger('results:message', {
3495
+ message: 'errorLoading'
3496
+ });
3497
+ });
3498
 
3499
+ self._request = $request;
3500
+ }
 
3501
 
3502
+ if (this.ajaxOptions.delay && params.term != null) {
3503
+ if (this._queryTimeout) {
3504
+ window.clearTimeout(this._queryTimeout);
3505
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3506
 
3507
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3508
+ } else {
3509
+ request();
3510
+ }
3511
+ };
3512
 
3513
+ return AjaxAdapter;
3514
+ });
3515
 
3516
+ S2.define('select2/data/tags',[
3517
+ 'jquery'
3518
+ ], function ($) {
3519
+ function Tags (decorated, $element, options) {
3520
+ var tags = options.get('tags');
3521
 
3522
+ var createTag = options.get('createTag');
 
 
 
 
 
 
3523
 
3524
+ if (createTag !== undefined) {
3525
+ this.createTag = createTag;
3526
+ }
3527
 
3528
+ var insertTag = options.get('insertTag');
 
 
 
3529
 
3530
+ if (insertTag !== undefined) {
3531
+ this.insertTag = insertTag;
3532
+ }
3533
 
3534
+ decorated.call(this, $element, options);
 
 
3535
 
3536
+ if ($.isArray(tags)) {
3537
+ for (var t = 0; t < tags.length; t++) {
3538
+ var tag = tags[t];
3539
+ var item = this._normalizeItem(tag);
3540
 
3541
+ var $option = this.option(item);
 
3542
 
3543
+ this.$element.append($option);
3544
+ }
3545
+ }
3546
+ }
3547
 
3548
+ Tags.prototype.query = function (decorated, params, callback) {
3549
+ var self = this;
3550
 
3551
+ this._removeOldTags();
 
3552
 
3553
+ if (params.term == null || params.page != null) {
3554
+ decorated.call(this, params, callback);
3555
+ return;
3556
+ }
 
 
 
3557
 
3558
+ function wrapper (obj, child) {
3559
+ var data = obj.results;
3560
 
3561
+ for (var i = 0; i < data.length; i++) {
3562
+ var option = data[i];
3563
 
3564
+ var checkChildren = (
3565
+ option.children != null &&
3566
+ !wrapper({
3567
+ results: option.children
3568
+ }, true)
3569
+ );
3570
 
3571
+ var optionText = (option.text || '').toUpperCase();
3572
+ var paramsTerm = (params.term || '').toUpperCase();
 
 
3573
 
3574
+ var checkText = optionText === paramsTerm;
 
3575
 
3576
+ if (checkText || checkChildren) {
3577
+ if (child) {
3578
+ return false;
3579
+ }
3580
 
3581
+ obj.data = data;
3582
+ callback(obj);
3583
 
3584
+ return;
3585
+ }
3586
+ }
3587
 
3588
+ if (child) {
3589
+ return true;
3590
+ }
 
3591
 
3592
+ var tag = self.createTag(params);
3593
 
3594
+ if (tag != null) {
3595
+ var $option = self.option(tag);
3596
+ $option.attr('data-select2-tag', true);
 
 
 
3597
 
3598
+ self.addOptions([$option]);
 
3599
 
3600
+ self.insertTag(data, tag);
3601
+ }
 
3602
 
3603
+ obj.results = data;
 
3604
 
3605
+ callback(obj);
3606
+ }
3607
 
3608
+ decorated.call(this, params, wrapper);
3609
+ };
3610
 
3611
+ Tags.prototype.createTag = function (decorated, params) {
3612
+ var term = $.trim(params.term);
3613
 
3614
+ if (term === '') {
3615
+ return null;
3616
+ }
3617
 
3618
+ return {
3619
+ id: term,
3620
+ text: term
3621
+ };
3622
+ };
3623
 
3624
+ Tags.prototype.insertTag = function (_, data, tag) {
3625
+ data.unshift(tag);
3626
+ };
3627
 
3628
+ Tags.prototype._removeOldTags = function (_) {
3629
+ var tag = this._lastTag;
3630
 
3631
+ var $options = this.$element.find('option[data-select2-tag]');
 
3632
 
3633
+ $options.each(function () {
3634
+ if (this.selected) {
3635
+ return;
3636
+ }
3637
 
3638
+ $(this).remove();
3639
+ });
3640
+ };
 
 
 
 
3641
 
3642
+ return Tags;
3643
+ });
 
3644
 
3645
+ S2.define('select2/data/tokenizer',[
3646
+ 'jquery'
3647
+ ], function ($) {
3648
+ function Tokenizer (decorated, $element, options) {
3649
+ var tokenizer = options.get('tokenizer');
3650
 
3651
+ if (tokenizer !== undefined) {
3652
+ this.tokenizer = tokenizer;
3653
+ }
3654
 
3655
+ decorated.call(this, $element, options);
3656
+ }
 
 
 
 
 
 
 
3657
 
3658
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3659
+ decorated.call(this, container, $container);
3660
 
3661
+ this.$search = container.dropdown.$search || container.selection.$search ||
3662
+ $container.find('.select2-search__field');
3663
+ };
3664
 
3665
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3666
+ var self = this;
3667
 
3668
+ function createAndSelect (data) {
3669
+ // Normalize the data object so we can use it for checks
3670
+ var item = self._normalizeItem(data);
3671
 
3672
+ // Check if the data object already exists as a tag
3673
+ // Select it if it doesn't
3674
+ var $existingOptions = self.$element.find('option').filter(function () {
3675
+ return $(this).val() === item.id;
3676
+ });
3677
 
3678
+ // If an existing option wasn't found for it, create the option
3679
+ if (!$existingOptions.length) {
3680
+ var $option = self.option(item);
3681
+ $option.attr('data-select2-tag', true);
 
3682
 
3683
+ self._removeOldTags();
3684
+ self.addOptions([$option]);
3685
+ }
3686
 
3687
+ // Select the item, now that we know there is an option for it
3688
+ select(item);
3689
+ }
3690
 
3691
+ function select (data) {
3692
+ self.trigger('select', {
3693
+ data: data
3694
+ });
3695
+ }
3696
 
3697
+ params.term = params.term || '';
 
 
3698
 
3699
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
 
 
 
 
 
 
 
 
 
 
 
 
3700
 
3701
+ if (tokenData.term !== params.term) {
3702
+ // Replace the search term if we have the search box
3703
+ if (this.$search.length) {
3704
+ this.$search.val(tokenData.term);
3705
+ this.$search.focus();
3706
+ }
 
3707
 
3708
+ params.term = tokenData.term;
3709
+ }
 
 
3710
 
3711
+ decorated.call(this, params, callback);
3712
+ };
3713
 
3714
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3715
+ var separators = options.get('tokenSeparators') || [];
3716
+ var term = params.term;
3717
+ var i = 0;
3718
 
3719
+ var createTag = this.createTag || function (params) {
3720
+ return {
3721
+ id: params.term,
3722
+ text: params.term
3723
+ };
3724
+ };
3725
 
3726
+ while (i < term.length) {
3727
+ var termChar = term[i];
3728
 
3729
+ if ($.inArray(termChar, separators) === -1) {
3730
+ i++;
 
 
 
3731
 
3732
+ continue;
3733
+ }
3734
 
3735
+ var part = term.substr(0, i);
3736
+ var partParams = $.extend({}, params, {
3737
+ term: part
3738
+ });
3739
 
3740
+ var data = createTag(partParams);
3741
 
3742
+ if (data == null) {
3743
+ i++;
3744
+ continue;
3745
+ }
3746
 
3747
+ callback(data);
3748
 
3749
+ // Reset the term to not include the tokenized portion
3750
+ term = term.substr(i + 1) || '';
3751
+ i = 0;
3752
+ }
3753
 
3754
+ return {
3755
+ term: term
3756
+ };
3757
+ };
3758
 
3759
+ return Tokenizer;
3760
+ });
 
 
3761
 
3762
+ S2.define('select2/data/minimumInputLength',[
 
3763
 
3764
+ ], function () {
3765
+ function MinimumInputLength (decorated, $e, options) {
3766
+ this.minimumInputLength = options.get('minimumInputLength');
3767
 
3768
+ decorated.call(this, $e, options);
3769
+ }
 
 
3770
 
3771
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3772
+ params.term = params.term || '';
3773
 
3774
+ if (params.term.length < this.minimumInputLength) {
3775
+ this.trigger('results:message', {
3776
+ message: 'inputTooShort',
3777
+ args: {
3778
+ minimum: this.minimumInputLength,
3779
+ input: params.term,
3780
+ params: params
3781
+ }
3782
+ });
3783
 
3784
+ return;
3785
+ }
 
 
 
 
3786
 
3787
+ decorated.call(this, params, callback);
3788
+ };
3789
 
3790
+ return MinimumInputLength;
3791
+ });
 
 
3792
 
3793
+ S2.define('select2/data/maximumInputLength',[
 
3794
 
3795
+ ], function () {
3796
+ function MaximumInputLength (decorated, $e, options) {
3797
+ this.maximumInputLength = options.get('maximumInputLength');
3798
 
3799
+ decorated.call(this, $e, options);
3800
+ }
 
3801
 
3802
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3803
+ params.term = params.term || '';
3804
+
3805
+ if (this.maximumInputLength > 0 &&
3806
+ params.term.length > this.maximumInputLength) {
3807
+ this.trigger('results:message', {
3808
+ message: 'inputTooLong',
3809
+ args: {
3810
+ maximum: this.maximumInputLength,
3811
+ input: params.term,
3812
+ params: params
3813
+ }
3814
+ });
3815
 
3816
+ return;
3817
+ }
 
3818
 
3819
+ decorated.call(this, params, callback);
3820
+ };
3821
 
3822
+ return MaximumInputLength;
3823
+ });
3824
 
3825
+ S2.define('select2/data/maximumSelectionLength',[
3826
 
3827
+ ], function (){
3828
+ function MaximumSelectionLength (decorated, $e, options) {
3829
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3830
 
3831
+ decorated.call(this, $e, options);
3832
+ }
3833
 
3834
+ MaximumSelectionLength.prototype.query =
3835
+ function (decorated, params, callback) {
3836
+ var self = this;
3837
+
3838
+ this.current(function (currentData) {
3839
+ var count = currentData != null ? currentData.length : 0;
3840
+ if (self.maximumSelectionLength > 0 &&
3841
+ count >= self.maximumSelectionLength) {
3842
+ self.trigger('results:message', {
3843
+ message: 'maximumSelected',
3844
+ args: {
3845
+ maximum: self.maximumSelectionLength
3846
+ }
3847
+ });
3848
+ return;
3849
+ }
3850
+ decorated.call(self, params, callback);
3851
+ });
3852
+ };
3853
 
3854
+ return MaximumSelectionLength;
3855
+ });
 
3856
 
3857
+ S2.define('select2/dropdown',[
3858
+ 'jquery',
3859
+ './utils'
3860
+ ], function ($, Utils) {
3861
+ function Dropdown ($element, options) {
3862
+ this.$element = $element;
3863
+ this.options = options;
3864
 
3865
+ Dropdown.__super__.constructor.call(this);
3866
+ }
 
3867
 
3868
+ Utils.Extend(Dropdown, Utils.Observable);
 
3869
 
3870
+ Dropdown.prototype.render = function () {
3871
+ var $dropdown = $(
3872
+ '<span class="select2-dropdown">' +
3873
+ '<span class="select2-results"></span>' +
3874
+ '</span>'
3875
+ );
3876
 
3877
+ $dropdown.attr('dir', this.options.get('dir'));
 
 
 
3878
 
3879
+ this.$dropdown = $dropdown;
 
 
3880
 
3881
+ return $dropdown;
3882
+ };
3883
 
3884
+ Dropdown.prototype.bind = function () {
3885
+ // Should be implemented in subclasses
3886
+ };
 
 
3887
 
3888
+ Dropdown.prototype.position = function ($dropdown, $container) {
3889
+ // Should be implmented in subclasses
3890
+ };
3891
 
3892
+ Dropdown.prototype.destroy = function () {
3893
+ // Remove the dropdown from the DOM
3894
+ this.$dropdown.remove();
3895
+ };
3896
 
3897
+ return Dropdown;
3898
+ });
3899
 
3900
+ S2.define('select2/dropdown/search',[
3901
+ 'jquery',
3902
+ '../utils'
3903
+ ], function ($, Utils) {
3904
+ function Search () { }
3905
 
3906
+ Search.prototype.render = function (decorated) {
3907
+ var $rendered = decorated.call(this);
3908
 
3909
+ var $search = $(
3910
+ '<span class="select2-search select2-search--dropdown">' +
3911
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
3912
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
3913
+ ' spellcheck="false" role="textbox" />' +
3914
+ '</span>'
3915
+ );
3916
 
3917
+ this.$searchContainer = $search;
3918
+ this.$search = $search.find('input');
 
 
 
3919
 
3920
+ $rendered.prepend($search);
 
 
 
3921
 
3922
+ return $rendered;
3923
+ };
 
3924
 
3925
+ Search.prototype.bind = function (decorated, container, $container) {
3926
+ var self = this;
 
3927
 
3928
+ decorated.call(this, container, $container);
 
 
 
 
3929
 
3930
+ this.$search.on('keydown', function (evt) {
3931
+ self.trigger('keypress', evt);
3932
 
3933
+ self._keyUpPrevented = evt.isDefaultPrevented();
3934
+ });
3935
 
3936
+ // Workaround for browsers which do not support the `input` event
3937
+ // This will prevent double-triggering of events for browsers which support
3938
+ // both the `keyup` and `input` events.
3939
+ this.$search.on('input', function (evt) {
3940
+ // Unbind the duplicated `keyup` event
3941
+ $(this).off('keyup');
3942
+ });
3943
 
3944
+ this.$search.on('keyup input', function (evt) {
3945
+ self.handleSearch(evt);
3946
+ });
3947
 
3948
+ container.on('open', function () {
3949
+ self.$search.attr('tabindex', 0);
3950
 
3951
+ self.$search.focus();
 
 
 
3952
 
3953
+ window.setTimeout(function () {
3954
+ self.$search.focus();
3955
+ }, 0);
3956
+ });
 
 
3957
 
3958
+ container.on('close', function () {
3959
+ self.$search.attr('tabindex', -1);
3960
 
3961
+ self.$search.val('');
3962
+ });
3963
 
3964
+ container.on('focus', function () {
3965
+ if (!container.isOpen()) {
3966
+ self.$search.focus();
3967
+ }
3968
+ });
3969
 
3970
+ container.on('results:all', function (params) {
3971
+ if (params.query.term == null || params.query.term === '') {
3972
+ var showSearch = self.showSearch(params);
 
3973
 
3974
+ if (showSearch) {
3975
+ self.$searchContainer.removeClass('select2-search--hide');
3976
+ } else {
3977
+ self.$searchContainer.addClass('select2-search--hide');
3978
+ }
3979
+ }
3980
+ });
3981
+ };
3982
 
3983
+ Search.prototype.handleSearch = function (evt) {
3984
+ if (!this._keyUpPrevented) {
3985
+ var input = this.$search.val();
 
3986
 
3987
+ this.trigger('query', {
3988
+ term: input
3989
+ });
3990
+ }
3991
 
3992
+ this._keyUpPrevented = false;
3993
+ };
 
 
3994
 
3995
+ Search.prototype.showSearch = function (_, params) {
3996
+ return true;
3997
+ };
 
3998
 
3999
+ return Search;
4000
+ });
4001
 
4002
+ S2.define('select2/dropdown/hidePlaceholder',[
4003
 
4004
+ ], function () {
4005
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4006
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4007
 
4008
+ decorated.call(this, $element, options, dataAdapter);
4009
+ }
4010
 
4011
+ HidePlaceholder.prototype.append = function (decorated, data) {
4012
+ data.results = this.removePlaceholder(data.results);
4013
 
4014
+ decorated.call(this, data);
4015
+ };
 
 
 
 
 
 
 
4016
 
4017
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4018
+ if (typeof placeholder === 'string') {
4019
+ placeholder = {
4020
+ id: '',
4021
+ text: placeholder
4022
+ };
4023
+ }
4024
 
4025
+ return placeholder;
4026
+ };
4027
 
4028
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4029
+ var modifiedData = data.slice(0);
4030
 
4031
+ for (var d = data.length - 1; d >= 0; d--) {
4032
+ var item = data[d];
4033
 
4034
+ if (this.placeholder.id === item.id) {
4035
+ modifiedData.splice(d, 1);
4036
+ }
4037
+ }
4038
 
4039
+ return modifiedData;
4040
+ };
4041
 
4042
+ return HidePlaceholder;
4043
+ });
4044
 
4045
+ S2.define('select2/dropdown/infiniteScroll',[
4046
+ 'jquery'
4047
+ ], function ($) {
4048
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4049
+ this.lastParams = {};
 
 
 
 
 
4050
 
4051
+ decorated.call(this, $element, options, dataAdapter);
 
4052
 
4053
+ this.$loadingMore = this.createLoadingMore();
4054
+ this.loading = false;
4055
+ }
4056
 
4057
+ InfiniteScroll.prototype.append = function (decorated, data) {
4058
+ this.$loadingMore.remove();
4059
+ this.loading = false;
4060
 
4061
+ decorated.call(this, data);
4062
 
4063
+ if (this.showLoadingMore(data)) {
4064
+ this.$results.append(this.$loadingMore);
4065
+ }
4066
+ };
4067
 
4068
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4069
+ var self = this;
4070
 
4071
+ decorated.call(this, container, $container);
 
 
4072
 
4073
+ container.on('query', function (params) {
4074
+ self.lastParams = params;
4075
+ self.loading = true;
4076
+ });
 
 
 
 
 
 
 
 
 
 
 
4077
 
4078
+ container.on('query:append', function (params) {
4079
+ self.lastParams = params;
4080
+ self.loading = true;
4081
+ });
4082
 
4083
+ this.$results.on('scroll', function () {
4084
+ var isLoadMoreVisible = $.contains(
4085
+ document.documentElement,
4086
+ self.$loadingMore[0]
4087
+ );
 
 
4088
 
4089
+ if (self.loading || !isLoadMoreVisible) {
4090
+ return;
4091
+ }
4092
 
4093
+ var currentOffset = self.$results.offset().top +
4094
+ self.$results.outerHeight(false);
4095
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4096
+ self.$loadingMore.outerHeight(false);
4097
 
4098
+ if (currentOffset + 50 >= loadingMoreOffset) {
4099
+ self.loadMore();
4100
+ }
4101
+ });
4102
+ };
 
4103
 
4104
+ InfiniteScroll.prototype.loadMore = function () {
4105
+ this.loading = true;
4106
 
4107
+ var params = $.extend({}, {page: 1}, this.lastParams);
4108
 
4109
+ params.page++;
 
4110
 
4111
+ this.trigger('query:append', params);
4112
+ };
 
4113
 
4114
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4115
+ return data.pagination && data.pagination.more;
4116
+ };
4117
 
4118
+ InfiniteScroll.prototype.createLoadingMore = function () {
4119
+ var $option = $(
4120
+ '<li ' +
4121
+ 'class="select2-results__option select2-results__option--load-more"' +
4122
+ 'role="treeitem" aria-disabled="true"></li>'
4123
+ );
4124
 
4125
+ var message = this.options.get('translations').get('loadingMore');
 
4126
 
4127
+ $option.html(message(this.lastParams));
 
 
 
 
4128
 
4129
+ return $option;
4130
+ };
4131
 
4132
+ return InfiniteScroll;
4133
+ });
 
 
 
 
 
4134
 
4135
+ S2.define('select2/dropdown/attachBody',[
4136
+ 'jquery',
4137
+ '../utils'
4138
+ ], function ($, Utils) {
4139
+ function AttachBody (decorated, $element, options) {
4140
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4141
 
4142
+ decorated.call(this, $element, options);
4143
+ }
4144
 
4145
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4146
+ var self = this;
4147
 
4148
+ var setupResultsEvents = false;
 
4149
 
4150
+ decorated.call(this, container, $container);
4151
 
4152
+ container.on('open', function () {
4153
+ self._showDropdown();
4154
+ self._attachPositioningHandler(container);
4155
 
4156
+ if (!setupResultsEvents) {
4157
+ setupResultsEvents = true;
4158
 
4159
+ container.on('results:all', function () {
4160
+ self._positionDropdown();
4161
+ self._resizeDropdown();
4162
+ });
 
 
 
4163
 
4164
+ container.on('results:append', function () {
4165
+ self._positionDropdown();
4166
+ self._resizeDropdown();
4167
+ });
4168
+ }
4169
+ });
4170
 
4171
+ container.on('close', function () {
4172
+ self._hideDropdown();
4173
+ self._detachPositioningHandler(container);
4174
+ });
4175
 
4176
+ this.$dropdownContainer.on('mousedown', function (evt) {
4177
+ evt.stopPropagation();
4178
+ });
4179
+ };
4180
 
4181
+ AttachBody.prototype.destroy = function (decorated) {
4182
+ decorated.call(this);
 
 
4183
 
4184
+ this.$dropdownContainer.remove();
4185
+ };
4186
 
4187
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4188
+ // Clone all of the container classes
4189
+ $dropdown.attr('class', $container.attr('class'));
4190
 
4191
+ $dropdown.removeClass('select2');
4192
+ $dropdown.addClass('select2-container--open');
 
 
 
4193
 
4194
+ $dropdown.css({
4195
+ position: 'absolute',
4196
+ top: -999999
4197
+ });
4198
 
4199
+ this.$container = $container;
4200
+ };
 
 
 
 
 
 
4201
 
4202
+ AttachBody.prototype.render = function (decorated) {
4203
+ var $container = $('<span></span>');
 
4204
 
4205
+ var $dropdown = decorated.call(this);
4206
+ $container.append($dropdown);
 
 
4207
 
4208
+ this.$dropdownContainer = $container;
 
4209
 
4210
+ return $container;
4211
+ };
 
4212
 
4213
+ AttachBody.prototype._hideDropdown = function (decorated) {
4214
+ this.$dropdownContainer.detach();
4215
+ };
4216
 
4217
+ AttachBody.prototype._attachPositioningHandler =
4218
+ function (decorated, container) {
4219
+ var self = this;
4220
 
4221
+ var scrollEvent = 'scroll.select2.' + container.id;
4222
+ var resizeEvent = 'resize.select2.' + container.id;
4223
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4224
 
4225
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4226
+ $watchers.each(function () {
4227
+ $(this).data('select2-scroll-position', {
4228
+ x: $(this).scrollLeft(),
4229
+ y: $(this).scrollTop()
4230
+ });
4231
+ });
4232
 
4233
+ $watchers.on(scrollEvent, function (ev) {
4234
+ var position = $(this).data('select2-scroll-position');
4235
+ $(this).scrollTop(position.y);
4236
+ });
4237
 
4238
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4239
+ function (e) {
4240
+ self._positionDropdown();
4241
+ self._resizeDropdown();
4242
+ });
4243
+ };
4244
 
4245
+ AttachBody.prototype._detachPositioningHandler =
4246
+ function (decorated, container) {
4247
+ var scrollEvent = 'scroll.select2.' + container.id;
4248
+ var resizeEvent = 'resize.select2.' + container.id;
4249
+ var orientationEvent = 'orientationchange.select2.' + container.id;
 
 
4250
 
4251
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4252
+ $watchers.off(scrollEvent);
4253
 
4254
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4255
+ };
4256
 
4257
+ AttachBody.prototype._positionDropdown = function () {
4258
+ var $window = $(window);
4259
 
4260
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4261
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
 
 
4262
 
4263
+ var newDirection = null;
 
4264
 
4265
+ var offset = this.$container.offset();
 
4266
 
4267
+ offset.bottom = offset.top + this.$container.outerHeight(false);
 
 
 
 
4268
 
4269
+ var container = {
4270
+ height: this.$container.outerHeight(false)
4271
+ };
4272
 
4273
+ container.top = offset.top;
4274
+ container.bottom = offset.top + container.height;
 
4275
 
4276
+ var dropdown = {
4277
+ height: this.$dropdown.outerHeight(false)
4278
+ };
4279
 
4280
+ var viewport = {
4281
+ top: $window.scrollTop(),
4282
+ bottom: $window.scrollTop() + $window.height()
4283
+ };
4284
 
4285
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4286
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
 
 
4287
 
4288
+ var css = {
4289
+ left: offset.left,
4290
+ top: container.bottom
4291
+ };
4292
 
4293
+ // Determine what the parent element is to use for calciulating the offset
4294
+ var $offsetParent = this.$dropdownParent;
4295
 
4296
+ // For statically positoned elements, we need to get the element
4297
+ // that is determining the offset
4298
+ if ($offsetParent.css('position') === 'static') {
4299
+ $offsetParent = $offsetParent.offsetParent();
4300
+ }
4301
 
4302
+ var parentOffset = $offsetParent.offset();
 
 
 
4303
 
4304
+ css.top -= parentOffset.top;
4305
+ css.left -= parentOffset.left;
 
 
 
4306
 
4307
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4308
+ newDirection = 'below';
4309
+ }
4310
 
4311
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4312
+ newDirection = 'above';
4313
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4314
+ newDirection = 'below';
4315
+ }
4316
 
4317
+ if (newDirection == 'above' ||
4318
+ (isCurrentlyAbove && newDirection !== 'below')) {
4319
+ css.top = container.top - parentOffset.top - dropdown.height;
4320
+ }
 
4321
 
4322
+ if (newDirection != null) {
4323
+ this.$dropdown
4324
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4325
+ .addClass('select2-dropdown--' + newDirection);
4326
+ this.$container
4327
+ .removeClass('select2-container--below select2-container--above')
4328
+ .addClass('select2-container--' + newDirection);
4329
+ }
4330
 
4331
+ this.$dropdownContainer.css(css);
4332
+ };
4333
 
4334
+ AttachBody.prototype._resizeDropdown = function () {
4335
+ var css = {
4336
+ width: this.$container.outerWidth(false) + 'px'
4337
+ };
4338
 
4339
+ if (this.options.get('dropdownAutoWidth')) {
4340
+ css.minWidth = css.width;
4341
+ css.position = 'relative';
4342
+ css.width = 'auto';
4343
+ }
4344
 
4345
+ this.$dropdown.css(css);
4346
+ };
 
4347
 
4348
+ AttachBody.prototype._showDropdown = function (decorated) {
4349
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
 
 
 
 
4350
 
4351
+ this._positionDropdown();
4352
+ this._resizeDropdown();
4353
+ };
4354
 
4355
+ return AttachBody;
4356
+ });
4357
 
4358
+ S2.define('select2/dropdown/minimumResultsForSearch',[
 
4359
 
4360
+ ], function () {
4361
+ function countResults (data) {
4362
+ var count = 0;
4363
 
4364
+ for (var d = 0; d < data.length; d++) {
4365
+ var item = data[d];
 
 
 
 
4366
 
4367
+ if (item.children) {
4368
+ count += countResults(item.children);
4369
+ } else {
4370
+ count++;
4371
+ }
4372
+ }
4373
 
4374
+ return count;
4375
+ }
4376
 
4377
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4378
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4379
 
4380
+ if (this.minimumResultsForSearch < 0) {
4381
+ this.minimumResultsForSearch = Infinity;
4382
+ }
4383
 
4384
+ decorated.call(this, $element, options, dataAdapter);
4385
+ }
 
4386
 
4387
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4388
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4389
+ return false;
4390
+ }
4391
 
4392
+ return decorated.call(this, params);
4393
+ };
 
 
4394
 
4395
+ return MinimumResultsForSearch;
 
 
4396
  });
 
 
4397
 
4398
+ S2.define('select2/dropdown/selectOnClose',[
 
 
 
4399
 
4400
+ ], function () {
4401
+ function SelectOnClose () { }
 
 
4402
 
4403
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4404
+ var self = this;
4405
 
4406
+ decorated.call(this, container, $container);
 
4407
 
4408
+ container.on('close', function (params) {
4409
+ self._handleSelectOnClose(params);
4410
+ });
4411
+ };
4412
 
4413
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4414
+ if (params && params.originalSelect2Event != null) {
4415
+ var event = params.originalSelect2Event;
4416
 
4417
+ // Don't select an item if the close event was triggered from a select or
4418
+ // unselect event
4419
+ if (event._type === 'select' || event._type === 'unselect') {
4420
+ return;
4421
+ }
4422
+ }
4423
 
4424
+ var $highlightedResults = this.getHighlightedResults();
 
4425
 
4426
+ // Only select highlighted results
4427
+ if ($highlightedResults.length < 1) {
4428
+ return;
4429
+ }
4430
 
4431
+ var data = $highlightedResults.data('data');
 
4432
 
4433
+ // Don't re-select already selected resulte
4434
+ if (
4435
+ (data.element != null && data.element.selected) ||
4436
+ (data.element == null && data.selected)
4437
+ ) {
4438
+ return;
4439
+ }
4440
 
4441
+ this.trigger('select', {
4442
+ data: data
4443
+ });
4444
+ };
4445
 
4446
+ return SelectOnClose;
4447
+ });
 
4448
 
4449
+ S2.define('select2/dropdown/closeOnSelect',[
 
 
4450
 
4451
+ ], function () {
4452
+ function CloseOnSelect () { }
 
4453
 
4454
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4455
+ var self = this;
 
 
 
 
 
4456
 
4457
+ decorated.call(this, container, $container);
 
 
 
4458
 
4459
+ container.on('select', function (evt) {
4460
+ self._selectTriggered(evt);
4461
+ });
 
 
 
4462
 
4463
+ container.on('unselect', function (evt) {
4464
+ self._selectTriggered(evt);
4465
+ });
4466
+ };
 
4467
 
4468
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4469
+ var originalEvent = evt.originalEvent;
4470
 
4471
+ // Don't close if the control key is being held
4472
+ if (originalEvent && originalEvent.ctrlKey) {
4473
+ return;
4474
+ }
4475
 
4476
+ this.trigger('close', {
4477
+ originalEvent: originalEvent,
4478
+ originalSelect2Event: evt
4479
+ });
4480
+ };
4481
 
4482
+ return CloseOnSelect;
4483
+ });
4484
 
4485
+ S2.define('select2/i18n/en',[],function () {
4486
+ // English
4487
+ return {
4488
+ errorLoading: function () {
4489
+ return 'The results could not be loaded.';
4490
+ },
4491
+ inputTooLong: function (args) {
4492
+ var overChars = args.input.length - args.maximum;
4493
 
4494
+ var message = 'Please delete ' + overChars + ' character';
4495
 
4496
+ if (overChars != 1) {
4497
+ message += 's';
4498
+ }
4499
 
4500
+ return message;
4501
+ },
4502
+ inputTooShort: function (args) {
4503
+ var remainingChars = args.minimum - args.input.length;
4504
 
4505
+ var message = 'Please enter ' + remainingChars + ' or more characters';
 
4506
 
4507
+ return message;
4508
+ },
4509
+ loadingMore: function () {
4510
+ return 'Loading more results…';
4511
+ },
4512
+ maximumSelected: function (args) {
4513
+ var message = 'You can only select ' + args.maximum + ' item';
4514
 
4515
+ if (args.maximum != 1) {
4516
+ message += 's';
4517
+ }
 
4518
 
4519
+ return message;
4520
+ },
4521
+ noResults: function () {
4522
+ return 'No results found';
4523
+ },
4524
+ searching: function () {
4525
+ return 'Searching…';
4526
+ }
4527
+ };
4528
+ });
4529
 
4530
+ S2.define('select2/defaults',[
4531
+ 'jquery',
4532
+ 'require',
 
4533
 
4534
+ './results',
 
4535
 
4536
+ './selection/single',
4537
+ './selection/multiple',
4538
+ './selection/placeholder',
4539
+ './selection/allowClear',
4540
+ './selection/search',
4541
+ './selection/eventRelay',
4542
 
4543
+ './utils',
4544
+ './translation',
4545
+ './diacritics',
4546
 
4547
+ './data/select',
4548
+ './data/array',
4549
+ './data/ajax',
4550
+ './data/tags',
4551
+ './data/tokenizer',
4552
+ './data/minimumInputLength',
4553
+ './data/maximumInputLength',
4554
+ './data/maximumSelectionLength',
4555
 
4556
+ './dropdown',
4557
+ './dropdown/search',
4558
+ './dropdown/hidePlaceholder',
4559
+ './dropdown/infiniteScroll',
4560
+ './dropdown/attachBody',
4561
+ './dropdown/minimumResultsForSearch',
4562
+ './dropdown/selectOnClose',
4563
+ './dropdown/closeOnSelect',
4564
 
4565
+ './i18n/en'
4566
+ ], function ($, require,
 
 
 
4567
 
4568
+ ResultsList,
 
 
 
4569
 
4570
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4571
+ SelectionSearch, EventRelay,
 
 
 
 
 
 
4572
 
4573
+ Utils, Translation, DIACRITICS,
 
4574
 
4575
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4576
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
 
 
4577
 
4578
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4579
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
 
 
 
4580
 
4581
+ EnglishTranslation) {
4582
+ function Defaults () {
4583
+ this.reset();
4584
+ }
4585
 
4586
+ Defaults.prototype.apply = function (options) {
4587
+ options = $.extend(true, {}, this.defaults, options);
4588
 
4589
+ if (options.dataAdapter == null) {
4590
+ if (options.ajax != null) {
4591
+ options.dataAdapter = AjaxData;
4592
+ } else if (options.data != null) {
4593
+ options.dataAdapter = ArrayData;
4594
+ } else {
4595
+ options.dataAdapter = SelectData;
4596
+ }
4597
 
4598
+ if (options.minimumInputLength > 0) {
4599
+ options.dataAdapter = Utils.Decorate(
4600
+ options.dataAdapter,
4601
+ MinimumInputLength
4602
+ );
4603
+ }
4604
 
4605
+ if (options.maximumInputLength > 0) {
4606
+ options.dataAdapter = Utils.Decorate(
4607
+ options.dataAdapter,
4608
+ MaximumInputLength
4609
+ );
4610
+ }
4611
 
4612
+ if (options.maximumSelectionLength > 0) {
4613
+ options.dataAdapter = Utils.Decorate(
4614
+ options.dataAdapter,
4615
+ MaximumSelectionLength
4616
+ );
4617
+ }
4618
 
4619
+ if (options.tags) {
4620
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4621
+ }
4622
 
4623
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4624
+ options.dataAdapter = Utils.Decorate(
4625
+ options.dataAdapter,
4626
+ Tokenizer
4627
+ );
4628
+ }
4629
 
4630
+ if (options.query != null) {
4631
+ var Query = require(options.amdBase + 'compat/query');
4632
 
4633
+ options.dataAdapter = Utils.Decorate(
4634
+ options.dataAdapter,
4635
+ Query
4636
+ );
4637
+ }
4638
 
4639
+ if (options.initSelection != null) {
4640
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
 
4641
 
4642
+ options.dataAdapter = Utils.Decorate(
4643
+ options.dataAdapter,
4644
+ InitSelection
4645
+ );
4646
+ }
4647
+ }
4648
 
4649
+ if (options.resultsAdapter == null) {
4650
+ options.resultsAdapter = ResultsList;
 
 
4651
 
4652
+ if (options.ajax != null) {
4653
+ options.resultsAdapter = Utils.Decorate(
4654
+ options.resultsAdapter,
4655
+ InfiniteScroll
4656
+ );
4657
+ }
4658
 
4659
+ if (options.placeholder != null) {
4660
+ options.resultsAdapter = Utils.Decorate(
4661
+ options.resultsAdapter,
4662
+ HidePlaceholder
4663
+ );
4664
+ }
4665
 
4666
+ if (options.selectOnClose) {
4667
+ options.resultsAdapter = Utils.Decorate(
4668
+ options.resultsAdapter,
4669
+ SelectOnClose
4670
+ );
4671
+ }
4672
+ }
4673
 
4674
+ if (options.dropdownAdapter == null) {
4675
+ if (options.multiple) {
4676
+ options.dropdownAdapter = Dropdown;
4677
+ } else {
4678
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4679
 
4680
+ options.dropdownAdapter = SearchableDropdown;
4681
+ }
4682
 
4683
+ if (options.minimumResultsForSearch !== 0) {
4684
+ options.dropdownAdapter = Utils.Decorate(
4685
+ options.dropdownAdapter,
4686
+ MinimumResultsForSearch
4687
+ );
4688
+ }
4689
 
4690
+ if (options.closeOnSelect) {
4691
+ options.dropdownAdapter = Utils.Decorate(
4692
+ options.dropdownAdapter,
4693
+ CloseOnSelect
4694
+ );
4695
+ }
4696
 
4697
+ if (
4698
+ options.dropdownCssClass != null ||
4699
+ options.dropdownCss != null ||
4700
+ options.adaptDropdownCssClass != null
4701
+ ) {
4702
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4703
+
4704
+ options.dropdownAdapter = Utils.Decorate(
4705
+ options.dropdownAdapter,
4706
+ DropdownCSS
4707
+ );
4708
+ }
4709
 
4710
+ options.dropdownAdapter = Utils.Decorate(
4711
+ options.dropdownAdapter,
4712
+ AttachBody
4713
+ );
4714
+ }
 
4715
 
4716
+ if (options.selectionAdapter == null) {
4717
+ if (options.multiple) {
4718
+ options.selectionAdapter = MultipleSelection;
4719
+ } else {
4720
+ options.selectionAdapter = SingleSelection;
4721
+ }
4722
 
4723
+ // Add the placeholder mixin if a placeholder was specified
4724
+ if (options.placeholder != null) {
4725
+ options.selectionAdapter = Utils.Decorate(
4726
+ options.selectionAdapter,
4727
+ Placeholder
4728
+ );
4729
+ }
4730
 
4731
+ if (options.allowClear) {
4732
+ options.selectionAdapter = Utils.Decorate(
4733
+ options.selectionAdapter,
4734
+ AllowClear
4735
+ );
4736
+ }
4737
 
4738
+ if (options.multiple) {
4739
+ options.selectionAdapter = Utils.Decorate(
4740
+ options.selectionAdapter,
4741
+ SelectionSearch
4742
+ );
4743
+ }
 
4744
 
4745
+ if (
4746
+ options.containerCssClass != null ||
4747
+ options.containerCss != null ||
4748
+ options.adaptContainerCssClass != null
4749
+ ) {
4750
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4751
+
4752
+ options.selectionAdapter = Utils.Decorate(
4753
+ options.selectionAdapter,
4754
+ ContainerCSS
4755
+ );
4756
+ }
4757
 
4758
+ options.selectionAdapter = Utils.Decorate(
4759
+ options.selectionAdapter,
4760
+ EventRelay
4761
+ );
4762
+ }
4763
 
4764
+ if (typeof options.language === 'string') {
4765
+ // Check if the language is specified with a region
4766
+ if (options.language.indexOf('-') > 0) {
4767
+ // Extract the region information if it is included
4768
+ var languageParts = options.language.split('-');
4769
+ var baseLanguage = languageParts[0];
4770
 
4771
+ options.language = [options.language, baseLanguage];
4772
+ } else {
4773
+ options.language = [options.language];
4774
+ }
4775
+ }
4776
 
4777
+ if ($.isArray(options.language)) {
4778
+ var languages = new Translation();
4779
+ options.language.push('en');
4780
+
4781
+ var languageNames = options.language;
4782
+
4783
+ for (var l = 0; l < languageNames.length; l++) {
4784
+ var name = languageNames[l];
4785
+ var language = {};
4786
+
4787
+ try {
4788
+ // Try to load it with the original name
4789
+ language = Translation.loadPath(name);
4790
+ } catch (e) {
4791
+ try {
4792
+ // If we couldn't load it, check if it wasn't the full path
4793
+ name = this.defaults.amdLanguageBase + name;
4794
+ language = Translation.loadPath(name);
4795
+ } catch (ex) {
4796
+ // The translation could not be loaded at all. Sometimes this is
4797
+ // because of a configuration problem, other times this can be
4798
+ // because of how Select2 helps load all possible translation files.
4799
+ if (options.debug && window.console && console.warn) {
4800
+ console.warn(
4801
+ 'Select2: The language file for "' + name + '" could not be ' +
4802
+ 'automatically loaded. A fallback will be used instead.'
4803
+ );
4804
+ }
4805
+
4806
+ continue;
4807
+ }
4808
+ }
4809
 
4810
+ languages.extend(language);
4811
+ }
4812
 
4813
+ options.translations = languages;
4814
+ } else {
4815
+ var baseTranslation = Translation.loadPath(
4816
+ this.defaults.amdLanguageBase + 'en'
4817
+ );
4818
+ var customTranslation = new Translation(options.language);
4819
 
4820
+ customTranslation.extend(baseTranslation);
 
 
 
4821
 
4822
+ options.translations = customTranslation;
4823
+ }
4824
 
4825
+ return options;
4826
+ };
 
 
4827
 
4828
+ Defaults.prototype.reset = function () {
4829
+ function stripDiacritics (text) {
4830
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4831
+ function match(a) {
4832
+ return DIACRITICS[a] || a;
4833
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4834
 
4835
+ return text.replace(/[^\u0000-\u007E]/g, match);
4836
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4837
 
4838
+ function matcher (params, data) {
4839
+ // Always return the object if there is nothing to compare
4840
+ if ($.trim(params.term) === '') {
4841
+ return data;
4842
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4843
 
4844
+ // Do a recursive check for options with children
4845
+ if (data.children && data.children.length > 0) {
4846
+ // Clone the data object if there are children
4847
+ // This is required as we modify the object to remove any non-matches
4848
+ var match = $.extend(true, {}, data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4849
 
4850
+ // Check each child of the option
4851
+ for (var c = data.children.length - 1; c >= 0; c--) {
4852
+ var child = data.children[c];
 
 
 
 
 
 
 
 
 
4853
 
4854
+ var matches = matcher(params, child);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4855
 
4856
+ // If there wasn't a match, remove the object in the array
4857
+ if (matches == null) {
4858
+ match.children.splice(c, 1);
4859
+ }
4860
+ }
4861
 
4862
+ // If any children matched, return the new object
4863
+ if (match.children.length > 0) {
4864
+ return match;
4865
+ }
4866
 
4867
+ // If there were no matching children, check just the plain object
4868
+ return matcher(params, match);
4869
+ }
 
 
 
4870
 
4871
+ var original = stripDiacritics(data.text).toUpperCase();
4872
+ var term = stripDiacritics(params.term).toUpperCase();
4873
 
4874
+ // Check if the text contains the term
4875
+ if (original.indexOf(term) > -1) {
4876
+ return data;
4877
+ }
4878
 
4879
+ // If it doesn't contain the term, don't return anything
4880
+ return null;
4881
+ }
4882
 
4883
+ this.defaults = {
4884
+ amdBase: './',
4885
+ amdLanguageBase: './i18n/',
4886
+ closeOnSelect: true,
4887
+ debug: false,
4888
+ dropdownAutoWidth: false,
4889
+ escapeMarkup: Utils.escapeMarkup,
4890
+ language: EnglishTranslation,
4891
+ matcher: matcher,
4892
+ minimumInputLength: 0,
4893
+ maximumInputLength: 0,
4894
+ maximumSelectionLength: 0,
4895
+ minimumResultsForSearch: 0,
4896
+ selectOnClose: false,
4897
+ sorter: function (data) {
4898
+ return data;
4899
+ },
4900
+ templateResult: function (result) {
4901
+ return result.text;
4902
+ },
4903
+ templateSelection: function (selection) {
4904
+ return selection.text;
4905
+ },
4906
+ theme: 'default',
4907
+ width: 'resolve'
4908
+ };
4909
+ };
4910
 
4911
+ Defaults.prototype.set = function (key, value) {
4912
+ var camelKey = $.camelCase(key);
4913
 
4914
+ var data = {};
4915
+ data[camelKey] = value;
 
 
 
4916
 
4917
+ var convertedData = Utils._convertData(data);
 
 
 
 
4918
 
4919
+ $.extend(this.defaults, convertedData);
4920
+ };
 
4921
 
4922
+ var defaults = new Defaults();
4923
 
4924
+ return defaults;
4925
+ });
 
 
 
4926
 
4927
+ S2.define('select2/options',[
4928
+ 'require',
4929
+ 'jquery',
4930
+ './defaults',
4931
+ './utils'
4932
+ ], function (require, $, Defaults, Utils) {
4933
+ function Options (options, $element) {
4934
+ this.options = options;
4935
+
4936
+ if ($element != null) {
4937
+ this.fromElement($element);
4938
+ }
4939
 
4940
+ this.options = Defaults.apply(this.options);
 
 
4941
 
4942
+ if ($element && $element.is('input')) {
4943
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4944
 
4945
+ this.options.dataAdapter = Utils.Decorate(
4946
+ this.options.dataAdapter,
4947
+ InputCompat
4948
+ );
4949
+ }
4950
+ }
4951
 
4952
+ Options.prototype.fromElement = function ($e) {
4953
+ var excludedData = ['select2'];
 
4954
 
4955
+ if (this.options.multiple == null) {
4956
+ this.options.multiple = $e.prop('multiple');
4957
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4958
 
4959
+ if (this.options.disabled == null) {
4960
+ this.options.disabled = $e.prop('disabled');
4961
+ }
4962
 
4963
+ if (this.options.language == null) {
4964
+ if ($e.prop('lang')) {
4965
+ this.options.language = $e.prop('lang').toLowerCase();
4966
+ } else if ($e.closest('[lang]').prop('lang')) {
4967
+ this.options.language = $e.closest('[lang]').prop('lang');
4968
+ }
4969
+ }
4970
 
4971
+ if (this.options.dir == null) {
4972
+ if ($e.prop('dir')) {
4973
+ this.options.dir = $e.prop('dir');
4974
+ } else if ($e.closest('[dir]').prop('dir')) {
4975
+ this.options.dir = $e.closest('[dir]').prop('dir');
4976
+ } else {
4977
+ this.options.dir = 'ltr';
4978
+ }
4979
+ }
4980
 
4981
+ $e.prop('disabled', this.options.disabled);
4982
+ $e.prop('multiple', this.options.multiple);
4983
 
4984
+ if ($e.data('select2Tags')) {
4985
+ if (this.options.debug && window.console && console.warn) {
4986
+ console.warn(
4987
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
4988
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4989
+ 'removed in future versions of Select2.'
4990
+ );
4991
+ }
4992
 
4993
+ $e.data('data', $e.data('select2Tags'));
4994
+ $e.data('tags', true);
4995
+ }
4996
 
4997
+ if ($e.data('ajaxUrl')) {
4998
+ if (this.options.debug && window.console && console.warn) {
4999
+ console.warn(
5000
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5001
+ '`data-ajax--url` and support for the old attribute will be removed' +
5002
+ ' in future versions of Select2.'
5003
+ );
5004
+ }
5005
 
5006
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
5007
+ $e.data('ajax--url', $e.data('ajaxUrl'));
5008
+ }
 
 
 
 
 
 
5009
 
5010
+ var dataset = {};
 
5011
 
5012
+ // Prefer the element's `dataset` attribute if it exists
5013
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5014
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5015
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5016
+ } else {
5017
+ dataset = $e.data();
5018
+ }
 
5019
 
5020
+ var data = $.extend(true, {}, dataset);
 
 
5021
 
5022
+ data = Utils._convertData(data);
 
 
 
 
 
 
 
 
 
 
 
5023
 
5024
+ for (var key in data) {
5025
+ if ($.inArray(key, excludedData) > -1) {
5026
+ continue;
5027
+ }
5028
 
5029
+ if ($.isPlainObject(this.options[key])) {
5030
+ $.extend(this.options[key], data[key]);
5031
+ } else {
5032
+ this.options[key] = data[key];
5033
+ }
5034
+ }
 
5035
 
5036
+ return this;
5037
+ };
5038
 
5039
+ Options.prototype.get = function (key) {
5040
+ return this.options[key];
5041
+ };
5042
 
5043
+ Options.prototype.set = function (key, val) {
5044
+ this.options[key] = val;
5045
+ };
 
5046
 
5047
+ return Options;
5048
+ });
 
 
 
 
5049
 
5050
+ S2.define('select2/core',[
5051
+ 'jquery',
5052
+ './options',
5053
+ './utils',
5054
+ './keys'
5055
+ ], function ($, Options, Utils, KEYS) {
5056
+ var Select2 = function ($element, options) {
5057
+ if ($element.data('select2') != null) {
5058
+ $element.data('select2').destroy();
5059
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5060
 
5061
+ this.$element = $element;
5062
 
5063
+ this.id = this._generateId($element);
5064
 
5065
+ options = options || {};
5066
 
5067
+ this.options = new Options(options, $element);
5068
 
5069
+ Select2.__super__.constructor.call(this);
5070
 
5071
+ // Set up the tabindex
5072
 
5073
+ var tabindex = $element.attr('tabindex') || 0;
5074
+ $element.data('old-tabindex', tabindex);
5075
+ $element.attr('tabindex', '-1');
5076
 
5077
+ // Set up containers and adapters
5078
 
5079
+ var DataAdapter = this.options.get('dataAdapter');
5080
+ this.dataAdapter = new DataAdapter($element, this.options);
5081
 
5082
+ var $container = this.render();
5083
 
5084
+ this._placeContainer($container);
5085
 
5086
+ var SelectionAdapter = this.options.get('selectionAdapter');
5087
+ this.selection = new SelectionAdapter($element, this.options);
5088
+ this.$selection = this.selection.render();
5089
 
5090
+ this.selection.position(this.$selection, $container);
5091
 
5092
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5093
+ this.dropdown = new DropdownAdapter($element, this.options);
5094
+ this.$dropdown = this.dropdown.render();
5095
 
5096
+ this.dropdown.position(this.$dropdown, $container);
5097
 
5098
+ var ResultsAdapter = this.options.get('resultsAdapter');
5099
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5100
+ this.$results = this.results.render();
5101
 
5102
+ this.results.position(this.$results, this.$dropdown);
5103
 
5104
+ // Bind events
5105
 
5106
+ var self = this;
5107
 
5108
+ // Bind the container to all of the adapters
5109
+ this._bindAdapters();
5110
 
5111
+ // Register any DOM event handlers
5112
+ this._registerDomEvents();
5113
 
5114
+ // Register any internal event handlers
5115
+ this._registerDataEvents();
5116
+ this._registerSelectionEvents();
5117
+ this._registerDropdownEvents();
5118
+ this._registerResultsEvents();
5119
+ this._registerEvents();
5120
 
5121
+ // Set the initial state
5122
+ this.dataAdapter.current(function (initialData) {
5123
+ self.trigger('selection:update', {
5124
+ data: initialData
5125
+ });
5126
+ });
5127
 
5128
+ // Hide the original select
5129
+ $element.addClass('select2-hidden-accessible');
5130
+ $element.attr('aria-hidden', 'true');
5131
 
5132
+ // Synchronize any monitored attributes
5133
+ this._syncAttributes();
5134
 
5135
+ $element.data('select2', this);
5136
+ };
5137
 
5138
+ Utils.Extend(Select2, Utils.Observable);
5139
 
5140
+ Select2.prototype._generateId = function ($element) {
5141
+ var id = '';
5142
 
5143
+ if ($element.attr('id') != null) {
5144
+ id = $element.attr('id');
5145
+ } else if ($element.attr('name') != null) {
5146
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5147
+ } else {
5148
+ id = Utils.generateChars(4);
5149
+ }
5150
 
5151
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5152
+ id = 'select2-' + id;
5153
 
5154
+ return id;
5155
+ };
5156
 
5157
+ Select2.prototype._placeContainer = function ($container) {
5158
+ $container.insertAfter(this.$element);
5159
 
5160
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5161
 
5162
+ if (width != null) {
5163
+ $container.css('width', width);
5164
+ }
5165
+ };
5166
 
5167
+ Select2.prototype._resolveWidth = function ($element, method) {
5168
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5169
 
5170
+ if (method == 'resolve') {
5171
+ var styleWidth = this._resolveWidth($element, 'style');
5172
 
5173
+ if (styleWidth != null) {
5174
+ return styleWidth;
5175
+ }
5176
 
5177
+ return this._resolveWidth($element, 'element');
5178
+ }
5179
 
5180
+ if (method == 'element') {
5181
+ var elementWidth = $element.outerWidth(false);
5182
 
5183
+ if (elementWidth <= 0) {
5184
+ return 'auto';
5185
+ }
5186
 
5187
+ return elementWidth + 'px';
5188
+ }
5189
 
5190
+ if (method == 'style') {
5191
+ var style = $element.attr('style');
5192
 
5193
+ if (typeof(style) !== 'string') {
5194
+ return null;
5195
+ }
5196
 
5197
+ var attrs = style.split(';');
5198
 
5199
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5200
+ var attr = attrs[i].replace(/\s/g, '');
5201
+ var matches = attr.match(WIDTH);
5202
 
5203
+ if (matches !== null && matches.length >= 1) {
5204
+ return matches[1];
5205
+ }
5206
+ }
5207
 
5208
+ return null;
5209
+ }
5210
 
5211
+ return method;
5212
+ };
5213
 
5214
+ Select2.prototype._bindAdapters = function () {
5215
+ this.dataAdapter.bind(this, this.$container);
5216
+ this.selection.bind(this, this.$container);
5217
 
5218
+ this.dropdown.bind(this, this.$container);
5219
+ this.results.bind(this, this.$container);
5220
+ };
5221
 
5222
+ Select2.prototype._registerDomEvents = function () {
5223
+ var self = this;
5224
 
5225
+ this.$element.on('change.select2', function () {
5226
+ self.dataAdapter.current(function (data) {
5227
+ self.trigger('selection:update', {
5228
+ data: data
5229
+ });
5230
+ });
5231
+ });
5232
 
5233
+ this.$element.on('focus.select2', function (evt) {
5234
+ self.trigger('focus', evt);
5235
+ });
5236
 
5237
+ this._syncA = Utils.bind(this._syncAttributes, this);
5238
+ this._syncS = Utils.bind(this._syncSubtree, this);
5239
 
5240
+ if (this.$element[0].attachEvent) {
5241
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5242
+ }
5243
 
5244
+ var observer = window.MutationObserver ||
5245
+ window.WebKitMutationObserver ||
5246
+ window.MozMutationObserver
5247
+ ;
5248
+
5249
+ if (observer != null) {
5250
+ this._observer = new observer(function (mutations) {
5251
+ $.each(mutations, self._syncA);
5252
+ $.each(mutations, self._syncS);
5253
+ });
5254
+ this._observer.observe(this.$element[0], {
5255
+ attributes: true,
5256
+ childList: true,
5257
+ subtree: false
5258
+ });
5259
+ } else if (this.$element[0].addEventListener) {
5260
+ this.$element[0].addEventListener(
5261
+ 'DOMAttrModified',
5262
+ self._syncA,
5263
+ false
5264
+ );
5265
+ this.$element[0].addEventListener(
5266
+ 'DOMNodeInserted',
5267
+ self._syncS,
5268
+ false
5269
+ );
5270
+ this.$element[0].addEventListener(
5271
+ 'DOMNodeRemoved',
5272
+ self._syncS,
5273
+ false
5274
+ );
5275
+ }
5276
+ };
5277
 
5278
+ Select2.prototype._registerDataEvents = function () {
5279
+ var self = this;
5280
 
5281
+ this.dataAdapter.on('*', function (name, params) {
5282
+ self.trigger(name, params);
5283
+ });
5284
+ };
5285
 
5286
+ Select2.prototype._registerSelectionEvents = function () {
5287
+ var self = this;
5288
+ var nonRelayEvents = ['toggle', 'focus'];
5289
 
5290
+ this.selection.on('toggle', function () {
5291
+ self.toggleDropdown();
5292
+ });
5293
 
5294
+ this.selection.on('focus', function (params) {
5295
+ self.focus(params);
5296
+ });
5297
 
5298
+ this.selection.on('*', function (name, params) {
5299
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5300
+ return;
5301
+ }
5302
 
5303
+ self.trigger(name, params);
5304
+ });
5305
+ };
5306
 
5307
+ Select2.prototype._registerDropdownEvents = function () {
5308
+ var self = this;
5309
 
5310
+ this.dropdown.on('*', function (name, params) {
5311
+ self.trigger(name, params);
5312
+ });
5313
+ };
5314
 
5315
+ Select2.prototype._registerResultsEvents = function () {
5316
+ var self = this;
5317
 
5318
+ this.results.on('*', function (name, params) {
5319
+ self.trigger(name, params);
5320
+ });
5321
+ };
5322
 
5323
+ Select2.prototype._registerEvents = function () {
5324
+ var self = this;
5325
 
5326
+ this.on('open', function () {
5327
+ self.$container.addClass('select2-container--open');
5328
+ });
5329
 
5330
+ this.on('close', function () {
5331
+ self.$container.removeClass('select2-container--open');
5332
+ });
5333
 
5334
+ this.on('enable', function () {
5335
+ self.$container.removeClass('select2-container--disabled');
5336
+ });
5337
 
5338
+ this.on('disable', function () {
5339
+ self.$container.addClass('select2-container--disabled');
5340
+ });
5341
 
5342
+ this.on('blur', function () {
5343
+ self.$container.removeClass('select2-container--focus');
5344
+ });
5345
 
5346
+ this.on('query', function (params) {
5347
+ if (!self.isOpen()) {
5348
+ self.trigger('open', {});
5349
+ }
5350
 
5351
+ this.dataAdapter.query(params, function (data) {
5352
+ self.trigger('results:all', {
5353
+ data: data,
5354
+ query: params
5355
+ });
5356
+ });
5357
+ });
5358
+
5359
+ this.on('query:append', function (params) {
5360
+ this.dataAdapter.query(params, function (data) {
5361
+ self.trigger('results:append', {
5362
+ data: data,
5363
+ query: params
5364
+ });
5365
+ });
5366
+ });
5367
+
5368
+ this.on('keypress', function (evt) {
5369
+ var key = evt.which;
5370
+
5371
+ if (self.isOpen()) {
5372
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5373
+ (key === KEYS.UP && evt.altKey)) {
5374
+ self.close();
5375
+
5376
+ evt.preventDefault();
5377
+ } else if (key === KEYS.ENTER) {
5378
+ self.trigger('results:select', {});
5379
+
5380
+ evt.preventDefault();
5381
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5382
+ self.trigger('results:toggle', {});
5383
+
5384
+ evt.preventDefault();
5385
+ } else if (key === KEYS.UP) {
5386
+ self.trigger('results:previous', {});
5387
+
5388
+ evt.preventDefault();
5389
+ } else if (key === KEYS.DOWN) {
5390
+ self.trigger('results:next', {});
5391
+
5392
+ evt.preventDefault();
5393
+ }
5394
+ } else {
5395
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5396
+ (key === KEYS.DOWN && evt.altKey)) {
5397
+ self.open();
5398
 
5399
+ evt.preventDefault();
5400
+ }
5401
+ }
5402
+ });
5403
+ };
5404
 
5405
+ Select2.prototype._syncAttributes = function () {
5406
+ this.options.set('disabled', this.$element.prop('disabled'));
 
 
5407
 
5408
+ if (this.options.get('disabled')) {
5409
+ if (this.isOpen()) {
5410
+ this.close();
5411
+ }
5412
 
5413
+ this.trigger('disable', {});
5414
+ } else {
5415
+ this.trigger('enable', {});
5416
+ }
5417
+ };
5418
 
5419
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5420
+ var changed = false;
5421
+ var self = this;
5422
+
5423
+ // Ignore any mutation events raised for elements that aren't options or
5424
+ // optgroups. This handles the case when the select element is destroyed
5425
+ if (
5426
+ evt && evt.target && (
5427
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5428
+ )
5429
+ ) {
5430
+ return;
5431
+ }
5432
 
5433
+ if (!mutations) {
5434
+ // If mutation events aren't supported, then we can only assume that the
5435
+ // change affected the selections
5436
+ changed = true;
5437
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5438
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5439
+ var node = mutations.addedNodes[n];
5440
 
5441
+ if (node.selected) {
5442
+ changed = true;
5443
+ }
5444
+ }
5445
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5446
+ changed = true;
5447
+ }
5448
 
5449
+ // Only re-pull the data if we think there is a change
5450
+ if (changed) {
5451
+ this.dataAdapter.current(function (currentData) {
5452
+ self.trigger('selection:update', {
5453
+ data: currentData
5454
+ });
5455
+ });
5456
+ }
5457
+ };
5458
 
5459
+ /**
5460
+ * Override the trigger method to automatically trigger pre-events when
5461
+ * there are events that can be prevented.
5462
+ */
5463
+ Select2.prototype.trigger = function (name, args) {
5464
+ var actualTrigger = Select2.__super__.trigger;
5465
+ var preTriggerMap = {
5466
+ 'open': 'opening',
5467
+ 'close': 'closing',
5468
+ 'select': 'selecting',
5469
+ 'unselect': 'unselecting'
5470
+ };
5471
+
5472
+ if (args === undefined) {
5473
+ args = {};
5474
+ }
5475
 
5476
+ if (name in preTriggerMap) {
5477
+ var preTriggerName = preTriggerMap[name];
5478
+ var preTriggerArgs = {
5479
+ prevented: false,
5480
+ name: name,
5481
+ args: args
5482
+ };
5483
 
5484
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5485
 
5486
+ if (preTriggerArgs.prevented) {
5487
+ args.prevented = true;
 
 
 
 
 
5488
 
5489
+ return;
5490
+ }
5491
+ }
 
 
 
 
5492
 
5493
+ actualTrigger.call(this, name, args);
5494
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5495
 
5496
+ Select2.prototype.toggleDropdown = function () {
5497
+ if (this.options.get('disabled')) {
5498
+ return;
5499
+ }
 
 
 
5500
 
5501
+ if (this.isOpen()) {
5502
+ this.close();
5503
+ } else {
5504
+ this.open();
5505
+ }
5506
+ };
5507
 
5508
+ Select2.prototype.open = function () {
5509
+ if (this.isOpen()) {
5510
+ return;
5511
+ }
5512
 
5513
+ this.trigger('query', {});
5514
+ };
 
5515
 
5516
+ Select2.prototype.close = function () {
5517
+ if (!this.isOpen()) {
5518
+ return;
5519
+ }
5520
 
5521
+ this.trigger('close', {});
5522
+ };
 
 
5523
 
5524
+ Select2.prototype.isOpen = function () {
5525
+ return this.$container.hasClass('select2-container--open');
5526
+ };
 
 
 
5527
 
5528
+ Select2.prototype.hasFocus = function () {
5529
+ return this.$container.hasClass('select2-container--focus');
5530
+ };
 
5531
 
5532
+ Select2.prototype.focus = function (data) {
5533
+ // No need to re-trigger focus events if we are already focused
5534
+ if (this.hasFocus()) {
5535
+ return;
5536
+ }
5537
 
5538
+ this.$container.addClass('select2-container--focus');
5539
+ this.trigger('focus', {});
5540
+ };
 
5541
 
5542
+ Select2.prototype.enable = function (args) {
5543
+ if (this.options.get('debug') && window.console && console.warn) {
5544
+ console.warn(
5545
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5546
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5547
+ ' instead.'
5548
+ );
5549
+ }
5550
 
5551
+ if (args == null || args.length === 0) {
5552
+ args = [true];
5553
+ }
5554
 
5555
+ var disabled = !args[0];
 
 
5556
 
5557
+ this.$element.prop('disabled', disabled);
5558
+ };
 
 
 
5559
 
5560
+ Select2.prototype.data = function () {
5561
+ if (this.options.get('debug') &&
5562
+ arguments.length > 0 && window.console && console.warn) {
5563
+ console.warn(
5564
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5565
+ 'should consider setting the value instead using `$element.val()`.'
5566
+ );
5567
+ }
 
 
 
 
5568
 
5569
+ var data = [];
 
 
5570
 
5571
+ this.dataAdapter.current(function (currentData) {
5572
+ data = currentData;
5573
+ });
5574
 
5575
+ return data;
5576
+ };
5577
 
5578
+ Select2.prototype.val = function (args) {
5579
+ if (this.options.get('debug') && window.console && console.warn) {
5580
+ console.warn(
5581
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5582
+ ' removed in later Select2 versions. Use $element.val() instead.'
5583
+ );
5584
+ }
 
5585
 
5586
+ if (args == null || args.length === 0) {
5587
+ return this.$element.val();
5588
+ }
5589
 
5590
+ var newVal = args[0];
 
 
5591
 
5592
+ if ($.isArray(newVal)) {
5593
+ newVal = $.map(newVal, function (obj) {
5594
+ return obj.toString();
5595
+ });
5596
+ }
5597
 
5598
+ this.$element.val(newVal).trigger('change');
5599
+ };
 
 
 
 
 
5600
 
5601
+ Select2.prototype.destroy = function () {
5602
+ this.$container.remove();
 
5603
 
5604
+ if (this.$element[0].detachEvent) {
5605
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5606
+ }
5607
 
5608
+ if (this._observer != null) {
5609
+ this._observer.disconnect();
5610
+ this._observer = null;
5611
+ } else if (this.$element[0].removeEventListener) {
5612
+ this.$element[0]
5613
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5614
+ this.$element[0]
5615
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5616
+ this.$element[0]
5617
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5618
+ }
5619
 
5620
+ this._syncA = null;
5621
+ this._syncS = null;
5622
 
5623
+ this.$element.off('.select2');
5624
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5625
 
5626
+ this.$element.removeClass('select2-hidden-accessible');
5627
+ this.$element.attr('aria-hidden', 'false');
5628
+ this.$element.removeData('select2');
5629
 
5630
+ this.dataAdapter.destroy();
5631
+ this.selection.destroy();
5632
+ this.dropdown.destroy();
5633
+ this.results.destroy();
 
 
 
 
 
 
 
5634
 
5635
+ this.dataAdapter = null;
5636
+ this.selection = null;
5637
+ this.dropdown = null;
5638
+ this.results = null;
5639
+ };
5640
 
5641
+ Select2.prototype.render = function () {
5642
+ var $container = $(
5643
+ '<span class="select2 select2-container">' +
5644
+ '<span class="selection"></span>' +
5645
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5646
+ '</span>'
5647
+ );
5648
 
5649
+ $container.attr('dir', this.options.get('dir'));
 
 
5650
 
5651
+ this.$container = $container;
 
 
 
5652
 
5653
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
 
 
 
 
5654
 
5655
+ $container.data('element', this.$element);
 
 
 
 
 
 
5656
 
5657
+ return $container;
5658
+ };
5659
 
5660
+ return Select2;
5661
+ });
5662
 
5663
+ S2.define('jquery-mousewheel',[
5664
+ 'jquery'
5665
+ ], function ($) {
5666
+ // Used to shim jQuery.mousewheel for non-full builds.
5667
+ return $;
5668
+ });
5669
 
5670
+ S2.define('jquery.select2',[
5671
+ 'jquery',
5672
+ 'jquery-mousewheel',
5673
 
5674
+ './select2/core',
5675
+ './select2/defaults'
5676
+ ], function ($, _, Select2, Defaults) {
5677
+ if ($.fn.select2 == null) {
5678
+ // All methods that should return the element
5679
+ var thisMethods = ['open', 'close', 'destroy'];
5680
 
5681
+ $.fn.select2 = function (options) {
5682
+ options = options || {};
5683
 
5684
+ if (typeof options === 'object') {
5685
+ this.each(function () {
5686
+ var instanceOptions = $.extend(true, {}, options);
 
 
 
5687
 
5688
+ var instance = new Select2($(this), instanceOptions);
5689
+ });
 
5690
 
5691
+ return this;
5692
+ } else if (typeof options === 'string') {
5693
+ var ret;
5694
+ var args = Array.prototype.slice.call(arguments, 1);
 
 
5695
 
5696
+ this.each(function () {
5697
+ var instance = $(this).data('select2');
5698
 
5699
+ if (instance == null && window.console && console.error) {
5700
+ console.error(
5701
+ 'The select2(\'' + options + '\') method was called on an ' +
5702
+ 'element that is not using Select2.'
5703
+ );
5704
+ }
5705
 
5706
+ ret = instance[options].apply(instance, args);
5707
+ });
5708
 
5709
+ // Check if we should be returning `this`
5710
+ if ($.inArray(options, thisMethods) > -1) {
5711
+ return this;
5712
+ }
5713
 
5714
+ return ret;
5715
+ } else {
5716
+ throw new Error('Invalid arguments for Select2: ' + options);
5717
+ }
5718
+ };
5719
+ }
5720
 
5721
+ if ($.fn.select2.defaults == null) {
5722
+ $.fn.select2.defaults = Defaults;
5723
+ }
 
 
 
5724
 
5725
+ return Select2;
5726
  });
5727
 
5728
+ // Return the AMD loader configuration so it can be used outside of this file
5729
+ return {
5730
+ define: S2.define,
5731
+ require: S2.require
5732
+ };
5733
+ }());
5734
+
5735
+ // Autoload the jQuery bindings
5736
+ // We know that all of the modules exist above this, so we're safe
5737
+ var select2 = S2.require('jquery.select2');
5738
+
5739
+ // Hold the AMD module references on the jQuery function that was just loaded
5740
+ // This allows Select2 to use the internal loader outside of this file, such
5741
+ // as in the language files.
5742
+ jQuery.fn.select2.amd = S2;
5743
 
5744
+ // Return the Select2 instance for anyone who is importing it.
5745
+ return select2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5746
  }));
languages/customify.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the same license as the Customify package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Customify 1.5.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customify\n"
7
  "POT-Creation-Date: 2017-02-13 13:29:14+00:00\n"
8
  "MIME-Version: 1.0\n"
2
  # This file is distributed under the same license as the Customify package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Customify 1.5.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customify\n"
7
  "POT-Creation-Date: 2017-02-13 13:29:14+00:00\n"
8
  "MIME-Version: 1.0\n"
package.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "name": "customify",
3
- "devDependencies": {
4
- "gulp": "*",
5
- "gulp-sass": "*",
6
- "gulp-autoprefixer": "~1.0.1",
7
- "gulp-minify-css": "*",
8
- "gulp-ignore": "*",
9
- "gulp-notify": "*",
10
- "gulp-concat": "~2.1.7",
11
- "gulp-exec": "~2.0.1",
12
- "gulp-replace": "~0.4.0",
13
- "gulp-beautify": "*",
14
- "gulp-csscomb": "*",
15
- "gulp-rename": "*",
16
- "gulp-combine-media-queries": "*",
17
- "del": "*",
18
- "gulp-postcss": "*",
19
- "rtlcss": "*",
20
- "es6-promise": "*"
21
- }
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Customify - A Theme Customizer Booster ===
2
  Contributors: pixelgrade, euthelup, babbardel, vlad.olaru, cristianfrumusanu, raduconstantin
3
- Tags: customizer, css, editor, live, preview, customise
4
- Requires at least: 4.6.0
5
- Tested up to: 4.9.0
6
- Stable tag: 1.5.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -37,12 +37,22 @@ With [Customify](https://github.com/pixelgrade/customify), developers can easily
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
40
  = 1.5.6 =
41
  * New Fields Styling Improvements
42
 
43
  = 1.5.5 =
44
  * Added Compatibility with WordPress 4.9
45
 
 
 
 
 
 
46
  = 1.5.3 =
47
  * Update Style for WordPress 4.8
48
  * Updated Google Fonts list
1
  === Customify - A Theme Customizer Booster ===
2
  Contributors: pixelgrade, euthelup, babbardel, vlad.olaru, cristianfrumusanu, raduconstantin
3
+ Tags: customizer, css, editor, live, preview, customizer
4
+ Requires at least: 4.7.0
5
+ Tested up to: 4.9.1
6
+ Stable tag: 1.5.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
37
 
38
  == Changelog ==
39
 
40
+ = 1.5.7 =
41
+ * Improved development logic for easier testing
42
+ * Improved and fixed reset settings buttons
43
+ * Fixed a couple of styling inconsistencies regarding the Customizer
44
+
45
  = 1.5.6 =
46
  * New Fields Styling Improvements
47
 
48
  = 1.5.5 =
49
  * Added Compatibility with WordPress 4.9
50
 
51
+ = 1.5.4 =
52
+ * Allow 0 values for fonts line-height and letter-spacing
53
+ * Improved the plugin loading process and the CSS inline output
54
+ * Fixed small style issues for the Customizer bar
55
+
56
  = 1.5.3 =
57
  * Update Style for WordPress 4.8
58
  * Updated Google Fonts list
scss/customizer.scss CHANGED
@@ -51,7 +51,7 @@ $background-hover : #f5fcff;
51
  }
52
 
53
  // Change sections overflow
54
- .accordion-section-content {
55
  overflow: visible;
56
  }
57
 
@@ -461,7 +461,6 @@ $background-hover : #f5fcff;
461
 
462
  &:after {
463
  content: "";
464
-
465
  position: absolute;
466
  top: 90%;
467
  left: 0;
@@ -469,7 +468,7 @@ $background-hover : #f5fcff;
469
  z-index: 0;
470
 
471
  display: block;
472
- height: 100px;
473
  }
474
  }
475
  .font-options__head {
@@ -636,8 +635,6 @@ $background-hover : #f5fcff;
636
 
637
 
638
 
639
-
640
-
641
  //------------------------------------*\
642
  // $INPUT FIELDS
643
  //------------------------------------*/
@@ -678,9 +675,9 @@ $background-hover : #f5fcff;
678
  }
679
  }
680
 
681
- .customize-control {
682
 
683
- input[type=text],
684
  input[type=checkbox],
685
  input[type=password],
686
  input[type=color],
@@ -733,7 +730,7 @@ $background-hover : #f5fcff;
733
  }
734
  }
735
 
736
- &.customize-control-checkbox,
737
  &.customize-control-radio {
738
 
739
  // Split into two columns only when
@@ -915,6 +912,25 @@ $background-hover : #f5fcff;
915
  position: relative;
916
  }
917
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  .iris-picker {
919
  position : absolute;
920
  top : 40px;
@@ -988,25 +1004,6 @@ $background-hover : #f5fcff;
988
  }
989
  }
990
  }
991
-
992
- .wp-color-result,
993
- .wp-color-result.button {
994
- top : 0;
995
- height : 30px;
996
- width : 40px;
997
- margin : 0;
998
- padding : 0;
999
-
1000
- border-radius: $fields_border-radius;
1001
- background: #2ECC71;
1002
- border: 2px solid #B8DAEB;
1003
- box-shadow: none;
1004
-
1005
- &:after,
1006
- .wp-color-result-text {
1007
- display:none;
1008
- }
1009
- }
1010
  }
1011
 
1012
 
51
  }
52
 
53
  // Change sections overflow
54
+ .wp-full-overlay-sidebar-content .accordion-section-content {
55
  overflow: visible;
56
  }
57
 
461
 
462
  &:after {
463
  content: "";
 
464
  position: absolute;
465
  top: 90%;
466
  left: 0;
468
  z-index: 0;
469
 
470
  display: block;
471
+ height: 30px;
472
  }
473
  }
474
  .font-options__head {
635
 
636
 
637
 
 
 
638
  //------------------------------------*\
639
  // $INPUT FIELDS
640
  //------------------------------------*/
675
  }
676
  }
677
 
678
+ .wp-full-overlay-sidebar-content .customize-control {
679
 
680
+ input[type=text]:not(#_customize-input-wpcom_custom_css_content_width_control),
681
  input[type=checkbox],
682
  input[type=password],
683
  input[type=color],
730
  }
731
  }
732
 
733
+ &.customize-control-checkbox:not(#customize-control-jetpack_css_mode_control),
734
  &.customize-control-radio {
735
 
736
  // Split into two columns only when
912
  position: relative;
913
  }
914
 
915
+ .wp-color-result,
916
+ .wp-color-result.button {
917
+ top : 0;
918
+ height : 30px;
919
+ width : 40px;
920
+ margin : 0;
921
+ padding : 0;
922
+
923
+ border-radius: $fields_border-radius;
924
+ background: #2ECC71;
925
+ border: 2px solid #B8DAEB;
926
+ box-shadow: none;
927
+
928
+ &:after,
929
+ .wp-color-result-text {
930
+ display:none;
931
+ }
932
+ }
933
+
934
  .iris-picker {
935
  position : absolute;
936
  top : 40px;
1004
  }
1005
  }
1006
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1007
  }
1008
 
1009
 
views/form-partials/fields/reset_theme_mod.php CHANGED
@@ -25,7 +25,7 @@ $attrs = array(
25
  'type' => 'checkbox',
26
  ); ?>
27
  <div class="reset_customify_theme_mod">
28
- <div class="button" id="reset_theme_mods"><?php esc_html_e( 'Reset theme mod', 'customify' ); ?></div>
29
  <script>
30
  (function ($) {
31
  $(document).ready(function () {
@@ -37,7 +37,7 @@ $attrs = array(
37
  }
38
 
39
  $.ajax({
40
- url: customify_settings.wp_rest.root + 'customfiy/v1/delete_theme_mod',
41
  method: 'POST',
42
  beforeSend: function (xhr) {
43
  xhr.setRequestHeader('X-WP-Nonce', customify_settings.wp_rest.nonce);
@@ -47,7 +47,9 @@ $attrs = array(
47
  }
48
  }).done(function (response) {
49
  if ( response.success ) {
50
- alert( response.data );
 
 
51
  }
52
  }).error(function (e) {
53
  console.log(e);
@@ -58,3 +60,5 @@ $attrs = array(
58
  })(jQuery)
59
  </script>
60
  </div>
 
 
25
  'type' => 'checkbox',
26
  ); ?>
27
  <div class="reset_customify_theme_mod">
28
+ <div class="button" id="reset_theme_mods"><?php esc_html_e( 'Reset Theme Mods', 'customify' ); ?></div>
29
  <script>
30
  (function ($) {
31
  $(document).ready(function () {
37
  }
38
 
39
  $.ajax({
40
+ url: customify_settings.wp_rest.root + 'customify/v1/delete_theme_mod',
41
  method: 'POST',
42
  beforeSend: function (xhr) {
43
  xhr.setRequestHeader('X-WP-Nonce', customify_settings.wp_rest.nonce);
47
  }
48
  }).done(function (response) {
49
  if ( response.success ) {
50
+ alert( 'Success: ' + response.data );
51
+ } else {
52
+ alert( 'No luck: ' + response.data );
53
  }
54
  }).error(function (e) {
55
  console.log(e);
60
  })(jQuery)
61
  </script>
62
  </div>
63
+ <br>
64
+ <div class="field-desc"><?php esc_html_e('Resets all the Customizer settings introduced by the plugin. It will NOT reset core Customizer settings or plugin settings.'); ?></div>