Ocean Extra - Version 1.1.5.1

Version Description

  • Error 500 fixed.
Download this release

Release Info

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

Code changes from version 1.1.4.2 to 1.1.5.1

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 from theme.
646
- wp_enqueue_script( 'oceanwp-select2', OCEANWP_INC_DIR_URI . 'customizer/controls/typography/select2.min.js', array( 'jquery' ), false, true );
647
 
648
- // Enqueue the select2 style from theme.
649
- wp_enqueue_style( 'select2-css', OCEANWP_INC_DIR_URI . 'customizer/controls/typography/select2.min.css', null );
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 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 );
includes/metabox/butterbean/css/butterbean.css CHANGED
@@ -265,9 +265,21 @@ body .butterbean-manager .butterbean-content .select2-container .select2-selecti
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.oceanwp-select2 { background-color: #f5f5f5; border-color: rgba(0, 0, 0, 0.05); border-radius: 0; }
269
- .select2-container--default .oceanwp-select2 .select2-results__option[aria-selected=true] { background-color: #eaeaea; }
270
- .select2-container--default .oceanwp-select2 .select2-results__option--highlighted[aria-selected] { background-color: #5897fb; }
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  /* Buttonset */
273
  body .butterbean-manager .butterbean-content .butterbean-buttonset { display: inline-block; margin: 0; border: 1px solid rgba(0, 0, 0, 0.1); }
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); }
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.oceanwp-select2{background-color:#f5f5f5;border-color:rgba(0,0,0,.05);border-radius:0}.select2-container--default .oceanwp-select2 .select2-results__option[aria-selected=true]{background-color:#eaeaea}.select2-container--default .oceanwp-select2 .select2-results__option--highlighted[aria-selected]{background-color:#5897fb}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{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}}
includes/metabox/butterbean/css/select2.css ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1 @@
 
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/js/butterbean.js CHANGED
@@ -956,8 +956,7 @@ window.butterbean = window.butterbean || {};
956
  ready : function() {
957
 
958
  jQuery( this.$el ).find( '.butterbean-select' ).oceanwpSelect2( {
959
- minimumResultsForSearch: 10,
960
- dropdownCssClass: 'oceanwp-select2'
961
  } );
962
  }
963
  } );
956
  ready : function() {
957
 
958
  jQuery( this.$el ).find( '.butterbean-select' ).oceanwpSelect2( {
959
+ minimumResultsForSearch: 10
 
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,dropdownCssClass:"oceanwp-select2"})}}),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").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:""})}})}}();
includes/metabox/butterbean/js/select2.js ADDED
@@ -0,0 +1,6454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,3 @@
 
 
 
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/panel/assets/img/modal-window-image.png ADDED
Binary file
includes/panel/extensions.php CHANGED
@@ -140,6 +140,13 @@ class OceanWP_Extensions {
140
  'desc' => esc_html__( 'Display your latest posts in a beautiful slider with different options.', 'ocean-extra' ),
141
  );
142
 
 
 
 
 
 
 
 
143
  // Affiliate link
144
  $ref_url = '';
145
  $aff_ref = apply_filters( 'ocean_affiliate_ref', $ref_url ); ?>
140
  'desc' => esc_html__( 'Display your latest posts in a beautiful slider with different options.', 'ocean-extra' ),
141
  );
142
 
143
+ $free['modal-window'] = array(
144
+ 'url' => 'https://oceanwp.org/extension/ocean-modal-window/',
145
+ 'image' => plugins_url( '/assets/img/modal-window-image.png', __FILE__ ),
146
+ 'name' => esc_html__( 'Modal Window', 'ocean-extra' ),
147
+ 'desc' => esc_html__( 'Insert any content in a modals and place the opening button anywhere to open it.', 'ocean-extra' ),
148
+ );
149
+
150
  // Affiliate link
151
  $ref_url = '';
152
  $aff_ref = apply_filters( 'ocean_affiliate_ref', $ref_url ); ?>
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.4.2
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.4.2';
90
 
91
  define( 'OE_PATH', $this->plugin_path );
92
  define( 'OE_VERSION', $this->version );
@@ -97,6 +97,10 @@ final class Ocean_Extra {
97
  add_action( 'init', array( $this, 'oe_load_plugin_textdomain' ) );
98
 
99
  add_action( 'init', array( $this, 'oe_setup' ) );
 
 
 
 
100
  }
101
 
102
  /**
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
  $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 );
97
  add_action( 'init', array( $this, 'oe_load_plugin_textdomain' ) );
98
 
99
  add_action( 'init', array( $this, 'oe_setup' ) );
100
+
101
+ // Allow for the use of shortcodes in the WordPress excerpt
102
+ add_filter( 'the_excerpt', 'shortcode_unautop' );
103
+ add_filter( 'the_excerpt', 'do_shortcode' );
104
  }
105
 
106
  /**
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.4.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -33,6 +33,13 @@ This plugin will only work with the [OceanWP](https://oceanwp.org/) theme.
33
 
34
  == Changelog ==
35
 
 
 
 
 
 
 
 
36
  = 1.1.4.2 =
37
  - Color picker script moved to use it in all metaboxes.
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.5.1
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.5.1 =
37
+ - Error 500 fixed.
38
+
39
+ = 1.1.5 =
40
+ - Ocean Modal Window added in the extension tab.
41
+ - Issue with select on the admin product page fixed.
42
+
43
  = 1.1.4.2 =
44
  - Color picker script moved to use it in all metaboxes.
45