WordPress.org

Make WordPress Core

Ticket #31696: issue-31696-select2.patch

File issue-31696-select2.patch, 264.7 KB (added by section214, 7 years ago)

Initial patch

  • wp-admin/admin-header.php

     
    5252
    5353wp_enqueue_style( 'colors' );
    5454wp_enqueue_style( 'ie' );
     55wp_enqueue_style( 'select2' );
    5556wp_enqueue_script('utils');
    5657wp_enqueue_script( 'svg-painter' );
     58wp_enqueue_script( 'wp-select2' );
    5759
    5860$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
    5961?>
  • wp-admin/options-general.php

     
    149149<tr>
    150150<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
    151151<td>
    152 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
     152<select class="select2" name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
    153153</td>
    154154</tr>
    155155<?php } else { ?>
     
    192192<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
    193193<td>
    194194
    195 <select id="timezone_string" name="timezone_string">
     195<select class="select2" id="timezone_string" name="timezone_string">
    196196<?php echo wp_timezone_choice($tzstring); ?>
    197197</select>
    198198
     
    317317</tr>
    318318<tr>
    319319<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
    320 <td><select name="start_of_week" id="start_of_week">
     320<td><select class="select2" name="start_of_week" id="start_of_week">
    321321<?php
    322322global $wp_locale;
    323323
  • wp-includes/css/select2.css

     
     1.select2-container {
     2  box-sizing: border-box;
     3  display: inline-block;
     4  margin: 0;
     5  position: relative;
     6  vertical-align: middle; }
     7  .select2-container .select2-selection--single {
     8    box-sizing: border-box;
     9    cursor: pointer;
     10    display: block;
     11    height: 28px;
     12    user-select: none;
     13    -webkit-user-select: none; }
     14    .select2-container .select2-selection--single .select2-selection__rendered {
     15      display: block;
     16      padding-left: 8px;
     17      padding-right: 20px;
     18      overflow: hidden;
     19      text-overflow: ellipsis;
     20      white-space: nowrap; }
     21  .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
     22    padding-right: 8px;
     23    padding-left: 20px; }
     24  .select2-container .select2-selection--multiple {
     25    box-sizing: border-box;
     26    cursor: pointer;
     27    display: block;
     28    min-height: 32px;
     29    user-select: none;
     30    -webkit-user-select: none; }
     31    .select2-container .select2-selection--multiple .select2-selection__rendered {
     32      display: inline-block;
     33      overflow: hidden;
     34      padding-left: 8px;
     35      text-overflow: ellipsis;
     36      white-space: nowrap; }
     37  .select2-container .select2-search--inline {
     38    float: left; }
     39    .select2-container .select2-search--inline .select2-search__field {
     40      box-sizing: border-box;
     41      border: none;
     42      font-size: 100%;
     43      margin-top: 5px; }
     44      .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
     45        -webkit-appearance: none; }
     46
     47.select2-dropdown {
     48  background-color: white;
     49  border: 1px solid #aaa;
     50  border-radius: 4px;
     51  box-sizing: border-box;
     52  display: block;
     53  position: absolute;
     54  left: -100000px;
     55  width: 100%;
     56  z-index: 1051; }
     57
     58.select2-results {
     59  display: block; }
     60
     61.select2-results__options {
     62  list-style: none;
     63  margin: 0;
     64  padding: 0; }
     65
     66.select2-results__option {
     67  padding: 6px;
     68  user-select: none;
     69  -webkit-user-select: none; }
     70  .select2-results__option[aria-selected] {
     71    cursor: pointer; }
     72
     73.select2-container--open .select2-dropdown {
     74  left: 0; }
     75
     76.select2-container--open .select2-dropdown--above {
     77  border-bottom: none;
     78  border-bottom-left-radius: 0;
     79  border-bottom-right-radius: 0; }
     80
     81.select2-container--open .select2-dropdown--below {
     82  border-top: none;
     83  border-top-left-radius: 0;
     84  border-top-right-radius: 0; }
     85
     86.select2-search--dropdown {
     87  display: block;
     88  padding: 4px; }
     89  .select2-search--dropdown .select2-search__field {
     90    padding: 4px;
     91    width: 100%;
     92    box-sizing: border-box; }
     93    .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
     94      -webkit-appearance: none; }
     95  .select2-search--dropdown.select2-search--hide {
     96    display: none; }
     97
     98.select2-close-mask {
     99  border: 0;
     100  margin: 0;
     101  padding: 0;
     102  display: block;
     103  position: fixed;
     104  left: 0;
     105  top: 0;
     106  min-height: 100%;
     107  min-width: 100%;
     108  height: auto;
     109  width: auto;
     110  opacity: 0;
     111  z-index: 99;
     112  background-color: #fff;
     113  filter: alpha(opacity=0); }
     114
     115.select2-container--default .select2-selection--single {
     116  background-color: #fff;
     117  border: 1px solid #aaa;
     118  border-radius: 4px; }
     119  .select2-container--default .select2-selection--single .select2-selection__rendered {
     120    color: #444;
     121    line-height: 28px; }
     122  .select2-container--default .select2-selection--single .select2-selection__clear {
     123    cursor: pointer;
     124    float: right;
     125    font-weight: bold; }
     126  .select2-container--default .select2-selection--single .select2-selection__placeholder {
     127    color: #999; }
     128  .select2-container--default .select2-selection--single .select2-selection__arrow {
     129    height: 26px;
     130    position: absolute;
     131    top: 1px;
     132    right: 1px;
     133    width: 20px; }
     134    .select2-container--default .select2-selection--single .select2-selection__arrow b {
     135      border-color: #888 transparent transparent transparent;
     136      border-style: solid;
     137      border-width: 5px 4px 0 4px;
     138      height: 0;
     139      left: 50%;
     140      margin-left: -4px;
     141      margin-top: -2px;
     142      position: absolute;
     143      top: 50%;
     144      width: 0; }
     145.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
     146  float: left; }
     147.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
     148  left: 1px;
     149  right: auto; }
     150.select2-container--default.select2-container--disabled .select2-selection--single {
     151  background-color: #eee;
     152  cursor: default; }
     153  .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
     154    display: none; }
     155.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
     156  border-color: transparent transparent #888 transparent;
     157  border-width: 0 4px 5px 4px; }
     158.select2-container--default .select2-selection--multiple {
     159  background-color: white;
     160  border: 1px solid #aaa;
     161  border-radius: 4px;
     162  cursor: text; }
     163  .select2-container--default .select2-selection--multiple .select2-selection__rendered {
     164    box-sizing: border-box;
     165    list-style: none;
     166    margin: 0;
     167    padding: 0 5px;
     168    width: 100%; }
     169  .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
     170    color: #999;
     171    margin-top: 5px;
     172    float: left; }
     173  .select2-container--default .select2-selection--multiple .select2-selection__clear {
     174    cursor: pointer;
     175    float: right;
     176    font-weight: bold;
     177    margin-top: 5px;
     178    margin-right: 10px; }
     179  .select2-container--default .select2-selection--multiple .select2-selection__choice {
     180    background-color: #e4e4e4;
     181    border: 1px solid #aaa;
     182    border-radius: 4px;
     183    cursor: default;
     184    float: left;
     185    margin-right: 5px;
     186    margin-top: 5px;
     187    padding: 0 5px; }
     188  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
     189    color: #999;
     190    cursor: pointer;
     191    display: inline-block;
     192    font-weight: bold;
     193    margin-right: 2px; }
     194    .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
     195      color: #333; }
     196.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder {
     197  float: right; }
     198.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
     199  margin-left: 5px;
     200  margin-right: auto; }
     201.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
     202  margin-left: 2px;
     203  margin-right: auto; }
     204.select2-container--default.select2-container--focus .select2-selection--multiple {
     205  border: solid black 1px;
     206  outline: 0; }
     207.select2-container--default.select2-container--disabled .select2-selection--multiple {
     208  background-color: #eee;
     209  cursor: default; }
     210.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
     211  display: none; }
     212.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
     213  border-top-left-radius: 0;
     214  border-top-right-radius: 0; }
     215.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
     216  border-bottom-left-radius: 0;
     217  border-bottom-right-radius: 0; }
     218.select2-container--default .select2-search--dropdown .select2-search__field {
     219  border: 1px solid #aaa; }
     220.select2-container--default .select2-search--inline .select2-search__field {
     221  background: transparent;
     222  border: none;
     223  outline: 0; }
     224.select2-container--default .select2-results > .select2-results__options {
     225  max-height: 200px;
     226  overflow-y: auto; }
     227.select2-container--default .select2-results__option[role=group] {
     228  padding: 0; }
     229.select2-container--default .select2-results__option[aria-disabled=true] {
     230  color: #999; }
     231.select2-container--default .select2-results__option[aria-selected=true] {
     232  background-color: #ddd; }
     233.select2-container--default .select2-results__option .select2-results__option {
     234  padding-left: 1em; }
     235  .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
     236    padding-left: 0; }
     237  .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
     238    margin-left: -1em;
     239    padding-left: 2em; }
     240    .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
     241      margin-left: -2em;
     242      padding-left: 3em; }
     243      .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
     244        margin-left: -3em;
     245        padding-left: 4em; }
     246        .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
     247          margin-left: -4em;
     248          padding-left: 5em; }
     249          .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
     250            margin-left: -5em;
     251            padding-left: 6em; }
     252.select2-container--default .select2-results__option--highlighted[aria-selected] {
     253  background-color: #5897fb;
     254  color: white; }
     255.select2-container--default .select2-results__group {
     256  cursor: default;
     257  display: block;
     258  padding: 6px; }
     259
     260.select2-container--classic .select2-selection--single {
     261  background-color: #f6f6f6;
     262  border: 1px solid #aaa;
     263  border-radius: 4px;
     264  outline: 0;
     265  background-image: -webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);
     266  background-image: -o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);
     267  background-image: linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);
     268  background-repeat: repeat-x;
     269  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); }
     270  .select2-container--classic .select2-selection--single:focus {
     271    border: 1px solid #5897fb; }
     272  .select2-container--classic .select2-selection--single .select2-selection__rendered {
     273    color: #444;
     274    line-height: 28px; }
     275  .select2-container--classic .select2-selection--single .select2-selection__clear {
     276    cursor: pointer;
     277    float: right;
     278    font-weight: bold;
     279    margin-right: 10px; }
     280  .select2-container--classic .select2-selection--single .select2-selection__placeholder {
     281    color: #999; }
     282  .select2-container--classic .select2-selection--single .select2-selection__arrow {
     283    background-color: #ddd;
     284    border: none;
     285    border-left: 1px solid #aaa;
     286    border-top-right-radius: 4px;
     287    border-bottom-right-radius: 4px;
     288    height: 26px;
     289    position: absolute;
     290    top: 1px;
     291    right: 1px;
     292    width: 20px;
     293    background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
     294    background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
     295    background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
     296    background-repeat: repeat-x;
     297    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0); }
     298    .select2-container--classic .select2-selection--single .select2-selection__arrow b {
     299      border-color: #888 transparent transparent transparent;
     300      border-style: solid;
     301      border-width: 5px 4px 0 4px;
     302      height: 0;
     303      left: 50%;
     304      margin-left: -4px;
     305      margin-top: -2px;
     306      position: absolute;
     307      top: 50%;
     308      width: 0; }
     309.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
     310  float: left; }
     311.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
     312  border: none;
     313  border-right: 1px solid #aaa;
     314  border-radius: 0;
     315  border-top-left-radius: 4px;
     316  border-bottom-left-radius: 4px;
     317  left: 1px;
     318  right: auto; }
     319.select2-container--classic.select2-container--open .select2-selection--single {
     320  border: 1px solid #5897fb; }
     321  .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
     322    background: transparent;
     323    border: none; }
     324    .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
     325      border-color: transparent transparent #888 transparent;
     326      border-width: 0 4px 5px 4px; }
     327.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
     328  border-top: none;
     329  border-top-left-radius: 0;
     330  border-top-right-radius: 0;
     331  background-image: -webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);
     332  background-image: -o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);
     333  background-image: linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);
     334  background-repeat: repeat-x;
     335  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); }
     336.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
     337  border-bottom: none;
     338  border-bottom-left-radius: 0;
     339  border-bottom-right-radius: 0;
     340  background-image: -webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);
     341  background-image: -o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);
     342  background-image: linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);
     343  background-repeat: repeat-x;
     344  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0); }
     345.select2-container--classic .select2-selection--multiple {
     346  background-color: white;
     347  border: 1px solid #aaa;
     348  border-radius: 4px;
     349  cursor: text;
     350  outline: 0; }
     351  .select2-container--classic .select2-selection--multiple:focus {
     352    border: 1px solid #5897fb; }
     353  .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
     354    list-style: none;
     355    margin: 0;
     356    padding: 0 5px; }
     357  .select2-container--classic .select2-selection--multiple .select2-selection__clear {
     358    display: none; }
     359  .select2-container--classic .select2-selection--multiple .select2-selection__choice {
     360    background-color: #e4e4e4;
     361    border: 1px solid #aaa;
     362    border-radius: 4px;
     363    cursor: default;
     364    float: left;
     365    margin-right: 5px;
     366    margin-top: 5px;
     367    padding: 0 5px; }
     368  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
     369    color: #888;
     370    cursor: pointer;
     371    display: inline-block;
     372    font-weight: bold;
     373    margin-right: 2px; }
     374    .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
     375      color: #555; }
     376.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
     377  float: right; }
     378.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
     379  margin-left: 5px;
     380  margin-right: auto; }
     381.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
     382  margin-left: 2px;
     383  margin-right: auto; }
     384.select2-container--classic.select2-container--open .select2-selection--multiple {
     385  border: 1px solid #5897fb; }
     386.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
     387  border-top: none;
     388  border-top-left-radius: 0;
     389  border-top-right-radius: 0; }
     390.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
     391  border-bottom: none;
     392  border-bottom-left-radius: 0;
     393  border-bottom-right-radius: 0; }
     394.select2-container--classic .select2-search--dropdown .select2-search__field {
     395  border: 1px solid #aaa;
     396  outline: 0; }
     397.select2-container--classic .select2-search--inline .select2-search__field {
     398  outline: 0; }
     399.select2-container--classic .select2-dropdown {
     400  background-color: white;
     401  border: 1px solid transparent; }
     402.select2-container--classic .select2-dropdown--above {
     403  border-bottom: none; }
     404.select2-container--classic .select2-dropdown--below {
     405  border-top: none; }
     406.select2-container--classic .select2-results > .select2-results__options {
     407  max-height: 200px;
     408  overflow-y: auto; }
     409.select2-container--classic .select2-results__option[role=group] {
     410  padding: 0; }
     411.select2-container--classic .select2-results__option[aria-disabled=true] {
     412  color: grey; }
     413.select2-container--classic .select2-results__option--highlighted[aria-selected] {
     414  background-color: #3875d7;
     415  color: white; }
     416.select2-container--classic .select2-results__group {
     417  cursor: default;
     418  display: block;
     419  padding: 6px; }
     420.select2-container--classic.select2-container--open .select2-dropdown {
     421  border-color: #5897fb; }
  • wp-includes/js/select2/i18n/az.js

    Property changes on: wp-includes/css/select2.css
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/bg.js

    Property changes on: wp-includes/js/select2/i18n/az.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/ca.js

    Property changes on: wp-includes/js/select2/i18n/bg.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/cs.js

    Property changes on: wp-includes/js/select2/i18n/ca.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/da.js

    Property changes on: wp-includes/js/select2/i18n/cs.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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"The results could not be loaded."},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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/de.js

    Property changes on: wp-includes/js/select2/i18n/da.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/en.js

    Property changes on: wp-includes/js/select2/i18n/de.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/es.js

    Property changes on: wp-includes/js/select2/i18n/en.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/et.js

    Property changes on: wp-includes/js/select2/i18n/es.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/eu.js

    Property changes on: wp-includes/js/select2/i18n/et.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/fa.js

    Property changes on: wp-includes/js/select2/i18n/eu.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/fi.js

    Property changes on: wp-includes/js/select2/i18n/fa.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/fr.js

    Property changes on: wp-includes/js/select2/i18n/fi.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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{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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/gl.js

    Property changes on: wp-includes/js/select2/i18n/fr.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Elimine ";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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/hi.js

    Property changes on: wp-includes/js/select2/i18n/gl.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/hr.js

    Property changes on: wp-includes/js/select2/i18n/hi.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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{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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/hu.js

    Property changes on: wp-includes/js/select2/i18n/hr.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/id.js

    Property changes on: wp-includes/js/select2/i18n/hu.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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{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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/is.js

    Property changes on: wp-includes/js/select2/i18n/id.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/it.js

    Property changes on: wp-includes/js/select2/i18n/is.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/ko.js

    Property changes on: wp-includes/js/select2/i18n/it.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/lt.js

    Property changes on: wp-includes/js/select2/i18n/ko.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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%100>9&&e%100<21||e%10===0?e%10>1?n:r:t}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"ių","ius","į"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"ių","ius","į"),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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/lv.js

    Property changes on: wp-includes/js/select2/i18n/lt.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par  "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/mk.js

    Property changes on: wp-includes/js/select2/i18n/lv.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/nb.js

    Property changes on: wp-includes/js/select2/i18n/mk.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/nb",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/nl.js

    Property changes on: wp-includes/js/select2/i18n/nb.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t="Er kunnen maar "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t+=" worden geselecteerd",t},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/pl.js

    Property changes on: wp-includes/js/select2/i18n/nl.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maxiumum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/pt-BR.js

    Property changes on: wp-includes/js/select2/i18n/pl.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/pt.js

    Property changes on: wp-includes/js/select2/i18n/pt-BR.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/ro.js

    Property changes on: wp-includes/js/select2/i18n/pt.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/ro",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să introduceți mai puțin de "+t;return n+=" caracter",n!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți incă "+t;return n+=" caracter",n!==1&&(n+="e"),n},loadingMore:function(){return"Se încarcă…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",t!==1&&(t+="e"),t},noResults:function(){return"Nu a fost găsit nimic"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/ru.js

    Property changes on: wp-includes/js/select2/i18n/ro.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/sk.js

    Property changes on: wp-includes/js/select2/i18n/ru.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/sr.js

    Property changes on: wp-includes/js/select2/i18n/sk.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/sr",[],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{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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/sv.js

    Property changes on: wp-includes/js/select2/i18n/sr.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/th.js

    Property changes on: wp-includes/js/select2/i18n/sv.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/th",[],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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/tr.js

    Property changes on: wp-includes/js/select2/i18n/th.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/uk.js

    Property changes on: wp-includes/js/select2/i18n/tr.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/vi.js

    Property changes on: wp-includes/js/select2/i18n/uk.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/zh-CN.js

    Property changes on: wp-includes/js/select2/i18n/vi.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/zh-CN",[],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}})();
     4 No newline at end of file
  • wp-includes/js/select2/i18n/zh-TW.js

    Property changes on: wp-includes/js/select2/i18n/zh-CN.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*! Select2 4.0.0-rc.2 | 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/zh-TW",[],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}})();
     4 No newline at end of file
  • wp-includes/js/select2/select2.js

    Property changes on: wp-includes/js/select2/i18n/zh-TW.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
     1/*!
     2 * Select2 4.0.0-rc.2
     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  }
     30var S2;(function () { if (!S2 || !S2.requirejs) {
     31if (!S2) { S2 = {}; } else { require = S2; }
     32/**
     33 * @license almond 0.2.9 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
     42var 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                //Convert baseName to array, and lop off the last part,
     79                //so that . matches that "directory" and not name of the baseName's
     80                //module. For instance, baseName of "one/two/three", maps to
     81                //"one/two/three.js", but we want the directory, "one/two" for
     82                //this normalization.
     83                baseParts = baseParts.slice(0, baseParts.length - 1);
     84                name = name.split('/');
     85                lastIndex = name.length - 1;
     86
     87                // Node .js allowance:
     88                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
     89                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
     90                }
     91
     92                name = baseParts.concat(name);
     93
     94                //start trimDots
     95                for (i = 0; i < name.length; i += 1) {
     96                    part = name[i];
     97                    if (part === ".") {
     98                        name.splice(i, 1);
     99                        i -= 1;
     100                    } else if (part === "..") {
     101                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {
     102                            //End of the line. Keep at least one non-dot
     103                            //path segment at the front so it can be mapped
     104                            //correctly to disk. Otherwise, there is likely
     105                            //no path mapping for a path starting with '..'.
     106                            //This can still fail, but catches the most reasonable
     107                            //uses of ..
     108                            break;
     109                        } else if (i > 0) {
     110                            name.splice(i - 1, 2);
     111                            i -= 2;
     112                        }
     113                    }
     114                }
     115                //end trimDots
     116
     117                name = name.join("/");
     118            } else if (name.indexOf('./') === 0) {
     119                // No baseName, so this is ID is resolved relative
     120                // to baseUrl, pull off the leading dot.
     121                name = name.substring(2);
     122            }
     123        }
     124
     125        //Apply map config if available.
     126        if ((baseParts || starMap) && map) {
     127            nameParts = name.split('/');
     128
     129            for (i = nameParts.length; i > 0; i -= 1) {
     130                nameSegment = nameParts.slice(0, i).join("/");
     131
     132                if (baseParts) {
     133                    //Find the longest baseName segment match in the config.
     134                    //So, do joins on the biggest to smallest lengths of baseParts.
     135                    for (j = baseParts.length; j > 0; j -= 1) {
     136                        mapValue = map[baseParts.slice(0, j).join('/')];
     137
     138                        //baseName segment has  config, find if it has one for
     139                        //this name.
     140                        if (mapValue) {
     141                            mapValue = mapValue[nameSegment];
     142                            if (mapValue) {
     143                                //Match, update name to the new value.
     144                                foundMap = mapValue;
     145                                foundI = i;
     146                                break;
     147                            }
     148                        }
     149                    }
     150                }
     151
     152                if (foundMap) {
     153                    break;
     154                }
     155
     156                //Check for a star map match, but just hold on to it,
     157                //if there is a shorter segment match later in a matching
     158                //config, then favor over this star map.
     159                if (!foundStarMap && starMap && starMap[nameSegment]) {
     160                    foundStarMap = starMap[nameSegment];
     161                    starI = i;
     162                }
     163            }
     164
     165            if (!foundMap && foundStarMap) {
     166                foundMap = foundStarMap;
     167                foundI = starI;
     168            }
     169
     170            if (foundMap) {
     171                nameParts.splice(0, foundI, foundMap);
     172                name = nameParts.join('/');
     173            }
     174        }
     175
     176        return name;
     177    }
     178
     179    function makeRequire(relName, forceSync) {
     180        return function () {
     181            //A version of a require function that passes a moduleName
     182            //value for items that may need to
     183            //look up paths relative to the moduleName
     184            return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
     185        };
     186    }
     187
     188    function makeNormalize(relName) {
     189        return function (name) {
     190            return normalize(name, relName);
     191        };
     192    }
     193
     194    function makeLoad(depName) {
     195        return function (value) {
     196            defined[depName] = value;
     197        };
     198    }
     199
     200    function callDep(name) {
     201        if (hasProp(waiting, name)) {
     202            var args = waiting[name];
     203            delete waiting[name];
     204            defining[name] = true;
     205            main.apply(undef, args);
     206        }
     207
     208        if (!hasProp(defined, name) && !hasProp(defining, name)) {
     209            throw new Error('No ' + name);
     210        }
     211        return defined[name];
     212    }
     213
     214    //Turns a plugin!resource to [plugin, resource]
     215    //with the plugin being undefined if the name
     216    //did not have a plugin prefix.
     217    function splitPrefix(name) {
     218        var prefix,
     219            index = name ? name.indexOf('!') : -1;
     220        if (index > -1) {
     221            prefix = name.substring(0, index);
     222            name = name.substring(index + 1, name.length);
     223        }
     224        return [prefix, name];
     225    }
     226
     227    /**
     228     * Makes a name map, normalizing the name, and using a plugin
     229     * for normalization if necessary. Grabs a ref to plugin
     230     * too, as an optimization.
     231     */
     232    makeMap = function (name, relName) {
     233        var plugin,
     234            parts = splitPrefix(name),
     235            prefix = parts[0];
     236
     237        name = parts[1];
     238
     239        if (prefix) {
     240            prefix = normalize(prefix, relName);
     241            plugin = callDep(prefix);
     242        }
     243
     244        //Normalize according
     245        if (prefix) {
     246            if (plugin && plugin.normalize) {
     247                name = plugin.normalize(name, makeNormalize(relName));
     248            } else {
     249                name = normalize(name, relName);
     250            }
     251        } else {
     252            name = normalize(name, relName);
     253            parts = splitPrefix(name);
     254            prefix = parts[0];
     255            name = parts[1];
     256            if (prefix) {
     257                plugin = callDep(prefix);
     258            }
     259        }
     260
     261        //Using ridiculous property names for space reasons
     262        return {
     263            f: prefix ? prefix + '!' + name : name, //fullName
     264            n: name,
     265            pr: prefix,
     266            p: plugin
     267        };
     268    };
     269
     270    function makeConfig(name) {
     271        return function () {
     272            return (config && config.config && config.config[name]) || {};
     273        };
     274    }
     275
     276    handlers = {
     277        require: function (name) {
     278            return makeRequire(name);
     279        },
     280        exports: function (name) {
     281            var e = defined[name];
     282            if (typeof e !== 'undefined') {
     283                return e;
     284            } else {
     285                return (defined[name] = {});
     286            }
     287        },
     288        module: function (name) {
     289            return {
     290                id: name,
     291                uri: '',
     292                exports: defined[name],
     293                config: makeConfig(name)
     294            };
     295        }
     296    };
     297
     298    main = function (name, deps, callback, relName) {
     299        var cjsModule, depName, ret, map, i,
     300            args = [],
     301            callbackType = typeof callback,
     302            usingExports;
     303
     304        //Use name if no relName
     305        relName = relName || name;
     306
     307        //Call the callback to define the module, if necessary.
     308        if (callbackType === 'undefined' || callbackType === 'function') {
     309            //Pull out the defined dependencies and pass the ordered
     310            //values to the callback.
     311            //Default to [require, exports, module] if no deps
     312            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
     313            for (i = 0; i < deps.length; i += 1) {
     314                map = makeMap(deps[i], relName);
     315                depName = map.f;
     316
     317                //Fast path CommonJS standard dependencies.
     318                if (depName === "require") {
     319                    args[i] = handlers.require(name);
     320                } else if (depName === "exports") {
     321                    //CommonJS module spec 1.1
     322                    args[i] = handlers.exports(name);
     323                    usingExports = true;
     324                } else if (depName === "module") {
     325                    //CommonJS module spec 1.1
     326                    cjsModule = args[i] = handlers.module(name);
     327                } else if (hasProp(defined, depName) ||
     328                           hasProp(waiting, depName) ||
     329                           hasProp(defining, depName)) {
     330                    args[i] = callDep(depName);
     331                } else if (map.p) {
     332                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
     333                    args[i] = defined[depName];
     334                } else {
     335                    throw new Error(name + ' missing ' + depName);
     336                }
     337            }
     338
     339            ret = callback ? callback.apply(defined[name], args) : undefined;
     340
     341            if (name) {
     342                //If setting exports via "module" is in play,
     343                //favor that over return value and exports. After that,
     344                //favor a non-undefined return value over exports use.
     345                if (cjsModule && cjsModule.exports !== undef &&
     346                        cjsModule.exports !== defined[name]) {
     347                    defined[name] = cjsModule.exports;
     348                } else if (ret !== undef || !usingExports) {
     349                    //Use the return value from the function.
     350                    defined[name] = ret;
     351                }
     352            }
     353        } else if (name) {
     354            //May just be an object definition for the module. Only
     355            //worry about defining if have a module name.
     356            defined[name] = callback;
     357        }
     358    };
     359
     360    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
     361        if (typeof deps === "string") {
     362            if (handlers[deps]) {
     363                //callback in this case is really relName
     364                return handlers[deps](callback);
     365            }
     366            //Just return the module wanted. In this scenario, the
     367            //deps arg is the module name, and second arg (if passed)
     368            //is just the relName.
     369            //Normalize module name, if it contains . or ..
     370            return callDep(makeMap(deps, callback).f);
     371        } else if (!deps.splice) {
     372            //deps is a config object, not an array.
     373            config = deps;
     374            if (config.deps) {
     375                req(config.deps, config.callback);
     376            }
     377            if (!callback) {
     378                return;
     379            }
     380
     381            if (callback.splice) {
     382                //callback is an array, which means it is a dependency list.
     383                //Adjust args if there are dependencies
     384                deps = callback;
     385                callback = relName;
     386                relName = null;
     387            } else {
     388                deps = undef;
     389            }
     390        }
     391
     392        //Support require(['a'])
     393        callback = callback || function () {};
     394
     395        //If relName is a function, it is an errback handler,
     396        //so remove it.
     397        if (typeof relName === 'function') {
     398            relName = forceSync;
     399            forceSync = alt;
     400        }
     401
     402        //Simulate async callback;
     403        if (forceSync) {
     404            main(undef, deps, callback, relName);
     405        } else {
     406            //Using a non-zero value because of concern for what old browsers
     407            //do, and latest browsers "upgrade" to 4 if lower value is used:
     408            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
     409            //If want a value immediately, use require('id') instead -- something
     410            //that works in almond on the global level, but not guaranteed and
     411            //unlikely to work in other AMD implementations.
     412            setTimeout(function () {
     413                main(undef, deps, callback, relName);
     414            }, 4);
     415        }
     416
     417        return req;
     418    };
     419
     420    /**
     421     * Just drops the config on the floor, but returns req in case
     422     * the config return value is used.
     423     */
     424    req.config = function (cfg) {
     425        return req(cfg);
     426    };
     427
     428    /**
     429     * Expose module registry for debugging and tooling
     430     */
     431    requirejs._defined = defined;
     432
     433    define = function (name, deps, callback) {
     434
     435        //This module may not have dependencies
     436        if (!deps.splice) {
     437            //deps is not an array, so probably means
     438            //an object literal or factory function for
     439            //the value. Adjust args.
     440            callback = deps;
     441            deps = [];
     442        }
     443
     444        if (!hasProp(defined, name) && !hasProp(waiting, name)) {
     445            waiting[name] = [name, deps, callback];
     446        }
     447    };
     448
     449    define.amd = {
     450        jQuery: true
     451    };
     452}());
     453
     454S2.requirejs = requirejs;S2.require = require;S2.define = define;
     455}
     456}());
     457S2.define("almond", function(){});
     458
     459/* global jQuery:false, $:false */
     460S2.define('jquery',[],function () {
     461  var _$ = jQuery || $;
     462
     463  if (_$ == null && console && console.error) {
     464    console.error(
     465      'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
     466      'found. Make sure that you are including jQuery before Select2 on your ' +
     467      'web page.'
     468    );
     469  }
     470
     471  return _$;
     472});
     473
     474S2.define('select2/utils',[
     475  'jquery'
     476], function ($) {
     477  var Utils = {};
     478
     479  Utils.Extend = function (ChildClass, SuperClass) {
     480    var __hasProp = {}.hasOwnProperty;
     481
     482    function BaseConstructor () {
     483      this.constructor = ChildClass;
     484    }
     485
     486    for (var key in SuperClass) {
     487      if (__hasProp.call(SuperClass, key)) {
     488        ChildClass[key] = SuperClass[key];
     489      }
     490    }
     491
     492    BaseConstructor.prototype = SuperClass.prototype;
     493    ChildClass.prototype = new BaseConstructor();
     494    ChildClass.__super__ = SuperClass.prototype;
     495
     496    return ChildClass;
     497  };
     498
     499  function getMethods (theClass) {
     500    var proto = theClass.prototype;
     501
     502    var methods = [];
     503
     504    for (var methodName in proto) {
     505      var m = proto[methodName];
     506
     507      if (typeof m !== 'function') {
     508        continue;
     509      }
     510
     511      if (methodName === 'constructor') {
     512        continue;
     513      }
     514
     515      methods.push(methodName);
     516    }
     517
     518    return methods;
     519  }
     520
     521  Utils.Decorate = function (SuperClass, DecoratorClass) {
     522    var decoratedMethods = getMethods(DecoratorClass);
     523    var superMethods = getMethods(SuperClass);
     524
     525    function DecoratedClass () {
     526      var unshift = Array.prototype.unshift;
     527
     528      var argCount = DecoratorClass.prototype.constructor.length;
     529
     530      var calledConstructor = SuperClass.prototype.constructor;
     531
     532      if (argCount > 0) {
     533        unshift.call(arguments, SuperClass.prototype.constructor);
     534
     535        calledConstructor = DecoratorClass.prototype.constructor;
     536      }
     537
     538      calledConstructor.apply(this, arguments);
     539    }
     540
     541    DecoratorClass.displayName = SuperClass.displayName;
     542
     543    function ctr () {
     544      this.constructor = DecoratedClass;
     545    }
     546
     547    DecoratedClass.prototype = new ctr();
     548
     549    for (var m = 0; m < superMethods.length; m++) {
     550        var superMethod = superMethods[m];
     551
     552        DecoratedClass.prototype[superMethod] =
     553          SuperClass.prototype[superMethod];
     554    }
     555
     556    var calledMethod = function (methodName) {
     557      // Stub out the original method if it's not decorating an actual method
     558      var originalMethod = function () {};
     559
     560      if (methodName in DecoratedClass.prototype) {
     561        originalMethod = DecoratedClass.prototype[methodName];
     562      }
     563
     564      var decoratedMethod = DecoratorClass.prototype[methodName];
     565
     566      return function () {
     567        var unshift = Array.prototype.unshift;
     568
     569        unshift.call(arguments, originalMethod);
     570
     571        return decoratedMethod.apply(this, arguments);
     572      };
     573    };
     574
     575    for (var d = 0; d < decoratedMethods.length; d++) {
     576      var decoratedMethod = decoratedMethods[d];
     577
     578      DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
     579    }
     580
     581    return DecoratedClass;
     582  };
     583
     584  var Observable = function () {
     585    this.listeners = {};
     586  };
     587
     588  Observable.prototype.on = function (event, callback) {
     589    this.listeners = this.listeners || {};
     590
     591    if (event in this.listeners) {
     592      this.listeners[event].push(callback);
     593    } else {
     594      this.listeners[event] = [callback];
     595    }
     596  };
     597
     598  Observable.prototype.trigger = function (event) {
     599    var slice = Array.prototype.slice;
     600
     601    this.listeners = this.listeners || {};
     602
     603    if (event in this.listeners) {
     604      this.invoke(this.listeners[event], slice.call(arguments, 1));
     605    }
     606
     607    if ('*' in this.listeners) {
     608      this.invoke(this.listeners['*'], arguments);
     609    }
     610  };
     611
     612  Observable.prototype.invoke = function (listeners, params) {
     613    for (var i = 0, len = listeners.length; i < len; i++) {
     614      listeners[i].apply(this, params);
     615    }
     616  };
     617
     618  Utils.Observable = Observable;
     619
     620  Utils.generateChars = function (length) {
     621    var chars = '';
     622
     623    for (var i = 0; i < length; i++) {
     624      var randomChar = Math.floor(Math.random() * 36);
     625      chars += randomChar.toString(36);
     626    }
     627
     628    return chars;
     629  };
     630
     631  Utils.bind = function (func, context) {
     632    return function () {
     633      func.apply(context, arguments);
     634    };
     635  };
     636
     637  Utils._convertData = function (data) {
     638    for (var originalKey in data) {
     639      var keys = originalKey.split('-');
     640
     641      var dataLevel = data;
     642
     643      if (keys.length === 1) {
     644        continue;
     645      }
     646
     647      for (var k = 0; k < keys.length; k++) {
     648        var key = keys[k];
     649
     650        // Lowercase the first letter
     651        // By default, dash-separated becomes camelCase
     652        key = key.substring(0, 1).toLowerCase() + key.substring(1);
     653
     654        if (!(key in dataLevel)) {
     655          dataLevel[key] = {};
     656        }
     657
     658        if (k == keys.length - 1) {
     659          dataLevel[key] = data[originalKey];
     660        }
     661
     662        dataLevel = dataLevel[key];
     663      }
     664
     665      delete data[originalKey];
     666    }
     667
     668    return data;
     669  };
     670
     671  Utils.hasScroll = function (index, el) {
     672    // Adapted from the function created by @ShadowScripter
     673    // and adapted by @BillBarry on the Stack Exchange Code Review website.
     674    // The original code can be found at
     675    // http://codereview.stackexchange.com/q/13338
     676    // and was designed to be used with the Sizzle selector engine.
     677
     678    var $el = $(el);
     679    var overflowX = el.style.overflowX;
     680    var overflowY = el.style.overflowY;
     681
     682    //Check both x and y declarations
     683    if (overflowX === overflowY &&
     684        (overflowY === 'hidden' || overflowY === 'visible')) {
     685      return false;
     686    }
     687
     688    if (overflowX === 'scroll' || overflowY === 'scroll') {
     689      return true;
     690    }
     691
     692    return ($el.innerHeight() < el.scrollHeight ||
     693      $el.innerWidth() < el.scrollWidth);
     694  };
     695
     696  Utils.escapeMarkup = function (markup) {
     697    var replaceMap = {
     698      '\\': '&#92;',
     699      '&': '&amp;',
     700      '<': '&lt;',
     701      '>': '&gt;',
     702      '"': '&quot;',
     703      '\'': '&#39;',
     704      '/': '&#47;'
     705    };
     706
     707    // Do not try to escape the markup if it's not a string
     708    if (typeof markup !== 'string') {
     709      return markup;
     710    }
     711
     712    return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
     713      return replaceMap[match];
     714    });
     715  };
     716
     717  return Utils;
     718});
     719
     720S2.define('select2/results',[
     721  'jquery',
     722  './utils'
     723], function ($, Utils) {
     724  function Results ($element, options, dataAdapter) {
     725    this.$element = $element;
     726    this.data = dataAdapter;
     727    this.options = options;
     728
     729    Results.__super__.constructor.call(this);
     730  }
     731
     732  Utils.Extend(Results, Utils.Observable);
     733
     734  Results.prototype.render = function () {
     735    var $results = $(
     736      '<ul class="select2-results__options" role="tree"></ul>'
     737    );
     738
     739    if (this.options.get('multiple')) {
     740      $results.attr('aria-multiselectable', 'true');
     741    }
     742
     743    this.$results = $results;
     744
     745    return $results;
     746  };
     747
     748  Results.prototype.clear = function () {
     749    this.$results.empty();
     750  };
     751
     752  Results.prototype.displayMessage = function (params) {
     753    var escapeMarkup = this.options.get('escapeMarkup');
     754
     755    this.clear();
     756    this.hideLoading();
     757
     758    var $message = $(
     759      '<li role="treeitem" class="select2-results__option"></li>'
     760    );
     761
     762    var message = this.options.get('translations').get(params.message);
     763
     764    $message.append(
     765      escapeMarkup(
     766        message(params.args)
     767      )
     768    );
     769
     770    this.$results.append($message);
     771  };
     772
     773  Results.prototype.append = function (data) {
     774    this.hideLoading();
     775
     776    var $options = [];
     777
     778    if (data.results == null || data.results.length === 0) {
     779      if (this.$results.children().length === 0) {
     780        this.trigger('results:message', {
     781          message: 'noResults'
     782        });
     783      }
     784
     785      return;
     786    }
     787
     788    data.results = this.sort(data.results);
     789
     790    for (var d = 0; d < data.results.length; d++) {
     791      var item = data.results[d];
     792
     793      var $option = this.option(item);
     794
     795      $options.push($option);
     796    }
     797
     798    this.$results.append($options);
     799  };
     800
     801  Results.prototype.position = function ($results, $dropdown) {
     802    var $resultsContainer = $dropdown.find('.select2-results');
     803    $resultsContainer.append($results);
     804  };
     805
     806  Results.prototype.sort = function (data) {
     807    var sorter = this.options.get('sorter');
     808
     809    return sorter(data);
     810  };
     811
     812  Results.prototype.setClasses = function () {
     813    var self = this;
     814
     815    this.data.current(function (selected) {
     816      var selectedIds = $.map(selected, function (s) {
     817        return s.id.toString();
     818      });
     819
     820      var $options = self.$results
     821        .find('.select2-results__option[aria-selected]');
     822
     823      $options.each(function () {
     824        var $option = $(this);
     825
     826        var item = $.data(this, 'data');
     827
     828        // id needs to be converted to a string when comparing
     829        var id = '' + item.id;
     830
     831        if ((item.element != null && item.element.selected) ||
     832            (item.element == null && $.inArray(id, selectedIds) > -1)) {
     833          $option.attr('aria-selected', 'true');
     834        } else {
     835          $option.attr('aria-selected', 'false');
     836        }
     837      });
     838
     839      var $selected = $options.filter('[aria-selected=true]');
     840
     841      // Check if there are any selected options
     842      if ($selected.length > 0) {
     843        // If there are selected options, highlight the first
     844        $selected.first().trigger('mouseenter');
     845      } else {
     846        // If there are no selected options, highlight the first option
     847        // in the dropdown
     848        $options.first().trigger('mouseenter');
     849      }
     850    });
     851  };
     852
     853  Results.prototype.showLoading = function (params) {
     854    this.hideLoading();
     855
     856    var loadingMore = this.options.get('translations').get('searching');
     857
     858    var loading = {
     859      disabled: true,
     860      loading: true,
     861      text: loadingMore(params)
     862    };
     863    var $loading = this.option(loading);
     864    $loading.className += ' loading-results';
     865
     866    this.$results.prepend($loading);
     867  };
     868
     869  Results.prototype.hideLoading = function () {
     870    this.$results.find('.loading-results').remove();
     871  };
     872
     873  Results.prototype.option = function (data) {
     874    var option = document.createElement('li');
     875    option.className = 'select2-results__option';
     876
     877    var attrs = {
     878      'role': 'treeitem',
     879      'aria-selected': 'false'
     880    };
     881
     882    if (data.disabled) {
     883      delete attrs['aria-selected'];
     884      attrs['aria-disabled'] = 'true';
     885    }
     886
     887    if (data.id == null) {
     888      delete attrs['aria-selected'];
     889    }
     890
     891    if (data._resultId != null) {
     892      option.id = data._resultId;
     893    }
     894
     895    if (data.title) {
     896      option.title = data.title;
     897    }
     898
     899    if (data.children) {
     900      attrs.role = 'group';
     901      attrs['aria-label'] = data.text;
     902      delete attrs['aria-selected'];
     903    }
     904
     905    for (var attr in attrs) {
     906      var val = attrs[attr];
     907
     908      option.setAttribute(attr, val);
     909    }
     910
     911    if (data.children) {
     912      var $option = $(option);
     913
     914      var label = document.createElement('strong');
     915      label.className = 'select2-results__group';
     916
     917      var $label = $(label);
     918      this.template(data, label);
     919
     920      var $children = [];
     921
     922      for (var c = 0; c < data.children.length; c++) {
     923        var child = data.children[c];
     924
     925        var $child = this.option(child);
     926
     927        $children.push($child);
     928      }
     929
     930      var $childrenContainer = $('<ul></ul>', {
     931        'class': 'select2-results__options select2-results__options--nested'
     932      });
     933
     934      $childrenContainer.append($children);
     935
     936      $option.append(label);
     937      $option.append($childrenContainer);
     938    } else {
     939      this.template(data, option);
     940    }
     941
     942    $.data(option, 'data', data);
     943
     944    return option;
     945  };
     946
     947  Results.prototype.bind = function (container, $container) {
     948    var self = this;
     949
     950    var id = container.id + '-results';
     951
     952    this.$results.attr('id', id);
     953
     954    container.on('results:all', function (params) {
     955      self.clear();
     956      self.append(params.data);
     957
     958      if (container.isOpen()) {
     959        self.setClasses();
     960      }
     961    });
     962
     963    container.on('results:append', function (params) {
     964      self.append(params.data);
     965
     966      if (container.isOpen()) {
     967        self.setClasses();
     968      }
     969    });
     970
     971    container.on('query', function (params) {
     972      self.showLoading(params);
     973    });
     974
     975    container.on('select', function () {
     976      if (!container.isOpen()) {
     977        return;
     978      }
     979
     980      self.setClasses();
     981    });
     982
     983    container.on('unselect', function () {
     984      if (!container.isOpen()) {
     985        return;
     986      }
     987
     988      self.setClasses();
     989    });
     990
     991    container.on('open', function () {
     992      // When the dropdown is open, aria-expended="true"
     993      self.$results.attr('aria-expanded', 'true');
     994      self.$results.attr('aria-hidden', 'false');
     995
     996      self.setClasses();
     997      self.ensureHighlightVisible();
     998    });
     999
     1000    container.on('close', function () {
     1001      // When the dropdown is closed, aria-expended="false"
     1002      self.$results.attr('aria-expanded', 'false');
     1003      self.$results.attr('aria-hidden', 'true');
     1004      self.$results.removeAttr('aria-activedescendant');
     1005    });
     1006
     1007    container.on('results:toggle', function () {
     1008      var $highlighted = self.getHighlightedResults();
     1009
     1010      if ($highlighted.length === 0) {
     1011        return;
     1012      }
     1013
     1014      $highlighted.trigger('mouseup');
     1015    });
     1016
     1017    container.on('results:select', function () {
     1018      var $highlighted = self.getHighlightedResults();
     1019
     1020      if ($highlighted.length === 0) {
     1021        return;
     1022      }
     1023
     1024      var data = $highlighted.data('data');
     1025
     1026      if ($highlighted.attr('aria-selected') == 'true') {
     1027        self.trigger('close');
     1028      } else {
     1029        self.trigger('select', {
     1030          data: data
     1031        });
     1032      }
     1033    });
     1034
     1035    container.on('results:previous', function () {
     1036      var $highlighted = self.getHighlightedResults();
     1037
     1038      var $options = self.$results.find('[aria-selected]');
     1039
     1040      var currentIndex = $options.index($highlighted);
     1041
     1042      // If we are already at te top, don't move further
     1043      if (currentIndex === 0) {
     1044        return;
     1045      }
     1046
     1047      var nextIndex = currentIndex - 1;
     1048
     1049      // If none are highlighted, highlight the first
     1050      if ($highlighted.length === 0) {
     1051        nextIndex = 0;
     1052      }
     1053
     1054      var $next = $options.eq(nextIndex);
     1055
     1056      $next.trigger('mouseenter');
     1057
     1058      var currentOffset = self.$results.offset().top;
     1059      var nextTop = $next.offset().top;
     1060      var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
     1061
     1062      if (nextIndex === 0) {
     1063        self.$results.scrollTop(0);
     1064      } else if (nextTop - currentOffset < 0) {
     1065        self.$results.scrollTop(nextOffset);
     1066      }
     1067    });
     1068
     1069    container.on('results:next', function () {
     1070      var $highlighted = self.getHighlightedResults();
     1071
     1072      var $options = self.$results.find('[aria-selected]');
     1073
     1074      var currentIndex = $options.index($highlighted);
     1075
     1076      var nextIndex = currentIndex + 1;
     1077
     1078      // If we are at the last option, stay there
     1079      if (nextIndex >= $options.length) {
     1080        return;
     1081      }
     1082
     1083      var $next = $options.eq(nextIndex);
     1084
     1085      $next.trigger('mouseenter');
     1086
     1087      var currentOffset = self.$results.offset().top +
     1088        self.$results.outerHeight(false);
     1089      var nextBottom = $next.offset().top + $next.outerHeight(false);
     1090      var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
     1091
     1092      if (nextIndex === 0) {
     1093        self.$results.scrollTop(0);
     1094      } else if (nextBottom > currentOffset) {
     1095        self.$results.scrollTop(nextOffset);
     1096      }
     1097    });
     1098
     1099    container.on('results:focus', function (params) {
     1100      params.element.addClass('select2-results__option--highlighted');
     1101    });
     1102
     1103    container.on('results:message', function (params) {
     1104      self.displayMessage(params);
     1105    });
     1106
     1107    if ($.fn.mousewheel) {
     1108      this.$results.on('mousewheel', function (e) {
     1109        var top = self.$results.scrollTop();
     1110
     1111        var bottom = (
     1112          self.$results.get(0).scrollHeight -
     1113          self.$results.scrollTop() +
     1114          e.deltaY
     1115        );
     1116
     1117        var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
     1118        var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
     1119
     1120        if (isAtTop) {
     1121          self.$results.scrollTop(0);
     1122
     1123          e.preventDefault();
     1124          e.stopPropagation();
     1125        } else if (isAtBottom) {
     1126          self.$results.scrollTop(
     1127            self.$results.get(0).scrollHeight - self.$results.height()
     1128          );
     1129
     1130          e.preventDefault();
     1131          e.stopPropagation();
     1132        }
     1133      });
     1134    }
     1135
     1136    this.$results.on('mouseup', '.select2-results__option[aria-selected]',
     1137      function (evt) {
     1138      var $this = $(this);
     1139
     1140      var data = $this.data('data');
     1141
     1142      if ($this.attr('aria-selected') === 'true') {
     1143        if (self.options.get('multiple')) {
     1144          self.trigger('unselect', {
     1145            originalEvent: evt,
     1146            data: data
     1147          });
     1148        } else {
     1149          self.trigger('close');
     1150        }
     1151
     1152        return;
     1153      }
     1154
     1155      self.trigger('select', {
     1156        originalEvent: evt,
     1157        data: data
     1158      });
     1159    });
     1160
     1161    this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
     1162      function (evt) {
     1163      var data = $(this).data('data');
     1164
     1165      self.getHighlightedResults()
     1166          .removeClass('select2-results__option--highlighted');
     1167
     1168      self.trigger('results:focus', {
     1169        data: data,
     1170        element: $(this)
     1171      });
     1172    });
     1173  };
     1174
     1175  Results.prototype.getHighlightedResults = function () {
     1176    var $highlighted = this.$results
     1177    .find('.select2-results__option--highlighted');
     1178
     1179    return $highlighted;
     1180  };
     1181
     1182  Results.prototype.destroy = function () {
     1183    this.$results.remove();
     1184  };
     1185
     1186  Results.prototype.ensureHighlightVisible = function () {
     1187    var $highlighted = this.getHighlightedResults();
     1188
     1189    if ($highlighted.length === 0) {
     1190      return;
     1191    }
     1192
     1193    var $options = this.$results.find('[aria-selected]');
     1194
     1195    var currentIndex = $options.index($highlighted);
     1196
     1197    var currentOffset = this.$results.offset().top;
     1198    var nextTop = $highlighted.offset().top;
     1199    var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
     1200
     1201    var offsetDelta = nextTop - currentOffset;
     1202    nextOffset -= $highlighted.outerHeight(false) * 2;
     1203
     1204    if (currentIndex <= 2) {
     1205      this.$results.scrollTop(0);
     1206    } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
     1207      this.$results.scrollTop(nextOffset);
     1208    }
     1209  };
     1210
     1211  Results.prototype.template = function (result, container) {
     1212    var template = this.options.get('templateResult');
     1213    var escapeMarkup = this.options.get('escapeMarkup');
     1214
     1215    var content = template(result);
     1216
     1217    if (content == null) {
     1218      container.style.display = 'none';
     1219    } else if (typeof content === 'string') {
     1220      container.innerHTML = escapeMarkup(content);
     1221    } else {
     1222      $(container).append(content);
     1223    }
     1224  };
     1225
     1226  return Results;
     1227});
     1228
     1229S2.define('select2/keys',[
     1230
     1231], function () {
     1232  var KEYS = {
     1233    BACKSPACE: 8,
     1234    TAB: 9,
     1235    ENTER: 13,
     1236    SHIFT: 16,
     1237    CTRL: 17,
     1238    ALT: 18,
     1239    ESC: 27,
     1240    SPACE: 32,
     1241    PAGE_UP: 33,
     1242    PAGE_DOWN: 34,
     1243    END: 35,
     1244    HOME: 36,
     1245    LEFT: 37,
     1246    UP: 38,
     1247    RIGHT: 39,
     1248    DOWN: 40,
     1249    DELETE: 46
     1250  };
     1251
     1252  return KEYS;
     1253});
     1254
     1255S2.define('select2/selection/base',[
     1256  'jquery',
     1257  '../utils',
     1258  '../keys'
     1259], function ($, Utils, KEYS) {
     1260  function BaseSelection ($element, options) {
     1261    this.$element = $element;
     1262    this.options = options;
     1263
     1264    BaseSelection.__super__.constructor.call(this);
     1265  }
     1266
     1267  Utils.Extend(BaseSelection, Utils.Observable);
     1268
     1269  BaseSelection.prototype.render = function () {
     1270    var $selection = $(
     1271      '<span class="select2-selection" role="combobox" ' +
     1272      'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
     1273      '</span>'
     1274    );
     1275
     1276    this._tabindex = 0;
     1277
     1278    if (this.$element.data('old-tabindex') != null) {
     1279      this._tabindex = this.$element.data('old-tabindex');
     1280    } else if (this.$element.attr('tabindex') != null) {
     1281      this._tabindex = this.$element.attr('tabindex');
     1282    }
     1283
     1284    $selection.attr('title', this.$element.attr('title'));
     1285    $selection.attr('tabindex', this._tabindex);
     1286
     1287    this.$selection = $selection;
     1288
     1289    return $selection;
     1290  };
     1291
     1292  BaseSelection.prototype.bind = function (container, $container) {
     1293    var self = this;
     1294
     1295    var id = container.id + '-container';
     1296    var resultsId = container.id + '-results';
     1297
     1298    this.container = container;
     1299
     1300    this.$selection.on('focus', function (evt) {
     1301      self.trigger('focus', evt);
     1302    });
     1303
     1304    this.$selection.on('blur', function (evt) {
     1305      self.trigger('blur', evt);
     1306    });
     1307
     1308    this.$selection.on('keydown', function (evt) {
     1309      self.trigger('keypress', evt);
     1310
     1311      if (evt.which === KEYS.SPACE) {
     1312        evt.preventDefault();
     1313      }
     1314    });
     1315
     1316    container.on('results:focus', function (params) {
     1317      self.$selection.attr('aria-activedescendant', params.data._resultId);
     1318    });
     1319
     1320    container.on('selection:update', function (params) {
     1321      self.update(params.data);
     1322    });
     1323
     1324    container.on('open', function () {
     1325      // When the dropdown is open, aria-expanded="true"
     1326      self.$selection.attr('aria-expanded', 'true');
     1327      self.$selection.attr('aria-owns', resultsId);
     1328
     1329      self._attachCloseHandler(container);
     1330    });
     1331
     1332    container.on('close', function () {
     1333      // When the dropdown is closed, aria-expanded="false"
     1334      self.$selection.attr('aria-expanded', 'false');
     1335      self.$selection.removeAttr('aria-activedescendant');
     1336      self.$selection.removeAttr('aria-owns');
     1337
     1338      self.$selection.focus();
     1339
     1340      self._detachCloseHandler(container);
     1341    });
     1342
     1343    container.on('enable', function () {
     1344      self.$selection.attr('tabindex', self._tabindex);
     1345    });
     1346
     1347    container.on('disable', function () {
     1348      self.$selection.attr('tabindex', '-1');
     1349    });
     1350  };
     1351
     1352  BaseSelection.prototype._attachCloseHandler = function (container) {
     1353    var self = this;
     1354
     1355    $(document.body).on('mousedown.select2.' + container.id, function (e) {
     1356      var $target = $(e.target);
     1357
     1358      var $select = $target.closest('.select2');
     1359
     1360      var $all = $('.select2.select2-container--open');
     1361
     1362      $all.each(function () {
     1363        var $this = $(this);
     1364
     1365        if (this == $select[0]) {
     1366          return;
     1367        }
     1368
     1369        var $element = $this.data('element');
     1370
     1371        $element.select2('close');
     1372      });
     1373    });
     1374  };
     1375
     1376  BaseSelection.prototype._detachCloseHandler = function (container) {
     1377    $(document.body).off('mousedown.select2.' + container.id);
     1378  };
     1379
     1380  BaseSelection.prototype.position = function ($selection, $container) {
     1381    var $selectionContainer = $container.find('.selection');
     1382    $selectionContainer.append($selection);
     1383  };
     1384
     1385  BaseSelection.prototype.destroy = function () {
     1386    this._detachCloseHandler(this.container);
     1387  };
     1388
     1389  BaseSelection.prototype.update = function (data) {
     1390    throw new Error('The `update` method must be defined in child classes.');
     1391  };
     1392
     1393  return BaseSelection;
     1394});
     1395
     1396S2.define('select2/selection/single',[
     1397  'jquery',
     1398  './base',
     1399  '../utils',
     1400  '../keys'
     1401], function ($, BaseSelection, Utils, KEYS) {
     1402  function SingleSelection () {
     1403    SingleSelection.__super__.constructor.apply(this, arguments);
     1404  }
     1405
     1406  Utils.Extend(SingleSelection, BaseSelection);
     1407
     1408  SingleSelection.prototype.render = function () {
     1409    var $selection = SingleSelection.__super__.render.call(this);
     1410
     1411    $selection.addClass('select2-selection--single');
     1412
     1413    $selection.html(
     1414      '<span class="select2-selection__rendered"></span>' +
     1415      '<span class="select2-selection__arrow" role="presentation">' +
     1416        '<b role="presentation"></b>' +
     1417      '</span>'
     1418    );
     1419
     1420    return $selection;
     1421  };
     1422
     1423  SingleSelection.prototype.bind = function (container, $container) {
     1424    var self = this;
     1425
     1426    SingleSelection.__super__.bind.apply(this, arguments);
     1427
     1428    var id = container.id + '-container';
     1429
     1430    this.$selection.find('.select2-selection__rendered').attr('id', id);
     1431    this.$selection.attr('aria-labelledby', id);
     1432
     1433    this.$selection.on('mousedown', function (evt) {
     1434      // Only respond to left clicks
     1435      if (evt.which !== 1) {
     1436        return;
     1437      }
     1438
     1439      self.trigger('toggle', {
     1440        originalEvent: evt
     1441      });
     1442    });
     1443
     1444    this.$selection.on('focus', function (evt) {
     1445      // User focuses on the container
     1446    });
     1447
     1448    this.$selection.on('blur', function (evt) {
     1449      // User exits the container
     1450    });
     1451
     1452    container.on('selection:update', function (params) {
     1453      self.update(params.data);
     1454    });
     1455  };
     1456
     1457  SingleSelection.prototype.clear = function () {
     1458    this.$selection.find('.select2-selection__rendered').empty();
     1459  };
     1460
     1461  SingleSelection.prototype.display = function (data) {
     1462    var template = this.options.get('templateSelection');
     1463    var escapeMarkup = this.options.get('escapeMarkup');
     1464
     1465    return escapeMarkup(template(data));
     1466  };
     1467
     1468  SingleSelection.prototype.selectionContainer = function () {
     1469    return $('<span></span>');
     1470  };
     1471
     1472  SingleSelection.prototype.update = function (data) {
     1473    if (data.length === 0) {
     1474      this.clear();
     1475      return;
     1476    }
     1477
     1478    var selection = data[0];
     1479
     1480    var formatted = this.display(selection);
     1481
     1482    var $rendered = this.$selection.find('.select2-selection__rendered');
     1483    $rendered.empty().append(formatted);
     1484    $rendered.prop('title', selection.title || selection.text);
     1485  };
     1486
     1487  return SingleSelection;
     1488});
     1489
     1490S2.define('select2/selection/multiple',[
     1491  'jquery',
     1492  './base',
     1493  '../utils'
     1494], function ($, BaseSelection, Utils) {
     1495  function MultipleSelection ($element, options) {
     1496    MultipleSelection.__super__.constructor.apply(this, arguments);
     1497  }
     1498
     1499  Utils.Extend(MultipleSelection, BaseSelection);
     1500
     1501  MultipleSelection.prototype.render = function () {
     1502    var $selection = MultipleSelection.__super__.render.call(this);
     1503
     1504    $selection.addClass('select2-selection--multiple');
     1505
     1506    $selection.html(
     1507      '<ul class="select2-selection__rendered"></ul>'
     1508    );
     1509
     1510    return $selection;
     1511  };
     1512
     1513  MultipleSelection.prototype.bind = function (container, $container) {
     1514    var self = this;
     1515
     1516    MultipleSelection.__super__.bind.apply(this, arguments);
     1517
     1518    this.$selection.on('click', function (evt) {
     1519      self.trigger('toggle', {
     1520        originalEvent: evt
     1521      });
     1522    });
     1523
     1524    this.$selection.on('click', '.select2-selection__choice__remove',
     1525      function (evt) {
     1526      var $remove = $(this);
     1527      var $selection = $remove.parent();
     1528
     1529      var data = $selection.data('data');
     1530
     1531      self.trigger('unselect', {
     1532        originalEvent: evt,
     1533        data: data
     1534      });
     1535    });
     1536  };
     1537
     1538  MultipleSelection.prototype.clear = function () {
     1539    this.$selection.find('.select2-selection__rendered').empty();
     1540  };
     1541
     1542  MultipleSelection.prototype.display = function (data) {
     1543    var template = this.options.get('templateSelection');
     1544    var escapeMarkup = this.options.get('escapeMarkup');
     1545
     1546    return escapeMarkup(template(data));
     1547  };
     1548
     1549  MultipleSelection.prototype.selectionContainer = function () {
     1550    var $container = $(
     1551      '<li class="select2-selection__choice">' +
     1552        '<span class="select2-selection__choice__remove" role="presentation">' +
     1553          '&times;' +
     1554        '</span>' +
     1555      '</li>'
     1556    );
     1557
     1558    return $container;
     1559  };
     1560
     1561  MultipleSelection.prototype.update = function (data) {
     1562    this.clear();
     1563
     1564    if (data.length === 0) {
     1565      return;
     1566    }
     1567
     1568    var $selections = $();
     1569
     1570    for (var d = 0; d < data.length; d++) {
     1571      var selection = data[d];
     1572
     1573      var formatted = this.display(selection);
     1574      var $selection = this.selectionContainer();
     1575
     1576      $selection.append(formatted);
     1577      $selection.prop('title', selection.title || selection.text);
     1578
     1579      $selection.data('data', selection);
     1580
     1581      $selections = $selections.add($selection);
     1582    }
     1583
     1584    this.$selection.find('.select2-selection__rendered').append($selections);
     1585  };
     1586
     1587  return MultipleSelection;
     1588});
     1589
     1590S2.define('select2/selection/placeholder',[
     1591  '../utils'
     1592], function (Utils) {
     1593  function Placeholder (decorated, $element, options) {
     1594    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
     1595
     1596    decorated.call(this, $element, options);
     1597  }
     1598
     1599  Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
     1600    if (typeof placeholder === 'string') {
     1601      placeholder = {
     1602        id: '',
     1603        text: placeholder
     1604      };
     1605    }
     1606
     1607    return placeholder;
     1608  };
     1609
     1610  Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
     1611    var $placeholder = this.selectionContainer();
     1612
     1613    $placeholder.html(this.display(placeholder));
     1614    $placeholder.addClass('select2-selection__placeholder')
     1615                .removeClass('select2-selection__choice');
     1616
     1617    return $placeholder;
     1618  };
     1619
     1620  Placeholder.prototype.update = function (decorated, data) {
     1621    var singlePlaceholder = (
     1622      data.length == 1 && data[0].id != this.placeholder.id
     1623    );
     1624    var multipleSelections = data.length > 1;
     1625
     1626    if (multipleSelections || singlePlaceholder) {
     1627      return decorated.call(this, data);
     1628    }
     1629
     1630    this.clear();
     1631
     1632    var $placeholder = this.createPlaceholder(this.placeholder);
     1633
     1634    this.$selection.find('.select2-selection__rendered').append($placeholder);
     1635  };
     1636
     1637  return Placeholder;
     1638});
     1639
     1640S2.define('select2/selection/allowClear',[
     1641  'jquery'
     1642], function ($) {
     1643  function AllowClear () { }
     1644
     1645  AllowClear.prototype.bind = function (decorated, container, $container) {
     1646    var self = this;
     1647
     1648    decorated.call(this, container, $container);
     1649
     1650    if (self.placeholder == null) {
     1651      if (self.options.get('debug') && window.console && console.error) {
     1652        console.error(
     1653          'Select2: The `allowClear` option should be used in combination ' +
     1654          'with the `placeholder` option.'
     1655        );
     1656      }
     1657    }
     1658
     1659    this.$selection.on('mousedown', '.select2-selection__clear',
     1660      function (evt) {
     1661        // Ignore the event if it is disabled
     1662        if (self.options.get('disabled')) {
     1663          return;
     1664        }
     1665
     1666        evt.stopPropagation();
     1667
     1668        var data = $(this).data('data');
     1669
     1670        for (var d = 0; d < data.length; d++) {
     1671          var unselectData = {
     1672            data: data[d]
     1673          };
     1674
     1675          // Trigger the `unselect` event, so people can prevent it from being
     1676          // cleared.
     1677          self.trigger('unselect', unselectData);
     1678
     1679          // If the event was prevented, don't clear it out.
     1680          if (unselectData.prevented) {
     1681            return;
     1682          }
     1683        }
     1684
     1685        self.$element.val(self.placeholder.id).trigger('change');
     1686
     1687        self.trigger('toggle');
     1688    });
     1689  };
     1690
     1691  AllowClear.prototype.update = function (decorated, data) {
     1692    decorated.call(this, data);
     1693
     1694    if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
     1695        data.length === 0) {
     1696      return;
     1697    }
     1698
     1699    var $remove = $(
     1700      '<span class="select2-selection__clear">' +
     1701        '&times;' +
     1702      '</span>'
     1703    );
     1704    $remove.data('data', data);
     1705
     1706    this.$selection.find('.select2-selection__rendered').prepend($remove);
     1707  };
     1708
     1709  return AllowClear;
     1710});
     1711
     1712S2.define('select2/selection/search',[
     1713  'jquery',
     1714  '../utils',
     1715  '../keys'
     1716], function ($, Utils, KEYS) {
     1717  function Search (decorated, $element, options) {
     1718    decorated.call(this, $element, options);
     1719  }
     1720
     1721  Search.prototype.render = function (decorated) {
     1722    var $search = $(
     1723      '<li class="select2-search select2-search--inline">' +
     1724        '<input class="select2-search__field" type="search" tabindex="-1"' +
     1725        ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
     1726        ' spellcheck="false" role="textbox" />' +
     1727      '</li>'
     1728    );
     1729
     1730    this.$searchContainer = $search;
     1731    this.$search = $search.find('input');
     1732
     1733    var $rendered = decorated.call(this);
     1734
     1735    return $rendered;
     1736  };
     1737
     1738  Search.prototype.bind = function (decorated, container, $container) {
     1739    var self = this;
     1740
     1741    decorated.call(this, container, $container);
     1742
     1743    container.on('open', function () {
     1744      self.$search.attr('tabindex', 0);
     1745
     1746      self.$search.focus();
     1747    });
     1748
     1749    container.on('close', function () {
     1750      self.$search.attr('tabindex', -1);
     1751
     1752      self.$search.val('');
     1753      self.$search.focus();
     1754    });
     1755
     1756    container.on('enable', function () {
     1757      self.$search.prop('disabled', false);
     1758    });
     1759
     1760    container.on('disable', function () {
     1761      self.$search.prop('disabled', true);
     1762    });
     1763
     1764    this.$selection.on('focusin', '.select2-search--inline', function (evt) {
     1765      self.trigger('focus', evt);
     1766    });
     1767
     1768    this.$selection.on('focusout', '.select2-search--inline', function (evt) {
     1769      self.trigger('blur', evt);
     1770    });
     1771
     1772    this.$selection.on('keydown', '.select2-search--inline', function (evt) {
     1773      evt.stopPropagation();
     1774
     1775      self.trigger('keypress', evt);
     1776
     1777      self._keyUpPrevented = evt.isDefaultPrevented();
     1778
     1779      var key = evt.which;
     1780
     1781      if (key === KEYS.BACKSPACE && self.$search.val() === '') {
     1782        var $previousChoice = self.$searchContainer
     1783          .prev('.select2-selection__choice');
     1784
     1785        if ($previousChoice.length > 0) {
     1786          var item = $previousChoice.data('data');
     1787
     1788          self.searchRemoveChoice(item);
     1789
     1790          evt.preventDefault();
     1791        }
     1792      }
     1793    });
     1794
     1795    // Workaround for browsers which do not support the `input` event
     1796    // This will prevent double-triggering of events for browsers which support
     1797    // both the `keyup` and `input` events.
     1798    this.$selection.on('input', '.select2-search--inline', function (evt) {
     1799      // Unbind the duplicated `keyup` event
     1800      self.$selection.off('keyup.search');
     1801    });
     1802
     1803    this.$selection.on('keyup.search input', '.select2-search--inline',
     1804        function (evt) {
     1805      self.handleSearch(evt);
     1806    });
     1807  };
     1808
     1809  Search.prototype.createPlaceholder = function (decorated, placeholder) {
     1810    this.$search.attr('placeholder', placeholder.text);
     1811  };
     1812
     1813  Search.prototype.update = function (decorated, data) {
     1814    this.$search.attr('placeholder', '');
     1815
     1816    decorated.call(this, data);
     1817
     1818    this.$selection.find('.select2-selection__rendered')
     1819                   .append(this.$searchContainer);
     1820
     1821    this.resizeSearch();
     1822  };
     1823
     1824  Search.prototype.handleSearch = function () {
     1825    this.resizeSearch();
     1826
     1827    if (!this._keyUpPrevented) {
     1828      var input = this.$search.val();
     1829
     1830      this.trigger('query', {
     1831        term: input
     1832      });
     1833    }
     1834
     1835    this._keyUpPrevented = false;
     1836  };
     1837
     1838  Search.prototype.searchRemoveChoice = function (decorated, item) {
     1839    this.trigger('unselect', {
     1840      data: item
     1841    });
     1842
     1843    this.trigger('open');
     1844
     1845    this.$search.val(item.text + ' ');
     1846  };
     1847
     1848  Search.prototype.resizeSearch = function () {
     1849    this.$search.css('width', '25px');
     1850
     1851    var width = '';
     1852
     1853    if (this.$search.attr('placeholder') !== '') {
     1854      width = this.$selection.find('.select2-selection__rendered').innerWidth();
     1855    } else {
     1856      var minimumWidth = this.$search.val().length + 1;
     1857
     1858      width = (minimumWidth * 0.75) + 'em';
     1859    }
     1860
     1861    this.$search.css('width', width);
     1862  };
     1863
     1864  return Search;
     1865});
     1866
     1867S2.define('select2/selection/eventRelay',[
     1868  'jquery'
     1869], function ($) {
     1870  function EventRelay () { }
     1871
     1872  EventRelay.prototype.bind = function (decorated, container, $container) {
     1873    var self = this;
     1874    var relayEvents = [
     1875      'open', 'opening',
     1876      'close', 'closing',
     1877      'select', 'selecting',
     1878      'unselect', 'unselecting'
     1879    ];
     1880
     1881    var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
     1882
     1883    decorated.call(this, container, $container);
     1884
     1885    container.on('*', function (name, params) {
     1886      // Ignore events that should not be relayed
     1887      if ($.inArray(name, relayEvents) === -1) {
     1888        return;
     1889      }
     1890
     1891      // The parameters should always be an object
     1892      params = params || {};
     1893
     1894      // Generate the jQuery event for the Select2 event
     1895      var evt = $.Event('select2:' + name, {
     1896        params: params
     1897      });
     1898
     1899      self.$element.trigger(evt);
     1900
     1901      // Only handle preventable events if it was one
     1902      if ($.inArray(name, preventableEvents) === -1) {
     1903        return;
     1904      }
     1905
     1906      params.prevented = evt.isDefaultPrevented();
     1907    });
     1908  };
     1909
     1910  return EventRelay;
     1911});
     1912
     1913S2.define('select2/translation',[
     1914  'jquery',
     1915  'require'
     1916], function ($, require) {
     1917  function Translation (dict) {
     1918    this.dict = dict || {};
     1919  }
     1920
     1921  Translation.prototype.all = function () {
     1922    return this.dict;
     1923  };
     1924
     1925  Translation.prototype.get = function (key) {
     1926    return this.dict[key];
     1927  };
     1928
     1929  Translation.prototype.extend = function (translation) {
     1930    this.dict = $.extend({}, translation.all(), this.dict);
     1931  };
     1932
     1933  // Static functions
     1934
     1935  Translation._cache = {};
     1936
     1937  Translation.loadPath = function (path) {
     1938    if (!(path in Translation._cache)) {
     1939      var translations = require(path);
     1940
     1941      Translation._cache[path] = translations;
     1942    }
     1943
     1944    return new Translation(Translation._cache[path]);
     1945  };
     1946
     1947  return Translation;
     1948});
     1949
     1950S2.define('select2/diacritics',[
     1951
     1952], function () {
     1953  var diacritics = {
     1954    '\u24B6': 'A',
     1955    '\uFF21': 'A',
     1956    '\u00C0': 'A',
     1957    '\u00C1': 'A',
     1958    '\u00C2': 'A',
     1959    '\u1EA6': 'A',
     1960    '\u1EA4': 'A',
     1961    '\u1EAA': 'A',
     1962    '\u1EA8': 'A',
     1963    '\u00C3': 'A',
     1964    '\u0100': 'A',
     1965    '\u0102': 'A',
     1966    '\u1EB0': 'A',
     1967    '\u1EAE': 'A',
     1968    '\u1EB4': 'A',
     1969    '\u1EB2': 'A',
     1970    '\u0226': 'A',
     1971    '\u01E0': 'A',
     1972    '\u00C4': 'A',
     1973    '\u01DE': 'A',
     1974    '\u1EA2': 'A',
     1975    '\u00C5': 'A',
     1976    '\u01FA': 'A',
     1977    '\u01CD': 'A',
     1978    '\u0200': 'A',
     1979    '\u0202': 'A',
     1980    '\u1EA0': 'A',
     1981    '\u1EAC': 'A',
     1982    '\u1EB6': 'A',
     1983    '\u1E00': 'A',
     1984    '\u0104': 'A',
     1985    '\u023A': 'A',
     1986    '\u2C6F': 'A',
     1987    '\uA732': 'AA',
     1988    '\u00C6': 'AE',
     1989    '\u01FC': 'AE',
     1990    '\u01E2': 'AE',
     1991    '\uA734': 'AO',
     1992    '\uA736': 'AU',
     1993    '\uA738': 'AV',
     1994    '\uA73A': 'AV',
     1995    '\uA73C': 'AY',
     1996    '\u24B7': 'B',
     1997    '\uFF22': 'B',
     1998    '\u1E02': 'B',
     1999    '\u1E04': 'B',
     2000    '\u1E06': 'B',
     2001    '\u0243': 'B',
     2002    '\u0182': 'B',
     2003    '\u0181': 'B',
     2004    '\u24B8': 'C',
     2005    '\uFF23': 'C',
     2006    '\u0106': 'C',
     2007    '\u0108': 'C',
     2008    '\u010A': 'C',
     2009    '\u010C': 'C',
     2010    '\u00C7': 'C',
     2011    '\u1E08': 'C',
     2012    '\u0187': 'C',
     2013    '\u023B': 'C',
     2014    '\uA73E': 'C',
     2015    '\u24B9': 'D',
     2016    '\uFF24': 'D',
     2017    '\u1E0A': 'D',
     2018    '\u010E': 'D',
     2019    '\u1E0C': 'D',
     2020    '\u1E10': 'D',
     2021    '\u1E12': 'D',
     2022    '\u1E0E': 'D',
     2023    '\u0110': 'D',
     2024    '\u018B': 'D',
     2025    '\u018A': 'D',
     2026    '\u0189': 'D',
     2027    '\uA779': 'D',
     2028    '\u01F1': 'DZ',
     2029    '\u01C4': 'DZ',
     2030    '\u01F2': 'Dz',
     2031    '\u01C5': 'Dz',
     2032    '\u24BA': 'E',
     2033    '\uFF25': 'E',
     2034    '\u00C8': 'E',
     2035    '\u00C9': 'E',
     2036    '\u00CA': 'E',
     2037    '\u1EC0': 'E',
     2038    '\u1EBE': 'E',
     2039    '\u1EC4': 'E',
     2040    '\u1EC2': 'E',
     2041    '\u1EBC': 'E',
     2042    '\u0112': 'E',
     2043    '\u1E14': 'E',
     2044    '\u1E16': 'E',
     2045    '\u0114': 'E',
     2046    '\u0116': 'E',
     2047    '\u00CB': 'E',
     2048    '\u1EBA': 'E',
     2049    '\u011A': 'E',
     2050    '\u0204': 'E',
     2051    '\u0206': 'E',
     2052    '\u1EB8': 'E',
     2053    '\u1EC6': 'E',
     2054    '\u0228': 'E',
     2055    '\u1E1C': 'E',
     2056    '\u0118': 'E',
     2057    '\u1E18': 'E',
     2058    '\u1E1A': 'E',
     2059    '\u0190': 'E',
     2060    '\u018E': 'E',
     2061    '\u24BB': 'F',
     2062    '\uFF26': 'F',
     2063    '\u1E1E': 'F',
     2064    '\u0191': 'F',
     2065    '\uA77B': 'F',
     2066    '\u24BC': 'G',
     2067    '\uFF27': 'G',
     2068    '\u01F4': 'G',
     2069    '\u011C': 'G',
     2070    '\u1E20': 'G',
     2071    '\u011E': 'G',
     2072    '\u0120': 'G',
     2073    '\u01E6': 'G',
     2074    '\u0122': 'G',
     2075    '\u01E4': 'G',
     2076    '\u0193': 'G',
     2077    '\uA7A0': 'G',
     2078    '\uA77D': 'G',
     2079    '\uA77E': 'G',
     2080    '\u24BD': 'H',
     2081    '\uFF28': 'H',
     2082    '\u0124': 'H',
     2083    '\u1E22': 'H',
     2084    '\u1E26': 'H',
     2085    '\u021E': 'H',
     2086    '\u1E24': 'H',
     2087    '\u1E28': 'H',
     2088    '\u1E2A': 'H',
     2089    '\u0126': 'H',
     2090    '\u2C67': 'H',
     2091    '\u2C75': 'H',
     2092    '\uA78D': 'H',
     2093    '\u24BE': 'I',
     2094    '\uFF29': 'I',
     2095    '\u00CC': 'I',
     2096    '\u00CD': 'I',
     2097    '\u00CE': 'I',
     2098    '\u0128': 'I',
     2099    '\u012A': 'I',
     2100    '\u012C': 'I',
     2101    '\u0130': 'I',
     2102    '\u00CF': 'I',
     2103    '\u1E2E': 'I',
     2104    '\u1EC8': 'I',
     2105    '\u01CF': 'I',
     2106    '\u0208': 'I',
     2107    '\u020A': 'I',
     2108    '\u1ECA': 'I',
     2109    '\u012E': 'I',
     2110    '\u1E2C': 'I',
     2111    '\u0197': 'I',
     2112    '\u24BF': 'J',
     2113    '\uFF2A': 'J',
     2114    '\u0134': 'J',
     2115    '\u0248': 'J',
     2116    '\u24C0': 'K',
     2117    '\uFF2B': 'K',
     2118    '\u1E30': 'K',
     2119    '\u01E8': 'K',
     2120    '\u1E32': 'K',
     2121    '\u0136': 'K',
     2122    '\u1E34': 'K',
     2123    '\u0198': 'K',
     2124    '\u2C69': 'K',
     2125    '\uA740': 'K',
     2126    '\uA742': 'K',
     2127    '\uA744': 'K',
     2128    '\uA7A2': 'K',
     2129    '\u24C1': 'L',
     2130    '\uFF2C': 'L',
     2131    '\u013F': 'L',
     2132    '\u0139': 'L',
     2133    '\u013D': 'L',
     2134    '\u1E36': 'L',
     2135    '\u1E38': 'L',
     2136    '\u013B': 'L',
     2137    '\u1E3C': 'L',
     2138    '\u1E3A': 'L',
     2139    '\u0141': 'L',
     2140    '\u023D': 'L',
     2141    '\u2C62': 'L',
     2142    '\u2C60': 'L',
     2143    '\uA748': 'L',
     2144    '\uA746': 'L',
     2145    '\uA780': 'L',
     2146    '\u01C7': 'LJ',
     2147    '\u01C8': 'Lj',
     2148    '\u24C2': 'M',
     2149    '\uFF2D': 'M',
     2150    '\u1E3E': 'M',
     2151    '\u1E40': 'M',
     2152    '\u1E42': 'M',
     2153    '\u2C6E': 'M',
     2154    '\u019C': 'M',
     2155    '\u24C3': 'N',
     2156    '\uFF2E': 'N',
     2157    '\u01F8': 'N',
     2158    '\u0143': 'N',
     2159    '\u00D1': 'N',
     2160    '\u1E44': 'N',
     2161    '\u0147': 'N',
     2162    '\u1E46': 'N',
     2163    '\u0145': 'N',
     2164    '\u1E4A': 'N',
     2165    '\u1E48': 'N',
     2166    '\u0220': 'N',
     2167    '\u019D': 'N',
     2168    '\uA790': 'N',
     2169    '\uA7A4': 'N',
     2170    '\u01CA': 'NJ',
     2171    '\u01CB': 'Nj',
     2172    '\u24C4': 'O',
     2173    '\uFF2F': 'O',
     2174    '\u00D2': 'O',
     2175    '\u00D3': 'O',
     2176    '\u00D4': 'O',
     2177    '\u1ED2': 'O',
     2178    '\u1ED0': 'O',
     2179    '\u1ED6': 'O',
     2180    '\u1ED4': 'O',
     2181    '\u00D5': 'O',
     2182    '\u1E4C': 'O',
     2183    '\u022C': 'O',
     2184    '\u1E4E': 'O',
     2185    '\u014C': 'O',
     2186    '\u1E50': 'O',
     2187    '\u1E52': 'O',
     2188    '\u014E': 'O',
     2189    '\u022E': 'O',
     2190    '\u0230': 'O',
     2191    '\u00D6': 'O',
     2192    '\u022A': 'O',
     2193    '\u1ECE': 'O',
     2194    '\u0150': 'O',
     2195    '\u01D1': 'O',
     2196    '\u020C': 'O',
     2197    '\u020E': 'O',
     2198    '\u01A0': 'O',
     2199    '\u1EDC': 'O',
     2200    '\u1EDA': 'O',
     2201    '\u1EE0': 'O',
     2202    '\u1EDE': 'O',
     2203    '\u1EE2': 'O',
     2204    '\u1ECC': 'O',
     2205    '\u1ED8': 'O',
     2206    '\u01EA': 'O',
     2207    '\u01EC': 'O',
     2208    '\u00D8': 'O',
     2209    '\u01FE': 'O',
     2210    '\u0186': 'O',
     2211    '\u019F': 'O',
     2212    '\uA74A': 'O',
     2213    '\uA74C': 'O',
     2214    '\u01A2': 'OI',
     2215    '\uA74E': 'OO',
     2216    '\u0222': 'OU',
     2217    '\u24C5': 'P',
     2218    '\uFF30': 'P',
     2219    '\u1E54': 'P',
     2220    '\u1E56': 'P',
     2221    '\u01A4': 'P',
     2222    '\u2C63': 'P',
     2223    '\uA750': 'P',
     2224    '\uA752': 'P',
     2225    '\uA754': 'P',
     2226    '\u24C6': 'Q',
     2227    '\uFF31': 'Q',
     2228    '\uA756': 'Q',
     2229    '\uA758': 'Q',
     2230    '\u024A': 'Q',
     2231    '\u24C7': 'R',
     2232    '\uFF32': 'R',
     2233    '\u0154': 'R',
     2234    '\u1E58': 'R',
     2235    '\u0158': 'R',
     2236    '\u0210': 'R',
     2237    '\u0212': 'R',
     2238    '\u1E5A': 'R',
     2239    '\u1E5C': 'R',
     2240    '\u0156': 'R',
     2241    '\u1E5E': 'R',
     2242    '\u024C': 'R',
     2243    '\u2C64': 'R',
     2244    '\uA75A': 'R',
     2245    '\uA7A6': 'R',
     2246    '\uA782': 'R',
     2247    '\u24C8': 'S',
     2248    '\uFF33': 'S',
     2249    '\u1E9E': 'S',
     2250    '\u015A': 'S',
     2251    '\u1E64': 'S',
     2252    '\u015C': 'S',
     2253    '\u1E60': 'S',
     2254    '\u0160': 'S',
     2255    '\u1E66': 'S',
     2256    '\u1E62': 'S',
     2257    '\u1E68': 'S',
     2258    '\u0218': 'S',
     2259    '\u015E': 'S',
     2260    '\u2C7E': 'S',
     2261    '\uA7A8': 'S',
     2262    '\uA784': 'S',
     2263    '\u24C9': 'T',
     2264    '\uFF34': 'T',
     2265    '\u1E6A': 'T',
     2266    '\u0164': 'T',
     2267    '\u1E6C': 'T',
     2268    '\u021A': 'T',
     2269    '\u0162': 'T',
     2270    '\u1E70': 'T',
     2271    '\u1E6E': 'T',
     2272    '\u0166': 'T',
     2273    '\u01AC': 'T',
     2274    '\u01AE': 'T',
     2275    '\u023E': 'T',
     2276    '\uA786': 'T',
     2277    '\uA728': 'TZ',
     2278    '\u24CA': 'U',
     2279    '\uFF35': 'U',
     2280    '\u00D9': 'U',
     2281    '\u00DA': 'U',
     2282    '\u00DB': 'U',
     2283    '\u0168': 'U',
     2284    '\u1E78': 'U',
     2285    '\u016A': 'U',
     2286    '\u1E7A': 'U',
     2287    '\u016C': 'U',
     2288    '\u00DC': 'U',
     2289    '\u01DB': 'U',
     2290    '\u01D7': 'U',
     2291    '\u01D5': 'U',
     2292    '\u01D9': 'U',
     2293    '\u1EE6': 'U',
     2294    '\u016E': 'U',
     2295    '\u0170': 'U',
     2296    '\u01D3': 'U',
     2297    '\u0214': 'U',
     2298    '\u0216': 'U',
     2299    '\u01AF': 'U',
     2300    '\u1EEA': 'U',
     2301    '\u1EE8': 'U',
     2302    '\u1EEE': 'U',
     2303    '\u1EEC': 'U',
     2304    '\u1EF0': 'U',
     2305    '\u1EE4': 'U',
     2306    '\u1E72': 'U',
     2307    '\u0172': 'U',
     2308    '\u1E76': 'U',
     2309    '\u1E74': 'U',
     2310    '\u0244': 'U',
     2311    '\u24CB': 'V',
     2312    '\uFF36': 'V',
     2313    '\u1E7C': 'V',
     2314    '\u1E7E': 'V',
     2315    '\u01B2': 'V',
     2316    '\uA75E': 'V',
     2317    '\u0245': 'V',
     2318    '\uA760': 'VY',
     2319    '\u24CC': 'W',
     2320    '\uFF37': 'W',
     2321    '\u1E80': 'W',
     2322    '\u1E82': 'W',
     2323    '\u0174': 'W',
     2324    '\u1E86': 'W',
     2325    '\u1E84': 'W',
     2326    '\u1E88': 'W',
     2327    '\u2C72': 'W',
     2328    '\u24CD': 'X',
     2329    '\uFF38': 'X',
     2330    '\u1E8A': 'X',
     2331    '\u1E8C': 'X',
     2332    '\u24CE': 'Y',
     2333    '\uFF39': 'Y',
     2334    '\u1EF2': 'Y',
     2335    '\u00DD': 'Y',
     2336    '\u0176': 'Y',
     2337    '\u1EF8': 'Y',
     2338    '\u0232': 'Y',
     2339    '\u1E8E': 'Y',
     2340    '\u0178': 'Y',
     2341    '\u1EF6': 'Y',
     2342    '\u1EF4': 'Y',
     2343    '\u01B3': 'Y',
     2344    '\u024E': 'Y',
     2345    '\u1EFE': 'Y',
     2346    '\u24CF': 'Z',
     2347    '\uFF3A': 'Z',
     2348    '\u0179': 'Z',
     2349    '\u1E90': 'Z',
     2350    '\u017B': 'Z',
     2351    '\u017D': 'Z',
     2352    '\u1E92': 'Z',
     2353    '\u1E94': 'Z',
     2354    '\u01B5': 'Z',
     2355    '\u0224': 'Z',
     2356    '\u2C7F': 'Z',
     2357    '\u2C6B': 'Z',
     2358    '\uA762': 'Z',
     2359    '\u24D0': 'a',
     2360    '\uFF41': 'a',
     2361    '\u1E9A': 'a',
     2362    '\u00E0': 'a',
     2363    '\u00E1': 'a',
     2364    '\u00E2': 'a',
     2365    '\u1EA7': 'a',
     2366    '\u1EA5': 'a',
     2367    '\u1EAB': 'a',
     2368    '\u1EA9': 'a',
     2369    '\u00E3': 'a',
     2370    '\u0101': 'a',
     2371    '\u0103': 'a',
     2372    '\u1EB1': 'a',
     2373    '\u1EAF': 'a',
     2374    '\u1EB5': 'a',
     2375    '\u1EB3': 'a',
     2376    '\u0227': 'a',
     2377    '\u01E1': 'a',
     2378    '\u00E4': 'a',
     2379    '\u01DF': 'a',
     2380    '\u1EA3': 'a',
     2381    '\u00E5': 'a',
     2382    '\u01FB': 'a',
     2383    '\u01CE': 'a',
     2384    '\u0201': 'a',
     2385    '\u0203': 'a',
     2386    '\u1EA1': 'a',
     2387    '\u1EAD': 'a',
     2388    '\u1EB7': 'a',
     2389    '\u1E01': 'a',
     2390    '\u0105': 'a',
     2391    '\u2C65': 'a',
     2392    '\u0250': 'a',
     2393    '\uA733': 'aa',
     2394    '\u00E6': 'ae',
     2395    '\u01FD': 'ae',
     2396    '\u01E3': 'ae',
     2397    '\uA735': 'ao',
     2398    '\uA737': 'au',
     2399    '\uA739': 'av',
     2400    '\uA73B': 'av',
     2401    '\uA73D': 'ay',
     2402    '\u24D1': 'b',
     2403    '\uFF42': 'b',
     2404    '\u1E03': 'b',
     2405    '\u1E05': 'b',
     2406    '\u1E07': 'b',
     2407    '\u0180': 'b',
     2408    '\u0183': 'b',
     2409    '\u0253': 'b',
     2410    '\u24D2': 'c',
     2411    '\uFF43': 'c',
     2412    '\u0107': 'c',
     2413    '\u0109': 'c',
     2414    '\u010B': 'c',
     2415    '\u010D': 'c',
     2416    '\u00E7': 'c',
     2417    '\u1E09': 'c',
     2418    '\u0188': 'c',
     2419    '\u023C': 'c',
     2420    '\uA73F': 'c',
     2421    '\u2184': 'c',
     2422    '\u24D3': 'd',
     2423    '\uFF44': 'd',
     2424    '\u1E0B': 'd',
     2425    '\u010F': 'd',
     2426    '\u1E0D': 'd',
     2427    '\u1E11': 'd',
     2428    '\u1E13': 'd',
     2429    '\u1E0F': 'd',
     2430    '\u0111': 'd',
     2431    '\u018C': 'd',
     2432    '\u0256': 'd',
     2433    '\u0257': 'd',
     2434    '\uA77A': 'd',
     2435    '\u01F3': 'dz',
     2436    '\u01C6': 'dz',
     2437    '\u24D4': 'e',
     2438    '\uFF45': 'e',
     2439    '\u00E8': 'e',
     2440    '\u00E9': 'e',
     2441    '\u00EA': 'e',
     2442    '\u1EC1': 'e',
     2443    '\u1EBF': 'e',
     2444    '\u1EC5': 'e',
     2445    '\u1EC3': 'e',
     2446    '\u1EBD': 'e',
     2447    '\u0113': 'e',
     2448    '\u1E15': 'e',
     2449    '\u1E17': 'e',
     2450    '\u0115': 'e',
     2451    '\u0117': 'e',
     2452    '\u00EB': 'e',
     2453    '\u1EBB': 'e',
     2454    '\u011B': 'e',
     2455    '\u0205': 'e',
     2456    '\u0207': 'e',
     2457    '\u1EB9': 'e',
     2458    '\u1EC7': 'e',
     2459    '\u0229': 'e',
     2460    '\u1E1D': 'e',
     2461    '\u0119': 'e',
     2462    '\u1E19': 'e',
     2463    '\u1E1B': 'e',
     2464    '\u0247': 'e',
     2465    '\u025B': 'e',
     2466    '\u01DD': 'e',
     2467    '\u24D5': 'f',
     2468    '\uFF46': 'f',
     2469    '\u1E1F': 'f',
     2470    '\u0192': 'f',
     2471    '\uA77C': 'f',
     2472    '\u24D6': 'g',
     2473    '\uFF47': 'g',
     2474    '\u01F5': 'g',
     2475    '\u011D': 'g',
     2476    '\u1E21': 'g',
     2477    '\u011F': 'g',
     2478    '\u0121': 'g',
     2479    '\u01E7': 'g',
     2480    '\u0123': 'g',
     2481    '\u01E5': 'g',
     2482    '\u0260': 'g',
     2483    '\uA7A1': 'g',
     2484    '\u1D79': 'g',
     2485    '\uA77F': 'g',
     2486    '\u24D7': 'h',
     2487    '\uFF48': 'h',
     2488    '\u0125': 'h',
     2489    '\u1E23': 'h',
     2490    '\u1E27': 'h',
     2491    '\u021F': 'h',
     2492    '\u1E25': 'h',
     2493    '\u1E29': 'h',
     2494    '\u1E2B': 'h',
     2495    '\u1E96': 'h',
     2496    '\u0127': 'h',
     2497    '\u2C68': 'h',
     2498    '\u2C76': 'h',
     2499    '\u0265': 'h',
     2500    '\u0195': 'hv',
     2501    '\u24D8': 'i',
     2502    '\uFF49': 'i',
     2503    '\u00EC': 'i',
     2504    '\u00ED': 'i',
     2505    '\u00EE': 'i',
     2506    '\u0129': 'i',
     2507    '\u012B': 'i',
     2508    '\u012D': 'i',
     2509    '\u00EF': 'i',
     2510    '\u1E2F': 'i',
     2511    '\u1EC9': 'i',
     2512    '\u01D0': 'i',
     2513    '\u0209': 'i',
     2514    '\u020B': 'i',
     2515    '\u1ECB': 'i',
     2516    '\u012F': 'i',
     2517    '\u1E2D': 'i',
     2518    '\u0268': 'i',
     2519    '\u0131': 'i',
     2520    '\u24D9': 'j',
     2521    '\uFF4A': 'j',
     2522    '\u0135': 'j',
     2523    '\u01F0': 'j',
     2524    '\u0249': 'j',
     2525    '\u24DA': 'k',
     2526    '\uFF4B': 'k',
     2527    '\u1E31': 'k',
     2528    '\u01E9': 'k',
     2529    '\u1E33': 'k',
     2530    '\u0137': 'k',
     2531    '\u1E35': 'k',
     2532    '\u0199': 'k',
     2533    '\u2C6A': 'k',
     2534    '\uA741': 'k',
     2535    '\uA743': 'k',
     2536    '\uA745': 'k',
     2537    '\uA7A3': 'k',
     2538    '\u24DB': 'l',
     2539    '\uFF4C': 'l',
     2540    '\u0140': 'l',
     2541    '\u013A': 'l',
     2542    '\u013E': 'l',
     2543    '\u1E37': 'l',
     2544    '\u1E39': 'l',
     2545    '\u013C': 'l',
     2546    '\u1E3D': 'l',
     2547    '\u1E3B': 'l',
     2548    '\u017F': 'l',
     2549    '\u0142': 'l',
     2550    '\u019A': 'l',
     2551    '\u026B': 'l',
     2552    '\u2C61': 'l',
     2553    '\uA749': 'l',
     2554    '\uA781': 'l',
     2555    '\uA747': 'l',
     2556    '\u01C9': 'lj',
     2557    '\u24DC': 'm',
     2558    '\uFF4D': 'm',
     2559    '\u1E3F': 'm',
     2560    '\u1E41': 'm',
     2561    '\u1E43': 'm',
     2562    '\u0271': 'm',
     2563    '\u026F': 'm',
     2564    '\u24DD': 'n',
     2565    '\uFF4E': 'n',
     2566    '\u01F9': 'n',
     2567    '\u0144': 'n',
     2568    '\u00F1': 'n',
     2569    '\u1E45': 'n',
     2570    '\u0148': 'n',
     2571    '\u1E47': 'n',
     2572    '\u0146': 'n',
     2573    '\u1E4B': 'n',
     2574    '\u1E49': 'n',
     2575    '\u019E': 'n',
     2576    '\u0272': 'n',
     2577    '\u0149': 'n',
     2578    '\uA791': 'n',
     2579    '\uA7A5': 'n',
     2580    '\u01CC': 'nj',
     2581    '\u24DE': 'o',
     2582    '\uFF4F': 'o',
     2583    '\u00F2': 'o',
     2584    '\u00F3': 'o',
     2585    '\u00F4': 'o',
     2586    '\u1ED3': 'o',
     2587    '\u1ED1': 'o',
     2588    '\u1ED7': 'o',
     2589    '\u1ED5': 'o',
     2590    '\u00F5': 'o',
     2591    '\u1E4D': 'o',
     2592    '\u022D': 'o',
     2593    '\u1E4F': 'o',
     2594    '\u014D': 'o',
     2595    '\u1E51': 'o',
     2596    '\u1E53': 'o',
     2597    '\u014F': 'o',
     2598    '\u022F': 'o',
     2599    '\u0231': 'o',
     2600    '\u00F6': 'o',
     2601    '\u022B': 'o',
     2602    '\u1ECF': 'o',
     2603    '\u0151': 'o',
     2604    '\u01D2': 'o',
     2605    '\u020D': 'o',
     2606    '\u020F': 'o',
     2607    '\u01A1': 'o',
     2608    '\u1EDD': 'o',
     2609    '\u1EDB': 'o',
     2610    '\u1EE1': 'o',
     2611    '\u1EDF': 'o',
     2612    '\u1EE3': 'o',
     2613    '\u1ECD': 'o',
     2614    '\u1ED9': 'o',
     2615    '\u01EB': 'o',
     2616    '\u01ED': 'o',
     2617    '\u00F8': 'o',
     2618    '\u01FF': 'o',
     2619    '\u0254': 'o',
     2620    '\uA74B': 'o',
     2621    '\uA74D': 'o',
     2622    '\u0275': 'o',
     2623    '\u01A3': 'oi',
     2624    '\u0223': 'ou',
     2625    '\uA74F': 'oo',
     2626    '\u24DF': 'p',
     2627    '\uFF50': 'p',
     2628    '\u1E55': 'p',
     2629    '\u1E57': 'p',
     2630    '\u01A5': 'p',
     2631    '\u1D7D': 'p',
     2632    '\uA751': 'p',
     2633    '\uA753': 'p',
     2634    '\uA755': 'p',
     2635    '\u24E0': 'q',
     2636    '\uFF51': 'q',
     2637    '\u024B': 'q',
     2638    '\uA757': 'q',
     2639    '\uA759': 'q',
     2640    '\u24E1': 'r',
     2641    '\uFF52': 'r',
     2642    '\u0155': 'r',
     2643    '\u1E59': 'r',
     2644    '\u0159': 'r',
     2645    '\u0211': 'r',
     2646    '\u0213': 'r',
     2647    '\u1E5B': 'r',
     2648    '\u1E5D': 'r',
     2649    '\u0157': 'r',
     2650    '\u1E5F': 'r',
     2651    '\u024D': 'r',
     2652    '\u027D': 'r',
     2653    '\uA75B': 'r',
     2654    '\uA7A7': 'r',
     2655    '\uA783': 'r',
     2656    '\u24E2': 's',
     2657    '\uFF53': 's',
     2658    '\u00DF': 's',
     2659    '\u015B': 's',
     2660    '\u1E65': 's',
     2661    '\u015D': 's',
     2662    '\u1E61': 's',
     2663    '\u0161': 's',
     2664    '\u1E67': 's',
     2665    '\u1E63': 's',
     2666    '\u1E69': 's',
     2667    '\u0219': 's',
     2668    '\u015F': 's',
     2669    '\u023F': 's',
     2670    '\uA7A9': 's',
     2671    '\uA785': 's',
     2672    '\u1E9B': 's',
     2673    '\u24E3': 't',
     2674    '\uFF54': 't',
     2675    '\u1E6B': 't',
     2676    '\u1E97': 't',
     2677    '\u0165': 't',
     2678    '\u1E6D': 't',
     2679    '\u021B': 't',
     2680    '\u0163': 't',
     2681    '\u1E71': 't',
     2682    '\u1E6F': 't',
     2683    '\u0167': 't',
     2684    '\u01AD': 't',
     2685    '\u0288': 't',
     2686    '\u2C66': 't',
     2687    '\uA787': 't',
     2688    '\uA729': 'tz',
     2689    '\u24E4': 'u',
     2690    '\uFF55': 'u',
     2691    '\u00F9': 'u',
     2692    '\u00FA': 'u',
     2693    '\u00FB': 'u',
     2694    '\u0169': 'u',
     2695    '\u1E79': 'u',
     2696    '\u016B': 'u',
     2697    '\u1E7B': 'u',
     2698    '\u016D': 'u',
     2699    '\u00FC': 'u',
     2700    '\u01DC': 'u',
     2701    '\u01D8': 'u',
     2702    '\u01D6': 'u',
     2703    '\u01DA': 'u',
     2704    '\u1EE7': 'u',
     2705    '\u016F': 'u',
     2706    '\u0171': 'u',
     2707    '\u01D4': 'u',
     2708    '\u0215': 'u',
     2709    '\u0217': 'u',
     2710    '\u01B0': 'u',
     2711    '\u1EEB': 'u',
     2712    '\u1EE9': 'u',
     2713    '\u1EEF': 'u',
     2714    '\u1EED': 'u',
     2715    '\u1EF1': 'u',
     2716    '\u1EE5': 'u',
     2717    '\u1E73': 'u',
     2718    '\u0173': 'u',
     2719    '\u1E77': 'u',
     2720    '\u1E75': 'u',
     2721    '\u0289': 'u',
     2722    '\u24E5': 'v',
     2723    '\uFF56': 'v',
     2724    '\u1E7D': 'v',
     2725    '\u1E7F': 'v',
     2726    '\u028B': 'v',
     2727    '\uA75F': 'v',
     2728    '\u028C': 'v',
     2729    '\uA761': 'vy',
     2730    '\u24E6': 'w',
     2731    '\uFF57': 'w',
     2732    '\u1E81': 'w',
     2733    '\u1E83': 'w',
     2734    '\u0175': 'w',
     2735    '\u1E87': 'w',
     2736    '\u1E85': 'w',
     2737    '\u1E98': 'w',
     2738    '\u1E89': 'w',
     2739    '\u2C73': 'w',
     2740    '\u24E7': 'x',
     2741    '\uFF58': 'x',
     2742    '\u1E8B': 'x',
     2743    '\u1E8D': 'x',
     2744    '\u24E8': 'y',
     2745    '\uFF59': 'y',
     2746    '\u1EF3': 'y',
     2747    '\u00FD': 'y',
     2748    '\u0177': 'y',
     2749    '\u1EF9': 'y',
     2750    '\u0233': 'y',
     2751    '\u1E8F': 'y',
     2752    '\u00FF': 'y',
     2753    '\u1EF7': 'y',
     2754    '\u1E99': 'y',
     2755    '\u1EF5': 'y',
     2756    '\u01B4': 'y',
     2757    '\u024F': 'y',
     2758    '\u1EFF': 'y',
     2759    '\u24E9': 'z',
     2760    '\uFF5A': 'z',
     2761    '\u017A': 'z',
     2762    '\u1E91': 'z',
     2763    '\u017C': 'z',
     2764    '\u017E': 'z',
     2765    '\u1E93': 'z',
     2766    '\u1E95': 'z',
     2767    '\u01B6': 'z',
     2768    '\u0225': 'z',
     2769    '\u0240': 'z',
     2770    '\u2C6C': 'z',
     2771    '\uA763': 'z',
     2772    '\u0386': '\u0391',
     2773    '\u0388': '\u0395',
     2774    '\u0389': '\u0397',
     2775    '\u038A': '\u0399',
     2776    '\u03AA': '\u0399',
     2777    '\u038C': '\u039F',
     2778    '\u038E': '\u03A5',
     2779    '\u03AB': '\u03A5',
     2780    '\u038F': '\u03A9',
     2781    '\u03AC': '\u03B1',
     2782    '\u03AD': '\u03B5',
     2783    '\u03AE': '\u03B7',
     2784    '\u03AF': '\u03B9',
     2785    '\u03CA': '\u03B9',
     2786    '\u0390': '\u03B9',
     2787    '\u03CC': '\u03BF',
     2788    '\u03CD': '\u03C5',
     2789    '\u03CB': '\u03C5',
     2790    '\u03B0': '\u03C5',
     2791    '\u03C9': '\u03C9',
     2792    '\u03C2': '\u03C3'
     2793  };
     2794
     2795  return diacritics;
     2796});
     2797
     2798S2.define('select2/data/base',[
     2799  '../utils'
     2800], function (Utils) {
     2801  function BaseAdapter ($element, options) {
     2802    BaseAdapter.__super__.constructor.call(this);
     2803  }
     2804
     2805  Utils.Extend(BaseAdapter, Utils.Observable);
     2806
     2807  BaseAdapter.prototype.current = function (callback) {
     2808    throw new Error('The `current` method must be defined in child classes.');
     2809  };
     2810
     2811  BaseAdapter.prototype.query = function (params, callback) {
     2812    throw new Error('The `query` method must be defined in child classes.');
     2813  };
     2814
     2815  BaseAdapter.prototype.bind = function (container, $container) {
     2816    // Can be implemented in subclasses
     2817  };
     2818
     2819  BaseAdapter.prototype.destroy = function () {
     2820    // Can be implemented in subclasses
     2821  };
     2822
     2823  BaseAdapter.prototype.generateResultId = function (container, data) {
     2824    var id = container.id + '-result-';
     2825
     2826    id += Utils.generateChars(4);
     2827
     2828    if (data.id != null) {
     2829      id += '-' + data.id.toString();
     2830    } else {
     2831      id += '-' + Utils.generateChars(4);
     2832    }
     2833    return id;
     2834  };
     2835
     2836  return BaseAdapter;
     2837});
     2838
     2839S2.define('select2/data/select',[
     2840  './base',
     2841  '../utils',
     2842  'jquery'
     2843], function (BaseAdapter, Utils, $) {
     2844  function SelectAdapter ($element, options) {
     2845    this.$element = $element;
     2846    this.options = options;
     2847
     2848    SelectAdapter.__super__.constructor.call(this);
     2849  }
     2850
     2851  Utils.Extend(SelectAdapter, BaseAdapter);
     2852
     2853  SelectAdapter.prototype.current = function (callback) {
     2854    var data = [];
     2855    var self = this;
     2856
     2857    this.$element.find(':selected').each(function () {
     2858      var $option = $(this);
     2859
     2860      var option = self.item($option);
     2861
     2862      data.push(option);
     2863    });
     2864
     2865    callback(data);
     2866  };
     2867
     2868  SelectAdapter.prototype.select = function (data) {
     2869    var self = this;
     2870
     2871    data.selected = true;
     2872
     2873    // If data.element is a DOM node, use it instead
     2874    if ($(data.element).is('option')) {
     2875      data.element.selected = true;
     2876
     2877      this.$element.trigger('change');
     2878
     2879      return;
     2880    }
     2881
     2882    if (this.$element.prop('multiple')) {
     2883      this.current(function (currentData) {
     2884        var val = [];
     2885
     2886        data = [data];
     2887        data.push.apply(data, currentData);
     2888
     2889        for (var d = 0; d < data.length; d++) {
     2890          var id = data[d].id;
     2891
     2892          if ($.inArray(id, val) === -1) {
     2893            val.push(id);
     2894          }
     2895        }
     2896
     2897        self.$element.val(val);
     2898        self.$element.trigger('change');
     2899      });
     2900    } else {
     2901      var val = data.id;
     2902
     2903      this.$element.val(val);
     2904      this.$element.trigger('change');
     2905    }
     2906  };
     2907
     2908  SelectAdapter.prototype.unselect = function (data) {
     2909    var self = this;
     2910
     2911    if (!this.$element.prop('multiple')) {
     2912      return;
     2913    }
     2914
     2915    data.selected = false;
     2916
     2917    if ($(data.element).is('option')) {
     2918      data.element.selected = false;
     2919
     2920      this.$element.trigger('change');
     2921
     2922      return;
     2923    }
     2924
     2925    this.current(function (currentData) {
     2926      var val = [];
     2927
     2928      for (var d = 0; d < currentData.length; d++) {
     2929        var id = currentData[d].id;
     2930
     2931        if (id !== data.id && $.inArray(id, val) === -1) {
     2932          val.push(id);
     2933        }
     2934      }
     2935
     2936      self.$element.val(val);
     2937
     2938      self.$element.trigger('change');
     2939    });
     2940  };
     2941
     2942  SelectAdapter.prototype.bind = function (container, $container) {
     2943    var self = this;
     2944
     2945    this.container = container;
     2946
     2947    container.on('select', function (params) {
     2948      self.select(params.data);
     2949    });
     2950
     2951    container.on('unselect', function (params) {
     2952      self.unselect(params.data);
     2953    });
     2954  };
     2955
     2956  SelectAdapter.prototype.destroy = function () {
     2957    // Remove anything added to child elements
     2958    this.$element.find('*').each(function () {
     2959      // Remove any custom data set by Select2
     2960      $.removeData(this, 'data');
     2961    });
     2962  };
     2963
     2964  SelectAdapter.prototype.query = function (params, callback) {
     2965    var data = [];
     2966    var self = this;
     2967
     2968    var $options = this.$element.children();
     2969
     2970    $options.each(function () {
     2971      var $option = $(this);
     2972
     2973      if (!$option.is('option') && !$option.is('optgroup')) {
     2974        return;
     2975      }
     2976
     2977      var option = self.item($option);
     2978
     2979      var matches = self.matches(params, option);
     2980
     2981      if (matches !== null) {
     2982        data.push(matches);
     2983      }
     2984    });
     2985
     2986    callback({
     2987      results: data
     2988    });
     2989  };
     2990
     2991  SelectAdapter.prototype.addOptions = function ($options) {
     2992    this.$element.append($options);
     2993  };
     2994
     2995  SelectAdapter.prototype.option = function (data) {
     2996    var option;
     2997
     2998    if (data.children) {
     2999      option = document.createElement('optgroup');
     3000      option.label = data.text;
     3001    } else {
     3002      option = document.createElement('option');
     3003
     3004      if (option.textContent !== undefined) {
     3005        option.textContent = data.text;
     3006      } else {
     3007        option.innerText = data.text;
     3008      }
     3009    }
     3010
     3011    if (data.id) {
     3012      option.value = data.id;
     3013    }
     3014
     3015    if (data.disabled) {
     3016      option.disabled = true;
     3017    }
     3018
     3019    if (data.selected) {
     3020      option.selected = true;
     3021    }
     3022
     3023    if (data.title) {
     3024      option.title = data.title;
     3025    }
     3026
     3027    var $option = $(option);
     3028
     3029    var normalizedData = this._normalizeItem(data);
     3030    normalizedData.element = option;
     3031
     3032    // Override the option's data with the combined data
     3033    $.data(option, 'data', normalizedData);
     3034
     3035    return $option;
     3036  };
     3037
     3038  SelectAdapter.prototype.item = function ($option) {
     3039    var data = {};
     3040
     3041    data = $.data($option[0], 'data');
     3042
     3043    if (data != null) {
     3044      return data;
     3045    }
     3046
     3047    if ($option.is('option')) {
     3048      data = {
     3049        id: $option.val(),
     3050        text: $option.text(),
     3051        disabled: $option.prop('disabled'),
     3052        selected: $option.prop('selected'),
     3053        title: $option.prop('title')
     3054      };
     3055    } else if ($option.is('optgroup')) {
     3056      data = {
     3057        text: $option.prop('label'),
     3058        children: [],
     3059        title: $option.prop('title')
     3060      };
     3061
     3062      var $children = $option.children('option');
     3063      var children = [];
     3064
     3065      for (var c = 0; c < $children.length; c++) {
     3066        var $child = $($children[c]);
     3067
     3068        var child = this.item($child);
     3069
     3070        children.push(child);
     3071      }
     3072
     3073      data.children = children;
     3074    }
     3075
     3076    data = this._normalizeItem(data);
     3077    data.element = $option[0];
     3078
     3079    $.data($option[0], 'data', data);
     3080
     3081    return data;
     3082  };
     3083
     3084  SelectAdapter.prototype._normalizeItem = function (item) {
     3085    if (!$.isPlainObject(item)) {
     3086      item = {
     3087        id: item,
     3088        text: item
     3089      };
     3090    }
     3091
     3092    item = $.extend({}, {
     3093      text: ''
     3094    }, item);
     3095
     3096    var defaults = {
     3097      selected: false,
     3098      disabled: false
     3099    };
     3100
     3101    if (item.id != null) {
     3102      item.id = item.id.toString();
     3103    }
     3104
     3105    if (item.text != null) {
     3106      item.text = item.text.toString();
     3107    }
     3108
     3109    if (item._resultId == null && item.id && this.container != null) {
     3110      item._resultId = this.generateResultId(this.container, item);
     3111    }
     3112
     3113    return $.extend({}, defaults, item);
     3114  };
     3115
     3116  SelectAdapter.prototype.matches = function (params, data) {
     3117    var matcher = this.options.get('matcher');
     3118
     3119    return matcher(params, data);
     3120  };
     3121
     3122  return SelectAdapter;
     3123});
     3124
     3125S2.define('select2/data/array',[
     3126  './select',
     3127  '../utils',
     3128  'jquery'
     3129], function (SelectAdapter, Utils, $) {
     3130  function ArrayAdapter ($element, options) {
     3131    var data = options.get('data') || [];
     3132
     3133    ArrayAdapter.__super__.constructor.call(this, $element, options);
     3134
     3135    this.addOptions(this.convertToOptions(data));
     3136  }
     3137
     3138  Utils.Extend(ArrayAdapter, SelectAdapter);
     3139
     3140  ArrayAdapter.prototype.select = function (data) {
     3141    var $option = this.$element.find('option').filter(function (i, elm) {
     3142      return elm.value == data.id.toString();
     3143    });
     3144
     3145    if ($option.length === 0) {
     3146      $option = this.option(data);
     3147
     3148      this.addOptions($option);
     3149    }
     3150
     3151    ArrayAdapter.__super__.select.call(this, data);
     3152  };
     3153
     3154  ArrayAdapter.prototype.convertToOptions = function (data) {
     3155    var self = this;
     3156
     3157    var $existing = this.$element.find('option');
     3158    var existingIds = $existing.map(function () {
     3159      return self.item($(this)).id;
     3160    }).get();
     3161
     3162    var $options = $();
     3163
     3164    // Filter out all items except for the one passed in the argument
     3165    function onlyItem (item) {
     3166      return function () {
     3167        return $(this).val() == item.id;
     3168      };
     3169    }
     3170
     3171    for (var d = 0; d < data.length; d++) {
     3172      var item = this._normalizeItem(data[d]);
     3173
     3174      // Skip items which were pre-loaded, only merge the data
     3175      if ($.inArray(item.id, existingIds) >= 0) {
     3176        var $existingOption = $existing.filter(onlyItem(item));
     3177
     3178        var existingData = this.item($existingOption);
     3179        var newData = $.extend(true, {}, existingData, item);
     3180
     3181        var $newOption = this.option(existingData);
     3182
     3183        $existingOption.replaceWith($newOption);
     3184
     3185        continue;
     3186      }
     3187
     3188      var $option = this.option(item);
     3189
     3190      if (item.children) {
     3191        var $children = this.convertToOptions(item.children);
     3192
     3193        $option.append($children);
     3194      }
     3195
     3196      $options = $options.add($option);
     3197    }
     3198
     3199    return $options;
     3200  };
     3201
     3202  return ArrayAdapter;
     3203});
     3204
     3205S2.define('select2/data/ajax',[
     3206  './array',
     3207  '../utils',
     3208  'jquery'
     3209], function (ArrayAdapter, Utils, $) {
     3210  function AjaxAdapter ($element, options) {
     3211    this.ajaxOptions = this._applyDefaults(options.get('ajax'));
     3212
     3213    if (this.ajaxOptions.processResults != null) {
     3214      this.processResults = this.ajaxOptions.processResults;
     3215    }
     3216
     3217    ArrayAdapter.__super__.constructor.call(this, $element, options);
     3218  }
     3219
     3220  Utils.Extend(AjaxAdapter, ArrayAdapter);
     3221
     3222  AjaxAdapter.prototype._applyDefaults = function (options) {
     3223    var defaults = {
     3224      data: function (params) {
     3225        return {
     3226          q: params.term
     3227        };
     3228      },
     3229      transport: function (params, success, failure) {
     3230        var $request = $.ajax(params);
     3231
     3232        $request.then(success);
     3233        $request.fail(failure);
     3234
     3235        return $request;
     3236      }
     3237    };
     3238
     3239    return $.extend({}, defaults, options, true);
     3240  };
     3241
     3242  AjaxAdapter.prototype.processResults = function (results) {
     3243    return results;
     3244  };
     3245
     3246  AjaxAdapter.prototype.query = function (params, callback) {
     3247    var matches = [];
     3248    var self = this;
     3249
     3250    if (this._request) {
     3251      this._request.abort();
     3252      this._request = null;
     3253    }
     3254
     3255    var options = $.extend({
     3256      type: 'GET'
     3257    }, this.ajaxOptions);
     3258
     3259    if (typeof options.url === 'function') {
     3260      options.url = options.url(params);
     3261    }
     3262
     3263    if (typeof options.data === 'function') {
     3264      options.data = options.data(params);
     3265    }
     3266
     3267    function request () {
     3268      var $request = options.transport(options, function (data) {
     3269        var results = self.processResults(data, params);
     3270
     3271        if (self.options.get('debug') && window.console && console.error) {
     3272          // Check to make sure that the response included a `results` key.
     3273          if (!results || !results.results || !$.isArray(results.results)) {
     3274            console.error(
     3275              'Select2: The AJAX results did not return an array in the ' +
     3276              '`results` key of the response.'
     3277            );
     3278          }
     3279        }
     3280
     3281        callback(results);
     3282      }, function () {
     3283        // TODO: Handle AJAX errors
     3284      });
     3285
     3286      self._request = $request;
     3287    }
     3288
     3289    if (this.ajaxOptions.delay && params.term !== '') {
     3290      if (this._queryTimeout) {
     3291        window.clearTimeout(this._queryTimeout);
     3292      }
     3293
     3294      this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
     3295    } else {
     3296      request();
     3297    }
     3298  };
     3299
     3300  return AjaxAdapter;
     3301});
     3302
     3303S2.define('select2/data/tags',[
     3304  'jquery'
     3305], function ($) {
     3306  function Tags (decorated, $element, options) {
     3307    var tags = options.get('tags');
     3308
     3309    var createTag = options.get('createTag');
     3310
     3311    if (createTag !== undefined) {
     3312      this.createTag = createTag;
     3313    }
     3314
     3315    decorated.call(this, $element, options);
     3316
     3317    if ($.isArray(tags)) {
     3318      for (var t = 0; t < tags.length; t++) {
     3319        var tag = tags[t];
     3320        var item = this._normalizeItem(tag);
     3321
     3322        var $option = this.option(item);
     3323
     3324        this.$element.append($option);
     3325      }
     3326    }
     3327  }
     3328
     3329  Tags.prototype.query = function (decorated, params, callback) {
     3330    var self = this;
     3331
     3332    this._removeOldTags();
     3333
     3334    if (params.term == null || params.page != null) {
     3335      decorated.call(this, params, callback);
     3336      return;
     3337    }
     3338
     3339    function wrapper (obj, child) {
     3340      var data = obj.results;
     3341
     3342      for (var i = 0; i < data.length; i++) {
     3343        var option = data[i];
     3344
     3345        var checkChildren = (
     3346          option.children != null &&
     3347          !wrapper({
     3348            results: option.children
     3349          }, true)
     3350        );
     3351
     3352        var checkText = option.text === params.term;
     3353
     3354        if (checkText || checkChildren) {
     3355          if (child) {
     3356            return false;
     3357          }
     3358
     3359          obj.data = data;
     3360          callback(obj);
     3361
     3362          return;
     3363        }
     3364      }
     3365
     3366      if (child) {
     3367        return true;
     3368      }
     3369
     3370      var tag = self.createTag(params);
     3371
     3372      if (tag != null) {
     3373        var $option = self.option(tag);
     3374        $option.attr('data-select2-tag', true);
     3375
     3376        self.addOptions($option);
     3377
     3378        self.insertTag(data, tag);
     3379      }
     3380
     3381      obj.results = data;
     3382
     3383      callback(obj);
     3384    }
     3385
     3386    decorated.call(this, params, wrapper);
     3387  };
     3388
     3389  Tags.prototype.createTag = function (decorated, params) {
     3390    var term = $.trim(params.term);
     3391
     3392    if (term === '') {
     3393      return null;
     3394    }
     3395
     3396    return {
     3397      id: term,
     3398      text: term
     3399    };
     3400  };
     3401
     3402  Tags.prototype.insertTag = function (_, data, tag) {
     3403    data.unshift(tag);
     3404  };
     3405
     3406  Tags.prototype._removeOldTags = function (_) {
     3407    var tag = this._lastTag;
     3408
     3409    var $options = this.$element.find('option[data-select2-tag]');
     3410
     3411    $options.each(function () {
     3412      if (this.selected) {
     3413        return;
     3414      }
     3415
     3416      $(this).remove();
     3417    });
     3418  };
     3419
     3420  return Tags;
     3421});
     3422
     3423S2.define('select2/data/tokenizer',[
     3424  'jquery'
     3425], function ($) {
     3426  function Tokenizer (decorated, $element, options) {
     3427    var tokenizer = options.get('tokenizer');
     3428
     3429    if (tokenizer !== undefined) {
     3430      this.tokenizer = tokenizer;
     3431    }
     3432
     3433    decorated.call(this, $element, options);
     3434  }
     3435
     3436  Tokenizer.prototype.bind = function (decorated, container, $container) {
     3437    decorated.call(this, container, $container);
     3438
     3439    this.$search =  container.dropdown.$search || container.selection.$search ||
     3440      $container.find('.select2-search__field');
     3441  };
     3442
     3443  Tokenizer.prototype.query = function (decorated, params, callback) {
     3444    var self = this;
     3445
     3446    function select (data) {
     3447      self.select(data);
     3448    }
     3449
     3450    params.term = params.term || '';
     3451
     3452    var tokenData = this.tokenizer(params, this.options, select);
     3453
     3454    if (tokenData.term !== params.term) {
     3455      // Replace the search term if we have the search box
     3456      if (this.$search.length) {
     3457        this.$search.val(tokenData.term);
     3458        this.$search.focus();
     3459      }
     3460
     3461      params.term = tokenData.term;
     3462    }
     3463
     3464    decorated.call(this, params, callback);
     3465  };
     3466
     3467  Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
     3468    var separators = options.get('tokenSeparators') || [];
     3469    var term = params.term;
     3470    var i = 0;
     3471
     3472    var createTag = this.createTag || function (params) {
     3473      return {
     3474        id: params.term,
     3475        text: params.term
     3476      };
     3477    };
     3478
     3479    while (i < term.length) {
     3480      var termChar = term[i];
     3481
     3482      if ($.inArray(termChar, separators) === -1) {
     3483        i++;
     3484
     3485        continue;
     3486      }
     3487
     3488      var part = term.substr(0, i);
     3489      var partParams = $.extend({}, params, {
     3490        term: part
     3491      });
     3492
     3493      var data = createTag(partParams);
     3494
     3495      callback(data);
     3496
     3497      // Reset the term to not include the tokenized portion
     3498      term = term.substr(i + 1) || '';
     3499      i = 0;
     3500    }
     3501
     3502    return {
     3503      term: term
     3504    };
     3505  };
     3506
     3507  return Tokenizer;
     3508});
     3509
     3510S2.define('select2/data/minimumInputLength',[
     3511
     3512], function () {
     3513  function MinimumInputLength (decorated, $e, options) {
     3514    this.minimumInputLength = options.get('minimumInputLength');
     3515
     3516    decorated.call(this, $e, options);
     3517  }
     3518
     3519  MinimumInputLength.prototype.query = function (decorated, params, callback) {
     3520    params.term = params.term || '';
     3521
     3522    if (params.term.length < this.minimumInputLength) {
     3523      this.trigger('results:message', {
     3524        message: 'inputTooShort',
     3525        args: {
     3526          minimum: this.minimumInputLength,
     3527          input: params.term,
     3528          params: params
     3529        }
     3530      });
     3531
     3532      return;
     3533    }
     3534
     3535    decorated.call(this, params, callback);
     3536  };
     3537
     3538  return MinimumInputLength;
     3539});
     3540
     3541S2.define('select2/data/maximumInputLength',[
     3542
     3543], function () {
     3544  function MaximumInputLength (decorated, $e, options) {
     3545    this.maximumInputLength = options.get('maximumInputLength');
     3546
     3547    decorated.call(this, $e, options);
     3548  }
     3549
     3550  MaximumInputLength.prototype.query = function (decorated, params, callback) {
     3551    params.term = params.term || '';
     3552
     3553    if (this.maximumInputLength > 0 &&
     3554        params.term.length > this.maximumInputLength) {
     3555      this.trigger('results:message', {
     3556        message: 'inputTooLong',
     3557        args: {
     3558          maximum: this.maximumInputLength,
     3559          input: params.term,
     3560          params: params
     3561        }
     3562      });
     3563
     3564      return;
     3565    }
     3566
     3567    decorated.call(this, params, callback);
     3568  };
     3569
     3570  return MaximumInputLength;
     3571});
     3572
     3573S2.define('select2/data/maximumSelectionLength',[
     3574
     3575], function (){
     3576  function MaximumSelectionLength (decorated, $e, options) {
     3577    this.maximumSelectionLength = options.get('maximumSelectionLength');
     3578
     3579    decorated.call(this, $e, options);
     3580  }
     3581
     3582  MaximumSelectionLength.prototype.query =
     3583    function (decorated, params, callback) {
     3584      var self = this;
     3585
     3586      this.current(function (currentData) {
     3587        var count = currentData != null ? currentData.length : 0;
     3588        if (self.maximumSelectionLength > 0 &&
     3589          count >= self.maximumSelectionLength) {
     3590          self.trigger('results:message', {
     3591            message: 'maximumSelected',
     3592            args: {
     3593              maximum: self.maximumSelectionLength
     3594            }
     3595          });
     3596          return;
     3597        }
     3598        decorated.call(self, params, callback);
     3599      });
     3600  };
     3601
     3602  return MaximumSelectionLength;
     3603});
     3604
     3605S2.define('select2/dropdown',[
     3606  'jquery',
     3607  './utils'
     3608], function ($, Utils) {
     3609  function Dropdown ($element, options) {
     3610    this.$element = $element;
     3611    this.options = options;
     3612
     3613    Dropdown.__super__.constructor.call(this);
     3614  }
     3615
     3616  Utils.Extend(Dropdown, Utils.Observable);
     3617
     3618  Dropdown.prototype.render = function () {
     3619    var $dropdown = $(
     3620      '<span class="select2-dropdown">' +
     3621        '<span class="select2-results"></span>' +
     3622      '</span>'
     3623    );
     3624
     3625    $dropdown.attr('dir', this.options.get('dir'));
     3626
     3627    this.$dropdown = $dropdown;
     3628
     3629    return $dropdown;
     3630  };
     3631
     3632  Dropdown.prototype.position = function ($dropdown, $container) {
     3633    // Should be implmented in subclasses
     3634  };
     3635
     3636  Dropdown.prototype.destroy = function () {
     3637    // Remove the dropdown from the DOM
     3638    this.$dropdown.remove();
     3639  };
     3640
     3641  return Dropdown;
     3642});
     3643
     3644S2.define('select2/dropdown/search',[
     3645  'jquery',
     3646  '../utils'
     3647], function ($, Utils) {
     3648  function Search () { }
     3649
     3650  Search.prototype.render = function (decorated) {
     3651    var $rendered = decorated.call(this);
     3652
     3653    var $search = $(
     3654      '<span class="select2-search select2-search--dropdown">' +
     3655        '<input class="select2-search__field" type="search" tabindex="-1"' +
     3656        ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
     3657        ' spellcheck="false" role="textbox" />' +
     3658      '</span>'
     3659    );
     3660
     3661    this.$searchContainer = $search;
     3662    this.$search = $search.find('input');
     3663
     3664    $rendered.prepend($search);
     3665
     3666    return $rendered;
     3667  };
     3668
     3669  Search.prototype.bind = function (decorated, container, $container) {
     3670    var self = this;
     3671
     3672    decorated.call(this, container, $container);
     3673
     3674    this.$search.on('keydown', function (evt) {
     3675      self.trigger('keypress', evt);
     3676
     3677      self._keyUpPrevented = evt.isDefaultPrevented();
     3678    });
     3679
     3680    // Workaround for browsers which do not support the `input` event
     3681    // This will prevent double-triggering of events for browsers which support
     3682    // both the `keyup` and `input` events.
     3683    this.$search.on('input', function (evt) {
     3684      // Unbind the duplicated `keyup` event
     3685      $(this).off('keyup');
     3686    });
     3687
     3688    this.$search.on('keyup input', function (evt) {
     3689      self.handleSearch(evt);
     3690    });
     3691
     3692    container.on('open', function () {
     3693      self.$search.attr('tabindex', 0);
     3694
     3695      self.$search.focus();
     3696
     3697      window.setTimeout(function () {
     3698        self.$search.focus();
     3699      }, 0);
     3700    });
     3701
     3702    container.on('close', function () {
     3703      self.$search.attr('tabindex', -1);
     3704
     3705      self.$search.val('');
     3706    });
     3707
     3708    container.on('results:all', function (params) {
     3709      if (params.query.term == null || params.query.term === '') {
     3710        var showSearch = self.showSearch(params);
     3711
     3712        if (showSearch) {
     3713          self.$searchContainer.removeClass('select2-search--hide');
     3714        } else {
     3715          self.$searchContainer.addClass('select2-search--hide');
     3716        }
     3717      }
     3718    });
     3719  };
     3720
     3721  Search.prototype.handleSearch = function (evt) {
     3722    if (!this._keyUpPrevented) {
     3723      var input = this.$search.val();
     3724
     3725      this.trigger('query', {
     3726        term: input
     3727      });
     3728    }
     3729
     3730    this._keyUpPrevented = false;
     3731  };
     3732
     3733  Search.prototype.showSearch = function (_, params) {
     3734    return true;
     3735  };
     3736
     3737  return Search;
     3738});
     3739
     3740S2.define('select2/dropdown/hidePlaceholder',[
     3741
     3742], function () {
     3743  function HidePlaceholder (decorated, $element, options, dataAdapter) {
     3744    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
     3745
     3746    decorated.call(this, $element, options, dataAdapter);
     3747  }
     3748
     3749  HidePlaceholder.prototype.append = function (decorated, data) {
     3750    data.results = this.removePlaceholder(data.results);
     3751
     3752    decorated.call(this, data);
     3753  };
     3754
     3755  HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
     3756    if (typeof placeholder === 'string') {
     3757      placeholder = {
     3758        id: '',
     3759        text: placeholder
     3760      };
     3761    }
     3762
     3763    return placeholder;
     3764  };
     3765
     3766  HidePlaceholder.prototype.removePlaceholder = function (_, data) {
     3767    var modifiedData = data.slice(0);
     3768
     3769    for (var d = data.length - 1; d >= 0; d--) {
     3770      var item = data[d];
     3771
     3772      if (this.placeholder.id === item.id) {
     3773        modifiedData.splice(d, 1);
     3774      }
     3775    }
     3776
     3777    return modifiedData;
     3778  };
     3779
     3780  return HidePlaceholder;
     3781});
     3782
     3783S2.define('select2/dropdown/infiniteScroll',[
     3784  'jquery'
     3785], function ($) {
     3786  function InfiniteScroll (decorated, $element, options, dataAdapter) {
     3787    this.lastParams = {};
     3788
     3789    decorated.call(this, $element, options, dataAdapter);
     3790
     3791    this.$loadingMore = this.createLoadingMore();
     3792    this.loading = false;
     3793  }
     3794
     3795  InfiniteScroll.prototype.append = function (decorated, data) {
     3796    this.$loadingMore.remove();
     3797    this.loading = false;
     3798
     3799    decorated.call(this, data);
     3800
     3801    if (this.showLoadingMore(data)) {
     3802      this.$results.append(this.$loadingMore);
     3803    }
     3804  };
     3805
     3806  InfiniteScroll.prototype.bind = function (decorated, container, $container) {
     3807    var self = this;
     3808
     3809    decorated.call(this, container, $container);
     3810
     3811    container.on('query', function (params) {
     3812      self.lastParams = params;
     3813      self.loading = true;
     3814    });
     3815
     3816    container.on('query:append', function (params) {
     3817      self.lastParams = params;
     3818      self.loading = true;
     3819    });
     3820
     3821    this.$results.on('scroll', function () {
     3822      var isLoadMoreVisible = $.contains(
     3823        document.documentElement,
     3824        self.$loadingMore[0]
     3825      );
     3826
     3827      if (self.loading || !isLoadMoreVisible) {
     3828        return;
     3829      }
     3830
     3831      var currentOffset = self.$results.offset().top +
     3832        self.$results.outerHeight(false);
     3833      var loadingMoreOffset = self.$loadingMore.offset().top +
     3834        self.$loadingMore.outerHeight(false);
     3835
     3836      if (currentOffset + 50 >= loadingMoreOffset) {
     3837        self.loadMore();
     3838      }
     3839    });
     3840  };
     3841
     3842  InfiniteScroll.prototype.loadMore = function () {
     3843    this.loading = true;
     3844
     3845    var params = $.extend({}, {page: 1}, this.lastParams);
     3846
     3847    params.page++;
     3848
     3849    this.trigger('query:append', params);
     3850  };
     3851
     3852  InfiniteScroll.prototype.showLoadingMore = function (_, data) {
     3853    return data.pagination && data.pagination.more;
     3854  };
     3855
     3856  InfiniteScroll.prototype.createLoadingMore = function () {
     3857    var $option = $(
     3858      '<li class="option load-more" role="treeitem"></li>'
     3859    );
     3860
     3861    var message = this.options.get('translations').get('loadingMore');
     3862
     3863    $option.html(message(this.lastParams));
     3864
     3865    return $option;
     3866  };
     3867
     3868  return InfiniteScroll;
     3869});
     3870
     3871S2.define('select2/dropdown/attachBody',[
     3872  'jquery',
     3873  '../utils'
     3874], function ($, Utils) {
     3875  function AttachBody (decorated, $element, options) {
     3876    this.$dropdownParent = options.get('dropdownParent') || document.body;
     3877
     3878    decorated.call(this, $element, options);
     3879  }
     3880
     3881  AttachBody.prototype.bind = function (decorated, container, $container) {
     3882    var self = this;
     3883
     3884    var setupResultsEvents = false;
     3885
     3886    decorated.call(this, container, $container);
     3887
     3888    container.on('open', function () {
     3889      self._showDropdown();
     3890      self._attachPositioningHandler(container);
     3891
     3892      if (!setupResultsEvents) {
     3893        setupResultsEvents = true;
     3894
     3895        container.on('results:all', function () {
     3896          self._positionDropdown();
     3897          self._resizeDropdown();
     3898        });
     3899
     3900        container.on('results:append', function () {
     3901          self._positionDropdown();
     3902          self._resizeDropdown();
     3903        });
     3904      }
     3905    });
     3906
     3907    container.on('close', function () {
     3908      self._hideDropdown();
     3909      self._detachPositioningHandler(container);
     3910    });
     3911
     3912    this.$dropdownContainer.on('mousedown', function (evt) {
     3913      evt.stopPropagation();
     3914    });
     3915  };
     3916
     3917  AttachBody.prototype.position = function (decorated, $dropdown, $container) {
     3918    // Clone all of the container classes
     3919    $dropdown.attr('class', $container.attr('class'));
     3920
     3921    $dropdown.removeClass('select2');
     3922    $dropdown.addClass('select2-container--open');
     3923
     3924    $dropdown.css({
     3925      position: 'absolute',
     3926      top: -999999
     3927    });
     3928
     3929    this.$container = $container;
     3930  };
     3931
     3932  AttachBody.prototype.render = function (decorated) {
     3933    var $container = $('<span></span>');
     3934
     3935    var $dropdown = decorated.call(this);
     3936    $container.append($dropdown);
     3937
     3938    this.$dropdownContainer = $container;
     3939
     3940    return $container;
     3941  };
     3942
     3943  AttachBody.prototype._hideDropdown = function (decorated) {
     3944    this.$dropdownContainer.detach();
     3945  };
     3946
     3947  AttachBody.prototype._attachPositioningHandler = function (container) {
     3948    var self = this;
     3949
     3950    var scrollEvent = 'scroll.select2.' + container.id;
     3951    var resizeEvent = 'resize.select2.' + container.id;
     3952    var orientationEvent = 'orientationchange.select2.' + container.id;
     3953
     3954    var $watchers = this.$container.parents().filter(Utils.hasScroll);
     3955    $watchers.each(function () {
     3956      $(this).data('select2-scroll-position', {
     3957        x: $(this).scrollLeft(),
     3958        y: $(this).scrollTop()
     3959      });
     3960    });
     3961
     3962    $watchers.on(scrollEvent, function (ev) {
     3963      var position = $(this).data('select2-scroll-position');
     3964      $(this).scrollTop(position.y);
     3965    });
     3966
     3967    $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
     3968      function (e) {
     3969      self._positionDropdown();
     3970      self._resizeDropdown();
     3971    });
     3972  };
     3973
     3974  AttachBody.prototype._detachPositioningHandler = function (container) {
     3975    var scrollEvent = 'scroll.select2.' + container.id;
     3976    var resizeEvent = 'resize.select2.' + container.id;
     3977    var orientationEvent = 'orientationchange.select2.' + container.id;
     3978
     3979    var $watchers = this.$container.parents().filter(Utils.hasScroll);
     3980    $watchers.off(scrollEvent);
     3981
     3982    $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
     3983  };
     3984
     3985  AttachBody.prototype._positionDropdown = function () {
     3986    var $window = $(window);
     3987
     3988    var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
     3989    var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
     3990
     3991    var newDirection = null;
     3992
     3993    var position = this.$container.position();
     3994    var offset = this.$container.offset();
     3995
     3996    offset.bottom = offset.top + this.$container.outerHeight(false);
     3997
     3998    var container = {
     3999      height: this.$container.outerHeight(false)
     4000    };
     4001
     4002    container.top = offset.top;
     4003    container.bottom = offset.top + container.height;
     4004
     4005    var dropdown = {
     4006      height: this.$dropdown.outerHeight(false)
     4007    };
     4008
     4009    var viewport = {
     4010      top: $window.scrollTop(),
     4011      bottom: $window.scrollTop() + $window.height()
     4012    };
     4013
     4014    var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
     4015    var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
     4016
     4017    var css = {
     4018      left: offset.left,
     4019      top: container.bottom
     4020    };
     4021
     4022    if (!isCurrentlyAbove && !isCurrentlyBelow) {
     4023      newDirection = 'below';
     4024    }
     4025
     4026    if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
     4027      newDirection = 'above';
     4028    } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
     4029      newDirection = 'below';
     4030    }
     4031
     4032    if (newDirection == 'above' ||
     4033      (isCurrentlyAbove && newDirection !== 'below')) {
     4034      css.top = container.top - dropdown.height;
     4035    }
     4036
     4037    if (newDirection != null) {
     4038      this.$dropdown
     4039        .removeClass('select2-dropdown--below select2-dropdown--above')
     4040        .addClass('select2-dropdown--' + newDirection);
     4041      this.$container
     4042        .removeClass('select2-container--below select2-container--above')
     4043        .addClass('select2-container--' + newDirection);
     4044    }
     4045
     4046    this.$dropdownContainer.css(css);
     4047  };
     4048
     4049  AttachBody.prototype._resizeDropdown = function () {
     4050    this.$dropdownContainer.width();
     4051
     4052    this.$dropdown.css({
     4053      width: this.$container.outerWidth(false) + 'px'
     4054    });
     4055  };
     4056
     4057  AttachBody.prototype._showDropdown = function (decorated) {
     4058    this.$dropdownContainer.appendTo(this.$dropdownParent);
     4059
     4060    this._positionDropdown();
     4061    this._resizeDropdown();
     4062  };
     4063
     4064  return AttachBody;
     4065});
     4066
     4067S2.define('select2/dropdown/minimumResultsForSearch',[
     4068
     4069], function () {
     4070  function countResults (data) {
     4071    var count = 0;
     4072
     4073    for (var d = 0; d < data.length; d++) {
     4074      var item = data[d];
     4075
     4076      if (item.children) {
     4077        count += countResults(item.children);
     4078      } else {
     4079        count++;
     4080      }
     4081    }
     4082
     4083    return count;
     4084  }
     4085
     4086  function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
     4087    this.minimumResultsForSearch = options.get('minimumResultsForSearch');
     4088
     4089    if (this.minimumResultsForSearch < 0) {
     4090      this.minimumResultsForSearch = Infinity;
     4091    }
     4092
     4093    decorated.call(this, $element, options, dataAdapter);
     4094  }
     4095
     4096  MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
     4097    if (countResults(params.data.results) < this.minimumResultsForSearch) {
     4098      return false;
     4099    }
     4100
     4101    return decorated.call(this, params);
     4102  };
     4103
     4104  return MinimumResultsForSearch;
     4105});
     4106
     4107S2.define('select2/dropdown/selectOnClose',[
     4108
     4109], function () {
     4110  function SelectOnClose () { }
     4111
     4112  SelectOnClose.prototype.bind = function (decorated, container, $container) {
     4113    var self = this;
     4114
     4115    decorated.call(this, container, $container);
     4116
     4117    container.on('close', function () {
     4118      self._handleSelectOnClose();
     4119    });
     4120  };
     4121
     4122  SelectOnClose.prototype._handleSelectOnClose = function () {
     4123    var $highlightedResults = this.getHighlightedResults();
     4124
     4125    if ($highlightedResults.length < 1) {
     4126      return;
     4127    }
     4128
     4129    $highlightedResults.trigger('mouseup');
     4130  };
     4131
     4132  return SelectOnClose;
     4133});
     4134
     4135S2.define('select2/dropdown/closeOnSelect',[
     4136
     4137], function () {
     4138  function CloseOnSelect () { }
     4139
     4140  CloseOnSelect.prototype.bind = function (decorated, container, $container) {
     4141    var self = this;
     4142
     4143    decorated.call(this, container, $container);
     4144
     4145    container.on('select', function (evt) {
     4146      self._selectTriggered(evt);
     4147    });
     4148
     4149    container.on('unselect', function (evt) {
     4150      self._selectTriggered(evt);
     4151    });
     4152  };
     4153
     4154  CloseOnSelect.prototype._selectTriggered = function (_, evt) {
     4155    var originalEvent = evt.originalEvent;
     4156
     4157    // Don't close if the control key is being held
     4158    if (originalEvent && originalEvent.ctrlKey) {
     4159      return;
     4160    }
     4161
     4162    this.trigger('close');
     4163  };
     4164
     4165  return CloseOnSelect;
     4166});
     4167
     4168S2.define('select2/i18n/en',[],function () {
     4169  // English
     4170  return {
     4171    errorLoading: function () {
     4172      return 'The results could not be loaded.';
     4173    },
     4174    inputTooLong: function (args) {
     4175      var overChars = args.input.length - args.maximum;
     4176
     4177      var message = 'Please delete ' + overChars + ' character';
     4178
     4179      if (overChars != 1) {
     4180        message += 's';
     4181      }
     4182
     4183      return message;
     4184    },
     4185    inputTooShort: function (args) {
     4186      var remainingChars = args.minimum - args.input.length;
     4187
     4188      var message = 'Please enter ' + remainingChars + ' or more characters';
     4189
     4190      return message;
     4191    },
     4192    loadingMore: function () {
     4193      return 'Loading more results…';
     4194    },
     4195    maximumSelected: function (args) {
     4196      var message = 'You can only select ' + args.maximum + ' item';
     4197
     4198      if (args.maximum != 1) {
     4199        message += 's';
     4200      }
     4201
     4202      return message;
     4203    },
     4204    noResults: function () {
     4205      return 'No results found';
     4206    },
     4207    searching: function () {
     4208      return 'Searching…';
     4209    }
     4210  };
     4211});
     4212
     4213S2.define('select2/defaults',[
     4214  'jquery',
     4215  'require',
     4216
     4217  './results',
     4218
     4219  './selection/single',
     4220  './selection/multiple',
     4221  './selection/placeholder',
     4222  './selection/allowClear',
     4223  './selection/search',
     4224  './selection/eventRelay',
     4225
     4226  './utils',
     4227  './translation',
     4228  './diacritics',
     4229
     4230  './data/select',
     4231  './data/array',
     4232  './data/ajax',
     4233  './data/tags',
     4234  './data/tokenizer',
     4235  './data/minimumInputLength',
     4236  './data/maximumInputLength',
     4237  './data/maximumSelectionLength',
     4238
     4239  './dropdown',
     4240  './dropdown/search',
     4241  './dropdown/hidePlaceholder',
     4242  './dropdown/infiniteScroll',
     4243  './dropdown/attachBody',
     4244  './dropdown/minimumResultsForSearch',
     4245  './dropdown/selectOnClose',
     4246  './dropdown/closeOnSelect',
     4247
     4248  './i18n/en'
     4249], function ($, require,
     4250
     4251             ResultsList,
     4252
     4253             SingleSelection, MultipleSelection, Placeholder, AllowClear,
     4254             SelectionSearch, EventRelay,
     4255
     4256             Utils, Translation, DIACRITICS,
     4257
     4258             SelectData, ArrayData, AjaxData, Tags, Tokenizer,
     4259             MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
     4260
     4261             Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
     4262             AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
     4263
     4264             EnglishTranslation) {
     4265  function Defaults () {
     4266    this.reset();
     4267  }
     4268
     4269  Defaults.prototype.apply = function (options) {
     4270    options = $.extend({}, this.defaults, options);
     4271
     4272    if (options.dataAdapter == null) {
     4273      if (options.ajax != null) {
     4274        options.dataAdapter = AjaxData;
     4275      } else if (options.data != null) {
     4276        options.dataAdapter = ArrayData;
     4277      } else {
     4278        options.dataAdapter = SelectData;
     4279      }
     4280
     4281      if (options.minimumInputLength > 0) {
     4282        options.dataAdapter = Utils.Decorate(
     4283          options.dataAdapter,
     4284          MinimumInputLength
     4285        );
     4286      }
     4287
     4288      if (options.maximumInputLength > 0) {
     4289        options.dataAdapter = Utils.Decorate(
     4290          options.dataAdapter,
     4291          MaximumInputLength
     4292        );
     4293      }
     4294
     4295      if (options.maximumSelectionLength > 0) {
     4296        options.dataAdapter = Utils.Decorate(
     4297          options.dataAdapter,
     4298          MaximumSelectionLength
     4299        );
     4300      }
     4301
     4302      if (options.tags) {
     4303        options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
     4304      }
     4305
     4306      if (options.tokenSeparators != null || options.tokenizer != null) {
     4307        options.dataAdapter = Utils.Decorate(
     4308          options.dataAdapter,
     4309          Tokenizer
     4310        );
     4311      }
     4312
     4313      if (options.query != null) {
     4314        var Query = require(options.amdBase + 'compat/query');
     4315
     4316        options.dataAdapter = Utils.Decorate(
     4317          options.dataAdapter,
     4318          Query
     4319        );
     4320      }
     4321
     4322      if (options.initSelection != null) {
     4323        var InitSelection = require(options.amdBase + 'compat/initSelection');
     4324
     4325        options.dataAdapter = Utils.Decorate(
     4326          options.dataAdapter,
     4327          InitSelection
     4328        );
     4329      }
     4330    }
     4331
     4332    if (options.resultsAdapter == null) {
     4333      options.resultsAdapter = ResultsList;
     4334
     4335      if (options.ajax != null) {
     4336        options.resultsAdapter = Utils.Decorate(
     4337          options.resultsAdapter,
     4338          InfiniteScroll
     4339        );
     4340      }
     4341
     4342      if (options.placeholder != null) {
     4343        options.resultsAdapter = Utils.Decorate(
     4344          options.resultsAdapter,
     4345          HidePlaceholder
     4346        );
     4347      }
     4348
     4349      if (options.selectOnClose) {
     4350        options.resultsAdapter = Utils.Decorate(
     4351          options.resultsAdapter,
     4352          SelectOnClose
     4353        );
     4354      }
     4355    }
     4356
     4357    if (options.dropdownAdapter == null) {
     4358      if (options.multiple) {
     4359        options.dropdownAdapter = Dropdown;
     4360      } else {
     4361        var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
     4362
     4363        options.dropdownAdapter = SearchableDropdown;
     4364      }
     4365
     4366      if (options.minimumResultsForSearch !== 0) {
     4367        options.dropdownAdapter = Utils.Decorate(
     4368          options.dropdownAdapter,
     4369          MinimumResultsForSearch
     4370        );
     4371      }
     4372
     4373      if (options.closeOnSelect) {
     4374        options.dropdownAdapter = Utils.Decorate(
     4375          options.dropdownAdapter,
     4376          CloseOnSelect
     4377        );
     4378      }
     4379
     4380      options.dropdownAdapter = Utils.Decorate(
     4381        options.dropdownAdapter,
     4382        AttachBody
     4383      );
     4384    }
     4385
     4386    if (options.selectionAdapter == null) {
     4387      if (options.multiple) {
     4388        options.selectionAdapter = MultipleSelection;
     4389      } else {
     4390        options.selectionAdapter = SingleSelection;
     4391      }
     4392
     4393      // Add the placeholder mixin if a placeholder was specified
     4394      if (options.placeholder != null) {
     4395        options.selectionAdapter = Utils.Decorate(
     4396          options.selectionAdapter,
     4397          Placeholder
     4398        );
     4399      }
     4400
     4401      if (options.allowClear) {
     4402        options.selectionAdapter = Utils.Decorate(
     4403          options.selectionAdapter,
     4404          AllowClear
     4405        );
     4406      }
     4407
     4408      if (options.multiple) {
     4409        options.selectionAdapter = Utils.Decorate(
     4410          options.selectionAdapter,
     4411          SelectionSearch
     4412        );
     4413      }
     4414
     4415      options.selectionAdapter = Utils.Decorate(
     4416        options.selectionAdapter,
     4417        EventRelay
     4418      );
     4419    }
     4420
     4421    if (typeof options.language === 'string') {
     4422      // Check if the language is specified with a region
     4423      if (options.language.indexOf('-') > 0) {
     4424        // Extract the region information if it is included
     4425        var languageParts = options.language.split('-');
     4426        var baseLanguage = languageParts[0];
     4427
     4428        options.language = [options.language, baseLanguage];
     4429      } else {
     4430        options.language = [options.language];
     4431      }
     4432    }
     4433
     4434    if ($.isArray(options.language)) {
     4435      var languages = new Translation();
     4436      options.language.push('en');
     4437
     4438      var languageNames = options.language;
     4439
     4440      for (var l = 0; l < languageNames.length; l++) {
     4441        var name = languageNames[l];
     4442        var language = {};
     4443
     4444        try {
     4445          // Try to load it with the original name
     4446          language = Translation.loadPath(name);
     4447        } catch (e) {
     4448          try {
     4449            // If we couldn't load it, check if it wasn't the full path
     4450            name = this.defaults.amdLanguageBase + name;
     4451            language = Translation.loadPath(name);
     4452          } catch (ex) {
     4453            // The translation could not be loaded at all. Sometimes this is
     4454            // because of a configuration problem, other times this can be
     4455            // because of how Select2 helps load all possible translation files.
     4456            if (options.debug && window.console && console.warn) {
     4457              console.warn(
     4458                'Select2: The language file for "' + name + '" could not be ' +
     4459                'automatically loaded. A fallback will be used instead.'
     4460              );
     4461            }
     4462
     4463            continue;
     4464          }
     4465        }
     4466
     4467        languages.extend(language);
     4468      }
     4469
     4470      options.translations = languages;
     4471    } else {
     4472      options.translations = new Translation(options.language);
     4473    }
     4474
     4475    return options;
     4476  };
     4477
     4478  Defaults.prototype.reset = function () {
     4479    function stripDiacritics (text) {
     4480      // Used 'uni range + named function' from http://jsperf.com/diacritics/18
     4481      function match(a) {
     4482        return DIACRITICS[a] || a;
     4483      }
     4484
     4485      return text.replace(/[^\u0000-\u007E]/g, match);
     4486    }
     4487
     4488    function matcher (params, data) {
     4489      // Always return the object if there is nothing to compare
     4490      if ($.trim(params.term) === '') {
     4491        return data;
     4492      }
     4493
     4494      // Do a recursive check for options with children
     4495      if (data.children && data.children.length > 0) {
     4496        // Clone the data object if there are children
     4497        // This is required as we modify the object to remove any non-matches
     4498        var match = $.extend(true, {}, data);
     4499
     4500        // Check each child of the option
     4501        for (var c = data.children.length - 1; c >= 0; c--) {
     4502          var child = data.children[c];
     4503
     4504          var matches = matcher(params, child);
     4505
     4506          // If there wasn't a match, remove the object in the array
     4507          if (matches == null) {
     4508            match.children.splice(c, 1);
     4509          }
     4510        }
     4511
     4512        // If any children matched, return the new object
     4513        if (match.children.length > 0) {
     4514          return match;
     4515        }
     4516
     4517        // If there were no matching children, check just the plain object
     4518        return matcher(params, match);
     4519      }
     4520
     4521      var original = stripDiacritics(data.text).toUpperCase();
     4522      var term = stripDiacritics(params.term).toUpperCase();
     4523
     4524      // Check if the text contains the term
     4525      if (original.indexOf(term) > -1) {
     4526        return data;
     4527      }
     4528
     4529      // If it doesn't contain the term, don't return anything
     4530      return null;
     4531    }
     4532
     4533    this.defaults = {
     4534      amdBase: './',
     4535      amdLanguageBase: './i18n/',
     4536      closeOnSelect: true,
     4537      debug: false,
     4538      escapeMarkup: Utils.escapeMarkup,
     4539      language: EnglishTranslation,
     4540      matcher: matcher,
     4541      minimumInputLength: 0,
     4542      maximumInputLength: 0,
     4543      maximumSelectionLength: 0,
     4544      minimumResultsForSearch: 0,
     4545      selectOnClose: false,
     4546      sorter: function (data) {
     4547        return data;
     4548      },
     4549      templateResult: function (result) {
     4550        return result.text;
     4551      },
     4552      templateSelection: function (selection) {
     4553        return selection.text;
     4554      },
     4555      theme: 'default',
     4556      width: 'resolve'
     4557    };
     4558  };
     4559
     4560  Defaults.prototype.set = function (key, value) {
     4561    var camelKey = $.camelCase(key);
     4562
     4563    var data = {};
     4564    data[camelKey] = value;
     4565
     4566    var convertedData = Utils._convertData(data);
     4567
     4568    $.extend(this.defaults, convertedData);
     4569  };
     4570
     4571  var defaults = new Defaults();
     4572
     4573  return defaults;
     4574});
     4575
     4576S2.define('select2/options',[
     4577  'jquery',
     4578  './defaults',
     4579  './utils'
     4580], function ($, Defaults, Utils) {
     4581  function Options (options, $element) {
     4582    this.options = options;
     4583
     4584    if ($element != null) {
     4585      this.fromElement($element);
     4586    }
     4587
     4588    this.options = Defaults.apply(this.options);
     4589
     4590    if ($element && $element.is('input')) {
     4591      var InputCompat = require(this.get('amdBase') + 'compat/inputData');
     4592
     4593      this.options.dataAdapter = Utils.Decorate(
     4594        this.options.dataAdapter,
     4595        InputCompat
     4596      );
     4597    }
     4598  }
     4599
     4600  Options.prototype.fromElement = function ($e) {
     4601    var excludedData = ['select2'];
     4602
     4603    if (this.options.multiple == null) {
     4604      this.options.multiple = $e.prop('multiple');
     4605    }
     4606
     4607    if (this.options.disabled == null) {
     4608      this.options.disabled = $e.prop('disabled');
     4609    }
     4610
     4611    if (this.options.language == null) {
     4612      if ($e.prop('lang')) {
     4613        this.options.language = $e.prop('lang').toLowerCase();
     4614      } else if ($e.closest('[lang]').prop('lang')) {
     4615        this.options.language = $e.closest('[lang]').prop('lang');
     4616      }
     4617    }
     4618
     4619    if (this.options.dir == null) {
     4620      if ($e.prop('dir')) {
     4621        this.options.dir = $e.prop('dir');
     4622      } else if ($e.closest('[dir]').prop('dir')) {
     4623        this.options.dir = $e.closest('[dir]').prop('dir');
     4624      } else {
     4625        this.options.dir = 'ltr';
     4626      }
     4627    }
     4628
     4629    $e.prop('disabled', this.options.disabled);
     4630    $e.prop('multiple', this.options.multiple);
     4631
     4632    if ($e.data('select2Tags')) {
     4633      if (this.options.debug && window.console && console.warn) {
     4634        console.warn(
     4635          'Select2: The `data-select2-tags` attribute has been changed to ' +
     4636          'use the `data-data` and `data-tags="true"` attributes and will be ' +
     4637          'removed in future versions of Select2.'
     4638        );
     4639      }
     4640
     4641      $e.data('data', $e.data('select2Tags'));
     4642      $e.data('tags', true);
     4643    }
     4644
     4645    if ($e.data('ajaxUrl')) {
     4646      if (this.options.debug && window.console && console.warn) {
     4647        console.warn(
     4648          'Select2: The `data-ajax-url` attribute has been changed to ' +
     4649          '`data-ajax--url` and support for the old attribute will be removed' +
     4650          ' in future versions of Select2.'
     4651        );
     4652      }
     4653
     4654      $e.attr('ajax--url', $e.data('ajaxUrl'));
     4655      $e.data('ajax--url', $e.data('ajaxUrl'));
     4656    }
     4657
     4658    var dataset = {};
     4659
     4660    // Prefer the element's `dataset` attribute if it exists
     4661    // jQuery 1.x does not correctly handle data attributes with multiple dashes
     4662    if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
     4663      dataset = $.extend(true, {}, $e[0].dataset, $e.data());
     4664    } else {
     4665      dataset = $e.data();
     4666    }
     4667
     4668    var data = $.extend(true, {}, dataset);
     4669
     4670    data = Utils._convertData(data);
     4671
     4672    for (var key in data) {
     4673      if ($.inArray(key, excludedData) > -1) {
     4674        continue;
     4675      }
     4676
     4677      if ($.isPlainObject(this.options[key])) {
     4678        $.extend(this.options[key], data[key]);
     4679      } else {
     4680        this.options[key] = data[key];
     4681      }
     4682    }
     4683
     4684    return this;
     4685  };
     4686
     4687  Options.prototype.get = function (key) {
     4688    return this.options[key];
     4689  };
     4690
     4691  Options.prototype.set = function (key, val) {
     4692    this.options[key] = val;
     4693  };
     4694
     4695  return Options;
     4696});
     4697
     4698S2.define('select2/core',[
     4699  'jquery',
     4700  './options',
     4701  './utils',
     4702  './keys'
     4703], function ($, Options, Utils, KEYS) {
     4704  var Select2 = function ($element, options) {
     4705    if ($element.data('select2') != null) {
     4706      $element.data('select2').destroy();
     4707    }
     4708
     4709    this.$element = $element;
     4710
     4711    this.id = this._generateId($element);
     4712
     4713    options = options || {};
     4714
     4715    this.options = new Options(options, $element);
     4716
     4717    Select2.__super__.constructor.call(this);
     4718
     4719    // Set up the tabindex
     4720
     4721    var tabindex = $element.attr('tabindex') || 0;
     4722    $element.data('old-tabindex', tabindex);
     4723    $element.attr('tabindex', '-1');
     4724
     4725    // Set up containers and adapters
     4726
     4727    var DataAdapter = this.options.get('dataAdapter');
     4728    this.dataAdapter = new DataAdapter($element, this.options);
     4729
     4730    var $container = this.render();
     4731
     4732    this._placeContainer($container);
     4733
     4734    var SelectionAdapter = this.options.get('selectionAdapter');
     4735    this.selection = new SelectionAdapter($element, this.options);
     4736    this.$selection = this.selection.render();
     4737
     4738    this.selection.position(this.$selection, $container);
     4739
     4740    var DropdownAdapter = this.options.get('dropdownAdapter');
     4741    this.dropdown = new DropdownAdapter($element, this.options);
     4742    this.$dropdown = this.dropdown.render();
     4743
     4744    this.dropdown.position(this.$dropdown, $container);
     4745
     4746    var ResultsAdapter = this.options.get('resultsAdapter');
     4747    this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
     4748    this.$results = this.results.render();
     4749
     4750    this.results.position(this.$results, this.$dropdown);
     4751
     4752    // Bind events
     4753
     4754    var self = this;
     4755
     4756    // Bind the container to all of the adapters
     4757    this._bindAdapters();
     4758
     4759    // Register any DOM event handlers
     4760    this._registerDomEvents();
     4761
     4762    // Register any internal event handlers
     4763    this._registerDataEvents();
     4764    this._registerSelectionEvents();
     4765    this._registerDropdownEvents();
     4766    this._registerResultsEvents();
     4767    this._registerEvents();
     4768
     4769    // Set the initial state
     4770    this.dataAdapter.current(function (initialData) {
     4771      self.trigger('selection:update', {
     4772        data: initialData
     4773      });
     4774    });
     4775
     4776    // Hide the original select
     4777    $element.hide();
     4778
     4779    // Synchronize any monitored attributes
     4780    this._syncAttributes();
     4781
     4782    $element.data('select2', this);
     4783  };
     4784
     4785  Utils.Extend(Select2, Utils.Observable);
     4786
     4787  Select2.prototype._generateId = function ($element) {
     4788    var id = '';
     4789
     4790    if ($element.attr('id') != null) {
     4791      id = $element.attr('id');
     4792    } else if ($element.attr('name') != null) {
     4793      id = $element.attr('name') + '-' + Utils.generateChars(2);
     4794    } else {
     4795      id = Utils.generateChars(4);
     4796    }
     4797
     4798    id = 'select2-' + id;
     4799
     4800    return id;
     4801  };
     4802
     4803  Select2.prototype._placeContainer = function ($container) {
     4804    $container.insertAfter(this.$element);
     4805
     4806    var width = this._resolveWidth(this.$element, this.options.get('width'));
     4807
     4808    if (width != null) {
     4809      $container.css('width', width);
     4810    }
     4811  };
     4812
     4813  Select2.prototype._resolveWidth = function ($element, method) {
     4814    var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
     4815
     4816    if (method == 'resolve') {
     4817      var styleWidth = this._resolveWidth($element, 'style');
     4818
     4819      if (styleWidth != null) {
     4820        return styleWidth;
     4821      }
     4822
     4823      return this._resolveWidth($element, 'element');
     4824    }
     4825
     4826    if (method == 'element') {
     4827      var elementWidth = $element.outerWidth(false);
     4828
     4829      if (elementWidth <= 0) {
     4830        return 'auto';
     4831      }
     4832
     4833      return elementWidth + 'px';
     4834    }
     4835
     4836    if (method == 'style') {
     4837      var style = $element.attr('style');
     4838
     4839      if (typeof(style) !== 'string') {
     4840        return null;
     4841      }
     4842
     4843      var attrs = style.split(';');
     4844
     4845      for (var i = 0, l = attrs.length; i < l; i = i + 1) {
     4846        var attr = attrs[i].replace(/\s/g, '');
     4847        var matches = attr.match(WIDTH);
     4848
     4849        if (matches !== null && matches.length >= 1) {
     4850          return matches[1];
     4851        }
     4852      }
     4853
     4854      return null;
     4855    }
     4856
     4857    return method;
     4858  };
     4859
     4860  Select2.prototype._bindAdapters = function () {
     4861    this.dataAdapter.bind(this, this.$container);
     4862    this.selection.bind(this, this.$container);
     4863
     4864    this.dropdown.bind(this, this.$container);
     4865    this.results.bind(this, this.$container);
     4866  };
     4867
     4868  Select2.prototype._registerDomEvents = function () {
     4869    var self = this;
     4870
     4871    this.$element.on('change.select2', function () {
     4872      self.dataAdapter.current(function (data) {
     4873        self.trigger('selection:update', {
     4874          data: data
     4875        });
     4876      });
     4877    });
     4878
     4879    this._sync = Utils.bind(this._syncAttributes, this);
     4880
     4881    if (this.$element[0].attachEvent) {
     4882      this.$element[0].attachEvent('onpropertychange', this._sync);
     4883    }
     4884
     4885    var observer = window.MutationObserver ||
     4886      window.WebKitMutationObserver ||
     4887      window.MozMutationObserver
     4888    ;
     4889
     4890    if (observer != null) {
     4891      this._observer = new observer(function (mutations) {
     4892        $.each(mutations, self._sync);
     4893      });
     4894      this._observer.observe(this.$element[0], {
     4895        attributes: true,
     4896        subtree: false
     4897      });
     4898    } else if (this.$element[0].addEventListener) {
     4899      this.$element[0].addEventListener('DOMAttrModified', self._sync, false);
     4900    }
     4901  };
     4902
     4903  Select2.prototype._registerDataEvents = function () {
     4904    var self = this;
     4905
     4906    this.dataAdapter.on('*', function (name, params) {
     4907      self.trigger(name, params);
     4908    });
     4909  };
     4910
     4911  Select2.prototype._registerSelectionEvents = function () {
     4912    var self = this;
     4913    var nonRelayEvents = ['toggle'];
     4914
     4915    this.selection.on('toggle', function () {
     4916      self.toggleDropdown();
     4917    });
     4918
     4919    this.selection.on('*', function (name, params) {
     4920      if ($.inArray(name, nonRelayEvents) !== -1) {
     4921        return;
     4922      }
     4923
     4924      self.trigger(name, params);
     4925    });
     4926  };
     4927
     4928  Select2.prototype._registerDropdownEvents = function () {
     4929    var self = this;
     4930
     4931    this.dropdown.on('*', function (name, params) {
     4932      self.trigger(name, params);
     4933    });
     4934  };
     4935
     4936  Select2.prototype._registerResultsEvents = function () {
     4937    var self = this;
     4938
     4939    this.results.on('*', function (name, params) {
     4940      self.trigger(name, params);
     4941    });
     4942  };
     4943
     4944  Select2.prototype._registerEvents = function () {
     4945    var self = this;
     4946
     4947    this.on('open', function () {
     4948      self.$container.addClass('select2-container--open');
     4949    });
     4950
     4951    this.on('close', function () {
     4952      self.$container.removeClass('select2-container--open');
     4953    });
     4954
     4955    this.on('enable', function () {
     4956      self.$container.removeClass('select2-container--disabled');
     4957    });
     4958
     4959    this.on('disable', function () {
     4960      self.$container.addClass('select2-container--disabled');
     4961    });
     4962
     4963    this.on('focus', function () {
     4964      self.$container.addClass('select2-container--focus');
     4965    });
     4966
     4967    this.on('blur', function () {
     4968      self.$container.removeClass('select2-container--focus');
     4969    });
     4970
     4971    this.on('query', function (params) {
     4972      if (!self.isOpen()) {
     4973        self.trigger('open');
     4974      }
     4975
     4976      this.dataAdapter.query(params, function (data) {
     4977        self.trigger('results:all', {
     4978          data: data,
     4979          query: params
     4980        });
     4981      });
     4982    });
     4983
     4984    this.on('query:append', function (params) {
     4985      this.dataAdapter.query(params, function (data) {
     4986        self.trigger('results:append', {
     4987          data: data,
     4988          query: params
     4989        });
     4990      });
     4991    });
     4992
     4993    this.on('keypress', function (evt) {
     4994      var key = evt.which;
     4995
     4996      if (self.isOpen()) {
     4997        if (key === KEYS.ENTER) {
     4998          self.trigger('results:select');
     4999
     5000          evt.preventDefault();
     5001        } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
     5002          self.trigger('results:toggle');
     5003
     5004          evt.preventDefault();
     5005        } else if (key === KEYS.UP) {
     5006          self.trigger('results:previous');
     5007
     5008          evt.preventDefault();
     5009        } else if (key === KEYS.DOWN) {
     5010          self.trigger('results:next');
     5011
     5012          evt.preventDefault();
     5013        } else if (key === KEYS.ESC || key === KEYS.TAB) {
     5014          self.close();
     5015
     5016          evt.preventDefault();
     5017        }
     5018      } else {
     5019        if (key === KEYS.ENTER || key === KEYS.SPACE ||
     5020            ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) {
     5021          self.open();
     5022
     5023          evt.preventDefault();
     5024        }
     5025      }
     5026    });
     5027  };
     5028
     5029  Select2.prototype._syncAttributes = function () {
     5030    this.options.set('disabled', this.$element.prop('disabled'));
     5031
     5032    if (this.options.get('disabled')) {
     5033      if (this.isOpen()) {
     5034        this.close();
     5035      }
     5036
     5037      this.trigger('disable');
     5038    } else {
     5039      this.trigger('enable');
     5040    }
     5041  };
     5042
     5043  /**
     5044   * Override the trigger method to automatically trigger pre-events when
     5045   * there are events that can be prevented.
     5046   */
     5047  Select2.prototype.trigger = function (name, args) {
     5048    var actualTrigger = Select2.__super__.trigger;
     5049    var preTriggerMap = {
     5050      'open': 'opening',
     5051      'close': 'closing',
     5052      'select': 'selecting',
     5053      'unselect': 'unselecting'
     5054    };
     5055
     5056    if (name in preTriggerMap) {
     5057      var preTriggerName = preTriggerMap[name];
     5058      var preTriggerArgs = {
     5059        prevented: false,
     5060        name: name,
     5061        args: args
     5062      };
     5063
     5064      actualTrigger.call(this, preTriggerName, preTriggerArgs);
     5065
     5066      if (preTriggerArgs.prevented) {
     5067        args.prevented = true;
     5068
     5069        return;
     5070      }
     5071    }
     5072
     5073    actualTrigger.call(this, name, args);
     5074  };
     5075
     5076  Select2.prototype.toggleDropdown = function () {
     5077    if (this.options.get('disabled')) {
     5078      return;
     5079    }
     5080
     5081    if (this.isOpen()) {
     5082      this.close();
     5083    } else {
     5084      this.open();
     5085    }
     5086  };
     5087
     5088  Select2.prototype.open = function () {
     5089    if (this.isOpen()) {
     5090      return;
     5091    }
     5092
     5093    this.trigger('query', {});
     5094
     5095    this.trigger('open');
     5096  };
     5097
     5098  Select2.prototype.close = function () {
     5099    if (!this.isOpen()) {
     5100      return;
     5101    }
     5102
     5103    this.trigger('close');
     5104  };
     5105
     5106  Select2.prototype.isOpen = function () {
     5107    return this.$container.hasClass('select2-container--open');
     5108  };
     5109
     5110  Select2.prototype.enable = function (args) {
     5111    if (this.options.get('debug') && window.console && console.warn) {
     5112      console.warn(
     5113        'Select2: The `select2("enable")` method has been deprecated and will' +
     5114        ' be removed in later Select2 versions. Use $element.prop("disabled")' +
     5115        ' instead.'
     5116      );
     5117    }
     5118
     5119    if (args == null || args.length === 0) {
     5120      args = [true];
     5121    }
     5122
     5123    var disabled = !args[0];
     5124
     5125    this.$element.prop('disabled', disabled);
     5126  };
     5127
     5128  Select2.prototype.data = function () {
     5129    if (this.options.get('debug') &&
     5130        arguments.length > 0 && window.console && console.warn) {
     5131      console.warn(
     5132        'Select2: Data can no longer be set using `select2("data")`. You ' +
     5133        'should consider setting the value instead using `$element.val()`.'
     5134      );
     5135    }
     5136
     5137    var data = [];
     5138
     5139    this.dataAdapter.current(function (currentData) {
     5140      data = currentData;
     5141    });
     5142
     5143    return data;
     5144  };
     5145
     5146  Select2.prototype.val = function (args) {
     5147    if (this.options.get('debug') && window.console && console.warn) {
     5148      console.warn(
     5149        'Select2: The `select2("val")` method has been deprecated and will be' +
     5150        ' removed in later Select2 versions. Use $element.val() instead.'
     5151      );
     5152    }
     5153
     5154    if (args == null || args.length === 0) {
     5155      return this.$element.val();
     5156    }
     5157
     5158    var newVal = args[0];
     5159
     5160    if ($.isArray(newVal)) {
     5161      newVal = $.map(newVal, function (obj) {
     5162        return obj.toString();
     5163      });
     5164    }
     5165
     5166    this.$element.val(newVal).trigger('change');
     5167  };
     5168
     5169  Select2.prototype.destroy = function () {
     5170    this.$container.remove();
     5171
     5172    if (this.$element[0].detachEvent) {
     5173      this.$element[0].detachEvent('onpropertychange', this._sync);
     5174    }
     5175
     5176    if (this._observer != null) {
     5177      this._observer.disconnect();
     5178      this._observer = null;
     5179    } else if (this.$element[0].removeEventListener) {
     5180      this.$element[0]
     5181        .removeEventListener('DOMAttrModified', this._sync, false);
     5182    }
     5183
     5184    this._sync = null;
     5185
     5186    this.$element.off('.select2');
     5187    this.$element.attr('tabindex', this.$element.data('old-tabindex'));
     5188
     5189    this.$element.show();
     5190    this.$element.removeData('select2');
     5191
     5192    this.dataAdapter.destroy();
     5193    this.selection.destroy();
     5194    this.dropdown.destroy();
     5195    this.results.destroy();
     5196
     5197    this.dataAdapter = null;
     5198    this.selection = null;
     5199    this.dropdown = null;
     5200    this.results = null;
     5201  };
     5202
     5203  Select2.prototype.render = function () {
     5204    var $container = $(
     5205      '<span class="select2 select2-container">' +
     5206        '<span class="selection"></span>' +
     5207        '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
     5208      '</span>'
     5209    );
     5210
     5211    $container.attr('dir', this.options.get('dir'));
     5212
     5213    this.$container = $container;
     5214
     5215    this.$container.addClass('select2-container--' + this.options.get('theme'));
     5216
     5217    $container.data('element', this.$element);
     5218
     5219    return $container;
     5220  };
     5221
     5222  return Select2;
     5223});
     5224
     5225S2.define('jquery.select2',[
     5226  'jquery',
     5227  './select2/core',
     5228  './select2/defaults'
     5229], function ($, Select2, Defaults) {
     5230  // Force jQuery.mousewheel to be loaded if it hasn't already
     5231  try {
     5232    require('jquery.mousewheel');
     5233  } catch (Exception) { }
     5234
     5235  if ($.fn.select2 == null) {
     5236    $.fn.select2 = function (options) {
     5237      options = options || {};
     5238
     5239      if (typeof options === 'object') {
     5240        this.each(function () {
     5241          var instanceOptions = $.extend({}, options, true);
     5242
     5243          var instance = new Select2($(this), instanceOptions);
     5244        });
     5245
     5246        return this;
     5247      } else if (typeof options === 'string') {
     5248        var instance = this.data('select2');
     5249        var args = Array.prototype.slice.call(arguments, 1);
     5250
     5251        return instance[options](args);
     5252      } else {
     5253        throw new Error('Invalid arguments for Select2: ' + options);
     5254      }
     5255    };
     5256  }
     5257
     5258  if ($.fn.select2.defaults == null) {
     5259    $.fn.select2.defaults = Defaults;
     5260  }
     5261
     5262  return Select2;
     5263});
     5264
     5265  // Return the AMD loader configuration so it can be used outside of this file
     5266  return {
     5267    define: S2.define,
     5268    require: S2.require
     5269  };
     5270}());
     5271
     5272  // Autoload the jQuery bindings
     5273  // We know that all of the modules exist above this, so we're safe
     5274  var select2 = S2.require('jquery.select2');
     5275
     5276  // Hold the AMD module references on the jQuery function that was just loaded
     5277  // This allows Select2 to use the internal loader outside of this file, such
     5278  // as in the language files.
     5279  jQuery.fn.select2.amd = S2;
     5280
     5281  // Return the Select2 instance for anyone who is importing it.
     5282  return select2;
     5283}));
  • wp-includes/js/select2/select2.min.js

     
     1/*! Select2 4.0.0-rc.2 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){return n.apply(b,v.call(arguments,0).concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),this.$results.append(d)},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";{a(h)}this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b){var c=this,d=b.id+"-results";this.$results.attr("id",d),b.on("results:all",function(a){c.clear(),c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("results:append",function(a){c.append(a.data),b.isOpen()&&c.setClasses()}),b.on("query",function(a){c.showLoading(a)}),b.on("select",function(){b.isOpen()&&c.setClasses()}),b.on("unselect",function(){b.isOpen()&&c.setClasses()}),b.on("open",function(){c.$results.attr("aria-expanded","true"),c.$results.attr("aria-hidden","false"),c.setClasses(),c.ensureHighlightVisible()}),b.on("close",function(){c.$results.attr("aria-expanded","false"),c.$results.attr("aria-hidden","true"),c.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=c.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=c.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?c.trigger("close"):c.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a);if(0!==d){var e=d-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top,h=f.offset().top,i=c.$results.scrollTop()+(h-g);0===e?c.$results.scrollTop(0):0>h-g&&c.$results.scrollTop(i)}}),b.on("results:next",function(){var a=c.getHighlightedResults(),b=c.$results.find("[aria-selected]"),d=b.index(a),e=d+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=c.$results.offset().top+c.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=c.$results.scrollTop()+h-g;0===e?c.$results.scrollTop(0):h>g&&c.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){c.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=c.$results.scrollTop(),d=c.$results.get(0).scrollHeight-c.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&d<=c.$results.height();e?(c.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(c.$results.scrollTop(c.$results.get(0).scrollHeight-c.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var d=a(this),e=d.data("data");return"true"===d.attr("aria-selected")?void(c.options.get("multiple")?c.trigger("unselect",{originalEvent:b,data:e}):c.trigger("close")):void c.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(){var b=a(this).data("data");c.getHighlightedResults().removeClass("select2-results__option--highlighted"),c.trigger("results:focus",{data:b,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a){var b=this,d=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){b.trigger("focus",a)}),this.$selection.on("blur",function(a){b.trigger("blur",a)}),this.$selection.on("keydown",function(a){b.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){b.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){b.update(a.data)}),a.on("open",function(){b.$selection.attr("aria-expanded","true"),b.$selection.attr("aria-owns",d),b._attachCloseHandler(a)}),a.on("close",function(){b.$selection.attr("aria-expanded","false"),b.$selection.removeAttr("aria-activedescendant"),b.$selection.removeAttr("aria-owns"),b.$selection.focus(),b._detachCloseHandler(a)}),a.on("enable",function(){b.$selection.attr("tabindex",b._tabindex)}),a.on("disable",function(){b.$selection.attr("tabindex","-1")})},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},d.prototype.bind=function(a){var b=this;d.__super__.bind.apply(this,arguments);var c=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",c),this.$selection.attr("aria-labelledby",c),this.$selection.on("mousedown",function(a){1===a.which&&b.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(){}),this.$selection.on("blur",function(){}),a.on("selection:update",function(a){b.update(a.data)})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){return a("<span></span>")},d.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.display(b),d=this.$selection.find(".select2-selection__rendered");d.empty().append(c),d.prop("title",b.title||b.text)},d}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(){var b=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){b.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(c){var d=a(this),e=d.parent(),f=e.data("data");b.trigger("unselect",{originalEvent:c,data:f})})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a){var b=this.options.get("templateSelection"),c=this.options.get("escapeMarkup");return c(b(a))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(b){if(this.clear(),0!==b.length){for(var c=a(),d=0;d<b.length;d++){var e=b[d],f=this.display(e),g=this.selectionContainer();g.append(f),g.prop("title",e.title||e.text),g.data("data",e),c=c.add(g)}this.$selection.find(".select2-selection__rendered").append(c)}},d}),b.define("select2/selection/placeholder",["../utils"],function(){function a(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},a.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},a}),b.define("select2/selection/allowClear",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),null==e.placeholder&&e.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(b){if(!e.options.get("disabled")){b.stopPropagation();for(var c=a(this).data("data"),d=0;d<c.length;d++){var f={data:c[d]};if(e.trigger("unselect",f),f.prevented)return}e.$element.val(e.placeholder.id).trigger("change"),e.trigger("toggle")}})},b.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},b}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus()}),b.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.focus()}),b.on("enable",function(){e.$search.prop("disabled",!1)}),b.on("disable",function(){e.$search.prop("disabled",!0)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e.trigger("blur",a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}}),this.$selection.on("input",".select2-search--inline",function(){e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input",".select2-search--inline",function(a){e.handleSearch(a)})},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.trigger("open"),this.$search.val(b.text+" ")},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a){var b=this;this.container=a,a.on("select",function(a){b.select(a.data)}),a.on("unselect",function(a){b.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){this.$element.append(a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);
     2var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function b(a){return function(){return c(this).val()==a.id}}for(var d=this,e=this.$element.find("option"),f=e.map(function(){return d.item(c(this)).id}).get(),g=c(),h=0;h<a.length;h++){var i=this._normalizeItem(a[h]);if(c.inArray(i.id,f)>=0){var j=e.filter(b(i)),k=this.item(j),l=(c.extend(!0,{},k,i),this.option(k));j.replaceWith(l)}else{var m=this.option(i);if(i.children){var n=this.convertToOptions(i.children);m.append(n)}g=g.add(m)}}return g},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(b,c){this.ajaxOptions=this._applyDefaults(c.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),a.__super__.constructor.call(this,b,c)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return{q:a.term}},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;this._request&&(this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url(a)),"function"==typeof f.data&&(f.data=f.data(a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions(m),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(){var b=(this._lastTag,this.$element.find("option[data-select2-tag]"));b.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.select(a)}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);e(m),g=g.substr(h+1)||"",h=0}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.position=function(){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a){function b(){}return b.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},b.prototype.handleSearch=function(){if(!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},b.prototype.showSearch=function(){return!0},b}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="option load-more" role="treeitem"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(a,b,c){this.$dropdownParent=c.get("dropdownParent")||document.body,a.call(this,b,c)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c){var d=this,e="scroll.select2."+c.id,f="resize.select2."+c.id,g="orientationchange.select2."+c.id,h=this.$container.parents().filter(b.hasScroll);h.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),h.on(e,function(){var b=a(this).data("select2-scroll-position");a(this).scrollTop(b.y)}),a(window).on(e+" "+f+" "+g,function(){d._positionDropdown(),d._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c){var d="scroll.select2."+c.id,e="resize.select2."+c.id,f="orientationchange.select2."+c.id,g=this.$container.parents().filter(b.hasScroll);g.off(d),a(window).off(d+" "+e+" "+f)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){this.$dropdownContainer.width(),this.$dropdown.css({width:this.$container.outerWidth(!1)+"px"})},c.prototype._showDropdown=function(){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();a.length<1||a.trigger("mouseup")},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close")},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(l.dataAdapter=null!=l.ajax?o:null!=l.data?n:m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter&&(l.selectionAdapter=l.multiple?e:d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),l.selectionAdapter=j.Decorate(l.selectionAdapter,i)),"string"==typeof l.language)if(l.language.indexOf("-")>0){var F=l.language.split("-"),G=F[0];l.language=[l.language,G]}else l.language=[l.language];if(a.isArray(l.language)){var H=new k;l.language.push("en");for(var I=l.language,J=0;J<I.length;J++){var K=I[J],L={};try{L=k.loadPath(K)}catch(M){try{K=this.defaults.amdLanguageBase+K,L=k.loadPath(K)}catch(N){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+K+'" could not be automatically loaded. A fallback will be used instead.');continue}}H.extend(L)}l.translations=H}else l.translations=new k(l.language);return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["jquery","./defaults","./utils"],function(a,b,c){function d(a,d){if(this.options=a,null!=d&&this.fromElement(d),this.options=b.apply(this.options),d&&d.is("input")){var e=require(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=c.Decorate(this.options.dataAdapter,e)}}return d.prototype.fromElement=function(b){var d=["select2"];null==this.options.multiple&&(this.options.multiple=b.prop("multiple")),null==this.options.disabled&&(this.options.disabled=b.prop("disabled")),null==this.options.language&&(b.prop("lang")?this.options.language=b.prop("lang").toLowerCase():b.closest("[lang]").prop("lang")&&(this.options.language=b.closest("[lang]").prop("lang"))),null==this.options.dir&&(this.options.dir=b.prop("dir")?b.prop("dir"):b.closest("[dir]").prop("dir")?b.closest("[dir]").prop("dir"):"ltr"),b.prop("disabled",this.options.disabled),b.prop("multiple",this.options.multiple),b.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),b.data("data",b.data("select2Tags")),b.data("tags",!0)),b.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),b.attr("ajax--url",b.data("ajaxUrl")),b.data("ajax--url",b.data("ajaxUrl")));var e={};e=a.fn.jquery&&"1."==a.fn.jquery.substr(0,2)&&b[0].dataset?a.extend(!0,{},b[0].dataset,b.data()):b.data();var f=a.extend(!0,{},e);f=c._convertData(f);for(var g in f)a.inArray(g,d)>-1||(a.isPlainObject(this.options[g])?a.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},d.prototype.get=function(a){return this.options[a]},d.prototype.set=function(a,b){this.options[a]=b},d}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.hide(),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("focus",function(){a.$container.addClass("select2-container--focus")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open"),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ENTER?(a.trigger("results:select"),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle"),b.preventDefault()):c===d.UP?(a.trigger("results:previous"),b.preventDefault()):c===d.DOWN?(a.trigger("results:next"),b.preventDefault()):(c===d.ESC||c===d.TAB)&&(a.close(),b.preventDefault()):(c===d.ENTER||c===d.SPACE||(c===d.DOWN||c===d.UP)&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable")):this.trigger("enable")},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||(this.trigger("query",{}),this.trigger("open"))},e.prototype.close=function(){this.isOpen()&&this.trigger("close")},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.show(),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery.select2",["jquery","./select2/core","./select2/defaults"],function(a,b,c){try{require("jquery.mousewheel")}catch(d){}return null==a.fn.select2&&(a.fn.select2=function(c){if(c=c||{},"object"==typeof c)return this.each(function(){{var d=a.extend({},c,!0);new b(a(this),d)}}),this;if("string"==typeof c){var d=this.data("select2"),e=Array.prototype.slice.call(arguments,1);return d[c](e)}throw new Error("Invalid arguments for Select2: "+c)}),null==a.fn.select2.defaults&&(a.fn.select2.defaults=c),b}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
     3 No newline at end of file
  • wp-includes/js/select2/wp-select2.js

     
     1jQuery(document).ready(function($) {
     2    $('.select2').select2();
     3});
  • wp-includes/l10n.php

     
    912912
    913913        $translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
    914914
    915         printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
     915        printf( '<select class="select2" name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
    916916
    917917        // Holds the HTML markup.
    918918        $structure = array();
  • wp-includes/script-loader.php

     
    226226        $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array(), '3.1.2', 1 );
    227227        $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2', 1 );
    228228
     229    // Select2
     230    $scripts->add( 'select2', "/wp-includes/js/select2/select2$suffix.js", array('jquery'), '4.0-2', 1 );
     231    $scripts->add( 'wp-select2', '/wp-includes/js/select2/wp-select2.js', array('select2'), '0.1', 1 );
     232
    229233        $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
    230234        did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
    231235                        'next' => __('Next &gt;'),
     
    700704        $styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.16.2' );
    701705        $styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement.css", array( 'mediaelement' ) );
    702706        $styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
     707    $styles->add( 'select2',             "/wp-includes/css/select2.css", array(), '4.0-2' );
    703708
    704709        // Deprecated CSS
    705710        $styles->add( 'media',      "/wp-admin/css/deprecated-media$suffix.css" );