Ocean Extra - Version 1.1.6

Version Description

  • Select2 script replaced by Selective to prevent conflict.
Download this release

Release Info

Developer oceanwp
Plugin Icon 128x128 Ocean Extra
Version 1.1.6
Comparing to
See all releases

Code changes from version 1.1.5.1 to 1.1.6

includes/metabox/butterbean/class-butterbean.php CHANGED
@@ -642,11 +642,11 @@ if ( ! class_exists( 'OceanWP_ButterBean' ) ) {
642
  public function enqueue() {
643
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
644
 
645
- // Enqueue the select2 script.
646
- wp_enqueue_script( 'oceanwp-select2', $this->dir_uri . "js/select2.min.js", array( 'jquery' ), false, true );
647
 
648
- // Enqueue the select2 style.
649
- wp_enqueue_style( 'oceanwp-select2', $this->dir_uri . "css/select2.min.css" );
650
 
651
  // Enqueue color picker alpha
652
  wp_enqueue_script( 'wp-color-picker-alpha', $this->dir_uri . "js/wp-color-picker-alpha.js", array( 'wp-color-picker' ), false, true );
642
  public function enqueue() {
643
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
644
 
645
+ // Enqueue the selectize script.
646
+ wp_enqueue_script( 'selectize', $this->dir_uri . "js/selectize.min.js", array( 'jquery' ), false, true );
647
 
648
+ // Enqueue the selectize style.
649
+ wp_enqueue_style( 'selectize', $this->dir_uri . "css/selectize.min.css" );
650
 
651
  // Enqueue color picker alpha
652
  wp_enqueue_script( 'wp-color-picker-alpha', $this->dir_uri . "js/wp-color-picker-alpha.js", array( 'wp-color-picker' ), false, true );
includes/metabox/butterbean/css/butterbean.css CHANGED
@@ -16,7 +16,9 @@
16
  /* Tabs wrapper. */
17
 
18
  .butterbean-manager-default {
19
- overflow: hidden;
 
 
20
  background: #fff;
21
  background: linear-gradient( 90deg, #fafafa 0%, #fafafa 180px, #fff 180px, #fff 100% );
22
  }
@@ -257,30 +259,6 @@ body .butterbean-manager .butterbean-content input[type="number"]:focus,
257
  body .butterbean-manager .butterbean-content textarea:focus { border-color: rgba(0,0,0,0.08); }
258
  body .butterbean-manager .butterbean-content textarea { height: 80px; line-height: 20px; }
259
 
260
- /* Select */
261
- body .butterbean-manager .butterbean-content .select2-container { width: 100% !important; }
262
- body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single { padding: 0 12px; height: 34px; border-radius: 0 !important; background-color: #f5f5f5; border-color: rgba(0, 0, 0, 0.05) !important; outline: none; }
263
- body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__rendered { color: #333; line-height: 32px; }
264
- body .butterbean-manager .butterbean-content .select2-container .select2-selection--single .select2-selection__rendered { padding-left: 0; }
265
- body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow { width: 32px; height: 32px; border-left: 1px solid rgba(0, 0, 0, 0.05); }
266
- body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b { display: inline-block; margin-top: -6px; margin-left: -6px; border-width: 0; border-color: transparent; width: auto; height: auto; line-height: 1; }
267
- body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b:after { content: '\f347'; font-family: 'dashicons'; font-size: 12px; color: #777; position: relative; margin: 0; }
268
- .select2-dropdown { background-color: #f5f5f5; border-color: rgba(0, 0, 0, 0.05); border-radius: 0; }
269
- .select2-container--default .select2-results__option[aria-selected=true] { background-color: #eaeaea; }
270
- .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #5897fb; }
271
-
272
- /* Fix select2 on WooCommerce product admin page */
273
- body .butterbean-manager .butterbean-content .select2-container .select2-choice { padding: 0 12px; border-radius: 0!important; background-color: #f5f5f5; border-color: rgba(0,0,0,.05)!important; outline: none; line-height: 1.4em; font-size: 13px; }
274
- body .butterbean-manager .butterbean-content .select2-container .select2-choice > .select2-chosen { color: #333; line-height: 32px; margin-right: 0; padding-right: 20px; }
275
- body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow { top: 1px; right: 1px; width: 32px; height: 32px; border-left: 1px solid rgba(0,0,0,.05); }
276
- body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow b { position: absolute; top: 50%; left: 50%; margin-top: -6px; margin-left: -6px; border-width: 0; border-color: transparent; width: auto; height: auto; line-height: 1; }
277
- body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow b:after { content: '\f347'; font-family: 'dashicons'; top: auto; left: auto; font-size: 12px; color: #777; border: 0; position: relative; margin: 0; }
278
- .select2-drop { background-color: #f5f5f5; border-color: rgba(0, 0, 0, 0.05); border-radius: 0; }
279
- .select2-drop .select2-results { padding: 0; }
280
- .select2-drop .select2-results li { font-size: 13px; line-height: 1.4em; padding: 6px; margin: 0 0 6px; }
281
- .select2-drop .select2-results .select2-result-label { padding: 0; }
282
- .select2-drop .select2-results .select2-highlighted { background-color: #5897fb; color: #fff; }
283
-
284
  /* Buttonset */
285
  body .butterbean-manager .butterbean-content .butterbean-buttonset { display: inline-block; margin: 0; border: 1px solid rgba(0, 0, 0, 0.1); }
286
  body .butterbean-manager .butterbean-content .butterbean-buttonset:after { content: ''; display: block; height: 0; clear: both; visibility: hidden; zoom: 1; }
16
  /* Tabs wrapper. */
17
 
18
  .butterbean-manager-default {
19
+ display: inline-block;
20
+ width: 100%;
21
+ margin-bottom: -4px;
22
  background: #fff;
23
  background: linear-gradient( 90deg, #fafafa 0%, #fafafa 180px, #fff 180px, #fff 100% );
24
  }
259
  body .butterbean-manager .butterbean-content textarea:focus { border-color: rgba(0,0,0,0.08); }
260
  body .butterbean-manager .butterbean-content textarea { height: 80px; line-height: 20px; }
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  /* Buttonset */
263
  body .butterbean-manager .butterbean-content .butterbean-buttonset { display: inline-block; margin: 0; border: 1px solid rgba(0, 0, 0, 0.1); }
264
  body .butterbean-manager .butterbean-content .butterbean-buttonset:after { content: ''; display: block; height: 0; clear: both; visibility: hidden; zoom: 1; }
includes/metabox/butterbean/css/butterbean.min.css CHANGED
@@ -1 +1 @@
1
- .butterbean-ui>.hndle{padding:10px!important;border-bottom:1px solid #eee}.butterbean-ui .inside{margin:0!important;padding:0}.butterbean-manager-default{overflow:hidden;background:#fff;background:linear-gradient(90deg,#fafafa 0%,#fafafa 180px,#fff 180px,#fff 100%)}#side-sortables .butterbean-manager-default{background:linear-gradient(90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default{background:linear-gradient(90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}}.butterbean-manager-default .butterbean-nav{position:relative;float:left;list-style:none;width:180px;line-height:1em;margin:0 0 -1px 0;padding:0;background-color:#fafafa;border-right:1px solid #eee;box-sizing:border-box}.butterbean-manager-default .butterbean-nav li{display:block;position:relative;margin:0;padding:0;line-height:20px}.butterbean-manager-default .butterbean-nav li a{display:block;margin:0;padding:10px;line-height:20px!important;text-decoration:none;border-bottom:1px solid #eee;box-shadow:none}.butterbean-manager-default .butterbean-nav .dashicons{line-height:20px;margin-right:3px}.butterbean-manager-default .butterbean-nav li[aria-selected="true"] a{position:relative;font-weight:700;color:#555;background-color:#e0e0e0}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default .butterbean-nav{width:48px}.butterbean-manager-default .butterbean-nav .dashicons{width:24px;height:24px;font-size:24px;line-height:24px}.butterbean-manager-default .butterbean-nav .dashicons::before{width:24px;height:24px}.butterbean-manager-default .butterbean-nav .label{overflow:hidden;position:absolute;top:-1000em;left:-1000em;width:1px;height:1px}}.butterbean-manager-default .butterbean-content{float:left;width:calc(100% - 180px);margin-left:-1px;border-left:1px solid #eee}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default .butterbean-content{width:calc(100% - 48px)}}@media only screen and (min-width:850px){#side-sortables .butterbean-manager-default{background:#fff}#side-sortables .butterbean-manager-default .butterbean-content{width:100%}#side-sortables .butterbean-manager-default .butterbean-nav{display:table;width:100%}#side-sortables .butterbean-manager-default .butterbean-nav li{display:table-cell;text-align:center;border-right:1px solid #eee}#side-sortables .butterbean-manager-default .butterbean-nav li:last-of-type{border-right:none}#side-sortables .butterbean-manager-default .butterbean-nav li a{padding:10px 0}#side-sortables .butterbean-manager-default .butterbean-nav .dashicons{width:24px;height:24px;font-size:24px;line-height:24px}#side-sortables .butterbean-manager-default .butterbean-nav .dashicons::before{width:24px;height:24px}#side-sortables .butterbean-manager-default .butterbean-nav .label{overflow:hidden;position:absolute;top:-1000em;left:-1000em;width:1px;height:1px}}.butterbean-manager-default .butterbean-section{padding:12px 12px 0;box-sizing:border-box}.butterbean-manager-default .butterbean-section[aria-hidden="true"]{display:none}.butterbean-manager-default .butterbean-section[aria-hidden="false"]{display:block}.butterbean-manager-default .butterbean-control{margin-bottom:20px}.butterbean-manager-default .butterbean-label{display:block!important;font-weight:700;display:inline-block;margin-bottom:4px}.butterbean-manager-default .butterbean-control-checkbox .butterbean-label{display:inline!important}.butterbean-manager-default .butterbean-description{display:block;font-style:italic;margin-top:4px}.butterbean-manager-default .butterbean-label+.butterbean-description{margin-top:0;margin-bottom:4px}.butterbean-control-image .butterbean-img{display:block;max-width:100%;max-height:300px;height:auto}.butterbean-placeholder{width:100%;position:relative;text-align:center;padding:9px 0;line-height:20px;border:1px dashed rgb(180,185,190);box-sizing:border-box}.butterbean-control-textarea textarea{display:block;width:100%;height:105px}body .butterbean-manager .butterbean-content .butterbean-control:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-nav li[aria-selected=true] a{font-weight:400;background-color:#fff;margin-right:-1px}body .butterbean-manager .butterbean-nav li a{color:#555}body .butterbean-manager .butterbean-nav .dashicons{margin-right:8px}body .butterbean-manager .butterbean-content .butterbean-control{border-top:1px solid #f1f1f1;padding:15px 0;margin:0}body .butterbean-manager .butterbean-content .butterbean-control:first-child{border-top:0;padding-top:0}body .butterbean-manager .butterbean-content .butterbean-control:last-child{padding-bottom:0}body .butterbean-manager .butterbean-content .butterbean-section{padding:20px 30px}body .butterbean-manager .butterbean-content .oceanwp-mb-desc{float:left;width:45%}body .butterbean-manager .butterbean-content .oceanwp-mb-field{position:relative;float:right;width:50%}body .butterbean-manager .butterbean-content .butterbean-label{font-size:13px;font-weight:400;color:#222}body .butterbean-manager .butterbean-content .butterbean-description{font-size:12px;font-weight:400;font-style:normal;margin:8px 0 0;padding:0;color:#939393}body .butterbean-manager .butterbean-content input[type="text"],body .butterbean-manager .butterbean-content input[type="number"],body .butterbean-manager .butterbean-content select,body .butterbean-manager .butterbean-content textarea{background-color:#f5f5f5;color:#333;border:1px solid rgba(0,0,0,.05);font-size:13px;padding:5px 12px;height:34px;line-height:34px;width:100%;margin:0;box-shadow:none!important;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}body .butterbean-manager .butterbean-content input[type="text"]:focus,body .butterbean-manager .butterbean-content input[type="number"]:focus,body .butterbean-manager .butterbean-content textarea:focus{border-color:rgba(0,0,0,.08)}body .butterbean-manager .butterbean-content textarea{height:80px;line-height:20px}body .butterbean-manager .butterbean-content .select2-container{width:100%!important}body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single{padding:0 12px;height:34px;border-radius:0!important;background-color:#f5f5f5;border-color:rgba(0,0,0,.05)!important;outline:none}body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__rendered{color:#333;line-height:32px}body .butterbean-manager .butterbean-content .select2-container .select2-selection--single .select2-selection__rendered{padding-left:0}body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow{width:32px;height:32px;border-left:1px solid rgba(0,0,0,.05)}body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b{display:inline-block;margin-top:-6px;margin-left:-6px;border-width:0;border-color:transparent;width:auto;height:auto;line-height:1}body .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b:after{content:'\f347';font-family:'dashicons';font-size:12px;color:#777;position:relative;margin:0}.select2-dropdown{background-color:#f5f5f5;border-color:rgba(0,0,0,.05);border-radius:0}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#eaeaea}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb}body .butterbean-manager .butterbean-content .select2-container .select2-choice{padding:0 12px;border-radius:0!important;background-color:#f5f5f5;border-color:rgba(0,0,0,.05)!important;outline:none;line-height:1.4em;font-size:13px}body .butterbean-manager .butterbean-content .select2-container .select2-choice>.select2-chosen{color:#333;line-height:32px;margin-right:0;padding-right:20px}body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow{top:1px;right:1px;width:32px;height:32px;border-left:1px solid rgba(0,0,0,.05)}body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow b{position:absolute;top:50%;left:50%;margin-top:-6px;margin-left:-6px;border-width:0;border-color:transparent;width:auto;height:auto;line-height:1}body .butterbean-manager .butterbean-content .select2-container .select2-choice .select2-arrow b:after{content:'\f347';font-family:'dashicons';top:auto;left:auto;font-size:12px;color:#777;border:0;position:relative;margin:0}.select2-drop{background-color:#f5f5f5;border-color:rgba(0,0,0,.05);border-radius:0}.select2-drop .select2-results{padding:0}.select2-drop .select2-results li{font-size:13px;line-height:1.4em;padding:6px;margin:0 0 6px}.select2-drop .select2-results .select2-result-label{padding:0}.select2-drop .select2-results .select2-highlighted{background-color:#5897fb;color:#fff}body .butterbean-manager .butterbean-content .butterbean-buttonset{display:inline-block;margin:0;border:1px solid rgba(0,0,0,.1)}body .butterbean-manager .butterbean-content .butterbean-buttonset:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-content .butterbean-buttonset li{float:left;margin:0}body .butterbean-manager .butterbean-content .butterbean-buttonset li label{display:block;background-color:#f5f5f5;color:#555;border-right:1px solid rgba(0,0,0,.1);min-width:60px;padding:12px 18px;margin:0;font-size:13px;line-height:1;letter-spacing:.6px;text-align:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-box-sizing:border-box}body .butterbean-manager .butterbean-content .butterbean-buttonset li:last-child label{border-right:0}body .butterbean-manager .butterbean-content .butterbean-buttonset li input{display:none}body .butterbean-manager .butterbean-content .butterbean-buttonset li .buttonset-input:checked+.buttonset-label{background-color:#3498DB;color:#fff}body .butterbean-manager .butterbean-content .wp-color-result{display:inline-block;margin-left:0;margin-right:0;padding-left:34px;height:32px!important;min-width:108px;border-radius:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}body .butterbean-manager .butterbean-content .wp-color-result:focus,body .butterbean-manager .butterbean-content .wp-color-result:hover,body .butterbean-manager .butterbean-content .wp-color-result:focus:after,body .butterbean-manager .butterbean-content .wp-color-result:hover:after{border-color:#bbb}body .butterbean-manager .butterbean-content .wp-color-result:after{position:relative;padding:0 6px;line-height:32px!important;border-radius:0!important;font-size:13px!important}body .butterbean-manager .butterbean-content .wp-picker-container{width:310px}body .butterbean-manager .butterbean-content .alpha-true .wp-picker-container{width:352px}body .butterbean-manager .butterbean-content .wp-picker-container input[type=text].wp-color-picker{height:34px;line-height:normal;float:left;width:calc(100% - 67px)!important;max-width:100%}body .butterbean-manager .butterbean-content .wp-picker-container .wp-picker-input-wrap{display:none}body .butterbean-manager .butterbean-content .wp-picker-container.wp-picker-active .wp-picker-input-wrap{display:block;margin-left:7px;float:right;width:calc(100% - 159px)}body .butterbean-manager .butterbean-content .wp-picker-container input.iris-error[type="text"]{background-color:#fff;border:1px solid #ddd;box-shadow:0 1px 2px rgba(0,0,0,.07) inset;color:#333;transition:border-color 0.05s ease-in-out 0s}body .butterbean-manager .butterbean-content .wp-picker-clear{border-radius:0!important;background:#f4f2f2!important;box-shadow:none!important;transition:all 200ms ease-in-out;border:1px solid rgba(0,0,0,.05);float:right;font-size:12px;height:34px!important;width:60px!important;margin:0px!important}body .butterbean-manager .butterbean-content .wp-picker-holder{clear:both;margin:0;padding-top:4px;display:block;overflow:hidden}body .butterbean-manager .butterbean-content input.wp-picker-clear{border-radius:0!important;background:#f4f2f2!important;box-shadow:none!important;transition:all 200ms ease-in-out;border:1px solid rgba(0,0,0,.05);float:right;font-size:12px;height:34px!important;width:60px!important;margin:0px!important}body .butterbean-manager .butterbean-content .iris-picker{min-width:308px}body .butterbean-manager .butterbean-content .alpha-true .iris-picker{min-width:350px}body .butterbean-manager .butterbean-content .iris-picker .iris-square{margin-right:0}body .butterbean-manager .butterbean-content .iris-picker .iris-square{width:251px!important;height:198px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-picker-inner .iris-square-value{height:0!important;width:0!important}body .butterbean-manager .butterbean-content .iris-picker .iris-palette-container{bottom:8px}body .butterbean-manager .butterbean-content .iris-picker .iris-palette{width:19px!important;height:19px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-slider .ui-slider-handle{width:23px;border:4px solid #fff!important;border-radius:0!important;box-shadow:0 1px 2px rgba(0,0,0,.4)}body .butterbean-manager .butterbean-content .iris-picker .iris-square,body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner,body .butterbean-manager .butterbean-content .iris-picker .iris-palette{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-box-sizing:border-box}body .butterbean-manager .butterbean-content .iris-picker .iris-square,body .butterbean-manager .butterbean-content .iris-picker .iris-slider,body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner,body .butterbean-manager .butterbean-content .iris-picker .iris-palette{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner{border:none}body .butterbean-manager .butterbean-content .iris-picker .iris-slider{margin-left:8px!important;width:25px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-alpha-slider{margin-left:17px!important}body .butterbean-manager .butterbean-content .range-wrapper:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-content input[type=range]{float:left;display:block;background-color:rgba(0,0,0,.1);height:5px;margin:13px 0;width:calc(100% - 130px);padding:0;cursor:pointer;-webkit-transition:background .5s;-moz-transition:background .5s;transition:background .5s;-webkit-appearance:none}body .butterbean-manager .butterbean-content input[type="range"]:focus{box-shadow:none!important;outline:none!important}body .butterbean-manager .butterbean-content input[type="range"]:hover{background-color:rgba(0,0,0,.15)}body .butterbean-manager .butterbean-content input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;background-color:#2e86b9;width:15px;height:15px;border-radius:15px;-webkit-border-radius:15px}body .butterbean-manager .butterbean-content input[type="range"]::-moz-range-track{border:inherit;background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-track{border:inherit;color:transparent;background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-fill-lower,body .butterbean-manager .butterbean-content input[type="range"]::-ms-fill-upper{background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-tooltip{display:none}body .butterbean-manager .butterbean-content input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border:none;border-radius:15px;background-color:#2e86b9}body .butterbean-manager .butterbean-content input[type="range"]::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:15px;background-color:#2e86b9}body .butterbean-manager .butterbean-content input[type="range"]::-ms-thumb{width:15px;height:15px;border-radius:15px;border:0;background-color:#2e86b9}body .butterbean-manager .butterbean-content input.oceanwp-range-input{float:left;width:80px;height:32px;text-align:center;border-radius:4px;padding:3px;font-size:13px;margin-left:15px;color:#555;-moz-appearance:textfield}body .butterbean-manager .butterbean-content input.oceanwp-range-input::-webkit-outer-spin-button,body .butterbean-manager .butterbean-content input.oceanwp-range-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider{float:right;position:relative;margin:8px 0 0 5px;line-height:1;color:rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;-webkit-transition:all .3s ease;-moz-transition:all .3s ease;-o-transition:all .3s ease;-ms-transition:all .3s ease}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider:hover{color:#fe5252}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider span{width:16px;height:16px;font-size:16px;line-height:1}body .butterbean-manager .butterbean-content .uploader input[type="text"]{width:78%}body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{float:right;width:20%;height:34px;margin:0;border-radius:0;outline:0;-webkit-box-shadow:none!important;box-shadow:none!important;vertical-align:middle}body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media:hover,body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media:focus{border-color:#bbb}@media only screen and (max-width:959px){body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{padding:6px 4px}}@media only screen and (max-width:480px){body .butterbean-manager .butterbean-content .oceanwp-mb-desc,body .butterbean-manager .butterbean-content .oceanwp-mb-field{float:none;width:100%}body .butterbean-manager .butterbean-content .oceanwp-mb-desc{margin-bottom:15px}}body.rtl .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 180px,#fff 180px,#fff 100%)}body.rtl #side-sortables .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}body.rtl .butterbean-manager-default .butterbean-nav{float:right;border-left:1px solid #eee;border-right:0}body.rtl .butterbean-manager .butterbean-nav .dashicons{margin-left:8px;margin-right:0}body.rtl .butterbean-manager .butterbean-nav li[aria-selected=true] a{margin-left:-1px;margin-right:0}body.rtl .butterbean-manager-default .butterbean-content{float:right;margin-right:-1px;margin-left:0;border-right:1px solid #eee;border-left:0}body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-desc{float:right}body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-field{float:left}body.rtl .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b{right:50%;left:auto;margin-right:-6px;margin-left:0}body.rtl .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow{border-right:1px solid rgba(0,0,0,.05);border-left:0}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li{float:right}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li label{border-left:1px solid rgba(0,0,0,.1);border-right:0}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li:last-child label{border-left:0}body.rtl .butterbean-manager .butterbean-content .wp-color-result{padding-right:34px;padding-left:0}body.rtl .butterbean-manager .butterbean-content .wp-picker-container input[type=text].wp-color-picker{float:right}body.rtl .butterbean-manager .butterbean-content .wp-picker-container.wp-picker-active .wp-picker-input-wrap{margin-right:7px;margin-left:0;float:left}body.rtl .butterbean-manager .butterbean-content .wp-picker-clear{float:left}body.rtl .butterbean-manager .butterbean-content input.wp-picker-clear{float:left}body.rtl .butterbean-manager .butterbean-content input[type=range]{float:right}body.rtl .butterbean-manager .butterbean-content input.oceanwp-range-input{float:right;margin-right:15px;margin-left:0}body.rtl .butterbean-manager .butterbean-content span.oceanwp-reset-slider{float:left;margin:8px 5px 0 0}body.rtl .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{float:left}@media only screen and (max-width:480px){body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-desc,body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-field{float:none;width:100%}}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){body.rtl .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}body.rtl .butterbean-manager-default .butterbean-nav .label{right:-1000em;left:auto}}@media only screen and (min-width:850px){body.rtl #side-sortables .butterbean-manager-default .butterbean-nav li{border-left:1px solid #eee;border-right:0}body.rtl #side-sortables .butterbean-manager-default .butterbean-nav li:last-of-type{border-left:none}body.rtl #side-sortables .butterbean-manager-default .butterbean-nav .label{right:-1000em;left:auto}}
1
+ .butterbean-ui>.hndle{padding:10px!important;border-bottom:1px solid #eee}.butterbean-ui .inside{margin:0!important;padding:0}.butterbean-manager-default{display:inline-block;width:100%;margin-bottom:-4px;background:#fff;background:linear-gradient(90deg,#fafafa 0%,#fafafa 180px,#fff 180px,#fff 100%)}#side-sortables .butterbean-manager-default{background:linear-gradient(90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default{background:linear-gradient(90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}}.butterbean-manager-default .butterbean-nav{position:relative;float:left;list-style:none;width:180px;line-height:1em;margin:0 0 -1px 0;padding:0;background-color:#fafafa;border-right:1px solid #eee;box-sizing:border-box}.butterbean-manager-default .butterbean-nav li{display:block;position:relative;margin:0;padding:0;line-height:20px}.butterbean-manager-default .butterbean-nav li a{display:block;margin:0;padding:10px;line-height:20px!important;text-decoration:none;border-bottom:1px solid #eee;box-shadow:none}.butterbean-manager-default .butterbean-nav .dashicons{line-height:20px;margin-right:3px}.butterbean-manager-default .butterbean-nav li[aria-selected="true"] a{position:relative;font-weight:700;color:#555;background-color:#e0e0e0}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default .butterbean-nav{width:48px}.butterbean-manager-default .butterbean-nav .dashicons{width:24px;height:24px;font-size:24px;line-height:24px}.butterbean-manager-default .butterbean-nav .dashicons::before{width:24px;height:24px}.butterbean-manager-default .butterbean-nav .label{overflow:hidden;position:absolute;top:-1000em;left:-1000em;width:1px;height:1px}}.butterbean-manager-default .butterbean-content{float:left;width:calc(100% - 180px);margin-left:-1px;border-left:1px solid #eee}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){.butterbean-manager-default .butterbean-content{width:calc(100% - 48px)}}@media only screen and (min-width:850px){#side-sortables .butterbean-manager-default{background:#fff}#side-sortables .butterbean-manager-default .butterbean-content{width:100%}#side-sortables .butterbean-manager-default .butterbean-nav{display:table;width:100%}#side-sortables .butterbean-manager-default .butterbean-nav li{display:table-cell;text-align:center;border-right:1px solid #eee}#side-sortables .butterbean-manager-default .butterbean-nav li:last-of-type{border-right:none}#side-sortables .butterbean-manager-default .butterbean-nav li a{padding:10px 0}#side-sortables .butterbean-manager-default .butterbean-nav .dashicons{width:24px;height:24px;font-size:24px;line-height:24px}#side-sortables .butterbean-manager-default .butterbean-nav .dashicons::before{width:24px;height:24px}#side-sortables .butterbean-manager-default .butterbean-nav .label{overflow:hidden;position:absolute;top:-1000em;left:-1000em;width:1px;height:1px}}.butterbean-manager-default .butterbean-section{padding:12px 12px 0;box-sizing:border-box}.butterbean-manager-default .butterbean-section[aria-hidden="true"]{display:none}.butterbean-manager-default .butterbean-section[aria-hidden="false"]{display:block}.butterbean-manager-default .butterbean-control{margin-bottom:20px}.butterbean-manager-default .butterbean-label{display:block!important;font-weight:700;display:inline-block;margin-bottom:4px}.butterbean-manager-default .butterbean-control-checkbox .butterbean-label{display:inline!important}.butterbean-manager-default .butterbean-description{display:block;font-style:italic;margin-top:4px}.butterbean-manager-default .butterbean-label+.butterbean-description{margin-top:0;margin-bottom:4px}.butterbean-control-image .butterbean-img{display:block;max-width:100%;max-height:300px;height:auto}.butterbean-placeholder{width:100%;position:relative;text-align:center;padding:9px 0;line-height:20px;border:1px dashed rgb(180,185,190);box-sizing:border-box}.butterbean-control-textarea textarea{display:block;width:100%;height:105px}body .butterbean-manager .butterbean-content .butterbean-control:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-nav li[aria-selected=true] a{font-weight:400;background-color:#fff;margin-right:-1px}body .butterbean-manager .butterbean-nav li a{color:#555}body .butterbean-manager .butterbean-nav .dashicons{margin-right:8px}body .butterbean-manager .butterbean-content .butterbean-control{border-top:1px solid #f1f1f1;padding:15px 0;margin:0}body .butterbean-manager .butterbean-content .butterbean-control:first-child{border-top:0;padding-top:0}body .butterbean-manager .butterbean-content .butterbean-control:last-child{padding-bottom:0}body .butterbean-manager .butterbean-content .butterbean-section{padding:20px 30px}body .butterbean-manager .butterbean-content .oceanwp-mb-desc{float:left;width:45%}body .butterbean-manager .butterbean-content .oceanwp-mb-field{position:relative;float:right;width:50%}body .butterbean-manager .butterbean-content .butterbean-label{font-size:13px;font-weight:400;color:#222}body .butterbean-manager .butterbean-content .butterbean-description{font-size:12px;font-weight:400;font-style:normal;margin:8px 0 0;padding:0;color:#939393}body .butterbean-manager .butterbean-content input[type="text"],body .butterbean-manager .butterbean-content input[type="number"],body .butterbean-manager .butterbean-content select,body .butterbean-manager .butterbean-content textarea{background-color:#f5f5f5;color:#333;border:1px solid rgba(0,0,0,.05);font-size:13px;padding:5px 12px;height:34px;line-height:34px;width:100%;margin:0;box-shadow:none!important;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}body .butterbean-manager .butterbean-content input[type="text"]:focus,body .butterbean-manager .butterbean-content input[type="number"]:focus,body .butterbean-manager .butterbean-content textarea:focus{border-color:rgba(0,0,0,.08)}body .butterbean-manager .butterbean-content textarea{height:80px;line-height:20px}body .butterbean-manager .butterbean-content .butterbean-buttonset{display:inline-block;margin:0;border:1px solid rgba(0,0,0,.1)}body .butterbean-manager .butterbean-content .butterbean-buttonset:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-content .butterbean-buttonset li{float:left;margin:0}body .butterbean-manager .butterbean-content .butterbean-buttonset li label{display:block;background-color:#f5f5f5;color:#555;border-right:1px solid rgba(0,0,0,.1);min-width:60px;padding:12px 18px;margin:0;font-size:13px;line-height:1;letter-spacing:.6px;text-align:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-box-sizing:border-box}body .butterbean-manager .butterbean-content .butterbean-buttonset li:last-child label{border-right:0}body .butterbean-manager .butterbean-content .butterbean-buttonset li input{display:none}body .butterbean-manager .butterbean-content .butterbean-buttonset li .buttonset-input:checked+.buttonset-label{background-color:#3498DB;color:#fff}body .butterbean-manager .butterbean-content .wp-color-result{display:inline-block;margin-left:0;margin-right:0;padding-left:34px;height:32px!important;min-width:108px;border-radius:0!important;box-shadow:none!important;-webkit-box-shadow:none!important}body .butterbean-manager .butterbean-content .wp-color-result:focus,body .butterbean-manager .butterbean-content .wp-color-result:hover,body .butterbean-manager .butterbean-content .wp-color-result:focus:after,body .butterbean-manager .butterbean-content .wp-color-result:hover:after{border-color:#bbb}body .butterbean-manager .butterbean-content .wp-color-result:after{position:relative;padding:0 6px;line-height:32px!important;border-radius:0!important;font-size:13px!important}body .butterbean-manager .butterbean-content .wp-picker-container{width:310px}body .butterbean-manager .butterbean-content .alpha-true .wp-picker-container{width:352px}body .butterbean-manager .butterbean-content .wp-picker-container input[type=text].wp-color-picker{height:34px;line-height:normal;float:left;width:calc(100% - 67px)!important;max-width:100%}body .butterbean-manager .butterbean-content .wp-picker-container .wp-picker-input-wrap{display:none}body .butterbean-manager .butterbean-content .wp-picker-container.wp-picker-active .wp-picker-input-wrap{display:block;margin-left:7px;float:right;width:calc(100% - 159px)}body .butterbean-manager .butterbean-content .wp-picker-container input.iris-error[type="text"]{background-color:#fff;border:1px solid #ddd;box-shadow:0 1px 2px rgba(0,0,0,.07) inset;color:#333;transition:border-color 0.05s ease-in-out 0s}body .butterbean-manager .butterbean-content .wp-picker-clear{border-radius:0!important;background:#f4f2f2!important;box-shadow:none!important;transition:all 200ms ease-in-out;border:1px solid rgba(0,0,0,.05);float:right;font-size:12px;height:34px!important;width:60px!important;margin:0px!important}body .butterbean-manager .butterbean-content .wp-picker-holder{clear:both;margin:0;padding-top:4px;display:block;overflow:hidden}body .butterbean-manager .butterbean-content input.wp-picker-clear{border-radius:0!important;background:#f4f2f2!important;box-shadow:none!important;transition:all 200ms ease-in-out;border:1px solid rgba(0,0,0,.05);float:right;font-size:12px;height:34px!important;width:60px!important;margin:0px!important}body .butterbean-manager .butterbean-content .iris-picker{min-width:308px}body .butterbean-manager .butterbean-content .alpha-true .iris-picker{min-width:350px}body .butterbean-manager .butterbean-content .iris-picker .iris-square{margin-right:0}body .butterbean-manager .butterbean-content .iris-picker .iris-square{width:251px!important;height:198px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-picker-inner .iris-square-value{height:0!important;width:0!important}body .butterbean-manager .butterbean-content .iris-picker .iris-palette-container{bottom:8px}body .butterbean-manager .butterbean-content .iris-picker .iris-palette{width:19px!important;height:19px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-slider .ui-slider-handle{width:23px;border:4px solid #fff!important;border-radius:0!important;box-shadow:0 1px 2px rgba(0,0,0,.4)}body .butterbean-manager .butterbean-content .iris-picker .iris-square,body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner,body .butterbean-manager .butterbean-content .iris-picker .iris-palette{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-box-sizing:border-box}body .butterbean-manager .butterbean-content .iris-picker .iris-square,body .butterbean-manager .butterbean-content .iris-picker .iris-slider,body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner,body .butterbean-manager .butterbean-content .iris-picker .iris-palette{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}body .butterbean-manager .butterbean-content .iris-picker .iris-square-inner{border:none}body .butterbean-manager .butterbean-content .iris-picker .iris-slider{margin-left:8px!important;width:25px!important}body .butterbean-manager .butterbean-content .iris-picker .iris-alpha-slider{margin-left:17px!important}body .butterbean-manager .butterbean-content .range-wrapper:after{content:'';display:block;height:0;clear:both;visibility:hidden;zoom:1}body .butterbean-manager .butterbean-content input[type=range]{float:left;display:block;background-color:rgba(0,0,0,.1);height:5px;margin:13px 0;width:calc(100% - 130px);padding:0;cursor:pointer;-webkit-transition:background .5s;-moz-transition:background .5s;transition:background .5s;-webkit-appearance:none}body .butterbean-manager .butterbean-content input[type="range"]:focus{box-shadow:none!important;outline:none!important}body .butterbean-manager .butterbean-content input[type="range"]:hover{background-color:rgba(0,0,0,.15)}body .butterbean-manager .butterbean-content input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;background-color:#2e86b9;width:15px;height:15px;border-radius:15px;-webkit-border-radius:15px}body .butterbean-manager .butterbean-content input[type="range"]::-moz-range-track{border:inherit;background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-track{border:inherit;color:transparent;background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-fill-lower,body .butterbean-manager .butterbean-content input[type="range"]::-ms-fill-upper{background-color:transparent}body .butterbean-manager .butterbean-content input[type="range"]::-ms-tooltip{display:none}body .butterbean-manager .butterbean-content input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border:none;border-radius:15px;background-color:#2e86b9}body .butterbean-manager .butterbean-content input[type="range"]::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:15px;background-color:#2e86b9}body .butterbean-manager .butterbean-content input[type="range"]::-ms-thumb{width:15px;height:15px;border-radius:15px;border:0;background-color:#2e86b9}body .butterbean-manager .butterbean-content input.oceanwp-range-input{float:left;width:80px;height:32px;text-align:center;border-radius:4px;padding:3px;font-size:13px;margin-left:15px;color:#555;-moz-appearance:textfield}body .butterbean-manager .butterbean-content input.oceanwp-range-input::-webkit-outer-spin-button,body .butterbean-manager .butterbean-content input.oceanwp-range-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider{float:right;position:relative;margin:8px 0 0 5px;line-height:1;color:rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;-webkit-transition:all .3s ease;-moz-transition:all .3s ease;-o-transition:all .3s ease;-ms-transition:all .3s ease}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider:hover{color:#fe5252}body .butterbean-manager .butterbean-content span.oceanwp-reset-slider span{width:16px;height:16px;font-size:16px;line-height:1}body .butterbean-manager .butterbean-content .uploader input[type="text"]{width:78%}body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{float:right;width:20%;height:34px;margin:0;border-radius:0;outline:0;-webkit-box-shadow:none!important;box-shadow:none!important;vertical-align:middle}body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media:hover,body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media:focus{border-color:#bbb}@media only screen and (max-width:959px){body .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{padding:6px 4px}}@media only screen and (max-width:480px){body .butterbean-manager .butterbean-content .oceanwp-mb-desc,body .butterbean-manager .butterbean-content .oceanwp-mb-field{float:none;width:100%}body .butterbean-manager .butterbean-content .oceanwp-mb-desc{margin-bottom:15px}}body.rtl .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 180px,#fff 180px,#fff 100%)}body.rtl #side-sortables .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}body.rtl .butterbean-manager-default .butterbean-nav{float:right;border-left:1px solid #eee;border-right:0}body.rtl .butterbean-manager .butterbean-nav .dashicons{margin-left:8px;margin-right:0}body.rtl .butterbean-manager .butterbean-nav li[aria-selected=true] a{margin-left:-1px;margin-right:0}body.rtl .butterbean-manager-default .butterbean-content{float:right;margin-right:-1px;margin-left:0;border-right:1px solid #eee;border-left:0}body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-desc{float:right}body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-field{float:left}body.rtl .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow b{right:50%;left:auto;margin-right:-6px;margin-left:0}body.rtl .butterbean-manager .butterbean-content .select2-container--default .select2-selection--single .select2-selection__arrow{border-right:1px solid rgba(0,0,0,.05);border-left:0}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li{float:right}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li label{border-left:1px solid rgba(0,0,0,.1);border-right:0}body.rtl .butterbean-manager .butterbean-content .butterbean-buttonset li:last-child label{border-left:0}body.rtl .butterbean-manager .butterbean-content .wp-color-result{padding-right:34px;padding-left:0}body.rtl .butterbean-manager .butterbean-content .wp-picker-container input[type=text].wp-color-picker{float:right}body.rtl .butterbean-manager .butterbean-content .wp-picker-container.wp-picker-active .wp-picker-input-wrap{margin-right:7px;margin-left:0;float:left}body.rtl .butterbean-manager .butterbean-content .wp-picker-clear{float:left}body.rtl .butterbean-manager .butterbean-content input.wp-picker-clear{float:left}body.rtl .butterbean-manager .butterbean-content input[type=range]{float:right}body.rtl .butterbean-manager .butterbean-content input.oceanwp-range-input{float:right;margin-right:15px;margin-left:0}body.rtl .butterbean-manager .butterbean-content span.oceanwp-reset-slider{float:left;margin:8px 5px 0 0}body.rtl .butterbean-manager .butterbean-content .uploader .oceanwp-add-media{float:left}@media only screen and (max-width:480px){body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-desc,body.rtl .butterbean-manager .butterbean-content .oceanwp-mb-field{float:none;width:100%}}@media only screen and (max-width:782px),(max-width:980px) and (min-width:851px){body.rtl .butterbean-manager-default{background:linear-gradient(-90deg,#fafafa 0%,#fafafa 48px,#fff 48px,#fff 100%)}body.rtl .butterbean-manager-default .butterbean-nav .label{right:-1000em;left:auto}}@media only screen and (min-width:850px){body.rtl #side-sortables .butterbean-manager-default .butterbean-nav li{border-left:1px solid #eee;border-right:0}body.rtl #side-sortables .butterbean-manager-default .butterbean-nav li:last-of-type{border-left:none}body.rtl #side-sortables .butterbean-manager-default .butterbean-nav .label{right:-1000em;left:auto}}
includes/metabox/butterbean/css/select2.css DELETED
@@ -1,484 +0,0 @@
1
- .select2-container {
2
- box-sizing: border-box;
3
- display: inline-block;
4
- margin: 0;
5
- position: relative;
6
- vertical-align: middle; }
7
- .select2-container .select2-selection--single {
8
- box-sizing: border-box;
9
- cursor: pointer;
10
- display: block;
11
- height: 28px;
12
- user-select: none;
13
- -webkit-user-select: none; }
14
- .select2-container .select2-selection--single .select2-selection__rendered {
15
- display: block;
16
- padding-left: 8px;
17
- padding-right: 20px;
18
- overflow: hidden;
19
- text-overflow: ellipsis;
20
- white-space: nowrap; }
21
- .select2-container .select2-selection--single .select2-selection__clear {
22
- position: relative; }
23
- .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
- padding-right: 8px;
25
- padding-left: 20px; }
26
- .select2-container .select2-selection--multiple {
27
- box-sizing: border-box;
28
- cursor: pointer;
29
- display: block;
30
- min-height: 32px;
31
- user-select: none;
32
- -webkit-user-select: none; }
33
- .select2-container .select2-selection--multiple .select2-selection__rendered {
34
- display: inline-block;
35
- overflow: hidden;
36
- padding-left: 8px;
37
- text-overflow: ellipsis;
38
- white-space: nowrap; }
39
- .select2-container .select2-search--inline {
40
- float: left; }
41
- .select2-container .select2-search--inline .select2-search__field {
42
- box-sizing: border-box;
43
- border: none;
44
- font-size: 100%;
45
- margin-top: 5px;
46
- padding: 0; }
47
- .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
- -webkit-appearance: none; }
49
-
50
- .select2-dropdown {
51
- background-color: white;
52
- border: 1px solid #aaa;
53
- border-radius: 4px;
54
- box-sizing: border-box;
55
- display: block;
56
- position: absolute;
57
- left: -100000px;
58
- width: 100%;
59
- z-index: 1051; }
60
-
61
- .select2-results {
62
- display: block; }
63
-
64
- .select2-results__options {
65
- list-style: none;
66
- margin: 0;
67
- padding: 0; }
68
-
69
- .select2-results__option {
70
- padding: 6px;
71
- user-select: none;
72
- -webkit-user-select: none; }
73
- .select2-results__option[aria-selected] {
74
- cursor: pointer; }
75
-
76
- .select2-container--open .select2-dropdown {
77
- left: 0; }
78
-
79
- .select2-container--open .select2-dropdown--above {
80
- border-bottom: none;
81
- border-bottom-left-radius: 0;
82
- border-bottom-right-radius: 0; }
83
-
84
- .select2-container--open .select2-dropdown--below {
85
- border-top: none;
86
- border-top-left-radius: 0;
87
- border-top-right-radius: 0; }
88
-
89
- .select2-search--dropdown {
90
- display: block;
91
- padding: 4px; }
92
- .select2-search--dropdown .select2-search__field {
93
- padding: 4px;
94
- width: 100%;
95
- box-sizing: border-box; }
96
- .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
97
- -webkit-appearance: none; }
98
- .select2-search--dropdown.select2-search--hide {
99
- display: none; }
100
-
101
- .select2-close-mask {
102
- border: 0;
103
- margin: 0;
104
- padding: 0;
105
- display: block;
106
- position: fixed;
107
- left: 0;
108
- top: 0;
109
- min-height: 100%;
110
- min-width: 100%;
111
- height: auto;
112
- width: auto;
113
- opacity: 0;
114
- z-index: 99;
115
- background-color: #fff;
116
- filter: alpha(opacity=0); }
117
-
118
- .select2-hidden-accessible {
119
- border: 0 !important;
120
- clip: rect(0 0 0 0) !important;
121
- height: 1px !important;
122
- margin: -1px !important;
123
- overflow: hidden !important;
124
- padding: 0 !important;
125
- position: absolute !important;
126
- width: 1px !important; }
127
-
128
- .select2-container--default .select2-selection--single {
129
- background-color: #fff;
130
- border: 1px solid #aaa;
131
- border-radius: 4px; }
132
- .select2-container--default .select2-selection--single .select2-selection__rendered {
133
- color: #444;
134
- line-height: 28px; }
135
- .select2-container--default .select2-selection--single .select2-selection__clear {
136
- cursor: pointer;
137
- float: right;
138
- font-weight: bold; }
139
- .select2-container--default .select2-selection--single .select2-selection__placeholder {
140
- color: #999; }
141
- .select2-container--default .select2-selection--single .select2-selection__arrow {
142
- height: 26px;
143
- position: absolute;
144
- top: 1px;
145
- right: 1px;
146
- width: 20px; }
147
- .select2-container--default .select2-selection--single .select2-selection__arrow b {
148
- border-color: #888 transparent transparent transparent;
149
- border-style: solid;
150
- border-width: 5px 4px 0 4px;
151
- height: 0;
152
- left: 50%;
153
- margin-left: -4px;
154
- margin-top: -2px;
155
- position: absolute;
156
- top: 50%;
157
- width: 0; }
158
-
159
- .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
160
- float: left; }
161
-
162
- .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
163
- left: 1px;
164
- right: auto; }
165
-
166
- .select2-container--default.select2-container--disabled .select2-selection--single {
167
- background-color: #eee;
168
- cursor: default; }
169
- .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
170
- display: none; }
171
-
172
- .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
173
- border-color: transparent transparent #888 transparent;
174
- border-width: 0 4px 5px 4px; }
175
-
176
- .select2-container--default .select2-selection--multiple {
177
- background-color: white;
178
- border: 1px solid #aaa;
179
- border-radius: 4px;
180
- cursor: text; }
181
- .select2-container--default .select2-selection--multiple .select2-selection__rendered {
182
- box-sizing: border-box;
183
- list-style: none;
184
- margin: 0;
185
- padding: 0 5px;
186
- width: 100%; }
187
- .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
188
- list-style: none; }
189
- .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
190
- color: #999;
191
- margin-top: 5px;
192
- float: left; }
193
- .select2-container--default .select2-selection--multiple .select2-selection__clear {
194
- cursor: pointer;
195
- float: right;
196
- font-weight: bold;
197
- margin-top: 5px;
198
- margin-right: 10px; }
199
- .select2-container--default .select2-selection--multiple .select2-selection__choice {
200
- background-color: #e4e4e4;
201
- border: 1px solid #aaa;
202
- border-radius: 4px;
203
- cursor: default;
204
- float: left;
205
- margin-right: 5px;
206
- margin-top: 5px;
207
- padding: 0 5px; }
208
- .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
209
- color: #999;
210
- cursor: pointer;
211
- display: inline-block;
212
- font-weight: bold;
213
- margin-right: 2px; }
214
- .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
215
- color: #333; }
216
-
217
- .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
218
- float: right; }
219
-
220
- .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
221
- margin-left: 5px;
222
- margin-right: auto; }
223
-
224
- .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
225
- margin-left: 2px;
226
- margin-right: auto; }
227
-
228
- .select2-container--default.select2-container--focus .select2-selection--multiple {
229
- border: solid black 1px;
230
- outline: 0; }
231
-
232
- .select2-container--default.select2-container--disabled .select2-selection--multiple {
233
- background-color: #eee;
234
- cursor: default; }
235
-
236
- .select2-container--default.select2-container--disabled .select2-selection__choice__remove {
237
- display: none; }
238
-
239
- .select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
240
- border-top-left-radius: 0;
241
- border-top-right-radius: 0; }
242
-
243
- .select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
244
- border-bottom-left-radius: 0;
245
- border-bottom-right-radius: 0; }
246
-
247
- .select2-container--default .select2-search--dropdown .select2-search__field {
248
- border: 1px solid #aaa; }
249
-
250
- .select2-container--default .select2-search--inline .select2-search__field {
251
- background: transparent;
252
- border: none;
253
- outline: 0;
254
- box-shadow: none;
255
- -webkit-appearance: textfield; }
256
-
257
- .select2-container--default .select2-results > .select2-results__options {
258
- max-height: 200px;
259
- overflow-y: auto; }
260
-
261
- .select2-container--default .select2-results__option[role=group] {
262
- padding: 0; }
263
-
264
- .select2-container--default .select2-results__option[aria-disabled=true] {
265
- color: #999; }
266
-
267
- .select2-container--default .select2-results__option[aria-selected=true] {
268
- background-color: #ddd; }
269
-
270
- .select2-container--default .select2-results__option .select2-results__option {
271
- padding-left: 1em; }
272
- .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
273
- padding-left: 0; }
274
- .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
275
- margin-left: -1em;
276
- padding-left: 2em; }
277
- .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
278
- margin-left: -2em;
279
- padding-left: 3em; }
280
- .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
281
- margin-left: -3em;
282
- padding-left: 4em; }
283
- .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
284
- margin-left: -4em;
285
- padding-left: 5em; }
286
- .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
287
- margin-left: -5em;
288
- padding-left: 6em; }
289
-
290
- .select2-container--default .select2-results__option--highlighted[aria-selected] {
291
- background-color: #5897fb;
292
- color: white; }
293
-
294
- .select2-container--default .select2-results__group {
295
- cursor: default;
296
- display: block;
297
- padding: 6px; }
298
-
299
- .select2-container--classic .select2-selection--single {
300
- background-color: #f7f7f7;
301
- border: 1px solid #aaa;
302
- border-radius: 4px;
303
- outline: 0;
304
- background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
305
- background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
306
- background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
307
- background-repeat: repeat-x;
308
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
309
- .select2-container--classic .select2-selection--single:focus {
310
- border: 1px solid #5897fb; }
311
- .select2-container--classic .select2-selection--single .select2-selection__rendered {
312
- color: #444;
313
- line-height: 28px; }
314
- .select2-container--classic .select2-selection--single .select2-selection__clear {
315
- cursor: pointer;
316
- float: right;
317
- font-weight: bold;
318
- margin-right: 10px; }
319
- .select2-container--classic .select2-selection--single .select2-selection__placeholder {
320
- color: #999; }
321
- .select2-container--classic .select2-selection--single .select2-selection__arrow {
322
- background-color: #ddd;
323
- border: none;
324
- border-left: 1px solid #aaa;
325
- border-top-right-radius: 4px;
326
- border-bottom-right-radius: 4px;
327
- height: 26px;
328
- position: absolute;
329
- top: 1px;
330
- right: 1px;
331
- width: 20px;
332
- background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
333
- background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
334
- background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
335
- background-repeat: repeat-x;
336
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
337
- .select2-container--classic .select2-selection--single .select2-selection__arrow b {
338
- border-color: #888 transparent transparent transparent;
339
- border-style: solid;
340
- border-width: 5px 4px 0 4px;
341
- height: 0;
342
- left: 50%;
343
- margin-left: -4px;
344
- margin-top: -2px;
345
- position: absolute;
346
- top: 50%;
347
- width: 0; }
348
-
349
- .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
350
- float: left; }
351
-
352
- .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
353
- border: none;
354
- border-right: 1px solid #aaa;
355
- border-radius: 0;
356
- border-top-left-radius: 4px;
357
- border-bottom-left-radius: 4px;
358
- left: 1px;
359
- right: auto; }
360
-
361
- .select2-container--classic.select2-container--open .select2-selection--single {
362
- border: 1px solid #5897fb; }
363
- .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
364
- background: transparent;
365
- border: none; }
366
- .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
367
- border-color: transparent transparent #888 transparent;
368
- border-width: 0 4px 5px 4px; }
369
-
370
- .select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
371
- border-top: none;
372
- border-top-left-radius: 0;
373
- border-top-right-radius: 0;
374
- background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
375
- background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
376
- background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
377
- background-repeat: repeat-x;
378
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
379
-
380
- .select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
381
- border-bottom: none;
382
- border-bottom-left-radius: 0;
383
- border-bottom-right-radius: 0;
384
- background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
385
- background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
386
- background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
387
- background-repeat: repeat-x;
388
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
389
-
390
- .select2-container--classic .select2-selection--multiple {
391
- background-color: white;
392
- border: 1px solid #aaa;
393
- border-radius: 4px;
394
- cursor: text;
395
- outline: 0; }
396
- .select2-container--classic .select2-selection--multiple:focus {
397
- border: 1px solid #5897fb; }
398
- .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
399
- list-style: none;
400
- margin: 0;
401
- padding: 0 5px; }
402
- .select2-container--classic .select2-selection--multiple .select2-selection__clear {
403
- display: none; }
404
- .select2-container--classic .select2-selection--multiple .select2-selection__choice {
405
- background-color: #e4e4e4;
406
- border: 1px solid #aaa;
407
- border-radius: 4px;
408
- cursor: default;
409
- float: left;
410
- margin-right: 5px;
411
- margin-top: 5px;
412
- padding: 0 5px; }
413
- .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
414
- color: #888;
415
- cursor: pointer;
416
- display: inline-block;
417
- font-weight: bold;
418
- margin-right: 2px; }
419
- .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
420
- color: #555; }
421
-
422
- .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
423
- float: right; }
424
-
425
- .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
426
- margin-left: 5px;
427
- margin-right: auto; }
428
-
429
- .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
430
- margin-left: 2px;
431
- margin-right: auto; }
432
-
433
- .select2-container--classic.select2-container--open .select2-selection--multiple {
434
- border: 1px solid #5897fb; }
435
-
436
- .select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
437
- border-top: none;
438
- border-top-left-radius: 0;
439
- border-top-right-radius: 0; }
440
-
441
- .select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
442
- border-bottom: none;
443
- border-bottom-left-radius: 0;
444
- border-bottom-right-radius: 0; }
445
-
446
- .select2-container--classic .select2-search--dropdown .select2-search__field {
447
- border: 1px solid #aaa;
448
- outline: 0; }
449
-
450
- .select2-container--classic .select2-search--inline .select2-search__field {
451
- outline: 0;
452
- box-shadow: none; }
453
-
454
- .select2-container--classic .select2-dropdown {
455
- background-color: white;
456
- border: 1px solid transparent; }
457
-
458
- .select2-container--classic .select2-dropdown--above {
459
- border-bottom: none; }
460
-
461
- .select2-container--classic .select2-dropdown--below {
462
- border-top: none; }
463
-
464
- .select2-container--classic .select2-results > .select2-results__options {
465
- max-height: 200px;
466
- overflow-y: auto; }
467
-
468
- .select2-container--classic .select2-results__option[role=group] {
469
- padding: 0; }
470
-
471
- .select2-container--classic .select2-results__option[aria-disabled=true] {
472
- color: grey; }
473
-
474
- .select2-container--classic .select2-results__option--highlighted[aria-selected] {
475
- background-color: #3875d7;
476
- color: white; }
477
-
478
- .select2-container--classic .select2-results__group {
479
- cursor: default;
480
- display: block;
481
- padding: 6px; }
482
-
483
- .select2-container--classic.select2-container--open .select2-dropdown {
484
- border-color: #5897fb; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/metabox/butterbean/css/select2.min.css DELETED
@@ -1 +0,0 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
 
includes/metabox/butterbean/css/selectize.css ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * selectize.css (v0.12.4)
3
+ * Copyright (c) 2013–2015 Brian Reavis & contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ * @author Brian Reavis <brian@thirdroute.com>
15
+ */
16
+
17
+ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
18
+ visibility: visible !important;
19
+ background: #f2f2f2 !important;
20
+ background: rgba(0, 0, 0, 0.06) !important;
21
+ border: 0 none !important;
22
+ -webkit-box-shadow: inset 0 0 12px 4px #ffffff;
23
+ box-shadow: inset 0 0 12px 4px #ffffff;
24
+ }
25
+ .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
26
+ content: '!';
27
+ visibility: hidden;
28
+ }
29
+ .selectize-control.plugin-drag_drop .ui-sortable-helper {
30
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
31
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
32
+ }
33
+ .selectize-dropdown-header {
34
+ position: relative;
35
+ padding: 5px 8px;
36
+ border-bottom: 1px solid #d0d0d0;
37
+ background: #f8f8f8;
38
+ -webkit-border-radius: 3px 3px 0 0;
39
+ -moz-border-radius: 3px 3px 0 0;
40
+ border-radius: 3px 3px 0 0;
41
+ }
42
+ .selectize-dropdown-header-close {
43
+ position: absolute;
44
+ right: 8px;
45
+ top: 50%;
46
+ color: #303030;
47
+ opacity: 0.4;
48
+ margin-top: -12px;
49
+ line-height: 20px;
50
+ font-size: 20px !important;
51
+ }
52
+ .selectize-dropdown-header-close:hover {
53
+ color: #000000;
54
+ }
55
+ .selectize-dropdown.plugin-optgroup_columns .optgroup {
56
+ border-right: 1px solid #f2f2f2;
57
+ border-top: 0 none;
58
+ float: left;
59
+ -webkit-box-sizing: border-box;
60
+ -moz-box-sizing: border-box;
61
+ box-sizing: border-box;
62
+ }
63
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
64
+ border-right: 0 none;
65
+ }
66
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:before {
67
+ display: none;
68
+ }
69
+ .selectize-dropdown.plugin-optgroup_columns .optgroup-header {
70
+ border-top: 0 none;
71
+ }
72
+ .selectize-control.plugin-remove_button [data-value] {
73
+ position: relative;
74
+ padding-right: 24px !important;
75
+ }
76
+ .selectize-control.plugin-remove_button [data-value] .remove {
77
+ z-index: 1;
78
+ /* fixes ie bug (see #392) */
79
+ position: absolute;
80
+ top: 0;
81
+ right: 0;
82
+ bottom: 0;
83
+ width: 17px;
84
+ text-align: center;
85
+ font-weight: bold;
86
+ font-size: 12px;
87
+ color: inherit;
88
+ text-decoration: none;
89
+ vertical-align: middle;
90
+ display: inline-block;
91
+ padding: 2px 0 0 0;
92
+ border-left: 1px solid #d0d0d0;
93
+ -webkit-border-radius: 0 2px 2px 0;
94
+ -moz-border-radius: 0 2px 2px 0;
95
+ border-radius: 0 2px 2px 0;
96
+ -webkit-box-sizing: border-box;
97
+ -moz-box-sizing: border-box;
98
+ box-sizing: border-box;
99
+ }
100
+ .selectize-control.plugin-remove_button [data-value] .remove:hover {
101
+ background: rgba(0, 0, 0, 0.05);
102
+ }
103
+ .selectize-control.plugin-remove_button [data-value].active .remove {
104
+ border-left-color: #cacaca;
105
+ }
106
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
107
+ background: none;
108
+ }
109
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove {
110
+ border-left-color: #ffffff;
111
+ }
112
+ .selectize-control.plugin-remove_button .remove-single {
113
+ position: absolute;
114
+ right: 28px;
115
+ top: 6px;
116
+ font-size: 23px;
117
+ }
118
+ .selectize-control {
119
+ position: relative;
120
+ }
121
+ .selectize-dropdown,
122
+ .selectize-input,
123
+ .selectize-input input {
124
+ color: #303030;
125
+ font-family: inherit;
126
+ font-size: 13px;
127
+ line-height: 30px;
128
+ -webkit-font-smoothing: inherit;
129
+ }
130
+ .selectize-input,
131
+ .selectize-control.single .selectize-input.input-active {
132
+ cursor: text;
133
+ display: inline-block;
134
+ }
135
+ .selectize-input {
136
+ background-color: #f5f5f5;
137
+ border: 1px solid rgba(0,0,0,.05);
138
+ padding: 0 12px;
139
+ display: inline-block;
140
+ width: 100%;
141
+ overflow: hidden;
142
+ position: relative;
143
+ height: 34px;
144
+ z-index: 1;
145
+ -webkit-box-sizing: border-box;
146
+ -moz-box-sizing: border-box;
147
+ box-sizing: border-box;
148
+ -webkit-border-radius: 0;
149
+ -moz-border-radius: 0;
150
+ border-radius: 0;
151
+ outline: none;
152
+ }
153
+ .selectize-control.multi .selectize-input.has-items {
154
+ padding: 6px 8px 3px;
155
+ }
156
+ .selectize-input.disabled,
157
+ .selectize-input.disabled * {
158
+ cursor: default !important;
159
+ }
160
+ .selectize-input > * {
161
+ vertical-align: baseline;
162
+ display: -moz-inline-stack;
163
+ display: inline-block;
164
+ zoom: 1;
165
+ *display: inline;
166
+ }
167
+ .selectize-control.multi .selectize-input > div {
168
+ cursor: pointer;
169
+ margin: 0 3px 3px 0;
170
+ padding: 2px 6px;
171
+ background: #f2f2f2;
172
+ color: #303030;
173
+ border: 0 solid #d0d0d0;
174
+ }
175
+ .selectize-control.multi .selectize-input > div.active {
176
+ background: #e8e8e8;
177
+ color: #303030;
178
+ border: 0 solid #cacaca;
179
+ }
180
+ .selectize-control.multi .selectize-input.disabled > div,
181
+ .selectize-control.multi .selectize-input.disabled > div.active {
182
+ color: #7d7d7d;
183
+ background: #ffffff;
184
+ border: 0 solid #ffffff;
185
+ }
186
+ .selectize-input > input {
187
+ display: inline-block !important;
188
+ padding: 0 !important;
189
+ max-width: 100% !important;
190
+ border: 0 none !important;
191
+ }
192
+ .selectize-input > input::-ms-clear {
193
+ display: none;
194
+ }
195
+ .selectize-input > input:focus {
196
+ outline: none !important;
197
+ }
198
+ .selectize-input::after {
199
+ content: ' ';
200
+ display: block;
201
+ clear: left;
202
+ }
203
+ .selectize-input.dropdown-active::before {
204
+ content: ' ';
205
+ display: block;
206
+ position: absolute;
207
+ background: #f0f0f0;
208
+ height: 1px;
209
+ bottom: 0;
210
+ left: 0;
211
+ right: 0;
212
+ }
213
+ .selectize-dropdown {
214
+ position: absolute;
215
+ background-color: #f5f5f5;
216
+ margin-top: -1px;
217
+ border: 1px solid rgba(0,0,0,.05);
218
+ -webkit-box-sizing: border-box;
219
+ -moz-box-sizing: border-box;
220
+ box-sizing: border-box;
221
+ z-index: 10000;
222
+ }
223
+ .selectize-dropdown [data-selectable] {
224
+ cursor: pointer;
225
+ overflow: hidden;
226
+ }
227
+ .selectize-dropdown [data-selectable] .highlight {
228
+ background: rgba(125, 168, 208, 0.2);
229
+ -webkit-border-radius: 1px;
230
+ -moz-border-radius: 1px;
231
+ border-radius: 1px;
232
+ }
233
+ .selectize-dropdown [data-selectable],
234
+ .selectize-dropdown .optgroup-header {
235
+ padding: 2px 8px;
236
+ margin-bottom: 6px;
237
+ }
238
+ .selectize-dropdown [data-selectable]:last-child {
239
+ margin-bottom: 0;
240
+ }
241
+ .selectize-dropdown .optgroup-header {
242
+ color: #303030;
243
+ background: #ffffff;
244
+ cursor: default;
245
+ }
246
+ .selectize-dropdown .active {
247
+ background-color: #5897fb;
248
+ color: #fff;
249
+ }
250
+ .selectize-dropdown .active.create {
251
+ color: #495c68;
252
+ }
253
+ .selectize-dropdown .create {
254
+ color: rgba(48, 48, 48, 0.5);
255
+ }
256
+ .selectize-dropdown-content {
257
+ overflow-y: auto;
258
+ overflow-x: hidden;
259
+ max-height: 200px;
260
+ -webkit-overflow-scrolling: touch;
261
+ }
262
+ .selectize-control.single .selectize-input,
263
+ .selectize-control.single .selectize-input input {
264
+ cursor: pointer;
265
+ line-height: 34px;
266
+ }
267
+ .selectize-control.single .selectize-input.input-active,
268
+ .selectize-control.single .selectize-input.input-active input {
269
+ cursor: text;
270
+ }
271
+ .selectize-control.single .selectize-input:before {
272
+ content: '';
273
+ position: absolute;
274
+ right: 32px;
275
+ width: 1px;
276
+ height: 100%;
277
+ background-color: rgba(0,0,0,.05);
278
+ }
279
+ .selectize-control.rtl.single .selectize-input:before {
280
+ left: 32px;
281
+ right: auto;
282
+ }
283
+ .selectize-control.single .selectize-input:after {
284
+ content: '\f347';
285
+ font-family: 'dashicons';
286
+ position: absolute;
287
+ top: 50%;
288
+ right: 0;
289
+ margin-top: -6px;
290
+ width: 32px;
291
+ font-size: 12px;
292
+ line-height: 1;
293
+ color: #777;
294
+ text-align: center;
295
+ transition: all .3s ease;
296
+ -webkit-transition: all .3s ease;
297
+ -moz-transition: all .3s ease;
298
+ -o-transition: all .3s ease;
299
+ -ms-transition: all .3s ease;
300
+ }
301
+ .selectize-control.single .selectize-input.dropdown-active:after {
302
+ -ms-transform: rotate(180deg);
303
+ -webkit-transform: rotate(180deg);
304
+ transform: rotate(180deg);
305
+ }
306
+ .selectize-control.rtl.single .selectize-input:after {
307
+ left: 0;
308
+ right: auto;
309
+ }
310
+ .selectize-control.rtl .selectize-input > input {
311
+ margin: 0 4px 0 -2px !important;
312
+ }
313
+ .selectize-control .selectize-input.disabled {
314
+ opacity: 0.5;
315
+ background-color: #fafafa;
316
+ }
includes/metabox/butterbean/css/selectize.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible!important;background:#f2f2f2!important;background:rgba(0,0,0,.06)!important;border:0 none!important;-webkit-box-shadow:inset 0 0 12px 4px #fff;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:'!';visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.2);box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-dropdown-header{position:relative;padding:5px 8px;border-bottom:1px solid #d0d0d0;background:#f8f8f8;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.selectize-dropdown-header-close{position:absolute;right:8px;top:50%;color:#303030;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px!important}.selectize-dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button [data-value]{position:relative;padding-right:24px!important}.selectize-control.plugin-remove_button [data-value] .remove{z-index:1;position:absolute;top:0;right:0;bottom:0;width:17px;text-align:center;font-weight:700;font-size:12px;color:inherit;text-decoration:none;vertical-align:middle;display:inline-block;padding:2px 0 0 0;border-left:1px solid #d0d0d0;-webkit-border-radius:0 2px 2px 0;-moz-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.selectize-control.plugin-remove_button [data-value] .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button [data-value].active .remove{border-left-color:#cacaca}.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover{background:none}.selectize-control.plugin-remove_button .disabled [data-value] .remove{border-left-color:#fff}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:28px;top:6px;font-size:23px}.selectize-control{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#303030;font-family:inherit;font-size:13px;line-height:30px;-webkit-font-smoothing:inherit}.selectize-input,.selectize-control.single .selectize-input.input-active{cursor:text;display:inline-block}.selectize-input{background-color:#f5f5f5;border:1px solid rgba(0,0,0,.05);padding:0 12px;display:inline-block;width:100%;overflow:hidden;position:relative;height:34px;z-index:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;outline:none}.selectize-control.multi .selectize-input.has-items{padding:6px 8px 3px}.selectize-input.disabled,.selectize-input.disabled *{cursor:default!important}.selectize-input>*{vertical-align:baseline;display:-moz-inline-stack;display:inline-block;zoom:1;*display:inline}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:2px 6px;background:#f2f2f2;color:#303030;border:0 solid #d0d0d0}.selectize-control.multi .selectize-input>div.active{background:#e8e8e8;color:#303030;border:0 solid #cacaca}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:#7d7d7d;background:#fff;border:0 solid #fff}.selectize-input>input{display:inline-block!important;padding:0!important;max-width:100%!important;border:0 none!important}.selectize-input>input::-ms-clear{display:none}.selectize-input>input:focus{outline:none!important}.selectize-input::after{content:' ';display:block;clear:left}.selectize-input.dropdown-active::before{content:' ';display:block;position:absolute;background:#f0f0f0;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;background-color:#f5f5f5;margin-top:-1px;border:1px solid rgba(0,0,0,.05);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;z-index:10000}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(125,168,208,.2);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px}.selectize-dropdown [data-selectable],.selectize-dropdown .optgroup-header{padding:2px 8px;margin-bottom:6px}.selectize-dropdown [data-selectable]:last-child{margin-bottom:0}.selectize-dropdown .optgroup-header{color:#303030;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#5897fb;color:#fff}.selectize-dropdown .active.create{color:#495c68}.selectize-dropdown .create{color:rgba(48,48,48,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;-webkit-overflow-scrolling:touch}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer;line-height:34px}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:before{content:'';position:absolute;right:32px;width:1px;height:100%;background-color:rgba(0,0,0,.05)}.selectize-control.rtl.single .selectize-input:before{left:32px;right:auto}.selectize-control.single .selectize-input:after{content:'\f347';font-family:'dashicons';position:absolute;top:50%;right:0;margin-top:-6px;width:32px;font-size:12px;line-height:1;color:#777;text-align:center;transition:all .3s ease;-webkit-transition:all .3s ease;-moz-transition:all .3s ease;-o-transition:all .3s ease;-ms-transition:all .3s ease}.selectize-control.single .selectize-input.dropdown-active:after{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.selectize-control.rtl.single .selectize-input:after{left:0;right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px!important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fafafa}
includes/metabox/butterbean/js/butterbean.js CHANGED
@@ -955,8 +955,8 @@ window.butterbean = window.butterbean || {};
955
 
956
  ready : function() {
957
 
958
- jQuery( this.$el ).find( '.butterbean-select' ).oceanwpSelect2( {
959
- minimumResultsForSearch: 10
960
  } );
961
  }
962
  } );
955
 
956
  ready : function() {
957
 
958
+ jQuery( this.$el ).find( '.butterbean-select' ).selectize( {
959
+ allowEmptyOption: true,
960
  } );
961
  }
962
  } );
includes/metabox/butterbean/js/butterbean.min.js CHANGED
@@ -1 +1 @@
1
- window.butterbean=window.butterbean||{},function(){if(!_.isUndefined(butterbean_data)){var a=butterbean={models:{managers:{},sections:{},controls:{}},views:{managers:{},sections:{},controls:{}},templates:{managers:{},sections:{},controls:{}}};a.models.register_manager=function(a,b){this.managers[a]=new c(b)},a.models.get_manager=function(a){return!!this.manager_exists(a)&&this.managers[a]},a.models.unregister_manager=function(a){this.manager_exists(a)&&delete this.managers[a]},a.models.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.models.register_section=function(a,b){this.sections[a]=new d(b)},a.models.get_section=function(a){return!!this.section_exists(a)&&this.sections[a]},a.models.unregister_section=function(a){this.section_exists(a)&&delete this.sections[a]},a.models.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.models.register_control=function(a,b){this.controls[a]=new e(b)},a.models.get_control=function(a){return!!this.control_exists(a)&&this.controls[a]},a.models.unregister_control=function(a){this.control_exists(a)&&delete this.controls[a]},a.models.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.views.register_manager=function(a,b){"default"!==a&&(this.managers[a]=this.managers.default.extend(b))},a.views.get_manager=function(a){return this.manager_exists(a)?this.managers[a]:this.managers.default},a.views.unregister_manager=function(a){"default"!==a&&this.manager_exists(a)&&delete this.managers[a]},a.views.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.views.register_section=function(a,b){"default"!==a&&(this.sections[a]=this.sections.default.extend(b))},a.views.get_section=function(a){return this.section_exists(a)?this.sections[a]:this.sections.default},a.views.unregister_section=function(a){"default"!==a&&this.section_exists(a)&&delete this.sections[a]},a.views.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.views.register_control=function(a,b){"default"!==a&&(this.controls[a]=this.controls.default.extend(b))},a.views.get_control=function(a){return this.control_exists(a)?this.controls[a]:this.controls.default},a.views.unregister_control=function(a){"default"!==a&&this.control_exists(a)&&delete this.controls[a]},a.views.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.templates.register_manager=function(a){this.managers[a]=wp.template("butterbean-manager-"+a)},a.templates.get_manager=function(a){return!!this.manager_exists(a)&&this.managers[a]},a.templates.unregister_manager=function(a){this.manager_exists(a)&&delete this.managers[a]},a.templates.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.templates.register_section=function(a){this.sections[a]=wp.template("butterbean-section-"+a)},a.templates.get_section=function(a){return!!this.section_exists(a)&&this.sections[a]},a.templates.unregister_section=function(a){this.section_exists(a)&&delete this.sections[a]},a.templates.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.templates.register_control=function(a){this.controls[a]=wp.template("butterbean-control-"+a)},a.templates.get_control=function(a){return!!this.control_exists(a)&&this.controls[a]},a.templates.unregister_control=function(a){this.control_exists(a)&&delete this.controls[a]},a.templates.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.render=function(){_.each(butterbean_data.managers,function(b){a.models.register_manager(b.name,b);var c=a.models.get_manager(b.name),d=a.views.get_manager(c.get("type")),e=new d({model:c}),f=document.getElementById("butterbean-ui-"+c.get("name"));f.className+=" butterbean-ui",f.querySelector(".inside").appendChild(e.render().el),e.subview_render(),e.ready()})};var b=wp.template("butterbean-nav"),c=Backbone.Model.extend({defaults:{name:"",type:"",sections:{},controls:{}}}),d=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",manager:"",active:"",selected:!1}}),e=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",value:"",choices:{},attr:"",active:"",manager:"",section:"",setting:""}}),f=Backbone.Collection.extend({model:d});a.views.managers.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-manager-"+this.model.get("name"),class:"butterbean-manager butterbean-manager-"+this.model.get("type")}},initialize:function(){var b=this.model.get("type");a.templates.manager_exists(b)||a.templates.register_manager(b),this.template=a.templates.get_manager(b)},render:function(){return this.el.innerHTML=this.template(this.model.toJSON()),this},subview_render:function(){var b=new f;return _.each(this.model.get("sections"),function(c){a.models.register_section(c.name,c),b.add(a.models.get_section(c.name))}),b.forEach(function(b,c){var d=new g({model:b});document.querySelector("#butterbean-ui-"+b.get("manager")+" .butterbean-nav").appendChild(d.render().el);var e=a.views.get_section(b.get("type")),f=new e({model:b});document.querySelector("#butterbean-ui-"+b.get("manager")+" .butterbean-content").appendChild(f.render().el),f.ready(),b.set("selected",0===c)},this),_.each(this.model.get("controls"),function(b){a.models.register_control(b.name,b);var c=a.models.get_control(b.name),d=a.views.get_control(c.get("type")),e=new d({model:c});document.getElementById("butterbean-"+c.get("manager")+"-section-"+c.get("section")).appendChild(e.render().el),e.ready()}),this},ready:function(){}}),a.views.sections.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-"+this.model.get("manager")+"-section-"+this.model.get("name"),class:"butterbean-section butterbean-section-"+this.model.get("type"),"aria-hidden":!this.model.get("selected")}},initialize:function(){this.model.on("change",this.onchange,this);var b=this.model.get("type");a.templates.section_exists(b)||a.templates.register_section(b),this.template=a.templates.get_section(b)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},onchange:function(){this.el.setAttribute("aria-hidden",!this.model.get("selected"))},ready:function(){}});var g=Backbone.View.extend({template:b,tagName:"li",attributes:function(){return{"aria-selected":this.model.get("selected")}},initialize:function(){this.model.on("change",this.render,this),this.model.on("change",this.onchange,this)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},events:{"click a":"onselect"},onchange:function(){this.el.setAttribute("aria-selected",this.model.get("selected"))},onselect:function(a){a.preventDefault(),_.each(this.model.collection.models,function(a){a.set("selected",!1)},this),this.model.set("selected",!0)}});a.views.controls.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-control-"+this.model.get("name"),class:"butterbean-control butterbean-control-"+this.model.get("type")}},initialize:function(){var b=this.model.get("type");a.templates.control_exists(b)||a.templates.register_control(b),this.template=a.templates.get_control(b),_.bindAll(this,"render"),this.model.bind("change",this.render)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},ready:function(){}}),a.views.register_control("select",{ready:function(){jQuery(this.$el).find(".butterbean-select").oceanwpSelect2({minimumResultsForSearch:10})}}),a.views.register_control("editor",{ready:function(){"undefined"!=typeof tinyMCE&&tinyMCE.execCommand("mceAddEditor",!0,this.model.get("field_name"))}}),a.views.register_control("color",{ready:function(){var a=this.model.attributes.options;jQuery(this.$el).find(".butterbean-color-picker").wpColorPicker(a)}}),a.views.register_control("range",{ready:function(){function b(b,c){var d=b,e=d.parent().find('input[type="range"]'),f=parseFloat(d.val()),g=parseFloat(e.attr("data-reset_value")),h=parseFloat(d.attr("step")),i=parseFloat(d.attr("min")),j=parseFloat(d.attr("max"));clearTimeout(a),a=setTimeout(function(){return isNaN(f)?(d.val(g),void e.val(g).trigger("change")):(h>=1&&f%1!==0&&(f=Math.round(f),d.val(f),e.val(f)),f>j&&(d.val(j),e.val(j).trigger("change")),void(f<i&&(d.val(i),e.val(i).trigger("change"))))},c),e.val(f).trigger("change")}jQuery("input[type=range]").on("mousedown",function(){range=jQuery(this),range_input=range.parent().children(".oceanwp-range-input"),value=range.attr("value"),range_input.val(value),range.mousemove(function(){value=range.attr("value"),range_input.val(value)})});var a;jQuery("input.oceanwp-range-input").on("change keyup",function(){b(jQuery(this),1e3)}).on("focusout",function(){b(jQuery(this),0)}),jQuery(".oceanwp-reset-slider").on("click",function(){this_input=jQuery(this).parent().find("input"),input_default=this_input.data("reset_value"),this_input.val(input_default),this_input.change()})}}),a.views.register_control("media",{events:{"click .oceanwp-add-media":"showmodal"},showmodal:function(){return _.isUndefined(this.media_modal)?(this.media_modal=wp.media({frame:"select",multiple:!1,editing:!0}),this.media_modal.on("select",function(){var a=this.media_modal.state().get("selection").first().toJSON();this.model.set({value:a.url})},this),void this.media_modal.open()):void this.media_modal.open()}}),a.views.register_control("image",{events:{"click .butterbean-add-media":"showmodal","click .butterbean-change-media":"showmodal","click .butterbean-remove-media":"removemedia"},showmodal:function(){return _.isUndefined(this.media_modal)?(this.media_modal=wp.media({frame:"select",multiple:!1,editing:!0,title:this.model.get("l10n").choose,library:{type:"image"},button:{text:this.model.get("l10n").set}}),this.media_modal.on("select",function(){var a=this.media_modal.state().get("selection").first().toJSON(),b=this.model.attributes.size;this.model.set({src:a.sizes[b]?a.sizes[b].url:a.url,alt:a.alt,value:a.id})},this),void this.media_modal.open()):void this.media_modal.open()},removemedia:function(){this.model.set({src:"",alt:"",value:""})}})}}();
1
+ window.butterbean=window.butterbean||{},function(){if(!_.isUndefined(butterbean_data)){var a=butterbean={models:{managers:{},sections:{},controls:{}},views:{managers:{},sections:{},controls:{}},templates:{managers:{},sections:{},controls:{}}};a.models.register_manager=function(a,b){this.managers[a]=new c(b)},a.models.get_manager=function(a){return!!this.manager_exists(a)&&this.managers[a]},a.models.unregister_manager=function(a){this.manager_exists(a)&&delete this.managers[a]},a.models.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.models.register_section=function(a,b){this.sections[a]=new d(b)},a.models.get_section=function(a){return!!this.section_exists(a)&&this.sections[a]},a.models.unregister_section=function(a){this.section_exists(a)&&delete this.sections[a]},a.models.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.models.register_control=function(a,b){this.controls[a]=new e(b)},a.models.get_control=function(a){return!!this.control_exists(a)&&this.controls[a]},a.models.unregister_control=function(a){this.control_exists(a)&&delete this.controls[a]},a.models.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.views.register_manager=function(a,b){"default"!==a&&(this.managers[a]=this.managers.default.extend(b))},a.views.get_manager=function(a){return this.manager_exists(a)?this.managers[a]:this.managers.default},a.views.unregister_manager=function(a){"default"!==a&&this.manager_exists(a)&&delete this.managers[a]},a.views.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.views.register_section=function(a,b){"default"!==a&&(this.sections[a]=this.sections.default.extend(b))},a.views.get_section=function(a){return this.section_exists(a)?this.sections[a]:this.sections.default},a.views.unregister_section=function(a){"default"!==a&&this.section_exists(a)&&delete this.sections[a]},a.views.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.views.register_control=function(a,b){"default"!==a&&(this.controls[a]=this.controls.default.extend(b))},a.views.get_control=function(a){return this.control_exists(a)?this.controls[a]:this.controls.default},a.views.unregister_control=function(a){"default"!==a&&this.control_exists(a)&&delete this.controls[a]},a.views.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.templates.register_manager=function(a){this.managers[a]=wp.template("butterbean-manager-"+a)},a.templates.get_manager=function(a){return!!this.manager_exists(a)&&this.managers[a]},a.templates.unregister_manager=function(a){this.manager_exists(a)&&delete this.managers[a]},a.templates.manager_exists=function(a){return this.managers.hasOwnProperty(a)},a.templates.register_section=function(a){this.sections[a]=wp.template("butterbean-section-"+a)},a.templates.get_section=function(a){return!!this.section_exists(a)&&this.sections[a]},a.templates.unregister_section=function(a){this.section_exists(a)&&delete this.sections[a]},a.templates.section_exists=function(a){return this.sections.hasOwnProperty(a)},a.templates.register_control=function(a){this.controls[a]=wp.template("butterbean-control-"+a)},a.templates.get_control=function(a){return!!this.control_exists(a)&&this.controls[a]},a.templates.unregister_control=function(a){this.control_exists(a)&&delete this.controls[a]},a.templates.control_exists=function(a){return this.controls.hasOwnProperty(a)},a.render=function(){_.each(butterbean_data.managers,function(b){a.models.register_manager(b.name,b);var c=a.models.get_manager(b.name),d=a.views.get_manager(c.get("type")),e=new d({model:c}),f=document.getElementById("butterbean-ui-"+c.get("name"));f.className+=" butterbean-ui",f.querySelector(".inside").appendChild(e.render().el),e.subview_render(),e.ready()})};var b=wp.template("butterbean-nav"),c=Backbone.Model.extend({defaults:{name:"",type:"",sections:{},controls:{}}}),d=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",manager:"",active:"",selected:!1}}),e=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",value:"",choices:{},attr:"",active:"",manager:"",section:"",setting:""}}),f=Backbone.Collection.extend({model:d});a.views.managers.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-manager-"+this.model.get("name"),class:"butterbean-manager butterbean-manager-"+this.model.get("type")}},initialize:function(){var b=this.model.get("type");a.templates.manager_exists(b)||a.templates.register_manager(b),this.template=a.templates.get_manager(b)},render:function(){return this.el.innerHTML=this.template(this.model.toJSON()),this},subview_render:function(){var b=new f;return _.each(this.model.get("sections"),function(c){a.models.register_section(c.name,c),b.add(a.models.get_section(c.name))}),b.forEach(function(b,c){var d=new g({model:b});document.querySelector("#butterbean-ui-"+b.get("manager")+" .butterbean-nav").appendChild(d.render().el);var e=a.views.get_section(b.get("type")),f=new e({model:b});document.querySelector("#butterbean-ui-"+b.get("manager")+" .butterbean-content").appendChild(f.render().el),f.ready(),b.set("selected",0===c)},this),_.each(this.model.get("controls"),function(b){a.models.register_control(b.name,b);var c=a.models.get_control(b.name),d=a.views.get_control(c.get("type")),e=new d({model:c});document.getElementById("butterbean-"+c.get("manager")+"-section-"+c.get("section")).appendChild(e.render().el),e.ready()}),this},ready:function(){}}),a.views.sections.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-"+this.model.get("manager")+"-section-"+this.model.get("name"),class:"butterbean-section butterbean-section-"+this.model.get("type"),"aria-hidden":!this.model.get("selected")}},initialize:function(){this.model.on("change",this.onchange,this);var b=this.model.get("type");a.templates.section_exists(b)||a.templates.register_section(b),this.template=a.templates.get_section(b)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},onchange:function(){this.el.setAttribute("aria-hidden",!this.model.get("selected"))},ready:function(){}});var g=Backbone.View.extend({template:b,tagName:"li",attributes:function(){return{"aria-selected":this.model.get("selected")}},initialize:function(){this.model.on("change",this.render,this),this.model.on("change",this.onchange,this)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},events:{"click a":"onselect"},onchange:function(){this.el.setAttribute("aria-selected",this.model.get("selected"))},onselect:function(a){a.preventDefault(),_.each(this.model.collection.models,function(a){a.set("selected",!1)},this),this.model.set("selected",!0)}});a.views.controls.default=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-control-"+this.model.get("name"),class:"butterbean-control butterbean-control-"+this.model.get("type")}},initialize:function(){var b=this.model.get("type");a.templates.control_exists(b)||a.templates.register_control(b),this.template=a.templates.get_control(b),_.bindAll(this,"render"),this.model.bind("change",this.render)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},ready:function(){}}),a.views.register_control("select",{ready:function(){jQuery(this.$el).find(".butterbean-select").selectize({allowEmptyOption:!0})}}),a.views.register_control("editor",{ready:function(){"undefined"!=typeof tinyMCE&&tinyMCE.execCommand("mceAddEditor",!0,this.model.get("field_name"))}}),a.views.register_control("color",{ready:function(){var a=this.model.attributes.options;jQuery(this.$el).find(".butterbean-color-picker").wpColorPicker(a)}}),a.views.register_control("range",{ready:function(){function b(b,c){var d=b,e=d.parent().find('input[type="range"]'),f=parseFloat(d.val()),g=parseFloat(e.attr("data-reset_value")),h=parseFloat(d.attr("step")),i=parseFloat(d.attr("min")),j=parseFloat(d.attr("max"));clearTimeout(a),a=setTimeout(function(){return isNaN(f)?(d.val(g),void e.val(g).trigger("change")):(h>=1&&f%1!==0&&(f=Math.round(f),d.val(f),e.val(f)),f>j&&(d.val(j),e.val(j).trigger("change")),void(f<i&&(d.val(i),e.val(i).trigger("change"))))},c),e.val(f).trigger("change")}jQuery("input[type=range]").on("mousedown",function(){range=jQuery(this),range_input=range.parent().children(".oceanwp-range-input"),value=range.attr("value"),range_input.val(value),range.mousemove(function(){value=range.attr("value"),range_input.val(value)})});var a;jQuery("input.oceanwp-range-input").on("change keyup",function(){b(jQuery(this),1e3)}).on("focusout",function(){b(jQuery(this),0)}),jQuery(".oceanwp-reset-slider").on("click",function(){this_input=jQuery(this).parent().find("input"),input_default=this_input.data("reset_value"),this_input.val(input_default),this_input.change()})}}),a.views.register_control("media",{events:{"click .oceanwp-add-media":"showmodal"},showmodal:function(){return _.isUndefined(this.media_modal)?(this.media_modal=wp.media({frame:"select",multiple:!1,editing:!0}),this.media_modal.on("select",function(){var a=this.media_modal.state().get("selection").first().toJSON();this.model.set({value:a.url})},this),void this.media_modal.open()):void this.media_modal.open()}}),a.views.register_control("image",{events:{"click .butterbean-add-media":"showmodal","click .butterbean-change-media":"showmodal","click .butterbean-remove-media":"removemedia"},showmodal:function(){return _.isUndefined(this.media_modal)?(this.media_modal=wp.media({frame:"select",multiple:!1,editing:!0,title:this.model.get("l10n").choose,library:{type:"image"},button:{text:this.model.get("l10n").set}}),this.media_modal.on("select",function(){var a=this.media_modal.state().get("selection").first().toJSON(),b=this.model.attributes.size;this.model.set({src:a.sizes[b]?a.sizes[b].url:a.url,alt:a.alt,value:a.id})},this),void this.media_modal.open()):void this.media_modal.open()},removemedia:function(){this.model.set({src:"",alt:"",value:""})}})}}();
includes/metabox/butterbean/js/select2.js DELETED
@@ -1,6454 +0,0 @@
1
- /*!
2
- * Select2 4.0.3
3
- * https://select2.github.io
4
- *
5
- * Released under the MIT license
6
- * https://github.com/select2/select2/blob/master/LICENSE.md
7
- */
8
- (function (factory) {
9
- if (typeof define === 'function' && define.amd) {
10
- // AMD. Register as an anonymous module.
11
- define(['jquery'], factory);
12
- } else if (typeof module === 'object' && module.exports) {
13
- // Node/CommonJS
14
- module.exports = function (root, jQuery) {
15
- if (jQuery === undefined) {
16
- // require('jQuery') returns a factory that requires window to
17
- // build a jQuery instance, we normalize how we use modules
18
- // that require this pattern but the window provided is a noop
19
- // if it's defined (how jquery works)
20
- if (typeof window !== 'undefined') {
21
- jQuery = require('jquery');
22
- }
23
- else {
24
- jQuery = require('jquery')(root);
25
- }
26
- }
27
- factory(jQuery);
28
- return jQuery;
29
- };
30
- } else {
31
- // Browser globals
32
- factory(jQuery);
33
- }
34
- jQuery.fn.oceanwpSelect2 = jQuery.fn.select2;
35
- } (function (jQuery) {
36
- // This is needed so we can catch the AMD loader configuration and use it
37
- // The inner file should be wrapped (by `banner.start.js`) in a function that
38
- // returns the AMD loader references.
39
- var S2 =(function () {
40
- // Restore the Select2 AMD loader so it can be used
41
- // Needed mostly in the language files, where the loader is not inserted
42
- if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
43
- var S2 = jQuery.fn.select2.amd;
44
- }
45
- var S2;(function () { if (!S2 || !S2.requirejs) {
46
- if (!S2) { S2 = {}; } else { require = S2; }
47
- /**
48
- * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
49
- * Available via the MIT or new BSD license.
50
- * see: http://github.com/jrburke/almond for details
51
- */
52
- //Going sloppy to avoid 'use strict' string cost, but strict practices should
53
- //be followed.
54
- /*jslint sloppy: true */
55
- /*global setTimeout: false */
56
-
57
- var requirejs, require, define;
58
- (function (undef) {
59
- var main, req, makeMap, handlers,
60
- defined = {},
61
- waiting = {},
62
- config = {},
63
- defining = {},
64
- hasOwn = Object.prototype.hasOwnProperty,
65
- aps = [].slice,
66
- jsSuffixRegExp = /\.js$/;
67
-
68
- function hasProp(obj, prop) {
69
- return hasOwn.call(obj, prop);
70
- }
71
-
72
- /**
73
- * Given a relative module name, like ./something, normalize it to
74
- * a real name that can be mapped to a path.
75
- * @param {String} name the relative name
76
- * @param {String} baseName a real name that the name arg is relative
77
- * to.
78
- * @returns {String} normalized name
79
- */
80
- function normalize(name, baseName) {
81
- var nameParts, nameSegment, mapValue, foundMap, lastIndex,
82
- foundI, foundStarMap, starI, i, j, part,
83
- baseParts = baseName && baseName.split("/"),
84
- map = config.map,
85
- starMap = (map && map['*']) || {};
86
-
87
- //Adjust any relative paths.
88
- if (name && name.charAt(0) === ".") {
89
- //If have a base name, try to normalize against it,
90
- //otherwise, assume it is a top-level require that will
91
- //be relative to baseUrl in the end.
92
- if (baseName) {
93
- name = name.split('/');
94
- lastIndex = name.length - 1;
95
-
96
- // Node .js allowance:
97
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
98
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
99
- }
100
-
101
- //Lop off the last part of baseParts, so that . matches the
102
- //"directory" and not name of the baseName's module. For instance,
103
- //baseName of "one/two/three", maps to "one/two/three.js", but we
104
- //want the directory, "one/two" for this normalization.
105
- name = baseParts.slice(0, baseParts.length - 1).concat(name);
106
-
107
- //start trimDots
108
- for (i = 0; i < name.length; i += 1) {
109
- part = name[i];
110
- if (part === ".") {
111
- name.splice(i, 1);
112
- i -= 1;
113
- } else if (part === "..") {
114
- if (i === 1 && (name[2] === '..' || name[0] === '..')) {
115
- //End of the line. Keep at least one non-dot
116
- //path segment at the front so it can be mapped
117
- //correctly to disk. Otherwise, there is likely
118
- //no path mapping for a path starting with '..'.
119
- //This can still fail, but catches the most reasonable
120
- //uses of ..
121
- break;
122
- } else if (i > 0) {
123
- name.splice(i - 1, 2);
124
- i -= 2;
125
- }
126
- }
127
- }
128
- //end trimDots
129
-
130
- name = name.join("/");
131
- } else if (name.indexOf('./') === 0) {
132
- // No baseName, so this is ID is resolved relative
133
- // to baseUrl, pull off the leading dot.
134
- name = name.substring(2);
135
- }
136
- }
137
-
138
- //Apply map config if available.
139
- if ((baseParts || starMap) && map) {
140
- nameParts = name.split('/');
141
-
142
- for (i = nameParts.length; i > 0; i -= 1) {
143
- nameSegment = nameParts.slice(0, i).join("/");
144
-
145
- if (baseParts) {
146
- //Find the longest baseName segment match in the config.
147
- //So, do joins on the biggest to smallest lengths of baseParts.
148
- for (j = baseParts.length; j > 0; j -= 1) {
149
- mapValue = map[baseParts.slice(0, j).join('/')];
150
-
151
- //baseName segment has config, find if it has one for
152
- //this name.
153
- if (mapValue) {
154
- mapValue = mapValue[nameSegment];
155
- if (mapValue) {
156
- //Match, update name to the new value.
157
- foundMap = mapValue;
158
- foundI = i;
159
- break;
160
- }
161
- }
162
- }
163
- }
164
-
165
- if (foundMap) {
166
- break;
167
- }
168
-
169
- //Check for a star map match, but just hold on to it,
170
- //if there is a shorter segment match later in a matching
171
- //config, then favor over this star map.
172
- if (!foundStarMap && starMap && starMap[nameSegment]) {
173
- foundStarMap = starMap[nameSegment];
174
- starI = i;
175
- }
176
- }
177
-
178
- if (!foundMap && foundStarMap) {
179
- foundMap = foundStarMap;
180
- foundI = starI;
181
- }
182
-
183
- if (foundMap) {
184
- nameParts.splice(0, foundI, foundMap);
185
- name = nameParts.join('/');
186
- }
187
- }
188
-
189
- return name;
190
- }
191
-
192
- function makeRequire(relName, forceSync) {
193
- return function () {
194
- //A version of a require function that passes a moduleName
195
- //value for items that may need to
196
- //look up paths relative to the moduleName
197
- var args = aps.call(arguments, 0);
198
-
199
- //If first arg is not require('string'), and there is only
200
- //one arg, it is the array form without a callback. Insert
201
- //a null so that the following concat is correct.
202
- if (typeof args[0] !== 'string' && args.length === 1) {
203
- args.push(null);
204
- }
205
- return req.apply(undef, args.concat([relName, forceSync]));
206
- };
207
- }
208
-
209
- function makeNormalize(relName) {
210
- return function (name) {
211
- return normalize(name, relName);
212
- };
213
- }
214
-
215
- function makeLoad(depName) {
216
- return function (value) {
217
- defined[depName] = value;
218
- };
219
- }
220
-
221
- function callDep(name) {
222
- if (hasProp(waiting, name)) {
223
- var args = waiting[name];
224
- delete waiting[name];
225
- defining[name] = true;
226
- main.apply(undef, args);
227
- }
228
-
229
- if (!hasProp(defined, name) && !hasProp(defining, name)) {
230
- throw new Error('No ' + name);
231
- }
232
- return defined[name];
233
- }
234
-
235
- //Turns a plugin!resource to [plugin, resource]
236
- //with the plugin being undefined if the name
237
- //did not have a plugin prefix.
238
- function splitPrefix(name) {
239
- var prefix,
240
- index = name ? name.indexOf('!') : -1;
241
- if (index > -1) {
242
- prefix = name.substring(0, index);
243
- name = name.substring(index + 1, name.length);
244
- }
245
- return [prefix, name];
246
- }
247
-
248
- /**
249
- * Makes a name map, normalizing the name, and using a plugin
250
- * for normalization if necessary. Grabs a ref to plugin
251
- * too, as an optimization.
252
- */
253
- makeMap = function (name, relName) {
254
- var plugin,
255
- parts = splitPrefix(name),
256
- prefix = parts[0];
257
-
258
- name = parts[1];
259
-
260
- if (prefix) {
261
- prefix = normalize(prefix, relName);
262
- plugin = callDep(prefix);
263
- }
264
-
265
- //Normalize according
266
- if (prefix) {
267
- if (plugin && plugin.normalize) {
268
- name = plugin.normalize(name, makeNormalize(relName));
269
- } else {
270
- name = normalize(name, relName);
271
- }
272
- } else {
273
- name = normalize(name, relName);
274
- parts = splitPrefix(name);
275
- prefix = parts[0];
276
- name = parts[1];
277
- if (prefix) {
278
- plugin = callDep(prefix);
279
- }
280
- }
281
-
282
- //Using ridiculous property names for space reasons
283
- return {
284
- f: prefix ? prefix + '!' + name : name, //fullName
285
- n: name,
286
- pr: prefix,
287
- p: plugin
288
- };
289
- };
290
-
291
- function makeConfig(name) {
292
- return function () {
293
- return (config && config.config && config.config[name]) || {};
294
- };
295
- }
296
-
297
- handlers = {
298
- require: function (name) {
299
- return makeRequire(name);
300
- },
301
- exports: function (name) {
302
- var e = defined[name];
303
- if (typeof e !== 'undefined') {
304
- return e;
305
- } else {
306
- return (defined[name] = {});
307
- }
308
- },
309
- module: function (name) {
310
- return {
311
- id: name,
312
- uri: '',
313
- exports: defined[name],
314
- config: makeConfig(name)
315
- };
316
- }
317
- };
318
-
319
- main = function (name, deps, callback, relName) {
320
- var cjsModule, depName, ret, map, i,
321
- args = [],
322
- callbackType = typeof callback,
323
- usingExports;
324
-
325
- //Use name if no relName
326
- relName = relName || name;
327
-
328
- //Call the callback to define the module, if necessary.
329
- if (callbackType === 'undefined' || callbackType === 'function') {
330
- //Pull out the defined dependencies and pass the ordered
331
- //values to the callback.
332
- //Default to [require, exports, module] if no deps
333
- deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
334
- for (i = 0; i < deps.length; i += 1) {
335
- map = makeMap(deps[i], relName);
336
- depName = map.f;
337
-
338
- //Fast path CommonJS standard dependencies.
339
- if (depName === "require") {
340
- args[i] = handlers.require(name);
341
- } else if (depName === "exports") {
342
- //CommonJS module spec 1.1
343
- args[i] = handlers.exports(name);
344
- usingExports = true;
345
- } else if (depName === "module") {
346
- //CommonJS module spec 1.1
347
- cjsModule = args[i] = handlers.module(name);
348
- } else if (hasProp(defined, depName) ||
349
- hasProp(waiting, depName) ||
350
- hasProp(defining, depName)) {
351
- args[i] = callDep(depName);
352
- } else if (map.p) {
353
- map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
354
- args[i] = defined[depName];
355
- } else {
356
- throw new Error(name + ' missing ' + depName);
357
- }
358
- }
359
-
360
- ret = callback ? callback.apply(defined[name], args) : undefined;
361
-
362
- if (name) {
363
- //If setting exports via "module" is in play,
364
- //favor that over return value and exports. After that,
365
- //favor a non-undefined return value over exports use.
366
- if (cjsModule && cjsModule.exports !== undef &&
367
- cjsModule.exports !== defined[name]) {
368
- defined[name] = cjsModule.exports;
369
- } else if (ret !== undef || !usingExports) {
370
- //Use the return value from the function.
371
- defined[name] = ret;
372
- }
373
- }
374
- } else if (name) {
375
- //May just be an object definition for the module. Only
376
- //worry about defining if have a module name.
377
- defined[name] = callback;
378
- }
379
- };
380
-
381
- requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
382
- if (typeof deps === "string") {
383
- if (handlers[deps]) {
384
- //callback in this case is really relName
385
- return handlers[deps](callback);
386
- }
387
- //Just return the module wanted. In this scenario, the
388
- //deps arg is the module name, and second arg (if passed)
389
- //is just the relName.
390
- //Normalize module name, if it contains . or ..
391
- return callDep(makeMap(deps, callback).f);
392
- } else if (!deps.splice) {
393
- //deps is a config object, not an array.
394
- config = deps;
395
- if (config.deps) {
396
- req(config.deps, config.callback);
397
- }
398
- if (!callback) {
399
- return;
400
- }
401
-
402
- if (callback.splice) {
403
- //callback is an array, which means it is a dependency list.
404
- //Adjust args if there are dependencies
405
- deps = callback;
406
- callback = relName;
407
- relName = null;
408
- } else {
409
- deps = undef;
410
- }
411
- }
412
-
413
- //Support require(['a'])
414
- callback = callback || function () {};
415
-
416
- //If relName is a function, it is an errback handler,
417
- //so remove it.
418
- if (typeof relName === 'function') {
419
- relName = forceSync;
420
- forceSync = alt;
421
- }
422
-
423
- //Simulate async callback;
424
- if (forceSync) {
425
- main(undef, deps, callback, relName);
426
- } else {
427
- //Using a non-zero value because of concern for what old browsers
428
- //do, and latest browsers "upgrade" to 4 if lower value is used:
429
- //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
430
- //If want a value immediately, use require('id') instead -- something
431
- //that works in almond on the global level, but not guaranteed and
432
- //unlikely to work in other AMD implementations.
433
- setTimeout(function () {
434
- main(undef, deps, callback, relName);
435
- }, 4);
436
- }
437
-
438
- return req;
439
- };
440
-
441
- /**
442
- * Just drops the config on the floor, but returns req in case
443
- * the config return value is used.
444
- */
445
- req.config = function (cfg) {
446
- return req(cfg);
447
- };
448
-
449
- /**
450
- * Expose module registry for debugging and tooling
451
- */
452
- requirejs._defined = defined;
453
-
454
- define = function (name, deps, callback) {
455
- if (typeof name !== 'string') {
456
- throw new Error('See almond README: incorrect module build, no module name');
457
- }
458
-
459
- //This module may not have dependencies
460
- if (!deps.splice) {
461
- //deps is not an array, so probably means
462
- //an object literal or factory function for
463
- //the value. Adjust args.
464
- callback = deps;
465
- deps = [];
466
- }
467
-
468
- if (!hasProp(defined, name) && !hasProp(waiting, name)) {
469
- waiting[name] = [name, deps, callback];
470
- }
471
- };
472
-
473
- define.amd = {
474
- jQuery: true
475
- };
476
- }());
477
-
478
- S2.requirejs = requirejs;S2.require = require;S2.define = define;
479
- }
480
- }());
481
- S2.define("almond", function(){});
482
-
483
- /* global jQuery:false, $:false */
484
- S2.define('jquery',[],function () {
485
- var _$ = jQuery || $;
486
-
487
- if (_$ == null && console && console.error) {
488
- console.error(
489
- 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
490
- 'found. Make sure that you are including jQuery before Select2 on your ' +
491
- 'web page.'
492
- );
493
- }
494
-
495
- return _$;
496
- });
497
-
498
- S2.define('select2/utils',[
499
- 'jquery'
500
- ], function ($) {
501
- var Utils = {};
502
-
503
- Utils.Extend = function (ChildClass, SuperClass) {
504
- var __hasProp = {}.hasOwnProperty;
505
-
506
- function BaseConstructor () {
507
- this.constructor = ChildClass;
508
- }
509
-
510
- for (var key in SuperClass) {
511
- if (__hasProp.call(SuperClass, key)) {
512
- ChildClass[key] = SuperClass[key];
513
- }
514
- }
515
-
516
- BaseConstructor.prototype = SuperClass.prototype;
517
- ChildClass.prototype = new BaseConstructor();
518
- ChildClass.__super__ = SuperClass.prototype;
519
-
520
- return ChildClass;
521
- };
522
-
523
- function getMethods (theClass) {
524
- var proto = theClass.prototype;
525
-
526
- var methods = [];
527
-
528
- for (var methodName in proto) {
529
- var m = proto[methodName];
530
-
531
- if (typeof m !== 'function') {
532
- continue;
533
- }
534
-
535
- if (methodName === 'constructor') {
536
- continue;
537
- }
538
-
539
- methods.push(methodName);
540
- }
541
-
542
- return methods;
543
- }
544
-
545
- Utils.Decorate = function (SuperClass, DecoratorClass) {
546
- var decoratedMethods = getMethods(DecoratorClass);
547
- var superMethods = getMethods(SuperClass);
548
-
549
- function DecoratedClass () {
550
- var unshift = Array.prototype.unshift;
551
-
552
- var argCount = DecoratorClass.prototype.constructor.length;
553
-
554
- var calledConstructor = SuperClass.prototype.constructor;
555
-
556
- if (argCount > 0) {
557
- unshift.call(arguments, SuperClass.prototype.constructor);
558
-
559
- calledConstructor = DecoratorClass.prototype.constructor;
560
- }
561
-
562
- calledConstructor.apply(this, arguments);
563
- }
564
-
565
- DecoratorClass.displayName = SuperClass.displayName;
566
-
567
- function ctr () {
568
- this.constructor = DecoratedClass;
569
- }
570
-
571
- DecoratedClass.prototype = new ctr();
572
-
573
- for (var m = 0; m < superMethods.length; m++) {
574
- var superMethod = superMethods[m];
575
-
576
- DecoratedClass.prototype[superMethod] =
577
- SuperClass.prototype[superMethod];
578
- }
579
-
580
- var calledMethod = function (methodName) {
581
- // Stub out the original method if it's not decorating an actual method
582
- var originalMethod = function () {};
583
-
584
- if (methodName in DecoratedClass.prototype) {
585
- originalMethod = DecoratedClass.prototype[methodName];
586
- }
587
-
588
- var decoratedMethod = DecoratorClass.prototype[methodName];
589
-
590
- return function () {
591
- var unshift = Array.prototype.unshift;
592
-
593
- unshift.call(arguments, originalMethod);
594
-
595
- return decoratedMethod.apply(this, arguments);
596
- };
597
- };
598
-
599
- for (var d = 0; d < decoratedMethods.length; d++) {
600
- var decoratedMethod = decoratedMethods[d];
601
-
602
- DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
603
- }
604
-
605
- return DecoratedClass;
606
- };
607
-
608
- var Observable = function () {
609
- this.listeners = {};
610
- };
611
-
612
- Observable.prototype.on = function (event, callback) {
613
- this.listeners = this.listeners || {};
614
-
615
- if (event in this.listeners) {
616
- this.listeners[event].push(callback);
617
- } else {
618
- this.listeners[event] = [callback];
619
- }
620
- };
621
-
622
- Observable.prototype.trigger = function (event) {
623
- var slice = Array.prototype.slice;
624
- var params = slice.call(arguments, 1);
625
-
626
- this.listeners = this.listeners || {};
627
-
628
- // Params should always come in as an array
629
- if (params == null) {
630
- params = [];
631
- }
632
-
633
- // If there are no arguments to the event, use a temporary object
634
- if (params.length === 0) {
635
- params.push({});
636
- }
637
-
638
- // Set the `_type` of the first object to the event
639
- params[0]._type = event;
640
-
641
- if (event in this.listeners) {
642
- this.invoke(this.listeners[event], slice.call(arguments, 1));
643
- }
644
-
645
- if ('*' in this.listeners) {
646
- this.invoke(this.listeners['*'], arguments);
647
- }
648
- };
649
-
650
- Observable.prototype.invoke = function (listeners, params) {
651
- for (var i = 0, len = listeners.length; i < len; i++) {
652
- listeners[i].apply(this, params);
653
- }
654
- };
655
-
656
- Utils.Observable = Observable;
657
-
658
- Utils.generateChars = function (length) {
659
- var chars = '';
660
-
661
- for (var i = 0; i < length; i++) {
662
- var randomChar = Math.floor(Math.random() * 36);
663
- chars += randomChar.toString(36);
664
- }
665
-
666
- return chars;
667
- };
668
-
669
- Utils.bind = function (func, context) {
670
- return function () {
671
- func.apply(context, arguments);
672
- };
673
- };
674
-
675
- Utils._convertData = function (data) {
676
- for (var originalKey in data) {
677
- var keys = originalKey.split('-');
678
-
679
- var dataLevel = data;
680
-
681
- if (keys.length === 1) {
682
- continue;
683
- }
684
-
685
- for (var k = 0; k < keys.length; k++) {
686
- var key = keys[k];
687
-
688
- // Lowercase the first letter
689
- // By default, dash-separated becomes camelCase
690
- key = key.substring(0, 1).toLowerCase() + key.substring(1);
691
-
692
- if (!(key in dataLevel)) {
693
- dataLevel[key] = {};
694
- }
695
-
696
- if (k == keys.length - 1) {
697
- dataLevel[key] = data[originalKey];
698
- }
699
-
700
- dataLevel = dataLevel[key];
701
- }
702
-
703
- delete data[originalKey];
704
- }
705
-
706
- return data;
707
- };
708
-
709
- Utils.hasScroll = function (index, el) {
710
- // Adapted from the function created by @ShadowScripter
711
- // and adapted by @BillBarry on the Stack Exchange Code Review website.
712
- // The original code can be found at
713
- // http://codereview.stackexchange.com/q/13338
714
- // and was designed to be used with the Sizzle selector engine.
715
-
716
- var $el = $(el);
717
- var overflowX = el.style.overflowX;
718
- var overflowY = el.style.overflowY;
719
-
720
- //Check both x and y declarations
721
- if (overflowX === overflowY &&
722
- (overflowY === 'hidden' || overflowY === 'visible')) {
723
- return false;
724
- }
725
-
726
- if (overflowX === 'scroll' || overflowY === 'scroll') {
727
- return true;
728
- }
729
-
730
- return ($el.innerHeight() < el.scrollHeight ||
731
- $el.innerWidth() < el.scrollWidth);
732
- };
733
-
734
- Utils.escapeMarkup = function (markup) {
735
- var replaceMap = {
736
- '\\': '&#92;',
737
- '&': '&amp;',
738
- '<': '&lt;',
739
- '>': '&gt;',
740
- '"': '&quot;',
741
- '\'': '&#39;',
742
- '/': '&#47;'
743
- };
744
-
745
- // Do not try to escape the markup if it's not a string
746
- if (typeof markup !== 'string') {
747
- return markup;
748
- }
749
-
750
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
751
- return replaceMap[match];
752
- });
753
- };
754
-
755
- // Append an array of jQuery nodes to a given element.
756
- Utils.appendMany = function ($element, $nodes) {
757
- // jQuery 1.7.x does not support $.fn.append() with an array
758
- // Fall back to a jQuery object collection using $.fn.add()
759
- if ($.fn.jquery.substr(0, 3) === '1.7') {
760
- var $jqNodes = $();
761
-
762
- $.map($nodes, function (node) {
763
- $jqNodes = $jqNodes.add(node);
764
- });
765
-
766
- $nodes = $jqNodes;
767
- }
768
-
769
- $element.append($nodes);
770
- };
771
-
772
- return Utils;
773
- });
774
-
775
- S2.define('select2/results',[
776
- 'jquery',
777
- './utils'
778
- ], function ($, Utils) {
779
- function Results ($element, options, dataAdapter) {
780
- this.$element = $element;
781
- this.data = dataAdapter;
782
- this.options = options;
783
-
784
- Results.__super__.constructor.call(this);
785
- }
786
-
787
- Utils.Extend(Results, Utils.Observable);
788
-
789
- Results.prototype.render = function () {
790
- var $results = $(
791
- '<ul class="select2-results__options" role="tree"></ul>'
792
- );
793
-
794
- if (this.options.get('multiple')) {
795
- $results.attr('aria-multiselectable', 'true');
796
- }
797
-
798
- this.$results = $results;
799
-
800
- return $results;
801
- };
802
-
803
- Results.prototype.clear = function () {
804
- this.$results.empty();
805
- };
806
-
807
- Results.prototype.displayMessage = function (params) {
808
- var escapeMarkup = this.options.get('escapeMarkup');
809
-
810
- this.clear();
811
- this.hideLoading();
812
-
813
- var $message = $(
814
- '<li role="treeitem" aria-live="assertive"' +
815
- ' class="select2-results__option"></li>'
816
- );
817
-
818
- var message = this.options.get('translations').get(params.message);
819
-
820
- $message.append(
821
- escapeMarkup(
822
- message(params.args)
823
- )
824
- );
825
-
826
- $message[0].className += ' select2-results__message';
827
-
828
- this.$results.append($message);
829
- };
830
-
831
- Results.prototype.hideMessages = function () {
832
- this.$results.find('.select2-results__message').remove();
833
- };
834
-
835
- Results.prototype.append = function (data) {
836
- this.hideLoading();
837
-
838
- var $options = [];
839
-
840
- if (data.results == null || data.results.length === 0) {
841
- if (this.$results.children().length === 0) {
842
- this.trigger('results:message', {
843
- message: 'noResults'
844
- });
845
- }
846
-
847
- return;
848
- }
849
-
850
- data.results = this.sort(data.results);
851
-
852
- for (var d = 0; d < data.results.length; d++) {
853
- var item = data.results[d];
854
-
855
- var $option = this.option(item);
856
-
857
- $options.push($option);
858
- }
859
-
860
- this.$results.append($options);
861
- };
862
-
863
- Results.prototype.position = function ($results, $dropdown) {
864
- var $resultsContainer = $dropdown.find('.select2-results');
865
- $resultsContainer.append($results);
866
- };
867
-
868
- Results.prototype.sort = function (data) {
869
- var sorter = this.options.get('sorter');
870
-
871
- return sorter(data);
872
- };
873
-
874
- Results.prototype.highlightFirstItem = function () {
875
- var $options = this.$results
876
- .find('.select2-results__option[aria-selected]');
877
-
878
- var $selected = $options.filter('[aria-selected=true]');
879
-
880
- // Check if there are any selected options
881
- if ($selected.length > 0) {
882
- // If there are selected options, highlight the first
883
- $selected.first().trigger('mouseenter');
884
- } else {
885
- // If there are no selected options, highlight the first option
886
- // in the dropdown
887
- $options.first().trigger('mouseenter');
888
- }
889
-
890
- this.ensureHighlightVisible();
891
- };
892
-
893
- Results.prototype.setClasses = function () {
894
- var self = this;
895
-
896
- this.data.current(function (selected) {
897
- var selectedIds = $.map(selected, function (s) {
898
- return s.id.toString();
899
- });
900
-
901
- var $options = self.$results
902
- .find('.select2-results__option[aria-selected]');
903
-
904
- $options.each(function () {
905
- var $option = $(this);
906
-
907
- var item = $.data(this, 'data');
908
-
909
- // id needs to be converted to a string when comparing
910
- var id = '' + item.id;
911
-
912
- if ((item.element != null && item.element.selected) ||
913
- (item.element == null && $.inArray(id, selectedIds) > -1)) {
914
- $option.attr('aria-selected', 'true');
915
- } else {
916
- $option.attr('aria-selected', 'false');
917
- }
918
- });
919
-
920
- });
921
- };
922
-
923
- Results.prototype.showLoading = function (params) {
924
- this.hideLoading();
925
-
926
- var loadingMore = this.options.get('translations').get('searching');
927
-
928
- var loading = {
929
- disabled: true,
930
- loading: true,
931
- text: loadingMore(params)
932
- };
933
- var $loading = this.option(loading);
934
- $loading.className += ' loading-results';
935
-
936
- this.$results.prepend($loading);
937
- };
938
-
939
- Results.prototype.hideLoading = function () {
940
- this.$results.find('.loading-results').remove();
941
- };
942
-
943
- Results.prototype.option = function (data) {
944
- var option = document.createElement('li');
945
- option.className = 'select2-results__option';
946
-
947
- var attrs = {
948
- 'role': 'treeitem',
949
- 'aria-selected': 'false'
950
- };
951
-
952
- if (data.disabled) {
953
- delete attrs['aria-selected'];
954
- attrs['aria-disabled'] = 'true';
955
- }
956
-
957
- if (data.id == null) {
958
- delete attrs['aria-selected'];
959
- }
960
-
961
- if (data._resultId != null) {
962
- option.id = data._resultId;
963
- }
964
-
965
- if (data.title) {
966
- option.title = data.title;
967
- }
968
-
969
- if (data.children) {
970
- attrs.role = 'group';
971
- attrs['aria-label'] = data.text;
972
- delete attrs['aria-selected'];
973
- }
974
-
975
- for (var attr in attrs) {
976
- var val = attrs[attr];
977
-
978
- option.setAttribute(attr, val);
979
- }
980
-
981
- if (data.children) {
982
- var $option = $(option);
983
-
984
- var label = document.createElement('strong');
985
- label.className = 'select2-results__group';
986
-
987
- var $label = $(label);
988
- this.template(data, label);
989
-
990
- var $children = [];
991
-
992
- for (var c = 0; c < data.children.length; c++) {
993
- var child = data.children[c];
994
-
995
- var $child = this.option(child);
996
-
997
- $children.push($child);
998
- }
999
-
1000
- var $childrenContainer = $('<ul></ul>', {
1001
- 'class': 'select2-results__options select2-results__options--nested'
1002
- });
1003
-
1004
- $childrenContainer.append($children);
1005
-
1006
- $option.append(label);
1007
- $option.append($childrenContainer);
1008
- } else {
1009
- this.template(data, option);
1010
- }
1011
-
1012
- $.data(option, 'data', data);
1013
-
1014
- return option;
1015
- };
1016
-
1017
- Results.prototype.bind = function (container, $container) {
1018
- var self = this;
1019
-
1020
- var id = container.id + '-results';
1021
-
1022
- this.$results.attr('id', id);
1023
-
1024
- container.on('results:all', function (params) {
1025
- self.clear();
1026
- self.append(params.data);
1027
-
1028
- if (container.isOpen()) {
1029
- self.setClasses();
1030
- self.highlightFirstItem();
1031
- }
1032
- });
1033
-
1034
- container.on('results:append', function (params) {
1035
- self.append(params.data);
1036
-
1037
- if (container.isOpen()) {
1038
- self.setClasses();
1039
- }
1040
- });
1041
-
1042
- container.on('query', function (params) {
1043
- self.hideMessages();
1044
- self.showLoading(params);
1045
- });
1046
-
1047
- container.on('select', function () {
1048
- if (!container.isOpen()) {
1049
- return;
1050
- }
1051
-
1052
- self.setClasses();
1053
- self.highlightFirstItem();
1054
- });
1055
-
1056
- container.on('unselect', function () {
1057
- if (!container.isOpen()) {
1058
- return;
1059
- }
1060
-
1061
- self.setClasses();
1062
- self.highlightFirstItem();
1063
- });
1064
-
1065
- container.on('open', function () {
1066
- // When the dropdown is open, aria-expended="true"
1067
- self.$results.attr('aria-expanded', 'true');
1068
- self.$results.attr('aria-hidden', 'false');
1069
-
1070
- self.setClasses();
1071
- self.ensureHighlightVisible();
1072
- });
1073
-
1074
- container.on('close', function () {
1075
- // When the dropdown is closed, aria-expended="false"
1076
- self.$results.attr('aria-expanded', 'false');
1077
- self.$results.attr('aria-hidden', 'true');
1078
- self.$results.removeAttr('aria-activedescendant');
1079
- });
1080
-
1081
- container.on('results:toggle', function () {
1082
- var $highlighted = self.getHighlightedResults();
1083
-
1084
- if ($highlighted.length === 0) {
1085
- return;
1086
- }
1087
-
1088
- $highlighted.trigger('mouseup');
1089
- });
1090
-
1091
- container.on('results:select', function () {
1092
- var $highlighted = self.getHighlightedResults();
1093
-
1094
- if ($highlighted.length === 0) {
1095
- return;
1096
- }
1097
-
1098
- var data = $highlighted.data('data');
1099
-
1100
- if ($highlighted.attr('aria-selected') == 'true') {
1101
- self.trigger('close', {});
1102
- } else {
1103
- self.trigger('select', {
1104
- data: data
1105
- });
1106
- }
1107
- });
1108
-
1109
- container.on('results:previous', function () {
1110
- var $highlighted = self.getHighlightedResults();
1111
-
1112
- var $options = self.$results.find('[aria-selected]');
1113
-
1114
- var currentIndex = $options.index($highlighted);
1115
-
1116
- // If we are already at te top, don't move further
1117
- if (currentIndex === 0) {
1118
- return;
1119
- }
1120
-
1121
- var nextIndex = currentIndex - 1;
1122
-
1123
- // If none are highlighted, highlight the first
1124
- if ($highlighted.length === 0) {
1125
- nextIndex = 0;
1126
- }
1127
-
1128
- var $next = $options.eq(nextIndex);
1129
-
1130
- $next.trigger('mouseenter');
1131
-
1132
- var currentOffset = self.$results.offset().top;
1133
- var nextTop = $next.offset().top;
1134
- var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1135
-
1136
- if (nextIndex === 0) {
1137
- self.$results.scrollTop(0);
1138
- } else if (nextTop - currentOffset < 0) {
1139
- self.$results.scrollTop(nextOffset);
1140
- }
1141
- });
1142
-
1143
- container.on('results:next', function () {
1144
- var $highlighted = self.getHighlightedResults();
1145
-
1146
- var $options = self.$results.find('[aria-selected]');
1147
-
1148
- var currentIndex = $options.index($highlighted);
1149
-
1150
- var nextIndex = currentIndex + 1;
1151
-
1152
- // If we are at the last option, stay there
1153
- if (nextIndex >= $options.length) {
1154
- return;
1155
- }
1156
-
1157
- var $next = $options.eq(nextIndex);
1158
-
1159
- $next.trigger('mouseenter');
1160
-
1161
- var currentOffset = self.$results.offset().top +
1162
- self.$results.outerHeight(false);
1163
- var nextBottom = $next.offset().top + $next.outerHeight(false);
1164
- var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1165
-
1166
- if (nextIndex === 0) {
1167
- self.$results.scrollTop(0);
1168
- } else if (nextBottom > currentOffset) {
1169
- self.$results.scrollTop(nextOffset);
1170
- }
1171
- });
1172
-
1173
- container.on('results:focus', function (params) {
1174
- params.element.addClass('select2-results__option--highlighted');
1175
- });
1176
-
1177
- container.on('results:message', function (params) {
1178
- self.displayMessage(params);
1179
- });
1180
-
1181
- if ($.fn.mousewheel) {
1182
- this.$results.on('mousewheel', function (e) {
1183
- var top = self.$results.scrollTop();
1184
-
1185
- var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1186
-
1187
- var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1188
- var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1189
-
1190
- if (isAtTop) {
1191
- self.$results.scrollTop(0);
1192
-
1193
- e.preventDefault();
1194
- e.stopPropagation();
1195
- } else if (isAtBottom) {
1196
- self.$results.scrollTop(
1197
- self.$results.get(0).scrollHeight - self.$results.height()
1198
- );
1199
-
1200
- e.preventDefault();
1201
- e.stopPropagation();
1202
- }
1203
- });
1204
- }
1205
-
1206
- this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1207
- function (evt) {
1208
- var $this = $(this);
1209
-
1210
- var data = $this.data('data');
1211
-
1212
- if ($this.attr('aria-selected') === 'true') {
1213
- if (self.options.get('multiple')) {
1214
- self.trigger('unselect', {
1215
- originalEvent: evt,
1216
- data: data
1217
- });
1218
- } else {
1219
- self.trigger('close', {});
1220
- }
1221
-
1222
- return;
1223
- }
1224
-
1225
- self.trigger('select', {
1226
- originalEvent: evt,
1227
- data: data
1228
- });
1229
- });
1230
-
1231
- this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1232
- function (evt) {
1233
- var data = $(this).data('data');
1234
-
1235
- self.getHighlightedResults()
1236
- .removeClass('select2-results__option--highlighted');
1237
-
1238
- self.trigger('results:focus', {
1239
- data: data,
1240
- element: $(this)
1241
- });
1242
- });
1243
- };
1244
-
1245
- Results.prototype.getHighlightedResults = function () {
1246
- var $highlighted = this.$results
1247
- .find('.select2-results__option--highlighted');
1248
-
1249
- return $highlighted;
1250
- };
1251
-
1252
- Results.prototype.destroy = function () {
1253
- this.$results.remove();
1254
- };
1255
-
1256
- Results.prototype.ensureHighlightVisible = function () {
1257
- var $highlighted = this.getHighlightedResults();
1258
-
1259
- if ($highlighted.length === 0) {
1260
- return;
1261
- }
1262
-
1263
- var $options = this.$results.find('[aria-selected]');
1264
-
1265
- var currentIndex = $options.index($highlighted);
1266
-
1267
- var currentOffset = this.$results.offset().top;
1268
- var nextTop = $highlighted.offset().top;
1269
- var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1270
-
1271
- var offsetDelta = nextTop - currentOffset;
1272
- nextOffset -= $highlighted.outerHeight(false) * 2;
1273
-
1274
- if (currentIndex <= 2) {
1275
- this.$results.scrollTop(0);
1276
- } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1277
- this.$results.scrollTop(nextOffset);
1278
- }
1279
- };
1280
-
1281
- Results.prototype.template = function (result, container) {
1282
- var template = this.options.get('templateResult');
1283
- var escapeMarkup = this.options.get('escapeMarkup');
1284
-
1285
- var content = template(result, container);
1286
-
1287
- if (content == null) {
1288
- container.style.display = 'none';
1289
- } else if (typeof content === 'string') {
1290
- container.innerHTML = escapeMarkup(content);
1291
- } else {
1292
- $(container).append(content);
1293
- }
1294
- };
1295
-
1296
- return Results;
1297
- });
1298
-
1299
- S2.define('select2/keys',[
1300
-
1301
- ], function () {
1302
- var KEYS = {
1303
- BACKSPACE: 8,
1304
- TAB: 9,
1305
- ENTER: 13,
1306
- SHIFT: 16,
1307
- CTRL: 17,
1308
- ALT: 18,
1309
- ESC: 27,
1310
- SPACE: 32,
1311
- PAGE_UP: 33,
1312
- PAGE_DOWN: 34,
1313
- END: 35,
1314
- HOME: 36,
1315
- LEFT: 37,
1316
- UP: 38,
1317
- RIGHT: 39,
1318
- DOWN: 40,
1319
- DELETE: 46
1320
- };
1321
-
1322
- return KEYS;
1323
- });
1324
-
1325
- S2.define('select2/selection/base',[
1326
- 'jquery',
1327
- '../utils',
1328
- '../keys'
1329
- ], function ($, Utils, KEYS) {
1330
- function BaseSelection ($element, options) {
1331
- this.$element = $element;
1332
- this.options = options;
1333
-
1334
- BaseSelection.__super__.constructor.call(this);
1335
- }
1336
-
1337
- Utils.Extend(BaseSelection, Utils.Observable);
1338
-
1339
- BaseSelection.prototype.render = function () {
1340
- var $selection = $(
1341
- '<span class="select2-selection" role="combobox" ' +
1342
- ' aria-haspopup="true" aria-expanded="false">' +
1343
- '</span>'
1344
- );
1345
-
1346
- this._tabindex = 0;
1347
-
1348
- if (this.$element.data('old-tabindex') != null) {
1349
- this._tabindex = this.$element.data('old-tabindex');
1350
- } else if (this.$element.attr('tabindex') != null) {
1351
- this._tabindex = this.$element.attr('tabindex');
1352
- }
1353
-
1354
- $selection.attr('title', this.$element.attr('title'));
1355
- $selection.attr('tabindex', this._tabindex);
1356
-
1357
- this.$selection = $selection;
1358
-
1359
- return $selection;
1360
- };
1361
-
1362
- BaseSelection.prototype.bind = function (container, $container) {
1363
- var self = this;
1364
-
1365
- var id = container.id + '-container';
1366
- var resultsId = container.id + '-results';
1367
-
1368
- this.container = container;
1369
-
1370
- this.$selection.on('focus', function (evt) {
1371
- self.trigger('focus', evt);
1372
- });
1373
-
1374
- this.$selection.on('blur', function (evt) {
1375
- self._handleBlur(evt);
1376
- });
1377
-
1378
- this.$selection.on('keydown', function (evt) {
1379
- self.trigger('keypress', evt);
1380
-
1381
- if (evt.which === KEYS.SPACE) {
1382
- evt.preventDefault();
1383
- }
1384
- });
1385
-
1386
- container.on('results:focus', function (params) {
1387
- self.$selection.attr('aria-activedescendant', params.data._resultId);
1388
- });
1389
-
1390
- container.on('selection:update', function (params) {
1391
- self.update(params.data);
1392
- });
1393
-
1394
- container.on('open', function () {
1395
- // When the dropdown is open, aria-expanded="true"
1396
- self.$selection.attr('aria-expanded', 'true');
1397
- self.$selection.attr('aria-owns', resultsId);
1398
-
1399
- self._attachCloseHandler(container);
1400
- });
1401
-
1402
- container.on('close', function () {
1403
- // When the dropdown is closed, aria-expanded="false"
1404
- self.$selection.attr('aria-expanded', 'false');
1405
- self.$selection.removeAttr('aria-activedescendant');
1406
- self.$selection.removeAttr('aria-owns');
1407
-
1408
- self.$selection.focus();
1409
-
1410
- self._detachCloseHandler(container);
1411
- });
1412
-
1413
- container.on('enable', function () {
1414
- self.$selection.attr('tabindex', self._tabindex);
1415
- });
1416
-
1417
- container.on('disable', function () {
1418
- self.$selection.attr('tabindex', '-1');
1419
- });
1420
- };
1421
-
1422
- BaseSelection.prototype._handleBlur = function (evt) {
1423
- var self = this;
1424
-
1425
- // This needs to be delayed as the active element is the body when the tab
1426
- // key is pressed, possibly along with others.
1427
- window.setTimeout(function () {
1428
- // Don't trigger `blur` if the focus is still in the selection
1429
- if (
1430
- (document.activeElement == self.$selection[0]) ||
1431
- ($.contains(self.$selection[0], document.activeElement))
1432
- ) {
1433
- return;
1434
- }
1435
-
1436
- self.trigger('blur', evt);
1437
- }, 1);
1438
- };
1439
-
1440
- BaseSelection.prototype._attachCloseHandler = function (container) {
1441
- var self = this;
1442
-
1443
- $(document.body).on('mousedown.select2.' + container.id, function (e) {
1444
- var $target = $(e.target);
1445
-
1446
- var $select = $target.closest('.select2');
1447
-
1448
- var $all = $('.select2.select2-container--open');
1449
-
1450
- $all.each(function () {
1451
- var $this = $(this);
1452
-
1453
- if (this == $select[0]) {
1454
- return;
1455
- }
1456
-
1457
- var $element = $this.data('element');
1458
-
1459
- $element.select2('close');
1460
- });
1461
- });
1462
- };
1463
-
1464
- BaseSelection.prototype._detachCloseHandler = function (container) {
1465
- $(document.body).off('mousedown.select2.' + container.id);
1466
- };
1467
-
1468
- BaseSelection.prototype.position = function ($selection, $container) {
1469
- var $selectionContainer = $container.find('.selection');
1470
- $selectionContainer.append($selection);
1471
- };
1472
-
1473
- BaseSelection.prototype.destroy = function () {
1474
- this._detachCloseHandler(this.container);
1475
- };
1476
-
1477
- BaseSelection.prototype.update = function (data) {
1478
- throw new Error('The `update` method must be defined in child classes.');
1479
- };
1480
-
1481
- return BaseSelection;
1482
- });
1483
-
1484
- S2.define('select2/selection/single',[
1485
- 'jquery',
1486
- './base',
1487
- '../utils',
1488
- '../keys'
1489
- ], function ($, BaseSelection, Utils, KEYS) {
1490
- function SingleSelection () {
1491
- SingleSelection.__super__.constructor.apply(this, arguments);
1492
- }
1493
-
1494
- Utils.Extend(SingleSelection, BaseSelection);
1495
-
1496
- SingleSelection.prototype.render = function () {
1497
- var $selection = SingleSelection.__super__.render.call(this);
1498
-
1499
- $selection.addClass('select2-selection--single');
1500
-
1501
- $selection.html(
1502
- '<span class="select2-selection__rendered"></span>' +
1503
- '<span class="select2-selection__arrow" role="presentation">' +
1504
- '<b role="presentation"></b>' +
1505
- '</span>'
1506
- );
1507
-
1508
- return $selection;
1509
- };
1510
-
1511
- SingleSelection.prototype.bind = function (container, $container) {
1512
- var self = this;
1513
-
1514
- SingleSelection.__super__.bind.apply(this, arguments);
1515
-
1516
- var id = container.id + '-container';
1517
-
1518
- this.$selection.find('.select2-selection__rendered').attr('id', id);
1519
- this.$selection.attr('aria-labelledby', id);
1520
-
1521
- this.$selection.on('mousedown', function (evt) {
1522
- // Only respond to left clicks
1523
- if (evt.which !== 1) {
1524
- return;
1525
- }
1526
-
1527
- self.trigger('toggle', {
1528
- originalEvent: evt
1529
- });
1530
- });
1531
-
1532
- this.$selection.on('focus', function (evt) {
1533
- // User focuses on the container
1534
- });
1535
-
1536
- this.$selection.on('blur', function (evt) {
1537
- // User exits the container
1538
- });
1539
-
1540
- container.on('focus', function (evt) {
1541
- if (!container.isOpen()) {
1542
- self.$selection.focus();
1543
- }
1544
- });
1545
-
1546
- container.on('selection:update', function (params) {
1547
- self.update(params.data);
1548
- });
1549
- };
1550
-
1551
- SingleSelection.prototype.clear = function () {
1552
- this.$selection.find('.select2-selection__rendered').empty();
1553
- };
1554
-
1555
- SingleSelection.prototype.display = function (data, container) {
1556
- var template = this.options.get('templateSelection');
1557
- var escapeMarkup = this.options.get('escapeMarkup');
1558
-
1559
- return escapeMarkup(template(data, container));
1560
- };
1561
-
1562
- SingleSelection.prototype.selectionContainer = function () {
1563
- return $('<span></span>');
1564
- };
1565
-
1566
- SingleSelection.prototype.update = function (data) {
1567
- if (data.length === 0) {
1568
- this.clear();
1569
- return;
1570
- }
1571
-
1572
- var selection = data[0];
1573
-
1574
- var $rendered = this.$selection.find('.select2-selection__rendered');
1575
- var formatted = this.display(selection, $rendered);
1576
-
1577
- $rendered.empty().append(formatted);
1578
- $rendered.prop('title', selection.title || selection.text);
1579
- };
1580
-
1581
- return SingleSelection;
1582
- });
1583
-
1584
- S2.define('select2/selection/multiple',[
1585
- 'jquery',
1586
- './base',
1587
- '../utils'
1588
- ], function ($, BaseSelection, Utils) {
1589
- function MultipleSelection ($element, options) {
1590
- MultipleSelection.__super__.constructor.apply(this, arguments);
1591
- }
1592
-
1593
- Utils.Extend(MultipleSelection, BaseSelection);
1594
-
1595
- MultipleSelection.prototype.render = function () {
1596
- var $selection = MultipleSelection.__super__.render.call(this);
1597
-
1598
- $selection.addClass('select2-selection--multiple');
1599
-
1600
- $selection.html(
1601
- '<ul class="select2-selection__rendered"></ul>'
1602
- );
1603
-
1604
- return $selection;
1605
- };
1606
-
1607
- MultipleSelection.prototype.bind = function (container, $container) {
1608
- var self = this;
1609
-
1610
- MultipleSelection.__super__.bind.apply(this, arguments);
1611
-
1612
- this.$selection.on('click', function (evt) {
1613
- self.trigger('toggle', {
1614
- originalEvent: evt
1615
- });
1616
- });
1617
-
1618
- this.$selection.on(
1619
- 'click',
1620
- '.select2-selection__choice__remove',
1621
- function (evt) {
1622
- // Ignore the event if it is disabled
1623
- if (self.options.get('disabled')) {
1624
- return;
1625
- }
1626
-
1627
- var $remove = $(this);
1628
- var $selection = $remove.parent();
1629
-
1630
- var data = $selection.data('data');
1631
-
1632
- self.trigger('unselect', {
1633
- originalEvent: evt,
1634
- data: data
1635
- });
1636
- }
1637
- );
1638
- };
1639
-
1640
- MultipleSelection.prototype.clear = function () {
1641
- this.$selection.find('.select2-selection__rendered').empty();
1642
- };
1643
-
1644
- MultipleSelection.prototype.display = function (data, container) {
1645
- var template = this.options.get('templateSelection');
1646
- var escapeMarkup = this.options.get('escapeMarkup');
1647
-
1648
- return escapeMarkup(template(data, container));
1649
- };
1650
-
1651
- MultipleSelection.prototype.selectionContainer = function () {
1652
- var $container = $(
1653
- '<li class="select2-selection__choice">' +
1654
- '<span class="select2-selection__choice__remove" role="presentation">' +
1655
- '&times;' +
1656
- '</span>' +
1657
- '</li>'
1658
- );
1659
-
1660
- return $container;
1661
- };
1662
-
1663
- MultipleSelection.prototype.update = function (data) {
1664
- this.clear();
1665
-
1666
- if (data.length === 0) {
1667
- return;
1668
- }
1669
-
1670
- var $selections = [];
1671
-
1672
- for (var d = 0; d < data.length; d++) {
1673
- var selection = data[d];
1674
-
1675
- var $selection = this.selectionContainer();
1676
- var formatted = this.display(selection, $selection);
1677
-
1678
- $selection.append(formatted);
1679
- $selection.prop('title', selection.title || selection.text);
1680
-
1681
- $selection.data('data', selection);
1682
-
1683
- $selections.push($selection);
1684
- }
1685
-
1686
- var $rendered = this.$selection.find('.select2-selection__rendered');
1687
-
1688
- Utils.appendMany($rendered, $selections);
1689
- };
1690
-
1691
- return MultipleSelection;
1692
- });
1693
-
1694
- S2.define('select2/selection/placeholder',[
1695
- '../utils'
1696
- ], function (Utils) {
1697
- function Placeholder (decorated, $element, options) {
1698
- this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1699
-
1700
- decorated.call(this, $element, options);
1701
- }
1702
-
1703
- Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1704
- if (typeof placeholder === 'string') {
1705
- placeholder = {
1706
- id: '',
1707
- text: placeholder
1708
- };
1709
- }
1710
-
1711
- return placeholder;
1712
- };
1713
-
1714
- Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1715
- var $placeholder = this.selectionContainer();
1716
-
1717
- $placeholder.html(this.display(placeholder));
1718
- $placeholder.addClass('select2-selection__placeholder')
1719
- .removeClass('select2-selection__choice');
1720
-
1721
- return $placeholder;
1722
- };
1723
-
1724
- Placeholder.prototype.update = function (decorated, data) {
1725
- var singlePlaceholder = (
1726
- data.length == 1 && data[0].id != this.placeholder.id
1727
- );
1728
- var multipleSelections = data.length > 1;
1729
-
1730
- if (multipleSelections || singlePlaceholder) {
1731
- return decorated.call(this, data);
1732
- }
1733
-
1734
- this.clear();
1735
-
1736
- var $placeholder = this.createPlaceholder(this.placeholder);
1737
-
1738
- this.$selection.find('.select2-selection__rendered').append($placeholder);
1739
- };
1740
-
1741
- return Placeholder;
1742
- });
1743
-
1744
- S2.define('select2/selection/allowClear',[
1745
- 'jquery',
1746
- '../keys'
1747
- ], function ($, KEYS) {
1748
- function AllowClear () { }
1749
-
1750
- AllowClear.prototype.bind = function (decorated, container, $container) {
1751
- var self = this;
1752
-
1753
- decorated.call(this, container, $container);
1754
-
1755
- if (this.placeholder == null) {
1756
- if (this.options.get('debug') && window.console && console.error) {
1757
- console.error(
1758
- 'Select2: The `allowClear` option should be used in combination ' +
1759
- 'with the `placeholder` option.'
1760
- );
1761
- }
1762
- }
1763
-
1764
- this.$selection.on('mousedown', '.select2-selection__clear',
1765
- function (evt) {
1766
- self._handleClear(evt);
1767
- });
1768
-
1769
- container.on('keypress', function (evt) {
1770
- self._handleKeyboardClear(evt, container);
1771
- });
1772
- };
1773
-
1774
- AllowClear.prototype._handleClear = function (_, evt) {
1775
- // Ignore the event if it is disabled
1776
- if (this.options.get('disabled')) {
1777
- return;
1778
- }
1779
-
1780
- var $clear = this.$selection.find('.select2-selection__clear');
1781
-
1782
- // Ignore the event if nothing has been selected
1783
- if ($clear.length === 0) {
1784
- return;
1785
- }
1786
-
1787
- evt.stopPropagation();
1788
-
1789
- var data = $clear.data('data');
1790
-
1791
- for (var d = 0; d < data.length; d++) {
1792
- var unselectData = {
1793
- data: data[d]
1794
- };
1795
-
1796
- // Trigger the `unselect` event, so people can prevent it from being
1797
- // cleared.
1798
- this.trigger('unselect', unselectData);
1799
-
1800
- // If the event was prevented, don't clear it out.
1801
- if (unselectData.prevented) {
1802
- return;
1803
- }
1804
- }
1805
-
1806
- this.$element.val(this.placeholder.id).trigger('change');
1807
-
1808
- this.trigger('toggle', {});
1809
- };
1810
-
1811
- AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1812
- if (container.isOpen()) {
1813
- return;
1814
- }
1815
-
1816
- if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1817
- this._handleClear(evt);
1818
- }
1819
- };
1820
-
1821
- AllowClear.prototype.update = function (decorated, data) {
1822
- decorated.call(this, data);
1823
-
1824
- if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1825
- data.length === 0) {
1826
- return;
1827
- }
1828
-
1829
- var $remove = $(
1830
- '<span class="select2-selection__clear">' +
1831
- '&times;' +
1832
- '</span>'
1833
- );
1834
- $remove.data('data', data);
1835
-
1836
- this.$selection.find('.select2-selection__rendered').prepend($remove);
1837
- };
1838
-
1839
- return AllowClear;
1840
- });
1841
-
1842
- S2.define('select2/selection/search',[
1843
- 'jquery',
1844
- '../utils',
1845
- '../keys'
1846
- ], function ($, Utils, KEYS) {
1847
- function Search (decorated, $element, options) {
1848
- decorated.call(this, $element, options);
1849
- }
1850
-
1851
- Search.prototype.render = function (decorated) {
1852
- var $search = $(
1853
- '<li class="select2-search select2-search--inline">' +
1854
- '<input class="select2-search__field" type="search" tabindex="-1"' +
1855
- ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1856
- ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1857
- '</li>'
1858
- );
1859
-
1860
- this.$searchContainer = $search;
1861
- this.$search = $search.find('input');
1862
-
1863
- var $rendered = decorated.call(this);
1864
-
1865
- this._transferTabIndex();
1866
-
1867
- return $rendered;
1868
- };
1869
-
1870
- Search.prototype.bind = function (decorated, container, $container) {
1871
- var self = this;
1872
-
1873
- decorated.call(this, container, $container);
1874
-
1875
- container.on('open', function () {
1876
- self.$search.trigger('focus');
1877
- });
1878
-
1879
- container.on('close', function () {
1880
- self.$search.val('');
1881
- self.$search.removeAttr('aria-activedescendant');
1882
- self.$search.trigger('focus');
1883
- });
1884
-
1885
- container.on('enable', function () {
1886
- self.$search.prop('disabled', false);
1887
-
1888
- self._transferTabIndex();
1889
- });
1890
-
1891
- container.on('disable', function () {
1892
- self.$search.prop('disabled', true);
1893
- });
1894
-
1895
- container.on('focus', function (evt) {
1896
- self.$search.trigger('focus');
1897
- });
1898
-
1899
- container.on('results:focus', function (params) {
1900
- self.$search.attr('aria-activedescendant', params.id);
1901
- });
1902
-
1903
- this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1904
- self.trigger('focus', evt);
1905
- });
1906
-
1907
- this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1908
- self._handleBlur(evt);
1909
- });
1910
-
1911
- this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1912
- evt.stopPropagation();
1913
-
1914
- self.trigger('keypress', evt);
1915
-
1916
- self._keyUpPrevented = evt.isDefaultPrevented();
1917
-
1918
- var key = evt.which;
1919
-
1920
- if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1921
- var $previousChoice = self.$searchContainer
1922
- .prev('.select2-selection__choice');
1923
-
1924
- if ($previousChoice.length > 0) {
1925
- var item = $previousChoice.data('data');
1926
-
1927
- self.searchRemoveChoice(item);
1928
-
1929
- evt.preventDefault();
1930
- }
1931
- }
1932
- });
1933
-
1934
- // Try to detect the IE version should the `documentMode` property that
1935
- // is stored on the document. This is only implemented in IE and is
1936
- // slightly cleaner than doing a user agent check.
1937
- // This property is not available in Edge, but Edge also doesn't have
1938
- // this bug.
1939
- var msie = document.documentMode;
1940
- var disableInputEvents = msie && msie <= 11;
1941
-
1942
- // Workaround for browsers which do not support the `input` event
1943
- // This will prevent double-triggering of events for browsers which support
1944
- // both the `keyup` and `input` events.
1945
- this.$selection.on(
1946
- 'input.searchcheck',
1947
- '.select2-search--inline',
1948
- function (evt) {
1949
- // IE will trigger the `input` event when a placeholder is used on a
1950
- // search box. To get around this issue, we are forced to ignore all
1951
- // `input` events in IE and keep using `keyup`.
1952
- if (disableInputEvents) {
1953
- self.$selection.off('input.search input.searchcheck');
1954
- return;
1955
- }
1956
-
1957
- // Unbind the duplicated `keyup` event
1958
- self.$selection.off('keyup.search');
1959
- }
1960
- );
1961
-
1962
- this.$selection.on(
1963
- 'keyup.search input.search',
1964
- '.select2-search--inline',
1965
- function (evt) {
1966
- // IE will trigger the `input` event when a placeholder is used on a
1967
- // search box. To get around this issue, we are forced to ignore all
1968
- // `input` events in IE and keep using `keyup`.
1969
- if (disableInputEvents && evt.type === 'input') {
1970
- self.$selection.off('input.search input.searchcheck');
1971
- return;
1972
- }
1973
-
1974
- var key = evt.which;
1975
-
1976
- // We can freely ignore events from modifier keys
1977
- if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1978
- return;
1979
- }
1980
-
1981
- // Tabbing will be handled during the `keydown` phase
1982
- if (key == KEYS.TAB) {
1983
- return;
1984
- }
1985
-
1986
- self.handleSearch(evt);
1987
- }
1988
- );
1989
- };
1990
-
1991
- /**
1992
- * This method will transfer the tabindex attribute from the rendered
1993
- * selection to the search box. This allows for the search box to be used as
1994
- * the primary focus instead of the selection container.
1995
- *
1996
- * @private
1997
- */
1998
- Search.prototype._transferTabIndex = function (decorated) {
1999
- this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2000
- this.$selection.attr('tabindex', '-1');
2001
- };
2002
-
2003
- Search.prototype.createPlaceholder = function (decorated, placeholder) {
2004
- this.$search.attr('placeholder', placeholder.text);
2005
- };
2006
-
2007
- Search.prototype.update = function (decorated, data) {
2008
- var searchHadFocus = this.$search[0] == document.activeElement;
2009
-
2010
- this.$search.attr('placeholder', '');
2011
-
2012
- decorated.call(this, data);
2013
-
2014
- this.$selection.find('.select2-selection__rendered')
2015
- .append(this.$searchContainer);
2016
-
2017
- this.resizeSearch();
2018
- if (searchHadFocus) {
2019
- this.$search.focus();
2020
- }
2021
- };
2022
-
2023
- Search.prototype.handleSearch = function () {
2024
- this.resizeSearch();
2025
-
2026
- if (!this._keyUpPrevented) {
2027
- var input = this.$search.val();
2028
-
2029
- this.trigger('query', {
2030
- term: input
2031
- });
2032
- }
2033
-
2034
- this._keyUpPrevented = false;
2035
- };
2036
-
2037
- Search.prototype.searchRemoveChoice = function (decorated, item) {
2038
- this.trigger('unselect', {
2039
- data: item
2040
- });
2041
-
2042
- this.$search.val(item.text);
2043
- this.handleSearch();
2044
- };
2045
-
2046
- Search.prototype.resizeSearch = function () {
2047
- this.$search.css('width', '25px');
2048
-
2049
- var width = '';
2050
-
2051
- if (this.$search.attr('placeholder') !== '') {
2052
- width = this.$selection.find('.select2-selection__rendered').innerWidth();
2053
- } else {
2054
- var minimumWidth = this.$search.val().length + 1;
2055
-
2056
- width = (minimumWidth * 0.75) + 'em';
2057
- }
2058
-
2059
- this.$search.css('width', width);
2060
- };
2061
-
2062
- return Search;
2063
- });
2064
-
2065
- S2.define('select2/selection/eventRelay',[
2066
- 'jquery'
2067
- ], function ($) {
2068
- function EventRelay () { }
2069
-
2070
- EventRelay.prototype.bind = function (decorated, container, $container) {
2071
- var self = this;
2072
- var relayEvents = [
2073
- 'open', 'opening',
2074
- 'close', 'closing',
2075
- 'select', 'selecting',
2076
- 'unselect', 'unselecting'
2077
- ];
2078
-
2079
- var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2080
-
2081
- decorated.call(this, container, $container);
2082
-
2083
- container.on('*', function (name, params) {
2084
- // Ignore events that should not be relayed
2085
- if ($.inArray(name, relayEvents) === -1) {
2086
- return;
2087
- }
2088
-
2089
- // The parameters should always be an object
2090
- params = params || {};
2091
-
2092
- // Generate the jQuery event for the Select2 event
2093
- var evt = $.Event('select2:' + name, {
2094
- params: params
2095
- });
2096
-
2097
- self.$element.trigger(evt);
2098
-
2099
- // Only handle preventable events if it was one
2100
- if ($.inArray(name, preventableEvents) === -1) {
2101
- return;
2102
- }
2103
-
2104
- params.prevented = evt.isDefaultPrevented();
2105
- });
2106
- };
2107
-
2108
- return EventRelay;
2109
- });
2110
-
2111
- S2.define('select2/translation',[
2112
- 'jquery',
2113
- 'require'
2114
- ], function ($, require) {
2115
- function Translation (dict) {
2116
- this.dict = dict || {};
2117
- }
2118
-
2119
- Translation.prototype.all = function () {
2120
- return this.dict;
2121
- };
2122
-
2123
- Translation.prototype.get = function (key) {
2124
- return this.dict[key];
2125
- };
2126
-
2127
- Translation.prototype.extend = function (translation) {
2128
- this.dict = $.extend({}, translation.all(), this.dict);
2129
- };
2130
-
2131
- // Static functions
2132
-
2133
- Translation._cache = {};
2134
-
2135
- Translation.loadPath = function (path) {
2136
- if (!(path in Translation._cache)) {
2137
- var translations = require(path);
2138
-
2139
- Translation._cache[path] = translations;
2140
- }
2141
-
2142
- return new Translation(Translation._cache[path]);
2143
- };
2144
-
2145
- return Translation;
2146
- });
2147
-
2148
- S2.define('select2/diacritics',[
2149
-
2150
- ], function () {
2151
- var diacritics = {
2152
- '\u24B6': 'A',
2153
- '\uFF21': 'A',
2154
- '\u00C0': 'A',
2155
- '\u00C1': 'A',
2156
- '\u00C2': 'A',
2157
- '\u1EA6': 'A',
2158
- '\u1EA4': 'A',
2159
- '\u1EAA': 'A',
2160
- '\u1EA8': 'A',
2161
- '\u00C3': 'A',
2162
- '\u0100': 'A',
2163
- '\u0102': 'A',
2164
- '\u1EB0': 'A',
2165
- '\u1EAE': 'A',
2166
- '\u1EB4': 'A',
2167
- '\u1EB2': 'A',
2168
- '\u0226': 'A',
2169
- '\u01E0': 'A',
2170
- '\u00C4': 'A',
2171
- '\u01DE': 'A',
2172
- '\u1EA2': 'A',
2173
- '\u00C5': 'A',
2174
- '\u01FA': 'A',
2175
- '\u01CD': 'A',
2176
- '\u0200': 'A',
2177
- '\u0202': 'A',
2178
- '\u1EA0': 'A',
2179
- '\u1EAC': 'A',
2180
- '\u1EB6': 'A',
2181
- '\u1E00': 'A',
2182
- '\u0104': 'A',
2183
- '\u023A': 'A',
2184
- '\u2C6F': 'A',
2185
- '\uA732': 'AA',
2186
- '\u00C6': 'AE',
2187
- '\u01FC': 'AE',
2188
- '\u01E2': 'AE',
2189
- '\uA734': 'AO',
2190
- '\uA736': 'AU',
2191
- '\uA738': 'AV',
2192
- '\uA73A': 'AV',
2193
- '\uA73C': 'AY',
2194
- '\u24B7': 'B',
2195
- '\uFF22': 'B',
2196
- '\u1E02': 'B',
2197
- '\u1E04': 'B',
2198
- '\u1E06': 'B',
2199
- '\u0243': 'B',
2200
- '\u0182': 'B',
2201
- '\u0181': 'B',
2202
- '\u24B8': 'C',
2203
- '\uFF23': 'C',
2204
- '\u0106': 'C',
2205
- '\u0108': 'C',
2206
- '\u010A': 'C',
2207
- '\u010C': 'C',
2208
- '\u00C7': 'C',
2209
- '\u1E08': 'C',
2210
- '\u0187': 'C',
2211
- '\u023B': 'C',
2212
- '\uA73E': 'C',
2213
- '\u24B9': 'D',
2214
- '\uFF24': 'D',
2215
- '\u1E0A': 'D',
2216
- '\u010E': 'D',
2217
- '\u1E0C': 'D',
2218
- '\u1E10': 'D',
2219
- '\u1E12': 'D',
2220
- '\u1E0E': 'D',
2221
- '\u0110': 'D',
2222
- '\u018B': 'D',
2223
- '\u018A': 'D',
2224
- '\u0189': 'D',
2225
- '\uA779': 'D',
2226
- '\u01F1': 'DZ',
2227
- '\u01C4': 'DZ',
2228
- '\u01F2': 'Dz',
2229
- '\u01C5': 'Dz',
2230
- '\u24BA': 'E',
2231
- '\uFF25': 'E',
2232
- '\u00C8': 'E',
2233
- '\u00C9': 'E',
2234
- '\u00CA': 'E',
2235
- '\u1EC0': 'E',
2236
- '\u1EBE': 'E',
2237
- '\u1EC4': 'E',
2238
- '\u1EC2': 'E',
2239
- '\u1EBC': 'E',
2240
- '\u0112': 'E',
2241
- '\u1E14': 'E',
2242
- '\u1E16': 'E',
2243
- '\u0114': 'E',
2244
- '\u0116': 'E',
2245
- '\u00CB': 'E',
2246
- '\u1EBA': 'E',
2247
- '\u011A': 'E',
2248
- '\u0204': 'E',
2249
- '\u0206': 'E',
2250
- '\u1EB8': 'E',
2251
- '\u1EC6': 'E',
2252
- '\u0228': 'E',
2253
- '\u1E1C': 'E',
2254
- '\u0118': 'E',
2255
- '\u1E18': 'E',
2256
- '\u1E1A': 'E',
2257
- '\u0190': 'E',
2258
- '\u018E': 'E',
2259
- '\u24BB': 'F',
2260
- '\uFF26': 'F',
2261
- '\u1E1E': 'F',
2262
- '\u0191': 'F',
2263
- '\uA77B': 'F',
2264
- '\u24BC': 'G',
2265
- '\uFF27': 'G',
2266
- '\u01F4': 'G',
2267
- '\u011C': 'G',
2268
- '\u1E20': 'G',
2269
- '\u011E': 'G',
2270
- '\u0120': 'G',
2271
- '\u01E6': 'G',
2272
- '\u0122': 'G',
2273
- '\u01E4': 'G',
2274
- '\u0193': 'G',
2275
- '\uA7A0': 'G',
2276
- '\uA77D': 'G',
2277
- '\uA77E': 'G',
2278
- '\u24BD': 'H',
2279
- '\uFF28': 'H',
2280
- '\u0124': 'H',
2281
- '\u1E22': 'H',
2282
- '\u1E26': 'H',
2283
- '\u021E': 'H',
2284
- '\u1E24': 'H',
2285
- '\u1E28': 'H',
2286
- '\u1E2A': 'H',
2287
- '\u0126': 'H',
2288
- '\u2C67': 'H',
2289
- '\u2C75': 'H',
2290
- '\uA78D': 'H',
2291
- '\u24BE': 'I',
2292
- '\uFF29': 'I',
2293
- '\u00CC': 'I',
2294
- '\u00CD': 'I',
2295
- '\u00CE': 'I',
2296
- '\u0128': 'I',
2297
- '\u012A': 'I',
2298
- '\u012C': 'I',
2299
- '\u0130': 'I',
2300
- '\u00CF': 'I',
2301
- '\u1E2E': 'I',
2302
- '\u1EC8': 'I',
2303
- '\u01CF': 'I',
2304
- '\u0208': 'I',
2305
- '\u020A': 'I',
2306
- '\u1ECA': 'I',
2307
- '\u012E': 'I',
2308
- '\u1E2C': 'I',
2309
- '\u0197': 'I',
2310
- '\u24BF': 'J',
2311
- '\uFF2A': 'J',
2312
- '\u0134': 'J',
2313
- '\u0248': 'J',
2314
- '\u24C0': 'K',
2315
- '\uFF2B': 'K',
2316
- '\u1E30': 'K',
2317
- '\u01E8': 'K',
2318
- '\u1E32': 'K',
2319
- '\u0136': 'K',
2320
- '\u1E34': 'K',
2321
- '\u0198': 'K',
2322
- '\u2C69': 'K',
2323
- '\uA740': 'K',
2324
- '\uA742': 'K',
2325
- '\uA744': 'K',
2326
- '\uA7A2': 'K',
2327
- '\u24C1': 'L',
2328
- '\uFF2C': 'L',
2329
- '\u013F': 'L',
2330
- '\u0139': 'L',
2331
- '\u013D': 'L',
2332
- '\u1E36': 'L',
2333
- '\u1E38': 'L',
2334
- '\u013B': 'L',
2335
- '\u1E3C': 'L',
2336
- '\u1E3A': 'L',
2337
- '\u0141': 'L',
2338
- '\u023D': 'L',
2339
- '\u2C62': 'L',
2340
- '\u2C60': 'L',
2341
- '\uA748': 'L',
2342
- '\uA746': 'L',
2343
- '\uA780': 'L',
2344
- '\u01C7': 'LJ',
2345
- '\u01C8': 'Lj',
2346
- '\u24C2': 'M',
2347
- '\uFF2D': 'M',
2348
- '\u1E3E': 'M',
2349
- '\u1E40': 'M',
2350
- '\u1E42': 'M',
2351
- '\u2C6E': 'M',
2352
- '\u019C': 'M',
2353
- '\u24C3': 'N',
2354
- '\uFF2E': 'N',
2355
- '\u01F8': 'N',
2356
- '\u0143': 'N',
2357
- '\u00D1': 'N',
2358
- '\u1E44': 'N',
2359
- '\u0147': 'N',
2360
- '\u1E46': 'N',
2361
- '\u0145': 'N',
2362
- '\u1E4A': 'N',
2363
- '\u1E48': 'N',
2364
- '\u0220': 'N',
2365
- '\u019D': 'N',
2366
- '\uA790': 'N',
2367
- '\uA7A4': 'N',
2368
- '\u01CA': 'NJ',
2369
- '\u01CB': 'Nj',
2370
- '\u24C4': 'O',
2371
- '\uFF2F': 'O',
2372
- '\u00D2': 'O',
2373
- '\u00D3': 'O',
2374
- '\u00D4': 'O',
2375
- '\u1ED2': 'O',
2376
- '\u1ED0': 'O',
2377
- '\u1ED6': 'O',
2378
- '\u1ED4': 'O',
2379
- '\u00D5': 'O',
2380
- '\u1E4C': 'O',
2381
- '\u022C': 'O',
2382
- '\u1E4E': 'O',
2383
- '\u014C': 'O',
2384
- '\u1E50': 'O',
2385
- '\u1E52': 'O',
2386
- '\u014E': 'O',
2387
- '\u022E': 'O',
2388
- '\u0230': 'O',
2389
- '\u00D6': 'O',
2390
- '\u022A': 'O',
2391
- '\u1ECE': 'O',
2392
- '\u0150': 'O',
2393
- '\u01D1': 'O',
2394
- '\u020C': 'O',
2395
- '\u020E': 'O',
2396
- '\u01A0': 'O',
2397
- '\u1EDC': 'O',
2398
- '\u1EDA': 'O',
2399
- '\u1EE0': 'O',
2400
- '\u1EDE': 'O',
2401
- '\u1EE2': 'O',
2402
- '\u1ECC': 'O',
2403
- '\u1ED8': 'O',
2404
- '\u01EA': 'O',
2405
- '\u01EC': 'O',
2406
- '\u00D8': 'O',
2407
- '\u01FE': 'O',
2408
- '\u0186': 'O',
2409
- '\u019F': 'O',
2410
- '\uA74A': 'O',
2411
- '\uA74C': 'O',
2412
- '\u01A2': 'OI',
2413
- '\uA74E': 'OO',
2414
- '\u0222': 'OU',
2415
- '\u24C5': 'P',
2416
- '\uFF30': 'P',
2417
- '\u1E54': 'P',
2418
- '\u1E56': 'P',
2419
- '\u01A4': 'P',
2420
- '\u2C63': 'P',
2421
- '\uA750': 'P',
2422
- '\uA752': 'P',
2423
- '\uA754': 'P',
2424
- '\u24C6': 'Q',
2425
- '\uFF31': 'Q',
2426
- '\uA756': 'Q',
2427
- '\uA758': 'Q',
2428
- '\u024A': 'Q',
2429
- '\u24C7': 'R',
2430
- '\uFF32': 'R',
2431
- '\u0154': 'R',
2432
- '\u1E58': 'R',
2433
- '\u0158': 'R',
2434
- '\u0210': 'R',
2435
- '\u0212': 'R',
2436
- '\u1E5A': 'R',
2437
- '\u1E5C': 'R',
2438
- '\u0156': 'R',
2439
- '\u1E5E': 'R',
2440
- '\u024C': 'R',
2441
- '\u2C64': 'R',
2442
- '\uA75A': 'R',
2443
- '\uA7A6': 'R',
2444
- '\uA782': 'R',
2445
- '\u24C8': 'S',
2446
- '\uFF33': 'S',
2447
- '\u1E9E': 'S',
2448
- '\u015A': 'S',
2449
- '\u1E64': 'S',
2450
- '\u015C': 'S',
2451
- '\u1E60': 'S',
2452
- '\u0160': 'S',
2453
- '\u1E66': 'S',
2454
- '\u1E62': 'S',
2455
- '\u1E68': 'S',
2456
- '\u0218': 'S',
2457
- '\u015E': 'S',
2458
- '\u2C7E': 'S',
2459
- '\uA7A8': 'S',
2460
- '\uA784': 'S',
2461
- '\u24C9': 'T',
2462
- '\uFF34': 'T',
2463
- '\u1E6A': 'T',
2464
- '\u0164': 'T',
2465
- '\u1E6C': 'T',
2466
- '\u021A': 'T',
2467
- '\u0162': 'T',
2468
- '\u1E70': 'T',
2469
- '\u1E6E': 'T',
2470
- '\u0166': 'T',
2471
- '\u01AC': 'T',
2472
- '\u01AE': 'T',
2473
- '\u023E': 'T',
2474
- '\uA786': 'T',
2475
- '\uA728': 'TZ',
2476
- '\u24CA': 'U',
2477
- '\uFF35': 'U',
2478
- '\u00D9': 'U',
2479
- '\u00DA': 'U',
2480
- '\u00DB': 'U',
2481
- '\u0168': 'U',
2482
- '\u1E78': 'U',
2483
- '\u016A': 'U',
2484
- '\u1E7A': 'U',
2485
- '\u016C': 'U',
2486
- '\u00DC': 'U',
2487
- '\u01DB': 'U',
2488
- '\u01D7': 'U',
2489
- '\u01D5': 'U',
2490
- '\u01D9': 'U',
2491
- '\u1EE6': 'U',
2492
- '\u016E': 'U',
2493
- '\u0170': 'U',
2494
- '\u01D3': 'U',
2495
- '\u0214': 'U',
2496
- '\u0216': 'U',
2497
- '\u01AF': 'U',
2498
- '\u1EEA': 'U',
2499
- '\u1EE8': 'U',
2500
- '\u1EEE': 'U',
2501
- '\u1EEC': 'U',
2502
- '\u1EF0': 'U',
2503
- '\u1EE4': 'U',
2504
- '\u1E72': 'U',
2505
- '\u0172': 'U',
2506
- '\u1E76': 'U',
2507
- '\u1E74': 'U',
2508
- '\u0244': 'U',
2509
- '\u24CB': 'V',
2510
- '\uFF36': 'V',
2511
- '\u1E7C': 'V',
2512
- '\u1E7E': 'V',
2513
- '\u01B2': 'V',
2514
- '\uA75E': 'V',
2515
- '\u0245': 'V',
2516
- '\uA760': 'VY',
2517
- '\u24CC': 'W',
2518
- '\uFF37': 'W',
2519
- '\u1E80': 'W',
2520
- '\u1E82': 'W',
2521
- '\u0174': 'W',
2522
- '\u1E86': 'W',
2523
- '\u1E84': 'W',
2524
- '\u1E88': 'W',
2525
- '\u2C72': 'W',
2526
- '\u24CD': 'X',
2527
- '\uFF38': 'X',
2528
- '\u1E8A': 'X',
2529
- '\u1E8C': 'X',
2530
- '\u24CE': 'Y',
2531
- '\uFF39': 'Y',
2532
- '\u1EF2': 'Y',
2533
- '\u00DD': 'Y',
2534
- '\u0176': 'Y',
2535
- '\u1EF8': 'Y',
2536
- '\u0232': 'Y',
2537
- '\u1E8E': 'Y',
2538
- '\u0178': 'Y',
2539
- '\u1EF6': 'Y',
2540
- '\u1EF4': 'Y',
2541
- '\u01B3': 'Y',
2542
- '\u024E': 'Y',
2543
- '\u1EFE': 'Y',
2544
- '\u24CF': 'Z',
2545
- '\uFF3A': 'Z',
2546
- '\u0179': 'Z',
2547
- '\u1E90': 'Z',
2548
- '\u017B': 'Z',
2549
- '\u017D': 'Z',
2550
- '\u1E92': 'Z',
2551
- '\u1E94': 'Z',
2552
- '\u01B5': 'Z',
2553
- '\u0224': 'Z',
2554
- '\u2C7F': 'Z',
2555
- '\u2C6B': 'Z',
2556
- '\uA762': 'Z',
2557
- '\u24D0': 'a',
2558
- '\uFF41': 'a',
2559
- '\u1E9A': 'a',
2560
- '\u00E0': 'a',
2561
- '\u00E1': 'a',
2562
- '\u00E2': 'a',
2563
- '\u1EA7': 'a',
2564
- '\u1EA5': 'a',
2565
- '\u1EAB': 'a',
2566
- '\u1EA9': 'a',
2567
- '\u00E3': 'a',
2568
- '\u0101': 'a',
2569
- '\u0103': 'a',
2570
- '\u1EB1': 'a',
2571
- '\u1EAF': 'a',
2572
- '\u1EB5': 'a',
2573
- '\u1EB3': 'a',
2574
- '\u0227': 'a',
2575
- '\u01E1': 'a',
2576
- '\u00E4': 'a',
2577
- '\u01DF': 'a',
2578
- '\u1EA3': 'a',
2579
- '\u00E5': 'a',
2580
- '\u01FB': 'a',
2581
- '\u01CE': 'a',
2582
- '\u0201': 'a',
2583
- '\u0203': 'a',
2584
- '\u1EA1': 'a',
2585
- '\u1EAD': 'a',
2586
- '\u1EB7': 'a',
2587
- '\u1E01': 'a',
2588
- '\u0105': 'a',
2589
- '\u2C65': 'a',
2590
- '\u0250': 'a',
2591
- '\uA733': 'aa',
2592
- '\u00E6': 'ae',
2593
- '\u01FD': 'ae',
2594
- '\u01E3': 'ae',
2595
- '\uA735': 'ao',
2596
- '\uA737': 'au',
2597
- '\uA739': 'av',
2598
- '\uA73B': 'av',
2599
- '\uA73D': 'ay',
2600
- '\u24D1': 'b',
2601
- '\uFF42': 'b',
2602
- '\u1E03': 'b',
2603
- '\u1E05': 'b',
2604
- '\u1E07': 'b',
2605
- '\u0180': 'b',
2606
- '\u0183': 'b',
2607
- '\u0253': 'b',
2608
- '\u24D2': 'c',
2609
- '\uFF43': 'c',
2610
- '\u0107': 'c',
2611
- '\u0109': 'c',
2612
- '\u010B': 'c',
2613
- '\u010D': 'c',
2614
- '\u00E7': 'c',
2615
- '\u1E09': 'c',
2616
- '\u0188': 'c',
2617
- '\u023C': 'c',
2618
- '\uA73F': 'c',
2619
- '\u2184': 'c',
2620
- '\u24D3': 'd',
2621
- '\uFF44': 'd',
2622
- '\u1E0B': 'd',
2623
- '\u010F': 'd',
2624
- '\u1E0D': 'd',
2625
- '\u1E11': 'd',
2626
- '\u1E13': 'd',
2627
- '\u1E0F': 'd',
2628
- '\u0111': 'd',
2629
- '\u018C': 'd',
2630
- '\u0256': 'd',
2631
- '\u0257': 'd',
2632
- '\uA77A': 'd',
2633
- '\u01F3': 'dz',
2634
- '\u01C6': 'dz',
2635
- '\u24D4': 'e',
2636
- '\uFF45': 'e',
2637
- '\u00E8': 'e',
2638
- '\u00E9': 'e',
2639
- '\u00EA': 'e',
2640
- '\u1EC1': 'e',
2641
- '\u1EBF': 'e',
2642
- '\u1EC5': 'e',
2643
- '\u1EC3': 'e',
2644
- '\u1EBD': 'e',
2645
- '\u0113': 'e',
2646
- '\u1E15': 'e',
2647
- '\u1E17': 'e',
2648
- '\u0115': 'e',
2649
- '\u0117': 'e',
2650
- '\u00EB': 'e',
2651
- '\u1EBB': 'e',
2652
- '\u011B': 'e',
2653
- '\u0205': 'e',
2654
- '\u0207': 'e',
2655
- '\u1EB9': 'e',
2656
- '\u1EC7': 'e',
2657
- '\u0229': 'e',
2658
- '\u1E1D': 'e',
2659
- '\u0119': 'e',
2660
- '\u1E19': 'e',
2661
- '\u1E1B': 'e',
2662
- '\u0247': 'e',
2663
- '\u025B': 'e',
2664
- '\u01DD': 'e',
2665
- '\u24D5': 'f',
2666
- '\uFF46': 'f',
2667
- '\u1E1F': 'f',
2668
- '\u0192': 'f',
2669
- '\uA77C': 'f',
2670
- '\u24D6': 'g',
2671
- '\uFF47': 'g',
2672
- '\u01F5': 'g',
2673
- '\u011D': 'g',
2674
- '\u1E21': 'g',
2675
- '\u011F': 'g',
2676
- '\u0121': 'g',
2677
- '\u01E7': 'g',
2678
- '\u0123': 'g',
2679
- '\u01E5': 'g',
2680
- '\u0260': 'g',
2681
- '\uA7A1': 'g',
2682
- '\u1D79': 'g',
2683
- '\uA77F': 'g',
2684
- '\u24D7': 'h',
2685
- '\uFF48': 'h',
2686
- '\u0125': 'h',
2687
- '\u1E23': 'h',
2688
- '\u1E27': 'h',
2689
- '\u021F': 'h',
2690
- '\u1E25': 'h',
2691
- '\u1E29': 'h',
2692
- '\u1E2B': 'h',
2693
- '\u1E96': 'h',
2694
- '\u0127': 'h',
2695
- '\u2C68': 'h',
2696
- '\u2C76': 'h',
2697
- '\u0265': 'h',
2698
- '\u0195': 'hv',
2699
- '\u24D8': 'i',
2700
- '\uFF49': 'i',
2701
- '\u00EC': 'i',
2702
- '\u00ED': 'i',
2703
- '\u00EE': 'i',
2704
- '\u0129': 'i',
2705
- '\u012B': 'i',
2706
- '\u012D': 'i',
2707
- '\u00EF': 'i',
2708
- '\u1E2F': 'i',
2709
- '\u1EC9': 'i',
2710
- '\u01D0': 'i',
2711
- '\u0209': 'i',
2712
- '\u020B': 'i',
2713
- '\u1ECB': 'i',
2714
- '\u012F': 'i',
2715
- '\u1E2D': 'i',
2716
- '\u0268': 'i',
2717
- '\u0131': 'i',
2718
- '\u24D9': 'j',
2719
- '\uFF4A': 'j',
2720
- '\u0135': 'j',
2721
- '\u01F0': 'j',
2722
- '\u0249': 'j',
2723
- '\u24DA': 'k',
2724
- '\uFF4B': 'k',
2725
- '\u1E31': 'k',
2726
- '\u01E9': 'k',
2727
- '\u1E33': 'k',
2728
- '\u0137': 'k',
2729
- '\u1E35': 'k',
2730
- '\u0199': 'k',
2731
- '\u2C6A': 'k',
2732
- '\uA741': 'k',
2733
- '\uA743': 'k',
2734
- '\uA745': 'k',
2735
- '\uA7A3': 'k',
2736
- '\u24DB': 'l',
2737
- '\uFF4C': 'l',
2738
- '\u0140': 'l',
2739
- '\u013A': 'l',
2740
- '\u013E': 'l',
2741
- '\u1E37': 'l',
2742
- '\u1E39': 'l',
2743
- '\u013C': 'l',
2744
- '\u1E3D': 'l',
2745
- '\u1E3B': 'l',
2746
- '\u017F': 'l',
2747
- '\u0142': 'l',
2748
- '\u019A': 'l',
2749
- '\u026B': 'l',
2750
- '\u2C61': 'l',
2751
- '\uA749': 'l',
2752
- '\uA781': 'l',
2753
- '\uA747': 'l',
2754
- '\u01C9': 'lj',
2755
- '\u24DC': 'm',
2756
- '\uFF4D': 'm',
2757
- '\u1E3F': 'm',
2758
- '\u1E41': 'm',
2759
- '\u1E43': 'm',
2760
- '\u0271': 'm',
2761
- '\u026F': 'm',
2762
- '\u24DD': 'n',
2763
- '\uFF4E': 'n',
2764
- '\u01F9': 'n',
2765
- '\u0144': 'n',
2766
- '\u00F1': 'n',
2767
- '\u1E45': 'n',
2768
- '\u0148': 'n',
2769
- '\u1E47': 'n',
2770
- '\u0146': 'n',
2771
- '\u1E4B': 'n',
2772
- '\u1E49': 'n',
2773
- '\u019E': 'n',
2774
- '\u0272': 'n',
2775
- '\u0149': 'n',
2776
- '\uA791': 'n',
2777
- '\uA7A5': 'n',
2778
- '\u01CC': 'nj',
2779
- '\u24DE': 'o',
2780
- '\uFF4F': 'o',
2781
- '\u00F2': 'o',
2782
- '\u00F3': 'o',
2783
- '\u00F4': 'o',
2784
- '\u1ED3': 'o',
2785
- '\u1ED1': 'o',
2786
- '\u1ED7': 'o',
2787
- '\u1ED5': 'o',
2788
- '\u00F5': 'o',
2789
- '\u1E4D': 'o',
2790
- '\u022D': 'o',
2791
- '\u1E4F': 'o',
2792
- '\u014D': 'o',
2793
- '\u1E51': 'o',
2794
- '\u1E53': 'o',
2795
- '\u014F': 'o',
2796
- '\u022F': 'o',
2797
- '\u0231': 'o',
2798
- '\u00F6': 'o',
2799
- '\u022B': 'o',
2800
- '\u1ECF': 'o',
2801
- '\u0151': 'o',
2802
- '\u01D2': 'o',
2803
- '\u020D': 'o',
2804
- '\u020F': 'o',
2805
- '\u01A1': 'o',
2806
- '\u1EDD': 'o',
2807
- '\u1EDB': 'o',
2808
- '\u1EE1': 'o',
2809
- '\u1EDF': 'o',
2810
- '\u1EE3': 'o',
2811
- '\u1ECD': 'o',
2812
- '\u1ED9': 'o',
2813
- '\u01EB': 'o',
2814
- '\u01ED': 'o',
2815
- '\u00F8': 'o',
2816
- '\u01FF': 'o',
2817
- '\u0254': 'o',
2818
- '\uA74B': 'o',
2819
- '\uA74D': 'o',
2820
- '\u0275': 'o',
2821
- '\u01A3': 'oi',
2822
- '\u0223': 'ou',
2823
- '\uA74F': 'oo',
2824
- '\u24DF': 'p',
2825
- '\uFF50': 'p',
2826
- '\u1E55': 'p',
2827
- '\u1E57': 'p',
2828
- '\u01A5': 'p',
2829
- '\u1D7D': 'p',
2830
- '\uA751': 'p',
2831
- '\uA753': 'p',
2832
- '\uA755': 'p',
2833
- '\u24E0': 'q',
2834
- '\uFF51': 'q',
2835
- '\u024B': 'q',
2836
- '\uA757': 'q',
2837
- '\uA759': 'q',
2838
- '\u24E1': 'r',
2839
- '\uFF52': 'r',
2840
- '\u0155': 'r',
2841
- '\u1E59': 'r',
2842
- '\u0159': 'r',
2843
- '\u0211': 'r',
2844
- '\u0213': 'r',
2845
- '\u1E5B': 'r',
2846
- '\u1E5D': 'r',
2847
- '\u0157': 'r',
2848
- '\u1E5F': 'r',
2849
- '\u024D': 'r',
2850
- '\u027D': 'r',
2851
- '\uA75B': 'r',
2852
- '\uA7A7': 'r',
2853
- '\uA783': 'r',
2854
- '\u24E2': 's',
2855
- '\uFF53': 's',
2856
- '\u00DF': 's',
2857
- '\u015B': 's',
2858
- '\u1E65': 's',
2859
- '\u015D': 's',
2860
- '\u1E61': 's',
2861
- '\u0161': 's',
2862
- '\u1E67': 's',
2863
- '\u1E63': 's',
2864
- '\u1E69': 's',
2865
- '\u0219': 's',
2866
- '\u015F': 's',
2867
- '\u023F': 's',
2868
- '\uA7A9': 's',
2869
- '\uA785': 's',
2870
- '\u1E9B': 's',
2871
- '\u24E3': 't',
2872
- '\uFF54': 't',
2873
- '\u1E6B': 't',
2874
- '\u1E97': 't',
2875
- '\u0165': 't',
2876
- '\u1E6D': 't',
2877
- '\u021B': 't',
2878
- '\u0163': 't',
2879
- '\u1E71': 't',
2880
- '\u1E6F': 't',
2881
- '\u0167': 't',
2882
- '\u01AD': 't',
2883
- '\u0288': 't',
2884
- '\u2C66': 't',
2885
- '\uA787': 't',
2886
- '\uA729': 'tz',
2887
- '\u24E4': 'u',
2888
- '\uFF55': 'u',
2889
- '\u00F9': 'u',
2890
- '\u00FA': 'u',
2891
- '\u00FB': 'u',
2892
- '\u0169': 'u',
2893
- '\u1E79': 'u',
2894
- '\u016B': 'u',
2895
- '\u1E7B': 'u',
2896
- '\u016D': 'u',
2897
- '\u00FC': 'u',
2898
- '\u01DC': 'u',
2899
- '\u01D8': 'u',
2900
- '\u01D6': 'u',
2901
- '\u01DA': 'u',
2902
- '\u1EE7': 'u',
2903
- '\u016F': 'u',
2904
- '\u0171': 'u',
2905
- '\u01D4': 'u',
2906
- '\u0215': 'u',
2907
- '\u0217': 'u',
2908
- '\u01B0': 'u',
2909
- '\u1EEB': 'u',
2910
- '\u1EE9': 'u',
2911
- '\u1EEF': 'u',
2912
- '\u1EED': 'u',
2913
- '\u1EF1': 'u',
2914
- '\u1EE5': 'u',
2915
- '\u1E73': 'u',
2916
- '\u0173': 'u',
2917
- '\u1E77': 'u',
2918
- '\u1E75': 'u',
2919
- '\u0289': 'u',
2920
- '\u24E5': 'v',
2921
- '\uFF56': 'v',
2922
- '\u1E7D': 'v',
2923
- '\u1E7F': 'v',
2924
- '\u028B': 'v',
2925
- '\uA75F': 'v',
2926
- '\u028C': 'v',
2927
- '\uA761': 'vy',
2928
- '\u24E6': 'w',
2929
- '\uFF57': 'w',
2930
- '\u1E81': 'w',
2931
- '\u1E83': 'w',
2932
- '\u0175': 'w',
2933
- '\u1E87': 'w',
2934
- '\u1E85': 'w',
2935
- '\u1E98': 'w',
2936
- '\u1E89': 'w',
2937
- '\u2C73': 'w',
2938
- '\u24E7': 'x',
2939
- '\uFF58': 'x',
2940
- '\u1E8B': 'x',
2941
- '\u1E8D': 'x',
2942
- '\u24E8': 'y',
2943
- '\uFF59': 'y',
2944
- '\u1EF3': 'y',
2945
- '\u00FD': 'y',
2946
- '\u0177': 'y',
2947
- '\u1EF9': 'y',
2948
- '\u0233': 'y',
2949
- '\u1E8F': 'y',
2950
- '\u00FF': 'y',
2951
- '\u1EF7': 'y',
2952
- '\u1E99': 'y',
2953
- '\u1EF5': 'y',
2954
- '\u01B4': 'y',
2955
- '\u024F': 'y',
2956
- '\u1EFF': 'y',
2957
- '\u24E9': 'z',
2958
- '\uFF5A': 'z',
2959
- '\u017A': 'z',
2960
- '\u1E91': 'z',
2961
- '\u017C': 'z',
2962
- '\u017E': 'z',
2963
- '\u1E93': 'z',
2964
- '\u1E95': 'z',
2965
- '\u01B6': 'z',
2966
- '\u0225': 'z',
2967
- '\u0240': 'z',
2968
- '\u2C6C': 'z',
2969
- '\uA763': 'z',
2970
- '\u0386': '\u0391',
2971
- '\u0388': '\u0395',
2972
- '\u0389': '\u0397',
2973
- '\u038A': '\u0399',
2974
- '\u03AA': '\u0399',
2975
- '\u038C': '\u039F',
2976
- '\u038E': '\u03A5',
2977
- '\u03AB': '\u03A5',
2978
- '\u038F': '\u03A9',
2979
- '\u03AC': '\u03B1',
2980
- '\u03AD': '\u03B5',
2981
- '\u03AE': '\u03B7',
2982
- '\u03AF': '\u03B9',
2983
- '\u03CA': '\u03B9',
2984
- '\u0390': '\u03B9',
2985
- '\u03CC': '\u03BF',
2986
- '\u03CD': '\u03C5',
2987
- '\u03CB': '\u03C5',
2988
- '\u03B0': '\u03C5',
2989
- '\u03C9': '\u03C9',
2990
- '\u03C2': '\u03C3'
2991
- };
2992
-
2993
- return diacritics;
2994
- });
2995
-
2996
- S2.define('select2/data/base',[
2997
- '../utils'
2998
- ], function (Utils) {
2999
- function BaseAdapter ($element, options) {
3000
- BaseAdapter.__super__.constructor.call(this);
3001
- }
3002
-
3003
- Utils.Extend(BaseAdapter, Utils.Observable);
3004
-
3005
- BaseAdapter.prototype.current = function (callback) {
3006
- throw new Error('The `current` method must be defined in child classes.');
3007
- };
3008
-
3009
- BaseAdapter.prototype.query = function (params, callback) {
3010
- throw new Error('The `query` method must be defined in child classes.');
3011
- };
3012
-
3013
- BaseAdapter.prototype.bind = function (container, $container) {
3014
- // Can be implemented in subclasses
3015
- };
3016
-
3017
- BaseAdapter.prototype.destroy = function () {
3018
- // Can be implemented in subclasses
3019
- };
3020
-
3021
- BaseAdapter.prototype.generateResultId = function (container, data) {
3022
- var id = container.id + '-result-';
3023
-
3024
- id += Utils.generateChars(4);
3025
-
3026
- if (data.id != null) {
3027
- id += '-' + data.id.toString();
3028
- } else {
3029
- id += '-' + Utils.generateChars(4);
3030
- }
3031
- return id;
3032
- };
3033
-
3034
- return BaseAdapter;
3035
- });
3036
-
3037
- S2.define('select2/data/select',[
3038
- './base',
3039
- '../utils',
3040
- 'jquery'
3041
- ], function (BaseAdapter, Utils, $) {
3042
- function SelectAdapter ($element, options) {
3043
- this.$element = $element;
3044
- this.options = options;
3045
-
3046
- SelectAdapter.__super__.constructor.call(this);
3047
- }
3048
-
3049
- Utils.Extend(SelectAdapter, BaseAdapter);
3050
-
3051
- SelectAdapter.prototype.current = function (callback) {
3052
- var data = [];
3053
- var self = this;
3054
-
3055
- this.$element.find(':selected').each(function () {
3056
- var $option = $(this);
3057
-
3058
- var option = self.item($option);
3059
-
3060
- data.push(option);
3061
- });
3062
-
3063
- callback(data);
3064
- };
3065
-
3066
- SelectAdapter.prototype.select = function (data) {
3067
- var self = this;
3068
-
3069
- data.selected = true;
3070
-
3071
- // If data.element is a DOM node, use it instead
3072
- if ($(data.element).is('option')) {
3073
- data.element.selected = true;
3074
-
3075
- this.$element.trigger('change');
3076
-
3077
- return;
3078
- }
3079
-
3080
- if (this.$element.prop('multiple')) {
3081
- this.current(function (currentData) {
3082
- var val = [];
3083
-
3084
- data = [data];
3085
- data.push.apply(data, currentData);
3086
-
3087
- for (var d = 0; d < data.length; d++) {
3088
- var id = data[d].id;
3089
-
3090
- if ($.inArray(id, val) === -1) {
3091
- val.push(id);
3092
- }
3093
- }
3094
-
3095
- self.$element.val(val);
3096
- self.$element.trigger('change');
3097
- });
3098
- } else {
3099
- var val = data.id;
3100
-
3101
- this.$element.val(val);
3102
- this.$element.trigger('change');
3103
- }
3104
- };
3105
-
3106
- SelectAdapter.prototype.unselect = function (data) {
3107
- var self = this;
3108
-
3109
- if (!this.$element.prop('multiple')) {
3110
- return;
3111
- }
3112
-
3113
- data.selected = false;
3114
-
3115
- if ($(data.element).is('option')) {
3116
- data.element.selected = false;
3117
-
3118
- this.$element.trigger('change');
3119
-
3120
- return;
3121
- }
3122
-
3123
- this.current(function (currentData) {
3124
- var val = [];
3125
-
3126
- for (var d = 0; d < currentData.length; d++) {
3127
- var id = currentData[d].id;
3128
-
3129
- if (id !== data.id && $.inArray(id, val) === -1) {
3130
- val.push(id);
3131
- }
3132
- }
3133
-
3134
- self.$element.val(val);
3135
-
3136
- self.$element.trigger('change');
3137
- });
3138
- };
3139
-
3140
- SelectAdapter.prototype.bind = function (container, $container) {
3141
- var self = this;
3142
-
3143
- this.container = container;
3144
-
3145
- container.on('select', function (params) {
3146
- self.select(params.data);
3147
- });
3148
-
3149
- container.on('unselect', function (params) {
3150
- self.unselect(params.data);
3151
- });
3152
- };
3153
-
3154
- SelectAdapter.prototype.destroy = function () {
3155
- // Remove anything added to child elements
3156
- this.$element.find('*').each(function () {
3157
- // Remove any custom data set by Select2
3158
- $.removeData(this, 'data');
3159
- });
3160
- };
3161
-
3162
- SelectAdapter.prototype.query = function (params, callback) {
3163
- var data = [];
3164
- var self = this;
3165
-
3166
- var $options = this.$element.children();
3167
-
3168
- $options.each(function () {
3169
- var $option = $(this);
3170
-
3171
- if (!$option.is('option') && !$option.is('optgroup')) {
3172
- return;
3173
- }
3174
-
3175
- var option = self.item($option);
3176
-
3177
- var matches = self.matches(params, option);
3178
-
3179
- if (matches !== null) {
3180
- data.push(matches);
3181
- }
3182
- });
3183
-
3184
- callback({
3185
- results: data
3186
- });
3187
- };
3188
-
3189
- SelectAdapter.prototype.addOptions = function ($options) {
3190
- Utils.appendMany(this.$element, $options);
3191
- };
3192
-
3193
- SelectAdapter.prototype.option = function (data) {
3194
- var option;
3195
-
3196
- if (data.children) {
3197
- option = document.createElement('optgroup');
3198
- option.label = data.text;
3199
- } else {
3200
- option = document.createElement('option');
3201
-
3202
- if (option.textContent !== undefined) {
3203
- option.textContent = data.text;
3204
- } else {
3205
- option.innerText = data.text;
3206
- }
3207
- }
3208
-
3209
- if (data.id !== undefined) {
3210
- option.value = data.id;
3211
- }
3212
-
3213
- if (data.disabled) {
3214
- option.disabled = true;
3215
- }
3216
-
3217
- if (data.selected) {
3218
- option.selected = true;
3219
- }
3220
-
3221
- if (data.title) {
3222
- option.title = data.title;
3223
- }
3224
-
3225
- var $option = $(option);
3226
-
3227
- var normalizedData = this._normalizeItem(data);
3228
- normalizedData.element = option;
3229
-
3230
- // Override the option's data with the combined data
3231
- $.data(option, 'data', normalizedData);
3232
-
3233
- return $option;
3234
- };
3235
-
3236
- SelectAdapter.prototype.item = function ($option) {
3237
- var data = {};
3238
-
3239
- data = $.data($option[0], 'data');
3240
-
3241
- if (data != null) {
3242
- return data;
3243
- }
3244
-
3245
- if ($option.is('option')) {
3246
- data = {
3247
- id: $option.val(),
3248
- text: $option.text(),
3249
- disabled: $option.prop('disabled'),
3250
- selected: $option.prop('selected'),
3251
- title: $option.prop('title')
3252
- };
3253
- } else if ($option.is('optgroup')) {
3254
- data = {
3255
- text: $option.prop('label'),
3256
- children: [],
3257
- title: $option.prop('title')
3258
- };
3259
-
3260
- var $children = $option.children('option');
3261
- var children = [];
3262
-
3263
- for (var c = 0; c < $children.length; c++) {
3264
- var $child = $($children[c]);
3265
-
3266
- var child = this.item($child);
3267
-
3268
- children.push(child);
3269
- }
3270
-
3271
- data.children = children;
3272
- }
3273
-
3274
- data = this._normalizeItem(data);
3275
- data.element = $option[0];
3276
-
3277
- $.data($option[0], 'data', data);
3278
-
3279
- return data;
3280
- };
3281
-
3282
- SelectAdapter.prototype._normalizeItem = function (item) {
3283
- if (!$.isPlainObject(item)) {
3284
- item = {
3285
- id: item,
3286
- text: item
3287
- };
3288
- }
3289
-
3290
- item = $.extend({}, {
3291
- text: ''
3292
- }, item);
3293
-
3294
- var defaults = {
3295
- selected: false,
3296
- disabled: false
3297
- };
3298
-
3299
- if (item.id != null) {
3300
- item.id = item.id.toString();
3301
- }
3302
-
3303
- if (item.text != null) {
3304
- item.text = item.text.toString();
3305
- }
3306
-
3307
- if (item._resultId == null && item.id && this.container != null) {
3308
- item._resultId = this.generateResultId(this.container, item);
3309
- }
3310
-
3311
- return $.extend({}, defaults, item);
3312
- };
3313
-
3314
- SelectAdapter.prototype.matches = function (params, data) {
3315
- var matcher = this.options.get('matcher');
3316
-
3317
- return matcher(params, data);
3318
- };
3319
-
3320
- return SelectAdapter;
3321
- });
3322
-
3323
- S2.define('select2/data/array',[
3324
- './select',
3325
- '../utils',
3326
- 'jquery'
3327
- ], function (SelectAdapter, Utils, $) {
3328
- function ArrayAdapter ($element, options) {
3329
- var data = options.get('data') || [];
3330
-
3331
- ArrayAdapter.__super__.constructor.call(this, $element, options);
3332
-
3333
- this.addOptions(this.convertToOptions(data));
3334
- }
3335
-
3336
- Utils.Extend(ArrayAdapter, SelectAdapter);
3337
-
3338
- ArrayAdapter.prototype.select = function (data) {
3339
- var $option = this.$element.find('option').filter(function (i, elm) {
3340
- return elm.value == data.id.toString();
3341
- });
3342
-
3343
- if ($option.length === 0) {
3344
- $option = this.option(data);
3345
-
3346
- this.addOptions($option);
3347
- }
3348
-
3349
- ArrayAdapter.__super__.select.call(this, data);
3350
- };
3351
-
3352
- ArrayAdapter.prototype.convertToOptions = function (data) {
3353
- var self = this;
3354
-
3355
- var $existing = this.$element.find('option');
3356
- var existingIds = $existing.map(function () {
3357
- return self.item($(this)).id;
3358
- }).get();
3359
-
3360
- var $options = [];
3361
-
3362
- // Filter out all items except for the one passed in the argument
3363
- function onlyItem (item) {
3364
- return function () {
3365
- return $(this).val() == item.id;
3366
- };
3367
- }
3368
-
3369
- for (var d = 0; d < data.length; d++) {
3370
- var item = this._normalizeItem(data[d]);
3371
-
3372
- // Skip items which were pre-loaded, only merge the data
3373
- if ($.inArray(item.id, existingIds) >= 0) {
3374
- var $existingOption = $existing.filter(onlyItem(item));
3375
-
3376
- var existingData = this.item($existingOption);
3377
- var newData = $.extend(true, {}, item, existingData);
3378
-
3379
- var $newOption = this.option(newData);
3380
-
3381
- $existingOption.replaceWith($newOption);
3382
-
3383
- continue;
3384
- }
3385
-
3386
- var $option = this.option(item);
3387
-
3388
- if (item.children) {
3389
- var $children = this.convertToOptions(item.children);
3390
-
3391
- Utils.appendMany($option, $children);
3392
- }
3393
-
3394
- $options.push($option);
3395
- }
3396
-
3397
- return $options;
3398
- };
3399
-
3400
- return ArrayAdapter;
3401
- });
3402
-
3403
- S2.define('select2/data/ajax',[
3404
- './array',
3405
- '../utils',
3406
- 'jquery'
3407
- ], function (ArrayAdapter, Utils, $) {
3408
- function AjaxAdapter ($element, options) {
3409
- this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3410
-
3411
- if (this.ajaxOptions.processResults != null) {
3412
- this.processResults = this.ajaxOptions.processResults;
3413
- }
3414
-
3415
- AjaxAdapter.__super__.constructor.call(this, $element, options);
3416
- }
3417
-
3418
- Utils.Extend(AjaxAdapter, ArrayAdapter);
3419
-
3420
- AjaxAdapter.prototype._applyDefaults = function (options) {
3421
- var defaults = {
3422
- data: function (params) {
3423
- return $.extend({}, params, {
3424
- q: params.term
3425
- });
3426
- },
3427
- transport: function (params, success, failure) {
3428
- var $request = $.ajax(params);
3429
-
3430
- $request.then(success);
3431
- $request.fail(failure);
3432
-
3433
- return $request;
3434
- }
3435
- };
3436
-
3437
- return $.extend({}, defaults, options, true);
3438
- };
3439
-
3440
- AjaxAdapter.prototype.processResults = function (results) {
3441
- return results;
3442
- };
3443
-
3444
- AjaxAdapter.prototype.query = function (params, callback) {
3445
- var matches = [];
3446
- var self = this;
3447
-
3448
- if (this._request != null) {
3449
- // JSONP requests cannot always be aborted
3450
- if ($.isFunction(this._request.abort)) {
3451
- this._request.abort();
3452
- }
3453
-
3454
- this._request = null;
3455
- }
3456
-
3457
- var options = $.extend({
3458
- type: 'GET'
3459
- }, this.ajaxOptions);
3460
-
3461
- if (typeof options.url === 'function') {
3462
- options.url = options.url.call(this.$element, params);
3463
- }
3464
-
3465
- if (typeof options.data === 'function') {
3466
- options.data = options.data.call(this.$element, params);
3467
- }
3468
-
3469
- function request () {
3470
- var $request = options.transport(options, function (data) {
3471
- var results = self.processResults(data, params);
3472
-
3473
- if (self.options.get('debug') && window.console && console.error) {
3474
- // Check to make sure that the response included a `results` key.
3475
- if (!results || !results.results || !$.isArray(results.results)) {
3476
- console.error(
3477
- 'Select2: The AJAX results did not return an array in the ' +
3478
- '`results` key of the response.'
3479
- );
3480
- }
3481
- }
3482
-
3483
- callback(results);
3484
- }, function () {
3485
- // Attempt to detect if a request was aborted
3486
- // Only works if the transport exposes a status property
3487
- if ($request.status && $request.status === '0') {
3488
- return;
3489
- }
3490
-
3491
- self.trigger('results:message', {
3492
- message: 'errorLoading'
3493
- });
3494
- });
3495
-
3496
- self._request = $request;
3497
- }
3498
-
3499
- if (this.ajaxOptions.delay && params.term != null) {
3500
- if (this._queryTimeout) {
3501
- window.clearTimeout(this._queryTimeout);
3502
- }
3503
-
3504
- this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3505
- } else {
3506
- request();
3507
- }
3508
- };
3509
-
3510
- return AjaxAdapter;
3511
- });
3512
-
3513
- S2.define('select2/data/tags',[
3514
- 'jquery'
3515
- ], function ($) {
3516
- function Tags (decorated, $element, options) {
3517
- var tags = options.get('tags');
3518
-
3519
- var createTag = options.get('createTag');
3520
-
3521
- if (createTag !== undefined) {
3522
- this.createTag = createTag;
3523
- }
3524
-
3525
- var insertTag = options.get('insertTag');
3526
-
3527
- if (insertTag !== undefined) {
3528
- this.insertTag = insertTag;
3529
- }
3530
-
3531
- decorated.call(this, $element, options);
3532
-
3533
- if ($.isArray(tags)) {
3534
- for (var t = 0; t < tags.length; t++) {
3535
- var tag = tags[t];
3536
- var item = this._normalizeItem(tag);
3537
-
3538
- var $option = this.option(item);
3539
-
3540
- this.$element.append($option);
3541
- }
3542
- }
3543
- }
3544
-
3545
- Tags.prototype.query = function (decorated, params, callback) {
3546
- var self = this;
3547
-
3548
- this._removeOldTags();
3549
-
3550
- if (params.term == null || params.page != null) {
3551
- decorated.call(this, params, callback);
3552
- return;
3553
- }
3554
-
3555
- function wrapper (obj, child) {
3556
- var data = obj.results;
3557
-
3558
- for (var i = 0; i < data.length; i++) {
3559
- var option = data[i];
3560
-
3561
- var checkChildren = (
3562
- option.children != null &&
3563
- !wrapper({
3564
- results: option.children
3565
- }, true)
3566
- );
3567
-
3568
- var optionText = (option.text || '').toUpperCase();
3569
- var paramsTerm = (params.term || '').toUpperCase();
3570
-
3571
- var checkText = optionText === paramsTerm;
3572
-
3573
- if (checkText || checkChildren) {
3574
- if (child) {
3575
- return false;
3576
- }
3577
-
3578
- obj.data = data;
3579
- callback(obj);
3580
-
3581
- return;
3582
- }
3583
- }
3584
-
3585
- if (child) {
3586
- return true;
3587
- }
3588
-
3589
- var tag = self.createTag(params);
3590
-
3591
- if (tag != null) {
3592
- var $option = self.option(tag);
3593
- $option.attr('data-select2-tag', true);
3594
-
3595
- self.addOptions([$option]);
3596
-
3597
- self.insertTag(data, tag);
3598
- }
3599
-
3600
- obj.results = data;
3601
-
3602
- callback(obj);
3603
- }
3604
-
3605
- decorated.call(this, params, wrapper);
3606
- };
3607
-
3608
- Tags.prototype.createTag = function (decorated, params) {
3609
- var term = $.trim(params.term);
3610
-
3611
- if (term === '') {
3612
- return null;
3613
- }
3614
-
3615
- return {
3616
- id: term,
3617
- text: term
3618
- };
3619
- };
3620
-
3621
- Tags.prototype.insertTag = function (_, data, tag) {
3622
- data.unshift(tag);
3623
- };
3624
-
3625
- Tags.prototype._removeOldTags = function (_) {
3626
- var tag = this._lastTag;
3627
-
3628
- var $options = this.$element.find('option[data-select2-tag]');
3629
-
3630
- $options.each(function () {
3631
- if (this.selected) {
3632
- return;
3633
- }
3634
-
3635
- $(this).remove();
3636
- });
3637
- };
3638
-
3639
- return Tags;
3640
- });
3641
-
3642
- S2.define('select2/data/tokenizer',[
3643
- 'jquery'
3644
- ], function ($) {
3645
- function Tokenizer (decorated, $element, options) {
3646
- var tokenizer = options.get('tokenizer');
3647
-
3648
- if (tokenizer !== undefined) {
3649
- this.tokenizer = tokenizer;
3650
- }
3651
-
3652
- decorated.call(this, $element, options);
3653
- }
3654
-
3655
- Tokenizer.prototype.bind = function (decorated, container, $container) {
3656
- decorated.call(this, container, $container);
3657
-
3658
- this.$search = container.dropdown.$search || container.selection.$search ||
3659
- $container.find('.select2-search__field');
3660
- };
3661
-
3662
- Tokenizer.prototype.query = function (decorated, params, callback) {
3663
- var self = this;
3664
-
3665
- function createAndSelect (data) {
3666
- // Normalize the data object so we can use it for checks
3667
- var item = self._normalizeItem(data);
3668
-
3669
- // Check if the data object already exists as a tag
3670
- // Select it if it doesn't
3671
- var $existingOptions = self.$element.find('option').filter(function () {
3672
- return $(this).val() === item.id;
3673
- });
3674
-
3675
- // If an existing option wasn't found for it, create the option
3676
- if (!$existingOptions.length) {
3677
- var $option = self.option(item);
3678
- $option.attr('data-select2-tag', true);
3679
-
3680
- self._removeOldTags();
3681
- self.addOptions([$option]);
3682
- }
3683
-
3684
- // Select the item, now that we know there is an option for it
3685
- select(item);
3686
- }
3687
-
3688
- function select (data) {
3689
- self.trigger('select', {
3690
- data: data
3691
- });
3692
- }
3693
-
3694
- params.term = params.term || '';
3695
-
3696
- var tokenData = this.tokenizer(params, this.options, createAndSelect);
3697
-
3698
- if (tokenData.term !== params.term) {
3699
- // Replace the search term if we have the search box
3700
- if (this.$search.length) {
3701
- this.$search.val(tokenData.term);
3702
- this.$search.focus();
3703
- }
3704
-
3705
- params.term = tokenData.term;
3706
- }
3707
-
3708
- decorated.call(this, params, callback);
3709
- };
3710
-
3711
- Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3712
- var separators = options.get('tokenSeparators') || [];
3713
- var term = params.term;
3714
- var i = 0;
3715
-
3716
- var createTag = this.createTag || function (params) {
3717
- return {
3718
- id: params.term,
3719
- text: params.term
3720
- };
3721
- };
3722
-
3723
- while (i < term.length) {
3724
- var termChar = term[i];
3725
-
3726
- if ($.inArray(termChar, separators) === -1) {
3727
- i++;
3728
-
3729
- continue;
3730
- }
3731
-
3732
- var part = term.substr(0, i);
3733
- var partParams = $.extend({}, params, {
3734
- term: part
3735
- });
3736
-
3737
- var data = createTag(partParams);
3738
-
3739
- if (data == null) {
3740
- i++;
3741
- continue;
3742
- }
3743
-
3744
- callback(data);
3745
-
3746
- // Reset the term to not include the tokenized portion
3747
- term = term.substr(i + 1) || '';
3748
- i = 0;
3749
- }
3750
-
3751
- return {
3752
- term: term
3753
- };
3754
- };
3755
-
3756
- return Tokenizer;
3757
- });
3758
-
3759
- S2.define('select2/data/minimumInputLength',[
3760
-
3761
- ], function () {
3762
- function MinimumInputLength (decorated, $e, options) {
3763
- this.minimumInputLength = options.get('minimumInputLength');
3764
-
3765
- decorated.call(this, $e, options);
3766
- }
3767
-
3768
- MinimumInputLength.prototype.query = function (decorated, params, callback) {
3769
- params.term = params.term || '';
3770
-
3771
- if (params.term.length < this.minimumInputLength) {
3772
- this.trigger('results:message', {
3773
- message: 'inputTooShort',
3774
- args: {
3775
- minimum: this.minimumInputLength,
3776
- input: params.term,
3777
- params: params
3778
- }
3779
- });
3780
-
3781
- return;
3782
- }
3783
-
3784
- decorated.call(this, params, callback);
3785
- };
3786
-
3787
- return MinimumInputLength;
3788
- });
3789
-
3790
- S2.define('select2/data/maximumInputLength',[
3791
-
3792
- ], function () {
3793
- function MaximumInputLength (decorated, $e, options) {
3794
- this.maximumInputLength = options.get('maximumInputLength');
3795
-
3796
- decorated.call(this, $e, options);
3797
- }
3798
-
3799
- MaximumInputLength.prototype.query = function (decorated, params, callback) {
3800
- params.term = params.term || '';
3801
-
3802
- if (this.maximumInputLength > 0 &&
3803
- params.term.length > this.maximumInputLength) {
3804
- this.trigger('results:message', {
3805
- message: 'inputTooLong',
3806
- args: {
3807
- maximum: this.maximumInputLength,
3808
- input: params.term,
3809
- params: params
3810
- }
3811
- });
3812
-
3813
- return;
3814
- }
3815
-
3816
- decorated.call(this, params, callback);
3817
- };
3818
-
3819
- return MaximumInputLength;
3820
- });
3821
-
3822
- S2.define('select2/data/maximumSelectionLength',[
3823
-
3824
- ], function (){
3825
- function MaximumSelectionLength (decorated, $e, options) {
3826
- this.maximumSelectionLength = options.get('maximumSelectionLength');
3827
-
3828
- decorated.call(this, $e, options);
3829
- }
3830
-
3831
- MaximumSelectionLength.prototype.query =
3832
- function (decorated, params, callback) {
3833
- var self = this;
3834
-
3835
- this.current(function (currentData) {
3836
- var count = currentData != null ? currentData.length : 0;
3837
- if (self.maximumSelectionLength > 0 &&
3838
- count >= self.maximumSelectionLength) {
3839
- self.trigger('results:message', {
3840
- message: 'maximumSelected',
3841
- args: {
3842
- maximum: self.maximumSelectionLength
3843
- }
3844
- });
3845
- return;
3846
- }
3847
- decorated.call(self, params, callback);
3848
- });
3849
- };
3850
-
3851
- return MaximumSelectionLength;
3852
- });
3853
-
3854
- S2.define('select2/dropdown',[
3855
- 'jquery',
3856
- './utils'
3857
- ], function ($, Utils) {
3858
- function Dropdown ($element, options) {
3859
- this.$element = $element;
3860
- this.options = options;
3861
-
3862
- Dropdown.__super__.constructor.call(this);
3863
- }
3864
-
3865
- Utils.Extend(Dropdown, Utils.Observable);
3866
-
3867
- Dropdown.prototype.render = function () {
3868
- var $dropdown = $(
3869
- '<span class="select2-dropdown">' +
3870
- '<span class="select2-results"></span>' +
3871
- '</span>'
3872
- );
3873
-
3874
- $dropdown.attr('dir', this.options.get('dir'));
3875
-
3876
- this.$dropdown = $dropdown;
3877
-
3878
- return $dropdown;
3879
- };
3880
-
3881
- Dropdown.prototype.bind = function () {
3882
- // Should be implemented in subclasses
3883
- };
3884
-
3885
- Dropdown.prototype.position = function ($dropdown, $container) {
3886
- // Should be implmented in subclasses
3887
- };
3888
-
3889
- Dropdown.prototype.destroy = function () {
3890
- // Remove the dropdown from the DOM
3891
- this.$dropdown.remove();
3892
- };
3893
-
3894
- return Dropdown;
3895
- });
3896
-
3897
- S2.define('select2/dropdown/search',[
3898
- 'jquery',
3899
- '../utils'
3900
- ], function ($, Utils) {
3901
- function Search () { }
3902
-
3903
- Search.prototype.render = function (decorated) {
3904
- var $rendered = decorated.call(this);
3905
-
3906
- var $search = $(
3907
- '<span class="select2-search select2-search--dropdown">' +
3908
- '<input class="select2-search__field" type="search" tabindex="-1"' +
3909
- ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
3910
- ' spellcheck="false" role="textbox" />' +
3911
- '</span>'
3912
- );
3913
-
3914
- this.$searchContainer = $search;
3915
- this.$search = $search.find('input');
3916
-
3917
- $rendered.prepend($search);
3918
-
3919
- return $rendered;
3920
- };
3921
-
3922
- Search.prototype.bind = function (decorated, container, $container) {
3923
- var self = this;
3924
-
3925
- decorated.call(this, container, $container);
3926
-
3927
- this.$search.on('keydown', function (evt) {
3928
- self.trigger('keypress', evt);
3929
-
3930
- self._keyUpPrevented = evt.isDefaultPrevented();
3931
- });
3932
-
3933
- // Workaround for browsers which do not support the `input` event
3934
- // This will prevent double-triggering of events for browsers which support
3935
- // both the `keyup` and `input` events.
3936
- this.$search.on('input', function (evt) {
3937
- // Unbind the duplicated `keyup` event
3938
- $(this).off('keyup');
3939
- });
3940
-
3941
- this.$search.on('keyup input', function (evt) {
3942
- self.handleSearch(evt);
3943
- });
3944
-
3945
- container.on('open', function () {
3946
- self.$search.attr('tabindex', 0);
3947
-
3948
- self.$search.focus();
3949
-
3950
- window.setTimeout(function () {
3951
- self.$search.focus();
3952
- }, 0);
3953
- });
3954
-
3955
- container.on('close', function () {
3956
- self.$search.attr('tabindex', -1);
3957
-
3958
- self.$search.val('');
3959
- });
3960
-
3961
- container.on('focus', function () {
3962
- if (container.isOpen()) {
3963
- self.$search.focus();
3964
- }
3965
- });
3966
-
3967
- container.on('results:all', function (params) {
3968
- if (params.query.term == null || params.query.term === '') {
3969
- var showSearch = self.showSearch(params);
3970
-
3971
- if (showSearch) {
3972
- self.$searchContainer.removeClass('select2-search--hide');
3973
- } else {
3974
- self.$searchContainer.addClass('select2-search--hide');
3975
- }
3976
- }
3977
- });
3978
- };
3979
-
3980
- Search.prototype.handleSearch = function (evt) {
3981
- if (!this._keyUpPrevented) {
3982
- var input = this.$search.val();
3983
-
3984
- this.trigger('query', {
3985
- term: input
3986
- });
3987
- }
3988
-
3989
- this._keyUpPrevented = false;
3990
- };
3991
-
3992
- Search.prototype.showSearch = function (_, params) {
3993
- return true;
3994
- };
3995
-
3996
- return Search;
3997
- });
3998
-
3999
- S2.define('select2/dropdown/hidePlaceholder',[
4000
-
4001
- ], function () {
4002
- function HidePlaceholder (decorated, $element, options, dataAdapter) {
4003
- this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4004
-
4005
- decorated.call(this, $element, options, dataAdapter);
4006
- }
4007
-
4008
- HidePlaceholder.prototype.append = function (decorated, data) {
4009
- data.results = this.removePlaceholder(data.results);
4010
-
4011
- decorated.call(this, data);
4012
- };
4013
-
4014
- HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4015
- if (typeof placeholder === 'string') {
4016
- placeholder = {
4017
- id: '',
4018
- text: placeholder
4019
- };
4020
- }
4021
-
4022
- return placeholder;
4023
- };
4024
-
4025
- HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4026
- var modifiedData = data.slice(0);
4027
-
4028
- for (var d = data.length - 1; d >= 0; d--) {
4029
- var item = data[d];
4030
-
4031
- if (this.placeholder.id === item.id) {
4032
- modifiedData.splice(d, 1);
4033
- }
4034
- }
4035
-
4036
- return modifiedData;
4037
- };
4038
-
4039
- return HidePlaceholder;
4040
- });
4041
-
4042
- S2.define('select2/dropdown/infiniteScroll',[
4043
- 'jquery'
4044
- ], function ($) {
4045
- function InfiniteScroll (decorated, $element, options, dataAdapter) {
4046
- this.lastParams = {};
4047
-
4048
- decorated.call(this, $element, options, dataAdapter);
4049
-
4050
- this.$loadingMore = this.createLoadingMore();
4051
- this.loading = false;
4052
- }
4053
-
4054
- InfiniteScroll.prototype.append = function (decorated, data) {
4055
- this.$loadingMore.remove();
4056
- this.loading = false;
4057
-
4058
- decorated.call(this, data);
4059
-
4060
- if (this.showLoadingMore(data)) {
4061
- this.$results.append(this.$loadingMore);
4062
- }
4063
- };
4064
-
4065
- InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4066
- var self = this;
4067
-
4068
- decorated.call(this, container, $container);
4069
-
4070
- container.on('query', function (params) {
4071
- self.lastParams = params;
4072
- self.loading = true;
4073
- });
4074
-
4075
- container.on('query:append', function (params) {
4076
- self.lastParams = params;
4077
- self.loading = true;
4078
- });
4079
-
4080
- this.$results.on('scroll', function () {
4081
- var isLoadMoreVisible = $.contains(
4082
- document.documentElement,
4083
- self.$loadingMore[0]
4084
- );
4085
-
4086
- if (self.loading || !isLoadMoreVisible) {
4087
- return;
4088
- }
4089
-
4090
- var currentOffset = self.$results.offset().top +
4091
- self.$results.outerHeight(false);
4092
- var loadingMoreOffset = self.$loadingMore.offset().top +
4093
- self.$loadingMore.outerHeight(false);
4094
-
4095
- if (currentOffset + 50 >= loadingMoreOffset) {
4096
- self.loadMore();
4097
- }
4098
- });
4099
- };
4100
-
4101
- InfiniteScroll.prototype.loadMore = function () {
4102
- this.loading = true;
4103
-
4104
- var params = $.extend({}, {page: 1}, this.lastParams);
4105
-
4106
- params.page++;
4107
-
4108
- this.trigger('query:append', params);
4109
- };
4110
-
4111
- InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4112
- return data.pagination && data.pagination.more;
4113
- };
4114
-
4115
- InfiniteScroll.prototype.createLoadingMore = function () {
4116
- var $option = $(
4117
- '<li ' +
4118
- 'class="select2-results__option select2-results__option--load-more"' +
4119
- 'role="treeitem" aria-disabled="true"></li>'
4120
- );
4121
-
4122
- var message = this.options.get('translations').get('loadingMore');
4123
-
4124
- $option.html(message(this.lastParams));
4125
-
4126
- return $option;
4127
- };
4128
-
4129
- return InfiniteScroll;
4130
- });
4131
-
4132
- S2.define('select2/dropdown/attachBody',[
4133
- 'jquery',
4134
- '../utils'
4135
- ], function ($, Utils) {
4136
- function AttachBody (decorated, $element, options) {
4137
- this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4138
-
4139
- decorated.call(this, $element, options);
4140
- }
4141
-
4142
- AttachBody.prototype.bind = function (decorated, container, $container) {
4143
- var self = this;
4144
-
4145
- var setupResultsEvents = false;
4146
-
4147
- decorated.call(this, container, $container);
4148
-
4149
- container.on('open', function () {
4150
- self._showDropdown();
4151
- self._attachPositioningHandler(container);
4152
-
4153
- if (!setupResultsEvents) {
4154
- setupResultsEvents = true;
4155
-
4156
- container.on('results:all', function () {
4157
- self._positionDropdown();
4158
- self._resizeDropdown();
4159
- });
4160
-
4161
- container.on('results:append', function () {
4162
- self._positionDropdown();
4163
- self._resizeDropdown();
4164
- });
4165
- }
4166
- });
4167
-
4168
- container.on('close', function () {
4169
- self._hideDropdown();
4170
- self._detachPositioningHandler(container);
4171
- });
4172
-
4173
- this.$dropdownContainer.on('mousedown', function (evt) {
4174
- evt.stopPropagation();
4175
- });
4176
- };
4177
-
4178
- AttachBody.prototype.destroy = function (decorated) {
4179
- decorated.call(this);
4180
-
4181
- this.$dropdownContainer.remove();
4182
- };
4183
-
4184
- AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4185
- // Clone all of the container classes
4186
- $dropdown.attr('class', $container.attr('class'));
4187
-
4188
- $dropdown.removeClass('select2');
4189
- $dropdown.addClass('select2-container--open');
4190
-
4191
- $dropdown.css({
4192
- position: 'absolute',
4193
- top: -999999
4194
- });
4195
-
4196
- this.$container = $container;
4197
- };
4198
-
4199
- AttachBody.prototype.render = function (decorated) {
4200
- var $container = $('<span></span>');
4201
-
4202
- var $dropdown = decorated.call(this);
4203
- $container.append($dropdown);
4204
-
4205
- this.$dropdownContainer = $container;
4206
-
4207
- return $container;
4208
- };
4209
-
4210
- AttachBody.prototype._hideDropdown = function (decorated) {
4211
- this.$dropdownContainer.detach();
4212
- };
4213
-
4214
- AttachBody.prototype._attachPositioningHandler =
4215
- function (decorated, container) {
4216
- var self = this;
4217
-
4218
- var scrollEvent = 'scroll.select2.' + container.id;
4219
- var resizeEvent = 'resize.select2.' + container.id;
4220
- var orientationEvent = 'orientationchange.select2.' + container.id;
4221
-
4222
- var $watchers = this.$container.parents().filter(Utils.hasScroll);
4223
- $watchers.each(function () {
4224
- $(this).data('select2-scroll-position', {
4225
- x: $(this).scrollLeft(),
4226
- y: $(this).scrollTop()
4227
- });
4228
- });
4229
-
4230
- $watchers.on(scrollEvent, function (ev) {
4231
- var position = $(this).data('select2-scroll-position');
4232
- $(this).scrollTop(position.y);
4233
- });
4234
-
4235
- $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4236
- function (e) {
4237
- self._positionDropdown();
4238
- self._resizeDropdown();
4239
- });
4240
- };
4241
-
4242
- AttachBody.prototype._detachPositioningHandler =
4243
- function (decorated, container) {
4244
- var scrollEvent = 'scroll.select2.' + container.id;
4245
- var resizeEvent = 'resize.select2.' + container.id;
4246
- var orientationEvent = 'orientationchange.select2.' + container.id;
4247
-
4248
- var $watchers = this.$container.parents().filter(Utils.hasScroll);
4249
- $watchers.off(scrollEvent);
4250
-
4251
- $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4252
- };
4253
-
4254
- AttachBody.prototype._positionDropdown = function () {
4255
- var $window = $(window);
4256
-
4257
- var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4258
- var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4259
-
4260
- var newDirection = null;
4261
-
4262
- var offset = this.$container.offset();
4263
-
4264
- offset.bottom = offset.top + this.$container.outerHeight(false);
4265
-
4266
- var container = {
4267
- height: this.$container.outerHeight(false)
4268
- };
4269
-
4270
- container.top = offset.top;
4271
- container.bottom = offset.top + container.height;
4272
-
4273
- var dropdown = {
4274
- height: this.$dropdown.outerHeight(false)
4275
- };
4276
-
4277
- var viewport = {
4278
- top: $window.scrollTop(),
4279
- bottom: $window.scrollTop() + $window.height()
4280
- };
4281
-
4282
- var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4283
- var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4284
-
4285
- var css = {
4286
- left: offset.left,
4287
- top: container.bottom
4288
- };
4289
-
4290
- // Determine what the parent element is to use for calciulating the offset
4291
- var $offsetParent = this.$dropdownParent;
4292
-
4293
- // For statically positoned elements, we need to get the element
4294
- // that is determining the offset
4295
- if ($offsetParent.css('position') === 'static') {
4296
- $offsetParent = $offsetParent.offsetParent();
4297
- }
4298
-
4299
- var parentOffset = $offsetParent.offset();
4300
-
4301
- css.top -= parentOffset.top;
4302
- css.left -= parentOffset.left;
4303
-
4304
- if (!isCurrentlyAbove && !isCurrentlyBelow) {
4305
- newDirection = 'below';
4306
- }
4307
-
4308
- if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4309
- newDirection = 'above';
4310
- } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4311
- newDirection = 'below';
4312
- }
4313
-
4314
- if (newDirection == 'above' ||
4315
- (isCurrentlyAbove && newDirection !== 'below')) {
4316
- css.top = container.top - parentOffset.top - dropdown.height;
4317
- }
4318
-
4319
- if (newDirection != null) {
4320
- this.$dropdown
4321
- .removeClass('select2-dropdown--below select2-dropdown--above')
4322
- .addClass('select2-dropdown--' + newDirection);
4323
- this.$container
4324
- .removeClass('select2-container--below select2-container--above')
4325
- .addClass('select2-container--' + newDirection);
4326
- }
4327
-
4328
- this.$dropdownContainer.css(css);
4329
- };
4330
-
4331
- AttachBody.prototype._resizeDropdown = function () {
4332
- var css = {
4333
- width: this.$container.outerWidth(false) + 'px'
4334
- };
4335
-
4336
- if (this.options.get('dropdownAutoWidth')) {
4337
- css.minWidth = css.width;
4338
- css.position = 'relative';
4339
- css.width = 'auto';
4340
- }
4341
-
4342
- this.$dropdown.css(css);
4343
- };
4344
-
4345
- AttachBody.prototype._showDropdown = function (decorated) {
4346
- this.$dropdownContainer.appendTo(this.$dropdownParent);
4347
-
4348
- this._positionDropdown();
4349
- this._resizeDropdown();
4350
- };
4351
-
4352
- return AttachBody;
4353
- });
4354
-
4355
- S2.define('select2/dropdown/minimumResultsForSearch',[
4356
-
4357
- ], function () {
4358
- function countResults (data) {
4359
- var count = 0;
4360
-
4361
- for (var d = 0; d < data.length; d++) {
4362
- var item = data[d];
4363
-
4364
- if (item.children) {
4365
- count += countResults(item.children);
4366
- } else {
4367
- count++;
4368
- }
4369
- }
4370
-
4371
- return count;
4372
- }
4373
-
4374
- function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4375
- this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4376
-
4377
- if (this.minimumResultsForSearch < 0) {
4378
- this.minimumResultsForSearch = Infinity;
4379
- }
4380
-
4381
- decorated.call(this, $element, options, dataAdapter);
4382
- }
4383
-
4384
- MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4385
- if (countResults(params.data.results) < this.minimumResultsForSearch) {
4386
- return false;
4387
- }
4388
-
4389
- return decorated.call(this, params);
4390
- };
4391
-
4392
- return MinimumResultsForSearch;
4393
- });
4394
-
4395
- S2.define('select2/dropdown/selectOnClose',[
4396
-
4397
- ], function () {
4398
- function SelectOnClose () { }
4399
-
4400
- SelectOnClose.prototype.bind = function (decorated, container, $container) {
4401
- var self = this;
4402
-
4403
- decorated.call(this, container, $container);
4404
-
4405
- container.on('close', function (params) {
4406
- self._handleSelectOnClose(params);
4407
- });
4408
- };
4409
-
4410
- SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4411
- if (params && params.originalSelect2Event != null) {
4412
- var event = params.originalSelect2Event;
4413
-
4414
- // Don't select an item if the close event was triggered from a select or
4415
- // unselect event
4416
- if (event._type === 'select' || event._type === 'unselect') {
4417
- return;
4418
- }
4419
- }
4420
-
4421
- var $highlightedResults = this.getHighlightedResults();
4422
-
4423
- // Only select highlighted results
4424
- if ($highlightedResults.length < 1) {
4425
- return;
4426
- }
4427
-
4428
- var data = $highlightedResults.data('data');
4429
-
4430
- // Don't re-select already selected resulte
4431
- if (
4432
- (data.element != null && data.element.selected) ||
4433
- (data.element == null && data.selected)
4434
- ) {
4435
- return;
4436
- }
4437
-
4438
- this.trigger('select', {
4439
- data: data
4440
- });
4441
- };
4442
-
4443
- return SelectOnClose;
4444
- });
4445
-
4446
- S2.define('select2/dropdown/closeOnSelect',[
4447
-
4448
- ], function () {
4449
- function CloseOnSelect () { }
4450
-
4451
- CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4452
- var self = this;
4453
-
4454
- decorated.call(this, container, $container);
4455
-
4456
- container.on('select', function (evt) {
4457
- self._selectTriggered(evt);
4458
- });
4459
-
4460
- container.on('unselect', function (evt) {
4461
- self._selectTriggered(evt);
4462
- });
4463
- };
4464
-
4465
- CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4466
- var originalEvent = evt.originalEvent;
4467
-
4468
- // Don't close if the control key is being held
4469
- if (originalEvent && originalEvent.ctrlKey) {
4470
- return;
4471
- }
4472
-
4473
- this.trigger('close', {
4474
- originalEvent: originalEvent,
4475
- originalSelect2Event: evt
4476
- });
4477
- };
4478
-
4479
- return CloseOnSelect;
4480
- });
4481
-
4482
- S2.define('select2/i18n/en',[],function () {
4483
- // English
4484
- return {
4485
- errorLoading: function () {
4486
- return 'The results could not be loaded.';
4487
- },
4488
- inputTooLong: function (args) {
4489
- var overChars = args.input.length - args.maximum;
4490
-
4491
- var message = 'Please delete ' + overChars + ' character';
4492
-
4493
- if (overChars != 1) {
4494
- message += 's';
4495
- }
4496
-
4497
- return message;
4498
- },
4499
- inputTooShort: function (args) {
4500
- var remainingChars = args.minimum - args.input.length;
4501
-
4502
- var message = 'Please enter ' + remainingChars + ' or more characters';
4503
-
4504
- return message;
4505
- },
4506
- loadingMore: function () {
4507
- return 'Loading more results…';
4508
- },
4509
- maximumSelected: function (args) {
4510
- var message = 'You can only select ' + args.maximum + ' item';
4511
-
4512
- if (args.maximum != 1) {
4513
- message += 's';
4514
- }
4515
-
4516
- return message;
4517
- },
4518
- noResults: function () {
4519
- return 'No results found';
4520
- },
4521
- searching: function () {
4522
- return 'Searching…';
4523
- }
4524
- };
4525
- });
4526
-
4527
- S2.define('select2/defaults',[
4528
- 'jquery',
4529
- 'require',
4530
-
4531
- './results',
4532
-
4533
- './selection/single',
4534
- './selection/multiple',
4535
- './selection/placeholder',
4536
- './selection/allowClear',
4537
- './selection/search',
4538
- './selection/eventRelay',
4539
-
4540
- './utils',
4541
- './translation',
4542
- './diacritics',
4543
-
4544
- './data/select',
4545
- './data/array',
4546
- './data/ajax',
4547
- './data/tags',
4548
- './data/tokenizer',
4549
- './data/minimumInputLength',
4550
- './data/maximumInputLength',
4551
- './data/maximumSelectionLength',
4552
-
4553
- './dropdown',
4554
- './dropdown/search',
4555
- './dropdown/hidePlaceholder',
4556
- './dropdown/infiniteScroll',
4557
- './dropdown/attachBody',
4558
- './dropdown/minimumResultsForSearch',
4559
- './dropdown/selectOnClose',
4560
- './dropdown/closeOnSelect',
4561
-
4562
- './i18n/en'
4563
- ], function ($, require,
4564
-
4565
- ResultsList,
4566
-
4567
- SingleSelection, MultipleSelection, Placeholder, AllowClear,
4568
- SelectionSearch, EventRelay,
4569
-
4570
- Utils, Translation, DIACRITICS,
4571
-
4572
- SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4573
- MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4574
-
4575
- Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4576
- AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4577
-
4578
- EnglishTranslation) {
4579
- function Defaults () {
4580
- this.reset();
4581
- }
4582
-
4583
- Defaults.prototype.apply = function (options) {
4584
- options = $.extend(true, {}, this.defaults, options);
4585
-
4586
- if (options.dataAdapter == null) {
4587
- if (options.ajax != null) {
4588
- options.dataAdapter = AjaxData;
4589
- } else if (options.data != null) {
4590
- options.dataAdapter = ArrayData;
4591
- } else {
4592
- options.dataAdapter = SelectData;
4593
- }
4594
-
4595
- if (options.minimumInputLength > 0) {
4596
- options.dataAdapter = Utils.Decorate(
4597
- options.dataAdapter,
4598
- MinimumInputLength
4599
- );
4600
- }
4601
-
4602
- if (options.maximumInputLength > 0) {
4603
- options.dataAdapter = Utils.Decorate(
4604
- options.dataAdapter,
4605
- MaximumInputLength
4606
- );
4607
- }
4608
-
4609
- if (options.maximumSelectionLength > 0) {
4610
- options.dataAdapter = Utils.Decorate(
4611
- options.dataAdapter,
4612
- MaximumSelectionLength
4613
- );
4614
- }
4615
-
4616
- if (options.tags) {
4617
- options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4618
- }
4619
-
4620
- if (options.tokenSeparators != null || options.tokenizer != null) {
4621
- options.dataAdapter = Utils.Decorate(
4622
- options.dataAdapter,
4623
- Tokenizer
4624
- );
4625
- }
4626
-
4627
- if (options.query != null) {
4628
- var Query = require(options.amdBase + 'compat/query');
4629
-
4630
- options.dataAdapter = Utils.Decorate(
4631
- options.dataAdapter,
4632
- Query
4633
- );
4634
- }
4635
-
4636
- if (options.initSelection != null) {
4637
- var InitSelection = require(options.amdBase + 'compat/initSelection');
4638
-
4639
- options.dataAdapter = Utils.Decorate(
4640
- options.dataAdapter,
4641
- InitSelection
4642
- );
4643
- }
4644
- }
4645
-
4646
- if (options.resultsAdapter == null) {
4647
- options.resultsAdapter = ResultsList;
4648
-
4649
- if (options.ajax != null) {
4650
- options.resultsAdapter = Utils.Decorate(
4651
- options.resultsAdapter,
4652
- InfiniteScroll
4653
- );
4654
- }
4655
-
4656
- if (options.placeholder != null) {
4657
- options.resultsAdapter = Utils.Decorate(
4658
- options.resultsAdapter,
4659
- HidePlaceholder
4660
- );
4661
- }
4662
-
4663
- if (options.selectOnClose) {
4664
- options.resultsAdapter = Utils.Decorate(
4665
- options.resultsAdapter,
4666
- SelectOnClose
4667
- );
4668
- }
4669
- }
4670
-
4671
- if (options.dropdownAdapter == null) {
4672
- if (options.multiple) {
4673
- options.dropdownAdapter = Dropdown;
4674
- } else {
4675
- var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4676
-
4677
- options.dropdownAdapter = SearchableDropdown;
4678
- }
4679
-
4680
- if (options.minimumResultsForSearch !== 0) {
4681
- options.dropdownAdapter = Utils.Decorate(
4682
- options.dropdownAdapter,
4683
- MinimumResultsForSearch
4684
- );
4685
- }
4686
-
4687
- if (options.closeOnSelect) {
4688
- options.dropdownAdapter = Utils.Decorate(
4689
- options.dropdownAdapter,
4690
- CloseOnSelect
4691
- );
4692
- }
4693
-
4694
- if (
4695
- options.dropdownCssClass != null ||
4696
- options.dropdownCss != null ||
4697
- options.adaptDropdownCssClass != null
4698
- ) {
4699
- var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4700
-
4701
- options.dropdownAdapter = Utils.Decorate(
4702
- options.dropdownAdapter,
4703
- DropdownCSS
4704
- );
4705
- }
4706
-
4707
- options.dropdownAdapter = Utils.Decorate(
4708
- options.dropdownAdapter,
4709
- AttachBody
4710
- );
4711
- }
4712
-
4713
- if (options.selectionAdapter == null) {
4714
- if (options.multiple) {
4715
- options.selectionAdapter = MultipleSelection;
4716
- } else {
4717
- options.selectionAdapter = SingleSelection;
4718
- }
4719
-
4720
- // Add the placeholder mixin if a placeholder was specified
4721
- if (options.placeholder != null) {
4722
- options.selectionAdapter = Utils.Decorate(
4723
- options.selectionAdapter,
4724
- Placeholder
4725
- );
4726
- }
4727
-
4728
- if (options.allowClear) {
4729
- options.selectionAdapter = Utils.Decorate(
4730
- options.selectionAdapter,
4731
- AllowClear
4732
- );
4733
- }
4734
-
4735
- if (options.multiple) {
4736
- options.selectionAdapter = Utils.Decorate(
4737
- options.selectionAdapter,
4738
- SelectionSearch
4739
- );
4740
- }
4741
-
4742
- if (
4743
- options.containerCssClass != null ||
4744
- options.containerCss != null ||
4745
- options.adaptContainerCssClass != null
4746
- ) {
4747
- var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4748
-
4749
- options.selectionAdapter = Utils.Decorate(
4750
- options.selectionAdapter,
4751
- ContainerCSS
4752
- );
4753
- }
4754
-
4755
- options.selectionAdapter = Utils.Decorate(
4756
- options.selectionAdapter,
4757
- EventRelay
4758
- );
4759
- }
4760
-
4761
- if (typeof options.language === 'string') {
4762
- // Check if the language is specified with a region
4763
- if (options.language.indexOf('-') > 0) {
4764
- // Extract the region information if it is included
4765
- var languageParts = options.language.split('-');
4766
- var baseLanguage = languageParts[0];
4767
-
4768
- options.language = [options.language, baseLanguage];
4769
- } else {
4770
- options.language = [options.language];
4771
- }
4772
- }
4773
-
4774
- if ($.isArray(options.language)) {
4775
- var languages = new Translation();
4776
- options.language.push('en');
4777
-
4778
- var languageNames = options.language;
4779
-
4780
- for (var l = 0; l < languageNames.length; l++) {
4781
- var name = languageNames[l];
4782
- var language = {};
4783
-
4784
- try {
4785
- // Try to load it with the original name
4786
- language = Translation.loadPath(name);
4787
- } catch (e) {
4788
- try {
4789
- // If we couldn't load it, check if it wasn't the full path
4790
- name = this.defaults.amdLanguageBase + name;
4791
- language = Translation.loadPath(name);
4792
- } catch (ex) {
4793
- // The translation could not be loaded at all. Sometimes this is
4794
- // because of a configuration problem, other times this can be
4795
- // because of how Select2 helps load all possible translation files.
4796
- if (options.debug && window.console && console.warn) {
4797
- console.warn(
4798
- 'Select2: The language file for "' + name + '" could not be ' +
4799
- 'automatically loaded. A fallback will be used instead.'
4800
- );
4801
- }
4802
-
4803
- continue;
4804
- }
4805
- }
4806
-
4807
- languages.extend(language);
4808
- }
4809
-
4810
- options.translations = languages;
4811
- } else {
4812
- var baseTranslation = Translation.loadPath(
4813
- this.defaults.amdLanguageBase + 'en'
4814
- );
4815
- var customTranslation = new Translation(options.language);
4816
-
4817
- customTranslation.extend(baseTranslation);
4818
-
4819
- options.translations = customTranslation;
4820
- }
4821
-
4822
- return options;
4823
- };
4824
-
4825
- Defaults.prototype.reset = function () {
4826
- function stripDiacritics (text) {
4827
- // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4828
- function match(a) {
4829
- return DIACRITICS[a] || a;
4830
- }
4831
-
4832
- return text.replace(/[^\u0000-\u007E]/g, match);
4833
- }
4834
-
4835
- function matcher (params, data) {
4836
- // Always return the object if there is nothing to compare
4837
- if ($.trim(params.term) === '') {
4838
- return data;
4839
- }
4840
-
4841
- // Do a recursive check for options with children
4842
- if (data.children && data.children.length > 0) {
4843
- // Clone the data object if there are children
4844
- // This is required as we modify the object to remove any non-matches
4845
- var match = $.extend(true, {}, data);
4846
-
4847
- // Check each child of the option
4848
- for (var c = data.children.length - 1; c >= 0; c--) {
4849
- var child = data.children[c];
4850
-
4851
- var matches = matcher(params, child);
4852
-
4853
- // If there wasn't a match, remove the object in the array
4854
- if (matches == null) {
4855
- match.children.splice(c, 1);
4856
- }
4857
- }
4858
-
4859
- // If any children matched, return the new object
4860
- if (match.children.length > 0) {
4861
- return match;
4862
- }
4863
-
4864
- // If there were no matching children, check just the plain object
4865
- return matcher(params, match);
4866
- }
4867
-
4868
- var original = stripDiacritics(data.text).toUpperCase();
4869
- var term = stripDiacritics(params.term).toUpperCase();
4870
-
4871
- // Check if the text contains the term
4872
- if (original.indexOf(term) > -1) {
4873
- return data;
4874
- }
4875
-
4876
- // If it doesn't contain the term, don't return anything
4877
- return null;
4878
- }
4879
-
4880
- this.defaults = {
4881
- amdBase: './',
4882
- amdLanguageBase: './i18n/',
4883
- closeOnSelect: true,
4884
- debug: false,
4885
- dropdownAutoWidth: false,
4886
- escapeMarkup: Utils.escapeMarkup,
4887
- language: EnglishTranslation,
4888
- matcher: matcher,
4889
- minimumInputLength: 0,
4890
- maximumInputLength: 0,
4891
- maximumSelectionLength: 0,
4892
- minimumResultsForSearch: 0,
4893
- selectOnClose: false,
4894
- sorter: function (data) {
4895
- return data;
4896
- },
4897
- templateResult: function (result) {
4898
- return result.text;
4899
- },
4900
- templateSelection: function (selection) {
4901
- return selection.text;
4902
- },
4903
- theme: 'default',
4904
- width: 'resolve'
4905
- };
4906
- };
4907
-
4908
- Defaults.prototype.set = function (key, value) {
4909
- var camelKey = $.camelCase(key);
4910
-
4911
- var data = {};
4912
- data[camelKey] = value;
4913
-
4914
- var convertedData = Utils._convertData(data);
4915
-
4916
- $.extend(this.defaults, convertedData);
4917
- };
4918
-
4919
- var defaults = new Defaults();
4920
-
4921
- return defaults;
4922
- });
4923
-
4924
- S2.define('select2/options',[
4925
- 'require',
4926
- 'jquery',
4927
- './defaults',
4928
- './utils'
4929
- ], function (require, $, Defaults, Utils) {
4930
- function Options (options, $element) {
4931
- this.options = options;
4932
-
4933
- if ($element != null) {
4934
- this.fromElement($element);
4935
- }
4936
-
4937
- this.options = Defaults.apply(this.options);
4938
-
4939
- if ($element && $element.is('input')) {
4940
- var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4941
-
4942
- this.options.dataAdapter = Utils.Decorate(
4943
- this.options.dataAdapter,
4944
- InputCompat
4945
- );
4946
- }
4947
- }
4948
-
4949
- Options.prototype.fromElement = function ($e) {
4950
- var excludedData = ['select2'];
4951
-
4952
- if (this.options.multiple == null) {
4953
- this.options.multiple = $e.prop('multiple');
4954
- }
4955
-
4956
- if (this.options.disabled == null) {
4957
- this.options.disabled = $e.prop('disabled');
4958
- }
4959
-
4960
- if (this.options.language == null) {
4961
- if ($e.prop('lang')) {
4962
- this.options.language = $e.prop('lang').toLowerCase();
4963
- } else if ($e.closest('[lang]').prop('lang')) {
4964
- this.options.language = $e.closest('[lang]').prop('lang');
4965
- }
4966
- }
4967
-
4968
- if (this.options.dir == null) {
4969
- if ($e.prop('dir')) {
4970
- this.options.dir = $e.prop('dir');
4971
- } else if ($e.closest('[dir]').prop('dir')) {
4972
- this.options.dir = $e.closest('[dir]').prop('dir');
4973
- } else {
4974
- this.options.dir = 'ltr';
4975
- }
4976
- }
4977
-
4978
- $e.prop('disabled', this.options.disabled);
4979
- $e.prop('multiple', this.options.multiple);
4980
-
4981
- if ($e.data('select2Tags')) {
4982
- if (this.options.debug && window.console && console.warn) {
4983
- console.warn(
4984
- 'Select2: The `data-select2-tags` attribute has been changed to ' +
4985
- 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4986
- 'removed in future versions of Select2.'
4987
- );
4988
- }
4989
-
4990
- $e.data('data', $e.data('select2Tags'));
4991
- $e.data('tags', true);
4992
- }
4993
-
4994
- if ($e.data('ajaxUrl')) {
4995
- if (this.options.debug && window.console && console.warn) {
4996
- console.warn(
4997
- 'Select2: The `data-ajax-url` attribute has been changed to ' +
4998
- '`data-ajax--url` and support for the old attribute will be removed' +
4999
- ' in future versions of Select2.'
5000
- );
5001
- }
5002
-
5003
- $e.attr('ajax--url', $e.data('ajaxUrl'));
5004
- $e.data('ajax--url', $e.data('ajaxUrl'));
5005
- }
5006
-
5007
- var dataset = {};
5008
-
5009
- // Prefer the element's `dataset` attribute if it exists
5010
- // jQuery 1.x does not correctly handle data attributes with multiple dashes
5011
- if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5012
- dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5013
- } else {
5014
- dataset = $e.data();
5015
- }
5016
-
5017
- var data = $.extend(true, {}, dataset);
5018
-
5019
- data = Utils._convertData(data);
5020
-
5021
- for (var key in data) {
5022
- if ($.inArray(key, excludedData) > -1) {
5023
- continue;
5024
- }
5025
-
5026
- if ($.isPlainObject(this.options[key])) {
5027
- $.extend(this.options[key], data[key]);
5028
- } else {
5029
- this.options[key] = data[key];
5030
- }
5031
- }
5032
-
5033
- return this;
5034
- };
5035
-
5036
- Options.prototype.get = function (key) {
5037
- return this.options[key];
5038
- };
5039
-
5040
- Options.prototype.set = function (key, val) {
5041
- this.options[key] = val;
5042
- };
5043
-
5044
- return Options;
5045
- });
5046
-
5047
- S2.define('select2/core',[
5048
- 'jquery',
5049
- './options',
5050
- './utils',
5051
- './keys'
5052
- ], function ($, Options, Utils, KEYS) {
5053
- var Select2 = function ($element, options) {
5054
- if ($element.data('select2') != null) {
5055
- $element.data('select2').destroy();
5056
- }
5057
-
5058
- this.$element = $element;
5059
-
5060
- this.id = this._generateId($element);
5061
-
5062
- options = options || {};
5063
-
5064
- this.options = new Options(options, $element);
5065
-
5066
- Select2.__super__.constructor.call(this);
5067
-
5068
- // Set up the tabindex
5069
-
5070
- var tabindex = $element.attr('tabindex') || 0;
5071
- $element.data('old-tabindex', tabindex);
5072
- $element.attr('tabindex', '-1');
5073
-
5074
- // Set up containers and adapters
5075
-
5076
- var DataAdapter = this.options.get('dataAdapter');
5077
- this.dataAdapter = new DataAdapter($element, this.options);
5078
-
5079
- var $container = this.render();
5080
-
5081
- this._placeContainer($container);
5082
-
5083
- var SelectionAdapter = this.options.get('selectionAdapter');
5084
- this.selection = new SelectionAdapter($element, this.options);
5085
- this.$selection = this.selection.render();
5086
-
5087
- this.selection.position(this.$selection, $container);
5088
-
5089
- var DropdownAdapter = this.options.get('dropdownAdapter');
5090
- this.dropdown = new DropdownAdapter($element, this.options);
5091
- this.$dropdown = this.dropdown.render();
5092
-
5093
- this.dropdown.position(this.$dropdown, $container);
5094
-
5095
- var ResultsAdapter = this.options.get('resultsAdapter');
5096
- this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5097
- this.$results = this.results.render();
5098
-
5099
- this.results.position(this.$results, this.$dropdown);
5100
-
5101
- // Bind events
5102
-
5103
- var self = this;
5104
-
5105
- // Bind the container to all of the adapters
5106
- this._bindAdapters();
5107
-
5108
- // Register any DOM event handlers
5109
- this._registerDomEvents();
5110
-
5111
- // Register any internal event handlers
5112
- this._registerDataEvents();
5113
- this._registerSelectionEvents();
5114
- this._registerDropdownEvents();
5115
- this._registerResultsEvents();
5116
- this._registerEvents();
5117
-
5118
- // Set the initial state
5119
- this.dataAdapter.current(function (initialData) {
5120
- self.trigger('selection:update', {
5121
- data: initialData
5122
- });
5123
- });
5124
-
5125
- // Hide the original select
5126
- $element.addClass('select2-hidden-accessible');
5127
- $element.attr('aria-hidden', 'true');
5128
-
5129
- // Synchronize any monitored attributes
5130
- this._syncAttributes();
5131
-
5132
- $element.data('select2', this);
5133
- };
5134
-
5135
- Utils.Extend(Select2, Utils.Observable);
5136
-
5137
- Select2.prototype._generateId = function ($element) {
5138
- var id = '';
5139
-
5140
- if ($element.attr('id') != null) {
5141
- id = $element.attr('id');
5142
- } else if ($element.attr('name') != null) {
5143
- id = $element.attr('name') + '-' + Utils.generateChars(2);
5144
- } else {
5145
- id = Utils.generateChars(4);
5146
- }
5147
-
5148
- id = id.replace(/(:|\.|\[|\]|,)/g, '');
5149
- id = 'select2-' + id;
5150
-
5151
- return id;
5152
- };
5153
-
5154
- Select2.prototype._placeContainer = function ($container) {
5155
- $container.insertAfter(this.$element);
5156
-
5157
- var width = this._resolveWidth(this.$element, this.options.get('width'));
5158
-
5159
- if (width != null) {
5160
- $container.css('width', width);
5161
- }
5162
- };
5163
-
5164
- Select2.prototype._resolveWidth = function ($element, method) {
5165
- var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5166
-
5167
- if (method == 'resolve') {
5168
- var styleWidth = this._resolveWidth($element, 'style');
5169
-
5170
- if (styleWidth != null) {
5171
- return styleWidth;
5172
- }
5173
-
5174
- return this._resolveWidth($element, 'element');
5175
- }
5176
-
5177
- if (method == 'element') {
5178
- var elementWidth = $element.outerWidth(false);
5179
-
5180
- if (elementWidth <= 0) {
5181
- return 'auto';
5182
- }
5183
-
5184
- return elementWidth + 'px';
5185
- }
5186
-
5187
- if (method == 'style') {
5188
- var style = $element.attr('style');
5189
-
5190
- if (typeof(style) !== 'string') {
5191
- return null;
5192
- }
5193
-
5194
- var attrs = style.split(';');
5195
-
5196
- for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5197
- var attr = attrs[i].replace(/\s/g, '');
5198
- var matches = attr.match(WIDTH);
5199
-
5200
- if (matches !== null && matches.length >= 1) {
5201
- return matches[1];
5202
- }
5203
- }
5204
-
5205
- return null;
5206
- }
5207
-
5208
- return method;
5209
- };
5210
-
5211
- Select2.prototype._bindAdapters = function () {
5212
- this.dataAdapter.bind(this, this.$container);
5213
- this.selection.bind(this, this.$container);
5214
-
5215
- this.dropdown.bind(this, this.$container);
5216
- this.results.bind(this, this.$container);
5217
- };
5218
-
5219
- Select2.prototype._registerDomEvents = function () {
5220
- var self = this;
5221
-
5222
- this.$element.on('change.select2', function () {
5223
- self.dataAdapter.current(function (data) {
5224
- self.trigger('selection:update', {
5225
- data: data
5226
- });
5227
- });
5228
- });
5229
-
5230
- this.$element.on('focus.select2', function (evt) {
5231
- self.trigger('focus', evt);
5232
- });
5233
-
5234
- this._syncA = Utils.bind(this._syncAttributes, this);
5235
- this._syncS = Utils.bind(this._syncSubtree, this);
5236
-
5237
- if (this.$element[0].attachEvent) {
5238
- this.$element[0].attachEvent('onpropertychange', this._syncA);
5239
- }
5240
-
5241
- var observer = window.MutationObserver ||
5242
- window.WebKitMutationObserver ||
5243
- window.MozMutationObserver
5244
- ;
5245
-
5246
- if (observer != null) {
5247
- this._observer = new observer(function (mutations) {
5248
- $.each(mutations, self._syncA);
5249
- $.each(mutations, self._syncS);
5250
- });
5251
- this._observer.observe(this.$element[0], {
5252
- attributes: true,
5253
- childList: true,
5254
- subtree: false
5255
- });
5256
- } else if (this.$element[0].addEventListener) {
5257
- this.$element[0].addEventListener(
5258
- 'DOMAttrModified',
5259
- self._syncA,
5260
- false
5261
- );
5262
- this.$element[0].addEventListener(
5263
- 'DOMNodeInserted',
5264
- self._syncS,
5265
- false
5266
- );
5267
- this.$element[0].addEventListener(
5268
- 'DOMNodeRemoved',
5269
- self._syncS,
5270
- false
5271
- );
5272
- }
5273
- };
5274
-
5275
- Select2.prototype._registerDataEvents = function () {
5276
- var self = this;
5277
-
5278
- this.dataAdapter.on('*', function (name, params) {
5279
- self.trigger(name, params);
5280
- });
5281
- };
5282
-
5283
- Select2.prototype._registerSelectionEvents = function () {
5284
- var self = this;
5285
- var nonRelayEvents = ['toggle', 'focus'];
5286
-
5287
- this.selection.on('toggle', function () {
5288
- self.toggleDropdown();
5289
- });
5290
-
5291
- this.selection.on('focus', function (params) {
5292
- self.focus(params);
5293
- });
5294
-
5295
- this.selection.on('*', function (name, params) {
5296
- if ($.inArray(name, nonRelayEvents) !== -1) {
5297
- return;
5298
- }
5299
-
5300
- self.trigger(name, params);
5301
- });
5302
- };
5303
-
5304
- Select2.prototype._registerDropdownEvents = function () {
5305
- var self = this;
5306
-
5307
- this.dropdown.on('*', function (name, params) {
5308
- self.trigger(name, params);
5309
- });
5310
- };
5311
-
5312
- Select2.prototype._registerResultsEvents = function () {
5313
- var self = this;
5314
-
5315
- this.results.on('*', function (name, params) {
5316
- self.trigger(name, params);
5317
- });
5318
- };
5319
-
5320
- Select2.prototype._registerEvents = function () {
5321
- var self = this;
5322
-
5323
- this.on('open', function () {
5324
- self.$container.addClass('select2-container--open');
5325
- });
5326
-
5327
- this.on('close', function () {
5328
- self.$container.removeClass('select2-container--open');
5329
- });
5330
-
5331
- this.on('enable', function () {
5332
- self.$container.removeClass('select2-container--disabled');
5333
- });
5334
-
5335
- this.on('disable', function () {
5336
- self.$container.addClass('select2-container--disabled');
5337
- });
5338
-
5339
- this.on('blur', function () {
5340
- self.$container.removeClass('select2-container--focus');
5341
- });
5342
-
5343
- this.on('query', function (params) {
5344
- if (!self.isOpen()) {
5345
- self.trigger('open', {});
5346
- }
5347
-
5348
- this.dataAdapter.query(params, function (data) {
5349
- self.trigger('results:all', {
5350
- data: data,
5351
- query: params
5352
- });
5353
- });
5354
- });
5355
-
5356
- this.on('query:append', function (params) {
5357
- this.dataAdapter.query(params, function (data) {
5358
- self.trigger('results:append', {
5359
- data: data,
5360
- query: params
5361
- });
5362
- });
5363
- });
5364
-
5365
- this.on('keypress', function (evt) {
5366
- var key = evt.which;
5367
-
5368
- if (self.isOpen()) {
5369
- if (key === KEYS.ESC || key === KEYS.TAB ||
5370
- (key === KEYS.UP && evt.altKey)) {
5371
- self.close();
5372
-
5373
- evt.preventDefault();
5374
- } else if (key === KEYS.ENTER) {
5375
- self.trigger('results:select', {});
5376
-
5377
- evt.preventDefault();
5378
- } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5379
- self.trigger('results:toggle', {});
5380
-
5381
- evt.preventDefault();
5382
- } else if (key === KEYS.UP) {
5383
- self.trigger('results:previous', {});
5384
-
5385
- evt.preventDefault();
5386
- } else if (key === KEYS.DOWN) {
5387
- self.trigger('results:next', {});
5388
-
5389
- evt.preventDefault();
5390
- }
5391
- } else {
5392
- if (key === KEYS.ENTER || key === KEYS.SPACE ||
5393
- (key === KEYS.DOWN && evt.altKey)) {
5394
- self.open();
5395
-
5396
- evt.preventDefault();
5397
- }
5398
- }
5399
- });
5400
- };
5401
-
5402
- Select2.prototype._syncAttributes = function () {
5403
- this.options.set('disabled', this.$element.prop('disabled'));
5404
-
5405
- if (this.options.get('disabled')) {
5406
- if (this.isOpen()) {
5407
- this.close();
5408
- }
5409
-
5410
- this.trigger('disable', {});
5411
- } else {
5412
- this.trigger('enable', {});
5413
- }
5414
- };
5415
-
5416
- Select2.prototype._syncSubtree = function (evt, mutations) {
5417
- var changed = false;
5418
- var self = this;
5419
-
5420
- // Ignore any mutation events raised for elements that aren't options or
5421
- // optgroups. This handles the case when the select element is destroyed
5422
- if (
5423
- evt && evt.target && (
5424
- evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5425
- )
5426
- ) {
5427
- return;
5428
- }
5429
-
5430
- if (!mutations) {
5431
- // If mutation events aren't supported, then we can only assume that the
5432
- // change affected the selections
5433
- changed = true;
5434
- } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5435
- for (var n = 0; n < mutations.addedNodes.length; n++) {
5436
- var node = mutations.addedNodes[n];
5437
-
5438
- if (node.selected) {
5439
- changed = true;
5440
- }
5441
- }
5442
- } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5443
- changed = true;
5444
- }
5445
-
5446
- // Only re-pull the data if we think there is a change
5447
- if (changed) {
5448
- this.dataAdapter.current(function (currentData) {
5449
- self.trigger('selection:update', {
5450
- data: currentData
5451
- });
5452
- });
5453
- }
5454
- };
5455
-
5456
- /**
5457
- * Override the trigger method to automatically trigger pre-events when
5458
- * there are events that can be prevented.
5459
- */
5460
- Select2.prototype.trigger = function (name, args) {
5461
- var actualTrigger = Select2.__super__.trigger;
5462
- var preTriggerMap = {
5463
- 'open': 'opening',
5464
- 'close': 'closing',
5465
- 'select': 'selecting',
5466
- 'unselect': 'unselecting'
5467
- };
5468
-
5469
- if (args === undefined) {
5470
- args = {};
5471
- }
5472
-
5473
- if (name in preTriggerMap) {
5474
- var preTriggerName = preTriggerMap[name];
5475
- var preTriggerArgs = {
5476
- prevented: false,
5477
- name: name,
5478
- args: args
5479
- };
5480
-
5481
- actualTrigger.call(this, preTriggerName, preTriggerArgs);
5482
-
5483
- if (preTriggerArgs.prevented) {
5484
- args.prevented = true;
5485
-
5486
- return;
5487
- }
5488
- }
5489
-
5490
- actualTrigger.call(this, name, args);
5491
- };
5492
-
5493
- Select2.prototype.toggleDropdown = function () {
5494
- if (this.options.get('disabled')) {
5495
- return;
5496
- }
5497
-
5498
- if (this.isOpen()) {
5499
- this.close();
5500
- } else {
5501
- this.open();
5502
- }
5503
- };
5504
-
5505
- Select2.prototype.open = function () {
5506
- if (this.isOpen()) {
5507
- return;
5508
- }
5509
-
5510
- this.trigger('query', {});
5511
- };
5512
-
5513
- Select2.prototype.close = function () {
5514
- if (!this.isOpen()) {
5515
- return;
5516
- }
5517
-
5518
- this.trigger('close', {});
5519
- };
5520
-
5521
- Select2.prototype.isOpen = function () {
5522
- return this.$container.hasClass('select2-container--open');
5523
- };
5524
-
5525
- Select2.prototype.hasFocus = function () {
5526
- return this.$container.hasClass('select2-container--focus');
5527
- };
5528
-
5529
- Select2.prototype.focus = function (data) {
5530
- // No need to re-trigger focus events if we are already focused
5531
- if (this.hasFocus()) {
5532
- return;
5533
- }
5534
-
5535
- this.$container.addClass('select2-container--focus');
5536
- this.trigger('focus', {});
5537
- };
5538
-
5539
- Select2.prototype.enable = function (args) {
5540
- if (this.options.get('debug') && window.console && console.warn) {
5541
- console.warn(
5542
- 'Select2: The `select2("enable")` method has been deprecated and will' +
5543
- ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5544
- ' instead.'
5545
- );
5546
- }
5547
-
5548
- if (args == null || args.length === 0) {
5549
- args = [true];
5550
- }
5551
-
5552
- var disabled = !args[0];
5553
-
5554
- this.$element.prop('disabled', disabled);
5555
- };
5556
-
5557
- Select2.prototype.data = function () {
5558
- if (this.options.get('debug') &&
5559
- arguments.length > 0 && window.console && console.warn) {
5560
- console.warn(
5561
- 'Select2: Data can no longer be set using `select2("data")`. You ' +
5562
- 'should consider setting the value instead using `$element.val()`.'
5563
- );
5564
- }
5565
-
5566
- var data = [];
5567
-
5568
- this.dataAdapter.current(function (currentData) {
5569
- data = currentData;
5570
- });
5571
-
5572
- return data;
5573
- };
5574
-
5575
- Select2.prototype.val = function (args) {
5576
- if (this.options.get('debug') && window.console && console.warn) {
5577
- console.warn(
5578
- 'Select2: The `select2("val")` method has been deprecated and will be' +
5579
- ' removed in later Select2 versions. Use $element.val() instead.'
5580
- );
5581
- }
5582
-
5583
- if (args == null || args.length === 0) {
5584
- return this.$element.val();
5585
- }
5586
-
5587
- var newVal = args[0];
5588
-
5589
- if ($.isArray(newVal)) {
5590
- newVal = $.map(newVal, function (obj) {
5591
- return obj.toString();
5592
- });
5593
- }
5594
-
5595
- this.$element.val(newVal).trigger('change');
5596
- };
5597
-
5598
- Select2.prototype.destroy = function () {
5599
- this.$container.remove();
5600
-
5601
- if (this.$element[0].detachEvent) {
5602
- this.$element[0].detachEvent('onpropertychange', this._syncA);
5603
- }
5604
-
5605
- if (this._observer != null) {
5606
- this._observer.disconnect();
5607
- this._observer = null;
5608
- } else if (this.$element[0].removeEventListener) {
5609
- this.$element[0]
5610
- .removeEventListener('DOMAttrModified', this._syncA, false);
5611
- this.$element[0]
5612
- .removeEventListener('DOMNodeInserted', this._syncS, false);
5613
- this.$element[0]
5614
- .removeEventListener('DOMNodeRemoved', this._syncS, false);
5615
- }
5616
-
5617
- this._syncA = null;
5618
- this._syncS = null;
5619
-
5620
- this.$element.off('.select2');
5621
- this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5622
-
5623
- this.$element.removeClass('select2-hidden-accessible');
5624
- this.$element.attr('aria-hidden', 'false');
5625
- this.$element.removeData('select2');
5626
-
5627
- this.dataAdapter.destroy();
5628
- this.selection.destroy();
5629
- this.dropdown.destroy();
5630
- this.results.destroy();
5631
-
5632
- this.dataAdapter = null;
5633
- this.selection = null;
5634
- this.dropdown = null;
5635
- this.results = null;
5636
- };
5637
-
5638
- Select2.prototype.render = function () {
5639
- var $container = $(
5640
- '<span class="select2 select2-container">' +
5641
- '<span class="selection"></span>' +
5642
- '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5643
- '</span>'
5644
- );
5645
-
5646
- $container.attr('dir', this.options.get('dir'));
5647
-
5648
- this.$container = $container;
5649
-
5650
- this.$container.addClass('select2-container--' + this.options.get('theme'));
5651
-
5652
- $container.data('element', this.$element);
5653
-
5654
- return $container;
5655
- };
5656
-
5657
- return Select2;
5658
- });
5659
-
5660
- S2.define('select2/compat/utils',[
5661
- 'jquery'
5662
- ], function ($) {
5663
- function syncCssClasses ($dest, $src, adapter) {
5664
- var classes, replacements = [], adapted;
5665
-
5666
- classes = $.trim($dest.attr('class'));
5667
-
5668
- if (classes) {
5669
- classes = '' + classes; // for IE which returns object
5670
-
5671
- $(classes.split(/\s+/)).each(function () {
5672
- // Save all Select2 classes
5673
- if (this.indexOf('select2-') === 0) {
5674
- replacements.push(this);
5675
- }
5676
- });
5677
- }
5678
-
5679
- classes = $.trim($src.attr('class'));
5680
-
5681
- if (classes) {
5682
- classes = '' + classes; // for IE which returns object
5683
-
5684
- $(classes.split(/\s+/)).each(function () {
5685
- // Only adapt non-Select2 classes
5686
- if (this.indexOf('select2-') !== 0) {
5687
- adapted = adapter(this);
5688
-
5689
- if (adapted != null) {
5690
- replacements.push(adapted);
5691
- }
5692
- }
5693
- });
5694
- }
5695
-
5696
- $dest.attr('class', replacements.join(' '));
5697
- }
5698
-
5699
- return {
5700
- syncCssClasses: syncCssClasses
5701
- };
5702
- });
5703
-
5704
- S2.define('select2/compat/containerCss',[
5705
- 'jquery',
5706
- './utils'
5707
- ], function ($, CompatUtils) {
5708
- // No-op CSS adapter that discards all classes by default
5709
- function _containerAdapter (clazz) {
5710
- return null;
5711
- }
5712
-
5713
- function ContainerCSS () { }
5714
-
5715
- ContainerCSS.prototype.render = function (decorated) {
5716
- var $container = decorated.call(this);
5717
-
5718
- var containerCssClass = this.options.get('containerCssClass') || '';
5719
-
5720
- if ($.isFunction(containerCssClass)) {
5721
- containerCssClass = containerCssClass(this.$element);
5722
- }
5723
-
5724
- var containerCssAdapter = this.options.get('adaptContainerCssClass');
5725
- containerCssAdapter = containerCssAdapter || _containerAdapter;
5726
-
5727
- if (containerCssClass.indexOf(':all:') !== -1) {
5728
- containerCssClass = containerCssClass.replace(':all:', '');
5729
-
5730
- var _cssAdapter = containerCssAdapter;
5731
-
5732
- containerCssAdapter = function (clazz) {
5733
- var adapted = _cssAdapter(clazz);
5734
-
5735
- if (adapted != null) {
5736
- // Append the old one along with the adapted one
5737
- return adapted + ' ' + clazz;
5738
- }
5739
-
5740
- return clazz;
5741
- };
5742
- }
5743
-
5744
- var containerCss = this.options.get('containerCss') || {};
5745
-
5746
- if ($.isFunction(containerCss)) {
5747
- containerCss = containerCss(this.$element);
5748
- }
5749
-
5750
- CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
5751
-
5752
- $container.css(containerCss);
5753
- $container.addClass(containerCssClass);
5754
-
5755
- return $container;
5756
- };
5757
-
5758
- return ContainerCSS;
5759
- });
5760
-
5761
- S2.define('select2/compat/dropdownCss',[
5762
- 'jquery',
5763
- './utils'
5764
- ], function ($, CompatUtils) {
5765
- // No-op CSS adapter that discards all classes by default
5766
- function _dropdownAdapter (clazz) {
5767
- return null;
5768
- }
5769
-
5770
- function DropdownCSS () { }
5771
-
5772
- DropdownCSS.prototype.render = function (decorated) {
5773
- var $dropdown = decorated.call(this);
5774
-
5775
- var dropdownCssClass = this.options.get('dropdownCssClass') || '';
5776
-
5777
- if ($.isFunction(dropdownCssClass)) {
5778
- dropdownCssClass = dropdownCssClass(this.$element);
5779
- }
5780
-
5781
- var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
5782
- dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
5783
-
5784
- if (dropdownCssClass.indexOf(':all:') !== -1) {
5785
- dropdownCssClass = dropdownCssClass.replace(':all:', '');
5786
-
5787
- var _cssAdapter = dropdownCssAdapter;
5788
-
5789
- dropdownCssAdapter = function (clazz) {
5790
- var adapted = _cssAdapter(clazz);
5791
-
5792
- if (adapted != null) {
5793
- // Append the old one along with the adapted one
5794
- return adapted + ' ' + clazz;
5795
- }
5796
-
5797
- return clazz;
5798
- };
5799
- }
5800
-
5801
- var dropdownCss = this.options.get('dropdownCss') || {};
5802
-
5803
- if ($.isFunction(dropdownCss)) {
5804
- dropdownCss = dropdownCss(this.$element);
5805
- }
5806
-
5807
- CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
5808
-
5809
- $dropdown.css(dropdownCss);
5810
- $dropdown.addClass(dropdownCssClass);
5811
-
5812
- return $dropdown;
5813
- };
5814
-
5815
- return DropdownCSS;
5816
- });
5817
-
5818
- S2.define('select2/compat/initSelection',[
5819
- 'jquery'
5820
- ], function ($) {
5821
- function InitSelection (decorated, $element, options) {
5822
- if (options.get('debug') && window.console && console.warn) {
5823
- console.warn(
5824
- 'Select2: The `initSelection` option has been deprecated in favor' +
5825
- ' of a custom data adapter that overrides the `current` method. ' +
5826
- 'This method is now called multiple times instead of a single ' +
5827
- 'time when the instance is initialized. Support will be removed ' +
5828
- 'for the `initSelection` option in future versions of Select2'
5829
- );
5830
- }
5831
-
5832
- this.initSelection = options.get('initSelection');
5833
- this._isInitialized = false;
5834
-
5835
- decorated.call(this, $element, options);
5836
- }
5837
-
5838
- InitSelection.prototype.current = function (decorated, callback) {
5839
- var self = this;
5840
-
5841
- if (this._isInitialized) {
5842
- decorated.call(this, callback);
5843
-
5844
- return;
5845
- }
5846
-
5847
- this.initSelection.call(null, this.$element, function (data) {
5848
- self._isInitialized = true;
5849
-
5850
- if (!$.isArray(data)) {
5851
- data = [data];
5852
- }
5853
-
5854
- callback(data);
5855
- });
5856
- };
5857
-
5858
- return InitSelection;
5859
- });
5860
-
5861
- S2.define('select2/compat/inputData',[
5862
- 'jquery'
5863
- ], function ($) {
5864
- function InputData (decorated, $element, options) {
5865
- this._currentData = [];
5866
- this._valueSeparator = options.get('valueSeparator') || ',';
5867
-
5868
- if ($element.prop('type') === 'hidden') {
5869
- if (options.get('debug') && console && console.warn) {
5870
- console.warn(
5871
- 'Select2: Using a hidden input with Select2 is no longer ' +
5872
- 'supported and may stop working in the future. It is recommended ' +
5873
- 'to use a `<select>` element instead.'
5874
- );
5875
- }
5876
- }
5877
-
5878
- decorated.call(this, $element, options);
5879
- }
5880
-
5881
- InputData.prototype.current = function (_, callback) {
5882
- function getSelected (data, selectedIds) {
5883
- var selected = [];
5884
-
5885
- if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
5886
- data.selected = true;
5887
- selected.push(data);
5888
- } else {
5889
- data.selected = false;
5890
- }
5891
-
5892
- if (data.children) {
5893
- selected.push.apply(selected, getSelected(data.children, selectedIds));
5894
- }
5895
-
5896
- return selected;
5897
- }
5898
-
5899
- var selected = [];
5900
-
5901
- for (var d = 0; d < this._currentData.length; d++) {
5902
- var data = this._currentData[d];
5903
-
5904
- selected.push.apply(
5905
- selected,
5906
- getSelected(
5907
- data,
5908
- this.$element.val().split(
5909
- this._valueSeparator
5910
- )
5911
- )
5912
- );
5913
- }
5914
-
5915
- callback(selected);
5916
- };
5917
-
5918
- InputData.prototype.select = function (_, data) {
5919
- if (!this.options.get('multiple')) {
5920
- this.current(function (allData) {
5921
- $.map(allData, function (data) {
5922
- data.selected = false;
5923
- });
5924
- });
5925
-
5926
- this.$element.val(data.id);
5927
- this.$element.trigger('change');
5928
- } else {
5929
- var value = this.$element.val();
5930
- value += this._valueSeparator + data.id;
5931
-
5932
- this.$element.val(value);
5933
- this.$element.trigger('change');
5934
- }
5935
- };
5936
-
5937
- InputData.prototype.unselect = function (_, data) {
5938
- var self = this;
5939
-
5940
- data.selected = false;
5941
-
5942
- this.current(function (allData) {
5943
- var values = [];
5944
-
5945
- for (var d = 0; d < allData.length; d++) {
5946
- var item = allData[d];
5947
-
5948
- if (data.id == item.id) {
5949
- continue;
5950
- }
5951
-
5952
- values.push(item.id);
5953
- }
5954
-
5955
- self.$element.val(values.join(self._valueSeparator));
5956
- self.$element.trigger('change');
5957
- });
5958
- };
5959
-
5960
- InputData.prototype.query = function (_, params, callback) {
5961
- var results = [];
5962
-
5963
- for (var d = 0; d < this._currentData.length; d++) {
5964
- var data = this._currentData[d];
5965
-
5966
- var matches = this.matches(params, data);
5967
-
5968
- if (matches !== null) {
5969
- results.push(matches);
5970
- }
5971
- }
5972
-
5973
- callback({
5974
- results: results
5975
- });
5976
- };
5977
-
5978
- InputData.prototype.addOptions = function (_, $options) {
5979
- var options = $.map($options, function ($option) {
5980
- return $.data($option[0], 'data');
5981
- });
5982
-
5983
- this._currentData.push.apply(this._currentData, options);
5984
- };
5985
-
5986
- return InputData;
5987
- });
5988
-
5989
- S2.define('select2/compat/matcher',[
5990
- 'jquery'
5991
- ], function ($) {
5992
- function oldMatcher (matcher) {
5993
- function wrappedMatcher (params, data) {
5994
- var match = $.extend(true, {}, data);
5995
-
5996
- if (params.term == null || $.trim(params.term) === '') {
5997
- return match;
5998
- }
5999
-
6000
- if (data.children) {
6001
- for (var c = data.children.length - 1; c >= 0; c--) {
6002
- var child = data.children[c];
6003
-
6004
- // Check if the child object matches
6005
- // The old matcher returned a boolean true or false
6006
- var doesMatch = matcher(params.term, child.text, child);
6007
-
6008
- // If the child didn't match, pop it off
6009
- if (!doesMatch) {
6010
- match.children.splice(c, 1);
6011
- }
6012
- }
6013
-
6014
- if (match.children.length > 0) {
6015
- return match;
6016
- }
6017
- }
6018
-
6019
- if (matcher(params.term, data.text, data)) {
6020
- return match;
6021
- }
6022
-
6023
- return null;
6024
- }
6025
-
6026
- return wrappedMatcher;
6027
- }
6028
-
6029
- return oldMatcher;
6030
- });
6031
-
6032
- S2.define('select2/compat/query',[
6033
-
6034
- ], function () {
6035
- function Query (decorated, $element, options) {
6036
- if (options.get('debug') && window.console && console.warn) {
6037
- console.warn(
6038
- 'Select2: The `query` option has been deprecated in favor of a ' +
6039
- 'custom data adapter that overrides the `query` method. Support ' +
6040
- 'will be removed for the `query` option in future versions of ' +
6041
- 'Select2.'
6042
- );
6043
- }
6044
-
6045
- decorated.call(this, $element, options);
6046
- }
6047
-
6048
- Query.prototype.query = function (_, params, callback) {
6049
- params.callback = callback;
6050
-
6051
- var query = this.options.get('query');
6052
-
6053
- query.call(null, params);
6054
- };
6055
-
6056
- return Query;
6057
- });
6058
-
6059
- S2.define('select2/dropdown/attachContainer',[
6060
-
6061
- ], function () {
6062
- function AttachContainer (decorated, $element, options) {
6063
- decorated.call(this, $element, options);
6064
- }
6065
-
6066
- AttachContainer.prototype.position =
6067
- function (decorated, $dropdown, $container) {
6068
- var $dropdownContainer = $container.find('.dropdown-wrapper');
6069
- $dropdownContainer.append($dropdown);
6070
-
6071
- $dropdown.addClass('select2-dropdown--below');
6072
- $container.addClass('select2-container--below');
6073
- };
6074
-
6075
- return AttachContainer;
6076
- });
6077
-
6078
- S2.define('select2/dropdown/stopPropagation',[
6079
-
6080
- ], function () {
6081
- function StopPropagation () { }
6082
-
6083
- StopPropagation.prototype.bind = function (decorated, container, $container) {
6084
- decorated.call(this, container, $container);
6085
-
6086
- var stoppedEvents = [
6087
- 'blur',
6088
- 'change',
6089
- 'click',
6090
- 'dblclick',
6091
- 'focus',
6092
- 'focusin',
6093
- 'focusout',
6094
- 'input',
6095
- 'keydown',
6096
- 'keyup',
6097
- 'keypress',
6098
- 'mousedown',
6099
- 'mouseenter',
6100
- 'mouseleave',
6101
- 'mousemove',
6102
- 'mouseover',
6103
- 'mouseup',
6104
- 'search',
6105
- 'touchend',
6106
- 'touchstart'
6107
- ];
6108
-
6109
- this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
6110
- evt.stopPropagation();
6111
- });
6112
- };
6113
-
6114
- return StopPropagation;
6115
- });
6116
-
6117
- S2.define('select2/selection/stopPropagation',[
6118
-
6119
- ], function () {
6120
- function StopPropagation () { }
6121
-
6122
- StopPropagation.prototype.bind = function (decorated, container, $container) {
6123
- decorated.call(this, container, $container);
6124
-
6125
- var stoppedEvents = [
6126
- 'blur',
6127
- 'change',
6128
- 'click',
6129
- 'dblclick',
6130
- 'focus',
6131
- 'focusin',
6132
- 'focusout',
6133
- 'input',
6134
- 'keydown',
6135
- 'keyup',
6136
- 'keypress',
6137
- 'mousedown',
6138
- 'mouseenter',
6139
- 'mouseleave',
6140
- 'mousemove',
6141
- 'mouseover',
6142
- 'mouseup',
6143
- 'search',
6144
- 'touchend',
6145
- 'touchstart'
6146
- ];
6147
-
6148
- this.$selection.on(stoppedEvents.join(' '), function (evt) {
6149
- evt.stopPropagation();
6150
- });
6151
- };
6152
-
6153
- return StopPropagation;
6154
- });
6155
-
6156
- /*!
6157
- * jQuery Mousewheel 3.1.13
6158
- *
6159
- * Copyright jQuery Foundation and other contributors
6160
- * Released under the MIT license
6161
- * http://jquery.org/license
6162
- */
6163
-
6164
- (function (factory) {
6165
- if ( typeof S2.define === 'function' && S2.define.amd ) {
6166
- // AMD. Register as an anonymous module.
6167
- S2.define('jquery-mousewheel',['jquery'], factory);
6168
- } else if (typeof exports === 'object') {
6169
- // Node/CommonJS style for Browserify
6170
- module.exports = factory;
6171
- } else {
6172
- // Browser globals
6173
- factory(jQuery);
6174
- }
6175
- }(function ($) {
6176
-
6177
- var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
6178
- toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
6179
- ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
6180
- slice = Array.prototype.slice,
6181
- nullLowestDeltaTimeout, lowestDelta;
6182
-
6183
- if ( $.event.fixHooks ) {
6184
- for ( var i = toFix.length; i; ) {
6185
- $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
6186
- }
6187
- }
6188
-
6189
- var special = $.event.special.mousewheel = {
6190
- version: '3.1.12',
6191
-
6192
- setup: function() {
6193
- if ( this.addEventListener ) {
6194
- for ( var i = toBind.length; i; ) {
6195
- this.addEventListener( toBind[--i], handler, false );
6196
- }
6197
- } else {
6198
- this.onmousewheel = handler;
6199
- }
6200
- // Store the line height and page height for this particular element
6201
- $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
6202
- $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
6203
- },
6204
-
6205
- teardown: function() {
6206
- if ( this.removeEventListener ) {
6207
- for ( var i = toBind.length; i; ) {
6208
- this.removeEventListener( toBind[--i], handler, false );
6209
- }
6210
- } else {
6211
- this.onmousewheel = null;
6212
- }
6213
- // Clean up the data we added to the element
6214
- $.removeData(this, 'mousewheel-line-height');
6215
- $.removeData(this, 'mousewheel-page-height');
6216
- },
6217
-
6218
- getLineHeight: function(elem) {
6219
- var $elem = $(elem),
6220
- $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6221
- if (!$parent.length) {
6222
- $parent = $('body');
6223
- }
6224
- return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6225
- },
6226
-
6227
- getPageHeight: function(elem) {
6228
- return $(elem).height();
6229
- },
6230
-
6231
- settings: {
6232
- adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
6233
- normalizeOffset: true // calls getBoundingClientRect for each event
6234
- }
6235
- };
6236
-
6237
- $.fn.extend({
6238
- mousewheel: function(fn) {
6239
- return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
6240
- },
6241
-
6242
- unmousewheel: function(fn) {
6243
- return this.unbind('mousewheel', fn);
6244
- }
6245
- });
6246
-
6247
-
6248
- function handler(event) {
6249
- var orgEvent = event || window.event,
6250
- args = slice.call(arguments, 1),
6251
- delta = 0,
6252
- deltaX = 0,
6253
- deltaY = 0,
6254
- absDelta = 0,
6255
- offsetX = 0,
6256
- offsetY = 0;
6257
- event = $.event.fix(orgEvent);
6258
- event.type = 'mousewheel';
6259
-
6260
- // Old school scrollwheel delta
6261
- if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
6262
- if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
6263
- if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
6264
- if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
6265
-
6266
- // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
6267
- if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
6268
- deltaX = deltaY * -1;
6269
- deltaY = 0;
6270
- }
6271
-
6272
- // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
6273
- delta = deltaY === 0 ? deltaX : deltaY;
6274
-
6275
- // New school wheel delta (wheel event)
6276
- if ( 'deltaY' in orgEvent ) {
6277
- deltaY = orgEvent.deltaY * -1;
6278
- delta = deltaY;
6279
- }
6280
- if ( 'deltaX' in orgEvent ) {
6281
- deltaX = orgEvent.deltaX;
6282
- if ( deltaY === 0 ) { delta = deltaX * -1; }
6283
- }
6284
-
6285
- // No change actually happened, no reason to go any further
6286
- if ( deltaY === 0 && deltaX === 0 ) { return; }
6287
-
6288
- // Need to convert lines and pages to pixels if we aren't already in pixels
6289
- // There are three delta modes:
6290
- // * deltaMode 0 is by pixels, nothing to do
6291
- // * deltaMode 1 is by lines
6292
- // * deltaMode 2 is by pages
6293
- if ( orgEvent.deltaMode === 1 ) {
6294
- var lineHeight = $.data(this, 'mousewheel-line-height');
6295
- delta *= lineHeight;
6296
- deltaY *= lineHeight;
6297
- deltaX *= lineHeight;
6298
- } else if ( orgEvent.deltaMode === 2 ) {
6299
- var pageHeight = $.data(this, 'mousewheel-page-height');
6300
- delta *= pageHeight;
6301
- deltaY *= pageHeight;
6302
- deltaX *= pageHeight;
6303
- }
6304
-
6305
- // Store lowest absolute delta to normalize the delta values
6306
- absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
6307
-
6308
- if ( !lowestDelta || absDelta < lowestDelta ) {
6309
- lowestDelta = absDelta;
6310
-
6311
- // Adjust older deltas if necessary
6312
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6313
- lowestDelta /= 40;
6314
- }
6315
- }
6316
-
6317
- // Adjust older deltas if necessary
6318
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6319
- // Divide all the things by 40!
6320
- delta /= 40;
6321
- deltaX /= 40;
6322
- deltaY /= 40;
6323
- }
6324
-
6325
- // Get a whole, normalized value for the deltas
6326
- delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
6327
- deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
6328
- deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
6329
-
6330
- // Normalise offsetX and offsetY properties
6331
- if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
6332
- var boundingRect = this.getBoundingClientRect();
6333
- offsetX = event.clientX - boundingRect.left;
6334
- offsetY = event.clientY - boundingRect.top;
6335
- }
6336
-
6337
- // Add information to the event object
6338
- event.deltaX = deltaX;
6339
- event.deltaY = deltaY;
6340
- event.deltaFactor = lowestDelta;
6341
- event.offsetX = offsetX;
6342
- event.offsetY = offsetY;
6343
- // Go ahead and set deltaMode to 0 since we converted to pixels
6344
- // Although this is a little odd since we overwrite the deltaX/Y
6345
- // properties with normalized deltas.
6346
- event.deltaMode = 0;
6347
-
6348
- // Add event and delta to the front of the arguments
6349
- args.unshift(event, delta, deltaX, deltaY);
6350
-
6351
- // Clearout lowestDelta after sometime to better
6352
- // handle multiple device types that give different
6353
- // a different lowestDelta
6354
- // Ex: trackpad = 3 and mouse wheel = 120
6355
- if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
6356
- nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
6357
-
6358
- return ($.event.dispatch || $.event.handle).apply(this, args);
6359
- }
6360
-
6361
- function nullLowestDelta() {
6362
- lowestDelta = null;
6363
- }
6364
-
6365
- function shouldAdjustOldDeltas(orgEvent, absDelta) {
6366
- // If this is an older event and the delta is divisable by 120,
6367
- // then we are assuming that the browser is treating this as an
6368
- // older mouse wheel event and that we should divide the deltas
6369
- // by 40 to try and get a more usable deltaFactor.
6370
- // Side note, this actually impacts the reported scroll distance
6371
- // in older browsers and can cause scrolling to be slower than native.
6372
- // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
6373
- return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
6374
- }
6375
-
6376
- }));
6377
-
6378
- S2.define('jquery.select2',[
6379
- 'jquery',
6380
- 'jquery-mousewheel',
6381
-
6382
- './select2/core',
6383
- './select2/defaults'
6384
- ], function ($, _, Select2, Defaults) {
6385
- if ($.fn.select2 == null) {
6386
- // All methods that should return the element
6387
- var thisMethods = ['open', 'close', 'destroy'];
6388
-
6389
- $.fn.select2 = function (options) {
6390
- options = options || {};
6391
-
6392
- if (typeof options === 'object') {
6393
- this.each(function () {
6394
- var instanceOptions = $.extend(true, {}, options);
6395
-
6396
- var instance = new Select2($(this), instanceOptions);
6397
- });
6398
-
6399
- return this;
6400
- } else if (typeof options === 'string') {
6401
- var ret;
6402
- var args = Array.prototype.slice.call(arguments, 1);
6403
-
6404
- this.each(function () {
6405
- var instance = $(this).data('select2');
6406
-
6407
- if (instance == null && window.console && console.error) {
6408
- console.error(
6409
- 'The select2(\'' + options + '\') method was called on an ' +
6410
- 'element that is not using Select2.'
6411
- );
6412
- }
6413
-
6414
- ret = instance[options].apply(instance, args);
6415
- });
6416
-
6417
- // Check if we should be returning `this`
6418
- if ($.inArray(options, thisMethods) > -1) {
6419
- return this;
6420
- }
6421
-
6422
- return ret;
6423
- } else {
6424
- throw new Error('Invalid arguments for Select2: ' + options);
6425
- }
6426
- };
6427
- }
6428
-
6429
- if ($.fn.select2.defaults == null) {
6430
- $.fn.select2.defaults = Defaults;
6431
- }
6432
-
6433
- return Select2;
6434
- });
6435
-
6436
- // Return the AMD loader configuration so it can be used outside of this file
6437
- return {
6438
- define: S2.define,
6439
- require: S2.require
6440
- };
6441
- }());
6442
-
6443
- // Autoload the jQuery bindings
6444
- // We know that all of the modules exist above this, so we're safe
6445
- var select2 = S2.require('jquery.select2');
6446
-
6447
- // Hold the AMD module references on the jQuery function that was just loaded
6448
- // This allows Select2 to use the internal loader outside of this file, such
6449
- // as in the language files.
6450
- jQuery.fn.select2.amd = S2;
6451
-
6452
- // Return the Select2 instance for anyone who is importing it.
6453
- return select2;
6454
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/metabox/butterbean/js/select2.min.js DELETED
@@ -1,3 +0,0 @@
1
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery),jQuery.fn.oceanwpSelect2=jQuery.fn.select2}(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 p(a,b){return m.call(a,b)}function q(a,b){var c,d,e,f,g,h,i,j,l,m,n,p=b&&b.split("/"),q=k.map,r=q&&q["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,k.nodeIdCompat&&o.test(a[g])&&(a[g]=a[g].replace(o,"")),a=p.slice(0,p.length-1).concat(a),l=0;l<a.length;l+=1)if(n=a[l],"."===n)a.splice(l,1),l-=1;else if(".."===n){if(1===l&&(".."===a[2]||".."===a[0]))break;l>0&&(a.splice(l-1,2),l-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((p||r)&&q){for(c=a.split("/"),l=c.length;l>0;l-=1){if(d=c.slice(0,l).join("/"),p)for(m=p.length;m>0;m-=1)if(e=q[p.slice(0,m).join("/")],e&&(e=e[d])){f=e,h=l;break}if(f)break;!i&&r&&r[d]&&(i=r[d],j=l)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function r(a,c){return function(){var d=n.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),f.apply(b,d.concat([a,c]))}}function s(a){return function(b){return q(b,a)}}function t(a){return function(b){i[a]=b}}function u(a){if(p(j,a)){var c=j[a];delete j[a],l[a]=!0,e.apply(b,c)}if(!p(i,a)&&!p(l,a))throw new Error("No "+a);return i[a]}function v(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 w(a){return function(){return k&&k.config&&k.config[a]||{}}}var e,f,g,h,i={},j={},k={},l={},m=Object.prototype.hasOwnProperty,n=[].slice,o=/\.js$/;g=function(a,b){var c,d=v(a),e=d[0];return a=d[1],e&&(e=q(e,b),c=u(e)),e?a=c&&c.normalize?c.normalize(a,s(b)):q(a,b):(a=q(a,b),d=v(a),e=d[0],a=d[1],e&&(c=u(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},h={require:function(a){return r(a)},exports:function(a){var b=i[a];return"undefined"!=typeof b?b:i[a]={}},module:function(a){return{id:a,uri:"",exports:i[a],config:w(a)}}},e=function(a,c,d,e){var f,k,m,n,o,v,q=[],s=typeof d;if(e=e||a,"undefined"===s||"function"===s){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=g(c[o],e),k=n.f,"require"===k)q[o]=h.require(a);else if("exports"===k)q[o]=h.exports(a),v=!0;else if("module"===k)f=q[o]=h.module(a);else if(p(i,k)||p(j,k)||p(l,k))q[o]=u(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,r(e,!0),t(k),{}),q[o]=i[k]}m=d?d.apply(i[a],q):void 0,a&&(f&&f.exports!==b&&f.exports!==i[a]?i[a]=f.exports:m===b&&v||(i[a]=m))}else a&&(i[a]=d)},a=c=f=function(a,c,d,i,j){if("string"==typeof a)return h[a]?h[a](c):u(g(a,c).f);if(!a.splice){if(k=a,k.deps&&f(k.deps,k.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=i,i=j),i?e(b,a,c,d):setTimeout(function(){e(b,a,c,d)},4),f},f.config=function(a){return f(a)},a._defined=i,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),p(i,a)||p(j,a)||(j[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 c(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 b={};b.Extend=function(a,b){function d(){this.constructor=a}var c={}.hasOwnProperty;for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},b.Decorate=function(a,b){function f(){var c=Array.prototype.unshift,d=b.prototype.constructor.length,e=a.prototype.constructor;d>0&&(c.call(arguments,a.prototype.constructor),e=b.prototype.constructor),e.apply(this,arguments)}function g(){this.constructor=f}var d=c(b),e=c(a);b.displayName=a.displayName,f.prototype=new g;for(var h=0;h<e.length;h++){var i=e[h];f.prototype[i]=a.prototype[i]}for(var j=(function(a){var c=function(){};a in f.prototype&&(c=f.prototype[a]);var d=b.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,c),d.apply(this,arguments)}}),k=0;k<d.length;k++){var l=d[k];f.prototype[l]=j(l)}return f};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},b.Observable=d,b.generateChars=function(a){for(var b="",c=0;c<a;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},b.bind=function(a,b){return function(){a.apply(b,arguments)}},b._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},b.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},b.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]})},b.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},b}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var j=[],k=0;k<b.children.length;k++){var l=b.children[k],m=this.option(l);j.push(m)}var n=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});n.append(j),g.append(h),g.append(n)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,f=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",f),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(a.inArray(b,f)!==-1){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),a.inArray(b,g)!==-1&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);
2
- 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;c.inArray(g,e)===-1&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&c.inArray(g,e)===-1&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function h(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=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,f)>=0){var k=e.filter(h(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}g.push(o)}}return g},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function g(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(g,this.ajaxOptions.delay)):g()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function e(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!e({results:i.children},!0),k=(i.text||"").toUpperCase(),l=(b.term||"").toUpperCase(),m=k===l;if(m||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var n=d.createTag(b);if(null!=n){var o=d.option(n);o.attr("data-select2-tag",!0),d.addOptions([o]),d.insertTag(g,n)}a.results=g,c(a)}var d=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,e)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var d=(this._lastTag,this.$element.find("option[data-select2-tag]"));d.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function f(b){var c=e._normalizeItem(b),d=e.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var f=e.option(c);f.attr("data-select2-tag",!0),e._removeOldTags(),e.addOptions([f])}g(c)}function g(a){e.trigger("select",{data:a})}var e=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,f);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(a.inArray(j,f)!==-1){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){a.inArray(d,c)===-1&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),
3
- 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("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(g=d(this),null!=g&&f.push(g))})),b.attr("class",f.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,f.indexOf(":all:")!==-1){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,f.indexOf(":all:")!==-1){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||a.inArray(b.id,c)!==-1?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];b.id!=f.id&&d.push(f.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),b.define("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f],h=b(c.term,g.text,g);h||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c;var d=this.options.get("query");d.call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){var d=c.find(".dropdown-wrapper");d.append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function i(b){var c=b||window.event,g=d.call(arguments,1),i=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(c),b.type="mousewheel","detail"in c&&(m=c.detail*-1),"wheelDelta"in c&&(m=c.wheelDelta),"wheelDeltaY"in c&&(m=c.wheelDeltaY),"wheelDeltaX"in c&&(l=c.wheelDeltaX*-1),"axis"in c&&c.axis===c.HORIZONTAL_AXIS&&(l=m*-1,m=0),i=0===m?l:m,"deltaY"in c&&(m=c.deltaY*-1,i=m),"deltaX"in c&&(l=c.deltaX,0===m&&(i=l*-1)),0!==m||0!==l){if(1===c.deltaMode){var q=a.data(this,"mousewheel-line-height");i*=q,m*=q,l*=q}else if(2===c.deltaMode){var r=a.data(this,"mousewheel-page-height");i*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n<f)&&(f=n,k(c,n)&&(f/=40)),k(c,n)&&(i/=40,l/=40,m/=40),i=Math[i>=1?"floor":"ceil"](i/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),h.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,g.unshift(b,i,l,m),e&&clearTimeout(e),e=setTimeout(j,200),(a.event.dispatch||a.event.handle).apply(this,g)}}function j(){f=null}function k(a,b){return h.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,b=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],c="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],d=Array.prototype.slice;if(a.event.fixHooks)for(var g=b.length;g;)a.event.fixHooks[b[--g]]=a.event.mouseHooks;var h=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var b=c.length;b;)this.addEventListener(c[--b],i,!1);else this.onmousewheel=i;a.data(this,"mousewheel-line-height",h.getLineHeight(this)),a.data(this,"mousewheel-page-height",h.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var b=c.length;b;)this.removeEventListener(c[--b],i,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
 
 
 
includes/metabox/butterbean/js/selectize.js ADDED
@@ -0,0 +1,3829 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * sifter.js
3
+ * Copyright (c) 2013 Brian Reavis & contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ * @author Brian Reavis <brian@thirdroute.com>
15
+ */
16
+
17
+ (function(root, factory) {
18
+ if (typeof define === 'function' && define.amd) {
19
+ define('sifter', factory);
20
+ } else if (typeof exports === 'object') {
21
+ module.exports = factory();
22
+ } else {
23
+ root.Sifter = factory();
24
+ }
25
+ }(this, function() {
26
+
27
+ /**
28
+ * Textually searches arrays and hashes of objects
29
+ * by property (or multiple properties). Designed
30
+ * specifically for autocomplete.
31
+ *
32
+ * @constructor
33
+ * @param {array|object} items
34
+ * @param {object} items
35
+ */
36
+ var Sifter = function(items, settings) {
37
+ this.items = items;
38
+ this.settings = settings || {diacritics: true};
39
+ };
40
+
41
+ /**
42
+ * Splits a search string into an array of individual
43
+ * regexps to be used to match results.
44
+ *
45
+ * @param {string} query
46
+ * @returns {array}
47
+ */
48
+ Sifter.prototype.tokenize = function(query) {
49
+ query = trim(String(query || '').toLowerCase());
50
+ if (!query || !query.length) return [];
51
+
52
+ var i, n, regex, letter;
53
+ var tokens = [];
54
+ var words = query.split(/ +/);
55
+
56
+ for (i = 0, n = words.length; i < n; i++) {
57
+ regex = escape_regex(words[i]);
58
+ if (this.settings.diacritics) {
59
+ for (letter in DIACRITICS) {
60
+ if (DIACRITICS.hasOwnProperty(letter)) {
61
+ regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
62
+ }
63
+ }
64
+ }
65
+ tokens.push({
66
+ string : words[i],
67
+ regex : new RegExp(regex, 'i')
68
+ });
69
+ }
70
+
71
+ return tokens;
72
+ };
73
+
74
+ /**
75
+ * Iterates over arrays and hashes.
76
+ *
77
+ * ```
78
+ * this.iterator(this.items, function(item, id) {
79
+ * // invoked for each item
80
+ * });
81
+ * ```
82
+ *
83
+ * @param {array|object} object
84
+ */
85
+ Sifter.prototype.iterator = function(object, callback) {
86
+ var iterator;
87
+ if (is_array(object)) {
88
+ iterator = Array.prototype.forEach || function(callback) {
89
+ for (var i = 0, n = this.length; i < n; i++) {
90
+ callback(this[i], i, this);
91
+ }
92
+ };
93
+ } else {
94
+ iterator = function(callback) {
95
+ for (var key in this) {
96
+ if (this.hasOwnProperty(key)) {
97
+ callback(this[key], key, this);
98
+ }
99
+ }
100
+ };
101
+ }
102
+
103
+ iterator.apply(object, [callback]);
104
+ };
105
+
106
+ /**
107
+ * Returns a function to be used to score individual results.
108
+ *
109
+ * Good matches will have a higher score than poor matches.
110
+ * If an item is not a match, 0 will be returned by the function.
111
+ *
112
+ * @param {object|string} search
113
+ * @param {object} options (optional)
114
+ * @returns {function}
115
+ */
116
+ Sifter.prototype.getScoreFunction = function(search, options) {
117
+ var self, fields, tokens, token_count, nesting;
118
+
119
+ self = this;
120
+ search = self.prepareSearch(search, options);
121
+ tokens = search.tokens;
122
+ fields = search.options.fields;
123
+ token_count = tokens.length;
124
+ nesting = search.options.nesting;
125
+
126
+ /**
127
+ * Calculates how close of a match the
128
+ * given value is against a search token.
129
+ *
130
+ * @param {mixed} value
131
+ * @param {object} token
132
+ * @return {number}
133
+ */
134
+ var scoreValue = function(value, token) {
135
+ var score, pos;
136
+
137
+ if (!value) return 0;
138
+ value = String(value || '');
139
+ pos = value.search(token.regex);
140
+ if (pos === -1) return 0;
141
+ score = token.string.length / value.length;
142
+ if (pos === 0) score += 0.5;
143
+ return score;
144
+ };
145
+
146
+ /**
147
+ * Calculates the score of an object
148
+ * against the search query.
149
+ *
150
+ * @param {object} token
151
+ * @param {object} data
152
+ * @return {number}
153
+ */
154
+ var scoreObject = (function() {
155
+ var field_count = fields.length;
156
+ if (!field_count) {
157
+ return function() { return 0; };
158
+ }
159
+ if (field_count === 1) {
160
+ return function(token, data) {
161
+ return scoreValue(getattr(data, fields[0], nesting), token);
162
+ };
163
+ }
164
+ return function(token, data) {
165
+ for (var i = 0, sum = 0; i < field_count; i++) {
166
+ sum += scoreValue(getattr(data, fields[i], nesting), token);
167
+ }
168
+ return sum / field_count;
169
+ };
170
+ })();
171
+
172
+ if (!token_count) {
173
+ return function() { return 0; };
174
+ }
175
+ if (token_count === 1) {
176
+ return function(data) {
177
+ return scoreObject(tokens[0], data);
178
+ };
179
+ }
180
+
181
+ if (search.options.conjunction === 'and') {
182
+ return function(data) {
183
+ var score;
184
+ for (var i = 0, sum = 0; i < token_count; i++) {
185
+ score = scoreObject(tokens[i], data);
186
+ if (score <= 0) return 0;
187
+ sum += score;
188
+ }
189
+ return sum / token_count;
190
+ };
191
+ } else {
192
+ return function(data) {
193
+ for (var i = 0, sum = 0; i < token_count; i++) {
194
+ sum += scoreObject(tokens[i], data);
195
+ }
196
+ return sum / token_count;
197
+ };
198
+ }
199
+ };
200
+
201
+ /**
202
+ * Returns a function that can be used to compare two
203
+ * results, for sorting purposes. If no sorting should
204
+ * be performed, `null` will be returned.
205
+ *
206
+ * @param {string|object} search
207
+ * @param {object} options
208
+ * @return function(a,b)
209
+ */
210
+ Sifter.prototype.getSortFunction = function(search, options) {
211
+ var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
212
+
213
+ self = this;
214
+ search = self.prepareSearch(search, options);
215
+ sort = (!search.query && options.sort_empty) || options.sort;
216
+
217
+ /**
218
+ * Fetches the specified sort field value
219
+ * from a search result item.
220
+ *
221
+ * @param {string} name
222
+ * @param {object} result
223
+ * @return {mixed}
224
+ */
225
+ get_field = function(name, result) {
226
+ if (name === '$score') return result.score;
227
+ return getattr(self.items[result.id], name, options.nesting);
228
+ };
229
+
230
+ // parse options
231
+ fields = [];
232
+ if (sort) {
233
+ for (i = 0, n = sort.length; i < n; i++) {
234
+ if (search.query || sort[i].field !== '$score') {
235
+ fields.push(sort[i]);
236
+ }
237
+ }
238
+ }
239
+
240
+ // the "$score" field is implied to be the primary
241
+ // sort field, unless it's manually specified
242
+ if (search.query) {
243
+ implicit_score = true;
244
+ for (i = 0, n = fields.length; i < n; i++) {
245
+ if (fields[i].field === '$score') {
246
+ implicit_score = false;
247
+ break;
248
+ }
249
+ }
250
+ if (implicit_score) {
251
+ fields.unshift({field: '$score', direction: 'desc'});
252
+ }
253
+ } else {
254
+ for (i = 0, n = fields.length; i < n; i++) {
255
+ if (fields[i].field === '$score') {
256
+ fields.splice(i, 1);
257
+ break;
258
+ }
259
+ }
260
+ }
261
+
262
+ multipliers = [];
263
+ for (i = 0, n = fields.length; i < n; i++) {
264
+ multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
265
+ }
266
+
267
+ // build function
268
+ fields_count = fields.length;
269
+ if (!fields_count) {
270
+ return null;
271
+ } else if (fields_count === 1) {
272
+ field = fields[0].field;
273
+ multiplier = multipliers[0];
274
+ return function(a, b) {
275
+ return multiplier * cmp(
276
+ get_field(field, a),
277
+ get_field(field, b)
278
+ );
279
+ };
280
+ } else {
281
+ return function(a, b) {
282
+ var i, result, a_value, b_value, field;
283
+ for (i = 0; i < fields_count; i++) {
284
+ field = fields[i].field;
285
+ result = multipliers[i] * cmp(
286
+ get_field(field, a),
287
+ get_field(field, b)
288
+ );
289
+ if (result) return result;
290
+ }
291
+ return 0;
292
+ };
293
+ }
294
+ };
295
+
296
+ /**
297
+ * Parses a search query and returns an object
298
+ * with tokens and fields ready to be populated
299
+ * with results.
300
+ *
301
+ * @param {string} query
302
+ * @param {object} options
303
+ * @returns {object}
304
+ */
305
+ Sifter.prototype.prepareSearch = function(query, options) {
306
+ if (typeof query === 'object') return query;
307
+
308
+ options = extend({}, options);
309
+
310
+ var option_fields = options.fields;
311
+ var option_sort = options.sort;
312
+ var option_sort_empty = options.sort_empty;
313
+
314
+ if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
315
+ if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
316
+ if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
317
+
318
+ return {
319
+ options : options,
320
+ query : String(query || '').toLowerCase(),
321
+ tokens : this.tokenize(query),
322
+ total : 0,
323
+ items : []
324
+ };
325
+ };
326
+
327
+ /**
328
+ * Searches through all items and returns a sorted array of matches.
329
+ *
330
+ * The `options` parameter can contain:
331
+ *
332
+ * - fields {string|array}
333
+ * - sort {array}
334
+ * - score {function}
335
+ * - filter {bool}
336
+ * - limit {integer}
337
+ *
338
+ * Returns an object containing:
339
+ *
340
+ * - options {object}
341
+ * - query {string}
342
+ * - tokens {array}
343
+ * - total {int}
344
+ * - items {array}
345
+ *
346
+ * @param {string} query
347
+ * @param {object} options
348
+ * @returns {object}
349
+ */
350
+ Sifter.prototype.search = function(query, options) {
351
+ var self = this, value, score, search, calculateScore;
352
+ var fn_sort;
353
+ var fn_score;
354
+
355
+ search = this.prepareSearch(query, options);
356
+ options = search.options;
357
+ query = search.query;
358
+
359
+ // generate result scoring function
360
+ fn_score = options.score || self.getScoreFunction(search);
361
+
362
+ // perform search and sort
363
+ if (query.length) {
364
+ self.iterator(self.items, function(item, id) {
365
+ score = fn_score(item);
366
+ if (options.filter === false || score > 0) {
367
+ search.items.push({'score': score, 'id': id});
368
+ }
369
+ });
370
+ } else {
371
+ self.iterator(self.items, function(item, id) {
372
+ search.items.push({'score': 1, 'id': id});
373
+ });
374
+ }
375
+
376
+ fn_sort = self.getSortFunction(search, options);
377
+ if (fn_sort) search.items.sort(fn_sort);
378
+
379
+ // apply limits
380
+ search.total = search.items.length;
381
+ if (typeof options.limit === 'number') {
382
+ search.items = search.items.slice(0, options.limit);
383
+ }
384
+
385
+ return search;
386
+ };
387
+
388
+ // utilities
389
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
390
+
391
+ var cmp = function(a, b) {
392
+ if (typeof a === 'number' && typeof b === 'number') {
393
+ return a > b ? 1 : (a < b ? -1 : 0);
394
+ }
395
+ a = asciifold(String(a || ''));
396
+ b = asciifold(String(b || ''));
397
+ if (a > b) return 1;
398
+ if (b > a) return -1;
399
+ return 0;
400
+ };
401
+
402
+ var extend = function(a, b) {
403
+ var i, n, k, object;
404
+ for (i = 1, n = arguments.length; i < n; i++) {
405
+ object = arguments[i];
406
+ if (!object) continue;
407
+ for (k in object) {
408
+ if (object.hasOwnProperty(k)) {
409
+ a[k] = object[k];
410
+ }
411
+ }
412
+ }
413
+ return a;
414
+ };
415
+
416
+ /**
417
+ * A property getter resolving dot-notation
418
+ * @param {Object} obj The root object to fetch property on
419
+ * @param {String} name The optionally dotted property name to fetch
420
+ * @param {Boolean} nesting Handle nesting or not
421
+ * @return {Object} The resolved property value
422
+ */
423
+ var getattr = function(obj, name, nesting) {
424
+ if (!obj || !name) return;
425
+ if (!nesting) return obj[name];
426
+ var names = name.split(".");
427
+ while(names.length && (obj = obj[names.shift()]));
428
+ return obj;
429
+ };
430
+
431
+ var trim = function(str) {
432
+ return (str + '').replace(/^\s+|\s+$|/g, '');
433
+ };
434
+
435
+ var escape_regex = function(str) {
436
+ return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
437
+ };
438
+
439
+ var is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) {
440
+ return Object.prototype.toString.call(object) === '[object Array]';
441
+ };
442
+
443
+ var DIACRITICS = {
444
+ 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
445
+ 'b': '[b␢βΒB฿𐌁ᛒ]',
446
+ 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
447
+ 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
448
+ 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
449
+ 'f': '[fƑƒḞḟ]',
450
+ 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
451
+ 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
452
+ 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
453
+ 'j': '[jȷĴĵɈɉʝɟʲ]',
454
+ 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
455
+ 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
456
+ 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
457
+ 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
458
+ 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
459
+ 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
460
+ 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
461
+ 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
462
+ 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
463
+ 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
464
+ 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
465
+ 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
466
+ 'x': '[xẌẍẊẋχ]',
467
+ 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
468
+ 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
469
+ };
470
+
471
+ var asciifold = (function() {
472
+ var i, n, k, chunk;
473
+ var foreignletters = '';
474
+ var lookup = {};
475
+ for (k in DIACRITICS) {
476
+ if (DIACRITICS.hasOwnProperty(k)) {
477
+ chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
478
+ foreignletters += chunk;
479
+ for (i = 0, n = chunk.length; i < n; i++) {
480
+ lookup[chunk.charAt(i)] = k;
481
+ }
482
+ }
483
+ }
484
+ var regexp = new RegExp('[' + foreignletters + ']', 'g');
485
+ return function(str) {
486
+ return str.replace(regexp, function(foreignletter) {
487
+ return lookup[foreignletter];
488
+ }).toLowerCase();
489
+ };
490
+ })();
491
+
492
+
493
+ // export
494
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
495
+
496
+ return Sifter;
497
+ }));
498
+
499
+
500
+
501
+ /**
502
+ * microplugin.js
503
+ * Copyright (c) 2013 Brian Reavis & contributors
504
+ *
505
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
506
+ * file except in compliance with the License. You may obtain a copy of the License at:
507
+ * http://www.apache.org/licenses/LICENSE-2.0
508
+ *
509
+ * Unless required by applicable law or agreed to in writing, software distributed under
510
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
511
+ * ANY KIND, either express or implied. See the License for the specific language
512
+ * governing permissions and limitations under the License.
513
+ *
514
+ * @author Brian Reavis <brian@thirdroute.com>
515
+ */
516
+
517
+ (function(root, factory) {
518
+ if (typeof define === 'function' && define.amd) {
519
+ define('microplugin', factory);
520
+ } else if (typeof exports === 'object') {
521
+ module.exports = factory();
522
+ } else {
523
+ root.MicroPlugin = factory();
524
+ }
525
+ }(this, function() {
526
+ var MicroPlugin = {};
527
+
528
+ MicroPlugin.mixin = function(Interface) {
529
+ Interface.plugins = {};
530
+
531
+ /**
532
+ * Initializes the listed plugins (with options).
533
+ * Acceptable formats:
534
+ *
535
+ * List (without options):
536
+ * ['a', 'b', 'c']
537
+ *
538
+ * List (with options):
539
+ * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
540
+ *
541
+ * Hash (with options):
542
+ * {'a': { ... }, 'b': { ... }, 'c': { ... }}
543
+ *
544
+ * @param {mixed} plugins
545
+ */
546
+ Interface.prototype.initializePlugins = function(plugins) {
547
+ var i, n, key;
548
+ var self = this;
549
+ var queue = [];
550
+
551
+ self.plugins = {
552
+ names : [],
553
+ settings : {},
554
+ requested : {},
555
+ loaded : {}
556
+ };
557
+
558
+ if (utils.isArray(plugins)) {
559
+ for (i = 0, n = plugins.length; i < n; i++) {
560
+ if (typeof plugins[i] === 'string') {
561
+ queue.push(plugins[i]);
562
+ } else {
563
+ self.plugins.settings[plugins[i].name] = plugins[i].options;
564
+ queue.push(plugins[i].name);
565
+ }
566
+ }
567
+ } else if (plugins) {
568
+ for (key in plugins) {
569
+ if (plugins.hasOwnProperty(key)) {
570
+ self.plugins.settings[key] = plugins[key];
571
+ queue.push(key);
572
+ }
573
+ }
574
+ }
575
+
576
+ while (queue.length) {
577
+ self.require(queue.shift());
578
+ }
579
+ };
580
+
581
+ Interface.prototype.loadPlugin = function(name) {
582
+ var self = this;
583
+ var plugins = self.plugins;
584
+ var plugin = Interface.plugins[name];
585
+
586
+ if (!Interface.plugins.hasOwnProperty(name)) {
587
+ throw new Error('Unable to find "' + name + '" plugin');
588
+ }
589
+
590
+ plugins.requested[name] = true;
591
+ plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
592
+ plugins.names.push(name);
593
+ };
594
+
595
+ /**
596
+ * Initializes a plugin.
597
+ *
598
+ * @param {string} name
599
+ */
600
+ Interface.prototype.require = function(name) {
601
+ var self = this;
602
+ var plugins = self.plugins;
603
+
604
+ if (!self.plugins.loaded.hasOwnProperty(name)) {
605
+ if (plugins.requested[name]) {
606
+ throw new Error('Plugin has circular dependency ("' + name + '")');
607
+ }
608
+ self.loadPlugin(name);
609
+ }
610
+
611
+ return plugins.loaded[name];
612
+ };
613
+
614
+ /**
615
+ * Registers a plugin.
616
+ *
617
+ * @param {string} name
618
+ * @param {function} fn
619
+ */
620
+ Interface.define = function(name, fn) {
621
+ Interface.plugins[name] = {
622
+ 'name' : name,
623
+ 'fn' : fn
624
+ };
625
+ };
626
+ };
627
+
628
+ var utils = {
629
+ isArray: Array.isArray || function(vArg) {
630
+ return Object.prototype.toString.call(vArg) === '[object Array]';
631
+ }
632
+ };
633
+
634
+ return MicroPlugin;
635
+ }));
636
+
637
+ /**
638
+ * selectize.js (v0.12.4)
639
+ * Copyright (c) 2013–2015 Brian Reavis & contributors
640
+ *
641
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
642
+ * file except in compliance with the License. You may obtain a copy of the License at:
643
+ * http://www.apache.org/licenses/LICENSE-2.0
644
+ *
645
+ * Unless required by applicable law or agreed to in writing, software distributed under
646
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
647
+ * ANY KIND, either express or implied. See the License for the specific language
648
+ * governing permissions and limitations under the License.
649
+ *
650
+ * @author Brian Reavis <brian@thirdroute.com>
651
+ */
652
+
653
+ /*jshint curly:false */
654
+ /*jshint browser:true */
655
+
656
+ (function(root, factory) {
657
+ if (typeof define === 'function' && define.amd) {
658
+ define('selectize', ['jquery','sifter','microplugin'], factory);
659
+ } else if (typeof exports === 'object') {
660
+ module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
661
+ } else {
662
+ root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
663
+ }
664
+ }(this, function($, Sifter, MicroPlugin) {
665
+ 'use strict';
666
+
667
+ var highlight = function($element, pattern) {
668
+ if (typeof pattern === 'string' && !pattern.length) return;
669
+ var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
670
+
671
+ var highlight = function(node) {
672
+ var skip = 0;
673
+ if (node.nodeType === 3) {
674
+ var pos = node.data.search(regex);
675
+ if (pos >= 0 && node.data.length > 0) {
676
+ var match = node.data.match(regex);
677
+ var spannode = document.createElement('span');
678
+ spannode.className = 'highlight';
679
+ var middlebit = node.splitText(pos);
680
+ var endbit = middlebit.splitText(match[0].length);
681
+ var middleclone = middlebit.cloneNode(true);
682
+ spannode.appendChild(middleclone);
683
+ middlebit.parentNode.replaceChild(spannode, middlebit);
684
+ skip = 1;
685
+ }
686
+ } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
687
+ for (var i = 0; i < node.childNodes.length; ++i) {
688
+ i += highlight(node.childNodes[i]);
689
+ }
690
+ }
691
+ return skip;
692
+ };
693
+
694
+ return $element.each(function() {
695
+ highlight(this);
696
+ });
697
+ };
698
+
699
+ /**
700
+ * removeHighlight fn copied from highlight v5 and
701
+ * edited to remove with() and pass js strict mode
702
+ */
703
+ $.fn.removeHighlight = function() {
704
+ return this.find("span.highlight").each(function() {
705
+ this.parentNode.firstChild.nodeName;
706
+ var parent = this.parentNode;
707
+ parent.replaceChild(this.firstChild, this);
708
+ parent.normalize();
709
+ }).end();
710
+ };
711
+
712
+
713
+ var MicroEvent = function() {};
714
+ MicroEvent.prototype = {
715
+ on: function(event, fct){
716
+ this._events = this._events || {};
717
+ this._events[event] = this._events[event] || [];
718
+ this._events[event].push(fct);
719
+ },
720
+ off: function(event, fct){
721
+ var n = arguments.length;
722
+ if (n === 0) return delete this._events;
723
+ if (n === 1) return delete this._events[event];
724
+
725
+ this._events = this._events || {};
726
+ if (event in this._events === false) return;
727
+ this._events[event].splice(this._events[event].indexOf(fct), 1);
728
+ },
729
+ trigger: function(event /* , args... */){
730
+ this._events = this._events || {};
731
+ if (event in this._events === false) return;
732
+ for (var i = 0; i < this._events[event].length; i++){
733
+ this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
734
+ }
735
+ }
736
+ };
737
+
738
+ /**
739
+ * Mixin will delegate all MicroEvent.js function in the destination object.
740
+ *
741
+ * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
742
+ *
743
+ * @param {object} the object which will support MicroEvent
744
+ */
745
+ MicroEvent.mixin = function(destObject){
746
+ var props = ['on', 'off', 'trigger'];
747
+ for (var i = 0; i < props.length; i++){
748
+ destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
749
+ }
750
+ };
751
+
752
+ var IS_MAC = /Mac/.test(navigator.userAgent);
753
+
754
+ var KEY_A = 65;
755
+ var KEY_COMMA = 188;
756
+ var KEY_RETURN = 13;
757
+ var KEY_ESC = 27;
758
+ var KEY_LEFT = 37;
759
+ var KEY_UP = 38;
760
+ var KEY_P = 80;
761
+ var KEY_RIGHT = 39;
762
+ var KEY_DOWN = 40;
763
+ var KEY_N = 78;
764
+ var KEY_BACKSPACE = 8;
765
+ var KEY_DELETE = 46;
766
+ var KEY_SHIFT = 16;
767
+ var KEY_CMD = IS_MAC ? 91 : 17;
768
+ var KEY_CTRL = IS_MAC ? 18 : 17;
769
+ var KEY_TAB = 9;
770
+
771
+ var TAG_SELECT = 1;
772
+ var TAG_INPUT = 2;
773
+
774
+ // for now, android support in general is too spotty to support validity
775
+ var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
776
+
777
+
778
+ var isset = function(object) {
779
+ return typeof object !== 'undefined';
780
+ };
781
+
782
+ /**
783
+ * Converts a scalar to its best string representation
784
+ * for hash keys and HTML attribute values.
785
+ *
786
+ * Transformations:
787
+ * 'str' -> 'str'
788
+ * null -> ''
789
+ * undefined -> ''
790
+ * true -> '1'
791
+ * false -> '0'
792
+ * 0 -> '0'
793
+ * 1 -> '1'
794
+ *
795
+ * @param {string} value
796
+ * @returns {string|null}
797
+ */
798
+ var hash_key = function(value) {
799
+ if (typeof value === 'undefined' || value === null) return null;
800
+ if (typeof value === 'boolean') return value ? '1' : '0';
801
+ return value + '';
802
+ };
803
+
804
+ /**
805
+ * Escapes a string for use within HTML.
806
+ *
807
+ * @param {string} str
808
+ * @returns {string}
809
+ */
810
+ var escape_html = function(str) {
811
+ return (str + '')
812
+ .replace(/&/g, '&amp;')
813
+ .replace(/</g, '&lt;')
814
+ .replace(/>/g, '&gt;')
815
+ .replace(/"/g, '&quot;');
816
+ };
817
+
818
+ /**
819
+ * Escapes "$" characters in replacement strings.
820
+ *
821
+ * @param {string} str
822
+ * @returns {string}
823
+ */
824
+ var escape_replace = function(str) {
825
+ return (str + '').replace(/\$/g, '$$$$');
826
+ };
827
+
828
+ var hook = {};
829
+
830
+ /**
831
+ * Wraps `method` on `self` so that `fn`
832
+ * is invoked before the original method.
833
+ *
834
+ * @param {object} self
835
+ * @param {string} method
836
+ * @param {function} fn
837
+ */
838
+ hook.before = function(self, method, fn) {
839
+ var original = self[method];
840
+ self[method] = function() {
841
+ fn.apply(self, arguments);
842
+ return original.apply(self, arguments);
843
+ };
844
+ };
845
+
846
+ /**
847
+ * Wraps `method` on `self` so that `fn`
848
+ * is invoked after the original method.
849
+ *
850
+ * @param {object} self
851
+ * @param {string} method
852
+ * @param {function} fn
853
+ */
854
+ hook.after = function(self, method, fn) {
855
+ var original = self[method];
856
+ self[method] = function() {
857
+ var result = original.apply(self, arguments);
858
+ fn.apply(self, arguments);
859
+ return result;
860
+ };
861
+ };
862
+
863
+ /**
864
+ * Wraps `fn` so that it can only be invoked once.
865
+ *
866
+ * @param {function} fn
867
+ * @returns {function}
868
+ */
869
+ var once = function(fn) {
870
+ var called = false;
871
+ return function() {
872
+ if (called) return;
873
+ called = true;
874
+ fn.apply(this, arguments);
875
+ };
876
+ };
877
+
878
+ /**
879
+ * Wraps `fn` so that it can only be called once
880
+ * every `delay` milliseconds (invoked on the falling edge).
881
+ *
882
+ * @param {function} fn
883
+ * @param {int} delay
884
+ * @returns {function}
885
+ */
886
+ var debounce = function(fn, delay) {
887
+ var timeout;
888
+ return function() {
889
+ var self = this;
890
+ var args = arguments;
891
+ window.clearTimeout(timeout);
892
+ timeout = window.setTimeout(function() {
893
+ fn.apply(self, args);
894
+ }, delay);
895
+ };
896
+ };
897
+
898
+ /**
899
+ * Debounce all fired events types listed in `types`
900
+ * while executing the provided `fn`.
901
+ *
902
+ * @param {object} self
903
+ * @param {array} types
904
+ * @param {function} fn
905
+ */
906
+ var debounce_events = function(self, types, fn) {
907
+ var type;
908
+ var trigger = self.trigger;
909
+ var event_args = {};
910
+
911
+ // override trigger method
912
+ self.trigger = function() {
913
+ var type = arguments[0];
914
+ if (types.indexOf(type) !== -1) {
915
+ event_args[type] = arguments;
916
+ } else {
917
+ return trigger.apply(self, arguments);
918
+ }
919
+ };
920
+
921
+ // invoke provided function
922
+ fn.apply(self, []);
923
+ self.trigger = trigger;
924
+
925
+ // trigger queued events
926
+ for (type in event_args) {
927
+ if (event_args.hasOwnProperty(type)) {
928
+ trigger.apply(self, event_args[type]);
929
+ }
930
+ }
931
+ };
932
+
933
+ /**
934
+ * A workaround for http://bugs.jquery.com/ticket/6696
935
+ *
936
+ * @param {object} $parent - Parent element to listen on.
937
+ * @param {string} event - Event name.
938
+ * @param {string} selector - Descendant selector to filter by.
939
+ * @param {function} fn - Event handler.
940
+ */
941
+ var watchChildEvent = function($parent, event, selector, fn) {
942
+ $parent.on(event, selector, function(e) {
943
+ var child = e.target;
944
+ while (child && child.parentNode !== $parent[0]) {
945
+ child = child.parentNode;
946
+ }
947
+ e.currentTarget = child;
948
+ return fn.apply(this, [e]);
949
+ });
950
+ };
951
+
952
+ /**
953
+ * Determines the current selection within a text input control.
954
+ * Returns an object containing:
955
+ * - start
956
+ * - length
957
+ *
958
+ * @param {object} input
959
+ * @returns {object}
960
+ */
961
+ var getSelection = function(input) {
962
+ var result = {};
963
+ if ('selectionStart' in input) {
964
+ result.start = input.selectionStart;
965
+ result.length = input.selectionEnd - result.start;
966
+ } else if (document.selection) {
967
+ input.focus();
968
+ var sel = document.selection.createRange();
969
+ var selLen = document.selection.createRange().text.length;
970
+ sel.moveStart('character', -input.value.length);
971
+ result.start = sel.text.length - selLen;
972
+ result.length = selLen;
973
+ }
974
+ return result;
975
+ };
976
+
977
+ /**
978
+ * Copies CSS properties from one element to another.
979
+ *
980
+ * @param {object} $from
981
+ * @param {object} $to
982
+ * @param {array} properties
983
+ */
984
+ var transferStyles = function($from, $to, properties) {
985
+ var i, n, styles = {};
986
+ if (properties) {
987
+ for (i = 0, n = properties.length; i < n; i++) {
988
+ styles[properties[i]] = $from.css(properties[i]);
989
+ }
990
+ } else {
991
+ styles = $from.css();
992
+ }
993
+ $to.css(styles);
994
+ };
995
+
996
+ /**
997
+ * Measures the width of a string within a
998
+ * parent element (in pixels).
999
+ *
1000
+ * @param {string} str
1001
+ * @param {object} $parent
1002
+ * @returns {int}
1003
+ */
1004
+ var measureString = function(str, $parent) {
1005
+ if (!str) {
1006
+ return 0;
1007
+ }
1008
+
1009
+ var $test = $('<test>').css({
1010
+ position: 'absolute',
1011
+ top: -99999,
1012
+ left: -99999,
1013
+ width: 'auto',
1014
+ padding: 0,
1015
+ whiteSpace: 'pre'
1016
+ }).text(str).appendTo('body');
1017
+
1018
+ transferStyles($parent, $test, [
1019
+ 'letterSpacing',
1020
+ 'fontSize',
1021
+ 'fontFamily',
1022
+ 'fontWeight',
1023
+ 'textTransform'
1024
+ ]);
1025
+
1026
+ var width = $test.width();
1027
+ $test.remove();
1028
+
1029
+ return width;
1030
+ };
1031
+
1032
+ /**
1033
+ * Sets up an input to grow horizontally as the user
1034
+ * types. If the value is changed manually, you can
1035
+ * trigger the "update" handler to resize:
1036
+ *
1037
+ * $input.trigger('update');
1038
+ *
1039
+ * @param {object} $input
1040
+ */
1041
+ var autoGrow = function($input) {
1042
+ var currentWidth = null;
1043
+
1044
+ var update = function(e, options) {
1045
+ var value, keyCode, printable, placeholder, width;
1046
+ var shift, character, selection;
1047
+ e = e || window.event || {};
1048
+ options = options || {};
1049
+
1050
+ if (e.metaKey || e.altKey) return;
1051
+ if (!options.force && $input.data('grow') === false) return;
1052
+
1053
+ value = $input.val();
1054
+ if (e.type && e.type.toLowerCase() === 'keydown') {
1055
+ keyCode = e.keyCode;
1056
+ printable = (
1057
+ (keyCode >= 97 && keyCode <= 122) || // a-z
1058
+ (keyCode >= 65 && keyCode <= 90) || // A-Z
1059
+ (keyCode >= 48 && keyCode <= 57) || // 0-9
1060
+ keyCode === 32 // space
1061
+ );
1062
+
1063
+ if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
1064
+ selection = getSelection($input[0]);
1065
+ if (selection.length) {
1066
+ value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
1067
+ } else if (keyCode === KEY_BACKSPACE && selection.start) {
1068
+ value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
1069
+ } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
1070
+ value = value.substring(0, selection.start) + value.substring(selection.start + 1);
1071
+ }
1072
+ } else if (printable) {
1073
+ shift = e.shiftKey;
1074
+ character = String.fromCharCode(e.keyCode);
1075
+ if (shift) character = character.toUpperCase();
1076
+ else character = character.toLowerCase();
1077
+ value += character;
1078
+ }
1079
+ }
1080
+
1081
+ placeholder = $input.attr('placeholder');
1082
+ if (!value && placeholder) {
1083
+ value = placeholder;
1084
+ }
1085
+
1086
+ width = measureString(value, $input) + 4;
1087
+ if (width !== currentWidth) {
1088
+ currentWidth = width;
1089
+ $input.width(width);
1090
+ $input.triggerHandler('resize');
1091
+ }
1092
+ };
1093
+
1094
+ $input.on('keydown keyup update blur', update);
1095
+ update();
1096
+ };
1097
+
1098
+ var domToString = function(d) {
1099
+ var tmp = document.createElement('div');
1100
+
1101
+ tmp.appendChild(d.cloneNode(true));
1102
+
1103
+ return tmp.innerHTML;
1104
+ };
1105
+
1106
+ var logError = function(message, options){
1107
+ if(!options) options = {};
1108
+ var component = "Selectize";
1109
+
1110
+ console.error(component + ": " + message)
1111
+
1112
+ if(options.explanation){
1113
+ // console.group is undefined in <IE11
1114
+ if(console.group) console.group();
1115
+ console.error(options.explanation);
1116
+ if(console.group) console.groupEnd();
1117
+ }
1118
+ }
1119
+
1120
+
1121
+ var Selectize = function($input, settings) {
1122
+ var key, i, n, dir, input, self = this;
1123
+ input = $input[0];
1124
+ input.selectize = self;
1125
+
1126
+ // detect rtl environment
1127
+ var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
1128
+ dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
1129
+ dir = dir || $input.parents('[dir]:first').attr('dir') || '';
1130
+
1131
+ // setup default state
1132
+ $.extend(self, {
1133
+ order : 0,
1134
+ settings : settings,
1135
+ $input : $input,
1136
+ tabIndex : $input.attr('tabindex') || '',
1137
+ tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
1138
+ rtl : /rtl/i.test(dir),
1139
+
1140
+ eventNS : '.selectize' + (++Selectize.count),
1141
+ highlightedValue : null,
1142
+ isOpen : false,
1143
+ isDisabled : false,
1144
+ isRequired : $input.is('[required]'),
1145
+ isInvalid : false,
1146
+ isLocked : false,
1147
+ isFocused : false,
1148
+ isInputHidden : false,
1149
+ isSetup : false,
1150
+ isShiftDown : false,
1151
+ isCmdDown : false,
1152
+ isCtrlDown : false,
1153
+ ignoreFocus : false,
1154
+ ignoreBlur : false,
1155
+ ignoreHover : false,
1156
+ hasOptions : false,
1157
+ currentResults : null,
1158
+ lastValue : '',
1159
+ caretPos : 0,
1160
+ loading : 0,
1161
+ loadedSearches : {},
1162
+
1163
+ $activeOption : null,
1164
+ $activeItems : [],
1165
+
1166
+ optgroups : {},
1167
+ options : {},
1168
+ userOptions : {},
1169
+ items : [],
1170
+ renderCache : {},
1171
+ onSearchChange : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
1172
+ });
1173
+
1174
+ // search system
1175
+ self.sifter = new Sifter(this.options, {diacritics: settings.diacritics});
1176
+
1177
+ // build options table
1178
+ if (self.settings.options) {
1179
+ for (i = 0, n = self.settings.options.length; i < n; i++) {
1180
+ self.registerOption(self.settings.options[i]);
1181
+ }
1182
+ delete self.settings.options;
1183
+ }
1184
+
1185
+ // build optgroup table
1186
+ if (self.settings.optgroups) {
1187
+ for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
1188
+ self.registerOptionGroup(self.settings.optgroups[i]);
1189
+ }
1190
+ delete self.settings.optgroups;
1191
+ }
1192
+
1193
+ // option-dependent defaults
1194
+ self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
1195
+ if (typeof self.settings.hideSelected !== 'boolean') {
1196
+ self.settings.hideSelected = self.settings.mode === 'multi';
1197
+ }
1198
+
1199
+ self.initializePlugins(self.settings.plugins);
1200
+ self.setupCallbacks();
1201
+ self.setupTemplates();
1202
+ self.setup();
1203
+ };
1204
+
1205
+ // mixins
1206
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1207
+
1208
+ MicroEvent.mixin(Selectize);
1209
+
1210
+ if(typeof MicroPlugin !== "undefined"){
1211
+ MicroPlugin.mixin(Selectize);
1212
+ }else{
1213
+ logError("Dependency MicroPlugin is missing",
1214
+ {explanation:
1215
+ "Make sure you either: (1) are using the \"standalone\" "+
1216
+ "version of Selectize, or (2) require MicroPlugin before you "+
1217
+ "load Selectize."}
1218
+ );
1219
+ }
1220
+
1221
+
1222
+ // methods
1223
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1224
+
1225
+ $.extend(Selectize.prototype, {
1226
+
1227
+ /**
1228
+ * Creates all elements and sets up event bindings.
1229
+ */
1230
+ setup: function() {
1231
+ var self = this;
1232
+ var settings = self.settings;
1233
+ var eventNS = self.eventNS;
1234
+ var $window = $(window);
1235
+ var $document = $(document);
1236
+ var $input = self.$input;
1237
+
1238
+ var $wrapper;
1239
+ var $control;
1240
+ var $control_input;
1241
+ var $dropdown;
1242
+ var $dropdown_content;
1243
+ var $dropdown_parent;
1244
+ var inputMode;
1245
+ var timeout_blur;
1246
+ var timeout_focus;
1247
+ var classes;
1248
+ var classes_plugins;
1249
+ var inputId;
1250
+
1251
+ inputMode = self.settings.mode;
1252
+ classes = $input.attr('class') || '';
1253
+
1254
+ $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode);
1255
+ $control = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper);
1256
+ $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
1257
+ $dropdown_parent = $(settings.dropdownParent || $wrapper);
1258
+ $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
1259
+ $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
1260
+
1261
+ if(inputId = $input.attr('id')) {
1262
+ $control_input.attr('id', inputId + '-selectized');
1263
+ $("label[for='"+inputId+"']").attr('for', inputId + '-selectized');
1264
+ }
1265
+
1266
+ if(self.settings.copyClassesToDropdown) {
1267
+ $dropdown.addClass(classes);
1268
+ }
1269
+
1270
+ $wrapper.css({
1271
+ width: $input[0].style.width
1272
+ });
1273
+
1274
+ if (self.plugins.names.length) {
1275
+ classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
1276
+ $wrapper.addClass(classes_plugins);
1277
+ $dropdown.addClass(classes_plugins);
1278
+ }
1279
+
1280
+ if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
1281
+ $input.attr('multiple', 'multiple');
1282
+ }
1283
+
1284
+ if (self.settings.placeholder) {
1285
+ $control_input.attr('placeholder', settings.placeholder);
1286
+ }
1287
+
1288
+ // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
1289
+ if (!self.settings.splitOn && self.settings.delimiter) {
1290
+ var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
1291
+ self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
1292
+ }
1293
+
1294
+ if ($input.attr('autocorrect')) {
1295
+ $control_input.attr('autocorrect', $input.attr('autocorrect'));
1296
+ }
1297
+
1298
+ if ($input.attr('autocapitalize')) {
1299
+ $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
1300
+ }
1301
+
1302
+ self.$wrapper = $wrapper;
1303
+ self.$control = $control;
1304
+ self.$control_input = $control_input;
1305
+ self.$dropdown = $dropdown;
1306
+ self.$dropdown_content = $dropdown_content;
1307
+
1308
+ $dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); });
1309
+ $dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); });
1310
+ watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); });
1311
+ autoGrow($control_input);
1312
+
1313
+ $control.on({
1314
+ mousedown : function() { return self.onMouseDown.apply(self, arguments); },
1315
+ click : function() { return self.onClick.apply(self, arguments); }
1316
+ });
1317
+
1318
+ $control_input.on({
1319
+ mousedown : function(e) { e.stopPropagation(); },
1320
+ keydown : function() { return self.onKeyDown.apply(self, arguments); },
1321
+ keyup : function() { return self.onKeyUp.apply(self, arguments); },
1322
+ keypress : function() { return self.onKeyPress.apply(self, arguments); },
1323
+ resize : function() { self.positionDropdown.apply(self, []); },
1324
+ blur : function() { return self.onBlur.apply(self, arguments); },
1325
+ focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); },
1326
+ paste : function() { return self.onPaste.apply(self, arguments); }
1327
+ });
1328
+
1329
+ $document.on('keydown' + eventNS, function(e) {
1330
+ self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
1331
+ self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
1332
+ self.isShiftDown = e.shiftKey;
1333
+ });
1334
+
1335
+ $document.on('keyup' + eventNS, function(e) {
1336
+ if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
1337
+ if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
1338
+ if (e.keyCode === KEY_CMD) self.isCmdDown = false;
1339
+ });
1340
+
1341
+ $document.on('mousedown' + eventNS, function(e) {
1342
+ if (self.isFocused) {
1343
+ // prevent events on the dropdown scrollbar from causing the control to blur
1344
+ if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
1345
+ return false;
1346
+ }
1347
+ // blur on click outside
1348
+ if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
1349
+ self.blur(e.target);
1350
+ }
1351
+ }
1352
+ });
1353
+
1354
+ $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() {
1355
+ if (self.isOpen) {
1356
+ self.positionDropdown.apply(self, arguments);
1357
+ }
1358
+ });
1359
+ $window.on('mousemove' + eventNS, function() {
1360
+ self.ignoreHover = false;
1361
+ });
1362
+
1363
+ // store original children and tab index so that they can be
1364
+ // restored when the destroy() method is called.
1365
+ this.revertSettings = {
1366
+ $children : $input.children().detach(),
1367
+ tabindex : $input.attr('tabindex')
1368
+ };
1369
+
1370
+ $input.attr('tabindex', -1).hide().after(self.$wrapper);
1371
+
1372
+ if ($.isArray(settings.items)) {
1373
+ self.setValue(settings.items);
1374
+ delete settings.items;
1375
+ }
1376
+
1377
+ // feature detect for the validation API
1378
+ if (SUPPORTS_VALIDITY_API) {
1379
+ $input.on('invalid' + eventNS, function(e) {
1380
+ e.preventDefault();
1381
+ self.isInvalid = true;
1382
+ self.refreshState();
1383
+ });
1384
+ }
1385
+
1386
+ self.updateOriginalInput();
1387
+ self.refreshItems();
1388
+ self.refreshState();
1389
+ self.updatePlaceholder();
1390
+ self.isSetup = true;
1391
+
1392
+ if ($input.is(':disabled')) {
1393
+ self.disable();
1394
+ }
1395
+
1396
+ self.on('change', this.onChange);
1397
+
1398
+ $input.data('selectize', self);
1399
+ $input.addClass('selectized');
1400
+ self.trigger('initialize');
1401
+
1402
+ // preload options
1403
+ if (settings.preload === true) {
1404
+ self.onSearchChange('');
1405
+ }
1406
+
1407
+ },
1408
+
1409
+ /**
1410
+ * Sets up default rendering functions.
1411
+ */
1412
+ setupTemplates: function() {
1413
+ var self = this;
1414
+ var field_label = self.settings.labelField;
1415
+ var field_optgroup = self.settings.optgroupLabelField;
1416
+
1417
+ var templates = {
1418
+ 'optgroup': function(data) {
1419
+ return '<div class="optgroup">' + data.html + '</div>';
1420
+ },
1421
+ 'optgroup_header': function(data, escape) {
1422
+ return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
1423
+ },
1424
+ 'option': function(data, escape) {
1425
+ return '<div class="option">' + escape(data[field_label]) + '</div>';
1426
+ },
1427
+ 'item': function(data, escape) {
1428
+ return '<div class="item">' + escape(data[field_label]) + '</div>';
1429
+ },
1430
+ 'option_create': function(data, escape) {
1431
+ return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
1432
+ }
1433
+ };
1434
+
1435
+ self.settings.render = $.extend({}, templates, self.settings.render);
1436
+ },
1437
+
1438
+ /**
1439
+ * Maps fired events to callbacks provided
1440
+ * in the settings used when creating the control.
1441
+ */
1442
+ setupCallbacks: function() {
1443
+ var key, fn, callbacks = {
1444
+ 'initialize' : 'onInitialize',
1445
+ 'change' : 'onChange',
1446
+ 'item_add' : 'onItemAdd',
1447
+ 'item_remove' : 'onItemRemove',
1448
+ 'clear' : 'onClear',
1449
+ 'option_add' : 'onOptionAdd',
1450
+ 'option_remove' : 'onOptionRemove',
1451
+ 'option_clear' : 'onOptionClear',
1452
+ 'optgroup_add' : 'onOptionGroupAdd',
1453
+ 'optgroup_remove' : 'onOptionGroupRemove',
1454
+ 'optgroup_clear' : 'onOptionGroupClear',
1455
+ 'dropdown_open' : 'onDropdownOpen',
1456
+ 'dropdown_close' : 'onDropdownClose',
1457
+ 'type' : 'onType',
1458
+ 'load' : 'onLoad',
1459
+ 'focus' : 'onFocus',
1460
+ 'blur' : 'onBlur'
1461
+ };
1462
+
1463
+ for (key in callbacks) {
1464
+ if (callbacks.hasOwnProperty(key)) {
1465
+ fn = this.settings[callbacks[key]];
1466
+ if (fn) this.on(key, fn);
1467
+ }
1468
+ }
1469
+ },
1470
+
1471
+ /**
1472
+ * Triggered when the main control element
1473
+ * has a click event.
1474
+ *
1475
+ * @param {object} e
1476
+ * @return {boolean}
1477
+ */
1478
+ onClick: function(e) {
1479
+ var self = this;
1480
+
1481
+ // necessary for mobile webkit devices (manual focus triggering
1482
+ // is ignored unless invoked within a click event)
1483
+ if (!self.isFocused) {
1484
+ self.focus();
1485
+ e.preventDefault();
1486
+ }
1487
+ },
1488
+
1489
+ /**
1490
+ * Triggered when the main control element
1491
+ * has a mouse down event.
1492
+ *
1493
+ * @param {object} e
1494
+ * @return {boolean}
1495
+ */
1496
+ onMouseDown: function(e) {
1497
+ var self = this;
1498
+ var defaultPrevented = e.isDefaultPrevented();
1499
+ var $target = $(e.target);
1500
+
1501
+ if (self.isFocused) {
1502
+ // retain focus by preventing native handling. if the
1503
+ // event target is the input it should not be modified.
1504
+ // otherwise, text selection within the input won't work.
1505
+ if (e.target !== self.$control_input[0]) {
1506
+ if (self.settings.mode === 'single') {
1507
+ // toggle dropdown
1508
+ self.isOpen ? self.close() : self.open();
1509
+ } else if (!defaultPrevented) {
1510
+ self.setActiveItem(null);
1511
+ }
1512
+ return false;
1513
+ }
1514
+ } else {
1515
+ // give control focus
1516
+ if (!defaultPrevented) {
1517
+ window.setTimeout(function() {
1518
+ self.focus();
1519
+ }, 0);
1520
+ }
1521
+ }
1522
+ },
1523
+
1524
+ /**
1525
+ * Triggered when the value of the control has been changed.
1526
+ * This should propagate the event to the original DOM
1527
+ * input / select element.
1528
+ */
1529
+ onChange: function() {
1530
+ this.$input.trigger('change');
1531
+ },
1532
+
1533
+ /**
1534
+ * Triggered on <input> paste.
1535
+ *
1536
+ * @param {object} e
1537
+ * @returns {boolean}
1538
+ */
1539
+ onPaste: function(e) {
1540
+ var self = this;
1541
+
1542
+ if (self.isFull() || self.isInputHidden || self.isLocked) {
1543
+ e.preventDefault();
1544
+ return;
1545
+ }
1546
+
1547
+ // If a regex or string is included, this will split the pasted
1548
+ // input and create Items for each separate value
1549
+ if (self.settings.splitOn) {
1550
+
1551
+ // Wait for pasted text to be recognized in value
1552
+ setTimeout(function() {
1553
+ var pastedText = self.$control_input.val();
1554
+ if(!pastedText.match(self.settings.splitOn)){ return }
1555
+
1556
+ var splitInput = $.trim(pastedText).split(self.settings.splitOn);
1557
+ for (var i = 0, n = splitInput.length; i < n; i++) {
1558
+ self.createItem(splitInput[i]);
1559
+ }
1560
+ }, 0);
1561
+ }
1562
+ },
1563
+
1564
+ /**
1565
+ * Triggered on <input> keypress.
1566
+ *
1567
+ * @param {object} e
1568
+ * @returns {boolean}
1569
+ */
1570
+ onKeyPress: function(e) {
1571
+ if (this.isLocked) return e && e.preventDefault();
1572
+ var character = String.fromCharCode(e.keyCode || e.which);
1573
+ if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
1574
+ this.createItem();
1575
+ e.preventDefault();
1576
+ return false;
1577
+ }
1578
+ },
1579
+
1580
+ /**
1581
+ * Triggered on <input> keydown.
1582
+ *
1583
+ * @param {object} e
1584
+ * @returns {boolean}
1585
+ */
1586
+ onKeyDown: function(e) {
1587
+ var isInput = e.target === this.$control_input[0];
1588
+ var self = this;
1589
+
1590
+ if (self.isLocked) {
1591
+ if (e.keyCode !== KEY_TAB) {
1592
+ e.preventDefault();
1593
+ }
1594
+ return;
1595
+ }
1596
+
1597
+ switch (e.keyCode) {
1598
+ case KEY_A:
1599
+ if (self.isCmdDown) {
1600
+ self.selectAll();
1601
+ return;
1602
+ }
1603
+ break;
1604
+ case KEY_ESC:
1605
+ if (self.isOpen) {
1606
+ e.preventDefault();
1607
+ e.stopPropagation();
1608
+ self.close();
1609
+ }
1610
+ return;
1611
+ case KEY_N:
1612
+ if (!e.ctrlKey || e.altKey) break;
1613
+ case KEY_DOWN:
1614
+ if (!self.isOpen && self.hasOptions) {
1615
+ self.open();
1616
+ } else if (self.$activeOption) {
1617
+ self.ignoreHover = true;
1618
+ var $next = self.getAdjacentOption(self.$activeOption, 1);
1619
+ if ($next.length) self.setActiveOption($next, true, true);
1620
+ }
1621
+ e.preventDefault();
1622
+ return;
1623
+ case KEY_P:
1624
+ if (!e.ctrlKey || e.altKey) break;
1625
+ case KEY_UP:
1626
+ if (self.$activeOption) {
1627
+ self.ignoreHover = true;
1628
+ var $prev = self.getAdjacentOption(self.$activeOption, -1);
1629
+ if ($prev.length) self.setActiveOption($prev, true, true);
1630
+ }
1631
+ e.preventDefault();
1632
+ return;
1633
+ case KEY_RETURN:
1634
+ if (self.isOpen && self.$activeOption) {
1635
+ self.onOptionSelect({currentTarget: self.$activeOption});
1636
+ e.preventDefault();
1637
+ }
1638
+ return;
1639
+ case KEY_LEFT:
1640
+ self.advanceSelection(-1, e);
1641
+ return;
1642
+ case KEY_RIGHT:
1643
+ self.advanceSelection(1, e);
1644
+ return;
1645
+ case KEY_TAB:
1646
+ if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
1647
+ self.onOptionSelect({currentTarget: self.$activeOption});
1648
+
1649
+ // Default behaviour is to jump to the next field, we only want this
1650
+ // if the current field doesn't accept any more entries
1651
+ if (!self.isFull()) {
1652
+ e.preventDefault();
1653
+ }
1654
+ }
1655
+ if (self.settings.create && self.createItem()) {
1656
+ e.preventDefault();
1657
+ }
1658
+ return;
1659
+ case KEY_BACKSPACE:
1660
+ case KEY_DELETE:
1661
+ self.deleteSelection(e);
1662
+ return;
1663
+ }
1664
+
1665
+ if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
1666
+ e.preventDefault();
1667
+ return;
1668
+ }
1669
+ },
1670
+
1671
+ /**
1672
+ * Triggered on <input> keyup.
1673
+ *
1674
+ * @param {object} e
1675
+ * @returns {boolean}
1676
+ */
1677
+ onKeyUp: function(e) {
1678
+ var self = this;
1679
+
1680
+ if (self.isLocked) return e && e.preventDefault();
1681
+ var value = self.$control_input.val() || '';
1682
+ if (self.lastValue !== value) {
1683
+ self.lastValue = value;
1684
+ self.onSearchChange(value);
1685
+ self.refreshOptions();
1686
+ self.trigger('type', value);
1687
+ }
1688
+ },
1689
+
1690
+ /**
1691
+ * Invokes the user-provide option provider / loader.
1692
+ *
1693
+ * Note: this function is debounced in the Selectize
1694
+ * constructor (by `settings.loadThrottle` milliseconds)
1695
+ *
1696
+ * @param {string} value
1697
+ */
1698
+ onSearchChange: function(value) {
1699
+ var self = this;
1700
+ var fn = self.settings.load;
1701
+ if (!fn) return;
1702
+ if (self.loadedSearches.hasOwnProperty(value)) return;
1703
+ self.loadedSearches[value] = true;
1704
+ self.load(function(callback) {
1705
+ fn.apply(self, [value, callback]);
1706
+ });
1707
+ },
1708
+
1709
+ /**
1710
+ * Triggered on <input> focus.
1711
+ *
1712
+ * @param {object} e (optional)
1713
+ * @returns {boolean}
1714
+ */
1715
+ onFocus: function(e) {
1716
+ var self = this;
1717
+ var wasFocused = self.isFocused;
1718
+
1719
+ if (self.isDisabled) {
1720
+ self.blur();
1721
+ e && e.preventDefault();
1722
+ return false;
1723
+ }
1724
+
1725
+ if (self.ignoreFocus) return;
1726
+ self.isFocused = true;
1727
+ if (self.settings.preload === 'focus') self.onSearchChange('');
1728
+
1729
+ if (!wasFocused) self.trigger('focus');
1730
+
1731
+ if (!self.$activeItems.length) {
1732
+ self.showInput();
1733
+ self.setActiveItem(null);
1734
+ self.refreshOptions(!!self.settings.openOnFocus);
1735
+ }
1736
+
1737
+ self.refreshState();
1738
+ },
1739
+
1740
+ /**
1741
+ * Triggered on <input> blur.
1742
+ *
1743
+ * @param {object} e
1744
+ * @param {Element} dest
1745
+ */
1746
+ onBlur: function(e, dest) {
1747
+ var self = this;
1748
+ if (!self.isFocused) return;
1749
+ self.isFocused = false;
1750
+
1751
+ if (self.ignoreFocus) {
1752
+ return;
1753
+ } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
1754
+ // necessary to prevent IE closing the dropdown when the scrollbar is clicked
1755
+ self.ignoreBlur = true;
1756
+ self.onFocus(e);
1757
+ return;
1758
+ }
1759
+
1760
+ var deactivate = function() {
1761
+ self.close();
1762
+ self.setTextboxValue('');
1763
+ self.setActiveItem(null);
1764
+ self.setActiveOption(null);
1765
+ self.setCaret(self.items.length);
1766
+ self.refreshState();
1767
+
1768
+ // IE11 bug: element still marked as active
1769
+ dest && dest.focus && dest.focus();
1770
+
1771
+ self.ignoreFocus = false;
1772
+ self.trigger('blur');
1773
+ };
1774
+
1775
+ self.ignoreFocus = true;
1776
+ if (self.settings.create && self.settings.createOnBlur) {
1777
+ self.createItem(null, false, deactivate);
1778
+ } else {
1779
+ deactivate();
1780
+ }
1781
+ },
1782
+
1783
+ /**
1784
+ * Triggered when the user rolls over
1785
+ * an option in the autocomplete dropdown menu.
1786
+ *
1787
+ * @param {object} e
1788
+ * @returns {boolean}
1789
+ */
1790
+ onOptionHover: function(e) {
1791
+ if (this.ignoreHover) return;
1792
+ this.setActiveOption(e.currentTarget, false);
1793
+ },
1794
+
1795
+ /**
1796
+ * Triggered when the user clicks on an option
1797
+ * in the autocomplete dropdown menu.
1798
+ *
1799
+ * @param {object} e
1800
+ * @returns {boolean}
1801
+ */
1802
+ onOptionSelect: function(e) {
1803
+ var value, $target, $option, self = this;
1804
+
1805
+ if (e.preventDefault) {
1806
+ e.preventDefault();
1807
+ e.stopPropagation();
1808
+ }
1809
+
1810
+ $target = $(e.currentTarget);
1811
+ if ($target.hasClass('create')) {
1812
+ self.createItem(null, function() {
1813
+ if (self.settings.closeAfterSelect) {
1814
+ self.close();
1815
+ }
1816
+ });
1817
+ } else {
1818
+ value = $target.attr('data-value');
1819
+ if (typeof value !== 'undefined') {
1820
+ self.lastQuery = null;
1821
+ self.setTextboxValue('');
1822
+ self.addItem(value);
1823
+ if (self.settings.closeAfterSelect) {
1824
+ self.close();
1825
+ } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
1826
+ self.setActiveOption(self.getOption(value));
1827
+ }
1828
+ }
1829
+ }
1830
+ },
1831
+
1832
+ /**
1833
+ * Triggered when the user clicks on an item
1834
+ * that has been selected.
1835
+ *
1836
+ * @param {object} e
1837
+ * @returns {boolean}
1838
+ */
1839
+ onItemSelect: function(e) {
1840
+ var self = this;
1841
+
1842
+ if (self.isLocked) return;
1843
+ if (self.settings.mode === 'multi') {
1844
+ e.preventDefault();
1845
+ self.setActiveItem(e.currentTarget, e);
1846
+ }
1847
+ },
1848
+
1849
+ /**
1850
+ * Invokes the provided method that provides
1851
+ * results to a callback---which are then added
1852
+ * as options to the control.
1853
+ *
1854
+ * @param {function} fn
1855
+ */
1856
+ load: function(fn) {
1857
+ var self = this;
1858
+ var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
1859
+
1860
+ self.loading++;
1861
+ fn.apply(self, [function(results) {
1862
+ self.loading = Math.max(self.loading - 1, 0);
1863
+ if (results && results.length) {
1864
+ self.addOption(results);
1865
+ self.refreshOptions(self.isFocused && !self.isInputHidden);
1866
+ }
1867
+ if (!self.loading) {
1868
+ $wrapper.removeClass(self.settings.loadingClass);
1869
+ }
1870
+ self.trigger('load', results);
1871
+ }]);
1872
+ },
1873
+
1874
+ /**
1875
+ * Sets the input field of the control to the specified value.
1876
+ *
1877
+ * @param {string} value
1878
+ */
1879
+ setTextboxValue: function(value) {
1880
+ var $input = this.$control_input;
1881
+ var changed = $input.val() !== value;
1882
+ if (changed) {
1883
+ $input.val(value).triggerHandler('update');
1884
+ this.lastValue = value;
1885
+ }
1886
+ },
1887
+
1888
+ /**
1889
+ * Returns the value of the control. If multiple items
1890
+ * can be selected (e.g. <select multiple>), this returns
1891
+ * an array. If only one item can be selected, this
1892
+ * returns a string.
1893
+ *
1894
+ * @returns {mixed}
1895
+ */
1896
+ getValue: function() {
1897
+ if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
1898
+ return this.items;
1899
+ } else {
1900
+ return this.items.join(this.settings.delimiter);
1901
+ }
1902
+ },
1903
+
1904
+ /**
1905
+ * Resets the selected items to the given value.
1906
+ *
1907
+ * @param {mixed} value
1908
+ */
1909
+ setValue: function(value, silent) {
1910
+ var events = silent ? [] : ['change'];
1911
+
1912
+ debounce_events(this, events, function() {
1913
+ this.clear(silent);
1914
+ this.addItems(value, silent);
1915
+ });
1916
+ },
1917
+
1918
+ /**
1919
+ * Sets the selected item.
1920
+ *
1921
+ * @param {object} $item
1922
+ * @param {object} e (optional)
1923
+ */
1924
+ setActiveItem: function($item, e) {
1925
+ var self = this;
1926
+ var eventName;
1927
+ var i, idx, begin, end, item, swap;
1928
+ var $last;
1929
+
1930
+ if (self.settings.mode === 'single') return;
1931
+ $item = $($item);
1932
+
1933
+ // clear the active selection
1934
+ if (!$item.length) {
1935
+ $(self.$activeItems).removeClass('active');
1936
+ self.$activeItems = [];
1937
+ if (self.isFocused) {
1938
+ self.showInput();
1939
+ }
1940
+ return;
1941
+ }
1942
+
1943
+ // modify selection
1944
+ eventName = e && e.type.toLowerCase();
1945
+
1946
+ if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
1947
+ $last = self.$control.children('.active:last');
1948
+ begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
1949
+ end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
1950
+ if (begin > end) {
1951
+ swap = begin;
1952
+ begin = end;
1953
+ end = swap;
1954
+ }
1955
+ for (i = begin; i <= end; i++) {
1956
+ item = self.$control[0].childNodes[i];
1957
+ if (self.$activeItems.indexOf(item) === -1) {
1958
+ $(item).addClass('active');
1959
+ self.$activeItems.push(item);
1960
+ }
1961
+ }
1962
+ e.preventDefault();
1963
+ } else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {
1964
+ if ($item.hasClass('active')) {
1965
+ idx = self.$activeItems.indexOf($item[0]);
1966
+ self.$activeItems.splice(idx, 1);
1967
+ $item.removeClass('active');
1968
+ } else {
1969
+ self.$activeItems.push($item.addClass('active')[0]);
1970
+ }
1971
+ } else {
1972
+ $(self.$activeItems).removeClass('active');
1973
+ self.$activeItems = [$item.addClass('active')[0]];
1974
+ }
1975
+
1976
+ // ensure control has focus
1977
+ self.hideInput();
1978
+ if (!this.isFocused) {
1979
+ self.focus();
1980
+ }
1981
+ },
1982
+
1983
+ /**
1984
+ * Sets the selected item in the dropdown menu
1985
+ * of available options.
1986
+ *
1987
+ * @param {object} $object
1988
+ * @param {boolean} scroll
1989
+ * @param {boolean} animate
1990
+ */
1991
+ setActiveOption: function($option, scroll, animate) {
1992
+ var height_menu, height_item, y;
1993
+ var scroll_top, scroll_bottom;
1994
+ var self = this;
1995
+
1996
+ if (self.$activeOption) self.$activeOption.removeClass('active');
1997
+ self.$activeOption = null;
1998
+
1999
+ $option = $($option);
2000
+ if (!$option.length) return;
2001
+
2002
+ self.$activeOption = $option.addClass('active');
2003
+
2004
+ if (scroll || !isset(scroll)) {
2005
+
2006
+ height_menu = self.$dropdown_content.height();
2007
+ height_item = self.$activeOption.outerHeight(true);
2008
+ scroll = self.$dropdown_content.scrollTop() || 0;
2009
+ y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
2010
+ scroll_top = y;
2011
+ scroll_bottom = y - height_menu + height_item;
2012
+
2013
+ if (y + height_item > height_menu + scroll) {
2014
+ self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
2015
+ } else if (y < scroll) {
2016
+ self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
2017
+ }
2018
+
2019
+ }
2020
+ },
2021
+
2022
+ /**
2023
+ * Selects all items (CTRL + A).
2024
+ */
2025
+ selectAll: function() {
2026
+ var self = this;
2027
+ if (self.settings.mode === 'single') return;
2028
+
2029
+ self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
2030
+ if (self.$activeItems.length) {
2031
+ self.hideInput();
2032
+ self.close();
2033
+ }
2034
+ self.focus();
2035
+ },
2036
+
2037
+ /**
2038
+ * Hides the input element out of view, while
2039
+ * retaining its focus.
2040
+ */
2041
+ hideInput: function() {
2042
+ var self = this;
2043
+
2044
+ self.setTextboxValue('');
2045
+ self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
2046
+ self.isInputHidden = true;
2047
+ },
2048
+
2049
+ /**
2050
+ * Restores input visibility.
2051
+ */
2052
+ showInput: function() {
2053
+ this.$control_input.css({opacity: 1, position: 'relative', left: 0});
2054
+ this.isInputHidden = false;
2055
+ },
2056
+
2057
+ /**
2058
+ * Gives the control focus.
2059
+ */
2060
+ focus: function() {
2061
+ var self = this;
2062
+ if (self.isDisabled) return;
2063
+
2064
+ self.ignoreFocus = true;
2065
+ self.$control_input[0].focus();
2066
+ window.setTimeout(function() {
2067
+ self.ignoreFocus = false;
2068
+ self.onFocus();
2069
+ }, 0);
2070
+ },
2071
+
2072
+ /**
2073
+ * Forces the control out of focus.
2074
+ *
2075
+ * @param {Element} dest
2076
+ */
2077
+ blur: function(dest) {
2078
+ this.$control_input[0].blur();
2079
+ this.onBlur(null, dest);
2080
+ },
2081
+
2082
+ /**
2083
+ * Returns a function that scores an object
2084
+ * to show how good of a match it is to the
2085
+ * provided query.
2086
+ *
2087
+ * @param {string} query
2088
+ * @param {object} options
2089
+ * @return {function}
2090
+ */
2091
+ getScoreFunction: function(query) {
2092
+ return this.sifter.getScoreFunction(query, this.getSearchOptions());
2093
+ },
2094
+
2095
+ /**
2096
+ * Returns search options for sifter (the system
2097
+ * for scoring and sorting results).
2098
+ *
2099
+ * @see https://github.com/brianreavis/sifter.js
2100
+ * @return {object}
2101
+ */
2102
+ getSearchOptions: function() {
2103
+ var settings = this.settings;
2104
+ var sort = settings.sortField;
2105
+ if (typeof sort === 'string') {
2106
+ sort = [{field: sort}];
2107
+ }
2108
+
2109
+ return {
2110
+ fields : settings.searchField,
2111
+ conjunction : settings.searchConjunction,
2112
+ sort : sort
2113
+ };
2114
+ },
2115
+
2116
+ /**
2117
+ * Searches through available options and returns
2118
+ * a sorted array of matches.
2119
+ *
2120
+ * Returns an object containing:
2121
+ *
2122
+ * - query {string}
2123
+ * - tokens {array}
2124
+ * - total {int}
2125
+ * - items {array}
2126
+ *
2127
+ * @param {string} query
2128
+ * @returns {object}
2129
+ */
2130
+ search: function(query) {
2131
+ var i, value, score, result, calculateScore;
2132
+ var self = this;
2133
+ var settings = self.settings;
2134
+ var options = this.getSearchOptions();
2135
+
2136
+ // validate user-provided result scoring function
2137
+ if (settings.score) {
2138
+ calculateScore = self.settings.score.apply(this, [query]);
2139
+ if (typeof calculateScore !== 'function') {
2140
+ throw new Error('Selectize "score" setting must be a function that returns a function');
2141
+ }
2142
+ }
2143
+
2144
+ // perform search
2145
+ if (query !== self.lastQuery) {
2146
+ self.lastQuery = query;
2147
+ result = self.sifter.search(query, $.extend(options, {score: calculateScore}));
2148
+ self.currentResults = result;
2149
+ } else {
2150
+ result = $.extend(true, {}, self.currentResults);
2151
+ }
2152
+
2153
+ // filter out selected items
2154
+ if (settings.hideSelected) {
2155
+ for (i = result.items.length - 1; i >= 0; i--) {
2156
+ if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
2157
+ result.items.splice(i, 1);
2158
+ }
2159
+ }
2160
+ }
2161
+
2162
+ return result;
2163
+ },
2164
+
2165
+ /**
2166
+ * Refreshes the list of available options shown
2167
+ * in the autocomplete dropdown menu.
2168
+ *
2169
+ * @param {boolean} triggerDropdown
2170
+ */
2171
+ refreshOptions: function(triggerDropdown) {
2172
+ var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
2173
+ var $active, $active_before, $create;
2174
+
2175
+ if (typeof triggerDropdown === 'undefined') {
2176
+ triggerDropdown = true;
2177
+ }
2178
+
2179
+ var self = this;
2180
+ var query = $.trim(self.$control_input.val());
2181
+ var results = self.search(query);
2182
+ var $dropdown_content = self.$dropdown_content;
2183
+ var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
2184
+
2185
+ // build markup
2186
+ n = results.items.length;
2187
+ if (typeof self.settings.maxOptions === 'number') {
2188
+ n = Math.min(n, self.settings.maxOptions);
2189
+ }
2190
+
2191
+ // render and group available options individually
2192
+ groups = {};
2193
+ groups_order = [];
2194
+
2195
+ for (i = 0; i < n; i++) {
2196
+ option = self.options[results.items[i].id];
2197
+ option_html = self.render('option', option);
2198
+ optgroup = option[self.settings.optgroupField] || '';
2199
+ optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
2200
+
2201
+ for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
2202
+ optgroup = optgroups[j];
2203
+ if (!self.optgroups.hasOwnProperty(optgroup)) {
2204
+ optgroup = '';
2205
+ }
2206
+ if (!groups.hasOwnProperty(optgroup)) {
2207
+ groups[optgroup] = document.createDocumentFragment();
2208
+ groups_order.push(optgroup);
2209
+ }
2210
+ groups[optgroup].appendChild(option_html);
2211
+ }
2212
+ }
2213
+
2214
+ // sort optgroups
2215
+ if (this.settings.lockOptgroupOrder) {
2216
+ groups_order.sort(function(a, b) {
2217
+ var a_order = self.optgroups[a].$order || 0;
2218
+ var b_order = self.optgroups[b].$order || 0;
2219
+ return a_order - b_order;
2220
+ });
2221
+ }
2222
+
2223
+ // render optgroup headers & join groups
2224
+ html = document.createDocumentFragment();
2225
+ for (i = 0, n = groups_order.length; i < n; i++) {
2226
+ optgroup = groups_order[i];
2227
+ if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
2228
+ // render the optgroup header and options within it,
2229
+ // then pass it to the wrapper template
2230
+ html_children = document.createDocumentFragment();
2231
+ html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
2232
+ html_children.appendChild(groups[optgroup]);
2233
+
2234
+ html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
2235
+ html: domToString(html_children),
2236
+ dom: html_children
2237
+ })));
2238
+ } else {
2239
+ html.appendChild(groups[optgroup]);
2240
+ }
2241
+ }
2242
+
2243
+ $dropdown_content.html(html);
2244
+
2245
+ // highlight matching terms inline
2246
+ if (self.settings.highlight && results.query.length && results.tokens.length) {
2247
+ $dropdown_content.removeHighlight();
2248
+ for (i = 0, n = results.tokens.length; i < n; i++) {
2249
+ highlight($dropdown_content, results.tokens[i].regex);
2250
+ }
2251
+ }
2252
+
2253
+ // add "selected" class to selected options
2254
+ if (!self.settings.hideSelected) {
2255
+ for (i = 0, n = self.items.length; i < n; i++) {
2256
+ self.getOption(self.items[i]).addClass('selected');
2257
+ }
2258
+ }
2259
+
2260
+ // add create option
2261
+ has_create_option = self.canCreate(query);
2262
+ if (has_create_option) {
2263
+ $dropdown_content.prepend(self.render('option_create', {input: query}));
2264
+ $create = $($dropdown_content[0].childNodes[0]);
2265
+ }
2266
+
2267
+ // activate
2268
+ self.hasOptions = results.items.length > 0 || has_create_option;
2269
+ if (self.hasOptions) {
2270
+ if (results.items.length > 0) {
2271
+ $active_before = active_before && self.getOption(active_before);
2272
+ if ($active_before && $active_before.length) {
2273
+ $active = $active_before;
2274
+ } else if (self.settings.mode === 'single' && self.items.length) {
2275
+ $active = self.getOption(self.items[0]);
2276
+ }
2277
+ if (!$active || !$active.length) {
2278
+ if ($create && !self.settings.addPrecedence) {
2279
+ $active = self.getAdjacentOption($create, 1);
2280
+ } else {
2281
+ $active = $dropdown_content.find('[data-selectable]:first');
2282
+ }
2283
+ }
2284
+ } else {
2285
+ $active = $create;
2286
+ }
2287
+ self.setActiveOption($active);
2288
+ if (triggerDropdown && !self.isOpen) { self.open(); }
2289
+ } else {
2290
+ self.setActiveOption(null);
2291
+ if (triggerDropdown && self.isOpen) { self.close(); }
2292
+ }
2293
+ },
2294
+
2295
+ /**
2296
+ * Adds an available option. If it already exists,
2297
+ * nothing will happen. Note: this does not refresh
2298
+ * the options list dropdown (use `refreshOptions`
2299
+ * for that).
2300
+ *
2301
+ * Usage:
2302
+ *
2303
+ * this.addOption(data)
2304
+ *
2305
+ * @param {object|array} data
2306
+ */
2307
+ addOption: function(data) {
2308
+ var i, n, value, self = this;
2309
+
2310
+ if ($.isArray(data)) {
2311
+ for (i = 0, n = data.length; i < n; i++) {
2312
+ self.addOption(data[i]);
2313
+ }
2314
+ return;
2315
+ }
2316
+
2317
+ if (value = self.registerOption(data)) {
2318
+ self.userOptions[value] = true;
2319
+ self.lastQuery = null;
2320
+ self.trigger('option_add', value, data);
2321
+ }
2322
+ },
2323
+
2324
+ /**
2325
+ * Registers an option to the pool of options.
2326
+ *
2327
+ * @param {object} data
2328
+ * @return {boolean|string}
2329
+ */
2330
+ registerOption: function(data) {
2331
+ var key = hash_key(data[this.settings.valueField]);
2332
+ if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
2333
+ data.$order = data.$order || ++this.order;
2334
+ this.options[key] = data;
2335
+ return key;
2336
+ },
2337
+
2338
+ /**
2339
+ * Registers an option group to the pool of option groups.
2340
+ *
2341
+ * @param {object} data
2342
+ * @return {boolean|string}
2343
+ */
2344
+ registerOptionGroup: function(data) {
2345
+ var key = hash_key(data[this.settings.optgroupValueField]);
2346
+ if (!key) return false;
2347
+
2348
+ data.$order = data.$order || ++this.order;
2349
+ this.optgroups[key] = data;
2350
+ return key;
2351
+ },
2352
+
2353
+ /**
2354
+ * Registers a new optgroup for options
2355
+ * to be bucketed into.
2356
+ *
2357
+ * @param {string} id
2358
+ * @param {object} data
2359
+ */
2360
+ addOptionGroup: function(id, data) {
2361
+ data[this.settings.optgroupValueField] = id;
2362
+ if (id = this.registerOptionGroup(data)) {
2363
+ this.trigger('optgroup_add', id, data);
2364
+ }
2365
+ },
2366
+
2367
+ /**
2368
+ * Removes an existing option group.
2369
+ *
2370
+ * @param {string} id
2371
+ */
2372
+ removeOptionGroup: function(id) {
2373
+ if (this.optgroups.hasOwnProperty(id)) {
2374
+ delete this.optgroups[id];
2375
+ this.renderCache = {};
2376
+ this.trigger('optgroup_remove', id);
2377
+ }
2378
+ },
2379
+
2380
+ /**
2381
+ * Clears all existing option groups.
2382
+ */
2383
+ clearOptionGroups: function() {
2384
+ this.optgroups = {};
2385
+ this.renderCache = {};
2386
+ this.trigger('optgroup_clear');
2387
+ },
2388
+
2389
+ /**
2390
+ * Updates an option available for selection. If
2391
+ * it is visible in the selected items or options
2392
+ * dropdown, it will be re-rendered automatically.
2393
+ *
2394
+ * @param {string} value
2395
+ * @param {object} data
2396
+ */
2397
+ updateOption: function(value, data) {
2398
+ var self = this;
2399
+ var $item, $item_new;
2400
+ var value_new, index_item, cache_items, cache_options, order_old;
2401
+
2402
+ value = hash_key(value);
2403
+ value_new = hash_key(data[self.settings.valueField]);
2404
+
2405
+ // sanity checks
2406
+ if (value === null) return;
2407
+ if (!self.options.hasOwnProperty(value)) return;
2408
+ if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
2409
+
2410
+ order_old = self.options[value].$order;
2411
+
2412
+ // update references
2413
+ if (value_new !== value) {
2414
+ delete self.options[value];
2415
+ index_item = self.items.indexOf(value);
2416
+ if (index_item !== -1) {
2417
+ self.items.splice(index_item, 1, value_new);
2418
+ }
2419
+ }
2420
+ data.$order = data.$order || order_old;
2421
+ self.options[value_new] = data;
2422
+
2423
+ // invalidate render cache
2424
+ cache_items = self.renderCache['item'];
2425
+ cache_options = self.renderCache['option'];
2426
+
2427
+ if (cache_items) {
2428
+ delete cache_items[value];
2429
+ delete cache_items[value_new];
2430
+ }
2431
+ if (cache_options) {
2432
+ delete cache_options[value];
2433
+ delete cache_options[value_new];
2434
+ }
2435
+
2436
+ // update the item if it's selected
2437
+ if (self.items.indexOf(value_new) !== -1) {
2438
+ $item = self.getItem(value);
2439
+ $item_new = $(self.render('item', data));
2440
+ if ($item.hasClass('active')) $item_new.addClass('active');
2441
+ $item.replaceWith($item_new);
2442
+ }
2443
+
2444
+ // invalidate last query because we might have updated the sortField
2445
+ self.lastQuery = null;
2446
+
2447
+ // update dropdown contents
2448
+ if (self.isOpen) {
2449
+ self.refreshOptions(false);
2450
+ }
2451
+ },
2452
+
2453
+ /**
2454
+ * Removes a single option.
2455
+ *
2456
+ * @param {string} value
2457
+ * @param {boolean} silent
2458
+ */
2459
+ removeOption: function(value, silent) {
2460
+ var self = this;
2461
+ value = hash_key(value);
2462
+
2463
+ var cache_items = self.renderCache['item'];
2464
+ var cache_options = self.renderCache['option'];
2465
+ if (cache_items) delete cache_items[value];
2466
+ if (cache_options) delete cache_options[value];
2467
+
2468
+ delete self.userOptions[value];
2469
+ delete self.options[value];
2470
+ self.lastQuery = null;
2471
+ self.trigger('option_remove', value);
2472
+ self.removeItem(value, silent);
2473
+ },
2474
+
2475
+ /**
2476
+ * Clears all options.
2477
+ */
2478
+ clearOptions: function() {
2479
+ var self = this;
2480
+
2481
+ self.loadedSearches = {};
2482
+ self.userOptions = {};
2483
+ self.renderCache = {};
2484
+ self.options = self.sifter.items = {};
2485
+ self.lastQuery = null;
2486
+ self.trigger('option_clear');
2487
+ self.clear();
2488
+ },
2489
+
2490
+ /**
2491
+ * Returns the jQuery element of the option
2492
+ * matching the given value.
2493
+ *
2494
+ * @param {string} value
2495
+ * @returns {object}
2496
+ */
2497
+ getOption: function(value) {
2498
+ return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
2499
+ },
2500
+
2501
+ /**
2502
+ * Returns the jQuery element of the next or
2503
+ * previous selectable option.
2504
+ *
2505
+ * @param {object} $option
2506
+ * @param {int} direction can be 1 for next or -1 for previous
2507
+ * @return {object}
2508
+ */
2509
+ getAdjacentOption: function($option, direction) {
2510
+ var $options = this.$dropdown.find('[data-selectable]');
2511
+ var index = $options.index($option) + direction;
2512
+
2513
+ return index >= 0 && index < $options.length ? $options.eq(index) : $();
2514
+ },
2515
+
2516
+ /**
2517
+ * Finds the first element with a "data-value" attribute
2518
+ * that matches the given value.
2519
+ *
2520
+ * @param {mixed} value
2521
+ * @param {object} $els
2522
+ * @return {object}
2523
+ */
2524
+ getElementWithValue: function(value, $els) {
2525
+ value = hash_key(value);
2526
+
2527
+ if (typeof value !== 'undefined' && value !== null) {
2528
+ for (var i = 0, n = $els.length; i < n; i++) {
2529
+ if ($els[i].getAttribute('data-value') === value) {
2530
+ return $($els[i]);
2531
+ }
2532
+ }
2533
+ }
2534
+
2535
+ return $();
2536
+ },
2537
+
2538
+ /**
2539
+ * Returns the jQuery element of the item
2540
+ * matching the given value.
2541
+ *
2542
+ * @param {string} value
2543
+ * @returns {object}
2544
+ */
2545
+ getItem: function(value) {
2546
+ return this.getElementWithValue(value, this.$control.children());
2547
+ },
2548
+
2549
+ /**
2550
+ * "Selects" multiple items at once. Adds them to the list
2551
+ * at the current caret position.
2552
+ *
2553
+ * @param {string} value
2554
+ * @param {boolean} silent
2555
+ */
2556
+ addItems: function(values, silent) {
2557
+ var items = $.isArray(values) ? values : [values];
2558
+ for (var i = 0, n = items.length; i < n; i++) {
2559
+ this.isPending = (i < n - 1);
2560
+ this.addItem(items[i], silent);
2561
+ }
2562
+ },
2563
+
2564
+ /**
2565
+ * "Selects" an item. Adds it to the list
2566
+ * at the current caret position.
2567
+ *
2568
+ * @param {string} value
2569
+ * @param {boolean} silent
2570
+ */
2571
+ addItem: function(value, silent) {
2572
+ var events = silent ? [] : ['change'];
2573
+
2574
+ debounce_events(this, events, function() {
2575
+ var $item, $option, $options;
2576
+ var self = this;
2577
+ var inputMode = self.settings.mode;
2578
+ var i, active, value_next, wasFull;
2579
+ value = hash_key(value);
2580
+
2581
+ if (self.items.indexOf(value) !== -1) {
2582
+ if (inputMode === 'single') self.close();
2583
+ return;
2584
+ }
2585
+
2586
+ if (!self.options.hasOwnProperty(value)) return;
2587
+ if (inputMode === 'single') self.clear(silent);
2588
+ if (inputMode === 'multi' && self.isFull()) return;
2589
+
2590
+ $item = $(self.render('item', self.options[value]));
2591
+ wasFull = self.isFull();
2592
+ self.items.splice(self.caretPos, 0, value);
2593
+ self.insertAtCaret($item);
2594
+ if (!self.isPending || (!wasFull && self.isFull())) {
2595
+ self.refreshState();
2596
+ }
2597
+
2598
+ if (self.isSetup) {
2599
+ $options = self.$dropdown_content.find('[data-selectable]');
2600
+
2601
+ // update menu / remove the option (if this is not one item being added as part of series)
2602
+ if (!self.isPending) {
2603
+ $option = self.getOption(value);
2604
+ value_next = self.getAdjacentOption($option, 1).attr('data-value');
2605
+ self.refreshOptions(self.isFocused && inputMode !== 'single');
2606
+ if (value_next) {
2607
+ self.setActiveOption(self.getOption(value_next));
2608
+ }
2609
+ }
2610
+
2611
+ // hide the menu if the maximum number of items have been selected or no options are left
2612
+ if (!$options.length || self.isFull()) {
2613
+ self.close();
2614
+ } else {
2615
+ self.positionDropdown();
2616
+ }
2617
+
2618
+ self.updatePlaceholder();
2619
+ self.trigger('item_add', value, $item);
2620
+ self.updateOriginalInput({silent: silent});
2621
+ }
2622
+ });
2623
+ },
2624
+
2625
+ /**
2626
+ * Removes the selected item matching
2627
+ * the provided value.
2628
+ *
2629
+ * @param {string} value
2630
+ */
2631
+ removeItem: function(value, silent) {
2632
+ var self = this;
2633
+ var $item, i, idx;
2634
+
2635
+ $item = (value instanceof $) ? value : self.getItem(value);
2636
+ value = hash_key($item.attr('data-value'));
2637
+ i = self.items.indexOf(value);
2638
+
2639
+ if (i !== -1) {
2640
+ $item.remove();
2641
+ if ($item.hasClass('active')) {
2642
+ idx = self.$activeItems.indexOf($item[0]);
2643
+ self.$activeItems.splice(idx, 1);
2644
+ }
2645
+
2646
+ self.items.splice(i, 1);
2647
+ self.lastQuery = null;
2648
+ if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
2649
+ self.removeOption(value, silent);
2650
+ }
2651
+
2652
+ if (i < self.caretPos) {
2653
+ self.setCaret(self.caretPos - 1);
2654
+ }
2655
+
2656
+ self.refreshState();
2657
+ self.updatePlaceholder();
2658
+ self.updateOriginalInput({silent: silent});
2659
+ self.positionDropdown();
2660
+ self.trigger('item_remove', value, $item);
2661
+ }
2662
+ },
2663
+
2664
+ /**
2665
+ * Invokes the `create` method provided in the
2666
+ * selectize options that should provide the data
2667
+ * for the new item, given the user input.
2668
+ *
2669
+ * Once this completes, it will be added
2670
+ * to the item list.
2671
+ *
2672
+ * @param {string} value
2673
+ * @param {boolean} [triggerDropdown]
2674
+ * @param {function} [callback]
2675
+ * @return {boolean}
2676
+ */
2677
+ createItem: function(input, triggerDropdown) {
2678
+ var self = this;
2679
+ var caret = self.caretPos;
2680
+ input = input || $.trim(self.$control_input.val() || '');
2681
+
2682
+ var callback = arguments[arguments.length - 1];
2683
+ if (typeof callback !== 'function') callback = function() {};
2684
+
2685
+ if (typeof triggerDropdown !== 'boolean') {
2686
+ triggerDropdown = true;
2687
+ }
2688
+
2689
+ if (!self.canCreate(input)) {
2690
+ callback();
2691
+ return false;
2692
+ }
2693
+
2694
+ self.lock();
2695
+
2696
+ var setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {
2697
+ var data = {};
2698
+ data[self.settings.labelField] = input;
2699
+ data[self.settings.valueField] = input;
2700
+ return data;
2701
+ };
2702
+
2703
+ var create = once(function(data) {
2704
+ self.unlock();
2705
+
2706
+ if (!data || typeof data !== 'object') return callback();
2707
+ var value = hash_key(data[self.settings.valueField]);
2708
+ if (typeof value !== 'string') return callback();
2709
+
2710
+ self.setTextboxValue('');
2711
+ self.addOption(data);
2712
+ self.setCaret(caret);
2713
+ self.addItem(value);
2714
+ self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
2715
+ callback(data);
2716
+ });
2717
+
2718
+ var output = setup.apply(this, [input, create]);
2719
+ if (typeof output !== 'undefined') {
2720
+ create(output);
2721
+ }
2722
+
2723
+ return true;
2724
+ },
2725
+
2726
+ /**
2727
+ * Re-renders the selected item lists.
2728
+ */
2729
+ refreshItems: function() {
2730
+ this.lastQuery = null;
2731
+
2732
+ if (this.isSetup) {
2733
+ this.addItem(this.items);
2734
+ }
2735
+
2736
+ this.refreshState();
2737
+ this.updateOriginalInput();
2738
+ },
2739
+
2740
+ /**
2741
+ * Updates all state-dependent attributes
2742
+ * and CSS classes.
2743
+ */
2744
+ refreshState: function() {
2745
+ this.refreshValidityState();
2746
+ this.refreshClasses();
2747
+ },
2748
+
2749
+ /**
2750
+ * Update the `required` attribute of both input and control input.
2751
+ *
2752
+ * The `required` property needs to be activated on the control input
2753
+ * for the error to be displayed at the right place. `required` also
2754
+ * needs to be temporarily deactivated on the input since the input is
2755
+ * hidden and can't show errors.
2756
+ */
2757
+ refreshValidityState: function() {
2758
+ if (!this.isRequired) return false;
2759
+
2760
+ var invalid = !this.items.length;
2761
+
2762
+ this.isInvalid = invalid;
2763
+ this.$control_input.prop('required', invalid);
2764
+ this.$input.prop('required', !invalid);
2765
+ },
2766
+
2767
+ /**
2768
+ * Updates all state-dependent CSS classes.
2769
+ */
2770
+ refreshClasses: function() {
2771
+ var self = this;
2772
+ var isFull = self.isFull();
2773
+ var isLocked = self.isLocked;
2774
+
2775
+ self.$wrapper
2776
+ .toggleClass('rtl', self.rtl);
2777
+
2778
+ self.$control
2779
+ .toggleClass('focus', self.isFocused)
2780
+ .toggleClass('disabled', self.isDisabled)
2781
+ .toggleClass('required', self.isRequired)
2782
+ .toggleClass('invalid', self.isInvalid)
2783
+ .toggleClass('locked', isLocked)
2784
+ .toggleClass('full', isFull).toggleClass('not-full', !isFull)
2785
+ .toggleClass('input-active', self.isFocused && !self.isInputHidden)
2786
+ .toggleClass('dropdown-active', self.isOpen)
2787
+ .toggleClass('has-options', !$.isEmptyObject(self.options))
2788
+ .toggleClass('has-items', self.items.length > 0);
2789
+
2790
+ self.$control_input.data('grow', !isFull && !isLocked);
2791
+ },
2792
+
2793
+ /**
2794
+ * Determines whether or not more items can be added
2795
+ * to the control without exceeding the user-defined maximum.
2796
+ *
2797
+ * @returns {boolean}
2798
+ */
2799
+ isFull: function() {
2800
+ return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
2801
+ },
2802
+
2803
+ /**
2804
+ * Refreshes the original <select> or <input>
2805
+ * element to reflect the current state.
2806
+ */
2807
+ updateOriginalInput: function(opts) {
2808
+ var i, n, options, label, self = this;
2809
+ opts = opts || {};
2810
+
2811
+ if (self.tagType === TAG_SELECT) {
2812
+ options = [];
2813
+ for (i = 0, n = self.items.length; i < n; i++) {
2814
+ label = self.options[self.items[i]][self.settings.labelField] || '';
2815
+ options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
2816
+ }
2817
+ if (!options.length && !this.$input.attr('multiple')) {
2818
+ options.push('<option value="" selected="selected"></option>');
2819
+ }
2820
+ self.$input.html(options.join(''));
2821
+ } else {
2822
+ self.$input.val(self.getValue());
2823
+ self.$input.attr('value',self.$input.val());
2824
+ }
2825
+
2826
+ if (self.isSetup) {
2827
+ if (!opts.silent) {
2828
+ self.trigger('change', self.$input.val());
2829
+ }
2830
+ }
2831
+ },
2832
+
2833
+ /**
2834
+ * Shows/hide the input placeholder depending
2835
+ * on if there items in the list already.
2836
+ */
2837
+ updatePlaceholder: function() {
2838
+ if (!this.settings.placeholder) return;
2839
+ var $input = this.$control_input;
2840
+
2841
+ if (this.items.length) {
2842
+ $input.removeAttr('placeholder');
2843
+ } else {
2844
+ $input.attr('placeholder', this.settings.placeholder);
2845
+ }
2846
+ $input.triggerHandler('update', {force: true});
2847
+ },
2848
+
2849
+ /**
2850
+ * Shows the autocomplete dropdown containing
2851
+ * the available options.
2852
+ */
2853
+ open: function() {
2854
+ var self = this;
2855
+
2856
+ if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
2857
+ self.focus();
2858
+ self.isOpen = true;
2859
+ self.refreshState();
2860
+ self.$dropdown.css({visibility: 'hidden', display: 'block'});
2861
+ self.positionDropdown();
2862
+ self.$dropdown.css({visibility: 'visible'});
2863
+ self.trigger('dropdown_open', self.$dropdown);
2864
+ },
2865
+
2866
+ /**
2867
+ * Closes the autocomplete dropdown menu.
2868
+ */
2869
+ close: function() {
2870
+ var self = this;
2871
+ var trigger = self.isOpen;
2872
+
2873
+ if (self.settings.mode === 'single' && self.items.length) {
2874
+ self.hideInput();
2875
+ self.$control_input.blur(); // close keyboard on iOS
2876
+ }
2877
+
2878
+ self.isOpen = false;
2879
+ self.$dropdown.hide();
2880
+ self.setActiveOption(null);
2881
+ self.refreshState();
2882
+
2883
+ if (trigger) self.trigger('dropdown_close', self.$dropdown);
2884
+ },
2885
+
2886
+ /**
2887
+ * Calculates and applies the appropriate
2888
+ * position of the dropdown.
2889
+ */
2890
+ positionDropdown: function() {
2891
+ var $control = this.$control;
2892
+ var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
2893
+ offset.top += $control.outerHeight(true);
2894
+
2895
+ this.$dropdown.css({
2896
+ width : $control.outerWidth(),
2897
+ top : offset.top,
2898
+ left : offset.left
2899
+ });
2900
+ },
2901
+
2902
+ /**
2903
+ * Resets / clears all selected items
2904
+ * from the control.
2905
+ *
2906
+ * @param {boolean} silent
2907
+ */
2908
+ clear: function(silent) {
2909
+ var self = this;
2910
+
2911
+ if (!self.items.length) return;
2912
+ self.$control.children(':not(input)').remove();
2913
+ self.items = [];
2914
+ self.lastQuery = null;
2915
+ self.setCaret(0);
2916
+ self.setActiveItem(null);
2917
+ self.updatePlaceholder();
2918
+ self.updateOriginalInput({silent: silent});
2919
+ self.refreshState();
2920
+ self.showInput();
2921
+ self.trigger('clear');
2922
+ },
2923
+
2924
+ /**
2925
+ * A helper method for inserting an element
2926
+ * at the current caret position.
2927
+ *
2928
+ * @param {object} $el
2929
+ */
2930
+ insertAtCaret: function($el) {
2931
+ var caret = Math.min(this.caretPos, this.items.length);
2932
+ if (caret === 0) {
2933
+ this.$control.prepend($el);
2934
+ } else {
2935
+ $(this.$control[0].childNodes[caret]).before($el);
2936
+ }
2937
+ this.setCaret(caret + 1);
2938
+ },
2939
+
2940
+ /**
2941
+ * Removes the current selected item(s).
2942
+ *
2943
+ * @param {object} e (optional)
2944
+ * @returns {boolean}
2945
+ */
2946
+ deleteSelection: function(e) {
2947
+ var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
2948
+ var self = this;
2949
+
2950
+ direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
2951
+ selection = getSelection(self.$control_input[0]);
2952
+
2953
+ if (self.$activeOption && !self.settings.hideSelected) {
2954
+ option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
2955
+ }
2956
+
2957
+ // determine items that will be removed
2958
+ values = [];
2959
+
2960
+ if (self.$activeItems.length) {
2961
+ $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
2962
+ caret = self.$control.children(':not(input)').index($tail);
2963
+ if (direction > 0) { caret++; }
2964
+
2965
+ for (i = 0, n = self.$activeItems.length; i < n; i++) {
2966
+ values.push($(self.$activeItems[i]).attr('data-value'));
2967
+ }
2968
+ if (e) {
2969
+ e.preventDefault();
2970
+ e.stopPropagation();
2971
+ }
2972
+ } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
2973
+ if (direction < 0 && selection.start === 0 && selection.length === 0) {
2974
+ values.push(self.items[self.caretPos - 1]);
2975
+ } else if (direction > 0 && selection.start === self.$control_input.val().length) {
2976
+ values.push(self.items[self.caretPos]);
2977
+ }
2978
+ }
2979
+
2980
+ // allow the callback to abort
2981
+ if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) {
2982
+ return false;
2983
+ }
2984
+
2985
+ // perform removal
2986
+ if (typeof caret !== 'undefined') {
2987
+ self.setCaret(caret);
2988
+ }
2989
+ while (values.length) {
2990
+ self.removeItem(values.pop());
2991
+ }
2992
+
2993
+ self.showInput();
2994
+ self.positionDropdown();
2995
+ self.refreshOptions(true);
2996
+
2997
+ // select previous option
2998
+ if (option_select) {
2999
+ $option_select = self.getOption(option_select);
3000
+ if ($option_select.length) {
3001
+ self.setActiveOption($option_select);
3002
+ }
3003
+ }
3004
+
3005
+ return true;
3006
+ },
3007
+
3008
+ /**
3009
+ * Selects the previous / next item (depending
3010
+ * on the `direction` argument).
3011
+ *
3012
+ * > 0 - right
3013
+ * < 0 - left
3014
+ *
3015
+ * @param {int} direction
3016
+ * @param {object} e (optional)
3017
+ */
3018
+ advanceSelection: function(direction, e) {
3019
+ var tail, selection, idx, valueLength, cursorAtEdge, $tail;
3020
+ var self = this;
3021
+
3022
+ if (direction === 0) return;
3023
+ if (self.rtl) direction *= -1;
3024
+
3025
+ tail = direction > 0 ? 'last' : 'first';
3026
+ selection = getSelection(self.$control_input[0]);
3027
+
3028
+ if (self.isFocused && !self.isInputHidden) {
3029
+ valueLength = self.$control_input.val().length;
3030
+ cursorAtEdge = direction < 0
3031
+ ? selection.start === 0 && selection.length === 0
3032
+ : selection.start === valueLength;
3033
+
3034
+ if (cursorAtEdge && !valueLength) {
3035
+ self.advanceCaret(direction, e);
3036
+ }
3037
+ } else {
3038
+ $tail = self.$control.children('.active:' + tail);
3039
+ if ($tail.length) {
3040
+ idx = self.$control.children(':not(input)').index($tail);
3041
+ self.setActiveItem(null);
3042
+ self.setCaret(direction > 0 ? idx + 1 : idx);
3043
+ }
3044
+ }
3045
+ },
3046
+
3047
+ /**
3048
+ * Moves the caret left / right.
3049
+ *
3050
+ * @param {int} direction
3051
+ * @param {object} e (optional)
3052
+ */
3053
+ advanceCaret: function(direction, e) {
3054
+ var self = this, fn, $adj;
3055
+
3056
+ if (direction === 0) return;
3057
+
3058
+ fn = direction > 0 ? 'next' : 'prev';
3059
+ if (self.isShiftDown) {
3060
+ $adj = self.$control_input[fn]();
3061
+ if ($adj.length) {
3062
+ self.hideInput();
3063
+ self.setActiveItem($adj);
3064
+ e && e.preventDefault();
3065
+ }
3066
+ } else {
3067
+ self.setCaret(self.caretPos + direction);
3068
+ }
3069
+ },
3070
+
3071
+ /**
3072
+ * Moves the caret to the specified index.
3073
+ *
3074
+ * @param {int} i
3075
+ */
3076
+ setCaret: function(i) {
3077
+ var self = this;
3078
+
3079
+ if (self.settings.mode === 'single') {
3080
+ i = self.items.length;
3081
+ } else {
3082
+ i = Math.max(0, Math.min(self.items.length, i));
3083
+ }
3084
+
3085
+ if(!self.isPending) {
3086
+ // the input must be moved by leaving it in place and moving the
3087
+ // siblings, due to the fact that focus cannot be restored once lost
3088
+ // on mobile webkit devices
3089
+ var j, n, fn, $children, $child;
3090
+ $children = self.$control.children(':not(input)');
3091
+ for (j = 0, n = $children.length; j < n; j++) {
3092
+ $child = $($children[j]).detach();
3093
+ if (j < i) {
3094
+ self.$control_input.before($child);
3095
+ } else {
3096
+ self.$control.append($child);
3097
+ }
3098
+ }
3099
+ }
3100
+
3101
+ self.caretPos = i;
3102
+ },
3103
+
3104
+ /**
3105
+ * Disables user input on the control. Used while
3106
+ * items are being asynchronously created.
3107
+ */
3108
+ lock: function() {
3109
+ this.close();
3110
+ this.isLocked = true;
3111
+ this.refreshState();
3112
+ },
3113
+
3114
+ /**
3115
+ * Re-enables user input on the control.
3116
+ */
3117
+ unlock: function() {
3118
+ this.isLocked = false;
3119
+ this.refreshState();
3120
+ },
3121
+
3122
+ /**
3123
+ * Disables user input on the control completely.
3124
+ * While disabled, it cannot receive focus.
3125
+ */
3126
+ disable: function() {
3127
+ var self = this;
3128
+ self.$input.prop('disabled', true);
3129
+ self.$control_input.prop('disabled', true).prop('tabindex', -1);
3130
+ self.isDisabled = true;
3131
+ self.lock();
3132
+ },
3133
+
3134
+ /**
3135
+ * Enables the control so that it can respond
3136
+ * to focus and user input.
3137
+ */
3138
+ enable: function() {
3139
+ var self = this;
3140
+ self.$input.prop('disabled', false);
3141
+ self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
3142
+ self.isDisabled = false;
3143
+ self.unlock();
3144
+ },
3145
+
3146
+ /**
3147
+ * Completely destroys the control and
3148
+ * unbinds all event listeners so that it can
3149
+ * be garbage collected.
3150
+ */
3151
+ destroy: function() {
3152
+ var self = this;
3153
+ var eventNS = self.eventNS;
3154
+ var revertSettings = self.revertSettings;
3155
+
3156
+ self.trigger('destroy');
3157
+ self.off();
3158
+ self.$wrapper.remove();
3159
+ self.$dropdown.remove();
3160
+
3161
+ self.$input
3162
+ .html('')
3163
+ .append(revertSettings.$children)
3164
+ .removeAttr('tabindex')
3165
+ .removeClass('selectized')
3166
+ .attr({tabindex: revertSettings.tabindex})
3167
+ .show();
3168
+
3169
+ self.$control_input.removeData('grow');
3170
+ self.$input.removeData('selectize');
3171
+
3172
+ $(window).off(eventNS);
3173
+ $(document).off(eventNS);
3174
+ $(document.body).off(eventNS);
3175
+
3176
+ delete self.$input[0].selectize;
3177
+ },
3178
+
3179
+ /**
3180
+ * A helper method for rendering "item" and
3181
+ * "option" templates, given the data.
3182
+ *
3183
+ * @param {string} templateName
3184
+ * @param {object} data
3185
+ * @returns {string}
3186
+ */
3187
+ render: function(templateName, data) {
3188
+ var value, id, label;
3189
+ var html = '';
3190
+ var cache = false;
3191
+ var self = this;
3192
+ var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
3193
+
3194
+ if (templateName === 'option' || templateName === 'item') {
3195
+ value = hash_key(data[self.settings.valueField]);
3196
+ cache = !!value;
3197
+ }
3198
+
3199
+ // pull markup from cache if it exists
3200
+ if (cache) {
3201
+ if (!isset(self.renderCache[templateName])) {
3202
+ self.renderCache[templateName] = {};
3203
+ }
3204
+ if (self.renderCache[templateName].hasOwnProperty(value)) {
3205
+ return self.renderCache[templateName][value];
3206
+ }
3207
+ }
3208
+
3209
+ // render markup
3210
+ html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
3211
+
3212
+ // add mandatory attributes
3213
+ if (templateName === 'option' || templateName === 'option_create') {
3214
+ html.attr('data-selectable', '');
3215
+ }
3216
+ else if (templateName === 'optgroup') {
3217
+ id = data[self.settings.optgroupValueField] || '';
3218
+ html.attr('data-group', id);
3219
+ }
3220
+ if (templateName === 'option' || templateName === 'item') {
3221
+ html.attr('data-value', value || '');
3222
+ }
3223
+
3224
+ // update cache
3225
+ if (cache) {
3226
+ self.renderCache[templateName][value] = html[0];
3227
+ }
3228
+
3229
+ return html[0];
3230
+ },
3231
+
3232
+ /**
3233
+ * Clears the render cache for a template. If
3234
+ * no template is given, clears all render
3235
+ * caches.
3236
+ *
3237
+ * @param {string} templateName
3238
+ */
3239
+ clearCache: function(templateName) {
3240
+ var self = this;
3241
+ if (typeof templateName === 'undefined') {
3242
+ self.renderCache = {};
3243
+ } else {
3244
+ delete self.renderCache[templateName];
3245
+ }
3246
+ },
3247
+
3248
+ /**
3249
+ * Determines whether or not to display the
3250
+ * create item prompt, given a user input.
3251
+ *
3252
+ * @param {string} input
3253
+ * @return {boolean}
3254
+ */
3255
+ canCreate: function(input) {
3256
+ var self = this;
3257
+ if (!self.settings.create) return false;
3258
+ var filter = self.settings.createFilter;
3259
+ return input.length
3260
+ && (typeof filter !== 'function' || filter.apply(self, [input]))
3261
+ && (typeof filter !== 'string' || new RegExp(filter).test(input))
3262
+ && (!(filter instanceof RegExp) || filter.test(input));
3263
+ }
3264
+
3265
+ });
3266
+
3267
+
3268
+ Selectize.count = 0;
3269
+ Selectize.defaults = {
3270
+ options: [],
3271
+ optgroups: [],
3272
+
3273
+ plugins: [],
3274
+ delimiter: ',',
3275
+ splitOn: null, // regexp or string for splitting up values from a paste command
3276
+ persist: true,
3277
+ diacritics: true,
3278
+ create: false,
3279
+ createOnBlur: false,
3280
+ createFilter: null,
3281
+ highlight: true,
3282
+ openOnFocus: true,
3283
+ maxOptions: 1000,
3284
+ maxItems: null,
3285
+ hideSelected: null,
3286
+ addPrecedence: false,
3287
+ selectOnTab: false,
3288
+ preload: false,
3289
+ allowEmptyOption: false,
3290
+ closeAfterSelect: false,
3291
+
3292
+ scrollDuration: 60,
3293
+ loadThrottle: 300,
3294
+ loadingClass: 'loading',
3295
+
3296
+ dataAttr: 'data-data',
3297
+ optgroupField: 'optgroup',
3298
+ valueField: 'value',
3299
+ labelField: 'text',
3300
+ optgroupLabelField: 'label',
3301
+ optgroupValueField: 'value',
3302
+ lockOptgroupOrder: false,
3303
+
3304
+ sortField: '$order',
3305
+ searchField: ['text'],
3306
+ searchConjunction: 'and',
3307
+
3308
+ mode: null,
3309
+ wrapperClass: 'selectize-control',
3310
+ inputClass: 'selectize-input',
3311
+ dropdownClass: 'selectize-dropdown',
3312
+ dropdownContentClass: 'selectize-dropdown-content',
3313
+
3314
+ dropdownParent: null,
3315
+
3316
+ copyClassesToDropdown: true,
3317
+
3318
+ /*
3319
+ load : null, // function(query, callback) { ... }
3320
+ score : null, // function(search) { ... }
3321
+ onInitialize : null, // function() { ... }
3322
+ onChange : null, // function(value) { ... }
3323
+ onItemAdd : null, // function(value, $item) { ... }
3324
+ onItemRemove : null, // function(value) { ... }
3325
+ onClear : null, // function() { ... }
3326
+ onOptionAdd : null, // function(value, data) { ... }
3327
+ onOptionRemove : null, // function(value) { ... }
3328
+ onOptionClear : null, // function() { ... }
3329
+ onOptionGroupAdd : null, // function(id, data) { ... }
3330
+ onOptionGroupRemove : null, // function(id) { ... }
3331
+ onOptionGroupClear : null, // function() { ... }
3332
+ onDropdownOpen : null, // function($dropdown) { ... }
3333
+ onDropdownClose : null, // function($dropdown) { ... }
3334
+ onType : null, // function(str) { ... }
3335
+ onDelete : null, // function(values) { ... }
3336
+ */
3337
+
3338
+ render: {
3339
+ /*
3340
+ item: null,
3341
+ optgroup: null,
3342
+ optgroup_header: null,
3343
+ option: null,
3344
+ option_create: null
3345
+ */
3346
+ }
3347
+ };
3348
+
3349
+
3350
+ $.fn.selectize = function(settings_user) {
3351
+ var defaults = $.fn.selectize.defaults;
3352
+ var settings = $.extend({}, defaults, settings_user);
3353
+ var attr_data = settings.dataAttr;
3354
+ var field_label = settings.labelField;
3355
+ var field_value = settings.valueField;
3356
+ var field_optgroup = settings.optgroupField;
3357
+ var field_optgroup_label = settings.optgroupLabelField;
3358
+ var field_optgroup_value = settings.optgroupValueField;
3359
+
3360
+ /**
3361
+ * Initializes selectize from a <input type="text"> element.
3362
+ *
3363
+ * @param {object} $input
3364
+ * @param {object} settings_element
3365
+ */
3366
+ var init_textbox = function($input, settings_element) {
3367
+ var i, n, values, option;
3368
+
3369
+ var data_raw = $input.attr(attr_data);
3370
+
3371
+ if (!data_raw) {
3372
+ var value = $.trim($input.val() || '');
3373
+ if (!settings.allowEmptyOption && !value.length) return;
3374
+ values = value.split(settings.delimiter);
3375
+ for (i = 0, n = values.length; i < n; i++) {
3376
+ option = {};
3377
+ option[field_label] = values[i];
3378
+ option[field_value] = values[i];
3379
+ settings_element.options.push(option);
3380
+ }
3381
+ settings_element.items = values;
3382
+ } else {
3383
+ settings_element.options = JSON.parse(data_raw);
3384
+ for (i = 0, n = settings_element.options.length; i < n; i++) {
3385
+ settings_element.items.push(settings_element.options[i][field_value]);
3386
+ }
3387
+ }
3388
+ };
3389
+
3390
+ /**
3391
+ * Initializes selectize from a <select> element.
3392
+ *
3393
+ * @param {object} $input
3394
+ * @param {object} settings_element
3395
+ */
3396
+ var init_select = function($input, settings_element) {
3397
+ var i, n, tagName, $children, order = 0;
3398
+ var options = settings_element.options;
3399
+ var optionsMap = {};
3400
+
3401
+ var readData = function($el) {
3402
+ var data = attr_data && $el.attr(attr_data);
3403
+ if (typeof data === 'string' && data.length) {
3404
+ return JSON.parse(data);
3405
+ }
3406
+ return null;
3407
+ };
3408
+
3409
+ var addOption = function($option, group) {
3410
+ $option = $($option);
3411
+
3412
+ var value = hash_key($option.val());
3413
+ if (!value && !settings.allowEmptyOption) return;
3414
+
3415
+ // if the option already exists, it's probably been
3416
+ // duplicated in another optgroup. in this case, push
3417
+ // the current group to the "optgroup" property on the
3418
+ // existing option so that it's rendered in both places.
3419
+ if (optionsMap.hasOwnProperty(value)) {
3420
+ if (group) {
3421
+ var arr = optionsMap[value][field_optgroup];
3422
+ if (!arr) {
3423
+ optionsMap[value][field_optgroup] = group;
3424
+ } else if (!$.isArray(arr)) {
3425
+ optionsMap[value][field_optgroup] = [arr, group];
3426
+ } else {
3427
+ arr.push(group);
3428
+ }
3429
+ }
3430
+ return;
3431
+ }
3432
+
3433
+ var option = readData($option) || {};
3434
+ option[field_label] = option[field_label] || $option.text();
3435
+ option[field_value] = option[field_value] || value;
3436
+ option[field_optgroup] = option[field_optgroup] || group;
3437
+
3438
+ optionsMap[value] = option;
3439
+ options.push(option);
3440
+
3441
+ if ($option.is(':selected')) {
3442
+ settings_element.items.push(value);
3443
+ }
3444
+ };
3445
+
3446
+ var addGroup = function($optgroup) {
3447
+ var i, n, id, optgroup, $options;
3448
+
3449
+ $optgroup = $($optgroup);
3450
+ id = $optgroup.attr('label');
3451
+
3452
+ if (id) {
3453
+ optgroup = readData($optgroup) || {};
3454
+ optgroup[field_optgroup_label] = id;
3455
+ optgroup[field_optgroup_value] = id;
3456
+ settings_element.optgroups.push(optgroup);
3457
+ }
3458
+
3459
+ $options = $('option', $optgroup);
3460
+ for (i = 0, n = $options.length; i < n; i++) {
3461
+ addOption($options[i], id);
3462
+ }
3463
+ };
3464
+
3465
+ settings_element.maxItems = $input.attr('multiple') ? null : 1;
3466
+
3467
+ $children = $input.children();
3468
+ for (i = 0, n = $children.length; i < n; i++) {
3469
+ tagName = $children[i].tagName.toLowerCase();
3470
+ if (tagName === 'optgroup') {
3471
+ addGroup($children[i]);
3472
+ } else if (tagName === 'option') {
3473
+ addOption($children[i]);
3474
+ }
3475
+ }
3476
+ };
3477
+
3478
+ return this.each(function() {
3479
+ if (this.selectize) return;
3480
+
3481
+ var instance;
3482
+ var $input = $(this);
3483
+ var tag_name = this.tagName.toLowerCase();
3484
+ var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
3485
+ if (!placeholder && !settings.allowEmptyOption) {
3486
+ placeholder = $input.children('option[value=""]').text();
3487
+ }
3488
+
3489
+ var settings_element = {
3490
+ 'placeholder' : placeholder,
3491
+ 'options' : [],
3492
+ 'optgroups' : [],
3493
+ 'items' : []
3494
+ };
3495
+
3496
+ if (tag_name === 'select') {
3497
+ init_select($input, settings_element);
3498
+ } else {
3499
+ init_textbox($input, settings_element);
3500
+ }
3501
+
3502
+ instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
3503
+ });
3504
+ };
3505
+
3506
+ $.fn.selectize.defaults = Selectize.defaults;
3507
+ $.fn.selectize.support = {
3508
+ validity: SUPPORTS_VALIDITY_API
3509
+ };
3510
+
3511
+
3512
+ Selectize.define('drag_drop', function(options) {
3513
+ if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
3514
+ if (this.settings.mode !== 'multi') return;
3515
+ var self = this;
3516
+
3517
+ self.lock = (function() {
3518
+ var original = self.lock;
3519
+ return function() {
3520
+ var sortable = self.$control.data('sortable');
3521
+ if (sortable) sortable.disable();
3522
+ return original.apply(self, arguments);
3523
+ };
3524
+ })();
3525
+
3526
+ self.unlock = (function() {
3527
+ var original = self.unlock;
3528
+ return function() {
3529
+ var sortable = self.$control.data('sortable');
3530
+ if (sortable) sortable.enable();
3531
+ return original.apply(self, arguments);
3532
+ };
3533
+ })();
3534
+
3535
+ self.setup = (function() {
3536
+ var original = self.setup;
3537
+ return function() {
3538
+ original.apply(this, arguments);
3539
+
3540
+ var $control = self.$control.sortable({
3541
+ items: '[data-value]',
3542
+ forcePlaceholderSize: true,
3543
+ disabled: self.isLocked,
3544
+ start: function(e, ui) {
3545
+ ui.placeholder.css('width', ui.helper.css('width'));
3546
+ $control.css({overflow: 'visible'});
3547
+ },
3548
+ stop: function() {
3549
+ $control.css({overflow: 'hidden'});
3550
+ var active = self.$activeItems ? self.$activeItems.slice() : null;
3551
+ var values = [];
3552
+ $control.children('[data-value]').each(function() {
3553
+ values.push($(this).attr('data-value'));
3554
+ });
3555
+ self.setValue(values);
3556
+ self.setActiveItem(active);
3557
+ }
3558
+ });
3559
+ };
3560
+ })();
3561
+
3562
+ });
3563
+
3564
+ Selectize.define('dropdown_header', function(options) {
3565
+ var self = this;
3566
+
3567
+ options = $.extend({
3568
+ title : 'Untitled',
3569
+ headerClass : 'selectize-dropdown-header',
3570
+ titleRowClass : 'selectize-dropdown-header-title',
3571
+ labelClass : 'selectize-dropdown-header-label',
3572
+ closeClass : 'selectize-dropdown-header-close',
3573
+
3574
+ html: function(data) {
3575
+ return (
3576
+ '<div class="' + data.headerClass + '">' +
3577
+ '<div class="' + data.titleRowClass + '">' +
3578
+ '<span class="' + data.labelClass + '">' + data.title + '</span>' +
3579
+ '<a href="javascript:void(0)" class="' + data.closeClass + '">&times;</a>' +
3580
+ '</div>' +
3581
+ '</div>'
3582
+ );
3583
+ }
3584
+ }, options);
3585
+
3586
+ self.setup = (function() {
3587
+ var original = self.setup;
3588
+ return function() {
3589
+ original.apply(self, arguments);
3590
+ self.$dropdown_header = $(options.html(options));
3591
+ self.$dropdown.prepend(self.$dropdown_header);
3592
+ };
3593
+ })();
3594
+
3595
+ });
3596
+
3597
+ Selectize.define('optgroup_columns', function(options) {
3598
+ var self = this;
3599
+
3600
+ options = $.extend({
3601
+ equalizeWidth : true,
3602
+ equalizeHeight : true
3603
+ }, options);
3604
+
3605
+ this.getAdjacentOption = function($option, direction) {
3606
+ var $options = $option.closest('[data-group]').find('[data-selectable]');
3607
+ var index = $options.index($option) + direction;
3608
+
3609
+ return index >= 0 && index < $options.length ? $options.eq(index) : $();
3610
+ };
3611
+
3612
+ this.onKeyDown = (function() {
3613
+ var original = self.onKeyDown;
3614
+ return function(e) {
3615
+ var index, $option, $options, $optgroup;
3616
+
3617
+ if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
3618
+ self.ignoreHover = true;
3619
+ $optgroup = this.$activeOption.closest('[data-group]');
3620
+ index = $optgroup.find('[data-selectable]').index(this.$activeOption);
3621
+
3622
+ if(e.keyCode === KEY_LEFT) {
3623
+ $optgroup = $optgroup.prev('[data-group]');
3624
+ } else {
3625
+ $optgroup = $optgroup.next('[data-group]');
3626
+ }
3627
+
3628
+ $options = $optgroup.find('[data-selectable]');
3629
+ $option = $options.eq(Math.min($options.length - 1, index));
3630
+ if ($option.length) {
3631
+ this.setActiveOption($option);
3632
+ }
3633
+ return;
3634
+ }
3635
+
3636
+ return original.apply(this, arguments);
3637
+ };
3638
+ })();
3639
+
3640
+ var getScrollbarWidth = function() {
3641
+ var div;
3642
+ var width = getScrollbarWidth.width;
3643
+ var doc = document;
3644
+
3645
+ if (typeof width === 'undefined') {
3646
+ div = doc.createElement('div');
3647
+ div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
3648
+ div = div.firstChild;
3649
+ doc.body.appendChild(div);
3650
+ width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
3651
+ doc.body.removeChild(div);
3652
+ }
3653
+ return width;
3654
+ };
3655
+
3656
+ var equalizeSizes = function() {
3657
+ var i, n, height_max, width, width_last, width_parent, $optgroups;
3658
+
3659
+ $optgroups = $('[data-group]', self.$dropdown_content);
3660
+ n = $optgroups.length;
3661
+ if (!n || !self.$dropdown_content.width()) return;
3662
+
3663
+ if (options.equalizeHeight) {
3664
+ height_max = 0;
3665
+ for (i = 0; i < n; i++) {
3666
+ height_max = Math.max(height_max, $optgroups.eq(i).height());
3667
+ }
3668
+ $optgroups.css({height: height_max});
3669
+ }
3670
+
3671
+ if (options.equalizeWidth) {
3672
+ width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
3673
+ width = Math.round(width_parent / n);
3674
+ $optgroups.css({width: width});
3675
+ if (n > 1) {
3676
+ width_last = width_parent - width * (n - 1);
3677
+ $optgroups.eq(n - 1).css({width: width_last});
3678
+ }
3679
+ }
3680
+ };
3681
+
3682
+ if (options.equalizeHeight || options.equalizeWidth) {
3683
+ hook.after(this, 'positionDropdown', equalizeSizes);
3684
+ hook.after(this, 'refreshOptions', equalizeSizes);
3685
+ }
3686
+
3687
+
3688
+ });
3689
+
3690
+ Selectize.define('remove_button', function(options) {
3691
+ options = $.extend({
3692
+ label : '&times;',
3693
+ title : 'Remove',
3694
+ className : 'remove',
3695
+ append : true
3696
+ }, options);
3697
+
3698
+ var singleClose = function(thisRef, options) {
3699
+
3700
+ options.className = 'remove-single';
3701
+
3702
+ var self = thisRef;
3703
+ var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
3704
+
3705
+ /**
3706
+ * Appends an element as a child (with raw HTML).
3707
+ *
3708
+ * @param {string} html_container
3709
+ * @param {string} html_element
3710
+ * @return {string}
3711
+ */
3712
+ var append = function(html_container, html_element) {
3713
+ return html_container + html_element;
3714
+ };
3715
+
3716
+ thisRef.setup = (function() {
3717
+ var original = self.setup;
3718
+ return function() {
3719
+ // override the item rendering method to add the button to each
3720
+ if (options.append) {
3721
+ var id = $(self.$input.context).attr('id');
3722
+ var selectizer = $('#'+id);
3723
+
3724
+ var render_item = self.settings.render.item;
3725
+ self.settings.render.item = function(data) {
3726
+ return append(render_item.apply(thisRef, arguments), html);
3727
+ };
3728
+ }
3729
+
3730
+ original.apply(thisRef, arguments);
3731
+
3732
+ // add event listener
3733
+ thisRef.$control.on('click', '.' + options.className, function(e) {
3734
+ e.preventDefault();
3735
+ if (self.isLocked) return;
3736
+
3737
+ self.clear();
3738
+ });
3739
+
3740
+ };
3741
+ })();
3742
+ };
3743
+
3744
+ var multiClose = function(thisRef, options) {
3745
+
3746
+ var self = thisRef;
3747
+ var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
3748
+
3749
+ /**
3750
+ * Appends an element as a child (with raw HTML).
3751
+ *
3752
+ * @param {string} html_container
3753
+ * @param {string} html_element
3754
+ * @return {string}
3755
+ */
3756
+ var append = function(html_container, html_element) {
3757
+ var pos = html_container.search(/(<\/[^>]+>\s*)$/);
3758
+ return html_container.substring(0, pos) + html_element + html_container.substring(pos);
3759
+ };
3760
+
3761
+ thisRef.setup = (function() {
3762
+ var original = self.setup;
3763
+ return function() {
3764
+ // override the item rendering method to add the button to each
3765
+ if (options.append) {
3766
+ var render_item = self.settings.render.item;
3767
+ self.settings.render.item = function(data) {
3768
+ return append(render_item.apply(thisRef, arguments), html);
3769
+ };
3770
+ }
3771
+
3772
+ original.apply(thisRef, arguments);
3773
+
3774
+ // add event listener
3775
+ thisRef.$control.on('click', '.' + options.className, function(e) {
3776
+ e.preventDefault();
3777
+ if (self.isLocked) return;
3778
+
3779
+ var $item = $(e.currentTarget).parent();
3780
+ self.setActiveItem($item);
3781
+ if (self.deleteSelection()) {
3782
+ self.setCaret(self.items.length);
3783
+ }
3784
+ });
3785
+
3786
+ };
3787
+ })();
3788
+ };
3789
+
3790
+ if (this.settings.mode === 'single') {
3791
+ singleClose(this, options);
3792
+ return;
3793
+ } else {
3794
+ multiClose(this, options);
3795
+ }
3796
+ });
3797
+
3798
+
3799
+ Selectize.define('restore_on_backspace', function(options) {
3800
+ var self = this;
3801
+
3802
+ options.text = options.text || function(option) {
3803
+ return option[this.settings.labelField];
3804
+ };
3805
+
3806
+ this.onKeyDown = (function() {
3807
+ var original = self.onKeyDown;
3808
+ return function(e) {
3809
+ var index, option;
3810
+ if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
3811
+ index = this.caretPos - 1;
3812
+ if (index >= 0 && index < this.items.length) {
3813
+ option = this.options[this.items[index]];
3814
+ if (this.deleteSelection(e)) {
3815
+ this.setTextboxValue(options.text.apply(this, [option]));
3816
+ this.refreshOptions(true);
3817
+ }
3818
+ e.preventDefault();
3819
+ return;
3820
+ }
3821
+ }
3822
+ return original.apply(this, arguments);
3823
+ };
3824
+ })();
3825
+ });
3826
+
3827
+
3828
+ return Selectize;
3829
+ }));
includes/metabox/butterbean/js/selectize.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! selectize.js - v0.12.4 | https://github.com/selectize/selectize.js | Apache License (v2) */
2
+ !function(a,b){"function"==typeof define&&define.amd?define("sifter",b):"object"==typeof exports?module.exports=b():a.Sifter=b()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=e(String(a||"").toLowerCase()),!a||!a.length)return[];var b,c,d,g,i=[],j=a.split(/ +/);for(b=0,c=j.length;b<c;b++){if(d=f(j[b]),this.settings.diacritics)for(g in h)h.hasOwnProperty(g)&&(d=d.replace(new RegExp(g,"g"),h[g]));i.push({string:j[b],regex:new RegExp(d,"i")})}return i},a.prototype.iterator=function(a,b){var c;c=g(a)?Array.prototype.forEach||function(a){for(var b=0,c=this.length;b<c;b++)a(this[b],b,this)}:function(a){for(var b in this)this.hasOwnProperty(b)&&a(this[b],b,this)},c.apply(a,[b])},a.prototype.getScoreFunction=function(a,b){var c,e,f,g,h;c=this,a=c.prepareSearch(a,b),f=a.tokens,e=a.options.fields,g=f.length,h=a.options.nesting;var i=function(a,b){var c,d;return a?(a=String(a||""),d=a.search(b.regex),d===-1?0:(c=b.string.length/a.length,0===d&&(c+=.5),c)):0},j=function(){var a=e.length;return a?1===a?function(a,b){return i(d(b,e[0],h),a)}:function(b,c){for(var f=0,g=0;f<a;f++)g+=i(d(c,e[f],h),b);return g/a}:function(){return 0}}();return g?1===g?function(a){return j(f[0],a)}:"and"===a.options.conjunction?function(a){for(var b,c=0,d=0;c<g;c++){if(b=j(f[c],a),b<=0)return 0;d+=b}return d/g}:function(a){for(var b=0,c=0;b<g;b++)c+=j(f[b],a);return c/g}:function(){return 0}},a.prototype.getSortFunction=function(a,c){var e,f,g,h,i,j,k,l,m,n,o;if(g=this,a=g.prepareSearch(a,c),o=!a.query&&c.sort_empty||c.sort,m=function(a,b){return"$score"===a?b.score:d(g.items[b.id],a,c.nesting)},i=[],o)for(e=0,f=o.length;e<f;e++)(a.query||"$score"!==o[e].field)&&i.push(o[e]);if(a.query){for(n=!0,e=0,f=i.length;e<f;e++)if("$score"===i[e].field){n=!1;break}n&&i.unshift({field:"$score",direction:"desc"})}else for(e=0,f=i.length;e<f;e++)if("$score"===i[e].field){i.splice(e,1);break}for(l=[],e=0,f=i.length;e<f;e++)l.push("desc"===i[e].direction?-1:1);return j=i.length,j?1===j?(h=i[0].field,k=l[0],function(a,c){return k*b(m(h,a),m(h,c))}):function(a,c){var d,e,f;for(d=0;d<j;d++)if(f=i[d].field,e=l[d]*b(m(f,a),m(f,c)))return e;return 0}:null},a.prototype.prepareSearch=function(a,b){if("object"==typeof a)return a;b=c({},b);var d=b.fields,e=b.sort,f=b.sort_empty;return d&&!g(d)&&(b.fields=[d]),e&&!g(e)&&(b.sort=[e]),f&&!g(f)&&(b.sort_empty=[f]),{options:b,query:String(a||"").toLowerCase(),tokens:this.tokenize(a),total:0,items:[]}},a.prototype.search=function(a,b){var c,d,e,f,g=this;return d=this.prepareSearch(a,b),b=d.options,a=d.query,f=b.score||g.getScoreFunction(d),a.length?g.iterator(g.items,function(a,e){c=f(a),(b.filter===!1||c>0)&&d.items.push({score:c,id:e})}):g.iterator(g.items,function(a,b){d.items.push({score:1,id:b})}),e=g.getSortFunction(d,b),e&&d.items.sort(e),d.total=d.items.length,"number"==typeof b.limit&&(d.items=d.items.slice(0,b.limit)),d};var b=function(a,b){return"number"==typeof a&&"number"==typeof b?a>b?1:a<b?-1:0:(a=i(String(a||"")),b=i(String(b||"")),a>b?1:b>a?-1:0)},c=function(a,b){var c,d,e,f;for(c=1,d=arguments.length;c<d;c++)if(f=arguments[c])for(e in f)f.hasOwnProperty(e)&&(a[e]=f[e]);return a},d=function(a,b,c){if(a&&b){if(!c)return a[b];for(var d=b.split(".");d.length&&(a=a[d.shift()]););return a}},e=function(a){return(a+"").replace(/^\s+|\s+$|/g,"")},f=function(a){return(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},g=Array.isArray||"undefined"!=typeof $&&$.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},h={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},i=function(){var a,b,c,d,e="",f={};for(c in h)if(h.hasOwnProperty(c))for(d=h[c].substring(2,h[c].length-1),e+=d,a=0,b=d.length;a<b;a++)f[d.charAt(a)]=c;var g=new RegExp("["+e+"]","g");return function(a){return a.replace(g,function(a){return f[a]}).toLowerCase()}}();return a}),function(a,b){"function"==typeof define&&define.amd?define("microplugin",b):"object"==typeof exports?module.exports=b():a.MicroPlugin=b()}(this,function(){var a={};a.mixin=function(a){a.plugins={},a.prototype.initializePlugins=function(a){var c,d,e,f=this,g=[];if(f.plugins={names:[],settings:{},requested:{},loaded:{}},b.isArray(a))for(c=0,d=a.length;c<d;c++)"string"==typeof a[c]?g.push(a[c]):(f.plugins.settings[a[c].name]=a[c].options,g.push(a[c].name));else if(a)for(e in a)a.hasOwnProperty(e)&&(f.plugins.settings[e]=a[e],g.push(e));for(;g.length;)f.require(g.shift())},a.prototype.loadPlugin=function(b){var c=this,d=c.plugins,e=a.plugins[b];if(!a.plugins.hasOwnProperty(b))throw new Error('Unable to find "'+b+'" plugin');d.requested[b]=!0,d.loaded[b]=e.fn.apply(c,[c.plugins.settings[b]||{}]),d.names.push(b)},a.prototype.require=function(a){var b=this,c=b.plugins;if(!b.plugins.loaded.hasOwnProperty(a)){if(c.requested[a])throw new Error('Plugin has circular dependency ("'+a+'")');b.loadPlugin(a)}return c.loaded[a]},a.define=function(b,c){a.plugins[b]={name:b,fn:c}}};var b={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}};return a}),function(a,b){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],b):"object"==typeof exports?module.exports=b(require("jquery"),require("sifter"),require("microplugin")):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,b,c){"use strict";var d=function(a,b){if("string"!=typeof b||b.length){var c="string"==typeof b?new RegExp(b,"i"):b,d=function(a){var b=0;if(3===a.nodeType){var e=a.data.search(c);if(e>=0&&a.data.length>0){var f=a.data.match(c),g=document.createElement("span");g.className="highlight";var h=a.splitText(e),i=(h.splitText(f[0].length),h.cloneNode(!0));g.appendChild(i),h.parentNode.replaceChild(g,h),b=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var j=0;j<a.childNodes.length;++j)j+=d(a.childNodes[j]);return b};return a.each(function(){d(this)})}};a.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var a=this.parentNode;a.replaceChild(this.firstChild,this),a.normalize()}).end()};var e=function(){};e.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){var c=arguments.length;return 0===c?delete this._events:1===c?delete this._events[a]:(this._events=this._events||{},void(a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)))},trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},e.mixin=function(a){for(var b=["on","off","trigger"],c=0;c<b.length;c++)a.prototype[b[c]]=e.prototype[b[c]]};var f=/Mac/.test(navigator.userAgent),g=65,h=13,i=27,j=37,k=38,l=80,m=39,n=40,o=78,p=8,q=46,r=16,s=f?91:17,t=f?18:17,u=9,v=1,w=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,y=function(a){return"undefined"!=typeof a},z=function(a){return"undefined"==typeof a||null===a?null:"boolean"==typeof a?a?"1":"0":a+""},A=function(a){return(a+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},B={};B.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},B.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var C=function(a){var b=!1;return function(){b||(b=!0,a.apply(this,arguments))}},D=function(a,b){var c;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},E=function(a,b,c){var d,e=a.trigger,f={};a.trigger=function(){var c=arguments[0];return b.indexOf(c)===-1?e.apply(a,arguments):void(f[c]=arguments)},c.apply(a,[]),a.trigger=e;for(d in f)f.hasOwnProperty(d)&&e.apply(a,f[d])},F=function(a,b,c,d){a.on(b,c,function(b){for(var c=b.target;c&&c.parentNode!==a[0];)c=c.parentNode;return b.currentTarget=c,d.apply(this,[b])})},G=function(a){var b={};if("selectionStart"in a)b.start=a.selectionStart,b.length=a.selectionEnd-b.start;else if(document.selection){a.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-a.value.length),b.start=c.text.length-d,b.length=d}return b},H=function(a,b,c){var d,e,f={};if(c)for(d=0,e=c.length;d<e;d++)f[c[d]]=a.css(c[d]);else f=a.css();b.css(f)},I=function(b,c){if(!b)return 0;var d=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(b).appendTo("body");H(c,d,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=d.width();return d.remove(),e},J=function(a){var b=null,c=function(c,d){var e,f,g,h,i,j,k,l;c=c||window.event||{},d=d||{},c.metaKey||c.altKey||(d.force||a.data("grow")!==!1)&&(e=a.val(),c.type&&"keydown"===c.type.toLowerCase()&&(f=c.keyCode,g=f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||32===f,f===q||f===p?(l=G(a[0]),l.length?e=e.substring(0,l.start)+e.substring(l.start+l.length):f===p&&l.start?e=e.substring(0,l.start-1)+e.substring(l.start+1):f===q&&"undefined"!=typeof l.start&&(e=e.substring(0,l.start)+e.substring(l.start+1))):g&&(j=c.shiftKey,k=String.fromCharCode(c.keyCode),k=j?k.toUpperCase():k.toLowerCase(),e+=k)),h=a.attr("placeholder"),!e&&h&&(e=h),i=I(e,a)+4,i!==b&&(b=i,a.width(i),a.triggerHandler("resize")))};a.on("keydown keyup update blur",c),c()},K=function(a){var b=document.createElement("div");return b.appendChild(a.cloneNode(!0)),b.innerHTML},L=function(a,b){b||(b={});var c="Selectize";console.error(c+": "+a),b.explanation&&(console.group&&console.group(),console.error(b.explanation),console.group&&console.groupEnd())},M=function(c,d){var e,f,g,h,i=this;h=c[0],h.selectize=i;var j=window.getComputedStyle&&window.getComputedStyle(h,null);if(g=j?j.getPropertyValue("direction"):h.currentStyle&&h.currentStyle.direction,g=g||c.parents("[dir]:first").attr("dir")||"",a.extend(i,{order:0,settings:d,$input:c,tabIndex:c.attr("tabindex")||"",tagType:"select"===h.tagName.toLowerCase()?v:w,rtl:/rtl/i.test(g),eventNS:".selectize"+ ++M.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:c.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===d.loadThrottle?i.onSearchChange:D(i.onSearchChange,d.loadThrottle)}),i.sifter=new b(this.options,{diacritics:d.diacritics}),i.settings.options){for(e=0,f=i.settings.options.length;e<f;e++)i.registerOption(i.settings.options[e]);delete i.settings.options}if(i.settings.optgroups){for(e=0,f=i.settings.optgroups.length;e<f;e++)i.registerOptionGroup(i.settings.optgroups[e]);delete i.settings.optgroups}i.settings.mode=i.settings.mode||(1===i.settings.maxItems?"single":"multi"),"boolean"!=typeof i.settings.hideSelected&&(i.settings.hideSelected="multi"===i.settings.mode),i.initializePlugins(i.settings.plugins),i.setupCallbacks(),i.setupTemplates(),i.setup()};return e.mixin(M),"undefined"!=typeof c?c.mixin(M):L("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),a.extend(M.prototype,{setup:function(){var b,c,d,e,g,h,i,j,k,l,m=this,n=m.settings,o=m.eventNS,p=a(window),q=a(document),u=m.$input;if(i=m.settings.mode,j=u.attr("class")||"",b=a("<div>").addClass(n.wrapperClass).addClass(j).addClass(i),c=a("<div>").addClass(n.inputClass).addClass("items").appendTo(b),d=a('<input type="text" autocomplete="off" />').appendTo(c).attr("tabindex",u.is(":disabled")?"-1":m.tabIndex),h=a(n.dropdownParent||b),e=a("<div>").addClass(n.dropdownClass).addClass(i).hide().appendTo(h),g=a("<div>").addClass(n.dropdownContentClass).appendTo(e),(l=u.attr("id"))&&(d.attr("id",l+"-selectized"),a("label[for='"+l+"']").attr("for",l+"-selectized")),m.settings.copyClassesToDropdown&&e.addClass(j),b.css({width:u[0].style.width}),m.plugins.names.length&&(k="plugin-"+m.plugins.names.join(" plugin-"),b.addClass(k),e.addClass(k)),(null===n.maxItems||n.maxItems>1)&&m.tagType===v&&u.attr("multiple","multiple"),m.settings.placeholder&&d.attr("placeholder",n.placeholder),!m.settings.splitOn&&m.settings.delimiter){var w=m.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");m.settings.splitOn=new RegExp("\\s*"+w+"+\\s*")}u.attr("autocorrect")&&d.attr("autocorrect",u.attr("autocorrect")),u.attr("autocapitalize")&&d.attr("autocapitalize",u.attr("autocapitalize")),m.$wrapper=b,m.$control=c,m.$control_input=d,m.$dropdown=e,m.$dropdown_content=g,e.on("mouseenter","[data-selectable]",function(){return m.onOptionHover.apply(m,arguments)}),e.on("mousedown click","[data-selectable]",function(){return m.onOptionSelect.apply(m,arguments)}),F(c,"mousedown","*:not(input)",function(){return m.onItemSelect.apply(m,arguments)}),J(d),c.on({mousedown:function(){return m.onMouseDown.apply(m,arguments)},click:function(){return m.onClick.apply(m,arguments)}}),d.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return m.onKeyDown.apply(m,arguments)},keyup:function(){return m.onKeyUp.apply(m,arguments)},keypress:function(){return m.onKeyPress.apply(m,arguments)},resize:function(){m.positionDropdown.apply(m,[])},blur:function(){return m.onBlur.apply(m,arguments)},focus:function(){return m.ignoreBlur=!1,m.onFocus.apply(m,arguments)},paste:function(){return m.onPaste.apply(m,arguments)}}),q.on("keydown"+o,function(a){m.isCmdDown=a[f?"metaKey":"ctrlKey"],m.isCtrlDown=a[f?"altKey":"ctrlKey"],m.isShiftDown=a.shiftKey}),q.on("keyup"+o,function(a){a.keyCode===t&&(m.isCtrlDown=!1),a.keyCode===r&&(m.isShiftDown=!1),a.keyCode===s&&(m.isCmdDown=!1)}),q.on("mousedown"+o,function(a){if(m.isFocused){if(a.target===m.$dropdown[0]||a.target.parentNode===m.$dropdown[0])return!1;m.$control.has(a.target).length||a.target===m.$control[0]||m.blur(a.target)}}),p.on(["scroll"+o,"resize"+o].join(" "),function(){m.isOpen&&m.positionDropdown.apply(m,arguments)}),p.on("mousemove"+o,function(){m.ignoreHover=!1}),this.revertSettings={$children:u.children().detach(),tabindex:u.attr("tabindex")},u.attr("tabindex",-1).hide().after(m.$wrapper),a.isArray(n.items)&&(m.setValue(n.items),delete n.items),x&&u.on("invalid"+o,function(a){a.preventDefault(),m.isInvalid=!0,m.refreshState()}),m.updateOriginalInput(),m.refreshItems(),m.refreshState(),m.updatePlaceholder(),m.isSetup=!0,u.is(":disabled")&&m.disable(),m.on("change",this.onChange),u.data("selectize",m),u.addClass("selectized"),m.trigger("initialize"),n.preload===!0&&m.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>&hellip;</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(a){var b=this;b.isFocused||(b.focus(),a.preventDefault())},onMouseDown:function(b){var c=this,d=b.isDefaultPrevented();a(b.target);if(c.isFocused){if(b.target!==c.$control_input[0])return"single"===c.settings.mode?c.isOpen?c.close():c.open():d||c.setActiveItem(null),!1}else d||window.setTimeout(function(){c.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(b){var c=this;return c.isFull()||c.isInputHidden||c.isLocked?void b.preventDefault():void(c.settings.splitOn&&setTimeout(function(){var b=c.$control_input.val();if(b.match(c.settings.splitOn))for(var d=a.trim(b).split(c.settings.splitOn),e=0,f=d.length;e<f;e++)c.createItem(d[e])},0))},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&"multi"===this.settings.mode&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(a){var b=(a.target===this.$control_input[0],this);if(b.isLocked)return void(a.keyCode!==u&&a.preventDefault());switch(a.keyCode){case g:if(b.isCmdDown)return void b.selectAll();break;case i:return void(b.isOpen&&(a.preventDefault(),a.stopPropagation(),b.close()));case o:if(!a.ctrlKey||a.altKey)break;case n:if(!b.isOpen&&b.hasOptions)b.open();else if(b.$activeOption){b.ignoreHover=!0;var c=b.getAdjacentOption(b.$activeOption,1);c.length&&b.setActiveOption(c,!0,!0)}return void a.preventDefault();case l:if(!a.ctrlKey||a.altKey)break;case k:if(b.$activeOption){b.ignoreHover=!0;var d=b.getAdjacentOption(b.$activeOption,-1);d.length&&b.setActiveOption(d,!0,!0)}return void a.preventDefault();case h:return void(b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),a.preventDefault()));case j:return void b.advanceSelection(-1,a);case m:return void b.advanceSelection(1,a);case u:return b.settings.selectOnTab&&b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),b.isFull()||a.preventDefault()),void(b.settings.create&&b.createItem()&&a.preventDefault());case p:case q:return void b.deleteSelection(a)}return!b.isFull()&&!b.isInputHidden||(f?a.metaKey:a.ctrlKey)?void 0:void a.preventDefault()},onKeyUp:function(a){var b=this;if(b.isLocked)return a&&a.preventDefault();var c=b.$control_input.val()||"";b.lastValue!==c&&(b.lastValue=c,b.onSearchChange(c),b.refreshOptions(),b.trigger("type",c))},onSearchChange:function(a){var b=this,c=b.settings.load;c&&(b.loadedSearches.hasOwnProperty(a)||(b.loadedSearches[a]=!0,b.load(function(d){c.apply(b,[a,d])})))},onFocus:function(a){var b=this,c=b.isFocused;return b.isDisabled?(b.blur(),a&&a.preventDefault(),!1):void(b.ignoreFocus||(b.isFocused=!0,"focus"===b.settings.preload&&b.onSearchChange(""),c||b.trigger("focus"),b.$activeItems.length||(b.showInput(),b.setActiveItem(null),b.refreshOptions(!!b.settings.openOnFocus)),b.refreshState()))},onBlur:function(a,b){var c=this;if(c.isFocused&&(c.isFocused=!1,!c.ignoreFocus)){if(!c.ignoreBlur&&document.activeElement===c.$dropdown_content[0])return c.ignoreBlur=!0,void c.onFocus(a);var d=function(){c.close(),c.setTextboxValue(""),c.setActiveItem(null),c.setActiveOption(null),c.setCaret(c.items.length),c.refreshState(),b&&b.focus&&b.focus(),c.ignoreFocus=!1,c.trigger("blur")};c.ignoreFocus=!0,c.settings.create&&c.settings.createOnBlur?c.createItem(null,!1,d):d()}},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(b){var c,d,e=this;b.preventDefault&&(b.preventDefault(),b.stopPropagation()),d=a(b.currentTarget),d.hasClass("create")?e.createItem(null,function(){e.settings.closeAfterSelect&&e.close()}):(c=d.attr("data-value"),"undefined"!=typeof c&&(e.lastQuery=null,e.setTextboxValue(""),e.addItem(c),e.settings.closeAfterSelect?e.close():!e.settings.hideSelected&&b.type&&/mouse/.test(b.type)&&e.setActiveOption(e.getOption(c))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(a){var b=this,c=b.$wrapper.addClass(b.settings.loadingClass);b.loading++,a.apply(b,[function(a){b.loading=Math.max(b.loading-1,0),a&&a.length&&(b.addOption(a),b.refreshOptions(b.isFocused&&!b.isInputHidden)),b.loading||c.removeClass(b.settings.loadingClass),b.trigger("load",a)}])},setTextboxValue:function(a){var b=this.$control_input,c=b.val()!==a;c&&(b.val(a).triggerHandler("update"),this.lastValue=a)},getValue:function(){return this.tagType===v&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(a,b){var c=b?[]:["change"];E(this,c,function(){this.clear(b),this.addItems(a,b)})},setActiveItem:function(b,c){var d,e,f,g,h,i,j,k,l=this;if("single"!==l.settings.mode){if(b=a(b),!b.length)return a(l.$activeItems).removeClass("active"),l.$activeItems=[],void(l.isFocused&&l.showInput());if(d=c&&c.type.toLowerCase(),"mousedown"===d&&l.isShiftDown&&l.$activeItems.length){for(k=l.$control.children(".active:last"),g=Array.prototype.indexOf.apply(l.$control[0].childNodes,[k[0]]),h=Array.prototype.indexOf.apply(l.$control[0].childNodes,[b[0]]),g>h&&(j=g,g=h,h=j),e=g;e<=h;e++)i=l.$control[0].childNodes[e],l.$activeItems.indexOf(i)===-1&&(a(i).addClass("active"),l.$activeItems.push(i));c.preventDefault()}else"mousedown"===d&&l.isCtrlDown||"keydown"===d&&this.isShiftDown?b.hasClass("active")?(f=l.$activeItems.indexOf(b[0]),l.$activeItems.splice(f,1),b.removeClass("active")):l.$activeItems.push(b.addClass("active")[0]):(a(l.$activeItems).removeClass("active"),l.$activeItems=[b.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}},setActiveOption:function(b,c,d){var e,f,g,h,i,j=this;j.$activeOption&&j.$activeOption.removeClass("active"),j.$activeOption=null,b=a(b),b.length&&(j.$activeOption=b.addClass("active"),!c&&y(c)||(e=j.$dropdown_content.height(),f=j.$activeOption.outerHeight(!0),c=j.$dropdown_content.scrollTop()||0,g=j.$activeOption.offset().top-j.$dropdown_content.offset().top+c,h=g,i=g-e+f,g+f>e+c?j.$dropdown_content.stop().animate({scrollTop:i},d?j.settings.scrollDuration:0):g<c&&j.$dropdown_content.stop().animate({scrollTop:h},d?j.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(a){this.$control_input[0].blur(),this.onBlur(null,a)},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.getSearchOptions())},getSearchOptions:function(){var a=this.settings,b=a.sortField;return"string"==typeof b&&(b=[{field:b}]),{fields:a.searchField,conjunction:a.searchConjunction,sort:b}},search:function(b){var c,d,e,f=this,g=f.settings,h=this.getSearchOptions();if(g.score&&(e=f.settings.score.apply(this,[b]),"function"!=typeof e))throw new Error('Selectize "score" setting must be a function that returns a function');if(b!==f.lastQuery?(f.lastQuery=b,d=f.sifter.search(b,a.extend(h,{score:e})),f.currentResults=d):d=a.extend(!0,{},f.currentResults),g.hideSelected)for(c=d.items.length-1;c>=0;c--)f.items.indexOf(z(d.items[c].id))!==-1&&d.items.splice(c,1);return d},refreshOptions:function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;"undefined"==typeof b&&(b=!0);var t=this,u=a.trim(t.$control_input.val()),v=t.search(u),w=t.$dropdown_content,x=t.$activeOption&&z(t.$activeOption.attr("data-value"));for(g=v.items.length,"number"==typeof t.settings.maxOptions&&(g=Math.min(g,t.settings.maxOptions)),h={},i=[],c=0;c<g;c++)for(j=t.options[v.items[c].id],k=t.render("option",j),l=j[t.settings.optgroupField]||"",m=a.isArray(l)?l:[l],e=0,f=m&&m.length;e<f;e++)l=m[e],t.optgroups.hasOwnProperty(l)||(l=""),h.hasOwnProperty(l)||(h[l]=document.createDocumentFragment(),i.push(l)),h[l].appendChild(k);for(this.settings.lockOptgroupOrder&&i.sort(function(a,b){var c=t.optgroups[a].$order||0,d=t.optgroups[b].$order||0;return c-d}),n=document.createDocumentFragment(),c=0,g=i.length;c<g;c++)l=i[c],t.optgroups.hasOwnProperty(l)&&h[l].childNodes.length?(o=document.createDocumentFragment(),o.appendChild(t.render("optgroup_header",t.optgroups[l])),o.appendChild(h[l]),n.appendChild(t.render("optgroup",a.extend({},t.optgroups[l],{html:K(o),dom:o})))):n.appendChild(h[l]);if(w.html(n),t.settings.highlight&&v.query.length&&v.tokens.length)for(w.removeHighlight(),c=0,g=v.tokens.length;c<g;c++)d(w,v.tokens[c].regex);if(!t.settings.hideSelected)for(c=0,g=t.items.length;c<g;c++)t.getOption(t.items[c]).addClass("selected");p=t.canCreate(u),p&&(w.prepend(t.render("option_create",{input:u})),s=a(w[0].childNodes[0])),t.hasOptions=v.items.length>0||p,t.hasOptions?(v.items.length>0?(r=x&&t.getOption(x),r&&r.length?q=r:"single"===t.settings.mode&&t.items.length&&(q=t.getOption(t.items[0])),q&&q.length||(q=s&&!t.settings.addPrecedence?t.getAdjacentOption(s,1):w.find("[data-selectable]:first"))):q=s,t.setActiveOption(q),b&&!t.isOpen&&t.open()):(t.setActiveOption(null),b&&t.isOpen&&t.close())},addOption:function(b){var c,d,e,f=this;if(a.isArray(b))for(c=0,d=b.length;c<d;c++)f.addOption(b[c]);else(e=f.registerOption(b))&&(f.userOptions[e]=!0,f.lastQuery=null,f.trigger("option_add",e,b))},registerOption:function(a){var b=z(a[this.settings.valueField]);return"undefined"!=typeof b&&null!==b&&!this.options.hasOwnProperty(b)&&(a.$order=a.$order||++this.order,this.options[b]=a,b)},registerOptionGroup:function(a){var b=z(a[this.settings.optgroupValueField]);return!!b&&(a.$order=a.$order||++this.order,this.optgroups[b]=a,b)},addOptionGroup:function(a,b){b[this.settings.optgroupValueField]=a,(a=this.registerOptionGroup(b))&&this.trigger("optgroup_add",a,b)},removeOptionGroup:function(a){this.optgroups.hasOwnProperty(a)&&(delete this.optgroups[a],this.renderCache={},this.trigger("optgroup_remove",a))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(b,c){var d,e,f,g,h,i,j,k=this;if(b=z(b),f=z(c[k.settings.valueField]),null!==b&&k.options.hasOwnProperty(b)){if("string"!=typeof f)throw new Error("Value must be set in option data");j=k.options[b].$order,f!==b&&(delete k.options[b],g=k.items.indexOf(b),g!==-1&&k.items.splice(g,1,f)),c.$order=c.$order||j,k.options[f]=c,h=k.renderCache.item,i=k.renderCache.option,h&&(delete h[b],delete h[f]),i&&(delete i[b],delete i[f]),k.items.indexOf(f)!==-1&&(d=k.getItem(b),e=a(k.render("item",c)),d.hasClass("active")&&e.addClass("active"),d.replaceWith(e)),k.lastQuery=null,k.isOpen&&k.refreshOptions(!1)}},removeOption:function(a,b){var c=this;a=z(a);var d=c.renderCache.item,e=c.renderCache.option;d&&delete d[a],e&&delete e[a],delete c.userOptions[a],delete c.options[a],c.lastQuery=null,c.trigger("option_remove",a),c.removeItem(a,b)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.renderCache={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(b,c){var d=this.$dropdown.find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},getElementWithValue:function(b,c){if(b=z(b),"undefined"!=typeof b&&null!==b)for(var d=0,e=c.length;d<e;d++)if(c[d].getAttribute("data-value")===b)return a(c[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItems:function(b,c){for(var d=a.isArray(b)?b:[b],e=0,f=d.length;e<f;e++)this.isPending=e<f-1,this.addItem(d[e],c)},addItem:function(b,c){var d=c?[]:["change"];E(this,d,function(){var d,e,f,g,h,i=this,j=i.settings.mode;return b=z(b),i.items.indexOf(b)!==-1?void("single"===j&&i.close()):void(i.options.hasOwnProperty(b)&&("single"===j&&i.clear(c),"multi"===j&&i.isFull()||(d=a(i.render("item",i.options[b])),h=i.isFull(),i.items.splice(i.caretPos,0,b),i.insertAtCaret(d),(!i.isPending||!h&&i.isFull())&&i.refreshState(),i.isSetup&&(f=i.$dropdown_content.find("[data-selectable]"),i.isPending||(e=i.getOption(b),g=i.getAdjacentOption(e,1).attr("data-value"),i.refreshOptions(i.isFocused&&"single"!==j),g&&i.setActiveOption(i.getOption(g))),!f.length||i.isFull()?i.close():i.positionDropdown(),i.updatePlaceholder(),i.trigger("item_add",b,d),i.updateOriginalInput({silent:c})))))})},removeItem:function(b,c){var d,e,f,g=this;d=b instanceof a?b:g.getItem(b),b=z(d.attr("data-value")),e=g.items.indexOf(b),e!==-1&&(d.remove(),d.hasClass("active")&&(f=g.$activeItems.indexOf(d[0]),g.$activeItems.splice(f,1)),g.items.splice(e,1),g.lastQuery=null,!g.settings.persist&&g.userOptions.hasOwnProperty(b)&&g.removeOption(b,c),e<g.caretPos&&g.setCaret(g.caretPos-1),g.refreshState(),g.updatePlaceholder(),g.updateOriginalInput({silent:c}),g.positionDropdown(),g.trigger("item_remove",b,d))},createItem:function(b,c){var d=this,e=d.caretPos;b=b||a.trim(d.$control_input.val()||"");var f=arguments[arguments.length-1];if("function"!=typeof f&&(f=function(){}),"boolean"!=typeof c&&(c=!0),!d.canCreate(b))return f(),!1;d.lock();var g="function"==typeof d.settings.create?this.settings.create:function(a){var b={};return b[d.settings.labelField]=a,b[d.settings.valueField]=a,b},h=C(function(a){if(d.unlock(),!a||"object"!=typeof a)return f();var b=z(a[d.settings.valueField]);return"string"!=typeof b?f():(d.setTextboxValue(""),d.addOption(a),d.setCaret(e),d.addItem(b),d.refreshOptions(c&&"single"!==d.settings.mode),void f(a))}),i=g.apply(this,[b,h]);return"undefined"!=typeof i&&h(i),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var a=!this.items.length;this.isInvalid=a,this.$control_input.prop("required",a),this.$input.prop("required",!a)},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(a){var b,c,d,e,f=this;if(a=a||{},f.tagType===v){for(d=[],b=0,c=f.items.length;b<c;b++)e=f.options[f.items[b]][f.settings.labelField]||"",d.push('<option value="'+A(f.items[b])+'" selected="selected">'+A(e)+"</option>");d.length||this.$input.attr("multiple")||d.push('<option value="" selected="selected"></option>'),
3
+ f.$input.html(d.join(""))}else f.$input.val(f.getValue()),f.$input.attr("value",f.$input.val());f.isSetup&&(a.silent||f.trigger("change",f.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update",{force:!0})}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&(a.hideInput(),a.$control_input.blur()),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(a){var b=this;b.items.length&&(b.$control.children(":not(input)").remove(),b.items=[],b.lastQuery=null,b.setCaret(0),b.setActiveItem(null),b.updatePlaceholder(),b.updateOriginalInput({silent:a}),b.refreshState(),b.showInput(),b.trigger("clear"))},insertAtCaret:function(b){var c=Math.min(this.caretPos,this.items.length);0===c?this.$control.prepend(b):a(this.$control[0].childNodes[c]).before(b),this.setCaret(c+1)},deleteSelection:function(b){var c,d,e,f,g,h,i,j,k,l=this;if(e=b&&b.keyCode===p?-1:1,f=G(l.$control_input[0]),l.$activeOption&&!l.settings.hideSelected&&(i=l.getAdjacentOption(l.$activeOption,-1).attr("data-value")),g=[],l.$activeItems.length){for(k=l.$control.children(".active:"+(e>0?"last":"first")),h=l.$control.children(":not(input)").index(k),e>0&&h++,c=0,d=l.$activeItems.length;c<d;c++)g.push(a(l.$activeItems[c]).attr("data-value"));b&&(b.preventDefault(),b.stopPropagation())}else(l.isFocused||"single"===l.settings.mode)&&l.items.length&&(e<0&&0===f.start&&0===f.length?g.push(l.items[l.caretPos-1]):e>0&&f.start===l.$control_input.val().length&&g.push(l.items[l.caretPos]));if(!g.length||"function"==typeof l.settings.onDelete&&l.settings.onDelete.apply(l,[g])===!1)return!1;for("undefined"!=typeof h&&l.setCaret(h);g.length;)l.removeItem(g.pop());return l.showInput(),l.positionDropdown(),l.refreshOptions(!0),i&&(j=l.getOption(i),j.length&&l.setActiveOption(j)),!0},advanceSelection:function(a,b){var c,d,e,f,g,h,i=this;0!==a&&(i.rtl&&(a*=-1),c=a>0?"last":"first",d=G(i.$control_input[0]),i.isFocused&&!i.isInputHidden?(f=i.$control_input.val().length,g=a<0?0===d.start&&0===d.length:d.start===f,g&&!f&&i.advanceCaret(a,b)):(h=i.$control.children(".active:"+c),h.length&&(e=i.$control.children(":not(input)").index(h),i.setActiveItem(null),i.setCaret(a>0?e+1:e))))},advanceCaret:function(a,b){var c,d,e=this;0!==a&&(c=a>0?"next":"prev",e.isShiftDown?(d=e.$control_input[c](),d.length&&(e.hideInput(),e.setActiveItem(d),b&&b.preventDefault())):e.setCaret(e.caretPos+a))},setCaret:function(b){var c=this;if(b="single"===c.settings.mode?c.items.length:Math.max(0,Math.min(c.items.length,b)),!c.isPending){var d,e,f,g;for(f=c.$control.children(":not(input)"),d=0,e=f.length;d<e;d++)g=a(f[d]).detach(),d<b?c.$control_input.before(g):c.$control.append(g)}c.caretPos=b},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.$control_input.prop("disabled",!0).prop("tabindex",-1),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.$control_input.prop("disabled",!1).prop("tabindex",a.tabIndex),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:d.tabindex}).show(),b.$control_input.removeData("grow"),b.$input.removeData("selectize"),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(b,c){var d,e,f="",g=!1,h=this;return"option"!==b&&"item"!==b||(d=z(c[h.settings.valueField]),g=!!d),g&&(y(h.renderCache[b])||(h.renderCache[b]={}),h.renderCache[b].hasOwnProperty(d))?h.renderCache[b][d]:(f=a(h.settings.render[b].apply(this,[c,A])),"option"===b||"option_create"===b?f.attr("data-selectable",""):"optgroup"===b&&(e=c[h.settings.optgroupValueField]||"",f.attr("data-group",e)),"option"!==b&&"item"!==b||f.attr("data-value",d||""),g&&(h.renderCache[b][d]=f[0]),f[0])},clearCache:function(a){var b=this;"undefined"==typeof a?b.renderCache={}:delete b.renderCache[a]},canCreate:function(a){var b=this;if(!b.settings.create)return!1;var c=b.settings.createFilter;return a.length&&("function"!=typeof c||c.apply(b,[a]))&&("string"!=typeof c||new RegExp(c).test(a))&&(!(c instanceof RegExp)||c.test(a))}}),M.count=0,M.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},a.fn.selectize=function(b){var c=a.fn.selectize.defaults,d=a.extend({},c,b),e=d.dataAttr,f=d.labelField,g=d.valueField,h=d.optgroupField,i=d.optgroupLabelField,j=d.optgroupValueField,k=function(b,c){var h,i,j,k,l=b.attr(e);if(l)for(c.options=JSON.parse(l),h=0,i=c.options.length;h<i;h++)c.items.push(c.options[h][g]);else{var m=a.trim(b.val()||"");if(!d.allowEmptyOption&&!m.length)return;for(j=m.split(d.delimiter),h=0,i=j.length;h<i;h++)k={},k[f]=j[h],k[g]=j[h],c.options.push(k);c.items=j}},l=function(b,c){var k,l,m,n,o=c.options,p={},q=function(a){var b=e&&a.attr(e);return"string"==typeof b&&b.length?JSON.parse(b):null},r=function(b,e){b=a(b);var i=z(b.val());if(i||d.allowEmptyOption)if(p.hasOwnProperty(i)){if(e){var j=p[i][h];j?a.isArray(j)?j.push(e):p[i][h]=[j,e]:p[i][h]=e}}else{var k=q(b)||{};k[f]=k[f]||b.text(),k[g]=k[g]||i,k[h]=k[h]||e,p[i]=k,o.push(k),b.is(":selected")&&c.items.push(i)}},s=function(b){var d,e,f,g,h;for(b=a(b),f=b.attr("label"),f&&(g=q(b)||{},g[i]=f,g[j]=f,c.optgroups.push(g)),h=a("option",b),d=0,e=h.length;d<e;d++)r(h[d],f)};for(c.maxItems=b.attr("multiple")?null:1,n=b.children(),k=0,l=n.length;k<l;k++)m=n[k].tagName.toLowerCase(),"optgroup"===m?s(n[k]):"option"===m&&r(n[k])};return this.each(function(){if(!this.selectize){var e,f=a(this),g=this.tagName.toLowerCase(),h=f.attr("placeholder")||f.attr("data-placeholder");h||d.allowEmptyOption||(h=f.children('option[value=""]').text());var i={placeholder:h,options:[],optgroups:[],items:[]};"select"===g?l(f,i):k(f,i),e=new M(f,a.extend(!0,{},c,i,b))}})},a.fn.selectize.defaults=M.defaults,a.fn.selectize.support={validity:x},M.define("drag_drop",function(b){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var c=this;c.lock=function(){var a=c.lock;return function(){var b=c.$control.data("sortable");return b&&b.disable(),a.apply(c,arguments)}}(),c.unlock=function(){var a=c.unlock;return function(){var b=c.$control.data("sortable");return b&&b.enable(),a.apply(c,arguments)}}(),c.setup=function(){var b=c.setup;return function(){b.apply(this,arguments);var d=c.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:c.isLocked,start:function(a,b){b.placeholder.css("width",b.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var b=c.$activeItems?c.$activeItems.slice():null,e=[];d.children("[data-value]").each(function(){e.push(a(this).attr("data-value"))}),c.setValue(e),c.setActiveItem(b)}})}}()}}),M.define("dropdown_header",function(b){var c=this;b=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'"><div class="'+a.titleRowClass+'"><span class="'+a.labelClass+'">'+a.title+'</span><a href="javascript:void(0)" class="'+a.closeClass+'">&times;</a></div></div>'}},b),c.setup=function(){var d=c.setup;return function(){d.apply(c,arguments),c.$dropdown_header=a(b.html(b)),c.$dropdown.prepend(c.$dropdown_header)}}()}),M.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(b,c){var d=b.closest("[data-group]").find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(b){var d,e,f,g;return!this.isOpen||b.keyCode!==j&&b.keyCode!==m?a.apply(this,arguments):(c.ignoreHover=!0,g=this.$activeOption.closest("[data-group]"),d=g.find("[data-selectable]").index(this.$activeOption),g=b.keyCode===j?g.prev("[data-group]"):g.next("[data-group]"),f=g.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,d)),void(e.length&&this.setActiveOption(e)))}}();var d=function(){var a,b=d.width,c=document;return"undefined"==typeof b&&(a=c.createElement("div"),a.innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',a=a.firstChild,c.body.appendChild(a),b=d.width=a.offsetWidth-a.clientWidth,c.body.removeChild(a)),b},e=function(){var e,f,g,h,i,j,k;if(k=a("[data-group]",c.$dropdown_content),f=k.length,f&&c.$dropdown_content.width()){if(b.equalizeHeight){for(g=0,e=0;e<f;e++)g=Math.max(g,k.eq(e).height());k.css({height:g})}b.equalizeWidth&&(j=c.$dropdown_content.innerWidth()-d(),h=Math.round(j/f),k.css({width:h}),f>1&&(i=j-h*(f-1),k.eq(f-1).css({width:i})))}};(b.equalizeHeight||b.equalizeWidth)&&(B.after(this,"positionDropdown",e),B.after(this,"refreshOptions",e))}),M.define("remove_button",function(b){b=a.extend({label:"&times;",title:"Remove",className:"remove",append:!0},b);var c=function(b,c){c.className="remove-single";var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){return a+b};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=a(d.$input.context).attr("id"),i=(a("#"+h),d.settings.render.item);d.settings.render.item=function(a){return f(i.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(a){a.preventDefault(),d.isLocked||d.clear()})}}()},d=function(b,c){var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+b+a.substring(c)};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=d.settings.render.item;d.settings.render.item=function(a){return f(h.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(b){if(b.preventDefault(),!d.isLocked){var c=a(b.currentTarget).parent();d.setActiveItem(c),d.deleteSelection()&&d.setCaret(d.items.length)}})}}()};return"single"===this.settings.mode?void c(this,b):void d(this,b)}),M.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(b){var d,e;return b.keyCode===p&&""===this.$control_input.val()&&!this.$activeItems.length&&(d=this.caretPos-1,d>=0&&d<this.items.length)?(e=this.options[this.items[d]],this.deleteSelection(b)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),void b.preventDefault()):c.apply(this,arguments)}}()}),M});
ocean-extra.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Ocean Extra
4
  * Plugin URI: https://oceanwp.org/extension/ocean-extra/
5
  * Description: Add extra features like metaboxes, Import/Export and a panel to activate the premium extensions.
6
- * Version: 1.1.5.1
7
  * Author: OceanWP
8
  * Author URI: https://oceanwp.org/
9
  * Requires at least: 4.0.0
@@ -86,7 +86,7 @@ final class Ocean_Extra {
86
  $this->token = 'ocean-extra';
87
  $this->plugin_url = plugin_dir_url( __FILE__ );
88
  $this->plugin_path = plugin_dir_path( __FILE__ );
89
- $this->version = '1.1.5.1';
90
 
91
  define( 'OE_PATH', $this->plugin_path );
92
  define( 'OE_VERSION', $this->version );
3
  * Plugin Name: Ocean Extra
4
  * Plugin URI: https://oceanwp.org/extension/ocean-extra/
5
  * Description: Add extra features like metaboxes, Import/Export and a panel to activate the premium extensions.
6
+ * Version: 1.1.6
7
  * Author: OceanWP
8
  * Author URI: https://oceanwp.org/
9
  * Requires at least: 4.0.0
86
  $this->token = 'ocean-extra';
87
  $this->plugin_url = plugin_dir_url( __FILE__ );
88
  $this->plugin_path = plugin_dir_path( __FILE__ );
89
+ $this->version = '1.1.6';
90
 
91
  define( 'OE_PATH', $this->plugin_path );
92
  define( 'OE_VERSION', $this->version );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: oceanwp
3
  Tags: meta boxes, meta box, metaboxes, metabox, social sharing, oceanwp
4
  Requires at least: 3.5
5
  Tested up to: 4.7.2
6
- Stable tag: 1.1.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -33,6 +33,9 @@ This plugin will only work with the [OceanWP](https://oceanwp.org/) theme.
33
 
34
  == Changelog ==
35
 
 
 
 
36
  = 1.1.5.1 =
37
  - Error 500 fixed.
38
 
3
  Tags: meta boxes, meta box, metaboxes, metabox, social sharing, oceanwp
4
  Requires at least: 3.5
5
  Tested up to: 4.7.2
6
+ Stable tag: 1.1.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
33
 
34
  == Changelog ==
35
 
36
+ = 1.1.6 =
37
+ - Select2 script replaced by Selective to prevent conflict.
38
+
39
  = 1.1.5.1 =
40
  - Error 500 fixed.
41